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

Miklos Vajna vmiklos at collabora.co.uk
Tue Nov 26 07:33:41 PST 2013


 oox/source/drawingml/shape.cxx                |    2 +-
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx      |    5 +++++
 sw/source/core/docnode/nodedump.cxx           |    8 ++++----
 writerfilter/source/dmapper/GraphicImport.cxx |   12 ++++++++++++
 4 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 3507ffabfe677463f082acca9b592d8eb947a890
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 26 16:29:39 2013 +0100

    SwRedlineTbl::dumpAsXml: -Werror=format
    
    Change-Id: I703009efb476b20f2fca8d87e14a15c28632a5be

diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 5728554..5934911 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -487,14 +487,14 @@ void SwRedlineTbl::dumpAsXml( xmlTextWriterPtr w )
                     //writer.writeFormatAttribute( "ptr", "%p", &pStartSwNode );
                     //writer.writeFormatAttribute( "type", "%d", pStartSwNode.GetNodeType() );
                     //writer.endElement( );    // swnode
-                    writer.writeFormatAttribute( "swnode_type", "%d", pStartSwNode.GetNodeType() );
+                    writer.writeFormatAttribute( "swnode_type", TMP_FORMAT, pStartSwNode.GetNodeType() );
 
                     const SwIndex&    pStartContent   = pStart->nContent;
                     //writer.startElement( "swindex" );
                     //writer.writeFormatAttribute( "ptr", "%p", &pStartContent );
                     //writer.writeFormatAttribute( "content_index", "%d", pStartContent.GetIndex() );
                     //writer.endElement( );    // swindex
-                    writer.writeFormatAttribute( "swindex_content_index", "%d", pStartContent.GetIndex() );
+                    writer.writeFormatAttribute( "swindex_content_index", TMP_FORMAT, pStartContent.GetIndex() );
                 }
                 //writer.endElement( );    // swnodeindex
             }
@@ -527,14 +527,14 @@ void SwRedlineTbl::dumpAsXml( xmlTextWriterPtr w )
                     //writer.writeFormatAttribute( "ptr", "%p", &pEndSwNode );
                     //writer.writeFormatAttribute( "type", "%d", pEndSwNode.GetNodeType() );
                     //writer.endElement( );    // swnode
-                    writer.writeFormatAttribute( "swnode_type", "%d", pEndSwNode.GetNodeType() );
+                    writer.writeFormatAttribute( "swnode_type", TMP_FORMAT, pEndSwNode.GetNodeType() );
 
                     const SwIndex&    pEndContent   = pEnd->nContent;
                     //writer.startElement( "swindex" );
                     //writer.writeFormatAttribute( "ptr", "%p", &pEndContent );
                     //writer.writeFormatAttribute( "content_index", "%d", pEndContent.GetIndex() );
                     //writer.endElement( );    // swindex
-                    writer.writeFormatAttribute( "swindex_content_index", "%d", pEndContent.GetIndex() );
+                    writer.writeFormatAttribute( "swindex_content_index", TMP_FORMAT, pEndContent.GetIndex() );
                 }
                 //writer.endElement( );    // swnodeindex
             }
commit 0205f0a2712f0bbc3629b1cc8590105d5dcf11db
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 26 16:24:13 2013 +0100

    DOCX drawingML shape import: initial wps:txbx positioning
    
    Change-Id: Id779ed88d657257b614d910a2191ed4974612c8f

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index aaf7128..1f7d559 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -623,7 +623,7 @@ Reference< XShape > Shape::createAndInsert(
         // These can have a custom geometry, so position should be set here,
         // after creation but before custom shape handling, using the position
         // we got from the caller.
-        if (mbWps)
+        if (mbWps && aServiceName != "com.sun.star.text.TextFrame")
             mxShape->setPosition(maPosition);
 
         if( bIsCustomShape )
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 8f6e931..551d743 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1539,6 +1539,11 @@ DECLARE_OOXMLIMPORT_TEST(textboxWpsOnly, "textbox-wps-only.docx")
     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString("Hello world!"), xFrame->getString());
+
+    // Position was the default (hori center, vert top) for the textbox.
+    xFrame.set(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2173), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2805), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index c0fa4b8..fe5ef95 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1004,6 +1004,18 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
                         // This needs to be AT_PARAGRAPH and not AT_CHARACTER, otherwise shape will move when the user inserts a new paragraph.
                         xShapeProps->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_PARAGRAPH));
 
+                        uno::Reference<lang::XServiceInfo> xServiceInfo(m_xShape, uno::UNO_QUERY_THROW);
+                        if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
+                        {
+                            // For non-textframes, this is handled already in oox::drawingml::Shape::createAndInsert().
+                            xShapeProps->setPropertyValue("HoriOrient", uno::makeAny(text::HoriOrientation::NONE));
+                            xShapeProps->setPropertyValue("VertOrient", uno::makeAny(text::VertOrientation::NONE));
+                            xShapeProps->setPropertyValue("HoriOrientPosition", uno::makeAny(m_pImpl->nLeftPosition));
+                            xShapeProps->setPropertyValue("VertOrientPosition", uno::makeAny(m_pImpl->nTopPosition));
+                            xShapeProps->setPropertyValue("HoriOrientRelation", uno::makeAny(text::RelOrientation::FRAME));
+                            xShapeProps->setPropertyValue("VertOrientRelation", uno::makeAny(text::RelOrientation::FRAME));
+                        }
+
                         m_pImpl->applyMargins(xShapeProps);
                         bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter();
                         if (!bOpaque)


More information about the Libreoffice-commits mailing list