Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/inc/userdat.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 <svx/svdobj.hxx>
23
#include "address.hxx"
24
#include "drwlayer.hxx"
25
26
// Object IDs for UserData
27
97.6k
#define SC_UD_OBJDATA       1
28
// SVX_IMAPINFO_ID = 2
29
0
#define SC_UD_MACRODATA     3
30
31
class SC_DLLPUBLIC ScDrawObjData final : public SdrObjUserData
32
{
33
public:
34
    enum Type { CellNote, ValidationCircle, DetectiveArrow, DrawingObject };
35
36
    ScAddress           maStart;
37
    ScAddress           maEnd;
38
    Point               maStartOffset;
39
    Point               maEndOffset;
40
    Type                meType;
41
    bool                mbResizeWithCell = false;
42
    bool                mbWasInHiddenRow = false;
43
44
    explicit            ScDrawObjData();
45
46
4.16k
    const tools::Rectangle & getShapeRect() const { return maShapeRect; };
47
488
    const tools::Rectangle & getLastCellRect() const { return maLastCellRect; };
48
    void setShapeRect(const ScDocument* rDoc, tools::Rectangle rNewRect, bool bIsVisible=true)
49
16.8k
    {
50
        // bIsVisible should be false when the object is hidden obviously. We don't want to store the old cell rect in that
51
        // case because it will have height=0
52
16.8k
        if (maStart.IsValid() && mbResizeWithCell && bIsVisible)
53
4.62k
            maLastCellRect = ScDrawLayer::GetCellRect(*rDoc, maStart, true);
54
16.8k
        maShapeRect = rNewRect;
55
16.8k
        mbWasInHiddenRow = !bIsVisible;
56
16.8k
    };
57
58
private:
59
     virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
60
61
    // Stores the last cell rect this shape was anchored to.
62
    // Needed when the cell is resized to resize the image accordingly.
63
    tools::Rectangle maLastCellRect;
64
    // Stores the rect of the shape to which this ScDrawObjData belongs.
65
    tools::Rectangle maShapeRect;
66
};
67
68
class SAL_DLLPUBLIC_RTTI ScMacroInfo final : public SdrObjUserData
69
{
70
public:
71
                    ScMacroInfo();
72
    virtual         ~ScMacroInfo() override;
73
74
0
    ScMacroInfo(ScMacroInfo const &) = default;
75
    ScMacroInfo(ScMacroInfo &&) = default;
76
    ScMacroInfo & operator =(ScMacroInfo const &) = delete; // due to SdrObjUserData
77
    ScMacroInfo & operator =(ScMacroInfo &&) = delete; // due to SdrObjUserData
78
79
    virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
80
81
0
    void            SetMacro( const OUString& rMacro ) { maMacro = rMacro; }
82
0
    const OUString& GetMacro() const { return maMacro; }
83
84
private:
85
    OUString   maMacro;
86
};
87
88
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */