LCOV - code coverage report
Current view: top level - svx/source/dialog - imapwnd.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 428 0.0 %
Date: 2012-08-25 Functions: 0 30 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1007 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <tools/urlobj.hxx>
      30                 :            : #include <vcl/msgbox.hxx>
      31                 :            : #include <vcl/help.hxx>
      32                 :            : #include <sfx2/sfxsids.hrc>     // SID_ATTR_MACROITEM
      33                 :            : #include <svtools/imaprect.hxx>
      34                 :            : #include <svtools/imapcirc.hxx>
      35                 :            : #include <svtools/imappoly.hxx>
      36                 :            : #include <svl/urlbmk.hxx>
      37                 :            : 
      38                 :            : #include <svx/xoutbmp.hxx>
      39                 :            : #include <svx/dialmgr.hxx>
      40                 :            : #include <svx/dialogs.hrc>
      41                 :            : #include <svx/svxids.hrc>
      42                 :            : #include <imapdlg.hrc>
      43                 :            : #include <imapwnd.hxx>
      44                 :            : #include <svx/svdpage.hxx>
      45                 :            : #include <svx/svdorect.hxx>
      46                 :            : #include <svx/svdocirc.hxx>
      47                 :            : #include <svx/svdopath.hxx>
      48                 :            : #include <svx/xfltrit.hxx>
      49                 :            : #include <svx/svdpagv.hxx>
      50                 :            : #include <svl/urihelper.hxx>
      51                 :            : #include <svx/xfillit.hxx>
      52                 :            : #include <svx/xlineit.hxx>
      53                 :            : #include <sfx2/evntconf.hxx>
      54                 :            : 
      55                 :            : #include <sot/formats.hxx>
      56                 :            : 
      57                 :            : #include <svx/svxdlg.hxx>
      58                 :            : #include <basegfx/point/b2dpoint.hxx>
      59                 :            : #include <basegfx/polygon/b2dpolygon.hxx>
      60                 :            : 
      61                 :            : using ::com::sun::star::frame::XFrame;
      62                 :            : using ::com::sun::star::uno::Reference;
      63                 :            : 
      64                 :            : #define TRANSCOL Color( COL_WHITE )
      65                 :            : 
      66                 :          0 : IMapWindow::IMapWindow( Window* pParent, const ResId& rResId, const Reference< XFrame >& rxDocumentFrame ) :
      67                 :            :             GraphCtrl( pParent, rResId ),
      68                 :            :             DropTargetHelper( this ),
      69 [ #  # ][ #  # ]:          0 :             mxDocumentFrame( rxDocumentFrame )
         [ #  # ][ #  # ]
                 [ #  # ]
      70                 :            : {
      71         [ #  # ]:          0 :     SetWinStyle( WB_SDRMODE );
      72                 :            : 
      73         [ #  # ]:          0 :     pItemInfo = new SfxItemInfo[ 1 ];
      74                 :          0 :     memset( pItemInfo, 0, sizeof( SfxItemInfo ) );
      75                 :            :     pIMapPool = new SfxItemPool( rtl::OUString("IMapItemPool"),
      76 [ #  # ][ #  # ]:          0 :                                  SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, pItemInfo );
      77         [ #  # ]:          0 :     pIMapPool->FreezeIdRanges();
      78                 :          0 : }
      79                 :            : 
      80 [ #  # ][ #  # ]:          0 : IMapWindow::~IMapWindow()
                 [ #  # ]
      81                 :            : {
      82                 :            :     // Delete Liste
      83         [ #  # ]:          0 :     for ( size_t i = 0, n = aTargetList.size(); i < n; ++i )
      84 [ #  # ][ #  # ]:          0 :         delete aTargetList[ i ];
                 [ #  # ]
      85                 :            : 
      86         [ #  # ]:          0 :     SfxItemPool::Free(pIMapPool);
      87         [ #  # ]:          0 :     delete[] pItemInfo;
      88         [ #  # ]:          0 : }
      89                 :            : 
      90                 :          0 : void IMapWindow::SetImageMap( const ImageMap& rImageMap )
      91                 :            : {
      92                 :          0 :     ReplaceImageMap( rImageMap, sal_False );
      93                 :          0 : }
      94                 :            : 
      95                 :          0 : void IMapWindow::ReplaceImageMap( const ImageMap& rImageMap, sal_Bool /*bScaleToGraphic*/ )
      96                 :            : {
      97                 :          0 :     SdrPage* pPage = 0;
      98                 :          0 :     aIMap = rImageMap;
      99                 :            : 
     100         [ #  # ]:          0 :     if(GetSdrModel())
     101                 :            :     {
     102                 :            :         // try to access page
     103                 :          0 :         pPage = GetSdrModel()->GetPage(0L);
     104                 :            :     }
     105                 :            : 
     106         [ #  # ]:          0 :     if(pPage)
     107                 :            :     {
     108                 :            :         // clear all draw objects
     109                 :          0 :         pPage->Clear();
     110                 :            :     }
     111                 :            : 
     112         [ #  # ]:          0 :     if(GetSdrView())
     113                 :            :     {
     114                 :            :         // #i63762# reset selection at view
     115                 :          0 :         GetSdrView()->UnmarkAllObj();
     116                 :            :     }
     117                 :            : 
     118                 :            :     // create new drawing objects
     119                 :          0 :     const sal_uInt16 nCount(rImageMap.GetIMapObjectCount());
     120                 :            : 
     121         [ #  # ]:          0 :     for ( sal_uInt16 i(nCount); i > 0; i-- )
     122                 :            :     {
     123                 :          0 :         SdrObject* pNewObj = CreateObj( rImageMap.GetIMapObject( i - 1 ) );
     124                 :            : 
     125         [ #  # ]:          0 :         if ( pNewObj )
     126                 :            :         {
     127                 :          0 :             pPage->InsertObject( pNewObj );
     128                 :            :         }
     129                 :            :     }
     130                 :          0 : }
     131                 :            : 
     132                 :          0 : sal_Bool IMapWindow::ReplaceActualIMapInfo( const NotifyInfo& rNewInfo )
     133                 :            : {
     134                 :          0 :     const SdrObject*    pSdrObj = GetSelectedSdrObject();
     135                 :            :     IMapObject*         pIMapObj;
     136                 :          0 :     sal_Bool                bRet = sal_False;
     137                 :            : 
     138 [ #  # ][ #  # ]:          0 :     if ( pSdrObj && ( ( pIMapObj = GetIMapObj( pSdrObj ) ) != NULL ) )
                 [ #  # ]
     139                 :            :     {
     140                 :          0 :         pIMapObj->SetURL( rNewInfo.aMarkURL );
     141                 :          0 :         pIMapObj->SetAltText( rNewInfo.aMarkAltText );
     142                 :          0 :         pIMapObj->SetTarget( rNewInfo.aMarkTarget );
     143                 :          0 :         pModel->SetChanged( sal_True );
     144                 :          0 :         UpdateInfo( sal_False );
     145                 :            : 
     146                 :          0 :         bRet = sal_True;
     147                 :            :     }
     148                 :            : 
     149                 :          0 :     return bRet;
     150                 :            : }
     151                 :            : 
     152                 :          0 : const ImageMap& IMapWindow::GetImageMap()
     153                 :            : {
     154         [ #  # ]:          0 :     if ( pModel->IsChanged() )
     155                 :            :     {
     156                 :          0 :         SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
     157                 :            : 
     158         [ #  # ]:          0 :         if ( pPage )
     159                 :            :         {
     160                 :          0 :             const long nCount = pPage->GetObjCount();
     161                 :            : 
     162                 :          0 :             aIMap.ClearImageMap();
     163                 :            : 
     164         [ #  # ]:          0 :             for ( long i = nCount - 1; i > -1; i-- )
     165         [ #  # ]:          0 :                 aIMap.InsertIMapObject( *( ( (IMapUserData*) pPage->GetObj( i )->GetUserData( 0 ) )->GetObject() ) );
     166                 :            :         }
     167                 :            : 
     168                 :          0 :         pModel->SetChanged( sal_False );
     169                 :            :     }
     170                 :            : 
     171                 :          0 :     return aIMap;
     172                 :            : }
     173                 :            : 
     174                 :          0 : void IMapWindow::SetTargetList( TargetList& rTargetList )
     175                 :            : {
     176                 :            :     // Delete old List
     177         [ #  # ]:          0 :     for( size_t i = 0, n = aTargetList.size(); i < n; ++i )
     178         [ #  # ]:          0 :         delete aTargetList[ i ];
     179                 :          0 :     aTargetList.clear();
     180                 :            : 
     181                 :            :     // Fill with the provided list
     182         [ #  # ]:          0 :     for( size_t i = 0, n = rTargetList.size(); i < n; ++i )
     183 [ #  # ][ #  # ]:          0 :         aTargetList.push_back( new String( *rTargetList[ i ] ) );
     184                 :            : 
     185                 :          0 :     pModel->SetChanged( sal_False );
     186                 :          0 : }
     187                 :            : 
     188                 :          0 : SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
     189                 :            : {
     190                 :          0 :     Point       aPoint;
     191         [ #  # ]:          0 :     Rectangle   aClipRect( aPoint, GetGraphicSize() );
     192                 :          0 :     SdrObject*  pSdrObj = NULL;
     193         [ #  # ]:          0 :     IMapObjectPtr pCloneIMapObj;
     194                 :            : 
     195         [ #  # ]:          0 :     switch( pIMapObj->GetType() )
           [ #  #  #  # ]
     196                 :            :     {
     197                 :            :         case( IMAP_OBJ_RECTANGLE ):
     198                 :            :         {
     199                 :          0 :             IMapRectangleObject*    pIMapRectObj = (IMapRectangleObject*) pIMapObj;
     200         [ #  # ]:          0 :             Rectangle               aDrawRect( pIMapRectObj->GetRectangle( sal_False ) );
     201                 :            : 
     202                 :            :             // clipped on CanvasPane
     203         [ #  # ]:          0 :             aDrawRect.Intersection( aClipRect );
     204                 :            : 
     205 [ #  # ][ #  # ]:          0 :             pSdrObj = (SdrObject*) new SdrRectObj( aDrawRect );
     206 [ #  # ][ #  # ]:          0 :             pCloneIMapObj.reset((IMapObject*) new IMapRectangleObject( *pIMapRectObj ));
                 [ #  # ]
     207                 :            :         }
     208                 :          0 :         break;
     209                 :            : 
     210                 :            :         case( IMAP_OBJ_CIRCLE ):
     211                 :            :         {
     212                 :          0 :             IMapCircleObject*   pIMapCircleObj = (IMapCircleObject*) pIMapObj;
     213         [ #  # ]:          0 :             const Point         aCenter( pIMapCircleObj->GetCenter( sal_False ) );
     214         [ #  # ]:          0 :             const long          nRadius = pIMapCircleObj->GetRadius( sal_False );
     215                 :          0 :             const Point         aOffset( nRadius, nRadius );
     216         [ #  # ]:          0 :             Rectangle           aCircle( aCenter - aOffset, aCenter + aOffset );
     217                 :            : 
     218                 :            :             // limited to CanvasPane
     219         [ #  # ]:          0 :             aCircle.Intersection( aClipRect );
     220                 :            : 
     221 [ #  # ][ #  # ]:          0 :             pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aCircle, 0, 36000 );
     222 [ #  # ][ #  # ]:          0 :             pCloneIMapObj.reset((IMapObject*) new IMapCircleObject( *pIMapCircleObj ));
                 [ #  # ]
     223                 :            :         }
     224                 :          0 :         break;
     225                 :            : 
     226                 :            :         case( IMAP_OBJ_POLYGON ):
     227                 :            :         {
     228                 :          0 :             IMapPolygonObject*  pIMapPolyObj = (IMapPolygonObject*) pIMapObj;
     229                 :            : 
     230                 :            :             // If it actually is an ellipse, then another ellipse is created again
     231         [ #  # ]:          0 :             if ( pIMapPolyObj->HasExtraEllipse() )
     232                 :            :             {
     233                 :          0 :                 Rectangle aDrawRect( pIMapPolyObj->GetExtraEllipse() );
     234                 :            : 
     235                 :            :                 // clipped on CanvasPane
     236         [ #  # ]:          0 :                 aDrawRect.Intersection( aClipRect );
     237                 :            : 
     238 [ #  # ][ #  # ]:          0 :                 pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aDrawRect, 0, 36000 );
     239                 :            :             }
     240                 :            :             else
     241                 :            :             {
     242         [ #  # ]:          0 :                 const Polygon&  rPoly = pIMapPolyObj->GetPolygon( sal_False );
     243         [ #  # ]:          0 :                 Polygon         aDrawPoly( rPoly );
     244                 :            : 
     245                 :            :                 // clipped on CanvasPane
     246         [ #  # ]:          0 :                 aDrawPoly.Clip( aClipRect );
     247                 :            : 
     248         [ #  # ]:          0 :                 basegfx::B2DPolygon aPolygon;
     249 [ #  # ][ #  # ]:          0 :                 aPolygon.append(aDrawPoly.getB2DPolygon());
                 [ #  # ]
     250 [ #  # ][ #  # ]:          0 :                 pSdrObj = (SdrObject*)new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aPolygon));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     251                 :            :             }
     252                 :            : 
     253 [ #  # ][ #  # ]:          0 :             pCloneIMapObj.reset((IMapObject*) new IMapPolygonObject( *pIMapPolyObj ));
                 [ #  # ]
     254                 :            :         }
     255                 :          0 :         break;
     256                 :            : 
     257                 :            :         default:
     258                 :          0 :         break;
     259                 :            :     }
     260                 :            : 
     261         [ #  # ]:          0 :     if ( pSdrObj )
     262                 :            :     {
     263         [ #  # ]:          0 :         SfxItemSet aSet( pModel->GetItemPool() );
     264                 :            : 
     265 [ #  # ][ #  # ]:          0 :         aSet.Put( XFillStyleItem( XFILL_SOLID ) );
                 [ #  # ]
     266 [ #  # ][ #  # ]:          0 :         aSet.Put( XFillColorItem( String(), TRANSCOL ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     267                 :            : 
     268         [ #  # ]:          0 :         if ( !pIMapObj->IsActive() )
     269                 :            :         {
     270 [ #  # ][ #  # ]:          0 :             aSet.Put( XFillTransparenceItem( 100 ) );
                 [ #  # ]
     271 [ #  # ][ #  # ]:          0 :             aSet.Put( XLineColorItem( String(), Color( COL_RED ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     272                 :            :         }
     273                 :            :         else
     274                 :            :         {
     275 [ #  # ][ #  # ]:          0 :             aSet.Put( XFillTransparenceItem( 50 ) );
                 [ #  # ]
     276 [ #  # ][ #  # ]:          0 :             aSet.Put( XLineColorItem( String(), Color( COL_BLACK ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     277                 :            :         }
     278                 :            : 
     279         [ #  # ]:          0 :         pSdrObj->SetMergedItemSetAndBroadcast(aSet);
     280                 :            : 
     281 [ #  # ][ #  # ]:          0 :         pSdrObj->AppendUserData( new IMapUserData( pCloneIMapObj ) );
                 [ #  # ]
     282 [ #  # ][ #  # ]:          0 :         pSdrObj->SetUserCall( GetSdrUserCall() );
     283                 :            :     }
     284                 :            : 
     285         [ #  # ]:          0 :     return pSdrObj;
     286                 :            : }
     287                 :            : 
     288                 :          0 : void IMapWindow::InitSdrModel()
     289                 :            : {
     290         [ #  # ]:          0 :     GraphCtrl::InitSdrModel();
     291                 :            : 
     292         [ #  # ]:          0 :     SfxItemSet aSet( pModel->GetItemPool() );
     293                 :            : 
     294 [ #  # ][ #  # ]:          0 :     aSet.Put( XFillColorItem( String(), TRANSCOL ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     295 [ #  # ][ #  # ]:          0 :     aSet.Put( XFillTransparenceItem( 50 ) );
                 [ #  # ]
     296         [ #  # ]:          0 :     pView->SetAttributes( aSet );
     297 [ #  # ][ #  # ]:          0 :     pView->SetFrameDragSingles( sal_True );
     298                 :          0 : }
     299                 :            : 
     300                 :          0 : void IMapWindow::SdrObjCreated( const SdrObject& rObj )
     301                 :            : {
     302   [ #  #  #  # ]:          0 :     switch( rObj.GetObjIdentifier() )
     303                 :            :     {
     304                 :            :         case( OBJ_RECT ):
     305                 :            :         {
     306                 :          0 :             SdrRectObj*          pRectObj = (SdrRectObj*) &rObj;
     307                 :          0 :             IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(),
     308 [ #  # ][ #  # ]:          0 :                 String(), String(), String(), String(), String(), sal_True, sal_False );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     309                 :            : 
     310 [ #  # ][ #  # ]:          0 :             pRectObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
                 [ #  # ]
     311                 :            :         }
     312                 :          0 :         break;
     313                 :            : 
     314                 :            :         case( OBJ_CIRC ):
     315                 :            :         {
     316                 :          0 :             SdrCircObj* pCircObj = (SdrCircObj*) &rObj;
     317         [ #  # ]:          0 :             SdrPathObj* pPathObj = (SdrPathObj*) pCircObj->ConvertToPolyObj( sal_False, sal_False );
     318 [ #  # ][ #  # ]:          0 :             Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0L));
                 [ #  # ]
     319 [ #  # ][ #  # ]:          0 :             delete pPathObj;
     320                 :            : 
     321 [ #  # ][ #  # ]:          0 :             IMapPolygonObject* pObj = new IMapPolygonObject( Polygon(aPoly), String(), String(), String(), String(), String(),  sal_True, sal_False );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     322 [ #  # ][ #  # ]:          0 :             pObj->SetExtraEllipse( aPoly.GetBoundRect() );
     323 [ #  # ][ #  # ]:          0 :             pCircObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     324                 :            :         }
     325                 :          0 :         break;
     326                 :            : 
     327                 :            :         case( OBJ_POLY ):
     328                 :            :         case( OBJ_FREEFILL ):
     329                 :            :         case( OBJ_PATHPOLY ):
     330                 :            :         case( OBJ_PATHFILL ):
     331                 :            :         {
     332                 :          0 :             SdrPathObj* pPathObj = (SdrPathObj*) &rObj;
     333                 :          0 :             const basegfx::B2DPolyPolygon& rXPolyPoly = pPathObj->GetPathPoly();
     334                 :            : 
     335         [ #  # ]:          0 :             if ( rXPolyPoly.count() )
     336                 :            :             {
     337 [ #  # ][ #  # ]:          0 :                 Polygon aPoly(rXPolyPoly.getB2DPolygon(0L));
                 [ #  # ]
     338 [ #  # ][ #  # ]:          0 :                 IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, String(), String(), String(), String(), String(),  sal_True, sal_False );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     339 [ #  # ][ #  # ]:          0 :                 pPathObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     340                 :            :             }
     341                 :            :         }
     342                 :          0 :         break;
     343                 :            : 
     344                 :            :         default:
     345                 :          0 :         break;
     346                 :            :     }
     347                 :          0 : }
     348                 :            : 
     349                 :          0 : void IMapWindow::SdrObjChanged( const SdrObject& rObj )
     350                 :            : {
     351                 :          0 :     IMapUserData* pUserData = (IMapUserData*) rObj.GetUserData( 0 );
     352                 :            : 
     353         [ #  # ]:          0 :     if ( pUserData )
     354                 :            :     {
     355         [ #  # ]:          0 :         String          aURL;
     356         [ #  # ]:          0 :         String          aAltText;
     357         [ #  # ]:          0 :         String          aDesc;
     358         [ #  # ]:          0 :         String          aTarget;
     359         [ #  # ]:          0 :         IMapObjectPtr   pIMapObj = pUserData->GetObject();
     360                 :          0 :         sal_Bool            bActive = sal_True;
     361                 :            : 
     362         [ #  # ]:          0 :         if ( pIMapObj.get() )
     363                 :            :         {
     364         [ #  # ]:          0 :             aURL = pIMapObj->GetURL();
     365         [ #  # ]:          0 :             aAltText = pIMapObj->GetAltText();
     366         [ #  # ]:          0 :             aDesc = pIMapObj->GetDesc();
     367         [ #  # ]:          0 :             aTarget = pIMapObj->GetTarget();
     368                 :          0 :             bActive = pIMapObj->IsActive();
     369                 :            :         }
     370                 :            : 
     371         [ #  # ]:          0 :         switch( rObj.GetObjIdentifier() )
           [ #  #  #  # ]
     372                 :            :         {
     373                 :            :             case( OBJ_RECT ):
     374                 :            :             {
     375                 :          0 :                 pUserData->ReplaceObject( IMapObjectPtr(new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(),
     376 [ #  # ][ #  # ]:          0 :                           aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False ) ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     377                 :            :             }
     378                 :          0 :             break;
     379                 :            : 
     380                 :            :             case( OBJ_CIRC ):
     381                 :            :             {
     382                 :          0 :                 const SdrCircObj& rCircObj = (const SdrCircObj&) rObj;
     383         [ #  # ]:          0 :                 SdrPathObj* pPathObj = (SdrPathObj*) rCircObj.ConvertToPolyObj( sal_False, sal_False );
     384 [ #  # ][ #  # ]:          0 :                 Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0L));
                 [ #  # ]
     385                 :            : 
     386 [ #  # ][ #  # ]:          0 :                 IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False );
         [ #  # ][ #  # ]
     387 [ #  # ][ #  # ]:          0 :                 pObj->SetExtraEllipse( aPoly.GetBoundRect() );
     388                 :            : 
     389                 :            :                 // was only created by us temporarily
     390 [ #  # ][ #  # ]:          0 :                 delete pPathObj;
     391 [ #  # ][ #  # ]:          0 :                 pUserData->ReplaceObject( IMapObjectPtr(pObj) );
         [ #  # ][ #  # ]
     392                 :            :             }
     393                 :          0 :             break;
     394                 :            : 
     395                 :            :             case( OBJ_POLY ):
     396                 :            :             case( OBJ_FREEFILL ):
     397                 :            :             case( OBJ_PATHPOLY ):
     398                 :            :             case( OBJ_PATHFILL ):
     399                 :            :             {
     400                 :          0 :                 const SdrPathObj& rPathObj = (const SdrPathObj&) rObj;
     401                 :          0 :                 const basegfx::B2DPolyPolygon& rXPolyPoly = rPathObj.GetPathPoly();
     402                 :            : 
     403 [ #  # ][ #  # ]:          0 :                 if ( rXPolyPoly.count() )
     404                 :            :                 {
     405 [ #  # ][ #  # ]:          0 :                     Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0L));
                 [ #  # ]
     406 [ #  # ][ #  # ]:          0 :                     IMapPolygonObject*  pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False );
         [ #  # ][ #  # ]
     407 [ #  # ][ #  # ]:          0 :                     pUserData->ReplaceObject( IMapObjectPtr(pObj) );
         [ #  # ][ #  # ]
     408                 :            :                 }
     409                 :            :             }
     410                 :          0 :             break;
     411                 :            : 
     412                 :            :             default:
     413                 :          0 :             break;
     414 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
                 [ #  # ]
     415                 :            :     }
     416                 :          0 : }
     417                 :            : 
     418                 :          0 : void IMapWindow::MouseButtonUp(const MouseEvent& rMEvt)
     419                 :            : {
     420                 :          0 :     GraphCtrl::MouseButtonUp( rMEvt );
     421                 :          0 :     UpdateInfo( sal_True );
     422                 :          0 : }
     423                 :            : 
     424                 :          0 : void IMapWindow::MarkListHasChanged()
     425                 :            : {
     426                 :          0 :     GraphCtrl::MarkListHasChanged();
     427                 :          0 :     UpdateInfo( sal_False );
     428                 :          0 : }
     429                 :            : 
     430                 :          0 : SdrObject* IMapWindow::GetHitSdrObj( const Point& rPosPixel ) const
     431                 :            : {
     432                 :          0 :     SdrObject*  pObj = NULL;
     433         [ #  # ]:          0 :     Point       aPt = PixelToLogic( rPosPixel );
     434                 :            : 
     435 [ #  # ][ #  # ]:          0 :     if ( Rectangle( Point(), GetGraphicSize() ).IsInside( aPt ) )
                 [ #  # ]
     436                 :            :     {
     437         [ #  # ]:          0 :         SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
     438                 :            :         sal_uIntPtr  nCount;
     439                 :            : 
     440 [ #  # ][ #  # ]:          0 :         if ( pPage && ( ( nCount = pPage->GetObjCount() ) > 0 ) )
         [ #  # ][ #  # ]
     441                 :            :         {
     442         [ #  # ]:          0 :             for ( long i = nCount - 1; i >= 0; i-- )
     443                 :            :             {
     444         [ #  # ]:          0 :                 SdrObject*  pTestObj = pPage->GetObj( i );
     445         [ #  # ]:          0 :                 IMapObject* pIMapObj = GetIMapObj( pTestObj );
     446                 :            : 
     447 [ #  # ][ #  # ]:          0 :                 if ( pIMapObj && pIMapObj->IsHit( aPt ) )
         [ #  # ][ #  # ]
     448                 :            :                 {
     449                 :          0 :                     pObj = pTestObj;
     450                 :          0 :                     break;
     451                 :            :                 }
     452                 :            :             }
     453                 :            :         }
     454                 :            :     }
     455                 :            : 
     456                 :          0 :     return pObj;
     457                 :            : }
     458                 :            : 
     459                 :          0 : IMapObject* IMapWindow::GetIMapObj( const SdrObject* pSdrObj ) const
     460                 :            : {
     461                 :          0 :     IMapObject* pIMapObj = NULL;
     462                 :            : 
     463         [ #  # ]:          0 :     if ( pSdrObj )
     464                 :            :     {
     465                 :          0 :         IMapUserData* pUserData = (IMapUserData*) pSdrObj->GetUserData( 0 );
     466                 :            : 
     467         [ #  # ]:          0 :         if ( pUserData )
     468                 :          0 :             pIMapObj = pUserData->GetObject().get();
     469                 :            :     }
     470                 :            : 
     471                 :          0 :     return pIMapObj;
     472                 :            : }
     473                 :            : 
     474                 :          0 : void IMapWindow::Command(const CommandEvent& rCEvt)
     475                 :            : {
     476         [ #  # ]:          0 :     Region  aRegion;
     477                 :            : 
     478         [ #  # ]:          0 :     if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
     479                 :            :     {
     480 [ #  # ][ #  # ]:          0 :         PopupMenu           aMenu( SVX_RES( RID_SVXMN_IMAP ) );
     481                 :          0 :         const SdrMarkList&  rMarkList = pView->GetMarkedObjectList();
     482                 :          0 :         sal_uIntPtr             nMarked = rMarkList.GetMarkCount();
     483                 :            : 
     484         [ #  # ]:          0 :         aMenu.EnableItem( MN_URL, sal_False );
     485         [ #  # ]:          0 :         aMenu.EnableItem( MN_ACTIVATE, sal_False );
     486         [ #  # ]:          0 :         aMenu.EnableItem( MN_MACRO, sal_False );
     487 [ #  # ][ #  # ]:          0 :         aMenu.EnableItem( MN_MARK_ALL, pModel->GetPage( 0 )->GetObjCount() != pView->GetMarkedObjectCount() );
                 [ #  # ]
     488                 :            : 
     489         [ #  # ]:          0 :         if ( !nMarked )
     490                 :            :         {
     491         [ #  # ]:          0 :             aMenu.EnableItem( MN_POSITION, sal_False );
     492         [ #  # ]:          0 :             aMenu.EnableItem( MN_FRAME_TO_TOP, sal_False );
     493         [ #  # ]:          0 :             aMenu.EnableItem( MN_MOREFRONT, sal_False );
     494         [ #  # ]:          0 :             aMenu.EnableItem( MN_MOREBACK, sal_False );
     495         [ #  # ]:          0 :             aMenu.EnableItem( MN_FRAME_TO_BOTTOM, sal_False );
     496         [ #  # ]:          0 :             aMenu.EnableItem( MN_DELETE1, sal_False );
     497                 :            :         }
     498                 :            :         else
     499                 :            :         {
     500         [ #  # ]:          0 :             if ( nMarked == 1 )
     501                 :            :             {
     502         [ #  # ]:          0 :                 SdrObject*  pSdrObj = GetSelectedSdrObject();
     503                 :            : 
     504         [ #  # ]:          0 :                 aMenu.EnableItem( MN_URL, sal_True );
     505         [ #  # ]:          0 :                 aMenu.EnableItem( MN_ACTIVATE, sal_True );
     506         [ #  # ]:          0 :                 aMenu.EnableItem( MN_MACRO, sal_True );
     507 [ #  # ][ #  # ]:          0 :                 aMenu.CheckItem( MN_ACTIVATE, GetIMapObj( pSdrObj )->IsActive() );
     508                 :            :             }
     509                 :            : 
     510         [ #  # ]:          0 :             aMenu.EnableItem( MN_POSITION, sal_True );
     511         [ #  # ]:          0 :             aMenu.EnableItem( MN_FRAME_TO_TOP, sal_True );
     512         [ #  # ]:          0 :             aMenu.EnableItem( MN_MOREFRONT, sal_True );
     513         [ #  # ]:          0 :             aMenu.EnableItem( MN_MOREBACK, sal_True );
     514         [ #  # ]:          0 :             aMenu.EnableItem( MN_FRAME_TO_BOTTOM, sal_True );
     515         [ #  # ]:          0 :             aMenu.EnableItem( MN_DELETE1, sal_True );
     516                 :            :         }
     517                 :            : 
     518         [ #  # ]:          0 :         aMenu.SetSelectHdl( LINK( this, IMapWindow, MenuSelectHdl ) );
     519 [ #  # ][ #  # ]:          0 :         aMenu.Execute( this, rCEvt.GetMousePosPixel() );
     520                 :            :     }
     521                 :            :     else
     522 [ #  # ][ #  # ]:          0 :         Window::Command(rCEvt);
     523                 :          0 : }
     524                 :            : 
     525                 :          0 : sal_Int8 IMapWindow::AcceptDrop( const AcceptDropEvent& rEvt )
     526                 :            : {
     527         [ #  # ]:          0 :     return( ( GetHitSdrObj( rEvt.maPosPixel ) != NULL ) ? rEvt.mnAction : DND_ACTION_NONE );
     528                 :            : }
     529                 :            : 
     530                 :          0 : sal_Int8 IMapWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
     531                 :            : {
     532                 :          0 :     sal_Int8 nRet = DND_ACTION_NONE;
     533                 :            : 
     534         [ #  # ]:          0 :     if( IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) )
     535                 :            :     {
     536         [ #  # ]:          0 :         const String    aString;
     537         [ #  # ]:          0 :         INetBookmark    aBookMark( aString, aString );
     538         [ #  # ]:          0 :         SdrObject*      pSdrObj = GetHitSdrObj( rEvt.maPosPixel );
     539                 :            : 
     540 [ #  # ][ #  # ]:          0 :         if( pSdrObj && TransferableDataHelper( rEvt.maDropEvent.Transferable ).GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aBookMark ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     541                 :            :         {
     542         [ #  # ]:          0 :             IMapObject* pIMapObj = GetIMapObj( pSdrObj );
     543                 :            : 
     544         [ #  # ]:          0 :             pIMapObj->SetURL( aBookMark.GetURL() );
     545         [ #  # ]:          0 :             pIMapObj->SetAltText( aBookMark.GetDescription() );
     546         [ #  # ]:          0 :             pModel->SetChanged( sal_True );
     547         [ #  # ]:          0 :             pView->UnmarkAll();
     548         [ #  # ]:          0 :             pView->MarkObj( pSdrObj, pView->GetSdrPageView() );
     549         [ #  # ]:          0 :             UpdateInfo( sal_True );
     550                 :          0 :             nRet =  rEvt.mnAction;
     551 [ #  # ][ #  # ]:          0 :         }
     552                 :            :     }
     553                 :            : 
     554                 :          0 :     return nRet;
     555                 :            : }
     556                 :            : 
     557                 :          0 : void IMapWindow::RequestHelp( const HelpEvent& rHEvt )
     558                 :            : {
     559                 :          0 :     SdrObject*          pSdrObj = NULL;
     560                 :          0 :     SdrPageView*        pPageView = NULL;
     561 [ #  # ][ #  # ]:          0 :     Point               aPos = PixelToLogic( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
                 [ #  # ]
     562                 :            : 
     563 [ #  # ][ #  # ]:          0 :     if ( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
         [ #  # ][ #  # ]
                 [ #  # ]
     564                 :            :     {
     565 [ #  # ][ #  # ]:          0 :         if ( pView->PickObj( aPos, pView->getHitTolLog(), pSdrObj, pPageView ) )
     566                 :            :         {
     567         [ #  # ]:          0 :             const IMapObject*   pIMapObj = GetIMapObj( pSdrObj );
     568         [ #  # ]:          0 :             String              aStr;
     569                 :            : 
     570 [ #  # ][ #  # ]:          0 :             if ( pIMapObj && ( aStr = pIMapObj->GetURL() ).Len() )
         [ #  # ][ #  # ]
     571                 :            :             {
     572         [ #  # ]:          0 :                 String      aDescr( pIMapObj->GetAltText() );
     573 [ #  # ][ #  # ]:          0 :                 Rectangle   aLogicPix( LogicToPixel( Rectangle( Point(), GetGraphicSize() ) ) );
     574                 :          0 :                 Rectangle   aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ),
     575         [ #  # ]:          0 :                                          OutputToScreenPixel( aLogicPix.BottomRight() ) );
           [ #  #  #  # ]
                 [ #  # ]
     576                 :            : 
     577 [ #  # ][ #  # ]:          0 :                 if ( Help::IsBalloonHelpEnabled() )
     578 [ #  # ][ #  # ]:          0 :                     Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect, aStr );
     579 [ #  # ][ #  # ]:          0 :                 else if ( Help::IsQuickHelpEnabled() )
     580 [ #  # ][ #  # ]:          0 :                     Help::ShowQuickHelp( this, aScreenRect, aStr );
     581         [ #  # ]:          0 :             }
     582                 :            :         }
     583                 :            :         else
     584         [ #  # ]:          0 :             Window::RequestHelp( rHEvt );
     585                 :            :     }
     586                 :          0 : }
     587                 :            : 
     588                 :          0 : void IMapWindow::SetCurrentObjState( sal_Bool bActive )
     589                 :            : {
     590                 :          0 :     SdrObject* pObj = GetSelectedSdrObject();
     591                 :            : 
     592         [ #  # ]:          0 :     if ( pObj )
     593                 :            :     {
     594         [ #  # ]:          0 :         SfxItemSet aSet( pModel->GetItemPool() );
     595                 :            : 
     596         [ #  # ]:          0 :         GetIMapObj( pObj )->SetActive( bActive );
     597                 :            : 
     598 [ #  # ][ #  # ]:          0 :         aSet.Put( XFillColorItem( String(), TRANSCOL ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     599                 :            : 
     600         [ #  # ]:          0 :         if ( !bActive )
     601                 :            :         {
     602 [ #  # ][ #  # ]:          0 :             aSet.Put( XFillTransparenceItem( 100 ) );
                 [ #  # ]
     603 [ #  # ][ #  # ]:          0 :             aSet.Put( XLineColorItem( String(), Color( COL_RED ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     604                 :            :         }
     605                 :            :         else
     606                 :            :         {
     607 [ #  # ][ #  # ]:          0 :             aSet.Put( XFillTransparenceItem( 50 ) );
                 [ #  # ]
     608 [ #  # ][ #  # ]:          0 :             aSet.Put( XLineColorItem( String(), Color( COL_BLACK ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     609                 :            :         }
     610                 :            : 
     611 [ #  # ][ #  # ]:          0 :         pView->SetAttributes( aSet, sal_False );
     612                 :            :     }
     613                 :          0 : }
     614                 :            : 
     615                 :          0 : void IMapWindow::UpdateInfo( sal_Bool bNewObj )
     616                 :            : {
     617         [ #  # ]:          0 :     if ( aInfoLink.IsSet() )
     618                 :            :     {
     619                 :          0 :         const SdrObject*    pSdrObj = GetSelectedSdrObject();
     620         [ #  # ]:          0 :         const IMapObject*   pIMapObj = pSdrObj ? GetIMapObj( pSdrObj ) : NULL;
     621                 :            : 
     622                 :          0 :         aInfo.bNewObj = bNewObj;
     623                 :            : 
     624         [ #  # ]:          0 :         if ( pIMapObj )
     625                 :            :         {
     626                 :          0 :             aInfo.bOneMarked = sal_True;
     627                 :          0 :             aInfo.aMarkURL = pIMapObj->GetURL();
     628                 :          0 :             aInfo.aMarkAltText = pIMapObj->GetAltText();
     629                 :          0 :             aInfo.aMarkTarget = pIMapObj->GetTarget();
     630                 :          0 :             aInfo.bActivated = pIMapObj->IsActive();
     631                 :          0 :             aInfoLink.Call( this );
     632                 :            :         }
     633                 :            :         else
     634                 :            :         {
     635 [ #  # ][ #  # ]:          0 :             aInfo.aMarkURL = aInfo.aMarkAltText = aInfo.aMarkTarget = String();
                 [ #  # ]
     636                 :          0 :             aInfo.bOneMarked = sal_False;
     637                 :          0 :             aInfo.bActivated = sal_False;
     638                 :            :         }
     639                 :            : 
     640                 :          0 :         aInfoLink.Call( this );
     641                 :            :     }
     642                 :          0 : }
     643                 :            : 
     644                 :          0 : void IMapWindow::DoMacroAssign()
     645                 :            : {
     646                 :          0 :     SdrObject*  pSdrObj = GetSelectedSdrObject();
     647                 :            : 
     648         [ #  # ]:          0 :     if ( pSdrObj )
     649                 :            :     {
     650         [ #  # ]:          0 :         SfxItemSet      aSet( *pIMapPool, SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
     651                 :            : 
     652         [ #  # ]:          0 :         SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
     653 [ #  # ][ #  # ]:          0 :         aNamesItem.AddEvent( rtl::OUString("MouseOver"), String(), SFX_EVENT_MOUSEOVER_OBJECT );
         [ #  # ][ #  # ]
                 [ #  # ]
     654 [ #  # ][ #  # ]:          0 :         aNamesItem.AddEvent( rtl::OUString("MouseOut"), String(), SFX_EVENT_MOUSEOUT_OBJECT );
         [ #  # ][ #  # ]
                 [ #  # ]
     655         [ #  # ]:          0 :         aSet.Put( aNamesItem );
     656                 :            : 
     657         [ #  # ]:          0 :         SvxMacroItem    aMacroItem(SID_ATTR_MACROITEM);
     658         [ #  # ]:          0 :         IMapObject*     pIMapObj = GetIMapObj( pSdrObj );
     659         [ #  # ]:          0 :         aMacroItem.SetMacroTable( pIMapObj->GetMacroTable() );
     660         [ #  # ]:          0 :         aSet.Put( aMacroItem, SID_ATTR_MACROITEM );
     661                 :            : 
     662         [ #  # ]:          0 :         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     663         [ #  # ]:          0 :         SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet, mxDocumentFrame, SID_EVENTCONFIG );
     664                 :            : 
     665 [ #  # ][ #  # ]:          0 :         if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
         [ #  # ][ #  # ]
     666                 :            :         {
     667         [ #  # ]:          0 :             const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
     668 [ #  # ][ #  # ]:          0 :             pIMapObj->SetMacroTable( ((const SvxMacroItem& )pOutSet->Get( SID_ATTR_MACROITEM )).GetMacroTable() );
     669         [ #  # ]:          0 :             pModel->SetChanged( sal_True );
     670         [ #  # ]:          0 :             UpdateInfo( sal_False );
     671                 :            :         }
     672                 :            : 
     673 [ #  # ][ #  # ]:          0 :         delete pMacroDlg;
         [ #  # ][ #  # ]
                 [ #  # ]
     674                 :            :     }
     675                 :          0 : }
     676                 :            : 
     677                 :          0 : void IMapWindow::DoPropertyDialog()
     678                 :            : {
     679                 :          0 :     SdrObject*  pSdrObj = GetSelectedSdrObject();
     680                 :            : 
     681         [ #  # ]:          0 :     if ( pSdrObj )
     682                 :            :     {
     683                 :          0 :         IMapObject* pIMapObj = GetIMapObj( pSdrObj );
     684                 :          0 :         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     685         [ #  # ]:          0 :         if(pFact)
     686                 :            :         {
     687                 :          0 :             AbstractURLDlg* aDlg = pFact->CreateURLDialog( this, pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(),
     688                 :          0 :                                             pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList );
     689                 :            :             DBG_ASSERT(aDlg, "Dialogdiet fail!");
     690         [ #  # ]:          0 :             if ( aDlg->Execute() == RET_OK )
     691                 :            :             {
     692         [ #  # ]:          0 :                 const String aURLText( aDlg->GetURL() );
     693                 :            : 
     694         [ #  # ]:          0 :                 if ( aURLText.Len() )
     695                 :            :                 {
     696 [ #  # ][ #  # ]:          0 :                     INetURLObject aObj( aURLText, INET_PROT_FILE );
     697                 :            :                     DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL" );
     698 [ #  # ][ #  # ]:          0 :                     pIMapObj->SetURL( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     699                 :            :                 }
     700                 :            :                 else
     701         [ #  # ]:          0 :                     pIMapObj->SetURL( aURLText );
     702                 :            : 
     703 [ #  # ][ #  # ]:          0 :                 pIMapObj->SetAltText( aDlg->GetAltText() );
                 [ #  # ]
     704 [ #  # ][ #  # ]:          0 :                 pIMapObj->SetDesc( aDlg->GetDesc() );
                 [ #  # ]
     705 [ #  # ][ #  # ]:          0 :                 pIMapObj->SetTarget( aDlg->GetTarget() );
                 [ #  # ]
     706 [ #  # ][ #  # ]:          0 :                 pIMapObj->SetName( aDlg->GetName() );
                 [ #  # ]
     707         [ #  # ]:          0 :                 pModel->SetChanged( sal_True );
     708 [ #  # ][ #  # ]:          0 :                 UpdateInfo( sal_True );
     709                 :            :             }
     710         [ #  # ]:          0 :             delete aDlg;
     711                 :            :         }
     712                 :            :     }
     713                 :          0 : }
     714                 :            : 
     715                 :          0 : IMPL_LINK( IMapWindow, MenuSelectHdl, Menu*, pMenu )
     716                 :            : {
     717         [ #  # ]:          0 :     if (pMenu)
     718                 :            :     {
     719                 :          0 :         sal_uInt16  nId = pMenu->GetCurItemId();
     720                 :            : 
     721   [ #  #  #  #  :          0 :         switch(nId)
          #  #  #  #  #  
                      # ]
     722                 :            :         {
     723                 :            :             case( MN_URL ):
     724                 :          0 :                 DoPropertyDialog();
     725                 :          0 :             break;
     726                 :            : 
     727                 :            :             case( MN_MACRO ):
     728                 :          0 :                 DoMacroAssign();
     729                 :          0 :             break;
     730                 :            : 
     731                 :            :             case( MN_ACTIVATE ):
     732                 :            :             {
     733                 :          0 :                 const sal_Bool bNewState = !pMenu->IsItemChecked( MN_ACTIVATE );
     734                 :            : 
     735                 :          0 :                 pMenu->CheckItem( MN_ACTIVATE, bNewState );
     736                 :          0 :                 SetCurrentObjState( bNewState );
     737                 :          0 :                 UpdateInfo( sal_False );
     738                 :            :             }
     739                 :            : 
     740                 :            :             case( MN_FRAME_TO_TOP ):
     741                 :          0 :                 pView->PutMarkedToTop();
     742                 :          0 :             break;
     743                 :            : 
     744                 :            :             case( MN_MOREFRONT ):
     745                 :          0 :                 pView->MovMarkedToTop();
     746                 :          0 :             break;
     747                 :            : 
     748                 :            :             case( MN_MOREBACK ):
     749                 :          0 :                 pView->MovMarkedToBtm();
     750                 :          0 :             break;
     751                 :            : 
     752                 :            :             case( MN_FRAME_TO_BOTTOM ):
     753                 :          0 :                 pView->PutMarkedToBtm();
     754                 :          0 :             break;
     755                 :            : 
     756                 :            :             case( MN_MARK_ALL ):
     757                 :          0 :                 pView->MarkAll();
     758                 :          0 :             break;
     759                 :            : 
     760                 :            :             case( MN_DELETE1 ):
     761                 :          0 :                 pView->DeleteMarked();
     762                 :            : 
     763                 :            :             default :
     764                 :          0 :             break;
     765                 :            :         }
     766                 :            :     }
     767                 :            : 
     768                 :          0 :     return 0;
     769                 :            : }
     770                 :            : 
     771                 :          0 : void IMapWindow::CreateDefaultObject()
     772                 :            : {
     773                 :          0 :     SdrPageView* pPageView = pView->GetSdrPageView();
     774                 :            : 
     775         [ #  # ]:          0 :     if(pPageView)
     776                 :            :     {
     777                 :            :         // calc position and size
     778                 :          0 :         Point aPagePos(0, 0); // = pPageView->GetOffset();
     779         [ #  # ]:          0 :         Size aPageSize = pPageView->GetPage()->GetSize();
     780                 :          0 :         sal_uInt32 nDefaultObjectSizeWidth = aPageSize.Width() / 4;
     781                 :          0 :         sal_uInt32 nDefaultObjectSizeHeight = aPageSize.Height() / 4;
     782                 :          0 :         aPagePos.X() += (aPageSize.Width() / 2) - (nDefaultObjectSizeWidth / 2);
     783                 :          0 :         aPagePos.Y() += (aPageSize.Height() / 2) - (nDefaultObjectSizeHeight / 2);
     784         [ #  # ]:          0 :         Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
     785                 :            : 
     786         [ #  # ]:          0 :         SdrObject* pObj = SdrObjFactory::MakeNewObject( pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(), 0L, pModel);
     787         [ #  # ]:          0 :         pObj->SetLogicRect(aNewObjectRectangle);
     788                 :            : 
     789         [ #  # ]:          0 :         switch( pObj->GetObjIdentifier() )
              [ #  #  # ]
     790                 :            :         {
     791                 :            :         case OBJ_POLY:
     792                 :            :         case OBJ_PATHPOLY:
     793                 :            :             {
     794         [ #  # ]:          0 :                 basegfx::B2DPolygon aInnerPoly;
     795 [ #  # ][ #  # ]:          0 :                 aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomLeft().X(), aNewObjectRectangle.BottomLeft().Y()));
                 [ #  # ]
     796         [ #  # ]:          0 :                 aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopLeft().X(), aNewObjectRectangle.TopLeft().Y()));
     797 [ #  # ][ #  # ]:          0 :                 aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopCenter().X(), aNewObjectRectangle.TopCenter().Y()));
                 [ #  # ]
     798 [ #  # ][ #  # ]:          0 :                 aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.Center().X(), aNewObjectRectangle.Center().Y()));
                 [ #  # ]
     799 [ #  # ][ #  # ]:          0 :                 aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.RightCenter().X(), aNewObjectRectangle.RightCenter().Y()));
                 [ #  # ]
     800 [ #  # ][ #  # ]:          0 :                 aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomRight().X(), aNewObjectRectangle.BottomRight().Y()));
                 [ #  # ]
     801         [ #  # ]:          0 :                 aInnerPoly.setClosed(true);
     802 [ #  # ][ #  # ]:          0 :                 ((SdrPathObj*)pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
                 [ #  # ]
     803         [ #  # ]:          0 :                 break;
     804                 :            :             }
     805                 :            :         case OBJ_FREEFILL:
     806                 :            :         case OBJ_PATHFILL:
     807                 :            :             {
     808         [ #  # ]:          0 :                 sal_Int32 nWdt(aNewObjectRectangle.GetWidth() / 2);
     809         [ #  # ]:          0 :                 sal_Int32 nHgt(aNewObjectRectangle.GetHeight() / 2);
     810 [ #  # ][ #  # ]:          0 :                 basegfx::B2DPolygon aInnerPoly(XPolygon(aNewObjectRectangle.Center(), nWdt, nHgt).getB2DPolygon());
         [ #  # ][ #  # ]
     811 [ #  # ][ #  # ]:          0 :                 ((SdrPathObj*)pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
                 [ #  # ]
     812         [ #  # ]:          0 :                 break;
     813                 :            :             }
     814                 :            : 
     815                 :            :         }
     816                 :            : 
     817         [ #  # ]:          0 :         pView->InsertObjectAtView(pObj, *pPageView);
     818         [ #  # ]:          0 :         SdrObjCreated( *pObj );
     819         [ #  # ]:          0 :         SetCurrentObjState( true );
     820         [ #  # ]:          0 :         pView->MarkObj( pObj, pPageView );
     821                 :            :     }
     822                 :          0 : }
     823                 :            : 
     824                 :          0 : void IMapWindow::KeyInput( const KeyEvent& rKEvt )
     825                 :            : {
     826                 :          0 :     GraphCtrl::KeyInput( rKEvt );
     827                 :          0 : }
     828                 :            : 
     829                 :          0 : void IMapWindow::SelectFirstObject()
     830                 :            : {
     831                 :          0 :     SdrPage*    pPage = (SdrPage*) pModel->GetPage( 0 );
     832         [ #  # ]:          0 :     if( pPage->GetObjCount() != 0 )
     833                 :            :     {
     834                 :          0 :         GrabFocus();
     835                 :          0 :         pView->UnmarkAllObj();
     836                 :          0 :         pView->MarkNextObj(sal_True);
     837                 :            :     }
     838                 :          0 : }
     839                 :            : 
     840                 :          0 : void IMapWindow::StartPolyEdit()
     841                 :            : {
     842                 :          0 :     GrabFocus();
     843                 :            : 
     844         [ #  # ]:          0 :     if( !pView->AreObjectsMarked() )
     845                 :          0 :         pView->MarkNextObj(sal_True);
     846                 :            : 
     847                 :          0 :     const SdrHdlList& rHdlList = pView->GetHdlList();
     848                 :          0 :     SdrHdl* pHdl = rHdlList.GetFocusHdl();
     849                 :            : 
     850         [ #  # ]:          0 :     if(!pHdl)
     851                 :            :     {
     852                 :          0 :         ((SdrHdlList&)rHdlList).TravelFocusHdl(true);
     853                 :            :     }
     854                 :          0 : }
     855                 :            : 
     856                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10