Kaydet (Commit) ed2ae3c3 authored tarafından Noel Grandin's avatar Noel Grandin

remove dead SwNoteURL

According to:

<mst_> noelgrandin: apparently this code exists so you can export a text

     frame as an image and then the urls in the text become
    image-map links

which means that according to my analysis below, nobody has noticed the
removal in 17 years :-)

SwNoteURL::InsertURLNote was the last place that constructed an
SwNoteURL and it was removed in
    commit bb7ade14
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Wed Mar 7 13:42:58 2018 +0200
    loplugin:unusedmethods

and SwNoteURL::InsertURLNote was dead because
   void SwTextPaintInfo::NotifyURL_( const SwLinePortion &rPor ) const
was removed in
    commit 73139fe6
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Fri Jan 19 13:10:22 2018 +0200
    loplugin:unusedmethods

and SwTextPaintInfo::NotifyURL_ was dead because
   void SwTextPaintInfo::NotifyURL( const SwLinePortion &rPor ) const
was removed in
    commit be8c4145
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Fri Jan 19 09:13:03 2018 +0200
    loplugin:unusedmethods also check for functions returning bool

and NotifyURL was dead because calls to it were removed in
    commit 1b666235
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Wed Jan 3 09:08:52 2018 +0200
    loplugin:singlevalfields improve copy constructor check
those calls were removed because the m_bURL field of SwFont was always
false.

tracing back, we find that m_bURL was called bURL before
    commit b4e2a13f
    Author: Miklos Vajna <vmiklos@collabora.co.uk>
    Date:   Mon Oct 26 08:55:17 2015 +0100
    sw: prefix members of SwFont

and we find that a method
     void SwFont::SetURL(const bool)
that modified bURL was removed in
    commit 407731c9
    Author: Noel Grandin <noel@peralex.com>
    Date:   Tue Jul 21 10:44:17 2015 +0200
    loplugin:unusedmethods sw

and we find that calls to SetURL were removed in
    commit da7671e4
    Author: Andreas Martens <ama@openoffice.org>
    Date:   Thu Mar 15 14:59:12 2001 +0000
    Opt.(FME): The new attribute handler makes a lot of code superfluous

which appears to be the root of the problem

Change-Id: Id2362ce216c06bc8dcf71698695d708eb494af4e
Reviewed-on: https://gerrit.libreoffice.org/51225Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst bb787e7b
......@@ -20,38 +20,8 @@
#ifndef INCLUDED_SW_SOURCE_CORE_INC_NOTEURL_HXX
#define INCLUDED_SW_SOURCE_CORE_INC_NOTEURL_HXX
#include <swrect.hxx>
#include <rtl/ustring.hxx>
#include <vector>
class ImageMap;
class MapMode;
class SwURLNote
{
OUString aURL;
OUString aTarget;
SwRect aRect;
public:
SwURLNote( const OUString& rURL, const OUString& rTarget, const SwRect& rRect )
: aURL( rURL ), aTarget( rTarget ), aRect( rRect )
{}
const OUString& GetURL() const { return aURL; }
const OUString& GetTarget() const { return aTarget; }
const SwRect& GetRect() const { return aRect; }
};
class SwNoteURL
{
private:
std::vector<SwURLNote> m_List;
public:
SwNoteURL() {}
void FillImageMap( ImageMap* pMap, const Point& rPos, const MapMode& rMap );
};
// globale Variable, in NoteURL.Cxx angelegt
......
......@@ -7367,7 +7367,6 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap )
if( bNoteURL )
{
OSL_ENSURE( pNoteURL, "MakeGraphic: Good Bye, NoteURL." );
pNoteURL->FillImageMap( pMap, pFly->getFrameArea().Pos(), aMap );
delete pNoteURL;
pNoteURL = nullptr;
}
......
......@@ -28,26 +28,4 @@
// Global variable
SwNoteURL *pNoteURL = nullptr;
void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
const MapMode& rMap )
{
OSL_ENSURE( pMap, "FillImageMap: No ImageMap, no cookies!" );
const size_t nCount = m_List.size();
if( nCount )
{
MapMode aMap( MapUnit::Map100thMM );
for( size_t i = 0; i < nCount; ++i )
{
const SwURLNote &rNote = m_List[i];
SwRect aSwRect( rNote.GetRect() );
aSwRect -= rPos;
tools::Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(),
rMap, aMap ) );
IMapRectangleObject aObj( aRect, rNote.GetURL(), OUString(), OUString(),
rNote.GetTarget(), OUString(), true, false );
pMap->InsertIMapObject( aObj );
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment