[Libreoffice-commits] core.git: starmath/inc starmath/source

Takeshi Abe tabe at fixedpoint.jp
Mon Jun 1 00:38:51 PDT 2015


 starmath/inc/edit.hxx    |    5 ++---
 starmath/source/edit.cxx |   27 +++++++++++----------------
 2 files changed, 13 insertions(+), 19 deletions(-)

New commits:
commit 8c5471c3a625c42523b144cf8d1dddf75f4a2746
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri May 29 20:20:29 2015 +0900

    tdf#91053 cleanup bogus member ...
    
    This replaces pAccessible/xAccesible with a rtl::Reference<<SmEditAccessible>.
    
    Change-Id: I7d00acd75fc9598cb7a5ad57357de36877275ad6
    Reviewed-on: https://gerrit.libreoffice.org/15987
    Tested-by: Jenkins <ci at libreoffice.org>
    Tested-by: David Tardon <dtardon at redhat.com>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index 485ca0c..ca3f95c 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -44,8 +44,7 @@ void SmGetLeftSelectionPart(const ESelection &rSelection, sal_Int32 &nPara, sal_
 
 class SmEditWindow : public vcl::Window, public DropTargetHelper
 {
-    css::uno::Reference<css::accessibility::XAccessible> xAccessible;
-    SmEditAccessible* pAccessible;
+    rtl::Reference<SmEditAccessible> mxAccessible;
 
     SmCmdBoxWindow& rCmdBox;
     std::unique_ptr<EditView> pEditView;
@@ -133,7 +132,7 @@ public:
     using Window::GetAccessible;
     SmEditAccessible* GetAccessible()
     {
-        return pAccessible;
+        return mxAccessible.get();
     }
 };
 
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 72b7b29..eb544ad 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -88,7 +88,6 @@ bool SmEditWindow::IsInlineEditEnabled()
 SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) :
     Window              (&rMyCmdBoxWin),
     DropTargetHelper    ( this ),
-    pAccessible         (0),
     rCmdBox             (rMyCmdBoxWin)
 {
     SetHelpId(HID_SMA_COMMAND_WIN_EDIT);
@@ -131,14 +130,11 @@ void SmEditWindow::dispose()
     // clean up of classes used for accessibility
     // must be done before EditView (and thus EditEngine) is no longer
     // available for those classes.
-    if (pAccessible)
+    if (mxAccessible.is())
     {
-        pAccessible->ClearWin();    // make Accessible defunctional
-        pAccessible = NULL;
-        xAccessible.clear();
+        mxAccessible->ClearWin();    // make Accessible defunctional
+        mxAccessible.clear();
     }
-    // Note: memory for pAccessible will be freed when the reference
-    // xAccessible is released. FIXME: horribly redundant lifecycle ! ...
 
     if (pEditView)
     {
@@ -699,10 +695,10 @@ void SmEditWindow::GetFocus()
 {
     Window::GetFocus();
 
-    if (xAccessible.is())
+    if (mxAccessible.is())
     {
         // Note: will implicitly send the AccessibleStateType::FOCUSED event
-        ::accessibility::AccessibleTextHelper *pHelper = pAccessible->GetTextHelper();
+        ::accessibility::AccessibleTextHelper *pHelper = mxAccessible->GetTextHelper();
         if (pHelper)
             pHelper->SetFocus(true);
     }
@@ -727,10 +723,10 @@ void SmEditWindow::LoseFocus()
 
     Window::LoseFocus();
 
-    if (xAccessible.is())
+    if (mxAccessible.is())
     {
         // Note: will implicitly send the AccessibleStateType::FOCUSED event
-        ::accessibility::AccessibleTextHelper *pHelper = pAccessible->GetTextHelper();
+        ::accessibility::AccessibleTextHelper *pHelper = mxAccessible->GetTextHelper();
         if (pHelper)
             pHelper->SetFocus(false);
     }
@@ -1113,13 +1109,12 @@ void SmEditWindow::DeleteEditView( SmViewShell & /*rView*/ )
 
 uno::Reference< XAccessible > SmEditWindow::CreateAccessible()
 {
-    if (!pAccessible)
+    if (!mxAccessible.is())
     {
-        pAccessible = new SmEditAccessible( this );
-        xAccessible = pAccessible;
-        pAccessible->Init();
+        mxAccessible.set(new SmEditAccessible( this ));
+        mxAccessible->Init();
     }
-    return xAccessible;
+    return uno::Reference< XAccessible >(mxAccessible.get());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list