mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Rename param for x2t & remove src dependency for library (paragraph)
This commit is contained in:
@ -79,7 +79,7 @@ HRESULT CDocxRenderer::Close()
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CDocxRenderer::SetTextAssociationType(const NSDocxRenderer::eTextAssociationType& eType)
|
||||
HRESULT CDocxRenderer::SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType)
|
||||
{
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_eTextAssociationType = eType;
|
||||
return S_OK;
|
||||
|
||||
@ -34,8 +34,6 @@
|
||||
#include "../DesktopEditor/graphics/pro/officedrawingfile.h"
|
||||
#include "../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
#include "src/logic/elements/Paragraph.h"
|
||||
|
||||
#ifndef DOCXRENDERER_USE_DYNAMIC_LIBRARY
|
||||
#define DOCXRENDERER_DECL_EXPORT
|
||||
#else
|
||||
@ -43,6 +41,8 @@
|
||||
#define DOCXRENDERER_DECL_EXPORT Q_DECL_EXPORT
|
||||
#endif
|
||||
|
||||
#include "convert_params.h"
|
||||
|
||||
class CDocxRenderer_Private;
|
||||
class DOCXRENDERER_DECL_EXPORT CDocxRenderer : public IRenderer
|
||||
{
|
||||
@ -187,7 +187,7 @@ public:
|
||||
virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand);
|
||||
|
||||
// методы, которыми будет пользоваться конвертер
|
||||
HRESULT SetTextAssociationType(const NSDocxRenderer::eTextAssociationType& eType);
|
||||
HRESULT SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType);
|
||||
int Convert(IOfficeDrawingFile* pFile, const std::wstring& sDstFile, bool bIsOutCompress = true);
|
||||
|
||||
private:
|
||||
|
||||
45
DocxRenderer/convert_params.h
Normal file
45
DocxRenderer/convert_params.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
enum class TextAssociationType
|
||||
{
|
||||
tatBlockChar = 0, // Каждый символ во фрейме
|
||||
tatBlockLine = 1, // Каждая линия - параграф во фрейме. Линии могут объединяться в рамках одного блока.
|
||||
tatPlainLine = 2, // Каждая линия - параграф обычный
|
||||
tatShapeLine = 3, // Каждая линия - параграф в шейпе. Линии могут объединяться в рамках одного блока.
|
||||
tatPlainParagraph = 4, // Все линии объединяются в параграфы
|
||||
tatParagraphToShape = 5 // Параграфы записываем в шейпы
|
||||
};
|
||||
}
|
||||
@ -49,7 +49,7 @@ namespace NSDocxRenderer
|
||||
CRow* m_pCurrentRow {nullptr};
|
||||
|
||||
|
||||
eTextAssociationType m_eTextAssociationType {eTextAssociationType::tatPlainParagraph};
|
||||
TextAssociationType m_eTextAssociationType {TextAssociationType::tatPlainParagraph};
|
||||
|
||||
bool m_bIsDeleteTextClipPage {true};
|
||||
bool m_bIsRecalcFontSize {true};
|
||||
|
||||
@ -157,7 +157,7 @@ namespace NSDocxRenderer
|
||||
if (m_bIsUnderlinePresent)
|
||||
{
|
||||
oWriter.WriteString(L"<w:u w:val=");
|
||||
oWriter.WriteString(SingletonInstance<LinesTable>().ConverLineToString(m_eUnderlineType));
|
||||
oWriter.WriteString(SingletonInstance<LinesTable>().ConvertLineToString(m_eUnderlineType));
|
||||
|
||||
if (m_lUnderlineColor != m_pFontStyle->oBrush.Color1)
|
||||
{
|
||||
@ -260,7 +260,7 @@ namespace NSDocxRenderer
|
||||
if (m_bIsUnderlinePresent && bIsNeedSaveFormat)
|
||||
{
|
||||
oWriter.WriteString(L"<w:u w:val=");
|
||||
oWriter.WriteString(SingletonInstance<LinesTable>().ConverLineToString(m_eUnderlineType));
|
||||
oWriter.WriteString(SingletonInstance<LinesTable>().ConvertLineToString(m_eUnderlineType));
|
||||
|
||||
if (m_lUnderlineColor != m_pFontStyle->oBrush.Color1)
|
||||
{
|
||||
|
||||
@ -78,7 +78,7 @@ namespace NSDocxRenderer
|
||||
}
|
||||
}
|
||||
|
||||
void CConverter::BuildParagraphes(double dPageWidth, eTextAssociationType eType, CBaseItem::ElemType eBaseType,
|
||||
void CConverter::BuildParagraphes(double dPageWidth, TextAssociationType eType, CBaseItem::ElemType eBaseType,
|
||||
std::vector<CTextLine*>& rTextLines,
|
||||
std::vector<CBaseItem*>& rOutputObjects,
|
||||
CParagraphStyleManager* pParagraphStyleManager)
|
||||
@ -88,8 +88,8 @@ namespace NSDocxRenderer
|
||||
}
|
||||
|
||||
// eBaseType == etCell или etParagraph
|
||||
// eType == 2 - 5 из eTextAssociationType
|
||||
void CConverter::BuildParagraphes(double dPageWidth, eTextAssociationType eType,
|
||||
// eType == 2 - 5 из TextAssociationType
|
||||
void CConverter::BuildParagraphes(double dPageWidth, TextAssociationType eType,
|
||||
CBaseItem::ElemType eBaseType, std::vector<CTextLine*>& rTextLines,
|
||||
std::vector<CTable*>& rTables, std::vector<CBaseItem*> &rOutputObjects,
|
||||
CParagraphStyleManager* pParagraphStyleManager)
|
||||
@ -103,7 +103,7 @@ namespace NSDocxRenderer
|
||||
eVerticalCrossingType eCrossingType;
|
||||
|
||||
bool bIf1, bIf2, bIf3, bIf4, bIf5, bIf6, bIf7;
|
||||
bool bIsNeedParagraphToShape = eType == eTextAssociationType::tatParagraphToShape && eBaseType == CBaseItem::ElemType::etParagraph;
|
||||
bool bIsNeedParagraphToShape = eType == TextAssociationType::tatParagraphToShape && eBaseType == CBaseItem::ElemType::etParagraph;
|
||||
|
||||
CTable* pCurrTable = nullptr;
|
||||
size_t nTableIndex = 0;
|
||||
@ -143,7 +143,7 @@ namespace NSDocxRenderer
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eType == eTextAssociationType::tatShapeLine)
|
||||
if (eType == TextAssociationType::tatShapeLine)
|
||||
{
|
||||
CreateSingleLineShape(pCurrLine, rOutputObjects);
|
||||
continue;
|
||||
@ -167,7 +167,7 @@ namespace NSDocxRenderer
|
||||
}
|
||||
dCurrBeforeSpacing = pCurrTable->CalculateBeforeSpacing(dPreviousStringBaseline);
|
||||
pCurrTable->m_dSpaceBefore = std::max(dCurrBeforeSpacing, 0.0);
|
||||
if (eType != eTextAssociationType::tatParagraphToShape || eBaseType != CBaseItem::ElemType::etParagraph)
|
||||
if (eType != TextAssociationType::tatParagraphToShape || eBaseType != CBaseItem::ElemType::etParagraph)
|
||||
{
|
||||
pCurrTable->m_bIsNeedSpacing = true;
|
||||
}
|
||||
@ -211,7 +211,7 @@ namespace NSDocxRenderer
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eType == eTextAssociationType::tatPlainLine)
|
||||
if (eType == TextAssociationType::tatPlainLine)
|
||||
{
|
||||
CreateSingleLineParagraph(pCurrLine, dPageWidth, &dCurrBeforeSpacing, rOutputObjects);
|
||||
continue;
|
||||
|
||||
@ -10,10 +10,10 @@ namespace NSDocxRenderer
|
||||
void BuildLines(std::vector<CTextLine*>& rTextLines);
|
||||
void DetermineDominantGraphics(std::vector<CTextLine*>& rTextLines);
|
||||
|
||||
void BuildParagraphes(double dPageWidth, eTextAssociationType eType,
|
||||
void BuildParagraphes(double dPageWidth, TextAssociationType eType,
|
||||
CBaseItem::ElemType eBaseType, std::vector<CTextLine*>& rTextLines,
|
||||
std::vector<CBaseItem*> &rOutputObjects, CParagraphStyleManager* pParagraphStyleManager);
|
||||
void BuildParagraphes(double dPageWidth, eTextAssociationType eType,
|
||||
void BuildParagraphes(double dPageWidth, TextAssociationType eType,
|
||||
CBaseItem::ElemType eBaseType, std::vector<CTextLine*>& rTextLines,
|
||||
std::vector<CTable*>& rTables, std::vector<CBaseItem*> &rOutputObjects, CParagraphStyleManager* pParagraphStyleManager);
|
||||
|
||||
|
||||
@ -1,19 +1,10 @@
|
||||
#pragma once
|
||||
#include "BaseItem.h"
|
||||
#include "TextLine.h"
|
||||
#include "../../../convert_params.h"
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
enum class eTextAssociationType
|
||||
{
|
||||
tatBlockChar = 0, // Каждый символ во фрейме
|
||||
tatBlockLine = 1, // Каждая линия - параграф во фрейме. Линии могут объединяться в рамках одного блока.
|
||||
tatPlainLine = 2, // Каждая линия - параграф обычный
|
||||
tatShapeLine = 3, // Каждая линия - параграф в шейпе. Линии могут объединяться в рамках одного блока.
|
||||
tatPlainParagraph = 4, // Все линии объединяются в параграфы
|
||||
tatParagraphToShape = 5 // Параграфы записываем в шейпы
|
||||
};
|
||||
|
||||
class CParagraph : public CBaseItem
|
||||
{
|
||||
public:
|
||||
|
||||
@ -47,7 +47,7 @@ public:
|
||||
InitLinesTable ();
|
||||
}
|
||||
|
||||
inline std::wstring ConverLineToString(const eLineType& sKey)
|
||||
inline std::wstring ConvertLineToString(const eLineType& sKey)
|
||||
{
|
||||
auto iter = m_Table.find(sKey);
|
||||
return iter == m_Table.end() ? L"\"none\"" : iter->second;
|
||||
|
||||
@ -127,10 +127,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!pReader)
|
||||
{
|
||||
pFonts->Release();
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
|
||||
pReader->SetTempDirectory(sTempDir);
|
||||
|
||||
@ -165,18 +162,18 @@ int main(int argc, char *argv[])
|
||||
std::wstring sZip = L"/" + sFileName + L".zip";
|
||||
|
||||
// проверить все режимы
|
||||
NSDocxRenderer::eTextAssociationType taType;
|
||||
//taType = NSDocxRenderer::eTextAssociationType::tatPlainLine;
|
||||
//taType = NSDocxRenderer::eTextAssociationType::tatShapeLine;
|
||||
taType = NSDocxRenderer::eTextAssociationType::tatPlainParagraph;
|
||||
//taType = NSDocxRenderer::eTextAssociationType::tatParagraphToShape;
|
||||
NSDocxRenderer::TextAssociationType taType;
|
||||
//taType = NSDocxRenderer::TextAssociationType::tatPlainLine;
|
||||
//taType = NSDocxRenderer::TextAssociationType::tatShapeLine;
|
||||
taType = NSDocxRenderer::TextAssociationType::tatPlainParagraph;
|
||||
//taType = NSDocxRenderer::TextAssociationType::tatParagraphToShape;
|
||||
|
||||
oDocxRenderer.SetTextAssociationType(taType);
|
||||
oDocxRenderer.Convert(pReader, sTextDirOut+sDocx);
|
||||
//Если сразу нужен zip-архив
|
||||
//oDocxRenderer.Convert(pReader, sPlainParagraphDirOut+sZip);
|
||||
#endif
|
||||
delete pReader;
|
||||
RELEASEOBJECT(pReader);
|
||||
}
|
||||
|
||||
pFonts->Release();
|
||||
|
||||
@ -4991,7 +4991,7 @@ namespace NExtractTools
|
||||
|
||||
CDocxRenderer oDocxRenderer(pApplicationFonts);
|
||||
|
||||
NSDocxRenderer::TextAssociationType taType = NSDocxRenderer::tatPlainLine;
|
||||
NSDocxRenderer::TextAssociationType taType = NSDocxRenderer::TextAssociationType::tatPlainLine;
|
||||
if (params.m_oTextParams)
|
||||
{
|
||||
InputParamsText* oTextParams = params.m_oTextParams;
|
||||
@ -5001,16 +5001,16 @@ namespace NExtractTools
|
||||
switch (*oTextParams->m_nTextAssociationType)
|
||||
{
|
||||
case 0:
|
||||
taType = NSDocxRenderer::tatBlockChar;
|
||||
taType = NSDocxRenderer::TextAssociationType::tatBlockChar;
|
||||
break;
|
||||
case 1:
|
||||
taType = NSDocxRenderer::tatBlockLine;
|
||||
taType = NSDocxRenderer::TextAssociationType::tatBlockLine;
|
||||
break;
|
||||
case 2:
|
||||
taType = NSDocxRenderer::tatPlainLine;
|
||||
taType = NSDocxRenderer::TextAssociationType::tatPlainLine;
|
||||
break;
|
||||
case 3:
|
||||
taType = NSDocxRenderer::tatPlainParagraph;
|
||||
taType = NSDocxRenderer::TextAssociationType::tatPlainParagraph;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user