LCOV - code coverage report
Current view: top level - svx/source/dialog - imapdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 424 0.2 %
Date: 2012-08-25 Functions: 2 42 4.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 945 0.1 %

           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 <stdlib.h>
      30                 :            : #include <tools/shl.hxx>
      31                 :            : #include <tools/errinf.hxx>
      32                 :            : #include <tools/urlobj.hxx>
      33                 :            : #include <unotools/ucbstreamhelper.hxx>
      34                 :            : #include <vcl/msgbox.hxx>
      35                 :            : #include <vcl/group.hxx>
      36                 :            : #include <vcl/lstbox.hxx>
      37                 :            : #include <svl/eitem.hxx>
      38                 :            : #include <unotools/pathoptions.hxx>
      39                 :            : #include <sfx2/dispatch.hxx>
      40                 :            : #include <sfx2/module.hxx>
      41                 :            : #include <sfx2/filedlghelper.hxx>
      42                 :            : #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
      43                 :            : #include <svl/urihelper.hxx>
      44                 :            : #include <svtools/miscopt.hxx>
      45                 :            : #include <svtools/ehdl.hxx>
      46                 :            : #include <svtools/sfxecode.hxx>
      47                 :            : #include <sfx2/viewfrm.hxx>
      48                 :            : #include <sfx2/objsh.hxx>
      49                 :            : #include <sfx2/docfile.hxx>
      50                 :            : #include <unotools/localedatawrapper.hxx>
      51                 :            : #include <comphelper/processfactory.hxx>
      52                 :            : 
      53                 :            : #define _IMAPDLG_PRIVATE
      54                 :            : #include "svx/imapdlg.hxx"
      55                 :            : 
      56                 :            : #include <svx/dialmgr.hxx>
      57                 :            : #include <svx/dialogs.hrc>
      58                 :            : #include <svx/svxids.hrc>
      59                 :            : #include "imapdlg.hrc"
      60                 :            : #include "imapwnd.hxx"
      61                 :            : #include "imapimp.hxx"
      62                 :            : #include "svx/dlgutil.hxx"
      63                 :            : #include <svx/svdtrans.hxx>
      64                 :            : #include <svx/svdopath.hxx>
      65                 :            : #include <vcl/svapp.hxx>
      66                 :            : #include "dlgunit.hxx"
      67                 :            : 
      68                 :            : #define SELF_TARGET         "_self"
      69                 :            : #define IMAP_ALL_FILTER     "<Alle>"
      70                 :            : #define IMAP_CERN_FILTER    "MAP - CERN"
      71                 :            : #define IMAP_NCSA_FILTER    "MAP - NCSA"
      72                 :            : #define IMAP_BINARY_FILTER  "SIP - StarView ImageMap"
      73                 :            : #define IMAP_ALL_TYPE       "*.*"
      74                 :            : #define IMAP_BINARY_TYPE    "*.sip"
      75                 :            : #define IMAP_CERN_TYPE      "*.map"
      76                 :            : #define IMAP_NCSA_TYPE      "*.map"
      77                 :            : #define IMAP_BINARY_EXT     "sip"
      78                 :            : #define IMAP_CERN_EXT       "map"
      79                 :            : #define IMAP_NCSA_EXT       "map"
      80                 :            : 
      81                 :            : /******************************************************************************/
      82                 :            : 
      83 [ #  # ][ +  - ]:        521 : SFX_IMPL_MODELESSDIALOG_WITHID( SvxIMapDlgChildWindow, SID_IMAP );
                 [ #  # ]
      84                 :            : 
      85                 :            : // ControllerItem
      86                 :            : 
      87                 :          0 : SvxIMapDlgItem::SvxIMapDlgItem( sal_uInt16 _nId, SvxIMapDlg& rIMapDlg, SfxBindings& rBindings ) :
      88                 :            :             SfxControllerItem   ( _nId, rBindings ),
      89                 :          0 :             rIMap               ( rIMapDlg )
      90                 :            : {
      91                 :          0 : }
      92                 :            : 
      93                 :          0 : void SvxIMapDlgItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
      94                 :            :                                    const SfxPoolItem* pItem )
      95                 :            : {
      96 [ #  # ][ #  # ]:          0 :     if ( ( nSID == SID_IMAP_EXEC ) && pItem )
      97                 :            :     {
      98 [ #  # ][ #  # ]:          0 :         const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem );
      99                 :            : 
     100                 :            :         DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem expected");
     101                 :            : 
     102                 :            :         // Disable Float if possible
     103                 :          0 :         rIMap.SetExecState( !pStateItem->GetValue() );
     104                 :            :     }
     105                 :          0 : }
     106                 :            : 
     107                 :          0 : SvxIMapDlgChildWindow::SvxIMapDlgChildWindow( Window* _pParent, sal_uInt16 nId,
     108                 :            :                                               SfxBindings* pBindings,
     109                 :            :                                               SfxChildWinInfo* pInfo ) :
     110                 :          0 :             SfxChildWindow( _pParent, nId )
     111                 :            : {
     112 [ #  # ][ #  # ]:          0 :     pWindow = new SvxIMapDlg( pBindings, this, _pParent, SVX_RES( RID_SVXDLG_IMAP ) );
                 [ #  # ]
     113                 :          0 :     SvxIMapDlg* pDlg = (SvxIMapDlg*) pWindow;
     114                 :            : 
     115         [ #  # ]:          0 :     if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
     116         [ #  # ]:          0 :         pDlg->RollUp();
     117                 :            : 
     118                 :          0 :     eChildAlignment = SFX_ALIGN_NOALIGNMENT;
     119                 :            : 
     120         [ #  # ]:          0 :     pDlg->Initialize( pInfo );
     121                 :          0 : }
     122                 :            : 
     123                 :          0 : void SvxIMapDlgChildWindow::UpdateIMapDlg( const Graphic& rGraphic, const ImageMap* pImageMap,
     124                 :            :                                            const TargetList* pTargetList, void* pEditingObj )
     125                 :            : {
     126   [ #  #  #  # ]:          0 :     if ( SfxViewFrame::Current() &&
                 [ #  # ]
     127                 :          0 :          SfxViewFrame::Current()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
     128                 :          0 :         SVXIMAPDLG()->Update( rGraphic, pImageMap, pTargetList, pEditingObj );
     129                 :          0 : }
     130                 :            : 
     131                 :          0 : SvxIMapDlg::SvxIMapDlg( SfxBindings *_pBindings, SfxChildWindow *pCW,
     132                 :            :                         Window* _pParent, const ResId& rResId ) :
     133                 :            :         SfxModelessDialog   ( _pBindings, pCW, _pParent, rResId ),
     134                 :            : 
     135         [ #  # ]:          0 :         aTbxIMapDlg1        ( this, SVX_RES( TBX_IMAPDLG1 ) ),
     136         [ #  # ]:          0 :         aFtURL              ( this, SVX_RES( FT_URL ) ),
     137         [ #  # ]:          0 :         maURLBox            ( this, SVX_RES( CBB_URL ) ),
     138         [ #  # ]:          0 :         aFtText             ( this, SVX_RES( FT_TEXT ) ),
     139         [ #  # ]:          0 :         aEdtText            ( this, SVX_RES( EDT_TEXT ) ),
     140         [ #  # ]:          0 :         maFtTarget          ( this, SVX_RES( RID_SVXCTL_FT_TARGET ) ),
     141         [ #  # ]:          0 :         maCbbTarget         ( this, SVX_RES( RID_SVXCTL_CBB_TARGET ) ),
     142                 :            :         aStbStatus          ( this, WB_BORDER | WB_3DLOOK | WB_LEFT ),
     143         [ #  # ]:          0 :         maImageList         ( SVX_RES( IL_IMAPDLG ) ),
     144                 :            :         pCheckObj           ( NULL ),
     145 [ #  # ][ #  # ]:          0 :         aIMapItem           ( SID_IMAP_EXEC, *this, *_pBindings )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     146                 :            : {
     147 [ #  # ][ #  # ]:          0 :     pIMapWnd = new IMapWindow( this, SVX_RES( RID_SVXCTL_IMAP ), _pBindings->GetActiveFrame() );
         [ #  # ][ #  # ]
     148                 :            : 
     149         [ #  # ]:          0 :     ApplyImageList();
     150                 :            : 
     151         [ #  # ]:          0 :     FreeResource();
     152                 :            : 
     153 [ #  # ][ #  # ]:          0 :     pOwnData = new IMapOwnData;
     154                 :            : 
     155         [ #  # ]:          0 :     pIMapWnd->SetInfoLink( LINK( this, SvxIMapDlg, InfoHdl ) );
     156         [ #  # ]:          0 :     pIMapWnd->SetMousePosLink( LINK( this, SvxIMapDlg, MousePosHdl ) );
     157         [ #  # ]:          0 :     pIMapWnd->SetGraphSizeLink( LINK( this, SvxIMapDlg, GraphSizeHdl ) );
     158         [ #  # ]:          0 :     pIMapWnd->SetUpdateLink( LINK( this, SvxIMapDlg, StateHdl ) );
     159                 :            : 
     160         [ #  # ]:          0 :     maURLBox.SetModifyHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
     161         [ #  # ]:          0 :     maURLBox.SetSelectHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
     162         [ #  # ]:          0 :     maURLBox.SetLoseFocusHdl( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) );
     163         [ #  # ]:          0 :     aEdtText.SetModifyHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
     164         [ #  # ]:          0 :     maCbbTarget.SetLoseFocusHdl( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) );
     165                 :            : 
     166         [ #  # ]:          0 :        SvtMiscOptions aMiscOptions;
     167 [ #  # ][ #  # ]:          0 :     aMiscOptions.AddListenerLink( LINK( this, SvxIMapDlg, MiscHdl ) );
     168                 :            : 
     169 [ #  # ][ #  # ]:          0 :     aTbxIMapDlg1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
     170 [ #  # ][ #  # ]:          0 :     aTbxIMapDlg1.SetSizePixel( aTbxIMapDlg1.CalcWindowSizePixel() );
     171         [ #  # ]:          0 :     aTbxIMapDlg1.SetSelectHdl( LINK( this, SvxIMapDlg, TbxClickHdl ) );
     172         [ #  # ]:          0 :     aTbxIMapDlg1.CheckItem( TBI_SELECT, sal_True );
     173         [ #  # ]:          0 :     TbxClickHdl( &aTbxIMapDlg1 );
     174                 :            : 
     175         [ #  # ]:          0 :     SetMinOutputSizePixel( aLastSize = GetOutputSizePixel() );
     176                 :            : 
     177         [ #  # ]:          0 :     aStbStatus.InsertItem( 1, 130, SIB_LEFT | SIB_IN | SIB_AUTOSIZE );
     178 [ #  # ][ #  # ]:          0 :     aStbStatus.InsertItem( 2, 10 + GetTextWidth( DEFINE_CONST_UNICODE( " 9999,99 cm / 9999,99 cm ") ), SIB_CENTER | SIB_IN );
         [ #  # ][ #  # ]
     179 [ #  # ][ #  # ]:          0 :     aStbStatus.InsertItem( 3, 10 + GetTextWidth( DEFINE_CONST_UNICODE( " 9999,99 cm x 9999,99 cm ") ), SIB_CENTER | SIB_IN );
         [ #  # ][ #  # ]
     180                 :            : 
     181         [ #  # ]:          0 :     aFtURL.Disable();
     182         [ #  # ]:          0 :     maURLBox.Disable();
     183         [ #  # ]:          0 :     aFtText.Disable();
     184         [ #  # ]:          0 :     aEdtText.Disable();
     185         [ #  # ]:          0 :     maFtTarget.Disable();
     186         [ #  # ]:          0 :     maCbbTarget.Disable();
     187                 :          0 :     pOwnData->bExecState = sal_False;
     188                 :            : 
     189         [ #  # ]:          0 :     Resize();
     190                 :            : 
     191         [ #  # ]:          0 :     pOwnData->aTimer.SetTimeout( 100 );
     192         [ #  # ]:          0 :     pOwnData->aTimer.SetTimeoutHdl( LINK( this, SvxIMapDlg, UpdateHdl ) );
     193                 :            : 
     194         [ #  # ]:          0 :     aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_False );
     195         [ #  # ]:          0 :     aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_False );
     196 [ #  # ][ #  # ]:          0 :     aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_False );
     197                 :          0 : }
     198                 :            : 
     199 [ #  # ][ #  # ]:          0 : SvxIMapDlg::~SvxIMapDlg()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     200                 :            : {
     201                 :            :     // Delete URL-List
     202 [ #  # ][ #  # ]:          0 :     delete pIMapWnd;
     203 [ #  # ][ #  # ]:          0 :     delete pOwnData;
     204         [ #  # ]:          0 : }
     205                 :            : 
     206                 :          0 : void SvxIMapDlg::Resize()
     207                 :            : {
     208         [ #  # ]:          0 :     SfxModelessDialog::Resize();
     209                 :            : 
     210                 :          0 :     Size aMinSize( GetMinOutputSizePixel() );
     211                 :          0 :     Size aNewSize( GetOutputSizePixel() );
     212                 :            : 
     213         [ #  # ]:          0 :     if ( aNewSize.Height() >= aMinSize.Height() )
     214                 :            :     {
     215         [ #  # ]:          0 :         Size    _aSize( aStbStatus.GetSizePixel() );
     216                 :          0 :         Point   aPoint( 0, aNewSize.Height() - _aSize.Height() );
     217                 :            : 
     218                 :            :         // Position the StatusBar
     219         [ #  # ]:          0 :         aStbStatus.SetPosSizePixel( aPoint, Size( aNewSize.Width(), _aSize.Height() ) );
     220         [ #  # ]:          0 :         aStbStatus.Show();
     221                 :            : 
     222                 :            :         // Position the EditWindow
     223                 :          0 :         _aSize.Width() = aNewSize.Width() - 18;
     224         [ #  # ]:          0 :         _aSize.Height() = aPoint.Y() - pIMapWnd->GetPosPixel().Y() - 6;
     225         [ #  # ]:          0 :         pIMapWnd->SetSizePixel( _aSize );
     226                 :            : 
     227                 :          0 :         aLastSize = aNewSize;
     228                 :            :     }
     229                 :          0 : }
     230                 :            : 
     231                 :          0 : sal_Bool SvxIMapDlg::Close()
     232                 :            : {
     233                 :          0 :     sal_Bool bRet = sal_True;
     234                 :            : 
     235         [ #  # ]:          0 :     if ( aTbxIMapDlg1.IsItemEnabled( TBI_APPLY ) )
     236                 :            :     {
     237                 :            :         QueryBox    aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
     238 [ #  # ][ #  # ]:          0 :                            String( SVX_RES( STR_IMAPDLG_MODIFY ) ) );
         [ #  # ][ #  # ]
     239         [ #  # ]:          0 :         const long  nRet = aQBox.Execute();
     240                 :            : 
     241         [ #  # ]:          0 :         if( nRet == RET_YES )
     242                 :            :         {
     243         [ #  # ]:          0 :             SfxBoolItem aBoolItem( SID_IMAP_EXEC, sal_True );
     244                 :          0 :             GetBindings().GetDispatcher()->Execute(
     245 [ #  # ][ #  # ]:          0 :                 SID_IMAP_EXEC, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
     246                 :            :         }
     247         [ #  # ]:          0 :         else if( nRet == RET_CANCEL )
     248         [ #  # ]:          0 :             bRet = sal_False;
     249                 :            :     }
     250         [ #  # ]:          0 :     else if( pIMapWnd->IsChanged() )
     251                 :            :     {
     252                 :            :         QueryBox    aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
     253 [ #  # ][ #  # ]:          0 :                            String( SVX_RES( STR_IMAPDLG_SAVE ) ) );
         [ #  # ][ #  # ]
     254         [ #  # ]:          0 :         const long  nRet = aQBox.Execute();
     255                 :            : 
     256         [ #  # ]:          0 :         if( nRet == RET_YES )
     257         [ #  # ]:          0 :             bRet = DoSave();
     258         [ #  # ]:          0 :         else if( nRet == RET_CANCEL )
     259         [ #  # ]:          0 :             bRet = sal_False;
     260                 :            :     }
     261                 :            : 
     262         [ #  # ]:          0 :     return( bRet ? SfxModelessDialog::Close() : sal_False );
     263                 :            : }
     264                 :            : 
     265                 :            : // Enabled or disable all Controls
     266                 :            : 
     267                 :          0 : void SvxIMapDlg::SetExecState( sal_Bool bEnable )
     268                 :            : {
     269                 :          0 :     pOwnData->bExecState = bEnable;
     270                 :          0 : }
     271                 :            : 
     272                 :          0 : void SvxIMapDlg::SetGraphic( const Graphic& rGraphic )
     273                 :            : {
     274                 :          0 :     pIMapWnd->SetGraphic( rGraphic );
     275                 :          0 : }
     276                 :            : 
     277                 :          0 : void SvxIMapDlg::SetImageMap( const ImageMap& rImageMap )
     278                 :            : {
     279                 :          0 :     pIMapWnd->SetImageMap( rImageMap );
     280                 :          0 : }
     281                 :            : 
     282                 :          0 : const ImageMap& SvxIMapDlg::GetImageMap() const
     283                 :            : {
     284                 :          0 :     return pIMapWnd->GetImageMap();
     285                 :            : }
     286                 :            : 
     287                 :          0 : void SvxIMapDlg::SetTargetList( const TargetList& rTargetList )
     288                 :            : {
     289         [ #  # ]:          0 :     TargetList  aNewList( rTargetList );
     290                 :            : 
     291         [ #  # ]:          0 :     pIMapWnd->SetTargetList( aNewList );
     292                 :            : 
     293         [ #  # ]:          0 :     maCbbTarget.Clear();
     294                 :            : 
     295         [ #  # ]:          0 :     for ( size_t i = 0, n = aNewList.size(); i < n; ++i )
     296 [ #  # ][ #  # ]:          0 :         maCbbTarget.InsertEntry( *aNewList[ i ] );
     297                 :          0 : }
     298                 :            : 
     299                 :          0 : void SvxIMapDlg::Update( const Graphic& rGraphic, const ImageMap* pImageMap,
     300                 :            :                          const TargetList* pTargetList, void* pEditingObj )
     301                 :            : {
     302                 :          0 :     pOwnData->aUpdateGraphic = rGraphic;
     303                 :            : 
     304         [ #  # ]:          0 :     if ( pImageMap )
     305                 :          0 :         pOwnData->aUpdateImageMap = *pImageMap;
     306                 :            :     else
     307                 :          0 :         pOwnData->aUpdateImageMap.ClearImageMap();
     308                 :            : 
     309                 :          0 :     pOwnData->pUpdateEditingObject = pEditingObj;
     310                 :            : 
     311                 :            :     // Delete UpdateTargetList, because this method can still be called several
     312                 :            :     // times before the update timer is turned on
     313         [ #  # ]:          0 :     for ( size_t i = 0, n = pOwnData->aUpdateTargetList.size(); i < n; ++i )
     314         [ #  # ]:          0 :         delete pOwnData->aUpdateTargetList[ i ];
     315                 :          0 :     pOwnData->aUpdateTargetList.clear();
     316                 :            : 
     317                 :            :     // TargetList must be copied, since it is owned by the caller and can be
     318                 :            :     // deleted immediately after this call the copied list will be deleted
     319                 :            :     // again in the handler
     320         [ #  # ]:          0 :     if( pTargetList )
     321                 :            :     {
     322         [ #  # ]:          0 :         TargetList aTargetList( *pTargetList );
     323                 :            : 
     324         [ #  # ]:          0 :         for ( size_t i = 0, n = aTargetList.size(); i < n; ++i )
     325 [ #  # ][ #  # ]:          0 :             pOwnData->aUpdateTargetList.push_back( new String( *aTargetList[ i ] ) );
         [ #  # ][ #  # ]
     326                 :            :     }
     327                 :            : 
     328                 :          0 :     pOwnData->aTimer.Start();
     329                 :          0 : }
     330                 :            : 
     331                 :            : 
     332                 :          0 : void SvxIMapDlg::KeyInput( const KeyEvent& rKEvt )
     333                 :            : {
     334                 :          0 :         SfxModelessDialog::KeyInput( rKEvt );
     335                 :          0 : }
     336                 :            : 
     337                 :            : // Click-handler for ToolBox
     338                 :            : 
     339                 :          0 : IMPL_LINK( SvxIMapDlg, TbxClickHdl, ToolBox*, pTbx )
     340                 :            : {
     341                 :          0 :     sal_uInt16 nNewItemId = pTbx->GetCurItemId();
     342                 :            : 
     343   [ #  #  #  #  :          0 :     switch( pTbx->GetCurItemId() )
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     344                 :            :     {
     345                 :            :         case( TBI_APPLY ):
     346                 :            :         {
     347         [ #  # ]:          0 :             URLLoseFocusHdl( NULL );
     348         [ #  # ]:          0 :             SfxBoolItem aBoolItem( SID_IMAP_EXEC, sal_True );
     349                 :          0 :             GetBindings().GetDispatcher()->Execute(
     350 [ #  # ][ #  # ]:          0 :                 SID_IMAP_EXEC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
     351                 :            :         }
     352                 :          0 :         break;
     353                 :            : 
     354                 :            :         case( TBI_OPEN ):
     355                 :          0 :             DoOpen();
     356                 :          0 :         break;
     357                 :            : 
     358                 :            :         case( TBI_SAVEAS ):
     359                 :          0 :             DoSave();
     360                 :          0 :         break;
     361                 :            : 
     362                 :            :         case( TBI_SELECT ):
     363                 :            :         {
     364                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     365                 :          0 :             pIMapWnd->SetEditMode( sal_True );
     366         [ #  # ]:          0 :             if( pTbx->IsKeyEvent() )
     367                 :            :             {
     368         [ #  # ]:          0 :                 if((pTbx->GetKeyModifier() & KEY_MOD1) != 0)
     369                 :          0 :                     pIMapWnd->SelectFirstObject();
     370                 :            :                 else
     371                 :          0 :                     pIMapWnd->GrabFocus();
     372                 :            :             }
     373                 :            :         }
     374                 :          0 :         break;
     375                 :            : 
     376                 :            :         case( TBI_RECT ):
     377                 :            :         {
     378                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     379                 :          0 :             pIMapWnd->SetObjKind( OBJ_RECT );
     380 [ #  # ][ #  # ]:          0 :             if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
                 [ #  # ]
     381                 :            :             {
     382                 :          0 :                 pIMapWnd->CreateDefaultObject();
     383                 :          0 :                 pIMapWnd->GrabFocus();
     384                 :            :             }
     385                 :            :         }
     386                 :          0 :         break;
     387                 :            : 
     388                 :            :         case( TBI_CIRCLE ):
     389                 :            :         {
     390                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     391                 :          0 :             pIMapWnd->SetObjKind( OBJ_CIRC );
     392 [ #  # ][ #  # ]:          0 :             if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
                 [ #  # ]
     393                 :            :             {
     394                 :          0 :                 pIMapWnd->CreateDefaultObject();
     395                 :          0 :                 pIMapWnd->GrabFocus();
     396                 :            :             }
     397                 :            :         }
     398                 :          0 :         break;
     399                 :            : 
     400                 :            :         case( TBI_POLY ):
     401                 :            :         {
     402                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     403                 :          0 :             pIMapWnd->SetObjKind( OBJ_POLY );
     404 [ #  # ][ #  # ]:          0 :             if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
                 [ #  # ]
     405                 :            :             {
     406                 :          0 :                 pIMapWnd->CreateDefaultObject();
     407                 :          0 :                 pIMapWnd->GrabFocus();
     408                 :            :             }
     409                 :            :         }
     410                 :          0 :         break;
     411                 :            : 
     412                 :            :         case( TBI_FREEPOLY ):
     413                 :            :         {
     414                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     415                 :          0 :             pIMapWnd->SetObjKind( OBJ_FREEFILL );
     416 [ #  # ][ #  # ]:          0 :             if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
                 [ #  # ]
     417                 :            :             {
     418                 :          0 :                 pIMapWnd->CreateDefaultObject();
     419                 :          0 :                 pIMapWnd->GrabFocus();
     420                 :            :             }
     421                 :            :         }
     422                 :          0 :         break;
     423                 :            : 
     424                 :            :         case( TBI_ACTIVE ):
     425                 :            :         {
     426                 :          0 :             URLLoseFocusHdl( NULL );
     427                 :          0 :             sal_Bool bNewState = !pTbx->IsItemChecked( TBI_ACTIVE );
     428                 :          0 :             pTbx->CheckItem( TBI_ACTIVE, bNewState );
     429                 :          0 :             pIMapWnd->SetCurrentObjState( !bNewState );
     430                 :            :         }
     431                 :          0 :         break;
     432                 :            : 
     433                 :            :         case( TBI_MACRO ):
     434                 :          0 :             pIMapWnd->DoMacroAssign();
     435                 :          0 :         break;
     436                 :            : 
     437                 :            :         case( TBI_PROPERTY ):
     438                 :          0 :             pIMapWnd->DoPropertyDialog();
     439                 :          0 :         break;
     440                 :            : 
     441                 :            :         case( TBI_POLYEDIT ):
     442         [ #  # ]:          0 :             pIMapWnd->SetPolyEditMode( pTbx->IsItemChecked( TBI_POLYEDIT ) ? SID_BEZIER_MOVE : 0 );
     443 [ #  # ][ #  # ]:          0 :             if( pTbx->IsKeyEvent() && pTbx->IsItemChecked( TBI_POLYEDIT ) )
                 [ #  # ]
     444                 :          0 :                 pIMapWnd->StartPolyEdit();
     445                 :          0 :         break;
     446                 :            : 
     447                 :            :         case( TBI_POLYMOVE ):
     448                 :          0 :             pIMapWnd->SetPolyEditMode( SID_BEZIER_MOVE );
     449                 :          0 :         break;
     450                 :            : 
     451                 :            :         case( TBI_POLYINSERT ):
     452                 :          0 :             pIMapWnd->SetPolyEditMode( SID_BEZIER_INSERT );
     453                 :          0 :         break;
     454                 :            : 
     455                 :            :         case( TBI_POLYDELETE ):
     456                 :          0 :             pIMapWnd->GetSdrView()->DeleteMarkedPoints();
     457                 :          0 :         break;
     458                 :            : 
     459                 :            :         case( TBI_UNDO ):
     460                 :            :         {
     461                 :          0 :             URLLoseFocusHdl( NULL );
     462                 :          0 :             pIMapWnd->GetSdrModel()->Undo();
     463                 :            :         }
     464                 :          0 :         break;
     465                 :            : 
     466                 :            :         case( TBI_REDO ):
     467                 :            :         {
     468                 :          0 :             URLLoseFocusHdl( NULL );
     469                 :          0 :             pIMapWnd->GetSdrModel()->Redo();
     470                 :            :         }
     471                 :          0 :         break;
     472                 :            : 
     473                 :            :         default:
     474                 :          0 :         break;
     475                 :            :     }
     476                 :            : 
     477                 :          0 :     return 0;
     478                 :            : }
     479                 :            : 
     480                 :          0 : void SvxIMapDlg::DoOpen()
     481                 :            : {
     482                 :            :     ::sfx2::FileDialogHelper aDlg(
     483         [ #  # ]:          0 :         com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
     484                 :            : 
     485         [ #  # ]:          0 :     ImageMap        aLoadIMap;
     486         [ #  # ]:          0 :     const String    aFilter( DEFINE_CONST_UNICODE( IMAP_ALL_FILTER ) );
     487                 :            : 
     488 [ #  # ][ #  # ]:          0 :     aDlg.AddFilter( aFilter, DEFINE_CONST_UNICODE( IMAP_ALL_TYPE ) );
                 [ #  # ]
     489 [ #  # ][ #  # ]:          0 :     aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_CERN_FILTER ), DEFINE_CONST_UNICODE( IMAP_CERN_TYPE ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     490 [ #  # ][ #  # ]:          0 :     aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_NCSA_FILTER ), DEFINE_CONST_UNICODE( IMAP_NCSA_TYPE ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     491 [ #  # ][ #  # ]:          0 :     aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_BINARY_FILTER ), DEFINE_CONST_UNICODE( IMAP_BINARY_TYPE ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     492                 :            : 
     493         [ #  # ]:          0 :     aDlg.SetCurrentFilter( aFilter );
     494 [ #  # ][ #  # ]:          0 :     aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
         [ #  # ][ #  # ]
     495                 :            : 
     496 [ #  # ][ #  # ]:          0 :     if( aDlg.Execute() == ERRCODE_NONE )
     497                 :            :     {
     498 [ #  # ][ #  # ]:          0 :         INetURLObject aURL( aDlg.GetPath() );
         [ #  # ][ #  # ]
     499                 :            :         DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
     500 [ #  # ][ #  # ]:          0 :         SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
         [ #  # ][ #  # ]
     501                 :            : 
     502         [ #  # ]:          0 :         if( pIStm )
     503                 :            :         {
     504 [ #  # ][ #  # ]:          0 :             aLoadIMap.Read( *pIStm, IMAP_FORMAT_DETECT, String() );
                 [ #  # ]
     505                 :            : 
     506         [ #  # ]:          0 :             if( pIStm->GetError() )
     507                 :            :             {
     508         [ #  # ]:          0 :                 SfxErrorContext eEC(ERRCODE_SFX_GENERAL,this);
     509 [ #  # ][ #  # ]:          0 :                 ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
     510                 :            :             }
     511                 :            :             else
     512         [ #  # ]:          0 :                 pIMapWnd->SetImageMap( aLoadIMap );
     513                 :            : 
     514 [ #  # ][ #  # ]:          0 :             delete pIStm;
     515                 :            :         }
     516                 :            : 
     517 [ #  # ][ #  # ]:          0 :         pIMapWnd->Invalidate();
     518 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
     519                 :          0 : }
     520                 :            : 
     521                 :          0 : sal_Bool SvxIMapDlg::DoSave()
     522                 :            : {
     523                 :            :     ::sfx2::FileDialogHelper aDlg(
     524         [ #  # ]:          0 :         com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
     525                 :            : 
     526         [ #  # ]:          0 :     const String    aBinFilter( DEFINE_CONST_UNICODE( IMAP_BINARY_FILTER ) );
     527         [ #  # ]:          0 :     const String    aCERNFilter( DEFINE_CONST_UNICODE( IMAP_CERN_FILTER ) );
     528         [ #  # ]:          0 :     const String    aNCSAFilter( DEFINE_CONST_UNICODE( IMAP_NCSA_FILTER ) );
     529                 :          0 :     SdrModel*       pModel = pIMapWnd->GetSdrModel();
     530                 :          0 :     const sal_Bool bChanged = pModel->IsChanged();
     531                 :          0 :     sal_Bool            bRet = false;
     532                 :            : 
     533 [ #  # ][ #  # ]:          0 :     aDlg.AddFilter( aCERNFilter, DEFINE_CONST_UNICODE( IMAP_CERN_TYPE ) );
                 [ #  # ]
     534 [ #  # ][ #  # ]:          0 :     aDlg.AddFilter( aNCSAFilter, DEFINE_CONST_UNICODE( IMAP_NCSA_TYPE ) );
                 [ #  # ]
     535 [ #  # ][ #  # ]:          0 :     aDlg.AddFilter( aBinFilter, DEFINE_CONST_UNICODE( IMAP_BINARY_TYPE ) );
                 [ #  # ]
     536                 :            : 
     537         [ #  # ]:          0 :     aDlg.SetCurrentFilter( aCERNFilter );
     538 [ #  # ][ #  # ]:          0 :     aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
         [ #  # ][ #  # ]
     539                 :            : 
     540 [ #  # ][ #  # ]:          0 :     if( aDlg.Execute() == ERRCODE_NONE )
     541                 :            :     {
     542         [ #  # ]:          0 :         const String    aFilter( aDlg.GetCurrentFilter() );
     543         [ #  # ]:          0 :         String          aExt;
     544                 :            :         sal_uIntPtr         nFormat;
     545                 :            : 
     546 [ #  # ][ #  # ]:          0 :         if ( aFilter == aBinFilter )
     547                 :            :         {
     548                 :          0 :             nFormat = IMAP_FORMAT_BIN;
     549 [ #  # ][ #  # ]:          0 :             aExt = DEFINE_CONST_UNICODE( IMAP_BINARY_EXT );
                 [ #  # ]
     550                 :            :         }
     551 [ #  # ][ #  # ]:          0 :         else if ( aFilter == aCERNFilter )
     552                 :            :         {
     553                 :          0 :             nFormat = IMAP_FORMAT_CERN;
     554 [ #  # ][ #  # ]:          0 :             aExt = DEFINE_CONST_UNICODE( IMAP_CERN_EXT );
                 [ #  # ]
     555                 :            :         }
     556 [ #  # ][ #  # ]:          0 :         else if ( aFilter == aNCSAFilter )
     557                 :            :         {
     558                 :          0 :             nFormat = IMAP_FORMAT_NCSA;
     559 [ #  # ][ #  # ]:          0 :             aExt = DEFINE_CONST_UNICODE( IMAP_NCSA_EXT );
                 [ #  # ]
     560                 :            :         }
     561                 :            :         else
     562                 :            :         {
     563                 :          0 :             return sal_False;
     564                 :            :         }
     565                 :            : 
     566 [ #  # ][ #  # ]:          0 :         INetURLObject aURL( aDlg.GetPath() );
         [ #  # ][ #  # ]
     567                 :            : 
     568         [ #  # ]:          0 :         if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
     569                 :            :         {
     570                 :            :             OSL_FAIL( "invalid URL" );
     571                 :            :         }
     572                 :            :         else
     573                 :            :         {
     574 [ #  # ][ #  # ]:          0 :             if( aURL.getExtension().isEmpty() )
     575 [ #  # ][ #  # ]:          0 :                 aURL.setExtension( aExt );
     576                 :            : 
     577 [ #  # ][ #  # ]:          0 :             SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
         [ #  # ][ #  # ]
     578         [ #  # ]:          0 :             if( pOStm )
     579                 :            :             {
     580 [ #  # ][ #  # ]:          0 :                 pIMapWnd->GetImageMap().Write( *pOStm, nFormat, String() );
         [ #  # ][ #  # ]
     581                 :            : 
     582         [ #  # ]:          0 :                 if( pOStm->GetError() )
     583         [ #  # ]:          0 :                     ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
     584                 :            : 
     585 [ #  # ][ #  # ]:          0 :                 delete pOStm;
     586         [ #  # ]:          0 :                 pModel->SetChanged( bChanged );
     587                 :          0 :                 bRet = sal_True;
     588                 :            :             }
     589 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
                 [ #  # ]
     590                 :            :     }
     591                 :            : 
     592 [ #  # ][ #  # ]:          0 :     return bRet;
         [ #  # ][ #  # ]
     593                 :            : }
     594                 :            : 
     595                 :          0 : IMPL_LINK( SvxIMapDlg, InfoHdl, IMapWindow*, pWnd )
     596                 :            : {
     597         [ #  # ]:          0 :     String              aStr;
     598                 :          0 :     const NotifyInfo&   rInfo = pWnd->GetInfo();
     599                 :            : 
     600         [ #  # ]:          0 :     if ( rInfo.bNewObj )
     601                 :            :     {
     602 [ #  # ][ #  # ]:          0 :         if( rInfo.aMarkURL.Len() && ( maURLBox.GetEntryPos( rInfo.aMarkURL ) == LISTBOX_ENTRY_NOTFOUND ) )
         [ #  # ][ #  # ]
     603         [ #  # ]:          0 :             maURLBox.InsertEntry( rInfo.aMarkURL );
     604                 :            : 
     605         [ #  # ]:          0 :         maURLBox.SetText( rInfo.aMarkURL );
     606         [ #  # ]:          0 :         aEdtText.SetText( rInfo.aMarkAltText );
     607                 :            : 
     608         [ #  # ]:          0 :         if ( !rInfo.aMarkTarget.Len() )
     609 [ #  # ][ #  # ]:          0 :             maCbbTarget.SetText( DEFINE_CONST_UNICODE( SELF_TARGET ) );
                 [ #  # ]
     610                 :            :         else
     611         [ #  # ]:          0 :             maCbbTarget.SetText( rInfo.aMarkTarget );
     612                 :            :     }
     613                 :            : 
     614         [ #  # ]:          0 :     if ( !rInfo.bOneMarked )
     615                 :            :     {
     616         [ #  # ]:          0 :         aTbxIMapDlg1.CheckItem( TBI_ACTIVE, sal_False );
     617         [ #  # ]:          0 :         aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_False );
     618         [ #  # ]:          0 :         aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_False );
     619         [ #  # ]:          0 :         aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_False );
     620         [ #  # ]:          0 :         aStbStatus.SetItemText( 1, aStr );
     621                 :            : 
     622         [ #  # ]:          0 :         aFtURL.Disable();
     623         [ #  # ]:          0 :         maURLBox.Disable();
     624         [ #  # ]:          0 :         aFtText.Disable();
     625         [ #  # ]:          0 :         aEdtText.Disable();
     626         [ #  # ]:          0 :         maFtTarget.Disable();
     627         [ #  # ]:          0 :         maCbbTarget.Disable();
     628                 :            : 
     629 [ #  # ][ #  # ]:          0 :         maURLBox.SetText( String() );
                 [ #  # ]
     630 [ #  # ][ #  # ]:          0 :         aEdtText.SetText( String() );
                 [ #  # ]
     631                 :            :     }
     632                 :            :     else
     633                 :            :     {
     634         [ #  # ]:          0 :         aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_True );
     635         [ #  # ]:          0 :         aTbxIMapDlg1.CheckItem( TBI_ACTIVE, !rInfo.bActivated );
     636         [ #  # ]:          0 :         aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_True );
     637         [ #  # ]:          0 :         aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_True );
     638                 :            : 
     639         [ #  # ]:          0 :         aFtURL.Enable();
     640         [ #  # ]:          0 :         maURLBox.Enable();
     641         [ #  # ]:          0 :         aFtText.Enable();
     642         [ #  # ]:          0 :         aEdtText.Enable();
     643         [ #  # ]:          0 :         maFtTarget.Enable();
     644         [ #  # ]:          0 :         maCbbTarget.Enable();
     645                 :            : 
     646         [ #  # ]:          0 :         aStbStatus.SetItemText( 1, rInfo.aMarkURL );
     647                 :            : 
     648 [ #  # ][ #  # ]:          0 :         if ( maURLBox.GetText() != rInfo.aMarkURL )
         [ #  # ][ #  # ]
     649         [ #  # ]:          0 :             maURLBox.SetText( rInfo.aMarkURL );
     650                 :            : 
     651 [ #  # ][ #  # ]:          0 :         if ( aEdtText.GetText() != rInfo.aMarkAltText )
         [ #  # ][ #  # ]
     652         [ #  # ]:          0 :             aEdtText.SetText( rInfo.aMarkAltText );
     653                 :            : 
     654         [ #  # ]:          0 :         if ( !rInfo.aMarkTarget.Len() )
     655 [ #  # ][ #  # ]:          0 :             maCbbTarget.SetText( DEFINE_CONST_UNICODE( SELF_TARGET ) );
                 [ #  # ]
     656                 :            :         else
     657         [ #  # ]:          0 :             maCbbTarget.SetText(  rInfo.aMarkTarget );
     658                 :            :     }
     659                 :            : 
     660         [ #  # ]:          0 :     return 0;
     661                 :            : }
     662                 :            : 
     663                 :          0 : IMPL_LINK( SvxIMapDlg, MousePosHdl, IMapWindow*, pWnd )
     664                 :            : {
     665         [ #  # ]:          0 :     String aStr;
     666 [ #  # ][ #  # ]:          0 :     const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
     667                 :          0 :     const Point& rMousePos = pWnd->GetMousePos();
     668 [ #  # ][ #  # ]:          0 :     LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
         [ #  # ][ #  # ]
     669         [ #  # ]:          0 :     const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
     670                 :            : 
     671 [ #  # ][ #  # ]:          0 :     aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
                 [ #  # ]
     672 [ #  # ][ #  # ]:          0 :     aStr.Append( DEFINE_CONST_UNICODE( " / " ) );
                 [ #  # ]
     673 [ #  # ][ #  # ]:          0 :     aStr.Append( GetUnitString( rMousePos.Y(), eFieldUnit, cSep ) );
                 [ #  # ]
     674                 :            : 
     675         [ #  # ]:          0 :     aStbStatus.SetItemText( 2, aStr );
     676                 :            : 
     677 [ #  # ][ #  # ]:          0 :     return 0L;
     678                 :            : }
     679                 :            : 
     680                 :          0 : IMPL_LINK( SvxIMapDlg, GraphSizeHdl, IMapWindow*, pWnd )
     681                 :            : {
     682         [ #  # ]:          0 :     String aStr;
     683 [ #  # ][ #  # ]:          0 :     const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
     684                 :          0 :     const Size& rSize = pWnd->GetGraphicSize();
     685 [ #  # ][ #  # ]:          0 :     LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
         [ #  # ][ #  # ]
     686         [ #  # ]:          0 :     const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
     687                 :            : 
     688 [ #  # ][ #  # ]:          0 :     aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );
                 [ #  # ]
     689 [ #  # ][ #  # ]:          0 :     aStr.Append( DEFINE_CONST_UNICODE( " x " ) );
                 [ #  # ]
     690 [ #  # ][ #  # ]:          0 :     aStr.Append( GetUnitString( rSize.Height(), eFieldUnit, cSep ) );
                 [ #  # ]
     691                 :            : 
     692         [ #  # ]:          0 :     aStbStatus.SetItemText( 3, aStr );
     693                 :            : 
     694 [ #  # ][ #  # ]:          0 :     return 0L;
     695                 :            : }
     696                 :            : 
     697                 :          0 : IMPL_LINK_NOARG(SvxIMapDlg, URLModifyHdl)
     698                 :            : {
     699         [ #  # ]:          0 :     NotifyInfo  aNewInfo;
     700                 :            : 
     701 [ #  # ][ #  # ]:          0 :     aNewInfo.aMarkURL = maURLBox.GetText();
                 [ #  # ]
     702 [ #  # ][ #  # ]:          0 :     aNewInfo.aMarkAltText = aEdtText.GetText();
                 [ #  # ]
     703 [ #  # ][ #  # ]:          0 :     aNewInfo.aMarkTarget = maCbbTarget.GetText();
                 [ #  # ]
     704                 :            : 
     705         [ #  # ]:          0 :     pIMapWnd->ReplaceActualIMapInfo( aNewInfo );
     706                 :            : 
     707         [ #  # ]:          0 :     return 0;
     708                 :            : }
     709                 :            : 
     710                 :          0 : IMPL_LINK_NOARG(SvxIMapDlg, URLLoseFocusHdl)
     711                 :            : {
     712         [ #  # ]:          0 :     NotifyInfo      aNewInfo;
     713         [ #  # ]:          0 :     const String    aURLText( maURLBox.GetText() );
     714         [ #  # ]:          0 :     const String    aTargetText( maCbbTarget.GetText() );
     715                 :            : 
     716         [ #  # ]:          0 :     if ( aURLText.Len() )
     717                 :            :     {
     718 [ #  # ][ #  # ]:          0 :         String aBase = GetBindings().GetDispatcher()->GetFrame()->GetObjectShell()->GetMedium()->GetBaseURL();
         [ #  # ][ #  # ]
     719                 :            :         aNewInfo.aMarkURL = ::URIHelper::SmartRel2Abs( INetURLObject(aBase), aURLText, URIHelper::GetMaybeFileHdl(), true, false,
     720                 :            :                                                         INetURLObject::WAS_ENCODED,
     721 [ #  # ][ #  # ]:          0 :                                                         INetURLObject::DECODE_UNAMBIGUOUS );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     722                 :            :     }
     723                 :            :     else
     724         [ #  # ]:          0 :         aNewInfo.aMarkURL = aURLText;
     725                 :            : 
     726 [ #  # ][ #  # ]:          0 :     aNewInfo.aMarkAltText = aEdtText.GetText();
                 [ #  # ]
     727                 :            : 
     728         [ #  # ]:          0 :     if ( !aTargetText.Len() )
     729 [ #  # ][ #  # ]:          0 :         aNewInfo.aMarkTarget = DEFINE_CONST_UNICODE( SELF_TARGET );
                 [ #  # ]
     730                 :            :     else
     731         [ #  # ]:          0 :         aNewInfo.aMarkTarget = aTargetText;
     732                 :            : 
     733         [ #  # ]:          0 :     pIMapWnd->ReplaceActualIMapInfo( aNewInfo );
     734                 :            : 
     735 [ #  # ][ #  # ]:          0 :     return 0;
                 [ #  # ]
     736                 :            : }
     737                 :            : 
     738                 :          0 : IMPL_LINK_NOARG(SvxIMapDlg, UpdateHdl)
     739                 :            : {
     740                 :          0 :     pOwnData->aTimer.Stop();
     741                 :            : 
     742         [ #  # ]:          0 :     if ( pOwnData->pUpdateEditingObject != pCheckObj )
     743                 :            :     {
     744 [ #  # ][ #  # ]:          0 :         if ( pIMapWnd->IsChanged() &&
                 [ #  # ]
     745                 :            :              ( QueryBox( this, WB_YES_NO | WB_DEF_YES,
     746 [ #  # ][ #  # ]:          0 :              String( SVX_RES( STR_IMAPDLG_SAVE ) ) ).Execute() == RET_YES ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
     747                 :            :         {
     748                 :          0 :             DoSave();
     749                 :            :         }
     750                 :            : 
     751                 :          0 :         SetGraphic( pOwnData->aUpdateGraphic );
     752                 :          0 :         SetImageMap( pOwnData->aUpdateImageMap );
     753                 :          0 :         SetTargetList( pOwnData->aUpdateTargetList );
     754                 :          0 :         SetEditingObject( pOwnData->pUpdateEditingObject );
     755                 :            : 
     756                 :            :         // After changes => default selection
     757                 :          0 :         aTbxIMapDlg1.CheckItem( TBI_SELECT, sal_True );
     758                 :          0 :         pIMapWnd->SetEditMode( sal_True );
     759                 :            :     }
     760                 :            : 
     761                 :            :     // Delete the copied list again in the Update method
     762         [ #  # ]:          0 :     for ( size_t i = 0, n = pOwnData->aUpdateTargetList.size(); i < n; ++i )
     763         [ #  # ]:          0 :         delete pOwnData->aUpdateTargetList[ i ];
     764                 :          0 :     pOwnData->aUpdateTargetList.clear();
     765                 :            : 
     766                 :          0 :     GetBindings().Invalidate( SID_IMAP_EXEC );
     767                 :            : 
     768                 :          0 :     return 0L;
     769                 :            : }
     770                 :            : 
     771                 :          0 : IMPL_LINK( SvxIMapDlg, StateHdl, IMapWindow*, pWnd )
     772                 :            : {
     773                 :          0 :     const SdrObject*    pObj = pWnd->GetSelectedSdrObject();
     774                 :          0 :     const SdrModel*     pModel = pWnd->GetSdrModel();
     775                 :          0 :     const SdrView*      pView = pWnd->GetSdrView();
     776 [ #  # ][ #  # ]:          0 :     const sal_Bool          bPolyEdit = ( pObj != NULL ) && pObj->ISA( SdrPathObj );
     777 [ #  # ][ #  # ]:          0 :     const sal_Bool          bDrawEnabled = !( bPolyEdit && aTbxIMapDlg1.IsItemChecked( TBI_POLYEDIT ) );
     778                 :            : 
     779 [ #  # ][ #  # ]:          0 :     aTbxIMapDlg1.EnableItem( TBI_APPLY, pOwnData->bExecState && pWnd->IsChanged() );
     780                 :            : 
     781                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_SELECT, bDrawEnabled );
     782                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_RECT, bDrawEnabled );
     783                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_CIRCLE, bDrawEnabled );
     784                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_POLY, bDrawEnabled );
     785                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_FREEPOLY, bDrawEnabled );
     786                 :            : 
     787                 :            :     // BezierEditor-Stati
     788                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_POLYEDIT, bPolyEdit );
     789                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_POLYMOVE, !bDrawEnabled );
     790                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_POLYINSERT, !bDrawEnabled );
     791 [ #  # ][ #  # ]:          0 :     aTbxIMapDlg1.EnableItem( TBI_POLYDELETE, !bDrawEnabled && pView->IsDeleteMarkedPointsPossible() );
     792                 :            : 
     793                 :            :     // Undo/Redo
     794                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_UNDO, pModel->GetUndoActionCount() > 0 );
     795                 :          0 :     aTbxIMapDlg1.EnableItem( TBI_REDO, pModel->GetRedoActionCount() > 0 );
     796                 :            : 
     797         [ #  # ]:          0 :     if ( bPolyEdit )
     798                 :            :     {
     799                 :          0 :         sal_uInt16 nId = 0;
     800                 :            : 
     801      [ #  #  # ]:          0 :         switch( pWnd->GetPolyEditMode() )
     802                 :            :         {
     803                 :          0 :             case( SID_BEZIER_MOVE ): nId = TBI_POLYMOVE; break;
     804                 :          0 :             case( SID_BEZIER_INSERT ): nId = TBI_POLYINSERT; break;
     805                 :            : 
     806                 :            :             default:
     807                 :          0 :             break;
     808                 :            :         }
     809                 :            : 
     810                 :          0 :         aTbxIMapDlg1.CheckItem( nId, sal_True );
     811                 :            :     }
     812                 :            :     else
     813                 :            :     {
     814                 :          0 :         aTbxIMapDlg1.CheckItem( TBI_POLYEDIT, sal_False );
     815                 :          0 :         aTbxIMapDlg1.CheckItem( TBI_POLYMOVE, sal_True );
     816                 :          0 :         aTbxIMapDlg1.CheckItem( TBI_POLYINSERT, sal_False );
     817                 :          0 :         pWnd->SetPolyEditMode( 0 );
     818                 :            :     }
     819                 :            : 
     820                 :          0 :     return 0L;
     821                 :            : }
     822                 :            : 
     823                 :          0 : IMPL_LINK_NOARG(SvxIMapDlg, MiscHdl)
     824                 :            : {
     825         [ #  # ]:          0 :        SvtMiscOptions aMiscOptions;
     826 [ #  # ][ #  # ]:          0 :     aTbxIMapDlg1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
     827                 :            : 
     828         [ #  # ]:          0 :     return 0L;
     829                 :            : }
     830                 :            : 
     831                 :          0 : void SvxIMapDlg::ApplyImageList()
     832                 :            : {
     833                 :          0 :     ImageList& rImgLst = maImageList;
     834                 :            : 
     835                 :          0 :     aTbxIMapDlg1.SetImageList( rImgLst );
     836                 :          0 : }
     837                 :            : 
     838                 :          0 : void SvxIMapDlg::DataChanged( const DataChangedEvent& rDCEvt )
     839                 :            : {
     840                 :          0 :     SfxModelessDialog::DataChanged( rDCEvt );
     841                 :            : 
     842 [ #  # ][ #  # ]:          0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
                 [ #  # ]
     843                 :          0 :             ApplyImageList();
     844                 :          0 : }
     845                 :            : 
     846                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10