2000-09-18 15:33:13 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: ImageControl.cxx,v $
|
|
|
|
*
|
2002-11-14 09:11:54 +00:00
|
|
|
* $Revision: 1.21 $
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2002-11-14 09:11:54 +00:00
|
|
|
* last change: $Author: fs $ $Date: 2002-11-14 10:11:54 $
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _FRM_IMAGE_CONTROL_HXX_
|
|
|
|
#include "ImageControl.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _FRM_PROPERTY_HRC_
|
|
|
|
#include "property.hrc"
|
|
|
|
#endif
|
|
|
|
#ifndef _FRM_RESOURCE_HRC_
|
|
|
|
#include "frm_resource.hrc"
|
|
|
|
#endif
|
|
|
|
#ifndef _FRM_RESOURCE_HXX_
|
|
|
|
#include "frm_resource.hxx"
|
|
|
|
#endif
|
|
|
|
#include "conversion.hxx"
|
|
|
|
#ifndef _FRM_SERVICES_HXX_
|
|
|
|
#include "services.hxx"
|
|
|
|
#endif
|
2000-11-09 13:18:18 +00:00
|
|
|
#ifndef _UNTOOLS_UCBLOCKBYTES_HXX
|
|
|
|
#include <unotools/ucblockbytes.hxx>
|
|
|
|
#endif
|
2001-08-22 12:12:50 +00:00
|
|
|
#ifndef _FILEDLGHELPER_HXX
|
|
|
|
#include <sfx2/filedlghelper.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XPOPUPMENU_HPP_
|
|
|
|
#include <com/sun/star/awt/XPopupMenu.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_POPUPMENUDIRECTION_HPP_
|
|
|
|
#include <com/sun/star/awt/PopupMenuDirection.hpp>
|
|
|
|
#endif
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UI_DIALOGS_TEMPLATEDESCRIPTION_HPP_
|
|
|
|
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
|
|
|
#endif
|
2001-06-15 09:29:10 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_
|
|
|
|
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
|
2001-05-11 09:12:24 +00:00
|
|
|
#endif
|
2001-06-15 08:55:48 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERCONTROLACCESS_HPP_
|
|
|
|
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
|
2001-05-11 09:12:24 +00:00
|
|
|
#endif
|
2001-06-15 08:55:48 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKER_HPP_
|
|
|
|
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
|
2001-05-11 09:12:24 +00:00
|
|
|
#endif
|
2000-09-18 15:33:13 +00:00
|
|
|
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
|
|
|
|
#include <com/sun/star/sdbc/DataType.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
|
|
|
|
#include <com/sun/star/awt/MouseButton.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
|
|
|
|
#include <com/sun/star/awt/XWindow.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XDIALOG_HPP_
|
|
|
|
#include <com/sun/star/awt/XDialog.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
|
|
|
|
#include <com/sun/star/io/XActiveDataSink.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_IO_NOTCONNECTEDEXCEPTION_HPP_
|
|
|
|
#include <com/sun/star/io/NotConnectedException.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SVX_IMPGRF_HXX
|
|
|
|
#include <svx/impgrf.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _URLOBJ_HXX
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _STREAM_HXX
|
|
|
|
#include <tools/stream.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _UNOTOOLS_STREAMHELPER_HXX_
|
|
|
|
#include <unotools/streamhelper.hxx>
|
|
|
|
#endif
|
2001-03-15 07:47:25 +00:00
|
|
|
#ifndef _COMPHELPER_EXTRACT_HXX_
|
|
|
|
#include <comphelper/extract.hxx>
|
2000-09-18 15:33:13 +00:00
|
|
|
#endif
|
2000-11-14 14:08:43 +00:00
|
|
|
#ifndef _UNTOOLS_UCBSTREAMHELPER_HXX
|
|
|
|
#include <unotools/ucbstreamhelper.hxx>
|
|
|
|
#endif
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
#define ID_OPEN_GRAPHICS 1
|
|
|
|
#define ID_CLEAR_GRAPHICS 2
|
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
//.........................................................................
|
|
|
|
namespace frm
|
|
|
|
{
|
|
|
|
//.........................................................................
|
2002-08-27 11:50:36 +00:00
|
|
|
using namespace ::com::sun::star;
|
2000-11-23 07:48:15 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::sdb;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::form;
|
|
|
|
using namespace ::com::sun::star::awt;
|
|
|
|
using namespace ::com::sun::star::io;
|
2001-06-15 08:55:48 +00:00
|
|
|
using namespace ::com::sun::star::ui::dialogs;
|
2000-11-23 07:48:15 +00:00
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::util;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
//==================================================================
|
|
|
|
// OImageControlModel
|
|
|
|
//==================================================================
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
InterfaceRef SAL_CALL OImageControlModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
return *(new OImageControlModel(_rxFactory));
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Sequence<Type> OImageControlModel::_getTypes()
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
static Sequence<Type> aTypes;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (!aTypes.getLength())
|
|
|
|
{
|
|
|
|
// my base class
|
2000-11-23 07:48:15 +00:00
|
|
|
Sequence<Type> aBaseClassTypes = OBoundControlModel::_getTypes();
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
Sequence<Type> aOwnTypes(1);
|
|
|
|
Type* pOwnTypes = aOwnTypes.getArray();
|
|
|
|
pOwnTypes[0] = getCppuType((Reference<XImageProducerSupplier>*)NULL);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
|
|
|
|
}
|
|
|
|
return aTypes;
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_NAME(OImageControlModel)
|
|
|
|
//------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
OImageControlModel::OImageControlModel(const Reference<XMultiServiceFactory>& _rxFactory)
|
2001-06-21 17:24:00 +00:00
|
|
|
:OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_IMAGECONTROL, FRM_CONTROL_IMAGECONTROL, sal_False, sal_False)
|
2000-09-18 15:33:13 +00:00
|
|
|
// use the old control name for compytibility reasons
|
|
|
|
,OPropertyChangeListener(m_aMutex)
|
|
|
|
,m_pImageProducer(new ImageProducer)
|
|
|
|
,m_bReadOnly(sal_False)
|
2001-06-21 17:24:00 +00:00
|
|
|
,m_pAggregatePropertyMultiplexer(NULL)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
DBG_CTOR(OImageControlModel,NULL);
|
2000-11-23 07:48:15 +00:00
|
|
|
m_nClassId = FormComponentType::IMAGECONTROL;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
m_xImageProducer = m_pImageProducer;
|
|
|
|
|
|
|
|
m_sDataFieldConnectivityProperty = PROPERTY_IMAGE_URL;
|
|
|
|
increment(m_refCount);
|
|
|
|
if (m_xAggregateSet.is())
|
|
|
|
{
|
2001-06-21 17:24:00 +00:00
|
|
|
m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, sal_False);
|
|
|
|
m_pAggregatePropertyMultiplexer->acquire();
|
|
|
|
m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_IMAGE_URL);
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
decrement(m_refCount);
|
2001-06-21 17:24:00 +00:00
|
|
|
|
|
|
|
doSetDelegator();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
OImageControlModel::~OImageControlModel()
|
|
|
|
{
|
|
|
|
if (!OComponentHelper::rBHelper.bDisposed)
|
|
|
|
{
|
|
|
|
acquire();
|
|
|
|
dispose();
|
|
|
|
}
|
|
|
|
|
2001-06-21 17:24:00 +00:00
|
|
|
doResetDelegator();
|
|
|
|
|
|
|
|
if (m_pAggregatePropertyMultiplexer)
|
|
|
|
{
|
|
|
|
m_pAggregatePropertyMultiplexer->dispose();
|
|
|
|
m_pAggregatePropertyMultiplexer->release();
|
|
|
|
m_pAggregatePropertyMultiplexer = NULL;
|
|
|
|
}
|
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
DBG_DTOR(OImageControlModel,NULL);
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XServiceInfo
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
StringSequence OImageControlModel::getSupportedServiceNames() throw()
|
|
|
|
{
|
|
|
|
StringSequence aSupported = OBoundControlModel::getSupportedServiceNames();
|
2000-11-03 16:51:15 +00:00
|
|
|
aSupported.realloc(aSupported.getLength() + 1);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
::rtl::OUString*pArray = aSupported.getArray();
|
|
|
|
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_IMAGECONTROL;
|
|
|
|
return aSupported;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Any SAL_CALL OImageControlModel::queryAggregation(const Type& _rType) throw (RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Any aReturn = OBoundControlModel::queryAggregation(_rType);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (!aReturn.hasValue())
|
|
|
|
aReturn = ::cppu::queryInterface(_rType
|
2000-11-23 07:48:15 +00:00
|
|
|
,static_cast<XImageProducerSupplier*>(this)
|
2000-09-18 15:33:13 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return aReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
sal_Bool OImageControlModel::_approve(sal_Int32 _nColumnType)
|
|
|
|
{
|
|
|
|
// zulaessing sind die binary Typen, OTHER- und LONGVARCHAR-Felder
|
2000-11-23 07:48:15 +00:00
|
|
|
if ((_nColumnType == DataType::BINARY) || (_nColumnType == DataType::VARBINARY)
|
|
|
|
|| (_nColumnType == DataType::LONGVARBINARY) || (_nColumnType == DataType::OTHER)
|
|
|
|
|| (_nColumnType == DataType::LONGVARCHAR))
|
2000-09-18 15:33:13 +00:00
|
|
|
return sal_True;
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OImageControlModel::_propertyChanged( const PropertyChangeEvent& rEvt )
|
|
|
|
throw( RuntimeException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard(m_aMutex);
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// Wenn eine URL gesetzt worden ist, muss die noch an den ImageProducer
|
2000-09-18 15:33:13 +00:00
|
|
|
// weitergereicht werden.
|
|
|
|
// xInStream erzeugen
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XActiveDataSink> xSink(
|
2000-09-18 15:33:13 +00:00
|
|
|
m_xServiceFactory->createInstance(
|
2000-11-23 07:48:15 +00:00
|
|
|
::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (!xSink.is())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// SvStream am xInStream setzen
|
2000-11-23 10:44:48 +00:00
|
|
|
String aPath = getString(rEvt.NewValue);
|
|
|
|
// INetURLObject aURLObj(getString(rEvt.NewValue));
|
|
|
|
// String aPath = INetURLObject::decode(aURLObj.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2000-11-14 14:08:43 +00:00
|
|
|
SvStream* pFileStream = ::utl::UcbStreamHelper::CreateStream(aPath, STREAM_READ);
|
2001-02-12 11:07:00 +00:00
|
|
|
sal_Bool bSetNull = (NULL == pFileStream) || (ERRCODE_NONE != pFileStream->GetErrorCode());
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
if (!bSetNull)
|
|
|
|
{
|
|
|
|
// get the size of the stream
|
|
|
|
pFileStream->Seek(STREAM_SEEK_TO_END);
|
|
|
|
sal_Int32 nSize = (sal_Int32)pFileStream->Tell();
|
|
|
|
if (pFileStream->GetBufferSize() < 8192)
|
|
|
|
pFileStream->SetBufferSize(8192);
|
2000-11-23 10:44:48 +00:00
|
|
|
pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XInputStream> xInput
|
2000-09-18 15:33:13 +00:00
|
|
|
(new ::utl::OInputStreamHelper(new SvLockBytes(pFileStream, sal_True),
|
2001-05-28 08:08:06 +00:00
|
|
|
nSize));
|
2000-09-18 15:33:13 +00:00
|
|
|
xSink->setInputStream(xInput);
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XInputStream> xInStream(xSink, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (m_xColumnUpdate.is())
|
|
|
|
m_xColumnUpdate->updateBinaryStream(xInStream, xInput->available());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetImageProducer()->setImage( xInStream );
|
|
|
|
m_xImageProducer->startProduction();
|
|
|
|
}
|
|
|
|
|
|
|
|
// usually the setBinaryStream should close the input, but just in case ....
|
2001-05-28 08:08:06 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
xInStream->closeInput();
|
|
|
|
}
|
|
|
|
catch (NotConnectedException&)
|
|
|
|
{
|
|
|
|
}
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_xColumnUpdate.is())
|
|
|
|
m_xColumnUpdate->updateNull();
|
|
|
|
else
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XInputStream> xInStream;
|
2000-09-18 15:33:13 +00:00
|
|
|
GetImageProducer()->setImage( xInStream );
|
|
|
|
m_xImageProducer->startProduction();
|
|
|
|
}
|
|
|
|
delete pFileStream;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OImageControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_READONLY : rValue <<= (sal_Bool)m_bReadOnly; break;
|
|
|
|
default:
|
|
|
|
OBoundControlModel::getFastPropertyValue(rValue, nHandle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2001-09-12 16:46:54 +00:00
|
|
|
void OImageControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) throw ( ::com::sun::star::uno::Exception)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_READONLY :
|
2000-11-23 07:48:15 +00:00
|
|
|
DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_BOOLEAN, "OImageControlModel::setFastPropertyValue_NoBroadcast : invalid type !" );
|
2000-09-18 15:33:13 +00:00
|
|
|
m_bReadOnly = getBOOL(rValue);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
OBoundControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
sal_Bool OImageControlModel::convertFastPropertyValue(Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue)
|
|
|
|
throw( IllegalArgumentException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_READONLY :
|
|
|
|
return tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bReadOnly);
|
|
|
|
|
|
|
|
default:
|
|
|
|
return OBoundControlModel::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySetInfo> SAL_CALL OImageControlModel::getPropertySetInfo() throw( RuntimeException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySetInfo> xInfo(createPropertySetInfo( getInfoHelper() ) );
|
2000-09-18 15:33:13 +00:00
|
|
|
return xInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OImageControlModel::fillProperties(
|
2000-11-23 07:48:15 +00:00
|
|
|
Sequence< Property >& _rProps,
|
|
|
|
Sequence< Property >& _rAggregateProps ) const
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2001-04-02 09:28:06 +00:00
|
|
|
FRM_BEGIN_PROP_HELPER(8)
|
2000-11-23 07:48:15 +00:00
|
|
|
// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_IMAGE_URL, PropertyAttribute::TRANSIENT, 0);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
|
|
|
|
DECL_BOOL_PROP1(READONLY, BOUND);
|
|
|
|
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
|
|
|
|
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
|
|
|
|
DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND);
|
2000-11-23 07:48:15 +00:00
|
|
|
DECL_IFACE_PROP2(BOUNDFIELD, XPropertySet, READONLY, TRANSIENT);
|
|
|
|
DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID);
|
2000-09-18 15:33:13 +00:00
|
|
|
DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT);
|
|
|
|
FRM_END_PROP_HELPER();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
::cppu::IPropertyArrayHelper& OImageControlModel::getInfoHelper()
|
|
|
|
{
|
|
|
|
return *const_cast<OImageControlModel*>(this)->getArrayHelper();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2001-09-12 16:46:54 +00:00
|
|
|
::rtl::OUString OImageControlModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
return FRM_COMPONENT_IMAGECONTROL; // old (non-sun) name for compatibility !
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2001-09-12 16:46:54 +00:00
|
|
|
void OImageControlModel::write(const Reference<XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
// Basisklasse
|
|
|
|
OBoundControlModel::write(_rxOutStream);
|
|
|
|
// Version
|
|
|
|
_rxOutStream->writeShort(0x0003);
|
|
|
|
// Name
|
|
|
|
_rxOutStream->writeBoolean(m_bReadOnly);
|
2001-04-02 09:28:06 +00:00
|
|
|
writeHelpTextCompatibly(_rxOutStream);
|
2000-09-18 15:33:13 +00:00
|
|
|
// from version 0x0003 : common properties
|
|
|
|
writeCommonProperties(_rxOutStream);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2001-09-12 16:46:54 +00:00
|
|
|
void OImageControlModel::read(const Reference<XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
OBoundControlModel::read(_rxInStream);
|
|
|
|
|
|
|
|
// Version
|
|
|
|
sal_uInt16 nVersion = _rxInStream->readShort();
|
|
|
|
switch (nVersion)
|
|
|
|
{
|
|
|
|
case 0x0001:
|
|
|
|
m_bReadOnly = _rxInStream->readBoolean();
|
|
|
|
break;
|
|
|
|
case 0x0002:
|
|
|
|
m_bReadOnly = _rxInStream->readBoolean();
|
2001-04-02 09:28:06 +00:00
|
|
|
readHelpTextCompatibly(_rxInStream);
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case 0x0003:
|
|
|
|
m_bReadOnly = _rxInStream->readBoolean();
|
2001-04-02 09:28:06 +00:00
|
|
|
readHelpTextCompatibly(_rxInStream);
|
2000-09-18 15:33:13 +00:00
|
|
|
readCommonProperties(_rxInStream);
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
DBG_ERROR("OImageControlModel::read : unknown version !");
|
|
|
|
m_bReadOnly = sal_False;
|
|
|
|
defaultCommonProperties();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Nach dem Lesen die Defaultwerte anzeigen
|
|
|
|
if (m_aControlSource.getLength())
|
|
|
|
{ // (not if we don't have a control source - the "State" property acts like it is persistent, then
|
|
|
|
::osl::MutexGuard aGuard(m_aMutex); // _reset expects this mutex guarding
|
|
|
|
_reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XPropertyChangeListener
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OImageControlModel::_onValueChanged()
|
|
|
|
{
|
|
|
|
UpdateFromField();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Any OImageControlModel::_getControlValue() const
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
// hier macht ein Vergleich keinen Sinn, daher void siehe OBoundControlModel
|
2000-11-23 07:48:15 +00:00
|
|
|
return Any();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// OComponentHelper
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void OImageControlModel::disposing()
|
|
|
|
{
|
2001-06-21 17:24:00 +00:00
|
|
|
if (m_pAggregatePropertyMultiplexer)
|
|
|
|
m_pAggregatePropertyMultiplexer->dispose();
|
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
OBoundControlModel::disposing();
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XInputStream> xInStream;
|
2000-09-18 15:33:13 +00:00
|
|
|
GetImageProducer()->setImage( xInStream );
|
|
|
|
m_xImageProducer->startProduction();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OImageControlModel::_reset()
|
|
|
|
{
|
2000-11-23 10:44:48 +00:00
|
|
|
if(m_xField.is()) // only reset when we are connected to a column
|
|
|
|
{
|
|
|
|
Reference<XInputStream> xDummy;
|
|
|
|
GetImageProducer()->setImage(xDummy);
|
|
|
|
Reference<XImageProducer> xProducer = m_xImageProducer;
|
|
|
|
{ // release our mutex once (it's acquired in the calling method !), as starting the image production may
|
|
|
|
// result in the locking of the solar mutex (unfortunally the default implementation of our aggregate,
|
|
|
|
// VCLXImageControl, does this locking)
|
|
|
|
// FS - 74438 - 30.03.00
|
|
|
|
MutexRelease aRelease(m_aMutex);
|
|
|
|
xProducer->startProduction();
|
|
|
|
}
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Helper functions
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OImageControlModel::UpdateFromField()
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XInputStream> xInStream;
|
2000-09-18 15:33:13 +00:00
|
|
|
xInStream = m_xColumn->getBinaryStream();
|
|
|
|
|
|
|
|
GetImageProducer()->setImage(xInStream);
|
|
|
|
|
|
|
|
m_xImageProducer->startProduction();
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================
|
|
|
|
// OImageControlControl
|
|
|
|
//==================================================================
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
InterfaceRef SAL_CALL OImageControlControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
return *(new OImageControlControl(_rxFactory));
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Sequence<Type> OImageControlControl::_getTypes()
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
static Sequence<Type> aTypes;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (!aTypes.getLength())
|
|
|
|
{
|
|
|
|
// my base class
|
2000-11-23 07:48:15 +00:00
|
|
|
Sequence<Type> aBaseClassTypes = OBoundControl::_getTypes();
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
Sequence<Type> aOwnTypes(1);
|
|
|
|
Type* pOwnTypes = aOwnTypes.getArray();
|
|
|
|
pOwnTypes[0] = getCppuType((Reference<XMouseListener>*)NULL);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
|
|
|
|
}
|
|
|
|
return aTypes;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
OImageControlControl::OImageControlControl(const Reference<XMultiServiceFactory>& _rxFactory)
|
2000-09-18 15:33:13 +00:00
|
|
|
:OBoundControl(_rxFactory, VCL_CONTROL_IMAGECONTROL)
|
|
|
|
{
|
|
|
|
increment(m_refCount);
|
|
|
|
{
|
|
|
|
// als Focus- und MouseListener anmelden
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XWindow> xComp;
|
2000-09-18 15:33:13 +00:00
|
|
|
query_aggregation( m_xAggregate, xComp);
|
|
|
|
if (xComp.is())
|
|
|
|
xComp->addMouseListener(this);
|
|
|
|
}
|
|
|
|
// Refcount bei 1 fuer den Listener
|
|
|
|
sal_Int32 n = decrement(m_refCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
// UNO Anbindung
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Any SAL_CALL OImageControlControl::queryAggregation(const Type& _rType) throw (RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Any aReturn = OBoundControl::queryAggregation(_rType);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (!aReturn.hasValue())
|
|
|
|
aReturn = ::cppu::queryInterface(_rType
|
2000-11-23 07:48:15 +00:00
|
|
|
,static_cast<XMouseListener*>(this)
|
2000-09-18 15:33:13 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return aReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
StringSequence OImageControlControl::getSupportedServiceNames() throw()
|
|
|
|
{
|
|
|
|
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
|
|
|
|
aSupported.realloc(aSupported.getLength() + 1);
|
|
|
|
|
|
|
|
::rtl::OUString*pArray = aSupported.getArray();
|
|
|
|
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_IMAGECONTROL;
|
|
|
|
return aSupported;
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XControl
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OImageControlControl::createPeer(const Reference<XToolkit>& _rxToolkit, const Reference<XWindowPeer>& Parent) throw( RuntimeException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
OBoundControl::createPeer(_rxToolkit, Parent);
|
|
|
|
if (!m_xControl.is())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// ImageConsumer vom Control holen
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XWindowPeer> xPeer = m_xControl->getPeer();
|
|
|
|
Reference<XImageConsumer> xImageConsumer(xPeer, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (!xImageConsumer.is())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// ImageConsumer am Imageproducer setzen
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XImageProducerSupplier> xImageSource(m_xControl->getModel(), UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (!xImageSource.is())
|
|
|
|
return;
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XImageProducer> xImageProducer = xImageSource->getImageProducer();
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
xImageProducer->addConsumer(xImageConsumer);
|
|
|
|
xImageProducer->startProduction();
|
|
|
|
}
|
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OImageControlControl::implClearGraphics()
|
|
|
|
{
|
|
|
|
Reference< XPropertySet > xSet( getModel(), UNO_QUERY );
|
|
|
|
if ( xSet.is() )
|
|
|
|
xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OImageControlControl::implInsertGraphics()
|
|
|
|
{
|
|
|
|
Reference< XPropertySet > xSet( getModel(), UNO_QUERY );
|
|
|
|
if ( !xSet.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
::rtl::OUString sTitle = FRM_RES_STRING(RID_STR_IMPORT_GRAPHIC);
|
|
|
|
// build some arguments for the upcoming dialog
|
|
|
|
try
|
|
|
|
{
|
2002-11-14 09:11:54 +00:00
|
|
|
::sfx2::FileDialogHelper aDialog( ::sfx2::FILEOPEN_LINK_PREVIEW, SFXWB_GRAPHIC );
|
2001-08-22 12:12:50 +00:00
|
|
|
aDialog.SetTitle( sTitle );
|
|
|
|
|
|
|
|
Reference< XFilePickerControlAccess > xController(aDialog.GetFilePicker(), UNO_QUERY);
|
|
|
|
DBG_ASSERT( xController.is(), "OImageControlControl::implInsertGraphics: invalid file picker!" );
|
|
|
|
if ( xController.is() )
|
|
|
|
{
|
|
|
|
xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
|
|
|
|
xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ERRCODE_NONE == aDialog.Execute() )
|
|
|
|
{
|
|
|
|
// reset the url property in case it already has the value we're about to set - in this case
|
|
|
|
// our propertyChanged would not get called without this.
|
|
|
|
implClearGraphics();
|
|
|
|
|
|
|
|
xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception&)
|
|
|
|
{
|
|
|
|
DBG_ERROR("OImageControlControl::implInsertGraphics: caught an exception while attempting to execute the FilePicker!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
// MouseListener
|
|
|
|
//------------------------------------------------------------------------------
|
2001-09-12 16:46:54 +00:00
|
|
|
void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Nur linke Maustaste
|
2000-11-23 07:48:15 +00:00
|
|
|
if (e.Buttons != MouseButton::LEFT)
|
2000-09-18 15:33:13 +00:00
|
|
|
return;
|
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
// is this a request for a context menu?
|
|
|
|
if ( e.PopupTrigger )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2001-08-22 12:12:50 +00:00
|
|
|
Reference< XPopupMenu > xMenu( m_xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.awt.PopupMenu" ) ), UNO_QUERY );
|
|
|
|
DBG_ASSERT( xMenu.is(), "OImageControlControl::mousePressed: could not create a popup menu!" );
|
|
|
|
|
|
|
|
Reference< XWindowPeer > xWindowPeer = getPeer();
|
|
|
|
DBG_ASSERT( xWindowPeer.is(), "OImageControlControl::mousePressed: no window!" );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
if ( xMenu.is() && xWindowPeer.is() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2001-08-22 12:12:50 +00:00
|
|
|
xMenu->insertItem( ID_OPEN_GRAPHICS, FRM_RES_STRING( RID_STR_OPEN_GRAPHICS ), 0, 0 );
|
|
|
|
xMenu->insertItem( ID_CLEAR_GRAPHICS, FRM_RES_STRING( RID_STR_CLEAR_GRAPHICS ), 0, 1 );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
// check if the ImageURL is empty
|
|
|
|
::rtl::OUString sCurrentURL;
|
|
|
|
Reference< XPropertySet > xSet( getModel(), UNO_QUERY );
|
|
|
|
if ( xSet.is() )
|
|
|
|
xSet->getPropertyValue( PROPERTY_IMAGE_URL ) >>= sCurrentURL;
|
|
|
|
if ( 0 == sCurrentURL.getLength() )
|
|
|
|
xMenu->enableItem( ID_CLEAR_GRAPHICS, sal_False );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2002-08-27 11:50:36 +00:00
|
|
|
awt::Rectangle aRect( e.X, e.Y, 0, 0 );
|
|
|
|
if ( ( e.X < 0 ) || ( e.Y < 0 ) )
|
|
|
|
{ // context menu triggered by keyboard
|
|
|
|
// position it in the center of the control
|
|
|
|
// 102205 - 16.08.2002 - fs@openoffice.org
|
|
|
|
Reference< XWindow > xWindow( static_cast< ::cppu::OWeakObject* >( this ), UNO_QUERY );
|
|
|
|
OSL_ENSURE( xWindow.is(), "OImageControlControl::mousePressed: me not a window? How this?" );
|
|
|
|
if ( xWindow.is() )
|
|
|
|
{
|
|
|
|
awt::Rectangle aPosSize = xWindow->getPosSize();
|
|
|
|
aRect.X = aPosSize.Width / 2;
|
|
|
|
aRect.Y = aPosSize.Height / 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
const sal_Int16 nResult = xMenu->execute( xWindowPeer, aRect, PopupMenuDirection::EXECUTE_DEFAULT );
|
2001-05-11 09:12:24 +00:00
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
switch ( nResult )
|
2001-05-11 09:12:24 +00:00
|
|
|
{
|
2001-08-22 12:12:50 +00:00
|
|
|
case ID_OPEN_GRAPHICS:
|
|
|
|
implInsertGraphics();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CLEAR_GRAPHICS:
|
|
|
|
implClearGraphics();
|
|
|
|
break;
|
2001-05-11 09:12:24 +00:00
|
|
|
}
|
2001-08-22 12:12:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Doppelclick
|
|
|
|
if (e.ClickCount == 2)
|
|
|
|
{
|
2001-05-11 09:12:24 +00:00
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
Reference<XPropertySet> xSet(getModel(), UNO_QUERY);
|
|
|
|
if (!xSet.is())
|
|
|
|
return;
|
2001-05-11 09:12:24 +00:00
|
|
|
|
2001-08-22 12:12:50 +00:00
|
|
|
// wenn Control nicht gebunden ist, kein Dialog (da die zu schickende URL hinterher sowieso
|
|
|
|
// versanden wuerde)
|
|
|
|
// FS - #64946# - 19.04.99
|
|
|
|
Reference<XPropertySet> xBoundField;
|
|
|
|
if (hasProperty(PROPERTY_BOUNDFIELD, xSet))
|
|
|
|
::cppu::extractInterface(xBoundField, xSet->getPropertyValue(PROPERTY_BOUNDFIELD));
|
|
|
|
if (!xBoundField.is())
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2001-08-22 12:12:50 +00:00
|
|
|
// but only if our IMAGE_URL property is handled as if it is transient, which is equivalent to
|
|
|
|
// an empty control source
|
|
|
|
if (!hasProperty(PROPERTY_CONTROLSOURCE, xSet) || (::comphelper::getString(xSet->getPropertyValue(PROPERTY_CONTROLSOURCE)).getLength() != 0))
|
|
|
|
return;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
2001-08-22 12:12:50 +00:00
|
|
|
|
|
|
|
sal_Bool bReadOnly;
|
|
|
|
xSet->getPropertyValue(PROPERTY_READONLY) >>= bReadOnly;
|
|
|
|
if (bReadOnly)
|
|
|
|
return;
|
|
|
|
|
|
|
|
implInsertGraphics();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//.........................................................................
|
|
|
|
} // namespace frm
|
|
|
|
//.........................................................................
|
|
|
|
|