cui/source/dialogs/pastedlg.cxx | 4 ++-- include/vcl/transfer.hxx | 4 ++-- sc/source/ui/view/cellsh.cxx | 2 +- sw/source/uibase/dochdl/swdtflvr.cxx | 2 +- vcl/source/treelist/transfer.cxx | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-)
New commits: commit 2a9e22157b61a67591057b3926e290236250efd0 Author: Mike Kaganski <[email protected]> AuthorDate: Tue Oct 10 12:47:41 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Tue Oct 10 13:07:44 2023 +0200 Make some methods const, and avoid some const_casts Change-Id: I4964abd34836438e3d24ee7c3c3b324f356477b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157746 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx index d86d277cc34f..423637e9d9e9 100644 --- a/cui/source/dialogs/pastedlg.cxx +++ b/cui/source/dialogs/pastedlg.cxx @@ -85,7 +85,7 @@ void SvPasteObjectDialog::PreGetFormat( const TransferableDataHelper &rHelper ) TransferableObjectDescriptor aDesc; if (rHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR)) { - (void)const_cast<TransferableDataHelper&>(rHelper).GetTransferableObjectDescriptor( + (void)rHelper.GetTransferableObjectDescriptor( SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc); } const DataFlavorExVector* pFormats = &rHelper.GetDataFlavorExVector(); @@ -204,7 +204,7 @@ SotClipboardFormatId SvPasteObjectDialog::GetFormat( const TransferableDataHelpe TransferableObjectDescriptor aDesc; if (rHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR)) { - (void)const_cast<TransferableDataHelper&>(rHelper).GetTransferableObjectDescriptor( + (void)rHelper.GetTransferableObjectDescriptor( SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc); } const DataFlavorExVector* pFormats = &rHelper.GetDataFlavorExVector(); diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index e460e9f9c155..e39fe13b039d 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -337,8 +337,8 @@ public: bool GetImageMap( SotClipboardFormatId nFormat, ImageMap& rIMap ) const; bool GetImageMap( const css::datatransfer::DataFlavor& rFlavor, ImageMap& rImap ) const; - bool GetTransferableObjectDescriptor( SotClipboardFormatId nFormat, TransferableObjectDescriptor& rDesc ); - bool GetTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ); + bool GetTransferableObjectDescriptor( SotClipboardFormatId nFormat, TransferableObjectDescriptor& rDesc ) const; + bool GetTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const; bool GetINetBookmark( SotClipboardFormatId nFormat, INetBookmark& rBmk ) const; bool GetINetBookmark( const css::datatransfer::DataFlavor& rFlavor, INetBookmark& rBmk ) const; diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index ec5914a2224b..34c87d0e61c6 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -445,7 +445,7 @@ static bool lcl_TestFormat( SvxClipboardFormatItem& rFormats, const Transferable if ( nFormatId == SotClipboardFormatId::EMBED_SOURCE ) { TransferableObjectDescriptor aDesc; - if ( const_cast<TransferableDataHelper&>(rDataHelper).GetTransferableObjectDescriptor( + if ( rDataHelper.GetTransferableObjectDescriptor( SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc ) ) aStrVal = aDesc.maTypeName; } diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 918410957579..fc5f9f73a0a5 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -3550,7 +3550,7 @@ void SwTransferable::FillClipFormatItem( const SwWrtShell& rSh, TransferableObjectDescriptor aDesc; if (rData.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR)) { - (void)const_cast<TransferableDataHelper&>(rData).GetTransferableObjectDescriptor( + (void)rData.GetTransferableObjectDescriptor( SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc); } diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index bb13861b9815..812b9609b07f 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -1774,14 +1774,14 @@ bool TransferableDataHelper::GetImageMap( const css::datatransfer::DataFlavor& r } -bool TransferableDataHelper::GetTransferableObjectDescriptor( SotClipboardFormatId nFormat, TransferableObjectDescriptor& rDesc ) +bool TransferableDataHelper::GetTransferableObjectDescriptor( SotClipboardFormatId nFormat, TransferableObjectDescriptor& rDesc ) const { DataFlavor aFlavor; return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetTransferableObjectDescriptor( rDesc ) ); } -bool TransferableDataHelper::GetTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) +bool TransferableDataHelper::GetTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const { rDesc = *mxObjDesc; return true;
