mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Fix problem with spaces.
This commit is contained in:
@ -36,18 +36,18 @@
|
|||||||
|
|
||||||
class CDocxRenderer_Private
|
class CDocxRenderer_Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NSDocxRenderer::CDocument m_oDocument;
|
NSDocxRenderer::CDocument m_oDocument;
|
||||||
std::wstring m_sTempDirectory;
|
std::wstring m_sTempDirectory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDocxRenderer_Private(NSFonts::IApplicationFonts* pFonts, IRenderer* pRenderer) : m_oDocument(pRenderer, pFonts)
|
CDocxRenderer_Private(NSFonts::IApplicationFonts* pFonts, IRenderer* pRenderer) : m_oDocument(pRenderer, pFonts)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~CDocxRenderer_Private()
|
~CDocxRenderer_Private()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CDocxRenderer::CDocxRenderer(NSFonts::IApplicationFonts* pAppFonts)
|
CDocxRenderer::CDocxRenderer(NSFonts::IApplicationFonts* pAppFonts)
|
||||||
@ -96,7 +96,7 @@ int CDocxRenderer::Convert(IOfficeDrawingFile* pFile, const std::wstring& sDstFi
|
|||||||
for (int i = 0; i < nPagesCount; ++i)
|
for (int i = 0; i < nPagesCount; ++i)
|
||||||
{
|
{
|
||||||
NewPage();
|
NewPage();
|
||||||
BeginCommand(c_nPageType);
|
BeginCommand(c_nPageType);
|
||||||
m_pInternal->m_oDocument.m_bIsDisablePageCommand = true;
|
m_pInternal->m_oDocument.m_bIsDisablePageCommand = true;
|
||||||
|
|
||||||
double dPageDpiX, dPageDpiY;
|
double dPageDpiX, dPageDpiY;
|
||||||
|
|||||||
@ -60,152 +60,152 @@ namespace NSDocxRenderer
|
|||||||
class CDocxRenderer_Private;
|
class CDocxRenderer_Private;
|
||||||
class DOCXRENDERER_DECL_EXPORT CDocxRenderer : public IRenderer
|
class DOCXRENDERER_DECL_EXPORT CDocxRenderer : public IRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CDocxRenderer(NSFonts::IApplicationFonts* pAppFonts);
|
CDocxRenderer(NSFonts::IApplicationFonts* pAppFonts);
|
||||||
virtual ~CDocxRenderer();
|
virtual ~CDocxRenderer();
|
||||||
|
|
||||||
HRESULT CreateNewFile(const std::wstring& wsPath, bool bIsOutCompress = true);
|
HRESULT CreateNewFile(const std::wstring& wsPath, bool bIsOutCompress = true);
|
||||||
HRESULT Close();
|
HRESULT Close();
|
||||||
|
|
||||||
HRESULT SetTempFolder(const std::wstring& wsPath);
|
HRESULT SetTempFolder(const std::wstring& wsPath);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Тип рендерера
|
// Тип рендерера
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT get_Type(LONG* lType);
|
virtual HRESULT get_Type(LONG* lType);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для работы со страницей
|
// Функции для работы со страницей
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT NewPage();
|
virtual HRESULT NewPage();
|
||||||
virtual HRESULT get_Height(double* dHeight);
|
virtual HRESULT get_Height(double* dHeight);
|
||||||
virtual HRESULT put_Height(const double& dHeight);
|
virtual HRESULT put_Height(const double& dHeight);
|
||||||
virtual HRESULT get_Width(double* dWidth);
|
virtual HRESULT get_Width(double* dWidth);
|
||||||
virtual HRESULT put_Width(const double& dWidth);
|
virtual HRESULT put_Width(const double& dWidth);
|
||||||
virtual HRESULT get_DpiX(double* dDpiX);
|
virtual HRESULT get_DpiX(double* dDpiX);
|
||||||
virtual HRESULT get_DpiY(double* dDpiY);
|
virtual HRESULT get_DpiY(double* dDpiY);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для работы с Pen
|
// Функции для работы с Pen
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT get_PenColor(LONG* lColor);
|
virtual HRESULT get_PenColor(LONG* lColor);
|
||||||
virtual HRESULT put_PenColor(const LONG& lColor);
|
virtual HRESULT put_PenColor(const LONG& lColor);
|
||||||
virtual HRESULT get_PenAlpha(LONG* lAlpha);
|
virtual HRESULT get_PenAlpha(LONG* lAlpha);
|
||||||
virtual HRESULT put_PenAlpha(const LONG& lAlpha);
|
virtual HRESULT put_PenAlpha(const LONG& lAlpha);
|
||||||
virtual HRESULT get_PenSize(double* dSize);
|
virtual HRESULT get_PenSize(double* dSize);
|
||||||
virtual HRESULT put_PenSize(const double& dSize);
|
virtual HRESULT put_PenSize(const double& dSize);
|
||||||
virtual HRESULT get_PenDashStyle(BYTE* nDashStyle);
|
virtual HRESULT get_PenDashStyle(BYTE* nDashStyle);
|
||||||
virtual HRESULT put_PenDashStyle(const BYTE& nDashStyle);
|
virtual HRESULT put_PenDashStyle(const BYTE& nDashStyle);
|
||||||
virtual HRESULT get_PenLineStartCap(BYTE* nCapStyle);
|
virtual HRESULT get_PenLineStartCap(BYTE* nCapStyle);
|
||||||
virtual HRESULT put_PenLineStartCap(const BYTE& nCapStyle);
|
virtual HRESULT put_PenLineStartCap(const BYTE& nCapStyle);
|
||||||
virtual HRESULT get_PenLineEndCap(BYTE* nCapStyle);
|
virtual HRESULT get_PenLineEndCap(BYTE* nCapStyle);
|
||||||
virtual HRESULT put_PenLineEndCap(const BYTE& nCapStyle);
|
virtual HRESULT put_PenLineEndCap(const BYTE& nCapStyle);
|
||||||
virtual HRESULT get_PenLineJoin(BYTE* nJoinStyle);
|
virtual HRESULT get_PenLineJoin(BYTE* nJoinStyle);
|
||||||
virtual HRESULT put_PenLineJoin(const BYTE& nJoinStyle);
|
virtual HRESULT put_PenLineJoin(const BYTE& nJoinStyle);
|
||||||
virtual HRESULT get_PenDashOffset(double* dOffset);
|
virtual HRESULT get_PenDashOffset(double* dOffset);
|
||||||
virtual HRESULT put_PenDashOffset(const double& dOffset);
|
virtual HRESULT put_PenDashOffset(const double& dOffset);
|
||||||
virtual HRESULT get_PenAlign(LONG* lAlign);
|
virtual HRESULT get_PenAlign(LONG* lAlign);
|
||||||
virtual HRESULT put_PenAlign(const LONG& lAlign);
|
virtual HRESULT put_PenAlign(const LONG& lAlign);
|
||||||
virtual HRESULT get_PenMiterLimit(double* dMiter);
|
virtual HRESULT get_PenMiterLimit(double* dMiter);
|
||||||
virtual HRESULT put_PenMiterLimit(const double& dMiter);
|
virtual HRESULT put_PenMiterLimit(const double& dMiter);
|
||||||
virtual HRESULT PenDashPattern(double* pPattern, LONG lCount);
|
virtual HRESULT PenDashPattern(double* pPattern, LONG lCount);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для работы с Brush
|
// Функции для работы с Brush
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT get_BrushType(LONG* lType);
|
virtual HRESULT get_BrushType(LONG* lType);
|
||||||
virtual HRESULT put_BrushType(const LONG& lType);
|
virtual HRESULT put_BrushType(const LONG& lType);
|
||||||
virtual HRESULT get_BrushColor1(LONG* lColor);
|
virtual HRESULT get_BrushColor1(LONG* lColor);
|
||||||
virtual HRESULT put_BrushColor1(const LONG& lColor);
|
virtual HRESULT put_BrushColor1(const LONG& lColor);
|
||||||
virtual HRESULT get_BrushAlpha1(LONG* lAlpha);
|
virtual HRESULT get_BrushAlpha1(LONG* lAlpha);
|
||||||
virtual HRESULT put_BrushAlpha1(const LONG& lAlpha);
|
virtual HRESULT put_BrushAlpha1(const LONG& lAlpha);
|
||||||
virtual HRESULT get_BrushColor2(LONG* lColor);
|
virtual HRESULT get_BrushColor2(LONG* lColor);
|
||||||
virtual HRESULT put_BrushColor2(const LONG& lColor);
|
virtual HRESULT put_BrushColor2(const LONG& lColor);
|
||||||
virtual HRESULT get_BrushAlpha2(LONG* lAlpha);
|
virtual HRESULT get_BrushAlpha2(LONG* lAlpha);
|
||||||
virtual HRESULT put_BrushAlpha2(const LONG& lAlpha);
|
virtual HRESULT put_BrushAlpha2(const LONG& lAlpha);
|
||||||
virtual HRESULT get_BrushTexturePath(std::wstring* wsPath);
|
virtual HRESULT get_BrushTexturePath(std::wstring* wsPath);
|
||||||
virtual HRESULT put_BrushTexturePath(const std::wstring& wsPath);
|
virtual HRESULT put_BrushTexturePath(const std::wstring& wsPath);
|
||||||
virtual HRESULT get_BrushTextureMode(LONG* lMode);
|
virtual HRESULT get_BrushTextureMode(LONG* lMode);
|
||||||
virtual HRESULT put_BrushTextureMode(const LONG& lMode);
|
virtual HRESULT put_BrushTextureMode(const LONG& lMode);
|
||||||
virtual HRESULT get_BrushTextureAlpha(LONG* lAlpha);
|
virtual HRESULT get_BrushTextureAlpha(LONG* lAlpha);
|
||||||
virtual HRESULT put_BrushTextureAlpha(const LONG& lAlpha);
|
virtual HRESULT put_BrushTextureAlpha(const LONG& lAlpha);
|
||||||
virtual HRESULT get_BrushLinearAngle(double* dAngle);
|
virtual HRESULT get_BrushLinearAngle(double* dAngle);
|
||||||
virtual HRESULT put_BrushLinearAngle(const double& dAngle);
|
virtual HRESULT put_BrushLinearAngle(const double& dAngle);
|
||||||
virtual HRESULT BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
virtual HRESULT BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
||||||
virtual HRESULT BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
virtual HRESULT BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
||||||
virtual HRESULT put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount);
|
virtual HRESULT put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для работы со шрифтами
|
// Функции для работы со шрифтами
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT get_FontName(std::wstring* wsName);
|
virtual HRESULT get_FontName(std::wstring* wsName);
|
||||||
virtual HRESULT put_FontName(const std::wstring& wsName);
|
virtual HRESULT put_FontName(const std::wstring& wsName);
|
||||||
virtual HRESULT get_FontPath(std::wstring* wsPath);
|
virtual HRESULT get_FontPath(std::wstring* wsPath);
|
||||||
virtual HRESULT put_FontPath(const std::wstring& wsPath);
|
virtual HRESULT put_FontPath(const std::wstring& wsPath);
|
||||||
virtual HRESULT get_FontSize(double* dSize);
|
virtual HRESULT get_FontSize(double* dSize);
|
||||||
virtual HRESULT put_FontSize(const double& dSize);
|
virtual HRESULT put_FontSize(const double& dSize);
|
||||||
virtual HRESULT get_FontStyle(LONG* lStyle);
|
virtual HRESULT get_FontStyle(LONG* lStyle);
|
||||||
virtual HRESULT put_FontStyle(const LONG& lStyle);
|
virtual HRESULT put_FontStyle(const LONG& lStyle);
|
||||||
virtual HRESULT get_FontStringGID(INT* bGid);
|
virtual HRESULT get_FontStringGID(INT* bGid);
|
||||||
virtual HRESULT put_FontStringGID(const INT& bGid);
|
virtual HRESULT put_FontStringGID(const INT& bGid);
|
||||||
virtual HRESULT get_FontCharSpace(double* dSpace);
|
virtual HRESULT get_FontCharSpace(double* dSpace);
|
||||||
virtual HRESULT put_FontCharSpace(const double& dSpace);
|
virtual HRESULT put_FontCharSpace(const double& dSpace);
|
||||||
virtual HRESULT get_FontFaceIndex(int* lFaceIndex);
|
virtual HRESULT get_FontFaceIndex(int* lFaceIndex);
|
||||||
virtual HRESULT put_FontFaceIndex(const int& lFaceIndex);
|
virtual HRESULT put_FontFaceIndex(const int& lFaceIndex);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для вывода текста
|
// Функции для вывода текста
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
virtual HRESULT CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
virtual HRESULT CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
virtual HRESULT CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Маркеры команд
|
// Маркеры команд
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT BeginCommand(const DWORD& lType);
|
virtual HRESULT BeginCommand(const DWORD& lType);
|
||||||
virtual HRESULT EndCommand(const DWORD& lType);
|
virtual HRESULT EndCommand(const DWORD& lType);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для работы с патом
|
// Функции для работы с патом
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT PathCommandMoveTo(const double& dX, const double& dY);
|
virtual HRESULT PathCommandMoveTo(const double& dX, const double& dY);
|
||||||
virtual HRESULT PathCommandLineTo(const double& dX, const double& dY);
|
virtual HRESULT PathCommandLineTo(const double& dX, const double& dY);
|
||||||
virtual HRESULT PathCommandLinesTo(double* pPoints, const int& nCount);
|
virtual HRESULT PathCommandLinesTo(double* pPoints, const int& nCount);
|
||||||
virtual HRESULT PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe);
|
virtual HRESULT PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe);
|
||||||
virtual HRESULT PathCommandCurvesTo(double* pPoints, const int& nCount);
|
virtual HRESULT PathCommandCurvesTo(double* pPoints, const int& nCount);
|
||||||
virtual HRESULT PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle);
|
virtual HRESULT PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle);
|
||||||
virtual HRESULT PathCommandClose();
|
virtual HRESULT PathCommandClose();
|
||||||
virtual HRESULT PathCommandEnd();
|
virtual HRESULT PathCommandEnd();
|
||||||
virtual HRESULT DrawPath(const LONG& lType);
|
virtual HRESULT DrawPath(const LONG& lType);
|
||||||
virtual HRESULT PathCommandStart();
|
virtual HRESULT PathCommandStart();
|
||||||
virtual HRESULT PathCommandGetCurrentPoint(double* dX, double* dY);
|
virtual HRESULT PathCommandGetCurrentPoint(double* dX, double* dY);
|
||||||
virtual HRESULT PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
virtual HRESULT PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
virtual HRESULT PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
virtual HRESULT PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для вывода изображений
|
// Функции для вывода изображений
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH);
|
virtual HRESULT DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||||
virtual HRESULT DrawImageFromFile(const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255);
|
virtual HRESULT DrawImageFromFile(const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для выставления преобразования
|
// Функции для выставления преобразования
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY);
|
virtual HRESULT SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY);
|
||||||
virtual HRESULT GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY);
|
virtual HRESULT GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY);
|
||||||
virtual HRESULT ResetTransform();
|
virtual HRESULT ResetTransform();
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Тип клипа
|
// Тип клипа
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT get_ClipMode(LONG* lMode);
|
virtual HRESULT get_ClipMode(LONG* lMode);
|
||||||
virtual HRESULT put_ClipMode(const LONG& lMode);
|
virtual HRESULT put_ClipMode(const LONG& lMode);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Дополнительные функции
|
// Дополнительные функции
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand);
|
virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand);
|
||||||
virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand);
|
virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand);
|
||||||
virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand);
|
virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand);
|
||||||
|
|
||||||
// методы, которыми будет пользоваться конвертер
|
// методы, которыми будет пользоваться конвертер
|
||||||
HRESULT SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType);
|
HRESULT SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType);
|
||||||
int Convert(IOfficeDrawingFile* pFile, const std::wstring& sDstFile, bool bIsOutCompress = true);
|
int Convert(IOfficeDrawingFile* pFile, const std::wstring& sDstFile, bool bIsOutCompress = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CDocxRenderer_Private* m_pInternal;
|
CDocxRenderer_Private* m_pInternal;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DOCX_RENDERER_H
|
#endif // _DOCX_RENDERER_H
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -85,7 +85,7 @@ namespace NSDocxRenderer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteSpaces(NSStringUtils::CStringUTF32& oText);
|
void RemoveSpacesAtBothEnds(NSStringUtils::CStringUTF32& oText);
|
||||||
|
|
||||||
class CContText
|
class CContText
|
||||||
{
|
{
|
||||||
@ -97,7 +97,7 @@ namespace NSDocxRenderer
|
|||||||
LONG m_lPickFontStyle;
|
LONG m_lPickFontStyle;
|
||||||
|
|
||||||
NSStringUtils::CStringUTF32 m_oText;
|
NSStringUtils::CStringUTF32 m_oText;
|
||||||
NSStringUtils::CStringUTF32 m_oGidText;
|
NSStringUtils::CStringUTF32 m_oGidText; //что это?
|
||||||
|
|
||||||
double m_dX;
|
double m_dX;
|
||||||
double m_dY;
|
double m_dY;
|
||||||
@ -114,6 +114,8 @@ namespace NSDocxRenderer
|
|||||||
double m_dCalculateWidth;
|
double m_dCalculateWidth;
|
||||||
double m_dSpaceByText;
|
double m_dSpaceByText;
|
||||||
|
|
||||||
|
bool m_bIsNeedSpaceAtTheEnd;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CContText();
|
CContText();
|
||||||
~CContText(){}
|
~CContText(){}
|
||||||
@ -137,6 +139,8 @@ namespace NSDocxRenderer
|
|||||||
void WriteTo(double dSpacingMM,
|
void WriteTo(double dSpacingMM,
|
||||||
NSStringUtils::CStringBuilder& oWriter,
|
NSStringUtils::CStringBuilder& oWriter,
|
||||||
CFontManagerLight* pManagerLight);
|
CFontManagerLight* pManagerLight);
|
||||||
|
|
||||||
|
void AddSpaceToEnd();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTextLine
|
class CTextLine
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -87,40 +87,77 @@ int main(int argc, char *argv[])
|
|||||||
if (!NSDirectory::Exists(sTempDirOut))
|
if (!NSDirectory::Exists(sTempDirOut))
|
||||||
NSDirectory::CreateDirectory(sTempDirOut);
|
NSDirectory::CreateDirectory(sTempDirOut);
|
||||||
|
|
||||||
std::wstring sSourceFile = L"PATH_TO_TEST_FILE";
|
//Добавляем все файлы из определенного каталога
|
||||||
std::wstring sDestFile = NSFile::GetProcessDirectory() + L"/output.docx";
|
//std::vector<std::wstring> sSourceFiles = NSDirectory::GetFiles(L"C:\\Docs\\Рекомендуемая литература");
|
||||||
|
std::vector<std::wstring> sSourceFiles;
|
||||||
|
//Или добавляем любой нужный файл
|
||||||
|
sSourceFiles.push_back(L"C:\\Development\\test\\andersen_skazki_tom_1.pdf");
|
||||||
|
sSourceFiles.push_back(L"C:\\Development\\test\\08 Правила дорожного движения РФ(108p).pdf");
|
||||||
|
sSourceFiles.push_back(L"C:\\Docs\\Рекомендуемая литература\\Мартин Фаулер - Рефакторинг.pdf");
|
||||||
|
//sSourceFiles.push_back(L"C:\\Development\\test\\(1917) - Das geheimnisvolle Haus.pdf");
|
||||||
|
//sSourceFiles.push_back(L"C:\\Docs\\Рекомендуемая литература\\Embedded_Linux_system_design_and_development_ru.pdf");
|
||||||
|
//sSourceFiles.push_back(L"C:\\Docs\\Рекомендуемая литература\\Алан Купер - Психбольница в руках пациентов.pdf");
|
||||||
|
///sSourceFiles.push_back(L"C:\\Docs\\Рекомендуемая литература\\Брюс Эккель - Философия C++.pdf");
|
||||||
|
//sSourceFiles.push_back(L"C:\\Docs\\Рекомендуемая литература\\Кент Бек - Экстремальное программирование.pdf");
|
||||||
|
//sSourceFiles.push_back(L"C:\\Docs\\Рекомендуемая литература\\Приёмы объектно-ориентированного проектирования. Паттерны проектирования.pdf");
|
||||||
|
//sSourceFiles.push_back(L"C:\\Docs\\Рекомендуемая литература\\Роберт Мартин - Чистый Код.pdf");
|
||||||
|
|
||||||
|
std::wstring sTextDirOut = NSFile::GetProcessDirectory() + L"/text";
|
||||||
|
if (!NSDirectory::Exists(sTextDirOut))
|
||||||
|
NSDirectory::CreateDirectory(sTextDirOut);
|
||||||
|
std::wstring sPlainParagraphDirOut = sTextDirOut + L"/PlainParagraph";
|
||||||
|
if (!NSDirectory::Exists(sPlainParagraphDirOut))
|
||||||
|
NSDirectory::CreateDirectory(sPlainParagraphDirOut);
|
||||||
|
std::wstring sPlainLineDirOut = sTextDirOut + L"/PlainLine";
|
||||||
|
if (!NSDirectory::Exists(sPlainLineDirOut))
|
||||||
|
NSDirectory::CreateDirectory(sPlainLineDirOut);
|
||||||
|
/*std::wstring sBlockCharDirOut = sTextDirOut + L"/BlockChar";
|
||||||
|
if (!NSDirectory::Exists(sBlockCharDirOut))
|
||||||
|
NSDirectory::CreateDirectory(sBlockCharDirOut);
|
||||||
|
std::wstring sBlockLineDirOut = sTextDirOut + L"/BlockLine";
|
||||||
|
if (!NSDirectory::Exists(sBlockLineDirOut))
|
||||||
|
NSDirectory::CreateDirectory(sBlockCharDirOut);*/
|
||||||
|
|
||||||
|
|
||||||
IOfficeDrawingFile* pReader = NULL;
|
IOfficeDrawingFile* pReader = NULL;
|
||||||
|
|
||||||
COfficeFileFormatChecker oChecker;
|
COfficeFileFormatChecker oChecker;
|
||||||
if (oChecker.isOfficeFile(sSourceFile))
|
int nFileType = 0;
|
||||||
|
|
||||||
|
CDocxRenderer oDocxRenderer(pFonts);
|
||||||
|
oDocxRenderer.SetTempFolder(sTempDirOut);
|
||||||
|
|
||||||
|
for (size_t index = 0; index < sSourceFiles.size(); index++)
|
||||||
{
|
{
|
||||||
switch (oChecker.nFileType)
|
if (oChecker.isOfficeFile(sSourceFiles[index]))
|
||||||
{
|
{
|
||||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF:
|
nFileType = oChecker.nFileType;
|
||||||
pReader = new PdfReader::CPdfReader(pFonts);
|
switch (nFileType)
|
||||||
break;
|
{
|
||||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS:
|
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF:
|
||||||
pReader = new CXpsFile(pFonts);
|
pReader = new PdfReader::CPdfReader(pFonts);
|
||||||
break;
|
break;
|
||||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU:
|
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS:
|
||||||
pReader = new CDjVuFile(pFonts);
|
pReader = new CXpsFile(pFonts);
|
||||||
break;
|
break;
|
||||||
default:
|
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU:
|
||||||
break;
|
pReader = new CDjVuFile(pFonts);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!pReader)
|
if (!pReader)
|
||||||
{
|
{
|
||||||
pFonts->Release();
|
pFonts->Release();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pReader->SetTempDirectory(sTempDir);
|
pReader->SetTempDirectory(sTempDir);
|
||||||
|
|
||||||
#ifndef LOAD_FILE_AS_BINARY
|
#ifndef LOAD_FILE_AS_BINARY
|
||||||
pReader->LoadFromFile(sSourceFile);
|
pReader->LoadFromFile(sSourceFiles[index]);
|
||||||
#else
|
#else
|
||||||
BYTE* pFileBinary = NULL;
|
BYTE* pFileBinary = NULL;
|
||||||
DWORD nFileBinaryLen = 0;
|
DWORD nFileBinaryLen = 0;
|
||||||
@ -142,19 +179,37 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
CDocxRenderer oDocxRenderer(pFonts);
|
|
||||||
|
|
||||||
// проверить все режимы
|
// проверить все режимы
|
||||||
NSDocxRenderer::TextAssociationType taType;
|
std::wstring sExtention = NSFile::GetFileExtention(sSourceFiles[index]);
|
||||||
//taType = NSDocxRenderer::TextAssociationTypeBlockChar;
|
std::wstring sFileNameWithExtention = NSFile::GetFileName(sSourceFiles[index]);
|
||||||
//taType = NSDocxRenderer::TextAssociationTypeBlockLine;
|
std::wstring sFileName = sFileNameWithExtention.substr(0, sFileNameWithExtention.size() - 1 - sExtention.size());
|
||||||
taType = NSDocxRenderer::TextAssociationTypePlainLine;
|
std::wstring sDocx = L"/" + sFileName + L".docx";
|
||||||
//taType = NSDocxRenderer::TextAssociationTypePlainParagraph;
|
std::wstring sZip = L"/" + sFileName + L".zip";
|
||||||
oDocxRenderer.SetTextAssociationType(taType);
|
|
||||||
|
|
||||||
oDocxRenderer.SetTempFolder(sTempDirOut);
|
NSDocxRenderer::TextAssociationType taType;
|
||||||
oDocxRenderer.Convert(pReader, sDestFile);
|
|
||||||
|
taType = NSDocxRenderer::TextAssociationTypePlainParagraph;
|
||||||
|
oDocxRenderer.SetTextAssociationType(taType);
|
||||||
|
oDocxRenderer.Convert(pReader, sPlainParagraphDirOut+sDocx);
|
||||||
|
oDocxRenderer.Convert(pReader, sPlainParagraphDirOut+sZip);
|
||||||
|
|
||||||
|
taType = NSDocxRenderer::TextAssociationTypePlainLine;
|
||||||
|
oDocxRenderer.SetTextAssociationType(taType);
|
||||||
|
oDocxRenderer.Convert(pReader, sPlainLineDirOut + sDocx);
|
||||||
|
oDocxRenderer.Convert(pReader, sPlainLineDirOut + sZip);
|
||||||
|
|
||||||
|
/*taType = NSDocxRenderer::TextAssociationTypeBlockLine;
|
||||||
|
oDocxRenderer.SetTextAssociationType(taType);
|
||||||
|
oDocxRenderer.Convert(pReader, sBlockLineDirOut + sDocx);
|
||||||
|
oDocxRenderer.Convert(pReader, sBlockLineDirOut + sZip);
|
||||||
|
|
||||||
|
taType = NSDocxRenderer::TextAssociationTypeBlockChar;
|
||||||
|
oDocxRenderer.SetTextAssociationType(taType);
|
||||||
|
oDocxRenderer.Convert(pReader, sBlockCharDirOut + sDocx);
|
||||||
|
oDocxRenderer.Convert(pReader, sBlockCharDirOut + sZip);*/
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
delete pReader;
|
delete pReader;
|
||||||
pFonts->Release();
|
pFonts->Release();
|
||||||
|
|||||||
Reference in New Issue
Block a user