Compare commits

...

48 Commits

Author SHA1 Message Date
b221150797 return AVS_FILEUTILS_ERROR_CONVERT_CORRUPTED in case of error in appling changes 2017-04-28 18:15:46 +03:00
2084587e9a remove res 2017-04-28 16:18:10 +03:00
8332c28ac2 Merge tag 'v4.3.3' into develop
v4.3.3 v4.3.3
2017-04-28 12:44:13 +03:00
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
d2c092fe62 pivot 2017-04-21 15:05:23 +03:00
a336917338 OdfFormatWriter - image bullet presentation list style 2017-04-21 14:12:50 +03:00
8925ddeee5 big integer from buffer bug 2017-04-21 10:24:17 +03:00
84824631b2 OdfFormatWriter - presentation styled list 2017-04-20 19:55:18 +03:00
dc3ecb1fc0 BigInteger as string realization 2017-04-20 18:13:10 +03:00
266cef8c49 tests windows 2017-04-20 14:10:38 +03:00
a5e821cd21 . 2017-04-19 20:06:58 +03:00
95c472c15c Merge branch 'hotfix/v4.3.2' 2017-04-17 14:59:08 +03:00
139 changed files with 5905 additions and 1684 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

@ -72,8 +72,8 @@ public:
void start_base_style(const std::wstring baseStyleName, const odf_types::style_family::type baseStyleType);
void end_base_style();
void ApplyTextProperties (std::wstring style,odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type);
void ApplyParagraphProperties (std::wstring style,odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type);
void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
void ApplyParagraphProperties (std::wstring para_style, odf_reader::paragraph_format_properties & propertiesOut);
void ApplyListProperties (odf_reader::paragraph_format_properties & propertiesOut, int Level);
void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
@ -239,32 +239,37 @@ void pptx_text_context::Impl::end_hyperlink(std::wstring hId)
dump_run();
hyperlink_hId = L"";
}
void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name,odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type)
void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name, std::wstring para_style_name, odf_reader::text_format_properties_content & propertiesOut)
{
std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance* style = NULL;
odf_reader::style_instance* baseStyle = NULL;
odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance* para_style = NULL;
odf_reader::style_instance* text_style = NULL;
odf_reader::style_instance* baseStyle = NULL;
if (local_styles_ptr_)
{
style = local_styles_ptr_->style_by_name(style_name, Type,false/*process_headers_footers_*/);
defaultStyle = local_styles_ptr_->style_default_by_type(Type);
baseStyle = local_styles_ptr_->style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
para_style = local_styles_ptr_->style_by_name (para_style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
text_style = local_styles_ptr_->style_by_name (style_name, odf_types::style_family::Text, false/*process_headers_footers_*/);
defaultStyle = local_styles_ptr_->style_default_by_type (odf_types::style_family::Text);
baseStyle = local_styles_ptr_->style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
}
else
{
style = odf_context_.styleContainer().style_by_name(style_name, Type,false/*process_headers_footers_*/);
defaultStyle = odf_context_.styleContainer().style_default_by_type(Type);
baseStyle = odf_context_.styleContainer().style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
para_style = odf_context_.styleContainer().style_by_name (para_style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
text_style = odf_context_.styleContainer().style_by_name (style_name, odf_types::style_family::Text, false/*process_headers_footers_*/);
defaultStyle = odf_context_.styleContainer().style_default_by_type (odf_types::style_family::Text);
baseStyle = odf_context_.styleContainer().style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
}
if (defaultStyle) instances.push_back(defaultStyle);
if (baseStyle) instances.push_back(baseStyle);
if (style) instances.push_back(style);
if (para_style) instances.push_back(para_style);
if (text_style) instances.push_back(text_style);
if (style)get_styles_context().start_process_style(style);
else get_styles_context().start_process_style(baseStyle);
if (text_style) get_styles_context().start_process_style(text_style);
else if (para_style) get_styles_context().start_process_style(para_style);
else get_styles_context().start_process_style(baseStyle);
propertiesOut.apply_from(calc_text_properties_content(instances));
}
@ -323,33 +328,33 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
}
void pptx_text_context::Impl::ApplyParagraphProperties(std::wstring style_name,odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type)
void pptx_text_context::Impl::ApplyParagraphProperties(std::wstring style_name, odf_reader::paragraph_format_properties & propertiesOut)
{
std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* style = NULL;
odf_reader::style_instance * defaultStyle = NULL;
odf_reader::style_instance * baseStyle = NULL;
odf_reader::style_instance* style = NULL;
odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance* baseStyle = NULL;
if (local_styles_ptr_)
{
style = local_styles_ptr_->style_by_name(style_name, Type,false/*process_headers_footers_*/);
defaultStyle = local_styles_ptr_->style_default_by_type(Type);
baseStyle = local_styles_ptr_->style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
style = local_styles_ptr_->style_by_name (style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
defaultStyle = local_styles_ptr_->style_default_by_type (odf_types::style_family::Paragraph);
baseStyle = local_styles_ptr_->style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
}
else
{
style = odf_context_.styleContainer().style_by_name(style_name, Type,false/*process_headers_footers_*/);
defaultStyle = odf_context_.styleContainer().style_default_by_type(Type);
baseStyle= odf_context_.styleContainer().style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/);
style = odf_context_.styleContainer().style_by_name (style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
defaultStyle = odf_context_.styleContainer().style_default_by_type (odf_types::style_family::Paragraph);
baseStyle = odf_context_.styleContainer().style_by_name (base_style_name_, base_style_family_,false/*process_headers_footers_*/);
}
if (defaultStyle) instances.push_back(defaultStyle);
if (baseStyle) instances.push_back(baseStyle);
if (style) instances.push_back(style);
if (style)get_styles_context().start_process_style(style);
else get_styles_context().start_process_style(baseStyle);
if (style) get_styles_context().start_process_style(style);
else get_styles_context().start_process_style(baseStyle);
propertiesOut.apply_from(calc_paragraph_properties_content(instances));
}
@ -360,9 +365,9 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
int level = list_style_stack_.size()-1;
odf_reader::paragraph_format_properties paragraph_properties_;
odf_reader::paragraph_format_properties paragraph_properties_;
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_,odf_types::style_family::Paragraph);
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_);
ApplyListProperties (paragraph_properties_, level);//выравнивания листа накатим на свойства параграфа
paragraph_properties_.pptx_convert(pptx_context_);
@ -403,16 +408,9 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
if (paragraph_style_name_.empty() && span_style_name_.empty() && !(!hyperlink_hId.empty()) && base_style_name_.empty())
return;
odf_reader::text_format_properties_content text_properties_paragraph_;
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_,odf_types::style_family::Paragraph);
odf_reader::text_format_properties_content text_properties_span_;
ApplyTextProperties(span_style_name_, text_properties_span_,odf_types::style_family::Text);
odf_reader::text_format_properties_content text_properties_;
text_properties_.apply_from(text_properties_paragraph_);
text_properties_.apply_from(text_properties_span_);
ApplyTextProperties(span_style_name_, paragraph_style_name_, text_properties_);
get_styles_context().start();

View File

@ -84,10 +84,10 @@ public:
void serialize_shared_strings(std::wostream & strm);
void ApplyTextProperties (std::wstring style, odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type);
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type);
void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut);
void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
void set_local_styles_container (odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
bool is_drawing_context(){return in_draw;}
@ -237,48 +237,54 @@ void xlsx_text_context::Impl::end_hyperlink(std::wstring hId)
hyperlink_hId = hId;
}
void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type)
void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut)
{
std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance* paraStyle = NULL;
if (local_styles_ptr_)
{
odf_reader::style_instance * defaultStyle = local_styles_ptr_->style_default_by_type(Type);
if (defaultStyle)instances.push_back(defaultStyle);
odf_reader::style_instance* styleInst = local_styles_ptr_->style_by_name(style, Type,false/*process_headers_footers_*/);
if(styleInst)instances.push_back(styleInst);
defaultStyle = local_styles_ptr_->style_default_by_type(odf_types::style_family::Paragraph);
paraStyle = local_styles_ptr_->style_by_name(style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
}
else
{
odf_reader::style_instance * defaultStyle = styles_.style_default_by_type(Type);
if (defaultStyle)instances.push_back(defaultStyle);
odf_reader::style_instance* styleInst = styles_.style_by_name(style, Type,false/*process_headers_footers_*/);
if(styleInst)instances.push_back(styleInst);
defaultStyle = styles_.style_default_by_type(odf_types::style_family::Paragraph);
paraStyle = styles_.style_by_name(style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
}
if (defaultStyle) instances.push_back(defaultStyle);
if (paraStyle) instances.push_back(paraStyle);
propertiesOut.apply_from(calc_paragraph_properties_content(instances));
}
void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type)
void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut)
{
std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance* textStyle = NULL;
odf_reader::style_instance* paraStyle = NULL;
if (local_styles_ptr_)
{
odf_reader::style_instance * defaultStyle = local_styles_ptr_->style_default_by_type(Type);
if (defaultStyle)instances.push_back(defaultStyle);
odf_reader::style_instance* styleInst = local_styles_ptr_->style_by_name(style, Type,false/*process_headers_footers_*/);
if(styleInst)instances.push_back(styleInst);
defaultStyle = local_styles_ptr_->style_default_by_type(odf_types::style_family::Text);
paraStyle = local_styles_ptr_->style_by_name(para_style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
textStyle = local_styles_ptr_->style_by_name(style, odf_types::style_family::Text, false/*process_headers_footers_*/);
}
else
{
odf_reader::style_instance * defaultStyle = styles_.style_default_by_type(Type);
if (defaultStyle)instances.push_back(defaultStyle);
odf_reader::style_instance* styleInst = styles_.style_by_name(style, Type,false/*process_headers_footers_*/);
if(styleInst)instances.push_back(styleInst);
defaultStyle = styles_.style_default_by_type(odf_types::style_family::Text);
paraStyle = styles_.style_by_name(para_style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
textStyle = styles_.style_by_name(style, odf_types::style_family::Text, false/*process_headers_footers_*/);
}
if (defaultStyle) instances.push_back(defaultStyle);
if (paraStyle) instances.push_back(paraStyle);
if (textStyle) instances.push_back(textStyle);
propertiesOut.apply_from(calc_text_properties_content(instances));
}
@ -291,10 +297,10 @@ void xlsx_text_context::Impl::write_pPr (std::wostream & strm)
{
if (paragraph_style_name_.empty())return;
odf_reader::paragraph_format_properties paragraph_format_properties_;
odf_reader::paragraph_format_properties paragraph_format_properties_;
ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_ , odf_types::style_family::Paragraph);
paragraph_format_properties_.xlsx_convert(strm, in_draw);
ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_);
paragraph_format_properties_.xlsx_convert (strm, in_draw);
}
void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
@ -303,20 +309,13 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
&& !(!hyperlink_hId.empty() && in_draw)
&& !(text_properties_cell_ && in_cell_content))return;
odf_reader::text_format_properties_content text_properties_paragraph_;
odf_reader::text_format_properties_content text_properties_span_;
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_ , odf_types::style_family::Paragraph);
ApplyTextProperties (span_style_name_, text_properties_span_ , odf_types::style_family::Text);
odf_reader::text_format_properties_content text_properties_;
if (in_cell_content && text_properties_cell_)
{
text_properties_.apply_from(*text_properties_cell_);
}
text_properties_.apply_from(text_properties_paragraph_);
text_properties_.apply_from(text_properties_span_);
}
ApplyTextProperties (span_style_name_, paragraph_style_name_, text_properties_);
_CP_OPT(double) dValFontSize;
if (text_properties_.fo_font_size_)

View File

@ -41,22 +41,22 @@ std::wostream & operator << (std::wostream & _Wostream, const presentation_class
std::wstring res = L"";
switch(_Val.get_type())
{
case presentation_class::title: _Wostream << L"title" ; break;
case presentation_class::subtitle: _Wostream << L"subtitle" ; break;
case presentation_class::graphic: _Wostream << L"graphic" ; break;
case presentation_class::object: _Wostream << L"object" ; break;
case presentation_class::chart: _Wostream << L"chart" ; break;
case presentation_class::table: _Wostream << L"table" ; break;
case presentation_class::orgchart: _Wostream << L"orgchart" ; break;
case presentation_class::header: _Wostream << L"header" ; break;
case presentation_class::footer: _Wostream << L"footer" ; break;
case presentation_class::date_time: _Wostream << L"date_time" ; break;
case presentation_class::page_number: _Wostream << L"page_number" ; break;
case presentation_class::page: _Wostream << L"page" ; break;
case presentation_class::notes: _Wostream << L"notes" ; break;
case presentation_class::handout: _Wostream << L"handout" ; break;
case presentation_class::outline: _Wostream << L"outline" ; break;
case presentation_class::text: _Wostream << L"text" ; break;
case presentation_class::title: _Wostream << L"title"; break;
case presentation_class::subtitle: _Wostream << L"subtitle"; break;
case presentation_class::graphic: _Wostream << L"graphic"; break;
case presentation_class::object: _Wostream << L"object"; break;
case presentation_class::chart: _Wostream << L"chart"; break;
case presentation_class::table: _Wostream << L"table"; break;
case presentation_class::orgchart: _Wostream << L"orgchart"; break;
case presentation_class::header: _Wostream << L"header"; break;
case presentation_class::footer: _Wostream << L"footer"; break;
case presentation_class::date_time: _Wostream << L"date-time"; break;
case presentation_class::page_number: _Wostream << L"page-number";break;
case presentation_class::page: _Wostream << L"page"; break;
case presentation_class::notes: _Wostream << L"notes"; break;
case presentation_class::handout: _Wostream << L"handout"; break;
case presentation_class::outline: _Wostream << L"outline"; break;
case presentation_class::text: _Wostream << L"text"; break;
}
return _Wostream;
}
@ -65,41 +65,24 @@ presentation_class presentation_class::parse(const std::wstring & Str)
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"page")
return presentation_class( page );
else if (tmp == L"title")
return presentation_class( title);
else if (tmp == L"outline")
return presentation_class( outline );
else if (tmp == L"subtitle")
return presentation_class( subtitle);
else if (tmp == L"text")
return presentation_class( text);
else if (tmp == L"graphic")
return presentation_class( graphic );
else if (tmp == L"object")
return presentation_class( object );
else if (tmp == L"chart")
return presentation_class( chart );
else if (tmp == L"table")
return presentation_class( table );
else if (tmp == L"orgchart")
return presentation_class( orgchart );
else if (tmp == L"notes")
return presentation_class( notes );
else if (tmp == L"handout")
return presentation_class( handout );
else if (tmp == L"header")
return presentation_class( header );
else if (tmp == L"footer")
return presentation_class( footer );
else if (tmp == L"date-time")
return presentation_class( date_time );
else if (tmp == L"page-number")
return presentation_class( page_number );
else
if (tmp == L"page") return presentation_class( page );
else if (tmp == L"title") return presentation_class( title);
else if (tmp == L"outline") return presentation_class( outline );
else if (tmp == L"subtitle") return presentation_class( subtitle);
else if (tmp == L"text") return presentation_class( text);
else if (tmp == L"graphic") return presentation_class( graphic );
else if (tmp == L"object") return presentation_class( object );
else if (tmp == L"chart") return presentation_class( chart );
else if (tmp == L"table") return presentation_class( table );
else if (tmp == L"orgchart") return presentation_class( orgchart );
else if (tmp == L"notes") return presentation_class( notes );
else if (tmp == L"handout") return presentation_class( handout );
else if (tmp == L"header") return presentation_class( header );
else if (tmp == L"footer") return presentation_class( footer );
else if (tmp == L"date-time") return presentation_class( date_time );
else if (tmp == L"page-number") return presentation_class( page_number );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return presentation_class( page );
}
}

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

@ -458,7 +458,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
{
CP_XML_NODE(L"a:spcBef")
{
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
if (fo_margin_top_->get_type() == length_or_percent::Length)
{
std::wstring w_before = pptx_process_margin(fo_margin_top_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts")

View File

@ -67,30 +67,41 @@ public:
odf_type_name =L"ooxml-snip2DiagRect";
modifiers = L"0 16667";
enhanced_path = L"M ?f9 ?f2 L ?f13 ?f2 ?f1 ?f12 ?f1 ?f11 ?f10 ?f3 ?f12 ?f3 ?f0 ?f14 ?f0 ?f9 Z N";
text_areas = L"?f17 ?f17 ?f18 ?f19";
view_box = L"0 0 21600 21600";
enhanced_path = L"M ?f3 0 L ?f7 0 ?f14 ?f6 ?f14 ?f5 ?f4 ?f17 ?f6 ?f17 0 ?f8 0 ?f3 Z N";
text_areas = L"?f11 ?f11 ?f12 ?f13";
view_box = L"0 0 0 0";
add(L"f0", L"left");
add(L"f1", L"right");
add(L"f2", L"top");
add(L"f3", L"bottom");
add(L"f4", L"?f3 - ?f2");
add(L"f5", L"?f1 - ?f0");
add(L"f6", L"min(?f5, ?f4)");
add(L"f7", L"$0");
add(L"f8", L"$1");
add(L"f9", L"?f6 * ?f7 / 100000");
add(L"f10", L"?f1 - ?f9");
add(L"f11", L"?f3 - ?f9");
add(L"f12", L"?f6 * ?f8 / 100000");
add(L"f13", L"?f1 - ?f12");
add(L"f14", L"?f3 - ?f12");
add(L"f15", L"?f9 - ?f12");
add(L"f16", L"if(?f15, ?f9, ?f12)");
add(L"f17", L"?f16 / 2");
add(L"f18", L"?f1 - ?f17");
add(L"f19", L"?f3 - ?f17");
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
add(L"f1", L"if(0-$1 ,0,if(50000-$1 ,$1 ,50000))");
add(L"f2", L"min(logwidth,logheight)");
add(L"f3", L"?f2 *?f0 /100000");
add(L"f4", L"logwidth+0-?f3 ");
add(L"f5", L"logheight+0-?f3 ");
add(L"f6", L"?f2 *?f1 /100000");
add(L"f7", L"logwidth+0-?f6 ");
add(L"f8", L"logheight+0-?f6 ");
add(L"f9", L"?f3 +0-?f6 ");
add(L"f10", L"if(?f9 ,?f3 ,?f6 )");
add(L"f11", L"?f10 *1/2");
add(L"f12", L"logwidth+0-?f11 ");
add(L"f13", L"logheight+0-?f11 ");
add(L"f14", L"logwidth");
add(L"f15", L"logheight/2");
add(L"f16", L"logwidth/2");
add(L"f17", L"logheight");
_handle h;
h.position = L"?f3 0";
h.x_maximum= L"50000";
h.x_minimum= L"0";
handles.push_back(h);
h.position = L"?f7 0";
h.x_maximum= L"50000";
h.x_minimum= L"0";
handles.push_back(h);
}
};
class oox_shape_snip2SameRect : public oox_shape

View File

@ -262,6 +262,7 @@ void odf_conversion_context::process_settings(_object & object, bool isRoot)
void odf_conversion_context::process_styles(_object & object, bool isRoot)
{
create_element(L"office", L"styles", object.styles, this, true);//общие стили
object.style_context->process_office_styles(object.styles.back());
page_layout_context()->process_office_styles(object.styles.back());
@ -288,7 +289,15 @@ office_element_ptr odf_conversion_context::start_tabs()
create_element(L"style", L"tab-stops", temporary_.elm, this,true);
return temporary_.elm;
}
std::wstring odf_conversion_context::add_image(const std::wstring & image_file_name)
{
if (image_file_name.empty()) return L"";
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage, odf_ref_name);
return odf_ref_name;
}
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
{
if (!temporary_.elm) return;

View File

@ -95,7 +95,7 @@ public:
virtual void start_text_context() = 0;
virtual void end_text_context() = 0;
virtual void start_image(const std::wstring & image_file_name) = 0;
std::wstring add_image(const std::wstring & image_file_name);
virtual odf_style_context * styles_context();

View File

@ -76,7 +76,7 @@ struct odf_group_state
scale_cx = scale_cy = 1.;
flipH = flipV = false;
elm = elm_;
elm = elm_;
level = level_;
prev_group = prev;
@ -185,19 +185,19 @@ struct odf_drawing_state
presentation_class_ = boost::none;
presentation_placeholder_ = boost::none;
rotateAngle = boost::none;
rotateAngle_ = boost::none;
path_ = L"";
view_box_ = L"";
path_last_command_ = L"";
oox_shape_preset = -1;
oox_shape_preset_ = -1;
oox_shape_.reset();
in_group = false;
text_box_tableframe = false;
in_group_ = false;
text_box_tableframe_= false;
flipH = flipV = false;
flipH_ = flipV_ = false;
}
std::vector<odf_element_state> elements_;
@ -207,28 +207,29 @@ struct odf_drawing_state
_CP_OPT(length) svg_height_;
_CP_OPT(length) svg_width_;
bool flipH_;
bool flipV_;
std::wstring name_;
std::wstring description_;
int z_order_;
bool hidden_;
_CP_OPT(double) rotateAngle;
_CP_OPT(double) rotateAngle_;
_CP_OPT(unsigned int) fill_color_;
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) presentation_placeholder_;
bool flipH;
bool flipV;
std::wstring path_;
std::wstring view_box_;
std::wstring path_last_command_;
oox_shape_ptr oox_shape_;
///////////////////////
int oox_shape_preset;
bool in_group;
bool text_box_tableframe;
int oox_shape_preset_;
bool in_group_;
bool text_box_tableframe_;
};
class odf_drawing_context::Impl
@ -316,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;
@ -330,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()
@ -461,12 +468,13 @@ void odf_drawing_context::start_drawing()
//else
if (impl_->current_level_.size() > 0)
{
impl_->current_drawing_state_.in_group = true;
impl_->current_drawing_state_.in_group_ = true;
}
}
void odf_drawing_context::end_drawing_background(odf_types::common_draw_fill_attlist & common_draw_attlist)
{
end_area_properties();
if (impl_->current_drawing_state_.elements_.empty() == false) return;
if (!impl_->is_background_ || !impl_->current_graphic_properties) return;
@ -485,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;
@ -509,20 +521,20 @@ void odf_drawing_context::end_drawing()
std::wstring strTransform;
if (impl_->current_drawing_state_.in_group && impl_->current_group_)
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_)
{
double rotate = impl_->current_group_->rotate;
if (impl_->current_drawing_state_.rotateAngle )
rotate += *impl_->current_drawing_state_.rotateAngle;
if (impl_->current_drawing_state_.rotateAngle_)
rotate += *impl_->current_drawing_state_.rotateAngle_;
if (fabs(rotate)>0.001)impl_->current_drawing_state_.rotateAngle = rotate;
if (fabs(rotate)>0.001)impl_->current_drawing_state_.rotateAngle_ = rotate;
}
double x = impl_->current_drawing_state_.svg_x_ ? impl_->current_drawing_state_.svg_x_->get_value() : 0;
double y = impl_->current_drawing_state_.svg_y_ ? impl_->current_drawing_state_.svg_y_->get_value() : 0;
if (impl_->current_drawing_state_.rotateAngle)
if (impl_->current_drawing_state_.rotateAngle_)
{
if (impl_->current_drawing_state_.in_group)
if (impl_->current_drawing_state_.in_group_)
{
if (impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_)
{
@ -532,7 +544,7 @@ void odf_drawing_context::end_drawing()
}
}
strTransform += std::wstring(L"rotate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.rotateAngle.get()) + std::wstring(L")");
strTransform += std::wstring(L"rotate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.rotateAngle_.get()) + std::wstring(L")");
//так как вращения все в мс относительно центра фигуры, а не от начала координат - убираем смещение
if (impl_->current_drawing_state_.svg_x_ && impl_->current_drawing_state_.svg_y_)
@ -576,14 +588,14 @@ void odf_drawing_context::end_drawing()
placeholder->svg_height_ = impl_->current_drawing_state_.svg_height_;
placeholder->svg_width_ = impl_->current_drawing_state_.svg_width_;
}
if (impl_->current_drawing_state_.in_group)
if (impl_->current_drawing_state_.in_group_)
{
odf_group_state_ptr gr = impl_->current_group_;
while(gr)
{
impl_->current_drawing_state_.flipH = impl_->current_drawing_state_.flipH ^ gr->flipH;
impl_->current_drawing_state_.flipV = impl_->current_drawing_state_.flipV ^ gr->flipV;
impl_->current_drawing_state_.flipH_ = impl_->current_drawing_state_.flipH_ ^ gr->flipH;
impl_->current_drawing_state_.flipV_ = impl_->current_drawing_state_.flipV_ ^ gr->flipV;
gr = gr->prev_group;
}
@ -594,8 +606,8 @@ void odf_drawing_context::end_drawing()
draw_enhanced_geometry* enhan = dynamic_cast<draw_enhanced_geometry*>(custom->draw_enhanced_geometry_.get());
if(enhan)
{
if (impl_->current_drawing_state_.flipV) enhan->draw_enhanced_geometry_attlist_.draw_mirror_vertical_ = true;
if (impl_->current_drawing_state_.flipH) enhan->draw_enhanced_geometry_attlist_.draw_mirror_horizontal_ = true;
if (impl_->current_drawing_state_.flipV_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_vertical_ = true;
if (impl_->current_drawing_state_.flipH_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_horizontal_ = true;
}
}else
{
@ -615,7 +627,7 @@ void odf_drawing_context::end_drawing()
impl_->current_graphic_properties->common_horizontal_margin_attlist_.fo_margin_right_ = impl_->anchor_settings_.fo_margin_right_;
impl_->current_graphic_properties->common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_;
if (draw && !impl_->current_drawing_state_.in_group)
if (draw && !impl_->current_drawing_state_.in_group_)
draw->common_draw_attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_ = impl_->anchor_settings_.anchor_type_;
impl_->current_graphic_properties->style_wrap_ = impl_->anchor_settings_.style_wrap_;
@ -695,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;
@ -707,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();
@ -728,7 +746,7 @@ void odf_drawing_context::Impl::create_draw_base(int type)
void odf_drawing_context::start_shape(int type)
{
impl_->current_drawing_state_.oox_shape_preset = type;
impl_->current_drawing_state_.oox_shape_preset_ = type;
if (type < sizeof(Shape_Types_Mapping)/sizeof(_sh_typ))
{
@ -756,12 +774,21 @@ void odf_drawing_context::start_shape(int type)
}
}
bool odf_drawing_context::change_text_box_2_wordart()
bool odf_drawing_context::is_wordart()
{
if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
return true;
if (impl_->current_drawing_state_.text_box_tableframe) return false;
return false;
}
bool odf_drawing_context::change_text_box_2_wordart()
{
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
return true;
if (impl_->current_drawing_state_.presentation_class_) return false;
if (impl_->current_drawing_state_.text_box_tableframe_) return false;
if (impl_->current_drawing_state_.elements_.empty()) return false;
draw_text_box* t = dynamic_cast<draw_text_box*>(impl_->current_drawing_state_.elements_.back().elm.get());
@ -799,7 +826,7 @@ bool odf_drawing_context::change_text_box_2_wordart()
impl_->current_drawing_state_.elements_.erase(impl_->current_drawing_state_.elements_.end() - 2, impl_->current_drawing_state_.elements_.end());
impl_->current_drawing_state_.elements_.push_back( state);
impl_->current_drawing_state_.oox_shape_preset = 2031;//plain text
impl_->current_drawing_state_.oox_shape_preset_ = 2031;//plain text
if (sz == 2) impl_->root_element_ = draw_elm;
return true;
@ -810,8 +837,8 @@ void odf_drawing_context::end_shape()
if (impl_->current_drawing_state_.elements_.empty())
return;
if (impl_->current_drawing_state_.oox_shape_preset == 2000) return end_text_box();
if (impl_->current_drawing_state_.oox_shape_preset == 3000) return end_image();
if (impl_->current_drawing_state_.oox_shape_preset_ == 2000) return end_text_box();
if (impl_->current_drawing_state_.oox_shape_preset_ == 3000) return end_image();
//вторичные, вычисляемые свойства шейпов
if (isLineShape())
@ -848,7 +875,7 @@ void odf_drawing_context::end_shape()
impl_->current_drawing_state_.svg_x_ = boost::none;
impl_->current_drawing_state_.svg_y_ = boost::none;
if (impl_->current_drawing_state_.flipV)
if (impl_->current_drawing_state_.flipV_)
{
_CP_OPT(length) tmp;
@ -856,7 +883,7 @@ void odf_drawing_context::end_shape()
line->draw_line_attlist_.svg_y1_ = line->draw_line_attlist_.svg_y2_;
line->draw_line_attlist_.svg_y2_ = tmp;
}
if (impl_->current_drawing_state_.flipH)
if (impl_->current_drawing_state_.flipH_)
{
_CP_OPT(length) tmp;
@ -881,11 +908,11 @@ void odf_drawing_context::end_shape()
std::wstring sub_type;
bool text_shape = false;
if (impl_->current_drawing_state_.oox_shape_preset < sizeof(Shape_Types_Mapping)/sizeof(_sh_typ))
if (impl_->current_drawing_state_.oox_shape_preset_ < sizeof(Shape_Types_Mapping)/sizeof(_sh_typ))
{
sub_type = Shape_Types_Mapping[impl_->current_drawing_state_.oox_shape_preset].first;
sub_type = Shape_Types_Mapping[impl_->current_drawing_state_.oox_shape_preset_].first;
}
else if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)// 3000 - все равно сюда не попадет
else if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)// 3000 - все равно сюда не попадет
{
text_shape = true;
}
@ -925,7 +952,7 @@ void odf_drawing_context::end_shape()
}
else
{
oox_shape_ptr shape_define = oox_shape::create(impl_->current_drawing_state_.oox_shape_preset);
oox_shape_ptr shape_define = oox_shape::create(impl_->current_drawing_state_.oox_shape_preset_);
if (!shape_define) shape_define = impl_->current_drawing_state_.oox_shape_;
@ -1001,7 +1028,7 @@ bool odf_drawing_context::isLineShape()
draw_path* path = dynamic_cast<draw_path*>(impl_->current_level_.back().get());
if (path) return true;
switch(impl_->current_drawing_state_.oox_shape_preset)
switch(impl_->current_drawing_state_.oox_shape_preset_)
{
case 20: //SimpleTypes::shapetypeBentConnector2:
case 21: //SimpleTypes::shapetypeBentConnector3:
@ -1125,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_)
{
@ -1159,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;
@ -1182,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 ...
}
@ -1229,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;
@ -1238,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_) &&
@ -1486,7 +1517,7 @@ void odf_drawing_context::set_viewBox (double W, double H)
}
void odf_drawing_context::set_flip_H(bool bVal)
{
impl_->current_drawing_state_.flipH = bVal;
impl_->current_drawing_state_.flipH_ = bVal;
if (impl_->current_graphic_properties == NULL) return;
if (bVal == false)return;
@ -1498,7 +1529,7 @@ void odf_drawing_context::set_flip_H(bool bVal)
}
void odf_drawing_context::set_flip_V(bool bVal)
{
impl_->current_drawing_state_.flipV = bVal;
impl_->current_drawing_state_.flipV_ = bVal;
if (impl_->current_graphic_properties == NULL) return;
if (bVal == false)return;
@ -1513,7 +1544,7 @@ void odf_drawing_context::set_rotate(double dVal)
{
if (dVal > 180) dVal = dVal - 360;
double dRotate = dVal / 180. * 3.14159265358979323846;
impl_->current_drawing_state_.rotateAngle = dRotate;
impl_->current_drawing_state_.rotateAngle_ = dRotate;
}
void odf_drawing_context::set_drawings_rect(_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt)// "- 1" не задано
@ -1720,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)
@ -1742,7 +1773,7 @@ void odf_drawing_context::set_group_flip_V(bool bVal)
{
if ( impl_->group_list_.empty() )return;
impl_->current_group_->flipV= bVal;
impl_->current_group_->flipV = bVal;
}
void odf_drawing_context::set_group_z_order(int Val)
{
@ -1767,7 +1798,7 @@ void odf_drawing_context::set_group_flip_H(bool bVal)
{
if ( impl_->group_list_.empty() )return;
impl_->current_group_->flipH= bVal;
impl_->current_group_->flipH = bVal;
}
void odf_drawing_context::set_group_rotate(int iVal)
@ -1794,14 +1825,14 @@ void odf_drawing_context::set_position_line(_CP_OPT(double) & x_pt, _CP_OPT(doub
draw_line* line = dynamic_cast<draw_line*>(impl_->current_level_.back().get());
if (line == NULL) return;
if (impl_->current_drawing_state_.in_group && impl_->current_group_ && x_pt)
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_ && x_pt)
x_pt = *x_pt * impl_->current_group_->scale_cx + impl_->current_group_->shift_x ;
// + (impl_->current_group_->flipH ? (impl_->current_group_->cx - 2 * x_pt): 0);
if (x_pt && !line->draw_line_attlist_.svg_x1_)
line->draw_line_attlist_.svg_x1_ = length(length(*x_pt,length::pt).get_value_unit(length::cm),length::cm);
if (impl_->current_drawing_state_.in_group && impl_->current_group_ && y_pt)
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_ && y_pt)
y_pt = *y_pt * impl_->current_group_->scale_cy + impl_->current_group_->shift_y;
//+ (impl_->current_group_->flipV ? (impl_->current_group_->cy - 2 * y_pt): 0);
@ -1809,13 +1840,13 @@ void odf_drawing_context::set_position_line(_CP_OPT(double) & x_pt, _CP_OPT(doub
line->draw_line_attlist_.svg_y1_ = length(length(*y_pt,length::pt).get_value_unit(length::cm),length::cm);
///////////////////////////////////////
if (impl_->current_drawing_state_.in_group && impl_->current_group_ && x2_pt)
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_ && x2_pt)
x2_pt = *x2_pt * impl_->current_group_->scale_cx + impl_->current_group_->shift_x ;
// + (impl_->current_group_->flipH ? (impl_->current_group_->cx - 2 * x_pt): 0);
if (x2_pt && !line->draw_line_attlist_.svg_x2_) line->draw_line_attlist_.svg_x2_ = length(length(*x2_pt,length::pt).get_value_unit(length::cm),length::cm);
if (impl_->current_drawing_state_.in_group && impl_->current_group_ && y2_pt)
if (impl_->current_drawing_state_.in_group_ && impl_->current_group_ && y2_pt)
y2_pt = *y2_pt * impl_->current_group_->scale_cy + impl_->current_group_->shift_y;
//+ (impl_->current_group_->flipV ? (impl_->current_group_->cy - 2 * y_pt): 0);
@ -1841,14 +1872,14 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
{
double x = *x_pt;
if (impl_->current_drawing_state_.in_group)
if (impl_->current_drawing_state_.in_group_)
{
for( int i = impl_->group_list_.size() - 1; i >= 0 ; i--)
{
x = (x + impl_->group_list_[i]->shift_x) * impl_->group_list_[i]->scale_cx ;
}
}
if (!impl_->current_drawing_state_.svg_x_ || impl_->current_drawing_state_.in_group)
if (!impl_->current_drawing_state_.svg_x_ || impl_->current_drawing_state_.in_group_)
{
impl_->current_drawing_state_.svg_x_ = length(length(x , length::pt).get_value_unit(length::cm), length::cm);
}
@ -1858,7 +1889,7 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
{
double y = *y_pt;
if (impl_->current_drawing_state_.in_group)
if (impl_->current_drawing_state_.in_group_)
{
for( int i = impl_->group_list_.size() - 1; i >= 0 ; i--)
{
@ -1866,7 +1897,7 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
}
}
if (!impl_->current_drawing_state_.svg_y_ || impl_->current_drawing_state_.in_group)
if (!impl_->current_drawing_state_.svg_y_ || impl_->current_drawing_state_.in_group_)
{
impl_->current_drawing_state_.svg_y_ = length(length(y, length::pt).get_value_unit(length::cm),length::cm);
}
@ -1887,7 +1918,7 @@ void odf_drawing_context::get_size( _CP_OPT(double) & width_pt, _CP_OPT(double)
}
void odf_drawing_context::set_size( _CP_OPT(double) & width_pt, _CP_OPT(double) & height_pt)
{
if (impl_->current_drawing_state_.in_group)
if (impl_->current_drawing_state_.in_group_)
{
if (width_pt)
{
@ -2129,7 +2160,7 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
style* style_ = NULL;
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
impl_->styles_context_->create_style(L"",style_family::Paragraph, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
style_ = dynamic_cast<style*>(style_shape_elm.get());
@ -2146,32 +2177,79 @@ 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)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (!impl_->current_paragraph_properties)
{
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (draw)
{
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
if (style_)
{
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
}
}
else
{
//??? find by name
}
}
}
if (impl_->current_paragraph_properties)
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
}
void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
{
if (!impl_->current_graphic_properties)return;
@ -2200,7 +2278,7 @@ void odf_drawing_context::start_image(std::wstring odf_path)
return;
}
impl_->current_drawing_state_.oox_shape_preset = 3000;
impl_->current_drawing_state_.oox_shape_preset_ = 3000;
start_frame();
@ -2247,7 +2325,7 @@ void odf_drawing_context::start_object(std::wstring name)
void odf_drawing_context::start_text_box()
{
impl_->current_drawing_state_.oox_shape_preset = 2000;
impl_->current_drawing_state_.oox_shape_preset_ = 2000;
start_frame();
@ -2292,7 +2370,7 @@ void odf_drawing_context::set_text_box_tableframe(bool val)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
impl_->current_drawing_state_.text_box_tableframe = val;
impl_->current_drawing_state_.text_box_tableframe_ = val;
}
void odf_drawing_context::set_text_box_parent_style(std::wstring style_name)
@ -2418,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++)
{
@ -2437,7 +2515,7 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
}
if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
{
//настройки цвета - перетащить в линии и заливки - так уж нужно wordart-у оо
style_text_properties *text_properties_ = text_context->get_text_properties();
@ -2947,7 +3025,7 @@ void odf_drawing_context::end_hatch_style()
void odf_drawing_context::start_bitmap_style()
{
if (!impl_->current_graphic_properties) return;
if (impl_->current_drawing_state_.oox_shape_preset == 3000) return;
if (impl_->current_drawing_state_.oox_shape_preset_ == 3000) return;
odf_writer::office_element_ptr fill_image_element;
@ -3043,7 +3121,7 @@ void odf_drawing_context::set_bitmap_link(std::wstring file_path)
std::wstring odf_ref_name ;
impl_->odf_context_->mediaitems()->add_or_find(file_path, _mediaitems::typeImage, odf_ref_name);
if (impl_->current_drawing_state_.oox_shape_preset == 3000)
if (impl_->current_drawing_state_.oox_shape_preset_ == 3000)
{
if (impl_->current_level_.size() < 1) return;

View File

@ -52,6 +52,7 @@ namespace odf_writer
class odf_conversion_context;
class odf_style_context;
class odf_text_context;
class style_paragraph_properties;
class odf_drawing_context
{
@ -59,7 +60,8 @@ public:
odf_drawing_context (odf_conversion_context *odf_context);
~odf_drawing_context ();
void set_presentation (bool bMaster);
void set_presentation (bool bMaster);
_CP_OPT(bool) get_presentation ();
void set_drawings_rect (_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt);
void clear ();
@ -124,16 +126,18 @@ public:
void start_frame ();
void end_frame ();
bool change_text_box_2_wordart();
void start_image (std::wstring file_path);
void start_image (std::wstring odf_file_path);
void end_image ();
bool change_text_box_2_wordart ();
bool is_wordart ();
void set_paragraph_properties (style_paragraph_properties *paragraph_properties);
void start_text_box ();
void set_text_box_min_size (bool val);
void set_text_box_min_size (double w_pt, double h_pt);
void set_text_box_parent_style (std::wstring style_name);
void set_text_box_tableframe (bool val);
void set_text_box_tableframe (bool val);
void end_text_box ();
void start_object(std::wstring name);

View File

@ -54,11 +54,12 @@ void odf_lists_styles_context::set_odf_context(odf_conversion_context * Context)
odf_context_ = Context;
}
void odf_lists_styles_context::process_styles(office_element_ptr root )
void odf_lists_styles_context::process_styles(office_element_ptr root, bool automatic)
{
for (size_t i = 0; i < lists_format_array_.size(); i++)
{
if (lists_format_array_[i].elements.size() < 1) continue;
if (lists_format_array_[i].elements.size() < 1) continue;
if (lists_format_array_[i].automatic != automatic) continue;
root->add_child_element(lists_format_array_[i].elements[0]);
}
@ -92,7 +93,13 @@ std::wstring odf_lists_styles_context::get_style_name1(int oox_style_num)
}
std::wstring odf_lists_styles_context::get_style_name(int oox_style_num)
{
if (link_format_map_.count(oox_style_num) > 0)
if (lists_format_array_.empty()) return L"";
if (oox_style_num < 0)
{
return lists_format_array_.back().odf_list_style_name;
}
else if (link_format_map_.count(oox_style_num) > 0)
{
return link_format_map_.at(oox_style_num);
}
@ -101,7 +108,7 @@ std::wstring odf_lists_styles_context::get_style_name(int oox_style_num)
return L"";
}
}
void odf_lists_styles_context::start_style(int based_number)
void odf_lists_styles_context::start_style(bool bMaster, int based_number)
{
list_format_state state;
@ -109,21 +116,29 @@ void odf_lists_styles_context::start_style(int based_number)
create_element(L"text", L"list-style", elm, odf_context_);
state.elements.push_back(elm);
state.oox_based_number = based_number;
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(based_number + 1);
if (based_number < 0)
{
state.oox_based_number = lists_format_array_.size();
state.odf_list_style_name = std::wstring(L"L") + boost::lexical_cast<std::wstring>(state.oox_based_number + 1);
}
else
{
state.oox_based_number = based_number;
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(state.oox_based_number + 1);
}
state.automatic = !bMaster;
text_list_style *style = dynamic_cast<text_list_style *>(elm.get());
if (style == NULL)return;
style->text_list_style_attr_.style_name_ = state.odf_list_style_name;
lists_format_array_.push_back(state); //перенести в end??
}
style_list_level_properties * odf_lists_styles_context::get_list_level_properties()
{
if (lists_format_array_.size() < 1) return NULL;
if (lists_format_array_.back().elements.size() <1) return NULL;
if (lists_format_array_.empty()) return NULL;
if (lists_format_array_.back().elements.empty()) return NULL;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
@ -156,8 +171,8 @@ style_list_level_properties * odf_lists_styles_context::get_list_level_propertie
}
style_text_properties * odf_lists_styles_context::get_text_properties()
{
if (lists_format_array_.size() < 1) return NULL;
if (lists_format_array_.back().elements.size() <1) return NULL;
if (lists_format_array_.empty()) return NULL;
if (lists_format_array_.back().elements.empty()) return NULL;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
@ -167,14 +182,14 @@ style_text_properties * odf_lists_styles_context::get_text_properties()
if (style_number_)
{
if (!style_number_->style_text_properties_)
create_element(L"style", L"text-properties",style_number_->style_text_properties_,odf_context_);
create_element(L"style", L"text-properties", style_number_->style_text_properties_, odf_context_);
props = dynamic_cast<style_text_properties *>(style_number_->style_text_properties_.get());
}
if (style_bullet_)
{
if (!style_bullet_->style_text_properties_)
create_element(L"style", L"text-properties",style_bullet_->style_text_properties_,odf_context_);
create_element(L"style", L"text-properties", style_bullet_->style_text_properties_, odf_context_);
props = dynamic_cast<style_text_properties *>(style_bullet_->style_text_properties_.get());
}
@ -190,8 +205,8 @@ style_text_properties * odf_lists_styles_context::get_text_properties()
style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alignment_properties()
{
if (lists_format_array_.size() < 1) return NULL;
if (lists_format_array_.back().elements.size() <1) return NULL;
if (lists_format_array_.empty()) return NULL;
if (lists_format_array_.back().elements.empty()) return NULL;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
@ -201,21 +216,21 @@ style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alig
if (style_number_)
{
if (!style_number_->style_list_level_properties_)
create_element(L"style", L"list-level-properties",style_number_->style_list_level_properties_,odf_context_);
create_element(L"style", L"list-level-properties", style_number_->style_list_level_properties_, odf_context_);
props = dynamic_cast<style_list_level_properties *>(style_number_->style_list_level_properties_.get());
}
if (style_bullet_)
{
if (!style_bullet_->style_list_level_properties_)
create_element(L"style", L"list-level-properties",style_bullet_->style_list_level_properties_,odf_context_);
create_element(L"style", L"list-level-properties", style_bullet_->style_list_level_properties_, odf_context_);
props = dynamic_cast<style_list_level_properties *>(style_bullet_->style_list_level_properties_.get());
}
if (style_image_)
{
if (!style_image_->style_list_level_properties_)
create_element(L"style", L"list-level-properties",style_image_->style_list_level_properties_,odf_context_);
create_element(L"style", L"list-level-properties", style_image_->style_list_level_properties_, odf_context_);
props = dynamic_cast<style_list_level_properties *>(style_image_->style_list_level_properties_.get());
}
@ -223,14 +238,15 @@ style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alig
if (!props->style_list_level_label_alignment_)
{
create_element(L"style", L"list-level-label-alignment" ,props->style_list_level_label_alignment_,odf_context_);
create_element(L"style", L"list-level-label-alignment" , props->style_list_level_label_alignment_, odf_context_);
}
return dynamic_cast<style_list_level_label_alignment *>(props->style_list_level_label_alignment_.get());
}
int odf_lists_styles_context::start_style_level(int level, int type)
{
if (lists_format_array_.size() < 1) return -1;
if (lists_format_array_.empty()) return -1;
int odf_type =1;
int format_type = -1;
@ -451,10 +467,10 @@ wchar_t convert_bullet_char(wchar_t c)
}
void odf_lists_styles_context::set_numeric_format(std::wstring val)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if ( val.length() <1 )
return;
if ( lists_format_array_.empty() ) return;
if ( lists_format_array_.back().elements.empty() ) return;
if ( val.empty() ) return;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
if (style_number_)
@ -522,10 +538,10 @@ void odf_lists_styles_context::set_numeric_format(std::wstring val)
}
void odf_lists_styles_context::set_bullet_char(std::wstring val)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if ( val.length() <1 )
return;
if ( lists_format_array_.empty() ) return;
if ( lists_format_array_.back().elements.empty() ) return ;
if ( val.empty() ) return;
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
@ -536,20 +552,20 @@ void odf_lists_styles_context::set_bullet_char(std::wstring val)
void odf_lists_styles_context::set_bullet_image_size(double size)
{
if (size < 0.1) return;
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if (lists_format_array_.empty()) return;
if (lists_format_array_.back().elements.empty()) return ;
style_list_level_properties *props = get_list_level_properties();
if(!props) return;
props->fo_width_ = length(length(size,length::pt).get_value_unit(length::cm),length::cm);
props->fo_height_ = length(length(size,length::pt).get_value_unit(length::cm),length::cm);
props->fo_width_ = length(length(size, length::pt).get_value_unit(length::cm), length::cm);
props->fo_height_ = length(length(size, length::pt).get_value_unit(length::cm), length::cm);
}
void odf_lists_styles_context::set_bullet_image (std::wstring ref)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if (lists_format_array_.empty()) return;
if (lists_format_array_.back().elements.empty()) return ;
text_list_level_style_image *style_image_ = dynamic_cast<text_list_level_style_image *>(lists_format_array_.back().elements.back().get());
@ -557,14 +573,14 @@ void odf_lists_styles_context::set_bullet_image (std::wstring ref)
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.href_ = ref;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.type_= xlink_type::Simple;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.show_ = xlink_show::Embed;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.type_ = xlink_type::Simple;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.show_ = xlink_show::Embed;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
}
void odf_lists_styles_context::set_start_number(int val)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if (lists_format_array_.empty()) return;
if (lists_format_array_.back().elements.empty()) return ;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
@ -574,8 +590,8 @@ void odf_lists_styles_context::set_start_number(int val)
}
void odf_lists_styles_context::set_text_style_name(std::wstring name)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if (lists_format_array_.empty()) return;
if (lists_format_array_.back().elements.empty()) return ;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());

View File

@ -55,7 +55,7 @@ struct list_format_state
std::vector<office_element_ptr> elements;
std::wstring odf_list_style_name;
bool automatic;
};
class odf_lists_styles_context
@ -64,7 +64,7 @@ public:
odf_lists_styles_context();
void set_odf_context(odf_conversion_context * Context);
void start_style(int abstract_number);
void start_style(bool bMaster, int abstract_number = -1);
int start_style_level(int level, int type);
style_list_level_properties * get_list_level_properties();
style_list_level_label_alignment * get_list_level_alignment_properties();
@ -84,9 +84,9 @@ public:
void add_style(int oox_style_num, int oox_based_num);
void process_styles(office_element_ptr root );
void process_styles(office_element_ptr root, bool automatic);
std::wstring get_style_name(int oox_style_num);
std::wstring get_style_name(int oox_style_num = -1);
std::wstring get_style_name1(int oox_style_num);
private:
std::vector<list_format_state> lists_format_array_;

View File

@ -161,6 +161,7 @@ void odf_style_context::process_automatic_styles(office_element_ptr root )
if (/*it->automatic_== true && */style_state_list_[i]->root_== false && style_state_list_[i]->odf_style_)
root->add_child_element(style_state_list_[i]->odf_style_);
}
lists_styles_context_.process_styles(root, true);
}
void odf_style_context::process_office_styles(office_element_ptr root )
@ -175,7 +176,7 @@ void odf_style_context::process_office_styles(office_element_ptr root )
root->add_child_element(style_state_list_[i]->odf_style_);
}
lists_styles_context_.process_styles(root );
lists_styles_context_.process_styles(root, false);
}
std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_family::type family, bool root, bool automatic)
{

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

@ -56,7 +56,26 @@ odp_conversion_context::odp_conversion_context(package::odf_document * outputDoc
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this), text_context_(NULL)
{
}
odf_text_context* odp_conversion_context::text_context()
{
return text_context_;
}
odp_slide_context* odp_conversion_context::slide_context()
{
return &slide_context_;
}
odf_drawing_context* odp_conversion_context::drawing_context()
{
if (slide_context_.page_state_list_.empty()) return NULL;
return slide_context_.state().drawing_context();
}
odf_comment_context* odp_conversion_context::comment_context()
{
if (slide_context_.page_state_list_.empty()) return NULL;
return slide_context_.state().comment_context();
}
void odp_conversion_context::start_document()
{
@ -128,14 +147,7 @@ void odp_conversion_context::end_drawings()
{
current_slide().drawing_context()->clear();
}
void odp_conversion_context::start_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
current_slide().drawing_context()->start_image(odf_ref_name);
}
void odp_conversion_context::start_comment(int oox_comm_id)
{
office_element_ptr comm_elm;

View File

@ -64,16 +64,14 @@ public:
virtual void start_text_context();
virtual void end_text_context();
virtual odf_drawing_context * drawing_context() {return current_slide().drawing_context();}
virtual odf_text_context * text_context() {return text_context_; }
odp_slide_context * slide_context() {return &slide_context_;}
odf_comment_context * comment_context() {return current_slide().comment_context();}
virtual odf_drawing_context * drawing_context();
virtual odf_text_context * text_context();
odp_slide_context * slide_context();
odf_comment_context * comment_context();
void start_drawings();
void end_drawings();
virtual void start_image(const std::wstring & image_file_name);
void start_comment (int oox_comment_id);
void end_comment ();
void start_comment_content ();

View File

@ -527,14 +527,7 @@ void ods_conversion_context::end_drawings()
{
current_table().drawing_context()->clear();
}
void ods_conversion_context::start_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
current_table().drawing_context()->start_image(odf_ref_name);
}
double ods_conversion_context::convert_symbol_width(double val)
{
//width = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;

View File

@ -101,8 +101,6 @@ public:
void start_drawings();
void end_drawings();
virtual void start_image(const std::wstring & image_file_name);
double convert_symbol_width(double val);
void add_defined_range (const std::wstring & name, const std::wstring & cell_range, int sheet_id, bool printable = false);

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();
@ -915,14 +923,6 @@ void odt_conversion_context::end_change (int id, int type)
// return (text_changes_state_.current_types.back() == 2);
//}
//--------------------------------------------------------------------------------------------------------
void odt_conversion_context::start_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name, _mediaitems::typeImage,odf_ref_name);
drawing_context()->start_image(odf_ref_name);
}
void odt_conversion_context::start_drop_cap(style_paragraph_properties *paragraph_properties)
{

View File

@ -79,11 +79,11 @@ public:
odf_comment_context * comment_context();
odf_table_context * table_context();
odf_notes_context * notes_context();
void start_drawings ();
void end_drawings ();
virtual void start_image(const std::wstring & image_file_name);
void add_text_content (const std::wstring & text);
void add_text_content (const std::wstring & text);
void start_paragraph (bool styled = false);
void end_paragraph ();

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)

File diff suppressed because it is too large Load Diff

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
{
@ -263,6 +264,7 @@ namespace PPTX
class Theme;
namespace Logic
{
class Bullet;
class ClrMap;
class SpTreeElem;
class GraphicFrame;
@ -353,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;
@ -364,6 +367,7 @@ public:
void convert (double oox_font_size, _CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size);
bool convert (std::wstring sSchemeColor, DWORD & argb);
void convert_font(PPTX::Theme *theme, std::wstring & font);
//.......................................................................................................................
void convert(OOX::WritingElement *oox_unknown);
//drawingML & pptx................................................................................................................................
@ -402,10 +406,16 @@ public:
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvGrpSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties * text_properties);
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
void convert(PPTX::Logic::TextListStyle *oox_list_style);
void convert_list_level (PPTX::Logic::TextParagraphPr *oox_para_props, int level);
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::Run *oox_run);
void convert(PPTX::Logic::Fld *oox_fld);
void convert(PPTX::Logic::Br *oox_br);
@ -502,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;
@ -3049,7 +3094,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
int type_list = odt_context->styles_context()->lists_styles().start_style_level(oox_num_lvl->m_oIlvl->GetValue(), oox_type_list );
if (type_list < 0) return;
odf_writer::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
odf_writer::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
odf_writer::style_list_level_label_alignment * aligment_props = odt_context->styles_context()->lists_styles().get_list_level_alignment_properties();
if (level_props == NULL)return;
@ -3101,8 +3146,8 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
}
}else
{
aligment_props->fo_text_indent_ = odf_types::length(0,odf_types::length::cm);
aligment_props->fo_margin_left_ = odf_types::length(0,odf_types::length::cm);
aligment_props->fo_text_indent_ = odf_types::length(0, odf_types::length::cm);
aligment_props->fo_margin_left_ = odf_types::length(0, odf_types::length::cm);
}
}
@ -3114,7 +3159,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
convert(oox_num_lvl->m_oRPr.GetPointer(), text_props);
//create text style for symbols list НА ЛОКАЛЬНОМ контексте - иначе пересечение имен стилей (todoo вытащить генерацию имен в общую часть)
styles_context->create_style(L"",odf_types::style_family::Text, false, true, -1);
styles_context->create_style(L"", odf_types::style_family::Text, false, true, -1);
odf_writer::odf_style_state_ptr style_state = styles_context->last_state(odf_types::style_family::Text);
if (style_state)
{
@ -3184,7 +3229,9 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
}
if (type_list == 2 || type_list == 3)
{
odt_context->styles_context()->lists_styles().set_bullet_image_size(size_bullet_number_marker);
}
if (oox_num_lvl->m_oLvlRestart.IsInit() && oox_num_lvl->m_oLvlRestart->m_oVal.IsInit() && type_list == 1)
{

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;
@ -219,21 +231,20 @@ void PptxConverter::convert_styles()
odf_writer::style_paragraph_properties * paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
odf_writer::style_text_properties * text_properties = odp_context->styles_context()->last_state()->get_text_properties();
if (text_properties)
if (presentation->defaultTextStyle.IsInit())
{
text_properties->content_.fo_font_size_ = odf_types::font_size(odf_types::length(18, odf_types::length::pt));
}
if (slide->theme.IsInit() && text_properties)
{
if (slide->theme->themeElements.fontScheme.majorFont.latin.typeface.empty() == false)
text_properties->content_.fo_font_family_ = slide->theme->themeElements.fontScheme.majorFont.latin.typeface;
if (slide->theme->themeElements.fontScheme.majorFont.cs.typeface.empty() == false)
text_properties->content_.style_font_family_complex_ = slide->theme->themeElements.fontScheme.majorFont.cs.typeface;
OoxConverter::convert(presentation->defaultTextStyle->levels[9].GetPointer(), paragraph_properties, text_properties); //defPPr
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
if (slide->theme->themeElements.fontScheme.majorFont.ea.typeface.empty() == false)
text_properties->content_.style_font_family_asian_ = slide->theme->themeElements.fontScheme.majorFont.ea.typeface;
odp_context->styles_context()->create_default_style(odf_types::style_family::Paragraph);
paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
odp_context->styles_context()->create_default_style(odf_types::style_family::Text);
text_properties = odp_context->styles_context()->last_state()->get_text_properties();
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
}
//convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков
@ -260,6 +271,8 @@ void PptxConverter::convert_styles()
odp_context->page_layout_context()->create_layer_sets();
}
void PptxConverter::convert_settings()
{
@ -302,20 +315,31 @@ void PptxConverter::convert_slides()
std::wstring master_style_name;
std::wstring layout_style_name;
bool bShow = slide->show.get_value_or(true);
bool bShowMasterAnim = slide->showMasterPhAnim.get_value_or(true);
bool bShowMasterSp = slide->showMasterSp.get_value_or(true);
PPTX::Logic::TxStyles* current_txStyles = NULL;
if (slide->Master.IsInit())
{
current_clrMap = &slide->Master->clrMap;
current_txStyles = slide->Master->txStyles.GetPointer();
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename);
std::wstring master_name = (bShowMasterSp ? slide->Master->m_sOutputFilename : L"") + slide->Layout->m_sOutputFilename;
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(master_name);
if (pFind == m_mapMasters.end())
{
master_style_name = L"MasterPage";
bool bShowLayoutMasterAnim = slide->Layout->showMasterPhAnim.get_value_or(true);
bool bShowLayoutMasterSp = slide->Layout->showMasterSp.get_value_or(true);
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get();
else if (current_theme->name.IsInit()) master_style_name = current_theme->name.get();
master_style_name += L"_" ;
if (slide->Layout->cSld.attrName.IsInit()) master_style_name += slide->Layout->cSld.attrName.get();
else if (slide->Layout->attrType.IsInit()) master_style_name += slide->Layout->attrType->get();
else
@ -323,18 +347,23 @@ void PptxConverter::convert_slides()
odp_context->start_master_slide(master_style_name);
convert_common();
//if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
{
current_slide = slide->Master.operator->();
convert_slide(&slide->Master->cSld, current_txStyles, false);
}
current_slide = slide->Master.operator->();
if (bShowLayoutMasterSp && bShowMasterSp)
convert_slide(&slide->Master->cSld, current_txStyles, false, true);
else
convert(slide->Master->cSld.bg.GetPointer());
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, 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(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename, master_style_name));
m_mapMasters.insert(std::make_pair(master_name, master_style_name));
}
else
{
@ -369,11 +398,8 @@ void PptxConverter::convert_slides()
odp_context->current_slide().set_master_page (master_style_name);
odp_context->current_slide().set_layout_page (layout_style_name);
//nullable_bool show;
//nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp;
convert_slide (slide->cSld.GetPointer(), current_txStyles, true);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp);
convert (slide->comments.operator->());
convert (slide->Note.operator->());
@ -929,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;
@ -940,56 +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);
}
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();
pShape->Merge(update_shape);
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());
}
@ -1017,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)
@ -1748,236 +1759,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_po
if (oox_from_to->m_oColOff.IsInit()) pos->col_off = oox_from_to->m_oColOff->GetValue();//pt
}
//void XlsxConverter::convert(OOX::Spreadsheet::CGroupShape* oox_group_shape)
//{
// if (!oox_group_shape)return;
// if (oox_group_shape->m_arrItems.size() < 1) return;
//
// ods_context->drawing_context()->start_group();
//
// if (oox_group_shape->m_oNvGroupSpPr.IsInit())
// {
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr.IsInit())
// {
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
// ods_context->drawing_context()->set_group_name(*oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName);
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
// ods_context->drawing_context()->set_group_z_order(oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
// }
// }
//
// OoxConverter::convert(oox_group_shape->m_oGroupSpPr.GetPointer());
//
// for (unsigned int i=0; i < oox_group_shape->m_arrItems.size(); i++)
// {
// switch(oox_group_shape->m_arrItems[i]->getType())
// {
// case OOX::et_x_Shape:
// {
// OOX::Spreadsheet::CShape* item = dynamic_cast<OOX::Spreadsheet::CShape*>(oox_group_shape->m_arrItems[i]);
// convert(item);
// }break;
// case OOX::et_x_ConnShape:
// {
// OOX::Spreadsheet::CConnShape* item = dynamic_cast<OOX::Spreadsheet::CConnShape*>(oox_group_shape->m_arrItems[i]);
// convert(item);
// }break;
// case OOX::et_x_GroupShape:
// {
// OOX::Spreadsheet::CGroupShape* item = dynamic_cast<OOX::Spreadsheet::CGroupShape*>(oox_group_shape->m_arrItems[i]);
// convert(item);
// }break;
// case OOX::et_x_Pic:
// {
// OOX::Spreadsheet::CPic* item = dynamic_cast<OOX::Spreadsheet::CPic*>(oox_group_shape->m_arrItems[i]);
// convert(item);
// }break;
// }
// }
// ods_context->drawing_context()->end_group();
//}
//
//void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape)
//{
// if (!oox_shape)return;
// if (!oox_shape->m_oSpPr.IsInit()) return;
//
// ods_context->drawing_context()->start_drawing();
//
// int type = -1;
// if (oox_shape->m_oSpPr->m_oCustGeom.IsInit())
// {
// type = 1000;//6???
// }
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
// {
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
// type =(geometry->m_oPrst.GetValue());
// }
//
// if ((oox_shape->m_oNvSpPr.IsInit()) && (oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit()))
// {
// if (oox_shape->m_oNvSpPr->m_oCNvSpPr->m_otxBox.GetValue() == 1)
// type = 2000; //textBox
// }
//
// if (type < 0)return;
///////////////////////////////////////////////////////////////////////////////////
// if (type == 2000) ods_context->drawing_context()->start_text_box();
// else ods_context->drawing_context()->start_shape(type);
//
// {
// OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
//
// if (oox_shape->m_oNvSpPr.IsInit())
// {
// OoxConverter::convert(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer()); //имя, описалово, номер ...
// convert(oox_shape->m_oNvSpPr->m_oCNvSpPr.GetPointer()); //заблокированности ... todooo
// }
// if (oox_shape->m_oShapeStyle.IsInit())
// {
// //доп эффекты
//
// }
// if (oox_shape->m_oTxBody.IsInit())
// {
// ods_context->start_text_context();
// OoxConverter::convert(oox_shape->m_oTxBody->m_oBodyPr.GetPointer());
//
// for (unsigned int i=0 ; i < oox_shape->m_oTxBody->m_arrItems.size();i++)
// {
// OoxConverter::convert(oox_shape->m_oTxBody->m_arrItems[i]);
// }
// ods_context->drawing_context()->set_text( ods_context->text_context());
// ods_context->end_text_context();
//
// }
// }
// if (type == 2000)ods_context->drawing_context()->end_text_box();
// else ods_context->drawing_context()->end_shape();
//
// ods_context->drawing_context()->end_drawing();
//
//}
//
//void XlsxConverter::convert(OOX::Spreadsheet::CConnShape* oox_shape)
//{
// if (!oox_shape)return;
// if (!oox_shape->m_oSpPr.IsInit()) return;
//
// ods_context->drawing_context()->start_drawing();
//
// int type = -1;
// if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypeCustom)
// {
// type = 1000;//?????
// }
// else if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypePreset)
// {
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
// {
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
// type = (int)(geometry->m_oPrst.GetValue());
// }
// }
// if (type < 0)return;
////////////////////////////////////////////////////////////////////////////////
// ods_context->drawing_context()->start_shape(type);
// {
// OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
//
// //частенько приплывает из стиля заполенение объекта .. а он то одномерный :)
// odf_context()->drawing_context()->start_area_properties();
// odf_context()->drawing_context()->set_no_fill();
// odf_context()->drawing_context()->end_area_properties();
//
// if (oox_shape->m_oNvConnSpPr.IsInit())
// {
// if (oox_shape->m_oNvConnSpPr->m_oCNvPr.IsInit())
// {
// OoxConverter::convert(oox_shape->m_oNvConnSpPr->m_oCNvPr.GetPointer());
// }
//
// if (oox_shape->m_oNvConnSpPr->m_oCNvConnSpPr.IsInit())
// {
// }
// }
// //avLst
// }
// ods_context->drawing_context()->end_shape();
// ods_context->drawing_context()->end_drawing();
//}
//
//
//void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
//{
// if (!oox_picture)return;
// if (!oox_picture->m_oBlipFill.IsInit()) return; // невeрная структура оох
//
// ods_context->drawing_context()->start_drawing();
//
// std::wstring pathImage;
// double Width=0, Height = 0;
//
// if (oox_picture->m_oBlipFill->m_oBlip.IsInit())
// {
// std::wstring sID = oox_picture->m_oBlipFill->m_oBlip->m_oEmbed.GetValue();
// pathImage = find_link_by_id(sID,1);
//
// if (pathImage.empty())
// {
// sID = oox_picture->m_oBlipFill->m_oBlip->m_oLink.GetValue();
// //???
// }
// _graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
// }
// ods_context->start_image(pathImage);
// {
// if (oox_picture->m_oBlipFill->m_oTile.IsInit())
// {
// ods_context->drawing_context()->set_image_style_repeat(2);
// }
// if (oox_picture->m_oBlipFill->m_oStretch.IsInit())
// {
// ods_context->drawing_context()->set_image_style_repeat(1);
// }
// if (oox_picture->m_oBlipFill->m_oSrcRect.IsInit() && Width >0 && Height >0)
// {
// ods_context->drawing_context()->set_image_client_rect_inch(
// oox_picture->m_oBlipFill->m_oSrcRect->m_oL.GetValue()/100. * Width / currentSystemDPI ,
// oox_picture->m_oBlipFill->m_oSrcRect->m_oT.GetValue()/100. * Height / currentSystemDPI ,
// oox_picture->m_oBlipFill->m_oSrcRect->m_oR.GetValue()/100. * Width / currentSystemDPI ,
// oox_picture->m_oBlipFill->m_oSrcRect->m_oB.GetValue()/100. * Height / currentSystemDPI );
// }
// if (oox_picture->m_oNvPicPr.IsInit())
// {
// OoxConverter::convert(oox_picture->m_oNvPicPr->m_oCNvPr.GetPointer());
//
// if (oox_picture->m_oNvPicPr->m_oCNvPicPr.IsInit())
// {
// if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks.IsInit())
// {
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoChangeAspect)
// //{
// //}
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoCrop))
// //{
// //}
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoResize)
// //{
// //}
// }
// //m_oExtLst
// }
// }
//
// OoxConverter::convert(oox_picture->m_oSpPr.GetPointer(), oox_picture->m_oShapeStyle.GetPointer());
//
// }
// ods_context->drawing_context()->end_image();
// ods_context->drawing_context()->end_drawing();
//}
//
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt)
{
if (!oox_cond_fmt)return;

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

@ -437,7 +437,6 @@ namespace PPTX
pWriter->EndRecord();
}
void Shape::FillLevelUp()
{
if ((m_pLevelUp == NULL) && (nvSpPr.nvPr.ph.IsInit()))
@ -452,6 +451,16 @@ namespace PPTX
}
}
bool Shape::IsListStyleEmpty()
{
if ((m_pLevelUp) && (m_pLevelUp->IsListStyleEmpty() == false)) return false;
if (txBody.IsInit() == false) return true;
if (txBody->lstStyle.IsInit() == false) return true;
return txBody->lstStyle->IsListStyleEmpty();
}
void Shape::Merge(Shape& shape, bool bIsSlidePlaceholder)
{
if (m_pLevelUp)

View File

@ -303,6 +303,7 @@ namespace PPTX
void FillLevelUp();
void Merge(Shape& shape, bool bIsSlidePlaceholder = false);
bool IsListStyleEmpty();
void SetLevelUpElement( Shape* p){m_pLevelUp = p;};

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)

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