Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/vcl/imapobj.hxx
Line
Count
Source
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
#pragma once
21
22
#include <svl/macitem.hxx>
23
#include <rtl/strbuf.hxx>
24
25
class Point;
26
class SvStream;
27
28
enum class IMapObjectType
29
{
30
    Rectangle = 1,
31
    Circle    = 2,
32
    Polygon   = 3
33
};
34
35
0
#define IMAP_OBJ_VERSION    (sal_uInt16(0x0005))
36
0
#define IMAGE_MAP_VERSION   (sal_uInt16(0x0001))
37
38
0
#define IMAPMAGIC           "SDIMAP"
39
40
0
#define IMAP_MIRROR_HORZ    0x00000001L
41
0
#define IMAP_MIRROR_VERT    0x00000002L
42
43
enum class IMapFormat
44
{
45
    Binary  = 1,
46
    CERN    = 2,
47
    NCSA    = 3,
48
    Detect  = 15,
49
};
50
51
0
#define IMAP_ERR_OK         0x00000000L
52
0
#define IMAP_ERR_FORMAT     0x00000001L
53
54
class IMapObject
55
{
56
    friend class        ImageMap;
57
58
    OUString            aURL;
59
    OUString            aAltText;
60
    OUString            aDesc;
61
    OUString            aTarget;
62
    OUString            aName;
63
    SvxMacroTableDtor   aEventList;
64
    bool                bActive;
65
66
protected:
67
    sal_uInt16              nReadVersion;
68
69
    // binary import/export
70
    virtual void        WriteIMapObject( SvStream& rOStm ) const = 0;
71
    virtual void        ReadIMapObject(  SvStream& rIStm ) = 0;
72
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;
78
79
public:
80
81
                        IMapObject();
82
                        IMapObject( OUString aURL,
83
                                    OUString aAltText,
84
                                    OUString aDesc,
85
                                    OUString aTarget,
86
                                    OUString aName,
87
                                    bool bActive );
88
5.99k
    virtual             ~IMapObject() {};
89
90
3.93k
    IMapObject(IMapObject const &) = default;
91
    IMapObject(IMapObject &&) = default;
92
    IMapObject & operator =(IMapObject const &) = default;
93
    IMapObject & operator =(IMapObject &&) = default;
94
95
    virtual IMapObjectType GetType() const = 0;
96
    virtual bool        IsHit( const Point& rPoint ) const = 0;
97
98
    void                Write ( SvStream& rOStm ) const;
99
    void                Read( SvStream& rIStm );
100
101
0
    const OUString&     GetURL() const { return aURL; }
102
0
    void                SetURL( const OUString& rURL ) { aURL = rURL; }
103
104
0
    const OUString&     GetAltText() const { return aAltText; }
105
0
    void                SetAltText( const OUString& rAltText) { aAltText = rAltText; }
106
107
0
    const OUString&     GetDesc() const { return aDesc; }
108
0
    void                SetDesc( const OUString& rDesc ) { aDesc = rDesc; }
109
110
0
    const OUString&     GetTarget() const { return aTarget; }
111
0
    void                SetTarget( const OUString& rTarget ) { aTarget = rTarget; }
112
113
0
    const OUString&     GetName() const { return aName; }
114
0
    void                SetName( const OUString& rName ) { aName = rName; }
115
116
0
    bool                IsActive() const { return bActive; }
117
0
    void                SetActive( bool bSetActive ) { bActive = bSetActive; }
118
119
    bool                IsEqual( const IMapObject& rEqObj ) const;
120
121
    // IMap-Events
122
0
    const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
123
5
    void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
124
};
125
126
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */