From fb14be5f8f74f83ba89e15f891ddf1f753dcc62f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 12 Mar 2015 14:53:28 +0200 Subject: 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 --- reportdesign/source/ui/dlg/GroupExchange.cxx | 10 +++++----- reportdesign/source/ui/dlg/GroupExchange.hxx | 2 +- reportdesign/source/ui/inc/dlgedclip.hxx | 2 +- reportdesign/source/ui/report/dlgedclip.cxx | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'reportdesign') diff --git a/reportdesign/source/ui/dlg/GroupExchange.cxx b/reportdesign/source/ui/dlg/GroupExchange.cxx index 75ab80ea094d..8bfdc708c448 100644 --- a/reportdesign/source/ui/dlg/GroupExchange.cxx +++ b/reportdesign/source/ui/dlg/GroupExchange.cxx @@ -26,13 +26,13 @@ namespace rptui using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; - sal_uInt32 OGroupExchange::getReportGroupId() + SotClipboardFormatId OGroupExchange::getReportGroupId() { - static sal_uInt32 s_nReportFormat = (sal_uInt32)-1; - if ( (sal_uInt32)-1 == s_nReportFormat ) + static SotClipboardFormatId s_nReportFormat = static_cast(-1); + if ( static_cast(-1) == s_nReportFormat ) { s_nReportFormat = SotExchange::RegisterFormatName(OUString("application/x-openoffice;windows_formatname=\"reportdesign.GroupFormat\"" )); - OSL_ENSURE((sal_uInt32)-1 != s_nReportFormat, "Bad exchange id!"); + OSL_ENSURE(static_cast(-1) != s_nReportFormat, "Bad exchange id!"); } return s_nReportFormat; } @@ -51,7 +51,7 @@ namespace rptui bool OGroupExchange::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { - sal_uLong nFormat = SotExchange::GetFormat(rFlavor); + SotClipboardFormatId nFormat = SotExchange::GetFormat(rFlavor); if(nFormat == OGroupExchange::getReportGroupId() ) { return SetAny(uno::makeAny(m_aGroupRow),rFlavor); diff --git a/reportdesign/source/ui/dlg/GroupExchange.hxx b/reportdesign/source/ui/dlg/GroupExchange.hxx index 39c206be49c6..a057067459ab 100644 --- a/reportdesign/source/ui/dlg/GroupExchange.hxx +++ b/reportdesign/source/ui/dlg/GroupExchange.hxx @@ -34,7 +34,7 @@ namespace rptui public: OGroupExchange(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& _aGroupRow); - static sal_uInt32 getReportGroupId(); + static SotClipboardFormatId getReportGroupId(); protected: virtual void AddSupportedFormats() SAL_OVERRIDE; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/dlgedclip.hxx b/reportdesign/source/ui/inc/dlgedclip.hxx index 39609c053fc1..5b376569c061 100644 --- a/reportdesign/source/ui/inc/dlgedclip.hxx +++ b/reportdesign/source/ui/inc/dlgedclip.hxx @@ -65,7 +65,7 @@ public: * * \return the registered format id */ - static sal_uInt32 getDescriptorFormatId(); + static SotClipboardFormatId getDescriptorFormatId(); protected: // TransferableHelper overridables diff --git a/reportdesign/source/ui/report/dlgedclip.cxx b/reportdesign/source/ui/report/dlgedclip.cxx index 3099489752f0..f85e21fc77cb 100644 --- a/reportdesign/source/ui/report/dlgedclip.cxx +++ b/reportdesign/source/ui/report/dlgedclip.cxx @@ -37,13 +37,13 @@ OReportExchange::OReportExchange(const TSectionElements& _rCopyElements ) { } -sal_uInt32 OReportExchange::getDescriptorFormatId() +SotClipboardFormatId OReportExchange::getDescriptorFormatId() { - static sal_uInt32 s_nFormat = (sal_uInt32)-1; - if ((sal_uInt32)-1 == s_nFormat) + static SotClipboardFormatId s_nFormat = static_cast(-1); + if (static_cast(-1) == s_nFormat) { s_nFormat = SotExchange::RegisterFormatName(OUString("application/x-openoffice;windows_formatname=\"report.ReportObjectsTransfer\"")); - OSL_ENSURE((sal_uInt32)-1 != s_nFormat, "OReportExchange::getDescriptorFormatId: bad exchange id!"); + OSL_ENSURE(static_cast(-1) != s_nFormat, "OReportExchange::getDescriptorFormatId: bad exchange id!"); } return s_nFormat; } @@ -55,7 +55,7 @@ void OReportExchange::AddSupportedFormats() bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ ) { - const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor); + const SotClipboardFormatId nFormatId = SotExchange::GetFormat(_rFlavor); return (nFormatId == getDescriptorFormatId()) && SetAny( uno::Any(m_aCopyElements), _rFlavor ); } @@ -66,7 +66,7 @@ bool OReportExchange::canExtract(const DataFlavorExVector& _rFlavor) OReportExchange::TSectionElements OReportExchange::extractCopies(const TransferableDataHelper& _rData) { - sal_Int32 nKnownFormatId = getDescriptorFormatId(); + SotClipboardFormatId nKnownFormatId = getDescriptorFormatId(); if ( _rData.HasFormat( nKnownFormatId ) ) { // extract the any from the transferable -- cgit