bump product version to 5.0.4.1
[LibreOffice.git] / sdext / source / presenter / PresenterNotesView.hxx
blob16a8e949e917acc18421323dbc66f4343d0d3596
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_SDEXT_SOURCE_PRESENTER_PRESENTERNOTESVIEW_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERNOTESVIEW_HXX
23 #include "PresenterController.hxx"
24 #include "PresenterToolBar.hxx"
25 #include "PresenterViewFactory.hxx"
26 #include <cppuhelper/basemutex.hxx>
27 #include <cppuhelper/compbase5.hxx>
28 #include <com/sun/star/awt/ActionEvent.hpp>
29 #include <com/sun/star/awt/XActionListener.hpp>
30 #include <com/sun/star/awt/XButton.hpp>
31 #include <com/sun/star/awt/XControl.hpp>
32 #include <com/sun/star/awt/XTextComponent.hpp>
33 #include <com/sun/star/awt/XWindowListener.hpp>
34 #include <com/sun/star/drawing/XDrawPage.hpp>
35 #include <com/sun/star/drawing/XDrawView.hpp>
36 #include <com/sun/star/drawing/framework/XView.hpp>
37 #include <com/sun/star/drawing/framework/XResourceId.hpp>
38 #include <com/sun/star/frame/XController.hpp>
39 #include <rtl/ref.hxx>
40 #include <boost/shared_ptr.hpp>
42 namespace {
43 typedef cppu::WeakComponentImplHelper5<
44 css::awt::XWindowListener,
45 css::awt::XPaintListener,
46 css::drawing::framework::XView,
47 css::drawing::XDrawView,
48 css::awt::XKeyListener
49 > PresenterNotesViewInterfaceBase;
52 namespace sdext { namespace presenter {
54 class PresenterButton;
55 class PresenterScrollBar;
56 class PresenterTextView;
58 /** A drawing framework view of the notes of a slide. At the moment this is
59 a simple text view that does not show the original formatting of the
60 notes text.
62 class PresenterNotesView
63 : private ::cppu::BaseMutex,
64 public PresenterNotesViewInterfaceBase,
65 public CachablePresenterView
67 public:
68 explicit PresenterNotesView (
69 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
70 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
71 const css::uno::Reference<css::frame::XController>& rxController,
72 const ::rtl::Reference<PresenterController>& rpPresenterController);
73 virtual ~PresenterNotesView();
75 virtual void SAL_CALL disposing() SAL_OVERRIDE;
77 /** Typically called from setCurrentSlide() with the notes page that is
78 associed with the slide given to setCurrentSlide().
80 Iterates over all text shapes on the given notes page and diplays
81 the concatenated text of these.
83 void SetSlide (
84 const css::uno::Reference<css::drawing::XDrawPage>& rxNotesPage);
86 void ChangeFontSize (const sal_Int32 nSizeChange);
88 ::boost::shared_ptr<PresenterTextView> GetTextView() const;
90 // lang::XEventListener
92 virtual void SAL_CALL
93 disposing (const css::lang::EventObject& rEventObject)
94 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 // XWindowListener
98 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
99 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
102 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
105 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
108 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 // XPaintListener
112 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
113 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 // XResourceId
117 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId()
118 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 virtual sal_Bool SAL_CALL isAnchorOnly()
121 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 // XDrawView
125 virtual void SAL_CALL setCurrentPage (
126 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
127 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage()
130 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 // XKeyListener
134 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent)
135 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent)
137 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 private:
140 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
141 ::rtl::Reference<PresenterController> mpPresenterController;
142 css::uno::Reference<css::awt::XWindow> mxParentWindow;
143 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
144 css::uno::Reference<css::drawing::XDrawPage> mxCurrentNotesPage;
145 ::rtl::Reference<PresenterScrollBar> mpScrollBar;
146 css::uno::Reference<css::awt::XWindow> mxToolBarWindow;
147 css::uno::Reference<css::rendering::XCanvas> mxToolBarCanvas;
148 ::rtl::Reference<PresenterToolBar> mpToolBar;
149 ::rtl::Reference<PresenterButton> mpCloseButton;
150 css::util::Color maSeparatorColor;
151 sal_Int32 mnSeparatorYLocation;
152 css::geometry::RealRectangle2D maTextBoundingBox;
153 SharedBitmapDescriptor mpBackground;
154 double mnTop;
155 PresenterTheme::SharedFontDescriptor mpFont;
156 ::boost::shared_ptr<PresenterTextView> mpTextView;
158 void CreateToolBar (
159 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
160 const ::rtl::Reference<PresenterController>& rpPresenterController);
161 void Layout();
162 void Paint (const css::awt::Rectangle& rUpdateBox);
163 void PaintToolBar (const css::awt::Rectangle& rUpdateBox);
164 void PaintText (const css::awt::Rectangle& rUpdateBox);
165 void Invalidate();
166 void Scroll (const double nDistance);
167 void SetTop (const double nTop);
168 void UpdateScrollBar();
169 void MoveCaret (const sal_Int32 nDistance);
171 /** This method throws a DisposedException when the object has already been
172 disposed.
174 void ThrowIfDisposed()
175 throw (css::lang::DisposedException);
178 } } // end of namespace ::sdext::presenter
180 #endif
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */