diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-12 14:53:28 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-03-18 14:23:50 +0200 |
commit | fb14be5f8f74f83ba89e15f891ddf1f753dcc62f (patch) | |
tree | beaa4af08b0c3d75bf6e40b21b96c55e0ac1c60a /dbaccess | |
parent | b8ce52aab9459773544f1696cfe6b7b6f171a389 (diff) |
create new 'enum class' SotClipboardFormatId to unify types
of which there are several.
There are some issues here I am unsure of
- the SW and SC and CHART2 modules essentially ignore the enum values and assign their own ids
Perhaps I should change them to use the common values and create new enum values where necessary?
- the sc/qa/ and sq/qa/ and starmath/qa/ code was doing some dodgy stuff. I translated the code to pass down the stuff
numeric values to the underlying code, but perhaps further fixing is necessary?
Change-Id: Ic06d723e404481e3f1bca67c43b70321b764d923
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 16 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppControllerDnD.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppControllerGen.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/brwctrlr.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dbexchange.cxx | 20 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/control/FieldDescControl.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/JoinExchange.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TableCopyHelper.hxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TableRowExchange.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbexchange.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/TableCopyHelper.cxx | 40 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinExchange.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindowListBox.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TEditControl.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableRowExchange.cxx | 12 |
17 files changed, 85 insertions, 81 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index cfbb3a9f069c..618237e17f7e 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -598,7 +598,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = !isDataSourceReadOnly() && !isConnectionReadOnly() && isTableFormat(); break; case E_QUERY: - aReturn.bEnabled = !isDataSourceReadOnly() && getViewClipboard().HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY); + aReturn.bEnabled = !isDataSourceReadOnly() && getViewClipboard().HasFormat(SotClipboardFormatId::DBACCESS_QUERY); break; default: aReturn.bEnabled = !isDataSourceReadOnly() && OComponentTransferable::canExtractComponentDescriptor(getViewClipboard().GetDataFlavorExVector(),getContainer()->getElementType() == E_FORM); @@ -1033,7 +1033,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa break; case E_QUERY: - if ( rTransferData.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY) ) + if ( rTransferData.HasFormat(SotClipboardFormatId::DBACCESS_QUERY) ) paste( E_QUERY, ODataAccessObjectTransferable::extractObjectDescriptor( rTransferData ) ); break; default: @@ -1064,11 +1064,11 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ::std::unique_ptr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( getView() )); - ::std::vector<SotFormatStringId> aFormatIds; + ::std::vector<SotClipboardFormatId> aFormatIds; getSupportedFormats(getContainer()->getElementType(),aFormatIds); - const ::std::vector<SotFormatStringId>::iterator aEnd = aFormatIds.end(); + const ::std::vector<SotClipboardFormatId>::iterator aEnd = aFormatIds.end(); OUString sEmpty; - for (::std::vector<SotFormatStringId>::iterator aIter = aFormatIds.begin();aIter != aEnd; ++aIter) + for (::std::vector<SotClipboardFormatId>::iterator aIter = aFormatIds.begin();aIter != aEnd; ++aIter) pDlg->Insert(*aIter,sEmpty); const TransferableDataHelper& rClipboard = getViewClipboard(); @@ -1082,9 +1082,9 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa { if ( pIter->Name == "FormatStringId" ) { - SotFormatStringId nFormatId = 0; - if ( pIter->Value >>= nFormatId ) - pasteFormat(nFormatId); + sal_uLong nTmp; + if ( pIter->Value >>= nTmp ) + pasteFormat(static_cast<SotClipboardFormatId>(nTmp)); break; } } diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 42237ce3d154..17ac7e840dbb 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -259,7 +259,7 @@ namespace dbaui @param _nFormatId The format to be copied. */ - void pasteFormat(sal_uInt32 _nFormatId); + void pasteFormat(SotClipboardFormatId _nFormatId); /** pastes a query, form or report into the data source @param _eType @@ -287,7 +287,7 @@ namespace dbaui @param _rFormatIds The vector to be filled up. */ - void getSupportedFormats(ElementType _eType,::std::vector<SotFormatStringId>& _rFormatIds) const; + void getSupportedFormats(ElementType _eType,::std::vector<SotClipboardFormatId>& _rFormatIds) const; /** adds a listener to the current name access. @param _xCollection diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 4736dc244d6a..39e4ecf1d85b 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -773,17 +773,17 @@ Reference<XNameContainer> OApplicationController::getQueryDefinitions() const return xNames; } -void OApplicationController::getSupportedFormats(ElementType _eType,::std::vector<SotFormatStringId>& _rFormatIds) const +void OApplicationController::getSupportedFormats(ElementType _eType,::std::vector<SotClipboardFormatId>& _rFormatIds) const { switch( _eType ) { case E_TABLE: - _rFormatIds.push_back(SOT_FORMATSTR_ID_DBACCESS_TABLE); - _rFormatIds.push_back(SOT_FORMAT_RTF); - _rFormatIds.push_back(SOT_FORMATSTR_ID_HTML); + _rFormatIds.push_back(SotClipboardFormatId::DBACCESS_TABLE); + _rFormatIds.push_back(SotClipboardFormatId::RTF); + _rFormatIds.push_back(SotClipboardFormatId::HTML); // run through case E_QUERY: - _rFormatIds.push_back(SOT_FORMATSTR_ID_DBACCESS_QUERY); + _rFormatIds.push_back(SotClipboardFormatId::DBACCESS_QUERY); break; default: break; diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 45185eda5691..3eda31592a78 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -135,9 +135,9 @@ void OApplicationController::convertToView(const OUString& _sName) } } -void OApplicationController::pasteFormat(sal_uInt32 _nFormatId) +void OApplicationController::pasteFormat(SotClipboardFormatId _nFormatId) { - if ( _nFormatId ) + if ( _nFormatId != SotClipboardFormatId::NONE ) { try { diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 6f0532958e43..8a001974e4eb 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -1491,7 +1491,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const aReturn.bEnabled = m_aCurrentFrame.isActive() && !bIsReadOnly; if(aReturn.bEnabled) { - aReturn.bEnabled = aReturn.bEnabled && IsFormatSupported( m_aSystemClipboard.GetDataFlavorExVector(), FORMAT_STRING ); + aReturn.bEnabled = aReturn.bEnabled && IsFormatSupported( m_aSystemClipboard.GetDataFlavorExVector(), SotClipboardFormatId::STRING ); } break; } diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx index 616f504f6538..5df1f04e30c9 100644 --- a/dbaccess/source/ui/browser/dbexchange.cxx +++ b/dbaccess/source/ui/browser/dbexchange.cxx @@ -134,9 +134,9 @@ namespace dbaui osl_atomic_decrement( &m_refCount ); } - bool ODataClipboard::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& /*rFlavor*/ ) + bool ODataClipboard::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, SotClipboardFormatId nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& /*rFlavor*/ ) { - if (nUserObjectId == SOT_FORMAT_RTF || nUserObjectId == SOT_FORMATSTR_ID_HTML ) + if (nUserObjectId == SotClipboardFormatId::RTF || nUserObjectId == SotClipboardFormatId::HTML ) { ODatabaseImportExport* pExport = reinterpret_cast<ODatabaseImportExport*>(pUserObject); if ( pExport && rxOStm.Is() ) @@ -151,28 +151,30 @@ namespace dbaui void ODataClipboard::AddSupportedFormats() { if ( m_pRtf.is() ) - AddFormat( SOT_FORMAT_RTF ); + AddFormat( SotClipboardFormatId::RTF ); if ( m_pHtml.is() ) - AddFormat( SOT_FORMATSTR_ID_HTML ); + AddFormat( SotClipboardFormatId::HTML ); ODataAccessObjectTransferable::AddSupportedFormats(); } bool ODataClipboard::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc ) { - const sal_uLong nFormat = SotExchange::GetFormat(rFlavor); + const SotClipboardFormatId nFormat = SotExchange::GetFormat(rFlavor); switch (nFormat) { - case SOT_FORMAT_RTF: + case SotClipboardFormatId::RTF: if ( m_pRtf.is() ) m_pRtf->initialize(getDescriptor()); - return m_pRtf.is() && SetObject( m_pRtf.get(), SOT_FORMAT_RTF, rFlavor ); + return m_pRtf.is() && SetObject( m_pRtf.get(), SotClipboardFormatId::RTF, rFlavor ); - case SOT_FORMATSTR_ID_HTML: + case SotClipboardFormatId::HTML: if ( m_pHtml.is() ) m_pHtml->initialize(getDescriptor()); - return m_pHtml.is() && SetObject( m_pHtml.get(), SOT_FORMATSTR_ID_HTML, rFlavor ); + return m_pHtml.is() && SetObject( m_pHtml.get(), SotClipboardFormatId::HTML, rFlavor ); + + default: break; } return ODataAccessObjectTransferable::GetData(rFlavor, rDestDoc); diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 632e7fd8e13c..71e7b14bb783 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -1251,10 +1251,11 @@ void SbaGridControl::DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos) { switch (_aType.mnSotId) { - case SOT_FORMATSTR_ID_DBACCESS_TABLE: // table descriptor - case SOT_FORMATSTR_ID_DBACCESS_QUERY: // query descriptor - case SOT_FORMATSTR_ID_DBACCESS_COMMAND: // SQL command + case SotClipboardFormatId::DBACCESS_TABLE: // table descriptor + case SotClipboardFormatId::DBACCESS_QUERY: // query descriptor + case SotClipboardFormatId::DBACCESS_COMMAND: // SQL command return true; + default: break; } return false; } @@ -1267,7 +1268,7 @@ sal_Int8 SbaGridControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt ) if (!::dbtools::getConnection(Reference< XRowSet > (getDataSource(),UNO_QUERY)).is()) return nAction; - if ( IsDropFormatSupported( FORMAT_STRING ) ) do + if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) ) do { // odd construction, but spares us a lot of (explicit ;) goto's if (!GetEmptyRow().Is()) @@ -1366,7 +1367,7 @@ sal_Int8 SbaGridControl::ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) if (!::dbtools::getConnection(Reference< XRowSet > (xDataSource,UNO_QUERY)).is()) return DND_ACTION_NONE; - if ( IsDropFormatSupported( FORMAT_STRING ) ) + if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) ) { long nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false); sal_uInt16 nCol = GetColumnAtXPosPixel(rEvt.maPosPixel.X(), false); @@ -1395,7 +1396,7 @@ sal_Int8 SbaGridControl::ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) // get the dropped string TransferableDataHelper aDropped( rEvt.maDropEvent.Transferable ); OUString sDropped; - if ( !aDropped.GetString( FORMAT_STRING, sDropped ) ) + if ( !aDropped.GetString( SotClipboardFormatId::STRING, sDropped ) ) return DND_ACTION_NONE; rEdit.SetText( sDropped ); diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 2566839d1b52..7643cfeb50e0 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -1610,7 +1610,7 @@ bool OFieldDescControl::isPasteAllowed() if ( bAllowed ) { TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent())); - bAllowed = aTransferData.HasFormat(SOT_FORMAT_STRING); + bAllowed = aTransferData.HasFormat(SotClipboardFormatId::STRING); } return bAllowed; } diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx index 18ab49a2c4fd..34e0d83166bc 100644 --- a/dbaccess/source/ui/inc/JoinExchange.hxx +++ b/dbaccess/source/ui/inc/JoinExchange.hxx @@ -57,7 +57,7 @@ namespace dbaui void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions, IDragTransferableListener* _pListener ); static OJoinExchangeData GetSourceDescription(const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxObject); - static bool isFormatAvailable( const DataFlavorExVector& _rFormats ,SotFormatStringId _nSlotID=SOT_FORMATSTR_ID_SBA_JOIN); + static bool isFormatAvailable( const DataFlavorExVector& _rFormats ,SotClipboardFormatId _nSlotID=SotClipboardFormatId::SBA_JOIN); protected: virtual void AddSupportedFormats() SAL_OVERRIDE; diff --git a/dbaccess/source/ui/inc/TableCopyHelper.hxx b/dbaccess/source/ui/inc/TableCopyHelper.hxx index 3ffefd87de26..d7795d12f26d 100644 --- a/dbaccess/source/ui/inc/TableCopyHelper.hxx +++ b/dbaccess/source/ui/inc/TableCopyHelper.hxx @@ -47,13 +47,14 @@ namespace dbaui { switch (_aType.mnSotId) { - case SOT_FORMAT_RTF: // RTF data descriptions - case SOT_FORMATSTR_ID_HTML: // HTML data descriptions - case SOT_FORMATSTR_ID_DBACCESS_TABLE: // table descriptor + case SotClipboardFormatId::RTF: // RTF data descriptions + case SotClipboardFormatId::HTML: // HTML data descriptions + case SotClipboardFormatId::DBACCESS_TABLE: // table descriptor return (E_TABLE == eEntryType); - case SOT_FORMATSTR_ID_DBACCESS_QUERY: // query descriptor - case SOT_FORMATSTR_ID_DBACCESS_COMMAND: // SQL command + case SotClipboardFormatId::DBACCESS_QUERY: // query descriptor + case SotClipboardFormatId::DBACCESS_COMMAND: // SQL command return ((E_QUERY == eEntryType) || ( !bQueryDrop && E_TABLE == eEntryType)); + default: break; } return false; } @@ -111,7 +112,7 @@ namespace dbaui @param _sDestDataSourceName The name of the dest data source. */ - void pasteTable( SotFormatStringId _nFormatId + void pasteTable( SotClipboardFormatId _nFormatId ,const TransferableDataHelper& _rTransData ,const OUString& _sDestDataSourceName ,const SharedConnection& _xConnection); diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx b/dbaccess/source/ui/inc/TableRowExchange.hxx index 0f49ee4515db..84cc98404c0b 100644 --- a/dbaccess/source/ui/inc/TableRowExchange.hxx +++ b/dbaccess/source/ui/inc/TableRowExchange.hxx @@ -35,7 +35,7 @@ namespace dbaui protected: virtual void AddSupportedFormats() SAL_OVERRIDE; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; - virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, SotClipboardFormatId nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; virtual void ObjectReleased() SAL_OVERRIDE; }; } diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx index fa2d9be451c6..47dfd7a35c14 100644 --- a/dbaccess/source/ui/inc/dbexchange.hxx +++ b/dbaccess/source/ui/inc/dbexchange.hxx @@ -79,7 +79,7 @@ namespace dbaui virtual void AddSupportedFormats() SAL_OVERRIDE; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; virtual void ObjectReleased() SAL_OVERRIDE; - virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; + virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, SotClipboardFormatId nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE; }; } diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx index 9906ff559bee..b9ad29c123d8 100644 --- a/dbaccess/source/ui/misc/TableCopyHelper.cxx +++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx @@ -177,12 +177,12 @@ void OTableCopyHelper::pasteTable( const ::svx::ODataAccessDescriptor& _rPasteDa i_rDestDataSourceName, i_rDestConnection ); } -void OTableCopyHelper::pasteTable( SotFormatStringId _nFormatId +void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId ,const TransferableDataHelper& _rTransData ,const OUString& i_rDestDataSource ,const SharedConnection& _xConnection) { - if ( _nFormatId == SOT_FORMATSTR_ID_DBACCESS_TABLE || _nFormatId == SOT_FORMATSTR_ID_DBACCESS_QUERY ) + if ( _nFormatId == SotClipboardFormatId::DBACCESS_TABLE || _nFormatId == SotClipboardFormatId::DBACCESS_QUERY ) { if ( ODataAccessObjectTransferable::canExtractObjectDescriptor(_rTransData.GetDataFlavorExVector()) ) { @@ -196,13 +196,13 @@ void OTableCopyHelper::pasteTable( SotFormatStringId _nFormatId { DropDescriptor aTrans; bool bOk; - if ( _nFormatId != SOT_FORMAT_RTF ) - bOk = const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SOT_FORMATSTR_ID_HTML ,aTrans.aHtmlRtfStorage); + if ( _nFormatId != SotClipboardFormatId::RTF ) + bOk = const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SotClipboardFormatId::HTML ,aTrans.aHtmlRtfStorage); else - bOk = const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SOT_FORMAT_RTF,aTrans.aHtmlRtfStorage); + bOk = const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SotClipboardFormatId::RTF,aTrans.aHtmlRtfStorage); aTrans.nType = E_TABLE; - aTrans.bHtml = SOT_FORMATSTR_ID_HTML == _nFormatId; + aTrans.bHtml = SotClipboardFormatId::HTML == _nFormatId; aTrans.sDefaultTableName = GetTableNameForAppend(); if ( !bOk || !copyTagTable(aTrans,false,_xConnection) ) m_pController->showError(SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, OUString("S1000"), 0, Any())); @@ -224,12 +224,12 @@ void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData ,const OUString& i_rDestDataSource ,const SharedConnection& _xConnection) { - if ( _rTransData.HasFormat(SOT_FORMATSTR_ID_DBACCESS_TABLE) || _rTransData.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY) ) - pasteTable( SOT_FORMATSTR_ID_DBACCESS_TABLE,_rTransData,i_rDestDataSource,_xConnection); - else if ( _rTransData.HasFormat(SOT_FORMATSTR_ID_HTML) ) - pasteTable( SOT_FORMATSTR_ID_HTML,_rTransData,i_rDestDataSource,_xConnection); - else if ( _rTransData.HasFormat(SOT_FORMAT_RTF) ) - pasteTable( SOT_FORMAT_RTF,_rTransData,i_rDestDataSource,_xConnection); + if ( _rTransData.HasFormat(SotClipboardFormatId::DBACCESS_TABLE) || _rTransData.HasFormat(SotClipboardFormatId::DBACCESS_QUERY) ) + pasteTable( SotClipboardFormatId::DBACCESS_TABLE,_rTransData,i_rDestDataSource,_xConnection); + else if ( _rTransData.HasFormat(SotClipboardFormatId::HTML) ) + pasteTable( SotClipboardFormatId::HTML,_rTransData,i_rDestDataSource,_xConnection); + else if ( _rTransData.HasFormat(SotClipboardFormatId::RTF) ) + pasteTable( SotClipboardFormatId::RTF,_rTransData,i_rDestDataSource,_xConnection); } bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc, bool _bCheck, const SharedConnection& _xConnection) @@ -255,10 +255,10 @@ bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc, bo bool OTableCopyHelper::isTableFormat(const TransferableDataHelper& _rClipboard) const { - bool bTableFormat = _rClipboard.HasFormat(SOT_FORMATSTR_ID_DBACCESS_TABLE) - || _rClipboard.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY) - || _rClipboard.HasFormat(SOT_FORMAT_RTF) - || _rClipboard.HasFormat(SOT_FORMATSTR_ID_HTML); + bool bTableFormat = _rClipboard.HasFormat(SotClipboardFormatId::DBACCESS_TABLE) + || _rClipboard.HasFormat(SotClipboardFormatId::DBACCESS_QUERY) + || _rClipboard.HasFormat(SotClipboardFormatId::RTF) + || _rClipboard.HasFormat(SotClipboardFormatId::HTML); return bTableFormat; } @@ -268,14 +268,14 @@ bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedData ,const SharedConnection& _xConnection) { bool bRet = false; - bool bHtml = _aDroppedData.HasFormat(SOT_FORMATSTR_ID_HTML); - if ( bHtml || _aDroppedData.HasFormat(SOT_FORMAT_RTF) ) + bool bHtml = _aDroppedData.HasFormat(SotClipboardFormatId::HTML); + if ( bHtml || _aDroppedData.HasFormat(SotClipboardFormatId::RTF) ) { bool bOk; if ( bHtml ) - bOk = const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SOT_FORMATSTR_ID_HTML ,_rAsyncDrop.aHtmlRtfStorage); + bOk = const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SotClipboardFormatId::HTML ,_rAsyncDrop.aHtmlRtfStorage); else - bOk = const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SOT_FORMAT_RTF,_rAsyncDrop.aHtmlRtfStorage); + bOk = const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SotClipboardFormatId::RTF,_rAsyncDrop.aHtmlRtfStorage); _rAsyncDrop.bHtml = bHtml; _rAsyncDrop.bError = !copyTagTable(_rAsyncDrop,true,_xConnection); diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx index eb05f2009faa..0cc4c779c3c4 100644 --- a/dbaccess/source/ui/querydesign/JoinExchange.cxx +++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx @@ -56,7 +56,7 @@ namespace dbaui m_pDragListener = NULL; } - bool OJoinExchObj::isFormatAvailable( const DataFlavorExVector& _rFormats ,SotFormatStringId _nSlotID) + bool OJoinExchObj::isFormatAvailable( const DataFlavorExVector& _rFormats ,SotClipboardFormatId _nSlotID) { DataFlavorExVector::const_iterator aCheckEnd = _rFormats.end(); for ( DataFlavorExVector::const_iterator aCheck = _rFormats.begin(); @@ -108,15 +108,15 @@ namespace dbaui void OJoinExchObj::AddSupportedFormats() { - AddFormat( SOT_FORMATSTR_ID_SBA_JOIN ); + AddFormat( SotClipboardFormatId::SBA_JOIN ); if ( m_bFirstEntry ) - AddFormat( SOT_FORMATSTR_ID_SBA_TABID ); + AddFormat( SotClipboardFormatId::SBA_TABID ); } bool OJoinExchObj::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { - sal_uInt32 nFormat = SotExchange::GetFormat(rFlavor); - if ( SOT_FORMATSTR_ID_SBA_JOIN == nFormat ) + SotClipboardFormatId nFormat = SotExchange::GetFormat(rFlavor); + if ( SotClipboardFormatId::SBA_JOIN == nFormat ) // this is a HACK // we don't really copy our data, the instances using us have to call GetSourceDescription .... // if, one day, we have a _lot_ of time, this hack should be removed .... diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx index f11a7b8e155d..1796dcf8e574 100644 --- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx @@ -214,8 +214,8 @@ sal_Int8 OTableWindowListBox::AcceptDrop( const AcceptDropEvent& _rEvt ) { sal_Int8 nDND_Action = DND_ACTION_NONE; // check the format - if ( !OJoinExchObj::isFormatAvailable(GetDataFlavorExVector(),SOT_FORMATSTR_ID_SBA_TABID) // this means that the first entry is to be draged - && OJoinExchObj::isFormatAvailable(GetDataFlavorExVector(),SOT_FORMATSTR_ID_SBA_JOIN) ) + if ( !OJoinExchObj::isFormatAvailable(GetDataFlavorExVector(),SotClipboardFormatId::SBA_TABID) // this means that the first entry is to be draged + && OJoinExchObj::isFormatAvailable(GetDataFlavorExVector(),SotClipboardFormatId::SBA_JOIN) ) { // don't drop into the window if it's the drag source itself // remove the selection if the dragging operation is leaving the window diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index ad3e5287a3f1..d8b907d4183e 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -769,10 +769,10 @@ void OTableEditorCtrl::InsertRows( long nRow ) ::std::vector< ::boost::shared_ptr<OTableRow> > vInsertedUndoRedoRows; // need for undo/redo handling // get rows from clipboard TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent())); - if(aTransferData.HasFormat(SOT_FORMATSTR_ID_SBA_TABED)) + if(aTransferData.HasFormat(SotClipboardFormatId::SBA_TABED)) { SotStorageStreamRef aStreamRef; - bool bOk = aTransferData.GetSotStorageStream(SOT_FORMATSTR_ID_SBA_TABED,aStreamRef); + bool bOk = aTransferData.GetSotStorageStream(SotClipboardFormatId::SBA_TABED,aStreamRef); if (bOk && aStreamRef.Is()) { aStreamRef->Seek(STREAM_SEEK_TO_BEGIN); @@ -1173,11 +1173,11 @@ bool OTableEditorCtrl::IsPasteAllowed( long /*nRow*/ ) if ( bAllowed ) { TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent())); - bool bRowFormat = aTransferData.HasFormat(SOT_FORMATSTR_ID_SBA_TABED); + bool bRowFormat = aTransferData.HasFormat(SotClipboardFormatId::SBA_TABED); if ( m_eChildFocus == ROW ) bAllowed = bRowFormat; else - bAllowed = !bRowFormat && aTransferData.HasFormat(SOT_FORMAT_STRING); + bAllowed = !bRowFormat && aTransferData.HasFormat(SotClipboardFormatId::STRING); } return bAllowed; @@ -1235,7 +1235,7 @@ void OTableEditorCtrl::copy() void OTableEditorCtrl::paste() { TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent())); - if(aTransferData.HasFormat(SOT_FORMATSTR_ID_SBA_TABED)) + if(aTransferData.HasFormat(SotClipboardFormatId::SBA_TABED)) { if( nPasteEvent ) Application::RemoveUserEvent( nPasteEvent ); diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx index 37e68dd35e6e..b6d036b13889 100644 --- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx +++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx @@ -30,9 +30,9 @@ namespace dbaui : m_vTableRow(_rvTableRow) { } - bool OTableRowExchange::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& /*rFlavor*/ ) + bool OTableRowExchange::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, SotClipboardFormatId nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& /*rFlavor*/ ) { - if(nUserObjectId == SOT_FORMATSTR_ID_SBA_TABED) + if(nUserObjectId == SotClipboardFormatId::SBA_TABED) { ::std::vector< ::boost::shared_ptr<OTableRow> >* pRows = reinterpret_cast< ::std::vector< ::boost::shared_ptr<OTableRow> >* >(pUserObject); if(pRows) @@ -50,13 +50,13 @@ namespace dbaui void OTableRowExchange::AddSupportedFormats() { if ( !m_vTableRow.empty() ) - AddFormat(SOT_FORMATSTR_ID_SBA_TABED); + AddFormat(SotClipboardFormatId::SBA_TABED); } bool OTableRowExchange::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { - sal_uLong nFormat = SotExchange::GetFormat(rFlavor); - if(nFormat == SOT_FORMATSTR_ID_SBA_TABED) - return SetObject(&m_vTableRow,SOT_FORMATSTR_ID_SBA_TABED,rFlavor); + SotClipboardFormatId nFormat = SotExchange::GetFormat(rFlavor); + if(nFormat == SotClipboardFormatId::SBA_TABED) + return SetObject(&m_vTableRow,SotClipboardFormatId::SBA_TABED,rFlavor); return false; } void OTableRowExchange::ObjectReleased() |