Files
core/DesktopEditor/graphics/MetafileToRenderer.h
Alexander Trofimov 76ee07f61c [copyright] Update copyright header
Co-authored-by: Alexander Trofimov <alexander.trofimov@onlyoffice.com>
Co-committed-by: Alexander Trofimov <alexander.trofimov@onlyoffice.com>
2026-05-14 08:23:56 +00:00

220 lines
6.1 KiB
C++

/*
* Copyright (C) Ascensio System SIA, 2009-2026
*
* 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, together with the
* additional terms provided in the LICENSE file.
*
* 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: https://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA by email at info@onlyoffice.com
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
* LV-1050, Latvia, European Union.
*
* The interactive user interfaces in modified versions of the Program
* are required to display Appropriate Legal Notices in accordance with
* Section 5 of the GNU AGPL version 3.
*
* No trademark rights are granted under this License.
*
* All non-code elements of the Product, including illustrations,
* icon sets, and technical writing content, are licensed under the
* Creative Commons Attribution-ShareAlike 4.0 International License:
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
*
* This license applies only to such non-code elements and does not
* modify or replace the licensing terms applicable to the Program's
* source code, which remains licensed under the GNU Affero General
* Public License v3.
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
#ifndef _BUILD_METAFILE_TO_IRENDERER_H_
#define _BUILD_METAFILE_TO_IRENDERER_H_
#pragma once
#include "pro/Image.h"
#include "MetafileToRendererCheck.h"
#ifndef INT32
typedef int INT32;
#endif
class GRAPHICS_DECL IMetafileToRenderter
{
public:
IRenderer* m_pRenderer;
void* m_pPicker;
protected:
std::wstring m_sTempDir;
std::wstring m_sThemesDir;
std::wstring m_sMediaDir;
std::wstring m_sInternalMediaDir;
public:
IMetafileToRenderter(IRenderer* pRenderer);
virtual ~IMetafileToRenderter();
public:
virtual std::wstring GetImagePath(const std::wstring& sPath);
virtual void SetLinearGradiant(const double& x0, const double& y0, const double& x1, const double& y1);
virtual void SetRadialGradiant(const double& dX0, const double& dY0, const double& dR0, const double& dX1, const double& dY1, const double& dR1);
virtual void InitPicker(const std::wstring& sFontsFolder);
virtual void InitPicker(NSFonts::IApplicationFonts* pFonts);
void SetTempDirectory(const std::wstring& sDir);
std::wstring GetTempDirectory();
void SetMediaDirectory(const std::wstring& sDir);
std::wstring GetMediaDirectory();
void SetInternalMediaDirectory(const std::wstring& sDir);
std::wstring GetInternalMediaDirectory();
void SetThemesDirectory(const std::wstring& sDir);
std::wstring GetThemesDirectory();
};
namespace NSOnlineOfficeBinToPdf
{
enum CommandType
{
ctPenXML = 0,
ctPenColor = 1,
ctPenAlpha = 2,
ctPenSize = 3,
ctPenDashStyle = 4,
ctPenLineStartCap = 5,
ctPenLineEndCap = 6,
ctPenLineJoin = 7,
ctPenDashPatern = 8,
ctPenDashPatternCount = 9,
ctPenDashOffset = 10,
ctPenAlign = 11,
ctPenMiterLimit = 12,
// brush
ctBrushXML = 20,
ctBrushType = 21,
ctBrushColor1 = 22,
ctBrushColor2 = 23,
ctBrushAlpha1 = 24,
ctBrushAlpha2 = 25,
ctBrushTexturePathOld = 26, // for compatibility
ctBrushTextureAlpha = 27,
ctBrushTextureMode = 28,
ctBrushRectable = 29,
ctBrushRectableEnabled = 30,
ctBrushGradient = 31,
ctBrushTexturePath = 32,
ctBrushResetRotation = 33,
// font
ctFontXML = 40,
ctFontName = 41,
ctFontSize = 42,
ctFontStyle = 43,
ctFontPath = 44,
ctFontGID = 45,
ctFontCharSpace = 46,
// shadow
ctShadowXML = 50,
ctShadowVisible = 51,
ctShadowDistanceX = 52,
ctShadowDistanceY = 53,
ctShadowBlurSize = 54,
ctShadowColor = 55,
ctShadowAlpha = 56,
// edge
ctEdgeXML = 70,
ctEdgeVisible = 71,
ctEdgeDistance = 72,
ctEdgeColor = 73,
ctEdgeAlpha = 74,
// text
ctDrawText = 80,
ctDrawTextEx = 81,
ctDrawTextCodeGid = 83,
// pathcommands
ctPathCommandMoveTo = 91,
ctPathCommandLineTo = 92,
ctPathCommandLinesTo = 93,
ctPathCommandCurveTo = 94,
ctPathCommandCurvesTo = 95,
ctPathCommandArcTo = 96,
ctPathCommandClose = 97,
ctPathCommandEnd = 98,
ctDrawPath = 99,
ctPathCommandStart = 100,
ctPathCommandGetCurrentPoint = 101,
ctPathCommandText = 102,
ctPathCommandTextEx = 103,
ctPathCommandOffset = 104,
ctPathCommandScale = 105,
// image
ctDrawImage = 110,
ctDrawImageFromFile = 111,
ctSetParams = 120,
ctBeginCommand = 121,
ctEndCommand = 122,
ctSetTransform = 130,
ctResetTransform = 131,
ctClipMode = 140,
ctCommandLong1 = 150,
ctCommandDouble1 = 151,
ctCommandString1 = 152,
ctCommandLong2 = 153,
ctCommandDouble2 = 154,
ctCommandString2 = 155,
ctHyperlink = 160,
ctLink = 161,
ctFormField = 162,
ctDocInfo = 163,
ctAnnotField = 164,
ctAnnotFieldDelete = 165,
ctWidgetsInfo = 166,
ctShapeStart = 167,
ctShapeEnd = 168,
ctHeadings = 169,
ctRedact = 170,
ctPageWidth = 200,
ctPageHeight = 201,
ctPageStart = 202,
ctPageEnd = 203,
ctPageClear = 207,
ctPageRotate = 208,
// gradients
ctGradientFill = 220,
ctGradientFillXML = 221,
ctGradientStroke = 222,
ctGradientStrokeXML = 223,
ctError = 255
};
bool GRAPHICS_DECL ConvertBufferToRenderer(BYTE* pBuffer, LONG lBufferLen, IMetafileToRenderter* pCorrector);
}
#endif // _BUILD_METAFILE_TO_IRENDERER_H_