sw/qa/extras/uiwriter/uiwriter.cxx       |   21 ---------------------
 sw/source/core/unocore/unocrsrhelper.cxx |   10 ----------
 2 files changed, 31 deletions(-)

New commits:
commit 6ff386fb693f2cb0e41ba716ac3e8ef38a6693f5
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Mon Nov 21 14:27:08 2022 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Mon Nov 21 14:27:08 2022 +0100

    Revert "sw: check if cursor position is valid before inserting file"
    
    This reverts commit 376f0143d875ef39550f916f209a3a923342c269.

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 7f81222766bf..d11cf4e2d3f8 100755
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -47,7 +47,6 @@
 #include <AnnotationWin.hxx>
 #include "com/sun/star/text/XDefaultNumberingProvider.hpp"
 #include "com/sun/star/awt/FontUnderline.hpp"
-#include <com/sun/star/document/XDocumentInsertable.hpp>
 
 #include <svx/svdpage.hxx>
 #include <svx/svdview.hxx>
@@ -130,7 +129,6 @@ public:
     void testDOCXAutoTextGallery();
     void testWatermarkDOCX();
     void testTdf67238();
-    void testInsertFileInInputFieldException();
     void testFdo75110();
     void testFdo75898();
     void testFdo74981();
@@ -280,7 +278,6 @@ public:
     CPPUNIT_TEST(testDOCXAutoTextGallery);
     CPPUNIT_TEST(testWatermarkDOCX);
     CPPUNIT_TEST(testTdf67238);
-    CPPUNIT_TEST(testInsertFileInInputFieldException);
     CPPUNIT_TEST(testFdo75110);
     CPPUNIT_TEST(testFdo75898);
     CPPUNIT_TEST(testFdo74981);
@@ -562,24 +559,6 @@ void SwUiWriterTest::testBookmarkCopy()
     }
 }
 
-void SwUiWriterTest::testInsertFileInInputFieldException()
-{
-    createDoc();
-    uno::Reference<text::XTextDocument> const xTextDoc(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<text::XText> const xBody(xTextDoc->getText());
-    uno::Reference<lang::XMultiServiceFactory> const xFactory(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<text::XTextCursor> const xCursor(xBody->createTextCursor());
-    uno::Reference<document::XDocumentInsertable> const xInsertable(xCursor, 
uno::UNO_QUERY);
-    uno::Reference<text::XTextContent> const xContent(
-        xFactory->createInstance("com.sun.star.text.textfield.Input"), 
uno::UNO_QUERY);
-    xBody->insertTextContent(xCursor, xContent, false);
-    xCursor->goLeft(1, false);
-    // try to insert some random file
-    OUString const url(m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"fdo75110.odt");
-    // inserting even asserts in debug builds - document model goes invalid 
with input field split across 2 nodes
-    CPPUNIT_ASSERT_THROW(xInsertable->insertDocumentFromURL(url, {}), 
uno::RuntimeException);
-}
-
 void SwUiWriterTest::testTdf67238()
 {
     //create a new writer document
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 4dc38b347e8f..547598423ab7 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -955,16 +955,6 @@ void resetCursorPropertyValue(const 
SfxItemPropertySimpleEntry& rEntry, SwPaM& r
 void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
     const uno::Sequence< beans::PropertyValue >& rOptions)
 {
-    if (SwTextNode const*const pTextNode = 
pUnoCursor->GetPoint()->nNode.GetNode().GetTextNode())
-    {
-        // TODO: check meta field here too in case it ever grows a 2nd char
-        if 
(pTextNode->GetTextAttrAt(pUnoCursor->GetPoint()->nContent.GetIndex(),
-                    RES_TXTATR_INPUTFIELD, SwTextNode::PARENT))
-        {
-            throw uno::RuntimeException("cannot insert file inside input 
field");
-        }
-    }
-
     std::unique_ptr<SfxMedium> pMed;
     SwDoc* pDoc = pUnoCursor->GetDoc();
     SwDocShell* pDocSh = pDoc->GetDocShell();

Reply via email to