mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
полностью реализован механизм билда статической и динамической библиотеки
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63673 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
3d027e9fd0
commit
e5a0ebb024
@ -1,4 +1,4 @@
|
||||
#include "DjVu.h"
|
||||
#include "DjVu.h"
|
||||
#include "DjVuFileImplementation.h"
|
||||
|
||||
class CApplicationFonts;
|
||||
|
||||
@ -1,14 +1,20 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "../DesktopEditor/graphics/IRenderer.h"
|
||||
|
||||
#ifndef DJVU_USE_DYNAMIC_LIBRARY
|
||||
#define DJVU_DECL_EXPORT
|
||||
#else
|
||||
#include "../DesktopEditor/common/base_export.h"
|
||||
#define DJVU_DECL_EXPORT Q_DECL_EXPORT
|
||||
#endif
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> CDjVuFileImplementation, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> h-<2D><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// –аботаем через класс CDjVuFileImplementation, чтобы когда цепл¤лс¤ данный h-файл, ничего лишнего не инклюдилось
|
||||
class CDjVuFileImplementation;
|
||||
class CApplicationFonts;
|
||||
|
||||
class CDjVuFile
|
||||
class DJVU_DECL_EXPORT CDjVuFile
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
@ -6,14 +6,71 @@
|
||||
|
||||
QT -= core gui
|
||||
|
||||
VERSION = 1.0.0.1
|
||||
TARGET = DjVuFile
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib
|
||||
|
||||
DEFINES += UNICODE
|
||||
DEFINES += _UNICODE
|
||||
DEFINES += _USE_LIBXML2_READER_
|
||||
DEFINES += LIBXML_READER_ENABLED
|
||||
#CONFIG += staticlib
|
||||
CONFIG += shared
|
||||
|
||||
############### destination path ###############
|
||||
DESTINATION_SDK_PATH = $$PWD/../SDK/lib
|
||||
|
||||
# WINDOWS
|
||||
win32:contains(QMAKE_TARGET.arch, x86_64):{
|
||||
CONFIG(debug, debug|release) {
|
||||
DESTDIR = $$DESTINATION_SDK_PATH/win_64/DEBUG
|
||||
} else {
|
||||
DESTDIR = $$DESTINATION_SDK_PATH/win_64
|
||||
}
|
||||
}
|
||||
win32:!contains(QMAKE_TARGET.arch, x86_64):{
|
||||
CONFIG(debug, debug|release) {
|
||||
DESTDIR = $$DESTINATION_SDK_PATH/win_32/DEBUG
|
||||
} else {
|
||||
DESTDIR = $$DESTINATION_SDK_PATH/win_32
|
||||
}
|
||||
}
|
||||
|
||||
linux-g++:contains(QMAKE_HOST.arch, x86_64):{
|
||||
DESTDIR = $$DESTINATION_SDK_PATH/linux_64
|
||||
}
|
||||
linux-g++:!contains(QMAKE_HOST.arch, x86_64):{
|
||||
DESTDIR = $$DESTINATION_SDK_PATH/linux_32
|
||||
}
|
||||
|
||||
################################################
|
||||
|
||||
############# dynamic dependencies #############
|
||||
shared {
|
||||
DEFINES += DJVU_USE_DYNAMIC_LIBRARY
|
||||
|
||||
LIBS += -L$$DESTDIR -lASCOfficeUtilsLib
|
||||
LIBS += -L$$DESTDIR -lgraphics
|
||||
LIBS += -L$$DESTDIR -llibxml
|
||||
LIBS += -L$$DESTDIR -lPdfWriter
|
||||
|
||||
message(dynamic)
|
||||
|
||||
win32 {
|
||||
LIBS += -lgdi32 \
|
||||
-ladvapi32 \
|
||||
-luser32 \
|
||||
-lshell32
|
||||
|
||||
TARGET_EXT = .dll
|
||||
}
|
||||
|
||||
linux-g++ | linux-g++-64 | linux-g++-32 {
|
||||
CONFIG += plugin
|
||||
TARGET_EXT = .so
|
||||
}
|
||||
}
|
||||
################################################
|
||||
|
||||
INCLUDEPATH += \
|
||||
../DesktopEditor/agg-2.4/include \
|
||||
../DesktopEditor/freetype-2.5.2/include
|
||||
|
||||
SOURCES += DjVu.cpp \
|
||||
DjVuFileImplementation.cpp \
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "DjVuFileImplementation.h"
|
||||
#include "DjVuFileImplementation.h"
|
||||
|
||||
#include "../DesktopEditor/common/File.h"
|
||||
#include "../DesktopEditor/common/Directory.h"
|
||||
@ -29,11 +29,10 @@ namespace NSDjvu
|
||||
GUTF8String utf8String(sText.c_str());
|
||||
return utf8String;
|
||||
}
|
||||
static CString MakeCString(GUTF8String& strText)
|
||||
static std::string MakeCString(GUTF8String& strText)
|
||||
{
|
||||
std::string sString(strText.getbuf());
|
||||
std::wstring wsString = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sString.c_str(), sString.length());
|
||||
return CString(wsString.c_str());
|
||||
return sString;
|
||||
}
|
||||
static int GetInteger(const std::wstring& wsString)
|
||||
{
|
||||
@ -42,7 +41,7 @@ namespace NSDjvu
|
||||
|
||||
try
|
||||
{
|
||||
return _ttoi(wsString.c_str());
|
||||
return std::stoi(wsString);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -162,7 +161,7 @@ void CDjVuFileImplementation::DrawPageOnRenderer(IRenderer* pRende
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// белая страница
|
||||
}
|
||||
}
|
||||
void CDjVuFileImplementation::ConvertToRaster(CApplicationFonts* pAppFonts, int nPageIndex, const std::wstring& wsDstPath, int nImageType)
|
||||
@ -252,6 +251,10 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP
|
||||
double dRendWidth = 0;
|
||||
double dRendHeight = 0;
|
||||
|
||||
pRenderer->NewPage();
|
||||
pRenderer->put_Width(25.4 * nWidth / dRendDpiX);
|
||||
pRenderer->put_Height(25.4 * nHeight / dRendDpiY);
|
||||
|
||||
pRenderer->get_Width(&dRendWidth);
|
||||
pRenderer->get_Height(&dRendHeight);
|
||||
|
||||
@ -272,7 +275,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP
|
||||
}
|
||||
else if (c_nHtmlRendrerer == lRendererType)
|
||||
{
|
||||
// TODO: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// TODO: Нужно реализовать функцию
|
||||
// pRenderer->GetMaxImageSize();
|
||||
//VARIANT var;
|
||||
//renderer->GetAdditionalParam(L"MaxImageSize", &var);
|
||||
@ -358,7 +361,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP
|
||||
}
|
||||
else
|
||||
{
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>??
|
||||
// белый фрейм??
|
||||
//memset(pBufferDst, 0xFF, 4 * lImageWidth * lImageHeight);
|
||||
GRect oRectAll(0, 0, lImageWidth, lImageHeight);
|
||||
GP<GPixmap> pImage = pPage->get_pixmap(oRectAll, oRectAll);
|
||||
@ -582,7 +585,7 @@ void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer,
|
||||
}
|
||||
else
|
||||
{
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>??
|
||||
// белый фрейм??
|
||||
//memset(pBufferDst, 0xFF, 4 * lImageWidth * lImageHeight);
|
||||
GRect oRectAll(0, 0, lImageWidth, lImageHeight);
|
||||
GP<GPixmap> pImage = pPage->get_pixmap(oRectAll, oRectAll);
|
||||
@ -692,7 +695,7 @@ void CDjVuFileImplementation::CreateGrFrame(IRenderer* pRenderer,
|
||||
LONG lImageWidth = 0;
|
||||
LONG lImageHeight = 0;
|
||||
|
||||
// TODO: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// TODO: Реализовать для графического рендерера
|
||||
|
||||
//VARIANT var;
|
||||
//renderer->GetAdditionalParam(L"Pixels", &var);
|
||||
@ -773,7 +776,7 @@ void CDjVuFileImplementation::CreateGrFrame(IRenderer* pRenderer,
|
||||
}
|
||||
else
|
||||
{
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>??
|
||||
// белый фрейм??
|
||||
//memset(pBufferDst, 0xFF, 4 * lImageWidth * lImageHeight);
|
||||
GRect oRectAll(0, 0, lImageWidth, lImageHeight);
|
||||
GP<GPixmap> pImage = pPage->get_pixmap(oRectAll, oRectAll);
|
||||
@ -855,18 +858,18 @@ XmlUtils::CXmlNode CDjVuFileImplementation::ParseText(GP<DjVuImage> pPage)
|
||||
XmlUtils::CXmlNode hiddenText;
|
||||
XmlUtils::CXmlNode pageColumn;
|
||||
XmlUtils::CXmlNode region;
|
||||
hiddenText.FromXmlString(NSDjvu::MakeCString(pageText));
|
||||
hiddenText.GetNode(_T("PAGECOLUMN"), pageColumn);
|
||||
pageColumn.GetNode(_T("REGION"), region);
|
||||
region.GetNode(_T("PARAGRAPH"), paragraph);
|
||||
hiddenText.FromXmlStringA(NSDjvu::MakeCString(pageText));
|
||||
hiddenText.GetNode(L"PAGECOLUMN", pageColumn);
|
||||
pageColumn.GetNode(L"REGION", region);
|
||||
region.GetNode(L"PARAGRAPH", paragraph);
|
||||
}
|
||||
return paragraph;
|
||||
}
|
||||
void CDjVuFileImplementation::TextToRenderer(IRenderer* pRenderer, XmlUtils::CXmlNode oTextNode, double dKoef, bool isView)
|
||||
{
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>)
|
||||
// Выставим шрифт пустой (чтобы растягивать по всему ректу)
|
||||
pRenderer->put_FontName(L"DjvuEmptyFont");
|
||||
CString csText = oTextNode.GetXml();
|
||||
//std::wstring csText = oTextNode.GetXml();
|
||||
XmlUtils::CXmlNodes oLinesNodes;
|
||||
oTextNode.GetNodes(L"LINE", oLinesNodes);
|
||||
for (int nLineIndex = 0; nLineIndex < oLinesNodes.GetCount(); ++nLineIndex)
|
||||
@ -879,11 +882,11 @@ void CDjVuFileImplementation::TextToRenderer(IRenderer* pRenderer,
|
||||
{
|
||||
XmlUtils::CXmlNode oWordNode;
|
||||
oWordsNodes.GetAt(nWordIndex, oWordNode);
|
||||
CString csWord = oWordNode.GetText();
|
||||
CString csCoords = oWordNode.GetAttribute(L"coords");
|
||||
std::wstring csWord = oWordNode.GetText();
|
||||
std::wstring csCoords = oWordNode.GetAttribute(L"coords");
|
||||
double arrCoords[4];
|
||||
ParseCoords(csCoords.GetBuffer(), arrCoords, dKoef);
|
||||
DrawPageText(pRenderer, arrCoords, csWord.GetBuffer());
|
||||
ParseCoords(csCoords, arrCoords, dKoef);
|
||||
DrawPageText(pRenderer, arrCoords, csWord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "libdjvu/DjVuDocument.h"
|
||||
#include "libdjvu/DjVuImage.h"
|
||||
@ -20,7 +20,7 @@
|
||||
#define _UNICODE
|
||||
#define _USE_LIBXML2_READER_
|
||||
#define LIBXML_READER_ENABLED
|
||||
#include "../Common/DocxFormat/Source/XML/xmlutils.h"
|
||||
#include "../DesktopEditor/xml/include/xmlutils.h"
|
||||
|
||||
#include "../DesktopEditor/graphics/IRenderer.h"
|
||||
|
||||
|
||||
@ -99,9 +99,11 @@ inline unsigned char
|
||||
umin(unsigned char a, unsigned char b)
|
||||
{ return (a>b) ? b : a; }
|
||||
|
||||
#if 0
|
||||
inline float
|
||||
fmin(float a, float b)
|
||||
{ return (a>b) ? b : a; }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
|
||||
|
||||
#include "../../PdfReader/PdfReader.h"
|
||||
#include "../../DjVuFile/DjVu.h"
|
||||
#include "../include/HTMLRenderer3.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -10,12 +11,21 @@ int main(int argc, char *argv[])
|
||||
QCoreApplication a(argc, 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"\\\\kirillov8\\_Office\\PDF\\Main Window(15p).pdf";
|
||||
std::wstring sFile = L"D:\\knut.djvu";
|
||||
|
||||
CApplicationFonts oFonts;
|
||||
oFonts.Initialize();
|
||||
|
||||
#if 0
|
||||
PdfReader::CPdfReader oReader(&oFonts);
|
||||
oReader.SetTempFolder(L"D:\\test\\Document");
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
CDjVuFile oReader;
|
||||
#endif
|
||||
|
||||
bool bResult = oReader.LoadFromFile(sFile.c_str());
|
||||
|
||||
NSHtmlRenderer::CASCHTMLRenderer3 oHtmlRenderer;
|
||||
|
||||
@ -14,6 +14,7 @@ CONFIG -= app_bundle
|
||||
|
||||
DEFINES += PDFREADER_USE_DYNAMIC_LIBRARY
|
||||
DEFINES += HTMLRENDERER_USE_DYNAMIC_LIBRARY
|
||||
DEFINES += DJVU_USE_DYNAMIC_LIBRARY
|
||||
|
||||
INCLUDEPATH += \
|
||||
../../DesktopEditor/freetype-2.5.2/include
|
||||
@ -25,6 +26,7 @@ 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 += -lgdi32 \
|
||||
-ladvapi32 \
|
||||
-luser32 \
|
||||
|
||||
@ -6,6 +6,13 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef PDFWRITER_USE_DYNAMIC_LIBRARY
|
||||
#define PDFWRITER_DECL_EXPORT
|
||||
#else
|
||||
#include "../DesktopEditor/common/base_export.h"
|
||||
#define PDFWRITER_DECL_EXPORT Q_DECL_EXPORT
|
||||
#endif
|
||||
|
||||
struct Pix;
|
||||
|
||||
namespace PdfWriter
|
||||
@ -30,7 +37,7 @@ class CApplicationFonts;
|
||||
class CRendererCommandBase;
|
||||
class CRendererTextCommand;
|
||||
|
||||
class CPdfRenderer : public IRenderer
|
||||
class PDFWRITER_DECL_EXPORT CPdfRenderer : public IRenderer
|
||||
{
|
||||
public:
|
||||
CPdfRenderer(CApplicationFonts* pAppFonts);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include "Utils.h"
|
||||
#include "Encrypt.h"
|
||||
#include "Objects.h"
|
||||
#include "FastStringToDouble.h"
|
||||
//#include "FastStringToDouble.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@ -793,7 +793,7 @@ namespace PdfWriter
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_oFile.CreateFile(wsFilePath))
|
||||
if (!m_oFile.CreateFileW(wsFilePath))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -870,7 +870,7 @@ namespace PdfWriter
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_oFile.CreateFile(wsFilePath))
|
||||
if (!m_oFile.CreateFileW(wsFilePath))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user