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_INC_OUTLINEVIEWSHELL_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_OUTLINEVIEWSHELL_HXX
22 
23 #include "ViewShell.hxx"
24 #include <glob.hxx>
25 
26 class SdPage;
27 class TransferableDataHelper;
28 class TransferableClipboardListener;
29 
30 namespace sd { class OutlineView; }
31 
32 namespace sd {
33 
34 /** Show a textual overview of the text contents of all slides.
35 */
36 class OutlineViewShell
37     : public ViewShell
38 {
39 public:
40 
41     SFX_DECL_VIEWFACTORY(OutlineViewShell);
42     SFX_DECL_INTERFACE(SD_IF_SDOUTLINEVIEWSHELL)
43 
44 private:
45     /// SfxInterface initializer.
46     static void InitInterface_Impl();
47 
48 public:
49     /** Create a new view shell for the outline mode.
50         @param rViewShellBase
51             The new object will be stacked on this view shell base.
52         @param pFrameView
53             The frame view that makes it possible to pass information from
54             one view shell to the next.
55     */
56     OutlineViewShell (
57         SfxViewFrame* pFrame,
58         ViewShellBase& rViewShellBase,
59         vcl::Window* pParentWindow,
60         FrameView* pFrameView);
61 
62     virtual ~OutlineViewShell() override;
63 
64     virtual void Shutdown() override;
65 
66     virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override;
67 
68     /** Arrange and resize the GUI elements like rulers, sliders, and
69         buttons as well as the actual document view according to the size of
70         the enclosing window and current sizes of buttons, rulers, and
71         sliders.
72     */
73     virtual void ArrangeGUIElements() override;
74 
75     virtual bool PrepareClose( bool bUI = true ) override;
76 
77     virtual void VirtHScrollHdl(ScrollBar* pHScroll) override;
78     virtual void VirtVScrollHdl(ScrollBar* pVHScroll) override;
79 
80     virtual void Activate( bool IsMDIActivate ) override;
81     virtual void Deactivate( bool IsMDIActivate ) override;
82 
83     virtual SdPage* GetActualPage() override;
84 
85     /// inherited from sd::ViewShell
86     virtual SdPage* getCurrentPage() const override;
87 
88     void ExecCtrl(SfxRequest &rReq);
89     void GetCtrlState(SfxItemSet &rSet);
90     // FIXME non-virtual override???
91     void GetMenuState(SfxItemSet &rSet);
92     void GetAttrState(SfxItemSet &rSet);
93     void GetState (SfxItemSet& rSet);
94 
95     static void ExecStatusBar(SfxRequest& rReq);
96     void GetStatusBarState(SfxItemSet& rSet);
97 
98     void FuTemporary(SfxRequest &rReq);
99     void FuTemporaryModify(SfxRequest &rReq);
100     void FuPermanent(SfxRequest &rReq);
101     void FuSupport(SfxRequest &rReq);
102 
103     virtual void SetZoom(long nZoom) override;
104     virtual void SetZoomRect(const ::tools::Rectangle& rZoomRect) override;
105 
106     void Execute(SfxRequest& rReq);
107 
108     virtual void ReadFrameViewData(FrameView* pView) override;
109     virtual void WriteFrameViewData() override;
110 
111     virtual void Command( const CommandEvent& rCEvt, ::sd::Window* pWin ) override;
112     virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) override;
113     virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
114 
115     ErrCode ReadRtf(SvStream& rInput);
116 
117     virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override;
118     virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override;
119 
120     /** this method is called when the visible area of the view from this viewshell is changed */
121     virtual void VisAreaChanged(const ::tools::Rectangle& rRect) override;
122 
123     /** Create an accessible object representing the specified window.
124         @param pWindow
125             The returned object makes the document displayed in this window
126             accessible.
127         @return
128             Returns an <type>AccessibleDrawDocumentView</type> object.
129    */
130     virtual css::uno::Reference<css::accessibility::XAccessible>
131         CreateAccessibleDocumentView (::sd::Window* pWindow) override;
132 
133     /** Update the preview to show the specified page.
134     */
135     virtual void UpdatePreview (SdPage* pPage) override;
136 
137     virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() override;
138 
139     /** Make the given page the new current page.  This method
140         notifies the controller and adapts the selection of the
141         model.
142         @param pPage
143             The new current page.  Pass NULL when there is no current page.
144     */
145     void SetCurrentPage (SdPage* pPage);
146 
147     void UpdateTitleObject( SdPage* pPage, Paragraph const * pPara );
148     void UpdateOutlineObject( SdPage* pPage, Paragraph* pPara );
149 
150 private:
151     OUString m_StrOldPageName;
152     std::unique_ptr<OutlineView> pOlView;
153     SdPage*         pLastPage; // For efficient processing of the preview
154     rtl::Reference<TransferableClipboardListener> mxClipEvtLstnr;
155     bool            bPastePossible;
156     bool mbInitialized;
157 
158     void Construct();
159     DECL_LINK( ClipboardChanged, TransferableDataHelper*, void );
160 };
161 
162 } // end of namespace sd
163 
164 #endif
165 
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
167