xref: /AOO41X/main/svtools/source/misc/imap.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svtools.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <tools/urlobj.hxx>
32*cdf0e10cSrcweir #include <vcl/svapp.hxx>
33*cdf0e10cSrcweir #include <vcl/mapmod.hxx>
34*cdf0e10cSrcweir #include <vcl/window.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include "svl/urihelper.hxx"
37*cdf0e10cSrcweir #include <svtools/imap.hxx>
38*cdf0e10cSrcweir #include <svtools/imapobj.hxx>
39*cdf0e10cSrcweir #include <svtools/imapcirc.hxx>
40*cdf0e10cSrcweir #include <svtools/imaprect.hxx>
41*cdf0e10cSrcweir #include <svtools/imappoly.hxx>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include <string.h>
44*cdf0e10cSrcweir #include <math.h>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir DBG_NAME( ImageMap )
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir #define SCALEPOINT(aPT,aFracX,aFracY) (aPT).X()=((aPT).X()*(aFracX).GetNumerator())/(aFracX).GetDenominator();	\
50*cdf0e10cSrcweir 									  (aPT).Y()=((aPT).Y()*(aFracY).GetNumerator())/(aFracY).GetDenominator();
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir /******************************************************************************/
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir sal_uInt16 IMapObject::nActualTextEncoding = (sal_uInt16) RTL_TEXTENCODING_DONTKNOW;
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir /******************************************************************************/
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir IMapObject::IMapObject()
61*cdf0e10cSrcweir     : bActive( false )
62*cdf0e10cSrcweir     , nReadVersion( 0 )
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir }
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir IMapObject::IMapObject( const String& rURL,	const String& rAltText, const String& rDesc,
67*cdf0e10cSrcweir 						const String& rTarget, const String& rName, sal_Bool bURLActive )
68*cdf0e10cSrcweir : aURL( rURL )
69*cdf0e10cSrcweir , aAltText( rAltText )
70*cdf0e10cSrcweir , aDesc( rDesc )
71*cdf0e10cSrcweir , aTarget( rTarget )
72*cdf0e10cSrcweir , aName( rName )
73*cdf0e10cSrcweir , bActive( bURLActive )
74*cdf0e10cSrcweir , nReadVersion( 0 )
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir }
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir /******************************************************************************
80*cdf0e10cSrcweir |*
81*cdf0e10cSrcweir |* Freigabe des internen Speichers
82*cdf0e10cSrcweir |*
83*cdf0e10cSrcweir \******************************************************************************/
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir sal_uInt16 IMapObject::GetVersion() const
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir 	return IMAP_OBJ_VERSION;
88*cdf0e10cSrcweir }
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir /******************************************************************************
92*cdf0e10cSrcweir |*
93*cdf0e10cSrcweir |*
94*cdf0e10cSrcweir |*
95*cdf0e10cSrcweir \******************************************************************************/
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir void IMapObject::Write( SvStream& rOStm, const String& rBaseURL ) const
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir 	IMapCompat*				pCompat;
100*cdf0e10cSrcweir 	const rtl_TextEncoding	eEncoding = gsl_getSystemTextEncoding();
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     rOStm << GetType();
103*cdf0e10cSrcweir     rOStm << GetVersion();
104*cdf0e10cSrcweir 	rOStm << ( (sal_uInt16) eEncoding );
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     const ByteString aRelURL = ByteString( String(URIHelper::simpleNormalizedMakeRelative( rBaseURL, aURL )), eEncoding );
107*cdf0e10cSrcweir 	rOStm.WriteByteString( aRelURL );
108*cdf0e10cSrcweir     rOStm.WriteByteString( ByteString( aAltText, eEncoding ) );
109*cdf0e10cSrcweir     rOStm << bActive;
110*cdf0e10cSrcweir     rOStm.WriteByteString( ByteString( aTarget, eEncoding ) );
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	pCompat = new IMapCompat( rOStm, STREAM_WRITE );
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     WriteIMapObject( rOStm );
115*cdf0e10cSrcweir     aEventList.Write( rOStm );                                 // V4
116*cdf0e10cSrcweir     rOStm.WriteByteString( ByteString( aName, eEncoding ) );   // V5
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	delete pCompat;
119*cdf0e10cSrcweir }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir /******************************************************************************
123*cdf0e10cSrcweir |*
124*cdf0e10cSrcweir |* 	Binaer-Import
125*cdf0e10cSrcweir |*
126*cdf0e10cSrcweir \******************************************************************************/
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir void IMapObject::Read( SvStream& rIStm, const String& rBaseURL )
129*cdf0e10cSrcweir {
130*cdf0e10cSrcweir 	IMapCompat*			pCompat;
131*cdf0e10cSrcweir 	rtl_TextEncoding	nTextEncoding;
132*cdf0e10cSrcweir 	ByteString			aString;
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	// Typ und Version ueberlesen wir
135*cdf0e10cSrcweir 	rIStm.SeekRel( 2 );
136*cdf0e10cSrcweir     rIStm >> nReadVersion;
137*cdf0e10cSrcweir 	rIStm >> nTextEncoding;
138*cdf0e10cSrcweir     rIStm.ReadByteString( aString ); aURL = String( aString.GetBuffer(), nTextEncoding );
139*cdf0e10cSrcweir     rIStm.ReadByteString( aString ); aAltText = String( aString.GetBuffer(), nTextEncoding );
140*cdf0e10cSrcweir     rIStm >> bActive;
141*cdf0e10cSrcweir     rIStm.ReadByteString( aString ); aTarget = String( aString.GetBuffer(), nTextEncoding );
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 	// URL absolut machen
144*cdf0e10cSrcweir     aURL = URIHelper::SmartRel2Abs( INetURLObject(rBaseURL), aURL, URIHelper::GetMaybeFileHdl(), true, false, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS );
145*cdf0e10cSrcweir 	pCompat = new IMapCompat( rIStm, STREAM_READ );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     ReadIMapObject( rIStm );
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 	// ab Version 4 lesen wir eine EventListe
150*cdf0e10cSrcweir     if ( nReadVersion >= 0x0004 )
151*cdf0e10cSrcweir 	{
152*cdf0e10cSrcweir         aEventList.Read(rIStm);
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 		// ab Version 5 kann ein Objektname vorhanden sein
155*cdf0e10cSrcweir         if ( nReadVersion >= 0x0005 )
156*cdf0e10cSrcweir 		{
157*cdf0e10cSrcweir             rIStm.ReadByteString( aString ); aName = String( aString.GetBuffer(), nTextEncoding );
158*cdf0e10cSrcweir 		}
159*cdf0e10cSrcweir 	}
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	delete pCompat;
162*cdf0e10cSrcweir }
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir /******************************************************************************
166*cdf0e10cSrcweir |*
167*cdf0e10cSrcweir |* Konvertierung der logischen Koordianten in Pixel
168*cdf0e10cSrcweir |*
169*cdf0e10cSrcweir \******************************************************************************/
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir Point IMapObject::GetPixelPoint( const Point& rLogPoint )
172*cdf0e10cSrcweir {
173*cdf0e10cSrcweir 	return Application::GetDefaultDevice()->LogicToPixel( rLogPoint, MapMode( MAP_100TH_MM ) );
174*cdf0e10cSrcweir }
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir /******************************************************************************
178*cdf0e10cSrcweir |*
179*cdf0e10cSrcweir |* Konvertierung der logischen Koordianten in Pixel
180*cdf0e10cSrcweir |*
181*cdf0e10cSrcweir \******************************************************************************/
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir Point IMapObject::GetLogPoint( const Point& rPixelPoint )
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir 	return Application::GetDefaultDevice()->PixelToLogic( rPixelPoint, MapMode( MAP_100TH_MM ) );
186*cdf0e10cSrcweir }
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir /******************************************************************************
190*cdf0e10cSrcweir |*
191*cdf0e10cSrcweir |*
192*cdf0e10cSrcweir |*
193*cdf0e10cSrcweir \******************************************************************************/
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir sal_Bool IMapObject::IsEqual( const IMapObject& rEqObj )
196*cdf0e10cSrcweir {
197*cdf0e10cSrcweir 	return ( ( aURL == rEqObj.aURL ) &&
198*cdf0e10cSrcweir 			 ( aAltText == rEqObj.aAltText ) &&
199*cdf0e10cSrcweir 			 ( aDesc == rEqObj.aDesc ) &&
200*cdf0e10cSrcweir 			 ( aTarget == rEqObj.aTarget ) &&
201*cdf0e10cSrcweir 			 ( aName == rEqObj.aName ) &&
202*cdf0e10cSrcweir 			 ( bActive == rEqObj.bActive ) );
203*cdf0e10cSrcweir }
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir /******************************************************************************/
207*cdf0e10cSrcweir /******************************************************************************/
208*cdf0e10cSrcweir /******************************************************************************/
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir IMapRectangleObject::IMapRectangleObject( const Rectangle& rRect,
211*cdf0e10cSrcweir 										  const String& rURL,
212*cdf0e10cSrcweir 										  const String& rAltText,
213*cdf0e10cSrcweir 										  const String& rDesc,
214*cdf0e10cSrcweir 										  const String&	rTarget,
215*cdf0e10cSrcweir 										  const String& rName,
216*cdf0e10cSrcweir 										  sal_Bool bURLActive,
217*cdf0e10cSrcweir 										  sal_Bool bPixelCoords ) :
218*cdf0e10cSrcweir 			IMapObject	( rURL, rAltText, rDesc, rTarget, rName, bURLActive )
219*cdf0e10cSrcweir {
220*cdf0e10cSrcweir 	ImpConstruct( rRect, bPixelCoords );
221*cdf0e10cSrcweir }
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir /******************************************************************************
225*cdf0e10cSrcweir |*
226*cdf0e10cSrcweir |*
227*cdf0e10cSrcweir |*
228*cdf0e10cSrcweir \******************************************************************************/
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir void IMapRectangleObject::ImpConstruct( const Rectangle& rRect, sal_Bool bPixel )
231*cdf0e10cSrcweir {
232*cdf0e10cSrcweir 	if ( bPixel )
233*cdf0e10cSrcweir 		aRect = Application::GetDefaultDevice()->PixelToLogic( rRect, MapMode( MAP_100TH_MM ) );
234*cdf0e10cSrcweir 	else
235*cdf0e10cSrcweir 		aRect = rRect;
236*cdf0e10cSrcweir }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir /******************************************************************************
240*cdf0e10cSrcweir |*
241*cdf0e10cSrcweir |* Binaer-Export
242*cdf0e10cSrcweir |*
243*cdf0e10cSrcweir \******************************************************************************/
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir void IMapRectangleObject::WriteIMapObject( SvStream& rOStm ) const
246*cdf0e10cSrcweir {
247*cdf0e10cSrcweir 	rOStm << aRect;
248*cdf0e10cSrcweir }
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir /******************************************************************************
252*cdf0e10cSrcweir |*
253*cdf0e10cSrcweir |* Binaer-Import
254*cdf0e10cSrcweir |*
255*cdf0e10cSrcweir \******************************************************************************/
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir void IMapRectangleObject::ReadIMapObject( SvStream& rIStm )
258*cdf0e10cSrcweir {
259*cdf0e10cSrcweir 	rIStm >> aRect;
260*cdf0e10cSrcweir }
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir /******************************************************************************
264*cdf0e10cSrcweir |*
265*cdf0e10cSrcweir |* Typ-Rueckgabe
266*cdf0e10cSrcweir |*
267*cdf0e10cSrcweir \******************************************************************************/
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir sal_uInt16 IMapRectangleObject::GetType() const
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir 	return IMAP_OBJ_RECTANGLE;
272*cdf0e10cSrcweir }
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir /******************************************************************************
276*cdf0e10cSrcweir |*
277*cdf0e10cSrcweir |* Hit-Test
278*cdf0e10cSrcweir |*
279*cdf0e10cSrcweir \******************************************************************************/
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir sal_Bool IMapRectangleObject::IsHit( const Point& rPoint ) const
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir 	return aRect.IsInside( rPoint );
284*cdf0e10cSrcweir }
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir /******************************************************************************
288*cdf0e10cSrcweir |*
289*cdf0e10cSrcweir |*
290*cdf0e10cSrcweir |*
291*cdf0e10cSrcweir \******************************************************************************/
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir Rectangle IMapRectangleObject::GetRectangle( sal_Bool bPixelCoords ) const
294*cdf0e10cSrcweir {
295*cdf0e10cSrcweir 	Rectangle	aNewRect;
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 	if ( bPixelCoords )
298*cdf0e10cSrcweir 		aNewRect = Application::GetDefaultDevice()->LogicToPixel( aRect, MapMode( MAP_100TH_MM ) );
299*cdf0e10cSrcweir 	else
300*cdf0e10cSrcweir 		aNewRect = aRect;
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir 	return aNewRect;
303*cdf0e10cSrcweir }
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir /******************************************************************************
307*cdf0e10cSrcweir |*
308*cdf0e10cSrcweir |*
309*cdf0e10cSrcweir |*
310*cdf0e10cSrcweir \******************************************************************************/
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir void IMapRectangleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
313*cdf0e10cSrcweir {
314*cdf0e10cSrcweir 	Point	aTL( aRect.TopLeft() );
315*cdf0e10cSrcweir 	Point	aBR( aRect.BottomRight() );
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 	if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
318*cdf0e10cSrcweir 	{
319*cdf0e10cSrcweir 		SCALEPOINT( aTL, rFracX, rFracY );
320*cdf0e10cSrcweir 		SCALEPOINT( aBR, rFracX, rFracY );
321*cdf0e10cSrcweir 	}
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir 	aRect = Rectangle( aTL, aBR );
324*cdf0e10cSrcweir }
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir /******************************************************************************
328*cdf0e10cSrcweir |*
329*cdf0e10cSrcweir |*
330*cdf0e10cSrcweir |*
331*cdf0e10cSrcweir \******************************************************************************/
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir sal_Bool IMapRectangleObject::IsEqual( const IMapRectangleObject& rEqObj )
334*cdf0e10cSrcweir {
335*cdf0e10cSrcweir 	return ( IMapObject::IsEqual( rEqObj ) && ( aRect == rEqObj.aRect ) );
336*cdf0e10cSrcweir }
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir /******************************************************************************/
340*cdf0e10cSrcweir /******************************************************************************/
341*cdf0e10cSrcweir /******************************************************************************/
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir IMapCircleObject::IMapCircleObject( const Point& rCenter, sal_uLong nCircleRadius,
344*cdf0e10cSrcweir 									const String& rURL,
345*cdf0e10cSrcweir 									const String& rAltText,
346*cdf0e10cSrcweir 									const String& rDesc,
347*cdf0e10cSrcweir 									const String& rTarget,
348*cdf0e10cSrcweir 									const String& rName,
349*cdf0e10cSrcweir 									sal_Bool bURLActive,
350*cdf0e10cSrcweir 									sal_Bool bPixelCoords ) :
351*cdf0e10cSrcweir 			IMapObject	( rURL, rAltText, rDesc, rTarget, rName, bURLActive )
352*cdf0e10cSrcweir {
353*cdf0e10cSrcweir 	ImpConstruct( rCenter, nCircleRadius, bPixelCoords );
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir /******************************************************************************
358*cdf0e10cSrcweir |*
359*cdf0e10cSrcweir |*
360*cdf0e10cSrcweir |*
361*cdf0e10cSrcweir \******************************************************************************/
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir void IMapCircleObject::ImpConstruct( const Point& rCenter, sal_uLong nRad, sal_Bool bPixel )
364*cdf0e10cSrcweir {
365*cdf0e10cSrcweir 	if ( bPixel )
366*cdf0e10cSrcweir 	{
367*cdf0e10cSrcweir 		MapMode	aMap100( MAP_100TH_MM );
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir 		aCenter = Application::GetDefaultDevice()->PixelToLogic( rCenter, aMap100 );
370*cdf0e10cSrcweir 		nRadius = Application::GetDefaultDevice()->PixelToLogic( Size( nRad, 0 ), aMap100 ).Width();
371*cdf0e10cSrcweir 	}
372*cdf0e10cSrcweir 	else
373*cdf0e10cSrcweir 	{
374*cdf0e10cSrcweir 		aCenter = rCenter;
375*cdf0e10cSrcweir 		nRadius = nRad;
376*cdf0e10cSrcweir 	}
377*cdf0e10cSrcweir }
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir /******************************************************************************
381*cdf0e10cSrcweir |*
382*cdf0e10cSrcweir |* Binaer-Export
383*cdf0e10cSrcweir |*
384*cdf0e10cSrcweir \******************************************************************************/
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir void IMapCircleObject::WriteIMapObject( SvStream& rOStm ) const
387*cdf0e10cSrcweir {
388*cdf0e10cSrcweir 	sal_uInt32 nTmp = nRadius;
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 	rOStm << aCenter;
391*cdf0e10cSrcweir 	rOStm << nTmp;
392*cdf0e10cSrcweir }
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir /******************************************************************************
396*cdf0e10cSrcweir |*
397*cdf0e10cSrcweir |* Binaer-Import
398*cdf0e10cSrcweir |*
399*cdf0e10cSrcweir \******************************************************************************/
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir void IMapCircleObject::ReadIMapObject( SvStream& rIStm )
402*cdf0e10cSrcweir {
403*cdf0e10cSrcweir 	sal_uInt32 nTmp;
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir 	rIStm >> aCenter;
406*cdf0e10cSrcweir 	rIStm >> nTmp;
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir 	nRadius = nTmp;
409*cdf0e10cSrcweir }
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir /******************************************************************************
413*cdf0e10cSrcweir |*
414*cdf0e10cSrcweir |* Typ-Rueckgabe
415*cdf0e10cSrcweir |*
416*cdf0e10cSrcweir \******************************************************************************/
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir sal_uInt16 IMapCircleObject::GetType() const
419*cdf0e10cSrcweir {
420*cdf0e10cSrcweir 	return IMAP_OBJ_CIRCLE;
421*cdf0e10cSrcweir }
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir /******************************************************************************
425*cdf0e10cSrcweir |*
426*cdf0e10cSrcweir |* Hit-Test
427*cdf0e10cSrcweir |*
428*cdf0e10cSrcweir \******************************************************************************/
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir sal_Bool IMapCircleObject::IsHit( const Point& rPoint ) const
431*cdf0e10cSrcweir {
432*cdf0e10cSrcweir 	const Point	aPoint( aCenter - rPoint );
433*cdf0e10cSrcweir 	sal_Bool		bRet = sal_False;
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir 	if ( (sal_uLong) sqrt( (double) aPoint.X() * aPoint.X() +
436*cdf0e10cSrcweir 					   aPoint.Y() * aPoint.Y() ) <= nRadius )
437*cdf0e10cSrcweir 	{
438*cdf0e10cSrcweir 		bRet = sal_True;
439*cdf0e10cSrcweir 	}
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir 	return bRet;
442*cdf0e10cSrcweir }
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir /******************************************************************************
446*cdf0e10cSrcweir |*
447*cdf0e10cSrcweir |*
448*cdf0e10cSrcweir |*
449*cdf0e10cSrcweir \******************************************************************************/
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir Point IMapCircleObject::GetCenter( sal_Bool bPixelCoords ) const
452*cdf0e10cSrcweir {
453*cdf0e10cSrcweir 	Point aNewPoint;
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 	if ( bPixelCoords )
456*cdf0e10cSrcweir 		aNewPoint = Application::GetDefaultDevice()->LogicToPixel( aCenter, MapMode( MAP_100TH_MM ) );
457*cdf0e10cSrcweir 	else
458*cdf0e10cSrcweir 		aNewPoint = aCenter;
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir 	return aNewPoint;
461*cdf0e10cSrcweir }
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir /******************************************************************************
465*cdf0e10cSrcweir |*
466*cdf0e10cSrcweir |*
467*cdf0e10cSrcweir |*
468*cdf0e10cSrcweir \******************************************************************************/
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir sal_uLong IMapCircleObject::GetRadius( sal_Bool bPixelCoords ) const
471*cdf0e10cSrcweir {
472*cdf0e10cSrcweir 	sal_uLong nNewRadius;
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir 	if ( bPixelCoords )
475*cdf0e10cSrcweir 		nNewRadius = Application::GetDefaultDevice()->LogicToPixel( Size( nRadius, 0 ), MapMode( MAP_100TH_MM ) ).Width();
476*cdf0e10cSrcweir 	else
477*cdf0e10cSrcweir 		nNewRadius = nRadius;
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir 	return nNewRadius;
480*cdf0e10cSrcweir }
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir /******************************************************************************
484*cdf0e10cSrcweir |*
485*cdf0e10cSrcweir |*
486*cdf0e10cSrcweir |*
487*cdf0e10cSrcweir \******************************************************************************/
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir Rectangle IMapCircleObject::GetBoundRect() const
490*cdf0e10cSrcweir {
491*cdf0e10cSrcweir 	long nWidth = nRadius << 1;
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 	return Rectangle( Point(  aCenter.X() - nRadius, aCenter.Y() - nRadius ),
494*cdf0e10cSrcweir 					  Size( nWidth, nWidth ) );
495*cdf0e10cSrcweir }
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir /******************************************************************************
499*cdf0e10cSrcweir |*
500*cdf0e10cSrcweir |*
501*cdf0e10cSrcweir |*
502*cdf0e10cSrcweir \******************************************************************************/
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir void IMapCircleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
505*cdf0e10cSrcweir {
506*cdf0e10cSrcweir 	Fraction aAverage( rFracX );
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 	aAverage += rFracY;
509*cdf0e10cSrcweir 	aAverage *= Fraction( 1, 2 );
510*cdf0e10cSrcweir 
511*cdf0e10cSrcweir 	if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
512*cdf0e10cSrcweir 	{
513*cdf0e10cSrcweir 		SCALEPOINT( aCenter, rFracX, rFracY );
514*cdf0e10cSrcweir 	}
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir 	nRadius = ( nRadius * aAverage.GetNumerator() ) / aAverage.GetDenominator();
517*cdf0e10cSrcweir }
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir /******************************************************************************
521*cdf0e10cSrcweir |*
522*cdf0e10cSrcweir |*
523*cdf0e10cSrcweir |*
524*cdf0e10cSrcweir \******************************************************************************/
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir sal_Bool IMapCircleObject::IsEqual( const IMapCircleObject& rEqObj )
527*cdf0e10cSrcweir {
528*cdf0e10cSrcweir 	return ( IMapObject::IsEqual( rEqObj ) &&
529*cdf0e10cSrcweir 			 ( aCenter == rEqObj.aCenter ) &&
530*cdf0e10cSrcweir 			 ( nRadius == rEqObj.nRadius ) );
531*cdf0e10cSrcweir }
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir /******************************************************************************/
535*cdf0e10cSrcweir /******************************************************************************/
536*cdf0e10cSrcweir /******************************************************************************/
537*cdf0e10cSrcweir IMapPolygonObject::IMapPolygonObject( const Polygon& rPoly,
538*cdf0e10cSrcweir 									  const String& rURL,
539*cdf0e10cSrcweir 									  const String& rAltText,
540*cdf0e10cSrcweir 									  const String& rDesc,
541*cdf0e10cSrcweir 									  const String& rTarget,
542*cdf0e10cSrcweir 									  const String& rName,
543*cdf0e10cSrcweir 									  sal_Bool bURLActive,
544*cdf0e10cSrcweir 									  sal_Bool bPixelCoords ) :
545*cdf0e10cSrcweir 			IMapObject	( rURL, rAltText, rDesc, rTarget, rName, bURLActive ),
546*cdf0e10cSrcweir 			bEllipse	( sal_False )
547*cdf0e10cSrcweir {
548*cdf0e10cSrcweir 	ImpConstruct( rPoly, bPixelCoords );
549*cdf0e10cSrcweir }
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir /******************************************************************************
553*cdf0e10cSrcweir |*
554*cdf0e10cSrcweir |*
555*cdf0e10cSrcweir |*
556*cdf0e10cSrcweir \******************************************************************************/
557*cdf0e10cSrcweir 
558*cdf0e10cSrcweir void IMapPolygonObject::ImpConstruct( const Polygon& rPoly, sal_Bool bPixel )
559*cdf0e10cSrcweir {
560*cdf0e10cSrcweir 	if ( bPixel )
561*cdf0e10cSrcweir 		aPoly = Application::GetDefaultDevice()->PixelToLogic( rPoly, MapMode( MAP_100TH_MM ) );
562*cdf0e10cSrcweir 	else
563*cdf0e10cSrcweir 		aPoly = rPoly;
564*cdf0e10cSrcweir }
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir /******************************************************************************
568*cdf0e10cSrcweir |*
569*cdf0e10cSrcweir |* Binaer-Export
570*cdf0e10cSrcweir |*
571*cdf0e10cSrcweir \******************************************************************************/
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir void IMapPolygonObject::WriteIMapObject( SvStream& rOStm ) const
574*cdf0e10cSrcweir {
575*cdf0e10cSrcweir 	rOStm << aPoly;
576*cdf0e10cSrcweir 	rOStm << bEllipse;	// >= Version 2
577*cdf0e10cSrcweir 	rOStm << aEllipse;	// >= Version 2
578*cdf0e10cSrcweir }
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir /******************************************************************************
582*cdf0e10cSrcweir |*
583*cdf0e10cSrcweir |* Binaer-Import
584*cdf0e10cSrcweir |*
585*cdf0e10cSrcweir \******************************************************************************/
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir void IMapPolygonObject::ReadIMapObject( SvStream& rIStm )
588*cdf0e10cSrcweir {
589*cdf0e10cSrcweir 	rIStm >> aPoly;
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir 	// Version >= 2 hat zusaetzlich Ellipsen-Information
592*cdf0e10cSrcweir 	if ( nReadVersion >= 2 )
593*cdf0e10cSrcweir 	{
594*cdf0e10cSrcweir 		rIStm >> bEllipse;
595*cdf0e10cSrcweir 		rIStm >> aEllipse;
596*cdf0e10cSrcweir 	}
597*cdf0e10cSrcweir }
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir 
600*cdf0e10cSrcweir /******************************************************************************
601*cdf0e10cSrcweir |*
602*cdf0e10cSrcweir |* Typ-Rueckgabe
603*cdf0e10cSrcweir |*
604*cdf0e10cSrcweir \******************************************************************************/
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir sal_uInt16 IMapPolygonObject::GetType() const
607*cdf0e10cSrcweir {
608*cdf0e10cSrcweir 	return IMAP_OBJ_POLYGON;
609*cdf0e10cSrcweir }
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir /******************************************************************************
613*cdf0e10cSrcweir |*
614*cdf0e10cSrcweir |* Hit-Test
615*cdf0e10cSrcweir |*
616*cdf0e10cSrcweir \******************************************************************************/
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir sal_Bool IMapPolygonObject::IsHit( const Point& rPoint ) const
619*cdf0e10cSrcweir {
620*cdf0e10cSrcweir 	return aPoly.IsInside( rPoint );
621*cdf0e10cSrcweir }
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir 
624*cdf0e10cSrcweir /******************************************************************************
625*cdf0e10cSrcweir |*
626*cdf0e10cSrcweir |*
627*cdf0e10cSrcweir |*
628*cdf0e10cSrcweir \******************************************************************************/
629*cdf0e10cSrcweir 
630*cdf0e10cSrcweir Polygon IMapPolygonObject::GetPolygon( sal_Bool bPixelCoords ) const
631*cdf0e10cSrcweir {
632*cdf0e10cSrcweir 	Polygon	aNewPoly;
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir 	if ( bPixelCoords )
635*cdf0e10cSrcweir 		aNewPoly = Application::GetDefaultDevice()->LogicToPixel( aPoly, MapMode( MAP_100TH_MM ) );
636*cdf0e10cSrcweir 	else
637*cdf0e10cSrcweir 		aNewPoly = aPoly;
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir 	return aNewPoly;
640*cdf0e10cSrcweir }
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir /******************************************************************************
644*cdf0e10cSrcweir |*
645*cdf0e10cSrcweir |*
646*cdf0e10cSrcweir |*
647*cdf0e10cSrcweir \******************************************************************************/
648*cdf0e10cSrcweir 
649*cdf0e10cSrcweir void IMapPolygonObject::SetExtraEllipse( const Rectangle& rEllipse )
650*cdf0e10cSrcweir {
651*cdf0e10cSrcweir 	if ( aPoly.GetSize() )
652*cdf0e10cSrcweir 	{
653*cdf0e10cSrcweir 		bEllipse = sal_True;
654*cdf0e10cSrcweir 		aEllipse = rEllipse;
655*cdf0e10cSrcweir 	}
656*cdf0e10cSrcweir }
657*cdf0e10cSrcweir 
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir /******************************************************************************
660*cdf0e10cSrcweir |*
661*cdf0e10cSrcweir |*
662*cdf0e10cSrcweir |*
663*cdf0e10cSrcweir \******************************************************************************/
664*cdf0e10cSrcweir 
665*cdf0e10cSrcweir void IMapPolygonObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
666*cdf0e10cSrcweir {
667*cdf0e10cSrcweir 	sal_uInt16 nCount = aPoly.GetSize();
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < nCount; i++ )
670*cdf0e10cSrcweir 	{
671*cdf0e10cSrcweir 		Point aScaledPt( aPoly[ i ] );
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir 		if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
674*cdf0e10cSrcweir 		{
675*cdf0e10cSrcweir 			SCALEPOINT( aScaledPt, rFracX, rFracY );
676*cdf0e10cSrcweir 		}
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir 		aPoly[ i ] = aScaledPt;
679*cdf0e10cSrcweir 	}
680*cdf0e10cSrcweir 
681*cdf0e10cSrcweir 	if ( bEllipse )
682*cdf0e10cSrcweir 	{
683*cdf0e10cSrcweir 		Point	aTL( aEllipse.TopLeft() );
684*cdf0e10cSrcweir 		Point	aBR( aEllipse.BottomRight() );
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir 		if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
687*cdf0e10cSrcweir 		{
688*cdf0e10cSrcweir 			SCALEPOINT( aTL, rFracX, rFracY );
689*cdf0e10cSrcweir 			SCALEPOINT( aBR, rFracX, rFracY );
690*cdf0e10cSrcweir 		}
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir 		aEllipse = Rectangle( aTL, aBR );
693*cdf0e10cSrcweir 	}
694*cdf0e10cSrcweir }
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir 
697*cdf0e10cSrcweir /******************************************************************************
698*cdf0e10cSrcweir |*
699*cdf0e10cSrcweir |*
700*cdf0e10cSrcweir |*
701*cdf0e10cSrcweir \******************************************************************************/
702*cdf0e10cSrcweir 
703*cdf0e10cSrcweir sal_Bool IMapPolygonObject::IsEqual( const IMapPolygonObject& rEqObj )
704*cdf0e10cSrcweir {
705*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
706*cdf0e10cSrcweir 
707*cdf0e10cSrcweir 	if ( IMapObject::IsEqual( rEqObj ) )
708*cdf0e10cSrcweir 	{
709*cdf0e10cSrcweir 		const Polygon&	rEqPoly = rEqObj.aPoly;
710*cdf0e10cSrcweir 		const sal_uInt16	nCount = aPoly.GetSize();
711*cdf0e10cSrcweir 		const sal_uInt16	nEqCount = rEqPoly.GetSize();
712*cdf0e10cSrcweir 		sal_Bool			bDifferent = sal_False;
713*cdf0e10cSrcweir 
714*cdf0e10cSrcweir 		if ( nCount == nEqCount )
715*cdf0e10cSrcweir 		{
716*cdf0e10cSrcweir 			for ( sal_uInt16 i = 0; i < nCount; i++ )
717*cdf0e10cSrcweir 			{
718*cdf0e10cSrcweir 				if ( aPoly[ i ] != rEqPoly[ i ] )
719*cdf0e10cSrcweir 				{
720*cdf0e10cSrcweir 					bDifferent = sal_True;
721*cdf0e10cSrcweir 					break;
722*cdf0e10cSrcweir 				}
723*cdf0e10cSrcweir 			}
724*cdf0e10cSrcweir 
725*cdf0e10cSrcweir 			if ( !bDifferent )
726*cdf0e10cSrcweir 				bRet = sal_True;
727*cdf0e10cSrcweir 		}
728*cdf0e10cSrcweir 	}
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir 	return bRet;
731*cdf0e10cSrcweir }
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir 
734*cdf0e10cSrcweir /******************************************************************************/
735*cdf0e10cSrcweir /******************************************************************************/
736*cdf0e10cSrcweir /******************************************************************************/
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir /******************************************************************************
740*cdf0e10cSrcweir |*
741*cdf0e10cSrcweir |* Ctor
742*cdf0e10cSrcweir |*
743*cdf0e10cSrcweir \******************************************************************************/
744*cdf0e10cSrcweir 
745*cdf0e10cSrcweir ImageMap::ImageMap( const String& rName ) :
746*cdf0e10cSrcweir 			aName	( rName )
747*cdf0e10cSrcweir {
748*cdf0e10cSrcweir }
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir 
751*cdf0e10cSrcweir /******************************************************************************
752*cdf0e10cSrcweir |*
753*cdf0e10cSrcweir |* Copy-Ctor
754*cdf0e10cSrcweir |*
755*cdf0e10cSrcweir \******************************************************************************/
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir ImageMap::ImageMap( const ImageMap& rImageMap )
758*cdf0e10cSrcweir {
759*cdf0e10cSrcweir 	DBG_CTOR( ImageMap, NULL );
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir 	sal_uInt16 nCount = rImageMap.GetIMapObjectCount();
762*cdf0e10cSrcweir 
763*cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < nCount; i++ )
764*cdf0e10cSrcweir 	{
765*cdf0e10cSrcweir 		IMapObject* pCopyObj = rImageMap.GetIMapObject( i );
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir 		switch( pCopyObj->GetType() )
768*cdf0e10cSrcweir 		{
769*cdf0e10cSrcweir 			case( IMAP_OBJ_RECTANGLE ):
770*cdf0e10cSrcweir 				maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND );
771*cdf0e10cSrcweir 			break;
772*cdf0e10cSrcweir 
773*cdf0e10cSrcweir 			case( IMAP_OBJ_CIRCLE ):
774*cdf0e10cSrcweir 				maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND );
775*cdf0e10cSrcweir 			break;
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir 			case( IMAP_OBJ_POLYGON ):
778*cdf0e10cSrcweir 				maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND );
779*cdf0e10cSrcweir 			break;
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir 			default:
782*cdf0e10cSrcweir 			break;
783*cdf0e10cSrcweir 		}
784*cdf0e10cSrcweir 	}
785*cdf0e10cSrcweir 
786*cdf0e10cSrcweir 	aName = rImageMap.aName;
787*cdf0e10cSrcweir }
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir /******************************************************************************
791*cdf0e10cSrcweir |*
792*cdf0e10cSrcweir |* Dtor
793*cdf0e10cSrcweir |*
794*cdf0e10cSrcweir \******************************************************************************/
795*cdf0e10cSrcweir 
796*cdf0e10cSrcweir ImageMap::~ImageMap()
797*cdf0e10cSrcweir {
798*cdf0e10cSrcweir 	DBG_DTOR( ImageMap, NULL );
799*cdf0e10cSrcweir 
800*cdf0e10cSrcweir 	ClearImageMap();
801*cdf0e10cSrcweir }
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir 
804*cdf0e10cSrcweir /******************************************************************************
805*cdf0e10cSrcweir |*
806*cdf0e10cSrcweir |* Freigabe des internen Speichers
807*cdf0e10cSrcweir |*
808*cdf0e10cSrcweir \******************************************************************************/
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir void ImageMap::ClearImageMap()
811*cdf0e10cSrcweir {
812*cdf0e10cSrcweir 	IMapObject* pObj = (IMapObject*) maList.First();
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir 	while ( pObj )
815*cdf0e10cSrcweir 	{
816*cdf0e10cSrcweir 		delete pObj;
817*cdf0e10cSrcweir 		pObj = (IMapObject*) maList.Next();
818*cdf0e10cSrcweir 	}
819*cdf0e10cSrcweir 
820*cdf0e10cSrcweir 	maList.Clear();
821*cdf0e10cSrcweir 
822*cdf0e10cSrcweir 	aName = String();
823*cdf0e10cSrcweir }
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir 
826*cdf0e10cSrcweir /******************************************************************************
827*cdf0e10cSrcweir |*
828*cdf0e10cSrcweir |* Zuweisungsoperator
829*cdf0e10cSrcweir |*
830*cdf0e10cSrcweir \******************************************************************************/
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir ImageMap& ImageMap::operator=( const ImageMap& rImageMap )
833*cdf0e10cSrcweir {
834*cdf0e10cSrcweir 	sal_uInt16 nCount = rImageMap.GetIMapObjectCount();
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir 	ClearImageMap();
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < nCount; i++ )
839*cdf0e10cSrcweir 	{
840*cdf0e10cSrcweir 		IMapObject* pCopyObj = rImageMap.GetIMapObject( i );
841*cdf0e10cSrcweir 
842*cdf0e10cSrcweir 		switch( pCopyObj->GetType() )
843*cdf0e10cSrcweir 		{
844*cdf0e10cSrcweir 			case( IMAP_OBJ_RECTANGLE ):
845*cdf0e10cSrcweir 				maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND );
846*cdf0e10cSrcweir 			break;
847*cdf0e10cSrcweir 
848*cdf0e10cSrcweir 			case( IMAP_OBJ_CIRCLE ):
849*cdf0e10cSrcweir 				maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND );
850*cdf0e10cSrcweir 			break;
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir 			case( IMAP_OBJ_POLYGON ):
853*cdf0e10cSrcweir 				maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND );
854*cdf0e10cSrcweir 			break;
855*cdf0e10cSrcweir 
856*cdf0e10cSrcweir 			default:
857*cdf0e10cSrcweir 			break;
858*cdf0e10cSrcweir 		}
859*cdf0e10cSrcweir 	}
860*cdf0e10cSrcweir 
861*cdf0e10cSrcweir 	aName = rImageMap.aName;
862*cdf0e10cSrcweir 
863*cdf0e10cSrcweir 	return *this;
864*cdf0e10cSrcweir }
865*cdf0e10cSrcweir 
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir /******************************************************************************
868*cdf0e10cSrcweir |*
869*cdf0e10cSrcweir |* Vergleichsoperator I
870*cdf0e10cSrcweir |*
871*cdf0e10cSrcweir \******************************************************************************/
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir sal_Bool ImageMap::operator==( const ImageMap& rImageMap )
874*cdf0e10cSrcweir {
875*cdf0e10cSrcweir 	const sal_uInt16	nCount = (sal_uInt16) maList.Count();
876*cdf0e10cSrcweir 	const sal_uInt16	nEqCount = rImageMap.GetIMapObjectCount();
877*cdf0e10cSrcweir 	sal_Bool			bRet = sal_False;
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir 	if ( nCount == nEqCount )
880*cdf0e10cSrcweir 	{
881*cdf0e10cSrcweir 		sal_Bool bDifferent = ( aName != rImageMap.aName );
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir 		for ( sal_uInt16 i = 0; ( i < nCount ) && !bDifferent; i++ )
884*cdf0e10cSrcweir 		{
885*cdf0e10cSrcweir 			IMapObject* pObj = (IMapObject*) maList.GetObject( i );
886*cdf0e10cSrcweir 			IMapObject* pEqObj = rImageMap.GetIMapObject( i );
887*cdf0e10cSrcweir 
888*cdf0e10cSrcweir 			if ( pObj->GetType() == pEqObj->GetType() )
889*cdf0e10cSrcweir 			{
890*cdf0e10cSrcweir 				switch( pObj->GetType() )
891*cdf0e10cSrcweir 				{
892*cdf0e10cSrcweir 					case( IMAP_OBJ_RECTANGLE ):
893*cdf0e10cSrcweir 					{
894*cdf0e10cSrcweir 						if ( !( (IMapRectangleObject*) pObj )->IsEqual( *(IMapRectangleObject*) pEqObj ) )
895*cdf0e10cSrcweir 							bDifferent = sal_True;
896*cdf0e10cSrcweir 					}
897*cdf0e10cSrcweir 					break;
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir 					case( IMAP_OBJ_CIRCLE ):
900*cdf0e10cSrcweir 					{
901*cdf0e10cSrcweir 						if ( !( (IMapCircleObject*) pObj )->IsEqual( *(IMapCircleObject*) pEqObj ) )
902*cdf0e10cSrcweir 							bDifferent = sal_True;
903*cdf0e10cSrcweir 					}
904*cdf0e10cSrcweir 					break;
905*cdf0e10cSrcweir 
906*cdf0e10cSrcweir 					case( IMAP_OBJ_POLYGON ):
907*cdf0e10cSrcweir 					{
908*cdf0e10cSrcweir 						if ( !( (IMapPolygonObject*) pObj )->IsEqual( *(IMapPolygonObject*) pEqObj ) )
909*cdf0e10cSrcweir 							bDifferent = sal_True;
910*cdf0e10cSrcweir 					}
911*cdf0e10cSrcweir 					break;
912*cdf0e10cSrcweir 
913*cdf0e10cSrcweir 					default:
914*cdf0e10cSrcweir 					break;
915*cdf0e10cSrcweir 				}
916*cdf0e10cSrcweir 			}
917*cdf0e10cSrcweir 			else
918*cdf0e10cSrcweir 				bDifferent = sal_True;
919*cdf0e10cSrcweir 		}
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir 		if ( !bDifferent )
922*cdf0e10cSrcweir 			bRet = sal_True;
923*cdf0e10cSrcweir 	}
924*cdf0e10cSrcweir 
925*cdf0e10cSrcweir 	return bRet;
926*cdf0e10cSrcweir }
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir /******************************************************************************
930*cdf0e10cSrcweir |*
931*cdf0e10cSrcweir |* Vergleichsoperator II
932*cdf0e10cSrcweir |*
933*cdf0e10cSrcweir \******************************************************************************/
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir sal_Bool ImageMap::operator!=( const ImageMap& rImageMap )
936*cdf0e10cSrcweir {
937*cdf0e10cSrcweir 	return !( *this == rImageMap );
938*cdf0e10cSrcweir }
939*cdf0e10cSrcweir 
940*cdf0e10cSrcweir 
941*cdf0e10cSrcweir /******************************************************************************
942*cdf0e10cSrcweir |*
943*cdf0e10cSrcweir |* Freigabe des internen Speichers
944*cdf0e10cSrcweir |*
945*cdf0e10cSrcweir \******************************************************************************/
946*cdf0e10cSrcweir 
947*cdf0e10cSrcweir sal_uInt16 ImageMap::GetVersion() const
948*cdf0e10cSrcweir {
949*cdf0e10cSrcweir 	return IMAGE_MAP_VERSION;
950*cdf0e10cSrcweir }
951*cdf0e10cSrcweir 
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir /******************************************************************************
954*cdf0e10cSrcweir |*
955*cdf0e10cSrcweir |* Einfuegen eines neuen Objekts
956*cdf0e10cSrcweir |*
957*cdf0e10cSrcweir \******************************************************************************/
958*cdf0e10cSrcweir 
959*cdf0e10cSrcweir void ImageMap::InsertIMapObject( const IMapObject& rIMapObject )
960*cdf0e10cSrcweir {
961*cdf0e10cSrcweir 	switch( rIMapObject.GetType() )
962*cdf0e10cSrcweir 	{
963*cdf0e10cSrcweir 		case( IMAP_OBJ_RECTANGLE ):
964*cdf0e10cSrcweir 			maList.Insert( new IMapRectangleObject( (IMapRectangleObject&) rIMapObject ), LIST_APPEND );
965*cdf0e10cSrcweir 		break;
966*cdf0e10cSrcweir 
967*cdf0e10cSrcweir 		case( IMAP_OBJ_CIRCLE ):
968*cdf0e10cSrcweir 			maList.Insert( new IMapCircleObject( (IMapCircleObject&) rIMapObject ), LIST_APPEND );
969*cdf0e10cSrcweir 		break;
970*cdf0e10cSrcweir 
971*cdf0e10cSrcweir 		case( IMAP_OBJ_POLYGON ):
972*cdf0e10cSrcweir 			maList.Insert( new IMapPolygonObject( (IMapPolygonObject&) rIMapObject ), LIST_APPEND );
973*cdf0e10cSrcweir 		break;
974*cdf0e10cSrcweir 
975*cdf0e10cSrcweir 		default:
976*cdf0e10cSrcweir 		break;
977*cdf0e10cSrcweir 	}
978*cdf0e10cSrcweir }
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir 
981*cdf0e10cSrcweir /******************************************************************************
982*cdf0e10cSrcweir |*
983*cdf0e10cSrcweir |* Hit-Test
984*cdf0e10cSrcweir |*
985*cdf0e10cSrcweir \******************************************************************************/
986*cdf0e10cSrcweir 
987*cdf0e10cSrcweir IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize,
988*cdf0e10cSrcweir 										const Size& rDisplaySize,
989*cdf0e10cSrcweir 										const Point& rRelHitPoint,
990*cdf0e10cSrcweir 										sal_uLong nFlags )
991*cdf0e10cSrcweir {
992*cdf0e10cSrcweir 	Point aRelPoint( rTotalSize.Width() * rRelHitPoint.X() / rDisplaySize.Width(),
993*cdf0e10cSrcweir 					 rTotalSize.Height() * rRelHitPoint.Y() / rDisplaySize.Height() );
994*cdf0e10cSrcweir 
995*cdf0e10cSrcweir 	// Falls Flags zur Spiegelung etc. angegeben sind, wird
996*cdf0e10cSrcweir 	// der zu pruefende Punkt vor der Pruefung entspr. transformiert
997*cdf0e10cSrcweir 	if ( nFlags )
998*cdf0e10cSrcweir 	{
999*cdf0e10cSrcweir 		if ( nFlags & IMAP_MIRROR_HORZ )
1000*cdf0e10cSrcweir 			aRelPoint.X() = rTotalSize.Width() - aRelPoint.X();
1001*cdf0e10cSrcweir 
1002*cdf0e10cSrcweir 		if ( nFlags & IMAP_MIRROR_VERT )
1003*cdf0e10cSrcweir 			aRelPoint.Y() = rTotalSize.Height() - aRelPoint.Y();
1004*cdf0e10cSrcweir 	}
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir 	// Alle Objekte durchlaufen und HitTest ausfuehren
1007*cdf0e10cSrcweir 	IMapObject* pObj = (IMapObject*) maList.First();
1008*cdf0e10cSrcweir 	while ( pObj )
1009*cdf0e10cSrcweir 	{
1010*cdf0e10cSrcweir 		if ( pObj->IsHit( aRelPoint ) )
1011*cdf0e10cSrcweir 			break;
1012*cdf0e10cSrcweir 
1013*cdf0e10cSrcweir 		pObj = (IMapObject*) maList.Next();
1014*cdf0e10cSrcweir 	}
1015*cdf0e10cSrcweir 
1016*cdf0e10cSrcweir 	return( pObj ? ( pObj->IsActive() ? pObj : NULL ) : NULL );
1017*cdf0e10cSrcweir }
1018*cdf0e10cSrcweir 
1019*cdf0e10cSrcweir 
1020*cdf0e10cSrcweir /******************************************************************************
1021*cdf0e10cSrcweir |*
1022*cdf0e10cSrcweir |*
1023*cdf0e10cSrcweir |*
1024*cdf0e10cSrcweir \******************************************************************************/
1025*cdf0e10cSrcweir 
1026*cdf0e10cSrcweir Rectangle ImageMap::GetBoundRect() const
1027*cdf0e10cSrcweir {
1028*cdf0e10cSrcweir 	Rectangle	aBoundRect;
1029*cdf0e10cSrcweir 	sal_uLong		nCount = maList.Count();
1030*cdf0e10cSrcweir 
1031*cdf0e10cSrcweir 	for ( sal_uLong i = 0; i < nCount; i++ )
1032*cdf0e10cSrcweir 		aBoundRect.Union( ( (IMapObject*) maList.GetObject( i ) )->GetBoundRect() );
1033*cdf0e10cSrcweir 
1034*cdf0e10cSrcweir 	return aBoundRect;
1035*cdf0e10cSrcweir }
1036*cdf0e10cSrcweir 
1037*cdf0e10cSrcweir 
1038*cdf0e10cSrcweir /******************************************************************************
1039*cdf0e10cSrcweir |*
1040*cdf0e10cSrcweir |*
1041*cdf0e10cSrcweir |*
1042*cdf0e10cSrcweir \******************************************************************************/
1043*cdf0e10cSrcweir 
1044*cdf0e10cSrcweir void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY )
1045*cdf0e10cSrcweir {
1046*cdf0e10cSrcweir 	sal_uInt16 nCount = (sal_uInt16) maList.Count();
1047*cdf0e10cSrcweir 
1048*cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < nCount; i++ )
1049*cdf0e10cSrcweir 	{
1050*cdf0e10cSrcweir 		IMapObject* pObj = GetIMapObject( i );
1051*cdf0e10cSrcweir 
1052*cdf0e10cSrcweir 		switch( pObj->GetType() )
1053*cdf0e10cSrcweir 		{
1054*cdf0e10cSrcweir 			case( IMAP_OBJ_RECTANGLE ):
1055*cdf0e10cSrcweir 				( (IMapRectangleObject*) pObj )->Scale( rFracX, rFracY );
1056*cdf0e10cSrcweir 			break;
1057*cdf0e10cSrcweir 
1058*cdf0e10cSrcweir 			case( IMAP_OBJ_CIRCLE ):
1059*cdf0e10cSrcweir 				( (IMapCircleObject*) pObj )->Scale( rFracX, rFracY );
1060*cdf0e10cSrcweir 			break;
1061*cdf0e10cSrcweir 
1062*cdf0e10cSrcweir 			case( IMAP_OBJ_POLYGON ):
1063*cdf0e10cSrcweir 				( (IMapPolygonObject*) pObj )->Scale( rFracX, rFracY );
1064*cdf0e10cSrcweir 			break;
1065*cdf0e10cSrcweir 
1066*cdf0e10cSrcweir 			default:
1067*cdf0e10cSrcweir 			break;
1068*cdf0e10cSrcweir 		}
1069*cdf0e10cSrcweir 	}
1070*cdf0e10cSrcweir }
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir 
1073*cdf0e10cSrcweir /******************************************************************************
1074*cdf0e10cSrcweir |*
1075*cdf0e10cSrcweir |* Objekte nacheinander wegschreiben
1076*cdf0e10cSrcweir |*
1077*cdf0e10cSrcweir \******************************************************************************/
1078*cdf0e10cSrcweir 
1079*cdf0e10cSrcweir void ImageMap::ImpWriteImageMap( SvStream& rOStm, const String& rBaseURL ) const
1080*cdf0e10cSrcweir {
1081*cdf0e10cSrcweir 	IMapObject* pObj;
1082*cdf0e10cSrcweir 	sal_uInt16		nCount = (sal_uInt16) maList.Count();
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < nCount; i++ )
1085*cdf0e10cSrcweir 	{
1086*cdf0e10cSrcweir 		pObj = (IMapObject*) maList.GetObject( i );
1087*cdf0e10cSrcweir         pObj->Write( rOStm, rBaseURL );
1088*cdf0e10cSrcweir 	}
1089*cdf0e10cSrcweir }
1090*cdf0e10cSrcweir 
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir /******************************************************************************
1093*cdf0e10cSrcweir |*
1094*cdf0e10cSrcweir |* Objekte nacheinander lesen
1095*cdf0e10cSrcweir |*
1096*cdf0e10cSrcweir \******************************************************************************/
1097*cdf0e10cSrcweir 
1098*cdf0e10cSrcweir void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String& rBaseURL )
1099*cdf0e10cSrcweir {
1100*cdf0e10cSrcweir 	// neue Objekte einlesen
1101*cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < nCount; i++ )
1102*cdf0e10cSrcweir 	{
1103*cdf0e10cSrcweir 		sal_uInt16 nType;
1104*cdf0e10cSrcweir 
1105*cdf0e10cSrcweir 		rIStm >> nType;
1106*cdf0e10cSrcweir 		rIStm.SeekRel( -2 );
1107*cdf0e10cSrcweir 
1108*cdf0e10cSrcweir 		switch( nType )
1109*cdf0e10cSrcweir 		{
1110*cdf0e10cSrcweir 			case ( IMAP_OBJ_RECTANGLE ):
1111*cdf0e10cSrcweir 			{
1112*cdf0e10cSrcweir 				IMapRectangleObject* pObj = new IMapRectangleObject;
1113*cdf0e10cSrcweir                 pObj->Read( rIStm, rBaseURL );
1114*cdf0e10cSrcweir 				maList.Insert( pObj, LIST_APPEND );
1115*cdf0e10cSrcweir 			}
1116*cdf0e10cSrcweir 			break;
1117*cdf0e10cSrcweir 
1118*cdf0e10cSrcweir 			case ( IMAP_OBJ_CIRCLE ):
1119*cdf0e10cSrcweir 			{
1120*cdf0e10cSrcweir 				IMapCircleObject* pObj = new IMapCircleObject;
1121*cdf0e10cSrcweir                 pObj->Read( rIStm, rBaseURL );
1122*cdf0e10cSrcweir 				maList.Insert( pObj, LIST_APPEND );
1123*cdf0e10cSrcweir 			}
1124*cdf0e10cSrcweir 			break;
1125*cdf0e10cSrcweir 
1126*cdf0e10cSrcweir 			case ( IMAP_OBJ_POLYGON ):
1127*cdf0e10cSrcweir 			{
1128*cdf0e10cSrcweir 				IMapPolygonObject* pObj = new IMapPolygonObject;
1129*cdf0e10cSrcweir                 pObj->Read( rIStm, rBaseURL );
1130*cdf0e10cSrcweir 				maList.Insert( pObj, LIST_APPEND );
1131*cdf0e10cSrcweir 			}
1132*cdf0e10cSrcweir 			break;
1133*cdf0e10cSrcweir 
1134*cdf0e10cSrcweir 			default:
1135*cdf0e10cSrcweir 			break;
1136*cdf0e10cSrcweir 		}
1137*cdf0e10cSrcweir 	}
1138*cdf0e10cSrcweir }
1139*cdf0e10cSrcweir 
1140*cdf0e10cSrcweir 
1141*cdf0e10cSrcweir /******************************************************************************
1142*cdf0e10cSrcweir |*
1143*cdf0e10cSrcweir |* Binaer speichern
1144*cdf0e10cSrcweir |*
1145*cdf0e10cSrcweir \******************************************************************************/
1146*cdf0e10cSrcweir 
1147*cdf0e10cSrcweir void ImageMap::Write( SvStream& rOStm, const String& rBaseURL ) const
1148*cdf0e10cSrcweir {
1149*cdf0e10cSrcweir 	IMapCompat*				pCompat;
1150*cdf0e10cSrcweir     String                  aImageName( GetName() );
1151*cdf0e10cSrcweir 	String					aDummy;
1152*cdf0e10cSrcweir 	sal_uInt16					nOldFormat = rOStm.GetNumberFormatInt();
1153*cdf0e10cSrcweir     sal_uInt16                  nCount = (sal_uInt16) GetIMapObjectCount();
1154*cdf0e10cSrcweir 	const rtl_TextEncoding	eEncoding = gsl_getSystemTextEncoding();
1155*cdf0e10cSrcweir 
1156*cdf0e10cSrcweir 	rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
1157*cdf0e10cSrcweir 
1158*cdf0e10cSrcweir 	// MagicCode schreiben
1159*cdf0e10cSrcweir 	rOStm << IMAPMAGIC;
1160*cdf0e10cSrcweir     rOStm << GetVersion();
1161*cdf0e10cSrcweir 	rOStm.WriteByteString( ByteString( aImageName, eEncoding ) );
1162*cdf0e10cSrcweir 	rOStm.WriteByteString( ByteString( aDummy, eEncoding ) );
1163*cdf0e10cSrcweir 	rOStm << nCount;
1164*cdf0e10cSrcweir 	rOStm.WriteByteString( ByteString( aImageName, eEncoding ) );
1165*cdf0e10cSrcweir 
1166*cdf0e10cSrcweir 	pCompat = new IMapCompat( rOStm, STREAM_WRITE );
1167*cdf0e10cSrcweir 
1168*cdf0e10cSrcweir 	// hier kann in neueren Versionen eingefuegt werden
1169*cdf0e10cSrcweir 
1170*cdf0e10cSrcweir 	delete pCompat;
1171*cdf0e10cSrcweir 
1172*cdf0e10cSrcweir     ImpWriteImageMap( rOStm, rBaseURL );
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir 	rOStm.SetNumberFormatInt( nOldFormat );
1175*cdf0e10cSrcweir }
1176*cdf0e10cSrcweir 
1177*cdf0e10cSrcweir 
1178*cdf0e10cSrcweir /******************************************************************************
1179*cdf0e10cSrcweir |*
1180*cdf0e10cSrcweir |* Binaer laden
1181*cdf0e10cSrcweir |*
1182*cdf0e10cSrcweir \******************************************************************************/
1183*cdf0e10cSrcweir 
1184*cdf0e10cSrcweir void ImageMap::Read( SvStream& rIStm, const String& rBaseURL )
1185*cdf0e10cSrcweir {
1186*cdf0e10cSrcweir 	ByteString	aString;
1187*cdf0e10cSrcweir 	char		cMagic[6];
1188*cdf0e10cSrcweir 	sal_uInt16		nOldFormat = rIStm.GetNumberFormatInt();
1189*cdf0e10cSrcweir 	sal_uInt16		nCount;
1190*cdf0e10cSrcweir 
1191*cdf0e10cSrcweir 	rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
1192*cdf0e10cSrcweir 	rIStm.Read( cMagic, sizeof( cMagic ) );
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir 	if ( !memcmp( cMagic, IMAPMAGIC, sizeof( cMagic ) ) )
1195*cdf0e10cSrcweir 	{
1196*cdf0e10cSrcweir 		IMapCompat* pCompat;
1197*cdf0e10cSrcweir 
1198*cdf0e10cSrcweir 		// alten Inhalt loeschen
1199*cdf0e10cSrcweir         ClearImageMap();
1200*cdf0e10cSrcweir 
1201*cdf0e10cSrcweir 		// Version ueberlesen wir
1202*cdf0e10cSrcweir 		rIStm.SeekRel( 2 );
1203*cdf0e10cSrcweir 
1204*cdf0e10cSrcweir         rIStm.ReadByteString( aString ); aName = String( aString, gsl_getSystemTextEncoding() );
1205*cdf0e10cSrcweir         rIStm.ReadByteString( aString ); // Dummy
1206*cdf0e10cSrcweir 		rIStm >> nCount;
1207*cdf0e10cSrcweir         rIStm.ReadByteString( aString ); // Dummy
1208*cdf0e10cSrcweir 
1209*cdf0e10cSrcweir 		pCompat = new IMapCompat( rIStm, STREAM_READ );
1210*cdf0e10cSrcweir 
1211*cdf0e10cSrcweir 		// hier kann in neueren Versionen gelesen werden
1212*cdf0e10cSrcweir 
1213*cdf0e10cSrcweir 		delete pCompat;
1214*cdf0e10cSrcweir         ImpReadImageMap( rIStm, nCount, rBaseURL );
1215*cdf0e10cSrcweir 
1216*cdf0e10cSrcweir 	}
1217*cdf0e10cSrcweir 	else
1218*cdf0e10cSrcweir 		rIStm.SetError( SVSTREAM_GENERALERROR );
1219*cdf0e10cSrcweir 
1220*cdf0e10cSrcweir 	rIStm.SetNumberFormatInt( nOldFormat );
1221*cdf0e10cSrcweir }
1222*cdf0e10cSrcweir 
1223