Compare commits

..

6 Commits

43 changed files with 1453 additions and 83 deletions

View File

@ -34,6 +34,7 @@
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../DesktopEditor/common/SystemUtils.h"
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
@ -224,7 +225,10 @@ namespace DocFileFormat
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(L"ONLYOFFICE");
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
pApp->SetApplication(sApplication);
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif

View File

@ -66,12 +66,13 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">")));
mc:Ignorable=\"w14 w15 wp14\">")));
oFile.WriteStringUTF8(m_oBackground.GetData());

View File

@ -72,12 +72,13 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">");
mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_hdr_End = _T("</w:hdr>");
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
@ -92,18 +93,19 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">");
mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_ftr_End = _T("</w:ftr>");
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_footnotes_End = _T("</w:footnotes>");
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_endnotes_End = _T("</w:endnotes>");
class HeaderFooterWriter

View File

@ -36,7 +36,7 @@
namespace Writers
{
static std::wstring g_string_n_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:numbering xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_n_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:numbering xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_n_End = _T("</w:numbering>");
class NumberingWriter

View File

@ -8004,11 +8004,54 @@ public:
pSdtPr->m_oAlias->m_sVal.Init();
pSdtPr->m_oAlias->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::Appearance == type)
{
pSdtPr->m_oAppearance.Init();
pSdtPr->m_oAppearance->m_oVal.Init();
pSdtPr->m_oAppearance->m_oVal->SetValue((SimpleTypes::ESdtAppearance)m_oBufferedStream.GetUChar());
}
else if (c_oSerSdt::ComboBox == type)
{
pSdtPr->m_oComboBox.Init();
READ1_DEF(length, res, this->ReadSdtComboBox, pSdtPr->m_oComboBox.GetPointer());
}
else if (c_oSerSdt::Color == type)
{
rPr oRPr(m_oFileWriter.m_oFontTableWriter.m_mapFonts);
res = oBinary_rPrReader.Read(length, &oRPr);
pSdtPr->m_oColor.Init();
if (oRPr.bColor)
{
pSdtPr->m_oColor->m_oVal.Init();
pSdtPr->m_oColor->m_oVal->SetValue(SimpleTypes::hexcolorRGB);
pSdtPr->m_oColor->m_oVal->Set_R(oRPr.Color.R);
pSdtPr->m_oColor->m_oVal->Set_G(oRPr.Color.G);
pSdtPr->m_oColor->m_oVal->Set_B(oRPr.Color.B);
}
if (oRPr.bThemeColor && oRPr.ThemeColor.IsNoEmpty())
{
if(oRPr.ThemeColor.Auto && !oRPr.bColor)
{
pSdtPr->m_oColor->m_oVal.Init();
pSdtPr->m_oColor->m_oVal->SetValue(SimpleTypes::hexcolorAuto);
}
if(oRPr.ThemeColor.bColor)
{
pSdtPr->m_oColor->m_oThemeColor.Init();
pSdtPr->m_oColor->m_oThemeColor->SetValue((SimpleTypes::EThemeColor)oRPr.ThemeColor.Color);
}
if(oRPr.ThemeColor.bTint)
{
pSdtPr->m_oColor->m_oThemeTint.Init();
pSdtPr->m_oColor->m_oThemeTint->SetValue(oRPr.ThemeColor.Tint);
}
if(oRPr.ThemeColor.bShade)
{
pSdtPr->m_oColor->m_oThemeShade.Init();
pSdtPr->m_oColor->m_oThemeShade->SetValue(oRPr.ThemeColor.Shade);
}
}
}
else if (c_oSerSdt::DataBinding == type)
{
pSdtPr->m_oDataBinding.Init();

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,7 @@
namespace Writers
{
static std::wstring g_string_ft_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:fonts xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" mc:Ignorable=\"w14\">");
static std::wstring g_string_ft_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:fonts xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" mc:Ignorable=\"w14 w15\">");
static std::wstring g_string_ft_End = _T("</w:fonts>");
class FontTableWriter

View File

@ -1096,7 +1096,9 @@ extern int g_nCurFormatVersion;
TabIndex = 32,
Tag = 33,
Temporary = 34,
MultiLine = 35
MultiLine = 35,
Appearance = 36,
Color = 37
};}
namespace c_oSerFFData{enum c_oSerFFData
{

View File

@ -7074,12 +7074,27 @@ namespace BinDocxRW
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oAlias->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oAppearance.IsInit() && oStdPr.m_oAppearance->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Appearance);
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_oAppearance->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oComboBox.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ComboBox);
WriteSdtComboBox(oStdPr.m_oComboBox.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oColor.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Color);
if(oStdPr.m_oColor->m_oVal.IsInit())
m_oBcw.WriteColor(c_oSerProp_rPrType::Color, oStdPr.m_oColor->m_oVal.get());
m_oBcw.WriteThemeColor(c_oSerProp_rPrType::ColorTheme, oStdPr.m_oColor->m_oVal, oStdPr.m_oColor->m_oThemeColor, oStdPr.m_oColor->m_oThemeTint, oStdPr.m_oColor->m_oThemeShade);
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDataBinding.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DataBinding);

View File

@ -34,6 +34,7 @@
#include "../../DesktopEditor/common/Directory.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Path.h"
#include "../../DesktopEditor/common/SystemUtils.h"
#include "../BinWriter/BinWriters.h"
#include "../BinReader/Readers.h"
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
@ -298,7 +299,10 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(L"ONLYOFFICE");
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
pApp->SetApplication(sApplication);
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif

View File

@ -38,6 +38,7 @@
#include "mediaitems.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/SystemUtils.h"
#include "../../DesktopEditor/graphics/pro/Image.h"
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
#include "../../Common/DocxFormat/Source/Base/Base.h"
@ -312,7 +313,11 @@ void app_file::write(const std::wstring & RootPath)
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
resStream << L"<Application>ONLYOFFICE";
resStream << L"<Application>";
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
resStream << sApplication;
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
resStream << L"/" << std::wstring(s.begin(), s.end()) ;

View File

@ -38,6 +38,7 @@
#include "../../../DesktopEditor/common/File.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../DesktopEditor/common/SystemUtils.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../../Common/3dParty/cryptopp/osrng.h"
@ -194,7 +195,10 @@ namespace odf_writer
{
CP_XML_NODE(L"meta:generator")
{
CP_XML_STREAM() << L"ONLYOFFICE";
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
CP_XML_STREAM() << sApplication;
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
CP_XML_STREAM() << L"/" << std::wstring (s.begin(), s.end() );

View File

@ -39,6 +39,7 @@
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../../ASCOfficeXlsFile2/source/Common/simple_xml_writer.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../DesktopEditor/common/SystemUtils.h"
#include "../Reader/PPTDocumentInfo.h"
@ -291,7 +292,9 @@ void NSPresentationEditor::CPPTXWriter::WriteApp(CFile& oFile)
{
CP_XML_STREAM() << 0;
}
std::wstring sApplication = L"ONLYOFFICE";
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
sApplication += L"/" + std::wstring(s.begin(), s.end());

View File

@ -32,6 +32,7 @@
#pragma once
#include "Converter.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../DesktopEditor/common/SystemUtils.h"
#include "DefaultNotesMaster.h"
#include "DefaultNotesTheme.h"
@ -1027,7 +1028,9 @@ namespace NSBinPptxRW
{
m_oApp.TotalTime = 0;
m_oApp.Words = 0;
std::wstring sApplication = L"ONLYOFFICE";
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
sApplication += L"/" + std::wstring(s.begin(), s.end());

View File

@ -37,6 +37,7 @@
#include "../../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Core.h"
#include "../../../DesktopEditor/common/SystemUtils.h"
#include <boost/algorithm/string.hpp>
@ -3280,7 +3281,9 @@ std::wstring RtfInformation::RenderToRtf(RenderParameter oRenderParameter)
if( PROP_DEF != m_nInternalId )
sResult += L"{\\id" + std::to_wstring(m_nInternalId) + L"}";
m_sApplication = L"ONLYOFFICE";
std::wstring m_sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (m_sApplication.empty())
m_sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);

View File

@ -47,6 +47,8 @@
#include "../../../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Core.h"
#include "../../../../DesktopEditor/common/SystemUtils.h"
#include "../../../../ASCOfficeDocxFile2/BinReader/DefaultThemeWriter.h"
OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
@ -160,7 +162,10 @@ bool OOXWriter::SaveByItemEnd()
if (m_poDocPropsApp)
{
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"ONLYOFFICE" );
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( sApplication );
#if defined(INTVER)
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( VALUE2STR(INTVER) );
#endif

View File

@ -42,6 +42,7 @@
#include "../../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Core.h"
#include "../../../DesktopEditor/common/SystemUtils.h"
namespace NSBinPptxRW
{
@ -218,7 +219,10 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(L"ONLYOFFICE");
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
pApp->SetApplication(sApplication);
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif

View File

@ -42,6 +42,7 @@
#include "external_items.h"
#include "../../../DesktopEditor/common/File.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../DesktopEditor/common/SystemUtils.h"
#include "../../../DesktopEditor/raster/ImageFileFormatChecker.h"
namespace oox {
@ -252,7 +253,11 @@ void app_file::write(const std::wstring & RootPath)
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
resStream << L"<Application>ONLYOFFICE";
resStream << L"<Application>";
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
resStream << sApplication;
#if defined(INTVER)
std::string s = VALUE2STR(INTVER);
resStream << L"/" << std::wstring(s.begin(), s.end());

View File

@ -883,7 +883,7 @@ namespace ComplexTypes
if ( m_oVal.IsInit() )
{
sResult += _T("w:val=\"");
sResult += m_oVal->ToString();
sResult += m_oVal->ToStringNoAlpha();
sResult += _T("\" ");
}

View File

@ -1252,4 +1252,39 @@ namespace SimpleTypes
SimpleType_FromString (ETrueFalse)
SimpleType_Operator_Equal (CTrueFalse)
};
enum ESdtAppearance
{
sdtappearenceTags = 0,
sdtappearenceBoundingBox = 1,
sdtappearenceHidden = 2
};
template<ESdtAppearance eDefValue = sdtappearenceBoundingBox>
class CSdtAppearance : public CSimpleType<ESdtAppearance, eDefValue>
{
public:
CSdtAppearance() {}
virtual ESdtAppearance FromString(std::wstring &sValue)
{
if ( L"boundingBox" == sValue ) this->m_eValue = sdtappearenceBoundingBox;
else if ( L"tags" == sValue ) this->m_eValue = sdtappearenceTags;
else if ( L"hidden" == sValue ) this->m_eValue = sdtappearenceHidden;
return this->m_eValue;
}
virtual std::wstring ToString () const
{
switch(this->m_eValue)
{
case sdtappearenceTags : return L"tags";
case sdtappearenceHidden : return L"hidden";
default : return L"boundingBox";
}
}
SimpleType_FromString (ESdtAppearance)
SimpleType_Operator_Equal (CSdtAppearance)
};
} // SimpleTypes

View File

@ -38,6 +38,7 @@
#include "../Base/Nullable.h"
#include "../Common/SimpleTypes_Word.h"
#include "../Common/SimpleTypes_Shared.h"
#include "../../../../DesktopEditor/common/SystemUtils.h"
namespace OOX
{
@ -415,7 +416,10 @@ namespace OOX
}
void SetDefaults()
{
SetApplication(L"ONLYOFFICE");
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
SetApplication(sApplication);
#if defined(INTVER)
SetAppVersion(VALUE2STR(INTVER));
#endif

View File

@ -376,12 +376,13 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">";
mc:Ignorable=\"w14 w15 wp14\">";
if ( m_oBackground.IsInit() )
sXml += m_oBackground->toXML();

View File

@ -107,7 +107,7 @@ namespace OOX
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
std::wstring sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
for ( unsigned int nIndex = 0; nIndex < m_arrEndnote.size(); nIndex++ )
{
if ( m_arrEndnote[nIndex] )

View File

@ -107,7 +107,7 @@ namespace OOX
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
std::wstring sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
for (size_t nIndex = 0; nIndex < m_arrFootnote.size(); nIndex++ )
{
if ( m_arrFootnote[nIndex] )

View File

@ -197,12 +197,13 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">");
mc:Ignorable=\"w14 w15 wp14\">");
else if ( et_w_hdr == m_eType )
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
@ -216,12 +217,13 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">");
mc:Ignorable=\"w14 w15 wp14\">");
else
return;

View File

@ -356,6 +356,54 @@ namespace ComplexTypes
nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse>> m_oMultiLine;
};
//--------------------------------------------------------------------------------
// SdtAppearance 2.5.4.2 ([MS-DOCX])
//--------------------------------------------------------------------------------
class CSdtAppearance : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CSdtAppearance)
CSdtAppearance()
{
}
virtual ~CSdtAppearance()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
XmlMacroReadAttributeBase( oNode, _T("w15:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring ToString() const
{
std::wstring sResult;
if(m_oVal.IsInit())
{
sResult = _T("w15:val=\"") + m_oVal->ToString() + _T("\"");
}
return sResult;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w15:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CSdtAppearance<>> m_oVal;
};
} // Word
} // ComplexTypes
@ -913,6 +961,9 @@ namespace OOX
if ( oNode.GetNode( _T("w:alias"), oChild ) )
m_oAlias = oChild;
if ( oNode.GetNode( _T("w15:appearance"), oChild ) )
m_oAppearance = oChild;
if ( oNode.GetNode( _T("w:bibliography"), oChild ) )
m_eType = sdttypeBibliography;
@ -924,6 +975,8 @@ namespace OOX
m_oComboBox = oChild;
m_eType = sdttypeComboBox;
}
if ( oNode.GetNode( _T("w15:color"), oChild ) )
m_oColor = oChild;
if ( oNode.GetNode( _T("w:dataBinding"), oChild ) )
m_oDataBinding = oChild;
@ -1012,6 +1065,8 @@ namespace OOX
if ( _T("w:alias") == sName )
m_oAlias = oReader;
else if( _T("w15:appearance") == sName )
m_oAppearance = oReader;
else if ( _T("w:bibliography") == sName )
m_eType = sdttypeBibliography;
else if ( sdttypeUnknown == m_eType && _T("w:citation") == sName )
@ -1021,6 +1076,8 @@ namespace OOX
m_oComboBox = oReader;
m_eType = sdttypeComboBox;
}
else if ( _T("w15:color") == sName )
m_oColor = oReader;
else if ( _T("w:dataBinding") == sName )
m_oDataBinding = oReader;
else if ( sdttypeUnknown == m_eType && _T("w:date") == sName )
@ -1082,6 +1139,8 @@ namespace OOX
WritingElement_WriteNode_2( m_oRPr );
WritingElement_WriteNode_1( L"<w:alias ", m_oAlias );
WritingElement_WriteNode_1( L"<w15:appearance ", m_oAppearance );
WritingElement_WriteNode_1( L"<w15:color ", m_oColor );
WritingElement_WriteNode_1( L"<w:id ", m_oId );
WritingElement_WriteNode_1( L"<w:label ", m_oLabel );
WritingElement_WriteNode_1( L"<w:tabIndex ", m_oTabIndex );
@ -1192,7 +1251,9 @@ namespace OOX
// Nodes
nullable<ComplexTypes::Word::String > m_oAlias;
nullable<ComplexTypes::Word::CSdtAppearance > m_oAppearance;
nullable<OOX::Logic::CSdtComboBox > m_oComboBox;
nullable<ComplexTypes::Word::CColor > m_oColor;
nullable<ComplexTypes::Word::CDataBinding > m_oDataBinding;
nullable<OOX::Logic::CDate > m_oDate;
nullable<OOX::Logic::CSdtDocPart > m_oDocPartList;

View File

@ -894,7 +894,7 @@ namespace OOX
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
std::wstring sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:numbering xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" mc:Ignorable=\"w14\">");
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:numbering xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" mc:Ignorable=\"w14 w15\">");
for (unsigned int nIndex = 0; nIndex < m_arrAbstractNum.size(); nIndex++ )
{

View File

@ -3027,7 +3027,7 @@ namespace OOX
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
std::wstring sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:settings xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:sl=\"http://schemas.openxmlformats.org/schemaLibrary/2006/main\" mc:Ignorable=\"w14\">");
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:settings xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:sl=\"http://schemas.openxmlformats.org/schemaLibrary/2006/main\" mc:Ignorable=\"w14 w15\">");
// 1
if ( m_oWriteProtection.IsInit() )

View File

@ -185,7 +185,7 @@ namespace OOX
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
std::wstring sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:webSettings xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" mc:Ignorable=\"w14\">");
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:webSettings xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" mc:Ignorable=\"w14 w15\">");
if ( m_oAllowPNG.IsInit() )
{

View File

@ -837,7 +837,7 @@ namespace OOX
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
std::wstring sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:styles xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" mc:Ignorable=\"w14\">");
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:styles xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" mc:Ignorable=\"w14 w15\">");
if ( m_oDocDefaults.IsInit() )
sXml += m_oDocDefaults->toXML();

View File

@ -182,26 +182,30 @@ void OOX::Spreadsheet::CCell::PrepareForBinaryWriter()
}
else if(SimpleTypes::Spreadsheet::celltypeStr == m_oType->GetValue() || SimpleTypes::Spreadsheet::celltypeError == m_oType->GetValue())
{
if(!xlsx->m_pSharedStrings)
xlsx->CreateSharedStrings();
std::wstring sValue;
if(m_oValue.IsInit())
sValue = m_oValue->ToString();
//добавляем в SharedStrings
CSi* pSi = new CSi();
CText* pText = new CText();
pText->m_sText = sValue;
pSi->m_arrItems.push_back(pText);
int nIndex = xlsx->m_pSharedStrings->AddSi(pSi);
//меняем значение ячейки
m_oValue.Init();
m_oValue->m_sText = std::to_wstring(nIndex);
//меняем тип ячейки
if(SimpleTypes::Spreadsheet::celltypeStr == m_oType->GetValue())
if (m_oValue.IsInit())
{
m_oType.Init();
m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
if(!xlsx->m_pSharedStrings)
xlsx->CreateSharedStrings();
//добавляем в SharedStrings
CSi* pSi = new CSi();
CText* pText = new CText();
pText->m_sText = m_oValue->ToString();
pSi->m_arrItems.push_back(pText);
int nIndex = xlsx->m_pSharedStrings->AddSi(pSi);
//меняем значение ячейки
m_oValue.Init();
m_oValue->m_sText = std::to_wstring(nIndex);
//меняем тип ячейки
if(SimpleTypes::Spreadsheet::celltypeStr == m_oType->GetValue())
{
m_oType.Init();
m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
}
}
else
{
m_oValue.reset();
m_oType.reset();
}
}
else if(SimpleTypes::Spreadsheet::celltypeBool == m_oType->GetValue())
@ -220,4 +224,4 @@ void OOX::Spreadsheet::CCell::PrepareForBinaryWriter()
}
}
}
}
}

View File

@ -45,6 +45,8 @@
#include "Pivot/PivotCacheDefinition.h"
#include "Pivot/PivotCacheRecords.h"
#include "../../../../DesktopEditor/common/SystemUtils.h"
OOX::Spreadsheet::CXlsx::~CXlsx()
{
if(bDeleteWorkbook) RELEASEOBJECT(m_pWorkbook);
@ -123,7 +125,10 @@ bool OOX::Spreadsheet::CXlsx::Write(const CPath& oDirPath, OOX::CContentTypes &o
//CApp
OOX::CApp* pApp = new OOX::CApp(this);
pApp->SetApplication(L"ONLYOFFICE");
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
pApp->SetApplication(sApplication);
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
@ -423,26 +428,31 @@ void OOX::Spreadsheet::CXlsx::PrepareWorksheet(CWorksheet* pWorksheet)
}
else if(SimpleTypes::Spreadsheet::celltypeStr == pCell->m_oType->GetValue() || SimpleTypes::Spreadsheet::celltypeError == pCell->m_oType->GetValue())
{
if(!m_pSharedStrings) CreateSharedStrings();
std::wstring sValue;
if(pCell->m_oValue.IsInit())
sValue = pCell->m_oValue->ToString();
//добавляем в SharedStrings
CSi* pSi = new CSi();
CText* pText = new CText();
pText->m_sText = sValue;
pSi->m_arrItems.push_back(pText);
int nIndex = m_pSharedStrings->AddSi(pSi);
//меняем значение ячейки
pCell->m_oValue.Init();
pCell->m_oValue->m_sText = std::to_wstring(nIndex);
//меняем тип ячейки
if(SimpleTypes::Spreadsheet::celltypeStr == pCell->m_oType->GetValue())
if (pCell->m_oValue.IsInit())
{
pCell->m_oType.Init();
pCell->m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
if(!m_pSharedStrings) CreateSharedStrings();
//добавляем в SharedStrings
CSi* pSi = new CSi();
CText* pText = new CText();
pText->m_sText = pCell->m_oValue->ToString();
pSi->m_arrItems.push_back(pText);
int nIndex = m_pSharedStrings->AddSi(pSi);
//меняем значение ячейки
pCell->m_oValue.Init();
pCell->m_oValue->m_sText = std::to_wstring(nIndex);
//меняем тип ячейки
if(SimpleTypes::Spreadsheet::celltypeStr == pCell->m_oType->GetValue())
{
pCell->m_oType.Init();
pCell->m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
}
}
else
{
pCell->m_oValue.reset();
pCell->m_oType.reset();
}
}
else if(SimpleTypes::Spreadsheet::celltypeBool == pCell->m_oType->GetValue())

View File

@ -103,3 +103,7 @@ SOURCES += ./../DesktopEditor/common/StreamWriter.cpp
# DIRECTORY
HEADERS += ./../DesktopEditor/common/Directory.h
SOURCES += ./../DesktopEditor/common/Directory.cpp
# SYSTEM
HEADERS += ./../DesktopEditor/common/SystemUtils.h
SOURCES += ./../DesktopEditor/common/SystemUtils.cpp

View File

@ -0,0 +1,64 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <stdlib.h>
#include "SystemUtils.h"
#include "File.h"
namespace NSSystemUtils
{
std::wstring GetEnvVariable(const std::wstring& strName)
{
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
wchar_t* pVal = _wgetenv(strName.c_str());
if (NULL != pVal)
{
std::wstring sRes(pVal);
return sRes;
}
else
{
return L"";
}
#else
std::string strNameA = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strName);
char* pValA = getenv(strNameA.c_str());
if (NULL != pValA)
{
return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)pValA, strlen(pValA));
}
else
{
return L"";
}
#endif
}
}

View File

@ -0,0 +1,47 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _SYSTEMUTILS_H
#define _SYSTEMUTILS_H
#include <string>
#include "../../Common/kernel_config.h"
namespace NSSystemUtils
{
static const wchar_t* gc_EnvApplicationName = L"APPLICATION_NAME";
static const wchar_t* gc_EnvApplicationNameDefault = L"ONLYOFFICE";
static const wchar_t* gc_EnvCompanyName = L"COMPANY_NAME";
static const wchar_t* gc_EnvCompanyNameDefault = L"Ascensio System SIA Copyright (c) 2018";
KERNEL_DECL std::wstring GetEnvVariable(const std::wstring& strName);
}
#endif // _SYSTEMUTILS_H

View File

@ -2,9 +2,6 @@
* TIFF file IO, using CxFile.
*/
#if defined(_WIN32) || defined (_WIN64)
#include <windows.h>
#endif
#include <stdio.h>
#include "ximage.h"
@ -112,7 +109,7 @@ extern char* realloc();
#include <malloc.h>
#endif
#ifndef UNICODE
#ifdef UNICODE
#define DbgPrint wvsprintf
#define DbgPrint2 wsprintf
#define DbgMsgBox MessageBox

View File

@ -41,10 +41,6 @@
#if !defined(__xfile_h)
#define __xfile_h
#if defined (WIN32) || defined (_WIN32_WCE)
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>

View File

@ -75,6 +75,16 @@
#if defined(WIN32) || defined(_WIN32_WCE)
#ifdef CXIMAGE_ATTACK_NO_UNICODE
#ifdef _UNICODE
#undef _UNICODE
#endif
#ifdef UNICODE
#undef UNICODE
#endif
#endif
#include <windows.h>
#include <tchar.h>
#endif

View File

@ -17,6 +17,596 @@
#include <assert.h>
#endif
#define USE_RGB_PALETTE
#ifdef USE_RGB_PALETTE
#include <vector>
namespace NSGeneratePalette
{
class CImage32bit_BGRA
{
public:
unsigned char* m_pPixels;
int m_lWidth;
int m_lHeight;
};
class CImage8bit
{
public:
unsigned char* m_pPixels;
int m_lWidth;
int m_lHeight;
public:
CImage8bit()
{
m_pPixels = NULL;
m_lWidth = 0;
m_lHeight = 0;
}
~CImage8bit()
{
Destroy(TRUE);
}
void Destroy(BOOL bAttack = TRUE)
{
if (bAttack)
{
if (NULL != m_pPixels)
delete[] m_pPixels;
}
m_pPixels = NULL;
}
bool Create( int lWidth, int lHeight )
{
unsigned char* pPixels = new unsigned char[lWidth * lHeight];
if( !pPixels )
return false;
m_pPixels = pPixels;
m_lWidth = lWidth;
m_lHeight = lHeight;
return true;
}
static bool ImageCut ( CImage8bit* pSource, int X, int Y, int Width, int Height, CImage8bit** pImage )
{
if ( NULL != pSource )
{
int SrcWidth = pSource->m_lWidth;
int SrcHeigth = pSource->m_lHeight;
unsigned char* pSrc = pSource->m_pPixels;
if ( ( X + Width ) > SrcWidth || ( Y + Height ) > SrcHeigth || NULL == pSrc )
{
return NULL;
}
(*pImage) = new CImage8bit ();
if ( NULL != pImage )
{
(*pImage)->Create ( Width, Height );
unsigned char* pDst = (*pImage)->m_pPixels;
pSrc += X + Y * SrcWidth;
for ( int i = 0; i < Height; ++i )
{
::memcpy ( pDst, pSrc, Width );
pDst += Width;
pSrc += SrcWidth;
}
return true;
}
}
return false;
}
};
struct SColor
{
union
{
unsigned int Pixel;
unsigned char Color[4];
struct
{
unsigned char B;
unsigned char G;
unsigned char R;
unsigned char A;
};
};
unsigned char* RefByDstPixel;
SColor()
{
Pixel = 0;
RefByDstPixel = 0;
}
SColor( const SColor& other )
{
Pixel = other.Pixel;
RefByDstPixel = other.RefByDstPixel;
}
void SetBgraColor( unsigned char* pBgraColor, unsigned char* pDstPixel )
{
Pixel = *((unsigned int*)pBgraColor);
RefByDstPixel = pDstPixel;
A = (A & ~15) + 15; // квантуем альфу
}
};
struct SRect3D
{
unsigned char MaxWidth; // максимальная ширина
unsigned char MaxColor; // цвет максимальной ширины: 0 - blue, 1 - green, 2 - red, 3 - alpha
SRect3D()
{
Clear();
}
void Clear()
{
MaxWidth = 0;
MaxColor = 0;
}
};
class CPaletteCreator
{
public:
class CBounder
{
public:
SColor* m_arrPoints;
unsigned int m_nCountPoints;
SRect3D m_oRect;
public:
CBounder()
{
m_arrPoints = NULL;
m_nCountPoints = 0;
}
~CBounder()
{
// удалять ничего не нужно, так как нет динамических данных
}
void Init( SColor* points, unsigned int count )
{
m_arrPoints = points;
m_nCountPoints = count;
Normalize();
}
void Clear()
{
m_arrPoints = 0;
m_nCountPoints = 0;
m_oRect.Clear();
}
void Normalize()
{
if( 0 == m_nCountPoints )
{
m_oRect.Clear();
return;
}
if( 1 == m_nCountPoints )
{
m_oRect.MaxWidth = 0;
m_oRect.MaxColor = 0;
return;
}
// нормализуем по точкам, убивая лишние грани...
int nMinB, nMaxB;
int nMinG, nMaxG;
int nMinR, nMaxR;
int nMinA, nMaxA;
SColor* pPoint = m_arrPoints;
nMinB = nMaxB = pPoint->B;
nMinG = nMaxG = pPoint->G;
nMinR = nMaxR = pPoint->R;
nMinA = nMaxA = pPoint->A;
for( unsigned int i = 1; i < m_nCountPoints; ++i, ++pPoint )
{
int B = pPoint->B;
int G = pPoint->G;
int R = pPoint->R;
int A = pPoint->A;
if( B < nMinB ) nMinB = B;
if( B > nMaxB ) nMaxB = B;
if( G < nMinG ) nMinG = G;
if( G > nMaxG ) nMaxG = G;
if( R < nMinR ) nMinR = R;
if( R > nMaxR ) nMaxR = R;
if( A < nMinA ) nMinA = A;
if( A > nMaxA ) nMaxA = A;
}
nMaxB -= nMinB;
nMaxG -= nMinG;
nMaxR -= nMinR;
nMaxA -= nMinA;
int nMaxWidth = nMaxB;
int nMaxColor = 0;
if( nMaxWidth < nMaxG )
{
nMaxWidth = nMaxG;
nMaxColor = 1;
}
if( nMaxWidth < nMaxR )
{
nMaxWidth = nMaxR;
nMaxColor = 2;
}
if( nMaxWidth < nMaxA )
{
nMaxWidth = nMaxA;
nMaxColor = 3;
}
m_oRect.MaxWidth = nMaxWidth;
m_oRect.MaxColor = nMaxColor;
}
void GetHistogramm( unsigned int Table[256], int nColorType ) const
{
memset( Table, 0, 256 * sizeof(unsigned int) );
if( !m_nCountPoints )
return;
SColor* pPoint = m_arrPoints;
for( unsigned int i = 0; i < m_nCountPoints; ++i, ++pPoint )
{
Table[pPoint->Color[nColorType]] += 1;
}
}
bool CreateNew( CBounder& bound1, CBounder& bound2 ) const
{
// перераспределяем точки в массиве на две части.
if( 0 == m_oRect.MaxWidth )
{
return FALSE;
}
// сначала определяем самую длинную сторону...
int nColorType = m_oRect.MaxColor;
unsigned int hist[256];
GetHistogramm( hist, nColorType );
unsigned int nHalfCountPoints = m_nCountPoints / 2;
unsigned int nIndexH = 0;
unsigned int nCurCount = 0;
do
{
nCurCount += hist[nIndexH++];
} while( nCurCount < nHalfCountPoints );
--nIndexH;
if( nCurCount == m_nCountPoints )
nCurCount -= hist[nIndexH--];
SColor* pPoint1 = m_arrPoints;
SColor* pPoint2 = m_arrPoints + m_nCountPoints;
while( pPoint1 != pPoint2 )
{
if( pPoint1->Color[nColorType] <= nIndexH )
{
++pPoint1;
}
else
{
--pPoint2;
SColor tmp( *pPoint1 );
*pPoint1 = *pPoint2;
*pPoint2 = tmp;
}
}
bound1.m_arrPoints = m_arrPoints;
bound1.m_nCountPoints = (unsigned int)(((size_t)pPoint2 - (size_t)m_arrPoints) / sizeof(SColor));
bound2.m_arrPoints = m_arrPoints + bound1.m_nCountPoints;
bound2.m_nCountPoints = m_nCountPoints - bound1.m_nCountPoints;
bound1.Normalize();
bound2.Normalize();
return true;
}
unsigned int GetColor() const
{
union
{
unsigned int value;
struct
{
unsigned char B;
unsigned char G;
unsigned char R;
unsigned char A;
};
} color;
SColor* pPoint = m_arrPoints;
if( !pPoint )
return 0;
color.value = pPoint->Pixel;
if( 0 == m_oRect.MaxWidth )
{
return color.value;
}
double dB = pPoint->B;
double dG = pPoint->G;
double dR = pPoint->R;
double dA = pPoint->A;
for( unsigned int i = 1; i < m_nCountPoints; ++i, ++pPoint )
{
dB += pPoint->B;
dG += pPoint->G;
dR += pPoint->R;
dA += pPoint->A;
}
color.B = (unsigned char)(dB / m_nCountPoints + 0.5);
color.G = (unsigned char)(dG / m_nCountPoints + 0.5);
color.R = (unsigned char)(dR / m_nCountPoints + 0.5);
color.A = (unsigned char)(dA / m_nCountPoints + 0.5);
return color.value;
}
void ApplyPaletteColor( unsigned char color ) const
{
SColor* pPoint = m_arrPoints;
for( unsigned int i = 0; i < m_nCountPoints; ++i, ++pPoint )
{
pPoint->RefByDstPixel[0] = color;
}
}
};
public:
CPaletteCreator()
{
}
~CPaletteCreator()
{
}
void Destroy()
{
}
std::vector<CImage8bit*> Convert(std::vector<CImage32bit_BGRA>& arImages, unsigned int** pDstPalette)
{
std::vector<CImage8bit*> arDst;
int nCountImages = (int)arImages.size();
if( !nCountImages || pDstPalette == NULL )
return arDst;
// создаём палитру
unsigned int* pPalette = new unsigned int[256];
*pDstPalette = pPalette;
if( !pPalette )
return arDst;
memset( pPalette, 0, 256 * sizeof(unsigned int) );
unsigned int lCountPoints = 0;
for( int nImage = 0; nImage < nCountImages; ++nImage )
{
int lWidth = arImages[nImage].m_lWidth;
int lHeight = arImages[nImage].m_lHeight;
CImage8bit* pImage8 = new CImage8bit();
if( pImage8 )
{
if( pImage8->Create( lWidth, lHeight ) )
{
lCountPoints += lWidth * lHeight;
::memset( pImage8->m_pPixels, 0, lWidth * lHeight );
}
else
{
delete pImage8;
pImage8 = NULL;
}
}
arDst.push_back( pImage8 );
}
SColor* arrPoints = (SColor*)(new unsigned char[lCountPoints * sizeof(SColor)]);
if( !arrPoints )
return arDst;
SColor* pPoint = arrPoints;
for( int nImage = 0; nImage < nCountImages; ++nImage )
{
CImage8bit* pImage8 = arDst[nImage];
if( !pImage8 )
continue;
unsigned int lCountPixels = pImage8->m_lWidth * pImage8->m_lHeight;
unsigned char* pBgraPixel = arImages[nImage].m_pPixels;
for( unsigned int i = 0; i < lCountPixels; ++i, pBgraPixel += 4 )
{
if( pBgraPixel[3] > 4 )
{
pPoint->SetBgraColor( pBgraPixel, pImage8->m_pPixels + i );
++pPoint;
}
}
}
if( pPoint == arrPoints )
{
delete [] (unsigned char*)arrPoints;
return arDst;
}
size_t nActivePoints = (size_t(pPoint) - size_t(arrPoints)) / sizeof(SColor);
CBounder bounds[255];
CBounder oNew1;
CBounder oNew2;
bounds[0].Init( arrPoints, nActivePoints );
int nCountBounds = 1;
while( nCountBounds < 255 )
{
int nBoundIndex = FindBoundIndexWithMaxWidth( bounds, nCountBounds );
if( nBoundIndex < 0 )
break;
bounds[nBoundIndex].CreateNew( oNew1, oNew2 );
bounds[nBoundIndex] = oNew1;
bounds[nCountBounds] = oNew2;
++nCountBounds;
}
for( int i = 0; i < nCountBounds; i++ )
{
pPalette[i + 1] = bounds[i].GetColor();
bounds[i].ApplyPaletteColor( i + 1 );
}
delete [] (unsigned char*)arrPoints;
//for( int nImage = 0; nImage < nCountImages; ++nImage )
//{
// CImage8bit* pImage8 = arDst[nImage];
// if( !pImage8 )
// continue;
// if( !pImage8->m_pPixels )
// continue;
// unsigned int nSize = pImage8->m_lWidth * pImage8->m_lHeight;
// unsigned int* buffer = new unsigned int[nSize];
// if( !buffer )
// continue;
// for( unsigned int i = 0; i < nSize; i++ )
// {
// buffer[i] = pPalette[pImage8->m_pPixels[i]];
// }
// delete [] buffer;
//}
return arDst;
}
static int FindBoundIndexWithMaxWidth( const CBounder* pBounds, int nCountBounds )
{
int nMaxWidth = 0;
int nMaxIndex = -1;
for( int i = 0; i < nCountBounds; ++i, ++pBounds )
{
int width = pBounds->m_oRect.MaxWidth;
if( width > nMaxWidth )
{
nMaxWidth = width;
nMaxIndex = i;
}
}
return nMaxIndex;
}
unsigned char* CreateFrom8bit(CImage8bit* pImage, unsigned int* pPalette)
{
unsigned char* pData = new unsigned char[4 * pImage->m_lWidth * pImage->m_lHeight];
unsigned char* pDataMem = pData;
long lCount = pImage->m_lWidth * pImage->m_lHeight;
for (long nIndex = 0; nIndex < lCount; ++nIndex)
{
unsigned int color = pPalette[pImage->m_pPixels[nIndex]]; // ARGB
pDataMem[2] = (unsigned char)((color >> 16) & 0xFF);
pDataMem[1] = (unsigned char)((color >> 8) & 0xFF);
pDataMem[0] = (unsigned char)(color & 0xFF);
pDataMem[3] = (unsigned char)(color >> 24);
pDataMem += 4;
}
return pData;
}
};
}
#endif
////////////////////////////////////////////////////////////////////////////////
CxImageGIF::CxImageGIF(): CxImage(CXIMAGE_FORMAT_GIF)
{
@ -693,10 +1283,11 @@ bool CxImageGIF::EncodeRGB(CxFile *fp)
EncodeComment(fp);
#ifndef USE_RGB_PALETTE
uint32_t w,h;
w=h=0;
const int32_t cellw = 17;
const int32_t cellh = 15;
int32_t cellw = 17;
int32_t cellh = 15;
CxImageGIF tmp;
for (int32_t y=0;y<head.biHeight;y+=cellh){
for (int32_t x=0;x<head.biWidth;x+=cellw){
@ -724,6 +1315,71 @@ bool CxImageGIF::EncodeRGB(CxFile *fp)
tmp.EncodeBody(fp,true);
}
}
#else
CxImageGIF tmp;
tmp.Create(head.biWidth, head.biHeight, 8);
tmp.SetTransIndex(0);
NSGeneratePalette::CImage32bit_BGRA srcBgra;
srcBgra.m_lWidth = head.biWidth;
srcBgra.m_lHeight = head.biHeight;
srcBgra.m_pPixels = new unsigned char[4 * srcBgra.m_lWidth * srcBgra.m_lHeight];
unsigned char* pixelsTmp = srcBgra.m_pPixels;
for (uint32_t j=0;j<head.biHeight;j++)
{
for (uint32_t k=0;k<head.biWidth;k++)
{
RGBQUAD c = GetPixelColor(k,j);
*pixelsTmp++ = c.rgbBlue;
*pixelsTmp++ = c.rgbGreen;
*pixelsTmp++ = c.rgbRed;
*pixelsTmp++ = c.rgbReserved;
}
}
NSGeneratePalette::CPaletteCreator oCreator;
std::vector<NSGeneratePalette::CImage32bit_BGRA> imagesSrc;
imagesSrc.push_back(srcBgra);
unsigned int* pPalette = NULL;
std::vector<NSGeneratePalette::CImage8bit*> imagesDst = oCreator.Convert(imagesSrc, &pPalette);
NSGeneratePalette::CImage8bit* pImage8 = imagesDst[0];
for (int i = 0; i < 256; i++)
{
unsigned int c = pPalette[i];
RGBQUAD cRGB;
//cRGB.rgbRed = (c >> 8) & 0xFF;
//cRGB.rgbGreen = (c >> 16) & 0xFF;
//cRGB.rgbBlue = (c >> 24) & 0xFF;
//cRGB.rgbReserved = c & 0xFF;
cRGB.rgbRed = (c >> 16) & 0xFF;
cRGB.rgbGreen = (c >> 8) & 0xFF;
cRGB.rgbReserved = (c >> 24) & 0xFF;
cRGB.rgbBlue = c & 0xFF;
tmp.SetPaletteColor(i, cRGB);
}
unsigned char* pImage8Tmp = pImage8->m_pPixels;
for (uint32_t j=0;j<head.biHeight;j++)
{
for (uint32_t k=0;k<head.biWidth;k++)
{
tmp.SetPixelIndex(k, j, *pImage8Tmp++);
}
}
delete[] srcBgra.m_pPixels;
delete[] pPalette;
delete pImage8;
tmp.SetOffset(0,0);
tmp.EncodeExtension(fp);
tmp.EncodeBody(fp,true);
#endif
fp->PutC(';'); // Write the GIF file terminator

View File

@ -1632,7 +1632,8 @@ std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles()
#if defined(__linux__) && !defined(_MAC)
std::vector<std::wstring> _array = NSDirectory::GetFiles(L"/usr/share/fonts", true);
NSDirectory::GetFiles2(L"/usr/share/X11/fonts", _array, true);
NSDirectory::GetFiles2(L"/usr/X11R6/lib/X11/fonts", _array, true);
NSDirectory::GetFiles2(L"/usr/X11R6/lib/X11/fonts", _array, true);
NSDirectory::GetFiles2(L"/usr/local/share/fonts", _array, true);
return _array;
#endif

View File

@ -0,0 +1,365 @@
LIB_GRAPHICS_PRI_PATH=$$PWD/../..
DEFINES += GRAPHICS_NO_USE_DYNAMIC_LIBRARY
DEFINES += \
_QT \
EXCLUDE_JPG_SUPPORT \
MNG_SUPPORT_DISPLAY \
MNG_SUPPORT_READ \
MNG_SUPPORT_WRITE \
MNG_ACCESS_CHUNKS \
MNG_STORE_CHUNKS\
MNG_ERROR_TELLTALE
core_linux {
DEFINES += \
HAVE_UNISTD_H
QMAKE_CXXFLAGS += -Wno-narrowing
}
core_mac {
DEFINES += \
HAVE_UNISTD_H
}
core_windows {
DEFINES += \
JAS_WIN_MSVC_BUILD \
NOMINMAX
#DEFINES -= UNICODE
#DEFINES -= _UNICODE
DEFINES += CXIMAGE_ATTACK_NO_UNICODE
LIBS += -lAdvapi32
LIBS += -lShell32
LIBS += -lUser32
}
INCLUDEPATH += \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/include \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/include \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg \
$$LIB_GRAPHICS_PRI_PATH/cximage/png \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib
HEADERS += \
$$PWD/../../raster/BgraFrame.h
SOURCES += \
$$PWD/../../raster/BgraFrame.cpp \
$$PWD/../../raster/ImageFileFormatChecker.cpp \
$$PWD/../../graphics/Image.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_arc.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_bezier_arc.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_arrowhead.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/ctrl/agg_cbox_ctrl.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_curves.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_gsv_text.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_image_filters.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_line_aa_basics.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_line_profile_aa.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_rounded_rect.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_sqrt_tables.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_trans_affine.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_bspline.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_vcgen_bspline.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_vcgen_contour.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_vcgen_dash.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_vcgen_markers_term.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_vcgen_smooth_poly1.cpp \
$$LIB_GRAPHICS_PRI_PATH/agg-2.4/src/agg_vcgen_stroke.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_cm.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_debug.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_getopt.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_icc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_iccdata.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_image.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_init.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_malloc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_stream.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_seq.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_string.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_tvp.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_version.c \
\
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/bmp/bmp_cod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/bmp/bmp_dec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/bmp/bmp_enc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jp2/jp2_cod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jp2/jp2_dec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jp2/jp2_enc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_bs.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_cs.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_dec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_enc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_math.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_mct.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_mqcod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_mqdec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_mqenc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_qmfb.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t1cod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t1dec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t1enc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t2cod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t2dec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t2enc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_tagtree.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_tsfb.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_util.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpg/jpg_dummy.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpg/jpg_val.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/mif/mif_cod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pgx/pgx_cod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pgx/pgx_dec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pgx/pgx_enc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pnm/pnm_cod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pnm/pnm_dec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pnm/pnm_enc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/ras/ras_cod.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/ras/ras_dec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/ras/ras_enc.c \
\
$$LIB_GRAPHICS_PRI_PATH/cximage/jbig/jbig.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jbig/jbig_tab.c \
\
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrtarga.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrrle.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrppm.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrjpgcom.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrgif.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrbmp.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/transupp.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdtarga.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdswitch.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdrle.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdppm.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdjpgcom.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdgif.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdcolmap.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdbmp.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jutils.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jpegtran.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jquant1.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jquant2.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdpostct.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdsample.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdtrans.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jerror.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jfdctflt.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jfdctfst.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jfdctint.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jidctflt.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jidctfst.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jidctint.c \
#$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jmemansi.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jmemmgr.c \
#$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jmemname.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jmemnobs.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jaricom.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcapimin.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcapistd.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcarith.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jccoefct.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jccolor.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcdctmgr.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jchuff.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcinit.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcmainct.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcmarker.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcmaster.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcomapi.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcparam.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcprepct.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcsample.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jctrans.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdapimin.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdapistd.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdarith.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdatadst.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdatasrc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdcoefct.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdcolor.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jddctmgr.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdhuff.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdinput.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdmainct.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdmarker.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdmaster.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdmerge.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/cdjpeg.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/cjpeg.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/ckconfig.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/djpeg.c
SOURCES += $$LIB_GRAPHICS_PRI_PATH/Qt_build/graphics/project/libpsd_pri.c
SOURCES += $$LIB_GRAPHICS_PRI_PATH/Qt_build/graphics/project/libpsd_pri2.c
SOURCES += $$LIB_GRAPHICS_PRI_PATH/Qt_build/graphics/project/libpsd_pri3.c
!build_cximage_zlib_disable {
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/crc32.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/adler32.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/deflate.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/inffast.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/inflate.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/inftrees.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/trees.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/zutil.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/uncompr.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/zlib/compress.c \
}
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_callback_xs.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_chunk_descr.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_chunk_io.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_chunk_prc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_chunk_xs.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_cms.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_display.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_dither.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_error.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_filter.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_hlapi.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_jpeg.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_object_prc.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_pixels.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_prop_xs.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_read.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_trace.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_write.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_zlib.c \
\
$$LIB_GRAPHICS_PRI_PATH/cximage/png/png.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngerror.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngget.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngmem.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngpread.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngread.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngrio.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngrtran.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngrutil.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngset.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngtrans.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngwio.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngwrite.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngwtran.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngwutil.c \
\
$$LIB_GRAPHICS_PRI_PATH/cximage/raw/libdcr.c \
\
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_stream.cxx \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_aux.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_close.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_codec.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_color.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_compress.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dir.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dirinfo.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dirread.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dirwrite.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dumpmode.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_error.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_extension.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_fax3.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_fax3sm.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_flush.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_getimage.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_jbig.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_jpeg.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_luv.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_lzw.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_next.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_ojpeg.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_open.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_packbits.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_pixarlog.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_predict.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_print.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_read.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_strip.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_swab.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_thunder.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_tile.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_unix.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_version.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_warning.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_write.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_zip.c \
\
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/tif_xfile.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximabmp.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximadsp.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaenc.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaexif.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximage.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximagif.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximahist.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaico.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximainfo.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaint.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximajas.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximajbg.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximajpg.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximalpha.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximalyr.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximamng.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximapal.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximapcx.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximapng.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximapsd.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaraw.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximasel.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaska.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximatga.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximath.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximatif.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximatran.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximawbmp.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximawmf.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximawnd.cpp \
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/xmemfile.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/Encoder/jbig2arith.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/Encoder/jbig2enc.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/Encoder/jbig2sym.cpp
SOURCES += $$LIB_GRAPHICS_PRI_PATH/Qt_build/graphics/project/lepton_lib_all.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/boxbasic.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/ccbord.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/dwacomb.2.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/dwacomblow.2.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/fhmtgen.1.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/fliphmtgen.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/fmorphauto.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/fmorphgen.1.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/numabasic.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/pix5.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/pixabasic.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/pixafunc1.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/pixcomp.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/ptabasic.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/ptra.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/ropiplow.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/roplow.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/rotateam.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/rotateshear.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/sarray.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/sel1.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/sel2.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/skew.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/raster/Jp2/J2kFile.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/Jp2/Reader.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/JBig2File.cpp

View File

@ -47,6 +47,7 @@
#include "Pattern.h"
#include "../../DesktopEditor/agg-2.4/include/agg_span_hatch.h"
#include "../../DesktopEditor/common/SystemUtils.h"
#ifdef CreateFont
#undef CreateFont
@ -112,7 +113,11 @@ namespace PdfWriter
return false;
m_pInfo->SetCreationTime();
m_pInfo->SetInfo(InfoProducer, "Ascensio System SIA Copyright (c) 2018");
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvCompanyName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvCompanyNameDefault;
std::string sApplicationA = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sApplication);
m_pInfo->SetInfo(InfoProducer, sApplicationA.c_str());
CMetadata* pMetadata = m_pCatalog->AddMetadata(m_pXref, m_pInfo);
if (IsPDFA())

View File

@ -33,6 +33,8 @@
#include "Streams.h"
#include "Info.h"
#include "../../DesktopEditor/common/SystemUtils.h"
namespace PdfWriter
{
//----------------------------------------------------------------------------------------
@ -61,9 +63,12 @@ namespace PdfWriter
sXML += "</rdf:Description>\n";
// Creator Tool
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
sXML += "<rdf:Description rdf:about=\"\" xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n";
sXML += "<xmp:CreatorTool>";
sXML += "OnlyOffice 2018";
sXML += NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sApplication);
sXML += "</xmp:CreatorTool>\n";
TDate oDate = pInfo->GetDate();