Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/sdr/contact/viewobjectcontact.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
#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX
21
#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX
22
23
#include <memory>
24
#include <optional>
25
#include <svx/svxdllapi.h>
26
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
27
28
class SdrPageView;
29
30
namespace sdr::animation {
31
    class PrimitiveAnimation;
32
}
33
namespace drawinglayer::primitive2d { class Primitive2DDecompositionVisitor; }
34
35
namespace sdr::contact {
36
37
class DisplayInfo;
38
class ObjectContact;
39
class ViewContact;
40
41
class SVXCORE_DLLPUBLIC ViewObjectContact
42
{
43
private:
44
    // must-exist and constant contacts
45
    ObjectContact&                                  mrObjectContact;
46
    ViewContact&                                    mrViewContact;
47
48
    // This range defines the object's BoundRect
49
    basegfx::B2DRange                               maObjectRange;
50
51
    // PrimitiveSequence of the ViewContact. This contains all necessary information
52
    // for the graphical visualisation and needs to be supported by all VCs which
53
    // can be visualized.
54
    drawinglayer::primitive2d::Primitive2DContainer  mxPrimitive2DSequence;
55
56
    // the PrimitiveAnimation if Primitive2DContainer contains animations
57
    std::unique_ptr<sdr::animation::PrimitiveAnimation> mpPrimitiveAnimation;
58
59
    // possible on-demand calculated GridOffset for non-linear ViewToDevice transformation (calc)
60
    mutable std::optional<basegfx::B2DVector>       moGridOffset;
61
62
    // used to detect ActionChanged() during primitive construction
63
    int                                             mnActionChangedCount;
64
65
    // This bool gets set when the object gets invalidated by ActionChanged() and
66
    // can be used from the OC to late-invalidates
67
    bool                                            mbLazyInvalidate : 1;
68
69
protected:
70
    // make redirector a protected friend, it needs to call createPrimitives as default action
71
    friend class ViewObjectContactRedirector;
72
73
    // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation
74
    // and setup accordingly
75
    void checkForPrimitive2DAnimations();
76
77
    // This method is responsible for creating the graphical visualisation data which is
78
    // stored/cached in the local primitive. Default gets view-independent Primitive
79
    // from the ViewContact using ViewContact::getViewIndependentPrimitive2DContainer(), takes care of
80
    // visibility, handles glue and ghosted.
81
    // This method will not handle included hierarchies and not check geometric visibility.
82
    virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
83
84
    // method for flushing Primitive2DContainer for VOC implementations
85
0
    void flushPrimitive2DSequence() { mxPrimitive2DSequence.clear(); }
86
87
public:
88
    // basic constructor.
89
    ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact);
90
    virtual ~ViewObjectContact();
91
92
    // access to ObjectContact
93
536k
    ObjectContact& GetObjectContact() const { return mrObjectContact; }
94
95
    // access to ViewContact
96
306k
    ViewContact& GetViewContact() const { return mrViewContact; }
97
98
    // get the object size range
99
    const basegfx::B2DRange& getObjectRange() const;
100
101
    // React on changes of the object of this ViewContact
102
    virtual void ActionChanged();
103
104
    // IASS: helper for IASS invalidates
105
    void ActionChangedIfDifferentPageView(const SdrPageView& rSdrPageView);
106
107
    // LazyInvalidate handling
108
    void triggerLazyInvalidate();
109
110
    // Check if this primitive is animated in any OC (View) which means it has
111
    // generated a PrimitiveAnimation
112
0
    bool isAnimated() const { return (nullptr != mpPrimitiveAnimation); }
113
114
    // Take some action when new objects are inserted
115
    void ActionChildInserted(ViewContact& rChild);
116
117
    // access to the local primitive. This will ensure that the local primitive is
118
    // current in comparing the local one with a fresh created incarnation
119
    // This method will not handle included hierarchies and not check visibility.
120
    drawinglayer::primitive2d::Primitive2DContainer const & getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
121
122
    void createStructureTag(drawinglayer::primitive2d::Primitive2DContainer & rNewPrimitiveSequence) const;
123
124
    /// check if getPrimitive2DSequence() should create tag
125
    virtual bool isExportPDFTags() const;
126
127
    // test this VOC for visibility concerning model-view stuff like e.g. Layer
128
    virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
129
130
    // test this VOC for ghosted mode
131
    virtual bool isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const;
132
133
    // process this primitive: Eventually also recursively travel an existing hierarchy,
134
    // e.g. for group objects, scenes or pages. This method will test geometrical visibility.
135
    virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
136
137
    // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy
138
    void getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
139
140
    // interface to support GridOffset for non-linear ViewToDevice transformation (calc)
141
    const basegfx::B2DVector& getGridOffset() const;
142
    void resetGridOffset();
143
};
144
145
}
146
147
148
#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX
149
150
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */