diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-09-23 14:40:01 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-09-23 14:41:52 +0200 |
commit | 38faee21e0b874359246e513b0a8c0af399a864d (patch) | |
tree | b5978fb1e40408a4cbc915977f338d32f7690d67 /sw | |
parent | d66b757083ddbb14c7bc58f4c34512185abbc60a (diff) |
Do not link html images only when pasting from clipboard (bnc#580834)
Change-Id: I020c4e6ed6d468e553dedd7c91979b081d6b4725
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/htmlimport/data/picture.html | 7 | ||||
-rw-r--r-- | sw/qa/extras/htmlimport/htmlimport.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/html/htmlgrin.cxx | 3 |
3 files changed, 14 insertions, 9 deletions
diff --git a/sw/qa/extras/htmlimport/data/picture.html b/sw/qa/extras/htmlimport/data/picture.html index c0b2e6cdb376..53f0c6441b13 100644 --- a/sw/qa/extras/htmlimport/data/picture.html +++ b/sw/qa/extras/htmlimport/data/picture.html @@ -3,17 +3,14 @@ <body> <div> <p> - This document should contain only one link. (Edit -> Links...) + This document should contain two links. (Edit -> Links...) </p> <p> - The picture below is supposed to be fully inserted into the document, not just as a link. - <br/> <a style="display:inline-block;" href="http://www.libreoffice.org/" title="Go to the Home of LibreOffice and the LibreOffice Community page"> <img src="../../../../../odk/docs/images/sdk_head-1.png" width="377" height="120px"/> </a> </p> - This one is supposed to be inserted as a link, since the source is "http://..." URL. - <br/> + <p> <a style="display:inline-block;" href="http://www.libreoffice.org/" title="Go to the Home of LibreOffice and the LibreOffice Community page"> <img src="http://www.libreoffice.org/themes/libo/images/logo.png" width="218px" height="45px"/> </a> diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index 592aa5335e70..1b1459fa43c3 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -29,9 +29,16 @@ DECLARE_HTMLIMPORT_TEST(testPictureImport, "picture.html") { SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTxtDoc); - // The document contains one embeded picture and one stored as a link. - const sfx2::LinkManager& rLinkManager = pTxtDoc->GetDocShell()->GetDoc()->GetEditShell()->GetLinkManager(); - CPPUNIT_ASSERT_EQUAL(size_t(1), rLinkManager.GetLinks().size()); + // The document contains two pictures stored as a link. + sfx2::LinkManager& rLinkManager = pTxtDoc->GetDocShell()->GetDoc()->GetEditShell()->GetLinkManager(); + CPPUNIT_ASSERT_EQUAL(size_t(2), rLinkManager.GetLinks().size()); + rLinkManager.Remove(0,2); + CPPUNIT_ASSERT_EQUAL(size_t(0), rLinkManager.GetLinks().size()); + + // TODO: Get the data into clipboard in html format and paste + + // But when pasting we don't want images to be linked. + CPPUNIT_ASSERT_EQUAL(size_t(0), rLinkManager.GetLinks().size()); } DECLARE_HTMLIMPORT_TEST(testInlinedImage, "inlined_image.html") diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index f4e1e4421410..4e136a437b36 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -706,7 +706,8 @@ IMAGE_SETEVENT: free( aStream ); } } - else if (aGraphicURL.GetProtocol() == INET_PROT_FILE) + // sBaseURL is empty if the source is clipboard + else if (sBaseURL.isEmpty()) { if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL)) sGrfNm = ""; |