Properly encapsulate svt::TextWindowPeer
Change-Id: Iffa67c345a03852ad7872031b4c5a87e223ffcad
This commit is contained in:
@@ -2102,7 +2102,7 @@ EditorWindow::GetComponentInterface(sal_Bool bCreate)
|
|||||||
if (!pEditEngine)
|
if (!pEditEngine)
|
||||||
CreateEditEngine();
|
CreateEditEngine();
|
||||||
|
|
||||||
xPeer = new ::svt::TextWindowPeer(*GetEditView());
|
xPeer = svt::createTextWindowPeer(*GetEditView());
|
||||||
SetComponentInterface(xPeer);
|
SetComponentInterface(xPeer);
|
||||||
}
|
}
|
||||||
return xPeer;
|
return xPeer;
|
||||||
|
@@ -20,45 +20,24 @@
|
|||||||
#ifndef INCLUDED_SVTOOLS_TEXTWINDOWPEER_HXX
|
#ifndef INCLUDED_SVTOOLS_TEXTWINDOWPEER_HXX
|
||||||
#define INCLUDED_SVTOOLS_TEXTWINDOWPEER_HXX
|
#define INCLUDED_SVTOOLS_TEXTWINDOWPEER_HXX
|
||||||
|
|
||||||
|
#include <sal/config.h>
|
||||||
|
|
||||||
|
#include <com/sun/star/uno/Reference.hxx>
|
||||||
|
#include <sal/types.h>
|
||||||
#include <svtools/svtdllapi.h>
|
#include <svtools/svtdllapi.h>
|
||||||
#include <toolkit/awt/vclxwindow.hxx>
|
|
||||||
|
|
||||||
#include <memory>
|
namespace com { namespace sun { namespace star { namespace awt {
|
||||||
|
class XWindowPeer;
|
||||||
class TextEngine;
|
} } } }
|
||||||
class TextView;
|
class TextView;
|
||||||
|
|
||||||
namespace svt
|
namespace svt {
|
||||||
{
|
|
||||||
class AccessibleFactoryAccess ;
|
|
||||||
|
|
||||||
class TextWindowPeer: public ::VCLXWindow
|
css::uno::Reference<css::awt::XWindowPeer> SVT_DLLPUBLIC createTextWindowPeer(
|
||||||
{
|
TextView & view);
|
||||||
public:
|
|
||||||
SVT_DLLPUBLIC TextWindowPeer(::TextView & rView);
|
|
||||||
|
|
||||||
virtual ~TextWindowPeer();
|
|
||||||
|
|
||||||
private:
|
|
||||||
// VCLXWindow inherits funny copy constructor and assignment operator from
|
|
||||||
// ::cppu::OWeakObject, so override them here:
|
|
||||||
|
|
||||||
TextWindowPeer(TextWindowPeer &); // not implemented
|
|
||||||
|
|
||||||
void operator =(TextWindowPeer); // not implemented
|
|
||||||
|
|
||||||
virtual ::com::sun::star::uno::Reference<
|
|
||||||
::com::sun::star::accessibility::XAccessibleContext >
|
|
||||||
CreateAccessibleContext();
|
|
||||||
|
|
||||||
::TextEngine & m_rEngine;
|
|
||||||
::TextView & m_rView;
|
|
||||||
|
|
||||||
::std::auto_ptr< ::svt::AccessibleFactoryAccess > m_pFactoryAccess;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // INCLUDED_SVTOOLS_TEXTWINDOWPEER_HXX
|
#endif
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -17,31 +17,55 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sal/config.h>
|
||||||
|
|
||||||
|
#include <svtaccessiblefactory.hxx>
|
||||||
|
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
|
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
|
||||||
|
#include <com/sun/star/awt/XWindowPeer.hpp>
|
||||||
|
#include <com/sun/star/uno/Reference.hxx>
|
||||||
|
#include <sal/types.h>
|
||||||
#include <svtools/textwindowpeer.hxx>
|
#include <svtools/textwindowpeer.hxx>
|
||||||
|
#include <toolkit/awt/vclxwindow.hxx>
|
||||||
|
#include <vcl/texteng.hxx>
|
||||||
#include <vcl/textview.hxx>
|
#include <vcl/textview.hxx>
|
||||||
#include "svtaccessiblefactory.hxx"
|
|
||||||
|
|
||||||
namespace svt
|
namespace {
|
||||||
|
|
||||||
|
class TextWindowPeer: public VCLXWindow, private boost::noncopyable {
|
||||||
|
public:
|
||||||
|
explicit TextWindowPeer(TextView & view);
|
||||||
|
|
||||||
|
virtual ~TextWindowPeer() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual css::uno::Reference<css::accessibility::XAccessibleContext>
|
||||||
|
CreateAccessibleContext();
|
||||||
|
|
||||||
|
TextEngine & m_rEngine;
|
||||||
|
TextView & m_rView;
|
||||||
|
svt::AccessibleFactoryAccess m_aFactoryAccess;
|
||||||
|
};
|
||||||
|
|
||||||
|
TextWindowPeer::TextWindowPeer(TextView & view):
|
||||||
|
m_rEngine(*view.GetTextEngine()), m_rView(view)
|
||||||
{
|
{
|
||||||
TextWindowPeer::TextWindowPeer(::TextView & rView):
|
SetWindow(view.GetWindow());
|
||||||
m_rEngine(*rView.GetTextEngine()), m_rView(rView)
|
}
|
||||||
{
|
|
||||||
SetWindow(rView.GetWindow());
|
|
||||||
m_pFactoryAccess.reset( new AccessibleFactoryAccess );
|
|
||||||
}
|
|
||||||
|
|
||||||
// virtual
|
css::uno::Reference<css::accessibility::XAccessibleContext>
|
||||||
TextWindowPeer::~TextWindowPeer()
|
TextWindowPeer::CreateAccessibleContext() {
|
||||||
{
|
return m_aFactoryAccess.getFactory().createAccessibleTextWindowContext(
|
||||||
}
|
this, m_rEngine, m_rView);
|
||||||
|
}
|
||||||
|
|
||||||
css::uno::Reference< css::accessibility::XAccessibleContext > TextWindowPeer::CreateAccessibleContext()
|
}
|
||||||
{
|
|
||||||
return m_pFactoryAccess->getFactory().createAccessibleTextWindowContext(
|
css::uno::Reference<css::awt::XWindowPeer> svt::createTextWindowPeer(
|
||||||
this, m_rEngine, m_rView
|
TextView & view)
|
||||||
);
|
{
|
||||||
}
|
return new TextWindowPeer(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user