LCOV - code coverage report
Current view: top level - sd/source/ui/slidesorter/inc/model - SlsPageDescriptor.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 4 100.0 %
Date: 2015-06-13 12:38:46 Functions: 4 4 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_SD_SOURCE_UI_SLIDESORTER_INC_MODEL_SLSPAGEDESCRIPTOR_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_MODEL_SLSPAGEDESCRIPTOR_HXX
      22             : 
      23             : #include "model/SlsVisualState.hxx"
      24             : #include <com/sun/star/drawing/XDrawPage.hpp>
      25             : #include <tools/gen.hxx>
      26             : #include <vcl/bitmap.hxx>
      27             : #include <sfx2/viewfrm.hxx>
      28             : 
      29             : #include <boost/enable_shared_from_this.hpp>
      30             : 
      31             : class SdPage;
      32             : class SdrPage;
      33             : 
      34             : namespace sd { namespace slidesorter { namespace model {
      35             : 
      36             : /** Each PageDescriptor object represents the preview of one draw page,
      37             :     slide, or master page of a Draw or Impress document as they are displayed
      38             :     in the slide sorter.  This class gives access to some associated
      39             :     information like prerendered preview or position on the screen.
      40             : 
      41             :     <p>Bounding boxes of page objects come in four varieties:
      42             :     Model and screen/pixel coordinates and the bounding boxes of the actual
      43             :     page objects and the larger bounding boxes that include page names and
      44             :     fade symbol.</p>
      45             : */
      46             : class PageDescriptor
      47             :     : public ::boost::enable_shared_from_this<PageDescriptor>
      48             : {
      49             : public:
      50             :     /** Create a PageDescriptor for the given SdPage object.
      51             :         @param rxPage
      52             :             The page that is represented by the new PageDescriptor object.
      53             :         @param pPage
      54             :             The page pointer can in some situations not be detected from
      55             :             rxPage, e.g. after undo of page deletion.  Therefore supply it
      56             :             separately.
      57             :         @param nIndex
      58             :             This index is displayed in the view as page number.  It is not
      59             :             necessaryily the page index (not even when you add or subtract 1
      60             :             or use (x-1)/2 magic).
      61             :     */
      62             :     PageDescriptor (
      63             :         const css::uno::Reference<css::drawing::XDrawPage>& rxPage,
      64             :         SdPage* pPage,
      65             :         const sal_Int32 nIndex);
      66             : 
      67             :     ~PageDescriptor();
      68             : 
      69             :     /** Return the page that is represented by the descriptor as SdPage pointer .
      70             :     */
      71        3390 :     SdPage* GetPage() const { return mpPage;}
      72             : 
      73             :     /** Return the page that is represented by the descriptor as XDrawPage reference.
      74             :     */
      75         212 :     css::uno::Reference<css::drawing::XDrawPage> GetXDrawPage() const { return mxPage;}
      76             : 
      77             :     /** Returns the index of the page as it is displayed in the view as page
      78             :         number.  The value may differ from the index returned by the
      79             :         XDrawPage when there are hidden slides and the XIndexAccess used to
      80             :         access the model filters them out.
      81             :     */
      82         591 :     sal_Int32 GetPageIndex() const { return mnIndex;}
      83             :     void SetPageIndex (const sal_Int32 nIndex);
      84             : 
      85             :     bool UpdateMasterPage();
      86             :     bool UpdateTransitionFlag();
      87             : 
      88             :     enum State { ST_Visible, ST_Selected, ST_WasSelected,
      89             :                  ST_Focused, ST_MouseOver, ST_Current, ST_Excluded };
      90             : 
      91             :     bool HasState (const State eState) const;
      92             : 
      93             :     bool SetState (const State eState, const bool bStateValue);
      94             : 
      95             :     /** Set the internal mbIsSelected flag to the selection state of the
      96             :         page.  Use this method to synchronize a page descriptor with the
      97             :         page it describes and determine whether a redraw to update the
      98             :         selection indicator is necessary.
      99             :         @return
     100             :             When the two selection states were different <TRUE/> is
     101             :             returned.  When they were the same this method returns
     102             :             <FALSE/>.
     103             :     */
     104             :     bool GetCoreSelection();
     105             : 
     106             :     /** Set the selection flags of the SdPage objects to the corresponding
     107             :         selection states of the page descriptors.
     108             :     */
     109             :     void SetCoreSelection();
     110             : 
     111         136 :     VisualState& GetVisualState() { return maVisualState;}
     112             : 
     113             :     Rectangle GetBoundingBox() const;
     114             :     Point GetLocation (const bool bIgnoreLocation = false) const;
     115             :     void SetBoundingBox (const Rectangle& rBoundingBox);
     116             : 
     117             : private:
     118             :     SdPage* mpPage;
     119             :     css::uno::Reference<css::drawing::XDrawPage> mxPage;
     120             :     SdrPage const* mpMasterPage;
     121             : 
     122             :     /** This index is displayed as page number in the view.  It may or may
     123             :         not be the actual page index.
     124             :     */
     125             :     sal_Int32 mnIndex;
     126             : 
     127             :     Rectangle maBoundingBox;
     128             :     VisualState maVisualState;
     129             : 
     130             :     bool mbIsSelected : 1;
     131             :     bool mbWasSelected : 1;
     132             :     bool mbIsVisible : 1;
     133             :     bool mbIsFocused : 1;
     134             :     bool mbIsCurrent : 1;
     135             :     bool mbIsMouseOver : 1;
     136             :     bool mbHasTransition : 1;
     137             : 
     138             :     PageDescriptor (const PageDescriptor& rDescriptor) SAL_DELETED_FUNCTION;
     139             : 
     140             :     PageDescriptor& operator= (const PageDescriptor& rDescriptor) SAL_DELETED_FUNCTION;
     141             : };
     142             : 
     143             : } } } // end of namespace ::sd::slidesorter::model
     144             : 
     145             : #endif
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11