summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-08-27 08:20:24 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-08-27 14:40:36 +0200
commit423d16487b6d8bc048f546017da3b8274bc289cf (patch)
tree72177a5c84d02d5f6335e3ea68f05dfc4f55166a /sc
parent3005c107f356ead72d18b5136361e75d82ab1dff (diff)
Remove duplicated sc imagemap functions
Change-Id: Ie1001abb5b57e73fece9f028041e683143a7008b Reviewed-on: https://gerrit.libreoffice.org/78162 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/drwlayer.hxx10
-rw-r--r--sc/inc/userdat.hxx17
-rw-r--r--sc/source/core/data/drwlayer.cxx78
-rw-r--r--sc/source/core/data/userdat.cxx21
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx5
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx5
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx9
-rw-r--r--sc/source/ui/view/drawvie3.cxx3
-rw-r--r--sc/source/ui/view/gridwin5.cxx7
-rw-r--r--sc/source/ui/view/tabvwsh9.cxx5
10 files changed, 21 insertions, 139 deletions
diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 4bb4a759b241..a2f9cadbc25d 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -27,9 +27,7 @@
class ScDocument;
class SfxObjectShell;
class ScDrawObjData;
-class ScIMapInfo;
class ScMacroInfo;
-class IMapObject;
class ScMarkData;
class ScTabDeletedHint : public SfxHint
@@ -208,16 +206,8 @@ public:
/** Returns the object data, if the passed object is a cell note caption. */
static ScDrawObjData* GetNoteCaptionData( SdrObject* pObj, SCTAB nTab );
- // Image-Map
- static ScIMapInfo* GetIMapInfo( const SdrObject* pObj );
-
- static IMapObject* GetHitIMapObject( const SdrObject* pObject,
- const Point& rWinPoint, const vcl::Window& rCmpWnd );
-
static ScMacroInfo* GetMacroInfo( SdrObject* pObj, bool bCreate = false );
- virtual ImageMap* GetImageMapForObject(SdrObject* pObj) override;
-
private:
static SfxObjectShell* pGlobalDrawPersist; // for AllocModel
public:
diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx
index 17a81261b3cd..e05662757193 100644
--- a/sc/inc/userdat.hxx
+++ b/sc/inc/userdat.hxx
@@ -27,7 +27,7 @@
// Object IDs for UserData
#define SC_UD_OBJDATA 1
-#define SC_UD_IMAPDATA 2
+// SVX_IMAPINFO_ID = 2
#define SC_UD_MACRODATA 3
class SC_DLLPUBLIC ScDrawObjData : public SdrObjUserData
@@ -67,21 +67,6 @@ private:
tools::Rectangle maShapeRect;
};
-class ScIMapInfo : public SdrObjUserData
-{
- ImageMap aImageMap;
-
-public:
- ScIMapInfo( const ImageMap& rImageMap );
- ScIMapInfo( const ScIMapInfo& rIMapInfo );
- virtual ~ScIMapInfo() override;
-
- virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
-
- void SetImageMap( const ImageMap& rIMap ) { aImageMap = rIMap; }
- const ImageMap& GetImageMap() const { return aImageMap; }
-};
-
class SAL_DLLPUBLIC_RTTI ScMacroInfo : public SdrObjUserData
{
public:
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 0f9214eb78a4..9228ce80cee7 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -2314,74 +2314,6 @@ ScDrawObjData* ScDrawLayer::GetNoteCaptionData( SdrObject* pObj, SCTAB nTab )
return (pData && pData->meType == ScDrawObjData::CellNote) ? pData : nullptr;
}
-ScIMapInfo* ScDrawLayer::GetIMapInfo( const SdrObject* pObj )
-{
- return static_cast<ScIMapInfo*>(GetFirstUserDataOfType(pObj, SC_UD_IMAPDATA));
-}
-
-IMapObject* ScDrawLayer::GetHitIMapObject( const SdrObject* pObj,
- const Point& rWinPoint, const vcl::Window& rCmpWnd )
-{
- const MapMode aMap100( MapUnit::Map100thMM );
- MapMode aWndMode = rCmpWnd.GetMapMode();
- Point aRelPoint( rCmpWnd.LogicToLogic( rWinPoint, &aWndMode, &aMap100 ) );
- tools::Rectangle aLogRect = rCmpWnd.LogicToLogic( pObj->GetLogicRect(), &aWndMode, &aMap100 );
- ScIMapInfo* pIMapInfo = GetIMapInfo( pObj );
- IMapObject* pIMapObj = nullptr;
-
- if ( pIMapInfo )
- {
- Size aGraphSize;
- ImageMap& rImageMap = const_cast<ImageMap&>(pIMapInfo->GetImageMap());
- Graphic aGraphic;
- bool bObjSupported = false;
-
- if (const SdrGrafObj* pGrafObj = dynamic_cast<const SdrGrafObj*>(pObj)) // Simple Graphics object
- {
- const GeoStat& rGeo = pGrafObj->GetGeoStat();
- const Graphic& rGraphic = pGrafObj->GetGraphic();
-
- // Reverse rotation
- if ( rGeo.nRotationAngle )
- RotatePoint( aRelPoint, aLogRect.TopLeft(), -rGeo.nSin, rGeo.nCos );
-
- // Reverse mirroring
- if ( static_cast<const SdrGrafObjGeoData*>( pGrafObj->GetGeoData() )->bMirrored )
- aRelPoint.setX( aLogRect.Right() + aLogRect.Left() - aRelPoint.X() );
-
- // Possible Unshear:
- if ( rGeo.nShearAngle )
- ShearPoint( aRelPoint, aLogRect.TopLeft(), -rGeo.nTan );
-
- if ( rGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
- aGraphSize = rCmpWnd.PixelToLogic( rGraphic.GetPrefSize(),
- aMap100 );
- else
- aGraphSize = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(),
- rGraphic.GetPrefMapMode(),
- aMap100 );
-
- bObjSupported = true;
- }
- else if (const SdrOle2Obj* pOleObj = dynamic_cast<const SdrOle2Obj*>(pObj)) // OLE object
- {
- // TODO/LEAN: working with visual area needs running state
- aGraphSize = pOleObj->GetOrigObjSize();
- bObjSupported = true;
- }
-
- // If everything has worked out, then perform HitTest
- if ( bObjSupported )
- {
- // Calculate relative mouse point
- aRelPoint -= aLogRect.TopLeft();
- pIMapObj = rImageMap.GetHitIMapObject( aGraphSize, aLogRect.GetSize(), aRelPoint );
- }
- }
-
- return pIMapObj;
-}
-
ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, bool bCreate )
{
if (SdrObjUserData *pData = GetFirstUserDataOfType(pObj, SC_UD_MACRODATA))
@@ -2396,16 +2328,6 @@ ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, bool bCreate )
return nullptr;
}
-ImageMap* ScDrawLayer::GetImageMapForObject(SdrObject* pObj)
-{
- ScIMapInfo* pIMapInfo = GetIMapInfo( pObj );
- if ( pIMapInfo )
- {
- return const_cast<ImageMap*>( &(pIMapInfo->GetImageMap()) );
- }
- return nullptr;
-}
-
void ScDrawLayer::SetGlobalDrawPersist(SfxObjectShell* pPersist)
{
OSL_ENSURE(!pGlobalDrawPersist,"Multiple SetGlobalDrawPersist");
diff --git a/sc/source/core/data/userdat.cxx b/sc/source/core/data/userdat.cxx
index 387d433e3374..9a65caaa11a3 100644
--- a/sc/source/core/data/userdat.cxx
+++ b/sc/source/core/data/userdat.cxx
@@ -34,27 +34,6 @@ std::unique_ptr<SdrObjUserData> ScDrawObjData::Clone( SdrObject* ) const
return std::unique_ptr<SdrObjUserData>(new ScDrawObjData( *this ));
}
-ScIMapInfo::ScIMapInfo( const ImageMap& rImageMap ) :
- SdrObjUserData( SdrInventor::ScOrSwDraw, SC_UD_IMAPDATA ),
- aImageMap( rImageMap )
-{
-}
-
-ScIMapInfo::ScIMapInfo( const ScIMapInfo& rIMapInfo ) :
- SdrObjUserData( rIMapInfo ),
- aImageMap( rIMapInfo.aImageMap )
-{
-}
-
-ScIMapInfo::~ScIMapInfo()
-{
-}
-
-std::unique_ptr<SdrObjUserData> ScIMapInfo::Clone( SdrObject* ) const
-{
- return std::unique_ptr<SdrObjUserData>(new ScIMapInfo( *this ));
-}
-
ScMacroInfo::ScMacroInfo() :
SdrObjUserData( SdrInventor::ScOrSwDraw, SC_UD_MACRODATA )
{
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index bc9657066059..bd6ac3c96c09 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -22,6 +22,7 @@
#include <svx/svdobj.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdouno.hxx>
+#include <svx/ImageMapInfo.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
@@ -623,8 +624,8 @@ static bool lcl_UrlHit( const SdrView* pView, const Point& rPosPixel, const vcl:
if ( eHit != SdrHitKind::NONE && aVEvt.pObj != nullptr )
{
- if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) && ScDrawLayer::GetHitIMapObject(
- aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), *pWindow ) )
+ if ( SvxIMapInfo::GetIMapInfo( aVEvt.pObj ) && SvxIMapInfo::GetHitIMapObject(
+ aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), pWindow ) )
return true;
if ( aVEvt.eEvent == SdrEventKind::ExecuteUrl )
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index f3e9af4dac8c..caffb9c1410b 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -26,6 +26,7 @@
#include <svx/svdouno.hxx>
#include <svx/svdomedia.hxx>
#include <svx/svdpagv.hxx>
+#include <svx/ImageMapInfo.hxx>
#include <editeng/outlobj.hxx>
#include <sfx2/app.hxx>
#include <sfx2/ipclient.hxx>
@@ -200,10 +201,10 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
pView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ) != SdrHitKind::NONE &&
aVEvt.pObj != nullptr )
{
- if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) ) // ImageMap
+ if ( SvxIMapInfo::GetIMapInfo( aVEvt.pObj ) ) // ImageMap
{
const IMapObject* pIMapObj =
- ScDrawLayer::GetHitIMapObject( aVEvt.pObj, aMDPos, *pWindow );
+ SvxIMapInfo::GetHitIMapObject( aVEvt.pObj, aMDPos, pWindow );
if ( pIMapObj && !pIMapObj->GetURL().isEmpty() )
{
sURL = pIMapObj->GetURL();
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 946d1ce6bcd9..8f353b361213 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -23,6 +23,7 @@
#include <svtools/unoevent.hxx>
#include <svtools/unoimap.hxx>
#include <svx/svdobj.hxx>
+#include <svx/ImageMapInfo.hxx>
#include <vcl/svapp.hxx>
#include <sfx2/event.hxx>
#include <svx/unoshape.hxx>
@@ -447,7 +448,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
if( !xImageMapInt.is() || !SvUnoImageMap_fillImageMap( xImageMapInt, aImageMap ) )
throw lang::IllegalArgumentException();
- ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo(pObj);
+ SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo(pObj);
if( pIMapInfo )
{
// replace existing image map
@@ -456,7 +457,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
else
{
// insert new user data with image map
- pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new ScIMapInfo(aImageMap) ));
+ pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SvxIMapInfo(aImageMap) ));
}
}
}
@@ -709,7 +710,7 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject* pObj = GetSdrObject();
if ( pObj )
{
- ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo(GetSdrObject());
+ SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo(GetSdrObject());
if( pIMapInfo )
{
const ImageMap& rIMap = pIMapInfo->GetImageMap();
@@ -948,7 +949,7 @@ void SAL_CALL ScShapeObj::setPropertyToDefault( const OUString& aPropertyName )
SdrObject* pObj = GetSdrObject();
if ( pObj )
{
- ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo(pObj);
+ SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo(pObj);
if( pIMapInfo )
{
ImageMap aEmpty;
diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index 5fc8cce39b9e..9a657ddb7361 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -19,6 +19,7 @@
#include <svx/svdograf.hxx>
#include <svx/svdoole2.hxx>
+#include <svx/ImageMapInfo.hxx>
#include <sfx2/viewfrm.hxx>
#include <strings.hrc>
@@ -209,7 +210,7 @@ void ScDrawView::UpdateIMap( SdrObject* pObj )
{
Graphic aGraphic;
TargetList aTargetList;
- ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo( pObj );
+ SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo( pObj );
const ImageMap* pImageMap = nullptr;
if ( pIMapInfo )
pImageMap = &pIMapInfo->GetImageMap();
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 9ea948a86b54..198543e5ffcb 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -22,6 +22,7 @@
#include <svx/fmpage.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdpagv.hxx>
+#include <svx/ImageMapInfo.hxx>
#include <vcl/imapobj.hxx>
#include <vcl/help.hxx>
#include <tools/urlobj.hxx>
@@ -254,11 +255,11 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
if ( eHit != SdrHitKind::NONE && aVEvt.pObj != nullptr )
{
// URL for IMapObject below Pointer is help text
- if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) )
+ if ( SvxIMapInfo::GetIMapInfo( aVEvt.pObj ) )
{
Point aLogicPos = PixelToLogic( aPosPixel );
- IMapObject* pIMapObj = ScDrawLayer::GetHitIMapObject(
- aVEvt.pObj, aLogicPos, *this );
+ IMapObject* pIMapObj = SvxIMapInfo::GetHitIMapObject(
+ aVEvt.pObj, aLogicPos, this );
if ( pIMapObj )
{
diff --git a/sc/source/ui/view/tabvwsh9.cxx b/sc/source/ui/view/tabvwsh9.cxx
index 6dbe86567bee..d708e5942b74 100644
--- a/sc/source/ui/view/tabvwsh9.cxx
+++ b/sc/source/ui/view/tabvwsh9.cxx
@@ -20,6 +20,7 @@
#include <svx/imapdlg.hxx>
#include <svx/svdmark.hxx>
#include <svx/svdview.hxx>
+#include <svx/ImageMapInfo.hxx>
#include <svx/svxids.hrc>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
@@ -131,10 +132,10 @@ void ScTabViewShell::ExecImageMap( SfxRequest& rReq )
if ( ScIMapDlgGetObj(pDlg) == static_cast<void*>(pSdrObj) )
{
const ImageMap& rImageMap = ScIMapDlgGetMap(pDlg);
- ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo( pSdrObj );
+ SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo( pSdrObj );
if ( !pIMapInfo )
- pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new ScIMapInfo( rImageMap )) );
+ pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SvxIMapInfo( rImageMap )) );
else
pIMapInfo->SetImageMap( rImageMap );