1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
21 #define INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
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>
29 namespace tools
{ class Rectangle
; }
34 class PDFExtOutDevData
;
42 namespace sdr::contact
{
46 class ViewObjectContactRedirector
;
48 class SVXCORE_DLLPUBLIC ObjectContact
51 // make ViewObjectContact a friend to exclusively allow it to use
52 // AddViewObjectContact/RemoveViewObjectContact
53 friend class ViewObjectContact
;
55 // All VOCs which are created using this OC, thus remembering this OC
56 // as a reference. All those VOCs need to be deleted when the OC goes down.
57 // Registering and de-registering is done in the VOC constructors/destructors.
58 std::vector
< ViewObjectContact
* > maViewObjectContactVector
;
60 // A new ViewObjectContact was created and shall be remembered.
61 void AddViewObjectContact(ViewObjectContact
& rVOContact
);
63 // A ViewObjectContact was deleted and shall be forgotten.
64 void RemoveViewObjectContact(ViewObjectContact
& rVOContact
);
66 // the primitiveAnimator which is used if this View and/or the contained primitives
67 // support animatedSwitchPrimitives
68 sdr::animation::primitiveAnimator maPrimitiveAnimator
;
70 // The redirector. If set it is used to pipe all supported calls
72 ViewObjectContactRedirector
* mpViewObjectContactRedirector
;
74 // the Primitive2DParameters containing view information
75 drawinglayer::geometry::ViewInformation2D maViewInformation2D
;
77 // flag for preview renderer
78 bool mbIsPreviewRenderer
: 1;
81 // Interface to allow derivates to travel over the registered VOC's
82 sal_uInt32
getViewObjectContactCount() const { return maViewObjectContactVector
.size(); }
83 ViewObjectContact
* getViewObjectContact(sal_uInt32 a
) const { return maViewObjectContactVector
[a
]; }
85 // interface to allow derivates to set PreviewRenderer flag
86 void setPreviewRenderer(bool bNew
) { mbIsPreviewRenderer
= bNew
; }
88 // interface to allow derivates to set ViewInformation2D
89 void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D
& rViewInformation2D
) { maViewInformation2D
= rViewInformation2D
; }
94 virtual ~ObjectContact() COVERITY_NOEXCEPT_FALSE
;
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
);
102 // call this to support evtl. preparations for repaint. Default does nothing
103 virtual void PrepareProcessDisplay();
105 // Process the whole displaying
106 virtual void ProcessDisplay(DisplayInfo
& rDisplayInfo
);
108 // test if visualizing of entered groups is switched on at all. Default
109 // implementation returns sal_False.
110 virtual bool DoVisualizeEnteredGroup() const;
112 // get active group's (the entered group) ViewContact
113 virtual const ViewContact
* getActiveViewContact() const;
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;
119 // Get info about the need to visualize GluePoints. The default
120 // is that it is not necessary.
121 virtual bool AreGluePointsVisible() const;
123 // method to get the primitiveAnimator
124 sdr::animation::primitiveAnimator
& getPrimitiveAnimator() { return maPrimitiveAnimator
; }
126 // check if text animation is allowed. Default is sal_true.
127 virtual bool IsTextAnimationAllowed() const;
129 // check if graphic animation is allowed. Default is sal_true.
130 virtual bool IsGraphicAnimationAllowed() const;
132 // access to ViewObjectContactRedirector
133 ViewObjectContactRedirector
* GetViewObjectContactRedirector() const { return mpViewObjectContactRedirector
; }
134 void SetViewObjectContactRedirector(ViewObjectContactRedirector
* pNew
);
136 // print? Default is false
137 virtual bool isOutputToPrinter() const;
139 // display page decoration? Default is true
140 virtual bool isPageDecorationActive() const;
142 // display mster page content (ViewContactOfMasterPage)? Default is true
143 virtual bool isMasterPageActive() const;
145 // recording MetaFile? Default is false
146 virtual bool isOutputToRecordingMetaFile() const;
148 // pdf export? Default is false
149 virtual bool isOutputToPDFFile() const;
150 virtual bool isExportTaggedPDF() const;
151 virtual ::vcl::PDFExtOutDevData
const* GetPDFExtOutDevData() const;
154 virtual bool isDrawModeGray() const;
156 // high contrast display mode
157 virtual bool isDrawModeHighContrast() const;
159 // check if this is a preview renderer. Default is sal_False.
160 bool IsPreviewRenderer() const { return mbIsPreviewRenderer
; }
162 // get Primitive2DParameters for this view
163 const drawinglayer::geometry::ViewInformation2D
& getViewInformation2D() const { return maViewInformation2D
; }
165 /// access to SdrPageView. May return 0L like the default implementations do. Override as needed.
166 virtual SdrPageView
* TryToGetSdrPageView() const;
168 /// access to OutputDevice. May return 0L like the default implementations do. Override as needed.
169 virtual OutputDevice
* TryToGetOutputDevice() const;
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();
185 #endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */