23#include <osl/diagnose.h>
24#include <com/sun/star/sdb/CommandType.hpp>
25#include <com/sun/star/sdb/XResultSetAccess.hpp>
26#include <com/sun/star/lang/XComponent.hpp>
43 using namespace ::
svx;
49 if ( !_xComponent.is() )
53 OSL_ENSURE( xCom.is(),
"lcl_setListener: no component!" );
57 i_bAdd ? xCom->addEventListener( i_rListener ) : xCom->removeEventListener( i_rListener );
66 const OUString& rDatasource,
67 const sal_Int32 nCommandType,
68 const OUString& rCommand,
75 ODataAccessObjectTransferable::Update(rDatasource, nCommandType, rCommand, rxConnection);
77 lcl_setListener(rxConnection,
this,
true);
86 const OUString& rDatasource,
87 const sal_Int32 nCommandType,
88 const OUString& rCommand,
90 const Reference< XComponentContext >& rxORB)
94 ODataAccessObjectTransferable::Update(rDatasource, nCommandType, rCommand);
103 const Sequence< Any >& i_rSelectedRows,
104 const bool i_bBookmarkSelection,
105 const Reference< XComponentContext >& i_rORB )
106 :ODataAccessObjectTransferable( i_rAliveForm )
108 OSL_PRECOND( i_rORB.is(),
"ODataClipboard::ODataClipboard: having no factory is not good ..." );
110 osl_atomic_increment( &m_refCount );
112 Reference<XConnection> xConnection;
113 getDescriptor()[ DataAccessDescriptorProperty::Connection ] >>= xConnection;
114 lcl_setListener( xConnection,
this,
true );
118 Reference< XResultSet > xResultSetClone;
119 Reference< XResultSetAccess > xResultSetAccess( i_rAliveForm, UNO_QUERY );
120 if ( xResultSetAccess.is() )
121 xResultSetClone = xResultSetAccess->createResultSet();
122 OSL_ENSURE( xResultSetClone.is(),
"ODataClipboard::ODataClipboard: could not clone the form's result set" );
123 lcl_setListener( xResultSetClone,
this,
true );
125 getDescriptor()[DataAccessDescriptorProperty::Cursor] <<= xResultSetClone;
126 getDescriptor()[DataAccessDescriptorProperty::Selection] <<= i_rSelectedRows;
127 getDescriptor()[DataAccessDescriptorProperty::BookmarkSelection]<<= i_bBookmarkSelection;
130 if ( xConnection.is() && i_rORB.is() )
133 if ( xFormatter.is() )
140 osl_atomic_decrement( &m_refCount );
148 if ( pExport && rxOStm.
is() )
151 return pExport->
Write();
160 AddFormat( SotClipboardFormatId::RTF );
163 AddFormat( SotClipboardFormatId::HTML );
165 ODataAccessObjectTransferable::AddSupportedFormats();
173 case SotClipboardFormatId::RTF:
178 case SotClipboardFormatId::HTML:
186 return ODataAccessObjectTransferable::GetData(rFlavor, rDestDoc);
203 if (
getDescriptor().has( DataAccessDescriptorProperty::Connection ) )
206 lcl_setListener( xConnection,
this,
false );
209 if (
getDescriptor().has( DataAccessDescriptorProperty::Cursor ) )
212 lcl_setListener( xResultSet,
this,
false );
215 ODataAccessObjectTransferable::ObjectReleased( );
222 if ( rDescriptor.has( DataAccessDescriptorProperty::Connection ) )
225 if ( xConnection == i_rSource.Source )
227 rDescriptor.erase( DataAccessDescriptorProperty::Connection );
231 if ( rDescriptor.has( DataAccessDescriptorProperty::Cursor ) )
234 if ( xResultSet == i_rSource.Source )
236 rDescriptor.erase( DataAccessDescriptorProperty::Cursor );
238 if ( rDescriptor.has( DataAccessDescriptorProperty::Selection ) )
239 rDescriptor.erase( DataAccessDescriptorProperty::Selection );
240 if ( rDescriptor.has( DataAccessDescriptorProperty::BookmarkSelection ) )
241 rDescriptor.erase( DataAccessDescriptorProperty::BookmarkSelection );
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
::rtl::Reference< OHTMLImportExport > m_pHtml
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor) override
void Update(const OUString &_rDatasource, const sal_Int32 _nCommandType, const OUString &_rCommand, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::util::XNumberFormatter > &_rxFormatter, const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
::rtl::Reference< ORTFImportExport > m_pRtf
virtual void ObjectReleased() override
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
virtual void AddSupportedFormats() override
void setStream(SvStream *_pStream)
const ODataAccessDescriptor & getDescriptor() const
void addCompatibleSelectionDescription(const css::uno::Sequence< css::uno::Any > &_rSelRows)
constexpr sal_uInt32 FORMAT_OBJECT_ID_RTF
css::uno::Reference< css::util::XNumberFormatter > getNumberFormatter(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
creates a number formatter
constexpr sal_uInt32 FORMAT_OBJECT_ID_HTML