Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/sdr/contact/objectcontact.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_OBJECTCONTACT_HXX
21
#define INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
22
23
#include <svx/sdr/animation/objectanimator.hxx>
24
#include <svx/sdr/animation/animationstate.hxx>
25
#include <svx/svxdllapi.h>
26
#include <drawinglayer/geometry/viewinformation2d.hxx>
27
28
class SdrPageView;
29
class OutputDevice;
30
31
namespace vcl {
32
    class PDFExtOutDevData;
33
}
34
35
namespace basegfx {
36
    class B2DRange;
37
}
38
39
namespace sdr::contact {
40
41
class DisplayInfo;
42
class ViewContact;
43
class ViewObjectContactRedirector;
44
45
class SVXCORE_DLLPUBLIC ObjectContact
46
{
47
private:
48
    // make ViewObjectContact a friend to exclusively allow it to use
49
    // AddViewObjectContact/RemoveViewObjectContact
50
    friend class ViewObjectContact;
51
52
    // All VOCs which are created using this OC, thus remembering this OC
53
    // as a reference. All those VOCs need to be deleted when the OC goes down.
54
    // Registering and de-registering is done in the VOC constructors/destructors.
55
    std::vector< ViewObjectContact* >               maViewObjectContactVector;
56
57
    // A new ViewObjectContact was created and shall be remembered.
58
    void AddViewObjectContact(ViewObjectContact& rVOContact);
59
60
    // A ViewObjectContact was deleted and shall be forgotten.
61
    void RemoveViewObjectContact(ViewObjectContact& rVOContact);
62
63
    // the primitiveAnimator which is used if this View and/or the contained primitives
64
    // support animatedSwitchPrimitives
65
    sdr::animation::primitiveAnimator               maPrimitiveAnimator;
66
67
    // The redirector. If set it is used to pipe all supported calls
68
    // to the redirector
69
    ViewObjectContactRedirector*                    mpViewObjectContactRedirector;
70
71
    // the Primitive2DParameters containing view information
72
    drawinglayer::geometry::ViewInformation2D       maViewInformation2D;
73
74
    // flag for preview renderer
75
    bool                                            mbIsPreviewRenderer : 1;
76
77
protected:
78
    // Interface to allow derivates to travel over the registered VOC's
79
0
    sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); }
80
0
    ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; }
81
82
    // interface to allow derivates to set PreviewRenderer flag
83
62.5k
    void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; }
84
85
    // interface to allow derivates to set ViewInformation2D
86
188k
    void setViewInformation2D2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; }
87
88
    // Allow to set EditViewActive early at local ViewInformation2D from ObjectContactOfPageView
89
62.5k
    void setEditViewActiveEarly() { maViewInformation2D.setEditViewActive(true); }
90
91
public:
92
    // basic constructor
93
    ObjectContact();
94
    virtual ~ObjectContact();
95
96
    // LazyInvalidate request. This is used from the VOCs to mark that they
97
    // got invalidated by an ActionChanged() call. An active view needs to remember
98
    // this and take action on it. Default implementation directly calls back
99
    // triggerLazyInvalidate() which promptly handles the request
100
    virtual void setLazyInvalidate(ViewObjectContact& rVOC);
101
102
    // call this to support evtl. preparations for repaint. Default does nothing
103
    virtual void PrepareProcessDisplay();
104
105
    // Process the whole displaying
106
    virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
107
108
    // test if visualizing of entered groups is switched on at all. Default
109
    // implementation returns sal_False.
110
    virtual bool DoVisualizeEnteredGroup() const;
111
112
    // get active group's (the entered group) ViewContact
113
    virtual const ViewContact* getActiveViewContact() const;
114
115
    // Invalidate given rectangle at the window/output which is represented by
116
    // this ObjectContact. Default does nothing.
117
    virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
118
119
    // Get info about the need to visualize GluePoints. The default
120
    // is that it is not necessary.
121
    virtual bool AreGluePointsVisible() const;
122
123
    // method to get the primitiveAnimator
124
188k
    sdr::animation::primitiveAnimator& getPrimitiveAnimator() {  return maPrimitiveAnimator; }
125
126
    // check if text animation is allowed. Default is sal_true.
127
    virtual bool IsTextAnimationAllowed() const;
128
129
    // check if graphic animation is allowed. Default is sal_true.
130
    virtual bool IsGraphicAnimationAllowed() const;
131
132
    // access to ViewObjectContactRedirector
133
3.27k
    ViewObjectContactRedirector* GetViewObjectContactRedirector() const {  return mpViewObjectContactRedirector; }
134
    void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew);
135
136
    // print? Default is false
137
    virtual bool isOutputToPrinter() const;
138
139
    // display page decoration? Default is true
140
    virtual bool isPageDecorationActive() const;
141
142
    // display mster page content (ViewContactOfMasterPage)? Default is true
143
    virtual bool isMasterPageActive() const;
144
145
    // recording MetaFile? Default is false
146
    virtual bool isOutputToRecordingMetaFile() const;
147
148
    // pdf export? Default is false
149
    virtual bool isOutputToPDFFile() const;
150
    virtual bool isExportTaggedPDF() const;
151
    virtual ::vcl::PDFExtOutDevData const* GetPDFExtOutDevData() const;
152
153
    // gray display mode
154
    virtual bool isDrawModeGray() const;
155
156
    // high contrast display mode
157
    virtual bool isDrawModeHighContrast() const;
158
159
    // check if this is a preview renderer. Default is sal_False.
160
0
    bool IsPreviewRenderer() const { return mbIsPreviewRenderer; }
161
162
    // get Primitive2DParameters for this view
163
9.83k
    const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
164
165
    /// access to SdrPageView. May return 0L like the default implementations do. Override as needed.
166
    virtual SdrPageView* TryToGetSdrPageView() const;
167
168
    /// access to OutputDevice. May return 0L like the default implementations do. Override as needed.
169
    virtual OutputDevice* TryToGetOutputDevice() const;
170
171
    // interface to support GridOffset for non-linear ViewToDevice transformation (calc)
172
    virtual bool supportsGridOffsets() const;
173
    virtual void calculateGridOffsetForViewObjectContact(
174
        basegfx::B2DVector& rTarget,
175
        const ViewObjectContact& rClient) const;
176
    virtual void calculateGridOffsetForB2DRange(
177
        basegfx::B2DVector& rTarget,
178
        const basegfx::B2DRange& rB2DRange) const;
179
    void resetAllGridOffsets();
180
};
181
182
}
183
184
185
#endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
186
187
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */