1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SVTOOLS_IMAP_HXX
21 #define INCLUDED_SVTOOLS_IMAP_HXX
23 #include <svtools/imapobj.hxx>
24 #include <svtools/svtdllapi.h>
25 #include <tools/stream.hxx>
29 namespace tools
{ class Rectangle
; }
34 class SVT_DLLPUBLIC ImageMap final
38 ::std::vector
< IMapObject
* > maList
;
41 // binary saving/loading
42 void ImpWriteImageMap( SvStream
& rOStm
, const OUString
& ) const ;
43 void ImpReadImageMap( SvStream
& rIStm
, size_t nCount
, const OUString
& );
46 void ImpWriteCERN( SvStream
& rOStm
) const;
47 void ImpWriteNCSA( SvStream
& rOStm
) const;
48 sal_uLong
ImpReadCERN( SvStream
& rOStm
);
49 sal_uLong
ImpReadNCSA( SvStream
& rOStm
);
51 void ImpReadCERNLine( const OString
& rLine
, const OUString
& rBaseURL
);
52 static Point
ImpReadCERNCoords( const char** ppStr
);
53 static long ImpReadCERNRadius( const char** ppStr
);
54 static OUString
ImpReadCERNURL( const char** ppStr
, const OUString
& rBaseURL
);
56 void ImpReadNCSALine( const OString
& rLine
, const OUString
& rBaseURL
);
57 static OUString
ImpReadNCSAURL( const char** ppStr
, const OUString
& rBaseURL
);
58 static Point
ImpReadNCSACoords( const char** ppStr
);
60 static sal_uLong
ImpDetectFormat( SvStream
& rIStm
);
65 ImageMap( const OUString
& rName
);
66 ImageMap( const ImageMap
& rImageMap
);
68 // all IMapObjects are destroyed in the destructor
71 ImageMap
& operator=( const ImageMap
& rImageMap
);
73 // comparison (everything is checked for equality)
74 bool operator==( const ImageMap
& rImageMap
);
75 bool operator!=( const ImageMap
& rImageMap
);
77 // a new IMap object is inserted at the end of the Map
78 void InsertIMapObject( const IMapObject
& rIMapObject
);
80 // access to the single ImapObjects; the objects may
81 // not be destroyed from outside
82 IMapObject
* GetIMapObject( size_t nPos
) const
84 return ( nPos
< maList
.size() ) ? maList
[ nPos
] : nullptr;
87 // returns the object which was hit first or NULL;
88 // size and position values are in 1/100mm;
89 // rTotalSize is the original size of the image
90 // rDisplaySize is the current size;
91 // rRelPoint relates to the display size and the upper left
92 // corner of the image
93 IMapObject
* GetHitIMapObject( const Size
& rOriginalSize
,
94 const Size
& rDisplaySize
,
95 const Point
& rRelHitPoint
,
96 sal_uLong nFlags
= 0 );
98 // returns the total amount of IMap objects
99 size_t GetIMapObjectCount() const { return maList
.size(); }
101 // deletes all internal objects
102 void ClearImageMap();
104 const OUString
& GetName() const { return aName
; }
105 void SetName( const OUString
& rName
) { aName
= rName
; }
107 // scales all objects of the ImageMap according to the given factor
108 void Scale( const Fraction
& rFractX
, const Fraction
& rFracY
);
111 void Write ( SvStream
& rOStm
) const;
112 void Read( SvStream
& rIStm
);
114 void Write( SvStream
& rOStm
, sal_uLong nFormat
) const;
115 sal_uLong
Read( SvStream
& rIStm
, sal_uLong nFormat
);
121 sal_uInt64 nCompatPos
;
122 sal_uInt64 nTotalSize
;
125 IMapCompat( const IMapCompat
& ) = delete;
126 IMapCompat
& operator=( const IMapCompat
& ) { return *this; }
130 IMapCompat( SvStream
& rStm
, const StreamMode nStreamMode
);
134 #endif // INCLUDED_SVTOOLS_IMAP_HXX
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */