xref: /AOO41X/main/svtools/inc/svtools/imap.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _IMAP_HXX
25cdf0e10cSrcweir #define _IMAP_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "svtools/svtdllapi.h"
28cdf0e10cSrcweir #include <tools/string.hxx>
29cdf0e10cSrcweir #include <tools/stream.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class Point;
32cdf0e10cSrcweir class Rectangle;
33cdf0e10cSrcweir class Size;
34cdf0e10cSrcweir class Fraction;
35cdf0e10cSrcweir class IMapObject;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir /******************************************************************************
38cdf0e10cSrcweir |*
39cdf0e10cSrcweir |*
40cdf0e10cSrcweir |*
41cdf0e10cSrcweir \******************************************************************************/
42cdf0e10cSrcweir 
43cdf0e10cSrcweir class SVT_DLLPUBLIC ImageMap
44cdf0e10cSrcweir {
45cdf0e10cSrcweir 	List				maList;
46cdf0e10cSrcweir 	String				aName;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir protected:
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	// Binaer laden/speichern
51cdf0e10cSrcweir     void                ImpWriteImageMap( SvStream& rOStm, const String& ) const ;
52cdf0e10cSrcweir     void                ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String& );
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	// Im-/Export
55cdf0e10cSrcweir     void                ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const;
56cdf0e10cSrcweir     void                ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const;
57cdf0e10cSrcweir     sal_uLong               ImpReadCERN( SvStream& rOStm, const String& rBaseURL );
58cdf0e10cSrcweir     sal_uLong               ImpReadNCSA( SvStream& rOStm, const String& rBaseURL );
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     void                ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL );
61cdf0e10cSrcweir 	Point				ImpReadCERNCoords( const char** ppStr );
62cdf0e10cSrcweir 	long				ImpReadCERNRadius( const char** ppStr );
63cdf0e10cSrcweir     String              ImpReadCERNURL( const char** ppStr, const String& rBaseURL );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     void                ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL );
66cdf0e10cSrcweir     String              ImpReadNCSAURL( const char** ppStr, const String& rBaseURL );
67cdf0e10cSrcweir 	Point				ImpReadNCSACoords( const char** ppStr );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	sal_uLong				ImpDetectFormat( SvStream& rIStm );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir public:
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	TYPEINFO();
74cdf0e10cSrcweir 
ImageMap()75cdf0e10cSrcweir 						ImageMap() {};
76cdf0e10cSrcweir 						ImageMap( const String& rName );
77cdf0e10cSrcweir 						ImageMap( const ImageMap& rImageMap );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 						// Der Dtor gibt den intern belegten
80cdf0e10cSrcweir 						// Speicher wieder frei;
81cdf0e10cSrcweir 						//  alle IMapObjekte werden im Dtor zerstoert;
82cdf0e10cSrcweir 	virtual				~ImageMap();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	// Zuweisungsoperator
85cdf0e10cSrcweir 	ImageMap&			operator=( const ImageMap& rImageMap );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	// Vergleichsoperator (es wird alles auf Gleichheit geprueft)
88cdf0e10cSrcweir 	sal_Bool				operator==( const ImageMap& rImageMap );
89cdf0e10cSrcweir 	sal_Bool				operator!=( const ImageMap& rImageMap );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	// In die Map wird ein neues IMap-Obkekt ans Ende eingefuegt
92cdf0e10cSrcweir 	void				InsertIMapObject( const IMapObject& rIMapObject );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	// Zugriff auf einzelne IMapObjekte; die Objekte
95cdf0e10cSrcweir 	// duerfen von aussen _nicht_ zerstoert werden
GetFirstIMapObject()96cdf0e10cSrcweir 	IMapObject*			GetFirstIMapObject() { return (IMapObject*) maList.First(); }
GetNextIMapObject()97cdf0e10cSrcweir 	IMapObject*			GetNextIMapObject() { return (IMapObject*) maList.Next(); }
GetLastIMapObject()98cdf0e10cSrcweir 	IMapObject*			GetLastIMapObject() { return (IMapObject*) maList.Last(); }
GetPrevIMapObject()99cdf0e10cSrcweir 	IMapObject*			GetPrevIMapObject() { return (IMapObject*) maList.Prev(); }
GetIMapObject(sal_uInt16 nPos) const100cdf0e10cSrcweir 	IMapObject*			GetIMapObject( sal_uInt16 nPos ) const { return (IMapObject*) maList.GetObject( nPos ); }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	// Gibt das Objekt zurueck, das zuerst getroffen wurde oder NULL;
103cdf0e10cSrcweir 	// Groessen- und Positionsangaben sind in 1/100mm;
104cdf0e10cSrcweir 	// rTotalSize ist die Originalgroesse des Bildes;
105cdf0e10cSrcweir 	// rDisplaySize die aktuelle Darstellungsgroesse;
106cdf0e10cSrcweir 	// rRelPoint bezieht sich auf die Darstellungsgroesse
107cdf0e10cSrcweir 	// und die linke oebere Ecke des Bildes
108cdf0e10cSrcweir 	IMapObject*			GetHitIMapObject( const Size& rOriginalSize,
109cdf0e10cSrcweir 										  const Size& rDisplaySize,
110cdf0e10cSrcweir 										  const Point& rRelHitPoint,
111cdf0e10cSrcweir 										  sal_uLong nFlags = 0 );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	// Gibt die Gesamtanzahl der IMap-Objekte zurueck
GetIMapObjectCount() const114cdf0e10cSrcweir 	sal_uInt16				GetIMapObjectCount() const { return (sal_uInt16) maList.Count(); }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	// Loescht alle internen Objekte
117cdf0e10cSrcweir 	void				ClearImageMap();
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	// liefert die aktuelle Versionsnummer
120cdf0e10cSrcweir 	sal_uInt16				GetVersion() const;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	// liefert / setzt den Namen der ImageMap
GetName() const123cdf0e10cSrcweir 	const String&		GetName() const { return aName; }
SetName(const String & rName)124cdf0e10cSrcweir 	void				SetName( const String& rName ) { aName = rName; }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	// gibt das BoundRect aller IMap-Objekte in 1/100mm zurueck
127cdf0e10cSrcweir 	Rectangle			GetBoundRect() const;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	// skaliert alle Objekte der ImageMap entpr. dem uebergebenen Faktor
130cdf0e10cSrcweir 	void				Scale( const Fraction& rFractX, const Fraction& rFracY );
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	// Im-/Export
133cdf0e10cSrcweir     void                Write ( SvStream& rOStm, const String& rBaseURL ) const;
134cdf0e10cSrcweir     void                Read( SvStream& rIStm, const String& rBaseURL );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     void                Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL ) const;
137cdf0e10cSrcweir     sal_uLong               Read( SvStream& rIStm, sal_uLong nFormat, const String& rBaseURL );
138cdf0e10cSrcweir };
139cdf0e10cSrcweir 
140cdf0e10cSrcweir /******************************************************************************
141cdf0e10cSrcweir |*
142cdf0e10cSrcweir |*
143cdf0e10cSrcweir |*
144cdf0e10cSrcweir \******************************************************************************/
145cdf0e10cSrcweir 
146cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
147cdf0e10cSrcweir 
148cdf0e10cSrcweir class IMapCompat
149cdf0e10cSrcweir {
150cdf0e10cSrcweir 	SvStream*		pRWStm;
151cdf0e10cSrcweir 	sal_uLong			nCompatPos;
152cdf0e10cSrcweir 	sal_uLong			nTotalSize;
153cdf0e10cSrcweir 	sal_uInt16			nStmMode;
154cdf0e10cSrcweir 
IMapCompat()155cdf0e10cSrcweir 					IMapCompat() {}
IMapCompat(const IMapCompat &)156cdf0e10cSrcweir 					IMapCompat( const IMapCompat& ) {}
operator =(const IMapCompat &)157cdf0e10cSrcweir 	IMapCompat&		operator=( const IMapCompat& ) { return *this; }
operator ==(const IMapCompat &)158cdf0e10cSrcweir 	sal_Bool			operator==( const IMapCompat& ) { return sal_False; }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir public:
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 					IMapCompat( SvStream& rStm, const sal_uInt16 nStreamMode );
163cdf0e10cSrcweir 					~IMapCompat();
164cdf0e10cSrcweir };
165cdf0e10cSrcweir 
166cdf0e10cSrcweir //#endif // __PRIVATE
167cdf0e10cSrcweir #endif // _IMAP_HXX
168