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