LibreOffice Module svx (master)  1
objectcontact.hxx
Go to the documentation of this file.
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 
25 #include <svx/svxdllapi.h>
27 
28 class SdrLayerIDSet;
29 namespace tools { class Rectangle; }
30 class SdrPageView;
31 class OutputDevice;
32 
33 namespace basegfx {
34  class B2DRange;
35  class B2DHomMatrix;
36 }
37 
38 namespace sdr { namespace contact {
39 
40 class DisplayInfo;
41 class ViewContact;
42 class ViewObjectContactRedirector;
43 
45 {
46 private:
47  // make ViewObjectContact a friend to exclusively allow it to use
48  // AddViewObjectContact/RemoveViewObjectContact
49  friend class ViewObjectContact;
50 
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;
55 
56  // A new ViewObjectContact was created and shall be remembered.
57  void AddViewObjectContact(ViewObjectContact& rVOContact);
58 
59  // A ViewObjectContact was deleted and shall be forgotten.
60  void RemoveViewObjectContact(ViewObjectContact& rVOContact);
61 
62  // the primitiveAnimator which is used if this View and/or the contained primitives
63  // support animatedSwitchPrimitives
65 
66  // The redirector. If set it is used to pipe all supported calls
67  // to the redirector
69 
70  // the Primitive2DParameters containing view information
72 
73  // flag for preview renderer
74  bool mbIsPreviewRenderer : 1;
75 
76 protected:
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]; }
80 
81  // interface to allow derivates to set PreviewRenderer flag
82  void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; }
83 
84  // interface to allow derivates to set ViewInformation2D
85  void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; }
86 
87 public:
88  // basic constructor
89  ObjectContact();
90  virtual ~ObjectContact() COVERITY_NOEXCEPT_FALSE;
91 
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);
97 
98  // call this to support evtl. preparations for repaint. Default does nothing
99  virtual void PrepareProcessDisplay();
100 
101  // Process the whole displaying
102  virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
103 
104  // test if visualizing of entered groups is switched on at all. Default
105  // implementation returns sal_False.
106  virtual bool DoVisualizeEnteredGroup() const;
107 
108  // get active group's (the entered group) ViewContact
109  virtual const ViewContact* getActiveViewContact() const;
110 
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;
114 
115  // Get info about the need to visualize GluePoints. The default
116  // is that it is not necessary.
117  virtual bool AreGluePointsVisible() const;
118 
119  // method to get the primitiveAnimator
120  sdr::animation::primitiveAnimator& getPrimitiveAnimator() { return maPrimitiveAnimator; }
121 
122  // check if text animation is allowed. Default is sal_true.
123  virtual bool IsTextAnimationAllowed() const;
124 
125  // check if graphic animation is allowed. Default is sal_true.
126  virtual bool IsGraphicAnimationAllowed() const;
127 
128  // access to ViewObjectContactRedirector
129  ViewObjectContactRedirector* GetViewObjectContactRedirector() const { return mpViewObjectContactRedirector; }
130  void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew);
131 
132  // print? Default is false
133  virtual bool isOutputToPrinter() const;
134 
135  // recording MetaFile? Default is false
136  virtual bool isOutputToRecordingMetaFile() const;
137 
138  // pdf export? Default is false
139  virtual bool isOutputToPDFFile() const;
140 
141  // gray display mode
142  virtual bool isDrawModeGray() const;
143 
144  // high contrast display mode
145  virtual bool isDrawModeHighContrast() const;
146 
147  // check if this is a preview renderer. Default is sal_False.
148  bool IsPreviewRenderer() const { return mbIsPreviewRenderer; }
149 
150  // get Primitive2DParameters for this view
151  const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
152 
154  virtual SdrPageView* TryToGetSdrPageView() const;
155 
157  virtual OutputDevice* TryToGetOutputDevice() const;
158 
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();
168 };
169 
170 }}
171 
172 
173 #endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
174 
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sdr::animation::primitiveAnimator maPrimitiveAnimator
ViewObjectContactRedirector * GetViewObjectContactRedirector() const
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
void setPreviewRenderer(bool bNew)
ViewObjectContactRedirector * mpViewObjectContactRedirector
void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D &rViewInformation2D)
const drawinglayer::geometry::ViewInformation2D & getViewInformation2D() const
ViewObjectContact * getViewObjectContact(sal_uInt32 a) const
std::vector< ViewObjectContact * > maViewObjectContactVector
sal_uInt32 getViewObjectContactCount() const
drawinglayer::geometry::ViewInformation2D maViewInformation2D