[Libreoffice-commits] core.git: 9 commits - accessibility/source basctl/source
Norbert Thiebaud
nthiebaud at gmail.com
Sun Jan 19 14:12:00 PST 2014
accessibility/source/extended/accessiblelistbox.cxx | 165 +++++++--------
accessibility/source/extended/accessiblelistboxentry.cxx | 29 +-
accessibility/source/standard/vclxaccessiblelist.cxx | 31 +-
basctl/source/basicide/baside2.cxx | 14 -
basctl/source/basicide/baside2b.cxx | 1
5 files changed, 120 insertions(+), 120 deletions(-)
New commits:
commit 2ee5758e4e91ab2d477d02310983f25e2f0d854e
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 15:44:21 2014 -0600
coverity#735600 : Division by zero
Change-Id: I67c2af62144872c4ad0ac7e17be5bb9a5883ba69
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 2ae6efd..10cfe47 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1453,6 +1453,7 @@ void BreakPointWindow::ShowMarker( bool bShow )
BreakPoint* BreakPointWindow::FindBreakPoint( const Point& rMousePos )
{
size_t nLineHeight = GetTextHeight();
+ nLineHeight = nLineHeight > 0 ? nLineHeight : 1;
size_t nYPos = rMousePos.Y() + nCurYOffset;
for ( size_t i = 0, n = GetBreakPoints().size(); i < n ; ++i )
commit 838d0cd4f397feef5b393942ec77185c00ccb811
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 15:42:23 2014 -0600
coverity#1000814 coverity#1000815 : Unintended sign extension
Change-Id: Ia9e40dba5ef2beca2ebc6cc40672d6804d430af0
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index cc3a6e6..2f8744e 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -791,9 +791,9 @@ void ModulWindow::EditMacro( const OUString& rMacroName )
long nVisHeight = GetOutputSizePixel().Height();
if ( (long)pView->GetTextEngine()->GetTextHeight() > nVisHeight )
{
- long nMaxY = pView->GetTextEngine()->GetTextHeight() - nVisHeight;
+ long nMaxY = (long)pView->GetTextEngine()->GetTextHeight() - nVisHeight;
long nOldStartY = pView->GetStartDocPos().Y();
- long nNewStartY = nStart * pView->GetTextEngine()->GetCharHeight();
+ long nNewStartY = (long)nStart * (long)pView->GetTextEngine()->GetCharHeight();
nNewStartY = std::min( nNewStartY, nMaxY );
pView->Scroll( 0, -(nNewStartY-nOldStartY) );
pView->ShowCursor( false, true );
commit b4ed680ebe8d89d010f4f1ccb5ffb8d6710475f4
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 15:36:06 2014 -0600
coverity#735599 : Division by zero
Change-Id: I1a69224793eb39d88894e1090672bdb641c88a02
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 50590e6..cc3a6e6 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -886,7 +886,11 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
OUString aTitle( CreateQualifiedName() );
- sal_uInt16 nLineHeight = (sal_uInt16) pPrinter->GetTextHeight(); // etwas mehr.
+ sal_uInt16 nLineHeight = (sal_uInt16) pPrinter->GetTextHeight();
+ if(nLineHeight == 0)
+ {
+ nLineHeight = 1;
+ }
sal_uInt16 nParaSpace = 10;
Size aPaperSz = pPrinter->GetOutputSize();
commit a1a545aa98951c06468330d8924f33c69fb7ba54
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 15:29:26 2014 -0600
coverity#1132668 : missing break in switch
Change-Id: Ia759081e7ccc9105898f25025ea567d900d33b13
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index 9363646..87414ec 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -78,7 +78,7 @@ namespace accessibility
{
switch ( rVclWindowEvent.GetId() )
{
- case VCLEVENT_CHECKBOX_TOGGLE :
+ case VCLEVENT_CHECKBOX_TOGGLE :
{
if ( !getListBox() || !getListBox()->HasFocus() )
{
@@ -103,114 +103,111 @@ namespace accessibility
break;
}
- case VCLEVENT_LISTBOX_SELECT :
+ case VCLEVENT_LISTBOX_SELECT :
{
- // First send an event that tells the listeners of a
- // modified selection. The active descendant event is
- // send after that so that the receiving AT has time to
- // read the text or name of the active child.
OSL_ASSERT(0 && "Debug: Treelist shouldn't use VCLEVENT_LISTBOX_SELECT");
+ break;
}
- case VCLEVENT_LISTBOX_TREESELECT:
+ case VCLEVENT_LISTBOX_TREESELECT:
+ {
+ if ( getListBox() && getListBox()->HasFocus() )
{
- if ( getListBox() && getListBox()->HasFocus() )
+ AccessibleListBoxEntry* pEntry =static_cast< AccessibleListBoxEntry* >(m_xFocusedChild.get());
+ if (pEntry)
{
- AccessibleListBoxEntry* pEntry =static_cast< AccessibleListBoxEntry* >(m_xFocusedChild.get());
- if (pEntry)
- {
- pEntry->NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
- }
+ pEntry->NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
}
}
- break;
- case VCLEVENT_LISTBOX_TREEFOCUS:
+ }
+ break;
+ case VCLEVENT_LISTBOX_TREEFOCUS:
+ {
+ SvTreeListBox* pBox = getListBox();
+ sal_Bool bNeedFocus = sal_False;
+ if (pBox)
{
- SvTreeListBox* pBox = getListBox();
- sal_Bool bNeedFocus = sal_False;
- if (pBox)
+ Window* pParent = ((Window*)pBox)->GetParent();
+ if (pParent && pParent->GetType() == WINDOW_FLOATINGWINDOW)
{
- Window* pParent = ((Window*)pBox)->GetParent();
- if (pParent && pParent->GetType() == WINDOW_FLOATINGWINDOW)
- {
- // MT: ImplGetAppSVData shouldn't be exported from VCL.
- // In which scenario is this needed?
- // If needed, we need to find an other solution
- /*
- ImplSVData* pSVData = ImplGetAppSVData();
- if (pSVData && pSVData->maWinData.mpFirstFloat == (FloatingWindow*)pParent)
- bNeedFocus = sal_True;
- */
- }
+ // MT: ImplGetAppSVData shouldn't be exported from VCL.
+ // In which scenario is this needed?
+ // If needed, we need to find an other solution
+ /*
+ ImplSVData* pSVData = ImplGetAppSVData();
+ if (pSVData && pSVData->maWinData.mpFirstFloat == (FloatingWindow*)pParent)
+ bNeedFocus = sal_True;
+ */
}
- if( pBox && (pBox->HasFocus() || bNeedFocus) )
+ }
+ if( pBox && (pBox->HasFocus() || bNeedFocus) )
+ {
+ uno::Any aOldValue, aNewValue;
+ SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
{
- uno::Any aOldValue, aNewValue;
- SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() );
- if ( pEntry )
+ AccessibleListBoxEntry* pEntryFocus =static_cast< AccessibleListBoxEntry* >(m_xFocusedChild.get());
+ if (pEntryFocus && pEntryFocus->GetSvLBoxEntry() == pEntry)
{
- AccessibleListBoxEntry* pEntryFocus =static_cast< AccessibleListBoxEntry* >(m_xFocusedChild.get());
- if (pEntryFocus && pEntryFocus->GetSvLBoxEntry() == pEntry)
- {
- aOldValue <<= uno::Any();
- aNewValue <<= m_xFocusedChild;
- NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
- return ;
- }
-
- aOldValue <<= m_xFocusedChild;
-
- MAP_ENTRY::iterator mi = m_mapEntry.find(pEntry);
- if(mi != m_mapEntry.end())
- {
- OSL_ASSERT(mi->second.get() != NULL);
- m_xFocusedChild = mi->second;
- }
- else
- {
- AccessibleListBoxEntry *pEntNew = new AccessibleListBoxEntry( *getListBox(), pEntry, NULL );
- m_xFocusedChild = pEntNew;
- m_mapEntry.insert(MAP_ENTRY::value_type(pEntry,pEntNew));
- }
-
+ aOldValue <<= uno::Any();
aNewValue <<= m_xFocusedChild;
NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+ return ;
+ }
+
+ aOldValue <<= m_xFocusedChild;
+
+ MAP_ENTRY::iterator mi = m_mapEntry.find(pEntry);
+ if(mi != m_mapEntry.end())
+ {
+ OSL_ASSERT(mi->second.get() != NULL);
+ m_xFocusedChild = mi->second;
}
else
{
- aOldValue <<= uno::Any();
- aNewValue <<= AccessibleStateType::FOCUSED;
- NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ AccessibleListBoxEntry *pEntNew = new AccessibleListBoxEntry( *getListBox(), pEntry, NULL );
+ m_xFocusedChild = pEntNew;
+ m_mapEntry.insert(MAP_ENTRY::value_type(pEntry,pEntNew));
}
+
+ aNewValue <<= m_xFocusedChild;
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
}
- }
- break;
- case VCLEVENT_LISTBOX_ITEMREMOVED:
- {
- SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() );
- if ( pEntry )
+ else
{
- RemoveChildEntries(pEntry);
+ aOldValue <<= uno::Any();
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
}
- else
+ }
+ }
+ break;
+ case VCLEVENT_LISTBOX_ITEMREMOVED:
+ {
+ SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ RemoveChildEntries(pEntry);
+ }
+ else
+ {
+ // NULL means Clear()
+ MAP_ENTRY::iterator mi = m_mapEntry.begin();
+ for ( ; mi != m_mapEntry.end() ; ++mi)
{
- // NULL means Clear()
- MAP_ENTRY::iterator mi = m_mapEntry.begin();
- for ( ; mi != m_mapEntry.end() ; ++mi)
- {
- uno::Any aNewValue;
- uno::Any aOldValue;
- aOldValue <<= mi->second;
- NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
- }
- m_mapEntry.clear();
+ uno::Any aNewValue;
+ uno::Any aOldValue;
+ aOldValue <<= mi->second;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
}
+ m_mapEntry.clear();
}
- break;
+ }
+ break;
// #i92103#
- case VCLEVENT_ITEM_EXPANDED :
- case VCLEVENT_ITEM_COLLAPSED :
+ case VCLEVENT_ITEM_EXPANDED :
+ case VCLEVENT_ITEM_COLLAPSED :
{
SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() );
if ( pEntry )
@@ -232,8 +229,8 @@ namespace accessibility
}
}
break;
- default:
- VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
}
}
}
commit 3c2f3f48549f0566f7e0df3f66558833932c9d40
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 15:22:19 2014 -0600
coverity#735598 : Division by zero
Change-Id: I288b46a933d8a301823deed8fccae9764b74e840
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 57379a7..50590e6 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -895,7 +895,9 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
// nLinepPage is not correct if there's a line break
sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height()/nLineHeight);
- sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / pPrinter->GetTextWidth( "X" ) );
+ long nXTextWidth = pPrinter->GetTextWidth( "X" );
+
+ sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / nXTextWidth > 1 ? nXTextWidth : 1);
sal_uLong nParas = GetEditEngine()->GetParagraphCount();
sal_uInt16 nPages = (sal_uInt16) (nParas/nLinespPage+1 );
commit 2a77e7a310d3b9a62df3c475578e11373188e802
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 15:14:55 2014 -0600
coverity#1158122 : Explicit null dereferenced
Change-Id: I6ffec6e69ca5ddb01998653d2f7637ed062bdc80
diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
index 6d22816..29a65b5 100644
--- a/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -87,8 +87,10 @@ VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType
}
}
UpdateVisibleLineCount();
- m_nCurSelectedPos=m_pListBoxHelper->GetSelectEntryPos();
-
+ if(m_pListBoxHelper)
+ {
+ m_nCurSelectedPos=m_pListBoxHelper->GetSelectEntryPos();
+ }
sal_uInt16 nCount = static_cast<sal_uInt16>(getAccessibleChildCount());
m_aAccessibleChildren.reserve(nCount);
}
commit 8db51361dc199c731cb82a06f90b4d2ff8eebfaf
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 15:11:09 2014 -0600
coverity#1132662 Dereference after null check
Change-Id: Iaccf8bb7903702d2bed3c4fc2195172e18ead6c7
diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
index f998904..6d22816 100644
--- a/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -281,7 +281,7 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool b_IsDropDownList)
{
//VCLXAccessibleDropdownListBox
//when in list is dropped down, xText = NULL
- if (m_pListBoxHelper->IsInDropDown())
+ if (m_pListBoxHelper && m_pListBoxHelper->IsInDropDown())
{
if ( aNewValue.hasValue() || aOldValue.hasValue() )
{
commit 9fd10cca8e8a3121b378b9e820c565c101985809
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 15:07:28 2014 -0600
coverity#1132661 Dereference after null check
Change-Id: Ida147599810b0aff4a7ebd00b90475b1c6cd1366
diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
index bc9b71c..f998904 100644
--- a/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -841,21 +841,18 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16)
aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos );
aNewValue <<= xNewAcc;
}
+ if (m_pListBoxHelper->IsInDropDown())
+ {
+ if ( aNewValue.hasValue() || aOldValue.hasValue() )
+ NotifyAccessibleEvent(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+ //the SELECTION_CHANGED is not necessary
+ //NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ }
}
}
- if (!m_pListBoxHelper->IsInDropDown())
- {
- }
- else
- {
- if ( aNewValue.hasValue() || aOldValue.hasValue() )
- NotifyAccessibleEvent(
- AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
- aOldValue,
- aNewValue );
- //the SELECTION_CHANGED is not necessary
- //NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
- }
}
// -----------------------------------------------------------------------------
commit 014a0e5d6f1acf54c97ac4c21d7a1d72f3f196cf
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Jan 19 14:59:29 2014 -0600
coverity#1132660 Dereference after null check
Change-Id: Ib184d73f2ced3beca8540a37bab74c4a712170ba
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx
index 1016139..98666fd 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -427,32 +427,29 @@ namespace accessibility
return AccessibleRole::TREE_ITEM;
else if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_LIST)
return AccessibleRole::LIST_ITEM;
- }
- sal_uInt16 treeFlag = pBox->GetTreeFlags();
- if(treeFlag & TREEFLAG_CHKBTN )
- {
- SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath );
- SvButtonState eState = pBox->GetCheckButtonState( pEntry );
- switch( eState )
+ sal_uInt16 treeFlag = pBox->GetTreeFlags();
+ if(treeFlag & TREEFLAG_CHKBTN )
{
+ SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath );
+ SvButtonState eState = pBox->GetCheckButtonState( pEntry );
+ switch( eState )
+ {
case SV_BUTTON_CHECKED:
case SV_BUTTON_UNCHECKED:
return AccessibleRole::CHECK_BOX;
case SV_BUTTON_TRISTATE:
default:
return AccessibleRole::LABEL;
+ }
}
+ if(getRoleType() == 0)
+ return AccessibleRole::LIST_ITEM;
+ else
+ //o is: return AccessibleRole::LABEL;
+ return AccessibleRole::TREE_ITEM;
}
- else
- {
-
- if(getRoleType() == 0)
- return AccessibleRole::LIST_ITEM;
- else
- //o is: return AccessibleRole::LABEL;
- return AccessibleRole::TREE_ITEM;
- }
+ return AccessibleRole::UNKNOWN;
}
// -----------------------------------------------------------------------------
OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) throw (RuntimeException)
More information about the Libreoffice-commits
mailing list