From b5f1cfc5788f278564004effaeeeccba8604d5e3 Mon Sep 17 00:00:00 2001 From: Kulikova Svetlana Date: Mon, 7 Aug 2023 17:54:05 +0300 Subject: [PATCH] Create AnnotField for MetafileToRenderer --- DesktopEditor/graphics/AnnotField.cpp | 33 +++++++++++++ DesktopEditor/graphics/AnnotField.h | 48 +++++++++++++++++++ DesktopEditor/graphics/IRenderer.h | 7 +++ DesktopEditor/graphics/MetafileToRenderer.cpp | 24 ++++++++++ DesktopEditor/graphics/MetafileToRenderer.h | 1 + DesktopEditor/graphics/pro/graphics.pro | 2 + PdfFile/test/test.cpp | 4 +- 7 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 DesktopEditor/graphics/AnnotField.cpp create mode 100644 DesktopEditor/graphics/AnnotField.h diff --git a/DesktopEditor/graphics/AnnotField.cpp b/DesktopEditor/graphics/AnnotField.cpp new file mode 100644 index 0000000000..159266fcd0 --- /dev/null +++ b/DesktopEditor/graphics/AnnotField.cpp @@ -0,0 +1,33 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +#include "./AnnotField.h" diff --git a/DesktopEditor/graphics/AnnotField.h b/DesktopEditor/graphics/AnnotField.h new file mode 100644 index 0000000000..ed9960fdb1 --- /dev/null +++ b/DesktopEditor/graphics/AnnotField.h @@ -0,0 +1,48 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +#ifndef _BUILD_ANNOTFIELD_H_ +#define _BUILD_ANNOTFIELD_H_ + +#include "config.h" +#include "IRenderer.h" + +class GRAPHICS_DECL CAnnotFieldInfo : public IAnnotField +{ +public: + CAnnotFieldInfo(); + virtual ~CAnnotFieldInfo(); + + void SetType(int nType); + bool IsValid() const; +}; + +#endif // _BUILD_ANNOTFIELD_H_ diff --git a/DesktopEditor/graphics/IRenderer.h b/DesktopEditor/graphics/IRenderer.h index bb757634b4..7a70fa05a9 100644 --- a/DesktopEditor/graphics/IRenderer.h +++ b/DesktopEditor/graphics/IRenderer.h @@ -140,6 +140,13 @@ public: virtual ~IFormField() {} }; +class IAnnotField +{ +public: + IAnnotField() {} + virtual ~IAnnotField() {} +}; + namespace Aggplus { class CImage; } // IRenderer diff --git a/DesktopEditor/graphics/MetafileToRenderer.cpp b/DesktopEditor/graphics/MetafileToRenderer.cpp index 1fc877e3c6..2c6def2911 100644 --- a/DesktopEditor/graphics/MetafileToRenderer.cpp +++ b/DesktopEditor/graphics/MetafileToRenderer.cpp @@ -1234,6 +1234,18 @@ namespace NSOnlineOfficeBinToPdf break; } + case ctAnnotField: + { + BYTE* nStartPos = current; + int nStartIndex = curindex; + + int nLen = ReadInt(current, curindex); + + current = nStartPos + nLen; + curindex = nStartIndex + nLen; + + break; + } case ctDocInfo: { int nFlags = ReadInt(current, curindex); @@ -1568,6 +1580,18 @@ namespace NSOnlineOfficeBinToPdf curindex = nStartIndex + nLen; break; } + case ctAnnotField: + { + BYTE* nStartPos = current; + int nStartIndex = curindex; + + int nLen = ReadInt(current, curindex); + + current = nStartPos + nLen; + curindex = nStartIndex + nLen; + break; + break; + } case ctDocInfo: { int nFlags = ReadInt(current, curindex); diff --git a/DesktopEditor/graphics/MetafileToRenderer.h b/DesktopEditor/graphics/MetafileToRenderer.h index 6524e33615..e2da4e7011 100644 --- a/DesktopEditor/graphics/MetafileToRenderer.h +++ b/DesktopEditor/graphics/MetafileToRenderer.h @@ -179,6 +179,7 @@ namespace NSOnlineOfficeBinToPdf ctLink = 161, ctFormField = 162, ctDocInfo = 163, + ctAnnotField = 164, ctPageWidth = 200, ctPageHeight = 201, diff --git a/DesktopEditor/graphics/pro/graphics.pro b/DesktopEditor/graphics/pro/graphics.pro index 475253ae53..20ec5fc191 100644 --- a/DesktopEditor/graphics/pro/graphics.pro +++ b/DesktopEditor/graphics/pro/graphics.pro @@ -110,6 +110,7 @@ HEADERS += \ ./../MetafileToRendererCheck.h \ ./../MetafileToGraphicsRenderer.h \ ./../FormField.h \ + ./../AnnotField.h \ ./../structures.h \ ./../shading_info.h \ ./../Graphics.h \ @@ -127,6 +128,7 @@ SOURCES += \ ./../MetafileToRenderer.cpp \ ./../MetafileToGraphicsRenderer.cpp \ ./../FormField.cpp \ + ./../AnnotField.cpp \ \ ./pro_Image.cpp \ ./pro_Graphics.cpp diff --git a/PdfFile/test/test.cpp b/PdfFile/test/test.cpp index 979d3ce35d..b46dcecd87 100644 --- a/PdfFile/test/test.cpp +++ b/PdfFile/test/test.cpp @@ -90,7 +90,7 @@ int main() } ICertificate* pCertificate = NULL; - if (true) + if (false) { std::wstring wsCertificateFile = NSFile::GetProcessDirectory() + L"/test.pfx"; std::wstring wsPrivateKeyFile = L""; @@ -109,7 +109,7 @@ int main() pCertificate = NSCertificate::GenerateByAlg("ed25519", properties); } - if (false) + if (true) { pdfFile.CreatePdf(); pdfFile.OnlineWordToPdfFromBinary(NSFile::GetProcessDirectory() + L"/pdf.bin", wsDstFile);