bump product version to 4.1.6.2
[LibreOffice.git] / include / svtools / imap.hxx
blob790cdebef60fb8f11acbd237a127a234113a1187
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _IMAP_HXX
21 #define _IMAP_HXX
23 #include "svtools/svtdllapi.h"
24 #include <tools/string.hxx>
25 #include <tools/stream.hxx>
26 #include <vector>
28 class Point;
29 class Rectangle;
30 class Size;
31 class Fraction;
32 class IMapObject;
34 typedef ::std::vector< IMapObject* > IMapObjectList_impl;
36 class SVT_DLLPUBLIC ImageMap
38 private:
40 IMapObjectList_impl maList;
41 String aName;
43 protected:
45 // Binaer laden/speichern
46 void ImpWriteImageMap( SvStream& rOStm, const String& ) const ;
47 void ImpReadImageMap( SvStream& rIStm, size_t nCount, const String& );
49 // Im-/Export
50 void ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const;
51 void ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const;
52 sal_uLong ImpReadCERN( SvStream& rOStm, const String& rBaseURL );
53 sal_uLong ImpReadNCSA( SvStream& rOStm, const String& rBaseURL );
55 void ImpReadCERNLine( const OString& rLine, const String& rBaseURL );
56 Point ImpReadCERNCoords( const char** ppStr );
57 long ImpReadCERNRadius( const char** ppStr );
58 String ImpReadCERNURL( const char** ppStr, const String& rBaseURL );
60 void ImpReadNCSALine( const OString& rLine, const String& rBaseURL );
61 String ImpReadNCSAURL( const char** ppStr, const String& rBaseURL );
62 Point ImpReadNCSACoords( const char** ppStr );
64 sal_uLong ImpDetectFormat( SvStream& rIStm );
66 public:
68 TYPEINFO();
70 ImageMap() {};
71 ImageMap( const String& rName );
72 ImageMap( const ImageMap& rImageMap );
74 // Der Dtor gibt den intern belegten
75 // Speicher wieder frei;
76 // alle IMapObjekte werden im Dtor zerstoert;
77 virtual ~ImageMap();
79 // Zuweisungsoperator
80 ImageMap& operator=( const ImageMap& rImageMap );
82 // Vergleichsoperator (es wird alles auf Gleichheit geprueft)
83 sal_Bool operator==( const ImageMap& rImageMap );
84 sal_Bool operator!=( const ImageMap& rImageMap );
86 // In die Map wird ein neues IMap-Obkekt ans Ende eingefuegt
87 void InsertIMapObject( const IMapObject& rIMapObject );
89 // Zugriff auf einzelne IMapObjekte; die Objekte
90 // duerfen von aussen _nicht_ zerstoert werden
91 IMapObject* GetIMapObject( size_t nPos ) const
93 return ( nPos < maList.size() ) ? maList[ nPos ] : NULL;
96 // Gibt das Objekt zurueck, das zuerst getroffen wurde oder NULL;
97 // Groessen- und Positionsangaben sind in 1/100mm;
98 // rTotalSize ist die Originalgroesse des Bildes;
99 // rDisplaySize die aktuelle Darstellungsgroesse;
100 // rRelPoint bezieht sich auf die Darstellungsgroesse
101 // und die linke oebere Ecke des Bildes
102 IMapObject* GetHitIMapObject( const Size& rOriginalSize,
103 const Size& rDisplaySize,
104 const Point& rRelHitPoint,
105 sal_uLong nFlags = 0 );
107 // Gibt die Gesamtanzahl der IMap-Objekte zurueck
108 size_t GetIMapObjectCount() const { return maList.size(); }
110 // Loescht alle internen Objekte
111 void ClearImageMap();
113 // liefert die aktuelle Versionsnummer
114 sal_uInt16 GetVersion() const;
116 // liefert / setzt den Namen der ImageMap
117 const String& GetName() const { return aName; }
118 void SetName( const String& rName ) { aName = rName; }
120 // skaliert alle Objekte der ImageMap entpr. dem uebergebenen Faktor
121 void Scale( const Fraction& rFractX, const Fraction& rFracY );
123 // Im-/Export
124 void Write ( SvStream& rOStm, const String& rBaseURL ) const;
125 void Read( SvStream& rIStm, const String& rBaseURL );
127 void Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL ) const;
128 sal_uLong Read( SvStream& rIStm, sal_uLong nFormat, const String& rBaseURL );
131 class IMapCompat
133 SvStream* pRWStm;
134 sal_uLong nCompatPos;
135 sal_uLong nTotalSize;
136 sal_uInt16 nStmMode;
138 IMapCompat() {}
139 IMapCompat( const IMapCompat& ) {}
140 IMapCompat& operator=( const IMapCompat& ) { return *this; }
141 sal_Bool operator==( const IMapCompat& ) { return sal_False; }
143 public:
145 IMapCompat( SvStream& rStm, const sal_uInt16 nStreamMode );
146 ~IMapCompat();
149 #endif // _IMAP_HXX
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */