merge the formfield patch from ooo-build
[ooovba.git] / sw / source / core / text / noteurl.cxx
blob25e3c0da0605ee214d52227f71c356dff21e16e4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: noteurl.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
36 #include "swtypes.hxx"
37 #include <vcl/outdev.hxx>
38 #include <svtools/imaprect.hxx>
39 #include <svtools/imap.hxx>
41 #include "txttypes.hxx"
42 #include "noteurl.hxx"
44 // globale Variable, wird in noteurl.Hxx bekanntgegeben
45 SwNoteURL *pNoteURL = NULL;
47 SV_IMPL_PTRARR( SwURLNoteList, SwURLNotePtr )
50 void SwNoteURL::InsertURLNote( const XubString& rURL, const XubString& rTarget,
51 const SwRect& rRect )
53 MSHORT i;
54 MSHORT nCount = aList.Count();
55 for( i = 0; i < nCount; i++ )
56 if( rRect == aList.GetObject(i)->GetRect() )
57 break;
58 if( i == nCount )
60 SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect );
61 aList.Insert( pNew, nCount );
66 void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
67 const MapMode& rMap )
69 ASSERT( pMap, "FillImageMap: No ImageMap, no cookies!" );
70 MSHORT nCount = Count();
71 if( nCount )
73 MapMode aMap( MAP_100TH_MM );
74 for( MSHORT i = 0; i < nCount; ++i )
76 const SwURLNote &rNote = GetURLNote( i );
77 SwRect aSwRect( rNote.GetRect() );
78 aSwRect -= rPos;
79 Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(),
80 rMap, aMap ) );
81 IMapRectangleObject aObj( aRect, rNote.GetURL(), aEmptyStr, aEmptyStr,
82 rNote.GetTarget(), aEmptyStr, sal_True, sal_False );
83 pMap->InsertIMapObject( aObj );