Compare commits

..

10 Commits

9 changed files with 135 additions and 42 deletions

View File

@ -1254,6 +1254,14 @@
<File
RelativePath="..\src\odf\chart_build_oox.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1302,6 +1310,14 @@
<File
RelativePath="..\src\odf\draw_frame_docx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1314,6 +1330,14 @@
<File
RelativePath="..\src\odf\draw_frame_pptx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1326,6 +1350,14 @@
<File
RelativePath="..\src\odf\draw_frame_xlsx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>

View File

@ -261,13 +261,13 @@ std::wstring RtfFont::RenderToOOX(RenderParameter oRenderParameter)
break;
}
sResult += L"<w:rFonts w:ascii=\"";
sResult += sFontName;
sResult += XmlUtils::EncodeXmlString( sFontName, true );
sResult += L"\" w:eastAsia=\"";
sResult += sFontName;
sResult += XmlUtils::EncodeXmlString( sFontName, true );
sResult += L"\" w:hAnsi=\"";
sResult += sFontName;
sResult += XmlUtils::EncodeXmlString( sFontName, true );
sResult += L"\" w:cs=\"";
sResult += sFontName;
sResult += XmlUtils::EncodeXmlString( sFontName, true );
sResult += L"\"";
sResult += sHint;
sResult += L"/>";

View File

@ -17,7 +17,11 @@ isEmpty(PUBLISHER_NAME){
}
win32 {
CURRENT_YEAR = $$system("echo %Date:~6,4%")
CURRENT_YEAR = $$system(wmic PATH Win32_LocalTime GET ^Year /FORMAT:VALUE | find \"=\")
CURRENT_YEAR = $$replace(CURRENT_YEAR, "Year=", "")
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\r", "")
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\n", "")
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\t", "")
}
!win32 {
@ -131,6 +135,7 @@ core_linux {
core_mac {
DEFINES += LINUX _LINUX MAC _MAC
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
QMAKE_LFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
}
# PREFIXES
@ -145,8 +150,8 @@ core_windows {
core_win_64:QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.02
core_win_32:QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.01
} else {
core_win_64:QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWS,5.02
core_win_32:QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWS,5.01
core_win_64:QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.02
core_win_32:QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
}
}
}

View File

@ -392,6 +392,7 @@ namespace NSCommon
{
NSFonts::IFontManager* pManager = applicationFonts->GenerateFontManager();
NSFonts::IFontsCache* pCache = NSFonts::NSFontCache::Create();
pCache->SetCacheSize(3);
pCache->SetStreams(applicationFonts->GetStreams());
pManager->SetOwnerCache(pCache);
@ -427,6 +428,9 @@ namespace NSCommon
pRenderer->put_Width(lWidthPix * 25.4 / dDpi);
pRenderer->put_Height(lHeightPix * 25.4 / dDpi);
bool isUseMapForStreams = false;
std::map<std::wstring, bool> mapUsedFiles;
for (int index = 0; index < nCountFonts; ++index)
{
std::map<std::wstring, CFontInfoJS>::iterator pPair = mapFonts.find(arrFonts[index]);
@ -476,6 +480,9 @@ namespace NSCommon
if (NULL != pInfoCur)
{
if (isUseMapForStreams)
mapUsedFiles.insert(std::pair<std::wstring, bool>(pInfoCur->m_wsFontPath, true));
pManager->LoadFontFromFile(pInfoCur->m_wsFontPath, 0, 14, dDpi, dDpi);
}
pRenderer->put_FontPath(pInfoCur->m_wsFontPath);
@ -503,6 +510,9 @@ namespace NSCommon
if (NULL != pInfoCur)
{
if (isUseMapForStreams)
mapUsedFiles.insert(std::pair<std::wstring, bool>(pInfoCur->m_wsFontPath, true));
pManager->LoadFontFromFile(pInfoCur->m_wsFontPath, 0, 14, dDpi, dDpi);
}
pRenderer->put_FontPath(pInfoCur->m_wsFontPath);
@ -514,6 +524,11 @@ namespace NSCommon
pRenderer->put_FontSize(14);
pRenderer->CommandDrawText(pPair->second.m_sName, 5, 25.4 * (index * lH1_px + lH1_px) / dDpi - 2, 0, 0);
if (isUseMapForStreams)
applicationFonts->GetStreams()->CheckStreams(mapUsedFiles);
else
applicationFonts->GetStreams()->Clear();
}
std::wstring strThumbnailPath = strFolderThumbnails + L"/fonts_thumbnail";

View File

@ -119,6 +119,8 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
NSDirectory::GetFiles2(*i, strFontsW_Cur, true);
}
std::sort(strFontsW_Cur.begin(), strFontsW_Cur.end());
bool bIsEqual = true;
if (strFonts.size() != strFontsW_Cur.size())
bIsEqual = false;

View File

@ -104,7 +104,19 @@ NSFonts::IFontStream* CApplicationFontStreams::GetStream(const std::wstring &str
}
void CApplicationFontStreams::CheckStreams(std::map<std::wstring,bool> &mapFiles)
{
// TODO:
std::map<std::wstring, CFontStream*>::iterator iter = m_mapStreams.begin();
while (iter != m_mapStreams.end())
{
CFontStream* pFile = iter->second;
if (mapFiles.find(iter->first) != mapFiles.end())
{
iter = m_mapStreams.erase(iter);
RELEASEINTERFACE(pFile);
}
else
iter++;
}
}
void CApplicationFontStreams::Clear()

View File

@ -358,17 +358,14 @@ namespace ZLibZipUtils
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
(filename_withoutpath!=(wchar_t*)filename_inzip))
{
char c=*(filename_withoutpath-1);
*(filename_withoutpath-1)='\0';
makedir(write_filename);
*(filename_withoutpath-1)=c;
char* current_directory = getcwd(NULL, 0);
if (current_directory)
{
std::string current_path(current_directory);
free(current_directory);
current_path += FILE_SEPARATOR_STRA;
replace_all(current_path, "/", FILE_SEPARATOR_STRA);
replace_all(current_path, "\\", FILE_SEPARATOR_STRA);
@ -378,12 +375,17 @@ namespace ZLibZipUtils
replace_all(filename_inzip, "\\", FILE_SEPARATOR_STRA);
std::string norm_path = normalize_path(current_path + filename_inzip);
std::string norm_current_path = normalize_path(current_path);
if (std::string::npos == norm_path.find(current_path))
if (std::string::npos == norm_path.find(norm_current_path))
{
return UNZ_INTERNALERROR;
}
}
char c=*(filename_withoutpath-1);
*(filename_withoutpath-1)='\0';
makedir(write_filename);
*(filename_withoutpath-1)=c;
if(oFile.CreateFileW(write_filename))
{
@ -446,7 +448,10 @@ namespace ZLibZipUtils
if (do_extract_currentfile(uf,&opt_extract_without_path,
&opt_overwrite,
password) != UNZ_OK)
break;
{
err = -1;
break;
}
if ( progress != NULL )
{
@ -479,7 +484,7 @@ namespace ZLibZipUtils
(*progress)( UTILS_ONPROGRESSEVENT_ID, progressValue, &cancel );
}
return 0;
return err;
}
/*========================================================================================================*/
@ -635,23 +640,46 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
std::vector<std::wstring> aCurFiles = NSDirectory::GetFiles(szText);
std::vector<std::wstring> aCurDirectories = NSDirectory::GetDirectories(szText);
if (sorted)
{
std::sort(aCurFiles.begin(), aCurFiles.end());
std::sort(aCurDirectories.begin(), aCurDirectories.end());
}
for(size_t i = 0; i < aCurDirectories.size(); ++i)
for(size_t i = 0; i < aCurDirectories.size(); ++i)
{
std::wstring sDirName = NSSystemPath::GetFileName(aCurDirectories[i]);
StringDeque.push_back( aCurDirectories[i] );
zipDeque.push_back( zipDir + sDirName );
if (sorted)
{
if (sDirName == L"ppt")
{
StringDeque.push_front(aCurDirectories[i] );
zipDeque.push_front( zipDir + sDirName );
}
else if(sDirName == L"xl")
{
StringDeque.push_front( aCurDirectories[i] );
zipDeque.push_front( zipDir + sDirName );
}
else if (sDirName == L"word")
{
StringDeque.push_front( aCurDirectories[i] );
zipDeque.push_front( zipDir + sDirName );
}
else
{
StringDeque.push_back( aCurDirectories[i] );
zipDeque.push_back( zipDir + sDirName );
}
}
else
{
StringDeque.push_back( aCurDirectories[i] );
zipDeque.push_back( zipDir + sDirName );
}
}
for (size_t i = 0; i < aCurFiles.size(); ++i)
{
std::wstring cFileName = NSSystemPath::GetFileName(aCurFiles[i]);
if (std::wstring::npos != cFileName.find(L"mimetype")) // возможно и полное соответствие
if (std::wstring::npos != cFileName.find(L"mimetype") ||
std::wstring::npos != cFileName.find(L"[Content_Types]")) // возможно и полное соответствие
{
file = NSSystemPath::Combine(szText, cFileName);
zipFileName = zipDir + cFileName;
@ -839,9 +867,9 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
if ( buffer != NULL )
{
#if defined(_WIN32) || defined (_WIN64)
err = _wchdir( buffer );
int err1 = _wchdir( buffer );
#else
err = chdir( buffer );
int err1 = chdir( buffer );
#endif
free( buffer );

View File

@ -147,9 +147,7 @@ namespace NExtractTools
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO)
return mscrypt2oot_bin(sFrom, sTo, sTemp, params);
else
{
//вместо docx другой формат!!
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
else return AVS_FILEUTILS_ERROR_CONVERT;
}
@ -228,7 +226,7 @@ namespace NExtractTools
}
else
{
nRes = dir2zip(sResultDocxDir, sTo);
nRes = dir2zip(sResultDocxDir, sTo, true);
}
}
@ -559,7 +557,7 @@ namespace NExtractTools
}
else
{
//вместо xlsx другой формат!!
return AVS_FILEUTILS_ERROR_CONVERT;
}
}
else return AVS_FILEUTILS_ERROR_CONVERT;
@ -648,7 +646,7 @@ namespace NExtractTools
}
else
{
nRes = dir2zip(sResultXlsxDir, sTo);
nRes = dir2zip(sResultXlsxDir, sTo, true);
}
}
return nRes;
@ -938,7 +936,8 @@ namespace NExtractTools
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO)
return mscrypt2oot_bin(sFrom, sTo, sTemp, params);
//вместо pptx другой формат!!
else
return AVS_FILEUTILS_ERROR_CONVERT;
}
else return AVS_FILEUTILS_ERROR_CONVERT;
}
@ -1021,7 +1020,7 @@ namespace NExtractTools
}
else
{
nRes = dir2zip(sResultPptxDir, sTo);
nRes = dir2zip(sResultPptxDir, sTo, true);
}
}
return nRes;
@ -1071,10 +1070,10 @@ namespace NExtractTools
return pptt_bin2pptx(sTempPpttFileEditor, sTo, sTemp, bFromChanges, sThemeDir, params);
}
// zip dir
_UINT32 dir2zip (const std::wstring &sFrom, const std::wstring &sTo)
_UINT32 dir2zip (const std::wstring &sFrom, const std::wstring &sTo, bool bSorted, int method, short level)
{
COfficeUtils oCOfficeUtils(NULL);
return (S_OK == oCOfficeUtils.CompressFileOrDirectory(sFrom, sTo)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
return (S_OK == oCOfficeUtils.CompressFileOrDirectory(sFrom, sTo, bSorted, method, level)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
}
// unzip dir
@ -3170,7 +3169,7 @@ namespace NExtractTools
}
else
{
nRes = dir2zip(sFrom, sTo);
nRes = dir2zip(sFrom, sTo, true);
}
}
}
@ -3402,7 +3401,7 @@ namespace NExtractTools
}
else
{
nRes = dir2zip(sFrom, sTo);
nRes = dir2zip(sFrom, sTo, true);
}
}
}
@ -3649,7 +3648,7 @@ namespace NExtractTools
}
else
{
nRes = dir2zip(sFrom, sTo);
nRes = dir2zip(sFrom, sTo, true);
}
}
}

View File

@ -178,7 +178,7 @@ namespace NExtractTools
_UINT32 html2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
//-------------------------------------------------------------------------------------------------------------------------------------------------
_UINT32 dir2zip (const std::wstring &sFrom, const std::wstring &sTo);
_UINT32 dir2zip (const std::wstring &sFrom, const std::wstring &sTo, bool bSorted = false, int method = 8/*Z_DEFLATED*/, short level = -1);
_UINT32 zip2dir (const std::wstring &sFrom, const std::wstring &sTo);
_UINT32 convertmailmerge (const InputParamsMailMerge& oMailMergeSend,const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params);