[ooo-build-commit] .: 3 commits - starmath/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Thu Sep 30 11:26:16 PDT 2010


 starmath/source/accessibility.cxx |   94 +++-----------------------------------
 starmath/source/accessibility.hxx |    4 -
 2 files changed, 9 insertions(+), 89 deletions(-)

New commits:
commit ff07bda04f10bbdceb47badf984f5da1c6f5e421
Author: Phil Bordelon <phil at thenexusproject.org>
Date:   Thu Sep 30 10:43:59 2010 -0500

    Remove dead less-than-zero conditional checks.
    
    A large number of conditionals in accessibility.cxx checked that
    their values were above zero at some point, but that code was
    commented out; this removes those (unused) checks completely.
    
    Signed-off-by: Phil Bordelon <phil at thenexusproject.org>

diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index ac6e342..29a45f7 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -464,7 +464,7 @@ sal_Bool SAL_CALL SmGraphicAccessible::setCaretPosition( sal_Int32 nIndex )
 {
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     String aTxt( GetAccessibleText_Impl() );
-    if (!(/*0 <= nIdx  &&*/  nIdx < aTxt.Len()))
+    if (!(nIdx < aTxt.Len()))
         throw IndexOutOfBoundsException();
     return sal_False;
 }
@@ -476,7 +476,7 @@ sal_Unicode SAL_CALL SmGraphicAccessible::getCharacter( sal_Int32 nIndex )
 
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     String aTxt( GetAccessibleText_Impl() );
-    if (!(/*0 <= nIdx  &&*/  nIdx < aTxt.Len()))
+    if (!(nIdx < aTxt.Len()))
         throw IndexOutOfBoundsException();
     return aTxt.GetChar( nIdx );
 }
@@ -694,8 +694,8 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     String aTxt( GetAccessibleText_Impl() );
     xub_StrLen nStart = (xub_StrLen) Min(nStartIndex, nEndIndex);
     xub_StrLen nEnd   = (xub_StrLen) Max(nStartIndex, nEndIndex);
-    if (!(/*0 <= nStart  &&*/  nStart <= aTxt.Len()) ||
-        !(/*0 <= nEnd    &&*/  nEnd   <= aTxt.Len()))
+    if (!(nStart <= aTxt.Len()) ||
+        !(nEnd   <= aTxt.Len()))
         throw IndexOutOfBoundsException();
     return aTxt.Copy( nStart, nEnd - nStart );
 }
@@ -706,7 +706,7 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     String aTxt( GetAccessibleText_Impl() );
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     //!! nIndex is allowed to be the string length
-    if (!(/*0 <= nIdx  &&*/  nIdx <= aTxt.Len()))
+    if (!(nIdx <= aTxt.Len()))
         throw IndexOutOfBoundsException();
 
     ::com::sun::star::accessibility::TextSegment aResult;
@@ -727,7 +727,7 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     String aTxt( GetAccessibleText_Impl() );
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     //!! nIndex is allowed to be the string length
-    if (!(/*0 <= nIdx  &&*/  nIdx <= aTxt.Len()))
+    if (!(nIdx <= aTxt.Len()))
         throw IndexOutOfBoundsException();
 
     ::com::sun::star::accessibility::TextSegment aResult;
@@ -749,7 +749,7 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     String aTxt( GetAccessibleText_Impl() );
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     //!! nIndex is allowed to be the string length
-    if (!(/*0 <= nIdx  &&*/  nIdx <= aTxt.Len()))
+    if (!(nIdx <= aTxt.Len()))
         throw IndexOutOfBoundsException();
 
     ::com::sun::star::accessibility::TextSegment aResult;
commit 025a52fd24b40672c99eac4c35b31318607e67bf
Author: Phil Bordelon <phil at thenexusproject.org>
Date:   Thu Sep 30 12:29:38 2010 -0500

    Remove dead code in starmath/accessibility.[ch]xx
    
    Signed-off-by: Phil Bordelon <phil at thenexusproject.org>

diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 7e3c228..ac6e342 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -122,7 +122,6 @@ SmGraphicAccessible::SmGraphicAccessible( SmGraphicWindow *pGraphicWin ) :
     pWin                (pGraphicWin)
 {
     DBG_ASSERT( pWin, "SmGraphicAccessible: window missing" );
-    //++aRefCount;
 }
 
 
@@ -131,21 +130,13 @@ SmGraphicAccessible::SmGraphicAccessible( const SmGraphicAccessible &rSmAcc ) :
     aAccName            ( String(SmResId(RID_DOCUMENTSTR)) ),
     nClientId           (0)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
     pWin = rSmAcc.pWin;
     DBG_ASSERT( pWin, "SmGraphicAccessible: window missing" );
-    //++aRefCount;
 }
 
 
 SmGraphicAccessible::~SmGraphicAccessible()
 {
-/*
-    vos::OGuard aGuard(Application::GetSolarMutex());
-    if (--aRefCount == 0)
-    {
-    }
-*/
 }
 
 
@@ -325,7 +316,6 @@ Reference< XAccessible > SAL_CALL SmGraphicAccessible::getAccessibleChild(
 {
     vos::OGuard aGuard(Application::GetSolarMutex());
     throw IndexOutOfBoundsException();  // there is no child...
-    /*return 0;*/
 }
 
 Reference< XAccessible > SAL_CALL SmGraphicAccessible::getAccessibleParent()
@@ -399,9 +389,6 @@ Reference< XAccessibleStateSet > SAL_CALL SmGraphicAccessible::getAccessibleStat
         pStateSet->AddState( AccessibleStateType::DEFUNC );
     else
     {
-        //pStateSet->AddState( AccessibleStateType::EDITABLE );
-        //pStateSet->AddState( AccessibleStateType::HORIZONTAL );
-        //pStateSet->AddState( AccessibleStateType::TRANSIENT );
         pStateSet->AddState( AccessibleStateType::ENABLED );
         pStateSet->AddState( AccessibleStateType::FOCUSABLE );
         if (pWin->HasFocus())
@@ -549,8 +536,6 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde
                 // get appropriate rectangle
                 Point aOffset(pNode->GetTopLeft() - pTree->GetTopLeft());
                 Point aTLPos (pWin->GetFormulaDrawPos() + aOffset);
-//                aTLPos.X() -= pNode->GetItalicLeftSpace();
-//                Size  aSize (pNode->GetItalicSize());
                 aTLPos.X() -= 0;
                 Size  aSize (pNode->GetSize());
 
@@ -617,9 +602,7 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin
         {
             // get appropriate rectangle
             Point   aOffset( pNode->GetTopLeft() - pTree->GetTopLeft() );
-            Point   aTLPos ( /*pWin->GetFormulaDrawPos() +*/ aOffset );
-//            aTLPos.X() -= pNode->GetItalicLeftSpace();
-//            Size  aSize( pNode->GetItalicSize() );
+            Point   aTLPos ( aOffset );
             aTLPos.X() -= 0;
             Size  aSize( pNode->GetSize() );
 #if OSL_DEBUG_LEVEL > 1
@@ -820,7 +803,6 @@ sal_Bool SAL_CALL SmGraphicAccessible::copyText(
 OUString SAL_CALL SmGraphicAccessible::getImplementationName()
     throw (RuntimeException)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
     return A2OU("SmGraphicAccessible");
 }
 
@@ -828,7 +810,6 @@ sal_Bool SAL_CALL SmGraphicAccessible::supportsService(
         const OUString& rServiceName )
     throw (RuntimeException)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
     return  rServiceName == A2OU( "com::sun::star::accessibility::Accessible" ) ||
             rServiceName == A2OU( "com::sun::star::accessibility::AccessibleComponent" ) ||
             rServiceName == A2OU( "com::sun::star::accessibility::AccessibleContext" ) ||
@@ -838,7 +819,6 @@ sal_Bool SAL_CALL SmGraphicAccessible::supportsService(
 Sequence< OUString > SAL_CALL SmGraphicAccessible::getSupportedServiceNames()
     throw (RuntimeException)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
     Sequence< OUString > aNames(4);
     OUString *pNames = aNames.getArray();
     pNames[0] = A2OU( "com::sun::star::accessibility::Accessible" );
@@ -867,7 +847,6 @@ SmEditSource::SmEditSource( const SmEditSource &rSrc ) :
     aEditViewFwd(rSrc.rEditAcc),
     rEditAcc	(rSrc.rEditAcc)
 {
-    //aBroadCaster;     can be completely new
 }
 
 SmEditSource::~SmEditSource()
@@ -1232,45 +1211,6 @@ USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSe
 
         if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
             bGaps = TRUE;
-/*
-        // since we have no portion with our item or if there were gaps
-        if( bEmpty || bGaps )
-        {
-            // we need to check the paragraph item
-            const SfxItemSet& rParaSet = rEditEngine.GetParaAttribs( nPara );
-            if( rParaSet.GetItemState( nWhich ) == SFX_ITEM_SET )
-            {
-                eState = SFX_ITEM_SET;
-                // get item from the paragraph
-                const SfxPoolItem* pTempItem = rParaSet.GetItem( nWhich );
-                if( pParaItem )
-                {
-                    if( *pParaItem != *pTempItem )
-                        return SFX_ITEM_DONTCARE;
-                }
-                else
-                {
-                    pParaItem = pTempItem;
-                }
-
-                // set if theres no last item or if its the same
-                eParaState = SFX_ITEM_SET;
-            }
-            else if( bEmpty )
-            {
-                eParaState = SFX_ITEM_DEFAULT;
-            }
-            else if( bGaps )
-            {
-                // gaps and item not set in paragraph, thats a dont care
-                return SFX_ITEM_DONTCARE;
-            }
-        }
-        else
-        {
-            eParaState = SFX_ITEM_SET;
-        }
-*/
         if( bEmpty )
             eParaState = SFX_ITEM_DEFAULT;
         else if( bGaps )
@@ -1709,7 +1649,6 @@ SmEditAccessible::SmEditAccessible( SmEditWindow *pEditWin ) :
     pWin                (pEditWin)
 {
     DBG_ASSERT( pWin, "SmEditAccessible: window missing" );
-    //++aRefCount;
 }
 
 
@@ -1717,21 +1656,13 @@ SmEditAccessible::SmEditAccessible( const SmEditAccessible &rSmAcc ) :
     SmEditAccessibleBaseClass(),
     aAccName            ( String(SmResId(STR_CMDBOXWINDOW)) )
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
     pWin = rSmAcc.pWin;
     DBG_ASSERT( pWin, "SmEditAccessible: window missing" );
-    //++aRefCount;
 }
 
 SmEditAccessible::~SmEditAccessible()
 {
     delete pTextHelper;
-/*
-    vos::OGuard aGuard(Application::GetSolarMutex());
-    if (--aRefCount == 0)
-    {
-    }
-*/
 }
 
 void SmEditAccessible::Init()
@@ -1988,10 +1919,7 @@ uno::Reference< XAccessibleStateSet > SAL_CALL SmEditAccessible::getAccessibleSt
         pStateSet->AddState( AccessibleStateType::DEFUNC );
     else
     {
-        //pStateSet->AddState( AccessibleStateType::EDITABLE );
         pStateSet->AddState( AccessibleStateType::MULTI_LINE );
-        //pStateSet->AddState( AccessibleStateType::HORIZONTAL );
-        //pStateSet->AddState( AccessibleStateType::TRANSIENT );
         pStateSet->AddState( AccessibleStateType::ENABLED );
         pStateSet->AddState( AccessibleStateType::FOCUSABLE );
         if (pWin->HasFocus())
@@ -2030,7 +1958,6 @@ void SAL_CALL SmEditAccessible::addEventListener( const uno::Reference< XAccessi
 void SAL_CALL SmEditAccessible::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
     throw (RuntimeException)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
    if (pTextHelper)   // not disposing (about to destroy view shell)
         pTextHelper->RemoveEventListener( xListener );
 }
@@ -2038,7 +1965,6 @@ void SAL_CALL SmEditAccessible::removeEventListener( const uno::Reference< XAcce
 OUString SAL_CALL SmEditAccessible::getImplementationName()
     throw (RuntimeException)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
     return A2OU("SmEditAccessible");
 }
 
@@ -2046,7 +1972,6 @@ sal_Bool SAL_CALL SmEditAccessible::supportsService(
         const OUString& rServiceName )
     throw (RuntimeException)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
     return  rServiceName == A2OU( "com::sun::star::accessibility::Accessible" ) ||
             rServiceName == A2OU( "com::sun::star::accessibility::AccessibleComponent" ) ||
             rServiceName == A2OU( "com::sun::star::accessibility::AccessibleContext" );
@@ -2055,7 +1980,6 @@ sal_Bool SAL_CALL SmEditAccessible::supportsService(
 Sequence< OUString > SAL_CALL SmEditAccessible::getSupportedServiceNames()
     throw (RuntimeException)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());
     Sequence< OUString > aNames(3);
     OUString *pNames = aNames.getArray();
     pNames[0] = A2OU( "com::sun::star::accessibility::Accessible" );
diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx
index d50d181..44ffcaa 100644
--- a/starmath/source/accessibility.hxx
+++ b/starmath/source/accessibility.hxx
@@ -32,9 +32,6 @@
 #ifndef _ACCESSIBILITY_HXX_
 #define _ACCESSIBILITY_HXX_
 
-//#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
-//#include <com/sun/star/lang/XComponent.hpp>
-//#endif
 #include <com/sun/star/accessibility/XAccessible.hpp>
 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
@@ -85,7 +82,6 @@ SmGraphicAccessibleBaseClass;
 class SmGraphicAccessible :
     public SmGraphicAccessibleBaseClass
 {
-    //vos::ORefCount    aRefCount;  // number of references to object
     osl::Mutex                          aListenerMutex;
     String                              aAccName;
     /// client id in the AccessibleEventNotifier queue
commit e7d36d77e96945446e75794e6138b5576a7075b1
Author: Phil Bordelon <phil at thenexusproject.org>
Date:   Thu Sep 30 10:40:05 2010 -0500

    Fix commented-out null-pointer check.
    
    In SmEditAccessible::addEventListener(), a previous commenting-out
    of a line also removed a null-pointer check.  This axes the
    commented out code but restores the check.
    
    Signed-off-by: Phil Bordelon <phil at thenexusproject.org>

diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index c9972a9..7e3c228 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -2023,7 +2023,7 @@ Locale SAL_CALL SmEditAccessible::getLocale(  )
 void SAL_CALL SmEditAccessible::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
     throw (RuntimeException)
 {
-    //vos::OGuard aGuard(Application::GetSolarMutex());   if (pTextHelper)   // not disposing (about to destroy view shell)
+    if (pTextHelper)   // not disposing (about to destroy view shell)
         pTextHelper->AddEventListener( xListener );
 }
 


More information about the ooo-build-commit mailing list