summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-12 14:53:28 +0200
committerNoel Grandin <noel@peralex.com>2015-03-18 14:23:50 +0200
commitfb14be5f8f74f83ba89e15f891ddf1f753dcc62f (patch)
treebeaa4af08b0c3d75bf6e40b21b96c55e0ac1c60a /sc/source/ui/docshell
parentb8ce52aab9459773544f1696cfe6b7b6f171a389 (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 'sc/source/ui/docshell')
-rw-r--r--sc/source/ui/docshell/arealink.cxx2
-rw-r--r--sc/source/ui/docshell/docsh.cxx12
-rw-r--r--sc/source/ui/docshell/docsh4.cxx8
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx2
-rw-r--r--sc/source/ui/docshell/impex.cxx56
-rw-r--r--sc/source/ui/docshell/servobj.cxx4
-rw-r--r--sc/source/ui/docshell/tablink.cxx4
7 files changed, 44 insertions, 44 deletions
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index 134ebb040359..cf79f30ca94d 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -60,7 +60,7 @@ ScAreaLink::ScAreaLink( SfxObjectShell* pShell, const OUString& rFile,
const OUString& rFilter, const OUString& rOpt,
const OUString& rArea, const ScRange& rDest,
sal_uLong nRefresh ) :
- ::sfx2::SvBaseLink(sfx2::LINKUPDATE_ONCALL,FORMAT_FILE),
+ ::sfx2::SvBaseLink(sfx2::LINKUPDATE_ONCALL,SotClipboardFormatId::FILE),
ScRefreshTimer ( nRefresh ),
pImpl ( new AreaLink_Impl() ),
aFileName (rFile),
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index e7cb71a76164..536c8c5b6369 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -178,7 +178,7 @@ SFX_IMPL_OBJECTFACTORY( ScDocShell, SvGlobalName(SO3_SC_CLASSID), SFXOBJECTSHELL
TYPEINIT1( ScDocShell, SfxObjectShell ); // SfxInPlaceObject: No TypeInfo?
void ScDocShell::FillClass( SvGlobalName* pClassName,
- sal_uInt32* pFormat,
+ SotClipboardFormatId* pFormat,
OUString* /* pAppName */,
OUString* pFullTypeName,
OUString* pShortTypeName,
@@ -188,14 +188,14 @@ void ScDocShell::FillClass( SvGlobalName* pClassName,
if ( nFileFormat == SOFFICE_FILEFORMAT_60 )
{
*pClassName = SvGlobalName( SO3_SC_CLASSID_60 );
- *pFormat = SOT_FORMATSTR_ID_STARCALC_60;
+ *pFormat = SotClipboardFormatId::STARCALC_60;
*pFullTypeName = OUString( ScResId( SCSTR_LONG_SCDOC_NAME ) );
*pShortTypeName = OUString( ScResId( SCSTR_SHORT_SCDOC_NAME ) );
}
else if ( nFileFormat == SOFFICE_FILEFORMAT_8 )
{
*pClassName = SvGlobalName( SO3_SC_CLASSID_60 );
- *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE : SOT_FORMATSTR_ID_STARCALC_8;
+ *pFormat = bTemplate ? SotClipboardFormatId::STARCALC_8_TEMPLATE : SotClipboardFormatId::STARCALC_8;
*pFullTypeName = "calc8";
*pShortTypeName = ScResId(SCSTR_SHORT_SCDOC_NAME).toString();
}
@@ -1313,7 +1313,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (pInStream)
{
pInStream->Seek( 0 );
- bRet = aImpEx.ImportStream( *pInStream, rMedium.GetBaseURL(), SOT_FORMATSTR_ID_SYLK );
+ bRet = aImpEx.ImportStream( *pInStream, rMedium.GetBaseURL(), SotClipboardFormatId::SYLK );
eError = bRet ? eERR_OK : SCERR_IMPORT_UNKNOWN;
aDocument.StartAllListeners();
sc::SetFormulaDirtyContext aCxt;
@@ -2405,7 +2405,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
ScImportExport aImExport( &aDocument, aRange );
aImExport.SetFormulas( true );
- bRet = aImExport.ExportStream( *pStream, rMed.GetBaseURL( true ), SOT_FORMATSTR_ID_SYLK );
+ bRet = aImExport.ExportStream( *pStream, rMed.GetBaseURL( true ), SotClipboardFormatId::SYLK );
}
}
else if (aFltName == pFilterHtml)
@@ -2424,7 +2424,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
ScImportExport aImExport(&aDocument);
aImExport.SetStreamPath(rMed.GetName());
aImExport.SetFilterOptions(sFilterOptions);
- bRet = aImExport.ExportStream(*pStream, rMed.GetBaseURL(true), SOT_FORMATSTR_ID_HTML);
+ bRet = aImExport.ExportStream(*pStream, rMed.GetBaseURL(true), SotClipboardFormatId::HTML);
if (bRet && !aImExport.GetNonConvertibleChars().isEmpty())
{
SetError(*new StringErrorInfo(
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 9d9ef86e9980..4f9f8f109032 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2059,7 +2059,7 @@ bool ScDocShell::DdeGetData( const OUString& rItem,
const OUString& rMimeType,
::com::sun::star::uno::Any & rValue )
{
- if( FORMAT_STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ) )
+ if( SotClipboardFormatId::STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ) )
{
if( rItem.equalsIgnoreAsciiCase( "Format" ) )
{
@@ -2081,7 +2081,7 @@ bool ScDocShell::DdeGetData( const OUString& rItem,
{
OString aData;
if( aObj.ExportByteString( aData, osl_getThreadTextEncoding(),
- SOT_FORMATSTR_ID_SYLK ) )
+ SotClipboardFormatId::SYLK ) )
{
rValue <<= ::com::sun::star::uno::Sequence< sal_Int8 >(
reinterpret_cast<const sal_Int8*>(aData.getStr()),
@@ -2107,7 +2107,7 @@ bool ScDocShell::DdeSetData( const OUString& rItem,
const OUString& rMimeType,
const ::com::sun::star::uno::Any & rValue )
{
- if( FORMAT_STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ))
+ if( SotClipboardFormatId::STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ))
{
if( rItem.equalsIgnoreAsciiCase( "Format" ) )
{
@@ -2127,7 +2127,7 @@ bool ScDocShell::DdeSetData( const OUString& rItem,
OUString aData;
if ( ScByteSequenceToString::GetString( aData, rValue, osl_getThreadTextEncoding() ) )
{
- return aObj.ImportString( aData, SOT_FORMATSTR_ID_SYLK );
+ return aObj.ImportString( aData, SotClipboardFormatId::SYLK );
}
return false;
}
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 3ab529a85051..5bde93bc1945 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1274,7 +1274,7 @@ ScExternalRefCache::DocItem* ScExternalRefCache::getDocItem(sal_uInt16 nFileId)
}
ScExternalRefLink::ScExternalRefLink(ScDocument* pDoc, sal_uInt16 nFileId, const OUString& rFilter) :
- ::sfx2::SvBaseLink(::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE),
+ ::sfx2::SvBaseLink(::sfx2::LINKUPDATE_ONCALL, SotClipboardFormatId::FILE),
mnFileId(nFileId),
maFilterName(rFilter),
mpDoc(pDoc),
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index ec70334d183a..b64ee4c52b7e 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -192,14 +192,14 @@ void ScImportExport::SetFilterOptions(const OUString& rFilterOptions)
maFilterOptions = rFilterOptions;
}
-bool ScImportExport::IsFormatSupported( sal_uLong nFormat )
+bool ScImportExport::IsFormatSupported( SotClipboardFormatId nFormat )
{
- return nFormat == FORMAT_STRING
- || nFormat == SOT_FORMATSTR_ID_SYLK
- || nFormat == SOT_FORMATSTR_ID_LINK
- || nFormat == SOT_FORMATSTR_ID_HTML
- || nFormat == SOT_FORMATSTR_ID_HTML_SIMPLE
- || nFormat == SOT_FORMATSTR_ID_DIF;
+ return nFormat == SotClipboardFormatId::STRING
+ || nFormat == SotClipboardFormatId::SYLK
+ || nFormat == SotClipboardFormatId::LINK
+ || nFormat == SotClipboardFormatId::HTML
+ || nFormat == SotClipboardFormatId::HTML_SIMPLE
+ || nFormat == SotClipboardFormatId::DIF;
}
// Prepare for Undo
@@ -278,12 +278,12 @@ bool ScImportExport::ExportData( const OUString& rMimeType,
return false;
}
-bool ScImportExport::ImportString( const OUString& rText, sal_uLong nFmt )
+bool ScImportExport::ImportString( const OUString& rText, SotClipboardFormatId nFmt )
{
switch ( nFmt )
{
// formats supporting unicode
- case FORMAT_STRING :
+ case SotClipboardFormatId::STRING :
{
ScImportStringStream aStrm( rText);
return ImportStream( aStrm, OUString(), nFmt );
@@ -301,10 +301,10 @@ bool ScImportExport::ImportString( const OUString& rText, sal_uLong nFmt )
}
}
-bool ScImportExport::ExportString( OUString& rText, sal_uLong nFmt )
+bool ScImportExport::ExportString( OUString& rText, SotClipboardFormatId nFmt )
{
- OSL_ENSURE( nFmt == FORMAT_STRING, "ScImportExport::ExportString: Unicode not supported for other formats than FORMAT_STRING" );
- if ( nFmt != FORMAT_STRING )
+ OSL_ENSURE( nFmt == SotClipboardFormatId::STRING, "ScImportExport::ExportString: Unicode not supported for other formats than SotClipboardFormatId::STRING" );
+ if ( nFmt != SotClipboardFormatId::STRING )
{
rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
OString aTmp;
@@ -332,7 +332,7 @@ bool ScImportExport::ExportString( OUString& rText, sal_uLong nFmt )
// ExportStream must handle RTL_TEXTENCODING_UNICODE
}
-bool ScImportExport::ExportByteString( OString& rText, rtl_TextEncoding eEnc, sal_uLong nFmt )
+bool ScImportExport::ExportByteString( OString& rText, rtl_TextEncoding eEnc, SotClipboardFormatId nFmt )
{
OSL_ENSURE( eEnc != RTL_TEXTENCODING_UNICODE, "ScImportExport::ExportByteString: Unicode not supported" );
if ( eEnc == RTL_TEXTENCODING_UNICODE )
@@ -359,36 +359,36 @@ bool ScImportExport::ExportByteString( OString& rText, rtl_TextEncoding eEnc, sa
return false;
}
-bool ScImportExport::ImportStream( SvStream& rStrm, const OUString& rBaseURL, sal_uLong nFmt )
+bool ScImportExport::ImportStream( SvStream& rStrm, const OUString& rBaseURL, SotClipboardFormatId nFmt )
{
- if( nFmt == FORMAT_STRING )
+ if( nFmt == SotClipboardFormatId::STRING )
{
if( ExtText2Doc( rStrm ) ) // evaluate pExtOptions
return true;
}
- if( nFmt == SOT_FORMATSTR_ID_SYLK )
+ if( nFmt == SotClipboardFormatId::SYLK )
{
if( Sylk2Doc( rStrm ) )
return true;
}
- if( nFmt == SOT_FORMATSTR_ID_DIF )
+ if( nFmt == SotClipboardFormatId::DIF )
{
if( Dif2Doc( rStrm ) )
return true;
}
- if( nFmt == FORMAT_RTF )
+ if( nFmt == SotClipboardFormatId::RTF )
{
if( RTF2Doc( rStrm, rBaseURL ) )
return true;
}
- if( nFmt == SOT_FORMATSTR_ID_LINK )
+ if( nFmt == SotClipboardFormatId::LINK )
return true; // Link-Import?
- if ( nFmt == SOT_FORMATSTR_ID_HTML )
+ if ( nFmt == SotClipboardFormatId::HTML )
{
if( HTML2Doc( rStrm, rBaseURL ) )
return true;
}
- if ( nFmt == SOT_FORMATSTR_ID_HTML_SIMPLE )
+ if ( nFmt == SotClipboardFormatId::HTML_SIMPLE )
{
MSE40HTMLClipFormatObj aMSE40ClpObj; // needed to skip the header data
SvStream* pHTML = aMSE40ClpObj.IsValid( rStrm );
@@ -399,24 +399,24 @@ bool ScImportExport::ImportStream( SvStream& rStrm, const OUString& rBaseURL, sa
return false;
}
-bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, sal_uLong nFmt )
+bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, SotClipboardFormatId nFmt )
{
- if( nFmt == FORMAT_STRING )
+ if( nFmt == SotClipboardFormatId::STRING )
{
if( Doc2Text( rStrm ) )
return true;
}
- if( nFmt == SOT_FORMATSTR_ID_SYLK )
+ if( nFmt == SotClipboardFormatId::SYLK )
{
if( Doc2Sylk( rStrm ) )
return true;
}
- if( nFmt == SOT_FORMATSTR_ID_DIF )
+ if( nFmt == SotClipboardFormatId::DIF )
{
if( Doc2Dif( rStrm ) )
return true;
}
- if( nFmt == SOT_FORMATSTR_ID_LINK && !bAll )
+ if( nFmt == SotClipboardFormatId::LINK && !bAll )
{
OUString aDocName;
if ( pDoc->IsClipboard() )
@@ -459,12 +459,12 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, sa
return rStrm.GetError() == SVSTREAM_OK;
}
}
- if( nFmt == SOT_FORMATSTR_ID_HTML )
+ if( nFmt == SotClipboardFormatId::HTML )
{
if( Doc2HTML( rStrm, rBaseURL ) )
return true;
}
- if( nFmt == FORMAT_RTF )
+ if( nFmt == SotClipboardFormatId::RTF )
{
if( Doc2RTF( rStrm ) )
return true;
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index 58f0cac8faf5..8fddc9b74427 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -163,7 +163,7 @@ bool ScServerObject::GetData(
OUString aDdeTextFmt = pDocSh->GetDdeTextFmt();
ScDocument& rDoc = pDocSh->GetDocument();
- if( FORMAT_STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ))
+ if( SotClipboardFormatId::STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ))
{
ScImportExport aObj( &rDoc, aRange );
if( aDdeTextFmt[0] == 'F' )
@@ -171,7 +171,7 @@ bool ScServerObject::GetData(
if( aDdeTextFmt == "SYLK" || aDdeTextFmt == "FSYLK" )
{
OString aByteData;
- if( aObj.ExportByteString( aByteData, osl_getThreadTextEncoding(), SOT_FORMATSTR_ID_SYLK ) )
+ if( aObj.ExportByteString( aByteData, osl_getThreadTextEncoding(), SotClipboardFormatId::SYLK ) )
{
rData <<= ::com::sun::star::uno::Sequence< sal_Int8 >(
reinterpret_cast<const sal_Int8*>(aByteData.getStr()),
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 765a232b3922..cca5968910a9 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -59,7 +59,7 @@ TYPEINIT1(ScTableLink, ::sfx2::SvBaseLink);
ScTableLink::ScTableLink(ScDocShell* pDocSh, const OUString& rFile,
const OUString& rFilter, const OUString& rOpt,
sal_uLong nRefresh ):
- ::sfx2::SvBaseLink(sfx2::LINKUPDATE_ONCALL,FORMAT_FILE),
+ ::sfx2::SvBaseLink(sfx2::LINKUPDATE_ONCALL,SotClipboardFormatId::FILE),
ScRefreshTimer( nRefresh ),
pImpl( new TableLink_Impl ),
aFileName(rFile),
@@ -76,7 +76,7 @@ ScTableLink::ScTableLink(ScDocShell* pDocSh, const OUString& rFile,
ScTableLink::ScTableLink(SfxObjectShell* pShell, const OUString& rFile,
const OUString& rFilter, const OUString& rOpt,
sal_uLong nRefresh ):
- ::sfx2::SvBaseLink(sfx2::LINKUPDATE_ONCALL,FORMAT_FILE),
+ ::sfx2::SvBaseLink(sfx2::LINKUPDATE_ONCALL,SotClipboardFormatId::FILE),
ScRefreshTimer( nRefresh ),
pImpl( new TableLink_Impl ),
aFileName(rFile),