oox/source/vml/vmlshape.cxx                       |   14 ++------------
 sw/qa/extras/ooxmlimport/data/n820504.docx        |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx          |    8 +++++++-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 +-
 4 files changed, 10 insertions(+), 14 deletions(-)

New commits:
commit f5b7acac624f07fa95835b6054b8d295901bb1dd
Author: Miklos Vajna <vmik...@suse.cz>
Date:   Thu Jul 4 10:55:50 2013 +0200

    bnc#820504 VML import: don't anchor shapes TO_PAGE
    
    In theory, this is a problem because Word formats only support AT_CHAR
    and AS_CHAR, so importing something as AT_PAGE is buggy.
    
    In practice, this also leads to unvisible shapes, since
    f0d001a378c64ea457e722266e60c96522c72e9b.
    
    Change-Id: Ie730d67a789ef12734cede1f9b6c27764a66f237

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index f95b7e1..efd5d75 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -456,18 +456,8 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const 
ShapeTypeModel& rTypeModel)
 
     if ( rTypeModel.maPosition == "absolute" )
     {
-        if (rTypeModel.moWrapAnchorX.get() == "page" && 
rTypeModel.moWrapAnchorY.get() == "page")
-        {
-            // I'm not sure if AT_PAGE is always correct here (not sure what 
the parent that
-            // the spec talks about can be), but with Writer SwXDrawPage::add()
-            // always in practice uses this because of 
pDoc->GetCurrentLayout() being NULL at this point.
-            rPropSet.setProperty(PROP_AnchorType, 
text::TextContentAnchorType_AT_PAGE);
-        }
-        else
-        {
-            // Map to as-character by default, that fixes vertical position of 
some textframes.
-            rPropSet.setProperty(PROP_AnchorType, 
text::TextContentAnchorType_AT_CHARACTER);
-        }
+        // Word supports as-character (inline) and at-character only, absolute 
can't be inline.
+        rPropSet.setProperty(PROP_AnchorType, 
text::TextContentAnchorType_AT_CHARACTER);
 
         if ( rTypeModel.maPositionVerticalRelative == "page" )
         {
diff --git a/sw/qa/extras/ooxmlimport/data/n820504.docx 
b/sw/qa/extras/ooxmlimport/data/n820504.docx
index 36279a9..3cc2bfa 100644
Binary files a/sw/qa/extras/ooxmlimport/data/n820504.docx and 
b/sw/qa/extras/ooxmlimport/data/n820504.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d53094e..6d036a8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -532,7 +532,7 @@ void Test::testN764005()
     CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER);
     sal_Bool bValue = sal_True;
     xPropertySet->getPropertyValue("Opaque") >>= bValue;
-    CPPUNIT_ASSERT_EQUAL(sal_False, bValue);
+    CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
 }
 
 void Test::testSmartart()
@@ -1455,6 +1455,12 @@ void Test::testN820504()
     uno::Reference<beans::XPropertySet> 
xStyle(xStylesAccess->getByName("Default Style"), uno::UNO_QUERY);
     // The problem was that the CharColor was set to AUTO (-1) even if we have 
some default char color set
     CPPUNIT_ASSERT_EQUAL(sal_Int32(4040635), getProperty<sal_Int32>(xStyle, 
"CharColor"));
+
+    // Also, the groupshape was anchored at-page instead of at-character
+    // (that's incorrect as Word only supports at-character and as-character).
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, 
getProperty<text::TextContentAnchorType>(xDraws->getByIndex(0), "AnchorType"));
 }
 
 void Test::testFdo43641()
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index af47f15..ded3f89 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1749,7 +1749,7 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
             if (nAnchorType == text::TextContentAnchorType_AT_PAGE)
                 bIsGraphic = false;
 
-            if (nAnchorType != text::TextContentAnchorType_AT_PAGE)
+            if (!m_bInHeaderFooterImport)
                 xProps->setPropertyValue(
                         rPropNameSupplier.GetName( PROP_OPAQUE ),
                         uno::makeAny( true ) );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to