xref: /AOO41X/main/sw/source/core/text/noteurl.cxx (revision efeef26f81c84063fb0a91bde3856d4a51172d90)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 
29 #include "swtypes.hxx"
30 #include <vcl/outdev.hxx>
31 #include <svtools/imaprect.hxx>
32 #include <svtools/imap.hxx>
33 
34 #include "txttypes.hxx"
35 #include "noteurl.hxx"
36 
37 // globale Variable, wird in noteurl.Hxx bekanntgegeben
38 SwNoteURL *pNoteURL = NULL;
39 
SV_IMPL_PTRARR(SwURLNoteList,SwURLNotePtr)40 SV_IMPL_PTRARR( SwURLNoteList, SwURLNotePtr )
41 
42 
43 void SwNoteURL::InsertURLNote( const XubString& rURL, const XubString& rTarget,
44     const SwRect& rRect )
45 {
46     MSHORT i;
47     MSHORT nCount = aList.Count();
48     for( i = 0; i < nCount; i++ )
49         if( rRect == aList.GetObject(i)->GetRect() )
50             break;
51     if( i == nCount )
52     {
53         SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect );
54         aList.Insert( pNew, nCount );
55     }
56 }
57 
58 
FillImageMap(ImageMap * pMap,const Point & rPos,const MapMode & rMap)59 void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
60     const MapMode& rMap )
61 {
62     ASSERT( pMap, "FillImageMap: No ImageMap, no cookies!" );
63     MSHORT nCount = Count();
64     if( nCount )
65     {
66         MapMode aMap( MAP_100TH_MM );
67         for( MSHORT i = 0; i < nCount; ++i )
68         {
69             const SwURLNote &rNote = GetURLNote( i );
70             SwRect aSwRect( rNote.GetRect() );
71             aSwRect -= rPos;
72             Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(),
73                                                          rMap, aMap ) );
74             IMapRectangleObject aObj( aRect, rNote.GetURL(), aEmptyStr, aEmptyStr,
75                                       rNote.GetTarget(), aEmptyStr, sal_True, sal_False );
76             pMap->InsertIMapObject( aObj );
77         }
78     }
79 }
80 
81 
82 
83 
84