From 1a18c92a527cd53abfb0919246935a4fd4ef421d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 4 Dec 2015 17:38:04 +0100 Subject: consolidate MSO format ClassID magic numbers in msfilter/classids.hxx Change-Id: I673eeaa4168f769cb002995c43d986ee5f2030b2 --- embeddedobj/source/msole/olevisual.cxx | 4 +-- filter/source/msfilter/msdffimp.cxx | 36 +++++++++----------------- include/filter/msfilter/classids.hxx | 47 ++++++++++++++++++++++++++++++++++ sc/source/filter/excel/excel.cxx | 3 ++- sd/source/filter/eppt/eppt.cxx | 3 ++- starmath/source/mathtype.cxx | 6 ++--- sw/source/filter/ww8/wrtww8.cxx | 6 ++--- 7 files changed, 70 insertions(+), 35 deletions(-) create mode 100644 include/filter/msfilter/classids.hxx diff --git a/embeddedobj/source/msole/olevisual.cxx b/embeddedobj/source/msole/olevisual.cxx index cb129871f512..5be4ed5b077a 100644 --- a/embeddedobj/source/msole/olevisual.cxx +++ b/embeddedobj/source/msole/olevisual.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #if defined WNT #include @@ -113,8 +114,7 @@ void SAL_CALL OleEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt // If cached size is not set, that means that this is the size initialization, so there is no need to set the real size sal_Bool bAllowToSetExtent = ( ( getStatus( nAspect ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) - && !MimeConfigurationHelper::ClassIDsEqual( m_aClassID, MimeConfigurationHelper::GetSequenceClassID( 0x00020906L, 0x0000, 0x0000, - 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 ) ) + && !MimeConfigurationHelper::ClassIDsEqual(m_aClassID, MimeConfigurationHelper::GetSequenceClassID(MSO_WW8_CLASSID)) && m_bHasCachedSize ); if ( m_nObjectState == embed::EmbedStates::LOADED && bAllowToSetExtent ) diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 430be20f86e9..4afc1cb2d919 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -107,6 +107,7 @@ #include "svx/svditer.hxx" #include #include "svx/xattr.hxx" +#include #include #include #include @@ -6849,31 +6850,18 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo sal_uInt16 n2, n3; sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15; } aArr[] = { - { OLE_MATHTYPE_2_STARMATH, "smath", - 0x0002ce02L, 0x0000, 0x0000, - 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }, - { OLE_MATHTYPE_2_STARMATH, "smath", - 0x00021700L, 0x0000, 0x0000, - 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }, - { OLE_WINWORD_2_STARWRITER, "swriter", - 0x00020906L, 0x0000, 0x0000, - 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }, - { OLE_EXCEL_2_STARCALC, "scalc", // Excel table - 0x00020810L, 0x0000, 0x0000, - 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }, - { OLE_EXCEL_2_STARCALC, "scalc", // Excel chart - 0x00020820L, 0x0000, 0x0000, - 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }, + { OLE_MATHTYPE_2_STARMATH, "smath", MSO_EQUATION3_CLASSID }, + { OLE_MATHTYPE_2_STARMATH, "smath", MSO_EQUATION2_CLASSID }, + { OLE_WINWORD_2_STARWRITER, "swriter", MSO_WW8_CLASSID }, + // Excel table + { OLE_EXCEL_2_STARCALC, "scalc", MSO_EXCEL5_CLASSID }, + { OLE_EXCEL_2_STARCALC, "scalc", MSO_EXCEL8_CLASSID }, // 114465: additional Excel OLE chart classId to above. - { OLE_EXCEL_2_STARCALC, "scalc", - 0x00020821L, 0x0000, 0x0000, - 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }, - { OLE_POWERPOINT_2_STARIMPRESS, "simpress", // PowerPoint presentation - 0x64818d10L, 0x4f9b, 0x11cf, - 0x86,0xea,0x00,0xaa,0x00,0xb9,0x29,0xe8 }, - { OLE_POWERPOINT_2_STARIMPRESS, "simpress", // PowerPoint slide - 0x64818d11L, 0x4f9b, 0x11cf, - 0x86,0xea,0x00,0xaa,0x00,0xb9,0x29,0xe8 }, + { OLE_EXCEL_2_STARCALC, "scalc", MSO_EXCEL8_CHART_CLASSID }, + // PowerPoint presentation + { OLE_POWERPOINT_2_STARIMPRESS, "simpress", MSO_PPT8_CLASSID }, + // PowerPoint slide + { OLE_POWERPOINT_2_STARIMPRESS, "simpress", MSO_PPT8_SLIDE_CLASSID }, { 0, nullptr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } diff --git a/include/filter/msfilter/classids.hxx b/include/filter/msfilter/classids.hxx new file mode 100644 index 000000000000..8394a716b0f7 --- /dev/null +++ b/include/filter/msfilter/classids.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX +#define INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX + +#define MSO_EQUATION2_CLASSID \ + 0x00021700L, 0x0000, 0x0000, \ + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 + +#define MSO_EQUATION3_CLASSID \ + 0x0002ce02L, 0x0000, 0x0000, \ + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 + +#define MSO_WW8_CLASSID \ + 0x00020906L, 0x0000, 0x0000, \ + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 + +#define MSO_EXCEL5_CLASSID \ + 0x00020810L, 0x0000, 0x0000, \ + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 + +#define MSO_EXCEL8_CLASSID \ + 0x00020820L, 0x0000, 0x0000, \ + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 + +#define MSO_EXCEL8_CHART_CLASSID \ + 0x00020821L, 0x0000, 0x0000, \ + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 + +#define MSO_PPT8_CLASSID \ + 0x64818d10L, 0x4f9b, 0x11cf, \ + 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8 + +#define MSO_PPT8_SLIDE_CLASSID \ + 0x64818d11L, 0x4f9b, 0x11cf, \ + 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8 + +#endif // INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 59e0daf446f3..73ee93ed3773 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -186,7 +187,7 @@ static FltError lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, if( eRet == eERR_RNGOVRFLW ) eRet = SCWARN_EXPORT_MAXROW; - SvGlobalName aGlobName( 0x00020810, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 ); + SvGlobalName aGlobName(MSO_EXCEL5_CLASSID); SotClipboardFormatId nClip = SotExchange::RegisterFormatName( aClipName ); xRootStrg->SetClass( aGlobName, nClip, aClassName ); diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 9e5c4a791021..71ef6f5414e3 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -113,7 +114,7 @@ void PPTWriter::exportPPTPre( const std::vector< css::beans::PropertyValue >& rM mXStatusIndicator->start( "PowerPoint Export", mnStatMaxValue + ( mnStatMaxValue >> 3 ) ); } - SvGlobalName aGName( 0x64818d10L, 0x4f9b, 0x11cf, 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8 ); + SvGlobalName aGName(MSO_PPT8_CLASSID); mrStg->SetClass( aGName, SotClipboardFormatId::NONE, "MS PowerPoint 97" ); if ( !ImplCreateCurrentUserStream() ) diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 9cc65c08500c..962de9d19b67 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include + +#include #include #include @@ -1887,8 +1888,7 @@ int MathType::ConvertFromStarMath( SfxMedium& rMedium ) { tools::SvRef pStor = new SotStorage( pStream, false ); - SvGlobalName aGName(0x0002ce02L, 0x0000, 0x0000,0xc0,0x00, - 0x00,0x00,0x00,0x00,0x00,0x46 ); + SvGlobalName aGName(MSO_EQUATION3_CLASSID); pStor->SetClass( aGName, SotClipboardFormatId::NONE, "Microsoft Equation 3.0"); static sal_uInt8 const aCompObj[] = { diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 76182e223a2d..0fdeef8ab26d 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -3232,7 +3233,6 @@ void WW8Export::PrepareStorage() sal_uLong nLen; const sal_uInt8* pData; const char* pName; - sal_uInt32 nId1; static const char aUserName[] = "Microsoft Word-Document"; static const sal_uInt8 aCompObj[] = @@ -3256,10 +3256,8 @@ void WW8Export::PrepareStorage() pName = aUserName; pData = aCompObj; nLen = sizeof( aCompObj ); - nId1 = 0x00020906L; - SvGlobalName aGName( nId1, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x46 ); + SvGlobalName aGName(MSO_WW8_CLASSID); GetWriter().GetStorage().SetClass( aGName, SotClipboardFormatId::NONE, OUString::createFromAscii( pName )); tools::SvRef xStor( GetWriter().GetStorage().OpenSotStream(sCompObj) ); xStor->Write( pData, nLen ); -- cgit