1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sdext.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "PresenterNotesView.hxx"
32*cdf0e10cSrcweir #include "PresenterButton.hxx"
33*cdf0e10cSrcweir #include "PresenterCanvasHelper.hxx"
34*cdf0e10cSrcweir #include "PresenterGeometryHelper.hxx"
35*cdf0e10cSrcweir #include "PresenterPaintManager.hxx"
36*cdf0e10cSrcweir #include "PresenterScrollBar.hxx"
37*cdf0e10cSrcweir #include "PresenterTextView.hxx"
38*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleTextType.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/awt/Key.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/awt/KeyModifier.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XControllerManager.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceName.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/presentation/XPresentationPage.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/rendering/XSpriteCanvas.hpp>
50*cdf0e10cSrcweir #include <com/sun/star/text/XTextRange.hpp>
51*cdf0e10cSrcweir #include <com/sun/star/util/XChangesBatch.hpp>
52*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
53*cdf0e10cSrcweir #include <boost/bind.hpp>
54*cdf0e10cSrcweir #include <set>
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir using namespace ::com::sun::star;
57*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
58*cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
59*cdf0e10cSrcweir using ::rtl::OUString;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir static const sal_Int32 gnSpaceBelowSeparator (10);
64*cdf0e10cSrcweir static const sal_Int32 gnSpaceAboveSeparator (10);
65*cdf0e10cSrcweir static const sal_Int32 gnPartHeight (128);
66*cdf0e10cSrcweir /** Maximal size of memory used for bitmaps which show the notes text.
67*cdf0e10cSrcweir */
68*cdf0e10cSrcweir static const sal_Int32 gnMaximalCacheSize (8*1024*1024);
69*cdf0e10cSrcweir static const double gnLineScrollFactor (1.2);
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir namespace sdext { namespace presenter {
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir //===== PresenterNotesView ====================================================
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir PresenterNotesView::PresenterNotesView (
76*cdf0e10cSrcweir     const Reference<XComponentContext>& rxComponentContext,
77*cdf0e10cSrcweir     const Reference<XResourceId>& rxViewId,
78*cdf0e10cSrcweir     const Reference<frame::XController>& rxController,
79*cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController)
80*cdf0e10cSrcweir     : PresenterNotesViewInterfaceBase(m_aMutex),
81*cdf0e10cSrcweir       mxViewId(rxViewId),
82*cdf0e10cSrcweir       mpPresenterController(rpPresenterController),
83*cdf0e10cSrcweir       mxCanvas(),
84*cdf0e10cSrcweir       mxCurrentNotesPage(),
85*cdf0e10cSrcweir       mpScrollBar(),
86*cdf0e10cSrcweir       mxToolBarWindow(),
87*cdf0e10cSrcweir       mxToolBarCanvas(),
88*cdf0e10cSrcweir       mpToolBar(),
89*cdf0e10cSrcweir       mpCloseButton(),
90*cdf0e10cSrcweir       maSeparatorColor(0xffffff),
91*cdf0e10cSrcweir       mnSeparatorYLocation(0),
92*cdf0e10cSrcweir       maTextBoundingBox(),
93*cdf0e10cSrcweir       mpBackground(),
94*cdf0e10cSrcweir       mnTop(0),
95*cdf0e10cSrcweir       mpFont(),
96*cdf0e10cSrcweir       mpTextView()
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir     try
99*cdf0e10cSrcweir     {
100*cdf0e10cSrcweir         Reference<XControllerManager> xCM (rxController, UNO_QUERY_THROW);
101*cdf0e10cSrcweir         Reference<XConfigurationController> xCC (xCM->getConfigurationController(), UNO_QUERY_THROW);
102*cdf0e10cSrcweir         Reference<XPane> xPane (xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW);
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir         mxParentWindow = xPane->getWindow();
105*cdf0e10cSrcweir         mxCanvas = xPane->getCanvas();
106*cdf0e10cSrcweir         mpTextView.reset(new PresenterTextView(
107*cdf0e10cSrcweir             rxComponentContext,
108*cdf0e10cSrcweir             mxCanvas,
109*cdf0e10cSrcweir             mpPresenterController->GetPaintManager()->GetInvalidator(mxParentWindow)));
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir         const OUString sResourceURL (mxViewId->getResourceURL());
112*cdf0e10cSrcweir         mpFont.reset(new PresenterTheme::FontDescriptor(
113*cdf0e10cSrcweir             rpPresenterController->GetViewFont(sResourceURL)));
114*cdf0e10cSrcweir         maSeparatorColor = mpFont->mnColor;
115*cdf0e10cSrcweir         mpTextView->SetFont(mpFont);
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir         CreateToolBar(rxComponentContext, rpPresenterController);
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir         mpCloseButton = PresenterButton::Create(
120*cdf0e10cSrcweir             rxComponentContext,
121*cdf0e10cSrcweir             mpPresenterController,
122*cdf0e10cSrcweir             mpPresenterController->GetTheme(),
123*cdf0e10cSrcweir             mxParentWindow,
124*cdf0e10cSrcweir             mxCanvas,
125*cdf0e10cSrcweir             A2S("NotesViewCloser"));
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir         if (mxParentWindow.is())
128*cdf0e10cSrcweir         {
129*cdf0e10cSrcweir             mxParentWindow->addWindowListener(this);
130*cdf0e10cSrcweir             mxParentWindow->addPaintListener(this);
131*cdf0e10cSrcweir             mxParentWindow->addKeyListener(this);
132*cdf0e10cSrcweir             mxParentWindow->setVisible(sal_True);
133*cdf0e10cSrcweir         }
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir         mpScrollBar = new PresenterVerticalScrollBar(
136*cdf0e10cSrcweir             rxComponentContext,
137*cdf0e10cSrcweir             mxParentWindow,
138*cdf0e10cSrcweir             mpPresenterController->GetPaintManager(),
139*cdf0e10cSrcweir             ::boost::bind(&PresenterNotesView::SetTop, this, _1));
140*cdf0e10cSrcweir         mpScrollBar->SetBackground(
141*cdf0e10cSrcweir             mpPresenterController->GetViewBackground(mxViewId->getResourceURL()));
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir         mpScrollBar->SetCanvas(mxCanvas);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         Layout();
146*cdf0e10cSrcweir     }
147*cdf0e10cSrcweir     catch (RuntimeException&)
148*cdf0e10cSrcweir     {
149*cdf0e10cSrcweir         PresenterNotesView::disposing();
150*cdf0e10cSrcweir         throw;
151*cdf0e10cSrcweir     }
152*cdf0e10cSrcweir }
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir PresenterNotesView::~PresenterNotesView (void)
158*cdf0e10cSrcweir {
159*cdf0e10cSrcweir }
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::disposing (void)
165*cdf0e10cSrcweir {
166*cdf0e10cSrcweir     if (mxParentWindow.is())
167*cdf0e10cSrcweir     {
168*cdf0e10cSrcweir         mxParentWindow->removeWindowListener(this);
169*cdf0e10cSrcweir         mxParentWindow->removePaintListener(this);
170*cdf0e10cSrcweir         mxParentWindow->removeKeyListener(this);
171*cdf0e10cSrcweir         mxParentWindow = NULL;
172*cdf0e10cSrcweir     }
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir     // Dispose tool bar.
175*cdf0e10cSrcweir     {
176*cdf0e10cSrcweir         Reference<XComponent> xComponent (static_cast<XWeak*>(mpToolBar.get()), UNO_QUERY);
177*cdf0e10cSrcweir         mpToolBar = NULL;
178*cdf0e10cSrcweir         if (xComponent.is())
179*cdf0e10cSrcweir             xComponent->dispose();
180*cdf0e10cSrcweir     }
181*cdf0e10cSrcweir     {
182*cdf0e10cSrcweir         Reference<XComponent> xComponent (mxToolBarCanvas, UNO_QUERY);
183*cdf0e10cSrcweir         mxToolBarCanvas = NULL;
184*cdf0e10cSrcweir         if (xComponent.is())
185*cdf0e10cSrcweir             xComponent->dispose();
186*cdf0e10cSrcweir     }
187*cdf0e10cSrcweir     {
188*cdf0e10cSrcweir         Reference<XComponent> xComponent (mxToolBarWindow, UNO_QUERY);
189*cdf0e10cSrcweir         mxToolBarWindow = NULL;
190*cdf0e10cSrcweir         if (xComponent.is())
191*cdf0e10cSrcweir             xComponent->dispose();
192*cdf0e10cSrcweir     }
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir     // Dispose close button
195*cdf0e10cSrcweir     {
196*cdf0e10cSrcweir         Reference<XComponent> xComponent (static_cast<XWeak*>(mpCloseButton.get()), UNO_QUERY);
197*cdf0e10cSrcweir         mpCloseButton = NULL;
198*cdf0e10cSrcweir         if (xComponent.is())
199*cdf0e10cSrcweir             xComponent->dispose();
200*cdf0e10cSrcweir     }
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir     // Create the tool bar.
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir     mpScrollBar = NULL;
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir     mxViewId = NULL;
207*cdf0e10cSrcweir }
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir void PresenterNotesView::CreateToolBar (
213*cdf0e10cSrcweir     const css::uno::Reference<css::uno::XComponentContext>& rxContext,
214*cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController)
215*cdf0e10cSrcweir {
216*cdf0e10cSrcweir     if (rpPresenterController.get() == NULL)
217*cdf0e10cSrcweir         return;
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir     Reference<drawing::XPresenterHelper> xPresenterHelper (
220*cdf0e10cSrcweir         rpPresenterController->GetPresenterHelper());
221*cdf0e10cSrcweir     if ( ! xPresenterHelper.is())
222*cdf0e10cSrcweir         return;
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir     // Create a new window as container of the tool bar.
225*cdf0e10cSrcweir     mxToolBarWindow = xPresenterHelper->createWindow(
226*cdf0e10cSrcweir         mxParentWindow,
227*cdf0e10cSrcweir         sal_False,
228*cdf0e10cSrcweir         sal_True,
229*cdf0e10cSrcweir         sal_False,
230*cdf0e10cSrcweir         sal_False);
231*cdf0e10cSrcweir     mxToolBarCanvas = xPresenterHelper->createSharedCanvas (
232*cdf0e10cSrcweir         Reference<rendering::XSpriteCanvas>(mxCanvas, UNO_QUERY),
233*cdf0e10cSrcweir         mxParentWindow,
234*cdf0e10cSrcweir         mxCanvas,
235*cdf0e10cSrcweir         mxParentWindow,
236*cdf0e10cSrcweir         mxToolBarWindow);
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir     // Create the tool bar.
239*cdf0e10cSrcweir     mpToolBar = new PresenterToolBar(
240*cdf0e10cSrcweir         rxContext,
241*cdf0e10cSrcweir         mxToolBarWindow,
242*cdf0e10cSrcweir         mxToolBarCanvas,
243*cdf0e10cSrcweir         rpPresenterController,
244*cdf0e10cSrcweir         PresenterToolBar::Left);
245*cdf0e10cSrcweir     mpToolBar->Initialize(
246*cdf0e10cSrcweir         A2S("PresenterScreenSettings/ToolBars/NotesToolBar"));
247*cdf0e10cSrcweir }
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir void PresenterNotesView::SetSlide (const Reference<drawing::XDrawPage>& rxNotesPage)
253*cdf0e10cSrcweir {
254*cdf0e10cSrcweir     static const ::rtl::OUString sNotesShapeName (
255*cdf0e10cSrcweir         A2S("com.sun.star.presentation.NotesShape"));
256*cdf0e10cSrcweir     static const ::rtl::OUString sTextShapeName (
257*cdf0e10cSrcweir         A2S("com.sun.star.drawing.TextShape"));
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir     Reference<container::XIndexAccess> xIndexAccess (rxNotesPage, UNO_QUERY);
260*cdf0e10cSrcweir     if (xIndexAccess.is())
261*cdf0e10cSrcweir     {
262*cdf0e10cSrcweir         ::rtl::OUString sText;
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir         // Iterate over all shapes and find the one that holds the text.
265*cdf0e10cSrcweir         sal_Int32 nCount (xIndexAccess->getCount());
266*cdf0e10cSrcweir         for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
267*cdf0e10cSrcweir         {
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir             Reference<lang::XServiceName> xServiceName (
270*cdf0e10cSrcweir                 xIndexAccess->getByIndex(nIndex), UNO_QUERY);
271*cdf0e10cSrcweir             if (xServiceName.is()
272*cdf0e10cSrcweir                 && xServiceName->getServiceName().equals(sNotesShapeName))
273*cdf0e10cSrcweir             {
274*cdf0e10cSrcweir                 Reference<text::XTextRange> xText (xServiceName, UNO_QUERY);
275*cdf0e10cSrcweir                 if (xText.is())
276*cdf0e10cSrcweir                 {
277*cdf0e10cSrcweir                     sText += xText->getString();
278*cdf0e10cSrcweir                 }
279*cdf0e10cSrcweir             }
280*cdf0e10cSrcweir             else
281*cdf0e10cSrcweir             {
282*cdf0e10cSrcweir                 Reference<drawing::XShapeDescriptor> xShapeDescriptor (
283*cdf0e10cSrcweir                     xIndexAccess->getByIndex(nIndex), UNO_QUERY);
284*cdf0e10cSrcweir                 if (xShapeDescriptor.is())
285*cdf0e10cSrcweir                 {
286*cdf0e10cSrcweir                     ::rtl::OUString sType (xShapeDescriptor->getShapeType());
287*cdf0e10cSrcweir                     if (sType.equals(sNotesShapeName) || sType.equals(sTextShapeName))
288*cdf0e10cSrcweir                     {
289*cdf0e10cSrcweir                         Reference<text::XTextRange> xText (
290*cdf0e10cSrcweir                             xIndexAccess->getByIndex(nIndex), UNO_QUERY);
291*cdf0e10cSrcweir                         if (xText.is())
292*cdf0e10cSrcweir                         {
293*cdf0e10cSrcweir                             sText += xText->getString();
294*cdf0e10cSrcweir                             mpTextView->SetText(Reference<text::XText>(xText, UNO_QUERY));
295*cdf0e10cSrcweir                         }
296*cdf0e10cSrcweir                     }
297*cdf0e10cSrcweir                 }
298*cdf0e10cSrcweir             }
299*cdf0e10cSrcweir         }
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir         Layout();
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         if (mpScrollBar.get() != NULL)
304*cdf0e10cSrcweir         {
305*cdf0e10cSrcweir             mpScrollBar->SetThumbPosition(0, false);
306*cdf0e10cSrcweir             UpdateScrollBar();
307*cdf0e10cSrcweir         }
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir         Invalidate();
310*cdf0e10cSrcweir     }
311*cdf0e10cSrcweir }
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir //-----  lang::XEventListener -------------------------------------------------
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::disposing (const lang::EventObject& rEventObject)
319*cdf0e10cSrcweir     throw (RuntimeException)
320*cdf0e10cSrcweir {
321*cdf0e10cSrcweir     if (rEventObject.Source == mxParentWindow)
322*cdf0e10cSrcweir         mxParentWindow = NULL;
323*cdf0e10cSrcweir }
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir //----- XWindowListener -------------------------------------------------------
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::windowResized (const awt::WindowEvent& rEvent)
331*cdf0e10cSrcweir     throw (RuntimeException)
332*cdf0e10cSrcweir {
333*cdf0e10cSrcweir     (void)rEvent;
334*cdf0e10cSrcweir     Layout();
335*cdf0e10cSrcweir }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::windowMoved (const awt::WindowEvent& rEvent)
341*cdf0e10cSrcweir     throw (RuntimeException)
342*cdf0e10cSrcweir {
343*cdf0e10cSrcweir     (void)rEvent;
344*cdf0e10cSrcweir }
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::windowShown (const lang::EventObject& rEvent)
350*cdf0e10cSrcweir     throw (RuntimeException)
351*cdf0e10cSrcweir {
352*cdf0e10cSrcweir     (void)rEvent;
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::windowHidden (const lang::EventObject& rEvent)
359*cdf0e10cSrcweir     throw (RuntimeException)
360*cdf0e10cSrcweir {
361*cdf0e10cSrcweir     (void)rEvent;
362*cdf0e10cSrcweir }
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir //----- XPaintListener --------------------------------------------------------
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::windowPaint (const awt::PaintEvent& rEvent)
370*cdf0e10cSrcweir     throw (RuntimeException)
371*cdf0e10cSrcweir {
372*cdf0e10cSrcweir     ThrowIfDisposed();
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir     if ( ! mbIsPresenterViewActive)
375*cdf0e10cSrcweir         return;
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir     ::osl::MutexGuard aSolarGuard (::osl::Mutex::getGlobalMutex());
378*cdf0e10cSrcweir     Paint(rEvent.UpdateRect);
379*cdf0e10cSrcweir }
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir //----- XResourceId -----------------------------------------------------------
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir Reference<XResourceId> SAL_CALL PresenterNotesView::getResourceId (void)
387*cdf0e10cSrcweir     throw (RuntimeException)
388*cdf0e10cSrcweir {
389*cdf0e10cSrcweir     return mxViewId;
390*cdf0e10cSrcweir }
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir sal_Bool SAL_CALL PresenterNotesView::isAnchorOnly (void)
396*cdf0e10cSrcweir     throw (RuntimeException)
397*cdf0e10cSrcweir {
398*cdf0e10cSrcweir     return false;
399*cdf0e10cSrcweir }
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir //----- XDrawView -------------------------------------------------------------
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::setCurrentPage (const Reference<drawing::XDrawPage>& rxSlide)
407*cdf0e10cSrcweir     throw (RuntimeException)
408*cdf0e10cSrcweir {
409*cdf0e10cSrcweir     // Get the associated notes page.
410*cdf0e10cSrcweir     mxCurrentNotesPage = NULL;
411*cdf0e10cSrcweir     try
412*cdf0e10cSrcweir     {
413*cdf0e10cSrcweir         Reference<presentation::XPresentationPage> xPresentationPage(rxSlide, UNO_QUERY);
414*cdf0e10cSrcweir         if (xPresentationPage.is())
415*cdf0e10cSrcweir             mxCurrentNotesPage = xPresentationPage->getNotesPage();
416*cdf0e10cSrcweir     }
417*cdf0e10cSrcweir     catch (RuntimeException&)
418*cdf0e10cSrcweir     {
419*cdf0e10cSrcweir     }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir     SetSlide(mxCurrentNotesPage);
422*cdf0e10cSrcweir }
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir Reference<drawing::XDrawPage> SAL_CALL PresenterNotesView::getCurrentPage (void)
428*cdf0e10cSrcweir     throw (RuntimeException)
429*cdf0e10cSrcweir {
430*cdf0e10cSrcweir     return NULL;
431*cdf0e10cSrcweir }
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir //----- XKeyListener ----------------------------------------------------------
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::keyPressed (const awt::KeyEvent& rEvent)
439*cdf0e10cSrcweir     throw (RuntimeException)
440*cdf0e10cSrcweir {
441*cdf0e10cSrcweir     switch (rEvent.KeyCode)
442*cdf0e10cSrcweir     {
443*cdf0e10cSrcweir         case awt::Key::A:
444*cdf0e10cSrcweir             Scroll(-gnLineScrollFactor * mpFont->mnSize);
445*cdf0e10cSrcweir             break;
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir         case awt::Key::Y:
448*cdf0e10cSrcweir         case awt::Key::Z:
449*cdf0e10cSrcweir             Scroll(+gnLineScrollFactor * mpFont->mnSize);
450*cdf0e10cSrcweir             break;
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir         case awt::Key::S:
453*cdf0e10cSrcweir             ChangeFontSize(-1);
454*cdf0e10cSrcweir             break;
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir         case awt::Key::G:
457*cdf0e10cSrcweir             ChangeFontSize(+1);
458*cdf0e10cSrcweir             break;
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir         case awt::Key::H:
461*cdf0e10cSrcweir             if (mpTextView)
462*cdf0e10cSrcweir                 mpTextView->MoveCaret(
463*cdf0e10cSrcweir                     -1,
464*cdf0e10cSrcweir                     (rEvent.Modifiers == awt::KeyModifier::SHIFT)
465*cdf0e10cSrcweir                         ? cssa::AccessibleTextType::CHARACTER
466*cdf0e10cSrcweir                         : cssa::AccessibleTextType::WORD);
467*cdf0e10cSrcweir             break;
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir         case awt::Key::L:
470*cdf0e10cSrcweir             if (mpTextView)
471*cdf0e10cSrcweir                 mpTextView->MoveCaret(
472*cdf0e10cSrcweir                     +1,
473*cdf0e10cSrcweir                     (rEvent.Modifiers == awt::KeyModifier::SHIFT)
474*cdf0e10cSrcweir                         ? cssa::AccessibleTextType::CHARACTER
475*cdf0e10cSrcweir                         : cssa::AccessibleTextType::WORD);
476*cdf0e10cSrcweir             break;
477*cdf0e10cSrcweir     }
478*cdf0e10cSrcweir }
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir void SAL_CALL PresenterNotesView::keyReleased (const awt::KeyEvent& rEvent)
484*cdf0e10cSrcweir     throw (RuntimeException)
485*cdf0e10cSrcweir {
486*cdf0e10cSrcweir     (void)rEvent;
487*cdf0e10cSrcweir }
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir //-----------------------------------------------------------------------------
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir void PresenterNotesView::Layout (void)
495*cdf0e10cSrcweir {
496*cdf0e10cSrcweir     if ( ! mxParentWindow.is())
497*cdf0e10cSrcweir         return;
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir     awt::Rectangle aWindowBox (mxParentWindow->getPosSize());
500*cdf0e10cSrcweir     geometry::RealRectangle2D aNewTextBoundingBox (0,0,aWindowBox.Width, aWindowBox.Height);
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir     // Size the tool bar and the horizontal separator above it.
503*cdf0e10cSrcweir     if (mxToolBarWindow.is())
504*cdf0e10cSrcweir     {
505*cdf0e10cSrcweir         const geometry::RealSize2D aToolBarSize (mpToolBar->GetMinimalSize());
506*cdf0e10cSrcweir         const sal_Int32 nToolBarHeight = sal_Int32(aToolBarSize.Height + 0.5);
507*cdf0e10cSrcweir         mxToolBarWindow->setPosSize(0, aWindowBox.Height - nToolBarHeight,
508*cdf0e10cSrcweir             sal_Int32(aToolBarSize.Width + 0.5), nToolBarHeight,
509*cdf0e10cSrcweir             awt::PosSize::POSSIZE);
510*cdf0e10cSrcweir         aNewTextBoundingBox.Y2 -= nToolBarHeight;
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir         mnSeparatorYLocation = aWindowBox.Height - nToolBarHeight - gnSpaceBelowSeparator;
513*cdf0e10cSrcweir         aNewTextBoundingBox.Y2 = mnSeparatorYLocation - gnSpaceAboveSeparator;
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir         // Place the close button.
516*cdf0e10cSrcweir         if (mpCloseButton.get() != NULL)
517*cdf0e10cSrcweir             mpCloseButton->SetCenter(geometry::RealPoint2D(
518*cdf0e10cSrcweir                 (aWindowBox.Width +  aToolBarSize.Width) / 2,
519*cdf0e10cSrcweir                 aWindowBox.Height - aToolBarSize.Height/2));
520*cdf0e10cSrcweir     }
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir     // Check whether the vertical scroll bar is necessary.
523*cdf0e10cSrcweir     if (mpScrollBar.get() != NULL)
524*cdf0e10cSrcweir     {
525*cdf0e10cSrcweir         bool bShowVerticalScrollbar (false);
526*cdf0e10cSrcweir         try
527*cdf0e10cSrcweir         {
528*cdf0e10cSrcweir             const double nTextBoxHeight (aNewTextBoundingBox.Y2 - aNewTextBoundingBox.Y1);
529*cdf0e10cSrcweir             const double nHeight (mpTextView->GetTotalTextHeight());
530*cdf0e10cSrcweir             if (nHeight > nTextBoxHeight)
531*cdf0e10cSrcweir             {
532*cdf0e10cSrcweir                 bShowVerticalScrollbar = true;
533*cdf0e10cSrcweir                 aNewTextBoundingBox.X2 -= mpScrollBar->GetSize();
534*cdf0e10cSrcweir             }
535*cdf0e10cSrcweir             mpScrollBar->SetTotalSize(nHeight);
536*cdf0e10cSrcweir         }
537*cdf0e10cSrcweir         catch(beans::UnknownPropertyException&)
538*cdf0e10cSrcweir         {
539*cdf0e10cSrcweir             OSL_ASSERT(false);
540*cdf0e10cSrcweir         }
541*cdf0e10cSrcweir 
542*cdf0e10cSrcweir         mpScrollBar->SetVisible(bShowVerticalScrollbar);
543*cdf0e10cSrcweir         mpScrollBar->SetPosSize(
544*cdf0e10cSrcweir             geometry::RealRectangle2D(
545*cdf0e10cSrcweir                 aNewTextBoundingBox.X2,
546*cdf0e10cSrcweir                 aNewTextBoundingBox.X1,
547*cdf0e10cSrcweir                 aNewTextBoundingBox.X2 + mpScrollBar->GetSize(),
548*cdf0e10cSrcweir                 aNewTextBoundingBox.Y2));
549*cdf0e10cSrcweir         if ( ! bShowVerticalScrollbar)
550*cdf0e10cSrcweir             mpScrollBar->SetThumbPosition(0, false);
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir         UpdateScrollBar();
553*cdf0e10cSrcweir     }
554*cdf0e10cSrcweir 
555*cdf0e10cSrcweir     // Has the text area has changed it position or size?
556*cdf0e10cSrcweir     if (aNewTextBoundingBox.X1 != maTextBoundingBox.X1
557*cdf0e10cSrcweir         || aNewTextBoundingBox.Y1 != maTextBoundingBox.Y1
558*cdf0e10cSrcweir         || aNewTextBoundingBox.X2 != maTextBoundingBox.X2
559*cdf0e10cSrcweir         || aNewTextBoundingBox.Y2 != maTextBoundingBox.Y2)
560*cdf0e10cSrcweir     {
561*cdf0e10cSrcweir         maTextBoundingBox = aNewTextBoundingBox;
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir         mpTextView->SetLocation(
564*cdf0e10cSrcweir             geometry::RealPoint2D(
565*cdf0e10cSrcweir                 aNewTextBoundingBox.X1,
566*cdf0e10cSrcweir                 aNewTextBoundingBox.Y1));
567*cdf0e10cSrcweir         mpTextView->SetSize(
568*cdf0e10cSrcweir             geometry::RealSize2D(
569*cdf0e10cSrcweir                 aNewTextBoundingBox.X2 - aNewTextBoundingBox.X1,
570*cdf0e10cSrcweir                 aNewTextBoundingBox.Y2 - aNewTextBoundingBox.Y1));
571*cdf0e10cSrcweir     }
572*cdf0e10cSrcweir }
573*cdf0e10cSrcweir 
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir 
577*cdf0e10cSrcweir void PresenterNotesView::Paint (const awt::Rectangle& rUpdateBox)
578*cdf0e10cSrcweir {
579*cdf0e10cSrcweir     if ( ! mxParentWindow.is())
580*cdf0e10cSrcweir         return;
581*cdf0e10cSrcweir     if ( ! mxCanvas.is())
582*cdf0e10cSrcweir         return;
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir     if (mpBackground.get() == NULL)
585*cdf0e10cSrcweir         mpBackground = mpPresenterController->GetViewBackground(mxViewId->getResourceURL());
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir     if (rUpdateBox.Y < maTextBoundingBox.Y2
588*cdf0e10cSrcweir         && rUpdateBox.X < maTextBoundingBox.X2)
589*cdf0e10cSrcweir     {
590*cdf0e10cSrcweir         PaintText(rUpdateBox);
591*cdf0e10cSrcweir     }
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir     mpTextView->Paint(rUpdateBox);
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir     if (rUpdateBox.Y + rUpdateBox.Height > maTextBoundingBox.Y2)
596*cdf0e10cSrcweir     {
597*cdf0e10cSrcweir         PaintToolBar(rUpdateBox);
598*cdf0e10cSrcweir     }
599*cdf0e10cSrcweir }
600*cdf0e10cSrcweir 
601*cdf0e10cSrcweir 
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir void PresenterNotesView::PaintToolBar (const awt::Rectangle& rUpdateBox)
605*cdf0e10cSrcweir {
606*cdf0e10cSrcweir     awt::Rectangle aWindowBox (mxParentWindow->getPosSize());
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir     rendering::ViewState aViewState (
609*cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
610*cdf0e10cSrcweir         NULL);
611*cdf0e10cSrcweir     rendering::RenderState aRenderState(
612*cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
613*cdf0e10cSrcweir         NULL,
614*cdf0e10cSrcweir         Sequence<double>(4),
615*cdf0e10cSrcweir         rendering::CompositeOperation::SOURCE);
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir     if (mpBackground.get() != NULL)
618*cdf0e10cSrcweir     {
619*cdf0e10cSrcweir         // Paint the background.
620*cdf0e10cSrcweir         mpPresenterController->GetCanvasHelper()->Paint(
621*cdf0e10cSrcweir             mpBackground,
622*cdf0e10cSrcweir             mxCanvas,
623*cdf0e10cSrcweir             rUpdateBox,
624*cdf0e10cSrcweir             awt::Rectangle(0,sal_Int32(maTextBoundingBox.Y2),aWindowBox.Width,aWindowBox.Height),
625*cdf0e10cSrcweir             awt::Rectangle());
626*cdf0e10cSrcweir     }
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir     // Paint the horizontal separator.
629*cdf0e10cSrcweir     OSL_ASSERT(mxViewId.is());
630*cdf0e10cSrcweir     PresenterCanvasHelper::SetDeviceColor(aRenderState, maSeparatorColor);
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir     mxCanvas->drawLine(
633*cdf0e10cSrcweir         geometry::RealPoint2D(0,mnSeparatorYLocation),
634*cdf0e10cSrcweir         geometry::RealPoint2D(aWindowBox.Width,mnSeparatorYLocation),
635*cdf0e10cSrcweir         aViewState,
636*cdf0e10cSrcweir         aRenderState);
637*cdf0e10cSrcweir }
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir void PresenterNotesView::PaintText (const awt::Rectangle& rUpdateBox)
643*cdf0e10cSrcweir {
644*cdf0e10cSrcweir     const awt::Rectangle aBox (PresenterGeometryHelper::Intersection(rUpdateBox,
645*cdf0e10cSrcweir             PresenterGeometryHelper::ConvertRectangle(maTextBoundingBox)));
646*cdf0e10cSrcweir 
647*cdf0e10cSrcweir     if (aBox.Width <= 0 || aBox.Height <= 0)
648*cdf0e10cSrcweir         return;
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir     rendering::ViewState aViewState (
651*cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
652*cdf0e10cSrcweir         PresenterGeometryHelper::CreatePolygon(aBox, mxCanvas->getDevice()));
653*cdf0e10cSrcweir     rendering::RenderState aRenderState(
654*cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
655*cdf0e10cSrcweir         NULL,
656*cdf0e10cSrcweir         Sequence<double>(3),
657*cdf0e10cSrcweir         rendering::CompositeOperation::SOURCE);
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir     if (mpBackground.get() != NULL)
660*cdf0e10cSrcweir     {
661*cdf0e10cSrcweir         // Paint the background.
662*cdf0e10cSrcweir         mpPresenterController->GetCanvasHelper()->Paint(
663*cdf0e10cSrcweir             mpBackground,
664*cdf0e10cSrcweir             mxCanvas,
665*cdf0e10cSrcweir             rUpdateBox,
666*cdf0e10cSrcweir             aBox,
667*cdf0e10cSrcweir             awt::Rectangle());
668*cdf0e10cSrcweir     }
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY);
671*cdf0e10cSrcweir     if (xSpriteCanvas.is())
672*cdf0e10cSrcweir         xSpriteCanvas->updateScreen(sal_False);
673*cdf0e10cSrcweir }
674*cdf0e10cSrcweir 
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir void PresenterNotesView::Invalidate (void)
679*cdf0e10cSrcweir {
680*cdf0e10cSrcweir     mpPresenterController->GetPaintManager()->Invalidate(
681*cdf0e10cSrcweir         mxParentWindow,
682*cdf0e10cSrcweir         PresenterGeometryHelper::ConvertRectangle(maTextBoundingBox));
683*cdf0e10cSrcweir }
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir 
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir void PresenterNotesView::Scroll (const double rnDistance)
689*cdf0e10cSrcweir {
690*cdf0e10cSrcweir     try
691*cdf0e10cSrcweir     {
692*cdf0e10cSrcweir         mnTop += rnDistance;
693*cdf0e10cSrcweir         mpTextView->SetOffset(0, mnTop);
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir         UpdateScrollBar();
696*cdf0e10cSrcweir         Invalidate();
697*cdf0e10cSrcweir     }
698*cdf0e10cSrcweir     catch (beans::UnknownPropertyException&)
699*cdf0e10cSrcweir     {}
700*cdf0e10cSrcweir }
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir 
703*cdf0e10cSrcweir 
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir void PresenterNotesView::SetTop (const double nTop)
706*cdf0e10cSrcweir {
707*cdf0e10cSrcweir     try
708*cdf0e10cSrcweir     {
709*cdf0e10cSrcweir         mnTop = nTop;
710*cdf0e10cSrcweir         mpTextView->SetOffset(0, mnTop);
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir         UpdateScrollBar();
713*cdf0e10cSrcweir         Invalidate();
714*cdf0e10cSrcweir     }
715*cdf0e10cSrcweir     catch (beans::UnknownPropertyException&)
716*cdf0e10cSrcweir     {}
717*cdf0e10cSrcweir }
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir 
720*cdf0e10cSrcweir 
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir void PresenterNotesView::ChangeFontSize (const sal_Int32 nSizeChange)
723*cdf0e10cSrcweir {
724*cdf0e10cSrcweir     const sal_Int32 nNewSize (mpFont->mnSize + nSizeChange);
725*cdf0e10cSrcweir     if (nNewSize > 5)
726*cdf0e10cSrcweir     {
727*cdf0e10cSrcweir         mpFont->mnSize = nNewSize;
728*cdf0e10cSrcweir         mpFont->mxFont = NULL;
729*cdf0e10cSrcweir         mpTextView->SetFont(mpFont);
730*cdf0e10cSrcweir 
731*cdf0e10cSrcweir         Layout();
732*cdf0e10cSrcweir         UpdateScrollBar();
733*cdf0e10cSrcweir         Invalidate();
734*cdf0e10cSrcweir 
735*cdf0e10cSrcweir         // Write the new font size to the configuration to make it persistent.
736*cdf0e10cSrcweir         try
737*cdf0e10cSrcweir         {
738*cdf0e10cSrcweir             const OUString sStyleName (mpPresenterController->GetTheme()->GetStyleName(
739*cdf0e10cSrcweir                 mxViewId->getResourceURL()));
740*cdf0e10cSrcweir             ::boost::shared_ptr<PresenterConfigurationAccess> pConfiguration (
741*cdf0e10cSrcweir                 mpPresenterController->GetTheme()->GetNodeForViewStyle(
742*cdf0e10cSrcweir                     sStyleName,
743*cdf0e10cSrcweir                     PresenterConfigurationAccess::READ_WRITE));
744*cdf0e10cSrcweir             if (pConfiguration.get()==NULL || ! pConfiguration->IsValid())
745*cdf0e10cSrcweir                 return;
746*cdf0e10cSrcweir 
747*cdf0e10cSrcweir             pConfiguration->GoToChild(A2S("Font"));
748*cdf0e10cSrcweir             pConfiguration->SetProperty(A2S("Size"), Any((sal_Int32)(nNewSize+0.5)));
749*cdf0e10cSrcweir             pConfiguration->CommitChanges();
750*cdf0e10cSrcweir         }
751*cdf0e10cSrcweir         catch (Exception&)
752*cdf0e10cSrcweir         {
753*cdf0e10cSrcweir             OSL_ASSERT(false);
754*cdf0e10cSrcweir         }
755*cdf0e10cSrcweir     }
756*cdf0e10cSrcweir }
757*cdf0e10cSrcweir 
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir ::boost::shared_ptr<PresenterTextView> PresenterNotesView::GetTextView (void) const
762*cdf0e10cSrcweir {
763*cdf0e10cSrcweir     return mpTextView;
764*cdf0e10cSrcweir }
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir void PresenterNotesView::UpdateScrollBar (void)
770*cdf0e10cSrcweir {
771*cdf0e10cSrcweir     if (mpScrollBar.get() != NULL)
772*cdf0e10cSrcweir     {
773*cdf0e10cSrcweir         try
774*cdf0e10cSrcweir         {
775*cdf0e10cSrcweir             mpScrollBar->SetTotalSize(mpTextView->GetTotalTextHeight());
776*cdf0e10cSrcweir         }
777*cdf0e10cSrcweir         catch(beans::UnknownPropertyException&)
778*cdf0e10cSrcweir         {
779*cdf0e10cSrcweir             OSL_ASSERT(false);
780*cdf0e10cSrcweir         }
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir         mpScrollBar->SetLineHeight(mpFont->mnSize*1.2);
783*cdf0e10cSrcweir         mpScrollBar->SetThumbPosition(mnTop, false);
784*cdf0e10cSrcweir 
785*cdf0e10cSrcweir         mpScrollBar->SetThumbSize(maTextBoundingBox.Y2 - maTextBoundingBox.Y1);
786*cdf0e10cSrcweir         mpScrollBar->CheckValues();
787*cdf0e10cSrcweir     }
788*cdf0e10cSrcweir }
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir 
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir void PresenterNotesView::ThrowIfDisposed (void)
794*cdf0e10cSrcweir     throw (::com::sun::star::lang::DisposedException)
795*cdf0e10cSrcweir {
796*cdf0e10cSrcweir 	if (rBHelper.bDisposed || rBHelper.bInDispose)
797*cdf0e10cSrcweir 	{
798*cdf0e10cSrcweir         throw lang::DisposedException (
799*cdf0e10cSrcweir             A2S("PresenterNotesView object has already been disposed"),
800*cdf0e10cSrcweir             static_cast<uno::XWeak*>(this));
801*cdf0e10cSrcweir     }
802*cdf0e10cSrcweir }
803*cdf0e10cSrcweir 
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir } } // end of namespace ::sdext::presenter
808