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

работа под линукс

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63685 954022d7-b5bf-4e40-9824-e11837661b57
parent 746ccb42
......@@ -327,7 +327,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP
GP<GBitmap> pBitmap = pPage->get_bitmap(oRectAll, oRectAll, 4);
int nPaletteEntries = pBitmap->get_grays();
DWORD* palette = new DWORD[nPaletteEntries];
unsigned int* palette = new unsigned int[nPaletteEntries];
// Create palette for the bitmap
int color = 0xff0000;
......@@ -339,7 +339,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP
color -= decrement;
}
DWORD* pBuffer = (DWORD*)pBufferDst;
unsigned int* pBuffer = (unsigned int*)pBufferDst;
for (int j = lImageHeight - 1; j >= 0; --j)
{
BYTE* pLine = pBitmap->operator [](j);
......@@ -390,7 +390,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP
{
int nPaletteEntries = pBitmap->get_grays();
DWORD* palette = new DWORD[nPaletteEntries];
unsigned int* palette = new unsigned int[nPaletteEntries];
// Create palette for the bitmap
int color = 0xff0000;
......@@ -402,7 +402,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP
color -= decrement;
}
DWORD* pBuffer = (DWORD*)pBufferDst;
unsigned int* pBuffer = (unsigned int*)pBufferDst;
for (int j = lImageHeight - 1; j >= 0; --j)
{
BYTE* pLine = pBitmap->operator [](j);
......@@ -647,7 +647,7 @@ void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer,
Aggplus::CImage oImage;
oImage.Create(pBufferDst, lImageWidth, lImageHeight, 4 * lImageWidth);
DWORD* palette = new DWORD[nPaletteEntries];
unsigned int* palette = new unsigned int[nPaletteEntries];
// Create palette for the bitmap
int color = 0xff0000;
......@@ -659,7 +659,7 @@ void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer,
color -= decrement;
}
DWORD* pBuffer = (DWORD*)pBufferDst;
unsigned int* pBuffer = (unsigned int*)pBufferDst;
for (int j = lImageHeight - 1; j >= 0; --j)
{
BYTE* pLine = pBitmap->operator [](j);
......@@ -739,7 +739,7 @@ void CDjVuFileImplementation::CreateGrFrame(IRenderer* pRenderer,
GP<GBitmap> pBitmap = pPage->get_bitmap(oRectAll, oRectAll, 4);
int nPaletteEntries = pBitmap->get_grays();
DWORD* palette = new DWORD[nPaletteEntries];
unsigned int* palette = new unsigned int[nPaletteEntries];
// Create palette for the bitmap
int color = 0xff0000;
......@@ -751,7 +751,7 @@ void CDjVuFileImplementation::CreateGrFrame(IRenderer* pRenderer,
color -= decrement;
}
DWORD* pBuffer = (DWORD*)pBufferDst;
unsigned int* pBuffer = (unsigned int*)pBufferDst;
for (int j = 0; j < lImageHeight; ++j)
{
BYTE* pLine = pBitmap->operator [](j);
......@@ -809,7 +809,7 @@ void CDjVuFileImplementation::CreateGrFrame(IRenderer* pRenderer,
{
int nPaletteEntries = pBitmap->get_grays();
DWORD* palette = new DWORD[nPaletteEntries];
unsigned int* palette = new unsigned int[nPaletteEntries];
// Create palette for the bitmap
int color = 0xff0000;
......@@ -821,7 +821,7 @@ void CDjVuFileImplementation::CreateGrFrame(IRenderer* pRenderer,
color -= decrement;
}
DWORD* pBuffer = (DWORD*)pBufferDst;
unsigned int* pBuffer = (unsigned int*)pBufferDst;
for (int j = 0; j < lImageHeight; ++j)
{
BYTE* pLine = pBitmap->operator [](j);
......
......@@ -11,17 +11,27 @@ int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
#if 0
//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:\\bankomats.xps";
std::wstring sDst = L"D:\\test\\Document";
#endif
#if 1
//std::wstring sFile = L"/home/oleg/activex/Android intro(2p).pdf";
//std::wstring sFile = L"/home/oleg/activex/knut.djvu";
std::wstring sFile = L"/home/oleg/activex/bankomats.xps";
std::wstring sDst = L"/home/oleg/Document";
#endif
CApplicationFonts oFonts;
oFonts.Initialize();
#if 0
PdfReader::CPdfReader oReader(&oFonts);
oReader.SetTempFolder(L"D:\\test\\Document");
oReader.SetTempFolder(sDst.c_str());
#endif
#if 0
......@@ -30,13 +40,13 @@ int main(int argc, char *argv[])
#if 1
CXpsFile oReader(&oFonts);
oReader.SetTempFolder(L"D:\\test\\Document");
oReader.SetTempFolder(sDst.c_str());
#endif
bool bResult = oReader.LoadFromFile(sFile.c_str());
NSHtmlRenderer::CASCHTMLRenderer3 oHtmlRenderer;
oHtmlRenderer.CreateOfficeFile(L"D:\\test\\Document");
oHtmlRenderer.CreateOfficeFile(sDst);
int nPagesCount = oReader.GetPagesCount();
for (int i = 0; i < nPagesCount; ++i)
......
......@@ -13,6 +13,7 @@ CONFIG += console
CONFIG -= app_bundle
DEFINES += PDFREADER_USE_DYNAMIC_LIBRARY
DEFINES += PDFWRITER_USE_DYNAMIC_LIBRARY
DEFINES += XPS_USE_DYNAMIC_LIBRARY
DEFINES += DJVU_USE_DYNAMIC_LIBRARY
DEFINES += HTMLRENDERER_USE_DYNAMIC_LIBRARY
......@@ -22,14 +23,44 @@ INCLUDEPATH += \
TEMPLATE = app
LIBS += -L../../../SDK/lib/win_64/DEBUG -lgraphics
LIBS += -L../../../SDK/lib/win_64/DEBUG -lHtmlRenderer
LIBS += -L../../../SDK/lib/win_64/DEBUG -lPdfReader
LIBS += -L../../../SDK/lib/win_64/DEBUG -lDjVuFile
LIBS += -L../../../SDK/lib/win_64/DEBUG -lXpsFile
############### destination path ###############
DESTINATION_SDK_PATH = $$PWD/../../SDK/lib
# WINDOWS
win32:contains(QMAKE_TARGET.arch, x86_64):{
CONFIG(debug, debug|release) {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_64/DEBUG
} else {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_64
}
}
win32:!contains(QMAKE_TARGET.arch, x86_64):{
CONFIG(debug, debug|release) {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_32/DEBUG
} else {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_32
}
}
linux-g++:contains(QMAKE_HOST.arch, x86_64):{
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/linux_64
}
linux-g++:!contains(QMAKE_HOST.arch, x86_64):{
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/linux_32
}
LIBS += -L$$DESTINATION_SDK_PATH -lgraphics
LIBS += -L$$DESTINATION_SDK_PATH -lHtmlRenderer
LIBS += -L$$DESTINATION_SDK_PATH -lPdfReader
LIBS += -L$$DESTINATION_SDK_PATH -lDjVuFile
LIBS += -L$$DESTINATION_SDK_PATH -lXpsFile
LIBS += -L$$DESTINATION_SDK_PATH -lPdfWriter
win32 {
LIBS += -lgdi32 \
-ladvapi32 \
-luser32 \
-lshell32
}
SOURCES += main.cpp
......@@ -41,7 +41,7 @@ namespace PdfReader
return NULL;
}
fclose(pFile);
oFile.CloseFile();
*pnFileLen = nLen;
return sBuffer;
}
......@@ -157,4 +157,4 @@ namespace PdfReader
{
return (nPos >= 0 && nPos + nSize >= nPos && nPos + nSize <= m_nLen);
}
}
\ No newline at end of file
}
......@@ -45,10 +45,10 @@ void CXpsFile::SetTempFolder(const std::wstring& wsPath)
NSDirectory::DeleteDirectory(m_wsTempFolder);
int nCounter = 0;
m_wsTempFolder = wsPath + L"\\XPS\\";
m_wsTempFolder = wsPath + L"/XPS/";
while (NSDirectory::Exists(m_wsTempFolder))
{
m_wsTempFolder = wsPath + L"\\XPS" + std::to_wstring(nCounter) + L"\\";
m_wsTempFolder = wsPath + L"/XPS" + std::to_wstring(nCounter) + L"/";
nCounter++;
}
NSDirectory::CreateDirectory(m_wsTempFolder);
......
......@@ -50,7 +50,8 @@ namespace XPS
FILE* pFile = oFile.GetFileNative();
fseek(pFile, 0, SEEK_SET);
fwrite(sFontData, 1, 32, pFile);
fclose(pFile);
oFile.CloseFile();
}
m_oCS.Leave();
}
......@@ -100,4 +101,4 @@ namespace XPS
};
}
#endif // _XPS_XPSLIB_FONTLIST_H
\ No newline at end of file
#endif // _XPS_XPSLIB_FONTLIST_H
......@@ -774,6 +774,7 @@ namespace XPS
}
std::wstring NormalizePath(const std::wstring& wsPath)
{
#ifdef WIN32
std::wstring wsResult = wsPath;
NSStringExt::Replace(wsResult, L"/", L"\\");
while (std::wstring::npos != wsResult.find(L"\\\\"))
......@@ -781,6 +782,11 @@ namespace XPS
NSStringExt::Replace(wsResult, L"\\\\", L"\\");
}
return wsResult;
#else
std::wstring wsResult = wsPath;
NSStringExt::Replace(wsResult, L"//", L"/");
return wsResult;
#endif
}
std::wstring GetPath(const std::wstring& wsPath)
{
......
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