[Libreoffice-commits] core.git: 2 commits - oox/source sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Mon Dec 9 05:02:19 PST 2013


 oox/source/drawingml/shapecontext.cxx                   |   21 +++++++++++++---
 oox/source/drawingml/textcharacterpropertiescontext.cxx |    1 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                |    3 ++
 3 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 826d133ccfdf20bb9e317715c726c4a562674b0b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Dec 9 13:54:37 2013 +0100

    drawingml import: handle w:b (found in docx groupshape textboxes)
    
    Change-Id: I105d068a6b8d454fac963cd30f6f812cf2b96170

diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx
index 7966482..cf844d3 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ b/oox/source/drawingml/shapecontext.cxx
@@ -114,6 +114,8 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const
             mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
         return new TextBodyPropertiesContext( *this, rAttribs, mpShapePtr->getTextBody()->getTextProperties() );
         break;
+    case XML_txbx:
+        break;
     default:
         SAL_WARN("oox", "ShapeContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
         break;
diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index 12362b9..d873c44 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -133,6 +133,7 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
         case OOX_TOKEN( doc, rFonts ):
             break;
         case OOX_TOKEN( doc, b ):
+            mrTextCharacterProperties.moBold = rAttribs.getBool(OOX_TOKEN( doc, val ), true);
             break;
         case OOX_TOKEN( doc, bCs ):
             break;
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index cc93d5b..5da974f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -11,6 +11,7 @@
 #if !defined(WNT)
 
 #include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
 #include <com/sun/star/drawing/XControlShape.hpp>
@@ -1614,6 +1615,7 @@ DECLARE_OOXMLIMPORT_TEST(testMceNested, "mce-nested.docx")
     uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText, "[Year]");
     CPPUNIT_ASSERT_EQUAL(48.f, getProperty<float>(getRun(xParagraph, 1), "CharHeight"));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"));
+    CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(xParagraph, 1), "CharWeight"));
     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xGroup->getByIndex(1), "TextVerticalAdjust"));
 }
 
commit f5b3a728cec51cedc985e60bdd25f8f5484b7e14
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Dec 9 13:35:39 2013 +0100

    drawingml import: handle wps:bodyPr inside a groupshape
    
    Change-Id: I1f059ae653ab13a7c867f77b2b1b4265e9e71b4e

diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx
index 7d6971f..7966482 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ b/oox/source/drawingml/shapecontext.cxx
@@ -31,6 +31,7 @@
 #include "oox/drawingml/drawingmltypes.hxx"
 #include "oox/drawingml/customshapegeometry.hxx"
 #include "oox/drawingml/textbodycontext.hxx"
+#include "oox/drawingml/textbodypropertiescontext.hxx"
 #include "hyperlinkcontext.hxx"
 
 using namespace oox::core;
@@ -95,15 +96,27 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const
     case XML_txBody:
     case XML_txbxContent:
     {
-        TextBodyPtr xTextBody( new TextBody );
-        mpShapePtr->setTextBody( xTextBody );
-        return new TextBodyContext( *this, *xTextBody );
+        if (!mpShapePtr->getTextBody())
+            mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
+        return new TextBodyContext( *this, *mpShapePtr->getTextBody() );
     }
     case XML_txXfrm:
     {
         mpShapePtr->getTextBody()->getTextProperties().moRotation = rAttribs.getInteger( XML_rot );
         break;
     }
+    case XML_cNvSpPr:
+        break;
+    case XML_spLocks:
+        break;
+    case XML_bodyPr:
+        if (!mpShapePtr->getTextBody())
+            mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
+        return new TextBodyPropertiesContext( *this, rAttribs, mpShapePtr->getTextBody()->getTextProperties() );
+        break;
+    default:
+        SAL_WARN("oox", "ShapeContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
+        break;
     }
 
     return this;
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 7223179..cc93d5b 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1614,6 +1614,7 @@ DECLARE_OOXMLIMPORT_TEST(testMceNested, "mce-nested.docx")
     uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText, "[Year]");
     CPPUNIT_ASSERT_EQUAL(48.f, getProperty<float>(getRun(xParagraph, 1), "CharHeight"));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"));
+    CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xGroup->getByIndex(1), "TextVerticalAdjust"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")


More information about the Libreoffice-commits mailing list