Kaydet (Commit) 0d172a80 authored tarafından Noel Grandin's avatar Noel Grandin

use rtl::Reference in SmGraphicWindow

instead of storing both a raw pointer and an uno::Reference

Change-Id: Ib84809bee35c01fb590439174740d92bf4cd54bd
üst f025255b
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <memory> #include <memory>
#include <rtl/ref.hxx>
#include <sfx2/dockwin.hxx> #include <sfx2/dockwin.hxx>
#include <sfx2/viewsh.hxx> #include <sfx2/viewsh.hxx>
#include <svtools/scrwin.hxx> #include <svtools/scrwin.hxx>
...@@ -72,8 +73,7 @@ protected: ...@@ -72,8 +73,7 @@ protected:
bool IsInlineEditEnabled() const; bool IsInlineEditEnabled() const;
private: private:
css::uno::Reference<css::accessibility::XAccessible> xAccessible; rtl::Reference<SmGraphicAccessible> mxAccessible;
SmGraphicAccessible* pAccessible;
SmViewShell* pViewShell; SmViewShell* pViewShell;
sal_uInt16 nZoom; sal_uInt16 nZoom;
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
using Window::GetAccessible; using Window::GetAccessible;
SmGraphicAccessible* GetAccessible_Impl() SmGraphicAccessible* GetAccessible_Impl()
{ {
return pAccessible; return mxAccessible.get();
} }
}; };
......
...@@ -95,7 +95,6 @@ using namespace css::uno; ...@@ -95,7 +95,6 @@ using namespace css::uno;
SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell) SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell)
: ScrollableWindow(&pShell->GetViewFrame()->GetWindow()) : ScrollableWindow(&pShell->GetViewFrame()->GetWindow())
, pAccessible(nullptr)
, pViewShell(pShell) , pViewShell(pShell)
, nZoom(100) , nZoom(100)
{ {
...@@ -122,10 +121,8 @@ SmGraphicWindow::~SmGraphicWindow() ...@@ -122,10 +121,8 @@ SmGraphicWindow::~SmGraphicWindow()
void SmGraphicWindow::dispose() void SmGraphicWindow::dispose()
{ {
if (pAccessible) if (mxAccessible.is())
pAccessible->ClearWin(); // make Accessible defunctional mxAccessible->ClearWin(); // make Accessible defunctional
// Note: memory for pAccessible will be freed when the reference
// xAccessible is released.
CaretBlinkStop(); CaretBlinkStop();
ScrollableWindow::dispose(); ScrollableWindow::dispose();
} }
...@@ -235,12 +232,12 @@ void SmGraphicWindow::GetFocus() ...@@ -235,12 +232,12 @@ void SmGraphicWindow::GetFocus()
void SmGraphicWindow::LoseFocus() void SmGraphicWindow::LoseFocus()
{ {
ScrollableWindow::LoseFocus(); ScrollableWindow::LoseFocus();
if (xAccessible.is()) if (mxAccessible.is())
{ {
uno::Any aOldValue, aNewValue; uno::Any aOldValue, aNewValue;
aOldValue <<= AccessibleStateType::FOCUSED; aOldValue <<= AccessibleStateType::FOCUSED;
// aNewValue remains empty // aNewValue remains empty
pAccessible->LaunchEvent( AccessibleEventId::STATE_CHANGED, mxAccessible->LaunchEvent( AccessibleEventId::STATE_CHANGED,
aOldValue, aNewValue ); aOldValue, aNewValue );
} }
if (!IsInlineEditEnabled()) if (!IsInlineEditEnabled())
...@@ -614,12 +611,11 @@ void SmGraphicWindow::ZoomToFitInWindow() ...@@ -614,12 +611,11 @@ void SmGraphicWindow::ZoomToFitInWindow()
uno::Reference< XAccessible > SmGraphicWindow::CreateAccessible() uno::Reference< XAccessible > SmGraphicWindow::CreateAccessible()
{ {
if (!pAccessible) if (!mxAccessible.is())
{ {
pAccessible = new SmGraphicAccessible( this ); mxAccessible = new SmGraphicAccessible( this );
xAccessible = pAccessible;
} }
return xAccessible; return mxAccessible.get();
} }
/**************************************************************************/ /**************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment