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
; }
38 namespace sdr
{ namespace contact
{
42 class ViewObjectContactRedirector
;
44 class SVX_DLLPUBLIC ObjectContact
47 // make ViewObjectContact a friend to exclusively allow it to use
48 // AddViewObjectContact/RemoveViewObjectContact
49 friend class ViewObjectContact
;
51 // All VOCs which are created using this OC, thus remembering this OC
52 // as a reference. All those VOCs need to be deleted when the OC goes down.
53 // Registering and de-registering is done in the VOC constructors/destructors.
54 std::vector
< ViewObjectContact
* > maViewObjectContactVector
;
56 // A new ViewObjectContact was created and shall be remembered.
57 void AddViewObjectContact(ViewObjectContact
& rVOContact
);
59 // A ViewObjectContact was deleted and shall be forgotten.
60 void RemoveViewObjectContact(ViewObjectContact
& rVOContact
);
62 // the primitiveAnimator which is used if this View and/or the contained primitives
63 // support animatedSwitchPrimitives
64 sdr::animation::primitiveAnimator maPrimitiveAnimator
;
66 // The redirector. If set it is used to pipe all supported calls
68 ViewObjectContactRedirector
* mpViewObjectContactRedirector
;
70 // the Primitive2DParameters containing view information
71 drawinglayer::geometry::ViewInformation2D maViewInformation2D
;
73 // flag for preview renderer
74 bool mbIsPreviewRenderer
: 1;
77 // Interface to allow derivates to travel over the registered VOC's
78 sal_uInt32
getViewObjectContactCount() const { return maViewObjectContactVector
.size(); }
79 ViewObjectContact
* getViewObjectContact(sal_uInt32 a
) const { return maViewObjectContactVector
[a
]; }
81 // interface to allow derivates to set PreviewRenderer flag
82 void setPreviewRenderer(bool bNew
) { mbIsPreviewRenderer
= bNew
; }
84 // interface to allow derivates to set ViewInformation2D
85 void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D
& rViewInformation2D
) { maViewInformation2D
= rViewInformation2D
; }
90 virtual ~ObjectContact() COVERITY_NOEXCEPT_FALSE
;
92 // LazyInvalidate request. This is used from the VOCs to mark that they
93 // got invalidated by an ActionChanged() call. An active view needs to remember
94 // this and take action on it. Default implementation directly calls back
95 // triggerLazyInvalidate() which promptly handles the request
96 virtual void setLazyInvalidate(ViewObjectContact
& rVOC
);
98 // call this to support evtl. preparations for repaint. Default does nothing
99 virtual void PrepareProcessDisplay();
101 // Process the whole displaying
102 virtual void ProcessDisplay(DisplayInfo
& rDisplayInfo
);
104 // test if visualizing of entered groups is switched on at all. Default
105 // implementation returns sal_False.
106 virtual bool DoVisualizeEnteredGroup() const;
108 // get active group's (the entered group) ViewContact
109 virtual const ViewContact
* getActiveViewContact() const;
111 // Invalidate given rectangle at the window/output which is represented by
112 // this ObjectContact. Default does nothing.
113 virtual void InvalidatePartOfView(const basegfx::B2DRange
& rRange
) const;
115 // Get info about the need to visualize GluePoints. The default
116 // is that it is not necessary.
117 virtual bool AreGluePointsVisible() const;
119 // method to get the primitiveAnimator
120 sdr::animation::primitiveAnimator
& getPrimitiveAnimator() { return maPrimitiveAnimator
; }
122 // check if text animation is allowed. Default is sal_true.
123 virtual bool IsTextAnimationAllowed() const;
125 // check if graphic animation is allowed. Default is sal_true.
126 virtual bool IsGraphicAnimationAllowed() const;
128 // access to ViewObjectContactRedirector
129 ViewObjectContactRedirector
* GetViewObjectContactRedirector() const { return mpViewObjectContactRedirector
; }
130 void SetViewObjectContactRedirector(ViewObjectContactRedirector
* pNew
);
132 // print? Default is false
133 virtual bool isOutputToPrinter() const;
135 // recording MetaFile? Default is false
136 virtual bool isOutputToRecordingMetaFile() const;
138 // pdf export? Default is false
139 virtual bool isOutputToPDFFile() const;
142 virtual bool isDrawModeGray() const;
144 // high contrast display mode
145 virtual bool isDrawModeHighContrast() const;
147 // check if this is a preview renderer. Default is sal_False.
148 bool IsPreviewRenderer() const { return mbIsPreviewRenderer
; }
150 // get Primitive2DParameters for this view
151 const drawinglayer::geometry::ViewInformation2D
& getViewInformation2D() const { return maViewInformation2D
; }
153 /// access to SdrPageView. May return 0L like the default implementations do. Override as needed.
154 virtual SdrPageView
* TryToGetSdrPageView() const;
156 /// access to OutputDevice. May return 0L like the default implementations do. Override as needed.
157 virtual OutputDevice
* TryToGetOutputDevice() const;
159 // interface to support GridOffset for non-linear ViewToDevice transformation (calc)
160 virtual bool supportsGridOffsets() const;
161 virtual void calculateGridOffsetForViewOjectContact(
162 basegfx::B2DVector
& rTarget
,
163 const ViewObjectContact
& rClient
) const;
164 virtual void calculateGridOffsetForB2DRange(
165 basegfx::B2DVector
& rTarget
,
166 const basegfx::B2DRange
& rB2DRange
) const;
167 void resetAllGridOffsets();
173 #endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */