dev/null                                              |binary
 include/oox/shape/ShapeContextHandler.hxx             |    5 
 oox/source/drawingml/shape.cxx                        |    2 
 oox/source/shape/ShapeContextHandler.cxx              |    8 -
 oox/source/shape/WpgContext.cxx                       |   45 +-----
 oox/source/shape/WpgContext.hxx                       |    8 -
 sw/inc/textboxhelper.hxx                              |    3 
 sw/inc/unomid.h                                       |    3 
 sw/inc/unoprnms.hxx                                   |    1 
 sw/qa/extras/layout/layout2.cxx                       |   41 ------
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx            |   21 ---
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx             |    7 -
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx             |    2 
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx             |    4 
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx             |    7 -
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx             |    7 -
 sw/source/core/doc/textboxhelper.cxx                  |  121 ------------------
 sw/source/core/unocore/unodraw.cxx                    |   62 ++-------
 sw/source/core/unocore/unomap.cxx                     |    3 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    4 
 20 files changed, 46 insertions(+), 308 deletions(-)

New commits:
commit f7862a66d60fe12f4a46cb014fc504460205da18
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Apr 12 09:12:54 2023 -0400
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Apr 12 21:33:17 2023 +0200

    Revert "tdf#143574 sw: textboxes in group shapes -- part 4"
    
    This reverts commit d4b87c11b451cb08aa950e09efed3cc6fa1422f3.
    
    It was added for T38690 and removed for T41585
    
    Change-Id: Ifc3fed831dc321f4b27cff295037b525768e3e55
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150295
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 1a0cadabc0e9..924b3e6b5c91 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -60,9 +60,6 @@ public:
     /// the original text in the shape will be copied to the frame
     /// The textbox is created for the shape given by the pObject parameter.
     static void create(SwFrameFormat* pShape, SdrObject* pObject, bool 
bCopyText = false);
-    /// Sets the given textframe as textbox for the given (group member) shape.
-    static void set(SwFrameFormat* pShape, SdrObject* pObject,
-                    css::uno::Reference<css::text::XTextFrame> xNew);
     /// Destroy a TextBox for a shape. If the format has more textboxes
     /// like group shapes, it will destroy only that textbox what belongs
     /// to the given pObject shape.
diff --git a/sw/inc/unomid.h b/sw/inc/unomid.h
index 9f413509ae1c..d249b32fc25a 100644
--- a/sw/inc/unomid.h
+++ b/sw/inc/unomid.h
@@ -151,9 +151,6 @@
 // SwFormatFollowTextFlow
 #define MID_FOLLOW_TEXT_FLOW    0
 
-#define MID_TEXT_BOX            0
-#define MID_TEXT_BOX_CONTENT    1
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index bb3ee1f47b3c..3a8df7c69182 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -74,7 +74,6 @@
 #define UNO_NAME_FOOTER_RIGHT_MARGIN "FooterRightMargin"
 #define UNO_NAME_TEXT_RANGE "TextRange"
 #define UNO_NAME_TEXT_BOX "TextBox"
-#define UNO_NAME_TEXT_BOX_CONTENT "TextBoxContent"
 #define UNO_NAME_NAME "Name"
 #define UNO_NAME_CHAR_STYLE_NAME "CharStyleName"
 #define UNO_NAME_ANCHOR_CHAR_STYLE_NAME "AnchorCharStyleName"
diff --git a/sw/qa/extras/layout/data/TextBoxFrame.odt 
b/sw/qa/extras/layout/data/TextBoxFrame.odt
deleted file mode 100644
index a6155e34fdfb..000000000000
Binary files a/sw/qa/extras/layout/data/TextBoxFrame.odt and /dev/null differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 6635d13c0ef9..9c656a6808ba 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -1647,47 +1647,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf141220)
     CPPUNIT_ASSERT_LESS(static_cast<sal_Int32>(15), nTextBoxTop - nShapeTop);
 }
 
-CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, TestTextBoxChangeViaUNO)
-{
-    CPPUNIT_ASSERT(createSwDoc(DATA_DIRECTORY, "TextBoxFrame.odt"));
-    // this file has a shape and a frame inside. Try to set up
-    // the frame for the shape as textbox. Before this was not
-    // implemented. This will be necesary for proper WPG import.
-
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("There must be a shape and a frame!", 2, 
getShapes());
-
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("This must be a custom shape!",
-                                 OUString("com.sun.star.drawing.CustomShape"),
-                                 getShape(1)->getShapeType());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("This must be a frame shape!", 
OUString("FrameShape"),
-                                 getShape(2)->getShapeType());
-
-    CPPUNIT_ASSERT_MESSAGE("This is not supposed to be a textbox!",
-                           !uno::Reference<beans::XPropertySet>(getShape(1), 
uno::UNO_QUERY_THROW)
-                                ->getPropertyValue("TextBox")
-                                .get<bool>());
-    // Without the fix it will crash at this line:
-    CPPUNIT_ASSERT_MESSAGE("This is not supposed to be a textbox!",
-                           !uno::Reference<beans::XPropertySet>(getShape(1), 
uno::UNO_QUERY_THROW)
-                                ->getPropertyValue("TextBoxContent")
-                                .hasValue());
-
-    // So now set the frame as textbox for the shape!
-    uno::Reference<beans::XPropertySet>(getShape(1), uno::UNO_QUERY_THROW)
-        ->setPropertyValue("TextBoxContent", 
uno::Any(uno::Reference<text::XTextFrame>(
-                                                 getShape(2), 
uno::UNO_QUERY_THROW)));
-
-    CPPUNIT_ASSERT_MESSAGE("This is supposed to be a textbox!",
-                           uno::Reference<beans::XPropertySet>(getShape(1), 
uno::UNO_QUERY_THROW)
-                               ->getPropertyValue("TextBox")
-                               .get<bool>());
-
-    CPPUNIT_ASSERT_MESSAGE("This is supposed to be a textbox!",
-                           uno::Reference<beans::XPropertySet>(getShape(1), 
uno::UNO_QUERY_THROW)
-                               ->getPropertyValue("TextBoxContent")
-                               .hasValue());
-}
-
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf121509)
 {
     auto pDoc = createSwDoc(DATA_DIRECTORY, "Tdf121509.odt");
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 1b9155f9b6e8..7889fd443b89 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -199,127 +199,6 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, 
SdrObject* pObject, bool bCo
     }
 }
 
-void SwTextBoxHelper::set(SwFrameFormat* pShapeFormat, SdrObject* pObj,
-                          uno::Reference<text::XTextFrame> xNew)
-{
-    // Do not set invalid data
-    assert(pShapeFormat && pObj && xNew);
-    // Firstly find the format of the new textbox.
-    SwFrameFormat* pFormat = nullptr;
-    if (auto pTextFrame = dynamic_cast<SwXTextFrame*>(xNew.get()))
-        pFormat = pTextFrame->GetFrameFormat();
-    if (!pFormat)
-        return;
-    std::vector<std::pair<beans::Property, uno::Any>> aOldProps;
-    // If there is a format, check if the shape already has a textbox assigned 
to.
-    if (auto pTextBoxNode = pShapeFormat->GetOtherTextBoxFormat())
-    {
-        // If it has a texbox, destroy it.
-        if (pTextBoxNode->GetTextBox(pObj))
-        {
-            auto xOldFrame
-                = 
pObj->getUnoShape()->queryInterface(cppu::UnoType<text::XTextRange>::get());
-            if (xOldFrame.hasValue())
-            {
-                uno::Reference<beans::XPropertySet> xOldprops(xOldFrame, 
uno::UNO_QUERY);
-                uno::Reference<beans::XPropertyState> 
xOldPropStates(xOldFrame, uno::UNO_QUERY);
-                for (auto& rProp : 
xOldprops->getPropertySetInfo()->getProperties())
-                {
-                    try
-                    {
-                        if (xOldPropStates->getPropertyState(rProp.Name)
-                            == 
beans::PropertyState::PropertyState_DIRECT_VALUE)
-                            aOldProps.push_back(
-                                std::pair(rProp, 
xOldprops->getPropertyValue(rProp.Name)));
-                    }
-                    catch (...)
-                    {
-                    }
-                }
-            }
-            destroy(pShapeFormat, pObj);
-        }
-        // And set the new one.
-        pTextBoxNode->AddTextBox(pObj, pFormat);
-        pFormat->SetOtherTextBoxFormat(pTextBoxNode);
-    }
-    else
-    {
-        // If the shape do not have a texbox node and textbox,
-        // create that for the shape.
-        auto* pTextBox = new SwTextBoxNode(pShapeFormat);
-        pTextBox->AddTextBox(pObj, pFormat);
-        pShapeFormat->SetOtherTextBoxFormat(pTextBox);
-        pFormat->SetOtherTextBoxFormat(pTextBox);
-    }
-    // Initialize its properties
-    uno::Reference<beans::XPropertySet> xPropertySet(xNew, uno::UNO_QUERY);
-    uno::Any aEmptyBorder = uno::makeAny(table::BorderLine2());
-    xPropertySet->setPropertyValue(UNO_NAME_TOP_BORDER, aEmptyBorder);
-    xPropertySet->setPropertyValue(UNO_NAME_BOTTOM_BORDER, aEmptyBorder);
-    xPropertySet->setPropertyValue(UNO_NAME_LEFT_BORDER, aEmptyBorder);
-    xPropertySet->setPropertyValue(UNO_NAME_RIGHT_BORDER, aEmptyBorder);
-    xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, 
uno::makeAny(sal_Int32(100)));
-    xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, 
uno::makeAny(text::SizeType::FIX));
-    xPropertySet->setPropertyValue(UNO_NAME_SURROUND, 
uno::makeAny(text::WrapTextMode_THROUGH));
-    // Add a new name to it
-    uno::Reference<container::XNamed> xNamed(xNew, uno::UNO_QUERY);
-    xNamed->setName(pShapeFormat->GetDoc()->GetUniqueFrameName());
-    // And sync. properties.
-    uno::Reference<drawing::XShape> xShape(pObj->getUnoShape(), 
uno::UNO_QUERY);
-    syncProperty(pShapeFormat, RES_FRM_SIZE, MID_FRMSIZE_SIZE, 
uno::makeAny(xShape->getSize()),
-                 pObj);
-    uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, 
uno::UNO_QUERY);
-    syncProperty(pShapeFormat, RES_ANCHOR, MID_ANCHOR_ANCHORTYPE,
-                 xShapePropertySet->getPropertyValue(UNO_NAME_ANCHOR_TYPE), 
pObj);
-    syncProperty(pShapeFormat, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT,
-                 xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT), 
pObj);
-    syncProperty(pShapeFormat, RES_HORI_ORIENT, MID_HORIORIENT_RELATION,
-                 
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION), pObj);
-    syncProperty(pShapeFormat, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT,
-                 xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT), 
pObj);
-    syncProperty(pShapeFormat, RES_VERT_ORIENT, MID_VERTORIENT_RELATION,
-                 
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION), pObj);
-    syncProperty(pShapeFormat, RES_HORI_ORIENT, MID_HORIORIENT_POSITION,
-                 
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION), pObj);
-    syncProperty(pShapeFormat, RES_VERT_ORIENT, MID_VERTORIENT_POSITION,
-                 
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION), pObj);
-    syncProperty(pShapeFormat, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT,
-                 
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT), pObj);
-    drawing::TextVerticalAdjust aVertAdj = drawing::TextVerticalAdjust_CENTER;
-    if ((uno::Reference<beans::XPropertyState>(xShape, uno::UNO_QUERY_THROW))
-            ->getPropertyState(UNO_NAME_TEXT_VERT_ADJUST)
-        != beans::PropertyState::PropertyState_DEFAULT_VALUE)
-    {
-        aVertAdj = 
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST)
-                       .get<drawing::TextVerticalAdjust>();
-    }
-    xPropertySet->setPropertyValue(UNO_NAME_TEXT_VERT_ADJUST, 
uno::makeAny(aVertAdj));
-    text::WritingMode eMode;
-    if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= 
eMode)
-        syncProperty(pShapeFormat, RES_FRAMEDIR, 0, 
uno::makeAny(sal_Int16(eMode)), pObj);
-    if (aOldProps.size())
-    {
-        for (auto& rProp : aOldProps)
-        {
-            try
-            {
-                xPropertySet->setPropertyValue(rProp.first.Name, rProp.second);
-            }
-            catch (...)
-            {
-            }
-        }
-    }
-    if (pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
-        && pFormat->GetAnchor().GetPageNum() == 0)
-    {
-        pFormat->SetFormatAttr(SwFormatAnchor(RndStdIds::FLY_AT_PAGE, 1));
-    }
-    // Do sync for the new textframe.
-    synchronizeGroupTextBoxProperty(&changeAnchor, pShapeFormat, pObj);
-}
-
 void SwTextBoxHelper::destroy(const SwFrameFormat* pShape, const SdrObject* 
pObject)
 {
     // If a TextBox was enabled previously
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index 1104df24085a..4d0b404e9a1c 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1164,29 +1164,18 @@ void SwXShape::setPropertyValue(const OUString& 
rPropertyName, const uno::Any& a
             }
             else if (pEntry->nWID == FN_TEXT_BOX)
             {
-                if (pEntry->nMemberId == MID_TEXT_BOX)
-                {
-                    bool bValue(false);
-                    aValue >>= bValue;
-                    if (bValue)
-                        SwTextBoxHelper::create(pFormat, 
GetSvxShape()->GetSdrObject());
-                    else
-                        SwTextBoxHelper::destroy(pFormat, 
GetSvxShape()->GetSdrObject());
-                }
-                else if (pEntry->nMemberId == MID_TEXT_BOX_CONTENT)
-                {
-                    if (aValue.getValueType() == 
cppu::UnoType<uno::Reference<text::XTextFrame>>::get())
-                        SwTextBoxHelper::set(pFormat, 
GetSvxShape()->GetSdrObject(),
-                                             
aValue.get<uno::Reference<text::XTextFrame>>());
-                    else
-                        SAL_WARN( "sw.uno", "This is not a TextFrame!" );
-                }
+                bool bValue(false);
+                aValue >>= bValue;
+                if (bValue)
+                    SwTextBoxHelper::create(pFormat, 
GetSvxShape()->GetSdrObject());
+                else
+                    SwTextBoxHelper::destroy(pFormat, 
GetSvxShape()->GetSdrObject());
+
             }
             else if (pEntry->nWID == RES_CHAIN)
             {
                 if (pEntry->nMemberId == MID_CHAIN_NEXTNAME || 
pEntry->nMemberId == MID_CHAIN_PREVNAME)
-                    SwTextBoxHelper::syncProperty(pFormat, pEntry->nWID, 
pEntry->nMemberId, aValue,
-                                                  
SdrObject::getSdrObjectFromXShape(mxShape));
+                    SwTextBoxHelper::syncProperty(pFormat, pEntry->nWID, 
pEntry->nMemberId, aValue);
             }
             // #i28749#
             else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
@@ -1357,8 +1346,7 @@ void SwXShape::setPropertyValue(const OUString& 
rPropertyName, const uno::Any& a
                     pFormat->SetFormatAttr(aSet);
             }
             // We have a pFormat and a pEntry as well: try to sync TextBox 
property.
-            SwTextBoxHelper::syncProperty(pFormat, pEntry->nWID, 
pEntry->nMemberId, aValue,
-                                          
SdrObject::getSdrObjectFromXShape(mxShape));
+            SwTextBoxHelper::syncProperty(pFormat, pEntry->nWID, 
pEntry->nMemberId, aValue);
         }
         else
         {
@@ -1448,8 +1436,7 @@ void SwXShape::setPropertyValue(const OUString& 
rPropertyName, const uno::Any& a
         if (pFormat)
         {
             // We have a pFormat (but no pEntry): try to sync TextBox property.
-            SwTextBoxHelper::syncProperty(pFormat, rPropertyName, aValue,
-                                          
SdrObject::getSdrObjectFromXShape(mxShape));
+            SwTextBoxHelper::syncProperty(pFormat, rPropertyName, aValue);
         }
 
         // #i31698# - restore object position, if caption point is set.
@@ -1530,25 +1517,12 @@ uno::Any SwXShape::getPropertyValue(const OUString& 
rPropertyName)
                 }
                 else if (pEntry->nWID == FN_TEXT_BOX)
                 {
-                    if (pEntry->nMemberId == MID_TEXT_BOX)
-                    {
-                        auto pSvxShape = GetSvxShape();
-                        bool bValue = SwTextBoxHelper::isTextBox(
-                            pFormat, RES_DRAWFRMFMT,
-                            ((pSvxShape && pSvxShape->GetSdrObject()) ? 
pSvxShape->GetSdrObject()
-                                : pFormat->FindRealSdrObject()));
-                        aRet <<= bValue;
-                    }
-                    else if (pEntry->nMemberId == MID_TEXT_BOX_CONTENT)
-                    {
-                        auto pObj = SdrObject::getSdrObjectFromXShape(mxShape);
-                        auto xRange = SwTextBoxHelper::queryInterface(
-                            pFormat, cppu::UnoType<text::XText>::get(),
-                            pObj ? pObj : pFormat->FindRealSdrObject());
-                        uno::Reference<text::XTextFrame> xFrame(xRange, 
uno::UNO_QUERY);
-                        if (xFrame.is())
-                            aRet <<= xFrame;
-                    }
+                    auto pSvxShape = GetSvxShape();
+                    bool bValue = SwTextBoxHelper::isTextBox(
+                        pFormat, RES_DRAWFRMFMT,
+                        ((pSvxShape && pSvxShape->GetSdrObject()) ? 
pSvxShape->GetSdrObject()
+                                                                  : 
pFormat->FindRealSdrObject()));
+                    aRet <<= bValue;
                 }
                 else if (pEntry->nWID == RES_CHAIN)
                 {
@@ -1829,9 +1803,7 @@ uno::Sequence< beans::PropertyState > 
SwXShape::getPropertyStates(
             else if (pEntry->nWID == FN_TEXT_BOX)
             {
                 // The TextBox property is set, if we can find a textbox for 
this shape.
-                if (pFormat
-                    && SwTextBoxHelper::isTextBox(pFormat, RES_DRAWFRMFMT,
-                                                  
SdrObject::getSdrObjectFromXShape(mxShape)))
+                if (pFormat && SwTextBoxHelper::isTextBox(pFormat, 
RES_DRAWFRMFMT))
                     pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
                 else
                     pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
diff --git a/sw/source/core/unocore/unomap.cxx 
b/sw/source/core/unocore/unomap.cxx
index db62cc990d69..abad86f1ce65 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -291,8 +291,7 @@ const SfxItemPropertyMapEntry* 
SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                     { u"" UNO_NAME_RELATIVE_HEIGHT_RELATION, RES_FRM_SIZE, 
cppu::UnoType<sal_Int16>::get(),      PROPERTY_NONE, 
MID_FRMSIZE_REL_HEIGHT_RELATION },
                     { u"" UNO_NAME_RELATIVE_WIDTH, RES_FRM_SIZE,      
cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH 
 },
                     { u"" UNO_NAME_RELATIVE_WIDTH_RELATION, RES_FRM_SIZE, 
cppu::UnoType<sal_Int16>::get(),       PROPERTY_NONE, 
MID_FRMSIZE_REL_WIDTH_RELATION },
-                    { u"" UNO_NAME_TEXT_BOX, FN_TEXT_BOX, 
cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_TEXT_BOX},
-                    { u"" UNO_NAME_TEXT_BOX_CONTENT, FN_TEXT_BOX, 
cppu::UnoType<text::XTextFrame>::get(), PROPERTY_NONE, MID_TEXT_BOX_CONTENT},
+                    { u"" UNO_NAME_TEXT_BOX, FN_TEXT_BOX, 
cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
                     { u"" UNO_NAME_CHAIN_NEXT_NAME, RES_CHAIN,                
cppu::UnoType<OUString>::get(),            PropertyAttribute::MAYBEVOID 
,MID_CHAIN_NEXTNAME},
                     { u"" UNO_NAME_CHAIN_PREV_NAME, RES_CHAIN,                
cppu::UnoType<OUString>::get(),            PropertyAttribute::MAYBEVOID 
,MID_CHAIN_PREVNAME},
                     { u"" UNO_NAME_CHAIN_NAME,      RES_CHAIN,                
cppu::UnoType<OUString>::get(),            PropertyAttribute::MAYBEVOID 
,MID_CHAIN_NAME    },
commit 6ca9e2f8b1c7df254516bc62aa7f8a72743d2aa6
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Apr 12 10:14:39 2023 -0400
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Apr 12 21:33:09 2023 +0200

    Revert "tdf#143574 OOXML export/import of textboxes in group shapes"
    
    This reverts commit b5034017e566cd4e5a236bf59555196598fd01cf.
    
    It was added for T38690 and removed for T41585
    
    Change-Id: Icca77965ddeece69c01129aebb7b4af3092cd85f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150294
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/include/oox/shape/ShapeContextHandler.hxx 
b/include/oox/shape/ShapeContextHandler.hxx
index fcd713e4c5a6..dadaf7f64cb3 100644
--- a/include/oox/shape/ShapeContextHandler.hxx
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -96,9 +96,6 @@ public:
 
     void setPosition(const css::awt::Point& rPosition);
 
-    const bool& getFullWPGSupport() { return m_bFullWPGSUpport; };
-    void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; };
-
     void setDocumentProperties(const 
css::uno::Reference<css::document::XDocumentProperties>& xDocProps);
     void setMediaDescriptor(const 
css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor);
 
@@ -113,7 +110,7 @@ private:
 
     ::sal_uInt32 mnStartToken;
     css::awt::Point maPosition;
-    bool m_bFullWPGSUpport;
+
     drawingml::ShapePtr mpShape;
     std::shared_ptr< vml::Drawing > mpDrawing;
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 92b8f18cb175..2f4a85854dba 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1569,7 +1569,7 @@ Reference< XShape > const & 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 && aServiceName == "com.sun.star.drawing.LineShape" && 
!pParentGroupShape)
+        if (mbWps && aServiceName == "com.sun.star.drawing.LineShape")
             mxShape->setPosition(maPosition);
 
         if( bIsCustomShape )
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 8aa5aad6d869..09b7d8613ce9 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -47,9 +47,7 @@ using namespace drawingml;
 
 ShapeContextHandler::ShapeContextHandler(const 
rtl::Reference<ShapeFilterBase>& xFilterBase) :
   mnStartToken(0),
-  m_bFullWPGSUpport(false),
   mxShapeFilterBase(xFilterBase)
-
 {
 }
 
@@ -141,12 +139,8 @@ uno::Reference<xml::sax::XFastContextHandler> const & 
ShapeContextHandler::getWp
         switch (getBaseToken(nElement))
         {
             case XML_wgp:
-            {
-                rtl::Reference<WpgContext> rContext = new 
WpgContext(*rFragmentHandler, oox::drawingml::ShapePtr());
-                rContext->setFullWPGSupport(m_bFullWPGSUpport);
-                
mxWpgContext.set(static_cast<oox::core::ContextHandler*>(rContext.get()));
+                mxWpgContext.set(static_cast<oox::core::ContextHandler*>(new 
WpgContext(*rFragmentHandler)));
                 break;
-            }
             default:
                 break;
         }
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
index cf65491e0f26..7896f8a4c81d 100644
--- a/oox/source/shape/WpgContext.cxx
+++ b/oox/source/shape/WpgContext.cxx
@@ -8,7 +8,6 @@
  */
 
 #include "WpgContext.hxx"
-#include "WpsContext.hxx"
 #include <sal/log.hxx>
 #include <drawingml/shapepropertiescontext.hxx>
 #include <oox/drawingml/shapegroupcontext.hxx>
@@ -20,14 +19,11 @@ using namespace com::sun::star;
 
 namespace oox::shape
 {
-WpgContext::WpgContext(FragmentHandler2 const& rParent, 
oox::drawingml::ShapePtr pMaster)
+WpgContext::WpgContext(FragmentHandler2 const& rParent)
     : FragmentHandler2(rParent)
-    , m_bFullWPGSupport(false)
 {
     mpShape = 
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape");
     mpShape->setWps(true);
-    if (pMaster)
-        pMaster->addChild(mpShape);
 }
 
 WpgContext::~WpgContext() = default;
@@ -43,22 +39,14 @@ oox::core::ContextHandlerRef 
WpgContext::onCreateContext(sal_Int32 nElementToken
             return new oox::drawingml::ShapePropertiesContext(*this, *mpShape);
         case XML_wsp:
         {
-            if (m_bFullWPGSupport)
-            {
-                oox::drawingml::ShapePtr pShape = 
std::make_shared<oox::drawingml::Shape>(
-                    "com.sun.star.drawing.CustomShape", 
/*bDefaultHeight=*/false);
-                return new oox::shape::WpsContext(*this, 
uno::Reference<drawing::XShape>(), mpShape,
-                                                  pShape);
-            }
-            else
-            {
-                // Don't set default character height, Writer has its own way 
to set
-                // the default, and if we don't set it here, editeng properly 
inherits
-                // it.
-                oox::drawingml::ShapePtr pShape = 
std::make_shared<oox::drawingml::Shape>(
-                    "com.sun.star.drawing.CustomShape", 
/*bDefaultHeight=*/false);
-                return new oox::drawingml::ShapeContext(*this, mpShape, 
pShape);
-            }
+            // Don't set default character height, Writer has its own way to 
set
+            // the default, and if we don't set it here, editeng properly 
inherits
+            // it.
+            oox::drawingml::ShapePtr pShape = 
std::make_shared<oox::drawingml::Shape>(
+                "com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false);
+            return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
+            // return new oox::shape::WpsContext(*this, 
uno::Reference<drawing::XShape>(),
+            //                                   mpShape, pShape);
         }
         case XML_pic:
             return new oox::drawingml::GraphicShapeContext(
@@ -66,18 +54,9 @@ oox::core::ContextHandlerRef 
WpgContext::onCreateContext(sal_Int32 nElementToken
                 
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"));
         case XML_grpSp:
         {
-            if (m_bFullWPGSupport)
-            {
-                rtl::Reference<WpgContext> pWPGShape = new 
oox::shape::WpgContext(*this, mpShape);
-                pWPGShape->setFullWPGSupport(m_bFullWPGSupport);
-                return pWPGShape;
-            }
-            else
-            {
-                return new oox::drawingml::ShapeGroupContext(
-                    *this, mpShape,
-                    
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape"));
-            }
+            return new oox::drawingml::ShapeGroupContext(
+                *this, mpShape,
+                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape"));
         }
         case XML_graphicFrame:
         {
diff --git a/oox/source/shape/WpgContext.hxx b/oox/source/shape/WpgContext.hxx
index 6da13d9663be..c4b511a923d3 100644
--- a/oox/source/shape/WpgContext.hxx
+++ b/oox/source/shape/WpgContext.hxx
@@ -19,8 +19,7 @@ namespace oox::shape
 class WpgContext final : public oox::core::FragmentHandler2
 {
 public:
-    explicit WpgContext(oox::core::FragmentHandler2 const& rParent,
-                        oox::drawingml::ShapePtr pMaster);
+    explicit WpgContext(oox::core::FragmentHandler2 const& rParent);
     ~WpgContext() override;
 
     oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken,
@@ -28,13 +27,8 @@ public:
 
     const oox::drawingml::ShapePtr& getShape() const { return mpShape; }
 
-    const bool& isFullWPGSupport() { return m_bFullWPGSupport; };
-    void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSupport = rbUse; };
-
 private:
     oox::drawingml::ShapePtr mpShape;
-
-    bool m_bFullWPGSupport;
 };
 }
 
diff --git a/sw/qa/extras/ooxmlexport/data/testWPGtextboxes.docx 
b/sw/qa/extras/ooxmlexport/data/testWPGtextboxes.docx
deleted file mode 100644
index eb7486f2a347..000000000000
Binary files a/sw/qa/extras/ooxmlexport/data/testWPGtextboxes.docx and 
/dev/null differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 42a4b0a234da..4827c8773ebe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -114,25 +114,6 @@ protected:
     }
 };
 
-DECLARE_OOXMLEXPORT_TEST(testWPGtextboxes, "testWPGtextboxes.docx")
-{
-    CPPUNIT_ASSERT_EQUAL(1, getShapes());
-
-    auto MyShape = getShape(1);
-    CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), 
MyShape->getShapeType());
-
-    uno::Reference<drawing::XShapes> xGroup(MyShape, uno::UNO_QUERY_THROW);
-    uno::Reference<beans::XPropertySet> xTriangle(xGroup->getByIndex(0), 
uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShapes> xEmbedGroup(xGroup->getByIndex(1), 
uno::UNO_QUERY_THROW);
-    uno::Reference<beans::XPropertySet> xCircle(xEmbedGroup->getByIndex(0), 
uno::UNO_QUERY_THROW);
-    uno::Reference<beans::XPropertySet> xDiamond(xEmbedGroup->getByIndex(1), 
uno::UNO_QUERY_THROW);
-
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("The circle lost its textbox", true, 
xCircle->getPropertyValue("TextBox").get<bool>());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("The diamond lost its textbox", true, 
xDiamond->getPropertyValue("TextBox").get<bool>());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("The triangle lost its textbox", true, 
xTriangle->getPropertyValue("TextBox").get<bool>());
-
-}
-
 DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
 {
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
@@ -282,7 +263,7 @@ DECLARE_OOXMLEXPORT_TEST(testMceNested, "mce-nested.docx")
     CPPUNIT_ASSERT_EQUAL(48.f, getProperty<float>(getRun(xParagraph, 1), 
"CharHeight"));
     CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(ColorTransparency, 
getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor")));
     CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, 
getProperty<float>(getRun(xParagraph, 1), "CharWeight"));
-    //FIXME: CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, 
getProperty<drawing::TextVerticalAdjust>(xGroup->getByIndex(1), 
"TextVerticalAdjust"));
+    CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, 
getProperty<drawing::TextVerticalAdjust>(xGroup->getByIndex(1), 
"TextVerticalAdjust"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testMissingPath, "missing-path.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index c36761dec09d..a32da9cb88ae 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -109,7 +109,7 @@ DECLARE_OOXMLEXPORT_TEST(testGroupshapeTextbox, 
"groupshape-textbox.docx")
     // The DML export does not, make sure it stays that way.
     CPPUNIT_ASSERT_EQUAL(OUString("first"), xShape->getString());
     // This was 16, i.e. inheriting doc default char height didn't work.
-    CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(getParagraphOfText(1, 
xShape->getText()), "CharHeight"));
+    CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xShape, "CharHeight"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testGroupshapePicture, "groupshape-picture.docx")
@@ -1223,8 +1223,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxTablePosition)
     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpX", 
"3494");
     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", 
"4611");
 }
-#if 0
-// FIXME:
+
 CPPUNIT_TEST_FIXTURE(Test, testUnderlineGroupShapeText)
 {
     loadAndSave("tdf123351_UnderlineGroupSapeText.docx");
@@ -1277,7 +1276,7 @@ CPPUNIT_TEST_FIXTURE(Test, testUnderlineGroupShapeText)
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:p[32]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor"
         
"/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u",
 "val", "single");
 }
-#endif
+
 CPPUNIT_TEST_FIXTURE(Test, testUnderlineColorGroupedShapes)
 {
     loadAndSave("tdf132491_UnderlineColorGroupedShapes.docx");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 11b716f0af55..04c9d7e7d927 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1374,7 +1374,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSpacingGroupShapeText)
     xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
 
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
-        
"/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:spacing",
 "val", "40");
+        
"/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:spacing",
 "val", "71");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf100581)
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 0f5e3b2a540b..61372e9e803e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -120,7 +120,7 @@ DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, 
"dml-textshape.docx")
 
     xShape.set(xGroup->getByIndex(5), uno::UNO_QUERY);
     // This was incorrectly shifted towards the top of the page, Y was 106.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(-4729), xShape->getPosition().Y);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-4725), xShape->getPosition().Y);
 }
 
 // testDmlTextshapeB was only made export-only because as an import-export 
test it failed for an unknown reason
@@ -137,7 +137,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlTextshapeB, 
"dml-textshapeB.docx")
 
     xShape.set(xGroup->getByIndex(5), uno::UNO_QUERY);
     // This was incorrectly shifted towards the top of the page, Y was -5011.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(-4720), xShape->getPosition().Y);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-4717), xShape->getPosition().Y);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testDMLSolidfillAlpha, "dml-solidfill-alpha.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 9f2de7c12dc4..431fdb526713 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -716,7 +716,7 @@ DECLARE_OOXMLEXPORT_TEST(testGroupshapeSmarttag, 
"groupshape-smarttag.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("Box 2"), xShape->getString());
 
     // Font size of the shape text was 10.
-    CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getParagraphOfText(1, 
xShape->getText()), "CharHeight"));
+    CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(xShape->getText(), 
"CharHeight"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testN793262, "n793262.docx")
@@ -1110,8 +1110,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableAutoColumnFixedSize2, 
"table-auto-column-fixed
     // This was 17907, i.e. the sum of the width of the 3 cells (10152 twips 
each), which is too wide.
     CPPUNIT_ASSERT_EQUAL(sal_Int32(16891), getProperty<sal_Int32>(xTextTable, 
"Width"));
 }
-#if 0
-// FIXME:
+
 DECLARE_OOXMLEXPORT_TEST(testFdo46361, "fdo46361.docx")
 {
     uno::Reference<container::XIndexAccess> xGroupShape(getShape(1), 
uno::UNO_QUERY);
@@ -1138,7 +1137,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo46361, "fdo46361.docx")
     xParagraph.set(getParagraphOfText(3, xShapeText->getText(), ""));
     CPPUNIT_ASSERT_MESSAGE("You FIXED me!", style::ParagraphAdjust_LEFT != 
static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xParagraph, 
"ParaAdjust")));
 }
-#endif
+
 DECLARE_OOXMLEXPORT_TEST(testFdo65632, "fdo65632.docx")
 {
     // The problem was that the footnote text had fake redline: only the body
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 232b67ab4056..bf9e298ea4d2 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -900,8 +900,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf129912)
     }
 }
 
-#if 0
-// TODO: Link import in frames in groupshapes.
 CPPUNIT_TEST_FIXTURE(Test, testTdf126426)
 {
     load(mpTestDocumentPath, "tdf126426.docx");
@@ -910,8 +908,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126426)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroup->getCount());
 
     // get second shape in group
-    uno::Reference<text::XTextRange> xRange(xGroup->getByIndex(1), 
uno::UNO_QUERY_THROW);
-    uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xRange,
+    uno::Reference<container::XEnumerationAccess> 
xParaEnumAccess(xGroup->getByIndex(1),
                                                                   
uno::UNO_QUERY_THROW);
     uno::Reference<container::XEnumeration> xParaEnum = 
xParaEnumAccess->createEnumeration();
 
@@ -945,7 +942,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152200)
     load(mpTestDocumentPath, "tdf152200-bad_fldChar_end.docx");
     // Should not crash/hang because of wrong placement of ending fldChar
 }
-#endif
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 24622e14524a..c915cf40c1eb 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1725,10 +1725,6 @@ void OOXMLFastContextHandlerShape::setToken(Token_t 
nToken)
 
     mrShapeContext->setRelationFragmentPath(mpParserState->getTarget());
 
-    // Floating tables (table inside a textframe) have issues with fullWPG,
-    // so disable the fullWPGsupport in tables until that issue is not fixed.
-    mrShapeContext->setFullWPGSupport(!mnTableDepth);
-
     auto xGraphicMapper = getDocument()->getGraphicMapper();
 
     if (xGraphicMapper.is())

Reply via email to