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 "noteurl.hxx"
26 :
27 : // Global variable
28 : SwNoteURL *pNoteURL = NULL;
29 :
30 0 : void SwNoteURL::InsertURLNote( const OUString& rURL, const OUString& rTarget,
31 : const SwRect& rRect )
32 : {
33 0 : const size_t nCount = aList.size();
34 0 : for( size_t i = 0; i < nCount; ++i )
35 0 : if( rRect == aList[i].GetRect() )
36 0 : return;
37 :
38 0 : SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect );
39 0 : aList.push_back( pNew );
40 : }
41 :
42 0 : void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
43 : const MapMode& rMap )
44 : {
45 : OSL_ENSURE( pMap, "FillImageMap: No ImageMap, no cookies!" );
46 0 : const size_t nCount = aList.size();
47 0 : if( nCount )
48 : {
49 0 : MapMode aMap( MAP_100TH_MM );
50 0 : for( size_t i = 0; i < nCount; ++i )
51 : {
52 0 : const SwURLNote &rNote = aList[i];
53 0 : SwRect aSwRect( rNote.GetRect() );
54 0 : aSwRect -= rPos;
55 : Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(),
56 0 : rMap, aMap ) );
57 0 : IMapRectangleObject aObj( aRect, rNote.GetURL(), OUString(), OUString(),
58 0 : rNote.GetTarget(), OUString(), true, false );
59 0 : pMap->InsertIMapObject( aObj );
60 0 : }
61 : }
62 270 : }
63 :
64 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|