summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accessibility/source/standard/vclxaccessiblelistboxlist.cxx335
-rw-r--r--forms/source/component/ImageControl.cxx11
-rw-r--r--forms/source/component/ImageControl.hxx2
-rw-r--r--forms/source/component/imgprod.cxx45
-rw-r--r--forms/source/component/imgprod.hxx22
5 files changed, 23 insertions, 392 deletions
diff --git a/accessibility/source/standard/vclxaccessiblelistboxlist.cxx b/accessibility/source/standard/vclxaccessiblelistboxlist.cxx
deleted file mode 100644
index df37c3239667..000000000000
--- a/accessibility/source/standard/vclxaccessiblelistboxlist.cxx
+++ /dev/null
@@ -1,335 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_accessibility.hxx"
-#include <accessibility/standard/vclxaccessiblelistboxlist.hxx>
-#include <accessibility/standard/vclxaccessiblelistitem.hxx>
-#include <accessibility/helper/listboxhelper.hxx>
-
-#include <algorithm>
-
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <tools/debug.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/unohelp.hxx>
-
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/helper/convert.hxx>
-
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::accessibility;
-
-
-namespace
-{
- void checkSelection_Impl( sal_Int32 _nIndex, const ListBox& _rListBox, sal_Bool bSelected )
- throw (::com::sun::star::lang::IndexOutOfBoundsException)
- {
- sal_Int32 nCount = bSelected ? (sal_Int32)_rListBox.GetSelectEntryCount()
- : (sal_Int32)_rListBox.GetEntryCount();
- if ( _nIndex < 0 || _nIndex >= nCount )
- throw ::com::sun::star::lang::IndexOutOfBoundsException();
- }
-}
-
-
-VCLXAccessibleListBoxList::VCLXAccessibleListBoxList (VCLXWindow* pVCLWindow,
- BoxType aBoxType,const Reference< XAccessible >& _xParent)
- : VCLXAccessibleList (pVCLWindow, aBoxType, _xParent)
-{
-}
-
-
-
-
-VCLXAccessibleListBoxList::~VCLXAccessibleListBoxList (void)
-{
-}
-
-
-
-
-void VCLXAccessibleListBoxList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
-{
- switch ( rVclWindowEvent.GetId() )
- {
- case VCLEVENT_LISTBOX_SCROLLED:
- UpdateEntryRange_Impl();
- break;
-
- case VCLEVENT_LISTBOX_SELECT:
- if ( !m_bDisableProcessEvent )
- UpdateSelection_Impl();
- break;
-
- default:
- VCLXAccessibleList::ProcessWindowEvent (rVclWindowEvent);
- }
-}
-
-IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleListBoxList, VCLXAccessibleList, VCLXAccessibleListBoxList_BASE)
-IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleListBoxList, VCLXAccessibleList, VCLXAccessibleListBoxList_BASE)
-
-
-
-//===== XServiceInfo ========================================================
-
-::rtl::OUString VCLXAccessibleListBoxList::getImplementationName (void)
- throw (RuntimeException)
-{
- return ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.AccessibleListBoxList");
-}
-
-
-
-
-Sequence< ::rtl::OUString > VCLXAccessibleListBoxList::getSupportedServiceNames (void)
- throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aNames = VCLXAccessibleList::getSupportedServiceNames();
- sal_Int32 nLength = aNames.getLength();
- aNames.realloc( nLength + 1 );
- aNames[nLength] = ::rtl::OUString::createFromAscii(
- "com.sun.star.accessibility.AccessibleListBoxList");
- return aNames;
-}
-// -----------------------------------------------------------------------------
-
-void VCLXAccessibleListBoxList::UpdateSelection_Impl()
-{
- uno::Any aOldValue, aNewValue;
-
- {
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- Reference< XAccessible > xNewAcc;
-
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if ( pListBox )
- {
- USHORT nPos = 0;
- ListItems::iterator aEnd = m_aAccessibleChildren.end();
- for ( ListItems::iterator aIter = m_aAccessibleChildren.begin();
- aIter != aEnd; ++aIter,++nPos)
- {
- if ( aIter->is() )
- {
- VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( aIter->get() );
- // Retrieve the item's index from the list entry.
- BOOL bNowSelected = pListBox->IsEntryPosSelected (nPos);
-
- if ( bNowSelected && !pItem->IsSelected() )
- {
- xNewAcc = *aIter;
- aNewValue <<= xNewAcc;
- m_nLastSelectedPos = nPos;
- }
-
- pItem->SetSelected( bNowSelected );
- }
- else
- { // it could happen that a child was not created before
- checkEntrySelected(pListBox,nPos,aNewValue,xNewAcc);
- }
- }
-
- USHORT nCount = pListBox->GetEntryCount();
- if ( nPos < nCount ) // here we have to check the if any other listbox entry is selected
- {
- for (; nPos < nCount && !checkEntrySelected(pListBox,nPos,aNewValue,xNewAcc) ;++nPos )
- ;
- }
- }
-
- if ( xNewAcc.is() && pListBox->HasFocus() )
- {
- if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
- aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos );
- aNewValue <<= xNewAcc;
- }
- }
-
- if ( aNewValue.hasValue() || aOldValue.hasValue() )
- NotifyAccessibleEvent(
- AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
- aOldValue,
- aNewValue );
-
- NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
-}
-
-// -----------------------------------------------------------------------------
-// XAccessibleSelection
-// -----------------------------------------------------------------------------
-void SAL_CALL VCLXAccessibleListBoxList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- sal_Bool bNotify = sal_False;
-
- {
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if ( pListBox )
- {
- checkSelection_Impl( nChildIndex, *pListBox, sal_False );
- pListBox->SelectEntryPos( (USHORT)nChildIndex, TRUE );
- // call the select handler, don't handle events in this time
- m_bDisableProcessEvent = true;
- pListBox->Select();
- m_bDisableProcessEvent = false;
- bNotify = sal_True;
- }
- }
-
- if ( bNotify )
- UpdateSelection_Impl();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL VCLXAccessibleListBoxList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_Bool bRet = sal_False;
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if ( pListBox )
- {
- checkSelection_Impl( nChildIndex, *pListBox, sal_False );
- bRet = pListBox->IsEntryPosSelected( (USHORT)nChildIndex );
- }
- return bRet;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL VCLXAccessibleListBoxList::clearAccessibleSelection( ) throw (RuntimeException)
-{
- sal_Bool bNotify = sal_False;
-
- {
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if ( pListBox )
- {
- pListBox->SetNoSelection();
- bNotify = sal_True;
- }
- }
-
- if ( bNotify )
- UpdateSelection_Impl();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL VCLXAccessibleListBoxList::selectAllAccessibleChildren( ) throw (RuntimeException)
-{
- sal_Bool bNotify = sal_False;
-
- {
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if ( pListBox )
- {
- USHORT nCount = pListBox->GetEntryCount();
- for ( USHORT i = 0; i < nCount; ++i )
- pListBox->SelectEntryPos( i, TRUE );
- // call the select handler, don't handle events in this time
- m_bDisableProcessEvent = true;
- pListBox->Select();
- m_bDisableProcessEvent = false;
- bNotify = sal_True;
- }
- }
-
- if ( bNotify )
- UpdateSelection_Impl();
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL VCLXAccessibleListBoxList::getSelectedAccessibleChildCount( ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_Int32 nCount = 0;
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if ( pListBox )
- nCount = pListBox->GetSelectEntryCount();
- return nCount;
-}
-// -----------------------------------------------------------------------------
-Reference< XAccessible > SAL_CALL VCLXAccessibleListBoxList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if ( pListBox )
- {
- checkSelection_Impl( nSelectedChildIndex, *pListBox, sal_True );
- return getAccessibleChild( (sal_Int32)pListBox->GetSelectEntryPos( (USHORT)nSelectedChildIndex ) );
- }
-
- return NULL;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL VCLXAccessibleListBoxList::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- sal_Bool bNotify = sal_False;
-
- {
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if ( pListBox )
- {
- checkSelection_Impl( nSelectedChildIndex, *pListBox, sal_False );
- pListBox->SelectEntryPos( (USHORT)nSelectedChildIndex, FALSE );
- // call the select handler, don't handle events in this time
- m_bDisableProcessEvent = true;
- pListBox->Select();
- m_bDisableProcessEvent = false;
- bNotify = sal_True;
- }
- }
-
- if ( bNotify )
- UpdateSelection_Impl();
-}
-// -----------------------------------------------------------------------------
-
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 72d22d3f30a5..f74e82135708 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -190,6 +190,7 @@ void OImageControlModel::implConstruct()
{
m_pImageProducer = new ImageProducer;
m_xImageProducer = m_pImageProducer;
+ m_pImageProducer->SetDoneHdl( LINK( this, OImageControlModel, OnImageImportDone ) );
}
//------------------------------------------------------------------
@@ -630,6 +631,16 @@ void SAL_CALL OImageControlModel::startProduction( ) throw (RuntimeException)
GetImageProducer()->startProduction();
}
+//------------------------------------------------------------------------------
+IMPL_LINK( OImageControlModel, OnImageImportDone, ::Graphic*, i_pGraphic )
+{
+ ENSURE_OR_RETURN( i_pGraphic, "OImageControlModel::OnImageImportDone: illegal graphic!", 0L );
+ setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ) ),
+ makeAny( Image( i_pGraphic->GetBitmapEx() ).GetXGraphic() )
+ );
+ return 1L;
+}
//==================================================================
// OImageControlControl
diff --git a/forms/source/component/ImageControl.hxx b/forms/source/component/ImageControl.hxx
index eb0e15660ca6..c31216fc8aca 100644
--- a/forms/source/component/ImageControl.hxx
+++ b/forms/source/component/ImageControl.hxx
@@ -140,6 +140,8 @@ protected:
bound field, or the control itself if there is no bound field
*/
sal_Bool impl_updateStreamForURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator );
+
+ DECL_LINK( OnImageImportDone, ::Graphic* );
};
//==================================================================
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx
index 8bd02173fc3f..7e0293be334e 100644
--- a/forms/source/component/imgprod.cxx
+++ b/forms/source/component/imgprod.cxx
@@ -190,11 +190,7 @@ ErrCode ImgProdLockBytes::Stat( SvLockBytesStat* pStat, SvLockBytesStatFlag eFla
ImageProducer::ImageProducer() :
mpStm ( NULL ),
- mpFilter ( NULL ),
- mnStatus ( 0UL ),
- mbConsInit ( sal_False ),
- mnLastError ( 0UL ),
- mbAsync ( sal_False )
+ mbConsInit ( sal_False )
{
mpGraphic = new Graphic;
DBG_ASSERT( Application::GetFilterHdl().IsSet(), "ImageProducer::ImageProducer(): No filter handler set" );
@@ -207,9 +203,6 @@ ImageProducer::~ImageProducer()
delete mpGraphic;
mpGraphic = NULL;
- delete mpFilter;
- mpFilter = NULL;
-
delete mpStm;
mpStm = NULL;
@@ -261,7 +254,6 @@ void ImageProducer::SetImage( const ::rtl::OUString& rPath )
maURL = rPath;
mpGraphic->Clear();
mbConsInit = sal_False;
- mbAsync = sal_False;
delete mpStm;
if ( ::svt::GraphicAccess::isSupportedURL( maURL ) )
@@ -284,7 +276,6 @@ void ImageProducer::SetImage( SvStream& rStm )
maURL = ::rtl::OUString();
mpGraphic->Clear();
mbConsInit = sal_False;
- mbAsync = sal_False;
delete mpStm;
mpStm = new SvStream( new ImgProdLockBytes( &rStm, sal_False ) );
@@ -297,7 +288,6 @@ void ImageProducer::setImage( ::com::sun::star::uno::Reference< ::com::sun::star
maURL = ::rtl::OUString();
mpGraphic->Clear();
mbConsInit = sal_False;
- mbAsync = sal_False;
delete mpStm;
if( rInputStmRef.is() )
@@ -318,9 +308,7 @@ void ImageProducer::NewDataAvailable()
void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeException)
{
- ResetLastError();
-
- if( maConsList.Count() )
+ if( maConsList.Count() || maDoneHdl.IsSet() )
{
bool bNotifyEmptyGraphics = false;
@@ -331,8 +319,8 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
// graphic is cleared if a new Stream is set
if( ( mpGraphic->GetType() == GRAPHIC_NONE ) || mpGraphic->GetContext() )
{
- if( !ImplImportGraphic( *mpGraphic ) && maErrorHdl.IsSet() )
- maErrorHdl.Call( this );
+ if ( ImplImportGraphic( *mpGraphic ) && maDoneHdl.IsSet() )
+ maDoneHdl.Call( mpGraphic );
}
if( mpGraphic->GetType() != GRAPHIC_NONE )
@@ -371,33 +359,16 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic )
{
- USHORT nFilter = GRFILTER_FORMAT_DONTKNOW;
- short nRet;
- sal_Bool bRet = sal_False;
-
if( ERRCODE_IO_PENDING == mpStm->GetError() )
mpStm->ResetError();
mpStm->Seek( 0UL );
- if( mpFilter )
- nRet = mpFilter->ImportGraphic( rGraphic, String(), *mpStm, nFilter );
- else
- {
- if( GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE )
- nRet = GRFILTER_OK;
- else
- nRet = GRFILTER_FILTERERROR;
- }
+ sal_Bool bRet = GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE;
if( ERRCODE_IO_PENDING == mpStm->GetError() )
mpStm->ResetError();
- if( nRet == GRFILTER_OK )
- bRet = sal_True;
- else
- mnLastError = nRet;
-
return bRet;
}
@@ -405,10 +376,6 @@ sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic )
void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
{
- // asynchronous?
- if( mpGraphic->GetContext() )
- mbAsync = sal_True;
-
ImplInitConsumer( rGraphic );
if( mbConsInit && maConsList.Count() )
@@ -425,7 +392,7 @@ void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
// iterate through interfaces
for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( mnStatus = ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
+ ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
// delete interfaces in temporary list
for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
diff --git a/forms/source/component/imgprod.hxx b/forms/source/component/imgprod.hxx
index 0da5d04755df..170fc186fa73 100644
--- a/forms/source/component/imgprod.hxx
+++ b/forms/source/component/imgprod.hxx
@@ -64,20 +64,9 @@ private:
List maConsList;
Graphic* mpGraphic;
SvStream* mpStm;
- GraphicFilter* mpFilter;
sal_uInt32 mnTransIndex;
- sal_uInt32 mnStatus;
sal_Bool mbConsInit;
- sal_Bool mbStmDel;
- Link maErrorHdl;
- sal_uInt32 mnLastError;
-
- sal_uInt32 mnExtra2;
-
- sal_Bool mbAsync;
- sal_Bool mbExtra1;
- sal_Bool mbExtra2;
- sal_Bool mbExtra3;
+ Link maDoneHdl;
sal_Bool ImplImportGraphic( Graphic& rGraphic );
void ImplUpdateData( const Graphic& rGraphic );
@@ -92,14 +81,11 @@ public:
void SetImage( const ::rtl::OUString& rPath );
void SetImage( SvStream& rStm );
- void SetErrorHandler( const Link& rErrorHdl ) { maErrorHdl = rErrorHdl; }
- const Link& GetErrorHandler() const { return maErrorHdl; }
-
- sal_uInt32 GetLastError() const { return mnLastError; }
- void ResetLastError() { mnLastError = 0; }
-
void NewDataAvailable();
+ void SetDoneHdl( const Link& i_rHdl ) { maDoneHdl = i_rHdl; }
+ const Link& GetDoneHdl() const { return maDoneHdl; }
+
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL acquire() throw() { OWeakObject::acquire(); }