summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sw/qa/core/doc/doc.cxx28
-rw-r--r--sw/source/core/doc/docfly.cxx2
2 files changed, 29 insertions, 1 deletions
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 0d39c2fbd508..43894afa03dc 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -197,6 +197,34 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping)
#endif
}
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testImageHyperlinkStyle)
+{
+ // Given a document with an image with a hyperlink:
+ loadURL("private:factory/swriter", nullptr);
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextDocument> xDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XText> xText = xDocument->getText();
+ uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+ uno::Reference<text::XTextContent> xImage(
+ xFactory->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY);
+ xText->insertTextContent(xCursor, xImage, /*bAbsorb=*/false);
+ uno::Reference<beans::XPropertySet> xImageProps(xImage, uno::UNO_QUERY);
+ OUString aExpected = "http://www.example.com";
+ xImageProps->setPropertyValue("HyperLinkURL", uno::makeAny(aExpected));
+
+ // When applying a frame style on it:
+ xImageProps->setPropertyValue("FrameStyleName", uno::makeAny(OUString("Frame")));
+
+ // Then make sure that the hyperlink is not lost:
+ auto aActual = getProperty<OUString>(xImageProps, "HyperLinkURL");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: http://www.example.com
+ // - Actual :
+ // i.e. the link was lost, even if the frame style dialog doesn't allow specifying a link on
+ // frames.
+ CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 6b73f1f756b5..db9518b2cecd 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -700,7 +700,7 @@ bool SwDoc::SetFrameFormatToFly( SwFrameFormat& rFormat, SwFrameFormat& rNewForm
rFormat.ResetFormatAttr( RES_PRINT, RES_SURROUND );
rFormat.ResetFormatAttr( RES_LR_SPACE, RES_UL_SPACE );
rFormat.ResetFormatAttr( RES_BACKGROUND, RES_COL );
- rFormat.ResetFormatAttr( RES_URL, RES_EDIT_IN_READONLY );
+ rFormat.ResetFormatAttr( RES_EDIT_IN_READONLY );
if( !bFrameSz )
rFormat.SetFormatAttr( aFrameSz );