Commit b8f1d41e authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

полностью реализован механизм билда статической и динамической библиотеки

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63675 954022d7-b5bf-4e40-9824-e11837661b57
parent f1fe79b8
......@@ -4,6 +4,7 @@
#include "../../PdfReader/PdfReader.h"
#include "../../DjVuFile/DjVu.h"
#include "../../XpsFile/XpsFile.h"
#include "../include/HTMLRenderer3.h"
int main(int argc, char *argv[])
......@@ -12,7 +13,8 @@ int main(int argc, char *argv[])
//std::wstring sFile = L"\\\\KIRILLOV8\\_Office\\PDF\\Android intro(2p).pdf";
//std::wstring sFile = L"\\\\kirillov8\\_Office\\PDF\\Main Window(15p).pdf";
std::wstring sFile = L"D:\\knut.djvu";
//std::wstring sFile = L"D:\\knut.djvu";
std::wstring sFile = L"D:\\bankomats.xps";
CApplicationFonts oFonts;
oFonts.Initialize();
......@@ -22,10 +24,15 @@ int main(int argc, char *argv[])
oReader.SetTempFolder(L"D:\\test\\Document");
#endif
#if 1
#if 0
CDjVuFile oReader;
#endif
#if 1
CXpsFile oReader(&oFonts);
oReader.SetTempFolder(L"D:\\test\\Document");
#endif
bool bResult = oReader.LoadFromFile(sFile.c_str());
NSHtmlRenderer::CASCHTMLRenderer3 oHtmlRenderer;
......@@ -34,7 +41,26 @@ int main(int argc, char *argv[])
int nPagesCount = oReader.GetPagesCount();
for (int i = 0; i < nPagesCount; ++i)
{
#if 1
oHtmlRenderer.NewPage();
oHtmlRenderer.BeginCommand(c_nPageType);
double dPageDpiX, dPageDpiY;
double dWidth, dHeight;
oReader.GetPageInfo(i, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY);
dWidth *= 25.4 / dPageDpiX;
dHeight *= 25.4 / dPageDpiY;
oHtmlRenderer.put_Width(dWidth);
oHtmlRenderer.put_Height(dHeight);
#endif
oReader.DrawPageOnRenderer(&oHtmlRenderer, i, NULL);
#if 1
oHtmlRenderer.EndCommand(c_nPageType);
#endif
}
oHtmlRenderer.CloseFile();
......
......@@ -13,20 +13,20 @@ CONFIG += console
CONFIG -= app_bundle
DEFINES += PDFREADER_USE_DYNAMIC_LIBRARY
DEFINES += HTMLRENDERER_USE_DYNAMIC_LIBRARY
DEFINES += XPS_USE_DYNAMIC_LIBRARY
DEFINES += DJVU_USE_DYNAMIC_LIBRARY
DEFINES += HTMLRENDERER_USE_DYNAMIC_LIBRARY
INCLUDEPATH += \
../../DesktopEditor/freetype-2.5.2/include
TEMPLATE = app
LIBS += -L../../../SDK/lib/win_64/DEBUG -lASCOfficeUtilsLib
LIBS += -L../../../SDK/lib/win_64/DEBUG -lgraphics
LIBS += -L../../../SDK/lib/win_64/DEBUG -lHtmlRenderer
LIBS += -L../../../SDK/lib/win_64/DEBUG -llibxml
LIBS += -L../../../SDK/lib/win_64/DEBUG -lPdfReader
LIBS += -L../../../SDK/lib/win_64/DEBUG -lDjVuFile
LIBS += -L../../../SDK/lib/win_64/DEBUG -lXpsFile
LIBS += -lgdi32 \
-ladvapi32 \
-luser32 \
......
......@@ -14,6 +14,8 @@ using namespace XPS;
CXpsFile::CXpsFile(CApplicationFonts* pAppFonts)
{
m_pDocument = NULL;
m_pAppFonts = pAppFonts;
// Создаем менеджер шрифтов с собственным кэшем
......@@ -174,4 +176,4 @@ void CXpsFile::ConvertToPdf(const std::wstring& wsPath)
}
oPdf.SaveToFile(wsPath);
}
\ No newline at end of file
}
......@@ -3,6 +3,13 @@
#include <string>
#ifndef XPS_USE_DYNAMIC_LIBRARY
#define XPS_DECL_EXPORT
#else
#include "../DesktopEditor/common/base_export.h"
#define XPS_DECL_EXPORT Q_DECL_EXPORT
#endif
namespace XPS
{
class CDocument;
......@@ -12,7 +19,7 @@ class IRenderer;
class CApplicationFonts;
class CFontManager;
class CXpsFile
class XPS_DECL_EXPORT CXpsFile
{
public:
CXpsFile(CApplicationFonts* pAppFonts);
......@@ -36,4 +43,4 @@ private:
XPS::CDocument* m_pDocument;
};
#endif // _XPS_FILE_H
\ No newline at end of file
#endif // _XPS_FILE_H
#include "Document.h"
#include "StaticResources.h"
#include "../../Common/DocxFormat/Source/XML/xmlutils.h"
#include "../../DesktopEditor/xml/include/xmlutils.h"
#include "../../DesktopEditor/common/File.h"
namespace XPS
......@@ -182,4 +182,4 @@ namespace XPS
m_mStaticResources.insert(std::pair<std::wstring, CStaticResource*>(wsPath, pStaticResource));
return pStaticResource;
}
}
\ No newline at end of file
}
......@@ -6,11 +6,6 @@
#include <map>
#include <vector>
#define UNICODE
#define _UNICODE
#define _USE_LIBXML2_READER_
#define LIBXML_READER_ENABLED
#include "../../DesktopEditor/graphics/IRenderer.h"
#include "../../DesktopEditor/graphics/TemporaryCS.h"
......@@ -41,4 +36,4 @@ namespace XPS
};
}
#endif //_XPS_XPSLIB_DOCUMENT_H
\ No newline at end of file
#endif //_XPS_XPSLIB_DOCUMENT_H
......@@ -90,10 +90,10 @@ namespace XPS
if (wsNodeName == L"FixedPage")
{
ReadAttribute(oReader, L"Width", wsAttrName);
nW = XmlUtils::GetInteger(wsAttrName.c_str());
nW = wsAttrName.tointeger();
ReadAttribute(oReader, L"Height", wsAttrName);
nH = XmlUtils::GetInteger(wsAttrName.c_str());
nH = wsAttrName.tointeger();
break;
}
}
......@@ -112,10 +112,10 @@ namespace XPS
if (wsNodeName == L"FixedPage")
{
ReadAttribute(oReader, L"Width", wsAttrName);
nW = XmlUtils::GetInteger(wsAttrName.c_str());
nW = wsAttrName.tointeger();
ReadAttribute(oReader, L"Height", wsAttrName);
nH = XmlUtils::GetInteger(wsAttrName.c_str());
nH = wsAttrName.tointeger();
break;
}
}
......@@ -128,10 +128,10 @@ namespace XPS
else if (wsNodeName == L"FixedPage")
{
ReadAttribute(oReader, L"Width", wsAttrName);
nW = XmlUtils::GetInteger(wsAttrName.c_str());
nW = wsAttrName.tointeger();
ReadAttribute(oReader, L"Height", wsAttrName);
nH = XmlUtils::GetInteger(wsAttrName.c_str());
nH = wsAttrName.tointeger();
}
}
void Page::Draw(IRenderer* pRenderer, bool* pbBreak)
......@@ -206,14 +206,14 @@ namespace XPS
bool bTransform = false, bClip = false, bOpacity = false, bResource = false;
if (oReader.MoveToFirstAttribute())
{
CWString wsAttrName = oReader.GetName();
std::string wsAttrName = oReader.GetNameA();
while (!wsAttrName.empty())
{
if (wsAttrName == L"Clip")
bClip = ClipToRenderer(oReader.GetText(), pState);
else if (wsAttrName == L"RenderTransform")
bTransform = TransformToRenderer(oReader.GetText(), pState);
else if (wsAttrName == L"Opacity")
if (wsAttrName == "Clip")
bClip = ClipToRenderer(oReader.GetText().c_str(), pState);
else if (wsAttrName == "RenderTransform")
bTransform = TransformToRenderer(oReader.GetText().c_str(), pState);
else if (wsAttrName == "Opacity")
{
pState->PushOpacity(GetDouble(oReader.GetText()));
bOpacity = true;
......@@ -222,7 +222,7 @@ namespace XPS
if (!oReader.MoveToNextAttribute())
break;
wsAttrName = oReader.GetName();
wsAttrName = oReader.GetNameA();
}
}
oReader.MoveToElement();
......@@ -813,15 +813,15 @@ namespace XPS
}
else if (L"StrokeDashCap" == wsAttrName)
{
nDashCap = GetCapStyle(oReader.GetText());
nDashCap = GetCapStyle(oReader.GetTextA());
}
else if (L"StrokeEndLineCap" == wsAttrName)
{
nEndCap = GetCapStyle(oReader.GetText());
nEndCap = GetCapStyle(oReader.GetTextA());
}
else if (L"StrokeStartLineCap" == wsAttrName)
{
nStartCap = GetCapStyle(oReader.GetText());
nStartCap = GetCapStyle(oReader.GetTextA());
}
else if (L"StrokeLineJoin" == wsAttrName)
{
......@@ -1032,4 +1032,4 @@ namespace XPS
return ReadPathGeometry(oReader, wsData, wsTransform);
}
}
}
\ No newline at end of file
}
......@@ -2,7 +2,7 @@
#define _XPS_XPSLIB_PAGE_H
#include "../../DesktopEditor/graphics/IRenderer.h"
#include "../../Common/DocxFormat/Source/XML/xmlutils.h"
#include "../../DesktopEditor/xml/include/xmlutils.h"
#include "../../DesktopEditor/fontengine/FontManager.h"
#include "FontList.h"
......@@ -45,4 +45,4 @@ namespace XPS
};
}
#endif // _XPS_XPSLIB_PAGE_H
\ No newline at end of file
#endif // _XPS_XPSLIB_PAGE_H
#include "StaticResources.h"
#include "../../Common/DocxFormat/Source/XML/xmlutils.h"
#include "../../DesktopEditor/xml/include/xmlutils.h"
#include "../../DesktopEditor/graphics/IRenderer.h"
#include "../../DesktopEditor/graphics/structures.h"
#include "../../PdfWriter/PdfRenderer.h"
......@@ -230,7 +230,7 @@ namespace XPS
{
if (wsAttrName == L"ImageSource")
{
pBrush = new CImageBrush(oReader.GetText());
pBrush = new CImageBrush(oReader.GetText().c_str());
}
else if (wsAttrName == L"x:Key" && pwsKey)
{
......@@ -411,4 +411,4 @@ namespace XPS
ReadSTColor(wsBrush, nBgr, nAlpha);
return new CSolidBrush(nBgr, nAlpha * dCurOpacity);
}
}
\ No newline at end of file
}
#include "Utils.h"
#include "../../DesktopEditor/common/String.h"
#include "../../DesktopEditor/common/Types.h"
#include "../../Common/DocxFormat/Source/XML/xmlutils.h"
#include "../../DesktopEditor/xml/include/xmlutils.h"
#include "../../DesktopEditor/graphics/IRenderer.h"
#ifndef M_PI
......@@ -758,17 +758,16 @@ namespace XPS
else
return;
}
unsigned char GetCapStyle(const wchar_t* wsCapStyle)
unsigned char GetCapStyle(const std::string& wsCapStyle)
{
BYTE nCapStyle = Aggplus::LineCapFlat;
CWString wsDashCap = wsCapStyle;
if (wsDashCap == L"Flat")
if (wsCapStyle == "Flat")
nCapStyle = Aggplus::LineCapFlat;
else if (wsDashCap == L"Round")
else if (wsCapStyle == "Round")
nCapStyle = Aggplus::LineCapRound;
else if (wsDashCap == L"Square")
else if (wsCapStyle == "Square")
nCapStyle = Aggplus::LineCapSquare;
else if (wsDashCap == L"Triangle")
else if (wsCapStyle == "Triangle")
nCapStyle = Aggplus::LineCapTriangle;
return nCapStyle;
......@@ -1703,4 +1702,4 @@ namespace XPS
int nPos = 0;
dValue = GetDouble(wsString.c_str(), nPos, wsString.size());
}
}
\ No newline at end of file
}
......@@ -63,7 +63,7 @@ namespace XPS
bool GetBool(const std::wstring& wsString);
void GetBgra(const std::wstring& wsString, int& nBgr, int& nAlpha);
unsigned char GetCapStyle(const wchar_t* wsCapStyle);
unsigned char GetCapStyle(const std::string& wsCapStyle);
std::wstring NormalizePath(const std::wstring& wsPath);
std::wstring GetPath(const std::wstring& wsPath);
......@@ -92,4 +92,4 @@ namespace XPS
void ReadGradientStops(XmlUtils::CXmlLiteReader& oReader, std::vector<LONG>& vColors, std::vector<double>& vPositions, const double& dOpacity);
}
#endif // _XPS_XPSLIB_UTILS_H
\ No newline at end of file
#endif // _XPS_XPSLIB_UTILS_H
......@@ -64,6 +64,13 @@ namespace XPS
m_unLen = 0;
create(wsString, false);
}
CWString::CWString(const std::wstring& wsString)
{
m_bOwnBuffer = false;
m_pBuffer = NULL;
m_unLen = 0;
create(wsString, true);
}
CWString::CWString(wchar_t* wsString, bool bCopy, int nLen)
{
m_bOwnBuffer = false;
......@@ -102,6 +109,12 @@ namespace XPS
m_bOwnBuffer = false;
}
}
void CWString::create(const std::wstring& sString, bool bCopy)
{
// unused bCopy
create(sString.c_str(), true, (int)sString.length());
}
void CWString::clear()
{
if (m_bOwnBuffer)
......@@ -206,6 +219,10 @@ namespace XPS
{
return 0 == m_unLen;
}
int CWString::tointeger() const
{
return _wtoi(c_str());
}
std::vector<CWString> CWString::split(wchar_t wChar, bool bCopy)
{
std::vector<CWString> vResult;
......@@ -226,4 +243,4 @@ namespace XPS
}
return vResult;
}
}
\ No newline at end of file
}
......@@ -2,6 +2,7 @@
#define _XPS_XPSLIB_WSTRING_H
#include <vector>
#include <string>
namespace XPS
{
......@@ -11,10 +12,12 @@ namespace XPS
public:
CWString();
CWString(const wchar_t* wsString);
CWString(const std::wstring& wsString);
CWString(const CWString& wsString);
CWString(wchar_t* wsString, bool bCopy, int nLen = -1);
~CWString();
void create(const wchar_t*, bool bCopy, int nLen = -1);
void create(const std::wstring& sString, bool bCopy);
void operator=(const wchar_t* wsString);
void operator=(const CWString& wsString);
bool operator<(const CWString& wsString) const;
......@@ -27,6 +30,8 @@ namespace XPS
const wchar_t* c_str() const;
void clear();
int tointeger() const;
std::vector<CWString> split(wchar_t wChar, bool bCopy = false);
private:
......@@ -37,4 +42,4 @@ namespace XPS
};
}
#endif //_XPS_XPSLIB_WSTRING_H
\ No newline at end of file
#endif //_XPS_XPSLIB_WSTRING_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment