Compare commits

..

37 Commits

Author SHA1 Message Date
435a11d75c . 2017-04-27 19:57:49 +03:00
9a5329f5d6 . 2017-04-27 16:12:28 +03:00
8eecbf5fa5 . 2017-04-27 16:08:38 +03:00
9e1773df65 Used ClrMap in docx settings 2017-04-27 15:57:44 +03:00
39e4140524 for save pivot 2017-04-27 15:46:06 +03:00
bd90de857e Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-04-27 13:51:47 +03:00
57f2ec7b96 graphicFrameLocks 2017-04-27 13:38:40 +03:00
634098a6fa fix reading xml attributes without namespace 2017-04-27 13:24:46 +03:00
bdbf208f6c open/save Sdt 2017-04-27 12:47:39 +03:00
a652f5d73f OdfFormatWriter - fix smart-art 2017-04-26 20:10:04 +03:00
1602843aa6 fix color alpha 2017-04-26 12:58:51 +03:00
cdb7fb8ea6 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  pivotButton; AddNoWrite defDir
  OdfFormat - fix after testing
  save pivotTables to xlsx
  windows sign (worked version)
  .
2017-04-26 12:46:48 +03:00
6387e9fa69 fix build converter ios 2017-04-26 12:46:41 +03:00
4e8097c93d pivotButton; AddNoWrite defDir 2017-04-26 11:10:58 +03:00
65254b57b2 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-04-25 19:31:42 +03:00
95899e23a8 OdfFormat - fix after testing 2017-04-25 19:30:40 +03:00
5c8757d346 save pivotTables to xlsx 2017-04-25 19:25:45 +03:00
234e19d68a Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-04-25 16:06:04 +03:00
62145b7204 windows sign (worked version) 2017-04-25 15:22:19 +03:00
8bcc6d1501 . 2017-04-25 15:05:58 +03:00
09ef46f333 fix bug #34836 2017-04-25 11:33:31 +03:00
1839350526 . 2017-04-24 19:57:38 +03:00
d7587e91b1 windows sign 2017-04-24 18:57:37 +03:00
7b0a342cf9 . 2017-04-24 17:49:47 +03:00
3d01b0782e . 2017-04-24 15:30:57 +03:00
fecfcfa7d2 . 2017-04-24 14:32:57 +03:00
29b5fa513a . 2017-04-24 13:26:50 +03:00
f9a19badbf DocFormatReader - fix embedded docx formula 2017-04-24 13:20:23 +03:00
d2630ea73c toXml - writer instead string; refreshedDate 2017-04-24 10:54:56 +03:00
a4a58c4782 x2t version up 2017-04-24 10:33:47 +03:00
29a3d80071 . 2017-04-23 16:36:12 +03:00
598bb419c0 OdfFormatWriter - presentation - fields 2017-04-23 16:31:00 +03:00
087da9d2ce . 2017-04-23 14:21:07 +03:00
c505aced48 . 2017-04-22 18:34:10 +03:00
959d5e5fcd OdfFormatWriter - presentation - fix multi-level list, master list styles 2017-04-22 13:05:10 +03:00
8ee0cf4b2c . 2017-04-21 19:26:01 +03:00
426342074e . 2017-04-21 19:08:59 +03:00
111 changed files with 3323 additions and 1169 deletions

View File

@ -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:

View File

@ -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.

View File

@ -86,6 +86,7 @@ namespace DocFileFormat
friend class Table;
friend class TableRow;
friend class VMLShapeMapping;
friend class VMLPictureMapping;
friend class OpenXmlPackage;
friend class TextboxMapping;

View File

@ -61,6 +61,26 @@ enum ETblStyleOverrideType
tblstyleoverridetypeSwCell = 11,
tblstyleoverridetypeWholeTable = 12
};
class SdtWraper
{
public:
OOX::Logic::CSdt m_oSdt;
rPr* m_oEndPr;
rPr* m_oRPr;
int m_nType;
SdtWraper(int nType)
{
m_nType = nType;
m_oEndPr = NULL;
m_oRPr = NULL;
}
~SdtWraper()
{
RELEASEOBJECT(m_oEndPr)
RELEASEOBJECT(m_oRPr)
}
};
#define READ1_DEF(stLen, fReadFunction, arg, res) {\
res = c_oSerConstants::ReadOk;\
@ -3635,6 +3655,11 @@ public:
//сбрасываем Shd
oBinary_tblPrReader.m_sCurTableShd.clear();
}
else if(c_oSerParType::Sdt == type)
{
SdtWraper oSdt(0);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else if ( c_oSerParType::sectPr == type )
{
SectPr oSectPr;
@ -3746,6 +3771,11 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
oTrackRevision.Write(&GetRunStringWriter(), _T("w:del"));
}
else if(c_oSerParType::Sdt == type)
{
SdtWraper oSdt(1);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -6412,6 +6442,11 @@ public:
res = Read1(length, &Binary_DocumentTableReader::Read_Row, this, poResult);
pCStringWriter->WriteString(std::wstring(_T("</w:tr>")));
}
else if(c_oSerDocTableType::Sdt == type)
{
SdtWraper oSdt(2);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -6444,6 +6479,11 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadCell, this, poResult);
pCStringWriter->WriteString(std::wstring(_T("</w:tc>")));
}
else if(c_oSerDocTableType::Sdt == type)
{
SdtWraper oSdt(3);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -7147,6 +7187,309 @@ public:
{
return oBinary_pPrReader.Read_SecPr(type, length, poResult);
}
int ReadSdt(BYTE type, long length, void* poResult)
{
int res = 0;
SdtWraper* pSdt = static_cast<SdtWraper*>(poResult);
if (c_oSerSdt::Pr == type)
{
pSdt->m_oSdt.m_oSdtPr.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPr, this, pSdt);
}
else if (c_oSerSdt::EndPr == type)
{
pSdt->m_oEndPr = new rPr(m_oFontTableWriter.m_mapFonts);
res = oBinary_rPrReader.Read(length, pSdt->m_oEndPr);
}
else if (c_oSerSdt::Content == type)
{
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdt>");
if ( pSdt->m_oSdt.m_oSdtPr.IsInit() )
{
m_oDocumentWriter.m_oContent.WriteString(pSdt->m_oSdt.m_oSdtPr->toXMLStart());
if (NULL != pSdt->m_oRPr)
{
pSdt->m_oRPr->Write(&m_oDocumentWriter.m_oContent);
}
m_oDocumentWriter.m_oContent.WriteString(pSdt->m_oSdt.m_oSdtPr->toXMLEnd());
}
if (NULL != pSdt->m_oEndPr)
{
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdtEndPr>");
pSdt->m_oEndPr->Write(&m_oDocumentWriter.m_oContent);
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdtEndPr>");
}
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdtContent>");
switch(pSdt->m_nType)
{
case 0:
res = Read1(length, &Binary_DocumentTableReader::ReadDocumentContent, this, this);
break;
case 1:
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, this);
break;
case 2:
res = Read1(length, &Binary_DocumentTableReader::Read_TableContent, this, &m_oDocumentWriter.m_oContent);
break;
case 3:
res = Read1(length, &Binary_DocumentTableReader::ReadRowContent, this, &m_oDocumentWriter.m_oContent);
break;
}
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdtContent>");
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdt>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtPr(BYTE type, long length, void* poResult)
{
int res = 0;
SdtWraper* pSdtWraper = static_cast<SdtWraper*>(poResult);
OOX::Logic::CSdtPr* pSdtPr = pSdtWraper->m_oSdt.m_oSdtPr.GetPointer();
if (c_oSerSdt::Type == type)
{
pSdtPr->m_eType = (OOX::Logic::ESdtType)m_oBufferedStream.GetUChar();
}
else if (c_oSerSdt::Alias == type)
{
pSdtPr->m_oAlias.Init();
pSdtPr->m_oAlias->m_sVal.Init();
pSdtPr->m_oAlias->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::ComboBox == type)
{
pSdtPr->m_oComboBox.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtComboBox, this, pSdtPr->m_oComboBox.GetPointer());
}
else if (c_oSerSdt::DataBinding == type)
{
pSdtPr->m_oDataBinding.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPrDataBinding, this, pSdtPr->m_oDataBinding.GetPointer());
}
else if (c_oSerSdt::PrDate == type)
{
pSdtPr->m_oDate.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPrDate, this, pSdtPr->m_oDate.GetPointer());
}
else if (c_oSerSdt::DocPartList == type)
{
pSdtPr->m_oDocPartList.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadDocPartList, this, pSdtPr->m_oDocPartList.GetPointer());
}
else if (c_oSerSdt::DocPartObj == type)
{
pSdtPr->m_oDocPartObj.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadDocPartList, this, pSdtPr->m_oDocPartObj.GetPointer());
}
else if (c_oSerSdt::DropDownList == type)
{
pSdtPr->m_oDropDownList.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadDropDownList, this, pSdtPr->m_oDropDownList.GetPointer());
}
else if (c_oSerSdt::Id == type)
{
pSdtPr->m_oId.Init();
pSdtPr->m_oId->m_oVal.Init();
pSdtPr->m_oId->m_oVal->SetValue(m_oBufferedStream.GetULong());
}
else if (c_oSerSdt::Label == type)
{
pSdtPr->m_oLabel.Init();
pSdtPr->m_oLabel->m_oVal.Init();
pSdtPr->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetULong());
}
else if (c_oSerSdt::Lock == type)
{
pSdtPr->m_oLock.Init();
pSdtPr->m_oLock->m_oVal.SetValue((SimpleTypes::ELock)m_oBufferedStream.GetUChar());
}
else if (c_oSerSdt::PlaceHolder == type)
{
pSdtPr->m_oPlaceHolder.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::RPr == type)
{
pSdtWraper->m_oRPr = new rPr(m_oFontTableWriter.m_mapFonts);
res = oBinary_rPrReader.Read(length, pSdtWraper->m_oRPr);
}
else if (c_oSerSdt::ShowingPlcHdr == type)
{
pSdtPr->m_oShowingPlcHdr.Init();
pSdtPr->m_oShowingPlcHdr->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else if (c_oSerSdt::TabIndex == type)
{
pSdtPr->m_oTabIndex.Init();
pSdtPr->m_oTabIndex->m_oVal.Init();
pSdtPr->m_oTabIndex->m_oVal->SetValue(m_oBufferedStream.GetULong());
}
else if (c_oSerSdt::Tag == type)
{
pSdtPr->m_oTag.Init();
pSdtPr->m_oTag->m_sVal.Init();
pSdtPr->m_oTag->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::Temporary == type)
{
pSdtPr->m_oTemporary.Init();
pSdtPr->m_oTemporary->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else if (c_oSerSdt::MultiLine == type)
{
pSdtPr->m_oText.Init();
pSdtPr->m_oText->m_oMultiLine.Init();
pSdtPr->m_oText->m_oMultiLine->FromBool(m_oBufferedStream.GetBool());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtComboBox(BYTE type, long length, void* poResult)
{
int res = 0;
OOX::Logic::CSdtComboBox* pSdtComboBox = static_cast<OOX::Logic::CSdtComboBox*>(poResult);
if (c_oSerSdt::LastValue == type)
{
pSdtComboBox->m_sLastValue.Init();
pSdtComboBox->m_sLastValue->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::SdtListItem == type)
{
ComplexTypes::Word::CSdtListItem* pSdtListItem = new ComplexTypes::Word::CSdtListItem();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtListItem, this, pSdtListItem);
pSdtComboBox->m_arrListItem.push_back(pSdtListItem); }
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtListItem(BYTE type, long length, void* poResult)
{
int res = 0;
ComplexTypes::Word::CSdtListItem* pSdtListItem = static_cast<ComplexTypes::Word::CSdtListItem*>(poResult);
if (c_oSerSdt::DisplayText == type)
{
pSdtListItem->m_sDisplayText.Init();
pSdtListItem->m_sDisplayText->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::Value == type)
{
pSdtListItem->m_sValue.Init();
pSdtListItem->m_sValue->append(m_oBufferedStream.GetString3(length));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtPrDataBinding(BYTE type, long length, void* poResult)
{
int res = 0;
ComplexTypes::Word::CDataBinding* pDataBinding = static_cast<ComplexTypes::Word::CDataBinding*>(poResult);
if (c_oSerSdt::PrefixMappings == type)
{
pDataBinding->m_sPrefixMappings.Init();
pDataBinding->m_sPrefixMappings->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::StoreItemID == type)
{
pDataBinding->m_sStoreItemID.Init();
pDataBinding->m_sStoreItemID->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::XPath == type)
{
pDataBinding->m_sXPath.Init();
pDataBinding->m_sXPath->append(m_oBufferedStream.GetString3(length));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtPrDate(BYTE type, long length, void* poResult)
{
int res = 0;
OOX::Logic::CDate* pDate = static_cast<OOX::Logic::CDate*>(poResult);
if (c_oSerSdt::FullDate == type)
{
std::wstring sVal = m_oBufferedStream.GetString3(length);
pDate->m_oFullDate.Init();
pDate->m_oFullDate->SetValue(sVal);
}
else if (c_oSerSdt::Calendar == type)
{
pDate->m_oCalendar.Init();
pDate->m_oCalendar->m_oVal.SetValue((SimpleTypes::ECalendarType)m_oBufferedStream.GetUChar());
}
else if (c_oSerSdt::DateFormat == type)
{
pDate->m_oDateFormat.Init();
pDate->m_oDateFormat->m_sVal.Init();
pDate->m_oDateFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::Lid == type)
{
pDate->m_oLid.Init();
pDate->m_oLid->m_oVal.Init();
std::wstring sVal = m_oBufferedStream.GetString3(length);
pDate->m_oLid->m_oVal->SetValue(sVal);
}
else if (c_oSerSdt::StoreMappedDataAs == type)
{
pDate->m_oStoreMappedDateAs.Init();
pDate->m_oStoreMappedDateAs->m_oVal.SetValue((SimpleTypes::ESdtDateMappingType)m_oBufferedStream.GetUChar());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadDocPartList(BYTE type, long length, void* poResult)
{
int res = 0;
OOX::Logic::CSdtDocPart* pDocPart = static_cast<OOX::Logic::CSdtDocPart*>(poResult);
if (c_oSerSdt::DocPartCategory == type)
{
pDocPart->m_oDocPartCategory.Init();
pDocPart->m_oDocPartCategory->m_sVal.Init();
pDocPart->m_oDocPartCategory->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::DocPartGallery == type)
{
pDocPart->m_oDocPartGallery.Init();
pDocPart->m_oDocPartGallery->m_sVal.Init();
pDocPart->m_oDocPartGallery->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::DocPartUnique == type)
{
pDocPart->m_oDocPartUnique.Init();
pDocPart->m_oDocPartUnique->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadDropDownList(BYTE type, long length, void* poResult)
{
int res = 0;
OOX::Logic::CSdtDropDownList* pDropDownList = static_cast<OOX::Logic::CSdtDropDownList*>(poResult);
if (c_oSerSdt::LastValue == type)
{
pDropDownList->m_sLastValue.Init();
pDropDownList->m_sLastValue->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::SdtListItem == type)
{
ComplexTypes::Word::CSdtListItem* pSdtListItem = new ComplexTypes::Word::CSdtListItem();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtListItem, this, pSdtListItem);
pDropDownList->m_arrListItem.push_back(pSdtListItem);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
};
class Binary_NotesTableReader : public Binary_CommonReader<Binary_NotesTableReader>
{

View File

@ -463,7 +463,8 @@ extern int g_nCurFormatVersion;
FldSimple = 11,
Del = 12,
Ins = 13,
Background = 14
Background = 14,
Sdt = 15
};}
namespace c_oSerDocTableType{enum c_oSerDocTableType
{
@ -477,7 +478,8 @@ extern int g_nCurFormatVersion;
Cell = 6,
Cell_Pr = 7,
Cell_Content = 8,
tblGridChange = 9
tblGridChange = 9,
Sdt = 10
};}
namespace c_oSerRunType{enum c_oSerRunType
{
@ -1003,6 +1005,45 @@ extern int g_nCurFormatVersion;
Data = 1,
Program = 2
};}
namespace c_oSerSdt{enum c_oSerSdt
{
Pr = 0,
EndPr = 1,
Content = 2,
Type = 3,
Alias = 4,
ComboBox = 5,
LastValue = 6,
SdtListItem = 7,
DisplayText = 8,
Value = 9,
DataBinding = 10,
PrefixMappings = 11,
StoreItemID = 12,
XPath = 13,
PrDate = 14,
FullDate = 15,
Calendar = 16,
DateFormat = 17,
Lid = 18,
StoreMappedDataAs = 19,
DocPartList = 20,
DocPartObj = 21,
DocPartCategory = 22,
DocPartGallery = 23,
DocPartUnique = 24,
DropDownList = 25,
Id = 26,
Label = 27,
Lock = 28,
PlaceHolder = 29,
RPr = 30,
ShowingPlcHdr = 31,
TabIndex = 32,
Tag = 33,
Temporary = 34,
MultiLine = 35
};}
}
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES

View File

@ -3047,8 +3047,9 @@ namespace BinDocxRW
case OOX::et_w_sdt:
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
WriteDocumentContent(pStd->m_oSdtContent.get().m_arrItems);
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Sdt);
WriteSdt(pStd, 0, NULL, 0, 0, 0);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}break;
case OOX::et_w_smartTag:
{
@ -3189,8 +3190,9 @@ namespace BinDocxRW
case OOX::et_w_sdt:
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
WriteParagraphContent(pStd->m_oSdtContent.get().m_arrItems);
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Sdt);
WriteSdt(pStd, 1, NULL, 0, 0, 0);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
break;
}
case OOX::et_w_smartTag:
@ -6366,8 +6368,9 @@ namespace BinDocxRW
else if(OOX::et_w_sdt == item->getType())
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
WriteTableContent(pStd->m_oSdtContent->m_arrItems, pTblPr, nRows, nCols);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Sdt);
WriteSdt(pStd, 2, pTblPr, 0, nRows, nCols);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
else if(OOX::et_w_smartTag == item->getType())
{
@ -6425,8 +6428,9 @@ namespace BinDocxRW
else if(OOX::et_w_sdt == item->getType())
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
WriteRowContent(pStd->m_oSdtContent.get().m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Sdt);
WriteSdt(pStd, 3, pTblPr, nCurRowIndex, nRows, nCols);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
else if(OOX::et_w_smartTag == item->getType())
{
@ -6462,6 +6466,287 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.WriteDocumentContent(tc.m_arrItems);
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteSdt(OOX::Logic::CSdt* pStd, int type, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
{
int nCurPos = 0;
if(pStd->m_oSdtPr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Pr);
WriteSdtPr(pStd->m_oSdtPr.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(pStd->m_oSdtEndPr.IsInit() && pStd->m_oSdtEndPr->m_oRPr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::EndPr);
brPrs.Write_rPr(pStd->m_oSdtEndPr->m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(pStd->m_oSdtContent.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Content);
switch(type)
{
case 0:
{
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, m_oParamsDocumentWriter, m_mapIgnoreComments, bpPrs.m_oBinaryHeaderFooterTableWriter);
oBinaryDocumentTableWriter.WriteDocumentContent(pStd->m_oSdtContent.get().m_arrItems);
break;
}
case 1:
{
WriteParagraphContent(pStd->m_oSdtContent.get().m_arrItems);
break;
}
case 2:
{
WriteTableContent(pStd->m_oSdtContent->m_arrItems, pTblPr, nRows, nCols);
break;
}
case 3:
{
WriteRowContent(pStd->m_oSdtContent.get().m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
break;
}
}
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr)
{
int nCurPos = 0;
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Type);
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_eType);
m_oBcw.WriteItemEnd(nCurPos);
if(oStdPr.m_oAlias.IsInit() && oStdPr.m_oAlias->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Alias);
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oAlias->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oComboBox.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ComboBox);
WriteSdtComboBox(oStdPr.m_oComboBox.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDataBinding.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DataBinding);
WriteSdtPrDataBinding(oStdPr.m_oDataBinding.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDate.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PrDate);
WriteSdtPrDate(oStdPr.m_oDate.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDocPartList.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartList);
WriteDocPartList(oStdPr.m_oDocPartList.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDocPartObj.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartObj);
WriteDocPartList(oStdPr.m_oDocPartObj.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDropDownList.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DropDownList);
WriteDropDownList(oStdPr.m_oDropDownList.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oId.IsInit() && oStdPr.m_oId->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Id);
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oId->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oLabel.IsInit() && oStdPr.m_oLabel->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Label);
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oLabel->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oLock.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Lock);
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_oLock->m_oVal.GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oPlaceHolder.IsInit() && oStdPr.m_oPlaceHolder->m_oDocPart.IsInit() && oStdPr.m_oPlaceHolder->m_oDocPart->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PlaceHolder);
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oPlaceHolder->m_oDocPart->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oRPr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::RPr);
brPrs.Write_rPr(oStdPr.m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oShowingPlcHdr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ShowingPlcHdr);
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oShowingPlcHdr->m_oVal.ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oTabIndex.IsInit() && oStdPr.m_oTabIndex->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TabIndex);
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oTabIndex->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oTag.IsInit() && oStdPr.m_oTag->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Tag);
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oTag->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oTemporary.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Temporary);
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oTemporary->m_oVal.ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oText.IsInit() && oStdPr.m_oText->m_oMultiLine.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::MultiLine);
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oText->m_oMultiLine->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtComboBox(const OOX::Logic::CSdtComboBox& oSdtComboBox)
{
int nCurPos = 0;
if(oSdtComboBox.m_sLastValue.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::LastValue);
m_oBcw.m_oStream.WriteStringW3(oSdtComboBox.m_sLastValue.get());
m_oBcw.WriteItemEnd(nCurPos);
}
for(size_t i = 0; i < oSdtComboBox.m_arrListItem.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::SdtListItem);
WriteSdtListItem(*oSdtComboBox.m_arrListItem[i]);
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtListItem(const ComplexTypes::Word::CSdtListItem& oSdtListItem)
{
int nCurPos = 0;
if(oSdtListItem.m_sDisplayText.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DisplayText);
m_oBcw.m_oStream.WriteStringW3(oSdtListItem.m_sDisplayText.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oSdtListItem.m_sValue.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Value);
m_oBcw.m_oStream.WriteStringW3(oSdtListItem.m_sValue.get());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtPrDataBinding(const ComplexTypes::Word::CDataBinding& oDataBinding)
{
int nCurPos = 0;
if(oDataBinding.m_sPrefixMappings.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PrefixMappings);
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sPrefixMappings.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDataBinding.m_sStoreItemID.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::StoreItemID);
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sStoreItemID.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDataBinding.m_sXPath.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::XPath);
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sXPath.get());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtPrDate(const OOX::Logic::CDate& oDate)
{
int nCurPos = 0;
if(oDate.m_oFullDate.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::FullDate);
m_oBcw.m_oStream.WriteStringW3(oDate.m_oFullDate->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDate.m_oCalendar.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Calendar);
m_oBcw.m_oStream.WriteBYTE(oDate.m_oCalendar->m_oVal.GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDate.m_oDateFormat.IsInit() && oDate.m_oDateFormat->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DateFormat);
m_oBcw.m_oStream.WriteStringW3(oDate.m_oDateFormat->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDate.m_oLid.IsInit() && oDate.m_oLid->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Lid);
m_oBcw.m_oStream.WriteStringW3(oDate.m_oLid->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDate.m_oStoreMappedDateAs.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::StoreMappedDataAs);
m_oBcw.m_oStream.WriteBYTE(oDate.m_oStoreMappedDateAs->m_oVal.GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteDocPartList(const OOX::Logic::CSdtDocPart& oSdtDocPart)
{
int nCurPos = 0;
if(oSdtDocPart.m_oDocPartCategory.IsInit() && oSdtDocPart.m_oDocPartCategory->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartCategory);
m_oBcw.m_oStream.WriteStringW3(oSdtDocPart.m_oDocPartCategory->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oSdtDocPart.m_oDocPartGallery.IsInit() && oSdtDocPart.m_oDocPartGallery->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartGallery);
m_oBcw.m_oStream.WriteStringW3(oSdtDocPart.m_oDocPartGallery->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oSdtDocPart.m_oDocPartUnique.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartUnique);
m_oBcw.m_oStream.WriteBOOL(oSdtDocPart.m_oDocPartUnique->m_oVal.ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteDropDownList(const OOX::Logic::CSdtDropDownList& oDropDownList)
{
int nCurPos = 0;
if(oDropDownList.m_sLastValue.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::LastValue);
m_oBcw.m_oStream.WriteStringW3(oDropDownList.m_sLastValue.get());
m_oBcw.WriteItemEnd(nCurPos);
}
for(size_t i = 0; i < oDropDownList.m_arrListItem.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::SdtListItem);
WriteSdtListItem(*oDropDownList.m_arrListItem[i]);
m_oBcw.WriteItemEnd(nCurPos);
}
}
};
class BinaryCommentsTableWriter
{
@ -6909,80 +7194,94 @@ namespace BinDocxRW
}
}
}
void WriteColorSchemeMapping(const OOX::Settings::CColorSchemeMapping& oColorSchemeMapping)
void WriteColorSchemeMapping(const PPTX::Logic::ClrMap& oColorSchemeMapping)
{
int nCurPos = 0;
if(oColorSchemeMapping.m_oAccent1.IsInit())
std::map<std::wstring, PPTX::Limit::ColorSchemeIndex>::const_iterator pFind;
pFind = oColorSchemeMapping.ColorMap.find(L"accent1");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent1->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent2.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent2->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent3.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent3");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent3);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent3->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent4.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent4");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent4);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent4->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent5.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent5");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent5);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent5->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent6.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent6");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent6);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent6->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oBg1.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"bg1");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oBg1->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oBg2.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"bg2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oBg2->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oFollowedHyperlink.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"folHlink");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::FollowedHyperlink);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oFollowedHyperlink->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oHyperlink.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"hlink");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Hyperlink);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oHyperlink->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oT1.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"tx1");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oT1->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oT2.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"tx2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oT2->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
};
};

View File

@ -54,7 +54,7 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT hr = S_OK;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.pptx"; //xlsx pptx docx
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.docx"; //xlsx pptx docx
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);

View File

@ -453,6 +453,7 @@ void draw_enhanced_geometry_attlist::add_attributes( const xml::attributes_wc_pt
CP_APPLY_ATTR(L"draw:modifiers" , draw_modifiers_);
CP_APPLY_ATTR(L"draw:text-path" , draw_text_path_);
CP_APPLY_ATTR(L"draw:enhanced-path" , draw_enhanced_path_);
CP_APPLY_ATTR(L"drawooo:enhanced-path" , drawooo_enhanced_path_);
CP_APPLY_ATTR(L"drawooo:sub-view-size" , drawooo_sub_view_size_);
}
// draw:enhanced_geometry
@ -485,6 +486,9 @@ void draw_enhanced_geometry::add_child_element( xml::sax * Reader, const std::ws
}
void draw_enhanced_geometry::find_draw_type_oox()
{
word_art_ = false;
bOoxType_ = false;
if (draw_enhanced_geometry_attlist_.draw_text_path_ &&
*draw_enhanced_geometry_attlist_.draw_text_path_ == true)
{
@ -501,7 +505,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
{
int count = sizeof(_OO_OOX_wordart) / sizeof(_shape_converter);
for (long i=0; i< count; i++)
for (int i = 0; i < count; i++)
{
if (_OO_OOX_wordart[i].odf_reader == odf_type)
{
@ -518,7 +522,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
if (pos < 0)
{
for (long i=0; i< count; i++)
for (long i = 0; i< count; i++)
{
if (_OO_OOX_custom_shapes[i].odf_reader == odf_type)
{
@ -529,8 +533,9 @@ void draw_enhanced_geometry::find_draw_type_oox()
}
else
{
bOoxType_ = true;
std::wstring oox_type = odf_type.substr(pos + 6);
for (long i=0; i< count; i++)
for (long i = 0; i< count; i++)
{
if (_OO_OOX_custom_shapes[i].oox == oox_type)
{
@ -547,18 +552,18 @@ void draw_enhanced_geometry::find_draw_type_oox()
}
std::wstringstream str;
BOOST_FOREACH(const office_element_ptr & parElement, draw_handle_)
for (size_t i = 0; i < draw_handle_.size(); i++)
{
draw_handle * handle = dynamic_cast<draw_handle *>(parElement.get());
int min = -1;
int max = -1;
draw_handle * handle = dynamic_cast<draw_handle *>(draw_handle_[i].get());
if (!handle) continue;
int min = -1, max = -1;
try
{
min = parsing(handle->draw_handle_attlist_.draw_handle_range_y_minimum_);//пока статик .. и выдается только цыфровое значение
if (min<0)min = parsing(handle->draw_handle_attlist_.draw_handle_range_x_minimum_);
if (min<0)min = parsing(handle->draw_handle_attlist_.draw_handle_radius_range_minimum_);
if (min < 0) min = parsing(handle->draw_handle_attlist_.draw_handle_range_x_minimum_);
if (min < 0) min = parsing(handle->draw_handle_attlist_.draw_handle_radius_range_minimum_);
}
catch(...)
{
@ -574,7 +579,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
catch(...)
{
}
draw_handle_geometry elm={min, max};
draw_handle_geometry elm = {min, max};
draw_handle_geometry_.push_back(elm);
}
}

View File

@ -437,6 +437,7 @@ public:
_CP_OPT(std::wstring) draw_modifiers_;
_CP_OPT(bool) draw_text_path_;
_CP_OPT(std::wstring) draw_enhanced_path_;
_CP_OPT(std::wstring) drawooo_enhanced_path_;
_CP_OPT(std::wstring) drawooo_sub_view_size_;
};
/////////////////////////////////////////////////////////////////////////
@ -464,7 +465,9 @@ public:
_CP_OPT(int) sub_type_;
_CP_OPT(int) draw_type_oox_index_;
_CP_OPT(std::wstring) svg_viewbox_;
bool word_art_;
bool bOoxType_;
typedef std::pair<std::wstring,std::wstring> pair_string_value;

View File

@ -253,13 +253,19 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
set_shape = true;
}
if (sub_type_)
{
shape->sub_type_ = sub_type_.get();
set_shape = true;
}
std::wstring odf_path;
if (draw_enhanced_geometry_attlist_.drawooo_enhanced_path_)
odf_path = draw_enhanced_geometry_attlist_.drawooo_enhanced_path_.get();
else if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
odf_path = draw_enhanced_geometry_attlist_.draw_enhanced_path_.get();
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
if (!odf_path.empty())
{
std::vector<::svg_path::_polyline> o_Polyline;
@ -267,7 +273,7 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
try
{
res = ::svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true);
}
catch(...)
{
@ -316,8 +322,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
{
if (draw_handle_geometry_[0].min < draw_handle_geometry_[0].max)
{
shape->additional_.push_back(_property(L"draw-modifiers-min",draw_handle_geometry_[0].min));
shape->additional_.push_back(_property(L"draw-modifiers-max",draw_handle_geometry_[0].max));
shape->additional_.push_back(_property(L"draw-modifiers-min", draw_handle_geometry_[0].min));
shape->additional_.push_back(_property(L"draw-modifiers-max", draw_handle_geometry_[0].max));
}
}
}
@ -326,7 +332,6 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
{
shape->bad_shape_ = true;
}
}
}
}

View File

@ -291,8 +291,9 @@ office_element_ptr odf_conversion_context::start_tabs()
}
std::wstring odf_conversion_context::add_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_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;

View File

@ -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()
@ -468,6 +474,7 @@ void odf_drawing_context::start_drawing()
}
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;
@ -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,7 +722,10 @@ 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();
@ -1135,7 +1152,6 @@ void odf_drawing_context::set_hidden (bool bVal)
void odf_drawing_context::set_opacity(double percent_)
{
if (!impl_->current_graphic_properties)return;
if (percent_ < 0.01) return;
switch(impl_->current_drawing_part_)
{
@ -1169,22 +1185,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;
@ -1192,7 +1212,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 ...
}
@ -1239,7 +1259,8 @@ _CP_OPT(odf_types::color) odf_drawing_context::get_line_color()
}
void odf_drawing_context::set_solid_fill(std::wstring hexColor)
{
if (!impl_->current_graphic_properties)return;
if (!impl_->current_graphic_properties) return;
if (hexColor.empty()) return;
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
@ -1248,7 +1269,7 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
{
case Area:
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->common_background_color_attlist_.fo_background_color_ = color(hexColor);
//impl_->current_graphic_properties->common_background_color_attlist_.fo_background_color_ = color(hexColor); - default transparent
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
@ -1730,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)
@ -2156,27 +2177,47 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
paragraph_properties = style_->content_.get_style_paragraph_properties();
}
}
if (paragraph_properties == NULL && impl_->current_paragraph_properties == NULL)return;
switch(mode)
if (paragraph_properties)
{
case 5://textverticaltypeWordArtVert:
case 6://textverticaltypeWordArtVertRtl:
case 4://SimpleTypes::textverticaltypeVert270: //нужно отзеркалить по горизонтали текст
case 3://SimpleTypes::textverticaltypeVert:
case 2://SimpleTypes::textverticaltypeMongolianVert:
paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::TbRl);
impl_->current_paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::TbRl);
break;
case 0://SimpleTypes::textverticaltypeEaVert:
paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::TbRl);
impl_->current_paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::TbRl);
break;
case 1://SimpleTypes::textverticaltypeHorz:
default:
paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::LrTb);
impl_->current_paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::LrTb);
break;
switch(mode)
{
case 5://textverticaltypeWordArtVert:
case 6://textverticaltypeWordArtVertRtl:
case 4://SimpleTypes::textverticaltypeVert270: //нужно отзеркалить по горизонтали текст
case 3://SimpleTypes::textverticaltypeVert:
case 2://SimpleTypes::textverticaltypeMongolianVert:
paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::TbRl);
break;
case 0://SimpleTypes::textverticaltypeEaVert:
paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::TbRl);
break;
case 1://SimpleTypes::textverticaltypeHorz:
default:
paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::LrTb);
break;
}
}
if (impl_->current_paragraph_properties)
{
switch(mode)
{
case 5://textverticaltypeWordArtVert:
case 6://textverticaltypeWordArtVertRtl:
case 4://SimpleTypes::textverticaltypeVert270: //нужно отзеркалить по горизонтали текст
case 3://SimpleTypes::textverticaltypeVert:
case 2://SimpleTypes::textverticaltypeMongolianVert:
impl_->current_paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::TbRl);
break;
case 0://SimpleTypes::textverticaltypeEaVert:
impl_->current_paragraph_properties->content_.style_writing_mode_ = odf_types::writing_mode(odf_types::writing_mode::TbRl);
break;
case 1://SimpleTypes::textverticaltypeHorz:
default:
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)
@ -2455,7 +2496,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++)
{

View File

@ -60,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 ();

View File

@ -108,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;
@ -120,14 +120,13 @@ void odf_lists_styles_context::start_style(int based_number)
{
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);
state.automatic = true; //document automatic style
}
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 = false; //office style
}
state.automatic = !bMaster;
text_list_style *style = dynamic_cast<text_list_style *>(elm.get());
if (style == NULL)return;

View File

@ -64,7 +64,7 @@ public:
odf_lists_styles_context();
void set_odf_context(odf_conversion_context * Context);
void start_style(int abstract_number = -1);
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();

View File

@ -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();

View File

@ -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);

View File

@ -163,6 +163,11 @@ odf_table_context* odt_conversion_context::table_context()
{
return &table_context_;
}
odf_notes_context* odt_conversion_context::notes_context()
{
return &notes_context_;
}
odf_text_context* odt_conversion_context::text_context()
{
@ -266,8 +271,11 @@ void odt_conversion_context::end_drawings()
}
else
{
text_context()->start_element(elm);
text_context()->end_element();
if (elm)
{
text_context()->start_element(elm);
text_context()->end_element();
}
drawing_context()->clear();
drawing_context_.pop_back();

View File

@ -79,6 +79,7 @@ public:
odf_comment_context * comment_context();
odf_table_context * table_context();
odf_notes_context * notes_context();
void start_drawings ();
void end_drawings ();

View File

@ -207,6 +207,8 @@ void text_list::create_child_element(const std::wstring & Ns, const std::wstring
}
void text_list::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextListHeader)

View File

@ -30,6 +30,8 @@
*
*/
#include "PptxConverter.h"
#include "DocxConverter.h"
#include "../utils.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
@ -96,9 +98,6 @@ void OoxConverter::convert(PPTX::Logic::GraphicFrame *oox_graphic_frame)
{
if (!oox_graphic_frame)return;
//----------------------------------------------------------------------------------
odf_context()->drawing_context()->start_drawing();
convert(&oox_graphic_frame->nvGraphicFramePr);
convert(oox_graphic_frame->xfrm.GetPointer());
@ -124,7 +123,6 @@ void OoxConverter::convert(PPTX::Logic::GraphicFrame *oox_graphic_frame)
{
OoxConverter::convert(oox_graphic_frame->element.GetElem().operator->());
}
odf_context()->drawing_context()->end_drawing();
}
void OoxConverter::convert(PPTX::Logic::NvGraphicFramePr *oox_framePr)
{
@ -192,7 +190,6 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
if (type != SimpleTypes::shapetypeRect)
{
odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->start_shape(type);
convert(&oox_picture->spPr, oox_picture->style.GetPointer());
@ -203,29 +200,29 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
odf_context()->drawing_context()->end_area_properties();
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
return;
}
}
std::wstring pathImage;
std::wstring odf_ref;
std::wstring pathImage;
if (oox_picture->blipFill.blip.IsInit())
{
std::wstring sID;
bool bEmbedded = true;
if (oox_picture->blipFill.blip->embed.IsInit())
{
sID = oox_picture->blipFill.blip->embed->get();
std::wstring sID = oox_picture->blipFill.blip->embed->get();
pathImage = find_link_by_id(sID, 1);
odf_ref = odf_context()->add_image(pathImage);
}
else if (oox_picture->blipFill.blip->link.IsInit())
{
pathImage = oox_picture->blipFill.blip->link->get();
odf_ref = oox_picture->blipFill.blip->link->get();
bEmbedded = false;
}
}
std::wstring odf_ref = odf_context()->add_image(pathImage);
odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->start_image(odf_ref);
{
double Width = 0, Height = 0;
@ -253,7 +250,6 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
}
odf_context()->drawing_context()->end_image();
odf_context()->drawing_context()->end_drawing();
}
void OoxConverter::convert(PPTX::Logic::SmartArt *oox_smart_art)
@ -261,11 +257,11 @@ void OoxConverter::convert(PPTX::Logic::SmartArt *oox_smart_art)
if (oox_smart_art == NULL) return;
if (oox_smart_art->id_data.IsInit() == false) return;
oox_smart_art->LoadDrawing();
oox_smart_art->LoadDrawing(current_document());
if (oox_smart_art->m_diag.IsInit())
{
_CP_OPT(double) x, y, width, height, cx, cy;
_CP_OPT(double) x, y, width, height, cx = 1., cy= 1.;
odf_context()->drawing_context()->get_size (width, height);
odf_context()->drawing_context()->get_position (x, y);
@ -279,7 +275,9 @@ void OoxConverter::convert(PPTX::Logic::SmartArt *oox_smart_art)
for (size_t i = 0; i < oox_smart_art->m_diag->SpTreeElems.size(); i++)
{
convert(&oox_smart_art->m_diag->SpTreeElems[i]);
odf_context()->drawing_context()->start_drawing();
convert(&oox_smart_art->m_diag->SpTreeElems[i]);
odf_context()->drawing_context()->end_drawing();
}
odf_context()->drawing_context()->end_group();
@ -396,7 +394,9 @@ void OoxConverter::convert(PPTX::Logic::SpTree *oox_shape_tree)
for (size_t i = 0; i < oox_shape_tree->SpTreeElems.size(); i++)
{
convert(oox_shape_tree->SpTreeElems[i].GetElem().operator->());
odf_context()->drawing_context()->start_drawing();
convert(oox_shape_tree->SpTreeElems[i].GetElem().operator->());
odf_context()->drawing_context()->end_drawing();
}
odf_context()->drawing_context()->end_group();
@ -406,80 +406,105 @@ void OoxConverter::convert(PPTX::Logic::CxnSp *oox_connect)
{
if (oox_connect == NULL) return;
odf_context()->drawing_context()->start_drawing();
int type = SimpleTypes::shapetypeLine;
int type = SimpleTypes::shapetypeLine;
if ( oox_connect->spPr.Geometry.is<PPTX::Logic::PrstGeom>() )
{
const PPTX::Logic::PrstGeom& prstGeom = oox_connect->spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> preset;
preset.FromString(prstGeom.prst.get());
type = preset.GetValue();
}
odf_context()->drawing_context()->start_shape(type);
if ( oox_connect->spPr.Geometry.is<PPTX::Logic::PrstGeom>() )
{
const PPTX::Logic::PrstGeom& prstGeom = oox_connect->spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> preset;
preset.FromString(prstGeom.prst.get());
type = preset.GetValue();
}
odf_context()->drawing_context()->start_shape(type);
convert(&oox_connect->spPr, oox_connect->style.GetPointer());
convert(&oox_connect->nvCxnSpPr);
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
}
void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
{
if (oox_shape == NULL) return;
odf_context()->drawing_context()->start_drawing();
_CP_OPT(bool) bMasterPresentation = odf_context()->drawing_context()->get_presentation();
int type = 1000; //custom
if (oox_shape->txXfrm.IsInit())
{
odf_context()->drawing_context()->start_group();
odf_context()->drawing_context()->start_drawing();
}
int type = 1000; //custom
if (oox_shape->spPr.Geometry.is_init())
if (oox_shape->spPr.Geometry.is_init())
{
if ( oox_shape->spPr.Geometry.is<PPTX::Logic::PrstGeom>() )
{
if ( oox_shape->spPr.Geometry.is<PPTX::Logic::PrstGeom>() )
const PPTX::Logic::PrstGeom& prstGeom = oox_shape->spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> preset;
preset.FromString(prstGeom.prst.get());
type = preset.GetValue();
}
if (type == SimpleTypes::shapetypeRect && (oox_shape->txBody.IsInit() || oox_shape->oTextBoxShape.IsInit()))
type = 2000;
if (type == 2000)
{
PPTX::Logic::BodyPr *bodyPr = NULL;
if (oox_shape->txBody.IsInit()) bodyPr = oox_shape->txBody->bodyPr.GetPointer();
else bodyPr = oox_shape->oTextBoxBodyPr.GetPointer();
if (bodyPr && bodyPr->fromWordArt.get_value_or(false))
{
const PPTX::Logic::PrstGeom& prstGeom = oox_shape->spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> preset;
preset.FromString(prstGeom.prst.get());
type = preset.GetValue();
}
if (type == SimpleTypes::shapetypeRect && oox_shape->txBody.IsInit()) type = 2000;
if (type == 2000 && oox_shape->txBody->bodyPr.IsInit()
&& oox_shape->txBody->bodyPr->fromWordArt.get_value_or(false))
{
int wordart_type = convert(oox_shape->txBody->bodyPr->prstTxWarp.GetPointer());
int wordart_type = convert(bodyPr->prstTxWarp.GetPointer());
if (wordart_type > 0) type = wordart_type;
}
}
else if (oox_shape->nvSpPr.nvPr.ph.is_init())
{
type = 2000;
}
}
else if (oox_shape->nvSpPr.nvPr.ph.is_init())
{
type = 2000;
}
if (type < 0)return;
if (type < 0)return;
//-----------------------------------------------------------------------------
odf_context()->drawing_context()->start_shape(type);
convert(&oox_shape->spPr, oox_shape->style.GetPointer());
odf_context()->drawing_context()->start_shape(type);
convert(&oox_shape->spPr, oox_shape->style.GetPointer());
convert(&oox_shape->nvSpPr);
convert(&oox_shape->nvSpPr);
if (oox_shape->txXfrm.IsInit() == false)
if (oox_shape->txXfrm.IsInit() == false)
{
if (oox_shape->oTextBoxShape.IsInit()) //docx sdt
{
convert(oox_shape->txBody.GetPointer(), oox_shape->style.GetPointer());
DocxConverter *docx_converter = dynamic_cast<DocxConverter*>(this);
if (docx_converter)
{
odf_context()->start_text_context();
docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
odf_context()->drawing_context()->set_text( odf_context()->text_context());
convert(oox_shape->oTextBoxBodyPr.GetPointer());
if (oox_shape->style.IsInit())
convert(&oox_shape->style->fontRef);
odf_context()->end_text_context();
}
}
else
convert(oox_shape->txBody.GetPointer(), oox_shape->style.GetPointer());
}
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
if (oox_shape->txXfrm.IsInit())
{
odf_context()->drawing_context()->end_drawing();
odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->start_text_box();
@ -492,6 +517,8 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
odf_context()->drawing_context()->end_text_box();
odf_context()->drawing_context()->end_drawing();
odf_context()->drawing_context()->end_group();
}
}
@ -882,12 +909,19 @@ void OoxConverter::convert(PPTX::Logic::UniColor * color, std::wstring & hexStri
if (!color) return;
convert(color, nARGB);
hexString = XmlUtils::IntToString(nARGB & 0x00FFFFFF, L"#%06X");
if ((nARGB >> 24) != 0xff)
if (nARGB != 0)
{
hexString = XmlUtils::IntToString(nARGB & 0x00FFFFFF, L"#%06X");
if ((nARGB >> 24) != 0xff)
{
opacity = ((nARGB >> 24) /255.) * 100.;
}
}
else
{
opacity = ((nARGB >> 24) /255.) * 100.;
//not found in theme
}
}
@ -1098,16 +1132,7 @@ void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr)
{
if (!oox_nvPr) return;
if (oox_nvPr->ph.is_init())
{
if (oox_nvPr->ph->type.IsInit())
odf_context()->drawing_context()->set_placeholder_type(oox_nvPr->ph->type->GetBYTECode());
if (oox_nvPr->ph->idx.IsInit())
odf_context()->drawing_context()->set_placeholder_id(oox_nvPr->ph->idx.get());
//nullable_bool hasCustomPrompt;
//nullable_limit<Limit::Orient> orient;
//nullable_limit<Limit::PlaceholderSize> sz;
}
//ph уровнем выше
}
void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_props, int level)
@ -1154,25 +1179,39 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
}
if (bullet.is<PPTX::Logic::BuBlip>())
{
odf_list_type = 1000;
const PPTX::Logic::BuBlip & buBlip = bullet.as<PPTX::Logic::BuBlip>();
std::wstring pathImage;
std::wstring sID;
std::wstring odf_ref;
bool bEmbedded = true;
if (buBlip.blip.embed.IsInit())
{
sID = buBlip.blip.embed->get();
pathImage = find_link_by_id(sID, 1);
std::wstring sID = buBlip.blip.embed->get();
std::wstring pathImage = find_link_by_id(sID, 1);
if (pathImage.empty())
pathImage = buBlip.blip.GetFullPicName(); // only for presentation merge shapes !!
odf_ref = odf_context()->add_image(pathImage);
}
else if (buBlip.blip.link.IsInit())
{
pathImage = buBlip.blip.link->get();
odf_ref = buBlip.blip.link->get();
bEmbedded = false;
}
std::wstring odf_ref = odf_context()->add_image(pathImage);
odf_context()->styles_context()->lists_styles().start_style_level(level, odf_list_type );
odf_context()->styles_context()->lists_styles().set_bullet_image(odf_ref);
if (!odf_ref.empty())
{
odf_list_type = 1000;
odf_context()->styles_context()->lists_styles().start_style_level(level, odf_list_type );
odf_context()->styles_context()->lists_styles().set_bullet_image(odf_ref);
}
else
{
odf_list_type = 5;
odf_context()->styles_context()->lists_styles().start_style_level(level, odf_list_type );
odf_context()->styles_context()->lists_styles().set_bullet_char(L"\x2022");
}
}
//odf_writer::style_list_level_label_alignment * aligment_props = odf_context()->styles_context()->lists_styles().get_list_level_alignment_properties();
@ -1181,7 +1220,7 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
convert(oox_para_props->defRPr.GetPointer(), text_properties);
if (oox_para_props->indent.IsInit())
if (oox_para_props->indent.IsInit() && level_props)
{
level_props->text_min_label_width_ = odf_types::length(- oox_para_props->indent.get() / 12700., odf_types::length::pt);
level_props->text_space_before_ = odf_types::length(1, odf_types::length::pt);
@ -1208,7 +1247,7 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
{
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
text_properties->content_.fo_color_ = odf_types::color(hexColor);
if (text_properties) text_properties->content_.fo_color_ = odf_types::color(hexColor);
}
}
//-----------------------------------
@ -1289,18 +1328,6 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
odf_context()->styles_context()->lists_styles().end_style_level();
}
void OoxConverter::convert_list (PPTX::Logic::TextListStyle *oox_list_style)
{
if (!oox_list_style) return;
odf_context()->styles_context()->lists_styles().start_style();
for (int i = 0; i < 9; i++)
{
convert_list_level(oox_list_style->levels[0].GetPointer(), i);
}
odf_context()->styles_context()->lists_styles().end_style();
}
void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::TextListStyle *oox_list_style)
{
if (!oox_paragraph)return;
@ -1311,7 +1338,7 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
bool list_present = false;
std::wstring list_style_name;
int list_level = 0;
int list_level = 0;//-1;
NSCommon::nullable<PPTX::Logic::TextParagraphPr> paraPr;
@ -1323,10 +1350,12 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
list_local = true;
}
if (oox_list_style && list_level >= 0 && list_level < 10)
if (oox_list_style)
{
if (oox_list_style->levels[list_level].IsInit())
oox_list_style->levels[list_level]->Merge(paraPr);
int i = (list_level >= 0 && list_level < 10) ? list_level : 0;
if (oox_list_style->levels[i].IsInit())
oox_list_style->levels[i]->Merge(paraPr);
}
if (oox_paragraph->pPr.IsInit())
oox_paragraph->pPr->Merge(paraPr);
@ -1341,7 +1370,6 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
list_present = true;
if (paraPr->ParagraphBullet.is<PPTX::Logic::BuNone>())
list_present = false;
else if (list_level == 0) list_level = 1;
}
//свойства могут быть приписаны не только к параграфу, но и к самому объекту
odf_writer::style_paragraph_properties* paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
@ -1377,33 +1405,32 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
odf_context()->text_context()->list_state_.style_name = L"";
}
if (odf_context()->text_context()->list_state_.started_list == false)
if (list_local)
{
if (list_local)
_CP_OPT(bool) inStyles = odf_context()->drawing_context()->get_presentation();
odf_context()->styles_context()->lists_styles().start_style(inStyles && *inStyles);
convert_list_level(oox_paragraph->pPr.GetPointer(), list_level /*- 1*/);
odf_context()->styles_context()->lists_styles().end_style();
}
list_style_name = odf_context()->styles_context()->lists_styles().get_style_name(); //last added
list_level++;
if (odf_context()->text_context()->list_state_.levels.size() < list_level)
{
while (odf_context()->text_context()->list_state_.levels.size() < list_level)
{
odf_context()->styles_context()->lists_styles().start_style();
convert_list_level(oox_paragraph->pPr.GetPointer(), list_level - 1);
odf_context()->styles_context()->lists_styles().end_style();
list_style_name = odf_context()->styles_context()->lists_styles().get_style_name(); //last added
odf_context()->text_context()->start_list(list_style_name);
odf_context()->text_context()->start_list_item();
if (odf_context()->text_context()->list_state_.style_name == list_style_name)
list_style_name = L"";
}
else
{
// !!!
}
odf_context()->text_context()->start_list(list_style_name);
}
odf_context()->text_context()->start_list_item();
if (odf_context()->text_context()->list_state_.style_name == list_style_name)
list_style_name = L"";
while (odf_context()->text_context()->list_state_.levels.size() < list_level)
{
odf_context()->text_context()->start_list(list_style_name);
else
odf_context()->text_context()->start_list_item();
}
}
else if (odf_context()->text_context()->list_state_.started_list == true)
{
@ -1417,10 +1444,10 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
}
odf_context()->text_context()->end_paragraph();
if(list_present)
{
odf_context()->text_context()->end_list_item();
}
//if(list_present)
//{
// odf_context()->text_context()->end_list_item();
//}
}
void OoxConverter::convert(PPTX::Logic::TextListStyle *oox_list_style, int level, odf_writer::style_paragraph_properties * paragraph_properties
, odf_writer::style_text_properties * text_properties)
@ -1732,6 +1759,45 @@ void OoxConverter::convert(PPTX::Logic::Run *oox_run)
void OoxConverter::convert(PPTX::Logic::Fld *oox_fld)
{
if (!oox_fld) return;
bool styled = false;
if (oox_fld->rPr.IsInit())
{
odf_writer::style_text_properties * text_properties = odf_context()->text_context()->get_text_properties();
if (!text_properties)
{
odf_context()->styles_context()->create_style(L"", odf_types::style_family::Text, true, false, -1);
text_properties = odf_context()->styles_context()->last_state()->get_text_properties();
styled = true;
}
convert(oox_fld->rPr.GetPointer(), text_properties);
}
odf_context()->text_context()->start_span(styled);
std::wstring fld_type = oox_fld->type.get_value_or(L"");
if ((oox_fld->rPr.IsInit()) && (oox_fld->rPr->hlinkClick.IsInit()) && (oox_fld->rPr->hlinkClick->id.IsInit()))
{
std::wstring hlink = find_link_by_id(oox_fld->rPr->hlinkClick->id.get(), 2);
odf_context()->text_context()->add_hyperlink(hlink, oox_fld->GetText());
}
else if (fld_type == L"slidenum")
{
odf_context()->text_context()->add_text_page_number( oox_fld->GetText());
}
else if (fld_type == L"datetime1")
{
odf_context()->text_context()->add_text_date( oox_fld->GetText());
}
else
{
odf_context()->text_context()->add_text_content( oox_fld->GetText());
}
odf_context()->text_context()->end_span();
}
void OoxConverter::convert(PPTX::Logic::Br *oox_br)
{
@ -1758,7 +1824,20 @@ void OoxConverter::convert(PPTX::Logic::MoveTo *oox_geom_path)
odf_context()->drawing_context()->add_path_element(std::wstring(L"M"), path_elm);
}
void OoxConverter::convert(PPTX::Logic::TextListStyle *oox_list_style)
{
if (!oox_list_style) return;
if (oox_list_style->IsListStyleEmpty()) return;
_CP_OPT(bool) inStyles = odf_context()->drawing_context()->get_presentation();
odf_context()->styles_context()->lists_styles().start_style(inStyles && *inStyles);
for (int i = 0; i < 9; i++)
{
OoxConverter::convert_list_level(oox_list_style->levels[i].GetPointer(), i);
}
odf_context()->styles_context()->lists_styles().end_style();
}
void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeStyle* oox_style)
{
if (!oox_txBody) return;
@ -1766,6 +1845,8 @@ void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeSt
odf_context()->start_text_context();
convert(oox_txBody->lstStyle.GetPointer());
for (size_t i = 0; i < oox_txBody->Paragrs.size(); i++)
{
convert(&oox_txBody->Paragrs[i], oox_txBody->lstStyle.GetPointer());

View File

@ -70,7 +70,7 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
}
//m_oPreferRelative//типо можно менять размер
for (unsigned int i=0 ; i < vml_shape_type->m_arrItems.size();i++)
for (size_t i = 0; i < vml_shape_type->m_arrItems.size(); i++)
{
convert(vml_shape_type->m_arrItems[i]);
}
@ -86,6 +86,18 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
//m_arrItems
//CVmlCommonElements
}
void OoxConverter::convert(OOX::Vml::CFormulas *vml_formulas)
{
if (vml_formulas == NULL) return;
for (size_t i = 0; i < vml_formulas->m_arrItems.size(); i++)
{
OOX::Vml::CF *cf = dynamic_cast<OOX::Vml::CF *>(vml_formulas->m_arrItems[i]);
if (cf == NULL) continue;
//odf_context()->drawing_context()->add_formula(L"", cf->m_sEqn);
}
}
void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
{
@ -95,7 +107,7 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
_CP_OPT(int) anchor_type_x, anchor_type_y;
for (unsigned int i=0; i < vml_style->m_arrProperties.size(); i++)
for (size_t i = 0; i < vml_style->m_arrProperties.size(); i++)
{
if (vml_style->m_arrProperties[i] == NULL) continue;
@ -693,17 +705,18 @@ void OoxConverter::convert(OOX::Vml::CTextbox *vml_textbox)
odf_context()->drawing_context()->set_textarea_wrap(true);
DocxConverter *docx_converter = dynamic_cast<DocxConverter*>(this);
odf_context()->start_text_context();
if (docx_converter)
{
for (unsigned int i=0 ; i < vml_textbox->m_oTxtbxContent->m_arrItems.size();i++)
odf_context()->start_text_context();
{
if (docx_converter)
for (size_t i = 0; i < vml_textbox->m_oTxtbxContent->m_arrItems.size(); i++)
{
docx_converter->convert(vml_textbox->m_oTxtbxContent->m_arrItems[i]);
}
odf_context()->drawing_context()->set_text( odf_context()->text_context());
}
odf_context()->drawing_context()->set_text( odf_context()->text_context());
odf_context()->end_text_context();
}
odf_context()->end_text_context();
}
void OoxConverter::convert(OOX::Vml::CTextPath *vml_textpath)
@ -869,7 +882,7 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
delete oRgbColor;
}
}
for (unsigned int i=0 ; i < vml_common->m_arrItems.size();i++)
for (size_t i = 0; i < vml_common->m_arrItems.size(); i++)
{
convert(vml_common->m_arrItems[i]);
}
@ -899,7 +912,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
odf_context()->drawing_context()->set_group_shift(vml_group->m_oCoordOrigin->GetX(), vml_group->m_oCoordOrigin->GetY());
}
for (unsigned int i=0; i < vml_group->m_arrItems.size(); i++)
for (size_t i = 0; i < vml_group->m_arrItems.size(); i++)
{
if (vml_group->m_arrItems[i] == NULL) continue;

View File

@ -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);
}
@ -143,18 +145,15 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
{
case OOX::et_graphicFrame:
{
PPTX::Logic::GraphicFrame* pGraphicFrame= dynamic_cast<PPTX::Logic::GraphicFrame*>(oox_unknown);
convert(pGraphicFrame);
convert(dynamic_cast<PPTX::Logic::GraphicFrame*>(oox_unknown));
}break;
case OOX::et_pic:
{
PPTX::Logic::Pic* pPic= dynamic_cast<PPTX::Logic::Pic*>(oox_unknown);
convert(pPic);
convert(dynamic_cast<PPTX::Logic::Pic*>(oox_unknown));
}break;
case OOX::et_dgm_DiagrammParts:
{
PPTX::Logic::SmartArt* pDiagrammParts = dynamic_cast<PPTX::Logic::SmartArt*>(oox_unknown);
convert(pDiagrammParts);
convert(dynamic_cast<PPTX::Logic::SmartArt*>(oox_unknown));
}break;
case OOX::et_a_Shape:
case OOX::et_p_Shape:
@ -266,18 +265,19 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
}break;
case OOX::et_v_fill:
{
OOX::Vml::CFill *vml = dynamic_cast<OOX::Vml::CFill*>(oox_unknown);
convert(vml);
convert(dynamic_cast<OOX::Vml::CFill*>(oox_unknown));
}break;
case OOX::et_v_stroke:
{
OOX::Vml::CStroke *vml = dynamic_cast<OOX::Vml::CStroke*>(oox_unknown);
convert(vml);
convert(dynamic_cast<OOX::Vml::CStroke*>(oox_unknown));
}break;
case OOX::et_v_formulas:
{
convert(dynamic_cast<OOX::Vml::CFormulas*>(oox_unknown));
}break;
case OOX::et_v_shadow:
{
OOX::Vml::CShadow *vml = dynamic_cast<OOX::Vml::CShadow*>(oox_unknown);
convert(vml);
convert(dynamic_cast<OOX::Vml::CShadow*>(oox_unknown));
}break;
case OOX::et_v_image:
{

View File

@ -245,6 +245,7 @@ namespace OOX
class CTextPath;
class CGroup;
class CVmlCommonElements;
class CFormulas;
}
namespace VmlWord
{
@ -354,10 +355,11 @@ public:
double getSystemDPI();
//.......................................................................................................................
virtual OOX::IFileContainer *current_document() = 0;
virtual cpdoccore::odf_writer::odf_conversion_context *odf_context() = 0;
virtual PPTX::Theme *oox_theme() = 0;
virtual PPTX::Logic::ClrMap *oox_clrMap() {return NULL;}
virtual std::wstring find_link_by_id(std::wstring sId, int t) = 0;
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId) = 0;
@ -405,9 +407,9 @@ public:
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);
void convert_list_level (PPTX::Logic::TextParagraphPr *oox_para_props, int level);
void convert_list (PPTX::Logic::TextListStyle *oox_list_style);
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);
@ -510,6 +512,7 @@ public:
void convert(OOX::VmlWord::CWrap *vml_wrap);
void convert(OOX::Vml::CGroup *vml_group);
void convert(OOX::Vml::CVmlCommonElements *vml_attr);
void convert(OOX::Vml::CFormulas *vml_formulas);
};
} // namespace Oox2Odf

View File

@ -103,7 +103,16 @@ PPTX::Theme* DocxConverter::oox_theme()
else
return NULL;
}
OOX::IFileContainer* DocxConverter::current_document()
{
if (oox_current_child_document)
return oox_current_child_document;
else
{
OOX::CDocument *oox_doc = docx_document->GetDocument();
return dynamic_cast<OOX::IFileContainer*>(oox_doc);
}
}
NSCommon::smart_ptr<OOX::File> DocxConverter::find_file_by_id(std::wstring sId)
{
OOX::CDocument *oox_doc = docx_document->GetDocument();
@ -317,16 +326,16 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
// OOX::Logic::CShape* pShape = dynamic_cast<OOX::Logic::CShape*>(oox_unknown);
// convert(pShape);
//}break;
//case OOX::et_w_pict:
//{
// OOX::Logic::CPicture* pPic = dynamic_cast<OOX::Logic::CPicture*>(oox_unknown);
// convert(pPic);
//}break;
//case OOX::et_w_object:
//{
// OOX::Logic::CObject* pObj = dynamic_cast<OOX::Logic::CObject*>(oox_unknown);
// convert(pObj);
//}break;
case OOX::et_w_pict:
{
OOX::Logic::CPicture* pPic = dynamic_cast<OOX::Logic::CPicture*>(oox_unknown);
convert(pPic);
}break;
case OOX::et_w_object:
{
OOX::Logic::CObject* pObj = dynamic_cast<OOX::Logic::CObject*>(oox_unknown);
convert(pObj);
}break;
case OOX::et_pic_pic:
case OOX::et_pic:
case OOX::et_p_pic:
@ -353,23 +362,27 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
}break;
case OOX::et_w_commentReference:
{
OOX::Logic::CCommentReference* pCommRef = dynamic_cast<OOX::Logic::CCommentReference*>(oox_unknown);
convert(pCommRef); //если нет Start - означает начало с предыдущего Run
convert(dynamic_cast<OOX::Logic::CCommentReference*>(oox_unknown)); //если нет Start - означает начало с предыдущего Run
}break;
case OOX::et_w_footnoteReference:
{
OOX::Logic::CFootnoteReference* pRef= dynamic_cast<OOX::Logic::CFootnoteReference*>(oox_unknown);
convert(pRef);
convert(dynamic_cast<OOX::Logic::CFootnoteReference*>(oox_unknown));
}break;
case OOX::et_w_endnoteReference:
{
OOX::Logic::CEndnoteReference* pRef= dynamic_cast<OOX::Logic::CEndnoteReference*>(oox_unknown);
convert(pRef);
convert(dynamic_cast<OOX::Logic::CEndnoteReference*>(oox_unknown));
}break;
case OOX::et_w_endnoteRef:
{
//add ref ??? todoooo
}break;
case OOX::et_w_footnoteRef:
{
//add ref
}break;
case OOX::et_w_tbl:
{
OOX::Logic::CTbl* pTable= dynamic_cast<OOX::Logic::CTbl*>(oox_unknown);
convert(pTable);
convert(dynamic_cast<OOX::Logic::CTbl*>(oox_unknown));
}break;
case OOX::et_w_tr:
{
@ -381,6 +394,12 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Logic::CTc* pCell= dynamic_cast<OOX::Logic::CTc*>(oox_unknown);
convert(pCell);
}break;
case OOX::et_w_bookmarkStart:
{
}break;
case OOX::et_w_bookmarkEnd:
{
}break;
default:
{
OoxConverter::convert(oox_unknown);
@ -394,12 +413,15 @@ void DocxConverter::convert(OOX::Logic::CSdt *oox_sdt)
//nullable<OOX::Logic::CSdtEndPr > m_oSdtEndPr;
//nullable<OOX::Logic::CSdtPr > m_oSdtPr;
if (oox_sdt->m_oSdtContent.IsInit())
convert(oox_sdt->m_oSdtContent.GetPointer());
}
void DocxConverter::convert(OOX::Logic::CSdtContent *oox_sdt)
{
if (oox_sdt == NULL) return;
for (size_t i = 0; i < oox_sdt->m_arrItems.size(); i++)
{
for (unsigned int i=0; i< oox_sdt->m_oSdtContent->m_arrItems.size(); i++)
{
convert(oox_sdt->m_oSdtContent->m_arrItems[i]);
}
convert(oox_sdt->m_arrItems[i]);
}
}
void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
@ -1271,6 +1293,15 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
}
if (odt_context->notes_context()->is_started())
{
paragraph_properties->content_.fo_margin_left_ = odf_types::length( 0.5, odf_types::length::cm);
paragraph_properties->content_.fo_text_indent_ = odf_types::length(-0.5, odf_types::length::cm);
paragraph_properties->content_.fo_line_height_ = odf_types::percent(100.);
paragraph_properties->content_.style_auto_text_indent_ = false;
//loext:contextual-spacing="false"
}
if (oox_paragraph_pr->m_oTabs.IsInit())
{
paragraph_properties->add_child_element(odf_context()->start_tabs());
@ -2692,9 +2723,12 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor)
int id = oox_anchor->m_oRelativeHeight->GetValue();
odf_context()->drawing_context()->set_z_order(id);
}
OoxConverter::convert(oox_anchor->m_oDocPr.GetPointer());
convert(&oox_anchor->m_oGraphic);
odf_context()->drawing_context()->start_drawing();
OoxConverter::convert(&oox_anchor->m_oGraphic);
odf_context()->drawing_context()->end_drawing();
odf_context()->drawing_context()->check_anchor();
}
@ -2724,9 +2758,12 @@ void DocxConverter::convert(OOX::Drawing::CInline *oox_inline)
odt_context->drawing_context()->set_vertical_rel(2);//line
odt_context->drawing_context()->set_vertical_pos(1);//middle
OoxConverter::convert(oox_inline->m_oDocPr.GetPointer());
convert(&oox_inline->m_oGraphic);
odf_context()->drawing_context()->start_drawing();
OoxConverter::convert(&oox_inline->m_oGraphic);
odf_context()->drawing_context()->end_drawing();
}
void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
@ -2781,11 +2818,19 @@ void DocxConverter::convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types
if (!color)return;
convert(color->m_oVal.GetPointer(), color->m_oThemeColor.GetPointer(),color->m_oThemeTint.GetPointer(),color->m_oThemeShade.GetPointer(), odf_color);
}
PPTX::Logic::ClrMap* DocxConverter::oox_clrMap()
{
//return current_clrMap; todoooo
OOX::CSettings * docx_settings = docx_document->GetSettings();
if (!docx_settings) return NULL;
return docx_settings->m_oClrSchemeMapping.GetPointer();
}
void DocxConverter::convert_settings()
{
if (!odt_context) return;
OOX::CSettings * docx_settings = docx_document->GetSettings();
OOX::CSettings * docx_settings = docx_document->GetSettings();
if (!docx_settings) return;
if (docx_settings->m_oZoom.IsInit())
@ -3017,7 +3062,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(true, oox_num_style->m_oAbstractNumId->GetValue());
//// Childs
//std::vector<OOX::Numbering::CLvl > m_arrLvl;
//nullable<ComplexTypes::Word::CMultiLevelType > m_oMultiLevelType;

View File

@ -95,6 +95,7 @@ namespace OOX
class CTcBorders;
class CTblBorders;
class CSdt;
class CSdtContent;
class CBackground;
class CLockedCanvas;
@ -146,12 +147,15 @@ namespace Oox2Odf
virtual void convertDocument();
virtual void write(const std::wstring & path);
virtual OOX::IFileContainer *current_document();
virtual odf_writer::odf_conversion_context *odf_context();
virtual PPTX::Theme *oox_theme();
virtual PPTX::Logic::ClrMap *oox_clrMap();
virtual std::wstring find_link_by_id (std::wstring sId, int t);
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId);
void convert(OOX::WritingElement *oox_unknown);
void convert(OOX::WritingElement *oox_unknown);
void convert(OOX::Logic::CSdtContent *oox_sdt);
private:
struct _section
{
@ -220,7 +224,7 @@ namespace Oox2Odf
void convert(OOX::Drawing::CAnchor *oox_anchor);
void convert(OOX::Drawing::CInline *oox_inline);
void convert(SimpleTypes::CTheme<> *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name);
void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types::color) & odf_color);
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf_types::length) & odf_size);

View File

@ -60,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 ???
@ -82,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()
@ -123,7 +127,15 @@ PPTX::Logic::ClrMap* PptxConverter::oox_clrMap()
{
return current_clrMap;
}
OOX::IFileContainer* PptxConverter::current_document()
{
if (oox_current_child_document)
return oox_current_child_document;
else if (current_slide)
return current_slide;
else
return pptx_document;
}
NSCommon::smart_ptr<OOX::File> PptxConverter::find_file_by_id(std::wstring sId)
{
smart_ptr<OOX::File> oFile;
@ -259,6 +271,8 @@ void PptxConverter::convert_styles()
odp_context->page_layout_context()->create_layer_sets();
}
void PptxConverter::convert_settings()
{
@ -317,12 +331,15 @@ void PptxConverter::convert_slides()
if (pFind == m_mapMasters.end())
{
master_style_name = L"MasterPage";
if (bShowMasterSp)
{
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();
}
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
@ -332,15 +349,18 @@ void PptxConverter::convert_slides()
convert_common();
current_slide = slide->Master.operator->();
if (bShowMasterSp)
convert_slide(&slide->Master->cSld, current_txStyles, false);
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, current_txStyles, true);
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp);
//add note master
odp_context->end_master_slide();
m_mapMasters.insert(std::make_pair(master_name, master_style_name));
@ -379,7 +399,7 @@ void PptxConverter::convert_slides()
odp_context->current_slide().set_master_page (master_style_name);
odp_context->current_slide().set_layout_page (layout_style_name);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp);
convert (slide->comments.operator->());
convert (slide->Note.operator->());
@ -935,7 +955,7 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
odp_context->end_drawings();
}
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders)
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp)
{
if (oox_slide == NULL) return;
@ -946,63 +966,90 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
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++)
{
smart_ptr<PPTX::WrapperWritingElement> pElem = oox_slide->spTree.SpTreeElems[i].GetElem();
smart_ptr<PPTX::Logic::Shape> pShape = pElem.smart_dynamic_cast<PPTX::Logic::Shape>();
if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init())
odf_context()->drawing_context()->start_drawing();
if (pShape.IsInit())
{
pShape->FillLevelUp();
if (!bPlaceholders)
continue;
PPTX::Logic::TextListStyle * listMasterStyle = NULL;
if (txStyles)
if (pShape->nvSpPr.nvPr.ph.is_init())
{
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();
if (bFillUp)
pShape->FillLevelUp();
PPTX::Logic::TextListStyle *newListStyle = new PPTX::Logic::TextListStyle();
for (int i = 0; i < 10; i++)
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
{
if(listMasterStyle->levels[i].is_init())
listMasterStyle->levels[i]->Merge(newListStyle->levels[i]);
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
//if (!bMaster && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
// continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type);
}
update_shape.txBody->lstStyle.reset(newListStyle);
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);
}
pShape->Merge(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();
//if (pShape->IsListStyleEmpty() == false)
//{
// //create list style
//}else if (listMasterStyle)
//{
//}
presentation->defaultTextStyle->Merge(update_shape.txBody->lstStyle);
OoxConverter::convert(&update_shape);
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->());
odf_context()->drawing_context()->end_drawing();
}
convert(oox_slide->controls.GetPointer());
}
@ -1030,7 +1077,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();

View File

@ -97,16 +97,17 @@ namespace Oox2Odf
virtual void convertDocument();
virtual void write(const std::wstring & path);
virtual OOX::IFileContainer *current_document();
virtual odf_writer::odf_conversion_context *odf_context();
virtual PPTX::Theme *oox_theme();
virtual PPTX::Logic::ClrMap *oox_clrMap();
virtual std::wstring find_link_by_id (std::wstring sId, int t);
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id (std::wstring sId);
void convert(OOX::WritingElement *oox_unknown);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders = true);
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);

View File

@ -94,6 +94,15 @@ PPTX::Theme* XlsxConverter::oox_theme()
else
return NULL;
}
OOX::IFileContainer* XlsxConverter::current_document()
{
if (xlsx_current_container)
return xlsx_current_container;
else if (oox_current_child_document)
return oox_current_child_document;
else
return NULL;
}
smart_ptr<OOX::File> XlsxConverter::find_file_by_id(std::wstring sId)
{
smart_ptr<OOX::File> oFile;
@ -1718,7 +1727,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
if (oox_anchor->m_oExt.IsInit())
{
}
OoxConverter::convert(oox_anchor->m_oElement.GetPointer());
odf_context()->drawing_context()->start_drawing();
OoxConverter::convert(oox_anchor->m_oElement.GetPointer());
odf_context()->drawing_context()->end_drawing();
}
void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)

View File

@ -130,6 +130,7 @@ namespace Oox2Odf
virtual void convertDocument();
virtual void write(const std::wstring & path);
virtual OOX::IFileContainer *current_document();
virtual odf_writer::odf_conversion_context *odf_context();
virtual PPTX::Theme *oox_theme();
virtual std::wstring find_link_by_id (std::wstring sId, int t);

View File

@ -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"

View File

@ -4309,7 +4309,8 @@ HRESULT CDrawingConverter::LoadClrMap(const std::wstring& bsXml)
if (oNode.IsValid())
{
pClrMap->fromXMLW(oNode.ReadNode(L"w:clrSchemeMapping"));
XmlUtils::CXmlNode nodeMap = oNode.ReadNode(L"w:clrSchemeMapping");
pClrMap->fromXML(nodeMap);
}
*m_pClrMap = pClrMap;

View File

@ -95,7 +95,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dx"), x)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dy"), y)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dz"), z)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -63,7 +63,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_if ( oReader, _T("w"), w)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("h"), h)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("prst"), prst)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -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");
}
@ -228,4 +236,4 @@ namespace PPTX
} // namespace Logic
} // namespace PPTX
#endif // PPTX_LOGIC_CNVGRAPHICFRAMESPPR_INCLUDE_H
#endif // PPTX_LOGIC_CNVGRAPHICFRAMESPPR_INCLUDE_H

View File

@ -78,7 +78,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_if ( oReader, _T("prst"), prst)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("fov"), fov)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("zoom"), zoom)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -88,7 +88,7 @@ namespace PPTX
Limit::ColorSchemeIndex lColorIndex_folHlink;
Limit::ColorSchemeIndex lColorIndex_hlink;
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("accent1"), lColorIndex_accent1)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("accent2"), lColorIndex_accent2 )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("accent3"), lColorIndex_accent3 )
@ -98,10 +98,15 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("bg1"), lColorIndex_bg1 )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("bg2"), lColorIndex_bg2 )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx1"), lColorIndex_tx1 )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx1"), lColorIndex_tx2 )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx2"), lColorIndex_tx2 )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("folHlink"), lColorIndex_folHlink )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("hlink"), lColorIndex_hlink )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("t1"), lColorIndex_tx1 )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("t2"), lColorIndex_tx2 )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("followedHyperlink"), lColorIndex_folHlink )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("hyperlink"), lColorIndex_hlink )
WritingElement_ReadAttributes_End_No_NS( oReader )
ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex_accent1));
ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex_accent2));
@ -123,6 +128,23 @@ namespace PPTX
ColorMap.clear();
Limit::ColorSchemeIndex lColorIndex;
if (m_name == L"w:clrSchemeMapping")
{
lColorIndex._set(node.GetAttribute(_T("w:accent1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent3"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent3"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent4"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent4"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent5"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent5"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent6"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent6"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:bg1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:bg2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:t1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:t2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:followedHyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("folHlink"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:hyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
}
lColorIndex._set(node.GetAttribute(_T("accent1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex));
@ -138,37 +160,29 @@ namespace PPTX
lColorIndex._set(node.GetAttribute(_T("hlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
}
void fromXMLW(const XmlUtils::CXmlNode& cnode)
{
XmlUtils::CXmlNode& node = const_cast<XmlUtils::CXmlNode&> (cnode);
m_name = node.GetName();
ColorMap.clear();
Limit::ColorSchemeIndex lColorIndex;
lColorIndex._set(node.GetAttribute(_T("w:accent1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent3"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent3"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent4"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent4"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent5"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent5"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:accent6"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent6"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:bg1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:bg2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:t1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:t2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:followedHyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("folHlink"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:hyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
for (std::map<std::wstring, Limit::ColorSchemeIndex>::const_iterator pPair = ColorMap.begin(); pPair != ColorMap.end(); ++pPair)
if (m_name == L"w:clrSchemeMapping")
{
oAttr.Write(pPair->first, pPair->second.get());
for (std::map<std::wstring, Limit::ColorSchemeIndex>::const_iterator pPair = ColorMap.begin(); pPair != ColorMap.end(); ++pPair)
{
std::wstring att_name = L"w:" + pPair->first;
if (pPair->first == L"tx1") att_name = L"w:t1";
else if (pPair->first == L"tx2") att_name = L"w:t2";
else if (pPair->first == L"folHlink") att_name = L"w:followedHyperlink";
else if (pPair->first == L"hlink") att_name = L"w:hyperlink";
oAttr.Write(att_name, pPair->second.get());
}
}
else
{
for (std::map<std::wstring, Limit::ColorSchemeIndex>::const_iterator pPair = ColorMap.begin(); pPair != ColorMap.end(); ++pPair)
{
oAttr.Write(pPair->first, pPair->second.get());
}
}
return XmlUtils::CreateNode(m_name, oAttr);
@ -229,12 +243,9 @@ namespace PPTX
pReader->Seek(_e);
}
public:
std::map<std::wstring, Limit::ColorSchemeIndex> ColorMap;
public:
std::wstring m_name;
std::wstring m_name;
protected:
virtual void FillParentPointersForChilds(){};
};

View File

@ -496,13 +496,13 @@ namespace PPTX
static void HSL2RGB(unsigned char* HSL, unsigned char* RGB)
{
if ( HSL[1] == 0 )
{
RGB[0] = HSL[2];
RGB[1] = HSL[2];
RGB[2] = HSL[2];
}
else
//if ( HSL[1] == 0 )
//{
// RGB[0] = HSL[2];
// RGB[1] = HSL[2];
// RGB[2] = HSL[2];
//}
//else
{
double H = double(HSL[0])/240.0;
double S = double(HSL[1])/240.0;

View File

@ -53,28 +53,36 @@ namespace PPTX
{
name = oReader.GetName();
ReadAttributes( oReader );
if (XmlUtils::GetNameNoNS(name) == _T("alpha"))
{
ReadAttributes2( oReader );
}
else
{
ReadAttributes( oReader );
}
}
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
{
nullable_string sTmp;
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), sTmp)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
if (val.is_init() && sTmp.is_init() && sTmp->find(wchar_t('%')) != -1)
*val = (*val) * 1000;
if (sTmp.is_init())
{
val = sTmp.get();
if (val.is_init() && std::wstring::npos != sTmp->find(L"%"))
{
*val = (*val) * 1000;
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
@ -86,7 +94,7 @@ namespace PPTX
nullable_string sTmp;
node.ReadAttributeBase(L"val", sTmp);
if (val.is_init() && sTmp.is_init() && sTmp->find(wchar_t('%')) != -1)
if (val.is_init() && sTmp.is_init() && std::wstring::npos != sTmp->find(L"%"))
*val = (*val) * 1000;
}
}

View File

@ -71,7 +71,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -60,7 +60,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{

View File

@ -57,7 +57,7 @@ namespace PPTX
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
if (6 == val.length())
{

View File

@ -172,7 +172,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual std::wstring toXML() const

View File

@ -70,7 +70,7 @@ namespace PPTX
WritingElement_ReadAttributes_Start_No_NS ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"name", name)
WritingElement_ReadAttributes_Read_else_if( oReader, L"type", type)
WritingElement_ReadAttributes_End ( oReader )
WritingElement_ReadAttributes_End_No_NS ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node);

View File

@ -67,7 +67,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("thresh"), thresh)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -66,7 +66,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("amt"), amt)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -66,8 +66,8 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -66,7 +66,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("a"), a)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -67,7 +67,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thresh"), thresh)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -81,7 +81,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("blend"), blend)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -69,7 +69,7 @@ namespace PPTX
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("grow"), grow)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -83,7 +83,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("useA"), useA)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)

View File

@ -67,7 +67,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("ref"), ref)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)

View File

@ -83,7 +83,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("blend"), blend)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -79,7 +79,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -70,7 +70,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_if ( oReader, _T("hue"), hue)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sat"), sat)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lum"), lum)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -84,7 +84,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_if ( oReader, _T("blurRad"), blurRad)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -68,7 +68,7 @@ namespace PPTX
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("bright"), bright)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("contrast"), contrast)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -99,7 +99,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), rotWithShape)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sx"), sx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sy"), sy)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -88,7 +88,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_if ( oReader, _T("prst"), prst)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -94,7 +94,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("endA"), endA)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("stPos"), stPos)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("endPos"), endPos)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -68,7 +68,7 @@ namespace PPTX
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("tx"), tx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ty"), ty)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -66,7 +66,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -68,7 +68,7 @@ namespace PPTX
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("amt"), amt)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("hue"), hue)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -77,7 +77,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sy"), sy)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx"), tx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ty"), ty)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -99,10 +99,10 @@ namespace PPTX
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dpi"), dpi)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), rotWithShape )
WritingElement_ReadAttributes_End ( oReader )
WritingElement_ReadAttributes_Start_No_NS (oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dpi"), dpi)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("rotWithShape"), rotWithShape )
WritingElement_ReadAttributes_End_No_NS ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -112,10 +112,10 @@ namespace PPTX
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS ( oReader )
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rotWithShape"), rotWithShape )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("flip"), flip )
WritingElement_ReadAttributes_End ( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -86,9 +86,9 @@ namespace PPTX
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS ( oReader )
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("prst"), prst )
WritingElement_ReadAttributes_End ( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -80,7 +80,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sy"), sy )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx"), tx )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ty"), ty )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -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)
{

View File

@ -80,7 +80,7 @@ namespace PPTX
nullable_int tmp;
WritingElement_ReadAttributes_Start_No_NS ( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("pos"), tmp)
WritingElement_ReadAttributes_End ( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
pos = tmp.get_value_or(0);
}

View File

@ -78,7 +78,7 @@ namespace PPTX
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dir"), dir)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("rig"), rig)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -59,7 +59,7 @@ namespace PPTX
WritingElement_ReadAttributes_Start_No_NS ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("ang"), ang)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("scaled"), scaled)
WritingElement_ReadAttributes_End ( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -62,7 +62,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_if ( oReader, _T("w"), w )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("type"), type )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("len"), len )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -80,9 +80,9 @@ namespace PPTX
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("lim"), lim )
WritingElement_ReadAttributes_End ( oReader )
WritingElement_ReadAttributes_Start_No_NS ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("lim"), lim )
WritingElement_ReadAttributes_End_No_NS ( oReader )
}
virtual void GetJoinFrom(XmlUtils::CXmlNode& element)

View File

@ -129,7 +129,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cap"), cap )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cmpd"), cmpd )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w"), w )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
Normalize();
}

View File

@ -59,7 +59,7 @@ namespace PPTX
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -61,7 +61,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("l"), l )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("r"), r )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("b"), b )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{

View File

@ -62,7 +62,7 @@ namespace PPTX
WritingElement_ReadAttributes_Read_if ( oReader, _T("lat"), lat_)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("lon"), lon_)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("rev"), rev_)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
lat = lat_.get_value_or(0);
lon = lon_.get_value_or(0);

View File

@ -457,13 +457,8 @@ namespace PPTX
if (txBody.IsInit() == false) return true;
if (txBody->lstStyle.IsInit() == false) return true;
for (int i = 0; i < 10; i++)
{
if (txBody->lstStyle->levels[i].IsInit())
return false;
}
return true;
return txBody->lstStyle->IsListStyleEmpty();
}
void Shape::Merge(Shape& shape, bool bIsSlidePlaceholder)

View File

@ -48,17 +48,15 @@ namespace PPTX
{
namespace Logic
{
void SmartArt::LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter)
bool SmartArt::LoadDrawing(OOX::IFileContainer* pRels)
{
if (m_diag.IsInit())
return ;
return true;
OOX::IFileContainer* pRels = NULL;
if (pWriter)
{
if (pWriter->m_pCurrentContainer->is_init())
pRels = pWriter->m_pCurrentContainer->operator ->();
}
if(id_data.IsInit() == false) return false;
if (pRels == NULL) return false;
bool result = false;
smart_ptr<OOX::File> oFileData;
smart_ptr<OOX::File> oFileDrawing;
@ -67,15 +65,12 @@ namespace PPTX
OOX::CDiagramData* pDiagramData = NULL;
OOX::CDiagramDrawing* pDiagramDrawing = NULL;
if(id_data.IsInit())
{
if (parentFileIs<OOX::IFileContainer>()) oFileData = parentFileAs<OOX::IFileContainer>().Find(*id_data);
else if (pRels != NULL) oFileData = pRels->Find(*id_data);
}
oFileData = pRels->Find(*id_data);
if (oFileData.IsInit())
{
pDiagramData = dynamic_cast<OOX::CDiagramData*>(oFileData.operator->());
if (pDiagramData) result = true; // это smart art ..есть у него drawing или нет - неважно
if ((pDiagramData) && (pDiagramData->m_oExtLst.IsInit()))
{
@ -131,6 +126,25 @@ namespace PPTX
{
//parse pDiagramData !!
}
return true;
}
void SmartArt::LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter)
{
if (m_diag.IsInit())
return ;
OOX::IFileContainer & pRelsPPTX = parentFileAs<OOX::IFileContainer>();
OOX::IFileContainer * pRels = NULL;
if (pWriter)
{
if (pWriter->m_pCurrentContainer->is_init())
pRels = pWriter->m_pCurrentContainer->operator ->();
}
bool result = LoadDrawing(&pRelsPPTX);
if (!result)
result = LoadDrawing( pRels );
}
void SmartArt::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{

View File

@ -115,6 +115,7 @@ namespace PPTX
public:
void LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter = NULL);
bool LoadDrawing(OOX::IFileContainer* pRels);
};
class ChartRec : public WrapperWritingElement

View File

@ -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
{

View File

@ -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

View File

@ -26,10 +26,8 @@
17C1FCBE1ACC429D006B99B3 /* EffectProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A443D1AC57B83005A27F7 /* EffectProperties.cpp */; };
17C1FCBF1ACC429D006B99B3 /* EffectLst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A443B1AC57B83005A27F7 /* EffectLst.cpp */; };
17C1FCC11ACC429D006B99B3 /* FileMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A43A31AC57B83005A27F7 /* FileMap.cpp */; };
17C1FCC21ACC429D006B99B3 /* ShapeTextProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44AC1AC57B83005A27F7 /* ShapeTextProperties.cpp */; };
17C1FCC31ACC429D006B99B3 /* TransitionBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A45051AC57B83005A27F7 /* TransitionBase.cpp */; };
17C1FCC51ACC429D006B99B3 /* Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44A71AC57B83005A27F7 /* Shape.cpp */; };
17C1FCC61ACC429D006B99B3 /* ShapeProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44A91AC57B83005A27F7 /* ShapeProperties.cpp */; };
17C1FCC71ACC429D006B99B3 /* BuildNodeBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44DE1AC57B83005A27F7 /* BuildNodeBase.cpp */; };
17C1FCC81ACC429D006B99B3 /* ContentPart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44311AC57B83005A27F7 /* ContentPart.cpp */; };
17C1FCC91ACC429D006B99B3 /* CNvGrpSpPr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44241AC57B83005A27F7 /* CNvGrpSpPr.cpp */; };
@ -306,7 +304,6 @@
17C1FDFE1ACC429D006B99B3 /* XfrmEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A445C1AC57B83005A27F7 /* XfrmEffect.h */; };
17C1FDFF1ACC429D006B99B3 /* ChartBuildType.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A43B51AC57B83005A27F7 /* ChartBuildType.h */; };
17C1FE001ACC429D006B99B3 /* SndAc.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A45011AC57B83005A27F7 /* SndAc.h */; };
17C1FE011ACC429D006B99B3 /* ShapeProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A44AA1AC57B83005A27F7 /* ShapeProperties.h */; };
17C1FE021ACC429D006B99B3 /* AlphaModFix.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A44451AC57B83005A27F7 /* AlphaModFix.h */; };
17C1FE041ACC429D006B99B3 /* Duotone.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A444D1AC57B83005A27F7 /* Duotone.h */; };
17C1FE061ACC429D006B99B3 /* ColorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A442A1AC57B83005A27F7 /* ColorBase.h */; };
@ -396,7 +393,6 @@
17C1FE601ACC429D006B99B3 /* Set.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A44EB1AC57B83005A27F7 /* Set.h */; };
17C1FE611ACC429D006B99B3 /* ShapeStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A44AB1AC57B83005A27F7 /* ShapeStyle.h */; };
17C1FE621ACC429D006B99B3 /* BaseLimit.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A43AE1AC57B83005A27F7 /* BaseLimit.h */; };
17C1FE631ACC429D006B99B3 /* ShapeTextProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A44AD1AC57B83005A27F7 /* ShapeTextProperties.h */; };
17C1FE641ACC429D006B99B3 /* BinReaderWriterDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D91A171AC5A4DF0096D788 /* BinReaderWriterDefines.h */; };
17C1FE651ACC429D006B99B3 /* ClrMapOvr.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A44211AC57B83005A27F7 /* ClrMapOvr.h */; };
17C1FE661ACC429D006B99B3 /* Glow.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A44511AC57B83005A27F7 /* Glow.h */; };
@ -705,11 +701,7 @@
179A44A61AC57B83005A27F7 /* Scene3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scene3d.h; sourceTree = "<group>"; };
179A44A71AC57B83005A27F7 /* Shape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shape.cpp; sourceTree = "<group>"; };
179A44A81AC57B83005A27F7 /* Shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shape.h; sourceTree = "<group>"; };
179A44A91AC57B83005A27F7 /* ShapeProperties.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeProperties.cpp; sourceTree = "<group>"; };
179A44AA1AC57B83005A27F7 /* ShapeProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShapeProperties.h; sourceTree = "<group>"; };
179A44AB1AC57B83005A27F7 /* ShapeStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShapeStyle.h; sourceTree = "<group>"; };
179A44AC1AC57B83005A27F7 /* ShapeTextProperties.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeTextProperties.cpp; sourceTree = "<group>"; };
179A44AD1AC57B83005A27F7 /* ShapeTextProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShapeTextProperties.h; sourceTree = "<group>"; };
179A44AE1AC57B83005A27F7 /* SmartArt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmartArt.cpp; sourceTree = "<group>"; };
179A44AF1AC57B83005A27F7 /* SmartArt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmartArt.h; sourceTree = "<group>"; };
179A44B01AC57B83005A27F7 /* Sp3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sp3d.h; sourceTree = "<group>"; };
@ -1176,11 +1168,7 @@
179A44A61AC57B83005A27F7 /* Scene3d.h */,
179A44A71AC57B83005A27F7 /* Shape.cpp */,
179A44A81AC57B83005A27F7 /* Shape.h */,
179A44A91AC57B83005A27F7 /* ShapeProperties.cpp */,
179A44AA1AC57B83005A27F7 /* ShapeProperties.h */,
179A44AB1AC57B83005A27F7 /* ShapeStyle.h */,
179A44AC1AC57B83005A27F7 /* ShapeTextProperties.cpp */,
179A44AD1AC57B83005A27F7 /* ShapeTextProperties.h */,
179A44AE1AC57B83005A27F7 /* SmartArt.cpp */,
179A44AF1AC57B83005A27F7 /* SmartArt.h */,
179A44B01AC57B83005A27F7 /* Sp3d.h */,
@ -1783,7 +1771,6 @@
17C1FDFE1ACC429D006B99B3 /* XfrmEffect.h in Headers */,
17C1FDFF1ACC429D006B99B3 /* ChartBuildType.h in Headers */,
17C1FE001ACC429D006B99B3 /* SndAc.h in Headers */,
17C1FE011ACC429D006B99B3 /* ShapeProperties.h in Headers */,
17C1FE021ACC429D006B99B3 /* AlphaModFix.h in Headers */,
17C1FE041ACC429D006B99B3 /* Duotone.h in Headers */,
17C1FE061ACC429D006B99B3 /* ColorBase.h in Headers */,
@ -1873,7 +1860,6 @@
17C1FE601ACC429D006B99B3 /* Set.h in Headers */,
17C1FE611ACC429D006B99B3 /* ShapeStyle.h in Headers */,
17C1FE621ACC429D006B99B3 /* BaseLimit.h in Headers */,
17C1FE631ACC429D006B99B3 /* ShapeTextProperties.h in Headers */,
17C1FE641ACC429D006B99B3 /* BinReaderWriterDefines.h in Headers */,
17C1FE651ACC429D006B99B3 /* ClrMapOvr.h in Headers */,
17C1FE661ACC429D006B99B3 /* Glow.h in Headers */,
@ -1981,11 +1967,9 @@
17C1FCBF1ACC429D006B99B3 /* EffectLst.cpp in Sources */,
695BC03A1C070DEF00817D7E /* ASCSVGWriter.cpp in Sources */,
17C1FCC11ACC429D006B99B3 /* FileMap.cpp in Sources */,
17C1FCC21ACC429D006B99B3 /* ShapeTextProperties.cpp in Sources */,
696791821D9E8B81002CA4BA /* MathParaWrapper.cpp in Sources */,
17C1FCC31ACC429D006B99B3 /* TransitionBase.cpp in Sources */,
17C1FCC51ACC429D006B99B3 /* Shape.cpp in Sources */,
17C1FCC61ACC429D006B99B3 /* ShapeProperties.cpp in Sources */,
17C1FCC71ACC429D006B99B3 /* BuildNodeBase.cpp in Sources */,
17C1FCC81ACC429D006B99B3 /* ContentPart.cpp in Sources */,
17C1FCC91ACC429D006B99B3 /* CNvGrpSpPr.cpp in Sources */,

View File

@ -246,4 +246,7 @@ HEADERS += docxformatlib.h \
../Source/XlsxFormat/Worksheets/Sparkline.h \
../Source/XlsxFormat/Ole/OleObjects.h \
../Source/DocxFormat/Diagram/DiagramData.h \
../Source/DocxFormat/Diagram/DiagramDrawing.h
../Source/DocxFormat/Diagram/DiagramDrawing.h \
../Source/XlsxFormat/Pivot/PivotTable.h \
../Source/XlsxFormat/Pivot/PivotCacheDefinition.h \
../Source/XlsxFormat/Pivot/PivotCacheRecords.h

View File

@ -86,7 +86,7 @@ namespace OOX
// Читаем атрибуты
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if( oReader, _T("spid"), m_sSpId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
public:
@ -136,7 +136,7 @@ namespace OOX
// Читаем атрибуты
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if( oReader, _T("relId"), m_oRelId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
public:
@ -181,7 +181,7 @@ namespace OOX
// Читаем атрибуты
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if( oReader, _T("uri"), m_sUri )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
public:

View File

@ -110,9 +110,16 @@ namespace OOX
OOX::CPath oName = pFile->DefaultFileName();
if(false == pFile->m_sOutputFilename.empty())
oName.SetName(pFile->m_sOutputFilename, false);
OOX::CSystemUtility::CreateDirectories( oCurrent / oDefDir );
pFile->write( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
std::map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(pPair->first);
if(m_mNoWriteContainer.end() == itFind)
{
OOX::CSystemUtility::CreateDirectories( oCurrent / oDefDir );
pFile->write( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
}
else if(itFind->second.length() > 0)
{
oDefDir = itFind->second;
}
if(true != pFile->m_bDoNotAddRels)
{
if (oDefDir.GetPath().length() > 0)//todooo перенести в CPath
@ -187,16 +194,23 @@ namespace OOX
mNamepair [oName.m_strFilename] = 1;
else
oName = oName + pNamePair->first;
OOX::CSystemUtility::CreateDirectories( oCurrent / oDefDir );
smart_ptr<OOX::IFileBuilder> pFileBuilder = pFile.smart_dynamic_cast<OOX::IFileBuilder>();
if ( pFileBuilder.is_init() )
std::map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(it->first);
if(m_mNoWriteContainer.end() == itFind)
{
pFileBuilder->Finalize( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
OOX::CSystemUtility::CreateDirectories( oCurrent / oDefDir );
smart_ptr<OOX::IFileBuilder> pFileBuilder = pFile.smart_dynamic_cast<OOX::IFileBuilder>();
if ( pFileBuilder.is_init() )
{
pFileBuilder->Finalize( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
}
else
{
pFile->write( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
}
}
else
else if(itFind->second.length() > 0)
{
pFile->write( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
oDefDir = itFind->second;
}
oRels.Registration( it->first, pFile->type(), oDefDir / oName );
@ -386,6 +400,20 @@ namespace OOX
m_mContainer [rId.get()] = pFile;
}
const RId IFileContainer::AddNoWrite(const smart_ptr<OOX::File>& pFile, const std::wstring& oDefDir)
{
const RId rId = GetMaxRId().next();
AddNoWrite( rId, pFile, oDefDir );
return rId;
}
void IFileContainer::AddNoWrite (const OOX::RId& rId, const smart_ptr<OOX::File>& pFile, const std::wstring& oDefDir)
{
m_lMaxRid = (std::max)( m_lMaxRid, rId.getNumber() );
m_mContainer [rId.get()] = pFile;
m_mNoWriteContainer[rId.get()] = oDefDir;
}
smart_ptr<OOX::File> IFileContainer::Find(const FileType& oType) const
{
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)

View File

@ -67,6 +67,7 @@ namespace OOX
static std::map<std::wstring, size_t> m_mapEnumeratedGlobal;
protected:
std::map<std::wstring, smart_ptr<OOX::File>> m_mContainer;
std::map<std::wstring, std::wstring> m_mNoWriteContainer;
size_t m_lMaxRid;
void Read (const OOX::CRels& oRels, const OOX::CPath& oRootPath, const CPath& oPath);
@ -103,6 +104,8 @@ namespace OOX
const RId Add(smart_ptr<OOX::File>& pFile);
void Add(const OOX::RId& rId, smart_ptr<OOX::File>& pFile);
const RId AddNoWrite(const smart_ptr<OOX::File>& pFile, const std::wstring& oDefDir);
void AddNoWrite(const OOX::RId& rId, const smart_ptr<OOX::File>& pFile, const std::wstring& oDefDir);
template<typename T>
T& Find();

View File

@ -340,7 +340,11 @@ namespace ComplexTypes
}
virtual std::wstring ToString() const
{
std::wstring sResult = _T("w:multiLine=\"") + m_oMultiLine.ToString() + _T("\"");
std::wstring sResult;
if(m_oMultiLine.IsInit())
{
sResult = _T("w:multiLine=\"") + m_oMultiLine->ToString() + _T("\"");
}
return sResult;
}
@ -356,7 +360,7 @@ namespace ComplexTypes
public:
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oMultiLine;
nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse>> m_oMultiLine;
};
} // Word
@ -503,7 +507,7 @@ namespace OOX
WritingElement_ReadNode( oNode, oChild, _T("w:calendar"), m_oCalendar );
WritingElement_ReadNode( oNode, oChild, _T("w:dateFormat"), m_oDateFormat );
WritingElement_ReadNode( oNode, oChild, _T("w:lid"), m_oLid );
WritingElement_ReadNode( oNode, oChild, _T("w:storeMappedDataAs"), m_oStoreMappedDataAs );
WritingElement_ReadNode( oNode, oChild, _T("w:storeMappedDateAs"), m_oStoreMappedDateAs );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
@ -523,8 +527,8 @@ namespace OOX
m_oDateFormat = oReader;
else if ( _T("w:lid") == sName )
m_oLid = oReader;
else if ( _T("w:storeMappedDataAs") == sName )
m_oStoreMappedDataAs = oReader;
else if ( _T("w:storeMappedDateAs") == sName )
m_oStoreMappedDateAs = oReader;
}
}
virtual std::wstring toXML() const
@ -543,7 +547,7 @@ namespace OOX
WritingElement_WriteNode_1( _T("<w:calendar "), m_oCalendar );
WritingElement_WriteNode_1( _T("<w:dateFormat "), m_oDateFormat );
WritingElement_WriteNode_1( _T("<w:lid "), m_oLid );
WritingElement_WriteNode_1( _T("<w:storeMappedDataAs "), m_oStoreMappedDataAs );
WritingElement_WriteNode_1( _T("<w:storeMappedDateAs "), m_oStoreMappedDateAs );
sResult += _T("</w:date>");
@ -573,7 +577,7 @@ namespace OOX
nullable<ComplexTypes::Word::CCalendarType > m_oCalendar;
nullable<ComplexTypes::Word::String > m_oDateFormat;
nullable<ComplexTypes::Word::CLang > m_oLid;
nullable<ComplexTypes::Word::CSdtDateMappingType> m_oStoreMappedDataAs;
nullable<ComplexTypes::Word::CSdtDateMappingType> m_oStoreMappedDateAs;
};
//--------------------------------------------------------------------------------
@ -630,6 +634,18 @@ namespace OOX
return sResult;
}
std::wstring toXML2(const std::wstring& sName) const
{
std::wstring sResult = L"<" + sName + L">";
WritingElement_WriteNode_1( _T("<w:docPartCategory "), m_oDocPartCategory );
WritingElement_WriteNode_1( _T("<w:docPartGallery "), m_oDocPartGallery );
WritingElement_WriteNode_1( _T("<w:docPartUnique "), m_oDocPartUnique );
sResult += L"</" + sName + L">";;
return sResult;
}
virtual EElementType getType() const
{
@ -1013,7 +1029,7 @@ namespace OOX
m_eType = sdttypeBibliography;
else if ( sdttypeUnknown == m_eType && _T("w:citation") == sName )
m_eType = sdttypeCitation;
else if ( sdttypeUnknown == m_eType && _T("w:alias") == sName )
else if ( sdttypeUnknown == m_eType && _T("w:comboBox") == sName )
{
m_oComboBox = oReader;
m_eType = sdttypeComboBox;
@ -1073,7 +1089,7 @@ namespace OOX
}
}
}
virtual std::wstring toXML() const
std::wstring toXMLStart() const
{
std::wstring sResult = _T("<w:sdtPr>");
@ -1093,7 +1109,7 @@ namespace OOX
{
case sdttypeBibliography:
{
sResult += _T("<bibliography/>");
sResult += _T("<w:bibliography/>");
break;
}
case sdttypeCitation:
@ -1118,14 +1134,14 @@ namespace OOX
case sdttypeDocPartList:
{
if ( m_oDocPartList.IsInit() )
sResult += m_oDocPartList->toXML();
sResult += m_oDocPartList->toXML2(L"w:docPartList");
break;
}
case sdttypeDocPartObj:
{
if ( m_oDocPartObj.IsInit() )
sResult += m_oDocPartObj->toXML();
sResult += m_oDocPartObj->toXML2(L"w:docPartObj");
break;
}
@ -1158,21 +1174,27 @@ namespace OOX
}
case sdttypeText:
{
sResult += _T("<w:text ");
if ( m_oText.IsInit() )
{
sResult += _T("<w:text ");
sResult += m_oText->ToString();
sResult += _T("/>");
}
sResult += _T("/>");
break;
}
}
sResult += _T("</w:sdtPr>");
return sResult;
}
std::wstring toXMLEnd() const
{
return _T("</w:sdtPr>");
}
virtual std::wstring toXML() const
{
return toXMLStart() + toXMLEnd();
}
virtual EElementType getType() const
{
return et_w_sdtPr;

View File

@ -580,134 +580,6 @@ namespace OOX
SimpleTypes::CCharacterSpacing<> m_oVal;
};
//--------------------------------------------------------------------------------
// CColorSchemeMapping 17.15.1.20 (Part 1)
//--------------------------------------------------------------------------------
class CColorSchemeMapping : public WritingElement
{
public:
WritingElement_AdditionConstructors(CColorSchemeMapping)
CColorSchemeMapping()
{
}
virtual ~CColorSchemeMapping()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CColorSchemeMapping::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<w:clrSchemeMapping ");
ComplexTypes_WriteAttribute( _T("w:bg1=\""), m_oBg1 );
ComplexTypes_WriteAttribute( _T("w:t1=\""), m_oT1 );
ComplexTypes_WriteAttribute( _T("w:bg2=\""), m_oBg2 );
ComplexTypes_WriteAttribute( _T("w:t2=\""), m_oT2 );
ComplexTypes_WriteAttribute( _T("w:accent1=\""), m_oAccent1 );
ComplexTypes_WriteAttribute( _T("w:accent2=\""), m_oAccent2 );
ComplexTypes_WriteAttribute( _T("w:accent3=\""), m_oAccent3 );
ComplexTypes_WriteAttribute( _T("w:accent4=\""), m_oAccent4 );
ComplexTypes_WriteAttribute( _T("w:accent5=\""), m_oAccent5 );
ComplexTypes_WriteAttribute( _T("w:accent6=\""), m_oAccent6 );
ComplexTypes_WriteAttribute( _T("w:hyperlink=\""), m_oHyperlink );
ComplexTypes_WriteAttribute( _T("w:followedHyperlink=\""), m_oFollowedHyperlink );
sResult += _T("/>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_w_clrSchemeMapping;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
std::wstring wsName = oReader.GetName();
while( !wsName.empty() )
{
wchar_t wsChar0 = wsName[0];
wchar_t wsChar2 = wsName[2]; // w:_
if ( 'w' == wsChar0 )
{
switch ( wsChar2 )
{
case 'a':
if ( _T("w:accent1") == wsName ) m_oAccent1 = oReader.GetText();
else if ( _T("w:accent2") == wsName ) m_oAccent2 = oReader.GetText();
else if ( _T("w:accent3") == wsName ) m_oAccent3 = oReader.GetText();
else if ( _T("w:accent4") == wsName ) m_oAccent4 = oReader.GetText();
else if ( _T("w:accent5") == wsName ) m_oAccent5 = oReader.GetText();
else if ( _T("w:accent6") == wsName ) m_oAccent6 = oReader.GetText();
break;
case 'b':
if ( _T("w:bg1") == wsName ) m_oBg1 = oReader.GetText();
else if ( _T("w:bg2") == wsName ) m_oBg2 = oReader.GetText();
break;
case 'f':
if ( _T("w:followedHyperlink") == wsName ) m_oFollowedHyperlink = oReader.GetText();
break;
case 'h':
if ( _T("w:hyperlink") == wsName ) m_oHyperlink = oReader.GetText();
break;
case 't':
if ( _T("w:t1") == wsName ) m_oT1 = oReader.GetText();
else if ( _T("w:t2") == wsName ) m_oT2 = oReader.GetText();
break;
}
}
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
public:
// Attributes
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oAccent1;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oAccent2;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oAccent3;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oAccent4;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oAccent5;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oAccent6;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oBg1;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oBg2;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oFollowedHyperlink;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oHyperlink;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oT1;
nullable<SimpleTypes::CWmlColorSchemeIndex<>> m_oT2;
};
//--------------------------------------------------------------------------------
// CCompatSetting 17.15.3.4 (Part 1)
//--------------------------------------------------------------------------------
class CCompatSetting : public WritingElement
@ -3225,189 +3097,142 @@ namespace OOX
if ( m_oAlignBordersAndEdges.IsInit() )
sXml += _T("<w:alignBordersAndEdges ") + m_oAlignBordersAndEdges->ToString() + _T("/>");
// 17
if ( m_oBordersDoNotSurroundHeader.IsInit() )
sXml += _T("<w:bordersDoNotSurroundHeader ") + m_oBordersDoNotSurroundHeader->ToString() + _T("/>");
// 18
if ( m_oBordersDoNotSurroundFooter.IsInit() )
sXml += _T("<w:bordersDoNotSurroundFooter ") + m_oBordersDoNotSurroundFooter->ToString() + _T("/>");
// 19
if ( m_oGutterAtTop.IsInit() )
sXml += _T("<w:gutterAtTop ") + m_oGutterAtTop->ToString() + _T("/>");
// 20
if ( m_oHideSpellingErrors.IsInit() )
sXml += _T("<w:hideSpellingErrors ") + m_oHideSpellingErrors->ToString() + _T("/>");
// 21
if ( m_oHideGrammaticalErrors.IsInit() )
sXml += _T("<w:hideGrammaticalErrors ") + m_oHideGrammaticalErrors->ToString() + _T("/>");
// 22
if ( m_oActiveWritingStyle.IsInit() )
sXml += m_oActiveWritingStyle->toXML();
// 23
if ( m_oProofState.IsInit() )
sXml += m_oProofState->toXML();
// 24
if ( m_oFormsDesign.IsInit() )
sXml += _T("<w:formsDesign ") + m_oFormsDesign->ToString() + _T("/>");
// 25
if ( m_oAttachedTemplate.IsInit() )
sXml += _T("<w:attachedTemplate ") + m_oAttachedTemplate->ToString() + _T("/>");
// 26
if ( m_oLinkStyles.IsInit() )
sXml += _T("<w:linkStyles ") + m_oLinkStyles->ToString() + _T("/>");
// 27
if ( m_oStylePaneFormatFilter.IsInit() )
sXml += m_oStylePaneFormatFilter->toXML();
// 28
if ( m_oStylePaneSortMethod.IsInit() )
sXml += m_oStylePaneSortMethod->toXML();
// 29
if ( m_oDocumentType.IsInit() )
sXml += m_oDocumentType->toXML();
// TO DO: Здесь вставить запись w:mailMerge
// 31
if ( m_oRevisionView.IsInit() )
sXml += m_oRevisionView->toXML();
// 32
if ( m_oTrackRevisions.IsInit() )
sXml += _T("<w:trackRevisions ") + m_oTrackRevisions->ToString() + _T("/>");
// 33
if ( m_oDoNotTrackMoves.IsInit() )
sXml += _T("<w:doNotTrackMoves ") + m_oDoNotTrackMoves->ToString() + _T("/>");
// 34
if ( m_oDoNotTrackFormatting.IsInit() )
sXml += _T("<w:doNotTrackFormatting ") + m_oDoNotTrackFormatting->ToString() + _T("/>");
// 35
if ( m_oDocumentProtection.IsInit() )
sXml += m_oDocumentProtection->toXML();
// 36
if ( m_oAutoFormatOverride.IsInit() )
sXml += _T("<w:autoFormatOverride ") + m_oAutoFormatOverride->ToString() + _T("/>");
// 37
if ( m_oStyleLockTheme.IsInit() )
sXml += _T("<w:styleLockTheme ") + m_oStyleLockTheme->ToString() + _T("/>");
// 38
if ( m_oStyleLockQFSet.IsInit() )
sXml += _T("<w:styleLockQFSet ") + m_oStyleLockQFSet->ToString() + _T("/>");
// 39
if ( m_oDefaultTabStop.IsInit() )
sXml += _T("<w:defaultTabStop ") + m_oDefaultTabStop->ToString() + _T("/>");
// 40
if ( m_oAutoHyphenation.IsInit() )
sXml += _T("<w:autoHyphenation ") + m_oAutoHyphenation->ToString() + _T("/>");
// 41
if ( m_oConsecutiveHyphenLimit.IsInit() )
sXml += _T("<w:consecutiveHyphenLimit ") + m_oConsecutiveHyphenLimit->ToString() + _T("/>");
// 42
if ( m_oHyphenationZone.IsInit() )
sXml += _T("<w:hyphenationZone ") + m_oHyphenationZone->ToString() + _T("/>");
// 43
if ( m_oDoNotHyphenateCaps.IsInit() )
sXml += _T("<w:doNotHyphenateCaps ") + m_oDoNotHyphenateCaps->ToString() + _T("/>");
// 44
if ( m_oShowEnvelope.IsInit() )
sXml += _T("<w:showEnvelope ") + m_oShowEnvelope->ToString() + _T("/>");
// 45
if ( m_oSummaryLength.IsInit() )
sXml += _T("<w:summaryLength ") + m_oSummaryLength->ToString() + _T("/>");
// 46
if ( m_oClickAndTypeStyle.IsInit() )
sXml += _T("<w:clickAndTypeStyle ") + m_oClickAndTypeStyle->ToString() + _T("/>");
// 47
if ( m_oDefaultTableStyle.IsInit() )
sXml += _T("<w:defaultTableStyle ") + m_oDefaultTableStyle->ToString() + _T("/>");
// 48
if ( m_oEvenAndOddHeaders.IsInit() )
sXml += _T("<w:evenAndOddHeaders ") + m_oEvenAndOddHeaders->ToString() + _T("/>");
// 49
if ( m_oBookFoldRevPrinting.IsInit() )
sXml += _T("<w:bookFoldRevPrinting ") + m_oBookFoldRevPrinting->ToString() + _T("/>");
// 50
if ( m_oBookFoldPrinting.IsInit() )
sXml += _T("<w:bookFoldPrinting ") + m_oBookFoldPrinting->ToString() + _T("/>");
// 51
if ( m_oBookFoldPrintingSheets.IsInit() )
sXml += _T("<w:bookFoldPrintingSheets ") + m_oBookFoldPrintingSheets->ToString() + _T("/>");
// 52
if ( m_oDrawingGridHorizontalSpacing.IsInit() )
sXml += _T("<w:drawingGridHorizontalSpacing ") + m_oDrawingGridHorizontalSpacing->ToString() + _T("/>");
// 53
if ( m_oDrawingGridVerticalSpacing.IsInit() )
sXml += _T("<w:drawingGridVerticalSpacing ") + m_oDrawingGridVerticalSpacing->ToString() + _T("/>");
// 54
if ( m_oDisplayHorizontalDrawingGridEvery.IsInit() )
sXml += _T("<w:displayHorizontalDrawingGridEvery ") + m_oDisplayHorizontalDrawingGridEvery->ToString() + _T("/>");
// 55
if ( m_oDisplayVerticalDrawingGridEvery.IsInit() )
sXml += _T("<w:displayVerticalDrawingGridEvery ") + m_oDisplayVerticalDrawingGridEvery->ToString() + _T("/>");
// 56
if ( m_oDoNotUseMarginsForDrawingGridOrigin.IsInit() )
sXml += _T("<w:doNotUseMarginsForDrawingGridOrigin ") + m_oDoNotUseMarginsForDrawingGridOrigin->ToString() + _T("/>");
// 57
if ( m_oDrawingGridHorizontalOrigin.IsInit() )
sXml += _T("<w:drawingGridHorizontalOrigin ") + m_oDrawingGridHorizontalOrigin->ToString() + _T("/>");
// 58
if ( m_oDrawingGridVerticalOrigin.IsInit() )
sXml += _T("<w:drawingGridVerticalOrigin ") + m_oDrawingGridVerticalOrigin->ToString() + _T("/>");
// 59
if ( m_oDoNotShadeFormData.IsInit() )
sXml += _T("<w:doNotShadeFormData ") + m_oDoNotShadeFormData->ToString() + _T("/>");
// 60
if ( m_oNoPunctuationKerning.IsInit() )
sXml += _T("<w:noPunctuationKerning ") + m_oNoPunctuationKerning->ToString() + _T("/>");
// 61
if ( m_oCharacterSpacingControl.IsInit() )
sXml += m_oCharacterSpacingControl->toXML();
// 62
if ( m_oPrintTwoOnOne.IsInit() )
sXml += _T("<w:printTwoOnOne ") + m_oPrintTwoOnOne->ToString() + _T("/>");
// 63
if ( m_oStrictFirstAndLastChars.IsInit() )
sXml += _T("<w:strictFirstAndLastChars ") + m_oStrictFirstAndLastChars->ToString() + _T("/>");
@ -3415,138 +3240,105 @@ namespace OOX
if ( m_oNoLineBreaksAfter.IsInit() )
sXml += m_oNoLineBreaksAfter->toXML();
// 65
if ( m_oNoLineBreaksBefore.IsInit() )
sXml += m_oNoLineBreaksBefore->toXML();
// 66
if ( m_oSavePreviewPicture.IsInit() )
sXml += _T("<w:savePreviewPicture ") + m_oSavePreviewPicture->ToString() + _T("/>");
// 67
if ( m_oDoNotValidateAgainstSchema.IsInit() )
sXml += _T("<w:doNotValidateAgainstSchema ") + m_oDoNotValidateAgainstSchema->ToString() + _T("/>");
// 68
if ( m_oSaveInvalidXml.IsInit() )
sXml += _T("<w:saveInvalidXml ") + m_oSaveInvalidXml->ToString() + _T("/>");
// 69
if ( m_oIgnoreMixedContent.IsInit() )
sXml += _T("<w:ignoreMixedContent ") + m_oIgnoreMixedContent->ToString() + _T("/>");
// 70
if ( m_oAlwaysShowPlaceholderText.IsInit() )
sXml += _T("<w:alwaysShowPlaceholderText ") + m_oAlwaysShowPlaceholderText->ToString() + _T("/>");
// 71
if ( m_oDoNotDemarcateInvalidXml.IsInit() )
sXml += _T("<w:doNotDemarcateInvalidXml ") + m_oDoNotDemarcateInvalidXml->ToString() + _T("/>");
// 72
if ( m_oSaveXmlDataOnly.IsInit() )
sXml += _T("<w:saveXmlDataOnly ") + m_oSaveXmlDataOnly->ToString() + _T("/>");
// 73
if ( m_oUseXSLTWhenSaving.IsInit() )
sXml += _T("<w:useXSLTWhenSaving ") + m_oUseXSLTWhenSaving->ToString() + _T("/>");
// 74
if ( m_oSaveThroughtXslt.IsInit() )
sXml += m_oSaveThroughtXslt->toXML();
// 75
if ( m_oShowXMLTags.IsInit() )
sXml += _T("<w:showXMLTags ") + m_oShowXMLTags->ToString() + _T("/>");
// 76
if ( m_oAlwaysMergeEmptyNamespace.IsInit() )
sXml += _T("<w:alwaysMergeEmptyNamespace ") + m_oAlwaysMergeEmptyNamespace->ToString() + _T("/>");
// 77
if ( m_oUpdateFields.IsInit() )
sXml += _T("<w:updateFields ") + m_oUpdateFields->ToString() + _T("/>");
// 78
if ( m_oHdrShapeDefaults.IsInit() )
sXml += m_oHdrShapeDefaults->toXML();
// 79
if ( m_oFootnotePr.IsInit() )
sXml += m_oFootnotePr->toXML();
// 80
if ( m_oEndnotePr.IsInit() )
sXml += m_oEndnotePr->toXML();
// 81
if ( m_oCompat.IsInit() )
sXml += m_oCompat->toXML();
// 82
if ( m_oDocVars.IsInit() )
sXml += m_oDocVars->toXML();
// 83
if ( m_oRsids.IsInit() )
sXml += m_oRsids->toXML();
// 85
if ( m_oMathPr.IsInit() )
sXml += m_oMathPr->toXML();
// 86
if ( m_oAttachedSchema.IsInit() )
sXml += _T("<w:attachedSchema ") + m_oAttachedSchema->ToString() + _T("/>");
// 87
if ( m_oThemeFontLang.IsInit() )
sXml += _T("<w:themeFontLang ") + m_oThemeFontLang->ToString() + _T("/>");
// 88
if ( m_oClrSchemeMapping.IsInit() )
sXml += m_oClrSchemeMapping->toXML();
// 89
if ( m_oDoNotIncludeSubdocsInStats.IsInit() )
sXml += _T("<w:doNotIncludeSubdocsInStats ") + m_oDoNotIncludeSubdocsInStats->ToString() + _T("/>");
// 90
if ( m_oDoNotAutoCompressPictures.IsInit() )
sXml += _T("<w:doNotAutoCompressPictures ") + m_oDoNotAutoCompressPictures->ToString() + _T("/>");
// 91
if ( m_oForceUpgrade.IsInit() )
sXml += _T("<<w:forceUpgrade/>");
// 92
if ( m_oCaptions.IsInit() )
sXml += m_oCaptions->toXML();
// 93
if ( m_oReadModeInkLockDown.IsInit() )
sXml += m_oReadModeInkLockDown->toXML();
// 94
for ( unsigned int nIndex = 0; nIndex < m_arrSmartTagType.size(); nIndex++ )
{
if (m_arrSmartTagType[nIndex])
sXml += m_arrSmartTagType[nIndex]->toXML();
}
// 95
if ( m_oSchemaLibrary.IsInit() )
sXml += m_oSchemaLibrary->toXML();
// 96
if ( m_oShapeDefaults.IsInit() )
sXml += m_oShapeDefaults->toXML();
// 97
if ( m_oDoNotEmbedSmartTags.IsInit() )
sXml += _T("<w:doNotEmbedSmartTags ") + m_oDoNotEmbedSmartTags->ToString() + _T("/>");
// 98
if ( m_oDecimalSymbol.IsInit() )
sXml += _T("<w:decimalSymbol ") + m_oDecimalSymbol->ToString() + _T("/>");
@ -3560,7 +3352,6 @@ namespace OOX
oContent.Registration( type().OverrideType(), oDirectory, oFilePath );
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::Setting;
@ -3574,9 +3365,6 @@ namespace OOX
return type().DefaultFileName();
}
public:
// Childs
nullable<OOX::Settings::CWritingStyle> m_oActiveWritingStyle;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oAlignBordersAndEdges;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oAlwaysMergeEmptyNamespace;
@ -3590,14 +3378,14 @@ namespace OOX
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oBookFoldRevPrinting;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oBordersDoNotSurroundFooter;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oBordersDoNotSurroundHeader;
nullable<OOX::Settings::CCaptions> m_oCaptions;
nullable<OOX::Settings::CCharacterSpacing> m_oCharacterSpacingControl;
nullable<ComplexTypes::Word::String> m_oClickAndTypeStyle;
nullable<OOX::Settings::CColorSchemeMapping> m_oClrSchemeMapping;
nullable<OOX::Settings::CCompat> m_oCompat;
nullable<ComplexTypes::Word::CDecimalNumber> m_oConsecutiveHyphenLimit;
nullable<ComplexTypes::Word::String> m_oDecimalSymbol;
nullable<ComplexTypes::Word::String> m_oDefaultTableStyle;
nullable<OOX::Settings::CCaptions> m_oCaptions;
nullable<OOX::Settings::CCharacterSpacing> m_oCharacterSpacingControl;
nullable<ComplexTypes::Word::String> m_oClickAndTypeStyle;
nullable<PPTX::Logic::ClrMap> m_oClrSchemeMapping;
nullable<OOX::Settings::CCompat> m_oCompat;
nullable<ComplexTypes::Word::CDecimalNumber> m_oConsecutiveHyphenLimit;
nullable<ComplexTypes::Word::String> m_oDecimalSymbol;
nullable<ComplexTypes::Word::String> m_oDefaultTableStyle;
nullable<ComplexTypes::Word::CTwipsMeasure> m_oDefaultTabStop;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oDisplayBackgroundShape;
nullable<ComplexTypes::Word::CDecimalNumber> m_oDisplayHorizontalDrawingGridEvery;
@ -3634,8 +3422,8 @@ namespace OOX
nullable<ComplexTypes::Word::CTwipsMeasure> m_oHyphenationZone;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oIgnoreMixedContent;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oLinkStyles;
nullable<ComplexTypes::Word::String> m_oListSeparator;
// TO DO: Settings::mailMerge
nullable<ComplexTypes::Word::String> m_oListSeparator;
// TO DO: Settings::mailMerge
nullable<OOX::Logic::CMathPr> m_oMathPr;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oMirrorMargins;
nullable<OOX::Settings::CKinsoku> m_oNoLineBreaksAfter;

View File

@ -124,6 +124,13 @@ namespace OOX
}\
Reader.MoveToElement();
#define WritingElement_ReadAttributes_End_No_NS(Reader) \
if ( !Reader.MoveToNextAttribute() ) \
break;\
wsName = XmlUtils::GetNameNoNS(Reader.GetName());\
}\
Reader.MoveToElement();
enum EElementType
{
et_Unknown,

File diff suppressed because it is too large Load Diff

View File

@ -81,6 +81,18 @@ namespace OOX
const FileType ExternalLinks (L"externalLinks", L"externalLink.xml",
_T("application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink"), true, true);
const FileType PivotTable (L"../pivotTables", L"pivotTable.xml",
_T("application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable"), true, true);
const FileType PivotCacheDefinition(L"pivotCache", L"pivotCacheDefinition.xml",
_T("application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition"), true);
const FileType PivotCacheRecords(L"", L"pivotCacheRecords.xml",
_T("application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords"), true, true);
} // namespace FileTypes

View File

@ -0,0 +1,142 @@
/*
* (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
*
*/
#pragma once
#ifndef OOX_PIVOTCACHEDEFINITION_FILE_INCLUDE_H_
#define OOX_PIVOTCACHEDEFINITION_FILE_INCLUDE_H_
#include "../CommonInclude.h"
namespace OOX
{
namespace Spreadsheet
{
class CPivotCacheDefinition : public OOX::File, public OOX::IFileContainer
{
public:
CPivotCacheDefinition()
{
m_bSpreadsheets = true;
bIsWritten = false;
m_pData = NULL;
m_nDataLength = 0;
}
CPivotCacheDefinition(const CPath& oRootPath, const CPath& oPath)
{
m_bSpreadsheets = true;
bIsWritten = false;
m_pData = NULL;
m_nDataLength = 0;
read( oRootPath, oPath );
}
virtual ~CPivotCacheDefinition()
{
ClearItems();
}
public:
virtual void read(const CPath& oPath)
{
}
virtual void read(const CPath& oRootPath, const CPath& oPath)
{
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
if(m_nDataLength > 0 && !bIsWritten)
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(oPath.GetPath());
oFile.WriteFile(m_pData, m_nDataLength);
oFile.CloseFile();
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write( oPath, oDirectory, oContent );
//prevent repeated write
bIsWritten = true;
}
}
virtual const OOX::FileType type() const
{
return OOX::Spreadsheet::FileTypes::PivotCacheDefinition;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
const CPath& GetReadPath()
{
return m_oReadPath;
}
void setData(BYTE* pData, long length, const std::wstring& srIdRecords)
{
if(srIdRecords.length() > 0)
{
const std::string srIdRecordsA( srIdRecords.begin(), srIdRecords.end() );
std::string rIdAttr = " r:id=\""+ srIdRecordsA +"\"";
m_nDataLength = length + rIdAttr.length();
m_pData = new BYTE[m_nDataLength];
long nTreshold = 220;
memcpy(m_pData, pData, nTreshold);
memcpy(m_pData + nTreshold, rIdAttr.c_str(), rIdAttr.length());
memcpy(m_pData + nTreshold + rIdAttr.length(), pData + nTreshold, length - nTreshold);
}
else
{
m_nDataLength = length;
m_pData = new BYTE[m_nDataLength];
memcpy(m_pData, pData, length);
}
}
private:
CPath m_oReadPath;
void ClearItems()
{
m_nDataLength = 0;
RELEASEARRAYOBJECTS(m_pData)
}
public:
mutable bool bIsWritten;
BYTE* m_pData;
long m_nDataLength;
};
} //Spreadsheet
} // namespace OOX
#endif // OOX_PIVOTCACHEDEFINITION_FILE_INCLUDE_H_

View File

@ -0,0 +1,124 @@
/*
* (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
*
*/
#pragma once
#ifndef OOX_PIVOTCACHERECORDS_FILE_INCLUDE_H_
#define OOX_PIVOTCACHERECORDS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
namespace OOX
{
namespace Spreadsheet
{
class CPivotCacheRecords : public OOX::File, public OOX::IFileContainer
{
public:
CPivotCacheRecords()
{
m_bSpreadsheets = true;
m_pData = NULL;
m_nDataLength = 0;
}
CPivotCacheRecords(const CPath& oRootPath, const CPath& oPath)
{
m_bSpreadsheets = true;
m_pData = NULL;
m_nDataLength = 0;
read( oRootPath, oPath );
}
virtual ~CPivotCacheRecords()
{
ClearItems();
}
public:
virtual void read(const CPath& oPath)
{
}
virtual void read(const CPath& oRootPath, const CPath& oPath)
{
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
if(m_nDataLength > 0)
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(oPath.GetPath());
oFile.WriteFile(m_pData, m_nDataLength);
oFile.CloseFile();
oContent.Registration(type().OverrideType(), oDirectory, oPath.GetFilename());
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write( oPath, oDirectory, oContent );
}
}
virtual const OOX::FileType type() const
{
return OOX::Spreadsheet::FileTypes::PivotCacheRecords;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
const CPath& GetReadPath()
{
return m_oReadPath;
}
void setData(BYTE* pData, long length)
{
m_nDataLength = length;
m_pData = new BYTE[length];
memcpy(m_pData, pData, length);
}
private:
CPath m_oReadPath;
void ClearItems()
{
m_nDataLength = 0;
RELEASEARRAYOBJECTS(m_pData)
}
public:
BYTE* m_pData;
long m_nDataLength;
};
} //Spreadsheet
} // namespace OOX
#endif // OOX_PIVOTCACHERECORDS_FILE_INCLUDE_H_

View File

@ -0,0 +1,122 @@
/*
* (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
*
*/
#pragma once
#ifndef OOX_PIVOTTABLE_FILE_INCLUDE_H_
#define OOX_PIVOTTABLE_FILE_INCLUDE_H_
#include "../CommonInclude.h"
namespace OOX
{
namespace Spreadsheet
{
class CPivotTable : public OOX::File, public OOX::IFileContainer
{
public:
CPivotTable()
{
m_bSpreadsheets = true;
m_pData = NULL;
m_nDataLength = 0;
}
CPivotTable(const CPath& oRootPath, const CPath& oPath)
{
m_bSpreadsheets = true;
m_pData = NULL;
m_nDataLength = 0;
read( oRootPath, oPath );
}
virtual ~CPivotTable()
{
ClearItems();
}
public:
virtual void read(const CPath& oPath)
{
}
virtual void read(const CPath& oRootPath, const CPath& oPath)
{
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
if(m_nDataLength > 0)
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(oPath.GetPath());
oFile.WriteFile(m_pData, m_nDataLength);
oFile.CloseFile();
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write( oPath, oDirectory, oContent );
}
}
virtual const OOX::FileType type() const
{
return OOX::Spreadsheet::FileTypes::PivotTable;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
const CPath& GetReadPath()
{
return m_oReadPath;
}
void setData(BYTE* pData, long length)
{
m_nDataLength = length;
m_pData = new BYTE[length];
memcpy(m_pData, pData, length);
}
private:
CPath m_oReadPath;
void ClearItems()
{
m_nDataLength = 0;
RELEASEARRAYOBJECTS(m_pData)
}
public:
BYTE* m_pData;
long m_nDataLength;
};
} //Spreadsheet
} // namespace OOX
#endif // OOX_PIVOTTABLE_FILE_INCLUDE_H_

View File

@ -198,6 +198,7 @@ namespace OOX
WritingStringNullableAttrBool(L"applyBorder", m_oApplyBorder);
WritingStringNullableAttrBool(L"applyAlignment", m_oApplyAlignment);
WritingStringNullableAttrBool(L"quotePrefix", m_oQuotePrefix);
WritingStringNullableAttrBool(L"pivotButton", m_oPivotButton);
if(m_oAligment.IsInit())
{
writer.WriteString(_T(">"));

View File

@ -137,6 +137,8 @@ namespace OOX
m_oDefinedNames->toXML(sXml);
sXml.WriteString(_T("<calcPr calcId=\"145621\"/>"));
if(m_oPivotCachesXml.IsInit())
sXml.WriteString(m_oPivotCachesXml.get());
sXml.WriteString(_T("</workbook>"));
std::wstring sPath = oPath.GetPath();
@ -208,7 +210,7 @@ namespace OOX
nullable<OOX::Spreadsheet::CSheets> m_oSheets;
nullable<OOX::Spreadsheet::CWorkbookPr> m_oWorkbookPr;
nullable<OOX::Spreadsheet::CExternalReferences> m_oExternalReferences;
nullable<std::wstring> m_oPivotCachesXml;
};
} //Spreadsheet
} // namespace OOX

View File

@ -47,6 +47,9 @@
#include "CalcChain/CalcChain.h"
#include "ExternalLinks/ExternalLinks.h"
#include "ExternalLinks/ExternalLinkPath.h"
#include "Pivot/PivotTable.h"
#include "Pivot/PivotCacheDefinition.h"
#include "Pivot/PivotCacheRecords.h"
#include "../../../DesktopEditor/common/Directory.h"

Some files were not shown because too many files have changed in this diff Show More