From 801b5e604ea6d51df833c5f191413e948640c6bd Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Wed, 7 May 2025 17:26:58 +0300 Subject: [PATCH] Fix bug 74372 --- PdfFile/PdfEditor.cpp | 1 + PdfFile/PdfFile.cpp | 12 ++++++++++-- PdfFile/PdfWriter.cpp | 8 ++++---- PdfFile/PdfWriter.h | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/PdfFile/PdfEditor.cpp b/PdfFile/PdfEditor.cpp index 180a995544..9b49a108e0 100644 --- a/PdfFile/PdfEditor.cpp +++ b/PdfFile/PdfEditor.cpp @@ -2135,6 +2135,7 @@ bool CPdfEditor::AddPage(int nPageIndex) m_mObjManager.m_arrSplitAddPages.erase(it); } + m_nEditPage = -1; // Применение добавления страницы для writer if (!m_pWriter->AddPage(nPageIndex)) return false; diff --git a/PdfFile/PdfFile.cpp b/PdfFile/PdfFile.cpp index d1c432d6a0..52fbb8c42a 100644 --- a/PdfFile/PdfFile.cpp +++ b/PdfFile/PdfFile.cpp @@ -583,7 +583,11 @@ HRESULT CPdfFile::put_Height(const double& dHeight) if (!m_pInternal->pWriter) return S_FALSE; if (m_pInternal->pEditor) - return S_OK; + { + if (m_pInternal->pEditor->IsEditPage()) + return S_OK; + return m_pInternal->pWriter->put_Height(dHeight, false); + } return m_pInternal->pWriter->put_Height(dHeight); } HRESULT CPdfFile::get_Width(double* dWidth) @@ -597,7 +601,11 @@ HRESULT CPdfFile::put_Width(const double& dWidth) if (!m_pInternal->pWriter) return S_FALSE; if (m_pInternal->pEditor) - return S_OK; + { + if (m_pInternal->pEditor->IsEditPage()) + return S_OK; + return m_pInternal->pWriter->put_Width(dWidth, false); + } return m_pInternal->pWriter->put_Width(dWidth); } HRESULT CPdfFile::get_DpiX(double* dDpiX) diff --git a/PdfFile/PdfWriter.cpp b/PdfFile/PdfWriter.cpp index 67d0d6eb27..7d0298d2d3 100644 --- a/PdfFile/PdfWriter.cpp +++ b/PdfFile/PdfWriter.cpp @@ -278,13 +278,13 @@ HRESULT CPdfWriter::get_Height(double* dHeight) *dHeight = m_dPageHeight; return S_OK; } -HRESULT CPdfWriter::put_Height(const double& dHeight) +HRESULT CPdfWriter::put_Height(const double& dHeight, bool bMM2PT) { if (!IsValid() || !m_pPage) return S_FALSE; m_dPageHeight = dHeight; - m_pPage->SetHeight(MM_2_PT(dHeight)); + m_pPage->SetHeight(bMM2PT ? MM_2_PT(dHeight) : dHeight); return S_OK; } HRESULT CPdfWriter::get_Width(double* dWidth) @@ -292,13 +292,13 @@ HRESULT CPdfWriter::get_Width(double* dWidth) *dWidth = m_dPageWidth; return S_OK; } -HRESULT CPdfWriter::put_Width(const double& dWidth) +HRESULT CPdfWriter::put_Width(const double& dWidth, bool bMM2PT) { if (!IsValid() || !m_pPage) return S_FALSE; m_dPageWidth = dWidth; - m_pPage->SetWidth(MM_2_PT(dWidth)); + m_pPage->SetWidth(bMM2PT ? MM_2_PT(dWidth) : dWidth); return S_OK; } //---------------------------------------------------------------------------------------- diff --git a/PdfFile/PdfWriter.h b/PdfFile/PdfWriter.h index eb3f211de5..e567002693 100644 --- a/PdfFile/PdfWriter.h +++ b/PdfFile/PdfWriter.h @@ -78,9 +78,9 @@ public: //---------------------------------------------------------------------------------------- HRESULT NewPage(); HRESULT get_Height(double* dHeight); - HRESULT put_Height(const double& dHeight); + HRESULT put_Height(const double& dHeight, bool bMM2PT = true); HRESULT get_Width(double* dWidth); - HRESULT put_Width(const double& dWidth); + HRESULT put_Width(const double& dWidth, bool bMM2PT = true); //---------------------------------------------------------------------------------------- // Функции для работы с Pen //----------------------------------------------------------------------------------------