From 23008b3737b2648f24525a391f127834094cb0b2 Mon Sep 17 00:00:00 2001 From: Green Date: Thu, 3 Jul 2025 19:43:13 +0300 Subject: [PATCH] Fix bug #75718 --- HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp | 53 +++---------------- 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp b/HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp index c98600f13b..06250710e0 100644 --- a/HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp +++ b/HwpFile/HwpDoc/Conversion/Converter2OOXML.cpp @@ -1652,57 +1652,15 @@ void CConverter2OOXML::WriteShapeExtent(const CCtrlObjElement* pCtrlShape, NSStr if (nullptr == pCtrlShape) return; - double dScaleX = 1., dScaleY = 1.; + int nFinalWidth = pCtrlShape->GetCurWidth(); + int nFinalHeight = pCtrlShape->GetCurHeight(); - const int nOrgWidth{pCtrlShape->GetOrgWidth()}, nOrgHeight{pCtrlShape->GetOrgHeight()}; - const int nCurWidth{pCtrlShape->GetCurWidth()}, nCurHeight{pCtrlShape->GetCurHeight()}; - - if (0 != nCurWidth && 0 != nOrgWidth) - dScaleX = (double)nCurWidth / (double)nOrgWidth; - - if (0 != nCurHeight && 0 != nOrgHeight) - dScaleY = (double)nCurHeight / (double)nOrgHeight; - - if (0 != pCtrlShape->GetWidth() && 0 != nCurWidth) - dScaleX *= (double)pCtrlShape->GetWidth() / (double)nCurWidth; - - if (0 != pCtrlShape->GetHeight() && 0 != nCurHeight) - dScaleY *= (double)pCtrlShape->GetHeight() / (double)nCurHeight; - - int nFinalWidth {pCtrlShape->GetWidth() }; - int nFinalHeight{pCtrlShape->GetHeight()}; - - if (0 == nFinalWidth) + if (0 == nFinalWidth || 0 == nFinalHeight) { - if (nullptr != pWidth && 0 != *pWidth) - nFinalWidth = *pWidth; - else - nFinalWidth = nCurWidth; + nFinalWidth = std::abs(pCtrlShape->GetWidth()); + nFinalHeight = std::abs(pCtrlShape->GetHeight()); } - if (nullptr != pWidth && 0 != *pWidth) - dScaleX *= (double)*pWidth / (double)nFinalWidth; - - if (0 == nFinalHeight) - { - if (nullptr != pHeight && 0 != *pHeight) - nFinalHeight = *pHeight; - else - nFinalHeight = nCurHeight; - } - - if (nullptr != pHeight && 0 != *pHeight) - dScaleY *= (double)*pHeight / (double)nFinalHeight; - - TMatrix oFinalMatrix{pCtrlShape->GetFinalMatrix()}; - oFinalMatrix.ApplyToSize(dScaleX, dScaleY); - - nFinalWidth = ceil((double)nFinalWidth * dScaleX); - nFinalHeight = ceil((double)nFinalHeight * dScaleY); - - nFinalWidth -= (pCtrlShape->GetLeftInMargin() + pCtrlShape->GetRightInMargin()); - nFinalHeight -= (pCtrlShape->GetTopInMargin() + pCtrlShape->GetBottomInMargin()); - if (nullptr != pWidth) *pWidth = Transform::HWPUINT2OOXML(nFinalWidth); @@ -1740,6 +1698,7 @@ void CConverter2OOXML::WriteShapeWrapMode(const CCtrlCommon* pCtrlShape, NSStrin } case ETextWrap::BEHIND_TEXT: case ETextWrap::IN_FRONT_OF_TEXT: + default: { oBuilder.WriteString(L""); break;