Commits

ihi  committed b9b04b2

CWS-TOOLING: integrate CWS impressaccessibility3
2009-09-18 16:10:59 +0200 af r276289 : #i102525# Fixed some minor compilation problems.
2009-09-17 14:11:23 +0200 af r276243 : #i102525# Fixed F1 shortcut for help view.
2009-09-16 16:20:58 +0200 af r276205 : #i102525# Removing const to make Solaris linker happy.
2009-09-16 16:13:25 +0200 af r276204 : #i90690# Initializing variable to avoid compilation problem.
2009-09-15 19:10:04 +0200 af r276186 : #i90825# Replace edit source proxy when an outliner object is set.
2009-09-15 11:12:07 +0200 af r276160 : #i90690# Broadcast accessibility events when the current slide is changed.
2009-09-15 09:37:48 +0200 af r276148 : #i102525# Fixed Solaris compilation problem.
2009-09-14 18:12:40 +0200 af r276142 : #i102525# Added missing implementation for some font related functions.
2009-09-14 18:02:05 +0200 af r276139 : #i102525# Added accessibility support.
2009-09-14 17:30:13 +0200 af r276136 : #i102525# Added support for interface XPane2 to panes.
2009-09-14 17:00:27 +0200 af r276133 : #i102525# Added XPane2 interface.
2009-09-14 16:13:04 +0200 af r276131 : #i50376# Make the focus indicator visible when the slide sorter has the focus.

  • Participants
  • Parent commits 2bc129f

Comments (0)

Files changed (50)

File canvas/source/vcl/canvasfont.cxx

     {
         tools::LocalGuard aGuard;
 
-        // TODO(F1)
-        return rendering::FontMetrics();
+        OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
+        VirtualDevice aVDev( rOutDev );
+        aVDev.SetFont(getVCLFont());
+        const ::FontMetric& aMetric( aVDev.GetFontMetric() );
+
+        return rendering::FontMetrics(
+            aMetric.GetAscent(),
+            aMetric.GetDescent(),
+            aMetric.GetIntLeading(),
+            aMetric.GetExtLeading(),
+            0,
+            aMetric.GetDescent() / 2.0,
+            aMetric.GetAscent() / 2.0);
     }
 
     uno::Sequence< double > SAL_CALL  CanvasFont::getAvailableSizes(  ) throw (uno::RuntimeException)

File canvas/source/vcl/textlayout.cxx

 #include <tools/diagnose_ex.h>
 #include <canvas/canvastools.hxx>
 
+#include <com/sun/star/rendering/CompositeOperation.hpp>
 #include <com/sun/star/rendering/TextDirection.hpp>
 
 #include <vcl/metric.hxx>
 
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/numeric/ftools.hxx>
+#include <basegfx/tools/canvastools.hxx>
 
 #include "impltools.hxx"
 #include "textlayout.hxx"
     {
         tools::LocalGuard aGuard;
 
-        // TODO(F1)
-        return uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > >();
+        OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
+        VirtualDevice aVDev( rOutDev );
+        aVDev.SetFont( mpFont->getVCLFont() );
+
+        setupLayoutMode( aVDev, mnTextDirection );
+
+        const rendering::ViewState aViewState(
+            geometry::AffineMatrix2D(1,0,0, 0,1,0),
+            NULL);
+
+        rendering::RenderState aRenderState (
+            geometry::AffineMatrix2D(1,0,0,0,1,0),
+            NULL,
+            uno::Sequence<double>(4),
+            rendering::CompositeOperation::SOURCE);
+
+        ::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]);
+        setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState);
+
+        uno::Sequence< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence;
+        ::basegfx::B2DPolyPolygonVector aOutlines;
+        if (aVDev.GetTextOutlines(
+            aOutlines,
+            maText.Text,
+            ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
+            ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
+            ::canvas::tools::numeric_cast<USHORT>(maText.Length),
+            FALSE,
+            0,
+            aOffsets.get()))
+        {
+            aOutlineSequence.realloc(aOutlines.size());
+            sal_Int32 nIndex (0);
+            for (::basegfx::B2DPolyPolygonVector::const_iterator
+                     iOutline(aOutlines.begin()),
+                     iEnd(aOutlines.end());
+                 iOutline!=iEnd;
+                 ++iOutline)
+            {
+                aOutlineSequence[nIndex++] = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+                    mxDevice,
+                    *iOutline);
+            }
+        }
+
+        return aOutlineSequence;
     }
 
     uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryInkMeasures(  ) throw (uno::RuntimeException)
     {
         tools::LocalGuard aGuard;
 
-        // TODO(F1)
-        return uno::Sequence< geometry::RealRectangle2D >();
+
+        OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
+        VirtualDevice aVDev( rOutDev );
+        aVDev.SetFont( mpFont->getVCLFont() );
+
+        setupLayoutMode( aVDev, mnTextDirection );
+
+        const rendering::ViewState aViewState(
+            geometry::AffineMatrix2D(1,0,0, 0,1,0),
+            NULL);
+
+        rendering::RenderState aRenderState (
+            geometry::AffineMatrix2D(1,0,0,0,1,0),
+            NULL,
+            uno::Sequence<double>(4),
+            rendering::CompositeOperation::SOURCE);
+
+        ::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]);
+        setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState);
+
+        MetricVector aMetricVector;
+        uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes;
+        if (aVDev.GetGlyphBoundRects(
+            Point(0,0),
+            maText.Text,
+            ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
+            ::canvas::tools::numeric_cast<USHORT>(maText.Length),
+            ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
+            aMetricVector))
+        {
+            aBoundingBoxes.realloc(aMetricVector.size());
+            sal_Int32 nIndex (0);
+            for (MetricVector::const_iterator
+                     iMetric(aMetricVector.begin()),
+                     iEnd(aMetricVector.end());
+                 iMetric!=iEnd;
+                 ++iMetric)
+            {
+                aBoundingBoxes[nIndex++] = geometry::RealRectangle2D(
+                    iMetric->getX(),
+                    iMetric->getY(),
+                    iMetric->getX() + iMetric->getWidth(),
+                    iMetric->getY() + iMetric->getHeight());
+            }
+        }
+        return aBoundingBoxes;
     }
 
     uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryMeasures(  ) throw (uno::RuntimeException)
 
         setupLayoutMode( aVDev, mnTextDirection );
 
-        const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() );
+        const sal_Int32 nAboveBaseline( /*-aMetric.GetIntLeading()*/ - aMetric.GetAscent() );
         const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
 
         if( maLogicalAdvancements.getLength() )

File offapi/com/sun/star/drawing/framework/XPane2.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XPane.idl,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_drawing_framework_XPane2_idl__
+#define __com_sun_star_drawing_framework_XPane2_idl__
+
+#ifndef __com_sun_star_accessibility_XAccessible_idl__
+#include <com/sun/star/accessibility/XAccessible.idl>
+#endif
+
+module com { module sun { module star { module drawing { module framework {
+
+/** An extension of the XPane interface that adds support for
+    a) showing and hiding the windows that internally belong to the pane and
+    b) setting the accessibility object.
+    This is typically an optional interface.
+*/
+interface XPane2
+{
+    /** Return whether all windows that are used to implement the pane are
+        visible.
+        @Returns <TRUE> when all windows of the pane are visible.
+    */
+    boolean isVisible ();
+
+    /** Hide or show the pane.  If there is more than one window used to
+        implement the pane then it is left to the implementation if one,
+        some, or all windows are hidden or shown as long as the pane becomes
+        hidden or visible.
+        @param bIsVisible
+            When <TRUE> then show the pane.  Hide it otherwise.
+    */
+    void setVisible ([in] boolean bIsVisible);
+
+    /** Set the accessibility object for the pane. When there is more than
+        one window used to implement the pane then the given accessibility
+        object is usually set at the topmost window.  However, the details
+        are implementation dependent.
+        @param xAccessible
+            May be an empty reference.  
+    */
+    void setAccessible ([in] ::com::sun::star::accessibility::XAccessible xAccessible);
+
+    /** Return the accessibility object that is currently associated with
+        the windows that implement the pane.
+    */
+    ::com::sun::star::accessibility::XAccessible getAccessible ();
+};
+
+}; }; }; }; }; // ::com::sun::star::drawing::framework
+
+#endif

File offapi/com/sun/star/drawing/framework/makefile.mk

 	XControllerManager.idl					\
 	XModuleController.idl					\
 	XPane.idl								\
+	XPane2.idl								\
 	XPaneBorderPainter.idl					\
 	XRelocatableResource.idl				\
 	XResource.idl							\

File sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx

 #include "AccessibleDrawDocumentView.hxx"
 #include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/drawing/XDrawView.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/frame/XController.hpp>
 #include "sdresid.hxx"
 #include <vos/mutex.hxx>
 
-using namespace ::rtl;
+using ::rtl::OUString;
 using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
 using namespace	::com::sun::star::accessibility;
 
 class SfxViewFrame;
 
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
 namespace accessibility {
 
 
       mpChildrenManager (NULL)
 {
     OSL_TRACE ("AccessibleDrawDocumentView");
+    UpdateAccessibleName();
 }
 
 
     {
         OSL_TRACE ("    current page changed");
 
+        // Update the accessible name to reflect the current slide.
+        UpdateAccessibleName();
+        
         // The current page changed.  Update the children manager accordingly.
         uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
         if (xView.is() && mpChildrenManager!=NULL)
 
 
 
+void AccessibleDrawDocumentView::UpdateAccessibleName (void)
+{
+	OUString sNewName (CreateAccessibleName());
+    sNewName += A2S(": ");
+
+    // Add the number of the current slide.
+    uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
+    if (xView.is())
+    {
+        uno::Reference<beans::XPropertySet> xProperties (xView->getCurrentPage(), UNO_QUERY);
+        if (xProperties.is())
+            try
+            {
+                sal_Int16 nPageNumber (0);
+                if (xProperties->getPropertyValue(A2S("Number")) >>= nPageNumber)
+                {
+                    sNewName += OUString::valueOf(sal_Int32(nPageNumber));
+                }
+            }
+            catch (beans::UnknownPropertyException&)
+            {
+            }
+    }
+
+    // Add the number of pages/slides.
+    Reference<drawing::XDrawPagesSupplier> xPagesSupplier (mxModel, UNO_QUERY);
+    if (xPagesSupplier.is())
+    {
+        Reference<container::XIndexAccess> xPages (xPagesSupplier->getDrawPages(), UNO_QUERY);
+        if (xPages.is())
+        {
+            sNewName += A2S(" / ");
+            sNewName += OUString::valueOf(xPages->getCount());
+        }
+    }
+    
+    SetAccessibleName (sNewName, AutomaticallyCreated);
+}
+
+
+
+
 } // end of namespace accessibility

File sd/source/ui/accessibility/AccessiblePageShape.cxx

 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 
 using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
 using namespace	::com::sun::star::accessibility;
 using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
 
 namespace accessibility {
 
     AccessiblePageShape::CreateAccessibleName (void)
     throw (::com::sun::star::uno::RuntimeException)
 {
-    return CreateAccessibleBaseName();
+    Reference<beans::XPropertySet> xPageProperties (mxPage, UNO_QUERY);
+
+    // Get name of the current slide.
+    OUString sCurrentSlideName;
+    try
+    {
+        if (xPageProperties.is())
+        {
+            xPageProperties->getPropertyValue(A2S("LinkDisplayName")) >>= sCurrentSlideName;
+        }
+    }
+    catch (beans::UnknownPropertyException&)
+    {
+    }
+    
+    return CreateAccessibleBaseName()+A2S(": ")+sCurrentSlideName;
 }
 
 

File sd/source/ui/framework/factories/FullScreenPane.cxx

 #include <cppcanvas/vclfactory.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/topfrm.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/dialog.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/util/URL.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::drawing::framework;
 using ::rtl::OUString;
 
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
 namespace sd { namespace framework {
 
 FullScreenPane::FullScreenPane (
     const ::Window* pViewShellWindow)
     : FrameWindowPane(rxPaneId,NULL),
       mxComponentContext(rxComponentContext),
-      mpWorkWindow(new WorkWindow(NULL, 0))
+      mpWorkWindow(NULL)
 {
+    ::Window* pParent = NULL;
+    mpWorkWindow.reset(new WorkWindow(
+        pParent,
+        0));  // For debugging (non-fullscreen) use WB_BORDER | WB_MOVEABLE | WB_SIZEABLE));
+
     if ( ! rxPaneId.is())
         throw lang::IllegalArgumentException();
 
 
     // Create a new top-leve window that is displayed full screen.
     mpWorkWindow->ShowFullScreenMode(TRUE, nScreenNumber);
+    // For debugging (non-fullscreen) use mpWorkWindow->SetScreenNumber(nScreenNumber);
     mpWorkWindow->SetMenuBarMode(MENUBAR_MODE_HIDE);
     mpWorkWindow->SetBorderStyle(WINDOW_BORDER_REMOVEBORDER);
     mpWorkWindow->SetBackground(Wallpaper());
-    mpWorkWindow->Show();
+    // Don't show the window right now in order to allow the setting of an
+    // accessibility object: accessibility objects are typically
+    // requested by AT-tools when the window is shown.  Chaning it
+    // afterwards may or may not work.
+
+    // Add resize listener at the work window.
+    Link aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
+    mpWorkWindow->AddEventListener(aWindowEventHandler);
 
     // Set title and icon of the new window to those of the current window
     // of the view shell.
     // completely.
     mpWindow = new ::Window(mpWorkWindow.get());
     mpWindow->SetPosSizePixel(Point(0,0), mpWorkWindow->GetSizePixel());
-    mpWindow->Show();
     mpWindow->SetBackground(Wallpaper());
     mxWindow = VCLUnoHelper::GetInterface(mpWindow);
 
         delete mpWindow;
     }
 
-    mpWorkWindow.reset();
+    if (mpWorkWindow.get() != NULL)
+    {
+        Link aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
+        mpWorkWindow->RemoveEventListener(aWindowEventHandler);
+        mpWorkWindow.reset();
+    }
+    
     
     FrameWindowPane::disposing();
 }
 
 
 
+//----- XPane -----------------------------------------------------------------
+
+sal_Bool SAL_CALL FullScreenPane::isVisible (void)
+    throw (RuntimeException)
+{
+    ThrowIfDisposed();
+
+    if (mpWindow != NULL)
+        return mpWindow->IsReallyVisible();
+    else
+        return false;
+}
+
+
+
+
+void SAL_CALL FullScreenPane::setVisible (const sal_Bool bIsVisible)
+    throw (RuntimeException)
+{
+    ThrowIfDisposed();
+
+    if (mpWindow != NULL)
+        mpWindow->Show(bIsVisible);
+    if (mpWorkWindow != NULL)
+        mpWorkWindow->Show(bIsVisible);
+}
+
+
+
+
+Reference<accessibility::XAccessible> SAL_CALL FullScreenPane::getAccessible (void)
+    throw (RuntimeException)
+{
+    ThrowIfDisposed();
+
+    if (mpWorkWindow != NULL)
+        return mpWorkWindow->GetAccessible(FALSE);
+    else
+        return NULL;
+}
+
+
+
+
+void SAL_CALL FullScreenPane::setAccessible (
+    const Reference<accessibility::XAccessible>& rxAccessible)
+    throw (RuntimeException)
+{
+    ThrowIfDisposed();
+    
+    if (mpWindow != NULL)
+    {
+        Reference<lang::XInitialization> xInitializable (rxAccessible, UNO_QUERY);
+        if (xInitializable.is())
+        {
+            ::Window* pParentWindow = mpWindow->GetParent();
+            Reference<accessibility::XAccessible> xAccessibleParent;
+            if (pParentWindow != NULL)
+                xAccessibleParent = pParentWindow->GetAccessible();
+            Sequence<Any> aArguments (1);
+            aArguments[0] = Any(xAccessibleParent);
+            xInitializable->initialize(aArguments);
+        }
+        GetWindow()->SetAccessible(rxAccessible);
+    }
+}
+
+
+
+
 //-----------------------------------------------------------------------------
 
+IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+	switch (pEvent->GetId())
+    {
+        case VCLEVENT_WINDOW_RESIZE:
+            GetWindow()->SetPosPixel(Point(0,0));
+            GetWindow()->SetSizePixel(Size(
+                mpWorkWindow->GetSizePixel().Width(),
+                mpWorkWindow->GetSizePixel().Height()));
+            break;
+
+        case VCLEVENT_OBJECT_DYING:
+            mpWorkWindow.reset();
+            break;
+    }
+    return 1;
+}
+
+
+
+
 Reference<rendering::XCanvas> FullScreenPane::CreateCanvas (void)
     throw (RuntimeException)
 {

File sd/source/ui/framework/factories/FullScreenPane.hxx

 #include "FrameWindowPane.hxx"
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
+#include <vcl/vclevent.hxx>
 #include <boost/scoped_ptr.hpp>
 
 namespace css = ::com::sun::star;
 
     virtual void SAL_CALL disposing (void);
 
+    //----- XPane -------------------------------------------------------------
+
+    virtual sal_Bool SAL_CALL isVisible (void)
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
+        throw (cssu::RuntimeException);
+
+    virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL setAccessible (
+        const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
+        throw (cssu::RuntimeException);
+
+    
+    //-------------------------------------------------------------------------
+
+    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+
 protected:
     virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
         CreateCanvas (void)

File sd/source/ui/framework/factories/Pane.cxx

 
 
 
+//----- XPane2 ----------------------------------------------------------------
+
+sal_Bool SAL_CALL Pane::isVisible (void)
+    throw (RuntimeException)
+{
+    ThrowIfDisposed();
+
+    const ::Window* pWindow = GetWindow();
+    if (pWindow != NULL)
+        return pWindow->IsVisible();
+    else
+        return false;
+}
+
+
+
+
+void SAL_CALL Pane::setVisible (sal_Bool bIsVisible)
+    throw (RuntimeException)
+{
+    ThrowIfDisposed();
+
+    ::Window* pWindow = GetWindow();
+    if (pWindow != NULL)
+        pWindow->Show(bIsVisible);
+}
+
+
+
+
+Reference<accessibility::XAccessible> SAL_CALL Pane::getAccessible (void)
+    throw (RuntimeException)
+{
+    ThrowIfDisposed();
+    ::Window* pWindow = GetWindow();
+    if (pWindow != NULL)
+        return pWindow->GetAccessible(FALSE);
+    else
+        return NULL;
+}
+
+
+
+
+void SAL_CALL Pane::setAccessible (
+    const Reference<accessibility::XAccessible>& rxAccessible)
+    throw (RuntimeException)
+{
+    ThrowIfDisposed();
+    ::Window* pWindow = GetWindow();
+    if (pWindow != NULL)
+        pWindow->SetAccessible(rxAccessible);
+}
+
+
+
+
 //----- XResource -------------------------------------------------------------
 
 Reference<XResourceId> SAL_CALL Pane::getResourceId (void)

File sd/source/ui/inc/AccessibleDrawDocumentView.hxx

     virtual void Deactivated (void);
 
     virtual void impl_dispose (void);
+    
+private:
+    void UpdateAccessibleName (void);
 };
 
 } // end of namespace accessibility

File sd/source/ui/inc/framework/Pane.hxx

 #include "MutexOwner.hxx"
 
 #include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/drawing/framework/XPane2.hpp>
 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/compbase3.hxx>
 #include <tools/link.hxx>
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
 
 class Window;
 
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
 namespace {
 
-typedef ::cppu::WeakComponentImplHelper2 <
+typedef ::cppu::WeakComponentImplHelper3 <
     ::com::sun::star::drawing::framework::XPane,
+    ::com::sun::star::drawing::framework::XPane2,
       ::com::sun::star::lang::XUnoTunnel
     > PaneInterfaceBase;
 
     */
     virtual ::Window* GetWindow (void);
 
-    // XPane
+    
+    //----- XPane -------------------------------------------------------------
 
     /** For a UNO API based implementation of a view this may the most
         important method of this class because the view is only interested
         in the window of the pane.
     */
-    virtual ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>
+    virtual cssu::Reference<css::awt::XWindow>
         SAL_CALL getWindow (void)
-        throw (::com::sun::star::uno::RuntimeException);
+        throw (cssu::RuntimeException);
 
-    virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
+    virtual cssu::Reference<css::rendering::XCanvas>
         SAL_CALL getCanvas (void)
-        throw (::com::sun::star::uno::RuntimeException);
+        throw (cssu::RuntimeException);
 
+
+    //----- XPane2 -------------------------------------------------------------
     
-    // XResource
+    virtual sal_Bool SAL_CALL isVisible (void)
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
+        throw (cssu::RuntimeException);
+
+    virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL setAccessible (
+        const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
+        throw (cssu::RuntimeException);
+
+
+    //----- XResource ---------------------------------------------------------
     
     virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
         SAL_CALL getResourceId (void)
         throw (com::sun::star::uno::RuntimeException);
 
     
-    // XUnoTunnel
+    //----- XUnoTunnel --------------------------------------------------------
 
     virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
         throw (com::sun::star::uno::RuntimeException);
 
+
 protected:
     ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
     ::Window* mpWindow;

File sd/source/ui/slidesorter/controller/SlideSorterController.cxx

                 break;
 
             case VCLEVENT_WINDOW_GETFOCUS:
-                // Show focus but only when the focus was not set to the
-                // window as a result of a mouse click.
                 if (pActiveWindow != NULL && pWindow == pActiveWindow)
-                    if (pWindow->GetPointerState().mnState==0)
-                        GetFocusManager().ShowFocus();
+                    GetFocusManager().ShowFocus();
                 break;
 
             case VCLEVENT_WINDOW_LOSEFOCUS:

File sd/source/ui/slidesorter/controller/SlsFocusManager.cxx

         FocusHider aHider (*this);
         mnPageIndex = nPageIndex;
     }
+
+    if (HasFocus() && !IsFocusShowing())
+        ShowFocus();
 }
 
 

File sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx

 private:
     /// Gap between border of page object and inside of focus rectangle.
     static const sal_Int32 mnFocusIndicatorOffset;
+    const bool mbContrastToSelected;
 
 protected:
 	// method which is to be used to implement the local decomposition of a 2D primitive.
 
 public:
 	// constructor and destructor
-	SdPageObjectFocusPrimitive(const basegfx::B2DRange& rRange);
+	SdPageObjectFocusPrimitive(const basegfx::B2DRange& rRange, const bool bContrast);
 	~SdPageObjectFocusPrimitive();
 
 	// provide unique ID
     // create polygon
     const basegfx::B2DPolygon aIndicatorPolygon(basegfx::tools::createPolygonFromRect(aFocusIndicatorRange));
 
-    // white rectangle
+    const StyleSettings& rStyleSettings(Application::GetSettings().GetStyleSettings());
+
+    // "background" rectangle
+    const Color aBackgroundColor(mbContrastToSelected ? rStyleSettings.GetMenuHighlightColor() : rStyleSettings.GetWindowColor());
     xRetval[0] = Primitive2DReference(
 	    new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aIndicatorPolygon, Color(COL_WHITE).getBColor()));
 
     // dotted black rectangle with same geometry
     ::std::vector< double > aDotDashArray;
 
-    aDotDashArray.push_back(aDiscretePixel.getX());
-    aDotDashArray.push_back(aDiscretePixel.getX());
+    const sal_Int32 nFocusIndicatorWidth (3);
+    aDotDashArray.push_back(nFocusIndicatorWidth *aDiscretePixel.getX());
+    aDotDashArray.push_back(nFocusIndicatorWidth * aDiscretePixel.getX());
 
     // prepare line and stroke attributes
-    const drawinglayer::attribute::LineAttribute aLineAttribute(Color(COL_BLACK).getBColor());
-    const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(aDotDashArray, 2.0 * aDiscretePixel.getX());
+    const Color aLineColor(mbContrastToSelected ? rStyleSettings.GetMenuHighlightTextColor() : rStyleSettings.GetWindowTextColor());
+    const drawinglayer::attribute::LineAttribute aLineAttribute(aLineColor.getBColor());
+    const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
+        aDotDashArray, 2.0 * nFocusIndicatorWidth * aDiscretePixel.getX());
+ 
 
     xRetval[1] = Primitive2DReference(
 	    new drawinglayer::primitive2d::PolygonStrokePrimitive2D(aIndicatorPolygon, aLineAttribute, aStrokeAttribute));
 	return xRetval;
 }
 
-SdPageObjectFocusPrimitive::SdPageObjectFocusPrimitive(const basegfx::B2DRange& rRange)
-:	SdPageObjectBasePrimitive(rRange)
+SdPageObjectFocusPrimitive::SdPageObjectFocusPrimitive(const basegfx::B2DRange& rRange, const bool bContrast)
+    :	SdPageObjectBasePrimitive(rRange),
+        mbContrastToSelected(bContrast)
 {
 }
 
 		if(bCreateFocused)
 		{
 			// add focus indicator if used
-			xRetval[nInsert++] = Primitive2DReference(new SdPageObjectFocusPrimitive(aInnerRange));
+			xRetval[nInsert++] = Primitive2DReference(new SdPageObjectFocusPrimitive(aInnerRange, bCreateSelected));
 		}
 
 		return xRetval;

File sdext/source/presenter/PresenterAccessibility.cxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: PresenterPane.hxx,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sdext.hxx"
+
+#include "PresenterAccessibility.hxx"
+#include "PresenterTextView.hxx"
+#include "PresenterConfigurationAccess.hxx"
+#include "PresenterNotesView.hxx"
+#include "PresenterPaneBase.hxx"
+#include "PresenterPaneContainer.hxx"
+#include "PresenterPaneFactory.hxx"
+#include "PresenterViewFactory.hxx"
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <vcl/svapp.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/compbase5.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+
+#define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
+
+#define VERBOSE
+
+//===== PresenterAccessibleObject =============================================
+
+namespace sdext { namespace presenter {
+
+namespace {
+    typedef ::cppu::WeakComponentImplHelper5 <
+        cssa::XAccessible,
+        cssa::XAccessibleContext,
+        cssa::XAccessibleComponent,
+        cssa::XAccessibleEventBroadcaster,
+        css::awt::XWindowListener
+    > PresenterAccessibleObjectInterfaceBase;
+}
+
+class PresenterAccessible::AccessibleObject
+    : public ::cppu::BaseMutex,
+      public PresenterAccessibleObjectInterfaceBase
+{
+public:
+    AccessibleObject (
+        const css::lang::Locale aLocale,
+        const sal_Int16 nRole,
+        const ::rtl::OUString& rsName);
+    void LateInitialization (void);
+
+    virtual ~AccessibleObject (void);
+
+    virtual void SetWindow (
+        const cssu::Reference<css::awt::XWindow>& rxContentWindow,
+        const cssu::Reference<css::awt::XWindow>& rxBorderWindow);
+    void SetAccessibleParent (const cssu::Reference<cssa::XAccessible>& rxAccessibleParent);
+
+    virtual void SAL_CALL disposing (void);
+
+    void NotifyCurrentSlideChange (const sal_Int32 nCurrentSlideIndex);
+
+    void AddChild (const ::rtl::Reference<AccessibleObject>& rpChild);
+    void RemoveChild (const ::rtl::Reference<AccessibleObject>& rpChild);
+
+    void SetIsFocused (const bool bIsFocused);
+    void SetAccessibleName (const ::rtl::OUString& rsName);
+
+    void FireAccessibleEvent (
+        const sal_Int16 nEventId,
+        const cssu::Any& rOldValue,
+        const cssu::Any& rNewValue);
+    
+    void UpdateStateSet (void);
+
+    
+    //----- XAccessible -------------------------------------------------------
+
+    virtual cssu::Reference<cssa::XAccessibleContext> SAL_CALL
+        getAccessibleContext (void) 
+        throw (cssu::RuntimeException);
+
+
+    //-----  XAccessibleContext  ----------------------------------------------
+
+    virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
+        throw (cssu::RuntimeException);
+
+    virtual cssu::Reference< cssa::XAccessible> SAL_CALL
+        getAccessibleChild (sal_Int32 nIndex)
+        throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
+
+	virtual cssu::Reference< cssa::XAccessible> SAL_CALL getAccessibleParent (void)
+        throw (cssu::RuntimeException);
+
+	virtual	sal_Int32 SAL_CALL getAccessibleIndexInParent (void)
+        throw (cssu::RuntimeException);
+
+	virtual sal_Int16 SAL_CALL getAccessibleRole (void)
+        throw (cssu::RuntimeException);
+
+	virtual ::rtl::OUString SAL_CALL getAccessibleDescription (void)
+        throw (cssu::RuntimeException);
+
+	virtual ::rtl::OUString SAL_CALL getAccessibleName (void)
+        throw (cssu::RuntimeException);
+
+	virtual cssu::Reference<cssa::XAccessibleRelationSet> SAL_CALL
+    	getAccessibleRelationSet (void)
+        throw (cssu::RuntimeException);
+
+	virtual cssu::Reference<cssa::XAccessibleStateSet> SAL_CALL
+    	getAccessibleStateSet (void)
+        throw (cssu::RuntimeException);
+
+	virtual css::lang::Locale SAL_CALL getLocale (void)
+		throw (cssu::RuntimeException,
+			cssa::IllegalAccessibleComponentStateException);
+
+    
+    //-----  XAccessibleComponent  --------------------------------------------
+
+    virtual sal_Bool SAL_CALL containsPoint (
+        const css::awt::Point& aPoint) 
+        throw (cssu::RuntimeException);
+
+    virtual cssu::Reference<cssa::XAccessible> SAL_CALL 
+        getAccessibleAtPoint (
+            const css::awt::Point& aPoint) 
+        throw (cssu::RuntimeException);
+
+    virtual css::awt::Rectangle SAL_CALL getBounds (void)
+        throw (cssu::RuntimeException);
+
+    virtual css::awt::Point SAL_CALL getLocation (void) 
+        throw (cssu::RuntimeException);
+
+    virtual css::awt::Point SAL_CALL getLocationOnScreen (void) 
+        throw (cssu::RuntimeException);
+
+    virtual css::awt::Size SAL_CALL getSize (void) 
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL grabFocus (void) 
+        throw (cssu::RuntimeException);
+
+    virtual sal_Int32 SAL_CALL getForeground (void) 
+        throw (cssu::RuntimeException);
+
+    virtual sal_Int32 SAL_CALL getBackground (void) 
+        throw (cssu::RuntimeException);
+
+
+    //-----  XAccessibleEventBroadcaster --------------------------------------
+
+    virtual void SAL_CALL addEventListener (
+            const cssu::Reference<cssa::XAccessibleEventListener>& rxListener) 
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL removeEventListener ( 
+            const cssu::Reference<cssa::XAccessibleEventListener>& rxListener) 
+        throw (cssu::RuntimeException);
+
+    using PresenterAccessibleObjectInterfaceBase::addEventListener;
+    using PresenterAccessibleObjectInterfaceBase::removeEventListener;
+
+    //----- XWindowListener ---------------------------------------------------
+
+    virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
+        throw (cssu::RuntimeException);
+
+
+    //----- XEventListener ----------------------------------------------------
+
+    virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
+        throw (cssu::RuntimeException);
+
+
+protected:
+    ::rtl::OUString msName;
+    cssu::Reference<css::awt::XWindow2> mxContentWindow;
+    cssu::Reference<css::awt::XWindow2> mxBorderWindow;
+    const css::lang::Locale maLocale;
+    const sal_Int16 mnRole;
+    sal_uInt32 mnStateSet;
+    bool mbIsFocused;
+    cssu::Reference<cssa::XAccessible> mxParentAccessible;
+    ::std::vector<rtl::Reference<AccessibleObject> > maChildren;
+    ::std::vector<Reference<XAccessibleEventListener> > maListeners; 
+
+    virtual awt::Point GetRelativeLocation (void);
+    virtual awt::Size GetSize (void);
+    virtual awt::Point GetAbsoluteParentLocation (void);
+
+    virtual bool GetWindowState (const sal_Int16 nType) const;
+    
+    void UpdateState (const sal_Int16 aState, const bool bValue);
+
+    sal_Bool IsDisposed (void) const;
+
+    void ThrowIfDisposed (void) const
+        throw (css::lang::DisposedException);
+
+    enum ExceptionType { ET_Runtime, ET_Disposed, ET_IndexOutOfBounds };
+    void ThrowException (const sal_Char* pMessage, const ExceptionType eExceptionType) const;
+};
+
+
+
+
+//===== AccessibleStateSet ====================================================
+
+namespace {
+typedef ::cppu::WeakComponentImplHelper1 <
+    cssa::XAccessibleStateSet
+    > AccessibleStateSetInterfaceBase;
+}
+
+class AccessibleStateSet
+    : public ::cppu::BaseMutex,
+      public AccessibleStateSetInterfaceBase
+{
+public:
+    AccessibleStateSet (const sal_Int32 nStateSet);
+    virtual ~AccessibleStateSet (void);
+
+    static sal_uInt32 GetStateMask (const sal_Int16 nType);
+
+    //----- XAccessibleStateSet -----------------------------------------------
+
+    virtual sal_Bool SAL_CALL isEmpty (void)
+        throw (cssu::RuntimeException);
+
+    virtual sal_Bool SAL_CALL contains (sal_Int16 nState)
+        throw (cssu::RuntimeException);
+
+    virtual sal_Bool SAL_CALL containsAll (const cssu::Sequence<sal_Int16>& rStateSet)
+        throw (cssu::RuntimeException);
+
+    virtual cssu::Sequence<sal_Int16> SAL_CALL getStates (void)
+        throw (cssu::RuntimeException);
+
+private:
+    const sal_Int32 mnStateSet;
+};
+
+
+
+
+//===== AccessibleRelationSet =================================================
+
+namespace {
+typedef ::cppu::WeakComponentImplHelper1 <
+    cssa::XAccessibleRelationSet
+    > AccessibleRelationSetInterfaceBase;
+}
+
+class AccessibleRelationSet
+    : public ::cppu::BaseMutex,
+      public AccessibleRelationSetInterfaceBase
+{
+public:
+    AccessibleRelationSet (void);
+    virtual ~AccessibleRelationSet (void);
+
+    void AddRelation (
+        const sal_Int16 nRelationType,
+        const Reference<XInterface>& rxObject);
+
+
+    //----- XAccessibleRelationSet --------------------------------------------
+
+    virtual sal_Int32 SAL_CALL getRelationCount (void)
+        throw (cssu::RuntimeException);
+
+    virtual AccessibleRelation SAL_CALL getRelation (sal_Int32 nIndex)
+        throw (cssu::RuntimeException, css::lang::IndexOutOfBoundsException);
+
+    virtual sal_Bool SAL_CALL containsRelation (sal_Int16 nRelationType)
+        throw (cssu::RuntimeException);
+
+    virtual AccessibleRelation SAL_CALL getRelationByType (sal_Int16 nRelationType)
+        throw (cssu::RuntimeException);
+
+private:
+    ::std::vector<AccessibleRelation> maRelations;
+};
+
+
+
+
+//===== PresenterAccessibleParagraph ==========================================
+
+namespace {
+typedef ::cppu::ImplInheritanceHelper1 <
+    PresenterAccessible::AccessibleObject,
+    cssa::XAccessibleText
+    > PresenterAccessibleParagraphInterfaceBase;
+}
+
+
+
+
+class PresenterAccessible::AccessibleParagraph
+    : public PresenterAccessibleParagraphInterfaceBase
+{
+public:
+    AccessibleParagraph (
+        const css::lang::Locale aLocale,
+        const sal_Int16 nRole,
+        const ::rtl::OUString& rsName,
+        const SharedPresenterTextParagraph& rpParagraph,
+        const sal_Int32 nParagraphIndex);
+
+    virtual ~AccessibleParagraph (void);
+
+
+    //----- XAccessibleContext ------------------------------------------------
+
+	virtual cssu::Reference<cssa::XAccessibleRelationSet> SAL_CALL
+    	getAccessibleRelationSet (void)
+        throw (cssu::RuntimeException);
+
+    
+    //----- XAccessibleText ---------------------------------------------------
+    
+    virtual sal_Int32 SAL_CALL getCaretPosition (void)
+        throw (cssu::RuntimeException);
+    
+    virtual sal_Bool SAL_CALL setCaretPosition (sal_Int32 nIndex)
+        throw (::com::sun::star::lang::IndexOutOfBoundsException, cssu::RuntimeException);
+    
+    virtual sal_Unicode SAL_CALL getCharacter (sal_Int32 nIndex)
+        throw (::com::sun::star::lang::IndexOutOfBoundsException, cssu::RuntimeException);
+    
+    virtual cssu::Sequence<css::beans::PropertyValue> SAL_CALL
+        getCharacterAttributes (
+            ::sal_Int32 nIndex,
+            const cssu::Sequence<rtl::OUString>& rRequestedAttributes)
+        throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
+    
+    virtual css::awt::Rectangle SAL_CALL getCharacterBounds (sal_Int32 nIndex)
+        throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
+    
+    virtual sal_Int32 SAL_CALL getCharacterCount (void)
+        throw (cssu::RuntimeException);
+    
+    virtual sal_Int32 SAL_CALL getIndexAtPoint (const css::awt::Point& rPoint)
+        throw (cssu::RuntimeException);
+    
+    virtual ::rtl::OUString SAL_CALL getSelectedText (void)
+        throw (cssu::RuntimeException);
+    
+    virtual sal_Int32 SAL_CALL getSelectionStart (void)
+        throw (cssu::RuntimeException);
+
+    virtual sal_Int32 SAL_CALL getSelectionEnd (void)
+        throw (cssu::RuntimeException);
+    
+    virtual sal_Bool SAL_CALL setSelection (sal_Int32 nStartIndex, sal_Int32 nEndIndex)
+        throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
+
+    virtual ::rtl::OUString SAL_CALL getText (void)
+        throw (cssu::RuntimeException);
+    
+    virtual ::rtl::OUString SAL_CALL getTextRange (
+        sal_Int32 nStartIndex,
+        sal_Int32 nEndIndex)
+        throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
+    
+    virtual cssa::TextSegment SAL_CALL getTextAtIndex (
+        sal_Int32 nIndex,
+        sal_Int16 nTextType)
+        throw (css::lang::IndexOutOfBoundsException,
+            css::lang::IllegalArgumentException,
+            cssu::RuntimeException);
+    
+    virtual cssa::TextSegment SAL_CALL getTextBeforeIndex (
+        sal_Int32 nIndex,
+        sal_Int16 nTextType)
+        throw (css::lang::IndexOutOfBoundsException,
+            css::lang::IllegalArgumentException,
+            cssu::RuntimeException);
+    
+    virtual cssa::TextSegment SAL_CALL getTextBehindIndex (
+        sal_Int32 nIndex,
+        sal_Int16 nTextType)
+        throw (css::lang::IndexOutOfBoundsException,
+            css::lang::IllegalArgumentException,
+            cssu::RuntimeException);
+    
+    virtual ::sal_Bool SAL_CALL copyText (sal_Int32 nStartIndex, sal_Int32 nEndIndex)
+        throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
+
+
+protected:
+    virtual awt::Point GetRelativeLocation (void);
+    virtual awt::Size GetSize (void);
+    virtual awt::Point GetAbsoluteParentLocation (void);
+    virtual bool GetWindowState (const sal_Int16 nType) const;
+
+private:
+    SharedPresenterTextParagraph mpParagraph;
+    const sal_Int32 mnParagraphIndex;
+};
+
+
+
+
+//===== AccessibleConsole =====================================================
+
+class AccessibleConsole
+{
+public:
+    static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
+        const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+        const lang::Locale aLocale)
+    {
+        OUString sName (A2S("Presenter Console"));
+        PresenterConfigurationAccess aConfiguration (
+            rxContext,
+            OUString::createFromAscii("/org.openoffice.Office.extension.PresenterScreen/"),
+            PresenterConfigurationAccess::READ_ONLY);
+        aConfiguration.GetConfigurationNode(A2S("Presenter/Accessibility/Console/String"))
+            >>= sName;
+
+        rtl::Reference<PresenterAccessible::AccessibleObject> pObject (
+            new PresenterAccessible::AccessibleObject(
+                aLocale, AccessibleRole::PANEL, sName));
+        pObject->LateInitialization();
+        pObject->UpdateStateSet();
+
+        return pObject;
+    }
+};
+
+
+
+
+//===== AccessiblePreview =====================================================
+
+class AccessiblePreview
+{
+public:
+    static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
+        const Reference<css::uno::XComponentContext>& rxContext,
+        const lang::Locale aLocale,
+        const Reference<awt::XWindow>& rxContentWindow,
+        const Reference<awt::XWindow>& rxBorderWindow)
+    {
+        OUString sName (A2S("Presenter Notes Window"));
+        {
+            PresenterConfigurationAccess aConfiguration (
+                rxContext,
+                OUString::createFromAscii("/org.openoffice.Office.extension.PresenterScreen/"),
+                PresenterConfigurationAccess::READ_ONLY);
+            aConfiguration.GetConfigurationNode(A2S("Presenter/Accessibility/Preview/String"))
+                >>= sName;
+        }
+        
+        rtl::Reference<PresenterAccessible::AccessibleObject> pObject (
+            new PresenterAccessible::AccessibleObject(
+                aLocale,
+                AccessibleRole::LABEL,
+                sName));
+        pObject->LateInitialization();
+        pObject->UpdateStateSet();
+        pObject->SetWindow(rxContentWindow, rxBorderWindow);
+
+        return pObject;
+    }
+};
+
+
+
+
+//===== AccessibleNotes =======================================================
+
+class AccessibleNotes : public PresenterAccessible::AccessibleObject
+{
+public:
+    AccessibleNotes (
+        const css::lang::Locale aLocale,
+        const sal_Int16 nRole,
+        const ::rtl::OUString& rsName);
+    
+
+    static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
+        const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+        const lang::Locale aLocale,
+        const Reference<awt::XWindow>& rxContentWindow,
+        const Reference<awt::XWindow>& rxBorderWindow,
+        const ::boost::shared_ptr<PresenterTextView>& rpTextView);
+    
+    void SetTextView (const ::boost::shared_ptr<PresenterTextView>& rpTextView);
+
+    virtual void SetWindow (
+        const cssu::Reference<css::awt::XWindow>& rxContentWindow,
+        const cssu::Reference<css::awt::XWindow>& rxBorderWindow);
+
+private:
+    ::boost::shared_ptr<PresenterTextView> mpTextView;
+
+    void NotifyCaretChange (
+        const sal_Int32 nOldParagraphIndex,
+        const sal_Int32 nOldCharacterIndex,
+        const sal_Int32 nNewParagraphIndex,
+        const sal_Int32 nNewCharacterIndex);
+    void HandleTextChange (void);
+};
+
+
+
+
+//===== AccessibleFocusManager ================================================
+
+/** A singleton class that makes sure that only one accessibility object in
+    the PresenterConsole hierarchy has the focus.
+*/
+class AccessibleFocusManager
+{
+public:
+    static ::boost::shared_ptr<AccessibleFocusManager> Instance (void);
+
+    void AddFocusableObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
+    void RemoveFocusableObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
+
+    void FocusObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
+
+private:
+    static ::boost::shared_ptr<AccessibleFocusManager> mpInstance;
+    ::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> > maFocusableObjects;
+
+    AccessibleFocusManager (void);
+};
+
+
+
+
+//===== PresenterAccessible ===================================================
+
+PresenterAccessible::PresenterAccessible (
+    const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+    const ::rtl::Reference<PresenterController>& rpPresenterController,
+    const Reference<drawing::framework::XPane>& rxMainPane)
+    : PresenterAccessibleInterfaceBase(m_aMutex),
+      mxComponentContext(rxContext),
+      mpPresenterController(rpPresenterController),
+      mxMainPaneId(rxMainPane.is() ? rxMainPane->getResourceId() : Reference<XResourceId>()),
+      mxMainPane(rxMainPane, UNO_QUERY),
+      mxMainWindow(),
+      mxPreviewContentWindow(),
+      mxPreviewBorderWindow(),
+      mxNotesContentWindow(),
+      mxNotesBorderWindow(),
+      mpAccessibleConsole(),
+      mpAccessiblePreview(),
+      mpAccessibleNotes(),
+      mxAccessibleParent()
+{
+    if (mxMainPane.is())
+        mxMainPane->setAccessible(this);
+}
+
+
+
+
+PresenterAccessible::~PresenterAccessible (void)
+{
+}
+
+
+
+
+PresenterPaneContainer::SharedPaneDescriptor PresenterAccessible::GetPreviewPane (void) const
+{
+    PresenterPaneContainer::SharedPaneDescriptor pPreviewPane;
+
+    if ( ! mpPresenterController.is())
+        return pPreviewPane;
+    
+    rtl::Reference<PresenterPaneContainer> pContainer (mpPresenterController->GetPaneContainer());
+    if ( ! pContainer.is())
+        return pPreviewPane;
+    
+    pPreviewPane = pContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL);
+    Reference<drawing::framework::XPane> xPreviewPane;
+    if (pPreviewPane)
+        xPreviewPane = pPreviewPane->mxPane.get();
+    if ( ! xPreviewPane.is())
+    {
+        pPreviewPane = pContainer->FindPaneURL(PresenterPaneFactory::msSlideSorterPaneURL);
+    }
+    return pPreviewPane;
+}
+
+
+
+
+void PresenterAccessible::UpdateAccessibilityHierarchy (void)
+{
+    if ( ! mpPresenterController.is())
+        return;
+
+    Reference<drawing::framework::XConfigurationController> xConfigurationController(
+        mpPresenterController->GetConfigurationController());
+    if ( ! xConfigurationController.is())
+        return;
+
+    rtl::Reference<PresenterPaneContainer> pPaneContainer (
+        mpPresenterController->GetPaneContainer());
+    if ( ! pPaneContainer.is())
+        return;
+
+    if ( ! mpAccessibleConsole.is())
+        return;
+
+    // Get the preview pane (standard or notes view) or the slide overview
+    // pane.
+    PresenterPaneContainer::SharedPaneDescriptor pPreviewPane(GetPreviewPane());
+    Reference<drawing::framework::XPane> xPreviewPane;
+    if (pPreviewPane)
+        xPreviewPane = pPreviewPane->mxPane.get();
+    
+    // Get the notes pane.
+    PresenterPaneContainer::SharedPaneDescriptor pNotesPane(
+        pPaneContainer->FindPaneURL(PresenterPaneFactory::msNotesPaneURL));
+    Reference<drawing::framework::XPane> xNotesPane;
+    if (pNotesPane)
+        xNotesPane = pNotesPane->mxPane.get();
+
+    // Get the notes view.
+    Reference<drawing::framework::XView> xNotesView;
+    if (pNotesPane)
+        xNotesView = pNotesPane->mxView;
+    rtl::Reference<PresenterNotesView> pNotesView (
+        dynamic_cast<PresenterNotesView*>(xNotesView.get()));
+
+    UpdateAccessibilityHierarchy(
+        pPreviewPane ? pPreviewPane->mxContentWindow : Reference<awt::XWindow>(),
+        pPreviewPane ? pPreviewPane->mxBorderWindow : Reference<awt::XWindow>(),
+        (pPreviewPane&&pPreviewPane->mxPane.is()) ? pPreviewPane->mxPane->GetTitle() : OUString(),
+        pNotesPane ? pNotesPane->mxContentWindow : Reference<awt::XWindow>(),
+        pNotesPane ? pNotesPane->mxBorderWindow : Reference<awt::XWindow>(),
+        pNotesView.is()
+            ? pNotesView->GetTextView()
+            : ::boost::shared_ptr<PresenterTextView>());
+}
+
+
+
+
+
+void PresenterAccessible::UpdateAccessibilityHierarchy (
+    const Reference<awt::XWindow>& rxPreviewContentWindow,
+    const Reference<awt::XWindow>& rxPreviewBorderWindow,
+    const ::rtl::OUString& rsTitle,
+    const Reference<awt::XWindow>& rxNotesContentWindow,
+    const Reference<awt::XWindow>& rxNotesBorderWindow,
+    const ::boost::shared_ptr<PresenterTextView>& rpNotesTextView)
+{
+    if ( ! mpAccessibleConsole.is())
+        return;
+
+    if (mxPreviewContentWindow != rxPreviewContentWindow)
+    {
+        if (mpAccessiblePreview.is())
+        {
+            mpAccessibleConsole->RemoveChild(mpAccessiblePreview);
+            mpAccessiblePreview = NULL;
+        }
+
+        mxPreviewContentWindow = rxPreviewContentWindow;
+        mxPreviewBorderWindow = rxPreviewBorderWindow;
+
+        if (mxPreviewContentWindow.is())
+        {
+            mpAccessiblePreview = AccessiblePreview::Create(
+                mxComponentContext,
+                lang::Locale(),
+                mxPreviewContentWindow,
+                mxPreviewBorderWindow);
+            mpAccessibleConsole->AddChild(mpAccessiblePreview);
+            mpAccessiblePreview->SetAccessibleName(rsTitle);
+        }
+    }
+
+    if (mxNotesContentWindow != rxNotesContentWindow)
+    {
+        if (mpAccessibleNotes.is())
+        {
+            mpAccessibleConsole->RemoveChild(mpAccessibleConsole.get());
+            mpAccessibleNotes = NULL;
+        }
+
+        mxNotesContentWindow = rxNotesContentWindow;
+        mxNotesBorderWindow = rxNotesBorderWindow;
+
+        if (mxNotesContentWindow.is())
+        {
+            mpAccessibleNotes = AccessibleNotes::Create(
+                mxComponentContext,
+                lang::Locale(),
+                mxNotesContentWindow,
+                mxNotesBorderWindow,
+                rpNotesTextView);
+            mpAccessibleConsole->AddChild(mpAccessibleNotes.get());
+        }
+    }
+}
+
+
+
+
+void PresenterAccessible::NotifyCurrentSlideChange (
+    const sal_Int32 nCurrentSlideIndex,
+    const sal_Int32 nSlideCount)
+{
+    (void)nCurrentSlideIndex;
+    (void)nSlideCount;
+
+    if (mpAccessiblePreview.is())
+    {
+        PresenterPaneContainer::SharedPaneDescriptor pPreviewPane (GetPreviewPane());
+        mpAccessiblePreview->SetAccessibleName(
+            (pPreviewPane&&pPreviewPane->mxPane.is()
+                ? pPreviewPane->mxPane->GetTitle()
+                : rtl::OUString()));
+    }
+
+    // Play some focus ping-pong to trigger AT tools.
+    //AccessibleFocusManager::Instance()->FocusObject(mpAccessibleConsole);
+    AccessibleFocusManager::Instance()->FocusObject(mpAccessiblePreview);
+}
+
+
+
+
+bool PresenterAccessible::IsAccessibilityActive (void) const
+{
+    return mpAccessibleConsole.is();
+}
+
+
+
+
+void SAL_CALL PresenterAccessible::disposing (void)
+{
+    UpdateAccessibilityHierarchy(
+        NULL,
+        NULL,
+        OUString(),
+        NULL,
+        NULL,
+        ::boost::shared_ptr<PresenterTextView>());
+
+    if (mxMainWindow.is())
+    {
+        mxMainWindow->removeFocusListener(this);
+
+        if (mxMainPane.is())
+            mxMainPane->setAccessible(NULL);
+    }
+    
+    mpAccessiblePreview = NULL;
+    mpAccessibleNotes = NULL;
+    mpAccessibleConsole = NULL;
+}
+
+
+
+
+//----- XAccessible -----------------------------------------------------------
+
+Reference<XAccessibleContext> SAL_CALL PresenterAccessible::getAccessibleContext (void) 
+    throw (cssu::RuntimeException)
+{
+    if ( ! mpAccessibleConsole.is())
+    {
+        Reference<XPane> xMainPane (mxMainPane, UNO_QUERY);
+        if (xMainPane.is())
+        {
+            mxMainWindow = Reference<awt::XWindow>(xMainPane->getWindow(), UNO_QUERY);
+            mxMainWindow->addFocusListener(this);
+        }
+        mpAccessibleConsole = AccessibleConsole::Create(
+            mxComponentContext, css::lang::Locale());
+        mpAccessibleConsole->SetWindow(mxMainWindow, NULL);
+        mpAccessibleConsole->SetAccessibleParent(mxAccessibleParent);
+        UpdateAccessibilityHierarchy();
+        if (mpPresenterController.is())
+            mpPresenterController->SetAccessibilityActiveState(true);
+    }
+    return mpAccessibleConsole->getAccessibleContext();
+}
+
+
+
+
+
+//----- XFocusListener ----------------------------------------------------
+
+void SAL_CALL PresenterAccessible::focusGained (const css::awt::FocusEvent& rEvent)
+        throw (cssu::RuntimeException)
+{
+    (void)rEvent;
+
+#ifdef VERBOSE
+    OSL_TRACE("PresenterAccessible::focusGained at %x and window %x\r", this,
+        mxMainWindow.get());
+#endif
+    
+    AccessibleFocusManager::Instance()->FocusObject(mpAccessibleConsole);
+}
+
+
+
+
+void SAL_CALL PresenterAccessible::focusLost (const css::awt::FocusEvent& rEvent)
+    throw (cssu::RuntimeException)
+{
+    (void)rEvent;
+
+#ifdef VERBOSE
+    OSL_TRACE("PresenterAccessible::focusLost at %x\r", this);
+#endif
+    
+    AccessibleFocusManager::Instance()->FocusObject(NULL);
+}
+
+
+
+
+//----- XEventListener ----------------------------------------------------
+
+void SAL_CALL PresenterAccessible::disposing (const css::lang::EventObject& rEvent)
+    throw (cssu::RuntimeException)
+{
+    if (rEvent.Source == mxMainWindow)
+        mxMainWindow = NULL;
+}
+
+
+
+
+//----- XInitialize -----------------------------------------------------------
+
+void SAL_CALL PresenterAccessible::initialize (const cssu::Sequence<cssu::Any>& rArguments)
+    throw (cssu::RuntimeException)
+{
+    if (rArguments.getLength() >= 1)
+    {
+        mxAccessibleParent = Reference<XAccessible>(rArguments[0], UNO_QUERY);
+        if (mpAccessibleConsole.is())
+            mpAccessibleConsole->SetAccessibleParent(mxAccessibleParent);
+    }
+}
+
+
+
+
+//===== PresenterAccessible::AccessibleObject =========================================
+
+PresenterAccessible::AccessibleObject::AccessibleObject (
+    const lang::Locale aLocale,
+    const sal_Int16 nRole,
+    const OUString& rsName)
+    : PresenterAccessibleObjectInterfaceBase(m_aMutex),
+      msName(rsName),
+      mxContentWindow(),
+      mxBorderWindow(),
+      maLocale(aLocale),
+      mnRole(nRole),
+      mnStateSet(0),
+      mbIsFocused(false),
+      mxParentAccessible(),
+      maChildren(),
+      maListeners()
+{
+}
+
+
+
+
+void PresenterAccessible::AccessibleObject::LateInitialization (void)
+{
+    AccessibleFocusManager::Instance()->AddFocusableObject(this);
+}
+
+
+
+
+PresenterAccessible::AccessibleObject::~AccessibleObject (void)
+{
+}
+
+
+
+
+void PresenterAccessible::AccessibleObject::SetWindow (
+    const Reference<awt::XWindow>& rxContentWindow,
+    const Reference<awt::XWindow>& rxBorderWindow)
+{
+    Reference<awt::XWindow2> xContentWindow (rxContentWindow, UNO_QUERY);
+
+    if (mxContentWindow.get() != xContentWindow.get())
+    {
+        if (mxContentWindow.is())
+        {
+            mxContentWindow->removeWindowListener(this);
+        }
+        
+        mxContentWindow = xContentWindow;
+        mxBorderWindow = Reference<awt::XWindow2>(rxBorderWindow, UNO_QUERY);
+
+        if (mxContentWindow.is())
+        {
+            mxContentWindow->addWindowListener(this);
+        }
+
+        UpdateStateSet();
+    }
+}
+
+
+
+