sc/source/ui/drawfunc/fuins1.cxx | 12 ------------ sd/qa/uitest/impress_tests2/tdf146019.py | 4 ++-- sd/source/ui/func/fuinsert.cxx | 13 ------------- sw/source/uibase/dochdl/swdtflvr.cxx | 22 ---------------------- vcl/source/filter/graphicfilter.cxx | 14 ++++++++++++++ 5 files changed, 16 insertions(+), 49 deletions(-)
New commits: commit 69c27a890d797e8fe140be31e37f26f6315a55a9 Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Tue Sep 9 15:09:59 2025 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Sep 10 08:33:33 2025 +0200 tdf#137833 Always respect EXIF Orientation tag when importing a JPEG Previously EXIF Orientation tag was read only via the Insert -> Image route. Now it is respected even via File -> Open or drag&drop. Change-Id: I16a79940823f4a62e8df5fa5d7c2e28a755e3460 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190717 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index d590b37d5259..d8eda3aba080 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -37,8 +37,6 @@ #include <avmedia/mediawindow.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> -#include <vcl/GraphicNativeTransform.hxx> -#include <vcl/GraphicNativeMetadata.hxx> #include <fuinsert.hxx> #include <tabvwsh.hxx> #include <drwlayer.hxx> @@ -114,16 +112,6 @@ static void lcl_InsertGraphic( const Graphic& rGraphic, ScAnchorType aAnchorType = SCA_CELL ) { Graphic& rGraphic1 = const_cast<Graphic &>(rGraphic); - GraphicNativeMetadata aMetadata; - if ( aMetadata.read(rGraphic1) ) - { - const Degree10 aRotation = aMetadata.getRotation(); - if (aRotation) - { - GraphicNativeTransform aTransform( rGraphic1 ); - aTransform.rotate( aRotation ); - } - } ScDrawView* pDrawView = rViewSh.GetScDrawView(); // #i123922# check if an existing object is selected; if yes, evtl. replace diff --git a/sd/qa/uitest/impress_tests2/tdf146019.py b/sd/qa/uitest/impress_tests2/tdf146019.py index 86b8ed48180f..dc568b5151c2 100644 --- a/sd/qa/uitest/impress_tests2/tdf146019.py +++ b/sd/qa/uitest/impress_tests2/tdf146019.py @@ -29,7 +29,7 @@ class tdf146019(UITestCase): # Check the shape is rotated, height > width shape = document.getDrawPages()[0][2] - self.assertEqual(8996, shape.getSize().Width) - self.assertEqual(11745, shape.getSize().Height) + self.assertEqual(8995, shape.getSize().Width) + self.assertEqual(11746, shape.getSize().Height) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index a6e3a1cc04dd..fd26dc295c76 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -80,9 +80,6 @@ #include <vcl/errinf.hxx> #include <vcl/graphicfilter.hxx> -#include <vcl/GraphicNativeTransform.hxx> -#include <vcl/GraphicNativeMetadata.hxx> - #include <comphelper/lok.hxx> using namespace com::sun::star; @@ -156,16 +153,6 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq ) if( nError == ERRCODE_NONE ) { - GraphicNativeMetadata aMetadata; - if ( aMetadata.read(aGraphic) ) - { - const Degree10 aRotation = aMetadata.getRotation(); - if (aRotation) - { - GraphicNativeTransform aTransform( aGraphic ); - aTransform.rotate( aRotation ); - } - } if( dynamic_cast< DrawViewShell *>( mpViewShell ) ) { sal_Int8 nAction = DND_ACTION_COPY; diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index d4a22da1d9ac..159682b2b6a1 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -130,8 +130,6 @@ #include <vcl/uitest/logger.hxx> #include <vcl/uitest/eventdescription.hxx> -#include <vcl/GraphicNativeTransform.hxx> -#include <vcl/GraphicNativeMetadata.hxx> #include <vcl/TypeSerializer.hxx> #include <comphelper/lok.hxx> #include <sfx2/classificationhelper.hxx> @@ -421,20 +419,6 @@ namespace rDest.GetMetaFieldManager().copyDocumentProperties(rSrc); } - - void lclCheckAndPerformRotation(Graphic& aGraphic) - { - GraphicNativeMetadata aMetadata; - if ( !aMetadata.read(aGraphic) ) - return; - - Degree10 aRotation = aMetadata.getRotation(); - if (aRotation) - { - GraphicNativeTransform aTransform( aGraphic ); - aTransform.rotate( aRotation ); - } - } } sal_Bool SAL_CALL SwTransferable::isComplex() @@ -2588,9 +2572,6 @@ bool SwTransferable::PasteTargetURL( const TransferableDataHelper& rData, if( bRet ) { - //Check and Perform rotation if needed - lclCheckAndPerformRotation(aGraphic); - switch( nAction ) { case SwPasteSdr::Insert: @@ -2997,9 +2978,6 @@ bool SwTransferable::PasteGrf( const TransferableDataHelper& rData, SwWrtShell& if( bRet ) { - //Check and Perform rotation if needed - lclCheckAndPerformRotation(aGraphic); - OUString sURL; if( dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) != nullptr // #i123922# if link action is noted, also take URL diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index b72faf93da2f..4b0b63388594 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -88,6 +88,8 @@ #include <o3tl/string_view.hxx> #include <o3tl/test_info.hxx> #include <vcl/TypeSerializer.hxx> +#include <vcl/GraphicNativeMetadata.hxx> +#include <vcl/GraphicNativeTransform.hxx> #include "FilterConfigCache.hxx" @@ -961,6 +963,18 @@ ErrCode GraphicFilter::readJPEG(SvStream & rStream, Graphic & rGraphic, GfxLinkT rLinkType = GfxLinkType::NativeJpg; } + // Get Orientation from EXIF data + GraphicNativeMetadata aMetadata; + if (aMetadata.read(rStream)) + { + Degree10 aRotation = aMetadata.getRotation(); + if (aRotation) + { + GraphicNativeTransform aTransform(rGraphic); + aTransform.rotate(aRotation); + } + } + return aReturnCode; }