Compare commits

..

8 Commits

Author SHA1 Message Date
ed1019a004 Not writing transparency group in pdfa mode 2019-05-20 17:09:22 +03:00
35c4d70cf5 Fix bug 41615 2019-05-20 11:57:52 +03:00
0b987aeed2 Add variable for xp support 2019-05-17 15:00:16 +03:00
aefb229343 [x2t] Fix typo (Core props) 2019-05-16 18:25:10 +03:00
eb9d69d1ec Fix svg bug 2019-05-15 19:28:02 +03:00
9670d021c2 x2t - fix bug #41503 2019-05-14 19:22:20 +03:00
79f18355fe x2t - fix bug #41515 2019-05-13 15:27:03 +03:00
f86055c713 Epub images bug (xml files) 2019-05-08 12:51:29 +03:00
7 changed files with 108 additions and 36 deletions

View File

@ -1818,7 +1818,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
std::wstring strCoord1 = oNodeShape.GetAttributeOrValue(L"from");
std::wstring strCoord2 = oNodeShape.GetAttributeOrValue(L"to");
if (strCoord1 != L"" && strCoord2 != L"")
if (!strCoord1.empty() && !strCoord2.empty())
{
std::vector<std::wstring> oArray1;
boost::algorithm::split(oArray1, strCoord1, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
@ -1905,7 +1905,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
int nOffsetX = _POINTS[0] - _x;
int nOffsetY = _POINTS[1] - _y;
strStyleAdvenced = L";margin-left:" + std::to_wstring(_x) + L";margin-top:" + std::to_wstring(_y)
strStyleAdvenced += L";margin-left:" + std::to_wstring(_x) + L";margin-top:" + std::to_wstring(_y)
+ L";width:" + std::to_wstring(_r - _x) + L";height:" + std::to_wstring(_b - _y) + L";polyline_correct:true;";
double dKoefX = 21600.0 / (std::max)((_r - _x), 1);
@ -3302,6 +3302,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
std::map<std::wstring, std::wstring>::iterator pFind;
bool bIsInline = false;
bool bIsMargin = false;
if (oProps.IsTop == true)
{
@ -3312,12 +3313,19 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
{
bIsInline = true;
}
if (((oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"margin-left")) &&
(oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"margin-top")))
||
((oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"left")) &&
(oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"top"))))
{
bIsMargin = true;
}
pFind = oCssStyles.m_mapSettings.find(L"mso-position-horizontal-relative");
if (oCssStyles.m_mapSettings.end() != pFind && (pFind->second == L"text" || pFind->second == L"char"))
if (oCssStyles.m_mapSettings.end() != pFind && ((pFind->second == L"text" && !bIsMargin) || pFind->second == L"char"))
{
pFind = oCssStyles.m_mapSettings.find(L"mso-position-vertical-relative");
if (oCssStyles.m_mapSettings.end() != pFind && (pFind->second == L"text" || pFind->second == L"line"))
if (oCssStyles.m_mapSettings.end() != pFind && ((pFind->second == L"text" && !bIsMargin) || pFind->second == L"line"))
{
bIsInline = true;
}
@ -3355,7 +3363,13 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (oCssStyles.m_mapSettings.end() != pFind)
{
left = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
std::vector<std::wstring> oArray1;
boost::algorithm::split(oArray1, pFind->second, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
for (size_t i = 0; i < oArray1.size(); i++)
{
left += (LONG)(dKoefSize * parserPoint.FromString(oArray1[i]) + 0.5);
}
}
pFind = oCssStyles.m_mapSettings.find(L"margin-top");
@ -3365,7 +3379,12 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (oCssStyles.m_mapSettings.end() != pFind)
{
top = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
std::vector<std::wstring> oArray1;
boost::algorithm::split(oArray1, pFind->second, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
for (size_t i = 0; i < oArray1.size(); i++)
{
top += (LONG)(dKoefSize * parserPoint.FromString(oArray1[i]) + 0.5);
}
}
}

View File

@ -79,7 +79,7 @@ namespace PPTX
XmlMacroReadNodeValueBase(oNode, _T("cp:revision"), revision);
XmlMacroReadNodeValueBase(oNode, _T("dc:subject"), subject);
XmlMacroReadNodeValueBase(oNode, _T("dc:title"), title);
XmlMacroReadNodeValueBase(oNode, _T("cp:version"), title);
XmlMacroReadNodeValueBase(oNode, _T("cp:version"), version);
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{
@ -217,7 +217,7 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->WriteNodeValue2(_T("dc:title"), title);
pWriter->WriteNodeValue2(_T("dc:subject"), title);
pWriter->WriteNodeValue2(_T("dc:subject"), subject);
pWriter->WriteNodeValue2(_T("dc:creator"), creator);
pWriter->WriteNodeValue2(_T("cp:keywords"), keywords);
pWriter->WriteNodeValue2(_T("dc:description"), description);
@ -242,9 +242,9 @@ namespace PPTX
pWriter->WriteStringXML(*modified);
pWriter->WriteNodeEnd(_T("dcterms:modified"));
}
pWriter->WriteNodeValue2(_T("cp:category"), revision);
pWriter->WriteNodeValue2(_T("cp:contentStatus"), revision);
pWriter->WriteNodeValue2(_T("cp:version"), revision);
pWriter->WriteNodeValue2(_T("cp:category"), category);
pWriter->WriteNodeValue2(_T("cp:contentStatus"), contentStatus);
pWriter->WriteNodeValue2(_T("cp:version"), version);
pWriter->EndNode(_T("cp:coreProperties"));
}

View File

@ -37,6 +37,12 @@ CONFIG(debug, debug|release) {
#PLATFORM
win32 {
CONFIG += core_windows
WINDOWS_VERSION_XP = $$(WINDOWS_VERSION_XP)
!isEmpty(WINDOWS_VERSION_XP) {
CONFIG += build_xp
message(xp using)
}
}
DST_ARCH=$$QMAKE_TARGET.arch

View File

@ -5580,6 +5580,12 @@ namespace SVG
inline bool LoadFromFile (const std::wstring& strFile, Storage* model)
{
#if 0
std::wstring sExt = NSFile::GetFileExtention(strFile);
if (sExt != L"svg" && sExt != L"xml")
return false;
#endif
if (model)
{
m_model = model;
@ -5613,19 +5619,26 @@ namespace SVG
}
XmlUtils::CXmlNode oXml;
if (oXml.FromXmlString(sXml))
{
m_nLayerLevel = 0;
if (!oXml.FromXmlString(sXml))
return false;
if (Explore(oXml))
{
m_model->JoinXLinkReference();
m_model->JoinClipPathLinks();
m_model->JoinStyleLinks();
std::wstring sNodeName = oXml.GetName();
if (L"svg" != sNodeName &&
L"g" != sNodeName &&
L"xml" != sNodeName)
return false;
return true;
}
}
m_nLayerLevel = 0;
if (Explore(oXml))
{
m_model->JoinXLinkReference();
m_model->JoinClipPathLinks();
m_model->JoinStyleLinks();
return true;
}
}
return false;

View File

@ -51,14 +51,26 @@
#include <stdio.h>
#endif
class CHtmlFile_Private
{
public:
bool m_bIsEpub;
public:
CHtmlFile_Private()
{
m_bIsEpub = false;
}
};
CHtmlFile::CHtmlFile()
{
m_internal = new CHtmlFile_Private();
}
CHtmlFile::~CHtmlFile()
{
RELEASEOBJECT(m_internal);
}
static std::wstring GetSdkPath()
@ -261,7 +273,20 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
oBuilder.WriteEncodeXmlString(CorrectHtmlPath(sFilePath));
else
{
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"HTM");
std::wstring sTmpDir = L"";
if (m_internal->m_bIsEpub)
{
// чтобы ссылки на картинки остались
sTmpDir = NSFile::GetDirectoryName(sFilePath);
if (!NSDirectory::Exists(sTmpDir))
sTmpDir = NSDirectory::GetTempPath();
}
else
{
sTmpDir = NSDirectory::GetTempPath();
}
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"HTM");
if (NSFile::CFileBinary::Exists(sTmpFile))
NSFile::CFileBinary::Remove(sTmpFile);
@ -665,7 +690,10 @@ int CHtmlFile::ConvertEpub(const std::wstring& sFolder, std::wstring& sMetaInfo,
if (arHtmls.size() == 0)
return 1;
return this->Convert(arHtmls, sDstfolder, sPathInternal);
m_internal->m_bIsEpub = true;
int nErr = this->Convert(arHtmls, sDstfolder, sPathInternal);
m_internal->m_bIsEpub = false;
return nErr;
}
/////////////////////////////////////////////////////////////////

View File

@ -42,9 +42,11 @@
#define HTMLFILE_DECL_EXPORT Q_DECL_EXPORT
#endif
class CHtmlFile_Private;
class HTMLFILE_DECL_EXPORT CHtmlFile
{
private:
CHtmlFile_Private* m_internal;
public:

View File

@ -645,15 +645,18 @@ namespace PdfWriter
}
delete[] pA;
if (!m_pTransparencyGroup)
{
m_pTransparencyGroup = new CDictObject();
m_pTransparencyGroup->Add("Type", "Group");
m_pTransparencyGroup->Add("S", "Transparency");
m_pTransparencyGroup->Add("CS", "DeviceRGB");
}
if (!IsPDFA())
{
if (!m_pTransparencyGroup)
{
m_pTransparencyGroup = new CDictObject();
m_pTransparencyGroup->Add("Type", "Group");
m_pTransparencyGroup->Add("S", "Transparency");
m_pTransparencyGroup->Add("CS", "DeviceRGB");
}
pPage->Add("Group", m_pTransparencyGroup);
pPage->Add("Group", m_pTransparencyGroup);
}
double dWidth = pPage->GetWidth();
double dHeight = pPage->GetHeight();
@ -662,7 +665,8 @@ namespace PdfWriter
pXObject->Add("Type", "XObject");
pXObject->Add("Subtype", "Form");
pXObject->Add("BBox", CArrayObject::CreateBox(0, 0, dWidth, dHeight));
pXObject->Add("Group", m_pTransparencyGroup);
if (m_pTransparencyGroup)
pXObject->Add("Group", m_pTransparencyGroup);
CDictObject* pResources = new CDictObject();
pXObject->Add("Resources", pResources);
CDictObject* pResShadings = new CDictObject();