Fix typo
[LibreOffice.git] / include / vcl / imapobj.hxx
blob3c3e864954e53c63d2f1a0929aea68c5e2824dcc
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 #pragma once
22 #include <svl/macitem.hxx>
23 #include <rtl/strbuf.hxx>
25 class Point;
26 class SvStream;
28 enum class IMapObjectType
30 Rectangle = 1,
31 Circle = 2,
32 Polygon = 3
35 #define IMAP_OBJ_VERSION (sal_uInt16(0x0005))
36 #define IMAGE_MAP_VERSION (sal_uInt16(0x0001))
38 #define IMAPMAGIC "SDIMAP"
40 #define IMAP_MIRROR_HORZ 0x00000001L
41 #define IMAP_MIRROR_VERT 0x00000002L
43 enum class IMapFormat
45 Binary = 1,
46 CERN = 2,
47 NCSA = 3,
48 Detect = 15,
51 #define IMAP_ERR_OK 0x00000000L
52 #define IMAP_ERR_FORMAT 0x00000001L
54 class IMapObject
56 friend class ImageMap;
58 OUString aURL;
59 OUString aAltText;
60 OUString aDesc;
61 OUString aTarget;
62 OUString aName;
63 SvxMacroTableDtor aEventList;
64 bool bActive;
66 protected:
67 sal_uInt16 nReadVersion;
69 // binary import/export
70 virtual void WriteIMapObject( SvStream& rOStm ) const = 0;
71 virtual void ReadIMapObject( SvStream& rIStm ) = 0;
73 // helper methods
74 static void AppendCERNCoords(OStringBuffer& rBuf, const Point& rPoint100);
75 void AppendCERNURL(OStringBuffer& rBuf) const;
76 static void AppendNCSACoords(OStringBuffer& rBuf, const Point& rPoint100);
77 void AppendNCSAURL(OStringBuffer&rBuf) const;
79 public:
81 IMapObject();
82 IMapObject( OUString aURL,
83 OUString aAltText,
84 OUString aDesc,
85 OUString aTarget,
86 OUString aName,
87 bool bActive );
88 virtual ~IMapObject() {};
90 IMapObject(IMapObject const &) = default;
91 IMapObject(IMapObject &&) = default;
92 IMapObject & operator =(IMapObject const &) = default;
93 IMapObject & operator =(IMapObject &&) = default;
95 virtual IMapObjectType GetType() const = 0;
96 virtual bool IsHit( const Point& rPoint ) const = 0;
98 void Write ( SvStream& rOStm ) const;
99 void Read( SvStream& rIStm );
101 const OUString& GetURL() const { return aURL; }
102 void SetURL( const OUString& rURL ) { aURL = rURL; }
104 const OUString& GetAltText() const { return aAltText; }
105 void SetAltText( const OUString& rAltText) { aAltText = rAltText; }
107 const OUString& GetDesc() const { return aDesc; }
108 void SetDesc( const OUString& rDesc ) { aDesc = rDesc; }
110 const OUString& GetTarget() const { return aTarget; }
111 void SetTarget( const OUString& rTarget ) { aTarget = rTarget; }
113 const OUString& GetName() const { return aName; }
114 void SetName( const OUString& rName ) { aName = rName; }
116 bool IsActive() const { return bActive; }
117 void SetActive( bool bSetActive ) { bActive = bSetActive; }
119 bool IsEqual( const IMapObject& rEqObj ) const;
121 // IMap-Events
122 const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
123 void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */