bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / slidesorter / inc / model / SlsPageDescriptor.hxx
blob412971e995c6d3a08808de30338b9136775c16e8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SD_SOURCE_UI_SLIDESORTER_INC_MODEL_SLSPAGEDESCRIPTOR_HXX
21 #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_MODEL_SLSPAGEDESCRIPTOR_HXX
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>
29 #include <boost/enable_shared_from_this.hpp>
31 class SdPage;
32 class SdrPage;
34 namespace sd { namespace slidesorter { namespace model {
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.
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>
46 class PageDescriptor
47 : public ::boost::enable_shared_from_this<PageDescriptor>
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).
62 PageDescriptor (
63 const css::uno::Reference<css::drawing::XDrawPage>& rxPage,
64 SdPage* pPage,
65 const sal_Int32 nIndex);
67 ~PageDescriptor();
69 /** Return the page that is represented by the descriptor as SdPage pointer .
71 SdPage* GetPage() const { return mpPage;}
73 /** Return the page that is represented by the descriptor as XDrawPage reference.
75 css::uno::Reference<css::drawing::XDrawPage> GetXDrawPage() const { return mxPage;}
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.
82 sal_Int32 GetPageIndex() const { return mnIndex;}
83 void SetPageIndex (const sal_Int32 nIndex);
85 bool UpdateMasterPage();
86 bool UpdateTransitionFlag();
88 enum State { ST_Visible, ST_Selected, ST_WasSelected,
89 ST_Focused, ST_MouseOver, ST_Current, ST_Excluded };
91 bool HasState (const State eState) const;
93 bool SetState (const State eState, const bool bStateValue);
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/>.
104 bool GetCoreSelection();
106 /** Set the selection flags of the SdPage objects to the corresponding
107 selection states of the page descriptors.
109 void SetCoreSelection();
111 VisualState& GetVisualState() { return maVisualState;}
113 Rectangle GetBoundingBox() const;
114 Point GetLocation (const bool bIgnoreLocation = false) const;
115 void SetBoundingBox (const Rectangle& rBoundingBox);
117 private:
118 SdPage* mpPage;
119 css::uno::Reference<css::drawing::XDrawPage> mxPage;
120 SdrPage const* mpMasterPage;
122 /** This index is displayed as page number in the view. It may or may
123 not be the actual page index.
125 sal_Int32 mnIndex;
127 Rectangle maBoundingBox;
128 VisualState maVisualState;
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;
138 PageDescriptor (const PageDescriptor& rDescriptor) SAL_DELETED_FUNCTION;
140 PageDescriptor& operator= (const PageDescriptor& rDescriptor) SAL_DELETED_FUNCTION;
143 } } } // end of namespace ::sd::slidesorter::model
145 #endif
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */