LCOV - code coverage report
Current view: top level - include/svx/sdr/contact - objectcontact.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 8 8 100.0 %
Date: 2014-11-03 Functions: 8 8 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/svxdllapi.h>
      25             : #include <drawinglayer/geometry/viewinformation2d.hxx>
      26             : 
      27             : 
      28             : // predeclarations
      29             : 
      30             : class SetOfByte;
      31             : class Rectangle;
      32             : class SdrPageView;
      33             : class OutputDevice;
      34             : 
      35             : namespace sdr { namespace contact {
      36             :     class DisplayInfo;
      37             :     class ViewContact;
      38             :     class ViewObjectContactRedirector;
      39             : }}
      40             : 
      41             : namespace sdr { namespace event {
      42             :     class TimerEventHandler;
      43             : }}
      44             : 
      45             : namespace basegfx {
      46             :     class B2DRange;
      47             :     class B2DHomMatrix;
      48             : }
      49             : 
      50             : 
      51             : 
      52             : namespace sdr
      53             : {
      54             :     namespace contact
      55             :     {
      56             :         class SVX_DLLPUBLIC ObjectContact
      57             :         {
      58             :         private:
      59             :             // make ViewObjectContact a friend to exclusively allow it to use
      60             :             // AddViewObjectContact/RemoveViewObjectContact
      61             :             friend class ViewObjectContact;
      62             : 
      63             :             // All VOCs which are created using this OC, thus remembering this OC
      64             :             // as a reference. All those VOCs need to be deleted when the OC goes down.
      65             :             // Registering and de-registering is done in the VOC constructors/destructors.
      66             :             std::vector< ViewObjectContact* >               maViewObjectContactVector;
      67             : 
      68             :             // A new ViewObjectContact was created and shall be remembered.
      69             :             void AddViewObjectContact(ViewObjectContact& rVOContact);
      70             : 
      71             :             // A ViewObjectContact was deleted and shall be forgotten.
      72             :             virtual void RemoveViewObjectContact(ViewObjectContact& rVOContact);
      73             : 
      74             :             // the primitiveAnimator which is used if this View and/or the contained primitives
      75             :             // support animatedSwitchPrimitives
      76             :             sdr::animation::primitiveAnimator               maPrimitiveAnimator;
      77             : 
      78             :             // the EventHandler for e.g. asynchronious loading of graphics
      79             :             sdr::event::TimerEventHandler*                  mpEventHandler;
      80             : 
      81             :             // The redirector. If set it is used to pipe all supported calls
      82             :             // to the redirector
      83             :             ViewObjectContactRedirector*                    mpViewObjectContactRedirector;
      84             : 
      85             :             // the Primitive2DParameters containing view information
      86             :             drawinglayer::geometry::ViewInformation2D       maViewInformation2D;
      87             : 
      88             :             // bitfield
      89             :             // flag for preview renderer
      90             :             bool                                            mbIsPreviewRenderer : 1;
      91             : 
      92             :             // method to create a EventHandler. Needs to give a result.
      93             :             sdr::event::TimerEventHandler* CreateEventHandler();
      94             : 
      95             :         protected:
      96             :             // Interface to allow derivates to travel over the registered VOC's
      97       10347 :             sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); }
      98      169828 :             ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; }
      99             : 
     100             :             // interface to allow derivates to set PreviewRenderer flag
     101        3205 :             void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; }
     102             : 
     103             :             // interface to allow derivates to set ViewInformation2D
     104       45705 :             void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; }
     105             : 
     106             :         public:
     107             :             // basic constructor
     108             :             ObjectContact();
     109             :             virtual ~ObjectContact();
     110             : 
     111             :             // LazyInvalidate request. This is used from the VOCs to mark that they
     112             :             // got invalidated by an ActionCanged() call. An active view needs to remember
     113             :             // this and take action on it. Default implementation directly calls back
     114             :             // triggerLazyInvalidate() which promptly handles the request
     115             :             virtual void setLazyInvalidate(ViewObjectContact& rVOC);
     116             : 
     117             :             // call this to support evtl. preparations for repaint. Default does nothing
     118             :             virtual void PrepareProcessDisplay();
     119             : 
     120             :             // Process the whole displaying
     121             :             virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
     122             : 
     123             :             // test if visualizing of entered groups is switched on at all. Default
     124             :             // implementation returns sal_False.
     125             :             virtual bool DoVisualizeEnteredGroup() const;
     126             : 
     127             :             // get active group's (the entered group) ViewContact
     128             :             virtual const ViewContact* getActiveViewContact() const;
     129             : 
     130             :             // Invalidate given rectangle at the window/output which is represented by
     131             :             // this ObjectContact. Default does nothing.
     132             :             virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
     133             : 
     134             :             // Get info if given Rectangle is visible in this view
     135             :             virtual bool IsAreaVisible(const basegfx::B2DRange& rRange) const;
     136             : 
     137             :             // Get info about the need to visualize GluePoints. The default
     138             :             // is that it is not necessary.
     139             :             virtual bool AreGluePointsVisible() const;
     140             : 
     141             :             // method to get the primitiveAnimator
     142       45133 :             sdr::animation::primitiveAnimator& getPrimitiveAnimator() {  return maPrimitiveAnimator; }
     143             : 
     144             :             // method to get the EventHandler. It will
     145             :             // return a existing one or create a new one using CreateEventHandler().
     146             :             sdr::event::TimerEventHandler& GetEventHandler() const;
     147             : 
     148             :             // delete the EventHandler
     149             :             void DeleteEventHandler();
     150             : 
     151             :             // test if there is an EventHandler without creating one on demand
     152             :             bool HasEventHandler() const;
     153             : 
     154             :             // check if text animation is allowed. Default is sal_true.
     155             :             virtual bool IsTextAnimationAllowed() const;
     156             : 
     157             :             // check if graphic animation is allowed. Default is sal_true.
     158             :             virtual bool IsGraphicAnimationAllowed() const;
     159             : 
     160             :             // check if asynchronious graphis loading is allowed. Default is sal_False.
     161             :             virtual bool IsAsynchronGraphicsLoadingAllowed() const;
     162             : 
     163             :             // access to ViewObjectContactRedirector
     164       44141 :             ViewObjectContactRedirector* GetViewObjectContactRedirector() const {  return mpViewObjectContactRedirector; }
     165             :             void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew);
     166             : 
     167             :             // check if buffering of MasterPages is allowed. Default is sal_False.
     168             :             virtual bool IsMasterPageBufferingAllowed() const;
     169             : 
     170             :             // print? Default is false
     171             :             virtual bool isOutputToPrinter() const;
     172             : 
     173             :             // window? Default is true
     174             :             virtual bool isOutputToWindow() const;
     175             : 
     176             :             // VirtualDevice? Default is false
     177             :             virtual bool isOutputToVirtualDevice() const;
     178             : 
     179             :             // recording MetaFile? Default is false
     180             :             virtual bool isOutputToRecordingMetaFile() const;
     181             : 
     182             :             // pdf export? Default is false
     183             :             virtual bool isOutputToPDFFile() const;
     184             : 
     185             :             // gray display mode
     186             :             virtual bool isDrawModeGray() const;
     187             : 
     188             :             // gray display mode
     189             :             virtual bool isDrawModeBlackWhite() const;
     190             : 
     191             :             // high contrast display mode
     192             :             virtual bool isDrawModeHighContrast() const;
     193             : 
     194             :             // check if this is a preview renderer. Default is sal_False.
     195        1928 :             bool IsPreviewRenderer() const { return mbIsPreviewRenderer; }
     196             : 
     197             :             // get Primitive2DParameters for this view
     198      136312 :             const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
     199             : 
     200             :             // access to SdrPageView. May return 0L like the default implementations do. Needs to be overloaded as needed.
     201             :             virtual SdrPageView* TryToGetSdrPageView() const;
     202             : 
     203             :             // access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
     204             :             virtual OutputDevice* TryToGetOutputDevice() const;
     205             : 
     206             :             // reset ViewPort at internal ViewInformation2D. This is needed when the OC is used
     207             :             // not for ProcessDisplay() but to get a VOC associated with it. When trying to get
     208             :             // a sequence of primitives from the VOC then, the last initialized ViewPort from
     209             :             // the last ProcessDisplay() is used for geometric visibility testing. If this is not
     210             :             // wanted (like in such cases) this method is used. It will reuse the current
     211             :             // ViewInformation2D, but clear the ViewPort (no ViewPort means all is visible)
     212             :             void resetViewPort();
     213             :         };
     214             :     } // end of namespace contact
     215             : } // end of namespace sdr
     216             : 
     217             : 
     218             : 
     219             : #endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
     220             : 
     221             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10