LCOV - code coverage report
Current view: top level - sd/source/ui/slidesorter/inc/view - SlideSorterView.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 2 50.0 %
Date: 2015-06-13 12:38:46 Functions: 1 2 50.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_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLIDESORTERVIEW_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLIDESORTERVIEW_HXX
      22             : 
      23             : #include "SlideSorter.hxx"
      24             : #include "model/SlsPageDescriptor.hxx"
      25             : #include "model/SlsSharedPageDescriptor.hxx"
      26             : #include "view/SlsLayouter.hxx"
      27             : #include "view/SlsILayerPainter.hxx"
      28             : 
      29             : #include "View.hxx"
      30             : #include <sfx2/viewfrm.hxx>
      31             : #include "pres.hxx"
      32             : #include <tools/gen.hxx>
      33             : #include <svx/svdmodel.hxx>
      34             : #include <vcl/region.hxx>
      35             : #include <vcl/outdev.hxx>
      36             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      37             : #include <memory>
      38             : #include <boost/shared_ptr.hpp>
      39             : #include <boost/noncopyable.hpp>
      40             : 
      41             : class Point;
      42             : 
      43             : namespace sd { namespace slidesorter { namespace controller {
      44             : class Properties;
      45             : } } }
      46             : 
      47             : namespace sd { namespace slidesorter { namespace cache {
      48             : class PageCache;
      49             : } } }
      50             : 
      51             : namespace sd { namespace slidesorter { namespace model {
      52             : class SlideSorterModel;
      53             : } } }
      54             : 
      55             : namespace sd { namespace slidesorter { namespace view {
      56             : 
      57             : class LayeredDevice;
      58             : class Layouter;
      59             : class PageObjectPainter;
      60             : class SelectionPainter;
      61             : class ToolTip;
      62             : 
      63             : class SlideSorterView
      64             :     : public sd::View,
      65             :       public ::boost::noncopyable
      66             : {
      67             : public:
      68             :     TYPEINFO_OVERRIDE();
      69             : 
      70             :     /** Create a new view for the slide sorter.
      71             :         @param rViewShell
      72             :             This reference is simply passed to the base class and not used
      73             :             by this class.
      74             : 
      75             :     */
      76             :     SlideSorterView (SlideSorter& rSlideSorter);
      77             :     void Init();
      78             : 
      79             :     virtual ~SlideSorterView();
      80             :     void Dispose();
      81             : 
      82             :     /** Set the general way of layouting the page objects.  Note that this
      83             :         method does not trigger any repaints or layouts.
      84             :     */
      85             :     bool SetOrientation (const Layouter::Orientation eOrientation);
      86         617 :     Layouter::Orientation GetOrientation() const { return meOrientation;}
      87             : 
      88             :     void RequestRepaint();
      89             :     void RequestRepaint (const model::SharedPageDescriptor& rDescriptor);
      90             :     void RequestRepaint (const Rectangle& rRepaintBox);
      91             :     void RequestRepaint (const vcl::Region& rRepaintRegion);
      92             : 
      93             :     Rectangle GetModelArea();
      94             : 
      95             :     /** Return the index of the page that is rendered at the given position.
      96             :         @param rPosition
      97             :             The position is expected to be in pixel coordinates.
      98             :         @return
      99             :             The returned index is -1 when there is no page object at the
     100             :             given position.
     101             :     */
     102             :     sal_Int32 GetPageIndexAtPoint (const Point& rPosition) const;
     103             : 
     104             :     view::Layouter& GetLayouter();
     105             : 
     106             :     virtual void ModelHasChanged() SAL_OVERRIDE;
     107             : 
     108             :     /** This method is typically called before a model change takes place.
     109             :         All references to model data are released.  PostModelChange() has to
     110             :         be called to complete the handling of the model change.  When the
     111             :         calls to Pre- and PostModelChange() are very close to each other you
     112             :         may call HandleModelChange() instead.
     113             :     */
     114             :     void PreModelChange();
     115             : 
     116             :     /** This method is typically called after a model change took place.
     117             :         References to model data are re-allocated.  Call this method only
     118             :         after PreModelChange() has been called.
     119             :     */
     120             :     void PostModelChange();
     121             : 
     122             :     /** This method is a convenience function that simply calls
     123             :         PreModelChange() and then PostModelChange().
     124             :     */
     125             :     void HandleModelChange();
     126             : 
     127             :     void HandleDrawModeChange();
     128             : 
     129             :     void Resize();
     130             :     virtual void CompleteRedraw (
     131             :         OutputDevice* pDevice,
     132             :         const vcl::Region& rPaintArea,
     133             :         sdr::contact::ViewObjectContactRedirector* pRedirector = NULL) SAL_OVERRIDE;
     134             :     void Paint (OutputDevice& rDevice, const Rectangle& rRepaintArea);
     135             : 
     136             :     virtual void ConfigurationChanged (
     137             :         utl::ConfigurationBroadcaster* pBroadcaster,
     138             :         sal_uInt32 nHint) SAL_OVERRIDE;
     139             : 
     140             :     void HandleDataChangeEvent();
     141             : 
     142             :     void Layout();
     143             :     /** This tells the view that it has to re-determine the visibility of
     144             :         the page objects before painting them the next time.
     145             :     */
     146             :     void InvalidatePageObjectVisibilities();
     147             : 
     148             :     /** Return the window to which this view renders its output.
     149             :     */
     150             :     //    ::boost::shared_ptr<sd::Window> GetWindow() const;
     151             : 
     152             :     ::boost::shared_ptr<cache::PageCache> GetPreviewCache();
     153             : 
     154             :     /** Set the bounding box of the insertion marker in model coordinates.
     155             : 
     156             :         It will be painted as a dark rectangle that fills the given box.
     157             :     */
     158             :     void SetInsertionMarker (const Rectangle& rBBox);
     159             : 
     160             :     /** Specify whether the insertion marker will be painted or not.
     161             :     */
     162             :     void SetInsertionMarkerVisibility (bool bVisible);
     163             : 
     164             :     /** Set the size and position of the selection rectangle.
     165             : 
     166             :         It will be painted as a dashed rectangle.
     167             :     */
     168             :     void SetSelectionRectangle (const Rectangle& rBox);
     169             : 
     170             :     /** Specify whether the selection rectangle will be painted or not.
     171             :     */
     172             :     void SetSelectionRectangleVisibility (bool bVisible);
     173             : 
     174             :     /** Return the range of currently visible page objects including the
     175             :         first and last one in that range.
     176             :         @return
     177             :             The returned pair of page object indices is empty when the
     178             :             second index is lower than the first.
     179             :     */
     180             :     Pair GetVisiblePageRange();
     181             : 
     182             :     /** Add a shape to the page.  Typically used from inside
     183             :         PostModelChange().
     184             :     */
     185             :     //    void AddSdrObject (SdrObject& rObject);
     186             : 
     187             :     /** Add a listener that is called when the set of visible slides.
     188             :         @param rListener
     189             :             When this method is called multiple times for the same listener
     190             :             the second and all following calls are ignored.  Each listener
     191             :             is added only once.
     192             :     */
     193             :     void AddVisibilityChangeListener (const Link<>& rListener);
     194             : 
     195             :     /** Remove a listener that is called when the set of visible slides changes.
     196             :         @param rListener
     197             :             It is save to pass a listener that was not added or has been
     198             :             removed previously.  Such calls are ignored.
     199             :     */
     200             :     void RemoveVisibilityChangeListener (const Link<>& rListener);
     201             : 
     202             :     /** The page under the mouse is not highlighted in some contexts.  Call
     203             :         this method on context changes.
     204             :     */
     205             :     void UpdatePageUnderMouse ();
     206             :     void UpdatePageUnderMouse (const Point& rMousePosition);
     207             :     void SetPageUnderMouse (const model::SharedPageDescriptor& rpDescriptor);
     208             : 
     209             :     bool SetState (
     210             :         const model::SharedPageDescriptor& rpDescriptor,
     211             :         const model::PageDescriptor::State eState,
     212             :         const bool bStateValue);
     213             : 
     214             :     void UpdateOrientation();
     215             : 
     216             :     ::boost::shared_ptr<PageObjectPainter> GetPageObjectPainter();
     217           0 :     ::boost::shared_ptr<LayeredDevice> GetLayeredDevice() const { return mpLayeredDevice;}
     218             : 
     219             :     class DrawLock
     220             :     {
     221             :     public:
     222             :         DrawLock (SlideSorter& rSlideSorter);
     223             :         ~DrawLock();
     224             :         /** When the DrawLock is disposed then it will not request a repaint
     225             :             on destruction.
     226             :         */
     227             :         void Dispose();
     228             :     private:
     229             :         view::SlideSorterView& mrView;
     230             :         VclPtr<sd::Window> mpWindow;
     231             :     };
     232             : 
     233             :     ToolTip& GetToolTip() const;
     234             : 
     235             :     virtual void DragFinished (sal_Int8 nDropAction) SAL_OVERRIDE;
     236             : 
     237             : protected:
     238             :     virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint) SAL_OVERRIDE;
     239             : 
     240             : private:
     241             :     SlideSorter& mrSlideSorter;
     242             :     model::SlideSorterModel& mrModel;
     243             :     bool mbIsDisposed;
     244             :     ::std::unique_ptr<Layouter> mpLayouter;
     245             :     bool mbPageObjectVisibilitiesValid;
     246             :     ::boost::shared_ptr<cache::PageCache> mpPreviewCache;
     247             :     ::boost::shared_ptr<LayeredDevice> mpLayeredDevice;
     248             :     Range maVisiblePageRange;
     249             :     bool mbModelChangedWhileModifyEnabled;
     250             :     Size maPreviewSize;
     251             :     bool mbPreciousFlagUpdatePending;
     252             :     Layouter::Orientation meOrientation;
     253             :     ::boost::shared_ptr<controller::Properties> mpProperties;
     254             :     model::SharedPageDescriptor mpPageUnderMouse;
     255             :     sal_Int32 mnButtonUnderMouse;
     256             :     ::boost::shared_ptr<PageObjectPainter> mpPageObjectPainter;
     257             :     ::boost::shared_ptr<SelectionPainter> mpSelectionPainter;
     258             :     vcl::Region maRedrawRegion;
     259             :     SharedILayerPainter mpBackgroundPainter;
     260             :     ::boost::scoped_ptr<ToolTip> mpToolTip;
     261             :     bool mbIsRearrangePending;
     262             :     ::std::vector<Link<>> maVisibilityChangeListeners;
     263             : 
     264             :     /** Determine the visibility of all page objects.
     265             :     */
     266             :     void DeterminePageObjectVisibilities();
     267             : 
     268             :     void UpdatePreciousFlags();
     269             :     void RequestRearrange();
     270             :     void Rearrange();
     271             : };
     272             : 
     273             : } } } // end of namespace ::sd::slidesorter::view
     274             : 
     275             : #endif
     276             : 
     277             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11