mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-11 02:16:02 +08:00
Compare commits
49 Commits
core/devel
...
core/devel
| Author | SHA1 | Date | |
|---|---|---|---|
| 234e19d68a | |||
| 62145b7204 | |||
| 8bcc6d1501 | |||
| 09ef46f333 | |||
| 1839350526 | |||
| d7587e91b1 | |||
| 7b0a342cf9 | |||
| 3d01b0782e | |||
| fecfcfa7d2 | |||
| 29b5fa513a | |||
| f9a19badbf | |||
| d2630ea73c | |||
| a4a58c4782 | |||
| 29a3d80071 | |||
| 598bb419c0 | |||
| 087da9d2ce | |||
| c505aced48 | |||
| 959d5e5fcd | |||
| 8ee0cf4b2c | |||
| 426342074e | |||
| d2c092fe62 | |||
| a336917338 | |||
| 8925ddeee5 | |||
| 84824631b2 | |||
| dc3ecb1fc0 | |||
| 266cef8c49 | |||
| a5e821cd21 | |||
| cb5d92334e | |||
| f6dbc6b9f0 | |||
| c2c6430495 | |||
| 9ecf5b7834 | |||
| 1d003863dd | |||
| 774561bd00 | |||
| d356a305b9 | |||
| 2dbec241f7 | |||
| f3c66cab50 | |||
| 11e6fc3e06 | |||
| cdf8c0a11b | |||
| ae29cebe35 | |||
| e933a1fb42 | |||
| 5a3f98c502 | |||
| 8677540a82 | |||
| f4ceac5b2b | |||
| 61be4ea100 | |||
| 51c6ce2ba2 | |||
| e13bc44198 | |||
| 56cefcb1be | |||
| 51c77c3a85 | |||
| 4326a7d258 |
@ -136,14 +136,18 @@ namespace DocFileFormat
|
||||
}
|
||||
return btWin32;
|
||||
}
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
|
||||
bool VMLPictureMapping::ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
|
||||
{
|
||||
newXmlString.clear();
|
||||
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(
|
||||
NSDirectory::GetTempPath(), L"emb");
|
||||
|
||||
sTempXmlFile += L".xml";
|
||||
|
||||
std::wstring sTempFolder = m_ctx->_doc->m_sTempFolder;
|
||||
if (sTempFolder.empty())
|
||||
{
|
||||
sTempFolder = NSFile::CFileBinary::GetTempPath();
|
||||
}
|
||||
|
||||
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(sTempFolder, L"emb");
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(sTempXmlFile);
|
||||
file.WriteFile((BYTE*)xmlString.c_str(), xmlString.size());
|
||||
@ -186,6 +190,7 @@ namespace DocFileFormat
|
||||
if (res) break;
|
||||
}
|
||||
}
|
||||
NSFile::CFileBinary::Remove(sTempXmlFile);
|
||||
return res;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
@ -297,8 +302,13 @@ namespace DocFileFormat
|
||||
case metroBlob:
|
||||
{
|
||||
//встроенная неведомая хуйня
|
||||
m_isEmbedded = true;
|
||||
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
|
||||
m_isEmbedded = true;
|
||||
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
|
||||
|
||||
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
|
||||
//{
|
||||
// m_isEmbedded = false;
|
||||
//}
|
||||
}break;
|
||||
//BORDERS
|
||||
case borderBottomColor:
|
||||
|
||||
@ -46,7 +46,6 @@ namespace DocFileFormat
|
||||
{
|
||||
class OleObject;
|
||||
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
|
||||
class VMLPictureMapping: public PropertiesMapping, public IMapping
|
||||
{
|
||||
@ -58,6 +57,7 @@ namespace DocFileFormat
|
||||
/// Writes a border element
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
protected:
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
|
||||
@ -86,6 +86,7 @@ namespace DocFileFormat
|
||||
friend class Table;
|
||||
friend class TableRow;
|
||||
friend class VMLShapeMapping;
|
||||
friend class VMLPictureMapping;
|
||||
friend class OpenXmlPackage;
|
||||
friend class TextboxMapping;
|
||||
|
||||
|
||||
@ -45,13 +45,13 @@ namespace Writers
|
||||
int index;
|
||||
};
|
||||
std::vector<_chartElem> m_aCharts;
|
||||
int nChartCount;
|
||||
public:
|
||||
std::wstring m_sDir;
|
||||
int nEmbeddedCount;
|
||||
|
||||
ChartWriter(std::wstring sDir) : m_sDir(sDir)
|
||||
{
|
||||
nChartCount = 0;
|
||||
nEmbeddedCount = 1000;
|
||||
}
|
||||
~ChartWriter()
|
||||
{
|
||||
@ -80,30 +80,20 @@ namespace Writers
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void AddChart(std::wstring& content, std::wstring& sRelsName, std::wstring& sFileName, int& index)
|
||||
void AddChart(std::wstring& content, std::wstring& sRelsName, std::wstring& sFileName, int index)
|
||||
{
|
||||
_chartElem oChartElem;
|
||||
|
||||
oChartElem.content = content;
|
||||
oChartElem.index = nChartCount + 1;
|
||||
nChartCount++;
|
||||
oChartElem.index = index;
|
||||
|
||||
oChartElem.filename = L"chart" + std::to_wstring(oChartElem.index) + L".xml";
|
||||
|
||||
sRelsName = L"charts/" + oChartElem.filename;
|
||||
sFileName = oChartElem.filename;
|
||||
index = oChartElem.index;
|
||||
|
||||
m_aCharts.push_back(oChartElem);
|
||||
}
|
||||
int getChartCount()
|
||||
{
|
||||
return nChartCount;
|
||||
}
|
||||
void setChartCount(int val)
|
||||
{
|
||||
nChartCount = val;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // #ifndef CHART_WRITER
|
||||
|
||||
@ -61,7 +61,7 @@ namespace Writers
|
||||
oFile.WriteStringUTF8( std::wstring(_T("<w:body>")));
|
||||
oFile.WriteStringUTF8(m_oContent.GetData());
|
||||
|
||||
oFile.WriteStringUTF8( std::wstring(_T("<w:sectPr >")));
|
||||
oFile.WriteStringUTF8( std::wstring(_T("<w:sectPr>")));
|
||||
oFile.WriteStringUTF8(WriteSectPrHdrFtr());
|
||||
oFile.WriteStringUTF8(m_oSecPr.GetData());
|
||||
oFile.WriteStringUTF8( std::wstring(_T("</w:sectPr>")));
|
||||
|
||||
@ -6292,15 +6292,11 @@ public:
|
||||
std::wstring sDrawingProperty = oCDrawingProperty.Write();
|
||||
if(false == sDrawingProperty.empty())
|
||||
{
|
||||
m_oFileWriter.m_pDrawingConverter->SetDocumentChartsCount(m_oFileWriter.m_oChartWriter.getChartCount());
|
||||
|
||||
long nCurPos = m_oBufferedStream.GetPos();
|
||||
std::wstring sDrawingXml;
|
||||
m_oFileWriter.m_pDrawingConverter->SaveObjectEx(oCDrawingProperty.DataPos, oCDrawingProperty.DataLength, sDrawingProperty, XMLWRITER_DOC_TYPE_DOCX, sDrawingXml);
|
||||
m_oBufferedStream.Seek(nCurPos);
|
||||
|
||||
m_oFileWriter.m_oChartWriter.setChartCount(m_oFileWriter.m_pDrawingConverter->GetDocumentChartsCount());
|
||||
|
||||
if( false == sDrawingXml.empty())
|
||||
{
|
||||
GetRunStringWriter().WriteString(sDrawingXml);
|
||||
@ -6606,8 +6602,11 @@ public:
|
||||
OOX::Spreadsheet::CChartSpace* pChartSpace = new OOX::Spreadsheet::CChartSpace();
|
||||
oBinaryChartReader.ReadCT_ChartSpace(length, &pChartSpace->m_oChartSpace);
|
||||
|
||||
//save xlsx
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(m_oFileWriter.m_oChartWriter.getChartCount() + 1) + L".xlsx";
|
||||
//save xlsx
|
||||
_INT32 nChartCount = m_oFileWriter.m_pDrawingConverter->GetDocumentChartsCount();
|
||||
_INT32 nChartIndex = nChartCount + 1;
|
||||
m_oFileWriter.m_pDrawingConverter->SetDocumentChartsCount(nChartCount + 1);
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(nChartIndex) + L".xlsx";
|
||||
std::wstring sXlsxPath = pathChartsWorksheetDir.GetPath() + FILE_SEPARATOR_STR + sXlsxFilename;
|
||||
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
|
||||
oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace);
|
||||
@ -6615,8 +6614,10 @@ public:
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
long rIdXlsx;
|
||||
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
|
||||
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
|
||||
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(L"xlsx");
|
||||
|
||||
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
|
||||
pChartSpace->m_oChartSpace.m_externalData->m_id = new std::wstring();
|
||||
pChartSpace->m_oChartSpace.m_externalData->m_id->append(L"rId");
|
||||
@ -6630,7 +6631,6 @@ public:
|
||||
|
||||
std::wstring sFilename;
|
||||
std::wstring sRelsName;
|
||||
int nChartIndex;
|
||||
std::wstring sContent = sw.GetData();
|
||||
|
||||
m_oFileWriter.m_oChartWriter.AddChart(sContent, sRelsName, sFilename, nChartIndex);
|
||||
@ -6824,8 +6824,7 @@ public:
|
||||
std::wstring strDstEmbeddedTemp = strDstEmbedded + FILE_SEPARATOR_STR + L"Temp";
|
||||
NSDirectory::CreateDirectory(strDstEmbeddedTemp);
|
||||
|
||||
int id = m_oFileWriter.m_oChartWriter.getChartCount();
|
||||
m_oFileWriter.m_oChartWriter.setChartCount(id + 1);
|
||||
int id = m_oFileWriter.m_oChartWriter.nEmbeddedCount++;
|
||||
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring( id + 1) + L".xlsx";
|
||||
BinXlsxRW::SaveParams oSaveParams(m_oFileWriter.m_sThemePath, m_oFileWriter.m_pDrawingConverter->GetContentTypes());//???
|
||||
|
||||
@ -81,12 +81,14 @@ namespace BinDocxRW
|
||||
void BinaryHeaderFooterTableWriter::WriteHdrFtrItem(OOX::Logic::CSectionProperty* pSectPr, OOX::CHdrFtr* pHdrFtr, bool bHdr)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
//Content
|
||||
ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr, pHdrFtr->m_oReadPath.GetPath());
|
||||
//Content
|
||||
ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
|
||||
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, m_mapIgnoreComments, NULL);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, pHdrFtr->m_arrShapeTypes);
|
||||
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, pHdrFtr->m_arrShapeTypes);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerHdrFtrTypes::HdrFtr_Content);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(pHdrFtr->m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
|
||||
@ -57,7 +57,6 @@ namespace BinDocxRW
|
||||
PPTX::Theme* m_poTheme;
|
||||
|
||||
OOX::IFileContainer* m_pCurRels;
|
||||
std::wstring m_sCurDocumentPath;
|
||||
std::map<int, bool> m_mapIgnoreComments;
|
||||
|
||||
ParamsWriter(NSBinPptxRW::CBinaryFileWriter* pCBufferedStream, DocWrapper::FontProcessor* pFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):
|
||||
@ -72,9 +71,8 @@ namespace BinDocxRW
|
||||
{
|
||||
public:
|
||||
OOX::IFileContainer* m_pRels;
|
||||
std::wstring m_sDocumentPath;
|
||||
|
||||
ParamsDocumentWriter(OOX::IFileContainer* pRels, const std::wstring& sDocumentPath):m_pRels(pRels), m_sDocumentPath(sDocumentPath)
|
||||
ParamsDocumentWriter(OOX::IFileContainer* pRels) : m_pRels(pRels)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -99,6 +97,8 @@ namespace BinDocxRW
|
||||
BinaryCommonWriter(ParamsWriter& oParamsWriter) : m_oStream(*oParamsWriter.m_pCBufferedStream),
|
||||
m_pEmbeddedFontsManager(oParamsWriter.m_pEmbeddedFontsManager)
|
||||
{
|
||||
*m_oStream.m_pCurrentContainer = oParamsWriter.m_pCurRels;
|
||||
m_oStream.m_pCurrentContainer->AddRef();
|
||||
}
|
||||
int WriteItemStart(BYTE type)
|
||||
{
|
||||
@ -2999,15 +2999,17 @@ namespace BinDocxRW
|
||||
RELEASEOBJECT(m_aFldChars[i]);
|
||||
}
|
||||
}
|
||||
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, std::wstring& sDocumentPath, std::vector<std::wstring>& aShapeTypes)
|
||||
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer *rels, std::vector<std::wstring>& aShapeTypes)
|
||||
{
|
||||
pOfficeDrawingConverter->SetRelsPath(sDocumentPath);
|
||||
smart_ptr<OOX::IFileContainer> oldRels = pOfficeDrawingConverter->GetRels();
|
||||
pOfficeDrawingConverter->SetRels(rels);
|
||||
|
||||
for(size_t i = 0, length = aShapeTypes.size(); i < length; ++i)
|
||||
{
|
||||
std::wstring& sShapeType = aShapeTypes[i];
|
||||
pOfficeDrawingConverter->AddShapeType(sShapeType);
|
||||
}
|
||||
pOfficeDrawingConverter->SetRels(oldRels);
|
||||
}
|
||||
void Write(std::vector<OOX::WritingElement*>& aElems)
|
||||
{
|
||||
@ -5480,21 +5482,14 @@ namespace BinDocxRW
|
||||
{
|
||||
if (pGraphic->chartRec.IsInit() && pGraphic->chartRec->id_data.IsInit() )
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( pGraphic->chartRec->id_data.get());
|
||||
if (pFile.IsInit() && OOX::FileTypes::Chart == pFile->type())
|
||||
{
|
||||
OOX::Spreadsheet::CChartSpace* pChart = static_cast<OOX::Spreadsheet::CChartSpace*>(pFile.operator ->());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::Chart2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::Chart2);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(m_oBcw.m_oStream, m_pOfficeDrawingConverter);
|
||||
oBinaryChartWriter.WriteCT_ChartSpace(*pChart);
|
||||
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
pGraphic->chartRec->toPPTY(&m_oBcw.m_oStream);
|
||||
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7003,9 +6998,8 @@ namespace BinDocxRW
|
||||
}
|
||||
void WriteFootnotes(OOX::CFootnotes& oFootnotes)
|
||||
{
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oFootnotes, oFootnotes.m_oReadPath.GetPath());
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oFootnotes);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
|
||||
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteNotes(oFootnotes.m_arrFootnote, oParamsDocumentWriter, oFootnotes.m_arrShapeTypes);
|
||||
@ -7013,9 +7007,8 @@ namespace BinDocxRW
|
||||
}
|
||||
void WriteEndnotes(OOX::CEndnotes& oEndnotes)
|
||||
{
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oEndnotes, oEndnotes.m_oReadPath.GetPath());
|
||||
ParamsDocumentWriter oParamsDocumentWriter(&oEndnotes);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
|
||||
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteNotes(oEndnotes.m_arrEndnote, oParamsDocumentWriter, oEndnotes.m_arrShapeTypes);
|
||||
@ -7048,7 +7041,9 @@ namespace BinDocxRW
|
||||
}
|
||||
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, NULL);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, arrShapeTypes);
|
||||
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, arrShapeTypes);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerNotes::NoteContent);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(oFtnEdn.m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
@ -7213,14 +7208,13 @@ namespace BinDocxRW
|
||||
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, poDocument, &m_oParamsWriter.m_mapIgnoreComments);
|
||||
|
||||
//Write DocumentTable
|
||||
ParamsDocumentWriter oParamsDocumentWriter(poDocument, poDocument->m_oReadPath.GetPath());
|
||||
ParamsDocumentWriter oParamsDocumentWriter(poDocument);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
|
||||
|
||||
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, poDocument->m_arrShapeTypes);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, poDocument->m_arrShapeTypes);
|
||||
|
||||
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
|
||||
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
|
||||
|
||||
@ -387,7 +387,7 @@ bool BinDocxRW::CDocxSerializer::getBinaryContent(const std::wstring& bsTxConten
|
||||
|
||||
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter);
|
||||
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
|
||||
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath);
|
||||
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels);
|
||||
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, oParams, &oParamsWriter.m_mapIgnoreComments, NULL);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(oSdtContent.m_arrItems);
|
||||
@ -411,7 +411,7 @@ bool BinDocxRW::CDocxSerializer::getBinaryContentElem(OOX::EElementType eElemTyp
|
||||
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter);
|
||||
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
|
||||
|
||||
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath);
|
||||
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels);
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, oParams, &oParamsWriter.m_mapIgnoreComments, NULL);
|
||||
if(OOX::et_m_oMathPara == eElemType)
|
||||
{
|
||||
|
||||
@ -139,31 +139,7 @@ namespace BinXlsxRW{
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return true;
|
||||
}
|
||||
bool CXlsxSerializer::loadChart(const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter* pWriter, long& lDataSize)
|
||||
{
|
||||
if (NULL == pWriter) return false;
|
||||
if (NULL == m_pExternalDrawingConverter) return false;
|
||||
|
||||
OOX::CPath oRootPath;
|
||||
OOX::Spreadsheet::CChartSpace oChart(oRootPath, sChartPath);
|
||||
|
||||
long nStartPos = pWriter->GetPosition();
|
||||
BinXlsxRW::BinaryCommonWriter oBcw(*pWriter);
|
||||
|
||||
std::wstring sOldRelsPath = m_pExternalDrawingConverter->GetRelsPath();
|
||||
m_pExternalDrawingConverter->SetRelsPath(sChartPath);
|
||||
|
||||
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(*pWriter, m_pExternalDrawingConverter);
|
||||
oBinaryChartWriter.WriteCT_ChartSpace(oChart);
|
||||
|
||||
m_pExternalDrawingConverter->SetRelsPath(sOldRelsPath);
|
||||
|
||||
long nEndPos = pWriter->GetPosition();
|
||||
lDataSize = nEndPos - nStartPos;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilepath, const long& lChartNumber)
|
||||
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilepath, const long& lChartNumber)
|
||||
{
|
||||
if (NULL == pReader) return false;
|
||||
if (NULL == m_pExternalDrawingConverter) return false;
|
||||
|
||||
@ -64,7 +64,6 @@ namespace BinXlsxRW {
|
||||
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool loadChart (const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter* pWriter, long& lDataSize);
|
||||
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilename, const long& lChartNumber);
|
||||
|
||||
void setFontDir (const std::wstring& sFontDir);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Version="8.00"
|
||||
Name="OdfFileReaderTest"
|
||||
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
|
||||
RootNamespace="ASCOfficeOdfFileTest"
|
||||
|
||||
@ -72,8 +72,8 @@ public:
|
||||
void start_base_style(const std::wstring baseStyleName, const odf_types::style_family::type baseStyleType);
|
||||
void end_base_style();
|
||||
|
||||
void ApplyTextProperties (std::wstring style,odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type);
|
||||
void ApplyParagraphProperties (std::wstring style,odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type);
|
||||
void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
|
||||
void ApplyParagraphProperties (std::wstring para_style, odf_reader::paragraph_format_properties & propertiesOut);
|
||||
void ApplyListProperties (odf_reader::paragraph_format_properties & propertiesOut, int Level);
|
||||
|
||||
void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
|
||||
@ -239,32 +239,37 @@ void pptx_text_context::Impl::end_hyperlink(std::wstring hId)
|
||||
dump_run();
|
||||
hyperlink_hId = L"";
|
||||
}
|
||||
void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name,odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type)
|
||||
void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name, std::wstring para_style_name, odf_reader::text_format_properties_content & propertiesOut)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* style = NULL;
|
||||
odf_reader::style_instance* baseStyle = NULL;
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* para_style = NULL;
|
||||
odf_reader::style_instance* text_style = NULL;
|
||||
odf_reader::style_instance* baseStyle = NULL;
|
||||
|
||||
if (local_styles_ptr_)
|
||||
{
|
||||
style = local_styles_ptr_->style_by_name(style_name, Type,false/*process_headers_footers_*/);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type(Type);
|
||||
baseStyle = local_styles_ptr_->style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
para_style = local_styles_ptr_->style_by_name (para_style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
text_style = local_styles_ptr_->style_by_name (style_name, odf_types::style_family::Text, false/*process_headers_footers_*/);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type (odf_types::style_family::Text);
|
||||
baseStyle = local_styles_ptr_->style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
style = odf_context_.styleContainer().style_by_name(style_name, Type,false/*process_headers_footers_*/);
|
||||
defaultStyle = odf_context_.styleContainer().style_default_by_type(Type);
|
||||
baseStyle = odf_context_.styleContainer().style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
para_style = odf_context_.styleContainer().style_by_name (para_style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
text_style = odf_context_.styleContainer().style_by_name (style_name, odf_types::style_family::Text, false/*process_headers_footers_*/);
|
||||
defaultStyle = odf_context_.styleContainer().style_default_by_type (odf_types::style_family::Text);
|
||||
baseStyle = odf_context_.styleContainer().style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
|
||||
}
|
||||
if (defaultStyle) instances.push_back(defaultStyle);
|
||||
if (baseStyle) instances.push_back(baseStyle);
|
||||
if (style) instances.push_back(style);
|
||||
if (para_style) instances.push_back(para_style);
|
||||
if (text_style) instances.push_back(text_style);
|
||||
|
||||
if (style)get_styles_context().start_process_style(style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
if (text_style) get_styles_context().start_process_style(text_style);
|
||||
else if (para_style) get_styles_context().start_process_style(para_style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
|
||||
propertiesOut.apply_from(calc_text_properties_content(instances));
|
||||
}
|
||||
@ -323,33 +328,33 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
|
||||
|
||||
}
|
||||
|
||||
void pptx_text_context::Impl::ApplyParagraphProperties(std::wstring style_name,odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type)
|
||||
void pptx_text_context::Impl::ApplyParagraphProperties(std::wstring style_name, odf_reader::paragraph_format_properties & propertiesOut)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* style = NULL;
|
||||
odf_reader::style_instance * defaultStyle = NULL;
|
||||
odf_reader::style_instance * baseStyle = NULL;
|
||||
odf_reader::style_instance* style = NULL;
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* baseStyle = NULL;
|
||||
|
||||
if (local_styles_ptr_)
|
||||
{
|
||||
style = local_styles_ptr_->style_by_name(style_name, Type,false/*process_headers_footers_*/);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type(Type);
|
||||
baseStyle = local_styles_ptr_->style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
style = local_styles_ptr_->style_by_name (style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type (odf_types::style_family::Paragraph);
|
||||
baseStyle = local_styles_ptr_->style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
style = odf_context_.styleContainer().style_by_name(style_name, Type,false/*process_headers_footers_*/);
|
||||
defaultStyle = odf_context_.styleContainer().style_default_by_type(Type);
|
||||
baseStyle= odf_context_.styleContainer().style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
style = odf_context_.styleContainer().style_by_name (style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
defaultStyle = odf_context_.styleContainer().style_default_by_type (odf_types::style_family::Paragraph);
|
||||
baseStyle = odf_context_.styleContainer().style_by_name (base_style_name_, base_style_family_,false/*process_headers_footers_*/);
|
||||
}
|
||||
|
||||
if (defaultStyle) instances.push_back(defaultStyle);
|
||||
if (baseStyle) instances.push_back(baseStyle);
|
||||
if (style) instances.push_back(style);
|
||||
|
||||
if (style)get_styles_context().start_process_style(style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
if (style) get_styles_context().start_process_style(style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
|
||||
propertiesOut.apply_from(calc_paragraph_properties_content(instances));
|
||||
}
|
||||
@ -360,9 +365,9 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
|
||||
|
||||
int level = list_style_stack_.size()-1;
|
||||
|
||||
odf_reader::paragraph_format_properties paragraph_properties_;
|
||||
odf_reader::paragraph_format_properties paragraph_properties_;
|
||||
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_,odf_types::style_family::Paragraph);
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_);
|
||||
ApplyListProperties (paragraph_properties_, level);//выравнивания листа накатим на свойства параграфа
|
||||
|
||||
paragraph_properties_.pptx_convert(pptx_context_);
|
||||
@ -403,16 +408,9 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
if (paragraph_style_name_.empty() && span_style_name_.empty() && !(!hyperlink_hId.empty()) && base_style_name_.empty())
|
||||
return;
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_paragraph_;
|
||||
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_,odf_types::style_family::Paragraph);
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_span_;
|
||||
ApplyTextProperties(span_style_name_, text_properties_span_,odf_types::style_family::Text);
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_;
|
||||
|
||||
text_properties_.apply_from(text_properties_paragraph_);
|
||||
text_properties_.apply_from(text_properties_span_);
|
||||
|
||||
ApplyTextProperties(span_style_name_, paragraph_style_name_, text_properties_);
|
||||
|
||||
get_styles_context().start();
|
||||
|
||||
|
||||
@ -84,10 +84,10 @@ public:
|
||||
|
||||
void serialize_shared_strings(std::wostream & strm);
|
||||
|
||||
void ApplyTextProperties (std::wstring style, odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type);
|
||||
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type);
|
||||
void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
|
||||
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut);
|
||||
|
||||
void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
|
||||
void set_local_styles_container (odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
|
||||
|
||||
bool is_drawing_context(){return in_draw;}
|
||||
|
||||
@ -136,7 +136,8 @@ void xlsx_text_context::Impl::serialize_shared_strings(std::wostream & strm)
|
||||
xlsx_text_context::Impl::Impl(odf_reader::styles_container & styles): paragraphs_cout_(0),styles_(styles),
|
||||
in_comment(false),in_draw(false),in_paragraph(false),in_span(false),in_cell_content(false)
|
||||
{
|
||||
text_properties_cell_ = NULL;
|
||||
local_styles_ptr_ = NULL;
|
||||
text_properties_cell_ = NULL;
|
||||
}
|
||||
|
||||
void xlsx_text_context::Impl::add_text(const std::wstring & text)
|
||||
@ -236,48 +237,54 @@ void xlsx_text_context::Impl::end_hyperlink(std::wstring hId)
|
||||
hyperlink_hId = hId;
|
||||
}
|
||||
|
||||
void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type)
|
||||
void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* paraStyle = NULL;
|
||||
|
||||
if (local_styles_ptr_)
|
||||
{
|
||||
odf_reader::style_instance * defaultStyle = local_styles_ptr_->style_default_by_type(Type);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
odf_reader::style_instance* styleInst = local_styles_ptr_->style_by_name(style, Type,false/*process_headers_footers_*/);
|
||||
if(styleInst)instances.push_back(styleInst);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type(odf_types::style_family::Paragraph);
|
||||
paraStyle = local_styles_ptr_->style_by_name(style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
odf_reader::style_instance * defaultStyle = styles_.style_default_by_type(Type);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
odf_reader::style_instance* styleInst = styles_.style_by_name(style, Type,false/*process_headers_footers_*/);
|
||||
if(styleInst)instances.push_back(styleInst);
|
||||
defaultStyle = styles_.style_default_by_type(odf_types::style_family::Paragraph);
|
||||
paraStyle = styles_.style_by_name(style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
}
|
||||
|
||||
if (defaultStyle) instances.push_back(defaultStyle);
|
||||
if (paraStyle) instances.push_back(paraStyle);
|
||||
|
||||
propertiesOut.apply_from(calc_paragraph_properties_content(instances));
|
||||
}
|
||||
void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type)
|
||||
void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut)
|
||||
{
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
odf_reader::style_instance* defaultStyle = NULL;
|
||||
odf_reader::style_instance* textStyle = NULL;
|
||||
odf_reader::style_instance* paraStyle = NULL;
|
||||
|
||||
if (local_styles_ptr_)
|
||||
{
|
||||
odf_reader::style_instance * defaultStyle = local_styles_ptr_->style_default_by_type(Type);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
odf_reader::style_instance* styleInst = local_styles_ptr_->style_by_name(style, Type,false/*process_headers_footers_*/);
|
||||
if(styleInst)instances.push_back(styleInst);
|
||||
defaultStyle = local_styles_ptr_->style_default_by_type(odf_types::style_family::Text);
|
||||
paraStyle = local_styles_ptr_->style_by_name(para_style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
textStyle = local_styles_ptr_->style_by_name(style, odf_types::style_family::Text, false/*process_headers_footers_*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
odf_reader::style_instance * defaultStyle = styles_.style_default_by_type(Type);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
odf_reader::style_instance* styleInst = styles_.style_by_name(style, Type,false/*process_headers_footers_*/);
|
||||
if(styleInst)instances.push_back(styleInst);
|
||||
defaultStyle = styles_.style_default_by_type(odf_types::style_family::Text);
|
||||
paraStyle = styles_.style_by_name(para_style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
|
||||
textStyle = styles_.style_by_name(style, odf_types::style_family::Text, false/*process_headers_footers_*/);
|
||||
}
|
||||
|
||||
if (defaultStyle) instances.push_back(defaultStyle);
|
||||
if (paraStyle) instances.push_back(paraStyle);
|
||||
if (textStyle) instances.push_back(textStyle);
|
||||
|
||||
propertiesOut.apply_from(calc_text_properties_content(instances));
|
||||
}
|
||||
|
||||
@ -290,10 +297,10 @@ void xlsx_text_context::Impl::write_pPr (std::wostream & strm)
|
||||
{
|
||||
if (paragraph_style_name_.empty())return;
|
||||
|
||||
odf_reader::paragraph_format_properties paragraph_format_properties_;
|
||||
odf_reader::paragraph_format_properties paragraph_format_properties_;
|
||||
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_ , odf_types::style_family::Paragraph);
|
||||
paragraph_format_properties_.xlsx_convert(strm, in_draw);
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_);
|
||||
paragraph_format_properties_.xlsx_convert (strm, in_draw);
|
||||
}
|
||||
|
||||
void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
@ -302,20 +309,13 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
&& !(!hyperlink_hId.empty() && in_draw)
|
||||
&& !(text_properties_cell_ && in_cell_content))return;
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_paragraph_;
|
||||
odf_reader::text_format_properties_content text_properties_span_;
|
||||
|
||||
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_ , odf_types::style_family::Paragraph);
|
||||
ApplyTextProperties (span_style_name_, text_properties_span_ , odf_types::style_family::Text);
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_;
|
||||
|
||||
if (in_cell_content && text_properties_cell_)
|
||||
{
|
||||
text_properties_.apply_from(*text_properties_cell_);
|
||||
}
|
||||
text_properties_.apply_from(text_properties_paragraph_);
|
||||
text_properties_.apply_from(text_properties_span_);
|
||||
}
|
||||
|
||||
ApplyTextProperties (span_style_name_, paragraph_style_name_, text_properties_);
|
||||
|
||||
_CP_OPT(double) dValFontSize;
|
||||
if (text_properties_.fo_font_size_)
|
||||
|
||||
@ -41,22 +41,22 @@ std::wostream & operator << (std::wostream & _Wostream, const presentation_class
|
||||
std::wstring res = L"";
|
||||
switch(_Val.get_type())
|
||||
{
|
||||
case presentation_class::title: _Wostream << L"title" ; break;
|
||||
case presentation_class::subtitle: _Wostream << L"subtitle" ; break;
|
||||
case presentation_class::graphic: _Wostream << L"graphic" ; break;
|
||||
case presentation_class::object: _Wostream << L"object" ; break;
|
||||
case presentation_class::chart: _Wostream << L"chart" ; break;
|
||||
case presentation_class::table: _Wostream << L"table" ; break;
|
||||
case presentation_class::orgchart: _Wostream << L"orgchart" ; break;
|
||||
case presentation_class::header: _Wostream << L"header" ; break;
|
||||
case presentation_class::footer: _Wostream << L"footer" ; break;
|
||||
case presentation_class::date_time: _Wostream << L"date_time" ; break;
|
||||
case presentation_class::page_number: _Wostream << L"page_number" ; break;
|
||||
case presentation_class::page: _Wostream << L"page" ; break;
|
||||
case presentation_class::notes: _Wostream << L"notes" ; break;
|
||||
case presentation_class::handout: _Wostream << L"handout" ; break;
|
||||
case presentation_class::outline: _Wostream << L"outline" ; break;
|
||||
case presentation_class::text: _Wostream << L"text" ; break;
|
||||
case presentation_class::title: _Wostream << L"title"; break;
|
||||
case presentation_class::subtitle: _Wostream << L"subtitle"; break;
|
||||
case presentation_class::graphic: _Wostream << L"graphic"; break;
|
||||
case presentation_class::object: _Wostream << L"object"; break;
|
||||
case presentation_class::chart: _Wostream << L"chart"; break;
|
||||
case presentation_class::table: _Wostream << L"table"; break;
|
||||
case presentation_class::orgchart: _Wostream << L"orgchart"; break;
|
||||
case presentation_class::header: _Wostream << L"header"; break;
|
||||
case presentation_class::footer: _Wostream << L"footer"; break;
|
||||
case presentation_class::date_time: _Wostream << L"date-time"; break;
|
||||
case presentation_class::page_number: _Wostream << L"page-number";break;
|
||||
case presentation_class::page: _Wostream << L"page"; break;
|
||||
case presentation_class::notes: _Wostream << L"notes"; break;
|
||||
case presentation_class::handout: _Wostream << L"handout"; break;
|
||||
case presentation_class::outline: _Wostream << L"outline"; break;
|
||||
case presentation_class::text: _Wostream << L"text"; break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -65,41 +65,24 @@ presentation_class presentation_class::parse(const std::wstring & Str)
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if (tmp == L"page")
|
||||
return presentation_class( page );
|
||||
else if (tmp == L"title")
|
||||
return presentation_class( title);
|
||||
else if (tmp == L"outline")
|
||||
return presentation_class( outline );
|
||||
else if (tmp == L"subtitle")
|
||||
return presentation_class( subtitle);
|
||||
else if (tmp == L"text")
|
||||
return presentation_class( text);
|
||||
else if (tmp == L"graphic")
|
||||
return presentation_class( graphic );
|
||||
else if (tmp == L"object")
|
||||
return presentation_class( object );
|
||||
else if (tmp == L"chart")
|
||||
return presentation_class( chart );
|
||||
else if (tmp == L"table")
|
||||
return presentation_class( table );
|
||||
else if (tmp == L"orgchart")
|
||||
return presentation_class( orgchart );
|
||||
else if (tmp == L"notes")
|
||||
return presentation_class( notes );
|
||||
else if (tmp == L"handout")
|
||||
return presentation_class( handout );
|
||||
else if (tmp == L"header")
|
||||
return presentation_class( header );
|
||||
else if (tmp == L"footer")
|
||||
return presentation_class( footer );
|
||||
else if (tmp == L"date-time")
|
||||
return presentation_class( date_time );
|
||||
else if (tmp == L"page-number")
|
||||
return presentation_class( page_number );
|
||||
else
|
||||
if (tmp == L"page") return presentation_class( page );
|
||||
else if (tmp == L"title") return presentation_class( title);
|
||||
else if (tmp == L"outline") return presentation_class( outline );
|
||||
else if (tmp == L"subtitle") return presentation_class( subtitle);
|
||||
else if (tmp == L"text") return presentation_class( text);
|
||||
else if (tmp == L"graphic") return presentation_class( graphic );
|
||||
else if (tmp == L"object") return presentation_class( object );
|
||||
else if (tmp == L"chart") return presentation_class( chart );
|
||||
else if (tmp == L"table") return presentation_class( table );
|
||||
else if (tmp == L"orgchart") return presentation_class( orgchart );
|
||||
else if (tmp == L"notes") return presentation_class( notes );
|
||||
else if (tmp == L"handout") return presentation_class( handout );
|
||||
else if (tmp == L"header") return presentation_class( header );
|
||||
else if (tmp == L"footer") return presentation_class( footer );
|
||||
else if (tmp == L"date-time") return presentation_class( date_time );
|
||||
else if (tmp == L"page-number") return presentation_class( page_number );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return presentation_class( page );
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
|
||||
{
|
||||
CP_XML_NODE(L"a:spcBef")
|
||||
{
|
||||
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
|
||||
if (fo_margin_top_->get_type() == length_or_percent::Length)
|
||||
{
|
||||
std::wstring w_before = pptx_process_margin(fo_margin_top_, length::pt, 100.0);
|
||||
CP_XML_NODE(L"a:spcPts")
|
||||
|
||||
@ -67,30 +67,41 @@ public:
|
||||
odf_type_name =L"ooxml-snip2DiagRect";
|
||||
|
||||
modifiers = L"0 16667";
|
||||
enhanced_path = L"M ?f9 ?f2 L ?f13 ?f2 ?f1 ?f12 ?f1 ?f11 ?f10 ?f3 ?f12 ?f3 ?f0 ?f14 ?f0 ?f9 Z N";
|
||||
text_areas = L"?f17 ?f17 ?f18 ?f19";
|
||||
view_box = L"0 0 21600 21600";
|
||||
enhanced_path = L"M ?f3 0 L ?f7 0 ?f14 ?f6 ?f14 ?f5 ?f4 ?f17 ?f6 ?f17 0 ?f8 0 ?f3 Z N";
|
||||
text_areas = L"?f11 ?f11 ?f12 ?f13";
|
||||
view_box = L"0 0 0 0";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"$0");
|
||||
add(L"f8", L"$1");
|
||||
add(L"f9", L"?f6 * ?f7 / 100000");
|
||||
add(L"f10", L"?f1 - ?f9");
|
||||
add(L"f11", L"?f3 - ?f9");
|
||||
add(L"f12", L"?f6 * ?f8 / 100000");
|
||||
add(L"f13", L"?f1 - ?f12");
|
||||
add(L"f14", L"?f3 - ?f12");
|
||||
add(L"f15", L"?f9 - ?f12");
|
||||
add(L"f16", L"if(?f15, ?f9, ?f12)");
|
||||
add(L"f17", L"?f16 / 2");
|
||||
add(L"f18", L"?f1 - ?f17");
|
||||
add(L"f19", L"?f3 - ?f17");
|
||||
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
|
||||
add(L"f1", L"if(0-$1 ,0,if(50000-$1 ,$1 ,50000))");
|
||||
add(L"f2", L"min(logwidth,logheight)");
|
||||
add(L"f3", L"?f2 *?f0 /100000");
|
||||
add(L"f4", L"logwidth+0-?f3 ");
|
||||
add(L"f5", L"logheight+0-?f3 ");
|
||||
add(L"f6", L"?f2 *?f1 /100000");
|
||||
add(L"f7", L"logwidth+0-?f6 ");
|
||||
add(L"f8", L"logheight+0-?f6 ");
|
||||
add(L"f9", L"?f3 +0-?f6 ");
|
||||
add(L"f10", L"if(?f9 ,?f3 ,?f6 )");
|
||||
add(L"f11", L"?f10 *1/2");
|
||||
add(L"f12", L"logwidth+0-?f11 ");
|
||||
add(L"f13", L"logheight+0-?f11 ");
|
||||
add(L"f14", L"logwidth");
|
||||
add(L"f15", L"logheight/2");
|
||||
add(L"f16", L"logwidth/2");
|
||||
add(L"f17", L"logheight");
|
||||
|
||||
_handle h;
|
||||
|
||||
h.position = L"?f3 0";
|
||||
h.x_maximum= L"50000";
|
||||
h.x_minimum= L"0";
|
||||
handles.push_back(h);
|
||||
|
||||
h.position = L"?f7 0";
|
||||
h.x_maximum= L"50000";
|
||||
h.x_minimum= L"0";
|
||||
handles.push_back(h);
|
||||
|
||||
}
|
||||
};
|
||||
class oox_shape_snip2SameRect : public oox_shape
|
||||
|
||||
@ -403,9 +403,11 @@ int draw_enhanced_geometry::parsing(_CP_OPT(std::wstring) val)
|
||||
void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"draw:type", draw_type_);
|
||||
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_);
|
||||
CP_XML_ATTR_OPT(L"drawooo:sub-view-size", draw_sub_view_size_);
|
||||
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_);
|
||||
CP_XML_ATTR_OPT(L"draw:modifiers", draw_modifiers_);
|
||||
CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_);
|
||||
CP_XML_ATTR_OPT(L"drawooo:enhanced-path", draw_enhanced_path_);
|
||||
//CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_);
|
||||
CP_XML_ATTR_OPT(L"draw:glue-points", draw_glue_points_);
|
||||
CP_XML_ATTR_OPT(L"draw:mirror-vertical", draw_mirror_vertical_);
|
||||
CP_XML_ATTR_OPT(L"draw:mirror-horizontal", draw_mirror_horizontal_);
|
||||
|
||||
@ -316,19 +316,21 @@ CP_REGISTER_OFFICE_ELEMENT2(draw_handle);
|
||||
class draw_enhanced_geometry_attlist
|
||||
{
|
||||
public:
|
||||
_CP_OPT(std::wstring) draw_type_;
|
||||
_CP_OPT(std::wstring) draw_modifiers_;
|
||||
_CP_OPT(std::wstring) draw_enhanced_path_;
|
||||
_CP_OPT(std::wstring) draw_text_areas_;
|
||||
_CP_OPT(std::wstring) draw_glue_points_;
|
||||
_CP_OPT(std::wstring) draw_type_;
|
||||
_CP_OPT(std::wstring) draw_modifiers_;
|
||||
_CP_OPT(std::wstring) draw_enhanced_path_;
|
||||
_CP_OPT(std::wstring) draw_text_areas_;
|
||||
_CP_OPT(std::wstring) draw_glue_points_;
|
||||
|
||||
_CP_OPT(odf_types::Bool) draw_mirror_vertical_;
|
||||
_CP_OPT(odf_types::Bool) draw_mirror_horizontal_;
|
||||
_CP_OPT(std::wstring) draw_sub_view_size_;
|
||||
|
||||
_CP_OPT(odf_types::Bool) draw_mirror_vertical_;
|
||||
_CP_OPT(odf_types::Bool) draw_mirror_horizontal_;
|
||||
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_;
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_;
|
||||
_CP_OPT(std::wstring) draw_text_path_mode_;
|
||||
_CP_OPT(std::wstring) draw_text_path_scale_;
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_;
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_;
|
||||
_CP_OPT(std::wstring) draw_text_path_mode_;
|
||||
_CP_OPT(std::wstring) draw_text_path_scale_;
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
|
||||
@ -96,7 +96,7 @@ void odf_comment_context::start_comment(office_element_ptr &elm, int oox_id)
|
||||
|
||||
impl_->comments_.push_back(state);
|
||||
impl_->comments_.back().elements_.push_back(elm);//"0" - root comment eleemnt
|
||||
impl_->comments_.back().oox_id = oox_id;
|
||||
impl_->comments_.back().oox_id = oox_id < 0 ? impl_->comments_.back().elements_.size() : oox_id;
|
||||
impl_->comments_.back().odf_name = L"comment_" + boost::lexical_cast<std::wstring>(oox_id);
|
||||
|
||||
impl_->comments_.back().is_started = false;
|
||||
@ -159,14 +159,14 @@ std::wstring odf_comment_context::find_name_by_id(int oox_id)
|
||||
}
|
||||
bool odf_comment_context::is_started()
|
||||
{
|
||||
if (impl_->comments_.size()>0)
|
||||
if (!impl_->comments_.empty())
|
||||
return impl_->comments_.back().is_started;
|
||||
else return false;
|
||||
|
||||
}
|
||||
void odf_comment_context::set_author(std::wstring author)
|
||||
{
|
||||
if ((impl_->comments_.size()<1) || !is_started()) return;
|
||||
if ((impl_->comments_.empty()) || !is_started()) return;
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"dc", L"creator", elm, impl_->odf_context_);
|
||||
@ -178,11 +178,15 @@ void odf_comment_context::set_author(std::wstring author)
|
||||
|
||||
impl_->comments_.back().elements_[0]->add_child_element(elm);
|
||||
impl_->comments_.back().elements_.push_back(elm);
|
||||
}
|
||||
void odf_comment_context::set_initials(std::wstring initials)
|
||||
{
|
||||
if ((impl_->comments_.empty()) || !is_started()) return;
|
||||
|
||||
}
|
||||
void odf_comment_context::set_date(std::wstring _date)
|
||||
{
|
||||
if ((impl_->comments_.size()<1) || !is_started()) return;
|
||||
if ((impl_->comments_.empty()) || !is_started()) return;
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"dc", L"date", elm, impl_->odf_context_);
|
||||
@ -195,5 +199,18 @@ void odf_comment_context::set_date(std::wstring _date)
|
||||
impl_->comments_.back().elements_[0]->add_child_element(elm);
|
||||
impl_->comments_.back().elements_.push_back(elm);
|
||||
}
|
||||
void odf_comment_context::set_position (double x, double y)
|
||||
{
|
||||
if ((impl_->comments_.empty()) || !is_started()) return;
|
||||
|
||||
office_annotation* comm = dynamic_cast<office_annotation*>(impl_->comments_.back().elements_.back().get());
|
||||
|
||||
if (comm)
|
||||
{
|
||||
comm->office_annotation_attr_.svg_x_ = odf_types::length(x, odf_types::length::pt);
|
||||
comm->office_annotation_attr_.svg_y_ = odf_types::length(y, odf_types::length::pt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -66,8 +66,11 @@ public:
|
||||
void start_comment_content ();
|
||||
void end_comment_content ();
|
||||
|
||||
void set_author (std::wstring author);
|
||||
void set_date (std::wstring author);
|
||||
void set_author (std::wstring author);
|
||||
void set_initials (std::wstring author);
|
||||
void set_date (std::wstring author);
|
||||
|
||||
void set_position (double x, double y);
|
||||
|
||||
private:
|
||||
std::wstring find_name_by_id(int oox_id);
|
||||
|
||||
@ -262,6 +262,7 @@ void odf_conversion_context::process_settings(_object & object, bool isRoot)
|
||||
void odf_conversion_context::process_styles(_object & object, bool isRoot)
|
||||
{
|
||||
create_element(L"office", L"styles", object.styles, this, true);//общие стили
|
||||
|
||||
object.style_context->process_office_styles(object.styles.back());
|
||||
page_layout_context()->process_office_styles(object.styles.back());
|
||||
|
||||
@ -288,7 +289,15 @@ office_element_ptr odf_conversion_context::start_tabs()
|
||||
create_element(L"style", L"tab-stops", temporary_.elm, this,true);
|
||||
return temporary_.elm;
|
||||
}
|
||||
std::wstring odf_conversion_context::add_image(const std::wstring & image_file_name)
|
||||
{
|
||||
if (image_file_name.empty()) return L"";
|
||||
|
||||
std::wstring odf_ref_name ;
|
||||
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage, odf_ref_name);
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
|
||||
{
|
||||
if (!temporary_.elm) return;
|
||||
|
||||
@ -95,7 +95,7 @@ public:
|
||||
virtual void start_text_context() = 0;
|
||||
virtual void end_text_context() = 0;
|
||||
|
||||
virtual void start_image(const std::wstring & image_file_name) = 0;
|
||||
std::wstring add_image(const std::wstring & image_file_name);
|
||||
|
||||
virtual odf_style_context * styles_context();
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ struct odf_group_state
|
||||
scale_cx = scale_cy = 1.;
|
||||
flipH = flipV = false;
|
||||
|
||||
elm = elm_;
|
||||
elm = elm_;
|
||||
level = level_;
|
||||
|
||||
prev_group = prev;
|
||||
@ -185,19 +185,19 @@ struct odf_drawing_state
|
||||
presentation_class_ = boost::none;
|
||||
presentation_placeholder_ = boost::none;
|
||||
|
||||
rotateAngle = boost::none;
|
||||
rotateAngle_ = boost::none;
|
||||
|
||||
path_ = L"";
|
||||
view_box_ = L"";
|
||||
path_last_command_ = L"";
|
||||
modifiers_ = L"";
|
||||
|
||||
oox_shape_preset = -1;
|
||||
oox_shape_preset_ = -1;
|
||||
oox_shape_.reset();
|
||||
|
||||
in_group = false;
|
||||
text_box_tableframe = false;
|
||||
in_group_ = false;
|
||||
text_box_tableframe_= false;
|
||||
|
||||
flipH = flipV = false;
|
||||
flipH_ = flipV_ = false;
|
||||
|
||||
}
|
||||
std::vector<odf_element_state> elements_;
|
||||
@ -207,29 +207,29 @@ struct odf_drawing_state
|
||||
_CP_OPT(length) svg_height_;
|
||||
_CP_OPT(length) svg_width_;
|
||||
|
||||
bool flipH_;
|
||||
bool flipV_;
|
||||
|
||||
std::wstring name_;
|
||||
std::wstring description_;
|
||||
int z_order_;
|
||||
bool hidden_;
|
||||
|
||||
_CP_OPT(double) rotateAngle;
|
||||
_CP_OPT(double) rotateAngle_;
|
||||
_CP_OPT(unsigned int) fill_color_;
|
||||
|
||||
_CP_OPT(presentation_class) presentation_class_;
|
||||
_CP_OPT(std::wstring) presentation_placeholder_;
|
||||
|
||||
bool flipH;
|
||||
bool flipV;
|
||||
|
||||
std::wstring path_;
|
||||
std::wstring view_box_;
|
||||
std::wstring path_last_command_;
|
||||
std::wstring modifiers_;
|
||||
|
||||
std::wstring path_;
|
||||
std::wstring view_box_;
|
||||
std::wstring path_last_command_;
|
||||
oox_shape_ptr oox_shape_;
|
||||
///////////////////////
|
||||
int oox_shape_preset;
|
||||
bool in_group;
|
||||
bool text_box_tableframe;
|
||||
int oox_shape_preset_;
|
||||
bool in_group_;
|
||||
bool text_box_tableframe_;
|
||||
};
|
||||
|
||||
class odf_drawing_context::Impl
|
||||
@ -317,6 +317,11 @@ void odf_drawing_context::set_presentation (bool bMaster)
|
||||
impl_->is_presentation_ = bMaster;
|
||||
}
|
||||
|
||||
_CP_OPT(bool) odf_drawing_context::get_presentation ()
|
||||
{
|
||||
return impl_->is_presentation_;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_footer_state(bool Val)
|
||||
{
|
||||
impl_->is_footer_ = Val;
|
||||
@ -331,6 +336,7 @@ void odf_drawing_context::set_background_state(bool Val)
|
||||
impl_->is_background_ = Val;
|
||||
|
||||
impl_->current_graphic_properties = new graphic_format_properties();
|
||||
start_area_properties();
|
||||
}
|
||||
|
||||
void odf_drawing_context::check_anchor()
|
||||
@ -462,12 +468,13 @@ void odf_drawing_context::start_drawing()
|
||||
//else
|
||||
if (impl_->current_level_.size() > 0)
|
||||
{
|
||||
impl_->current_drawing_state_.in_group = true;
|
||||
impl_->current_drawing_state_.in_group_ = true;
|
||||
}
|
||||
|
||||
}
|
||||
void odf_drawing_context::end_drawing_background(odf_types::common_draw_fill_attlist & common_draw_attlist)
|
||||
{
|
||||
end_area_properties();
|
||||
if (impl_->current_drawing_state_.elements_.empty() == false) return;
|
||||
|
||||
if (!impl_->is_background_ || !impl_->current_graphic_properties) return;
|
||||
@ -486,19 +493,23 @@ void odf_drawing_context::end_drawing()
|
||||
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
if (draw)
|
||||
{
|
||||
if (impl_->is_presentation_)
|
||||
if (impl_->current_drawing_state_.presentation_class_ || impl_->current_drawing_state_.presentation_placeholder_)
|
||||
{
|
||||
_CP_OPT(std::wstring) draw_layer;
|
||||
if (impl_->is_presentation_.get() == true)
|
||||
{//master
|
||||
if (impl_->current_drawing_state_.presentation_class_)
|
||||
draw_layer = L"backgroundobjects";
|
||||
else draw_layer = L"layout";
|
||||
draw_layer = L"backgroundobjects";
|
||||
|
||||
if (!impl_->current_drawing_state_.presentation_class_)
|
||||
impl_->current_drawing_state_.presentation_class_ = presentation_class::outline;
|
||||
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_user_transformed_ = true;
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_placeholder_ = false;
|
||||
}
|
||||
else
|
||||
{//slide
|
||||
if (impl_->current_drawing_state_.presentation_class_)
|
||||
draw_layer = L"layout";
|
||||
draw_layer = L"layout";
|
||||
}
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_class_ = impl_->current_drawing_state_.presentation_class_;
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_layer_ = draw_layer;
|
||||
@ -510,20 +521,20 @@ void odf_drawing_context::end_drawing()
|
||||
|
||||
std::wstring strTransform;
|
||||
|
||||
if (impl_->current_drawing_state_.in_group && impl_->current_group_)
|
||||
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_)
|
||||
{
|
||||
double rotate = impl_->current_group_->rotate;
|
||||
if (impl_->current_drawing_state_.rotateAngle )
|
||||
rotate += *impl_->current_drawing_state_.rotateAngle;
|
||||
if (impl_->current_drawing_state_.rotateAngle_)
|
||||
rotate += *impl_->current_drawing_state_.rotateAngle_;
|
||||
|
||||
if (fabs(rotate)>0.001)impl_->current_drawing_state_.rotateAngle = rotate;
|
||||
if (fabs(rotate)>0.001)impl_->current_drawing_state_.rotateAngle_ = rotate;
|
||||
}
|
||||
double x = impl_->current_drawing_state_.svg_x_ ? impl_->current_drawing_state_.svg_x_->get_value() : 0;
|
||||
double y = impl_->current_drawing_state_.svg_y_ ? impl_->current_drawing_state_.svg_y_->get_value() : 0;
|
||||
|
||||
if (impl_->current_drawing_state_.rotateAngle)
|
||||
if (impl_->current_drawing_state_.rotateAngle_)
|
||||
{
|
||||
if (impl_->current_drawing_state_.in_group)
|
||||
if (impl_->current_drawing_state_.in_group_)
|
||||
{
|
||||
if (impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_)
|
||||
{
|
||||
@ -533,7 +544,7 @@ void odf_drawing_context::end_drawing()
|
||||
}
|
||||
|
||||
}
|
||||
strTransform += std::wstring(L"rotate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.rotateAngle.get()) + std::wstring(L")");
|
||||
strTransform += std::wstring(L"rotate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.rotateAngle_.get()) + std::wstring(L")");
|
||||
//так как вращения все в мс относительно центра фигуры, а не от начала координат - убираем смещение
|
||||
|
||||
if (impl_->current_drawing_state_.svg_x_ && impl_->current_drawing_state_.svg_y_)
|
||||
@ -577,14 +588,14 @@ void odf_drawing_context::end_drawing()
|
||||
placeholder->svg_height_ = impl_->current_drawing_state_.svg_height_;
|
||||
placeholder->svg_width_ = impl_->current_drawing_state_.svg_width_;
|
||||
}
|
||||
if (impl_->current_drawing_state_.in_group)
|
||||
if (impl_->current_drawing_state_.in_group_)
|
||||
{
|
||||
odf_group_state_ptr gr = impl_->current_group_;
|
||||
|
||||
while(gr)
|
||||
{
|
||||
impl_->current_drawing_state_.flipH = impl_->current_drawing_state_.flipH ^ gr->flipH;
|
||||
impl_->current_drawing_state_.flipV = impl_->current_drawing_state_.flipV ^ gr->flipV;
|
||||
impl_->current_drawing_state_.flipH_ = impl_->current_drawing_state_.flipH_ ^ gr->flipH;
|
||||
impl_->current_drawing_state_.flipV_ = impl_->current_drawing_state_.flipV_ ^ gr->flipV;
|
||||
|
||||
gr = gr->prev_group;
|
||||
}
|
||||
@ -595,8 +606,8 @@ void odf_drawing_context::end_drawing()
|
||||
draw_enhanced_geometry* enhan = dynamic_cast<draw_enhanced_geometry*>(custom->draw_enhanced_geometry_.get());
|
||||
if(enhan)
|
||||
{
|
||||
if (impl_->current_drawing_state_.flipV) enhan->draw_enhanced_geometry_attlist_.draw_mirror_vertical_ = true;
|
||||
if (impl_->current_drawing_state_.flipH) enhan->draw_enhanced_geometry_attlist_.draw_mirror_horizontal_ = true;
|
||||
if (impl_->current_drawing_state_.flipV_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_vertical_ = true;
|
||||
if (impl_->current_drawing_state_.flipH_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_horizontal_ = true;
|
||||
}
|
||||
}else
|
||||
{
|
||||
@ -616,7 +627,7 @@ void odf_drawing_context::end_drawing()
|
||||
impl_->current_graphic_properties->common_horizontal_margin_attlist_.fo_margin_right_ = impl_->anchor_settings_.fo_margin_right_;
|
||||
impl_->current_graphic_properties->common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_;
|
||||
|
||||
if (draw && !impl_->current_drawing_state_.in_group)
|
||||
if (draw && !impl_->current_drawing_state_.in_group_)
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_ = impl_->anchor_settings_.anchor_type_;
|
||||
|
||||
impl_->current_graphic_properties->style_wrap_ = impl_->anchor_settings_.style_wrap_;
|
||||
@ -696,7 +707,10 @@ void odf_drawing_context::Impl::create_draw_base(int type)
|
||||
draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get());
|
||||
if (draw == NULL)return;
|
||||
//////////
|
||||
styles_context_->create_style(L"", style_family::Graphic, true, false, -1);
|
||||
if (is_presentation_ && current_drawing_state_.presentation_class_)
|
||||
styles_context_->create_style(L"", style_family::Presentation, true, false, -1);
|
||||
else
|
||||
styles_context_->create_style(L"", style_family::Graphic, true, false, -1);
|
||||
|
||||
office_element_ptr & style_shape_elm = styles_context_->last_state()->get_office_element();
|
||||
std::wstring style_name;
|
||||
@ -708,12 +722,15 @@ void odf_drawing_context::Impl::create_draw_base(int type)
|
||||
current_graphic_properties = style_->content_.get_graphic_properties();
|
||||
}
|
||||
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_style_name_ = style_name;
|
||||
if (is_presentation_ && current_drawing_state_.presentation_class_)
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_style_name_ = style_name;
|
||||
else
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_style_name_ = style_name;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int level = current_level_.size();
|
||||
|
||||
if (current_level_.size()>0)
|
||||
if (current_level_.size() > 0)
|
||||
current_level_.back()->add_child_element(draw_elm);
|
||||
|
||||
current_level_.push_back(draw_elm);
|
||||
@ -722,11 +739,14 @@ void odf_drawing_context::Impl::create_draw_base(int type)
|
||||
|
||||
current_drawing_state_.elements_.push_back(state);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (type == 7)
|
||||
current_drawing_state_.oox_shape_ = oox_shape_ptr(new oox_shape());
|
||||
}
|
||||
|
||||
void odf_drawing_context::start_shape(int type)
|
||||
{
|
||||
impl_->current_drawing_state_.oox_shape_preset = type;
|
||||
impl_->current_drawing_state_.oox_shape_preset_ = type;
|
||||
|
||||
if (type < sizeof(Shape_Types_Mapping)/sizeof(_sh_typ))
|
||||
{
|
||||
@ -738,7 +758,7 @@ void odf_drawing_context::start_shape(int type)
|
||||
}
|
||||
else if (type == 1001)
|
||||
{
|
||||
impl_->create_draw_base(6);//пока кастом .. потом переделать на path, что правильнее
|
||||
impl_->create_draw_base(6); //path
|
||||
}
|
||||
else if (type == 2000)
|
||||
{
|
||||
@ -748,18 +768,27 @@ void odf_drawing_context::start_shape(int type)
|
||||
{
|
||||
start_image(L"");
|
||||
}
|
||||
else if (type > 2000 && type < 3000)
|
||||
else if (type > 2000 && type < 3000) //custom text path
|
||||
{
|
||||
impl_->create_draw_base(7);
|
||||
impl_->create_draw_base(7);
|
||||
}
|
||||
}
|
||||
|
||||
bool odf_drawing_context::is_wordart()
|
||||
{
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool odf_drawing_context::change_text_box_2_wordart()
|
||||
{
|
||||
if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
|
||||
return true;
|
||||
|
||||
if (impl_->current_drawing_state_.text_box_tableframe) return false;
|
||||
if (impl_->current_drawing_state_.presentation_class_) return false;
|
||||
if (impl_->current_drawing_state_.text_box_tableframe_) return false;
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return false;
|
||||
|
||||
draw_text_box* t = dynamic_cast<draw_text_box*>(impl_->current_drawing_state_.elements_.back().elm.get());
|
||||
@ -797,7 +826,7 @@ bool odf_drawing_context::change_text_box_2_wordart()
|
||||
impl_->current_drawing_state_.elements_.erase(impl_->current_drawing_state_.elements_.end() - 2, impl_->current_drawing_state_.elements_.end());
|
||||
impl_->current_drawing_state_.elements_.push_back( state);
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_preset = 2031;//plain text
|
||||
impl_->current_drawing_state_.oox_shape_preset_ = 2031;//plain text
|
||||
|
||||
if (sz == 2) impl_->root_element_ = draw_elm;
|
||||
return true;
|
||||
@ -808,11 +837,14 @@ void odf_drawing_context::end_shape()
|
||||
if (impl_->current_drawing_state_.elements_.empty())
|
||||
return;
|
||||
|
||||
if (impl_->current_drawing_state_.oox_shape_preset == 2000) return end_text_box();
|
||||
if (impl_->current_drawing_state_.oox_shape_preset == 3000) return end_image();
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ == 2000) return end_text_box();
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ == 3000) return end_image();
|
||||
//вторичные, вычисляемые свойства шейпов
|
||||
|
||||
bool line_always_present = false;
|
||||
if (isLineShape())
|
||||
{
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
|
||||
}
|
||||
|
||||
draw_path* path = dynamic_cast<draw_path*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
if (path)
|
||||
@ -821,10 +853,8 @@ void odf_drawing_context::end_shape()
|
||||
set_viewBox( impl_->current_drawing_state_.svg_width_->get_value_unit(length::cm) * 1000,
|
||||
impl_->current_drawing_state_.svg_height_->get_value_unit(length::cm) *1000);
|
||||
|
||||
if (impl_->current_drawing_state_.path_.length()>1) path->draw_path_attlist_.svg_d_ = impl_->current_drawing_state_.path_;
|
||||
if (impl_->current_drawing_state_.view_box_.length()>1) path->draw_path_attlist_.svg_viewbox_ = impl_->current_drawing_state_.view_box_;
|
||||
|
||||
line_always_present = true;
|
||||
if (!impl_->current_drawing_state_.path_.empty()) path->draw_path_attlist_.svg_d_ = impl_->current_drawing_state_.path_;
|
||||
if (!impl_->current_drawing_state_.view_box_.empty()) path->draw_path_attlist_.svg_viewbox_ = impl_->current_drawing_state_.view_box_;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
draw_line* line = dynamic_cast<draw_line*>(impl_->current_level_.back().get());
|
||||
@ -845,7 +875,7 @@ void odf_drawing_context::end_shape()
|
||||
impl_->current_drawing_state_.svg_x_ = boost::none;
|
||||
impl_->current_drawing_state_.svg_y_ = boost::none;
|
||||
|
||||
if (impl_->current_drawing_state_.flipV)
|
||||
if (impl_->current_drawing_state_.flipV_)
|
||||
{
|
||||
_CP_OPT(length) tmp;
|
||||
|
||||
@ -853,7 +883,7 @@ void odf_drawing_context::end_shape()
|
||||
line->draw_line_attlist_.svg_y1_ = line->draw_line_attlist_.svg_y2_;
|
||||
line->draw_line_attlist_.svg_y2_ = tmp;
|
||||
}
|
||||
if (impl_->current_drawing_state_.flipH)
|
||||
if (impl_->current_drawing_state_.flipH_)
|
||||
{
|
||||
_CP_OPT(length) tmp;
|
||||
|
||||
@ -861,16 +891,14 @@ void odf_drawing_context::end_shape()
|
||||
line->draw_line_attlist_.svg_x1_ = line->draw_line_attlist_.svg_x2_;
|
||||
line->draw_line_attlist_.svg_x2_ = tmp;
|
||||
}
|
||||
|
||||
line_always_present = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
draw_connector* connector = dynamic_cast<draw_connector*>(impl_->current_level_.back().get());
|
||||
if (connector)
|
||||
{
|
||||
if (!connector->draw_connector_attlist_.draw_type_) connector->draw_connector_attlist_.draw_type_ = L"line";
|
||||
line_always_present = true;
|
||||
if (!connector->draw_connector_attlist_.draw_type_)
|
||||
connector->draw_connector_attlist_.draw_type_ = L"line";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -880,19 +908,19 @@ void odf_drawing_context::end_shape()
|
||||
std::wstring sub_type;
|
||||
bool text_shape = false;
|
||||
|
||||
if (impl_->current_drawing_state_.oox_shape_preset < sizeof(Shape_Types_Mapping)/sizeof(_sh_typ))
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ < sizeof(Shape_Types_Mapping)/sizeof(_sh_typ))
|
||||
{
|
||||
sub_type = Shape_Types_Mapping[impl_->current_drawing_state_.oox_shape_preset].first;
|
||||
sub_type = Shape_Types_Mapping[impl_->current_drawing_state_.oox_shape_preset_].first;
|
||||
}
|
||||
else if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)// 3000 - все равно сюда не попадет
|
||||
else if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)// 3000 - все равно сюда не попадет
|
||||
{
|
||||
text_shape = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_type = L"polyline";
|
||||
line_always_present = true;
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// sub_type = L"polyline";
|
||||
// line_always_present = true;
|
||||
//}
|
||||
|
||||
office_element_ptr enhanced_elm;
|
||||
create_element(L"draw", L"enhanced-geometry", enhanced_elm, impl_->odf_context_);
|
||||
@ -906,52 +934,50 @@ void odf_drawing_context::end_shape()
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_same_letter_heights_ = false;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_scale_ = L"path" ;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_mode_ = L"shape" ;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_ = true;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_mode_ = L"shape" ;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_ = true;
|
||||
}
|
||||
|
||||
if (impl_->current_drawing_state_.path_.length()>1)
|
||||
if (!impl_->current_drawing_state_.path_.empty())
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ =impl_->current_drawing_state_.path_;
|
||||
}
|
||||
if (impl_->current_drawing_state_.view_box_.length()>1)
|
||||
if (!impl_->current_drawing_state_.view_box_.empty())
|
||||
{
|
||||
enhanced->svg_viewbox_ = impl_->current_drawing_state_.view_box_;
|
||||
}
|
||||
if (sub_type.length()>1)
|
||||
if (!sub_type.empty())
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = sub_type;
|
||||
|
||||
int res=0;
|
||||
if ((res = sub_type.find(L"ooxml")) >= 0 && impl_->current_drawing_state_.modifiers_.length()>1)
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = impl_->current_drawing_state_.modifiers_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oox_shape_ptr shape_define = oox_shape::create(impl_->current_drawing_state_.oox_shape_preset);
|
||||
|
||||
oox_shape_ptr shape_define = oox_shape::create(impl_->current_drawing_state_.oox_shape_preset_);
|
||||
|
||||
if (!shape_define) shape_define = impl_->current_drawing_state_.oox_shape_;
|
||||
|
||||
if (shape_define)
|
||||
{
|
||||
enhanced->svg_viewbox_ = shape_define->view_box;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_areas_ = shape_define->text_areas;
|
||||
if (shape_define->glue_points)
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_glue_points_ = *shape_define->glue_points;
|
||||
}
|
||||
enhanced->svg_viewbox_ = shape_define->view_box;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_areas_ = shape_define->text_areas;
|
||||
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_glue_points_ = shape_define->glue_points;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_sub_view_size_ = shape_define->sub_view_size;
|
||||
|
||||
if (impl_->current_drawing_state_.modifiers_.length()>1)
|
||||
if (impl_->current_drawing_state_.oox_shape_ && !impl_->current_drawing_state_.oox_shape_->modifiers.empty())
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = impl_->current_drawing_state_.modifiers_;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = impl_->current_drawing_state_.oox_shape_->modifiers;
|
||||
}
|
||||
else // обязательно нужны дефолтовые
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = shape_define->modifiers;
|
||||
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
|
||||
if (!shape_define->enhanced_path.empty())
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
|
||||
else
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = impl_->current_drawing_state_.path_;
|
||||
|
||||
for (size_t i = 0; i < shape_define->equations.size();i++)
|
||||
for (size_t i = 0; i < shape_define->equations.size(); i++)
|
||||
{
|
||||
office_element_ptr elm_eq;
|
||||
create_element(L"draw", L"equation", elm_eq, impl_->odf_context_);
|
||||
@ -965,7 +991,7 @@ void odf_drawing_context::end_shape()
|
||||
end_element();
|
||||
}
|
||||
//-----------------------------
|
||||
for (size_t i = 0; i < shape_define->handles.size();i++)
|
||||
for (size_t i = 0; i < shape_define->handles.size(); i++)
|
||||
{
|
||||
office_element_ptr elm_h;
|
||||
create_element(L"draw", L"handle", elm_h, impl_->odf_context_);
|
||||
@ -988,7 +1014,38 @@ void odf_drawing_context::end_shape()
|
||||
}
|
||||
end_element();
|
||||
}
|
||||
void odf_drawing_context::corrected_line_fill()
|
||||
|
||||
bool odf_drawing_context::isLineShape()
|
||||
{
|
||||
if (impl_->current_level_.empty()) return false;
|
||||
|
||||
draw_line* line = dynamic_cast<draw_line*>(impl_->current_level_.back().get());
|
||||
if (line) return true;
|
||||
|
||||
draw_connector* connector = dynamic_cast<draw_connector*>(impl_->current_level_.back().get());
|
||||
if (connector) return true;
|
||||
|
||||
draw_path* path = dynamic_cast<draw_path*>(impl_->current_level_.back().get());
|
||||
if (path) return true;
|
||||
|
||||
switch(impl_->current_drawing_state_.oox_shape_preset_)
|
||||
{
|
||||
case 20: //SimpleTypes::shapetypeBentConnector2:
|
||||
case 21: //SimpleTypes::shapetypeBentConnector3:
|
||||
case 22: //SimpleTypes::shapetypeBentConnector4:
|
||||
case 23: //SimpleTypes::shapetypeBentConnector5:
|
||||
case 47: //SimpleTypes::shapetypeCurvedConnector2:
|
||||
case 48: //SimpleTypes::shapetypeCurvedConnector3:
|
||||
case 49: //SimpleTypes::shapetypeCurvedConnector4:
|
||||
case 50: //SimpleTypes::shapetypeCurvedConnector5:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void odf_drawing_context::corrected_line_fill() //for vml objects
|
||||
{
|
||||
if (!impl_->current_graphic_properties)return;
|
||||
|
||||
@ -1129,22 +1186,26 @@ void odf_drawing_context::set_shadow(int type, std::wstring hexColor, _CP_OPT(do
|
||||
|
||||
void odf_drawing_context::set_placeholder_id (std::wstring val)
|
||||
{
|
||||
if (!impl_->is_presentation_) return;
|
||||
|
||||
impl_->current_drawing_state_.presentation_placeholder_ = val;
|
||||
}
|
||||
void odf_drawing_context::set_placeholder_type (int val)
|
||||
{
|
||||
if (!impl_->is_presentation_) return;
|
||||
|
||||
switch(val)
|
||||
{
|
||||
case 0: impl_->current_drawing_state_.presentation_class_ = presentation_class::text; break;
|
||||
case 1: impl_->current_drawing_state_.presentation_class_ = presentation_class::chart; break;
|
||||
case 0: impl_->current_drawing_state_.presentation_class_ = presentation_class::outline; break;
|
||||
case 1: impl_->current_drawing_state_.presentation_class_ = presentation_class::chart; break;
|
||||
case 2: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break;
|
||||
case 3: impl_->current_drawing_state_.presentation_class_ = presentation_class::title; break;
|
||||
case 4: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break;
|
||||
case 5: impl_->current_drawing_state_.presentation_class_ = presentation_class::date_time; break;
|
||||
case 6: impl_->current_drawing_state_.presentation_class_ = presentation_class::footer; break;
|
||||
case 7: impl_->current_drawing_state_.presentation_class_ = presentation_class::header; break;
|
||||
case 8: impl_->current_drawing_state_.presentation_class_ = presentation_class::object; break;
|
||||
case 9: impl_->current_drawing_state_.presentation_class_ = presentation_class::object; break;
|
||||
case 6: impl_->current_drawing_state_.presentation_class_ = presentation_class::footer; break;
|
||||
case 7: impl_->current_drawing_state_.presentation_class_ = presentation_class::header; break;
|
||||
case 8: impl_->current_drawing_state_.presentation_class_ = presentation_class::object; break;
|
||||
case 9: impl_->current_drawing_state_.presentation_class_ = presentation_class::object; break;
|
||||
case 10: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break;
|
||||
case 11: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break;
|
||||
case 12: impl_->current_drawing_state_.presentation_class_ = presentation_class::page_number;break;
|
||||
@ -1152,7 +1213,7 @@ void odf_drawing_context::set_placeholder_type (int val)
|
||||
case 14: impl_->current_drawing_state_.presentation_class_ = presentation_class::table; break;
|
||||
case 15: impl_->current_drawing_state_.presentation_class_ = presentation_class::title; break;
|
||||
default:
|
||||
impl_->current_drawing_state_.presentation_class_ = presentation_class::text; break;
|
||||
impl_->current_drawing_state_.presentation_class_ = presentation_class::outline; break;
|
||||
}
|
||||
//todooo draw_layer for master for sldnum, datetime ...
|
||||
}
|
||||
@ -1246,10 +1307,12 @@ void odf_drawing_context::set_path(std::wstring path_string)
|
||||
//boost::replace_all(path_string, L",,", L" 0 ");
|
||||
//boost::replace_all(path_string, L" -", L"-");
|
||||
//boost::replace_all(path_string, L",", L"0"); // нужен разбор
|
||||
//impl_->current_drawing_state_.path_ = path_string;
|
||||
impl_->current_drawing_state_.path_ = path_string;
|
||||
}
|
||||
void odf_drawing_context::add_path_element(std::wstring command, const std::wstring & strE)
|
||||
void odf_drawing_context::add_path_element(std::wstring command, std::wstring strE)
|
||||
{
|
||||
XmlUtils::replace_all(strE, L"gd", L"?f");
|
||||
|
||||
if (command != impl_->current_drawing_state_.path_last_command_)
|
||||
{
|
||||
impl_->current_drawing_state_.path_ += command;
|
||||
@ -1258,19 +1321,179 @@ void odf_drawing_context::add_path_element(std::wstring command, const std::wstr
|
||||
|
||||
impl_->current_drawing_state_.path_last_command_ = command;
|
||||
}
|
||||
if (command != L"N")
|
||||
impl_->current_drawing_state_.path_ += strE + L" ";
|
||||
else
|
||||
impl_->current_drawing_state_.path_ += strE;
|
||||
|
||||
impl_->current_drawing_state_.path_ += strE + L" ";
|
||||
|
||||
if (command == L"N")
|
||||
impl_->current_drawing_state_.path_last_command_.clear();
|
||||
}
|
||||
void odf_drawing_context::add_modifier(std::wstring modifier)
|
||||
void odf_drawing_context::add_modifier (std::wstring modifier)
|
||||
{
|
||||
if (!impl_->current_drawing_state_.oox_shape_) return;
|
||||
|
||||
boost::algorithm::to_lower(modifier);
|
||||
int res = modifier.find(L"val ");
|
||||
if (res >=0) modifier = modifier.substr(4);
|
||||
impl_->current_drawing_state_.modifiers_ += modifier + L" ";
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_->modifiers += modifier + L" ";
|
||||
}
|
||||
void odf_drawing_context::set_viewBox(double W, double H)
|
||||
int GetFormulaType2(const WCHAR& c1, const WCHAR& c2)
|
||||
{
|
||||
switch (c1)
|
||||
{
|
||||
case (WCHAR)'*': return 0;
|
||||
case (WCHAR)'+': return ((WCHAR)'-' == c2) ? 1 : 2;
|
||||
case (WCHAR)'?': return 3;
|
||||
case (WCHAR)'a': return ((WCHAR)'b' == c2) ? 4 : 5;
|
||||
case (WCHAR)'c': return ((WCHAR)'a' == c2) ? 6 : 7;
|
||||
case (WCHAR)'m': return ((WCHAR)'a' == c2) ? 8 : (((WCHAR)'i' == c2) ? 16 : 9);
|
||||
case (WCHAR)'p': return 10;
|
||||
case (WCHAR)'s': return ((WCHAR)'a' == c2) ? 11 : (((WCHAR)'i' == c2) ? 12 : 13);
|
||||
case (WCHAR)'t': return 14;
|
||||
case (WCHAR)'v': return 15;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_textarea (std::wstring l, std::wstring t, std::wstring r, std::wstring b)
|
||||
{
|
||||
if (!impl_->current_drawing_state_.oox_shape_) return;
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_->text_areas = l + L" " + t + L" " + r + L" " + b;
|
||||
|
||||
XmlUtils::replace_all(impl_->current_drawing_state_.oox_shape_->text_areas, L"gd", L"?f");
|
||||
}
|
||||
void odf_drawing_context::add_handle (std::wstring x, std::wstring y, std::wstring refX, std::wstring refY,
|
||||
std::wstring minX, std::wstring maxX, std::wstring minY, std::wstring maxY)
|
||||
{
|
||||
if (!impl_->current_drawing_state_.oox_shape_) return;
|
||||
|
||||
oox_shape::_handle h;
|
||||
|
||||
XmlUtils::replace_all(x, L"gd", L"?f");
|
||||
XmlUtils::replace_all(y, L"gd", L"?f");
|
||||
|
||||
h.position = x + L" " + y;
|
||||
|
||||
if (!maxX.empty()) h.x_maximum= maxX;
|
||||
if (!minX.empty()) h.x_minimum= minX;
|
||||
|
||||
if (!maxY.empty()) h.y_maximum= maxY;
|
||||
if (!minY.empty()) h.y_minimum= minY;
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_->handles.push_back(h);
|
||||
}
|
||||
|
||||
void odf_drawing_context::add_formula (std::wstring name, std::wstring fmla)
|
||||
{
|
||||
if (!impl_->current_drawing_state_.oox_shape_) return;
|
||||
|
||||
size_t nStart = 0;
|
||||
size_t nCurrent = 0;
|
||||
|
||||
const wchar_t* pData = fmla.c_str();
|
||||
|
||||
int nFound = 0, x = 0, y = 0;
|
||||
|
||||
std::wstring val[4];
|
||||
|
||||
while (nCurrent < fmla.length())
|
||||
{
|
||||
if (pData[nCurrent] == (WCHAR)' ')
|
||||
{
|
||||
if (nStart < nCurrent)
|
||||
{
|
||||
if (0 == nFound)
|
||||
{
|
||||
if ((nCurrent - nStart) > 1)
|
||||
{
|
||||
x = GetFormulaType2(pData[nStart], pData[nStart + 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val[nFound-1] = std::wstring( pData + nStart, (ULONG)(nCurrent - nStart));
|
||||
}
|
||||
nStart = nCurrent + 1;
|
||||
++nFound;
|
||||
}
|
||||
}
|
||||
++nCurrent;
|
||||
}
|
||||
if (nStart < nCurrent)
|
||||
{
|
||||
if (0 == nFound)
|
||||
{
|
||||
if ((nCurrent - nStart) > 1)
|
||||
{
|
||||
y = GetFormulaType2(pData[nStart], pData[nStart + 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val[nFound-1] = std::wstring( pData + nStart, (ULONG)(nCurrent - nStart));
|
||||
}
|
||||
}
|
||||
std::wstring odf_fmla = L"";
|
||||
|
||||
switch(x)
|
||||
{
|
||||
case 0:
|
||||
odf_fmla = val[0] + L"*" + val[1] + L"/" + val[2];
|
||||
break;
|
||||
case 1:
|
||||
odf_fmla = val[0] + L"+" + val[1] + L"-" + val[2];
|
||||
break;
|
||||
case 2:
|
||||
odf_fmla = val[0] + L"+" + val[1];
|
||||
break;
|
||||
case 3:
|
||||
odf_fmla = L"if(";
|
||||
for (int i = 0; i < nFound - 1; i++)
|
||||
{
|
||||
odf_fmla += val[i] + L",";
|
||||
}
|
||||
odf_fmla += val[nFound-1] + L")"; break;
|
||||
case 4:
|
||||
odf_fmla = L"abs(" + val[0] + L")";
|
||||
break;
|
||||
case 7:
|
||||
odf_fmla = val[0] + L"*cos(pi*(" + val[1] + L")/10800000)";
|
||||
break;
|
||||
case 12:
|
||||
odf_fmla = val[0] + L"*sin(pi*(" + val[1] + L")/10800000)";
|
||||
break;
|
||||
case 13:
|
||||
odf_fmla = L"sqrt(" + val[0] + L")";
|
||||
break;
|
||||
case 15:
|
||||
odf_fmla = val[0];
|
||||
break;
|
||||
default:
|
||||
odf_fmla = fmla;
|
||||
break;
|
||||
}
|
||||
|
||||
//XmlUtils::replace_all(odf_fmla, L"gd", L"?f");
|
||||
XmlUtils::replace_all(odf_fmla, L"h", L"logheight");
|
||||
XmlUtils::replace_all(odf_fmla, L"w", L"logwidth");
|
||||
XmlUtils::replace_all(odf_fmla, L"adj", L"$");
|
||||
//XmlUtils::replace_all(name, L"gd", L"f");
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_->add(name, odf_fmla);
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_viewBox (double W, double H)
|
||||
{
|
||||
if (W < 0.01)
|
||||
{
|
||||
@ -1282,11 +1505,19 @@ void odf_drawing_context::set_viewBox(double W, double H)
|
||||
if (impl_->current_drawing_state_.svg_height_)
|
||||
H = impl_->current_drawing_state_.svg_height_->get_value_unit(length::emu);
|
||||
}
|
||||
impl_->current_drawing_state_.view_box_ = std::wstring(L"0 0 ") + boost::lexical_cast<std::wstring>((int)W) + L" " + boost::lexical_cast<std::wstring>((int)H);
|
||||
impl_->current_drawing_state_.view_box_ = std::wstring(L"0 0 ") + std::to_wstring((int)W) + L" " + std::to_wstring((int)H);
|
||||
|
||||
if (impl_->current_drawing_state_.oox_shape_)
|
||||
{
|
||||
if (impl_->current_drawing_state_.oox_shape_->sub_view_size)
|
||||
impl_->current_drawing_state_.oox_shape_->sub_view_size = *impl_->current_drawing_state_.oox_shape_->sub_view_size + L" " + std::to_wstring((int)W) + L" " + std::to_wstring((int)H);
|
||||
else
|
||||
impl_->current_drawing_state_.oox_shape_->sub_view_size = std::to_wstring((int)W) + L" " + std::to_wstring((int)H);
|
||||
}
|
||||
}
|
||||
void odf_drawing_context::set_flip_H(bool bVal)
|
||||
{
|
||||
impl_->current_drawing_state_.flipH = bVal;
|
||||
impl_->current_drawing_state_.flipH_ = bVal;
|
||||
|
||||
if (impl_->current_graphic_properties == NULL) return;
|
||||
if (bVal == false)return;
|
||||
@ -1298,7 +1529,7 @@ void odf_drawing_context::set_flip_H(bool bVal)
|
||||
}
|
||||
void odf_drawing_context::set_flip_V(bool bVal)
|
||||
{
|
||||
impl_->current_drawing_state_.flipV = bVal;
|
||||
impl_->current_drawing_state_.flipV_ = bVal;
|
||||
|
||||
if (impl_->current_graphic_properties == NULL) return;
|
||||
if (bVal == false)return;
|
||||
@ -1313,7 +1544,7 @@ void odf_drawing_context::set_rotate(double dVal)
|
||||
{
|
||||
if (dVal > 180) dVal = dVal - 360;
|
||||
double dRotate = dVal / 180. * 3.14159265358979323846;
|
||||
impl_->current_drawing_state_.rotateAngle = dRotate;
|
||||
impl_->current_drawing_state_.rotateAngle_ = dRotate;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_drawings_rect(_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt)// "- 1" не задано
|
||||
@ -1520,8 +1751,8 @@ void odf_drawing_context::set_group_position(_CP_OPT(double) x, _CP_OPT(double)
|
||||
impl_->current_group_->x = *change_x ;
|
||||
impl_->current_group_->y = *change_y ;
|
||||
|
||||
impl_->current_group_->shift_x = (*x - *change_x) ;
|
||||
impl_->current_group_->shift_y = (*y - *change_y) ;
|
||||
impl_->current_group_->shift_x = (*x /impl_->current_group_->scale_cx - *change_x) ;
|
||||
impl_->current_group_->shift_y = (*y /impl_->current_group_->scale_cy - *change_y) ;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_group_size( _CP_OPT(double) cx, _CP_OPT(double) cy, _CP_OPT(double) change_cx, _CP_OPT(double) change_cy)
|
||||
@ -1542,7 +1773,7 @@ void odf_drawing_context::set_group_flip_V(bool bVal)
|
||||
{
|
||||
if ( impl_->group_list_.empty() )return;
|
||||
|
||||
impl_->current_group_->flipV= bVal;
|
||||
impl_->current_group_->flipV = bVal;
|
||||
}
|
||||
void odf_drawing_context::set_group_z_order(int Val)
|
||||
{
|
||||
@ -1567,7 +1798,7 @@ void odf_drawing_context::set_group_flip_H(bool bVal)
|
||||
{
|
||||
if ( impl_->group_list_.empty() )return;
|
||||
|
||||
impl_->current_group_->flipH= bVal;
|
||||
impl_->current_group_->flipH = bVal;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_group_rotate(int iVal)
|
||||
@ -1594,14 +1825,14 @@ void odf_drawing_context::set_position_line(_CP_OPT(double) & x_pt, _CP_OPT(doub
|
||||
draw_line* line = dynamic_cast<draw_line*>(impl_->current_level_.back().get());
|
||||
if (line == NULL) return;
|
||||
|
||||
if (impl_->current_drawing_state_.in_group && impl_->current_group_ && x_pt)
|
||||
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_ && x_pt)
|
||||
x_pt = *x_pt * impl_->current_group_->scale_cx + impl_->current_group_->shift_x ;
|
||||
// + (impl_->current_group_->flipH ? (impl_->current_group_->cx - 2 * x_pt): 0);
|
||||
|
||||
if (x_pt && !line->draw_line_attlist_.svg_x1_)
|
||||
line->draw_line_attlist_.svg_x1_ = length(length(*x_pt,length::pt).get_value_unit(length::cm),length::cm);
|
||||
|
||||
if (impl_->current_drawing_state_.in_group && impl_->current_group_ && y_pt)
|
||||
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_ && y_pt)
|
||||
y_pt = *y_pt * impl_->current_group_->scale_cy + impl_->current_group_->shift_y;
|
||||
//+ (impl_->current_group_->flipV ? (impl_->current_group_->cy - 2 * y_pt): 0);
|
||||
|
||||
@ -1609,13 +1840,13 @@ void odf_drawing_context::set_position_line(_CP_OPT(double) & x_pt, _CP_OPT(doub
|
||||
line->draw_line_attlist_.svg_y1_ = length(length(*y_pt,length::pt).get_value_unit(length::cm),length::cm);
|
||||
|
||||
///////////////////////////////////////
|
||||
if (impl_->current_drawing_state_.in_group && impl_->current_group_ && x2_pt)
|
||||
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_ && x2_pt)
|
||||
x2_pt = *x2_pt * impl_->current_group_->scale_cx + impl_->current_group_->shift_x ;
|
||||
// + (impl_->current_group_->flipH ? (impl_->current_group_->cx - 2 * x_pt): 0);
|
||||
|
||||
if (x2_pt && !line->draw_line_attlist_.svg_x2_) line->draw_line_attlist_.svg_x2_ = length(length(*x2_pt,length::pt).get_value_unit(length::cm),length::cm);
|
||||
|
||||
if (impl_->current_drawing_state_.in_group && impl_->current_group_ && y2_pt)
|
||||
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_ && y2_pt)
|
||||
y2_pt = *y2_pt * impl_->current_group_->scale_cy + impl_->current_group_->shift_y;
|
||||
//+ (impl_->current_group_->flipV ? (impl_->current_group_->cy - 2 * y_pt): 0);
|
||||
|
||||
@ -1641,14 +1872,14 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
|
||||
{
|
||||
double x = *x_pt;
|
||||
|
||||
if (impl_->current_drawing_state_.in_group)
|
||||
if (impl_->current_drawing_state_.in_group_)
|
||||
{
|
||||
for( int i = impl_->group_list_.size() - 1; i >= 0 ; i--)
|
||||
{
|
||||
x = (x + impl_->group_list_[i]->shift_x) * impl_->group_list_[i]->scale_cx ;
|
||||
}
|
||||
}
|
||||
if (!impl_->current_drawing_state_.svg_x_ || impl_->current_drawing_state_.in_group)
|
||||
if (!impl_->current_drawing_state_.svg_x_ || impl_->current_drawing_state_.in_group_)
|
||||
{
|
||||
impl_->current_drawing_state_.svg_x_ = length(length(x , length::pt).get_value_unit(length::cm), length::cm);
|
||||
}
|
||||
@ -1658,7 +1889,7 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
|
||||
{
|
||||
double y = *y_pt;
|
||||
|
||||
if (impl_->current_drawing_state_.in_group)
|
||||
if (impl_->current_drawing_state_.in_group_)
|
||||
{
|
||||
for( int i = impl_->group_list_.size() - 1; i >= 0 ; i--)
|
||||
{
|
||||
@ -1666,7 +1897,7 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
|
||||
}
|
||||
}
|
||||
|
||||
if (!impl_->current_drawing_state_.svg_y_ || impl_->current_drawing_state_.in_group)
|
||||
if (!impl_->current_drawing_state_.svg_y_ || impl_->current_drawing_state_.in_group_)
|
||||
{
|
||||
impl_->current_drawing_state_.svg_y_ = length(length(y, length::pt).get_value_unit(length::cm),length::cm);
|
||||
}
|
||||
@ -1687,7 +1918,7 @@ void odf_drawing_context::get_size( _CP_OPT(double) & width_pt, _CP_OPT(double)
|
||||
}
|
||||
void odf_drawing_context::set_size( _CP_OPT(double) & width_pt, _CP_OPT(double) & height_pt)
|
||||
{
|
||||
if (impl_->current_drawing_state_.in_group)
|
||||
if (impl_->current_drawing_state_.in_group_)
|
||||
{
|
||||
if (width_pt)
|
||||
{
|
||||
@ -1929,7 +2160,7 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
|
||||
style* style_ = NULL;
|
||||
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
|
||||
{
|
||||
impl_->styles_context_->create_style(L"",style_family::Paragraph, true, false, -1);
|
||||
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
|
||||
|
||||
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
style_ = dynamic_cast<style*>(style_shape_elm.get());
|
||||
@ -1968,10 +2199,37 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
|
||||
impl_->current_paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::LrTb);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
|
||||
{
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return;
|
||||
|
||||
if (!impl_->current_paragraph_properties)
|
||||
{
|
||||
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
if (draw)
|
||||
{
|
||||
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
|
||||
{
|
||||
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
|
||||
|
||||
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
|
||||
if (style_)
|
||||
{
|
||||
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//??? find by name
|
||||
}
|
||||
}
|
||||
}
|
||||
if (impl_->current_paragraph_properties)
|
||||
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
|
||||
}
|
||||
void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
|
||||
{
|
||||
if (!impl_->current_graphic_properties)return;
|
||||
@ -2000,7 +2258,7 @@ void odf_drawing_context::start_image(std::wstring odf_path)
|
||||
return;
|
||||
}
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_preset = 3000;
|
||||
impl_->current_drawing_state_.oox_shape_preset_ = 3000;
|
||||
|
||||
start_frame();
|
||||
|
||||
@ -2047,7 +2305,7 @@ void odf_drawing_context::start_object(std::wstring name)
|
||||
|
||||
void odf_drawing_context::start_text_box()
|
||||
{
|
||||
impl_->current_drawing_state_.oox_shape_preset = 2000;
|
||||
impl_->current_drawing_state_.oox_shape_preset_ = 2000;
|
||||
|
||||
start_frame();
|
||||
|
||||
@ -2092,7 +2350,7 @@ void odf_drawing_context::set_text_box_tableframe(bool val)
|
||||
{
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return;
|
||||
|
||||
impl_->current_drawing_state_.text_box_tableframe = val;
|
||||
impl_->current_drawing_state_.text_box_tableframe_ = val;
|
||||
|
||||
}
|
||||
void odf_drawing_context::set_text_box_parent_style(std::wstring style_name)
|
||||
@ -2218,7 +2476,7 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
|
||||
{
|
||||
if (text_context == NULL || impl_->current_level_.size() < 1 ) return;
|
||||
|
||||
if (impl_->is_presentation_ && *impl_->is_presentation_) return;
|
||||
//if (impl_->is_presentation_ && *impl_->is_presentation_) return;
|
||||
|
||||
for (size_t i = 0; i < text_context->text_elements_list_.size(); i++)
|
||||
{
|
||||
@ -2237,7 +2495,7 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
|
||||
|
||||
}
|
||||
|
||||
if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
|
||||
{
|
||||
//настройки цвета - перетащить в линии и заливки - так уж нужно wordart-у оо
|
||||
style_text_properties *text_properties_ = text_context->get_text_properties();
|
||||
@ -2747,7 +3005,7 @@ void odf_drawing_context::end_hatch_style()
|
||||
void odf_drawing_context::start_bitmap_style()
|
||||
{
|
||||
if (!impl_->current_graphic_properties) return;
|
||||
if (impl_->current_drawing_state_.oox_shape_preset == 3000) return;
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ == 3000) return;
|
||||
|
||||
odf_writer::office_element_ptr fill_image_element;
|
||||
|
||||
@ -2843,7 +3101,7 @@ void odf_drawing_context::set_bitmap_link(std::wstring file_path)
|
||||
std::wstring odf_ref_name ;
|
||||
impl_->odf_context_->mediaitems()->add_or_find(file_path, _mediaitems::typeImage, odf_ref_name);
|
||||
|
||||
if (impl_->current_drawing_state_.oox_shape_preset == 3000)
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ == 3000)
|
||||
{
|
||||
if (impl_->current_level_.size() < 1) return;
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ namespace odf_writer
|
||||
class odf_conversion_context;
|
||||
class odf_style_context;
|
||||
class odf_text_context;
|
||||
class style_paragraph_properties;
|
||||
|
||||
class odf_drawing_context
|
||||
{
|
||||
@ -59,7 +60,8 @@ public:
|
||||
odf_drawing_context (odf_conversion_context *odf_context);
|
||||
~odf_drawing_context ();
|
||||
|
||||
void set_presentation (bool bMaster);
|
||||
void set_presentation (bool bMaster);
|
||||
_CP_OPT(bool) get_presentation ();
|
||||
|
||||
void set_drawings_rect (_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt);
|
||||
void clear ();
|
||||
@ -124,21 +126,24 @@ public:
|
||||
void start_frame ();
|
||||
void end_frame ();
|
||||
|
||||
bool change_text_box_2_wordart();
|
||||
|
||||
void start_image (std::wstring file_path);
|
||||
void start_image (std::wstring odf_file_path);
|
||||
void end_image ();
|
||||
|
||||
bool change_text_box_2_wordart ();
|
||||
bool is_wordart ();
|
||||
void set_paragraph_properties (style_paragraph_properties *paragraph_properties);
|
||||
|
||||
void start_text_box ();
|
||||
void set_text_box_min_size (bool val);
|
||||
void set_text_box_min_size (double w_pt, double h_pt);
|
||||
void set_text_box_parent_style (std::wstring style_name);
|
||||
void set_text_box_tableframe (bool val);
|
||||
void set_text_box_tableframe (bool val);
|
||||
void end_text_box ();
|
||||
|
||||
void start_object(std::wstring name);
|
||||
void end_object();
|
||||
|
||||
bool isLineShape();
|
||||
void corrected_line_fill();
|
||||
|
||||
office_element_ptr & get_root_element();
|
||||
@ -149,8 +154,12 @@ public:
|
||||
bool is_exist_content();
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
void set_path (std::wstring path_string);
|
||||
void add_path_element (std::wstring command, const std::wstring & elm);
|
||||
void add_path_element (std::wstring command, std::wstring elm);
|
||||
void add_modifier (std::wstring modifier);
|
||||
void add_formula (std::wstring name, std::wstring fmla);
|
||||
void set_textarea (std::wstring l, std::wstring t, std::wstring r, std::wstring b);
|
||||
void add_handle (std::wstring x, std::wstring y, std::wstring refX, std::wstring refY,
|
||||
std::wstring minX, std::wstring maxX, std::wstring minY, std::wstring maxY);
|
||||
|
||||
void set_viewBox (double W, double H);
|
||||
|
||||
|
||||
@ -54,11 +54,12 @@ void odf_lists_styles_context::set_odf_context(odf_conversion_context * Context)
|
||||
odf_context_ = Context;
|
||||
}
|
||||
|
||||
void odf_lists_styles_context::process_styles(office_element_ptr root )
|
||||
void odf_lists_styles_context::process_styles(office_element_ptr root, bool automatic)
|
||||
{
|
||||
for (size_t i = 0; i < lists_format_array_.size(); i++)
|
||||
{
|
||||
if (lists_format_array_[i].elements.size() < 1) continue;
|
||||
if (lists_format_array_[i].elements.size() < 1) continue;
|
||||
if (lists_format_array_[i].automatic != automatic) continue;
|
||||
|
||||
root->add_child_element(lists_format_array_[i].elements[0]);
|
||||
}
|
||||
@ -92,7 +93,13 @@ std::wstring odf_lists_styles_context::get_style_name1(int oox_style_num)
|
||||
}
|
||||
std::wstring odf_lists_styles_context::get_style_name(int oox_style_num)
|
||||
{
|
||||
if (link_format_map_.count(oox_style_num) > 0)
|
||||
if (lists_format_array_.empty()) return L"";
|
||||
|
||||
if (oox_style_num < 0)
|
||||
{
|
||||
return lists_format_array_.back().odf_list_style_name;
|
||||
}
|
||||
else if (link_format_map_.count(oox_style_num) > 0)
|
||||
{
|
||||
return link_format_map_.at(oox_style_num);
|
||||
}
|
||||
@ -101,7 +108,7 @@ std::wstring odf_lists_styles_context::get_style_name(int oox_style_num)
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
void odf_lists_styles_context::start_style(int based_number)
|
||||
void odf_lists_styles_context::start_style(bool bMaster, int based_number)
|
||||
{
|
||||
list_format_state state;
|
||||
|
||||
@ -109,21 +116,29 @@ void odf_lists_styles_context::start_style(int based_number)
|
||||
create_element(L"text", L"list-style", elm, odf_context_);
|
||||
state.elements.push_back(elm);
|
||||
|
||||
state.oox_based_number = based_number;
|
||||
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(based_number + 1);
|
||||
if (based_number < 0)
|
||||
{
|
||||
state.oox_based_number = lists_format_array_.size();
|
||||
state.odf_list_style_name = std::wstring(L"L") + boost::lexical_cast<std::wstring>(state.oox_based_number + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
state.oox_based_number = based_number;
|
||||
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(state.oox_based_number + 1);
|
||||
}
|
||||
state.automatic = !bMaster;
|
||||
|
||||
text_list_style *style = dynamic_cast<text_list_style *>(elm.get());
|
||||
if (style == NULL)return;
|
||||
|
||||
style->text_list_style_attr_.style_name_ = state.odf_list_style_name;
|
||||
|
||||
lists_format_array_.push_back(state); //перенести в end??
|
||||
}
|
||||
|
||||
style_list_level_properties * odf_lists_styles_context::get_list_level_properties()
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return NULL;
|
||||
if (lists_format_array_.back().elements.size() <1) return NULL;
|
||||
if (lists_format_array_.empty()) return NULL;
|
||||
if (lists_format_array_.back().elements.empty()) return NULL;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
@ -156,8 +171,8 @@ style_list_level_properties * odf_lists_styles_context::get_list_level_propertie
|
||||
}
|
||||
style_text_properties * odf_lists_styles_context::get_text_properties()
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return NULL;
|
||||
if (lists_format_array_.back().elements.size() <1) return NULL;
|
||||
if (lists_format_array_.empty()) return NULL;
|
||||
if (lists_format_array_.back().elements.empty()) return NULL;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
@ -167,14 +182,14 @@ style_text_properties * odf_lists_styles_context::get_text_properties()
|
||||
if (style_number_)
|
||||
{
|
||||
if (!style_number_->style_text_properties_)
|
||||
create_element(L"style", L"text-properties",style_number_->style_text_properties_,odf_context_);
|
||||
create_element(L"style", L"text-properties", style_number_->style_text_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_text_properties *>(style_number_->style_text_properties_.get());
|
||||
}
|
||||
if (style_bullet_)
|
||||
{
|
||||
if (!style_bullet_->style_text_properties_)
|
||||
create_element(L"style", L"text-properties",style_bullet_->style_text_properties_,odf_context_);
|
||||
create_element(L"style", L"text-properties", style_bullet_->style_text_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_text_properties *>(style_bullet_->style_text_properties_.get());
|
||||
}
|
||||
@ -190,8 +205,8 @@ style_text_properties * odf_lists_styles_context::get_text_properties()
|
||||
|
||||
style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alignment_properties()
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return NULL;
|
||||
if (lists_format_array_.back().elements.size() <1) return NULL;
|
||||
if (lists_format_array_.empty()) return NULL;
|
||||
if (lists_format_array_.back().elements.empty()) return NULL;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
@ -201,21 +216,21 @@ style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alig
|
||||
if (style_number_)
|
||||
{
|
||||
if (!style_number_->style_list_level_properties_)
|
||||
create_element(L"style", L"list-level-properties",style_number_->style_list_level_properties_,odf_context_);
|
||||
create_element(L"style", L"list-level-properties", style_number_->style_list_level_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_list_level_properties *>(style_number_->style_list_level_properties_.get());
|
||||
}
|
||||
if (style_bullet_)
|
||||
{
|
||||
if (!style_bullet_->style_list_level_properties_)
|
||||
create_element(L"style", L"list-level-properties",style_bullet_->style_list_level_properties_,odf_context_);
|
||||
create_element(L"style", L"list-level-properties", style_bullet_->style_list_level_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_list_level_properties *>(style_bullet_->style_list_level_properties_.get());
|
||||
}
|
||||
if (style_image_)
|
||||
{
|
||||
if (!style_image_->style_list_level_properties_)
|
||||
create_element(L"style", L"list-level-properties",style_image_->style_list_level_properties_,odf_context_);
|
||||
create_element(L"style", L"list-level-properties", style_image_->style_list_level_properties_, odf_context_);
|
||||
|
||||
props = dynamic_cast<style_list_level_properties *>(style_image_->style_list_level_properties_.get());
|
||||
}
|
||||
@ -223,14 +238,15 @@ style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alig
|
||||
|
||||
if (!props->style_list_level_label_alignment_)
|
||||
{
|
||||
create_element(L"style", L"list-level-label-alignment" ,props->style_list_level_label_alignment_,odf_context_);
|
||||
create_element(L"style", L"list-level-label-alignment" , props->style_list_level_label_alignment_, odf_context_);
|
||||
}
|
||||
return dynamic_cast<style_list_level_label_alignment *>(props->style_list_level_label_alignment_.get());
|
||||
}
|
||||
|
||||
int odf_lists_styles_context::start_style_level(int level, int type)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return -1;
|
||||
if (lists_format_array_.empty()) return -1;
|
||||
|
||||
int odf_type =1;
|
||||
int format_type = -1;
|
||||
|
||||
@ -451,10 +467,10 @@ wchar_t convert_bullet_char(wchar_t c)
|
||||
}
|
||||
void odf_lists_styles_context::set_numeric_format(std::wstring val)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if ( val.length() <1 )
|
||||
return;
|
||||
if ( lists_format_array_.empty() ) return;
|
||||
if ( lists_format_array_.back().elements.empty() ) return;
|
||||
|
||||
if ( val.empty() ) return;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
if (style_number_)
|
||||
@ -522,10 +538,10 @@ void odf_lists_styles_context::set_numeric_format(std::wstring val)
|
||||
}
|
||||
void odf_lists_styles_context::set_bullet_char(std::wstring val)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if ( val.length() <1 )
|
||||
return;
|
||||
if ( lists_format_array_.empty() ) return;
|
||||
if ( lists_format_array_.back().elements.empty() ) return ;
|
||||
|
||||
if ( val.empty() ) return;
|
||||
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
|
||||
@ -536,20 +552,20 @@ void odf_lists_styles_context::set_bullet_char(std::wstring val)
|
||||
void odf_lists_styles_context::set_bullet_image_size(double size)
|
||||
{
|
||||
if (size < 0.1) return;
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if (lists_format_array_.empty()) return;
|
||||
if (lists_format_array_.back().elements.empty()) return ;
|
||||
|
||||
style_list_level_properties *props = get_list_level_properties();
|
||||
|
||||
if(!props) return;
|
||||
|
||||
props->fo_width_ = length(length(size,length::pt).get_value_unit(length::cm),length::cm);
|
||||
props->fo_height_ = length(length(size,length::pt).get_value_unit(length::cm),length::cm);
|
||||
props->fo_width_ = length(length(size, length::pt).get_value_unit(length::cm), length::cm);
|
||||
props->fo_height_ = length(length(size, length::pt).get_value_unit(length::cm), length::cm);
|
||||
}
|
||||
void odf_lists_styles_context::set_bullet_image (std::wstring ref)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if (lists_format_array_.empty()) return;
|
||||
if (lists_format_array_.back().elements.empty()) return ;
|
||||
|
||||
text_list_level_style_image *style_image_ = dynamic_cast<text_list_level_style_image *>(lists_format_array_.back().elements.back().get());
|
||||
|
||||
@ -557,14 +573,14 @@ void odf_lists_styles_context::set_bullet_image (std::wstring ref)
|
||||
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.href_ = ref;
|
||||
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.type_= xlink_type::Simple;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
|
||||
}
|
||||
void odf_lists_styles_context::set_start_number(int val)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if (lists_format_array_.empty()) return;
|
||||
if (lists_format_array_.back().elements.empty()) return ;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
|
||||
@ -574,8 +590,8 @@ void odf_lists_styles_context::set_start_number(int val)
|
||||
}
|
||||
void odf_lists_styles_context::set_text_style_name(std::wstring name)
|
||||
{
|
||||
if (lists_format_array_.size() < 1) return;
|
||||
if (lists_format_array_.back().elements.size() <1) return ;
|
||||
if (lists_format_array_.empty()) return;
|
||||
if (lists_format_array_.back().elements.empty()) return ;
|
||||
|
||||
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
|
||||
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
|
||||
|
||||
@ -55,7 +55,7 @@ struct list_format_state
|
||||
std::vector<office_element_ptr> elements;
|
||||
|
||||
std::wstring odf_list_style_name;
|
||||
|
||||
bool automatic;
|
||||
};
|
||||
|
||||
class odf_lists_styles_context
|
||||
@ -64,7 +64,7 @@ public:
|
||||
odf_lists_styles_context();
|
||||
void set_odf_context(odf_conversion_context * Context);
|
||||
|
||||
void start_style(int abstract_number);
|
||||
void start_style(bool bMaster, int abstract_number = -1);
|
||||
int start_style_level(int level, int type);
|
||||
style_list_level_properties * get_list_level_properties();
|
||||
style_list_level_label_alignment * get_list_level_alignment_properties();
|
||||
@ -84,9 +84,9 @@ public:
|
||||
|
||||
void add_style(int oox_style_num, int oox_based_num);
|
||||
|
||||
void process_styles(office_element_ptr root );
|
||||
void process_styles(office_element_ptr root, bool automatic);
|
||||
|
||||
std::wstring get_style_name(int oox_style_num);
|
||||
std::wstring get_style_name(int oox_style_num = -1);
|
||||
std::wstring get_style_name1(int oox_style_num);
|
||||
private:
|
||||
std::vector<list_format_state> lists_format_array_;
|
||||
|
||||
@ -161,6 +161,7 @@ void odf_style_context::process_automatic_styles(office_element_ptr root )
|
||||
if (/*it->automatic_== true && */style_state_list_[i]->root_== false && style_state_list_[i]->odf_style_)
|
||||
root->add_child_element(style_state_list_[i]->odf_style_);
|
||||
}
|
||||
lists_styles_context_.process_styles(root, true);
|
||||
}
|
||||
|
||||
void odf_style_context::process_office_styles(office_element_ptr root )
|
||||
@ -175,7 +176,7 @@ void odf_style_context::process_office_styles(office_element_ptr root )
|
||||
root->add_child_element(style_state_list_[i]->odf_style_);
|
||||
}
|
||||
|
||||
lists_styles_context_.process_styles(root );
|
||||
lists_styles_context_.process_styles(root, false);
|
||||
}
|
||||
std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_family::type family, bool root, bool automatic)
|
||||
{
|
||||
|
||||
@ -154,13 +154,35 @@ void odf_text_context::add_text_content(const std::wstring & text)
|
||||
std::wstring last = text.substr(pos);
|
||||
if (last.length() > 0)current_level_.back().elm->add_text(last);
|
||||
}
|
||||
void odf_text_context::add_text_date(const std::wstring & text)
|
||||
{
|
||||
office_element_ptr s_elm;
|
||||
create_element(L"text", L"date", s_elm, odf_context_);
|
||||
|
||||
text_date* s = dynamic_cast<text_date*>(s_elm.get());
|
||||
if (s) s->add_text(text);
|
||||
|
||||
if (current_level_.size()>0)
|
||||
current_level_.back().elm->add_child_element(s_elm);
|
||||
}
|
||||
void odf_text_context::add_text_page_number(const std::wstring & text)
|
||||
{
|
||||
office_element_ptr s_elm;
|
||||
create_element(L"text", L"page-number", s_elm, odf_context_);
|
||||
|
||||
text_page_number* s = dynamic_cast<text_page_number*>(s_elm.get());
|
||||
if (s) s->add_text(text);
|
||||
|
||||
if (current_level_.size()>0)
|
||||
current_level_.back().elm->add_child_element(s_elm);
|
||||
}
|
||||
void odf_text_context::add_text_space(int count)
|
||||
{
|
||||
office_element_ptr s_elm;
|
||||
create_element(L"text", L"s", s_elm, odf_context_);
|
||||
|
||||
text_s* s = dynamic_cast<text_s*>(s_elm.get());
|
||||
if (s)s->text_c_ = count;
|
||||
if (s) s->text_c_ = count;
|
||||
|
||||
//необязательно хранить..
|
||||
//int level = current_level_.size();
|
||||
|
||||
@ -67,8 +67,10 @@ public:
|
||||
|
||||
void add_text_content (const std::wstring & text);
|
||||
void add_text_space (int count);
|
||||
|
||||
void set_symbol_font (const std::wstring & font);
|
||||
void add_text_date (const std::wstring & text);
|
||||
void add_text_page_number(const std::wstring & text);
|
||||
|
||||
void set_symbol_font (const std::wstring & font);
|
||||
void set_symbol_text (int sym);
|
||||
|
||||
void start_paragraph (bool styled = false);
|
||||
|
||||
@ -56,7 +56,26 @@ odp_conversion_context::odp_conversion_context(package::odf_document * outputDoc
|
||||
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this), text_context_(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
odf_text_context* odp_conversion_context::text_context()
|
||||
{
|
||||
return text_context_;
|
||||
}
|
||||
odp_slide_context* odp_conversion_context::slide_context()
|
||||
{
|
||||
return &slide_context_;
|
||||
}
|
||||
odf_drawing_context* odp_conversion_context::drawing_context()
|
||||
{
|
||||
if (slide_context_.page_state_list_.empty()) return NULL;
|
||||
|
||||
return slide_context_.state().drawing_context();
|
||||
}
|
||||
odf_comment_context* odp_conversion_context::comment_context()
|
||||
{
|
||||
if (slide_context_.page_state_list_.empty()) return NULL;
|
||||
|
||||
return slide_context_.state().comment_context();
|
||||
}
|
||||
|
||||
void odp_conversion_context::start_document()
|
||||
{
|
||||
@ -128,13 +147,41 @@ void odp_conversion_context::end_drawings()
|
||||
{
|
||||
current_slide().drawing_context()->clear();
|
||||
}
|
||||
void odp_conversion_context::start_image(const std::wstring & image_file_name)
|
||||
{
|
||||
std::wstring odf_ref_name ;
|
||||
|
||||
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
|
||||
|
||||
current_slide().drawing_context()->start_image(odf_ref_name);
|
||||
}
|
||||
void odp_conversion_context::start_comment(int oox_comm_id)
|
||||
{
|
||||
office_element_ptr comm_elm;
|
||||
create_element(L"office", L"annotation", comm_elm, this);
|
||||
|
||||
current_slide().comment_context()->start_comment(comm_elm, oox_comm_id);
|
||||
|
||||
current_slide().drawing_context()->start_drawing();
|
||||
current_slide().drawing_context()->start_element(comm_elm);
|
||||
}
|
||||
void odp_conversion_context::start_comment_content()
|
||||
{
|
||||
current_slide().comment_context()->start_comment_content();
|
||||
|
||||
office_element_ptr & root_comm_element = current_slide().drawing_context()->get_current_element();
|
||||
start_text_context();
|
||||
|
||||
text_context()->start_element(root_comm_element);
|
||||
text_context()->start_paragraph();
|
||||
}
|
||||
void odp_conversion_context::end_comment_content()
|
||||
{
|
||||
text_context()->end_paragraph();
|
||||
|
||||
current_slide().comment_context()->end_comment_content();
|
||||
|
||||
text_context()->end_element();
|
||||
end_text_context();
|
||||
}
|
||||
void odp_conversion_context::end_comment()
|
||||
{
|
||||
current_slide().drawing_context()->end_element();
|
||||
current_slide().drawing_context()->end_drawing();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,14 +64,18 @@ public:
|
||||
virtual void start_text_context();
|
||||
virtual void end_text_context();
|
||||
|
||||
virtual odf_drawing_context * drawing_context() {return current_slide().drawing_context();}
|
||||
virtual odf_text_context * text_context() {return text_context_; }
|
||||
odp_slide_context * slide_context() {return &slide_context_;}
|
||||
virtual odf_drawing_context * drawing_context();
|
||||
virtual odf_text_context * text_context();
|
||||
odp_slide_context * slide_context();
|
||||
odf_comment_context * comment_context();
|
||||
|
||||
void start_drawings();
|
||||
void end_drawings();
|
||||
|
||||
virtual void start_image(const std::wstring & image_file_name);
|
||||
void start_comment (int oox_comment_id);
|
||||
void end_comment ();
|
||||
void start_comment_content ();
|
||||
void end_comment_content ();
|
||||
|
||||
private:
|
||||
odp_slide_context slide_context_;
|
||||
|
||||
@ -58,7 +58,7 @@ namespace odf_writer {
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_ptr & elm)
|
||||
: context_(Context), drawing_context_(Context)
|
||||
: context_(Context), drawing_context_(Context), comment_context_(Context)
|
||||
{
|
||||
page_elm_ = elm;
|
||||
|
||||
|
||||
@ -40,11 +40,11 @@
|
||||
#include"../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
#include "odf_drawing_context.h"
|
||||
#include "odf_comment_context.h"
|
||||
|
||||
#include "office_elements_create.h"
|
||||
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_types
|
||||
@ -57,7 +57,6 @@ namespace odf_writer {
|
||||
class odp_conversion_context;
|
||||
class odf_text_context;
|
||||
|
||||
//class table_table;
|
||||
class style;
|
||||
|
||||
|
||||
@ -85,6 +84,7 @@ public:
|
||||
|
||||
///////////////////////////////
|
||||
odf_drawing_context * drawing_context(){return &drawing_context_;}
|
||||
odf_comment_context * comment_context(){return &comment_context_;}
|
||||
|
||||
std::wstring office_page_name_;
|
||||
office_element_ptr page_elm_;
|
||||
@ -94,6 +94,7 @@ private:
|
||||
odf_conversion_context * context_;
|
||||
|
||||
odf_drawing_context drawing_context_;
|
||||
odf_comment_context comment_context_;
|
||||
|
||||
friend class odp_slide_context;
|
||||
|
||||
|
||||
@ -58,7 +58,6 @@ public:
|
||||
|
||||
odp_page_state & state();
|
||||
|
||||
odf_comment_context * comment_context();
|
||||
odf_table_context * table_context();
|
||||
|
||||
void start_table ();
|
||||
|
||||
@ -238,11 +238,11 @@ void ods_conversion_context::end_row()
|
||||
//////////////////////
|
||||
void ods_conversion_context::start_comment(int col, int row, std::wstring & author)
|
||||
{
|
||||
current_table().start_comment(col,row,author);
|
||||
current_table().start_comment(col, row, author);
|
||||
start_text_context();
|
||||
////////////////
|
||||
office_element_ptr paragr_elm;
|
||||
create_element(L"text", L"p",paragr_elm,this);
|
||||
create_element(L"text", L"p", paragr_elm, this);
|
||||
|
||||
current_text_context_->start_paragraph(paragr_elm);
|
||||
}
|
||||
@ -309,7 +309,7 @@ void ods_conversion_context::add_merge_cells(const std::wstring & ref)
|
||||
|
||||
void ods_conversion_context::start_cell(std::wstring & ref, int xfd_style)
|
||||
{
|
||||
int col=0, row=0;
|
||||
int col = 0, row = 0;
|
||||
utils::parsing_ref ( ref, col,row);
|
||||
|
||||
if (col > current_table().current_column()+1)
|
||||
@ -389,11 +389,31 @@ void ods_conversion_context::start_rows()
|
||||
void ods_conversion_context::end_rows()
|
||||
{
|
||||
//add default last row
|
||||
int repeat = (std::max)(current_table().dimension_row,64) - current_table().current_row();
|
||||
if (repeat < 0) repeat = 1;
|
||||
int repeated = (std::max)(current_table().dimension_row, 64) - current_table().current_row();
|
||||
if (repeated < 0) repeated = 1;
|
||||
|
||||
start_row(current_table().current_row()+1,repeat,0,true);
|
||||
end_row();
|
||||
while(true)
|
||||
{
|
||||
//делим на 3 - до, с комметом, после;
|
||||
int comment_idx = current_table().is_row_comment(current_table().current_row() + 1, repeated);
|
||||
|
||||
if (comment_idx < 0) break;
|
||||
int rows = current_table().comments_[comment_idx].row - current_table().current_row() - 1;
|
||||
|
||||
start_row(current_table().current_row() + 1, rows, 0, true);
|
||||
end_row();
|
||||
|
||||
start_row(current_table().current_row() + 1, 1, 0, true);
|
||||
end_row();
|
||||
|
||||
repeated -= (1 + rows);
|
||||
}
|
||||
|
||||
if (repeated > 0)
|
||||
{
|
||||
start_row(current_table().current_row() + 1, repeated, 0, true);
|
||||
end_row();
|
||||
}
|
||||
}
|
||||
|
||||
void ods_conversion_context::add_column(int start_column, int repeated, int level, bool _default)
|
||||
@ -507,14 +527,7 @@ void ods_conversion_context::end_drawings()
|
||||
{
|
||||
current_table().drawing_context()->clear();
|
||||
}
|
||||
void ods_conversion_context::start_image(const std::wstring & image_file_name)
|
||||
{
|
||||
std::wstring odf_ref_name ;
|
||||
|
||||
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
|
||||
|
||||
current_table().drawing_context()->start_image(odf_ref_name);
|
||||
}
|
||||
double ods_conversion_context::convert_symbol_width(double val)
|
||||
{
|
||||
//width = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
|
||||
|
||||
@ -101,8 +101,6 @@ public:
|
||||
void start_drawings();
|
||||
void end_drawings();
|
||||
|
||||
virtual void start_image(const std::wstring & image_file_name);
|
||||
|
||||
double convert_symbol_width(double val);
|
||||
|
||||
void add_defined_range (const std::wstring & name, const std::wstring & cell_range, int sheet_id, bool printable = false);
|
||||
|
||||
@ -136,8 +136,8 @@ ods_table_state::ods_table_state(odf_conversion_context * Context, office_elemen
|
||||
{
|
||||
office_table_ = elm;
|
||||
|
||||
current_table_row_ =0;
|
||||
current_table_column_ =0;
|
||||
current_table_row_ = 0;
|
||||
current_table_column_ = 0;
|
||||
|
||||
current_level_.push_back(office_table_);
|
||||
|
||||
@ -395,7 +395,7 @@ bool ods_table_state::is_cell_hyperlink()
|
||||
bool ods_table_state::is_cell_comment()
|
||||
{
|
||||
if (cells_size_ <1)return false;
|
||||
return cells_.back().comment_idx >=0 ? true : false;
|
||||
return cells_.back().comment_idx >= 0 ? true : false;
|
||||
}
|
||||
|
||||
int ods_table_state::is_cell_hyperlink(int col, int row)
|
||||
@ -413,7 +413,18 @@ int ods_table_state::is_cell_comment(int col, int row, short repeate_col)
|
||||
{
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
if ((comments_[i].col < col+repeate_col && comments_[i].col >= col) && comments_[i].row == row)
|
||||
if ((comments_[i].col < col + repeate_col && comments_[i].col >= col) && comments_[i].row == row)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
int ods_table_state::is_row_comment(int row, int repeate_row)
|
||||
{
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
if (comments_[i].row < row + repeate_row && comments_[i].row >= row)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -489,10 +500,10 @@ void ods_table_state::start_cell(office_element_ptr & elm, office_element_ptr &
|
||||
|
||||
state.empty = true;
|
||||
state.elm = elm; state.repeated = 1; state.style_name = style_name; state.style_elm = style_elm;
|
||||
state.row=current_table_row_; state.col =current_table_column_+1;
|
||||
state.row = current_table_row_; state.col =current_table_column_ + 1;
|
||||
|
||||
state.hyperlink_idx = is_cell_hyperlink(state.col, state.row);
|
||||
state.comment_idx = is_cell_comment(state.col, state.row);
|
||||
state.comment_idx = is_cell_comment(state.col, state.row);
|
||||
|
||||
current_table_column_ += state.repeated;
|
||||
cells_.push_back(state);
|
||||
@ -1016,8 +1027,8 @@ void ods_table_state::end_cell()
|
||||
|
||||
void ods_table_state::add_default_cell( short repeated)
|
||||
{
|
||||
int comment_idx = is_cell_comment(current_table_column_+1 , current_table_row_, repeated);
|
||||
if (comment_idx >=0 && repeated >1)
|
||||
int comment_idx = is_cell_comment(current_table_column_ + 1 , current_table_row_, repeated);
|
||||
if (comment_idx >= 0 && repeated > 1)
|
||||
{
|
||||
//делим на 3 - до, с комметом, после;
|
||||
int c = current_table_column_;
|
||||
|
||||
@ -300,6 +300,7 @@ public:
|
||||
int is_cell_hyperlink (int col, int row);
|
||||
bool is_cell_comment ();
|
||||
int is_cell_comment (int col, int row, short repeate_col = 1);
|
||||
int is_row_comment (int row, int repeate_row = 1);
|
||||
|
||||
ods_hyperlink_state & current_hyperlink();
|
||||
|
||||
@ -316,7 +317,8 @@ public:
|
||||
|
||||
odf_drawing_context * drawing_context(){return &drawing_context_;}
|
||||
|
||||
std::wstring office_table_name_;
|
||||
std::wstring office_table_name_;
|
||||
std::vector<ods_comment_state> comments_;
|
||||
private:
|
||||
|
||||
odf_conversion_context * context_;
|
||||
@ -342,9 +344,7 @@ private:
|
||||
std::list<ods_cell_state> cells_;
|
||||
long cells_size_;
|
||||
|
||||
std::vector<ods_hyperlink_state> hyperlinks_;
|
||||
std::vector<ods_comment_state> comments_;
|
||||
|
||||
std::vector<ods_hyperlink_state> hyperlinks_;
|
||||
std::vector<ods_shared_formula_state> shared_formulas_;
|
||||
|
||||
odf_drawing_context drawing_context_;
|
||||
|
||||
@ -915,14 +915,6 @@ void odt_conversion_context::end_change (int id, int type)
|
||||
// return (text_changes_state_.current_types.back() == 2);
|
||||
//}
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void odt_conversion_context::start_image(const std::wstring & image_file_name)
|
||||
{
|
||||
std::wstring odf_ref_name ;
|
||||
|
||||
mediaitems()->add_or_find(image_file_name, _mediaitems::typeImage,odf_ref_name);
|
||||
|
||||
drawing_context()->start_image(odf_ref_name);
|
||||
}
|
||||
|
||||
void odt_conversion_context::start_drop_cap(style_paragraph_properties *paragraph_properties)
|
||||
{
|
||||
|
||||
@ -82,8 +82,7 @@ public:
|
||||
void start_drawings ();
|
||||
void end_drawings ();
|
||||
|
||||
virtual void start_image(const std::wstring & image_file_name);
|
||||
void add_text_content (const std::wstring & text);
|
||||
void add_text_content (const std::wstring & text);
|
||||
|
||||
void start_paragraph (bool styled = false);
|
||||
void end_paragraph ();
|
||||
|
||||
@ -50,6 +50,12 @@
|
||||
namespace cpdoccore
|
||||
{
|
||||
|
||||
oox_shape::oox_shape()
|
||||
{
|
||||
odf_type_name = L"ooxml-non-primitive";
|
||||
view_box = L"0 0 0 0";
|
||||
}
|
||||
|
||||
oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
|
||||
{
|
||||
switch (ooxPrstGeomType)
|
||||
@ -127,7 +133,7 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
|
||||
|
||||
default:
|
||||
if (ooxPrstGeomType > 2000) return boost::make_shared<oox_shape_textPlain>();
|
||||
else return boost::make_shared<oox_shape>();
|
||||
else return oox_shape_ptr();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,8 @@ namespace cpdoccore
|
||||
public:
|
||||
static oox_shape_ptr create(int ooxPrstGeomType);
|
||||
|
||||
oox_shape();
|
||||
|
||||
struct _equation
|
||||
{
|
||||
std::wstring name;
|
||||
@ -66,20 +68,20 @@ namespace cpdoccore
|
||||
|
||||
void add(std::wstring name,std::wstring frmla)
|
||||
{
|
||||
_equation q = {name,frmla};
|
||||
_equation q = {name, frmla};
|
||||
equations.push_back(q);
|
||||
}
|
||||
|
||||
std::vector<_equation> equations;
|
||||
std::vector<_handle> handles;
|
||||
std::vector<_equation> equations;
|
||||
std::vector<_handle> handles;
|
||||
|
||||
std::wstring enhanced_path;
|
||||
std::wstring modifiers;
|
||||
std::wstring text_areas;
|
||||
std::wstring view_box;
|
||||
std::wstring enhanced_path;
|
||||
std::wstring modifiers;
|
||||
std::wstring text_areas;
|
||||
std::wstring view_box;
|
||||
_CP_OPT(std::wstring) sub_view_size;
|
||||
_CP_OPT(std::wstring) glue_points;
|
||||
|
||||
std::wstring odf_type_name;
|
||||
|
||||
_CP_OPT(std::wstring) glue_points;
|
||||
std::wstring odf_type_name;
|
||||
};
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@ -130,6 +130,8 @@ bool OoxConverter::UpdateProgress(long nComplete)
|
||||
|
||||
void OoxConverter::set_fonts_directory(const std::wstring &fontsPath)
|
||||
{
|
||||
if (odf_context() == NULL) return;
|
||||
|
||||
odf_context()->set_fonts_directory(fontsPath);
|
||||
}
|
||||
|
||||
@ -181,6 +183,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
convert(dynamic_cast<PPTX::Logic::CustGeom*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_ahXY:
|
||||
{
|
||||
convert(dynamic_cast<PPTX::Logic::AhXY*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_ahPolar:
|
||||
{
|
||||
convert(dynamic_cast<PPTX::Logic::AhPolar*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_lnTo:
|
||||
{
|
||||
convert(dynamic_cast<PPTX::Logic::LineTo*>(oox_unknown));
|
||||
|
||||
@ -263,6 +263,7 @@ namespace PPTX
|
||||
class Theme;
|
||||
namespace Logic
|
||||
{
|
||||
class Bullet;
|
||||
class ClrMap;
|
||||
class SpTreeElem;
|
||||
class GraphicFrame;
|
||||
@ -322,6 +323,8 @@ namespace PPTX
|
||||
class InnerShdw;
|
||||
class OuterShdw;
|
||||
class PrstShdw;
|
||||
class AhXY;
|
||||
class AhPolar;
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,6 +365,7 @@ public:
|
||||
|
||||
void convert (double oox_font_size, _CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size);
|
||||
bool convert (std::wstring sSchemeColor, DWORD & argb);
|
||||
void convert_font(PPTX::Theme *theme, std::wstring & font);
|
||||
//.......................................................................................................................
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
//drawingML & pptx................................................................................................................................
|
||||
@ -390,6 +394,7 @@ public:
|
||||
void convert(PPTX::Logic::PathBase *oox_path);
|
||||
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
|
||||
void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0);
|
||||
void convert(PPTX::Logic::UniColor *color, DWORD & nARGB);
|
||||
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
|
||||
void convert(PPTX::Logic::NvSpPr *oox_nvSpPr);
|
||||
void convert(PPTX::Logic::CNvPr *oox_cnvPr);
|
||||
@ -399,10 +404,16 @@ public:
|
||||
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
|
||||
void convert(PPTX::Logic::NvGrpSpPr *oox_nvSpPr);
|
||||
void convert(PPTX::Logic::NvPr *oox_nvPr);
|
||||
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
|
||||
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
|
||||
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
|
||||
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties * text_properties);
|
||||
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
|
||||
void convert(PPTX::Logic::TextListStyle *oox_list_style);
|
||||
|
||||
void convert_list_level (PPTX::Logic::TextParagraphPr *oox_para_props, int level);
|
||||
|
||||
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
|
||||
cpdoccore::odf_writer::style_text_properties *text_properties);
|
||||
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
|
||||
cpdoccore::odf_writer::style_text_properties *text_properties);
|
||||
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties *text_properties);
|
||||
void convert(PPTX::Logic::Run *oox_run);
|
||||
void convert(PPTX::Logic::Fld *oox_fld);
|
||||
void convert(PPTX::Logic::Br *oox_br);
|
||||
@ -417,6 +428,8 @@ public:
|
||||
void convert(PPTX::Logic::QuadBezTo *oox_geom_path);
|
||||
void convert(PPTX::Logic::CubicBezTo *oox_geom_path);
|
||||
void convert(PPTX::Logic::Close *oox_geom_path);
|
||||
void convert(PPTX::Logic::AhXY *oox_handle);
|
||||
void convert(PPTX::Logic::AhPolar *oox_handle);
|
||||
void convert(PPTX::Logic::EffectStyle *oox_effect);
|
||||
void convert(PPTX::Logic::EffectLst *oox_effect_list);
|
||||
void convert(PPTX::Logic::InnerShdw *oox_effect);
|
||||
|
||||
@ -3017,7 +3017,7 @@ void DocxConverter::convert(OOX::Numbering::CAbstractNum* oox_num_style)
|
||||
if (oox_num_style->m_oAbstractNumId.IsInit() == false) return;
|
||||
|
||||
|
||||
odt_context->styles_context()->lists_styles().start_style(oox_num_style->m_oAbstractNumId->GetValue());
|
||||
odt_context->styles_context()->lists_styles().start_style(false, oox_num_style->m_oAbstractNumId->GetValue());
|
||||
//// Childs
|
||||
//std::vector<OOX::Numbering::CLvl > m_arrLvl;
|
||||
//nullable<ComplexTypes::Word::CMultiLevelType > m_oMultiLevelType;
|
||||
@ -3049,7 +3049,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
int type_list = odt_context->styles_context()->lists_styles().start_style_level(oox_num_lvl->m_oIlvl->GetValue(), oox_type_list );
|
||||
if (type_list < 0) return;
|
||||
|
||||
odf_writer::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
|
||||
odf_writer::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
|
||||
odf_writer::style_list_level_label_alignment * aligment_props = odt_context->styles_context()->lists_styles().get_list_level_alignment_properties();
|
||||
|
||||
if (level_props == NULL)return;
|
||||
@ -3101,8 +3101,8 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
}
|
||||
}else
|
||||
{
|
||||
aligment_props->fo_text_indent_ = odf_types::length(0,odf_types::length::cm);
|
||||
aligment_props->fo_margin_left_ = odf_types::length(0,odf_types::length::cm);
|
||||
aligment_props->fo_text_indent_ = odf_types::length(0, odf_types::length::cm);
|
||||
aligment_props->fo_margin_left_ = odf_types::length(0, odf_types::length::cm);
|
||||
|
||||
}
|
||||
}
|
||||
@ -3114,7 +3114,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
convert(oox_num_lvl->m_oRPr.GetPointer(), text_props);
|
||||
|
||||
//create text style for symbols list НА ЛОКАЛЬНОМ контексте - иначе пересечение имен стилей (todoo вытащить генерацию имен в общую часть)
|
||||
styles_context->create_style(L"",odf_types::style_family::Text, false, true, -1);
|
||||
styles_context->create_style(L"", odf_types::style_family::Text, false, true, -1);
|
||||
odf_writer::odf_style_state_ptr style_state = styles_context->last_state(odf_types::style_family::Text);
|
||||
if (style_state)
|
||||
{
|
||||
@ -3184,7 +3184,9 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
|
||||
}
|
||||
if (type_list == 2 || type_list == 3)
|
||||
{
|
||||
odt_context->styles_context()->lists_styles().set_bullet_image_size(size_bullet_number_marker);
|
||||
}
|
||||
|
||||
if (oox_num_lvl->m_oLvlRestart.IsInit() && oox_num_lvl->m_oLvlRestart->m_oVal.IsInit() && type_list == 1)
|
||||
{
|
||||
@ -3392,7 +3394,7 @@ void DocxConverter::convert(OOX::Logic::CCommentRangeStart* oox_comm_start)
|
||||
|
||||
bool added = odt_context->start_comment(oox_comm_id);
|
||||
|
||||
if (added==false)
|
||||
if (added == false)
|
||||
{
|
||||
convert_comment(oox_comm_id);
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Folder.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Presentation.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Slide.h"
|
||||
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
@ -59,7 +60,18 @@ namespace Oox2Odf
|
||||
{
|
||||
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
|
||||
{
|
||||
const OOX::CPath oox_path(std::wstring(path.c_str()));
|
||||
current_clrMap = NULL;
|
||||
current_slide = NULL;
|
||||
current_theme = NULL;
|
||||
current_tableStyles = NULL;
|
||||
|
||||
presentation = NULL;
|
||||
output_document = NULL;
|
||||
odp_context = NULL;
|
||||
|
||||
pCallBack = CallBack;
|
||||
|
||||
const OOX::CPath oox_path(std::wstring(path.c_str()));
|
||||
|
||||
pptx_document = new PPTX::Folder();
|
||||
if (!pptx_document->isValid(oox_path.GetPath())) // true ???
|
||||
@ -81,13 +93,6 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
|
||||
output_document = new odf_writer::package::odf_document(L"presentation");
|
||||
odp_context = new odf_writer::odp_conversion_context(output_document);
|
||||
|
||||
current_clrMap = NULL;
|
||||
current_slide = NULL;
|
||||
current_theme = NULL;
|
||||
current_tableStyles = NULL;
|
||||
|
||||
pCallBack = CallBack;
|
||||
|
||||
if (UpdateProgress(290000))return;
|
||||
}
|
||||
PptxConverter::~PptxConverter()
|
||||
@ -218,21 +223,20 @@ void PptxConverter::convert_styles()
|
||||
odf_writer::style_paragraph_properties * paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
|
||||
odf_writer::style_text_properties * text_properties = odp_context->styles_context()->last_state()->get_text_properties();
|
||||
|
||||
if (text_properties)
|
||||
if (presentation->defaultTextStyle.IsInit())
|
||||
{
|
||||
text_properties->content_.fo_font_size_ = odf_types::font_size(odf_types::length(18, odf_types::length::pt));
|
||||
}
|
||||
|
||||
if (slide->theme.IsInit() && text_properties)
|
||||
{
|
||||
if (slide->theme->themeElements.fontScheme.majorFont.latin.typeface.empty() == false)
|
||||
text_properties->content_.fo_font_family_ = slide->theme->themeElements.fontScheme.majorFont.latin.typeface;
|
||||
|
||||
if (slide->theme->themeElements.fontScheme.majorFont.cs.typeface.empty() == false)
|
||||
text_properties->content_.style_font_family_complex_ = slide->theme->themeElements.fontScheme.majorFont.cs.typeface;
|
||||
OoxConverter::convert(presentation->defaultTextStyle->levels[9].GetPointer(), paragraph_properties, text_properties); //defPPr
|
||||
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
|
||||
|
||||
if (slide->theme->themeElements.fontScheme.majorFont.ea.typeface.empty() == false)
|
||||
text_properties->content_.style_font_family_asian_ = slide->theme->themeElements.fontScheme.majorFont.ea.typeface;
|
||||
odp_context->styles_context()->create_default_style(odf_types::style_family::Paragraph);
|
||||
paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
|
||||
|
||||
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
|
||||
|
||||
odp_context->styles_context()->create_default_style(odf_types::style_family::Text);
|
||||
text_properties = odp_context->styles_context()->last_state()->get_text_properties();
|
||||
|
||||
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
|
||||
}
|
||||
//convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков
|
||||
|
||||
@ -259,6 +263,8 @@ void PptxConverter::convert_styles()
|
||||
odp_context->page_layout_context()->create_layer_sets();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PptxConverter::convert_settings()
|
||||
{
|
||||
|
||||
@ -294,24 +300,38 @@ void PptxConverter::convert_slides()
|
||||
{
|
||||
continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx
|
||||
}
|
||||
|
||||
current_theme = slide->theme.operator->();
|
||||
current_clrMap = NULL;
|
||||
|
||||
std::wstring master_style_name;
|
||||
std::wstring layout_style_name;
|
||||
|
||||
bool bShow = slide->show.get_value_or(true);
|
||||
bool bShowMasterAnim = slide->showMasterPhAnim.get_value_or(true);
|
||||
bool bShowMasterSp = slide->showMasterSp.get_value_or(true);
|
||||
|
||||
PPTX::Logic::TxStyles* current_txStyles = NULL;
|
||||
if (slide->Master.IsInit())
|
||||
{
|
||||
current_clrMap = &slide->Master->clrMap;
|
||||
current_clrMap = &slide->Master->clrMap;
|
||||
current_txStyles = slide->Master->txStyles.GetPointer();
|
||||
|
||||
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename);
|
||||
std::wstring master_name = (bShowMasterSp ? slide->Master->m_sOutputFilename : L"") + slide->Layout->m_sOutputFilename;
|
||||
|
||||
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(master_name);
|
||||
if (pFind == m_mapMasters.end())
|
||||
{
|
||||
master_style_name = L"MasterPage";
|
||||
|
||||
bool bShowLayoutMasterAnim = slide->Layout->showMasterPhAnim.get_value_or(true);
|
||||
bool bShowLayoutMasterSp = slide->Layout->showMasterSp.get_value_or(true);
|
||||
|
||||
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get();
|
||||
else if (current_theme->name.IsInit()) master_style_name = current_theme->name.get();
|
||||
|
||||
|
||||
master_style_name += L"_" ;
|
||||
|
||||
if (slide->Layout->cSld.attrName.IsInit()) master_style_name += slide->Layout->cSld.attrName.get();
|
||||
else if (slide->Layout->attrType.IsInit()) master_style_name += slide->Layout->attrType->get();
|
||||
else
|
||||
@ -319,18 +339,23 @@ void PptxConverter::convert_slides()
|
||||
|
||||
odp_context->start_master_slide(master_style_name);
|
||||
convert_common();
|
||||
//if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
|
||||
{
|
||||
current_slide = slide->Master.operator->();
|
||||
convert_slide(&slide->Master->cSld, false);
|
||||
}
|
||||
|
||||
current_slide = slide->Master.operator->();
|
||||
|
||||
if (bShowLayoutMasterSp && bShowMasterSp)
|
||||
convert_slide(&slide->Master->cSld, current_txStyles, false, true);
|
||||
else
|
||||
convert(slide->Master->cSld.bg.GetPointer());
|
||||
|
||||
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
|
||||
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
|
||||
current_slide = slide->Layout.operator->();
|
||||
convert_slide(&slide->Layout->cSld, true);
|
||||
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp);
|
||||
//add note master
|
||||
odp_context->end_master_slide();
|
||||
|
||||
m_mapMasters.insert(std::make_pair(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename, master_style_name));
|
||||
m_mapMasters.insert(std::make_pair(master_name, master_style_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -365,23 +390,22 @@ void PptxConverter::convert_slides()
|
||||
|
||||
odp_context->current_slide().set_master_page (master_style_name);
|
||||
odp_context->current_slide().set_layout_page (layout_style_name);
|
||||
//nullable_bool show;
|
||||
//nullable_bool showMasterPhAnim;
|
||||
//nullable_bool showMasterSp;
|
||||
|
||||
convert_slide(slide->cSld.GetPointer(), true);
|
||||
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp);
|
||||
convert (slide->comments.operator->());
|
||||
convert (slide->Note.operator->());
|
||||
|
||||
convert (slide->timing.GetPointer(), slide->transition.GetPointer());
|
||||
|
||||
|
||||
//nullable<Logic::Transition> transition;
|
||||
//nullable<Logic::Timing> timing;
|
||||
|
||||
//smart_ptr<NotesSlide> Note;
|
||||
|
||||
//smart_ptr<PPTX::Comments> comments;
|
||||
|
||||
odp_context->end_slide();
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::NotesSlide *oox_note)
|
||||
{
|
||||
if (!oox_note) return;
|
||||
}
|
||||
|
||||
void PptxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
if (oox_unknown == NULL)return;
|
||||
@ -394,7 +418,51 @@ void PptxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
}break;
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Comments *oox_comments)
|
||||
{
|
||||
if (!oox_comments) return;
|
||||
|
||||
for (size_t i = 0; i < oox_comments->m_arComments.size(); i++)
|
||||
{
|
||||
PPTX::Logic::Comment & oox_comment = oox_comments->m_arComments[i];
|
||||
|
||||
odp_context->start_comment(oox_comment.idx.get_value_or(-1));
|
||||
odp_context->start_comment_content();
|
||||
|
||||
if (oox_comment.pos_x.IsInit() && oox_comment.pos_y.IsInit())
|
||||
odp_context->comment_context()->set_position (*oox_comment.pos_x / 10., *oox_comment.pos_y / 10.); //pt
|
||||
|
||||
if (oox_comment.authorId.IsInit() && presentation->commentAuthors.IsInit())
|
||||
{
|
||||
for (size_t a = 0; a < presentation->commentAuthors->m_arAuthors.size(); a++)
|
||||
{
|
||||
PPTX::Logic::CommentAuthor & autor = presentation->commentAuthors->m_arAuthors[a];
|
||||
|
||||
if (autor.id.IsInit() && autor.id.get() == oox_comment.authorId.get())
|
||||
{
|
||||
odp_context->comment_context()->set_author(autor.name.get_value_or(L""));
|
||||
odp_context->comment_context()->set_initials(autor.initials.get_value_or(L""));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oox_comment.dt.IsInit()) odp_context->comment_context()->set_date(*oox_comment.dt);
|
||||
if (oox_comment.text.IsInit()) odp_context->text_context()->add_text_content(*oox_comment.text);
|
||||
|
||||
odp_context->end_comment_content();
|
||||
odp_context->end_comment();
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition)
|
||||
{
|
||||
if (!oox_timing) return;
|
||||
if (!oox_timing->tnLst.IsInit()) return;
|
||||
|
||||
for (size_t i = 0; i < oox_timing->tnLst->list.size(); i++)
|
||||
{
|
||||
//oox_timing->tnLst[0]
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::TableProperties *oox_table_pr)
|
||||
{
|
||||
if (!oox_table_pr) return;
|
||||
@ -879,18 +947,19 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
|
||||
odp_context->end_drawings();
|
||||
}
|
||||
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholders)
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp)
|
||||
{
|
||||
if (oox_slide == NULL) return;
|
||||
|
||||
if (current_theme && current_clrMap)
|
||||
current_theme->SetColorMap(*current_clrMap);
|
||||
|
||||
|
||||
if (oox_slide->attrName.IsInit())
|
||||
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
|
||||
|
||||
convert(oox_slide->bg.GetPointer());
|
||||
|
||||
bool bMaster = *odf_context()->drawing_context()->get_presentation();
|
||||
|
||||
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
|
||||
{
|
||||
@ -899,20 +968,77 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholde
|
||||
|
||||
if (pShape.IsInit())
|
||||
{
|
||||
pShape->FillLevelUp();
|
||||
if (!bPlaceholders && pShape->nvSpPr.nvPr.ph.is_init())
|
||||
continue;
|
||||
if (pShape->nvSpPr.nvPr.ph.is_init())
|
||||
{
|
||||
if (bFillUp)
|
||||
pShape->FillLevelUp();
|
||||
|
||||
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
|
||||
{
|
||||
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
|
||||
|
||||
PPTX::Logic::Shape update_shape;
|
||||
pShape->Merge(update_shape);
|
||||
//if (!bMaster && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
|
||||
// continue;
|
||||
|
||||
OoxConverter::convert(&update_shape);
|
||||
odf_context()->drawing_context()->set_placeholder_type(ph_type);
|
||||
}
|
||||
else
|
||||
odf_context()->drawing_context()->set_placeholder_type(0);
|
||||
|
||||
if (pShape->nvSpPr.nvPr.ph->idx.IsInit())
|
||||
odf_context()->drawing_context()->set_placeholder_id(pShape->nvSpPr.nvPr.ph->idx.get());
|
||||
|
||||
if (!bPlaceholders)
|
||||
continue;
|
||||
|
||||
PPTX::Logic::TextListStyle * listMasterStyle = NULL;
|
||||
|
||||
if (txStyles)
|
||||
{
|
||||
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
|
||||
if ((type == L"title") || (type == L"ctrTitle"))
|
||||
listMasterStyle = txStyles->titleStyle.GetPointer();
|
||||
else if ((type == L"body") || (type == L"subTitle") || (type == L"obj"))
|
||||
listMasterStyle = txStyles->bodyStyle.GetPointer();
|
||||
else if (type != L"")
|
||||
listMasterStyle = txStyles->otherStyle.GetPointer();
|
||||
}
|
||||
PPTX::Logic::Shape update_shape;
|
||||
|
||||
if (listMasterStyle)
|
||||
{
|
||||
update_shape.txBody = new PPTX::Logic::TxBody();
|
||||
|
||||
PPTX::Logic::TextListStyle *newListStyle = new PPTX::Logic::TextListStyle();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if(listMasterStyle->levels[i].is_init())
|
||||
listMasterStyle->levels[i]->Merge(newListStyle->levels[i]);
|
||||
}
|
||||
update_shape.txBody->lstStyle.reset(newListStyle);
|
||||
}
|
||||
pShape->Merge(update_shape);
|
||||
OoxConverter::convert(&update_shape);
|
||||
}
|
||||
else if (pShape->txBody.IsInit() && presentation->defaultTextStyle.IsInit())
|
||||
{//default text style with master clrScheme
|
||||
PPTX::Logic::Shape update_shape;
|
||||
|
||||
update_shape.txBody = new PPTX::Logic::TxBody();
|
||||
|
||||
presentation->defaultTextStyle->Merge(update_shape.txBody->lstStyle);
|
||||
|
||||
pShape->Merge(update_shape);
|
||||
OoxConverter::convert(&update_shape);
|
||||
}
|
||||
else
|
||||
OoxConverter::convert(pShape.operator->());
|
||||
}
|
||||
else
|
||||
{
|
||||
OoxConverter::convert(pElem.operator->());
|
||||
}
|
||||
//convert(oox_slide->spTree.SpTreeElems[i].GetElem().operator->());
|
||||
}
|
||||
convert(oox_slide->controls.GetPointer());
|
||||
}
|
||||
@ -940,7 +1066,11 @@ void PptxConverter::convert_layout(PPTX::Logic::CSld *oox_slide)
|
||||
odf_context()->drawing_context()->start_drawing();
|
||||
odf_context()->drawing_context()->start_element(elm);
|
||||
|
||||
OoxConverter::convert(&pShape->nvSpPr.nvPr);
|
||||
odf_context()->drawing_context()->set_placeholder_type(type);
|
||||
|
||||
if (pShape->nvSpPr.nvPr.ph->idx.IsInit())
|
||||
odf_context()->drawing_context()->set_placeholder_id(*pShape->nvSpPr.nvPr.ph->idx);
|
||||
|
||||
OoxConverter::convert(pShape->spPr.xfrm.GetPointer());
|
||||
|
||||
odf_context()->drawing_context()->end_element();
|
||||
|
||||
@ -47,7 +47,9 @@ namespace OOX
|
||||
namespace PPTX
|
||||
{
|
||||
class TableStyles;
|
||||
class NotesSlide;
|
||||
class Presentation;
|
||||
class Comments;
|
||||
class Folder;
|
||||
|
||||
namespace Logic
|
||||
@ -63,6 +65,7 @@ namespace PPTX
|
||||
class TableCell;
|
||||
class TableCellProperties;
|
||||
class TcBdr;
|
||||
class TxStyles;
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,10 +106,13 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, bool bPlaceholders = true);
|
||||
void convert_layout (PPTX::Logic::CSld *oox_slide);
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp);
|
||||
void convert_layout (PPTX::Logic::CSld *oox_slide);
|
||||
void convert (PPTX::Comments *oox_comments);
|
||||
void convert (PPTX::NotesSlide *oox_note);
|
||||
|
||||
void convert(PPTX::Logic::Bg *oox_background);
|
||||
void convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition);
|
||||
|
||||
void convert(PPTX::Logic::Table *oox_table);
|
||||
void convert(PPTX::Logic::TableRow *oox_table_row);
|
||||
|
||||
@ -1748,236 +1748,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_po
|
||||
if (oox_from_to->m_oColOff.IsInit()) pos->col_off = oox_from_to->m_oColOff->GetValue();//pt
|
||||
}
|
||||
|
||||
//void XlsxConverter::convert(OOX::Spreadsheet::CGroupShape* oox_group_shape)
|
||||
//{
|
||||
// if (!oox_group_shape)return;
|
||||
// if (oox_group_shape->m_arrItems.size() < 1) return;
|
||||
//
|
||||
// ods_context->drawing_context()->start_group();
|
||||
//
|
||||
// if (oox_group_shape->m_oNvGroupSpPr.IsInit())
|
||||
// {
|
||||
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr.IsInit())
|
||||
// {
|
||||
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
|
||||
// ods_context->drawing_context()->set_group_name(*oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName);
|
||||
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
|
||||
// ods_context->drawing_context()->set_group_z_order(oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// OoxConverter::convert(oox_group_shape->m_oGroupSpPr.GetPointer());
|
||||
//
|
||||
// for (unsigned int i=0; i < oox_group_shape->m_arrItems.size(); i++)
|
||||
// {
|
||||
// switch(oox_group_shape->m_arrItems[i]->getType())
|
||||
// {
|
||||
// case OOX::et_x_Shape:
|
||||
// {
|
||||
// OOX::Spreadsheet::CShape* item = dynamic_cast<OOX::Spreadsheet::CShape*>(oox_group_shape->m_arrItems[i]);
|
||||
// convert(item);
|
||||
// }break;
|
||||
// case OOX::et_x_ConnShape:
|
||||
// {
|
||||
// OOX::Spreadsheet::CConnShape* item = dynamic_cast<OOX::Spreadsheet::CConnShape*>(oox_group_shape->m_arrItems[i]);
|
||||
// convert(item);
|
||||
// }break;
|
||||
// case OOX::et_x_GroupShape:
|
||||
// {
|
||||
// OOX::Spreadsheet::CGroupShape* item = dynamic_cast<OOX::Spreadsheet::CGroupShape*>(oox_group_shape->m_arrItems[i]);
|
||||
// convert(item);
|
||||
// }break;
|
||||
// case OOX::et_x_Pic:
|
||||
// {
|
||||
// OOX::Spreadsheet::CPic* item = dynamic_cast<OOX::Spreadsheet::CPic*>(oox_group_shape->m_arrItems[i]);
|
||||
// convert(item);
|
||||
// }break;
|
||||
// }
|
||||
// }
|
||||
// ods_context->drawing_context()->end_group();
|
||||
//}
|
||||
//
|
||||
//void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape)
|
||||
//{
|
||||
// if (!oox_shape)return;
|
||||
// if (!oox_shape->m_oSpPr.IsInit()) return;
|
||||
//
|
||||
// ods_context->drawing_context()->start_drawing();
|
||||
//
|
||||
// int type = -1;
|
||||
// if (oox_shape->m_oSpPr->m_oCustGeom.IsInit())
|
||||
// {
|
||||
// type = 1000;//6???
|
||||
// }
|
||||
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
|
||||
// {
|
||||
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
|
||||
// type =(geometry->m_oPrst.GetValue());
|
||||
// }
|
||||
//
|
||||
// if ((oox_shape->m_oNvSpPr.IsInit()) && (oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit()))
|
||||
// {
|
||||
// if (oox_shape->m_oNvSpPr->m_oCNvSpPr->m_otxBox.GetValue() == 1)
|
||||
// type = 2000; //textBox
|
||||
// }
|
||||
//
|
||||
// if (type < 0)return;
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// if (type == 2000) ods_context->drawing_context()->start_text_box();
|
||||
// else ods_context->drawing_context()->start_shape(type);
|
||||
//
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
|
||||
//
|
||||
// if (oox_shape->m_oNvSpPr.IsInit())
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer()); //имя, описалово, номер ...
|
||||
// convert(oox_shape->m_oNvSpPr->m_oCNvSpPr.GetPointer()); //заблокированности ... todooo
|
||||
// }
|
||||
// if (oox_shape->m_oShapeStyle.IsInit())
|
||||
// {
|
||||
// //доп эффекты
|
||||
//
|
||||
// }
|
||||
// if (oox_shape->m_oTxBody.IsInit())
|
||||
// {
|
||||
// ods_context->start_text_context();
|
||||
// OoxConverter::convert(oox_shape->m_oTxBody->m_oBodyPr.GetPointer());
|
||||
//
|
||||
// for (unsigned int i=0 ; i < oox_shape->m_oTxBody->m_arrItems.size();i++)
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oTxBody->m_arrItems[i]);
|
||||
// }
|
||||
// ods_context->drawing_context()->set_text( ods_context->text_context());
|
||||
// ods_context->end_text_context();
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// if (type == 2000)ods_context->drawing_context()->end_text_box();
|
||||
// else ods_context->drawing_context()->end_shape();
|
||||
//
|
||||
// ods_context->drawing_context()->end_drawing();
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void XlsxConverter::convert(OOX::Spreadsheet::CConnShape* oox_shape)
|
||||
//{
|
||||
// if (!oox_shape)return;
|
||||
// if (!oox_shape->m_oSpPr.IsInit()) return;
|
||||
//
|
||||
// ods_context->drawing_context()->start_drawing();
|
||||
//
|
||||
// int type = -1;
|
||||
// if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypeCustom)
|
||||
// {
|
||||
// type = 1000;//?????
|
||||
// }
|
||||
// else if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypePreset)
|
||||
// {
|
||||
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
|
||||
// {
|
||||
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
|
||||
// type = (int)(geometry->m_oPrst.GetValue());
|
||||
// }
|
||||
// }
|
||||
// if (type < 0)return;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ods_context->drawing_context()->start_shape(type);
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
|
||||
//
|
||||
// //частенько приплывает из стиля заполенение объекта .. а он то одномерный :)
|
||||
// odf_context()->drawing_context()->start_area_properties();
|
||||
// odf_context()->drawing_context()->set_no_fill();
|
||||
// odf_context()->drawing_context()->end_area_properties();
|
||||
//
|
||||
// if (oox_shape->m_oNvConnSpPr.IsInit())
|
||||
// {
|
||||
// if (oox_shape->m_oNvConnSpPr->m_oCNvPr.IsInit())
|
||||
// {
|
||||
// OoxConverter::convert(oox_shape->m_oNvConnSpPr->m_oCNvPr.GetPointer());
|
||||
// }
|
||||
//
|
||||
// if (oox_shape->m_oNvConnSpPr->m_oCNvConnSpPr.IsInit())
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
// //avLst
|
||||
// }
|
||||
// ods_context->drawing_context()->end_shape();
|
||||
// ods_context->drawing_context()->end_drawing();
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
|
||||
//{
|
||||
// if (!oox_picture)return;
|
||||
// if (!oox_picture->m_oBlipFill.IsInit()) return; // невeрная структура оох
|
||||
//
|
||||
// ods_context->drawing_context()->start_drawing();
|
||||
//
|
||||
// std::wstring pathImage;
|
||||
// double Width=0, Height = 0;
|
||||
//
|
||||
// if (oox_picture->m_oBlipFill->m_oBlip.IsInit())
|
||||
// {
|
||||
// std::wstring sID = oox_picture->m_oBlipFill->m_oBlip->m_oEmbed.GetValue();
|
||||
// pathImage = find_link_by_id(sID,1);
|
||||
//
|
||||
// if (pathImage.empty())
|
||||
// {
|
||||
// sID = oox_picture->m_oBlipFill->m_oBlip->m_oLink.GetValue();
|
||||
// //???
|
||||
// }
|
||||
// _graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
|
||||
// }
|
||||
// ods_context->start_image(pathImage);
|
||||
// {
|
||||
// if (oox_picture->m_oBlipFill->m_oTile.IsInit())
|
||||
// {
|
||||
// ods_context->drawing_context()->set_image_style_repeat(2);
|
||||
// }
|
||||
// if (oox_picture->m_oBlipFill->m_oStretch.IsInit())
|
||||
// {
|
||||
// ods_context->drawing_context()->set_image_style_repeat(1);
|
||||
// }
|
||||
// if (oox_picture->m_oBlipFill->m_oSrcRect.IsInit() && Width >0 && Height >0)
|
||||
// {
|
||||
// ods_context->drawing_context()->set_image_client_rect_inch(
|
||||
// oox_picture->m_oBlipFill->m_oSrcRect->m_oL.GetValue()/100. * Width / currentSystemDPI ,
|
||||
// oox_picture->m_oBlipFill->m_oSrcRect->m_oT.GetValue()/100. * Height / currentSystemDPI ,
|
||||
// oox_picture->m_oBlipFill->m_oSrcRect->m_oR.GetValue()/100. * Width / currentSystemDPI ,
|
||||
// oox_picture->m_oBlipFill->m_oSrcRect->m_oB.GetValue()/100. * Height / currentSystemDPI );
|
||||
// }
|
||||
// if (oox_picture->m_oNvPicPr.IsInit())
|
||||
// {
|
||||
// OoxConverter::convert(oox_picture->m_oNvPicPr->m_oCNvPr.GetPointer());
|
||||
//
|
||||
// if (oox_picture->m_oNvPicPr->m_oCNvPicPr.IsInit())
|
||||
// {
|
||||
// if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks.IsInit())
|
||||
// {
|
||||
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoChangeAspect)
|
||||
// //{
|
||||
// //}
|
||||
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoCrop))
|
||||
// //{
|
||||
// //}
|
||||
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoResize)
|
||||
// //{
|
||||
// //}
|
||||
// }
|
||||
// //m_oExtLst
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// OoxConverter::convert(oox_picture->m_oSpPr.GetPointer(), oox_picture->m_oShapeStyle.GetPointer());
|
||||
//
|
||||
// }
|
||||
// ods_context->drawing_context()->end_image();
|
||||
// ods_context->drawing_context()->end_drawing();
|
||||
//}
|
||||
//
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt)
|
||||
{
|
||||
if (!oox_cond_fmt)return;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Version="8.00"
|
||||
Name="Oox2OdfConverter"
|
||||
ProjectGUID="{BEE01B53-244A-44E6-8947-ED9342D9247E}"
|
||||
RootNamespace="Oox2OdfConverter"
|
||||
|
||||
@ -912,16 +912,7 @@ HRESULT CDrawingConverter::SetMainDocument(BinDocxRW::CDocxSerializer* pDocument
|
||||
m_pImageManager->m_nDocumentType = XMLWRITER_DOC_TYPE_DOCX;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CDrawingConverter::SetRelsPath(const std::wstring& bsRelsPath)
|
||||
{
|
||||
// чтобы не переоткрывать рельсы - посмотрим - может у нас уже есть такой??
|
||||
m_strCurrentRelsPath = bsRelsPath;
|
||||
return SetCurrentRelsPath();
|
||||
}
|
||||
std::wstring CDrawingConverter::GetRelsPath()
|
||||
{
|
||||
return m_strCurrentRelsPath;
|
||||
}
|
||||
|
||||
HRESULT CDrawingConverter::SetMediaDstPath(const std::wstring& bsMediaPath)
|
||||
{
|
||||
m_pBinaryWriter->m_pCommon->m_pImageManager->m_strDstMedia = (std::wstring)bsMediaPath;
|
||||
@ -1062,9 +1053,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::ObjectFromXml(const std::wstring& sXm
|
||||
XmlUtils::CXmlNode oNodeContent;
|
||||
oChilds.GetAt(0, oNodeContent);
|
||||
|
||||
std::wstring strCurrentRelsPath = m_strCurrentRelsPath;
|
||||
|
||||
if (L"dgm:relIds" == oNodeContent.GetName() && m_pBinaryWriter->m_pCommonRels->is_init())
|
||||
if (L"dgm:relIds" == oNodeContent.GetName() && m_pBinaryWriter->m_pCurrentContainer->is_init())
|
||||
{
|
||||
doc_LoadDiagram(&oElem, oNodeContent, ppMainProps, true);
|
||||
}
|
||||
@ -1597,7 +1586,7 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
|
||||
|
||||
if (id_data.IsInit())
|
||||
{
|
||||
oFileData = (*m_pBinaryWriter->m_pCommonRels)->Find(*id_data);
|
||||
oFileData = (*m_pBinaryWriter->m_pCurrentContainer)->Find(*id_data);
|
||||
|
||||
if (oFileData.is_init())
|
||||
{
|
||||
@ -1616,7 +1605,7 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
|
||||
}
|
||||
if (id_drawing.is_init())
|
||||
{
|
||||
oFileDrawing = (*m_pBinaryWriter->m_pCommonRels)->Find(*id_drawing);
|
||||
oFileDrawing = (*m_pBinaryWriter->m_pCurrentContainer)->Find(*id_drawing);
|
||||
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
|
||||
}
|
||||
if (!pDiagramDrawing && pDiagramData)
|
||||
@ -1641,8 +1630,7 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
|
||||
{
|
||||
result->InitElem(new PPTX::Logic::SpTree(*pDiagramDrawing->m_oShapeTree));
|
||||
//to correct write blipFill rId to binary
|
||||
m_strCurrentRelsPath = pDiagramDrawing->GetReadPath().GetPath();
|
||||
SetCurrentRelsPath();
|
||||
SetRels(pDiagramDrawing);
|
||||
}
|
||||
else
|
||||
{//BG-FSC1.docx
|
||||
@ -2604,10 +2592,10 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
{
|
||||
std::wstring sId = oNodeTextData.GetAttribute(L"id");
|
||||
|
||||
if (sId.length() > 0 && m_pBinaryWriter->m_pCommonRels->IsInit())
|
||||
if (sId.length() > 0 && m_pBinaryWriter->m_pCurrentContainer->IsInit())
|
||||
{
|
||||
OOX::RId rId(sId);
|
||||
smart_ptr<PPTX::LegacyDiagramText> pExt = (*m_pBinaryWriter->m_pCommonRels)->legacyDiagramText(rId);
|
||||
smart_ptr<PPTX::LegacyDiagramText> pExt = (*m_pBinaryWriter->m_pCurrentContainer)->GetLegacyDiagramText(rId);
|
||||
|
||||
if (pExt.IsInit())
|
||||
{
|
||||
@ -5275,27 +5263,19 @@ void CDrawingConverter::Clear()
|
||||
RELEASEOBJECT(pMem);
|
||||
}
|
||||
m_mapShapeTypes.clear();
|
||||
m_mapRels.clear();
|
||||
}
|
||||
|
||||
HRESULT CDrawingConverter::SetCurrentRelsPath()
|
||||
void CDrawingConverter::SetRels(smart_ptr<OOX::IFileContainer> container)
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<PPTX::CCommonRels>>::iterator pPair = m_mapRels.find(m_strCurrentRelsPath);
|
||||
|
||||
if (m_mapRels.end() == pPair)
|
||||
{
|
||||
smart_ptr<PPTX::CCommonRels> pCR = new PPTX::CCommonRels();
|
||||
m_mapRels.insert(std::pair<std::wstring, NSCommon::smart_ptr<PPTX::CCommonRels>>(m_strCurrentRelsPath, pCR));
|
||||
|
||||
pPair = m_mapRels.find(m_strCurrentRelsPath);
|
||||
|
||||
OOX::CPath filename = m_strCurrentRelsPath;
|
||||
pPair->second->_read(filename);
|
||||
}
|
||||
|
||||
*m_pBinaryWriter->m_pCommonRels = pPair->second;
|
||||
|
||||
return S_OK;
|
||||
*m_pBinaryWriter->m_pCurrentContainer = container;
|
||||
}
|
||||
void CDrawingConverter::SetRels(OOX::IFileContainer *container)
|
||||
{
|
||||
*m_pBinaryWriter->m_pCurrentContainer = smart_ptr<OOX::IFileContainer>(container);
|
||||
m_pBinaryWriter->m_pCurrentContainer->AddRef();
|
||||
}
|
||||
smart_ptr<OOX::IFileContainer> CDrawingConverter::GetRels()
|
||||
{
|
||||
return *m_pBinaryWriter->m_pCurrentContainer;
|
||||
}
|
||||
void CDrawingConverter::SetFontManager(CFontManager* pFontManager)
|
||||
{
|
||||
|
||||
@ -63,6 +63,7 @@ namespace BinDocxRW
|
||||
namespace OOX
|
||||
{
|
||||
class CContentTypes;
|
||||
class IFileContainer;
|
||||
}
|
||||
namespace NSBinPptxRW
|
||||
{
|
||||
@ -186,9 +187,7 @@ namespace NSBinPptxRW
|
||||
};
|
||||
|
||||
|
||||
std::map<std::wstring, CShape*> m_mapShapeTypes;
|
||||
std::map<std::wstring, NSCommon::smart_ptr<PPTX::CCommonRels>> m_mapRels;
|
||||
std::wstring m_strCurrentRelsPath;
|
||||
std::map<std::wstring, CShape*> m_mapShapeTypes;
|
||||
|
||||
NSBinPptxRW::CBinaryFileWriter* m_pBinaryWriter;
|
||||
int m_lNextId;
|
||||
@ -211,9 +210,11 @@ namespace NSBinPptxRW
|
||||
|
||||
~CDrawingConverter();
|
||||
|
||||
HRESULT SetMainDocument (BinDocxRW::CDocxSerializer* pDocument);
|
||||
HRESULT SetRelsPath (const std::wstring& sRelsPath);
|
||||
std::wstring GetRelsPath ();
|
||||
void SetRels(OOX::IFileContainer *container);
|
||||
void SetRels(smart_ptr<OOX::IFileContainer> container);
|
||||
smart_ptr<OOX::IFileContainer> GetRels();
|
||||
|
||||
HRESULT SetMainDocument (BinDocxRW::CDocxSerializer* pDocument);
|
||||
HRESULT SetMediaDstPath (const std::wstring& sMediaPath);
|
||||
HRESULT SetEmbedDstPath (const std::wstring& sEmbedPath);
|
||||
|
||||
|
||||
@ -82,7 +82,8 @@ namespace NSBinPptxRW
|
||||
|
||||
FontsEmbedded = 44,
|
||||
SlideNotesRels = 45,
|
||||
NotesRels = 46
|
||||
NotesRels = 46,
|
||||
NotesMastersRels= 47
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,11 +718,12 @@ namespace NSBinPptxRW
|
||||
}
|
||||
CBinaryFileWriter::CBinaryFileWriter()
|
||||
{
|
||||
m_pMainDocument = NULL;
|
||||
m_pCommon = new CCommonWriter();
|
||||
m_pCommonRels = new NSCommon::smart_ptr<PPTX::CCommonRels>();
|
||||
m_pTheme = new NSCommon::smart_ptr<PPTX::Theme>();
|
||||
m_pClrMap = new NSCommon::smart_ptr<PPTX::Logic::ClrMap>();
|
||||
m_pMainDocument = NULL;
|
||||
m_pCommon = new CCommonWriter();
|
||||
//m_pCommonRels = new NSCommon::smart_ptr<PPTX::CCommonRels>();
|
||||
m_pCurrentContainer = new NSCommon::smart_ptr<OOX::IFileContainer>();
|
||||
m_pTheme = new NSCommon::smart_ptr<PPTX::Theme>();
|
||||
m_pClrMap = new NSCommon::smart_ptr<PPTX::Logic::ClrMap>();
|
||||
|
||||
Clear();
|
||||
}
|
||||
@ -730,7 +731,8 @@ namespace NSBinPptxRW
|
||||
{
|
||||
RELEASEARRAYOBJECTS (m_pStreamData);
|
||||
RELEASEOBJECT (m_pCommon);
|
||||
RELEASEOBJECT (m_pCommonRels);
|
||||
//RELEASEOBJECT (m_pCommonRels);
|
||||
RELEASEOBJECT (m_pCurrentContainer);
|
||||
|
||||
RELEASEOBJECT (m_pTheme);
|
||||
RELEASEOBJECT (m_pClrMap);
|
||||
|
||||
@ -51,6 +51,7 @@ namespace OOX
|
||||
class OleObject;
|
||||
class CContentTypes;
|
||||
class WritingElement;
|
||||
class IFileContainer;
|
||||
}
|
||||
namespace NSCommon
|
||||
{
|
||||
@ -63,7 +64,6 @@ namespace NSCommon
|
||||
}
|
||||
namespace PPTX
|
||||
{
|
||||
class CCommonRels;
|
||||
class Theme;
|
||||
namespace Logic
|
||||
{
|
||||
@ -154,6 +154,7 @@ namespace NSBinPptxRW
|
||||
std::vector<LONG> m_oSlide_Layout_Rels;
|
||||
std::vector<LONG> m_oSlide_Notes_Rels;
|
||||
std::vector<LONG> m_oNote_Rels;
|
||||
std::vector<LONG> m_oNotesMasters_Rels;
|
||||
|
||||
NSShapeImageGen::CImageManager* m_pImageManager;
|
||||
|
||||
@ -225,7 +226,7 @@ namespace NSBinPptxRW
|
||||
CCommonWriter* m_pCommon;
|
||||
std::wstring m_strMainFolder;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::CCommonRels>* m_pCommonRels;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer>* m_pCurrentContainer;
|
||||
BinDocxRW::CDocxSerializer * m_pMainDocument;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::Theme>* m_pTheme;
|
||||
|
||||
@ -147,13 +147,18 @@ namespace PPTX2EditorAdvanced
|
||||
|
||||
// проверяем theme
|
||||
size_t pPointerTh = (size_t)(noteMaster->theme_.operator ->());
|
||||
LONG nNotesMastersRelsIndex = -1;
|
||||
std::map<size_t, LONG>::const_iterator pSearchTh = pCommon->themes.find(pPointerTh);
|
||||
if (pSearchTh == pCommon->themes.end())
|
||||
{
|
||||
LONG lCountTh = (LONG)_themes.size();
|
||||
pCommon->themes [pPointerTh] = lCountTh;
|
||||
_themes.push_back(noteMaster->theme_);
|
||||
nNotesMastersRelsIndex = lCountTh;
|
||||
} else {
|
||||
nNotesMastersRelsIndex = pSearchTh->second;
|
||||
}
|
||||
oBinaryWriter.m_pCommon->m_oNotesMasters_Rels.push_back(nNotesMastersRelsIndex);
|
||||
}
|
||||
|
||||
// записываем все слайды
|
||||
@ -490,6 +495,21 @@ namespace PPTX2EditorAdvanced
|
||||
oBinaryWriter.EndRecord();
|
||||
// ------------------------------------------------
|
||||
|
||||
// NoteRels --------------------------------------
|
||||
oBinaryWriter.StartMainRecord(NSMainTables::NotesMastersRels);
|
||||
oBinaryWriter.StartRecord(NSMainTables::NotesMastersRels);
|
||||
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
_s_rels = oBinaryWriter.m_pCommon->m_oNotesMasters_Rels.size();
|
||||
for (size_t i = 0; i < _s_rels; ++i)
|
||||
{
|
||||
oBinaryWriter.WriteInt1(0, oBinaryWriter.m_pCommon->m_oNotesMasters_Rels[i]);
|
||||
}
|
||||
|
||||
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
oBinaryWriter.EndRecord();
|
||||
// ------------------------------------------------
|
||||
|
||||
|
||||
oBinaryWriter.EndRecord();
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ namespace PPTX
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(CommentAuthor)
|
||||
private:
|
||||
|
||||
nullable_int id;
|
||||
nullable_int last_idx;
|
||||
nullable_int clr_idx;
|
||||
@ -52,8 +52,6 @@ namespace PPTX
|
||||
nullable_string name;
|
||||
nullable_string initials;
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"id", id);
|
||||
@ -138,10 +136,9 @@ namespace PPTX
|
||||
|
||||
class Authors : public WrapperFile
|
||||
{
|
||||
private:
|
||||
public:
|
||||
std::vector<PPTX::Logic::CommentAuthor> m_arAuthors;
|
||||
|
||||
public:
|
||||
Authors()
|
||||
{
|
||||
}
|
||||
@ -152,8 +149,6 @@ namespace PPTX
|
||||
virtual ~Authors()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
@ -177,8 +172,6 @@ namespace PPTX
|
||||
{
|
||||
WrapperFile::write(filename, directory, content);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::Presentation::FileTypes::CommentAuthors;
|
||||
@ -191,8 +184,6 @@ namespace PPTX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteRecordArray(0, 0, m_arAuthors);
|
||||
|
||||
@ -44,7 +44,7 @@ namespace PPTX
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(Comment)
|
||||
private:
|
||||
|
||||
nullable_int authorId;
|
||||
nullable_int idx;
|
||||
nullable_string dt;
|
||||
@ -59,8 +59,6 @@ namespace PPTX
|
||||
|
||||
nullable_string additional_data; // teamlab editor information!!!
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"authorId", authorId);
|
||||
@ -276,10 +274,9 @@ namespace PPTX
|
||||
|
||||
class Comments : public WrapperFile
|
||||
{
|
||||
private:
|
||||
public:
|
||||
std::vector<PPTX::Logic::Comment> m_arComments;
|
||||
|
||||
public:
|
||||
Comments()
|
||||
{
|
||||
}
|
||||
@ -291,7 +288,6 @@ namespace PPTX
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
@ -315,7 +311,6 @@ namespace PPTX
|
||||
WrapperFile::write(filename, directory, content);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::Presentation::FileTypes::SlideComments;
|
||||
@ -328,8 +323,6 @@ namespace PPTX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteRecordArray(0, 0, m_arComments);
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
#include "FileContainer.h"
|
||||
#include "FileTypes.h"
|
||||
|
||||
#include "LegacyDiagramText.h"
|
||||
#include "FileFactory.h"
|
||||
#include "WrapperFile.h"
|
||||
|
||||
@ -241,13 +240,7 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
}
|
||||
smart_ptr<PPTX::LegacyDiagramText> FileContainer::legacyDiagramText(const OOX::RId& rId) const
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
|
||||
if (pPair == m_mContainer.end ())
|
||||
return smart_ptr<LegacyDiagramText>();
|
||||
return pPair->second.smart_dynamic_cast<LegacyDiagramText>();
|
||||
}
|
||||
|
||||
void FileContainer::read(const OOX::CPath& filename, FileMap& map, IPPTXEvent* Event)
|
||||
{
|
||||
OOX::CRels rels(filename);
|
||||
@ -304,25 +297,5 @@ namespace PPTX
|
||||
content.Registration(type().OverrideType(), directory, m_WrittenFileName);
|
||||
m_written = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
void CCommonRels::_read(const OOX::CRels& rels, const OOX::CPath& path)
|
||||
{
|
||||
size_t nCount = rels.m_arrRelations.size();
|
||||
for (size_t i = 0; i < nCount; ++i)
|
||||
{
|
||||
OOX::Rels::CRelationShip* pRelation = rels.m_arrRelations[i];
|
||||
|
||||
OOX::CPath normPath = CorrectPathRels(path, pRelation);
|
||||
|
||||
smart_ptr<OOX::File> _file = PPTX::FileFactory::CreateFilePPTX_OnlyMedia(normPath, *pRelation);
|
||||
Add(pRelation->rId(), _file);
|
||||
}
|
||||
}
|
||||
|
||||
void CCommonRels::_read(const OOX::CPath& filename)
|
||||
{
|
||||
OOX::CRels rels(filename);
|
||||
OOX::CPath path = filename.GetDirectory();
|
||||
_read(rels, path);
|
||||
}
|
||||
} // namespace PPTX
|
||||
|
||||
@ -52,7 +52,6 @@ namespace PPTX
|
||||
virtual ~FileContainer()
|
||||
{
|
||||
}
|
||||
smart_ptr<PPTX::LegacyDiagramText> legacyDiagramText (const OOX::RId& rId) const;
|
||||
|
||||
protected:
|
||||
void read(const OOX::CPath& filename);
|
||||
@ -71,16 +70,6 @@ namespace PPTX
|
||||
bool m_bCancelled;
|
||||
};
|
||||
|
||||
class CCommonRels : public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
CCommonRels() : PPTX::FileContainer()
|
||||
{
|
||||
}
|
||||
|
||||
void _read(const OOX::CPath& filename);
|
||||
void _read(const OOX::CRels& rels, const OOX::CPath& path);
|
||||
};
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_IFILE_CONTAINER_INCLUDE_H_
|
||||
@ -143,52 +143,4 @@ namespace PPTX
|
||||
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
|
||||
}
|
||||
|
||||
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX_OnlyMedia(const OOX::CPath& norm_filename, OOX::Rels::CRelationShip& relation)
|
||||
{
|
||||
bool bIsDownload = false;
|
||||
std::wstring strFile = relation.Filename().GetPath();
|
||||
|
||||
int n1 = (int)strFile.find(_T("www"));
|
||||
int n2 = (int)strFile.find(_T("http"));
|
||||
int n3 = (int)strFile.find(_T("ftp"));
|
||||
int n4 = (int)strFile.find(_T("https://"));
|
||||
|
||||
//если nI сранивать не с 0, то будут проблемы
|
||||
//потому что в инсталяции мы кладем файлы в /var/www...
|
||||
if (0 == n1 || 0 == n2 || 0 == n3 || 0 == n4)
|
||||
bIsDownload = true;
|
||||
|
||||
OOX::CPath filename = norm_filename;
|
||||
|
||||
if (bIsDownload)
|
||||
filename = relation.Filename();
|
||||
|
||||
std::wstring strT = relation.Type();
|
||||
|
||||
if (strT == OOX::FileTypes::Image ||
|
||||
strT == OOX::FileTypes::Chart)
|
||||
{
|
||||
return smart_ptr<OOX::File>(new OOX::Image(filename));
|
||||
}
|
||||
else if(strT == OOX::FileTypes::Data)
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramData(filename));
|
||||
|
||||
else if(strT == OOX::FileTypes::DiagDrawing)
|
||||
return smart_ptr<OOX::File>(new OOX::CDiagramDrawing(filename));
|
||||
|
||||
else if(strT == OOX::FileTypes::HyperLink)
|
||||
return smart_ptr<OOX::File>(new OOX::HyperLink(relation.Target()));
|
||||
|
||||
else if(strT == OOX::FileTypes::LegacyDiagramText)
|
||||
return smart_ptr<OOX::File>(new PPTX::LegacyDiagramText(filename));
|
||||
|
||||
else if(strT == OOX::FileTypes::OleObject)
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject(filename));
|
||||
|
||||
else if ( strT == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
|
||||
|
||||
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
|
||||
}
|
||||
|
||||
} // namespace PPTX
|
||||
|
||||
@ -42,6 +42,5 @@ namespace PPTX
|
||||
{
|
||||
public:
|
||||
static const smart_ptr<OOX::File> CreateFilePPTX(const OOX::CPath& path, OOX::Rels::CRelationShip& relation, FileMap& map);
|
||||
static const smart_ptr<OOX::File> CreateFilePPTX_OnlyMedia(const OOX::CPath& path, OOX::Rels::CRelationShip& relation);
|
||||
};
|
||||
} // namespace PPTX
|
||||
|
||||
@ -120,21 +120,29 @@ namespace PPTX
|
||||
oAttr.Write(_T("noResize"), noResize);
|
||||
oAttr.Write(_T("noSelect"), noSelect);
|
||||
|
||||
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", oAttr.m_strValue.empty() ? L"" : XmlUtils::CreateNode(L"a:graphicFrameLocks", oAttr));
|
||||
std::wstring namespaceLocks = L"a";
|
||||
if (m_namespace == L"wp") namespaceLocks = L"wp";
|
||||
|
||||
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", oAttr.m_strValue.empty() ? L"" : XmlUtils::CreateNode(namespaceLocks + L":graphicFrameLocks", oAttr));
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
std::wstring namespace_ = m_namespace;
|
||||
std::wstring namespace_ = m_namespace;
|
||||
std::wstring namespaceLock_ = L"a";
|
||||
|
||||
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
|
||||
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wp";
|
||||
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
|
||||
{
|
||||
namespaceLock_ = L"wp";
|
||||
namespace_ = L"wp";
|
||||
}
|
||||
|
||||
pWriter->StartNode(namespace_ + L":cNvGraphicFramePr");
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(_T("a:graphicFrameLocks"));
|
||||
pWriter->StartNode(namespaceLock_ + L"graphicFrameLocks");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
@ -147,7 +155,7 @@ namespace PPTX
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->EndNode(_T("a:graphicFrameLocks"));
|
||||
pWriter->EndNode(namespaceLock_ + L":graphicFrameLocks");
|
||||
|
||||
pWriter->EndNode(namespace_ + L":cNvGraphicFramePr");
|
||||
}
|
||||
|
||||
@ -38,24 +38,23 @@ namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
std::wstring Control::GetVmlXmlBySpid(std::wstring spid, std::wstring & rels) const
|
||||
std::wstring Control::GetVmlXmlBySpid(std::wstring spid, smart_ptr<OOX::IFileContainer> & rels) const
|
||||
{
|
||||
std::wstring xml;
|
||||
rels = _T("");
|
||||
if(parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(spid);
|
||||
rels = parentFileAs<PPTX::Slide>().Vml->GetReadPath().GetPath();
|
||||
rels = parentFileAs<PPTX::Slide>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideLayout>() && parentFileAs<PPTX::SlideLayout>().Vml.IsInit())
|
||||
{
|
||||
xml= parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(spid);
|
||||
rels = parentFileAs<PPTX::SlideLayout>().Vml->GetReadPath().GetPath();
|
||||
rels = parentFileAs<PPTX::SlideLayout>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideMaster>() && parentFileAs<PPTX::SlideMaster>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(spid);
|
||||
rels = parentFileAs<PPTX::SlideMaster>().Vml->GetReadPath().GetPath();
|
||||
rels = parentFileAs<PPTX::SlideMaster>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
|
||||
return xml;
|
||||
@ -67,7 +66,7 @@ namespace PPTX
|
||||
std::wstring s = *spid;
|
||||
if (s.length() < 8) s = _T("_x0000_s") + s;
|
||||
|
||||
std::wstring rels;
|
||||
smart_ptr<OOX::IFileContainer> rels;
|
||||
std::wstring xml = GetVmlXmlBySpid(s, rels);
|
||||
|
||||
if (xml.length() > 0)
|
||||
@ -82,7 +81,7 @@ namespace PPTX
|
||||
RELEASEOBJECT(oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager);
|
||||
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pImageManager = pImageManager;
|
||||
|
||||
oDrawingConverter.SetRelsPath(rels);
|
||||
oDrawingConverter.SetRels(rels);
|
||||
|
||||
std::wstring *main_props = NULL;
|
||||
HRESULT hRes = oDrawingConverter.AddObject(temp, &main_props);
|
||||
@ -97,7 +96,7 @@ namespace PPTX
|
||||
std::wstring s = *spid;
|
||||
if (s.length() < 8) s = _T("_x0000_s") + s;
|
||||
|
||||
std::wstring rels;
|
||||
smart_ptr<OOX::IFileContainer> rels;
|
||||
std::wstring xml = GetVmlXmlBySpid(s, rels);
|
||||
|
||||
if (xml.length() > 0)
|
||||
@ -113,7 +112,7 @@ namespace PPTX
|
||||
|
||||
std::wstring *main_props = NULL;
|
||||
|
||||
oDrawingConverter.SetRelsPath(rels);
|
||||
oDrawingConverter.SetRels(rels);
|
||||
|
||||
HRESULT hRes = oDrawingConverter.AddObject(temp, &main_props);
|
||||
if (hRes == S_OK && oDrawingConverter.m_pBinaryWriter->GetPosition() > 10)
|
||||
|
||||
@ -50,7 +50,8 @@ namespace PPTX
|
||||
|
||||
public:
|
||||
void AddObjectTo (const std::vector<SpTreeElem> *spTreeElements, NSShapeImageGen::CImageManager* pImageManager) const ;
|
||||
std::wstring GetVmlXmlBySpid(std::wstring spid, std::wstring & rels) const ;
|
||||
|
||||
std::wstring GetVmlXmlBySpid(std::wstring spid, smart_ptr<OOX::IFileContainer> & rels) const ;
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const ;
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ namespace PPTX
|
||||
Effects[i].SetParentPointer(this);
|
||||
}
|
||||
|
||||
std::wstring Blip::GetFullPicName(FileContainer* pRels)const
|
||||
std::wstring Blip::GetFullPicName(OOX::IFileContainer* pRels)const
|
||||
{
|
||||
if(embed.IsInit())
|
||||
{
|
||||
@ -141,7 +141,7 @@ namespace PPTX
|
||||
}
|
||||
return _T("");
|
||||
}
|
||||
std::wstring Blip::GetFullOleName(const OOX::RId& oRId, FileContainer* pRels)const
|
||||
std::wstring Blip::GetFullOleName(const OOX::RId& oRId, OOX::IFileContainer* pRels)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> pOleObject;
|
||||
|
||||
|
||||
@ -135,10 +135,10 @@ namespace PPTX
|
||||
double dW = pWriter->GetShapeWidth(); //mm
|
||||
double dH = pWriter->GetShapeHeight();
|
||||
|
||||
FileContainer* pRels = NULL;
|
||||
OOX::IFileContainer* pRels = NULL;
|
||||
|
||||
if (pWriter->m_pCommonRels->is_init())
|
||||
pRels = pWriter->m_pCommonRels->operator ->();
|
||||
if (pWriter->m_pCurrentContainer->is_init())
|
||||
pRels = pWriter->m_pCurrentContainer->operator ->();
|
||||
|
||||
std::wstring olePath;
|
||||
if(!oleFilepathBin.empty())
|
||||
@ -171,8 +171,8 @@ namespace PPTX
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
virtual std::wstring GetFullPicName(FileContainer* pRels = NULL)const;
|
||||
virtual std::wstring GetFullOleName(const OOX::RId& pRId, FileContainer* pRels = NULL)const;
|
||||
virtual std::wstring GetFullPicName(OOX::IFileContainer* pRels = NULL)const;
|
||||
virtual std::wstring GetFullOleName(const OOX::RId& pRId, OOX::IFileContainer* pRels = NULL)const;
|
||||
|
||||
std::vector<UniEffect> Effects;
|
||||
|
||||
|
||||
@ -122,8 +122,8 @@ namespace PPTX
|
||||
|
||||
if (L"xfrm" == strName && strNamespace != L"xdr")
|
||||
xfrm = oReader;
|
||||
else if (L"nvGraphicFramePr" == strName)
|
||||
nvGraphicFramePr.fromXML( oReader );
|
||||
else if (L"cNvGraphicFramePr" == strName)
|
||||
nvGraphicFramePr.cNvGraphicFramePr.fromXML( oReader );
|
||||
|
||||
else if (L"graphic" == strName)
|
||||
{
|
||||
@ -375,8 +375,8 @@ namespace PPTX
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring xml_object_vml;
|
||||
std::wstring xml_object_rels;
|
||||
std::wstring xml_object_vml;
|
||||
smart_ptr<OOX::IFileContainer> xml_object_rels;
|
||||
|
||||
if (oleSpid.is_init())
|
||||
{
|
||||
@ -452,7 +452,7 @@ namespace PPTX
|
||||
|
||||
std::wstring *main_props = NULL;
|
||||
|
||||
oDrawingConverter.SetRelsPath(xml_object_rels);
|
||||
oDrawingConverter.SetRels(xml_object_rels);
|
||||
oDrawingConverter.SetAdditionalParam(L"xfrm_override", (BYTE*)xfrm.GetPointer(), sizeof(xfrm));
|
||||
|
||||
HRESULT hRes = oDrawingConverter.AddObject(temp, &main_props);
|
||||
@ -613,35 +613,29 @@ namespace PPTX
|
||||
{
|
||||
nvGraphicFramePr.SetParentPointer(this);
|
||||
|
||||
if (xfrm.IsInit())
|
||||
xfrm->SetParentPointer(this);
|
||||
if(table.IsInit())
|
||||
table->SetParentPointer(this);
|
||||
if (smartArt.is_init())
|
||||
smartArt->SetParentPointer(this);
|
||||
if (chartRec.is_init())
|
||||
chartRec->SetParentPointer(this);
|
||||
if (olePic.is_init())
|
||||
olePic->SetParentPointer(this);
|
||||
if (xfrm.IsInit()) xfrm->SetParentPointer(this);
|
||||
if (table.IsInit()) table->SetParentPointer(this);
|
||||
if (smartArt.is_init()) smartArt->SetParentPointer(this);
|
||||
if (chartRec.is_init()) chartRec->SetParentPointer(this);
|
||||
if (olePic.is_init()) olePic->SetParentPointer(this);
|
||||
}
|
||||
std::wstring GraphicFrame::GetVmlXmlBySpid(std::wstring & rels)const
|
||||
std::wstring GraphicFrame::GetVmlXmlBySpid(smart_ptr<OOX::IFileContainer> & rels)const
|
||||
{
|
||||
std::wstring xml;
|
||||
rels = L"";
|
||||
if(parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::Slide>().Vml->GetReadPath().GetPath();
|
||||
rels = parentFileAs<PPTX::Slide>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideLayout>() && parentFileAs<PPTX::SlideLayout>().Vml.IsInit())
|
||||
{
|
||||
xml= parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::SlideLayout>().Vml->GetReadPath().GetPath();
|
||||
xml = parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::SlideLayout>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideMaster>() && parentFileAs<PPTX::SlideMaster>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::SlideMaster>().Vml->GetReadPath().GetPath();
|
||||
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::SlideMaster>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
|
||||
return xml;
|
||||
|
||||
@ -98,7 +98,7 @@ namespace PPTX
|
||||
|
||||
SpTreeElem element;
|
||||
|
||||
std::wstring GetVmlXmlBySpid(std::wstring & rels) const;
|
||||
std::wstring GetVmlXmlBySpid(smart_ptr<OOX::IFileContainer> & rels) const;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds();
|
||||
};
|
||||
|
||||
@ -41,7 +41,7 @@ namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
std::wstring Hyperlink::GetFullHyperlinkName(FileContainer* pRels)const
|
||||
std::wstring Hyperlink::GetFullHyperlinkName(OOX::IFileContainer* pRels)const
|
||||
{
|
||||
if(id.IsInit() && *id != _T(""))
|
||||
{
|
||||
|
||||
@ -113,9 +113,9 @@ namespace PPTX
|
||||
|
||||
if (id.is_init())
|
||||
{
|
||||
FileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCommonRels->is_init())
|
||||
pRels = pWriter->m_pCommonRels->operator ->();
|
||||
OOX::IFileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCurrentContainer->is_init())
|
||||
pRels = pWriter->m_pCurrentContainer->operator ->();
|
||||
|
||||
std::wstring str = GetFullHyperlinkName(pRels);
|
||||
pWriter->WriteString1(0, str);
|
||||
@ -256,7 +256,7 @@ namespace PPTX
|
||||
snd->SetParentPointer(this);
|
||||
}
|
||||
|
||||
virtual std::wstring GetFullHyperlinkName(FileContainer* pRels)const;
|
||||
virtual std::wstring GetFullHyperlinkName(OOX::IFileContainer* pRels)const;
|
||||
};
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
@ -112,9 +112,9 @@ namespace PPTX
|
||||
|
||||
if(m_oId.IsInit() && ole_file.IsInit() == false)
|
||||
{
|
||||
FileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCommonRels->is_init())
|
||||
pRels = pWriter->m_pCommonRels->operator ->();
|
||||
OOX::IFileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCurrentContainer->is_init())
|
||||
pRels = pWriter->m_pCurrentContainer->operator ->();
|
||||
|
||||
ole_file = GetOleObject(m_oId.get(), pRels);
|
||||
}
|
||||
@ -163,8 +163,8 @@ namespace PPTX
|
||||
DocWrapper::FontProcessor fp;
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSCommon::smart_ptr<PPTX::CCommonRels> old_rels = *pWriter->m_pCommonRels;
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = pWriter;
|
||||
|
||||
@ -176,7 +176,7 @@ namespace PPTX
|
||||
pWriter->EndRecord();
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = old_writer;
|
||||
*pWriter->m_pCommonRels = old_rels;
|
||||
*pWriter->m_pCurrentContainer = old_rels;
|
||||
}
|
||||
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX)
|
||||
//if ( std::wstring::npos != sProgID.find(L"Excel.Sheet")) //"ET.Xlsx.6" !!!
|
||||
@ -189,7 +189,7 @@ namespace PPTX
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSCommon::smart_ptr<PPTX::CCommonRels> old_rels = *pWriter->m_pCommonRels;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = pWriter;
|
||||
|
||||
@ -201,7 +201,7 @@ namespace PPTX
|
||||
pWriter->EndRecord();
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = old_writer;
|
||||
*pWriter->m_pCommonRels = old_rels;
|
||||
*pWriter->m_pCurrentContainer = old_rels;
|
||||
}
|
||||
//else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX)
|
||||
//{
|
||||
@ -469,7 +469,7 @@ namespace PPTX
|
||||
return m_sProgId.IsInit() && (m_sData.IsInit() || m_oId.IsInit() || m_OleObjectFile.IsInit());
|
||||
}
|
||||
|
||||
smart_ptr<OOX::OleObject> COLEObject::GetOleObject(const OOX::RId& oRId, FileContainer* pRels) const
|
||||
smart_ptr<OOX::OleObject> COLEObject::GetOleObject(const OOX::RId& oRId, OOX::IFileContainer* pRels) const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> ole_file = m_OleObjectFile;
|
||||
if (ole_file.IsInit() == false)
|
||||
|
||||
@ -198,7 +198,7 @@ namespace PPTX
|
||||
|
||||
bool isValid();
|
||||
|
||||
smart_ptr<OOX::OleObject> GetOleObject(const OOX::RId& oRId, FileContainer* pRels)const;
|
||||
smart_ptr<OOX::OleObject> GetOleObject(const OOX::RId& oRId, OOX::IFileContainer* pRels)const;
|
||||
std::wstring GetOleData (const std::wstring& sFilePath)const;
|
||||
|
||||
nullable_limit<Limit::OLEDrawAspectType>m_oDrawAspect;
|
||||
|
||||
@ -45,7 +45,6 @@ namespace PPTX
|
||||
{
|
||||
m_name = name_;
|
||||
m_pLevelUp = NULL;
|
||||
m_nMasterTextType = -1;
|
||||
}
|
||||
|
||||
Shape::~Shape()
|
||||
@ -55,21 +54,18 @@ namespace PPTX
|
||||
Shape::Shape(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_pLevelUp = NULL;
|
||||
m_nMasterTextType = -1;
|
||||
|
||||
fromXML(node);
|
||||
}
|
||||
Shape::Shape(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
m_pLevelUp = NULL;
|
||||
m_nMasterTextType = -1;
|
||||
|
||||
fromXML(oReader);
|
||||
}
|
||||
const Shape& Shape::operator =(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_pLevelUp = NULL;
|
||||
m_nMasterTextType = -1;
|
||||
|
||||
fromXML(node);
|
||||
return *this;
|
||||
@ -77,7 +73,6 @@ namespace PPTX
|
||||
const Shape& Shape::operator =(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
m_pLevelUp = NULL;
|
||||
m_nMasterTextType = -1;
|
||||
|
||||
fromXML(oReader);
|
||||
return *this;
|
||||
@ -442,7 +437,6 @@ namespace PPTX
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
|
||||
|
||||
void Shape::FillLevelUp()
|
||||
{
|
||||
if ((m_pLevelUp == NULL) && (nvSpPr.nvPr.ph.IsInit()))
|
||||
@ -457,57 +451,25 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
|
||||
bool Shape::IsListStyleEmpty()
|
||||
{
|
||||
if ((m_pLevelUp) && (m_pLevelUp->IsListStyleEmpty() == false)) return false;
|
||||
|
||||
if (txBody.IsInit() == false) return true;
|
||||
if (txBody->lstStyle.IsInit() == false) return true;
|
||||
|
||||
return txBody->lstStyle->IsListStyleEmpty();
|
||||
}
|
||||
|
||||
void Shape::Merge(Shape& shape, bool bIsSlidePlaceholder)
|
||||
{
|
||||
if (m_pLevelUp)
|
||||
m_pLevelUp->Merge(shape, true);
|
||||
|
||||
shape.m_name = m_name;
|
||||
shape.m_nMasterTextType = m_nMasterTextType;
|
||||
|
||||
shape.nvSpPr = nvSpPr;
|
||||
shape.m_name = m_name;
|
||||
shape.nvSpPr = nvSpPr;
|
||||
spPr.Merge(shape.spPr);
|
||||
|
||||
if (parentFileIs<SlideMaster>() && (parentFileAs<SlideMaster>()).txStyles.IsInit())
|
||||
{
|
||||
TextListStyle * listMasterStyle = NULL;
|
||||
|
||||
std::wstring type = nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
|
||||
if ((type == L"title") || (type == L"ctrTitle"))
|
||||
{
|
||||
m_nMasterTextType = 1;
|
||||
listMasterStyle = (parentFileAs<SlideMaster>()).txStyles->titleStyle.GetPointer();
|
||||
}
|
||||
else if ((type == L"body") || (type == L"subTitle") || (type == L"obj"))
|
||||
{
|
||||
m_nMasterTextType = 2;
|
||||
listMasterStyle = (parentFileAs<SlideMaster>()).txStyles->bodyStyle.GetPointer();
|
||||
}
|
||||
else if (type != L"")
|
||||
{
|
||||
m_nMasterTextType = 3;
|
||||
listMasterStyle = (parentFileAs<SlideMaster>()).txStyles->otherStyle.GetPointer();
|
||||
}
|
||||
|
||||
if (listMasterStyle)
|
||||
{
|
||||
if(!txBody.is_init())
|
||||
txBody = new TxBody();
|
||||
|
||||
TextListStyle *newListStyle = new TextListStyle();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if(listMasterStyle->levels[i].is_init())
|
||||
listMasterStyle->levels[i]->Merge(newListStyle->levels[i]);
|
||||
if(txBody->lstStyle->levels[i].is_init())
|
||||
txBody->lstStyle->levels[i]->Merge(newListStyle->levels[i]);
|
||||
}
|
||||
txBody->lstStyle.reset(newListStyle);
|
||||
}
|
||||
}
|
||||
shape.m_nMasterTextType = m_nMasterTextType;
|
||||
|
||||
if (style.is_init())
|
||||
{
|
||||
shape.m_bIsFontRefInSlide = bIsSlidePlaceholder;
|
||||
|
||||
@ -303,6 +303,7 @@ namespace PPTX
|
||||
|
||||
void FillLevelUp();
|
||||
void Merge(Shape& shape, bool bIsSlidePlaceholder = false);
|
||||
bool IsListStyleEmpty();
|
||||
|
||||
void SetLevelUpElement( Shape* p){m_pLevelUp = p;};
|
||||
|
||||
@ -316,7 +317,6 @@ namespace PPTX
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
std::wstring m_name;
|
||||
Shape * m_pLevelUp;
|
||||
int m_nMasterTextType;
|
||||
bool m_bIsFontRefInSlide;
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
NvSpPr nvSpPr;
|
||||
|
||||
@ -36,7 +36,11 @@
|
||||
#include "../SlideMaster.h"
|
||||
|
||||
#include "../../ASCOfficeDrawingConverter.h"
|
||||
|
||||
#include "../../../XlsxSerializerCom/Reader/ChartFromToBinary.h"
|
||||
#include "../../../ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h"
|
||||
#include "../../../ASCOfficeDocxFile2/BinWriter/BinWriters.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
|
||||
|
||||
@ -49,11 +53,11 @@ namespace PPTX
|
||||
if (m_diag.IsInit())
|
||||
return ;
|
||||
|
||||
FileContainer* pRels = NULL;
|
||||
OOX::IFileContainer* pRels = NULL;
|
||||
if (pWriter)
|
||||
{
|
||||
if (pWriter->m_pCommonRels->is_init())
|
||||
pRels = pWriter->m_pCommonRels->operator ->();
|
||||
if (pWriter->m_pCurrentContainer->is_init())
|
||||
pRels = pWriter->m_pCurrentContainer->operator ->();
|
||||
}
|
||||
|
||||
smart_ptr<OOX::File> oFileData;
|
||||
@ -65,11 +69,8 @@ namespace PPTX
|
||||
|
||||
if(id_data.IsInit())
|
||||
{
|
||||
if (parentFileIs<Slide>()) oFileData = parentFileAs<Slide>().Find(*id_data);
|
||||
else if (parentFileIs<SlideLayout>()) oFileData = parentFileAs<SlideLayout>().Find(*id_data);
|
||||
else if (parentFileIs<SlideMaster>()) oFileData = parentFileAs<SlideMaster>().Find(*id_data);
|
||||
else if (parentFileIs<Theme>()) oFileData = parentFileAs<Theme>().Find(*id_data);
|
||||
else if (pRels != NULL) oFileData = pRels->Find(*id_data);
|
||||
if (parentFileIs<OOX::IFileContainer>()) oFileData = parentFileAs<OOX::IFileContainer>().Find(*id_data);
|
||||
else if (pRels != NULL) oFileData = pRels->Find(*id_data);
|
||||
}
|
||||
|
||||
if (oFileData.IsInit())
|
||||
@ -88,13 +89,10 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
|
||||
if (id_drawing.IsInit())
|
||||
if (id_drawing.IsInit() && pDiagramData)
|
||||
{
|
||||
if (parentFileIs<Slide>()) oFileDrawing = parentFileAs<Slide>().Find(*id_drawing);
|
||||
else if (parentFileIs<SlideLayout>()) oFileDrawing = parentFileAs<SlideLayout>().Find(*id_drawing);
|
||||
else if (parentFileIs<SlideMaster>()) oFileDrawing = parentFileAs<SlideMaster>().Find(*id_drawing);
|
||||
else if (parentFileIs<Theme>()) oFileDrawing = parentFileAs<Theme>().Find(*id_drawing);
|
||||
else if (pRels != NULL) oFileDrawing = pRels->Find(*id_data);
|
||||
if (parentFileIs<OOX::IFileContainer>()) oFileDrawing = parentFileAs<OOX::IFileContainer>().Find(*id_drawing);
|
||||
else if (pRels != NULL) oFileDrawing = pRels->Find(*id_drawing);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -102,10 +100,7 @@ namespace PPTX
|
||||
//пробуем по тому же пути с номером data.xml - ниже
|
||||
}
|
||||
}
|
||||
if (oFileDrawing.IsInit())
|
||||
{
|
||||
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
|
||||
}
|
||||
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
|
||||
|
||||
if (!pDiagramDrawing && pDiagramData)
|
||||
{
|
||||
@ -127,8 +122,7 @@ namespace PPTX
|
||||
m_diag = pDiagramDrawing->m_oShapeTree;
|
||||
FillParentPointersForChilds();
|
||||
|
||||
m_oCommonRels = smart_ptr<PPTX::CCommonRels>( new PPTX::CCommonRels());
|
||||
m_oCommonRels->_read(pDiagramDrawing->m_oReadPath);
|
||||
m_pFileContainer = oFileDrawing.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
|
||||
if (!m_diag->grpSpPr.xfrm.IsInit())
|
||||
m_diag->grpSpPr.xfrm = new PPTX::Logic::Xfrm;
|
||||
@ -138,46 +132,48 @@ namespace PPTX
|
||||
//parse pDiagramData !!
|
||||
}
|
||||
}
|
||||
|
||||
void SmartArt::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
if (m_diag.is_init())
|
||||
{
|
||||
smart_ptr<OOX::IFileContainer> old = *pWriter->m_pCurrentContainer;
|
||||
*pWriter->m_pCurrentContainer = m_pFileContainer;
|
||||
if (pWriter->m_pMainDocument)
|
||||
pWriter->m_pMainDocument->m_pParamsWriter->m_pCurRels = (OOX::IFileContainer*)m_pFileContainer.operator->();
|
||||
|
||||
m_diag->toPPTY(pWriter);
|
||||
|
||||
*pWriter->m_pCurrentContainer = old;
|
||||
if (pWriter->m_pMainDocument)
|
||||
pWriter->m_pMainDocument->m_pParamsWriter->m_pCurRels = old.operator->();
|
||||
}
|
||||
}
|
||||
void ChartRec::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
FileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCommonRels->is_init())
|
||||
pRels = pWriter->m_pCommonRels->operator ->();
|
||||
OOX::IFileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCurrentContainer->is_init())
|
||||
pRels = pWriter->m_pCurrentContainer->operator ->();
|
||||
|
||||
std::wstring strDataPath = L"";
|
||||
smart_ptr<OOX::File> file;
|
||||
if(id_data.IsInit())
|
||||
{
|
||||
if(parentFileIs<Slide>())
|
||||
strDataPath = parentFileAs<Slide>().GetMediaFullPathNameFromRId(*id_data);
|
||||
else if(parentFileIs<SlideLayout>())
|
||||
strDataPath = parentFileAs<SlideLayout>().GetMediaFullPathNameFromRId(*id_data);
|
||||
else if(parentFileIs<SlideMaster>())
|
||||
strDataPath = parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*id_data);
|
||||
else if(parentFileIs<Theme>())
|
||||
strDataPath = parentFileAs<Theme>().GetMediaFullPathNameFromRId(*id_data);
|
||||
else if (pRels != NULL)
|
||||
{
|
||||
smart_ptr<OOX::Image> p = pRels->GetImage(*id_data);
|
||||
if (p.is_init())
|
||||
strDataPath = p->filename().m_strFilename;
|
||||
}
|
||||
if(parentFileIs<OOX::IFileContainer>()) file = parentFileAs<OOX::IFileContainer>().Find(*id_data);
|
||||
else if (pRels != NULL) file = pRels->Find(*id_data);
|
||||
}
|
||||
smart_ptr<OOX::Spreadsheet::CChartSpace> pChart = file.smart_dynamic_cast<OOX::Spreadsheet::CChartSpace>();
|
||||
|
||||
if (strDataPath.empty())
|
||||
if (pChart.IsInit() == false)
|
||||
return;
|
||||
|
||||
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
NSBinPptxRW::CBinaryFileWriter* pOldWriter = oDrawingConverter.m_pBinaryWriter;
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = pWriter;
|
||||
NSCommon::smart_ptr<PPTX::CCommonRels> pOldRels = *oDrawingConverter.m_pBinaryWriter->m_pCommonRels;
|
||||
oDrawingConverter.SetRels(pChart.smart_dynamic_cast<OOX::IFileContainer>());
|
||||
|
||||
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(*pWriter, &oDrawingConverter);
|
||||
oBinaryChartWriter.WriteCT_ChartSpace(*pChart);
|
||||
|
||||
oXlsxSerializer.setDrawingConverter(&oDrawingConverter);
|
||||
|
||||
long lDataSize = 0;
|
||||
oXlsxSerializer.loadChart(strDataPath, pWriter, lDataSize);
|
||||
*oDrawingConverter.m_pBinaryWriter->m_pCommonRels = pOldRels;
|
||||
oDrawingConverter.m_pBinaryWriter = pOldWriter;
|
||||
}
|
||||
std::wstring ChartRec::toXML() const
|
||||
|
||||
@ -93,17 +93,7 @@ namespace PPTX
|
||||
{
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
if (m_diag.is_init())
|
||||
{
|
||||
smart_ptr<PPTX::CCommonRels> old = *pWriter->m_pCommonRels;
|
||||
*pWriter->m_pCommonRels = m_oCommonRels;
|
||||
m_diag->toPPTY(pWriter);
|
||||
*pWriter->m_pCommonRels = old;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
@ -115,7 +105,7 @@ namespace PPTX
|
||||
nullable<OOX::RId> id_style;
|
||||
|
||||
nullable<PPTX::Logic::SpTree> m_diag;
|
||||
smart_ptr<PPTX::CCommonRels> m_oCommonRels;
|
||||
smart_ptr<OOX::IFileContainer> m_pFileContainer;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -418,6 +418,8 @@ namespace PPTX
|
||||
smart_ptr<PPTX::Logic::SpTree> oSpTree = m_elem.smart_dynamic_cast<PPTX::Logic::SpTree>();
|
||||
if (oSpTree.IsInit()) oSpTree->toXmlWriterVML(pWriter, oTheme, oClrMap);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -171,6 +171,20 @@ namespace PPTX
|
||||
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
bool IsListStyleEmpty()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (levels[i].IsInit())
|
||||
{
|
||||
if (levels[i]->ParagraphBullet.is_init() == false) continue;
|
||||
if (levels[i]->ParagraphBullet.is<PPTX::Logic::BuNone>())continue;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Merge(nullable<TextListStyle>& lstStyle)const
|
||||
{
|
||||
|
||||
@ -47,7 +47,6 @@ namespace PPTX
|
||||
explicit TimeNodeBase(XmlUtils::CXmlNode& node);
|
||||
const TimeNodeBase& operator =(XmlUtils::CXmlNode& node);
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node);
|
||||
virtual void GetTimeNodeFrom(XmlUtils::CXmlNode& element);
|
||||
virtual bool is_init()const{return (m_node.IsInit());};
|
||||
@ -61,7 +60,6 @@ namespace PPTX
|
||||
template<class T> AVSINLINE const T& as() const { return m_node.as<T>(); }
|
||||
|
||||
virtual std::wstring toXML() const;
|
||||
//public:
|
||||
private:
|
||||
smart_ptr<WrapperWritingElement> m_node;
|
||||
protected:
|
||||
|
||||
@ -46,7 +46,6 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(Timing)
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
tnLst = node.ReadNode(_T("p:tnLst"));
|
||||
@ -76,7 +75,6 @@ namespace PPTX
|
||||
pWriter->EndNode(_T("p:timing"));
|
||||
}
|
||||
|
||||
public:
|
||||
nullable<TnLst> tnLst;
|
||||
nullable<BldLst> bldLst;
|
||||
protected:
|
||||
|
||||
@ -55,8 +55,6 @@ namespace PPTX
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -72,9 +70,8 @@ namespace PPTX
|
||||
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oValue);
|
||||
}
|
||||
public:
|
||||
std::vector<TimeNodeBase> list;
|
||||
std::wstring name;
|
||||
std::wstring name;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -156,6 +156,16 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pShape->nvSpPr.nvPr.ph->idx.IsInit())
|
||||
{
|
||||
//not found in layout !! 100818_건강보험과_보건의료_김용익_최종.pptx
|
||||
bool bShapeMaster = showMasterSp.get_value_or(true);
|
||||
if (Master.IsInit() && bShapeMaster)
|
||||
{
|
||||
Master->GetLevelUp(pShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
|
||||
|
||||
@ -23,7 +23,7 @@ if "%platform%" == "win_64" (
|
||||
if exist "%SCRIPTPATH%%platform%\icu.zip" (
|
||||
echo "icu already downloaded"
|
||||
) else (
|
||||
Powershell.exe Invoke-WebRequest -OutFile %platform%\icu.zip "%URL%"
|
||||
Powershell.exe Invoke-WebRequest -OutFile %platform%\icu.zip -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox "%URL%"
|
||||
)
|
||||
|
||||
SET UNSIP_PROGRAMM="C:\Program Files\7-Zip\7z.exe"
|
||||
|
||||
@ -35,12 +35,13 @@
|
||||
#include "ContentTypes.h"
|
||||
|
||||
#include "FileType.h"
|
||||
#include "FileTypes.h"
|
||||
|
||||
#include "External/External.h"
|
||||
#include "External/HyperLink.h"
|
||||
#include "Media/Image.h"
|
||||
#include "Media/OleObject.h"
|
||||
#include "FileTypes.h"
|
||||
|
||||
#include "../../../../ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h"
|
||||
#include "../XlsxFormat/FileFactory_Spreadsheet.h"
|
||||
|
||||
namespace OOX
|
||||
@ -252,7 +253,13 @@ namespace OOX
|
||||
return smart_ptr<OleObject>();
|
||||
return pPair->second.smart_dynamic_cast<OleObject>();
|
||||
}
|
||||
|
||||
smart_ptr<PPTX::LegacyDiagramText> IFileContainer::GetLegacyDiagramText(const OOX::RId& rId) const
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
|
||||
if (pPair == m_mContainer.end ())
|
||||
return smart_ptr<PPTX::LegacyDiagramText>();
|
||||
return pPair->second.smart_dynamic_cast<PPTX::LegacyDiagramText>();
|
||||
}
|
||||
const bool IFileContainer::IsExist(const FileType& oType) const
|
||||
{
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator it = m_mContainer.begin(); it != m_mContainer.end(); ++it)
|
||||
|
||||
@ -48,7 +48,12 @@ namespace OOX
|
||||
class Image;
|
||||
class HyperLink;
|
||||
class OleObject;
|
||||
} // OOX
|
||||
}
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
class LegacyDiagramText;
|
||||
}
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
@ -76,9 +81,10 @@ namespace OOX
|
||||
void Read (const OOX::CPath& oRootPath, const OOX::CPath& oPath);
|
||||
void ExtractPictures(const OOX::CPath& oPath) const;
|
||||
|
||||
virtual smart_ptr<Image> GetImage (const RId& rId) const;
|
||||
virtual smart_ptr<HyperLink> GetHyperlink(const RId& rId) const;
|
||||
virtual smart_ptr<OleObject> GetOleObject(const RId& rId) const;
|
||||
virtual smart_ptr<Image> GetImage (const RId& rId) const;
|
||||
virtual smart_ptr<HyperLink> GetHyperlink(const RId& rId) const;
|
||||
virtual smart_ptr<OleObject> GetOleObject(const RId& rId) const;
|
||||
virtual smart_ptr<PPTX::LegacyDiagramText> GetLegacyDiagramText (const OOX::RId& rId) const;
|
||||
|
||||
OOX::CRels* GetCurRls()
|
||||
{
|
||||
|
||||
427
DesktopEditor/common/BigInteger.h
Normal file
427
DesktopEditor/common/BigInteger.h
Normal file
@ -0,0 +1,427 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* 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 _BUILD_BIGINTEGER_CROSSPLATFORM_H_
|
||||
#define _BUILD_BIGINTEGER_CROSSPLATFORM_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
class CBigInteger
|
||||
{
|
||||
protected:
|
||||
std::string m_value;
|
||||
bool m_isNegative;
|
||||
|
||||
public:
|
||||
|
||||
CBigInteger()
|
||||
{
|
||||
m_value = "0";
|
||||
m_isNegative = false;
|
||||
}
|
||||
|
||||
CBigInteger(unsigned char* data, int size)
|
||||
{
|
||||
m_isNegative = false;
|
||||
m_value = "0";
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
CBigInteger tmp((int)data[i]);
|
||||
|
||||
for (int j = size - 1 - i; j > 0; --j)
|
||||
tmp *= 256;
|
||||
|
||||
*this += tmp;
|
||||
}
|
||||
}
|
||||
|
||||
CBigInteger(std::string data, int nBase = 10)
|
||||
{
|
||||
m_isNegative = false;
|
||||
|
||||
if (10 == nBase)
|
||||
{
|
||||
m_value = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_value = "0";
|
||||
int len = (int)data.length();
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
int val = 0;
|
||||
char _c = data[i];
|
||||
if (_c >= '0' && _c <= '9')
|
||||
val = _c - '0';
|
||||
else if (_c >= 'A' && _c <= 'F')
|
||||
val = 10 + _c - 'A';
|
||||
else if (_c >= 'a' && _c <= 'f')
|
||||
val = 10 + _c - 'a';
|
||||
|
||||
CBigInteger tmp(val);
|
||||
for (int j = len - 1 - i; j > 0; --j)
|
||||
tmp *= nBase;
|
||||
|
||||
*this += tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CBigInteger(int value)
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
m_isNegative = true;
|
||||
m_value = std::to_string(-value);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isNegative = false;
|
||||
m_value = std::to_string(value);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetValue()
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
bool IsNegative()
|
||||
{
|
||||
return m_isNegative;
|
||||
}
|
||||
|
||||
void operator = (CBigInteger b)
|
||||
{
|
||||
m_value = b.m_value;
|
||||
m_isNegative = b.m_isNegative;
|
||||
}
|
||||
|
||||
bool operator == (CBigInteger b)
|
||||
{
|
||||
return equals((*this) , b);
|
||||
}
|
||||
|
||||
bool operator != (CBigInteger b)
|
||||
{
|
||||
return !equals((*this) , b);
|
||||
}
|
||||
|
||||
bool operator > (CBigInteger b)
|
||||
{
|
||||
return greater((*this) , b);
|
||||
}
|
||||
|
||||
bool operator < (CBigInteger b)
|
||||
{
|
||||
return less((*this) , b);
|
||||
}
|
||||
|
||||
bool operator >= (CBigInteger b)
|
||||
{
|
||||
return equals((*this) , b) || greater((*this), b);
|
||||
}
|
||||
|
||||
bool operator <= (CBigInteger b)
|
||||
{
|
||||
return equals((*this) , b) || less((*this) , b);
|
||||
}
|
||||
|
||||
CBigInteger absolute()
|
||||
{
|
||||
return CBigInteger(m_value); // +ve by default
|
||||
}
|
||||
|
||||
CBigInteger& operator ++()
|
||||
{
|
||||
// prefix
|
||||
(*this) = (*this) + 1;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
CBigInteger operator ++(int)
|
||||
{
|
||||
// postfix
|
||||
CBigInteger before = (*this);
|
||||
(*this) = (*this) + 1;
|
||||
return before;
|
||||
}
|
||||
|
||||
CBigInteger& operator --()
|
||||
{
|
||||
// prefix
|
||||
(*this) = (*this) - 1;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
CBigInteger operator --(int)
|
||||
{
|
||||
// postfix
|
||||
CBigInteger before = (*this);
|
||||
(*this) = (*this) - 1;
|
||||
return before;
|
||||
}
|
||||
|
||||
CBigInteger operator + (CBigInteger b)
|
||||
{
|
||||
CBigInteger addition;
|
||||
if (m_isNegative == b.m_isNegative)
|
||||
{
|
||||
// both +ve or -ve
|
||||
addition.m_value = (add(m_value, b.m_value));
|
||||
addition.m_isNegative = m_isNegative;
|
||||
}
|
||||
else
|
||||
{
|
||||
// sign different
|
||||
if (absolute() > b.absolute())
|
||||
{
|
||||
addition.m_value = subtract(m_value, b.m_value);
|
||||
addition.m_isNegative = m_isNegative;
|
||||
}
|
||||
else
|
||||
{
|
||||
addition.m_value = subtract(b.m_value, m_value);
|
||||
addition.m_isNegative = b.m_isNegative;
|
||||
}
|
||||
}
|
||||
|
||||
if (addition.m_value == "0") // avoid (-0) problem
|
||||
addition.m_isNegative = false;
|
||||
|
||||
return addition;
|
||||
}
|
||||
|
||||
CBigInteger operator - (CBigInteger b)
|
||||
{
|
||||
b.m_isNegative = !b.m_isNegative; // x - y = x + (-y)
|
||||
return (*this) + b;
|
||||
}
|
||||
|
||||
CBigInteger operator * (CBigInteger b)
|
||||
{
|
||||
CBigInteger mul;
|
||||
|
||||
mul.m_value = multiply(m_value, b.m_value);
|
||||
mul.m_isNegative = (m_isNegative != b.m_isNegative);
|
||||
|
||||
if (mul.m_value == "0") // avoid (-0) problem
|
||||
mul.m_isNegative = false;
|
||||
|
||||
return mul;
|
||||
}
|
||||
|
||||
CBigInteger& operator += (CBigInteger b)
|
||||
{
|
||||
(*this) = (*this) + b;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
CBigInteger& operator -= (CBigInteger b)
|
||||
{
|
||||
(*this) = (*this) - b;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
CBigInteger& operator *= (CBigInteger b)
|
||||
{
|
||||
(*this) = (*this) * b;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
CBigInteger operator -() { // unary minus sign
|
||||
return (*this) * -1;
|
||||
}
|
||||
|
||||
std::string ToString()
|
||||
{
|
||||
// for conversion from BigInteger to string
|
||||
std::string signedString = ( m_isNegative ) ? "-" : ""; // if +ve, don't print + sign
|
||||
signedString += m_value;
|
||||
return signedString;
|
||||
}
|
||||
|
||||
private:
|
||||
bool equals(CBigInteger n1, CBigInteger n2)
|
||||
{
|
||||
return ((n1.m_value == n2.m_value) && (n1.m_isNegative == n2.m_isNegative));
|
||||
}
|
||||
|
||||
bool less(CBigInteger n1, CBigInteger n2)
|
||||
{
|
||||
bool sign1 = n1.m_isNegative;
|
||||
bool sign2 = n2.m_isNegative;
|
||||
|
||||
if (sign1 && !sign2)
|
||||
return true;
|
||||
else if (!sign1 && sign2)
|
||||
return false;
|
||||
else if (!sign1)
|
||||
{
|
||||
std::string::size_type _size1 = n1.m_value.length();
|
||||
std::string::size_type _size2 = n2.m_value.length();
|
||||
if (_size1 < _size2)
|
||||
return true;
|
||||
if (_size1 > _size2)
|
||||
return false;
|
||||
return n1.m_value < n2.m_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string::size_type _size1 = n1.m_value.length();
|
||||
std::string::size_type _size2 = n2.m_value.length();
|
||||
|
||||
if (_size1 > _size2)
|
||||
return true;
|
||||
if (_size1 < _size2)
|
||||
return false;
|
||||
return n1.m_value.compare(n2.m_value) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool greater(CBigInteger n1, CBigInteger n2)
|
||||
{
|
||||
return !equals(n1, n2) && !less(n1, n2);
|
||||
}
|
||||
|
||||
std::string add(std::string number1, std::string number2)
|
||||
{
|
||||
std::string add = (number1.length() > number2.length()) ? number1 : number2;
|
||||
char carry = '0';
|
||||
int differenceInLength = (int)(number1.size() - number2.size());
|
||||
|
||||
if (differenceInLength > 0)
|
||||
number2.insert(0, differenceInLength, '0');
|
||||
else
|
||||
number1.insert(0, -differenceInLength, '0');
|
||||
|
||||
if (differenceInLength < 0)
|
||||
differenceInLength = -differenceInLength;
|
||||
|
||||
for (int i = number1.size() - 1; i >= 0; --i)
|
||||
{
|
||||
add[i] = ((carry-'0')+(number1[i]-'0')+(number2[i]-'0')) + '0';
|
||||
|
||||
if(i != 0)
|
||||
{
|
||||
if(add[i] > '9')
|
||||
{
|
||||
add[i] -= 10;
|
||||
carry = '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
carry = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (add[0] > '9')
|
||||
{
|
||||
add[0] -= 10;
|
||||
add.insert(0, 1, '1');
|
||||
}
|
||||
return add;
|
||||
}
|
||||
|
||||
std::string subtract(std::string number1, std::string number2)
|
||||
{
|
||||
std::string sub = (number1.length() > number2.length()) ? number1 : number2;
|
||||
int differenceInLength = (int)(number1.size() - number2.size());
|
||||
|
||||
if (differenceInLength > 0)
|
||||
number2.insert(0, differenceInLength, '0');
|
||||
else
|
||||
number1.insert(0, -differenceInLength, '0');
|
||||
|
||||
if (differenceInLength < 0)
|
||||
differenceInLength = -differenceInLength;
|
||||
|
||||
for (int i = number1.length() - 1; i >= 0; --i)
|
||||
{
|
||||
if (number1[i] < number2[i])
|
||||
{
|
||||
number1[i] += 10;
|
||||
number1[i-1]--;
|
||||
}
|
||||
sub[i] = ((number1[i]-'0')-(number2[i]-'0')) + '0';
|
||||
}
|
||||
|
||||
while (sub[0]=='0' && sub.length() != 1) // erase leading zeros
|
||||
sub.erase(0, 1);
|
||||
|
||||
return sub;
|
||||
}
|
||||
|
||||
std::string multiply(std::string n1, std::string n2)
|
||||
{
|
||||
if (n1.length() > n2.length())
|
||||
n1.swap(n2);
|
||||
|
||||
std::string res = "0";
|
||||
for (int i = n1.length() - 1; i >= 0; --i)
|
||||
{
|
||||
std::string temp = n2;
|
||||
int currentDigit = n1[i] - '0';
|
||||
int carry = 0;
|
||||
|
||||
for (int j = temp.length() - 1; j >= 0; --j)
|
||||
{
|
||||
temp[j] = ((temp[j]-'0') * currentDigit) + carry;
|
||||
|
||||
if (temp[j] > 9)
|
||||
{
|
||||
carry = (temp[j] / 10);
|
||||
temp[j] -= (carry * 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
carry = 0;
|
||||
}
|
||||
|
||||
temp[j] += '0'; // back to string mood
|
||||
}
|
||||
|
||||
if (carry > 0)
|
||||
temp.insert(0, 1, (carry+'0'));
|
||||
|
||||
temp.append((n1.length() - i - 1), '0'); // as like mult by 10, 100, 1000, 10000 and so on
|
||||
|
||||
res = add(res, temp); // O(n)
|
||||
}
|
||||
|
||||
while (res[0] == '0' && res.length() != 1) // erase leading zeros
|
||||
res.erase(0,1);
|
||||
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_BUILD_BIGINTEGER_CROSSPLATFORM_H_
|
||||
@ -45,7 +45,8 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define U_TO_UTF8(val) NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(val.c_str(), val.length())
|
||||
#define U_TO_UTF8(val) NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(val.c_str(), (LONG)val.length())
|
||||
#define UTF8_TO_U(val) NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)val.c_str(), (LONG)val.length())
|
||||
|
||||
#if defined(__linux__) || defined(_MAC) && !defined(_IOS)
|
||||
#include <unistd.h>
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include "../../libxml2/entities.c"
|
||||
#include "../../libxml2/error.c"
|
||||
#include "../../libxml2/globals.c"
|
||||
#include "../../libxml2/hash.c"
|
||||
#include "../../libxml2/HTMLparser.c"
|
||||
#include "../../libxml2/HTMLtree.c"
|
||||
#include "../../libxml2/legacy.c"
|
||||
@ -16,6 +17,7 @@
|
||||
#include "../../libxml2/nanoftp.c"
|
||||
#include "../../libxml2/nanohttp.c"
|
||||
//#include "../../libxml2/parser.c"
|
||||
#include "../../libxml2/parserInternals.c"
|
||||
#include "../../libxml2/pattern.c"
|
||||
#include "../../libxml2/relaxng.c"
|
||||
#include "../../libxml2/SAX.c"
|
||||
@ -40,5 +42,3 @@
|
||||
#include "../../libxml2/xmlwriter.c"
|
||||
#include "../../libxml2/xpath.c"
|
||||
#include "../../libxml2/xpointer.c"
|
||||
#include "../../libxml2/parserInternals.c"
|
||||
#include "../../libxml2/hash.c"
|
||||
|
||||
@ -593,7 +593,7 @@ Thu Apr 24 13:56:53 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
Tue Apr 22 10:27:17 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* dict.c: improvement on the hashing of the dictionnary, with visible
|
||||
* dict.c: improvement on the hashing of the dictionary, with visible
|
||||
speed up as the number of strings in the hash increases, work from
|
||||
Stefan Behnel
|
||||
|
||||
@ -2479,7 +2479,7 @@ Mon Jan 9 17:27:15 CET 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
|
||||
Mon Jan 9 15:33:16 CET 2006 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c: reverted first patches for #319279 which led to #326295
|
||||
and fixed the problem in DoctRenderer() instead
|
||||
and fixed the problem in xmlParseChunk() instead
|
||||
* test/ent11 result//ent11*: added test for #326295 to the regression
|
||||
suite
|
||||
|
||||
@ -5017,7 +5017,7 @@ Mon Jan 24 00:47:41 CET 2005 Daniel Veillard <daniel@veillard.com>
|
||||
Sun Jan 23 23:54:39 CET 2005 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* hash.c include/libxml/hash.h: added xmlHashCreateDict where
|
||||
the hash reuses the dictionnary for internal strings
|
||||
the hash reuses the dictionary for internal strings
|
||||
* entities.c valid.c parser.c: reuse that new API, leads to a decent
|
||||
speedup when parsing for example DocBook documents.
|
||||
|
||||
@ -5371,7 +5371,7 @@ Fri Nov 26 11:44:36 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
Wed Nov 24 13:41:52 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* dict.c include/libxml/dict.h: added xmlDictExists() to the
|
||||
dictionnary interface.
|
||||
dictionary interface.
|
||||
* xmlreader.c: applying xmlTextReaderHasAttributes fix for namespaces
|
||||
from Rob Richards
|
||||
|
||||
@ -5697,7 +5697,7 @@ Tue Oct 26 23:57:02 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||
Tue Oct 26 18:09:59 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* debugXML.c include/libxml/xmlerror.h: added checking for names
|
||||
values and dictionnaries generates a tons of errors
|
||||
values and dictionaries generates a tons of errors
|
||||
* SAX2.ccatalog.c parser.c relaxng.c tree.c xinclude.c xmlwriter.c
|
||||
include/libxml/tree.h: fixing the errors in the regression tests
|
||||
|
||||
@ -7746,14 +7746,14 @@ Fri Jan 23 14:03:21 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
make tests
|
||||
* xpath.c include/libxml/xpath.h: added xmlXPathCtxtCompile() to
|
||||
compile an XPath expression within a context, currently the goal
|
||||
is to be able to reuse the XSLT stylesheet dictionnary, but this
|
||||
is to be able to reuse the XSLT stylesheet dictionary, but this
|
||||
opens the door to others possible optimizations.
|
||||
* dict.c include/libxml/dict.h: added xmlDictCreateSub() which allows
|
||||
to build a new dictionnary based on another read-only dictionnary.
|
||||
This is needed for XSLT to keep the stylesheet dictionnary read-only
|
||||
to build a new dictionary based on another read-only dictionary.
|
||||
This is needed for XSLT to keep the stylesheet dictionary read-only
|
||||
while being able to reuse the strings for the transformation
|
||||
dictionnary.
|
||||
* xinclude.c: fixed a dictionnar reference counting problem occuring
|
||||
dictionary.
|
||||
* xinclude.c: fixed a dictionary reference counting problem occuring
|
||||
when document parsing failed.
|
||||
* testSAX.c: adding option --repeat for timing 100times the parsing
|
||||
* doc/* : rebuilt all the docs
|
||||
@ -7806,7 +7806,7 @@ Mon Jan 12 17:22:57 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
Thu Jan 8 17:57:50 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlschemas.c: removed a memory leak remaining from the switch
|
||||
to a dictionnary for string allocations c.f. #130891
|
||||
to a dictionary for string allocations c.f. #130891
|
||||
|
||||
Thu Jan 8 17:48:46 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
@ -7928,7 +7928,7 @@ Fri Jan 2 22:58:29 HKT 2004 William Brack <wbrack@mmm.com.hk>
|
||||
Fri Jan 2 11:40:06 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* SAX2.c: found and fixed a bug misallocating some non
|
||||
blank text node strings from the dictionnary.
|
||||
blank text node strings from the dictionary.
|
||||
* xmlmemory.c: fixed a problem with the memory debug mutex
|
||||
release.
|
||||
|
||||
@ -9386,7 +9386,7 @@ Sat Sep 27 01:25:39 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c: William's change allowed to spot a nasty bug in xmlDoRead
|
||||
if the result is not well formed that ctxt->myDoc is not NULL
|
||||
and uses the context dictionnary.
|
||||
and uses the context dictionary.
|
||||
|
||||
Fri Sep 26 21:09:34 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ docbParseChunk(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (DoctRenderer(ctxt, chunk, size, terminate));
|
||||
return (xmlParseChunk(ctxt, chunk, size, terminate));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -105,7 +105,7 @@ htmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
|
||||
*
|
||||
* Handle a fatal parser error, i.e. violating Well-Formedness constraints
|
||||
*/
|
||||
static void
|
||||
static void LIBXML_ATTR_FORMAT(3,0)
|
||||
htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar *str1, const xmlChar *str2)
|
||||
{
|
||||
@ -132,7 +132,7 @@ htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
*
|
||||
* Handle a fatal parser error, i.e. violating Well-Formedness constraints
|
||||
*/
|
||||
static void
|
||||
static void LIBXML_ATTR_FORMAT(3,0)
|
||||
htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, int val)
|
||||
{
|
||||
@ -303,6 +303,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
|
||||
#define UPP(val) (toupper(ctxt->input->cur[(val)]))
|
||||
|
||||
#define CUR_PTR ctxt->input->cur
|
||||
#define BASE_PTR ctxt->input->base
|
||||
|
||||
#define SHRINK if ((ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
|
||||
(ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
|
||||
@ -1177,7 +1178,7 @@ static const char *const htmlScriptAttributes[] = {
|
||||
"onfocus",
|
||||
"onblur",
|
||||
"onsubmit",
|
||||
"onrest",
|
||||
"onreset",
|
||||
"onchange",
|
||||
"onselect"
|
||||
};
|
||||
@ -2471,6 +2472,10 @@ htmlParseName(htmlParserCtxtPtr ctxt) {
|
||||
(*in == '_') || (*in == '-') ||
|
||||
(*in == ':') || (*in == '.'))
|
||||
in++;
|
||||
|
||||
if (in == ctxt->input->end)
|
||||
return(NULL);
|
||||
|
||||
if ((*in > 0) && (*in < 0x80)) {
|
||||
count = in - ctxt->input->cur;
|
||||
ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count);
|
||||
@ -2488,6 +2493,7 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) {
|
||||
int len = 0, l;
|
||||
int c;
|
||||
int count = 0;
|
||||
const xmlChar *base = ctxt->input->base;
|
||||
|
||||
/*
|
||||
* Handler for more complex cases
|
||||
@ -2513,7 +2519,18 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) {
|
||||
len += l;
|
||||
NEXTL(l);
|
||||
c = CUR_CHAR(l);
|
||||
if (ctxt->input->base != base) {
|
||||
/*
|
||||
* We changed encoding from an unknown encoding
|
||||
* Input buffer changed location, so we better start again
|
||||
*/
|
||||
return(htmlParseNameComplex(ctxt));
|
||||
}
|
||||
}
|
||||
|
||||
if (ctxt->input->base > ctxt->input->cur - len)
|
||||
return(NULL);
|
||||
|
||||
return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
|
||||
}
|
||||
|
||||
@ -2765,31 +2782,43 @@ htmlParseAttValue(htmlParserCtxtPtr ctxt) {
|
||||
|
||||
static xmlChar *
|
||||
htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
|
||||
const xmlChar *q;
|
||||
size_t len = 0, startPosition = 0;
|
||||
xmlChar *ret = NULL;
|
||||
|
||||
if (CUR == '"') {
|
||||
NEXT;
|
||||
q = CUR_PTR;
|
||||
while ((IS_CHAR_CH(CUR)) && (CUR != '"'))
|
||||
|
||||
if (CUR_PTR < BASE_PTR)
|
||||
return(ret);
|
||||
startPosition = CUR_PTR - BASE_PTR;
|
||||
|
||||
while ((IS_CHAR_CH(CUR)) && (CUR != '"')) {
|
||||
NEXT;
|
||||
len++;
|
||||
}
|
||||
if (!IS_CHAR_CH(CUR)) {
|
||||
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
|
||||
"Unfinished SystemLiteral\n", NULL, NULL);
|
||||
} else {
|
||||
ret = xmlStrndup(q, CUR_PTR - q);
|
||||
ret = xmlStrndup((BASE_PTR+startPosition), len);
|
||||
NEXT;
|
||||
}
|
||||
} else if (CUR == '\'') {
|
||||
NEXT;
|
||||
q = CUR_PTR;
|
||||
while ((IS_CHAR_CH(CUR)) && (CUR != '\''))
|
||||
|
||||
if (CUR_PTR < BASE_PTR)
|
||||
return(ret);
|
||||
startPosition = CUR_PTR - BASE_PTR;
|
||||
|
||||
while ((IS_CHAR_CH(CUR)) && (CUR != '\'')) {
|
||||
NEXT;
|
||||
len++;
|
||||
}
|
||||
if (!IS_CHAR_CH(CUR)) {
|
||||
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
|
||||
"Unfinished SystemLiteral\n", NULL, NULL);
|
||||
} else {
|
||||
ret = xmlStrndup(q, CUR_PTR - q);
|
||||
ret = xmlStrndup((BASE_PTR+startPosition), len);
|
||||
NEXT;
|
||||
}
|
||||
} else {
|
||||
@ -2813,32 +2842,47 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
|
||||
|
||||
static xmlChar *
|
||||
htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
|
||||
const xmlChar *q;
|
||||
size_t len = 0, startPosition = 0;
|
||||
xmlChar *ret = NULL;
|
||||
/*
|
||||
* Name ::= (Letter | '_') (NameChar)*
|
||||
*/
|
||||
if (CUR == '"') {
|
||||
NEXT;
|
||||
q = CUR_PTR;
|
||||
while (IS_PUBIDCHAR_CH(CUR)) NEXT;
|
||||
|
||||
if (CUR_PTR < BASE_PTR)
|
||||
return(ret);
|
||||
startPosition = CUR_PTR - BASE_PTR;
|
||||
|
||||
while (IS_PUBIDCHAR_CH(CUR)) {
|
||||
len++;
|
||||
NEXT;
|
||||
}
|
||||
|
||||
if (CUR != '"') {
|
||||
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
|
||||
"Unfinished PubidLiteral\n", NULL, NULL);
|
||||
} else {
|
||||
ret = xmlStrndup(q, CUR_PTR - q);
|
||||
ret = xmlStrndup((BASE_PTR + startPosition), len);
|
||||
NEXT;
|
||||
}
|
||||
} else if (CUR == '\'') {
|
||||
NEXT;
|
||||
q = CUR_PTR;
|
||||
while ((IS_PUBIDCHAR_CH(CUR)) && (CUR != '\''))
|
||||
NEXT;
|
||||
|
||||
if (CUR_PTR < BASE_PTR)
|
||||
return(ret);
|
||||
startPosition = CUR_PTR - BASE_PTR;
|
||||
|
||||
while ((IS_PUBIDCHAR_CH(CUR)) && (CUR != '\'')){
|
||||
len++;
|
||||
NEXT;
|
||||
}
|
||||
|
||||
if (CUR != '\'') {
|
||||
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
|
||||
"Unfinished PubidLiteral\n", NULL, NULL);
|
||||
} else {
|
||||
ret = xmlStrndup(q, CUR_PTR - q);
|
||||
ret = xmlStrndup((BASE_PTR + startPosition), len);
|
||||
NEXT;
|
||||
}
|
||||
} else {
|
||||
@ -2948,8 +2992,9 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
|
||||
|
||||
|
||||
/**
|
||||
* htmlParseCharData:
|
||||
* htmlParseCharDataInternal:
|
||||
* @ctxt: an HTML parser context
|
||||
* @readahead: optional read ahead character in ascii range
|
||||
*
|
||||
* parse a CharData section.
|
||||
* if we are within a CDATA section ']]>' marks an end of section.
|
||||
@ -2958,12 +3003,15 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
|
||||
*/
|
||||
|
||||
static void
|
||||
htmlParseCharData(htmlParserCtxtPtr ctxt) {
|
||||
xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 5];
|
||||
htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) {
|
||||
xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 6];
|
||||
int nbchar = 0;
|
||||
int cur, l;
|
||||
int chunk = 0;
|
||||
|
||||
if (readahead)
|
||||
buf[nbchar++] = readahead;
|
||||
|
||||
SHRINK;
|
||||
cur = CUR_CHAR(l);
|
||||
while (((cur != '<') || (ctxt->token == '<')) &&
|
||||
@ -3042,6 +3090,21 @@ htmlParseCharData(htmlParserCtxtPtr ctxt) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* htmlParseCharData:
|
||||
* @ctxt: an HTML parser context
|
||||
*
|
||||
* parse a CharData section.
|
||||
* if we are within a CDATA section ']]>' marks an end of section.
|
||||
*
|
||||
* [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
|
||||
*/
|
||||
|
||||
static void
|
||||
htmlParseCharData(htmlParserCtxtPtr ctxt) {
|
||||
htmlParseCharDataInternal(ctxt, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* htmlParseExternalID:
|
||||
* @ctxt: an HTML parser context
|
||||
@ -3245,12 +3308,17 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
|
||||
ctxt->instate = state;
|
||||
return;
|
||||
}
|
||||
len = 0;
|
||||
buf[len] = 0;
|
||||
q = CUR_CHAR(ql);
|
||||
if (!IS_CHAR(q))
|
||||
goto unfinished;
|
||||
NEXTL(ql);
|
||||
r = CUR_CHAR(rl);
|
||||
if (!IS_CHAR(r))
|
||||
goto unfinished;
|
||||
NEXTL(rl);
|
||||
cur = CUR_CHAR(l);
|
||||
len = 0;
|
||||
while (IS_CHAR(cur) &&
|
||||
((cur != '>') ||
|
||||
(r != '-') || (q != '-'))) {
|
||||
@ -3281,18 +3349,20 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
|
||||
}
|
||||
}
|
||||
buf[len] = 0;
|
||||
if (!IS_CHAR(cur)) {
|
||||
htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
|
||||
"Comment not terminated \n<!--%.50s\n", buf, NULL);
|
||||
xmlFree(buf);
|
||||
} else {
|
||||
if (IS_CHAR(cur)) {
|
||||
NEXT;
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
ctxt->sax->comment(ctxt->userData, buf);
|
||||
xmlFree(buf);
|
||||
ctxt->instate = state;
|
||||
return;
|
||||
}
|
||||
ctxt->instate = state;
|
||||
|
||||
unfinished:
|
||||
htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
|
||||
"Comment not terminated \n<!--%.50s\n", buf, NULL);
|
||||
xmlFree(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3671,13 +3741,13 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
|
||||
int i;
|
||||
int discardtag = 0;
|
||||
|
||||
if (ctxt->instate == XML_PARSER_EOF)
|
||||
return(-1);
|
||||
if ((ctxt == NULL) || (ctxt->input == NULL)) {
|
||||
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
|
||||
"htmlParseStartTag: context error\n", NULL, NULL);
|
||||
return -1;
|
||||
}
|
||||
if (ctxt->instate == XML_PARSER_EOF)
|
||||
return(-1);
|
||||
if (CUR != '<') return -1;
|
||||
NEXT;
|
||||
|
||||
@ -3690,6 +3760,14 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
|
||||
htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED,
|
||||
"htmlParseStartTag: invalid element name\n",
|
||||
NULL, NULL);
|
||||
/* if recover preserve text on classic misconstructs */
|
||||
if ((ctxt->recovery) && ((IS_BLANK_CH(CUR)) || (CUR == '<') ||
|
||||
(CUR == '=') || (CUR == '>') || (((CUR >= '0') && (CUR <= '9'))))) {
|
||||
htmlParseCharDataInternal(ctxt, '<');
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
/* Dump the bogus tag like browsers do */
|
||||
while ((IS_CHAR_CH(CUR)) && (CUR != '>') &&
|
||||
(ctxt->instate != XML_PARSER_EOF))
|
||||
@ -4366,7 +4444,7 @@ static void
|
||||
htmlParseElementInternal(htmlParserCtxtPtr ctxt) {
|
||||
const xmlChar *name;
|
||||
const htmlElemDesc * info;
|
||||
htmlParserNodeInfo node_info;
|
||||
htmlParserNodeInfo node_info = { 0, };
|
||||
int failed;
|
||||
|
||||
if ((ctxt == NULL) || (ctxt->input == NULL)) {
|
||||
@ -5701,17 +5779,17 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
||||
if (ctxt->keepBlanks) {
|
||||
if (ctxt->sax->characters != NULL)
|
||||
ctxt->sax->characters(
|
||||
ctxt->userData, &cur, 1);
|
||||
ctxt->userData, &in->cur[0], 1);
|
||||
} else {
|
||||
if (ctxt->sax->ignorableWhitespace != NULL)
|
||||
ctxt->sax->ignorableWhitespace(
|
||||
ctxt->userData, &cur, 1);
|
||||
ctxt->userData, &in->cur[0], 1);
|
||||
}
|
||||
} else {
|
||||
htmlCheckParagraph(ctxt);
|
||||
if (ctxt->sax->characters != NULL)
|
||||
ctxt->sax->characters(
|
||||
ctxt->userData, &cur, 1);
|
||||
ctxt->userData, &in->cur[0], 1);
|
||||
}
|
||||
}
|
||||
ctxt->token = 0;
|
||||
@ -6288,12 +6366,16 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
|
||||
|
||||
/* set encoding */
|
||||
if (encoding) {
|
||||
content = xmlMallocAtomic (xmlStrlen(content_line) + strlen(encoding) + 1);
|
||||
if (content) {
|
||||
strcpy ((char *)content, (char *)content_line);
|
||||
strcat ((char *)content, (char *)encoding);
|
||||
htmlCheckEncoding (ctxt, content);
|
||||
xmlFree (content);
|
||||
size_t l = strlen(encoding);
|
||||
|
||||
if (l < 1000) {
|
||||
content = xmlMallocAtomic (xmlStrlen(content_line) + l + 1);
|
||||
if (content) {
|
||||
strcpy ((char *)content, (char *)content_line);
|
||||
strcat ((char *)content, (char *)encoding);
|
||||
htmlCheckEncoding (ctxt, content);
|
||||
xmlFree (content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6499,7 +6581,7 @@ htmlNodeStatus(const htmlNodePtr node, int legacy) {
|
||||
* DICT_FREE:
|
||||
* @str: a string
|
||||
*
|
||||
* Free a string if it is not owned by the "dict" dictionnary in the
|
||||
* Free a string if it is not owned by the "dict" dictionary in the
|
||||
* current scope
|
||||
*/
|
||||
#define DICT_FREE(str) \
|
||||
@ -6808,6 +6890,7 @@ htmlReadFd(int fd, const char *URL, const char *encoding, int options)
|
||||
|
||||
if (fd < 0)
|
||||
return (NULL);
|
||||
xmlInitParser();
|
||||
|
||||
xmlInitParser();
|
||||
input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
|
||||
@ -6898,6 +6981,7 @@ htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur,
|
||||
return (NULL);
|
||||
if (ctxt == NULL)
|
||||
return (NULL);
|
||||
xmlInitParser();
|
||||
|
||||
htmlCtxtReset(ctxt);
|
||||
|
||||
@ -6931,6 +7015,7 @@ htmlCtxtReadFile(htmlParserCtxtPtr ctxt, const char *filename,
|
||||
return (NULL);
|
||||
if (ctxt == NULL)
|
||||
return (NULL);
|
||||
xmlInitParser();
|
||||
|
||||
htmlCtxtReset(ctxt);
|
||||
|
||||
@ -6967,6 +7052,7 @@ htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size,
|
||||
return (NULL);
|
||||
if (buffer == NULL)
|
||||
return (NULL);
|
||||
xmlInitParser();
|
||||
|
||||
htmlCtxtReset(ctxt);
|
||||
|
||||
@ -7009,6 +7095,7 @@ htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd,
|
||||
return (NULL);
|
||||
if (ctxt == NULL)
|
||||
return (NULL);
|
||||
xmlInitParser();
|
||||
|
||||
htmlCtxtReset(ctxt);
|
||||
|
||||
@ -7053,6 +7140,7 @@ htmlCtxtReadIO(htmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
|
||||
return (NULL);
|
||||
if (ctxt == NULL)
|
||||
return (NULL);
|
||||
xmlInitParser();
|
||||
|
||||
htmlCtxtReset(ctxt);
|
||||
|
||||
|
||||
@ -668,7 +668,8 @@ htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
xmlOutputBufferWriteString(buf, " ");
|
||||
xmlBufWriteQuotedString(buf->buffer, cur->SystemID);
|
||||
}
|
||||
} else if (cur->SystemID != NULL) {
|
||||
} else if (cur->SystemID != NULL &&
|
||||
xmlStrcmp(cur->SystemID, BAD_CAST "about:legacy-compat")) {
|
||||
xmlOutputBufferWriteString(buf, " SYSTEM ");
|
||||
xmlBufWriteQuotedString(buf->buffer, cur->SystemID);
|
||||
}
|
||||
|
||||
@ -216,6 +216,10 @@ check-valgrind valgrind: all
|
||||
@echo '## Go get a cup of coffee it is gonna take a while ...'
|
||||
$(MAKE) CHECKER='valgrind -q' runtests
|
||||
|
||||
asan:
|
||||
@echo '## rebuilding for ASAN'
|
||||
./configure CFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" CXXFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" LDFLAGS="-fsanitize=address,undefined" CC="clang" CXX="clang++" --disable-shared ; OptimOff ; $(MAKE) clean ; $(MAKE)
|
||||
|
||||
testall : tests SVGtests SAXtests
|
||||
|
||||
tests: XMLtests XMLenttests NStests IDtests Errtests APItests $(READER_TEST) $(TEST_SAX) $(TEST_PUSH) $(TEST_HTML) $(TEST_PHTML) $(TEST_VALID) URItests $(TEST_PATTERN) $(TEST_XPATH) $(TEST_XPTR) $(TEST_XINCLUDE) $(TEST_C14N) $(TEST_DEBUG) $(TEST_CATALOG) $(TEST_REGEXPS) $(TEST_SCHEMAS) $(TEST_SCHEMATRON) $(TEST_THREADS) Timingtests $(TEST_VTIME) $(PYTHON_TESTS) $(TEST_MODULES)
|
||||
@ -1164,7 +1168,7 @@ cleanup:
|
||||
|
||||
dist-hook: cleanup libxml2.spec
|
||||
-cp libxml2.spec $(distdir)
|
||||
(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git win32 macos vms VxWorks bakefile test result) | (cd $(distdir); tar xf -)
|
||||
(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git win32 macos os400 vms VxWorks bakefile test result) | (cd $(distdir); tar xf -)
|
||||
|
||||
dist-source: distdir
|
||||
$(AMTAR) -chof - --exclude Tests --exclude test --exclude result $(distdir) | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-sources+"`.tar.gz
|
||||
@ -1207,6 +1211,7 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \
|
||||
check-xsddata-test-suite.py check-xinclude-test-suite.py \
|
||||
example/Makefile.am example/gjobread.c example/gjobs.xml \
|
||||
$(man_MANS) libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \
|
||||
libxml2-config.cmake.in autogen.sh \
|
||||
trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
|
||||
triop.h triodef.h libxml.h elfgcchack.h xzlib.h buf.h \
|
||||
enc.h save.h testThreadsWin32.c genUnicode.py TODO_SCHEMAS \
|
||||
@ -1218,6 +1223,9 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libxml-2.0.pc
|
||||
|
||||
cmakedir = $(libdir)/cmake/libxml2
|
||||
cmake_DATA = libxml2-config.cmake
|
||||
|
||||
#
|
||||
# Install the tests program sources as examples
|
||||
#
|
||||
|
||||
@ -4,17 +4,647 @@
|
||||
Note that this is automatically generated from the news webpage at:
|
||||
http://xmlsoft.org/news.html
|
||||
|
||||
Items not finished and worked on, get in touch with the list if you want
|
||||
to help those - More testing on RelaxNG
|
||||
- Finishing up XML
|
||||
Schemas
|
||||
|
||||
The change log at
|
||||
ChangeLog.html
|
||||
describes the recents commits
|
||||
to the SVN at
|
||||
http://svn.gnome.org/viewvc/libxml2/trunk/
|
||||
to the GIT at
|
||||
http://git.gnome.org/browse/libxml2/
|
||||
code base.Here is the list of public releases:
|
||||
2.9.2: Oct 16 2014:
|
||||
- Security:
|
||||
Fix for CVE-2014-3660 billion laugh variant (Daniel Veillard),
|
||||
CVE-2014-0191 Do not fetch external parameter entities (Daniel Veillard)
|
||||
|
||||
- Bug Fixes:
|
||||
fix memory leak xml header encoding field with XML_PARSE_IGNORE_ENC (Bart De Schuymer),
|
||||
xmlmemory: handle realloc properly (Yegor Yefremov),
|
||||
Python generator bug raised by the const change (Daniel Veillard),
|
||||
Windows Critical sections not released correctly (Daniel Veillard),
|
||||
Parser error on repeated recursive entity expansion containing < (Daniel Veillard),
|
||||
xpointer : fixing Null Pointers (Gaurav Gupta),
|
||||
Remove Unnecessary Null check in xpointer.c (Gaurav Gupta),
|
||||
parser bug on misformed namespace attributes (Dennis Filder),
|
||||
Pointer dereferenced before null check (Daniel Veillard),
|
||||
Leak of struct addrinfo in xmlNanoFTPConnect() (Gaurav Gupta),
|
||||
Possible overflow in HTMLParser.c (Daniel Veillard),
|
||||
python/tests/sync.py assumes Python dictionaries are ordered (John Beck),
|
||||
Fix Enum check and missing break (Gaurav Gupta),
|
||||
xmlIO: Handle error returns from dup() (Philip Withnall),
|
||||
Fix a problem properly saving URIs (Daniel Veillard),
|
||||
wrong error column in structured error when parsing attribute values (Juergen Keil),
|
||||
wrong error column in structured error when skipping whitespace in xml decl (Juergen Keil),
|
||||
no error column in structured error handler for xml schema validation errors (Juergen Keil),
|
||||
Couple of Missing Null checks (Gaurav Gupta),
|
||||
Add couple of missing Null checks (Daniel Veillard),
|
||||
xmlschemastypes: Fix potential array overflow (Philip Withnall),
|
||||
runtest: Fix a memory leak on parse failure (Philip Withnall),
|
||||
xmlIO: Fix an FD leak on gzdopen() failure (Philip Withnall),
|
||||
xmlcatalog: Fix a memory leak on quit (Philip Withnall),
|
||||
HTMLparser: Correctly initialise a stack allocated structure (Philip Withnall),
|
||||
Check for tmon in _xmlSchemaDateAdd() is incorrect (David Kilzer),
|
||||
Avoid Possible Null Pointer in trio.c (Gaurav Gupta),
|
||||
Fix processing in SAX2 in case of an allocation failure (Daniel Veillard),
|
||||
XML Shell command "cd" does not handle "/" at end of path (Daniel Veillard),
|
||||
Fix various Missing Null checks (Gaurav Gupta),
|
||||
Fix a potential NULL dereference (Daniel Veillard),
|
||||
Add a couple of misisng check in xmlRelaxNGCleanupTree (Gaurav Gupta),
|
||||
Add a missing argument check (Gaurav Gupta),
|
||||
Adding a check in case of allocation error (Gaurav Gupta),
|
||||
xmlSaveUri() incorrectly recomposes URIs with rootless paths (Dennis Filder),
|
||||
Adding some missing NULL checks (Gaurav),
|
||||
Fixes for xmlInitParserCtxt (Daniel Veillard),
|
||||
Fix regressions introduced by CVE-2014-0191 patch (Daniel Veillard),
|
||||
erroneously ignores a validation error if no error callback set (Daniel Veillard),
|
||||
xmllint was not parsing the --c14n11 flag (Sérgio Batista),
|
||||
Avoid Possible null pointer dereference in memory debug mode (Gaurav),
|
||||
Avoid Double Null Check (Gaurav),
|
||||
Restore context size and position after XPATH_OP_ARG (Nick Wellnhofer),
|
||||
Fix xmlParseInNodeContext() if node is not element (Daniel Veillard),
|
||||
Avoid a possible NULL pointer dereference (Gaurav),
|
||||
Fix xmlTextWriterWriteElement when a null content is given (Daniel Veillard),
|
||||
Fix an typo 'onrest' in htmlScriptAttributes (Daniel Veillard),
|
||||
fixing a ptotential uninitialized access (Daniel Veillard),
|
||||
Fix an fd leak in an error case (Daniel Veillard),
|
||||
Missing initialization for the catalog module (Daniel Veillard),
|
||||
Handling of XPath function arguments in error case (Nick Wellnhofer),
|
||||
Fix a couple of missing NULL checks (Gaurav),
|
||||
Avoid a possibility of dangling encoding handler (Gaurav),
|
||||
Fix HTML push parser to accept HTML_PARSE_NODEFDTD (Arnold Hendriks),
|
||||
Fix a bug loading some compressed files (Mike Alexander),
|
||||
Fix XPath node comparison bug (Gaurav),
|
||||
Type mismatch in xmlschemas.c (Gaurav),
|
||||
Type mismatch in xmlschemastypes.c (Gaurav),
|
||||
Avoid a deadcode in catalog.c (Daniel Veillard),
|
||||
run close socket on Solaris, same as we do on other platforms (Denis Pauk),
|
||||
Fix pointer dereferenced before null check (Gaurav),
|
||||
Fix a potential NULL dereference in tree code (Daniel Veillard),
|
||||
Fix potential NULL pointer dereferences in regexp code (Gaurav),
|
||||
xmllint --pretty crashed without following numeric argument (Tim Galeckas),
|
||||
Fix XPath expressions of the form '@ns:*' (Nick Wellnhofer),
|
||||
Fix XPath '//' optimization with predicates (Nick Wellnhofer),
|
||||
Clear up a potential NULL dereference (Daniel Veillard),
|
||||
Fix a possible NULL dereference (Gaurav),
|
||||
Avoid crash if allocation fails (Daniel Veillard),
|
||||
Remove occasional leading space in XPath number formatting (Daniel Veillard),
|
||||
Fix handling of mmap errors (Daniel Veillard),
|
||||
Catch malloc error and exit accordingly (Daniel Veillard),
|
||||
missing else in xlink.c (Ami Fischman),
|
||||
Fix a parsing bug on non-ascii element and CR/LF usage (Daniel Veillard),
|
||||
Fix a regression in xmlGetDocCompressMode() (Daniel Veillard),
|
||||
properly quote the namespace uris written out during c14n (Aleksey Sanin),
|
||||
Remove premature XInclude check on URI being relative (Alexey Neyman),
|
||||
Fix missing break on last() function for attributes (dcb),
|
||||
Do not URI escape in server side includes (Romain Bondue),
|
||||
Fix an error in xmlCleanupParser (Alexander Pastukhov)
|
||||
|
||||
- Documentation:
|
||||
typo in error messages "colon are forbidden from..." (Daniel Veillard),
|
||||
Fix a link to James SAX documentation old page (Daniel Veillard),
|
||||
Fix typos in relaxng.c (Jan Pokorný),
|
||||
Fix a doc typo (Daniel Veillard),
|
||||
Fix typos in {tree,xpath}.c (errror) (Jan Pokorný),
|
||||
Add limitations about encoding conversion (Daniel Veillard),
|
||||
Fix typos in xmlschemas{,types}.c (Jan Pokorný),
|
||||
Fix incorrect spelling entites->entities (Jan Pokorný),
|
||||
Forgot to document 2.9.1 release, regenerate docs (Daniel Veillard)
|
||||
|
||||
- Portability:
|
||||
AC_CONFIG_FILES and executable bit (Roumen Petrov),
|
||||
remove HAVE_CONFIG_H dependency in testlimits.c (Roumen Petrov),
|
||||
fix some tabs mixing incompatible with python3 (Roumen Petrov),
|
||||
Visual Studio 14 CTP defines snprintf() (Francis Dupont),
|
||||
OS400: do not try to copy unexisting doc files (Patrick Monnerat),
|
||||
OS400: use either configure.ac or configure.in. (Patrick Monnerat),
|
||||
os400: make-src.sh: create physical file with target CCSID (Patrick Monnerat),
|
||||
OS400: Add some more C macros equivalent procedures. (Patrick Monnerat),
|
||||
OS400: use C macros to implement equivalent RPG support procedures. (Patrick Monnerat),
|
||||
OS400: implement XPath macros as procedures for ILE/RPG support. (Patrick Monnerat),
|
||||
OS400: include in distribution tarball. (Patrick Monnerat),
|
||||
OS400: Add README: compilation directives and OS/400 specific stuff. (Patrick Monnerat),
|
||||
OS400: Add compilation scripts. (Patrick Monnerat),
|
||||
OS400: ILE RPG language header files. (Patrick Monnerat),
|
||||
OS400: implement some macros as functions for ILE/RPG language support (that as no macros). (Patrick Monnerat),
|
||||
OS400: UTF8<-->EBCDIC wrappers for system and external library calls (Patrick Monnerat),
|
||||
OS400: Easy character transcoding support (Patrick Monnerat),
|
||||
OS400: iconv functions compatibility wrappers and table builder. (Patrick Monnerat),
|
||||
OS400: create architecture directory. Implement dlfcn emulation. (Patrick Monnerat),
|
||||
Fix building when configuring without xpath and xptr (Daniel Veillard),
|
||||
configure: Add --with-python-install-dir (Jonas Eriksson),
|
||||
Fix compilation with minimum and xinclude. (Nicolas Le Cam),
|
||||
Compile out use of xmlValidateNCName() when not available. (Nicolas Le Cam),
|
||||
Fix compilation with minimum and schematron. (Nicolas Le Cam),
|
||||
Legacy needs xmlSAX2StartElement() and xmlSAX2EndElement(). (Nicolas Le Cam),
|
||||
Don't use xmlValidateName() when not available. (Nicolas Le Cam),
|
||||
Fix a portability issue on Windows (Longstreth Jon),
|
||||
Various portability patches for OpenVMS (Jacob (Jouk) Jansen),
|
||||
Use specific macros for portability to OS/400 (Patrick Monnerat),
|
||||
Add macros needed for OS/400 portability (Patrick Monnerat),
|
||||
Portability patch for fopen on OS/400 (Patrick Monnerat),
|
||||
Portability fixes for OS/400 (Patrick Monnerat),
|
||||
Improve va_list portability (Patrick Monnerat),
|
||||
Portability fix (Patrick Monnerat),
|
||||
Portability fix (Patrick Monnerat),
|
||||
Generic portability fix (Patrick Monnerat),
|
||||
Shortening lines in headers (Patrick Monnerat),
|
||||
build: Use pkg-config to find liblzma in preference to AC_CHECK_LIB (Philip Withnall),
|
||||
build: Add @LZMA_LIBS@ to libxml’s pkg-config files (Philip Withnall),
|
||||
fix some tabs mixing incompatible with python3 (Daniel Veillard),
|
||||
add additional defines checks for support "./configure --with-minimum" (Denis Pauk),
|
||||
Another round of fixes for older versions of Python (Arfrever Frehtes Taifersar Arahesis),
|
||||
python: fix drv_libxml2.py for python3 compatibility (Alexandre Rostovtsev),
|
||||
python: Fix compiler warnings when building python3 bindings (Armin K),
|
||||
Fix for compilation with python 2.6.8 (Petr Sumbera)
|
||||
|
||||
- Improvements:
|
||||
win32/libxml2.def.src after rebuild in doc (Roumen Petrov),
|
||||
elfgcchack.h: more legacy needs xmlSAX2StartElement() and xmlSAX2EndElement() (Roumen Petrov),
|
||||
elfgcchack.h: add xmlXPathNodeEval and xmlXPathSetContextNode (Roumen Petrov),
|
||||
Provide cmake module (Samuel Martin),
|
||||
Fix a couple of issues raised by make dist (Daniel Veillard),
|
||||
Fix and add const qualifiers (Kurt Roeckx),
|
||||
Preparing for upcoming release of 2.9.2 (Daniel Veillard),
|
||||
Fix zlib and lzma libraries check via command line (Dmitriy),
|
||||
wrong error column in structured error when parsing end tag (Juergen Keil),
|
||||
doc/news.html: small update to avoid line join while generating NEWS. (Patrick Monnerat),
|
||||
Add methods for python3 iterator (Ron Angeles),
|
||||
Support element node traversal in document fragments. (Kyle VanderBeek),
|
||||
xmlNodeSetName: Allow setting the name to a substring of the currently set name (Tristan Van Berkom),
|
||||
Added macros for argument casts (Eric Zurcher),
|
||||
adding init calls to xml and html Read parsing entry points (Daniel Veillard),
|
||||
Get rid of 'REPLACEMENT CHARACTER' Unicode chars in xmlschemas.c (Jan Pokorný),
|
||||
Implement choice for name classes on attributes (Shaun McCance),
|
||||
Two small namespace tweaks (Daniel Veillard),
|
||||
xmllint --memory should fail on empty files (Daniel Veillard),
|
||||
Cast encoding name to char pointer to match arg type (Nikolay Sivov)
|
||||
|
||||
- Cleanups:
|
||||
Removal of old configure.in (Daniel Veillard),
|
||||
Unreachable code in tree.c (Gaurav Gupta),
|
||||
Remove a couple of dead conditions (Gaurav Gupta),
|
||||
Avoid some dead code and cleanup in relaxng.c (Gaurav),
|
||||
Drop not needed checks (Denis Pauk),
|
||||
Fix a wrong test (Daniel Veillard)
|
||||
|
||||
|
||||
|
||||
2.9.1: Apr 19 2013:
|
||||
- Features:
|
||||
Support for Python3 (Daniel Veillard),
|
||||
Add xmlXPathSetContextNode and xmlXPathNodeEval (Alex Bligh)
|
||||
|
||||
- Documentation:
|
||||
Add documentation for xmllint --xpath (Daniel Veillard),
|
||||
Fix the URL of the SAX documentation from James (Daniel Veillard),
|
||||
Fix spelling of "length". (Michael Wood)
|
||||
|
||||
- Portability:
|
||||
Fix python bindings with versions older than 2.7 (Daniel Veillard),
|
||||
rebuild docs:Makefile.am (Roumen Petrov),
|
||||
elfgcchack.h after rebuild in doc (Roumen Petrov),
|
||||
elfgcchack for buf module (Roumen Petrov),
|
||||
Fix a uneeded and wrong extra link parameter (Daniel Veillard),
|
||||
Few cleanup patches for Windows (Denis Pauk),
|
||||
Fix rpmbuild --nocheck (Mark Salter),
|
||||
Fix for win32/configure.js and WITH_THREAD_ALLOC (Daniel Richard),
|
||||
Fix Broken multi-arch support in xml2-config (Daniel Veillard),
|
||||
Fix a portability issue for GCC < 3.4.0 (Daniel Veillard),
|
||||
Windows build fixes (Daniel Richard),
|
||||
Fix a thread portability problem (Friedrich Haubensak),
|
||||
Downgrade autoconf requirement to 2.63 (Daniel Veillard)
|
||||
|
||||
- Bug Fixes:
|
||||
Fix a linking error for python bindings (Daniel Veillard),
|
||||
Fix a couple of return without value (Jüri Aedla),
|
||||
Improve the hashing functions (Daniel Franke),
|
||||
Improve handling of xmlStopParser() (Daniel Veillard),
|
||||
Remove risk of lockup in dictionary initialization (Daniel Veillard),
|
||||
Activate detection of encoding in external subset (Daniel Veillard),
|
||||
Fix an output buffer flushing conversion bug (Mikhail Titov),
|
||||
Fix an old bug in xmlSchemaValidateOneElement (Csaba László),
|
||||
Fix configure cannot remove messages (Gilles Espinasse),
|
||||
fix schema validation in combination with xsi:nil (Daniel Veillard),
|
||||
xmlCtxtReadFile doesn't work with literal IPv6 URLs (Steve Wolf),
|
||||
Fix a few problems with setEntityLoader (Alexey Neyman),
|
||||
Detect excessive entities expansion upon replacement (Daniel Veillard),
|
||||
Fix the flushing out of raw buffers on encoding conversions (Daniel,
|
||||
Veillard),
|
||||
Fix some buffer conversion issues (Daniel Veillard),
|
||||
When calling xmlNodeDump make sure we grow the buffer quickly (Daniel,
|
||||
Veillard),
|
||||
Fix an error in the progressive DTD parsing code (Dan Winship),
|
||||
xmllint should not load DTD by default when using the reader (Daniel,
|
||||
Veillard),
|
||||
Try IBM-037 when looking for EBCDIC handlers (Petr Sumbera),
|
||||
Fix potential out of bound access (Daniel Veillard),
|
||||
Fix large parse of file from memory (Daniel Veillard),
|
||||
Fix a bug in the nsclean option of the parser (Daniel Veillard),
|
||||
Fix a regression in 2.9.0 breaking validation while streaming (Daniel,
|
||||
Veillard),
|
||||
Remove potential calls to exit() (Daniel Veillard)
|
||||
|
||||
- Improvements:
|
||||
Regenerated API, and testapi, rebuild documentation (Daniel Veillard),
|
||||
Fix tree iterators broken by 2to3 script (Daniel Veillard),
|
||||
update all tests for Python3 and Python2 (Daniel Veillard),
|
||||
A few more fixes for python 3 affecting libxml2.py (Daniel Veillard),
|
||||
Fix compilation on Python3 (Daniel Veillard),
|
||||
Converting apibuild.py to python3 (Daniel Veillard),
|
||||
First pass at starting porting to python3 (Daniel Veillard),
|
||||
updated configure.in for python3 (Daniel Veillard),
|
||||
Add support for xpathRegisterVariable in Python (Shaun McCance),
|
||||
Added a regression tests from bug 694228 data (Daniel Veillard),
|
||||
Cache presence of '<' in entities content (Daniel Veillard),
|
||||
Avoid extra processing on entities (Daniel Veillard),
|
||||
Python binding for xmlRegisterInputCallback (Alexey Neyman),
|
||||
Python bindings: DOM casts everything to xmlNode (Alexey Neyman),
|
||||
Define LIBXML_THREAD_ALLOC_ENABLED via xmlversion.h (Tim Starling),
|
||||
Adding streaming validation to runtest checks (Daniel Veillard),
|
||||
Add a --pushsmall option to xmllint (Daniel Veillard)
|
||||
|
||||
- Cleanups:
|
||||
Switched comment in file to UTF-8 encoding (Daniel Veillard),
|
||||
Extend gitignore (Daniel Veillard),
|
||||
Silent the new python test on input (Alexey Neyman),
|
||||
Cleanup of a duplicate test (Daniel Veillard),
|
||||
Cleanup on duplicate test expressions (Daniel Veillard),
|
||||
Fix compiler warning after 153cf15905cf4ec080612ada6703757d10caba1e (Patrick,
|
||||
Gansterer),
|
||||
Spec cleanups and a fix for multiarch support (Daniel Veillard),
|
||||
Silence a clang warning (Daniel Veillard),
|
||||
Cleanup the Copyright to be pure MIT Licence wording (Daniel Veillard),
|
||||
rand_seed should be static in dict.c (Wouter Van Rooy),
|
||||
Fix typos in parser comments (Jan Pokorný)
|
||||
|
||||
|
||||
|
||||
2.9.0: Sep 11 2012:
|
||||
- Features:
|
||||
A few new API entry points,
|
||||
More resilient push parser mode,
|
||||
A lot of portability improvement,
|
||||
Faster XPath evaluation
|
||||
|
||||
- Documentation:
|
||||
xml2-config.1 markup error (Christian Weisgerber),
|
||||
libxml(3) manpage typo fix (John Bradshaw),
|
||||
More cleanups to the documentation part of libxml2 (Daniel Richard G)
|
||||
|
||||
- Portability:
|
||||
Bug 676544 - fails to build with --without-sax1 (Akira TAGOH),
|
||||
fix builds not having stdint.h (Rob Richards),
|
||||
GetProcAddressA is available only on WinCE (Daniel Veillard),
|
||||
More updates and cleanups on autotools and Makefiles (Daniel Richard G),
|
||||
More changes for Win32 compilation (Eric Zurcher),
|
||||
Basic changes for Win32 builds of release 2.9.0: compile buf.c (Eric Zurcher),
|
||||
Bundles all generated files for python into the distribution (Daniel Richard G),
|
||||
Fix compiler warnings of wincecompat.c (Patrick Gansterer),
|
||||
Fix non __GNUC__ build (Patrick Gansterer),
|
||||
Fix windows unicode build (Patrick Gansterer),
|
||||
clean redefinition of {v}snprintf in C-source (Roumen Petrov),
|
||||
use xmlBuf... if DEBUG_INPUT is defined (Roumen Petrov),
|
||||
fix runtests to use pthreads support for various Unix platforms (Daniel Richard G),
|
||||
Various "make distcheck" and portability fixups 2nd part (Daniel Richard G),
|
||||
Various "make distcheck" and portability fixups (Daniel Richard G),
|
||||
Fix compilation on older Visual Studio (Daniel Veillard)
|
||||
|
||||
- Bug Fixes:
|
||||
Change the XPath code to percolate allocation errors (Daniel Veillard),
|
||||
Fix reuse of xmlInitParser (Daniel Veillard),
|
||||
Fix potential crash on entities errors (Daniel Veillard),
|
||||
initialize var (Rob Richards),
|
||||
Fix the XPath arity check to also check the XPath stack limits (Daniel Veillard),
|
||||
Fix problem with specific and generic error handlers (Pietro Cerutti),
|
||||
Avoid a potential infinite recursion (Daniel Veillard),
|
||||
Fix an XSD error when generating internal automata (Daniel Veillard),
|
||||
Patch for xinclude of text using multibyte characters (Vitaly Ostanin),
|
||||
Fix a segfault on XSD validation on pattern error (Daniel Veillard),
|
||||
Fix missing xmlsave.h module which was ignored in recent builds (Daniel Veillard),
|
||||
Add a missing element check (Daniel Veillard),
|
||||
Adding various checks on node type though the API (Daniel Veillard),
|
||||
Namespace nodes can't be unlinked with xmlUnlinkNode (Daniel Veillard),
|
||||
Fix make dist to include new private header files (Daniel Veillard),
|
||||
More fixups on the push parser behaviour (Daniel Veillard),
|
||||
Strengthen behaviour of the push parser in problematic situations (Daniel Veillard),
|
||||
Enforce XML_PARSER_EOF state handling through the parser (Daniel Veillard),
|
||||
Fixup limits parser (Daniel Veillard),
|
||||
Do not fetch external parsed entities (Daniel Veillard),
|
||||
Fix an error in previous commit (Aron Xu),
|
||||
Fix entities local buffers size problems (Daniel Veillard),
|
||||
Fix parser local buffers size problems (Daniel Veillard),
|
||||
Fix a failure to report xmlreader parsing failures (Daniel Veillard)
|
||||
|
||||
- Improvements:
|
||||
Keep libxml2.syms when running "make distclean" (Daniel Veillard),
|
||||
Allow to set the quoting character of an xmlWriter (Csaba Raduly),
|
||||
Keep non-significant blanks node in HTML parser (Daniel Veillard),
|
||||
Add a forbidden variable error number and message to XPath (Daniel Veillard),
|
||||
Support long path names on WNT (Michael Stahl),
|
||||
Improve HTML escaping of attribute on output (Daniel Veillard),
|
||||
Handle ICU_LIBS as LIBADD, not LDFLAGS to prevent linking errors (Arfrever Frehtes Taifersar Arahesis),
|
||||
Switching XPath node sorting to Timsort (Vojtech Fried),
|
||||
Optimizing '//' in XPath expressions (Nick Wellnhofer),
|
||||
Expose xmlBufShrink in the public tree API (Daniel Veillard),
|
||||
Visible HTML elements close the head tag (Conrad Irwin),
|
||||
Fix file and line report for XSD SAX and reader streaming validation (Daniel Veillard),
|
||||
Fix const qualifyer to definition of xmlBufferDetach (Daniel Veillard),
|
||||
minimize use of HAVE_CONFIG_H (Roumen Petrov),
|
||||
fixup regression in Various "make distcheck" and portability fixups (Roumen Petrov),
|
||||
Add support for big line numbers in error reporting (Daniel Veillard),
|
||||
Avoid using xmlBuffer for serialization (Daniel Veillard),
|
||||
Improve compatibility between xmlBuf and xmlBuffer (Daniel Veillard),
|
||||
Provide new accessors for xmlOutputBuffer (Daniel Veillard),
|
||||
Improvements for old buffer compatibility (Daniel Veillard),
|
||||
Expand the limit test program (Daniel Veillard),
|
||||
Improve error reporting on parser errors (Daniel Veillard),
|
||||
Implement some default limits in the XPath module (Daniel Veillard),
|
||||
Introduce some default parser limits (Daniel Veillard),
|
||||
Cleanups and new limit APIs for dictionaries (Daniel Veillard),
|
||||
Fixup for buf.c (Daniel Veillard),
|
||||
Cleanup URI module memory allocation code (Daniel Veillard),
|
||||
Extend testlimits (Daniel Veillard),
|
||||
More avoid quadratic behaviour (Daniel Veillard),
|
||||
Impose a reasonable limit on PI size (Daniel Veillard),
|
||||
first version of testlimits new test (Daniel Veillard),
|
||||
Avoid quadratic behaviour in some push parsing cases (Daniel Veillard),
|
||||
Impose a reasonable limit on comment size (Daniel Veillard),
|
||||
Impose a reasonable limit on attribute size (Daniel Veillard),
|
||||
Harden the buffer code and make it more compatible (Daniel Veillard),
|
||||
More cleanups for input/buffers code (Daniel Veillard),
|
||||
Cleanup function xmlBufResetInput(), to set input from Buffer (Daniel Veillard)
|
||||
Swicth the test program for characters to new input buffers (Daniel Veillard),
|
||||
Convert the HTML tree module to the new buffers (Daniel Veillard),
|
||||
Convert of the HTML parser to new input buffers (Daniel Veillard),
|
||||
Convert the writer to new output buffer and save APIs (Daniel Veillard),
|
||||
Convert XMLReader to the new input buffers (Daniel Veillard),
|
||||
New saving functions using xmlBuf and conversion (Daniel Veillard),
|
||||
Provide new xmlBuf based saving functions (Daniel Veillard),
|
||||
Convert XInclude to the new input buffers (Daniel Veillard),
|
||||
Convert catalog code to the new input buffers (Daniel Veillard),
|
||||
Convert C14N to the new Input buffer (Daniel Veillard),
|
||||
Convert xmlIO.c to the new input and output buffers (Daniel Veillard),
|
||||
Convert XML parser to the new input buffers (Daniel Veillard),
|
||||
Incompatible change to the Input and Output buffers (Daniel Veillard),
|
||||
Adding new encoding function to deal with the new structures (Daniel Veillard),
|
||||
Convert XPath to xmlBuf (Daniel Veillard),
|
||||
Adding a new buf module for buffers (Daniel Veillard),
|
||||
Memory error within SAX2 reuse common framework (Daniel Veillard),
|
||||
Fix xmllint --xpath node initialization (Daniel Veillard)
|
||||
|
||||
- Cleanups:
|
||||
Various cleanups to avoid compiler warnings (Daniel Veillard),
|
||||
Big space and tab cleanup (Daniel Veillard),
|
||||
Followup to LibXML2 docs/examples cleanup patch (Daniel Veillard),
|
||||
Second round of cleanups for LibXML2 docs/examples (Daniel Richard),
|
||||
Remove all .cvsignore as they are not used anymore (Daniel Veillard),
|
||||
Fix a Timsort function helper comment (Daniel Veillard),
|
||||
Small cleanup for valgrind target (Daniel Veillard),
|
||||
Patch for portability of latin characters in C files (Daniel Veillard),
|
||||
Cleanup some of the parser code (Daniel Veillard),
|
||||
Fix a variable name in comment (Daniel Veillard),
|
||||
Regenerated testapi.c (Daniel Veillard),
|
||||
Regenerating docs and API files (Daniel Veillard),
|
||||
Small cleanup of unused variables in test (Daniel Veillard),
|
||||
Expand .gitignore with more files (Daniel Veillard)
|
||||
|
||||
|
||||
|
||||
2.8.0: May 23 2012:
|
||||
- Features:
|
||||
add lzma compression support (Anders F Bjorklund)
|
||||
|
||||
- Documentation:
|
||||
xmlcatalog: Add uri and delegateURI to possible add types in man page. (Ville Skyttä),
|
||||
Update README.tests (Daniel Veillard),
|
||||
URI handling code is not OOM resilient (Daniel Veillard),
|
||||
Fix an error in comment (Daniel Veillard),
|
||||
Fixed bug #617016 (Daniel Mustieles),
|
||||
Fixed two typos in the README document (Daniel Neel),
|
||||
add generated html files (Anders F Bjorklund),
|
||||
Clarify the need to use xmlFreeNode after xmlUnlinkNode (Daniel Veillard),
|
||||
Improve documentation a bit (Daniel Veillard),
|
||||
Updated URL for lxml python bindings (Daniel Veillard)
|
||||
|
||||
- Portability:
|
||||
Restore code for Windows compilation (Daniel Veillard),
|
||||
Remove git error message during configure (Christian Dywan),
|
||||
xmllint: Build fix for endTimer if !defined(HAVE_GETTIMEOFDAY) (Patrick R. Gansterer),
|
||||
remove a bashism in confgure.in (John Hein),
|
||||
undef ERROR if already defined (Patrick R. Gansterer),
|
||||
Fix library problems with mingw-w64 (Michael Cronenworth),
|
||||
fix windows build. ifdef addition from bug 666491 makes no sense (Rob Richards),
|
||||
prefer native threads on win32 (Sam Thursfield),
|
||||
Allow to compile with Visual Studio 2010 (Thomas Lemm),
|
||||
Fix mingw's snprintf configure check (Andoni Morales),
|
||||
fixed a 64bit big endian issue (Marcus Meissner),
|
||||
Fix portability failure if netdb.h lacks NO_ADDRESS (Daniel Veillard),
|
||||
Fix windows build from lzma addition (Rob Richards),
|
||||
autogen: Only check for libtoolize (Colin Walters),
|
||||
Fix the Windows build files (Patrick von Reth),
|
||||
634846 Remove a linking option breaking Windows VC10 (Daniel Veillard),
|
||||
599241 fix an initialization problem on Win64 (Andrew W. Nosenko),
|
||||
fix win build (Rob Richards)
|
||||
|
||||
- Bug fixes:
|
||||
Part for rand_r checking missing (Daniel Veillard),
|
||||
Cleanup on randomization (Daniel Veillard),
|
||||
Fix undefined reference in python module (Pacho Ramos),
|
||||
Fix a race in xmlNewInputStream (Daniel Veillard),
|
||||
Fix weird streaming RelaxNG errors (Noam),
|
||||
Fix various bugs in new code raised by the API checking (Daniel Veillard),
|
||||
Fix various problems with "make dist" (Daniel Veillard),
|
||||
Fix a memory leak in the xzlib code (Daniel Veillard),
|
||||
HTML parser error with <noscript> in the <head> (Denis Pauk),
|
||||
XSD: optional element in complex type extension (Remi Gacogne),
|
||||
Fix html serialization error and htmlSetMetaEncoding() (Daniel Veillard),
|
||||
Fix a wrong return value in previous patch (Daniel Veillard),
|
||||
Fix an uninitialized variable use (Daniel Veillard),
|
||||
Fix a compilation problem with --minimum (Brandon Slack),
|
||||
Remove redundant and ungarded include of resolv.h (Daniel Veillard),
|
||||
xinclude with parse="text" does not use the entity loader (Shaun McCance),
|
||||
Allow to parse 1 byte HTML files (Denis Pauk),
|
||||
Patch that fixes the skipping of the HTML_PARSE_NOIMPLIED flag (Martin Schröder),
|
||||
Avoid memory leak if xmlParserInputBufferCreateIO fails (Lin Yi-Li),
|
||||
Prevent an infinite loop when dumping a node with encoding problems (Timothy Elliott),
|
||||
xmlParseNodeInContext problems with an empty document (Tim Elliott),
|
||||
HTML element position is not detected propperly (Pavel Andrejs),
|
||||
Fix an off by one pointer access (Jüri Aedla),
|
||||
Try to fix a problem with entities in SAX mode (Daniel Veillard),
|
||||
Fix a crash with xmllint --path on empty results (Daniel Veillard),
|
||||
Fixed bug #667946 (Daniel Mustieles),
|
||||
Fix a logic error in Schemas Component Constraints (Ryan Sleevi),
|
||||
Fix a wrong enum type use in Schemas Types (Nico Weber),
|
||||
Fix SAX2 builder in case of undefined attributes namespace (Daniel Veillard),
|
||||
Fix SAX2 builder in case of undefined element namespaces (Daniel Veillard),
|
||||
fix reference to STDOUT_FILENO on MSVC (Tay Ray Chuan),
|
||||
fix a pair of possible out of array char references (Daniel Veillard),
|
||||
Fix an allocation error when copying entities (Daniel Veillard),
|
||||
Make sure the parser returns when getting a Stop order (Chris Evans),
|
||||
Fix some potential problems on reallocation failures(parser.c) (Xia Xinfeng),
|
||||
Fix a schema type duration comparison overflow (Daniel Veillard),
|
||||
Fix an unimplemented part in RNG value validation (Daniel Veillard),
|
||||
Fix missing error status in XPath evaluation (Daniel Veillard),
|
||||
Hardening of XPath evaluation (Daniel Veillard),
|
||||
Fix an off by one error in encoding (Daniel Veillard),
|
||||
Fix RELAX NG include bug #655288 (Shaun McCance),
|
||||
Fix XSD validation bug #630130 (Toyoda Eizi),
|
||||
Fix some potential problems on reallocation failures (Chris Evans),
|
||||
__xmlRaiseError: fix use of the structured callback channel (Dmitry V. Levin),
|
||||
__xmlRaiseError: fix the structured callback channel's data initialization (Dmitry V. Levin),
|
||||
Fix memory corruption when xmlParseBalancedChunkMemoryInternal is called from xmlParseBalancedChunk (Rob Richards),
|
||||
Small fix for previous commit (Daniel Veillard),
|
||||
Fix a potential freeing error in XPath (Daniel Veillard),
|
||||
Fix a potential memory access error (Daniel Veillard),
|
||||
Reactivate the shared library versionning script (Daniel Veillard)
|
||||
|
||||
- Improvements:
|
||||
use mingw C99 compatible functions {v}snprintf instead those from MSVC runtime (Roumen Petrov),
|
||||
New symbols added for the next release (Daniel Veillard),
|
||||
xmlTextReader bails too quickly on error (Andy Lutomirski),
|
||||
Use a hybrid allocation scheme in xmlNodeSetContent (Conrad Irwin),
|
||||
Use buffers when constructing string node lists. (Conrad Irwin),
|
||||
Add HTML parser support for HTML5 meta charset encoding declaration (Denis Pauk),
|
||||
wrong message for double hyphen in comment XML error (Bryan Henderson),
|
||||
Fix "make tst" to grab lzma lib too (Daniel Veillard),
|
||||
Add "whereis" command to xmllint shell (Ryan),
|
||||
Improve xmllint shell (Ryan),
|
||||
add function xmlTextReaderRelaxNGValidateCtxt() (Noam Postavsky),
|
||||
Add --system support to autogen.sh (Daniel Veillard),
|
||||
Add hash randomization to hash and dict structures (Daniel Veillard),
|
||||
included xzlib in dist (Anders F Bjorklund),
|
||||
move xz/lzma helpers to separate included files (Anders F Bjorklund),
|
||||
add generated devhelp files (Anders F Bjorklund),
|
||||
add XML_WITH_LZMA to api (Anders F Bjorklund),
|
||||
autogen.sh: Honor NOCONFIGURE environment variable (Colin Walters),
|
||||
Improve the error report on undefined REFs (Daniel Veillard),
|
||||
Add exception for new W3C PI xml-model (Daniel Veillard),
|
||||
Add options to ignore the internal encoding (Daniel Veillard),
|
||||
testapi: use the right type for the check (Stefan Kost),
|
||||
various: handle return values of write calls (Stefan Kost),
|
||||
testWriter: xmlTextWriterWriteFormatElement wants an int instead of a long int (Stefan Kost),
|
||||
runxmlconf: update to latest testsuite version (Stefan Kost),
|
||||
configure: add -Wno-long-long to CFLAGS (Stefan Kost),
|
||||
configure: support silent automake rules if possible (Stefan Kost),
|
||||
xmlmemory: add a cast as size_t has no portable printf modifier (Stefan Kost),
|
||||
__xmlRaiseError: remove redundant schannel initialization (Dmitry V. Levin),
|
||||
__xmlRaiseError: do cheap code check early (Dmitry V. Levin)
|
||||
|
||||
- Cleanups:
|
||||
Cleanups before 2.8.0-rc2 (Daniel Veillard),
|
||||
Avoid an extra operation (Daniel Veillard),
|
||||
Remove vestigial de-ANSI-fication support. (Javier Jardón),
|
||||
autogen.sh: Fix typo (Javier Jardón),
|
||||
Do not use unsigned but unsigned int (Daniel Veillard),
|
||||
Remove two references to u_short (Daniel Veillard),
|
||||
Fix -Wempty-body warning from clang (Nico Weber),
|
||||
Cleanups of lzma support (Daniel Veillard),
|
||||
Augment the list of ignored files (Daniel Veillard),
|
||||
python: remove unused variable (Stefan Kost),
|
||||
python: flag two unused args (Stefan Kost),
|
||||
configure: acconfig.h is deprecated since autoconf-2.50 (Stefan Kost),
|
||||
xpath: remove unused variable (Stefan Kost)
|
||||
|
||||
|
||||
|
||||
2.7.8: Nov 4 2010:
|
||||
- Features:
|
||||
480323 add code to plug in ICU converters by default (Giuseppe Iuculano),
|
||||
Add xmlSaveOption XML_SAVE_WSNONSIG (Adam Spragg)
|
||||
|
||||
- Documentation:
|
||||
Fix devhelp documentation installation (Mike Hommey),
|
||||
Fix web site encoding problems (Daniel Veillard),
|
||||
Fix a couple of typo in HTML parser error messages (Michael Day),
|
||||
Forgot to update the news page for 0.7.7 (Daniel Veillard)
|
||||
|
||||
- Portability:
|
||||
607273 Fix python detection on MSys/Windows (LRN),
|
||||
614087 Fix Socket API usage to allow Windows64 compilation (Ozkan Sezer),
|
||||
Fix compilation with Clang (Koop Mast),
|
||||
Fix Win32 build (Rob Richards)
|
||||
|
||||
- Bug Fixes:
|
||||
595789 fix a remaining potential Solaris problem (Daniel Veillard),
|
||||
617468 fix progressive HTML parsing with style using "'" (Denis Pauk),
|
||||
616478 Fix xmllint shell write command (Gwenn Kahz),
|
||||
614005 Possible erroneous HTML parsing on unterminated script (Pierre Belzile),
|
||||
627987 Fix XSD IDC errors in imported schemas (Jim Panetta),
|
||||
629325 XPath rounding errors first cleanup (Phil Shafer),
|
||||
630140 fix iso995x encoding error (Daniel Veillard),
|
||||
make sure htmlCtxtReset do reset the disableSAX field (Daniel Veillard),
|
||||
Fix a change of semantic on XPath preceding and following axis (Daniel Veillard),
|
||||
Fix a potential segfault due to weak symbols on pthreads (Mike Hommey),
|
||||
Fix a leak in XPath compilation (Daniel Veillard),
|
||||
Fix the semantic of XPath axis for namespace/attribute context nodes (Daniel Veillard),
|
||||
Avoid a descriptor leak in catalog loading code (Carlo Bramini),
|
||||
Fix a small bug in XPath evaluation code (Marius Wachtler),
|
||||
Fix handling of XML-1.0 XML namespace declaration (Daniel Veillard),
|
||||
Fix errors in XSD double validation check (Csaba Raduly),
|
||||
Fix handling of apos in URIs (Daniel Veillard),
|
||||
xmlTextReaderReadOuterXml should handle DTD (Rob Richards),
|
||||
Autogen.sh needs to create m4 directory (Rob Richards)
|
||||
|
||||
- Improvements:
|
||||
606592 update language ID parser to RFC 5646 (Daniel Veillard),
|
||||
Sort python generated stubs (Mike Hommey),
|
||||
Add an HTML parser option to avoid a default doctype (Daniel Veillard)
|
||||
|
||||
- Cleanups:
|
||||
618831 don't ship generated files in git (Adrian Bunk),
|
||||
Switch from the obsolete mkinstalldirs to AC_PROG_MKDIR_P (Adrian Bunk),
|
||||
Various cleanups on encoding handling (Daniel Veillard),
|
||||
Fix xmllint to use format=1 for default formatting (Adam Spragg),
|
||||
Force _xmlSaveCtxt.format to be 0 or 1 (Adam Spragg),
|
||||
Cleanup encoding pointer comparison (Nikolay Sivov),
|
||||
Small code cleanup on previous patch (Daniel Veillard)
|
||||
|
||||
|
||||
|
||||
2.7.7: Mar 15 2010:
|
||||
- Improvements:
|
||||
Adding a --xpath option to xmllint (Daniel Veillard),
|
||||
Make HTML parser non-recursive (Eugene Pimenov)
|
||||
|
||||
- Portability:
|
||||
relaxng.c: cast to allow compilation with sun studio 11 (Ben Walton),
|
||||
Fix build failure on Sparc solaris (Roumen Petrov),
|
||||
use autoreconf in autogen.sh (Daniel Veillard),
|
||||
Fix build with mingw (Roumen Petrov),
|
||||
Upgrade some of the configure and autogen (Daniel Veillard),
|
||||
Fix relaxNG tests in runtest for Windows runtest.c: initialize ret (Rob Richards),
|
||||
Fix a const warning in xmlNodeSetBase (Martin Trappel),
|
||||
Fix python generator to not use deprecated xmllib (Daniel Veillard),
|
||||
Update some automake files (Daniel Veillard),
|
||||
598785 Fix nanohttp on Windows (spadix)
|
||||
|
||||
- Bug Fixes:
|
||||
libxml violates the zlib interface and crashes (Mark Adler),
|
||||
Fix broken escape behaviour in regexp ranges (Daniel Veillard),
|
||||
Fix missing win32 libraries in libxml-2.0.pc (Volker Grabsch),
|
||||
Fix detection of python linker flags (Daniel Macks),
|
||||
fix build error in libxml2/python (Paul Smith),
|
||||
ChunkParser: Incorrect decoding of small xml files (Raul Hudea),
|
||||
htmlCheckEncoding doesn't update input-end after shrink (Eugene Pimenov),
|
||||
Fix a missing #ifdef (Daniel Veillard),
|
||||
Fix encoding selection for xmlParseInNodeContext (Daniel Veillard),
|
||||
xmlPreviousElementSibling mistake (François Delyon),
|
||||
608773 add a missing check in xmlGROW (Daniel Veillard),
|
||||
Fix xmlParseInNodeContext for HTML content (Daniel Veillard),
|
||||
Fix lost namespace when copying node * tree.c: reconcile namespace if not found (Rob Richards),
|
||||
Fix some missing commas in HTML element lists (Eugene Pimenov),
|
||||
Correct variable type to unsigned (Nikolay Sivov),
|
||||
Recognize ID attribute in HTML without DOCTYPE (Daniel Veillard),
|
||||
Fix memory leak in xmlXPathEvalExpression() (Martin),
|
||||
Fix an init bug in global.c (Kai Henning),
|
||||
Fix xmlNodeSetBase() comment (Daniel Veillard),
|
||||
Fix broken escape behaviour in regexp ranges (Daniel Veillard),
|
||||
Don't give default HTML boolean attribute values in parser (Daniel Veillard),
|
||||
xmlCtxtResetLastError should reset ctxt-errNo (Daniel Veillard)
|
||||
|
||||
- Cleanups:
|
||||
Cleanup a couple of weirdness in HTML parser (Eugene Pimenov)
|
||||
|
||||
|
||||
|
||||
2.7.6: Oct 6 2009:
|
||||
- Bug Fixes:
|
||||
Restore thread support in default configuration (Andrew W. Nosenko),
|
||||
@ -215,7 +845,7 @@ http://svn.gnome.org/viewvc/libxml2/trunk/
|
||||
- Improvement: switch parser to XML-1.0 5th edition, add parsing flags
|
||||
for old versions, switch URI parsing to RFC 3986,
|
||||
add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer),
|
||||
new hashing functions for dictionnaries (based on Stefan Behnel work),
|
||||
new hashing functions for dictionaries (based on Stefan Behnel work),
|
||||
improve handling of misplaced html/head/body in HTML parser, better
|
||||
regression test tools and code coverage display, better algorithms
|
||||
to detect various versions of the billion laughts attacks, make
|
||||
@ -420,7 +1050,7 @@ Do not use or package 2.6.25
|
||||
|
||||
- Improvements: xmlDOMWrapReconcileNamespaces xmlDOMWrapCloneNode (Kasimier
|
||||
Buchcik), XML catalog debugging (Rick Jones), update to Unicode 4.01.
|
||||
- Bug fixes: DoctRenderer() problem in 2.6.23, xmlParseInNodeContext()
|
||||
- Bug fixes: xmlParseChunk() problem in 2.6.23, xmlParseInNodeContext()
|
||||
on HTML docs, URI behaviour on Windows (Rob Richards), comment streaming
|
||||
bug, xmlParseComment (with William Brack), regexp bug fixes (DV &
|
||||
Youri Golovanov), xmlGetNodePath on text/CDATA (Kasimier),
|
||||
@ -601,7 +1231,7 @@ Do not use or package 2.6.25
|
||||
Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed),
|
||||
some gcc4 fixes, HP-UX portability fixes (Rick Jones).
|
||||
- bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and
|
||||
xmlreader stopping on non-fatal errors, thread support for dictionnaries
|
||||
xmlreader stopping on non-fatal errors, thread support for dictionaries
|
||||
reference counting (Gary Coady), internal subset and push problem, URL
|
||||
saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths
|
||||
fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix
|
||||
@ -614,7 +1244,7 @@ Do not use or package 2.6.25
|
||||
Hendricks), aliasing bug exposed by gcc4 on s390, xmlTextReaderNext bug
|
||||
(Rob Richards), Schemas decimal type fixes (William Brack),
|
||||
xmlByteConsumed static buffer (Ben Maurer).
|
||||
- improvement: speedup parsing comments and DTDs, dictionnary support for
|
||||
- improvement: speedup parsing comments and DTDs, dictionary support for
|
||||
hash tables, Schemas Identity constraints (Kasimier), streaming XPath
|
||||
subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical
|
||||
values handling (Kasimier), add xmlTextReaderByteConsumed (Aron
|
||||
@ -824,7 +1454,7 @@ Do not use or package 2.6.25
|
||||
URI on SYSTEM lookup failure, XInclude parse flags inheritance (William),
|
||||
XInclude and XPointer fixes for entities (William), XML parser bug
|
||||
reported by Holger Rauch, nanohttp fd leak (William), regexps char
|
||||
groups '-' handling (William), dictionnary reference counting problems,
|
||||
groups '-' handling (William), dictionary reference counting problems,
|
||||
do not close stderr.
|
||||
- performance patches from Petr Pajas
|
||||
- Documentation fixes: XML_CATALOG_FILES in man pages (Mike Hommey)
|
||||
@ -852,7 +1482,7 @@ Do not use or package 2.6.25
|
||||
William) reported by Yuuichi Teranishi
|
||||
- bugfixes: make test and path issues, xmlWriter attribute serialization
|
||||
(William Brack), xmlWriter indentation (William), schemas validation
|
||||
(Eric Haszlakiewicz), XInclude dictionnaries issues (William and Oleg
|
||||
(Eric Haszlakiewicz), XInclude dictionaries issues (William and Oleg
|
||||
Paraschenko), XInclude empty fallback (William), HTML warnings (William),
|
||||
XPointer in XInclude (William), Python namespace serialization,
|
||||
isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter
|
||||
@ -873,7 +1503,7 @@ Do not use or package 2.6.25
|
||||
|
||||
|
||||
2.6.5: Jan 25 2004:
|
||||
- Bugfixes: dictionnaries for schemas (William Brack), regexp segfault
|
||||
- Bugfixes: dictionaries for schemas (William Brack), regexp segfault
|
||||
(William), xs:all problem (William), a number of XPointer bugfixes
|
||||
(William), xmllint error go to stderr, DTD validation problem with
|
||||
namespace, memory leak (William), SAX1 cleanup and minimal options fixes
|
||||
@ -885,14 +1515,14 @@ Do not use or package 2.6.25
|
||||
Fleck), doc (Sven Zimmerman), I/O example.
|
||||
- Python bindings: fixes (William), enum support (Stéphane Bidoul),
|
||||
structured error reporting (Stéphane Bidoul)
|
||||
- XInclude: various fixes for conformance, problem related to dictionnary
|
||||
- XInclude: various fixes for conformance, problem related to dictionary
|
||||
references (William & me), recursion (William)
|
||||
- xmlWriter: indentation (Lucas Brasilino), memory leaks (Alfred
|
||||
Mickautsch),
|
||||
- xmlSchemas: normalizedString datatype (John Belmonte)
|
||||
- code cleanup for strings functions (William)
|
||||
- Windows: compiler patches (Mark Vakoc)
|
||||
- Parser optimizations, a few new XPath and dictionnary APIs for future
|
||||
- Parser optimizations, a few new XPath and dictionary APIs for future
|
||||
XSLT optimizations.
|
||||
|
||||
|
||||
@ -987,8 +1617,8 @@ Do not use or package 2.6.25
|
||||
of change
|
||||
- Increased the library modularity, far more options can be stripped out,
|
||||
a --with-minimum configuration will weight around 160KBytes
|
||||
- Use per parser and per document dictionnary, allocate names and small
|
||||
text nodes from the dictionnary
|
||||
- Use per parser and per document dictionary, allocate names and small
|
||||
text nodes from the dictionary
|
||||
- Switch to a SAX2 like parser rewrote most of the XML parser core,
|
||||
provides namespace resolution and defaulted attributes, minimize memory
|
||||
allocations and copies, namespace checking and specific error handling,
|
||||
@ -1035,7 +1665,7 @@ Do not use or package 2.6.25
|
||||
(William), xmlCleanupParser (Marc Liyanage), CDATA output (William), HTTP
|
||||
error handling.
|
||||
- xmllint options: --dtdvalidfpi for Tobias Reif, --sax1 for compat
|
||||
testing, --nodict for building without tree dictionnary, --nocdata to
|
||||
testing, --nodict for building without tree dictionary, --nocdata to
|
||||
replace CDATA by text, --nsclean to remove surperfluous namespace
|
||||
declarations
|
||||
- added xml2-config --libtool-libs option from Kevin P. Fleming
|
||||
@ -1325,7 +1955,8 @@ http://www.w3.org/TR/xmlschema-2/
|
||||
code, beware, all
|
||||
interfaces are likely to change, there is huge holes, it is clearly a work in
|
||||
progress and don't even think of putting this code in a production system,
|
||||
it's actually not compiled in by default. The real fixes are: - a couple of bugs or limitations introduced in 2.4.20
|
||||
it's actually not compiled in by default. The real fixes are:
|
||||
- a couple of bugs or limitations introduced in 2.4.20
|
||||
- patches for Borland C++ and MSC by Igor
|
||||
- some fixes on XPath strings and conformance patches by Richard
|
||||
Jinks
|
||||
@ -1567,7 +2198,8 @@ it's actually not compiled in by default. The real fixes are: - a couple of bu
|
||||
|
||||
|
||||
2.3.9: May 19 2001:
|
||||
Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #54891 and another patch from Jonas Borgström
|
||||
Lots of bugfixes, and added a basic SGML catalog support:
|
||||
- HTML push bugfix #54891 and another patch from Jonas Borgstrom
|
||||
- some serious speed optimization again
|
||||
- some documentation cleanups
|
||||
- trying to get better linking on Solaris (-R)
|
||||
@ -1809,7 +2441,8 @@ Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #
|
||||
about & charref parsing
|
||||
- 2.1.0 also ease the upgrade from libxml v1 to the recent version. it
|
||||
also contains numerous fixes and enhancements:
|
||||
added xmlStopParser() to stop parsing
|
||||
|
||||
added xmlStopParser() to stop parsing
|
||||
improved a lot parsing speed when there is large CDATA blocs
|
||||
includes XPath patches provided by Picdar Technology
|
||||
tried to fix as much as possible DTD validation and namespace
|
||||
@ -1817,6 +2450,7 @@ Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #
|
||||
output to a given encoding has been added/tested
|
||||
lot of various fixes
|
||||
|
||||
|
||||
- added xmlStopParser() to stop parsing
|
||||
- improved a lot parsing speed when there is large CDATA blocs
|
||||
- includes XPath patches provided by Picdar Technology
|
||||
@ -1865,7 +2499,8 @@ Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #
|
||||
upgrade page
|
||||
- Some interfaces may changes (especially a bit about encoding).
|
||||
- the updates includes:
|
||||
fix I18N support. ISO-Latin-x/UTF-8/UTF-16 (nearly) seems correctly
|
||||
|
||||
fix I18N support. ISO-Latin-x/UTF-8/UTF-16 (nearly) seems correctly
|
||||
handled now
|
||||
Better handling of entities, especially well-formedness checking
|
||||
and proper PEref extensions in external subsets
|
||||
@ -1874,6 +2509,7 @@ Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #
|
||||
change
|
||||
structures to accommodate DOM
|
||||
|
||||
|
||||
- fix I18N support. ISO-Latin-x/UTF-8/UTF-16 (nearly) seems correctly
|
||||
handled now
|
||||
- Better handling of entities, especially well-formedness checking
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
* @ctxt: an XML validation parser context
|
||||
* @msg: a string to accompany the error message
|
||||
*/
|
||||
static void
|
||||
static void LIBXML_ATTR_FORMAT(2,0)
|
||||
xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) {
|
||||
xmlStructuredErrorFunc schannel = NULL;
|
||||
const char *str1 = "out of memory\n";
|
||||
@ -93,7 +93,7 @@ xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) {
|
||||
*
|
||||
* Handle a validation error
|
||||
*/
|
||||
static void
|
||||
static void LIBXML_ATTR_FORMAT(3,0)
|
||||
xmlErrValid(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const char *str1, const char *str2)
|
||||
{
|
||||
@ -133,7 +133,7 @@ xmlErrValid(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
*
|
||||
* Handle a fatal parser error, i.e. violating Well-Formedness constraints
|
||||
*/
|
||||
static void
|
||||
static void LIBXML_ATTR_FORMAT(3,0)
|
||||
xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar *str1, const xmlChar *str2)
|
||||
{
|
||||
@ -164,7 +164,7 @@ xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
*
|
||||
* Handle a parser warning
|
||||
*/
|
||||
static void
|
||||
static void LIBXML_ATTR_FORMAT(3,0)
|
||||
xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar *str1)
|
||||
{
|
||||
@ -189,7 +189,7 @@ xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
*
|
||||
* Handle a namespace error
|
||||
*/
|
||||
static void
|
||||
static void LIBXML_ATTR_FORMAT(3,0)
|
||||
xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar *str1, const xmlChar *str2)
|
||||
{
|
||||
@ -213,7 +213,7 @@ xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
*
|
||||
* Handle a namespace warning
|
||||
*/
|
||||
static void
|
||||
static void LIBXML_ATTR_FORMAT(3,0)
|
||||
xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar *str1, const xmlChar *str2)
|
||||
{
|
||||
@ -1078,7 +1078,7 @@ xmlSAX2EndDocument(void *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
|
||||
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
|
||||
/**
|
||||
* xmlSAX2AttributeInternal:
|
||||
* @ctx: the user data (XML parser context)
|
||||
@ -1177,6 +1177,12 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
|
||||
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
|
||||
0,0,0);
|
||||
ctxt->depth--;
|
||||
if (val == NULL) {
|
||||
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
|
||||
if (name != NULL)
|
||||
xmlFree(name);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
val = (xmlChar *) value;
|
||||
}
|
||||
@ -1822,7 +1828,7 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
|
||||
#endif
|
||||
nodePop(ctxt);
|
||||
}
|
||||
#endif /* LIBXML_SAX1_ENABLED || LIBXML_HTML_ENABLE */
|
||||
#endif /* LIBXML_SAX1_ENABLED || LIBXML_HTML_ENABLED || LIBXML_LEGACY_ENABLED */
|
||||
|
||||
/*
|
||||
* xmlSAX2TextNode:
|
||||
@ -2145,12 +2151,14 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
|
||||
*/
|
||||
if (dup == NULL)
|
||||
dup = xmlStrndup(value, valueend - value);
|
||||
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (xmlValidateNCName(dup, 1) != 0) {
|
||||
xmlErrValid(ctxt, XML_DTD_XMLID_VALUE,
|
||||
"xml:id : attribute value %s is not an NCName\n",
|
||||
(const char *) dup, NULL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret);
|
||||
} else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) {
|
||||
@ -2570,6 +2578,10 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
|
||||
(xmlDictOwns(ctxt->dict, lastChild->content))) {
|
||||
lastChild->content = xmlStrdup(lastChild->content);
|
||||
}
|
||||
if (lastChild->content == NULL) {
|
||||
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: xmlStrdup returned NULL");
|
||||
return;
|
||||
}
|
||||
if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) &&
|
||||
((ctxt->options & XML_PARSE_HUGE) == 0)) {
|
||||
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node");
|
||||
@ -2793,7 +2805,8 @@ xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
|
||||
xmlTextConcat(lastChild, value, len);
|
||||
} else {
|
||||
ret = xmlNewCDataBlock(ctxt->myDoc, value, len);
|
||||
xmlAddChild(ctxt->node, ret);
|
||||
if (xmlAddChild(ctxt->node, ret) == NULL)
|
||||
xmlFreeNode(ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -221,7 +221,7 @@ Done:
|
||||
ID and removes it from the table.
|
||||
- push mode parsing i.e. non-blocking state based parser
|
||||
done, both for XML and HTML parsers. Use xmlCreatePushParserCtxt()
|
||||
and DoctRenderer() and html counterparts.
|
||||
and xmlParseChunk() and html counterparts.
|
||||
The tester program now has a --push option to select that parser
|
||||
front-end. Douplicated tests to use both and check results are similar.
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/globals.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
|
||||
#include "buf.h"
|
||||
|
||||
#define WITH_BUFFER_COMPAT
|
||||
@ -299,7 +300,8 @@ xmlBufSetAllocationScheme(xmlBufPtr buf,
|
||||
if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
|
||||
(scheme == XML_BUFFER_ALLOC_EXACT) ||
|
||||
(scheme == XML_BUFFER_ALLOC_HYBRID) ||
|
||||
(scheme == XML_BUFFER_ALLOC_IMMUTABLE)) {
|
||||
(scheme == XML_BUFFER_ALLOC_IMMUTABLE) ||
|
||||
(scheme == XML_BUFFER_ALLOC_BOUNDED)) {
|
||||
buf->alloc = scheme;
|
||||
if (buf->buffer)
|
||||
buf->buffer->alloc = scheme;
|
||||
@ -458,6 +460,18 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
|
||||
size = buf->use + len + 100;
|
||||
#endif
|
||||
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
|
||||
/*
|
||||
* Used to provide parsing limits
|
||||
*/
|
||||
if ((buf->use + len >= XML_MAX_TEXT_LENGTH) ||
|
||||
(buf->size >= XML_MAX_TEXT_LENGTH)) {
|
||||
xmlBufMemoryError(buf, "buffer error: text too long\n");
|
||||
return(0);
|
||||
}
|
||||
if (size >= XML_MAX_TEXT_LENGTH)
|
||||
size = XML_MAX_TEXT_LENGTH;
|
||||
}
|
||||
if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
|
||||
size_t start_buf = buf->content - buf->contentIO;
|
||||
|
||||
@ -565,7 +579,7 @@ xmlBufDump(FILE *file, xmlBufPtr buf) {
|
||||
*/
|
||||
|
||||
xmlChar *
|
||||
xmlBufContent(const xmlBufPtr buf)
|
||||
xmlBufContent(const xmlBuf *buf)
|
||||
{
|
||||
if ((!buf) || (buf->error))
|
||||
return NULL;
|
||||
@ -583,7 +597,7 @@ xmlBufContent(const xmlBufPtr buf)
|
||||
*/
|
||||
|
||||
xmlChar *
|
||||
xmlBufEnd(const xmlBufPtr buf)
|
||||
xmlBufEnd(xmlBufPtr buf)
|
||||
{
|
||||
if ((!buf) || (buf->error))
|
||||
return NULL;
|
||||
@ -739,6 +753,15 @@ xmlBufResize(xmlBufPtr buf, size_t size)
|
||||
CHECK_COMPAT(buf)
|
||||
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
|
||||
/*
|
||||
* Used to provide parsing limits
|
||||
*/
|
||||
if (size >= XML_MAX_TEXT_LENGTH) {
|
||||
xmlBufMemoryError(buf, "buffer error: text too long\n");
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't resize if we don't have to */
|
||||
if (size < buf->size)
|
||||
@ -867,6 +890,15 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
|
||||
|
||||
needSize = buf->use + len + 2;
|
||||
if (needSize > buf->size){
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
|
||||
/*
|
||||
* Used to provide parsing limits
|
||||
*/
|
||||
if (needSize >= XML_MAX_TEXT_LENGTH) {
|
||||
xmlBufMemoryError(buf, "buffer error: text too long\n");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
if (!xmlBufResize(buf, needSize)){
|
||||
xmlBufMemoryError(buf, "growing buffer");
|
||||
return XML_ERR_NO_MEMORY;
|
||||
@ -938,6 +970,15 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
|
||||
}
|
||||
needSize = buf->use + len + 2;
|
||||
if (needSize > buf->size){
|
||||
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
|
||||
/*
|
||||
* Used to provide parsing limits
|
||||
*/
|
||||
if (needSize >= XML_MAX_TEXT_LENGTH) {
|
||||
xmlBufMemoryError(buf, "buffer error: text too long\n");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
if (!xmlBufResize(buf, needSize)){
|
||||
xmlBufMemoryError(buf, "growing buffer");
|
||||
return XML_ERR_NO_MEMORY;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Summary: Internal Interfaces for memory buffers in libxml2
|
||||
* Description: this module describes most of the new xmlBuf buffer
|
||||
* entry points, those are private routines, with a
|
||||
@ -50,8 +50,8 @@ int xmlBufIsEmpty(const xmlBufPtr buf);
|
||||
int xmlBufAddLen(xmlBufPtr buf, size_t len);
|
||||
int xmlBufErase(xmlBufPtr buf, size_t len);
|
||||
|
||||
/* const xmlChar * xmlBufContent(const xmlBufPtr buf); */
|
||||
/* const xmlChar * xmlBufEnd(const xmlBufPtr buf); */
|
||||
/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
|
||||
/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
|
||||
|
||||
xmlChar * xmlBufDetach(xmlBufPtr buf);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user