diff options
author | Steve Yin <steve_y@apache.org> | 2013-11-25 16:15:58 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-11-25 16:52:36 +0000 |
commit | b755fb8c0f6b1282f62c12f378c0a5ecac64d490 (patch) | |
tree | 4e6df42c862fe4eafef3f52267797e811bac59e0 /svtools/source/control/ruler.cxx | |
parent | 74bf915fb48c660bd1e3a04bec6c3a20c754b6af (diff) |
Integrate branch of IAccessible2
Change-Id: I3b5936bb92bb258f9e9e76402dd2b55f29aa686a
Diffstat (limited to 'svtools/source/control/ruler.cxx')
-rw-r--r-- | svtools/source/control/ruler.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index f6808a22df1e..6b74fdcde375 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -24,11 +24,18 @@ #include <vcl/i18nhelp.hxx> #include <svtools/ruler.hxx> +#include <svtools/svtresid.hxx> +#include <svtools/svtools.hrc> #include <boost/scoped_array.hpp> #include <vector> using namespace std; +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::accessibility; #define RULER_OFF 3 #define RULER_TEXTOFF 5 @@ -271,6 +278,7 @@ void Ruler::ImplInit( WinBits nWinBits ) aDefSize.Width() = nDefHeight; SetOutputSizePixel( aDefSize ); SetType(WINDOW_RULER); + pAccContext = NULL; } Ruler::Ruler( Window* pParent, WinBits nWinStyle ) : @@ -290,6 +298,8 @@ Ruler::~Ruler() Application::RemoveUserEvent( mnUpdateEvtId ); delete mpSaveData; delete mpDragData; + if( pAccContext ) + pAccContext->release(); } void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 ) @@ -2793,4 +2803,31 @@ void Ruler::DrawTicks() Paint(Rectangle()); } +uno::Reference< XAccessible > Ruler::CreateAccessible() +{ + Window* pParent = GetAccessibleParentWindow(); + OSL_ENSURE( pParent, "-SvxRuler::CreateAccessible(): No Parent!" ); + uno::Reference< XAccessible > xAccParent = pParent->GetAccessible(); + if( xAccParent.is() ) + { + // MT: Fixed compiler issue because the address from a temporary object was used. + // BUT: Shoudl it really be a Pointer, instead of const&??? + OUString aStr; + if ( mnWinStyle & WB_HORZ ) + { + aStr = SvtResId(STR_SVT_ACC_RULER_HORZ_NAME); + } + else + { + aStr = SvtResId(STR_SVT_ACC_RULER_VERT_NAME); + } + pAccContext = new SvtRulerAccessible( xAccParent, *this, aStr ); + pAccContext->acquire(); + this->SetAccessible(pAccContext); + return pAccContext; + } + else + return uno::Reference< XAccessible >(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |