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 /svtools | |
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 'svtools')
-rw-r--r-- | svtools/source/brwbox/brwbox2.cxx | 4 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 8 | ||||
-rw-r--r-- | svtools/source/dialogs/insdlg.cxx | 144 | ||||
-rw-r--r-- | svtools/source/misc/embedtransfer.cxx | 20 | ||||
-rw-r--r-- | svtools/source/misc/openfiledroptargetlistener.cxx | 10 | ||||
-rw-r--r-- | svtools/source/misc/stringtransfer.cxx | 10 | ||||
-rw-r--r-- | svtools/source/misc/transfer.cxx | 172 | ||||
-rw-r--r-- | svtools/source/misc/transfer2.cxx | 63 | ||||
-rw-r--r-- | svtools/source/urlobj/inetimg.cxx | 14 |
9 files changed, 224 insertions, 221 deletions
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index b64b7c4d70a4..5eb10d95e61f 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -86,7 +86,7 @@ void* BrowseBox::implGetDataFlavors() const -bool BrowseBox::IsDropFormatSupported( SotFormatStringId _nFormat ) +bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat ) { if ( static_cast< BrowserDataWin* >( pDataWin )->bCallingDropCallback ) return static_cast< BrowserDataWin* >( pDataWin )->IsDropFormatSupported( _nFormat ); @@ -96,7 +96,7 @@ bool BrowseBox::IsDropFormatSupported( SotFormatStringId _nFormat ) -bool BrowseBox::IsDropFormatSupported( SotFormatStringId _nFormat ) const +bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat ) const { return const_cast< BrowseBox* >( this )->IsDropFormatSupported( _nFormat ); } diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index fcb1836103bd..581485ab6789 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1223,7 +1223,7 @@ sal_Int8 SvTreeListBox::AcceptDrop( const AcceptDropEvent& rEvt ) else { SvTreeListEntry* pEntry = GetDropTarget( rEvt.maPosPixel ); - if( !IsDropFormatSupported( SOT_FORMATSTR_ID_TREELISTBOX ) ) + if( !IsDropFormatSupported( SotClipboardFormatId::TREELISTBOX ) ) { SAL_WARN( "svtools.contnr", "SvTreeListBox::QueryDrop(): no format" ); } @@ -1265,9 +1265,9 @@ sal_Int8 SvTreeListBox::ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox SvLBoxDDInfo aDDInfo; TransferableDataHelper aData( rEvt.maDropEvent.Transferable ); - if( aData.HasFormat( SOT_FORMATSTR_ID_TREELISTBOX )) + if( aData.HasFormat( SotClipboardFormatId::TREELISTBOX )) { - css::uno::Sequence<sal_Int8> aSeq = aData.GetSequence(SOT_FORMATSTR_ID_TREELISTBOX, OUString()); + css::uno::Sequence<sal_Int8> aSeq = aData.GetSequence(SotClipboardFormatId::TREELISTBOX, OUString()); if (sizeof(SvLBoxDDInfo) == aSeq.getLength()) { memcpy( &aDDInfo, aSeq.getConstArray(), sizeof(SvLBoxDDInfo) ); @@ -1347,7 +1347,7 @@ void SvTreeListBox::StartDrag( sal_Int8, const Point& rPosPixel ) // let derived views do their thing WriteDragServerInfo( rPosPixel, &aDDInfo ); - pContainer->CopyAnyData( SOT_FORMATSTR_ID_TREELISTBOX, + pContainer->CopyAnyData( SotClipboardFormatId::TREELISTBOX, reinterpret_cast<char*>(&aDDInfo), sizeof(SvLBoxDDInfo) ); pDDSource = this; pDDTarget = 0; diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index c7d9aa09719d..e7aec0197af7 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -188,82 +188,82 @@ void SvObjectServerList::FillInsertObjects() } } -OUString SvPasteObjectHelper::GetSotFormatUIName( SotFormatStringId nId ) +OUString SvPasteObjectHelper::GetSotFormatUIName( SotClipboardFormatId nId ) { struct SotResourcePair { - SotFormatStringId mnSotId; + SotClipboardFormatId mnSotId; sal_uInt16 mnResId; }; static const SotResourcePair aSotResourcePairs[] = { - { SOT_FORMAT_STRING, STR_FORMAT_STRING }, - { SOT_FORMAT_BITMAP, STR_FORMAT_BITMAP }, - { SOT_FORMAT_GDIMETAFILE, STR_FORMAT_GDIMETAFILE }, - { SOT_FORMAT_RTF, STR_FORMAT_RTF }, - { SOT_FORMATSTR_ID_DRAWING, STR_FORMAT_ID_DRAWING }, - { SOT_FORMATSTR_ID_SVXB, STR_FORMAT_ID_SVXB }, - { SOT_FORMATSTR_ID_INTERNALLINK_STATE, STR_FORMAT_ID_INTERNALLINK_STATE }, - { SOT_FORMATSTR_ID_SOLK, STR_FORMAT_ID_SOLK }, - { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, STR_FORMAT_ID_NETSCAPE_BOOKMARK }, - { SOT_FORMATSTR_ID_STARSERVER, STR_FORMAT_ID_STARSERVER }, - { SOT_FORMATSTR_ID_STAROBJECT, STR_FORMAT_ID_STAROBJECT }, - { SOT_FORMATSTR_ID_APPLETOBJECT, STR_FORMAT_ID_APPLETOBJECT }, - { SOT_FORMATSTR_ID_PLUGIN_OBJECT, STR_FORMAT_ID_PLUGIN_OBJECT }, - { SOT_FORMATSTR_ID_STARWRITER_30, STR_FORMAT_ID_STARWRITER_30 }, - { SOT_FORMATSTR_ID_STARWRITER_40, STR_FORMAT_ID_STARWRITER_40 }, - { SOT_FORMATSTR_ID_STARWRITER_50, STR_FORMAT_ID_STARWRITER_50 }, - { SOT_FORMATSTR_ID_STARWRITERWEB_40, STR_FORMAT_ID_STARWRITERWEB_40 }, - { SOT_FORMATSTR_ID_STARWRITERWEB_50, STR_FORMAT_ID_STARWRITERWEB_50 }, - { SOT_FORMATSTR_ID_STARWRITERGLOB_40, STR_FORMAT_ID_STARWRITERGLOB_40 }, - { SOT_FORMATSTR_ID_STARWRITERGLOB_50, STR_FORMAT_ID_STARWRITERGLOB_50 }, - { SOT_FORMATSTR_ID_STARDRAW, STR_FORMAT_ID_STARDRAW }, - { SOT_FORMATSTR_ID_STARDRAW_40, STR_FORMAT_ID_STARDRAW_40 }, - { SOT_FORMATSTR_ID_STARIMPRESS_50, STR_FORMAT_ID_STARIMPRESS_50 }, - { SOT_FORMATSTR_ID_STARDRAW_50, STR_FORMAT_ID_STARDRAW_50 }, - { SOT_FORMATSTR_ID_STARCALC, STR_FORMAT_ID_STARCALC }, - { SOT_FORMATSTR_ID_STARCALC_40, STR_FORMAT_ID_STARCALC_40 }, - { SOT_FORMATSTR_ID_STARCALC_50, STR_FORMAT_ID_STARCALC_50 }, - { SOT_FORMATSTR_ID_STARCHART, STR_FORMAT_ID_STARCHART }, - { SOT_FORMATSTR_ID_STARCHART_40, STR_FORMAT_ID_STARCHART_40 }, - { SOT_FORMATSTR_ID_STARCHART_50, STR_FORMAT_ID_STARCHART_50 }, - { SOT_FORMATSTR_ID_STARIMAGE, STR_FORMAT_ID_STARIMAGE }, - { SOT_FORMATSTR_ID_STARIMAGE_40, STR_FORMAT_ID_STARIMAGE_40 }, - { SOT_FORMATSTR_ID_STARIMAGE_50, STR_FORMAT_ID_STARIMAGE_50 }, - { SOT_FORMATSTR_ID_STARMATH, STR_FORMAT_ID_STARMATH }, - { SOT_FORMATSTR_ID_STARMATH_40, STR_FORMAT_ID_STARMATH_40 }, - { SOT_FORMATSTR_ID_STARMATH_50, STR_FORMAT_ID_STARMATH_50 }, - { SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC, STR_FORMAT_ID_STAROBJECT_PAINTDOC }, - { SOT_FORMATSTR_ID_HTML, STR_FORMAT_ID_HTML }, - { SOT_FORMATSTR_ID_HTML_SIMPLE, STR_FORMAT_ID_HTML_SIMPLE }, - { SOT_FORMATSTR_ID_BIFF_5, STR_FORMAT_ID_BIFF_5 }, - { SOT_FORMATSTR_ID_BIFF_8, STR_FORMAT_ID_BIFF_8 }, - { SOT_FORMATSTR_ID_SYLK, STR_FORMAT_ID_SYLK }, - { SOT_FORMATSTR_ID_LINK, STR_FORMAT_ID_LINK }, - { SOT_FORMATSTR_ID_DIF, STR_FORMAT_ID_DIF }, - { SOT_FORMATSTR_ID_MSWORD_DOC, STR_FORMAT_ID_MSWORD_DOC }, - { SOT_FORMATSTR_ID_STAR_FRAMESET_DOC, STR_FORMAT_ID_STAR_FRAMESET_DOC }, - { SOT_FORMATSTR_ID_OFFICE_DOC, STR_FORMAT_ID_OFFICE_DOC }, - { SOT_FORMATSTR_ID_NOTES_DOCINFO, STR_FORMAT_ID_NOTES_DOCINFO }, - { SOT_FORMATSTR_ID_SFX_DOC, STR_FORMAT_ID_SFX_DOC }, - { SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50,STR_FORMAT_ID_STARCHARTDOCUMENT_50 }, - { SOT_FORMATSTR_ID_GRAPHOBJ, STR_FORMAT_ID_GRAPHOBJ }, - { SOT_FORMATSTR_ID_STARWRITER_60, STR_FORMAT_ID_STARWRITER_60 }, - { SOT_FORMATSTR_ID_STARWRITERWEB_60, STR_FORMAT_ID_STARWRITERWEB_60 }, - { SOT_FORMATSTR_ID_STARWRITERGLOB_60, STR_FORMAT_ID_STARWRITERGLOB_60 }, - { SOT_FORMATSTR_ID_STARDRAW_60, STR_FORMAT_ID_STARDRAW_60 }, - { SOT_FORMATSTR_ID_STARIMPRESS_60, STR_FORMAT_ID_STARIMPRESS_60 }, - { SOT_FORMATSTR_ID_STARCALC_60, STR_FORMAT_ID_STARCALC_60 }, - { SOT_FORMATSTR_ID_STARCHART_60, STR_FORMAT_ID_STARCHART_60 }, - { SOT_FORMATSTR_ID_STARMATH_60, STR_FORMAT_ID_STARMATH_60 }, - { SOT_FORMATSTR_ID_WMF, STR_FORMAT_ID_WMF }, - { SOT_FORMATSTR_ID_DBACCESS_QUERY, STR_FORMAT_ID_DBACCESS_QUERY }, - { SOT_FORMATSTR_ID_DBACCESS_TABLE, STR_FORMAT_ID_DBACCESS_TABLE }, - { SOT_FORMATSTR_ID_DBACCESS_COMMAND, STR_FORMAT_ID_DBACCESS_COMMAND }, - { SOT_FORMATSTR_ID_DIALOG_60, STR_FORMAT_ID_DIALOG_60 }, - { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, STR_FORMAT_ID_FILEGRPDESCRIPTOR }, - { SOT_FORMATSTR_ID_HTML_NO_COMMENT, STR_FORMAT_ID_HTML_NO_COMMENT } + { SotClipboardFormatId::STRING, STR_FORMAT_STRING }, + { SotClipboardFormatId::BITMAP, STR_FORMAT_BITMAP }, + { SotClipboardFormatId::GDIMETAFILE, STR_FORMAT_GDIMETAFILE }, + { SotClipboardFormatId::RTF, STR_FORMAT_RTF }, + { SotClipboardFormatId::DRAWING, STR_FORMAT_ID_DRAWING }, + { SotClipboardFormatId::SVXB, STR_FORMAT_ID_SVXB }, + { SotClipboardFormatId::INTERNALLINK_STATE, STR_FORMAT_ID_INTERNALLINK_STATE }, + { SotClipboardFormatId::SOLK, STR_FORMAT_ID_SOLK }, + { SotClipboardFormatId::NETSCAPE_BOOKMARK, STR_FORMAT_ID_NETSCAPE_BOOKMARK }, + { SotClipboardFormatId::STARSERVER, STR_FORMAT_ID_STARSERVER }, + { SotClipboardFormatId::STAROBJECT, STR_FORMAT_ID_STAROBJECT }, + { SotClipboardFormatId::APPLETOBJECT, STR_FORMAT_ID_APPLETOBJECT }, + { SotClipboardFormatId::PLUGIN_OBJECT, STR_FORMAT_ID_PLUGIN_OBJECT }, + { SotClipboardFormatId::STARWRITER_30, STR_FORMAT_ID_STARWRITER_30 }, + { SotClipboardFormatId::STARWRITER_40, STR_FORMAT_ID_STARWRITER_40 }, + { SotClipboardFormatId::STARWRITER_50, STR_FORMAT_ID_STARWRITER_50 }, + { SotClipboardFormatId::STARWRITERWEB_40, STR_FORMAT_ID_STARWRITERWEB_40 }, + { SotClipboardFormatId::STARWRITERWEB_50, STR_FORMAT_ID_STARWRITERWEB_50 }, + { SotClipboardFormatId::STARWRITERGLOB_40, STR_FORMAT_ID_STARWRITERGLOB_40 }, + { SotClipboardFormatId::STARWRITERGLOB_50, STR_FORMAT_ID_STARWRITERGLOB_50 }, + { SotClipboardFormatId::STARDRAW, STR_FORMAT_ID_STARDRAW }, + { SotClipboardFormatId::STARDRAW_40, STR_FORMAT_ID_STARDRAW_40 }, + { SotClipboardFormatId::STARIMPRESS_50, STR_FORMAT_ID_STARIMPRESS_50 }, + { SotClipboardFormatId::STARDRAW_50, STR_FORMAT_ID_STARDRAW_50 }, + { SotClipboardFormatId::STARCALC, STR_FORMAT_ID_STARCALC }, + { SotClipboardFormatId::STARCALC_40, STR_FORMAT_ID_STARCALC_40 }, + { SotClipboardFormatId::STARCALC_50, STR_FORMAT_ID_STARCALC_50 }, + { SotClipboardFormatId::STARCHART, STR_FORMAT_ID_STARCHART }, + { SotClipboardFormatId::STARCHART_40, STR_FORMAT_ID_STARCHART_40 }, + { SotClipboardFormatId::STARCHART_50, STR_FORMAT_ID_STARCHART_50 }, + { SotClipboardFormatId::STARIMAGE, STR_FORMAT_ID_STARIMAGE }, + { SotClipboardFormatId::STARIMAGE_40, STR_FORMAT_ID_STARIMAGE_40 }, + { SotClipboardFormatId::STARIMAGE_50, STR_FORMAT_ID_STARIMAGE_50 }, + { SotClipboardFormatId::STARMATH, STR_FORMAT_ID_STARMATH }, + { SotClipboardFormatId::STARMATH_40, STR_FORMAT_ID_STARMATH_40 }, + { SotClipboardFormatId::STARMATH_50, STR_FORMAT_ID_STARMATH_50 }, + { SotClipboardFormatId::STAROBJECT_PAINTDOC, STR_FORMAT_ID_STAROBJECT_PAINTDOC }, + { SotClipboardFormatId::HTML, STR_FORMAT_ID_HTML }, + { SotClipboardFormatId::HTML_SIMPLE, STR_FORMAT_ID_HTML_SIMPLE }, + { SotClipboardFormatId::BIFF_5, STR_FORMAT_ID_BIFF_5 }, + { SotClipboardFormatId::BIFF_8, STR_FORMAT_ID_BIFF_8 }, + { SotClipboardFormatId::SYLK, STR_FORMAT_ID_SYLK }, + { SotClipboardFormatId::LINK, STR_FORMAT_ID_LINK }, + { SotClipboardFormatId::DIF, STR_FORMAT_ID_DIF }, + { SotClipboardFormatId::MSWORD_DOC, STR_FORMAT_ID_MSWORD_DOC }, + { SotClipboardFormatId::STAR_FRAMESET_DOC, STR_FORMAT_ID_STAR_FRAMESET_DOC }, + { SotClipboardFormatId::OFFICE_DOC, STR_FORMAT_ID_OFFICE_DOC }, + { SotClipboardFormatId::NOTES_DOCINFO, STR_FORMAT_ID_NOTES_DOCINFO }, + { SotClipboardFormatId::SFX_DOC, STR_FORMAT_ID_SFX_DOC }, + { SotClipboardFormatId::STARCHARTDOCUMENT_50,STR_FORMAT_ID_STARCHARTDOCUMENT_50 }, + { SotClipboardFormatId::GRAPHOBJ, STR_FORMAT_ID_GRAPHOBJ }, + { SotClipboardFormatId::STARWRITER_60, STR_FORMAT_ID_STARWRITER_60 }, + { SotClipboardFormatId::STARWRITERWEB_60, STR_FORMAT_ID_STARWRITERWEB_60 }, + { SotClipboardFormatId::STARWRITERGLOB_60, STR_FORMAT_ID_STARWRITERGLOB_60 }, + { SotClipboardFormatId::STARDRAW_60, STR_FORMAT_ID_STARDRAW_60 }, + { SotClipboardFormatId::STARIMPRESS_60, STR_FORMAT_ID_STARIMPRESS_60 }, + { SotClipboardFormatId::STARCALC_60, STR_FORMAT_ID_STARCALC_60 }, + { SotClipboardFormatId::STARCHART_60, STR_FORMAT_ID_STARCHART_60 }, + { SotClipboardFormatId::STARMATH_60, STR_FORMAT_ID_STARMATH_60 }, + { SotClipboardFormatId::WMF, STR_FORMAT_ID_WMF }, + { SotClipboardFormatId::DBACCESS_QUERY, STR_FORMAT_ID_DBACCESS_QUERY }, + { SotClipboardFormatId::DBACCESS_TABLE, STR_FORMAT_ID_DBACCESS_TABLE }, + { SotClipboardFormatId::DBACCESS_COMMAND, STR_FORMAT_ID_DBACCESS_COMMAND }, + { SotClipboardFormatId::DIALOG_60, STR_FORMAT_ID_DIALOG_60 }, + { SotClipboardFormatId::FILEGRPDESCRIPTOR, STR_FORMAT_ID_FILEGRPDESCRIPTOR }, + { SotClipboardFormatId::HTML_NO_COMMENT, STR_FORMAT_ID_HTML_NO_COMMENT } }; OUString aUIName; @@ -283,13 +283,13 @@ OUString SvPasteObjectHelper::GetSotFormatUIName( SotFormatStringId nId ) return aUIName; } -bool SvPasteObjectHelper::GetEmbeddedName(const TransferableDataHelper& rData, OUString& _rName, OUString& _rSource, SotFormatStringId& _nFormat) +bool SvPasteObjectHelper::GetEmbeddedName(const TransferableDataHelper& rData, OUString& _rName, OUString& _rSource, SotClipboardFormatId& _nFormat) { bool bRet = false; - if( _nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE_OLE || _nFormat == SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ) + if( _nFormat == SotClipboardFormatId::EMBED_SOURCE_OLE || _nFormat == SotClipboardFormatId::EMBEDDED_OBJ_OLE ) { datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE, aFlavor ); + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::OBJECTDESCRIPTOR_OLE, aFlavor ); uno::Any aAny; if( rData.HasFormat( aFlavor ) && @@ -315,7 +315,7 @@ bool SvPasteObjectHelper::GetEmbeddedName(const TransferableDataHelper& rData, O _rName += pUserTypeName; // the following statement was here for historical reasons, it is commented out since it causes bug i49460 - // _nFormat = SOT_FORMATSTR_ID_EMBED_SOURCE_OLE; + // _nFormat = SotClipboardFormatId::EMBED_SOURCE_OLE; } // determine the source of the embedded object diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index da622b09a1ad..836b98977238 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -73,10 +73,10 @@ void SvEmbedTransferHelper::SetParentShellID( const OUString& rShellID ) void SvEmbedTransferHelper::AddSupportedFormats() { - AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ); - AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); - AddFormat( FORMAT_GDIMETAFILE ); - AddFormat( FORMAT_BITMAP ); + AddFormat( SotClipboardFormatId::EMBED_SOURCE ); + AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ); + AddFormat( SotClipboardFormatId::GDIMETAFILE ); + AddFormat( SotClipboardFormatId::BITMAP ); } @@ -89,16 +89,16 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo { try { - sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); + SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor ); if( HasFormat( nFormat ) ) { - if( nFormat == SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) + if( nFormat == SotClipboardFormatId::OBJECTDESCRIPTOR ) { TransferableObjectDescriptor aDesc; FillTransferableObjectDescriptor( aDesc, m_xObj, m_pGraphic, m_nAspect ); bRet = SetTransferableObjectDescriptor( aDesc, rFlavor ); } - else if( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE ) + else if( nFormat == SotClipboardFormatId::EMBED_SOURCE ) { try { @@ -157,7 +157,7 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo { } } - else if ( nFormat == FORMAT_GDIMETAFILE && m_pGraphic ) + else if ( nFormat == SotClipboardFormatId::GDIMETAFILE && m_pGraphic ) { SvMemoryStream aMemStm( 65535, 65535 ); aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); @@ -170,7 +170,7 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo SetAny( aAny, rFlavor ); bRet = true; } - else if ( ( nFormat == FORMAT_BITMAP || nFormat == SOT_FORMATSTR_ID_PNG ) && m_pGraphic ) + else if ( ( nFormat == SotClipboardFormatId::BITMAP || nFormat == SotClipboardFormatId::PNG ) && m_pGraphic ) { bRet = SetBitmapEx( m_pGraphic->GetBitmapEx(), rFlavor ); } @@ -209,7 +209,7 @@ void SvEmbedTransferHelper::FillTransferableObjectDescriptor( TransferableObject { //TODO/LATER: need TypeName to fill it into the Descriptor (will be shown in listbox) ::com::sun::star::datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aFlavor ); + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::OBJECTDESCRIPTOR, aFlavor ); rDesc.maClassName = SvGlobalName( xObj->getClassID() ); rDesc.maTypeName = aFlavor.HumanPresentableName; diff --git a/svtools/source/misc/openfiledroptargetlistener.cxx b/svtools/source/misc/openfiledroptargetlistener.cxx index e50cb0b35293..042c5c78ab7a 100644 --- a/svtools/source/misc/openfiledroptargetlistener.cxx +++ b/svtools/source/misc/openfiledroptargetlistener.cxx @@ -78,7 +78,7 @@ void SAL_CALL OpenFileDropTargetListener::drop( const css::datatransfer::dnd::Dr FileList aFileList; // at first check filelist format - if ( aHelper.GetFileList( SOT_FORMAT_FILE_LIST, aFileList ) ) + if ( aHelper.GetFileList( SotClipboardFormatId::FILE_LIST, aFileList ) ) { sal_uLong i, nCount = aFileList.Count(); for ( i = 0; i < nCount; ++i ) @@ -88,7 +88,7 @@ void SAL_CALL OpenFileDropTargetListener::drop( const css::datatransfer::dnd::Dr // then, if necessary, the file format OUString aFilePath; - if ( !bFormatFound && aHelper.GetString( SOT_FORMAT_FILE, aFilePath ) ) + if ( !bFormatFound && aHelper.GetString( SotClipboardFormatId::FILE, aFilePath ) ) implts_OpenFile( aFilePath ); } dtde.Context->dropComplete( css::datatransfer::dnd::DNDConstants::ACTION_NONE != nAction ); @@ -132,8 +132,8 @@ void SAL_CALL OpenFileDropTargetListener::dragOver( const css::datatransfer::dnd { try { - bool bAccept = ( implts_IsDropFormatSupported( SOT_FORMAT_FILE ) || - implts_IsDropFormatSupported( SOT_FORMAT_FILE_LIST ) ); + bool bAccept = ( implts_IsDropFormatSupported( SotClipboardFormatId::FILE ) || + implts_IsDropFormatSupported( SotClipboardFormatId::FILE_LIST ) ); if ( !bAccept ) dtde.Context->rejectDrag(); @@ -170,7 +170,7 @@ void OpenFileDropTargetListener::implts_EndDrag() /* } SAFE */ } -bool OpenFileDropTargetListener::implts_IsDropFormatSupported( SotFormatStringId nFormat ) +bool OpenFileDropTargetListener::implts_IsDropFormatSupported( SotClipboardFormatId nFormat ) { /* SAFE { */ SolarMutexGuard aGuard; diff --git a/svtools/source/misc/stringtransfer.cxx b/svtools/source/misc/stringtransfer.cxx index 0c8637f46c14..da7396101cfa 100644 --- a/svtools/source/misc/stringtransfer.cxx +++ b/svtools/source/misc/stringtransfer.cxx @@ -40,14 +40,14 @@ namespace svt void OStringTransferable::AddSupportedFormats() { - AddFormat(SOT_FORMAT_STRING); + AddFormat(SotClipboardFormatId::STRING); } bool OStringTransferable::GetData( const DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { - sal_uInt32 nFormat = SotExchange::GetFormat( _rFlavor ); - if (SOT_FORMAT_STRING == nFormat) + SotClipboardFormatId nFormat = SotExchange::GetFormat( _rFlavor ); + if (SotClipboardFormatId::STRING == nFormat) return SetString( m_sContent, _rFlavor ); return false; @@ -76,10 +76,10 @@ namespace svt ++aSearch ) { - if (SOT_FORMAT_STRING == aSearch->mnSotId) + if (SotClipboardFormatId::STRING == aSearch->mnSotId) { OUString sContent; - bool bSuccess = aClipboardData.GetString( SOT_FORMAT_STRING, sContent ); + bool bSuccess = aClipboardData.GetString( SotClipboardFormatId::STRING, sContent ); _rContent = sContent; return bSuccess; } diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 255ba7fe3bb7..5c2ccbe7b414 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -325,22 +325,22 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co AddSupportedFormats(); // check alien formats first and try to get a substitution format - if( SotExchange::GetFormatDataFlavor( FORMAT_STRING, aSubstFlavor ) && + if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aSubstFlavor ) && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) ) { GetData(aSubstFlavor, rDestDoc); bDone = maAny.hasValue(); } - else if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_BMP, aSubstFlavor ) + else if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::BMP, aSubstFlavor ) && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) - && SotExchange::GetFormatDataFlavor(FORMAT_BITMAP, aSubstFlavor)) + && SotExchange::GetFormatDataFlavor(SotClipboardFormatId::BITMAP, aSubstFlavor)) { GetData(aSubstFlavor, rDestDoc); bDone = true; } - else if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_EMF, aSubstFlavor ) && + else if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EMF, aSubstFlavor ) && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) && - SotExchange::GetFormatDataFlavor( FORMAT_GDIMETAFILE, aSubstFlavor ) ) + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aSubstFlavor ) ) { GetData(aSubstFlavor, rDestDoc); @@ -368,9 +368,9 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co } } } - else if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_WMF, aSubstFlavor ) && + else if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::WMF, aSubstFlavor ) && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) && - SotExchange::GetFormatDataFlavor( FORMAT_GDIMETAFILE, aSubstFlavor ) ) + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aSubstFlavor ) ) { GetData(aSubstFlavor, rDestDoc); @@ -589,7 +589,7 @@ void TransferableHelper::ImplFlush() -void TransferableHelper::AddFormat( SotFormatStringId nFormat ) +void TransferableHelper::AddFormat( SotClipboardFormatId nFormat ) { DataFlavor aFlavor; @@ -607,12 +607,12 @@ void TransferableHelper::AddFormat( const DataFlavor& rFlavor ) { if( TransferableDataHelper::IsEqual( *aIter, rFlavor ) ) { - // update MimeType for SOT_FORMATSTR_ID_OBJECTDESCRIPTOR in every case - if( ( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR == aIter->mnSotId ) && mpObjDesc ) + // update MimeType for SotClipboardFormatId::OBJECTDESCRIPTOR in every case + if( ( SotClipboardFormatId::OBJECTDESCRIPTOR == aIter->mnSotId ) && mpObjDesc ) { DataFlavor aObjDescFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDescFlavor ); + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::OBJECTDESCRIPTOR, aObjDescFlavor ); aIter->MimeType = aObjDescFlavor.MimeType; aIter->MimeType += ::ImplGetParameterString( *mpObjDesc ); @@ -637,27 +637,27 @@ void TransferableHelper::AddFormat( const DataFlavor& rFlavor ) aFlavorEx.DataType = rFlavor.DataType; aFlavorEx.mnSotId = SotExchange::RegisterFormat( rFlavor ); - if( ( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR == aFlavorEx.mnSotId ) && mpObjDesc ) + if( ( SotClipboardFormatId::OBJECTDESCRIPTOR == aFlavorEx.mnSotId ) && mpObjDesc ) aFlavorEx.MimeType += ::ImplGetParameterString( *mpObjDesc ); mpFormats->push_back( aFlavorEx ); - if( FORMAT_BITMAP == aFlavorEx.mnSotId ) + if( SotClipboardFormatId::BITMAP == aFlavorEx.mnSotId ) { - AddFormat( SOT_FORMATSTR_ID_PNG ); - AddFormat( SOT_FORMATSTR_ID_BMP ); + AddFormat( SotClipboardFormatId::PNG ); + AddFormat( SotClipboardFormatId::BMP ); } - else if( FORMAT_GDIMETAFILE == aFlavorEx.mnSotId ) + else if( SotClipboardFormatId::GDIMETAFILE == aFlavorEx.mnSotId ) { - AddFormat( SOT_FORMATSTR_ID_EMF ); - AddFormat( SOT_FORMATSTR_ID_WMF ); + AddFormat( SotClipboardFormatId::EMF ); + AddFormat( SotClipboardFormatId::WMF ); } } } -void TransferableHelper::RemoveFormat( SotFormatStringId nFormat ) +void TransferableHelper::RemoveFormat( SotClipboardFormatId nFormat ) { DataFlavor aFlavor; @@ -682,7 +682,7 @@ void TransferableHelper::RemoveFormat( const DataFlavor& rFlavor ) -bool TransferableHelper::HasFormat( SotFormatStringId nFormat ) +bool TransferableHelper::HasFormat( SotClipboardFormatId nFormat ) { bool bRet = false; @@ -721,7 +721,7 @@ bool TransferableHelper::SetString( const OUString& rString, const DataFlavor& r DataFlavor aFileFlavor; if( !rString.isEmpty() && - SotExchange::GetFormatDataFlavor( FORMAT_FILE, aFileFlavor ) && + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::FILE, aFileFlavor ) && TransferableDataHelper::IsEqual( aFileFlavor, rFlavor ) ) { const OString aByteStr(OUStringToOString(rString, osl_getThreadTextEncoding())); @@ -846,7 +846,7 @@ bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk, switch( SotExchange::GetFormat( rFlavor ) ) { - case( SOT_FORMATSTR_ID_SOLK ): + case SotClipboardFormatId::SOLK: { OString sURL(OUStringToOString(rBmk.GetURL(), eSysCSet)); OString sDesc(OUStringToOString(rBmk.GetDescription(), eSysCSet)); @@ -862,11 +862,11 @@ bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk, } break; - case( FORMAT_STRING ): + case SotClipboardFormatId::STRING: maAny <<= OUString( rBmk.GetURL() ); break; - case( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ): + case SotClipboardFormatId::UNIFORMRESOURCELOCATOR: { OString sURL(OUStringToOString(rBmk.GetURL(), eSysCSet)); Sequence< sal_Int8 > aSeq( sURL.getLength() ); @@ -875,7 +875,7 @@ bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk, } break; - case( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ): + case SotClipboardFormatId::NETSCAPE_BOOKMARK: { Sequence< sal_Int8 > aSeq( 2048 ); @@ -888,7 +888,7 @@ bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk, break; #ifdef WNT - case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR: + case SotClipboardFormatId::FILEGRPDESCRIPTOR: { Sequence< sal_Int8 > aSeq( sizeof( FILEGROUPDESCRIPTOR ) ); FILEGROUPDESCRIPTOR* pFDesc = (FILEGROUPDESCRIPTOR*) aSeq.getArray(); @@ -912,7 +912,7 @@ bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk, } break; - case SOT_FORMATSTR_ID_FILECONTENT: + case SotClipboardFormatId::FILECONTENT: { OUString aStr( "[InternetShortcut]\x0aURL=" ); maAny <<= ( aStr += rBmk.GetURL() ); @@ -944,7 +944,7 @@ bool TransferableHelper::SetINetImage( const INetImage& rINtImg, -bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const DataFlavor& rFlavor ) +bool TransferableHelper::SetObject( void* pUserObject, SotClipboardFormatId nUserObjectId, const DataFlavor& rFlavor ) { SotStorageStreamRef xStm( new SotStorageStream( OUString() ) ); @@ -958,7 +958,7 @@ bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, xStm->Seek( STREAM_SEEK_TO_BEGIN ); xStm->Read( aSeq.getArray(), nLen ); - if( nLen && ( SotExchange::GetFormat( rFlavor ) == SOT_FORMAT_STRING ) ) + if( nLen && ( SotExchange::GetFormat( rFlavor ) == SotClipboardFormatId::STRING ) ) { //JP 24.7.2001: as I know was this only for the writer application and this // writes now UTF16 format into the stream @@ -975,7 +975,7 @@ bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, -bool TransferableHelper::WriteObject( SotStorageStreamRef&, void*, sal_uInt32, const DataFlavor& ) +bool TransferableHelper::WriteObject( SotStorageStreamRef&, void*, SotClipboardFormatId, const DataFlavor& ) { OSL_FAIL( "TransferableHelper::WriteObject( ... ) not implemented" ); return false; @@ -1000,8 +1000,8 @@ void TransferableHelper::PrepareOLE( const TransferableObjectDescriptor& rObjDes delete mpObjDesc; mpObjDesc = new TransferableObjectDescriptor( rObjDesc ); - if( HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) ) - AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); + if( HasFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ) ) + AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ); } @@ -1357,26 +1357,26 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor rDataFlavorExVector.push_back( aFlavorEx ); // add additional formats for special mime types - if(SOT_FORMATSTR_ID_BMP == aFlavorEx.mnSotId || SOT_FORMATSTR_ID_PNG == aFlavorEx.mnSotId) + if(SotClipboardFormatId::BMP == aFlavorEx.mnSotId || SotClipboardFormatId::PNG == aFlavorEx.mnSotId) { - if( SotExchange::GetFormatDataFlavor( SOT_FORMAT_BITMAP, aFlavorEx ) ) + if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::BITMAP, aFlavorEx ) ) { - aFlavorEx.mnSotId = SOT_FORMAT_BITMAP; + aFlavorEx.mnSotId = SotClipboardFormatId::BITMAP; rDataFlavorExVector.push_back( aFlavorEx ); } } - else if( SOT_FORMATSTR_ID_WMF == aFlavorEx.mnSotId || SOT_FORMATSTR_ID_EMF == aFlavorEx.mnSotId ) + else if( SotClipboardFormatId::WMF == aFlavorEx.mnSotId || SotClipboardFormatId::EMF == aFlavorEx.mnSotId ) { - if( SotExchange::GetFormatDataFlavor( SOT_FORMAT_GDIMETAFILE, aFlavorEx ) ) + if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aFlavorEx ) ) { - aFlavorEx.mnSotId = SOT_FORMAT_GDIMETAFILE; + aFlavorEx.mnSotId = SotClipboardFormatId::GDIMETAFILE; rDataFlavorExVector.push_back( aFlavorEx ); } } - else if ( SOT_FORMATSTR_ID_HTML_SIMPLE == aFlavorEx.mnSotId ) + else if ( SotClipboardFormatId::HTML_SIMPLE == aFlavorEx.mnSotId ) { // #104735# HTML_SIMPLE may also be inserted without comments - aFlavorEx.mnSotId = SOT_FORMATSTR_ID_HTML_NO_COMMENT; + aFlavorEx.mnSotId = SotClipboardFormatId::HTML_NO_COMMENT; rDataFlavorExVector.push_back( aFlavorEx ); } else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/plain" ) ) @@ -1387,27 +1387,27 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor if( xMimeType->getParameterValue( aCharsetStr ).equalsIgnoreAsciiCase( "unicode" ) || xMimeType->getParameterValue( aCharsetStr ).equalsIgnoreAsciiCase( "utf-16" ) ) { - rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = FORMAT_STRING; + rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::STRING; } } } else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/rtf" ) ) { - rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = FORMAT_RTF; + rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::RTF; } else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/html" ) ) { - rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SOT_FORMATSTR_ID_HTML; + rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::HTML; } else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/uri-list" ) ) { - rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SOT_FORMAT_FILE_LIST; + rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::FILE_LIST; } else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "application/x-openoffice-objectdescriptor-xml" ) ) { - rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SOT_FORMATSTR_ID_OBJECTDESCRIPTOR; + rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::OBJECTDESCRIPTOR; } } } @@ -1432,7 +1432,7 @@ void TransferableDataHelper::InitFormats() for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter) { - if( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR == aIter->mnSotId ) + if( SotClipboardFormatId::OBJECTDESCRIPTOR == aIter->mnSotId ) { ImplSetParameterString( *mpObjDesc, *aIter ); break; @@ -1443,7 +1443,7 @@ void TransferableDataHelper::InitFormats() -bool TransferableDataHelper::HasFormat( SotFormatStringId nFormat ) const +bool TransferableDataHelper::HasFormat( SotClipboardFormatId nFormat ) const { ::osl::MutexGuard aGuard( mpImpl->maMutex ); @@ -1494,11 +1494,11 @@ sal_uInt32 TransferableDataHelper::GetFormatCount() const -SotFormatStringId TransferableDataHelper::GetFormat( sal_uInt32 nFormat ) const +SotClipboardFormatId TransferableDataHelper::GetFormat( sal_uInt32 nFormat ) const { ::osl::MutexGuard aGuard( mpImpl->maMutex ); DBG_ASSERT( nFormat < mpFormats->size(), "TransferableDataHelper::GetFormat: invalid format index" ); - return( ( nFormat < mpFormats->size() ) ? (*mpFormats)[ nFormat ].mnSotId : 0 ); + return( ( nFormat < mpFormats->size() ) ? (*mpFormats)[ nFormat ].mnSotId : SotClipboardFormatId::NONE ); } @@ -1543,7 +1543,7 @@ Reference< XTransferable > TransferableDataHelper::GetXTransferable() const -Any TransferableDataHelper::GetAny( SotFormatStringId nFormat, const OUString& rDestDoc ) const +Any TransferableDataHelper::GetAny( SotClipboardFormatId nFormat, const OUString& rDestDoc ) const { Any aReturn; @@ -1566,11 +1566,11 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& r { if( mxTransfer.is() ) { - const SotFormatStringId nRequestFormat = SotExchange::GetFormat( rFlavor ); + const SotClipboardFormatId nRequestFormat = SotExchange::GetFormat( rFlavor ); Reference<css::datatransfer::XTransferable2> xTransfer2(mxTransfer, UNO_QUERY); - if( nRequestFormat ) + if( nRequestFormat != SotClipboardFormatId::NONE ) { // try to get alien format first for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter) @@ -1606,7 +1606,7 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& r -bool TransferableDataHelper::GetString( SotFormatStringId nFormat, OUString& rStr ) +bool TransferableDataHelper::GetString( SotClipboardFormatId nFormat, OUString& rStr ) { DataFlavor aFlavor; return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetString( aFlavor, rStr ) ); @@ -1650,14 +1650,14 @@ bool TransferableDataHelper::GetString( const DataFlavor& rFlavor, OUString& rSt -bool TransferableDataHelper::GetBitmapEx( SotFormatStringId nFormat, BitmapEx& rBmpEx ) +bool TransferableDataHelper::GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx& rBmpEx ) { - if(FORMAT_BITMAP == nFormat) + if(SotClipboardFormatId::BITMAP == nFormat) { // try to get PNG first DataFlavor aFlavor; - if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aFlavor)) + if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aFlavor)) { if(GetBitmapEx(aFlavor, rBmpEx)) { @@ -1679,13 +1679,13 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r bool bRet(GetSotStorageStream(rFlavor, xStm)); bool bSuppressPNG(false); // #122982# If PNG stream not accessed, but BMP one, suppress trying to load PNG - if(!bRet && HasFormat(SOT_FORMATSTR_ID_PNG) && SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aSubstFlavor)) + if(!bRet && HasFormat(SotClipboardFormatId::PNG) && SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aSubstFlavor)) { // when no direct success, try if PNG is available bRet = GetSotStorageStream(aSubstFlavor, xStm); } - if(!bRet && HasFormat(SOT_FORMATSTR_ID_BMP) && SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_BMP, aSubstFlavor)) + if(!bRet && HasFormat(SotClipboardFormatId::BMP) && SotExchange::GetFormatDataFlavor(SotClipboardFormatId::BMP, aSubstFlavor)) { // when no direct success, try if BMP is available bRet = GetSotStorageStream(aSubstFlavor, xStm); @@ -1759,7 +1759,7 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r -bool TransferableDataHelper::GetGDIMetaFile(SotFormatStringId nFormat, GDIMetaFile& rMtf, size_t nMaxActions) +bool TransferableDataHelper::GetGDIMetaFile(SotClipboardFormatId nFormat, GDIMetaFile& rMtf, size_t nMaxActions) { DataFlavor aFlavor; return SotExchange::GetFormatDataFlavor(nFormat, aFlavor) && @@ -1782,8 +1782,8 @@ bool TransferableDataHelper::GetGDIMetaFile( const DataFlavor& rFlavor, GDIMetaF } if( !bRet && - HasFormat( SOT_FORMATSTR_ID_EMF ) && - SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_EMF, aSubstFlavor ) && + HasFormat( SotClipboardFormatId::EMF ) && + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EMF, aSubstFlavor ) && GetSotStorageStream( aSubstFlavor, xStm ) ) { Graphic aGraphic; @@ -1796,8 +1796,8 @@ bool TransferableDataHelper::GetGDIMetaFile( const DataFlavor& rFlavor, GDIMetaF } if( !bRet && - HasFormat( SOT_FORMATSTR_ID_WMF ) && - SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_WMF, aSubstFlavor ) && + HasFormat( SotClipboardFormatId::WMF ) && + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::WMF, aSubstFlavor ) && GetSotStorageStream( aSubstFlavor, xStm ) ) { Graphic aGraphic; @@ -1814,14 +1814,14 @@ bool TransferableDataHelper::GetGDIMetaFile( const DataFlavor& rFlavor, GDIMetaF -bool TransferableDataHelper::GetGraphic( SotFormatStringId nFormat, Graphic& rGraphic ) +bool TransferableDataHelper::GetGraphic( SotClipboardFormatId nFormat, Graphic& rGraphic ) { - if(FORMAT_BITMAP == nFormat) + if(SotClipboardFormatId::BITMAP == nFormat) { // try to get PNG first DataFlavor aFlavor; - if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aFlavor)) + if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aFlavor)) { if(GetGraphic(aFlavor, rGraphic)) { @@ -1841,7 +1841,7 @@ bool TransferableDataHelper::GetGraphic( const ::com::sun::star::datatransfer::D DataFlavor aFlavor; bool bRet = false; - if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aFlavor) && + if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aFlavor) && TransferableDataHelper::IsEqual(aFlavor, rFlavor)) { // try to get PNG first @@ -1850,7 +1850,7 @@ bool TransferableDataHelper::GetGraphic( const ::com::sun::star::datatransfer::D if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) ) rGraphic = aBmpEx; } - else if(SotExchange::GetFormatDataFlavor( SOT_FORMAT_BITMAP, aFlavor ) && + else if(SotExchange::GetFormatDataFlavor( SotClipboardFormatId::BITMAP, aFlavor ) && TransferableDataHelper::IsEqual( aFlavor, rFlavor ) ) { BitmapEx aBmpEx; @@ -1858,7 +1858,7 @@ bool TransferableDataHelper::GetGraphic( const ::com::sun::star::datatransfer::D if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) ) rGraphic = aBmpEx; } - else if( SotExchange::GetFormatDataFlavor( SOT_FORMAT_GDIMETAFILE, aFlavor ) && + else if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aFlavor ) && TransferableDataHelper::IsEqual( aFlavor, rFlavor ) ) { GDIMetaFile aMtf; @@ -1882,7 +1882,7 @@ bool TransferableDataHelper::GetGraphic( const ::com::sun::star::datatransfer::D -bool TransferableDataHelper::GetImageMap( SotFormatStringId nFormat, ImageMap& rIMap ) +bool TransferableDataHelper::GetImageMap( SotClipboardFormatId nFormat, ImageMap& rIMap ) { DataFlavor aFlavor; return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetImageMap( aFlavor, rIMap ) ); @@ -1906,7 +1906,7 @@ bool TransferableDataHelper::GetImageMap( const ::com::sun::star::datatransfer:: -bool TransferableDataHelper::GetTransferableObjectDescriptor( SotFormatStringId nFormat, TransferableObjectDescriptor& rDesc ) +bool TransferableDataHelper::GetTransferableObjectDescriptor( SotClipboardFormatId nFormat, TransferableObjectDescriptor& rDesc ) { DataFlavor aFlavor; return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetTransferableObjectDescriptor( aFlavor, rDesc ) ); @@ -1922,7 +1922,7 @@ bool TransferableDataHelper::GetTransferableObjectDescriptor( const ::com::sun:: -bool TransferableDataHelper::GetINetBookmark( SotFormatStringId nFormat, INetBookmark& rBmk ) +bool TransferableDataHelper::GetINetBookmark( SotClipboardFormatId nFormat, INetBookmark& rBmk ) { DataFlavor aFlavor; return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetINetBookmark( aFlavor, rBmk ) ); @@ -1935,16 +1935,16 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf bool bRet = false; if( HasFormat( rFlavor )) { - const SotFormatStringId nFormat = SotExchange::GetFormat( rFlavor ); + const SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor ); switch( nFormat ) { - case( SOT_FORMATSTR_ID_SOLK ): - case( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ): + case( SotClipboardFormatId::SOLK ): + case( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ): { OUString aString; if( GetString( rFlavor, aString ) ) { - if( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR == nFormat ) + if( SotClipboardFormatId::UNIFORMRESOURCELOCATOR == nFormat ) { rBmk = INetBookmark( aString, aString ); bRet = true; @@ -1985,7 +1985,7 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf } break; - case( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ): + case( SotClipboardFormatId::NETSCAPE_BOOKMARK ): { Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString()); @@ -2001,7 +2001,7 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf break; #ifdef WNT - case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR: + case SotClipboardFormatId::FILEGRPDESCRIPTOR: { Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString()); @@ -2026,7 +2026,7 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf aSeq.realloc( 0 ); pStream.reset(); - if (SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_FILECONTENT, aFileContentFlavor)) + if (SotExchange::GetFormatDataFlavor(SotClipboardFormatId::FILECONTENT, aFileContentFlavor)) { aSeq = GetSequence(aFileContentFlavor, OUString()); if (aSeq.getLength()) @@ -2058,7 +2058,7 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf } break; #endif - + default: break; } } return bRet; @@ -2066,7 +2066,7 @@ bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransf -bool TransferableDataHelper::GetINetImage( SotFormatStringId nFormat, +bool TransferableDataHelper::GetINetImage( SotClipboardFormatId nFormat, INetImage& rINtImg ) { DataFlavor aFlavor; @@ -2089,7 +2089,7 @@ bool TransferableDataHelper::GetINetImage( -bool TransferableDataHelper::GetFileList( SotFormatStringId nFormat, +bool TransferableDataHelper::GetFileList( SotClipboardFormatId nFormat, FileList& rFileList ) { DataFlavor aFlavor; @@ -2107,7 +2107,7 @@ bool TransferableDataHelper::GetFileList( for( sal_uInt32 i = 0, nFormatCount = GetFormatCount(); ( i < nFormatCount ) && !bRet; ++i ) { - if( SOT_FORMAT_FILE_LIST == GetFormat( i ) ) + if( SotClipboardFormatId::FILE_LIST == GetFormat( i ) ) { const DataFlavor aFlavor( GetFormatDataFlavor( i ) ); @@ -2134,7 +2134,7 @@ bool TransferableDataHelper::GetFileList( -Sequence<sal_Int8> TransferableDataHelper::GetSequence( SotFormatStringId nFormat, const OUString& rDestDoc ) +Sequence<sal_Int8> TransferableDataHelper::GetSequence( SotClipboardFormatId nFormat, const OUString& rDestDoc ) { DataFlavor aFlavor; if (!SotExchange::GetFormatDataFlavor(nFormat, aFlavor)) @@ -2159,7 +2159,7 @@ Sequence<sal_Int8> TransferableDataHelper::GetSequence( const DataFlavor& rFlavo -bool TransferableDataHelper::GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rxStream ) +bool TransferableDataHelper::GetSotStorageStream( SotClipboardFormatId nFormat, SotStorageStreamRef& rxStream ) { DataFlavor aFlavor; return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetSotStorageStream( aFlavor, rxStream ) ); @@ -2181,7 +2181,7 @@ bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, Sot return aSeq.getLength(); } -Reference<XInputStream> TransferableDataHelper::GetInputStream( SotFormatStringId nFormat, const OUString& rDestDoc ) +Reference<XInputStream> TransferableDataHelper::GetInputStream( SotClipboardFormatId nFormat, const OUString& rDestDoc ) { DataFlavor aFlavor; if (!SotExchange::GetFormatDataFlavor(nFormat, aFlavor)) diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index a5e80c4ca878..d4099a9d5782 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -322,7 +322,7 @@ sal_Int8 DropTargetHelper::ExecuteDrop( const ExecuteDropEvent& ) -bool DropTargetHelper::IsDropFormatSupported( SotFormatStringId nFormat ) +bool DropTargetHelper::IsDropFormatSupported( SotClipboardFormatId nFormat ) { DataFlavorExVector::iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); bool bRet = false; @@ -365,7 +365,7 @@ bool DropTargetHelper::IsDropFormatSupported( const DataFlavor& rFlavor ) struct TDataCntnrEntry_Impl { ::com::sun::star::uno::Any aAny; - SotFormatStringId nId; + SotClipboardFormatId nId; }; @@ -421,7 +421,7 @@ bool TransferDataContainer::GetData( TDataCntnrEntryList::iterator aIter( pImpl->aFmtList.begin() ), aEnd( pImpl->aFmtList.end() ); bool bFnd = false; - sal_uLong nFmtId = SotExchange::GetFormat( rFlavor ); + SotClipboardFormatId nFmtId = SotExchange::GetFormat( rFlavor ); // test first the list for( ; aIter != aEnd; ++aIter ) @@ -438,23 +438,24 @@ bool TransferDataContainer::GetData( if( !bFnd ) switch( nFmtId ) { - case SOT_FORMAT_STRING: - case SOT_FORMATSTR_ID_SOLK: - case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK: - case SOT_FORMATSTR_ID_FILECONTENT: - case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR: - case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR: + case SotClipboardFormatId::STRING: + case SotClipboardFormatId::SOLK: + case SotClipboardFormatId::NETSCAPE_BOOKMARK: + case SotClipboardFormatId::FILECONTENT: + case SotClipboardFormatId::FILEGRPDESCRIPTOR: + case SotClipboardFormatId::UNIFORMRESOURCELOCATOR: if( pImpl->pBookmk ) bFnd = SetINetBookmark( *pImpl->pBookmk, rFlavor ); break; - case SOT_FORMATSTR_ID_SVXB: - case SOT_FORMATSTR_ID_PNG: - case SOT_FORMAT_BITMAP: - case SOT_FORMAT_GDIMETAFILE: + case SotClipboardFormatId::SVXB: + case SotClipboardFormatId::PNG: + case SotClipboardFormatId::BITMAP: + case SotClipboardFormatId::GDIMETAFILE: if( pImpl->pGrf ) bFnd = SetGraphic( *pImpl->pGrf, rFlavor ); break; + default: break; } return bFnd; @@ -469,17 +470,17 @@ void TransferDataContainer::CopyINetBookmark( const INetBookmark& rBkmk ) else *pImpl->pBookmk = rBkmk; - AddFormat( SOT_FORMAT_STRING ); - AddFormat( SOT_FORMATSTR_ID_SOLK ); - AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ); - AddFormat( SOT_FORMATSTR_ID_FILECONTENT ); - AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ); - AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ); + AddFormat( SotClipboardFormatId::STRING ); + AddFormat( SotClipboardFormatId::SOLK ); + AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ); + AddFormat( SotClipboardFormatId::FILECONTENT ); + AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ); + AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ); } -void TransferDataContainer::CopyAnyData( sal_uLong nFormatId, +void TransferDataContainer::CopyAnyData( SotClipboardFormatId nFormatId, const sal_Char* pData, sal_uLong nLen ) { if( nLen ) @@ -497,7 +498,7 @@ void TransferDataContainer::CopyAnyData( sal_uLong nFormatId, -void TransferDataContainer::CopyByteString( sal_uLong nFormatId, +void TransferDataContainer::CopyByteString( SotClipboardFormatId nFormatId, const OString& rStr ) { CopyAnyData( nFormatId, rStr.getStr(), rStr.getLength() ); @@ -509,8 +510,8 @@ void TransferDataContainer::CopyINetImage( const INetImage& rINtImg ) { SvMemoryStream aMemStm( 1024, 1024 ); aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 ); - rINtImg.Write( aMemStm, SOT_FORMATSTR_ID_INET_IMAGE ); - CopyAnyData( SOT_FORMATSTR_ID_INET_IMAGE, (sal_Char*)aMemStm.GetData(), + rINtImg.Write( aMemStm, SotClipboardFormatId::INET_IMAGE ); + CopyAnyData( SotClipboardFormatId::INET_IMAGE, (sal_Char*)aMemStm.GetData(), aMemStm.Seek( STREAM_SEEK_TO_END ) ); } @@ -521,7 +522,7 @@ void TransferDataContainer::CopyImageMap( const ImageMap& rImgMap ) SvMemoryStream aMemStm( 8192, 8192 ); aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 ); rImgMap.Write( aMemStm, OUString() ); - CopyAnyData( SOT_FORMATSTR_ID_SVIM, (sal_Char*)aMemStm.GetData(), + CopyAnyData( SotClipboardFormatId::SVIM, (sal_Char*)aMemStm.GetData(), aMemStm.Seek( STREAM_SEEK_TO_END ) ); } @@ -537,23 +538,23 @@ void TransferDataContainer::CopyGraphic( const Graphic& rGrf ) else *pImpl->pGrf = rGrf; - AddFormat( SOT_FORMATSTR_ID_SVXB ); + AddFormat( SotClipboardFormatId::SVXB ); if( GRAPHIC_BITMAP == nType ) { - AddFormat( SOT_FORMATSTR_ID_PNG ); - AddFormat( SOT_FORMAT_BITMAP ); + AddFormat( SotClipboardFormatId::PNG ); + AddFormat( SotClipboardFormatId::BITMAP ); } else if( GRAPHIC_GDIMETAFILE == nType ) { - AddFormat( SOT_FORMAT_GDIMETAFILE ); + AddFormat( SotClipboardFormatId::GDIMETAFILE ); } } } -void TransferDataContainer::CopyString( sal_uInt16 nFmt, const OUString& rStr ) +void TransferDataContainer::CopyString( SotClipboardFormatId nFmt, const OUString& rStr ) { if( !rStr.isEmpty() ) { @@ -570,12 +571,12 @@ void TransferDataContainer::CopyString( sal_uInt16 nFmt, const OUString& rStr ) void TransferDataContainer::CopyString( const OUString& rStr ) { - CopyString( SOT_FORMAT_STRING, rStr ); + CopyString( SotClipboardFormatId::STRING, rStr ); } -void TransferDataContainer::CopyAny( sal_uInt16 nFmt, +void TransferDataContainer::CopyAny( SotClipboardFormatId nFmt, const ::com::sun::star::uno::Any& rAny ) { TDataCntnrEntry_Impl aEntry; diff --git a/svtools/source/urlobj/inetimg.cxx b/svtools/source/urlobj/inetimg.cxx index 0ed6198e5e60..51ef978ee0bb 100644 --- a/svtools/source/urlobj/inetimg.cxx +++ b/svtools/source/urlobj/inetimg.cxx @@ -25,12 +25,12 @@ static const sal_Unicode TOKEN_SEPARATOR = '\001'; -bool INetImage::Write( SvStream& rOStm, sal_uLong nFormat ) const +bool INetImage::Write( SvStream& rOStm, SotClipboardFormatId nFormat ) const { bool bRet = false; switch( nFormat ) { - case SOT_FORMATSTR_ID_INET_IMAGE: + case SotClipboardFormatId::INET_IMAGE: { OUString sString; (sString += aImageURL ) += OUString(TOKEN_SEPARATOR); @@ -51,18 +51,19 @@ bool INetImage::Write( SvStream& rOStm, sal_uLong nFormat ) const } break; - case SOT_FORMATSTR_ID_NETSCAPE_IMAGE: + case SotClipboardFormatId::NETSCAPE_IMAGE: break; + default: break; } return bRet; } -bool INetImage::Read( SvStream& rIStm, sal_uLong nFormat ) +bool INetImage::Read( SvStream& rIStm, SotClipboardFormatId nFormat ) { bool bRet = false; switch( nFormat ) { - case SOT_FORMATSTR_ID_INET_IMAGE: + case SotClipboardFormatId::INET_IMAGE: { OUString sINetImg = read_zeroTerminated_uInt8s_ToOUString(rIStm, RTL_TEXTENCODING_UTF8); sal_Int32 nStart = 0; @@ -78,7 +79,7 @@ bool INetImage::Read( SvStream& rIStm, sal_uLong nFormat ) } break; - case SOT_FORMATSTR_ID_NETSCAPE_IMAGE: + case SotClipboardFormatId::NETSCAPE_IMAGE: { /* --> structure size MUST - alignment of 4! @@ -130,6 +131,7 @@ bool INetImage::Read( SvStream& rIStm, sal_uLong nFormat ) bRet = 0 == rIStm.GetError(); } break; + default: break; } return bRet; } |