LibreOffice Module vcl (master) 1
imap.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_VCL_IMAP_HXX
21#define INCLUDED_VCL_IMAP_HXX
22
23#include <vcl/imapobj.hxx>
24#include <vcl/dllapi.h>
25#include <tools/stream.hxx>
26#include <tools/solar.h>
27#include <memory>
28#include <vector>
29
30class Point;
31class Size;
32class Fraction;
33class IMapObject;
34
36{
37private:
38
39 std::vector<std::unique_ptr<IMapObject>> maList;
40 OUString aName;
41
42 // binary saving/loading
43 void ImpWriteImageMap( SvStream& rOStm ) const ;
44 void ImpReadImageMap( SvStream& rIStm, size_t nCount );
45
46 // Import/Export
47 void ImpWriteCERN( SvStream& rOStm ) const;
48 void ImpWriteNCSA( SvStream& rOStm ) const;
49 void ImpReadCERN( SvStream& rOStm );
50 void ImpReadNCSA( SvStream& rOStm );
51
52 void ImpReadCERNLine( std::string_view rLine );
53 static Point ImpReadCERNCoords( const char** ppStr );
54 static tools::Long ImpReadCERNRadius( const char** ppStr );
55 static OUString ImpReadCERNURL( const char** ppStr );
56
57 void ImpReadNCSALine( std::string_view rLine );
58 static OUString ImpReadNCSAURL( const char** ppStr );
59 static Point ImpReadNCSACoords( const char** ppStr );
60
61 static IMapFormat ImpDetectFormat( SvStream& rIStm );
62
63public:
64
66 ImageMap( OUString aName );
67 ImageMap( const ImageMap& rImageMap );
68
69 // all IMapObjects are destroyed in the destructor
70 ~ImageMap();
71
72 ImageMap& operator=( const ImageMap& rImageMap );
73
74 // comparison (everything is checked for equality)
75 bool operator==( const ImageMap& rImageMap );
76 bool operator!=( const ImageMap& rImageMap );
77
78 // a new IMap object is inserted at the end of the Map
79 void InsertIMapObject( const IMapObject& rIMapObject );
80 void InsertIMapObject( std::unique_ptr<IMapObject> rIMapObject );
81
82 // access to the single ImapObjects; the objects may
83 // not be destroyed from outside
84 IMapObject* GetIMapObject( size_t nPos ) const
85 {
86 return ( nPos < maList.size() ) ? maList[ nPos ].get() : nullptr;
87 }
88
89 // returns the object which was hit first or NULL;
90 // size and position values are in 1/100mm;
91 // rTotalSize is the original size of the image
92 // rDisplaySize is the current size;
93 // rRelPoint relates to the display size and the upper left
94 // corner of the image
95 IMapObject* GetHitIMapObject( const Size& rOriginalSize,
96 const Size& rDisplaySize,
97 const Point& rRelHitPoint,
98 sal_uLong nFlags = 0 ) const;
99
100 // returns the total amount of IMap objects
101 size_t GetIMapObjectCount() const { return maList.size(); }
102
103 // deletes all internal objects
104 void ClearImageMap();
105
106 const OUString& GetName() const { return aName; }
107 void SetName( const OUString& rName ) { aName = rName; }
108
109 // scales all objects of the ImageMap according to the given factor
110 void Scale( const Fraction& rFractX, const Fraction& rFracY );
111
112 // Import/Export
113 void Write ( SvStream& rOStm ) const;
114 void Read( SvStream& rIStm );
115
116 void Write( SvStream& rOStm, IMapFormat nFormat ) const;
117 sal_uLong Read( SvStream& rIStm, IMapFormat nFormat );
118};
119
121{
123 sal_uInt64 nCompatPos;
124 sal_uInt64 nTotalSize;
126
127 IMapCompat( const IMapCompat& ) = delete;
128 IMapCompat& operator=( const IMapCompat& ) { return *this; }
129
130public:
131
132 IMapCompat( SvStream& rStm, const StreamMode nStreamMode );
133 ~IMapCompat();
134};
135
136#endif // INCLUDED_VCL_IMAP_HXX
137
138/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
StreamMode nStmMode
Definition: imap.hxx:125
sal_uInt64 nCompatPos
Definition: imap.hxx:123
IMapCompat & operator=(const IMapCompat &)
Definition: imap.hxx:128
IMapCompat(const IMapCompat &)=delete
~IMapCompat()
Definition: imap3.cxx:62
sal_uInt64 nTotalSize
Definition: imap.hxx:124
SvStream * pRWStm
Definition: imap.hxx:122
void SetName(const OUString &rName)
Definition: imap.hxx:107
OUString aName
Definition: imap.hxx:40
const OUString & GetName() const
Definition: imap.hxx:106
ImageMap()
Definition: imap.hxx:65
std::vector< std::unique_ptr< IMapObject > > maList
Definition: imap.hxx:39
IMapObject * GetIMapObject(size_t nPos) const
Definition: imap.hxx:84
size_t GetIMapObjectCount() const
Definition: imap.hxx:101
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
IMapFormat
Definition: imapobj.hxx:45
OUString aName
sal_uInt16 nPos
long Long
sal_uIntPtr sal_uLong
StreamMode
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:175
bool operator!=(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:180