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 :
32 0 : void SwNoteURL::InsertURLNote( const XubString& rURL, const XubString& rTarget,
33 : const SwRect& rRect )
34 : {
35 : MSHORT i;
36 0 : MSHORT nCount = aList.size();
37 0 : for( i = 0; i < nCount; i++ )
38 0 : if( rRect == aList[i].GetRect() )
39 0 : break;
40 0 : if( i == nCount )
41 : {
42 0 : SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect );
43 0 : aList.push_back( pNew );
44 : }
45 0 : }
46 :
47 :
48 0 : void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
49 : const MapMode& rMap )
50 : {
51 : OSL_ENSURE( pMap, "FillImageMap: No ImageMap, no cookies!" );
52 0 : MSHORT nCount = Count();
53 0 : if( nCount )
54 : {
55 0 : MapMode aMap( MAP_100TH_MM );
56 0 : for( MSHORT i = 0; i < nCount; ++i )
57 : {
58 0 : const SwURLNote &rNote = GetURLNote( i );
59 0 : SwRect aSwRect( rNote.GetRect() );
60 0 : aSwRect -= rPos;
61 : Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(),
62 0 : rMap, aMap ) );
63 0 : IMapRectangleObject aObj( aRect, rNote.GetURL(), aEmptyStr, aEmptyStr,
64 0 : rNote.GetTarget(), aEmptyStr, sal_True, sal_False );
65 0 : pMap->InsertIMapObject( aObj );
66 0 : }
67 : }
68 99 : }
69 :
70 :
71 :
72 :
73 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|