Commit 62e0c06c authored by konovalovsergey's avatar konovalovsergey Committed by Alexander Trofimov

падения при открытии docx, xlsx.

parent 2f515afe
...@@ -4978,36 +4978,32 @@ namespace BinDocxRW ...@@ -4978,36 +4978,32 @@ namespace BinDocxRW
OOX::Logic::CObject* pObject = static_cast<OOX::Logic::CObject*>(item); OOX::Logic::CObject* pObject = static_cast<OOX::Logic::CObject*>(item);
CString* pXml = pObject ? pObject->m_sXml.GetPointer() : NULL; CString* pXml = pObject ? pObject->m_sXml.GetPointer() : NULL;
CString sProgID;
if ((pObject) && (pObject->m_oOleObject.IsInit()))
sProgID = pObject->m_oOleObject->m_sProgId.get().GetString();
int nPosObject = m_oBcw.WriteItemStart(c_oSerRunType::object); int nPosObject = m_oBcw.WriteItemStart(c_oSerRunType::object);
if ( _T("Word.Document") == sProgID) if(pObject && pObject->m_oOleObject.IsInit() && pObject->m_oOleObject->m_sProgId.IsInit() && pObject->m_oOleObject->m_oId.IsInit())
{ {
int nPosEmbedded = m_oBcw.WriteItemStart(c_oSerImageType2::Embedded); CString sProgID = pObject->m_oOleObject->m_sProgId.get().GetString();
if ( _T("Word.Document") == sProgID)
{
int nPosEmbedded = m_oBcw.WriteItemStart(c_oSerImageType2::Embedded);
OOX::Rels::CRelationShip* oRels = NULL; OOX::Rels::CRelationShip* oRels = NULL;
smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( OOX::RId(pObject->m_oOleObject->m_oId.get().GetValue())); smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( OOX::RId(pObject->m_oOleObject->m_oId.get().GetValue()));
CString sLink; CString sLink;
if (pFile.IsInit() && OOX::FileTypes::OleObject == pFile->type()) if (pFile.IsInit() && OOX::FileTypes::OleObject == pFile->type())
{ {
OOX::HyperLink* pHyperlinkFile = static_cast<OOX::HyperLink*>(pFile.operator ->()); OOX::HyperLink* pHyperlinkFile = static_cast<OOX::HyperLink*>(pFile.operator ->());
sLink = pHyperlinkFile->Uri().GetPath(); sLink = pHyperlinkFile->Uri().GetPath();
}
OOX::CPath path(sLink);
OOX::CDocument poDocumentEmbedded(path, path);
WriteDocumentContent(poDocumentEmbedded.m_arrItems);
m_oBcw.WriteItemEnd(nPosEmbedded);
} }
OOX::CPath path(sLink); else if ( _T("Equation.3") == sProgID)
OOX::CDocument poDocumentEmbedded(path, path);
WriteDocumentContent(poDocumentEmbedded.m_arrItems);
m_oBcw.WriteItemEnd(nPosEmbedded);
}
else
{
//write equation
if ( _T("Equation.3") == sProgID)
{ {
//write equation
OOX::Rels::CRelationShip* oRels = NULL; OOX::Rels::CRelationShip* oRels = NULL;
smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( OOX::RId(pObject->m_oOleObject->m_oId.get().GetValue())); smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( OOX::RId(pObject->m_oOleObject->m_oId.get().GetValue()));
...@@ -5021,7 +5017,7 @@ namespace BinDocxRW ...@@ -5021,7 +5017,7 @@ namespace BinDocxRW
MathEquation::CEquationReader oReader(sLink); MathEquation::CEquationReader oReader(sLink);
oReader.SetOutputDev(&oBinEqWriter); oReader.SetOutputDev(&oBinEqWriter);
oReader.Parse(); oReader.Parse();
} }
} }
//write Picture //write Picture
......
//#include "stdafx.h" //#include "stdafx.h"
#include "FontProcessor.h" #include "FontProcessor.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h" #include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
...@@ -26,7 +26,7 @@ namespace DocWrapper { ...@@ -26,7 +26,7 @@ namespace DocWrapper {
} }
void FontProcessor::setFontTable(OOX::CFontTable* fontTable) void FontProcessor::setFontTable(OOX::CFontTable* fontTable)
{ {
// js //подбор перенесен в js
return; return;
for (int i = 0; i < fontTable->m_arrFonts.size(); ++i) for (int i = 0; i < fontTable->m_arrFonts.size(); ++i)
addToFontMap(*fontTable->m_arrFonts[i]); addToFontMap(*fontTable->m_arrFonts[i]);
...@@ -34,7 +34,7 @@ namespace DocWrapper { ...@@ -34,7 +34,7 @@ namespace DocWrapper {
CString FontProcessor::getFont(const CString& name) CString FontProcessor::getFont(const CString& name)
{ {
// js //подбор перенесен в js
return name; return name;
CString fontName = gc_sDefaultFontName; CString fontName = gc_sDefaultFontName;
if (fontMap.find(name) != fontMap.end()) if (fontMap.find(name) != fontMap.end())
...@@ -54,9 +54,9 @@ namespace DocWrapper { ...@@ -54,9 +54,9 @@ namespace DocWrapper {
{ {
CFontSelectFormat oFontSelectFormat; CFontSelectFormat oFontSelectFormat;
CString sFontName; CString sFontName;
if(oScheme.IsInit() && oScheme->m_oFontScheme.IsInit()) if(NULL != pTheme && oScheme.IsInit() && oScheme->m_oFontScheme.IsInit())
{ {
// //берем шрифт из темы
const SimpleTypes::Spreadsheet::EFontScheme eFontScheme = oScheme->m_oFontScheme->GetValue(); const SimpleTypes::Spreadsheet::EFontScheme eFontScheme = oScheme->m_oFontScheme->GetValue();
if(SimpleTypes::Spreadsheet::fontschemeMajor == eFontScheme) if(SimpleTypes::Spreadsheet::fontschemeMajor == eFontScheme)
sFontName = pTheme->GetMajorFont(); sFontName = pTheme->GetMajorFont();
...@@ -67,14 +67,14 @@ namespace DocWrapper { ...@@ -67,14 +67,14 @@ namespace DocWrapper {
sFontName = oRFont->ToString2(); sFontName = oRFont->ToString2();
if(sFontName.IsEmpty()) if(sFontName.IsEmpty())
sFontName = CString(gc_sNoNameFont); sFontName = CString(gc_sNoNameFont);
// js //подбор перенесен в js
return sFontName; return sFontName;
oFontSelectFormat.wsName = new std::wstring; oFontSelectFormat.wsName = new std::wstring;
*oFontSelectFormat.wsName = string2std_string(sFontName); *oFontSelectFormat.wsName = string2std_string(sFontName);
if(oCharset.IsInit() && oCharset->m_oCharset.IsInit()) if(oCharset.IsInit() && oCharset->m_oCharset.IsInit())
{ {
SimpleTypes::Spreadsheet::EFontCharset eCharset = oCharset->m_oCharset->GetValue(); SimpleTypes::Spreadsheet::EFontCharset eCharset = oCharset->m_oCharset->GetValue();
// fontcharsetANSI fontcharsetDefault, , dll //на серверве на берем в расчет fontcharsetANSI и fontcharsetDefault, потому что он зависит от локали, а dll работает на сервере
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset) if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
{ {
oFontSelectFormat.unCharset = new BYTE; oFontSelectFormat.unCharset = new BYTE;
...@@ -114,7 +114,7 @@ namespace DocWrapper { ...@@ -114,7 +114,7 @@ namespace DocWrapper {
if(font.m_oCharset.IsInit()) if(font.m_oCharset.IsInit())
{ {
SimpleTypes::EFontCharset eCharset = font.m_oCharset->GetValue(); SimpleTypes::EFontCharset eCharset = font.m_oCharset->GetValue();
// fontcharsetANSI fontcharsetDefault, , dll //на серверве на берем в расчет fontcharsetANSI и fontcharsetDefault, потому что он зависит от локали, а dll работает на сервере
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset) if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
{ {
oFontSelectFormat.unCharset = new BYTE; oFontSelectFormat.unCharset = new BYTE;
...@@ -134,7 +134,7 @@ namespace DocWrapper { ...@@ -134,7 +134,7 @@ namespace DocWrapper {
{ {
unsigned char cCurVal = font.m_oPanose->Get_Number(i); unsigned char cCurVal = font.m_oPanose->Get_Number(i);
oFontSelectFormat.pPanose[i] = cCurVal; oFontSelectFormat.pPanose[i] = cCurVal;
// 0, Panose // Если хоть одно значение не 0, то используем Panose
if ( 0 != cCurVal ) if ( 0 != cCurVal )
bIsPanose = true; bIsPanose = true;
} }
...@@ -189,4 +189,4 @@ namespace DocWrapper { ...@@ -189,4 +189,4 @@ namespace DocWrapper {
else else
fontMap[sFontName] = gc_sDefaultFontName; fontMap[sFontName] = gc_sDefaultFontName;
} }
} }
\ No newline at end of file
...@@ -998,6 +998,18 @@ namespace OOX ...@@ -998,6 +998,18 @@ namespace OOX
} }
m_arrTabs.clear(); m_arrTabs.clear();
} }
CTabs(const CTabs& oSrc)
{
*this = oSrc;
}
const CTabs& operator =(const CTabs &oTabs)
{
for(size_t i = 0; i < oTabs.m_arrTabs.size(); ++i)
{
m_arrTabs.push_back(new ComplexTypes::Word::CTabStop(*oTabs.m_arrTabs[i]));
}
return *this;
}
public: public:
virtual void fromXML(XmlUtils::CXmlNode& oNode) virtual void fromXML(XmlUtils::CXmlNode& oNode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment