1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sw.hxx" 30 31 32 33 #include "swtypes.hxx" 34 #include <vcl/outdev.hxx> 35 #include <svtools/imaprect.hxx> 36 #include <svtools/imap.hxx> 37 38 #include "txttypes.hxx" 39 #include "noteurl.hxx" 40 41 // globale Variable, wird in noteurl.Hxx bekanntgegeben 42 SwNoteURL *pNoteURL = NULL; 43 44 SV_IMPL_PTRARR( SwURLNoteList, SwURLNotePtr ) 45 46 47 void SwNoteURL::InsertURLNote( const XubString& rURL, const XubString& rTarget, 48 const SwRect& rRect ) 49 { 50 MSHORT i; 51 MSHORT nCount = aList.Count(); 52 for( i = 0; i < nCount; i++ ) 53 if( rRect == aList.GetObject(i)->GetRect() ) 54 break; 55 if( i == nCount ) 56 { 57 SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect ); 58 aList.Insert( pNew, nCount ); 59 } 60 } 61 62 63 void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos, 64 const MapMode& rMap ) 65 { 66 ASSERT( pMap, "FillImageMap: No ImageMap, no cookies!" ); 67 MSHORT nCount = Count(); 68 if( nCount ) 69 { 70 MapMode aMap( MAP_100TH_MM ); 71 for( MSHORT i = 0; i < nCount; ++i ) 72 { 73 const SwURLNote &rNote = GetURLNote( i ); 74 SwRect aSwRect( rNote.GetRect() ); 75 aSwRect -= rPos; 76 Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(), 77 rMap, aMap ) ); 78 IMapRectangleObject aObj( aRect, rNote.GetURL(), aEmptyStr, aEmptyStr, 79 rNote.GetTarget(), aEmptyStr, sal_True, sal_False ); 80 pMap->InsertIMapObject( aObj ); 81 } 82 } 83 } 84 85 86 87 88