update credits
[LibreOffice.git] / sw / source / core / text / noteurl.cxx
blobf70bcf0ba3713a2c9e606ed4708058d9f44fbe64
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "swtypes.hxx"
21 #include <vcl/outdev.hxx>
22 #include <svtools/imaprect.hxx>
23 #include <svtools/imap.hxx>
25 #include "txttypes.hxx"
26 #include "noteurl.hxx"
28 // Global variable
29 SwNoteURL *pNoteURL = NULL;
32 void SwNoteURL::InsertURLNote( const XubString& rURL, const XubString& rTarget,
33 const SwRect& rRect )
35 MSHORT i;
36 MSHORT nCount = aList.size();
37 for( i = 0; i < nCount; i++ )
38 if( rRect == aList[i].GetRect() )
39 break;
40 if( i == nCount )
42 SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect );
43 aList.push_back( pNew );
48 void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
49 const MapMode& rMap )
51 OSL_ENSURE( pMap, "FillImageMap: No ImageMap, no cookies!" );
52 MSHORT nCount = Count();
53 if( nCount )
55 MapMode aMap( MAP_100TH_MM );
56 for( MSHORT i = 0; i < nCount; ++i )
58 const SwURLNote &rNote = GetURLNote( i );
59 SwRect aSwRect( rNote.GetRect() );
60 aSwRect -= rPos;
61 Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(),
62 rMap, aMap ) );
63 IMapRectangleObject aObj( aRect, rNote.GetURL(), aEmptyStr, aEmptyStr,
64 rNote.GetTarget(), aEmptyStr, sal_True, sal_False );
65 pMap->InsertIMapObject( aObj );
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */