Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "swtypes.hxx"
21 : #include <vcl/outdev.hxx>
22 : #include <svtools/imaprect.hxx>
23 : #include <svtools/imap.hxx>
24 :
25 : #include "txttypes.hxx"
26 : #include "noteurl.hxx"
27 :
28 : // Global variable
29 : SwNoteURL *pNoteURL = NULL;
30 :
31 0 : void SwNoteURL::InsertURLNote( const OUString& rURL, const OUString& rTarget,
32 : const SwRect& rRect )
33 : {
34 : MSHORT i;
35 0 : MSHORT nCount = aList.size();
36 0 : for( i = 0; i < nCount; i++ )
37 0 : if( rRect == aList[i].GetRect() )
38 0 : break;
39 0 : if( i == nCount )
40 : {
41 0 : SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect );
42 0 : aList.push_back( pNew );
43 : }
44 0 : }
45 :
46 0 : void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
47 : const MapMode& rMap )
48 : {
49 : OSL_ENSURE( pMap, "FillImageMap: No ImageMap, no cookies!" );
50 0 : MSHORT nCount = Count();
51 0 : if( nCount )
52 : {
53 0 : MapMode aMap( MAP_100TH_MM );
54 0 : for( MSHORT i = 0; i < nCount; ++i )
55 : {
56 0 : const SwURLNote &rNote = GetURLNote( i );
57 0 : SwRect aSwRect( rNote.GetRect() );
58 0 : aSwRect -= rPos;
59 : Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(),
60 0 : rMap, aMap ) );
61 0 : IMapRectangleObject aObj( aRect, rNote.GetURL(), OUString(), OUString(),
62 0 : rNote.GetTarget(), OUString(), true, false );
63 0 : pMap->InsertIMapObject( aObj );
64 0 : }
65 : }
66 0 : }
67 :
68 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|