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 #pragma once
21 
22 #include "ViewShell.hxx"
23 #include <svx/svdview.hxx>
24 #include <pres.hxx>
25 
26 class SdDrawDocument;
27 class SdOptions;
28 
29 namespace sd {
30 
31 /**
32  * View for MDIFrame
33  */
34 class SD_DLLPUBLIC FrameView
35     : public SdrView
36 {
37 public:
38     FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView = nullptr );
39     FrameView(const FrameView& rFrameView);
40     virtual ~FrameView() override;
41 
42     void Connect();
43     void Disconnect();
44 
45     void Update(SdOptions const * pOptions);
46 
SetStandardHelpLines(const SdrHelpLineList & rHelpLines)47     void  SetStandardHelpLines(const SdrHelpLineList& rHelpLines)
48                              { maStandardHelpLines = rHelpLines; }
GetStandardHelpLines() const49     const SdrHelpLineList& GetStandardHelpLines() const { return maStandardHelpLines; }
SetNotesHelpLines(const SdrHelpLineList & rHelpLines)50     void  SetNotesHelpLines(const SdrHelpLineList& rHelpLines)
51                              { maNotesHelpLines = rHelpLines; }
GetNotesHelpLines() const52     const SdrHelpLineList& GetNotesHelpLines() const { return maNotesHelpLines; }
SetHandoutHelpLines(const SdrHelpLineList & rHelpLines)53     void  SetHandoutHelpLines(const SdrHelpLineList& rHelpLines)
54                              { maHandoutHelpLines = rHelpLines; }
GetHandoutHelpLines() const55     const SdrHelpLineList& GetHandoutHelpLines() const { return maHandoutHelpLines; }
56 
SetVisibleLayers(const SdrLayerIDSet & rVisibleLayers)57     void SetVisibleLayers(const SdrLayerIDSet& rVisibleLayers)
58                          { maVisibleLayers = rVisibleLayers; }
GetVisibleLayers() const59     const SdrLayerIDSet& GetVisibleLayers() const { return maVisibleLayers; }
60 
SetLockedLayers(const SdrLayerIDSet & rLockedLayers)61     void SetLockedLayers(const SdrLayerIDSet& rLockedLayers)
62                         { maLockedLayers = rLockedLayers; }
GetLockedLayers() const63     const SdrLayerIDSet& GetLockedLayers() const { return maLockedLayers; }
64 
SetPrintableLayers(const SdrLayerIDSet & rPrintableLayers)65     void SetPrintableLayers(const SdrLayerIDSet& rPrintableLayers)
66                          { maPrintableLayers = rPrintableLayers; }
GetPrintableLayers() const67     const SdrLayerIDSet& GetPrintableLayers() const { return maPrintableLayers; }
68 
SetRuler(const bool bRulerOn)69     void SetRuler(const bool bRulerOn)
70                  { mbRuler = bRulerOn; }
HasRuler() const71     bool HasRuler() const { return mbRuler; }
72 
SetNoColors(const bool bNoCol)73     void SetNoColors(const bool bNoCol)
74                  { mbNoColors = bNoCol; }
IsNoColors() const75     bool IsNoColors() const { return mbNoColors; }
76 
SetNoAttribs(const bool bNoAttr)77     void SetNoAttribs(const bool bNoAttr)
78                  { mbNoAttribs = bNoAttr; }
IsNoAttribs() const79     bool IsNoAttribs() const { return mbNoAttribs; }
80 
SetVisArea(const::tools::Rectangle & rVisArea)81     void SetVisArea(const ::tools::Rectangle& rVisArea)
82                  { maVisArea = rVisArea; }
GetVisArea() const83     const ::tools::Rectangle& GetVisArea() const { return maVisArea; }
84 
SetPageKind(PageKind eKind)85     void SetPageKind(PageKind eKind) { mePageKind = eKind; }
GetPageKind() const86     PageKind GetPageKind() const { return mePageKind; }
87 
88     /** is used in FrameView::ReadUserDataSequence() only to store the
89         page kind that was selected while last saving this document */
SetPageKindOnLoad(PageKind eKind)90     void SetPageKindOnLoad(PageKind eKind) { mePageKindOnLoad = eKind; }
91 
92     /** can be used to get the page kind that was selected on last save of this document */
GetPageKindOnLoad() const93     PageKind GetPageKindOnLoad() const { return mePageKindOnLoad; }
94 
95     void SetSelectedPage (sal_uInt16 nPage);
GetSelectedPage() const96     sal_uInt16 GetSelectedPage () const { return mnSelectedPage;}
97 
98     /** is used in FrameView::ReadUserDataSequence() only to store the
99         page that was selected while last saving this document */
SetSelectedPageOnLoad(sal_uInt16 nPage)100     void SetSelectedPageOnLoad (sal_uInt16 nPage) { mnSelectedPageOnLoad = nPage; }
101 
102     /** can be used to get the page that was selected on last save of this document */
GetSelectedPageOnLoad() const103     sal_uInt16 GetSelectedPageOnLoad () const { return mnSelectedPageOnLoad; }
104 
105     void SetViewShEditMode(EditMode eMode);
106     EditMode GetViewShEditMode () const;
107 
108     /** Remember the edit mode of the main view shell at the time when the
109         document is loaded.
110     */
111     void SetViewShEditModeOnLoad (const EditMode eMode);
112 
113     /** Return the value of the edit mode as it was when the document was
114         loaded.
115     */
GetViewShEditModeOnLoad() const116     EditMode GetViewShEditModeOnLoad() const { return meEditModeOnLoad;}
117 
SetLayerMode(bool bMode)118     void SetLayerMode(bool bMode)
119                  { mbLayerMode = bMode; }
IsLayerMode() const120     bool IsLayerMode() const { return mbLayerMode; }
121 
SetQuickEdit(bool bQEdit)122     void SetQuickEdit(bool bQEdit)
123                  { mbQuickEdit = bQEdit; }
IsQuickEdit() const124     bool IsQuickEdit() const { return mbQuickEdit; }
125 
SetDoubleClickTextEdit(bool bOn)126     void        SetDoubleClickTextEdit( bool bOn ) { mbDoubleClickTextEdit = bOn; }
IsDoubleClickTextEdit() const127     bool    IsDoubleClickTextEdit() const { return mbDoubleClickTextEdit; }
128 
SetClickChangeRotation(bool bOn)129     void        SetClickChangeRotation( bool bOn ) { mbClickChangeRotation = bOn; }
IsClickChangeRotation() const130     bool    IsClickChangeRotation() const { return mbClickChangeRotation; }
131 
132     /** Remember the type of the view shell that was (or soon will be)
133         previously associated with this frame view.
134         @param eType
135             The type of the previous view shell or ViewShell::ST_NONE to
136             indicate that there is no previous view shell.
137     */
138     void SetPreviousViewShellType (ViewShell::ShellType eType);
139 
140     /** Return the type of the view shell previously associated with this
141         frame view.
142     */
GetPreviousViewShellType() const143     ViewShell::ShellType GetPreviousViewShellType() const { return mePreviousViewShellType;}
144 
145     /** Remember the type of the view shell at the time when the document is
146         loaded or, rather, when the ViewShellBase is constructed.
147     */
148     void SetViewShellTypeOnLoad (ViewShell::ShellType eType);
149 
GetViewShellTypeOnLoad() const150     ViewShell::ShellType GetViewShellTypeOnLoad() const { return meViewShellTypeOnLoad;}
151 
SetPresentationViewShellId(sal_uInt16 nId)152     void SetPresentationViewShellId(sal_uInt16 nId)
153                  { mnPresViewShellId = nId; }
GetPresentationViewShellId() const154     sal_uInt16 GetPresentationViewShellId() const { return mnPresViewShellId; }
155 
SetSlidesPerRow(sal_uInt16 nSlides)156     void SetSlidesPerRow(sal_uInt16 nSlides) { mnSlidesPerRow = nSlides; }
GetSlidesPerRow() const157     sal_uInt16 GetSlidesPerRow() const { return mnSlidesPerRow; }
158 
SetDrawMode(DrawModeFlags nNewDrawMode)159     void SetDrawMode(DrawModeFlags nNewDrawMode) { mnDrawMode = nNewDrawMode; };
GetDrawMode() const160     DrawModeFlags GetDrawMode() const { return mnDrawMode; };
161 
162     void SetIsNavigatorShowingAllShapes (const bool bIsNavigatorShowingAllShapes);
IsNavigatorShowingAllShapes() const163     bool IsNavigatorShowingAllShapes() const { return mbIsNavigatorShowingAllShapes;}
164 
165     void    WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& );
166     void    ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& );
167 
168 private:
169     sal_uInt16          mnRefCount;
170     bool                mbRuler;
171     SdrLayerIDSet           maVisibleLayers;
172     SdrLayerIDSet           maLockedLayers;
173     SdrLayerIDSet           maPrintableLayers;
174     SdrHelpLineList     maStandardHelpLines;
175     SdrHelpLineList     maNotesHelpLines;
176     SdrHelpLineList     maHandoutHelpLines;
177     bool                mbNoColors;        ///< structuring mode
178     bool                mbNoAttribs;       ///< structuring mode
179     ::tools::Rectangle           maVisArea;         ///< visible area
180     PageKind            mePageKind;        ///< kind of page (standard, notes, handout)
181     sal_uInt16          mnSelectedPage;
182     PageKind            mePageKindOnLoad;
183     sal_uInt16          mnSelectedPageOnLoad;
184     EditMode            mePageEditMode; ///< edit mode in drawing mode (Page/MasterPage)
185     // EditMode            meStandardEditMode; ///< edit mode in drawing mode (Page/MasterPage)
186     // EditMode            meNotesEditMode;    ///< edit mode in notes mode (Page/MasterPage)
187     // EditMode            meHandoutEditMode;  ///< edit mode in handout mode (Page/MasterPage)
188     EditMode            meEditModeOnLoad;
189     bool                mbLayerMode;        ///< layer on/off
190     bool                mbQuickEdit;        ///< QuickEdit on/off
191     bool                mbDoubleClickTextEdit; ///< text mode after double click
192     bool                mbClickChangeRotation; ///< single click switches between selection/rotation mode
193     sal_uInt16          mnPresViewShellId;  ///< ViewShell from which the presentation was started
194     sal_uInt16          mnSlidesPerRow;     ///< slides per row on the slide-desk
195     DrawModeFlags       mnDrawMode;         ///< draw mode for the normal window
196     /** Remember whether the navigator shows all shapes (<TRUE/>) or only
197         the names ones (<FALSE/>).  Not persistent.
198     */
199     bool            mbIsNavigatorShowingAllShapes;
200 
201     /** The type of the previous view shell.  The (default) value
202         ViewShell::ST_NONE indicates that there was no previous view shell.
203         Note that this value is used only temporarily and is not saved or
204         restored.
205     */
206     ViewShell::ShellType mePreviousViewShellType;
207 
208     ViewShell::ShellType meViewShellTypeOnLoad;
209 };
210 
211 } // end of namespace sd
212 
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
214