mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
17 Commits
core-windo
...
core/devel
| Author | SHA1 | Date | |
|---|---|---|---|
| fecefb672d | |||
| f91e030836 | |||
| d0591483bc | |||
| 729f9f246f | |||
| 17a6ba735b | |||
| de22fb4737 | |||
| 751774419e | |||
| 8278609f10 | |||
| 445eedc7a3 | |||
| ed7661b93c | |||
| a17a04298a | |||
| f7ba686f0c | |||
| c41385e1ae | |||
| f582a9b690 | |||
| b36c2dbaf9 | |||
| 10b9e9e5e8 | |||
| 1beb5440f9 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -43,3 +43,4 @@ OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
|
||||
*.pdb
|
||||
*.tlb
|
||||
*.idb
|
||||
**/.hg
|
||||
|
||||
@ -3801,19 +3801,228 @@ public:
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
CFldSimple* pFldSimple = static_cast<CFldSimple*>(poResult);
|
||||
if ( c_oSer_HyperlinkType::Link == type )
|
||||
if ( c_oSer_FldSimpleType::Instr == type )
|
||||
pFldSimple->sInstr = m_oBufferedStream.GetString3(length);
|
||||
else if ( c_oSer_HyperlinkType::Content == type )
|
||||
else if ( c_oSer_FldSimpleType::Content == type )
|
||||
{
|
||||
XmlUtils::CStringWriter* pPrevWriter = m_pCurWriter;
|
||||
m_pCurWriter = &pFldSimple->writer;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, NULL);
|
||||
m_pCurWriter = pPrevWriter;
|
||||
}
|
||||
else if ( c_oSer_FldSimpleType::FFData == type )
|
||||
{
|
||||
OOX::Logic::CFFData oFFData;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFData, this, &oFFData);
|
||||
pFldSimple->writer.WriteString(oFFData.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFData(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFData* pFFData = static_cast<OOX::Logic::CFFData*>(poResult);
|
||||
if ( c_oSerFFData::CalcOnExit == type )
|
||||
{
|
||||
pFFData->m_oCalcOnExit.Init();
|
||||
pFFData->m_oCalcOnExit->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CheckBox == type )
|
||||
{
|
||||
pFFData->m_oCheckBox.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFCheckBox, this, pFFData->m_oCheckBox.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::DDList == type )
|
||||
{
|
||||
pFFData->m_oDDList.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDDList, this, pFFData->m_oDDList.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::Enabled == type )
|
||||
{
|
||||
pFFData->m_oEnabled.Init();
|
||||
pFFData->m_oEnabled->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::EntryMacro == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oEntryMacro.Init();
|
||||
pFFData->m_oEntryMacro->m_oVal.Init();
|
||||
pFFData->m_oEntryMacro->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::ExitMacro == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oExitMacro.Init();
|
||||
pFFData->m_oExitMacro->m_oVal.Init();
|
||||
pFFData->m_oExitMacro->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::HelpText == type )
|
||||
{
|
||||
pFFData->m_oHelpText.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFHelpText, this, pFFData->m_oHelpText.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::Label == type )
|
||||
{
|
||||
pFFData->m_oLabel.Init();
|
||||
pFFData->m_oLabel->m_oVal.Init();
|
||||
pFFData->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::Name == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oName.Init();
|
||||
pFFData->m_oName->m_oVal.Init();
|
||||
pFFData->m_oName->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::StatusText == type )
|
||||
{
|
||||
pFFData->m_oStatusText.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFStatusText, this, pFFData->m_oStatusText.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::TabIndex == type )
|
||||
{
|
||||
pFFData->m_oTabIndex.Init();
|
||||
pFFData->m_oTabIndex->m_oVal.Init();
|
||||
pFFData->m_oTabIndex->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::TextInput == type )
|
||||
{
|
||||
pFFData->m_oTextInput.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadTextInput, this, pFFData->m_oTextInput.GetPointer());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFCheckBox(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFCheckBox* pFFCheckBox = static_cast<OOX::Logic::CFFCheckBox*>(poResult);
|
||||
if ( c_oSerFFData::CBChecked == type )
|
||||
{
|
||||
pFFCheckBox->m_oChecked.Init();
|
||||
pFFCheckBox->m_oChecked->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CBDefault == type )
|
||||
{
|
||||
pFFCheckBox->m_oDefault.Init();
|
||||
pFFCheckBox->m_oDefault->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CBSize == type )
|
||||
{
|
||||
pFFCheckBox->m_oSize.Init();
|
||||
pFFCheckBox->m_oSize->m_oVal.Init();
|
||||
pFFCheckBox->m_oSize->m_oVal->FromHps(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if ( c_oSerFFData::CBSizeAuto == type )
|
||||
{
|
||||
pFFCheckBox->m_oSizeAuto.Init();
|
||||
pFFCheckBox->m_oSizeAuto->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadDDList(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFDDList* pDDList = static_cast<OOX::Logic::CFFDDList*>(poResult);
|
||||
if ( c_oSerFFData::DLDefault == type )
|
||||
{
|
||||
pDDList->m_oDefault.Init();
|
||||
pDDList->m_oDefault->m_oVal.Init();
|
||||
pDDList->m_oDefault->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::DLResult == type )
|
||||
{
|
||||
pDDList->m_oResult.Init();
|
||||
pDDList->m_oResult->m_oVal.Init();
|
||||
pDDList->m_oResult->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::DLListEntry == type )
|
||||
{
|
||||
ComplexTypes::Word::String* pVal = new ComplexTypes::Word::String();
|
||||
pVal->m_sVal.Init();
|
||||
pVal->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
pDDList->m_arrListEntry.push_back(pVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFHelpText(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
ComplexTypes::Word::CFFHelpText* pHelpText = static_cast<ComplexTypes::Word::CFFHelpText*>(poResult);
|
||||
if ( c_oSerFFData::HTType == type )
|
||||
{
|
||||
pHelpText->m_oType.Init();
|
||||
pHelpText->m_oType->SetValue((SimpleTypes::EInfoTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if ( c_oSerFFData::HTVal == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pHelpText->m_oVal.Init();
|
||||
pHelpText->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFStatusText(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
ComplexTypes::Word::CFFStatusText* pStatusText = static_cast<ComplexTypes::Word::CFFStatusText*>(poResult);
|
||||
if ( c_oSerFFData::HTType == type )
|
||||
{
|
||||
pStatusText->m_oType.Init();
|
||||
pStatusText->m_oType->SetValue((SimpleTypes::EInfoTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if ( c_oSerFFData::HTVal == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pStatusText->m_oVal.Init();
|
||||
pStatusText->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadTextInput(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFTextInput* pTextInput = static_cast<OOX::Logic::CFFTextInput*>(poResult);
|
||||
if ( c_oSerFFData::TIDefault == type )
|
||||
{
|
||||
pTextInput->m_oDefault.Init();
|
||||
pTextInput->m_oDefault->m_sVal.Init();
|
||||
pTextInput->m_oDefault->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerFFData::TIFormat == type )
|
||||
{
|
||||
pTextInput->m_oFormat.Init();
|
||||
pTextInput->m_oFormat->m_sVal.Init();
|
||||
pTextInput->m_oFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerFFData::TIMaxLength == type )
|
||||
{
|
||||
pTextInput->m_oMaxLength.Init();
|
||||
pTextInput->m_oMaxLength->m_oVal.Init();
|
||||
pTextInput->m_oMaxLength->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::TIType == type )
|
||||
{
|
||||
pTextInput->m_oType.Init();
|
||||
pTextInput->m_oType->m_oVal.Init();
|
||||
pTextInput->m_oType->m_oVal->SetValue((SimpleTypes::EFFTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
|
||||
int ReadHyperlink(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
|
||||
@ -912,7 +912,8 @@ extern int g_nCurFormatVersion;
|
||||
namespace c_oSer_FldSimpleType{ enum c_oSer_FldSimpleType
|
||||
{
|
||||
Content = 0,
|
||||
Instr = 1
|
||||
Instr = 1,
|
||||
FFData = 2
|
||||
};}
|
||||
namespace c_oSer_ColorThemeType{ enum c_oSer_ColorThemeType
|
||||
{
|
||||
@ -1044,6 +1045,34 @@ extern int g_nCurFormatVersion;
|
||||
Temporary = 34,
|
||||
MultiLine = 35
|
||||
};}
|
||||
namespace c_oSerFFData{enum c_oSerFFData
|
||||
{
|
||||
CalcOnExit = 0,
|
||||
CheckBox = 1,
|
||||
DDList = 2,
|
||||
Enabled = 3,
|
||||
EntryMacro = 4,
|
||||
ExitMacro = 5,
|
||||
HelpText = 6,
|
||||
Label = 7,
|
||||
Name = 8,
|
||||
StatusText = 9,
|
||||
TabIndex = 10,
|
||||
TextInput = 11,
|
||||
CBChecked = 12,
|
||||
CBDefault = 13,
|
||||
CBSize = 14,
|
||||
CBSizeAuto = 15,
|
||||
DLDefault = 16,
|
||||
DLResult = 17,
|
||||
DLListEntry = 18,
|
||||
HTType = 19,
|
||||
HTVal = 20,
|
||||
TIDefault = 21,
|
||||
TIFormat = 22,
|
||||
TIMaxLength = 23,
|
||||
TIType = 24,
|
||||
};}
|
||||
}
|
||||
|
||||
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
|
||||
|
||||
@ -3321,11 +3321,208 @@ namespace BinDocxRW
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::Instr);
|
||||
m_oBcw.m_oStream.WriteStringW3(*pFldSimple->m_sInstr);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
//FFData
|
||||
if(pFldSimple->m_oFFData.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::FFData);
|
||||
WriteFFData(pFldSimple->m_oFFData.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//Content
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::Content);
|
||||
WriteParagraphContent(pFldSimple->m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
void WriteFFData(const OOX::Logic::CFFData& oFFData)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oFFData.m_oCalcOnExit.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CalcOnExit);
|
||||
m_oBcw.m_oStream.WriteBOOL(oFFData.m_oCalcOnExit->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oCheckBox.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CheckBox);
|
||||
WriteFFCheckBox(oFFData.m_oCheckBox.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oDDList.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DDList);
|
||||
WriteDDList(oFFData.m_oDDList.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oEnabled.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Enabled);
|
||||
m_oBcw.m_oStream.WriteBOOL(oFFData.m_oEnabled->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oEntryMacro.IsInit() && oFFData.m_oEntryMacro->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::EntryMacro);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oEntryMacro->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oExitMacro.IsInit() && oFFData.m_oExitMacro->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::ExitMacro);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oExitMacro->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oHelpText.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HelpText);
|
||||
WriteFFHelpText(oFFData.m_oHelpText.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oLabel.IsInit() && oFFData.m_oLabel->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Label);
|
||||
m_oBcw.m_oStream.WriteLONG(oFFData.m_oLabel->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oName.IsInit() && oFFData.m_oName->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Name);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oName->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oStatusText.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::StatusText);
|
||||
WriteFFStatusText(oFFData.m_oStatusText.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oTabIndex.IsInit() && oFFData.m_oTabIndex->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TabIndex);
|
||||
m_oBcw.m_oStream.WriteLONG(oFFData.m_oTabIndex->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oTextInput.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TextInput);
|
||||
WriteTextInput(oFFData.m_oTextInput.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteFFCheckBox(const OOX::Logic::CFFCheckBox& oCheckBox)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oCheckBox.m_oChecked.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBChecked);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oChecked->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oDefault.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBDefault);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oDefault->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oSize.IsInit() && oCheckBox.m_oSize->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBSize);
|
||||
m_oBcw.m_oStream.WriteULONG(oCheckBox.m_oSize->m_oVal->ToHps());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oSizeAuto.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBSizeAuto);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oSizeAuto->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteDDList(const OOX::Logic::CFFDDList& oDDList)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDDList.m_oDefault.IsInit() && oDDList.m_oDefault->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLDefault);
|
||||
m_oBcw.m_oStream.WriteLONG(oDDList.m_oDefault->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oDDList.m_oResult.IsInit() && oDDList.m_oResult->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLResult);
|
||||
m_oBcw.m_oStream.WriteLONG(oDDList.m_oResult->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
for(int i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
|
||||
{
|
||||
ComplexTypes::Word::String* pVal = oDDList.m_arrListEntry[i];
|
||||
if(pVal->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLListEntry);
|
||||
m_oBcw.m_oStream.WriteStringW3(pVal->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteFFHelpText(const ComplexTypes::Word::CFFHelpText& oHelpText)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oHelpText.m_oType.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oHelpText.m_oType->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oHelpText.m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTVal);
|
||||
m_oBcw.m_oStream.WriteStringW3(oHelpText.m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteFFStatusText(const ComplexTypes::Word::CFFStatusText& oStatusText)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oStatusText.m_oType.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oStatusText.m_oType->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oStatusText.m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTVal);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStatusText.m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteTextInput(const OOX::Logic::CFFTextInput& oTextInput)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oTextInput.m_oDefault.IsInit() && oTextInput.m_oDefault->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIDefault);
|
||||
m_oBcw.m_oStream.WriteStringW3(oTextInput.m_oDefault->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oFormat.IsInit() && oTextInput.m_oFormat->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIFormat);
|
||||
m_oBcw.m_oStream.WriteStringW3(oTextInput.m_oFormat->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oMaxLength.IsInit() && oTextInput.m_oMaxLength->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIMaxLength);
|
||||
m_oBcw.m_oStream.WriteLONG(oTextInput.m_oMaxLength->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oType.IsInit() && oTextInput.m_oType->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oTextInput.m_oType->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteHyperlink(OOX::Logic::CHyperlink* pHyperlink)
|
||||
{
|
||||
|
||||
@ -132,7 +132,7 @@ void pptx_conversion_context::process_layouts()
|
||||
type == odf_types::presentation_class::header ||
|
||||
type == odf_types::presentation_class::page_number)
|
||||
{
|
||||
if (frame->idx_in_owner <0)
|
||||
if (frame->idx_in_owner < 0)
|
||||
frame->idx_in_owner = last_idx_placeHolder++;
|
||||
|
||||
frame->pptx_convert_placeHolder(*this);
|
||||
|
||||
@ -58,6 +58,7 @@ const wchar_t * anim_par::name = L"par";
|
||||
|
||||
void anim_par::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void anim_par::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
@ -98,6 +99,7 @@ const wchar_t * anim_seq::name = L"seq";
|
||||
|
||||
void anim_seq::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void anim_seq::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
@ -211,11 +213,11 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
case smil_transition_type::checkerBoardWipe:
|
||||
type = L"checker";
|
||||
if (attlist_.smil_subtype_.get()==L"across") dir = L"horz";
|
||||
if (attlist_.smil_subtype_.get()==L"down") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"down") dir = L"vert";
|
||||
break;
|
||||
case smil_transition_type::blindsWipe:
|
||||
type = L"blinds";
|
||||
if (attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
|
||||
break;
|
||||
case smil_transition_type::diagonalWipe:
|
||||
@ -223,9 +225,9 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
type = L"strips";
|
||||
if (attlist_.smil_subtype_)
|
||||
{
|
||||
if (attlist_.smil_subtype_.get() == L"horizontalLeft") dir = L"rd";
|
||||
if (attlist_.smil_subtype_.get() == L"horizontalLeft") dir = L"rd";
|
||||
else if (attlist_.smil_subtype_.get() == L"horizontalRight") dir = L"lu";
|
||||
else if (attlist_.smil_subtype_.get() == L"verticalRight") dir = L"ld";
|
||||
else if (attlist_.smil_subtype_.get() == L"verticalRight") dir = L"ld";
|
||||
else dir = L"ru";
|
||||
}
|
||||
break;
|
||||
@ -235,11 +237,11 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
case smil_transition_type::randomBarWipe:
|
||||
type = L"randomBar";
|
||||
if (attlist_.smil_subtype_.get() == L"vertical") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get() == L"horizontal")dir = L"horz";
|
||||
if (attlist_.smil_subtype_.get() == L"horizontal") dir = L"horz";
|
||||
break;
|
||||
case smil_transition_type::pushWipe:
|
||||
type = L"push";
|
||||
if (attlist_.smil_subtype_.get()==L"combVertical") {type = L"comb"; dir = L"vert";};
|
||||
if (attlist_.smil_subtype_.get()==L"combVertical") {type = L"comb"; dir = L"vert";};
|
||||
if (attlist_.smil_subtype_.get()==L"combHorizontal") {type = L"comb"; dir = L"horz";};
|
||||
break;
|
||||
case smil_transition_type::slideWipe:
|
||||
@ -250,7 +252,7 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
case smil_transition_type::barnDoorWipe:
|
||||
type = L"split";
|
||||
if (attlist_.smil_subtype_.get()==L"vertical") param = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"vertical") param = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"horizontal") param = L"horz";
|
||||
break;
|
||||
case smil_transition_type::barWipe:
|
||||
@ -298,15 +300,15 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
if (attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
|
||||
if (attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
|
||||
if (attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
|
||||
|
||||
if (attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
|
||||
if (attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
|
||||
if (attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
|
||||
if (attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
|
||||
if (attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
|
||||
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomLeft") dir = L"ru";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomLeft")dir = L"ru";
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";
|
||||
|
||||
|
||||
@ -41,8 +41,13 @@ namespace cpdoccore { namespace odf_types {
|
||||
|
||||
std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
|
||||
{
|
||||
// 5ms = 5 milliseconds
|
||||
_Wostream << _Val.get_value() << "ms"; // todoooo усложнить ..
|
||||
// 5ms = 5 milliseconds
|
||||
if (_Val.get_value() < 0)
|
||||
_Wostream << L"indefinite";
|
||||
else
|
||||
{
|
||||
_Wostream << _Val.get_value() << "ms"; // todoooo усложнить ..
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
@ -120,15 +125,20 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
|
||||
}
|
||||
clockvalue clockvalue::parse(const std::wstring & Str)
|
||||
{
|
||||
int v=0;
|
||||
if (Str == L"indefinite")
|
||||
return clockvalue(-1);
|
||||
else
|
||||
{
|
||||
int v=0;
|
||||
|
||||
int ms=0;
|
||||
double h=0,m=0,s =0;
|
||||
bool res = parseTime(Str,h,m,s,ms);
|
||||
int ms=0;
|
||||
double h=0,m=0,s =0;
|
||||
bool res = parseTime(Str,h,m,s,ms);
|
||||
|
||||
v = (((h*60)+m)*60+s)*1000+ms;
|
||||
v = (((h*60)+m)*60+s)*1000+ms;
|
||||
|
||||
return clockvalue(v);
|
||||
return clockvalue(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -804,28 +804,32 @@ void common_presentation_attlist::serialize(CP_ATTR_NODE)
|
||||
|
||||
void common_anim_smil_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"smil:direction", smil_direction_);
|
||||
CP_APPLY_ATTR(L"smil:subtype", smil_subtype_);
|
||||
CP_APPLY_ATTR(L"smil:type", smil_type_);
|
||||
CP_APPLY_ATTR(L"smil:dur", smil_dur_);
|
||||
CP_APPLY_ATTR(L"presentation:node-type", presentation_node_type_);
|
||||
CP_APPLY_ATTR(L"smil:direction", smil_direction_);
|
||||
CP_APPLY_ATTR(L"smil:begin", smil_begin_);
|
||||
CP_APPLY_ATTR(L"smil:end", smil_end_);
|
||||
CP_APPLY_ATTR(L"smil:restart", smil_restart_);
|
||||
CP_APPLY_ATTR(L"smil:dur", smil_dur_);
|
||||
|
||||
}
|
||||
void common_anim_smil_attlist::apply_from(const common_anim_smil_attlist & Other)
|
||||
{
|
||||
_CP_APPLY_PROP(presentation_node_type_, Other.presentation_node_type_);
|
||||
|
||||
_CP_APPLY_PROP(smil_direction_, Other.smil_direction_);
|
||||
_CP_APPLY_PROP(smil_subtype_, Other.smil_subtype_);
|
||||
_CP_APPLY_PROP(smil_type_, Other.smil_type_);
|
||||
_CP_APPLY_PROP(smil_begin_, Other.smil_begin_);
|
||||
_CP_APPLY_PROP(smil_end_, Other.smil_end_);
|
||||
_CP_APPLY_PROP(smil_restart_, Other.smil_restart_);
|
||||
_CP_APPLY_PROP(smil_dur_, Other.smil_dur_);
|
||||
}
|
||||
void common_anim_smil_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"smil:direction", smil_direction_);
|
||||
CP_XML_ATTR_OPT(L"smil:subtype", smil_subtype_);
|
||||
CP_XML_ATTR_OPT(L"smil:type", smil_type_);
|
||||
CP_XML_ATTR_OPT(L"smil:restart", smil_restart_);
|
||||
CP_XML_ATTR_OPT(L"smil:dur", smil_dur_);
|
||||
CP_XML_ATTR_OPT(L"presentation:node-type", presentation_node_type_);
|
||||
CP_XML_ATTR_OPT(L"smil:begin", smil_begin_);
|
||||
CP_XML_ATTR_OPT(L"smil:end", smil_end_);
|
||||
}
|
||||
void union_common_draw_attlists::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
|
||||
@ -577,17 +577,14 @@ public:
|
||||
void apply_from (const common_anim_smil_attlist & Other);
|
||||
void serialize (CP_ATTR_NODE);
|
||||
|
||||
_CP_OPT(std::wstring) presentation_node_type_;
|
||||
_CP_OPT(std::wstring) smil_direction_;
|
||||
_CP_OPT(std::wstring) smil_restart_;
|
||||
_CP_OPT(std::wstring) smil_subtype_;
|
||||
_CP_OPT(std::wstring) smil_type_;
|
||||
_CP_OPT(std::wstring) smil_dur_;
|
||||
_CP_OPT(std::wstring) presentation_node_type_;
|
||||
|
||||
_CP_OPT(std::wstring) smil_begin_;
|
||||
|
||||
_CP_OPT(color) smil_fadeColor;
|
||||
_CP_OPT(std::wstring) smil_direction_;
|
||||
_CP_OPT(std::wstring) smil_restart_;
|
||||
_CP_OPT(odf_types::clockvalue) smil_dur_;
|
||||
|
||||
_CP_OPT(std::wstring) smil_begin_;
|
||||
_CP_OPT(std::wstring) smil_end_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -41,47 +41,47 @@ std::wostream & operator << (std::wostream & _Wostream, const smil_transition_ty
|
||||
{
|
||||
switch(_Val.get_type())
|
||||
{
|
||||
case smil_transition_type::barWipe : _Wostream << L"barwipe" ; break;
|
||||
case smil_transition_type::boxWipe : _Wostream << L"boxwipe" ; break;
|
||||
case smil_transition_type::fourBoxWipe : _Wostream << L"fourboxwipe" ; break;
|
||||
case smil_transition_type::barnDoorWipe : _Wostream << L"barndoorwipe" ; break;
|
||||
case smil_transition_type::diagonalWipe : _Wostream << L"diagonalwipe" ; break;
|
||||
case smil_transition_type::bowTieWipe : _Wostream << L"bowtiewipe" ; break;
|
||||
case smil_transition_type::miscDiagonalWipe : _Wostream << L"miscdiagonalwipe"; break;
|
||||
case smil_transition_type::veeWipe : _Wostream << L"veewipe" ; break;
|
||||
case smil_transition_type::barnVeeWipe : _Wostream << L"barnveewipe" ; break;
|
||||
case smil_transition_type::zigZagWipe : _Wostream << L"zigzagwipe" ; break;
|
||||
case smil_transition_type::barnZigZagWipe : _Wostream << L"barnzigzagwipe" ; break;
|
||||
case smil_transition_type::irisWipe : _Wostream << L"iriswipe" ; break;
|
||||
case smil_transition_type::triangleWipe : _Wostream << L"trianglewipe" ; break;
|
||||
case smil_transition_type::arrowHeadWipe : _Wostream << L"arrowheadwipe" ; break;
|
||||
case smil_transition_type::pentagonWipe : _Wostream << L"pentagonwipe" ; break;
|
||||
case smil_transition_type::hexagonWipe : _Wostream << L"hexagonwipe" ; break;
|
||||
case smil_transition_type::ellipseWipe : _Wostream << L"ellipsewipe" ; break;
|
||||
case smil_transition_type::eyeWipe : _Wostream << L"eyewipe" ; break;
|
||||
case smil_transition_type::roundRectWipe : _Wostream << L"roundrectwipe" ; break;
|
||||
case smil_transition_type::starWipe : _Wostream << L"starwipe" ; break;
|
||||
case smil_transition_type::miscShapeWipe : _Wostream << L"miscshapewipe" ; break;
|
||||
case smil_transition_type::clockWipe : _Wostream << L"clockwipe" ; break;
|
||||
case smil_transition_type::pinWheelWipe : _Wostream << L"pinwheelwipe" ; break;
|
||||
case smil_transition_type::singleSweepWipe : _Wostream << L"singlesweepwipe" ; break;
|
||||
case smil_transition_type::fanWipe : _Wostream << L"fanwipe" ; break;
|
||||
case smil_transition_type::doubleFanWipe : _Wostream << L"doublefanwipe" ; break;
|
||||
case smil_transition_type::doubleSweepWipe : _Wostream << L"doublesweepwipe" ; break;
|
||||
case smil_transition_type::saloonDoorWipe : _Wostream << L"saloondoorwipe" ; break;
|
||||
case smil_transition_type::windshieldWipe : _Wostream << L"windshieldwipe" ; break;
|
||||
case smil_transition_type::snakeWipe : _Wostream << L"snakewipe" ; break;
|
||||
case smil_transition_type::spiralWipe : _Wostream << L"spiralwipe" ; break;
|
||||
case smil_transition_type::parallelSnakesWipe: _Wostream << L"parallelsnakeswipe"; break;
|
||||
case smil_transition_type::boxSnakesWipe : _Wostream << L"boxsnakeswipe" ; break;
|
||||
case smil_transition_type::waterfallWipe : _Wostream << L"waterfallwipe" ; break;
|
||||
case smil_transition_type::pushWipe : _Wostream << L"pushwipe" ; break;
|
||||
case smil_transition_type::slideWipe : _Wostream << L"slidewipe" ; break;
|
||||
case smil_transition_type::barWipe : _Wostream << L"barWipe" ; break;
|
||||
case smil_transition_type::boxWipe : _Wostream << L"boxWipe" ; break;
|
||||
case smil_transition_type::fourBoxWipe : _Wostream << L"fourBoxWipe" ; break;
|
||||
case smil_transition_type::barnDoorWipe : _Wostream << L"barnDoorWipe" ; break;
|
||||
case smil_transition_type::diagonalWipe : _Wostream << L"diagonalWipe" ; break;
|
||||
case smil_transition_type::bowTieWipe : _Wostream << L"bowTieWipe" ; break;
|
||||
case smil_transition_type::miscDiagonalWipe : _Wostream << L"miscDiagonalWipe"; break;
|
||||
case smil_transition_type::veeWipe : _Wostream << L"veeWipe" ; break;
|
||||
case smil_transition_type::barnVeeWipe : _Wostream << L"barnVeeWipe" ; break;
|
||||
case smil_transition_type::zigZagWipe : _Wostream << L"zigZagWipe" ; break;
|
||||
case smil_transition_type::barnZigZagWipe : _Wostream << L"barnZigZagWipe" ; break;
|
||||
case smil_transition_type::irisWipe : _Wostream << L"irisWipe" ; break;
|
||||
case smil_transition_type::triangleWipe : _Wostream << L"triangleWipe" ; break;
|
||||
case smil_transition_type::arrowHeadWipe : _Wostream << L"arrowHeadWipe" ; break;
|
||||
case smil_transition_type::pentagonWipe : _Wostream << L"pentagonWipe" ; break;
|
||||
case smil_transition_type::hexagonWipe : _Wostream << L"hexagonWipe" ; break;
|
||||
case smil_transition_type::ellipseWipe : _Wostream << L"ellipseWipe" ; break;
|
||||
case smil_transition_type::eyeWipe : _Wostream << L"eyeWipe" ; break;
|
||||
case smil_transition_type::roundRectWipe : _Wostream << L"roundRectWipe" ; break;
|
||||
case smil_transition_type::starWipe : _Wostream << L"starWipe" ; break;
|
||||
case smil_transition_type::miscShapeWipe : _Wostream << L"miscShapeWipe" ; break;
|
||||
case smil_transition_type::clockWipe : _Wostream << L"clockWipe" ; break;
|
||||
case smil_transition_type::pinWheelWipe : _Wostream << L"pinWheelWipe" ; break;
|
||||
case smil_transition_type::singleSweepWipe : _Wostream << L"singleSweepWipe" ; break;
|
||||
case smil_transition_type::fanWipe : _Wostream << L"fanWipe" ; break;
|
||||
case smil_transition_type::doubleFanWipe : _Wostream << L"doubleFanWipe" ; break;
|
||||
case smil_transition_type::doubleSweepWipe : _Wostream << L"doubleSweepWipe" ; break;
|
||||
case smil_transition_type::saloonDoorWipe : _Wostream << L"saloonDoorWipe" ; break;
|
||||
case smil_transition_type::windshieldWipe : _Wostream << L"windshieldWipe" ; break;
|
||||
case smil_transition_type::snakeWipe : _Wostream << L"snakeWipe" ; break;
|
||||
case smil_transition_type::spiralWipe : _Wostream << L"spiralWipe" ; break;
|
||||
case smil_transition_type::parallelSnakesWipe: _Wostream << L"parallelSnakesWipe"; break;
|
||||
case smil_transition_type::boxSnakesWipe : _Wostream << L"boxSnakesWipe" ; break;
|
||||
case smil_transition_type::waterfallWipe : _Wostream << L"waterfallWipe" ; break;
|
||||
case smil_transition_type::pushWipe : _Wostream << L"pushWipe" ; break;
|
||||
case smil_transition_type::slideWipe : _Wostream << L"slideWipe" ; break;
|
||||
case smil_transition_type::fade : _Wostream << L"fade" ; break;
|
||||
case smil_transition_type::checkerBoardWipe : _Wostream << L"checkerboardwipe"; break;
|
||||
case smil_transition_type::blindsWipe : _Wostream << L"blindswipe" ; break;
|
||||
case smil_transition_type::checkerBoardWipe : _Wostream << L"checkerboardWipe"; break;
|
||||
case smil_transition_type::blindsWipe : _Wostream << L"blindsWipe" ; break;
|
||||
case smil_transition_type::dissolve : _Wostream << L"dissolve" ; break;
|
||||
case smil_transition_type::randomBarWipe : _Wostream << L"randombarwipe" ; break;
|
||||
case smil_transition_type::randomBarWipe : _Wostream << L"randomBarWipe" ; break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -91,47 +91,47 @@ smil_transition_type smil_transition_type::parse(const std::wstring & Str)
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if(tmp == L"barwipe") return smil_transition_type( barWipe );
|
||||
else if(tmp == L"boxwipe") return smil_transition_type( boxWipe );
|
||||
else if(tmp == L"fourboxwipe") return smil_transition_type( fourBoxWipe );
|
||||
else if(tmp == L"barndoorwipe") return smil_transition_type( barnDoorWipe );
|
||||
else if(tmp == L"diagonalwipe") return smil_transition_type( diagonalWipe );
|
||||
else if(tmp == L"bowtiewipe") return smil_transition_type( bowTieWipe );
|
||||
else if(tmp == L"miscdiagonalwipe") return smil_transition_type( miscDiagonalWipe );
|
||||
else if(tmp == L"veewipe") return smil_transition_type( veeWipe );
|
||||
else if(tmp == L"barnveewipe") return smil_transition_type( barnVeeWipe );
|
||||
else if(tmp == L"zigzagwipe") return smil_transition_type( zigZagWipe );
|
||||
else if(tmp == L"barnzigzagwipe") return smil_transition_type( barnZigZagWipe );
|
||||
else if(tmp == L"iriswipe") return smil_transition_type( irisWipe);
|
||||
else if(tmp == L"trianglewipe") return smil_transition_type( triangleWipe);
|
||||
else if(tmp == L"arrowheadwipe") return smil_transition_type( arrowHeadWipe );
|
||||
else if(tmp == L"pentagonwipe") return smil_transition_type( pentagonWipe );
|
||||
else if(tmp == L"hexagonwipe") return smil_transition_type( hexagonWipe );
|
||||
else if(tmp == L"ellipsewipe") return smil_transition_type( ellipseWipe );
|
||||
else if(tmp == L"eyewipe") return smil_transition_type( eyeWipe );
|
||||
else if(tmp == L"roundrectwipe") return smil_transition_type( roundRectWipe );
|
||||
else if(tmp == L"starwipe") return smil_transition_type( starWipe );
|
||||
else if(tmp == L"miscshapewipe") return smil_transition_type( miscShapeWipe );
|
||||
else if(tmp == L"clockwipe") return smil_transition_type( clockWipe );
|
||||
else if(tmp == L"pinwheelwipe") return smil_transition_type( pinWheelWipe );
|
||||
else if(tmp == L"singlesweepwipe") return smil_transition_type( singleSweepWipe);
|
||||
else if(tmp == L"fanwipe") return smil_transition_type( fanWipe );
|
||||
else if(tmp == L"doublefanwipe") return smil_transition_type( doubleFanWipe );
|
||||
else if(tmp == L"doublesweepwipe") return smil_transition_type( doubleSweepWipe );
|
||||
else if(tmp == L"saloondoorwipe") return smil_transition_type( saloonDoorWipe );
|
||||
else if(tmp == L"windshieldwipe") return smil_transition_type( windshieldWipe );
|
||||
else if(tmp == L"snakewipe") return smil_transition_type( snakeWipe );
|
||||
else if(tmp == L"spiralwipe") return smil_transition_type( spiralWipe );
|
||||
else if(tmp == L"parallelsnakeswipe")return smil_transition_type( parallelSnakesWipe );
|
||||
else if(tmp == L"boxsnakeswipe") return smil_transition_type( boxSnakesWipe );
|
||||
else if(tmp == L"waterfallwipe") return smil_transition_type( waterfallWipe );
|
||||
else if(tmp == L"pushwipe") return smil_transition_type( pushWipe );
|
||||
else if(tmp == L"slidewipe") return smil_transition_type( slideWipe );
|
||||
if(tmp == L"barWipe") return smil_transition_type( barWipe );
|
||||
else if(tmp == L"boxWipe") return smil_transition_type( boxWipe );
|
||||
else if(tmp == L"fourboxWipe") return smil_transition_type( fourBoxWipe );
|
||||
else if(tmp == L"barndoorWipe") return smil_transition_type( barnDoorWipe );
|
||||
else if(tmp == L"diagonalWipe") return smil_transition_type( diagonalWipe );
|
||||
else if(tmp == L"bowtieWipe") return smil_transition_type( bowTieWipe );
|
||||
else if(tmp == L"miscdiagonalWipe") return smil_transition_type( miscDiagonalWipe );
|
||||
else if(tmp == L"veeWipe") return smil_transition_type( veeWipe );
|
||||
else if(tmp == L"barnveeWipe") return smil_transition_type( barnVeeWipe );
|
||||
else if(tmp == L"zigzagWipe") return smil_transition_type( zigZagWipe );
|
||||
else if(tmp == L"barnzigzagWipe") return smil_transition_type( barnZigZagWipe );
|
||||
else if(tmp == L"irisWipe") return smil_transition_type( irisWipe);
|
||||
else if(tmp == L"triangleWipe") return smil_transition_type( triangleWipe);
|
||||
else if(tmp == L"arrowheadWipe") return smil_transition_type( arrowHeadWipe );
|
||||
else if(tmp == L"pentagonWipe") return smil_transition_type( pentagonWipe );
|
||||
else if(tmp == L"hexagonWipe") return smil_transition_type( hexagonWipe );
|
||||
else if(tmp == L"ellipseWipe") return smil_transition_type( ellipseWipe );
|
||||
else if(tmp == L"eyeWipe") return smil_transition_type( eyeWipe );
|
||||
else if(tmp == L"roundrectWipe") return smil_transition_type( roundRectWipe );
|
||||
else if(tmp == L"starWipe") return smil_transition_type( starWipe );
|
||||
else if(tmp == L"miscshapeWipe") return smil_transition_type( miscShapeWipe );
|
||||
else if(tmp == L"clockWipe") return smil_transition_type( clockWipe );
|
||||
else if(tmp == L"pinwheelWipe") return smil_transition_type( pinWheelWipe );
|
||||
else if(tmp == L"singlesweepWipe") return smil_transition_type( singleSweepWipe);
|
||||
else if(tmp == L"fanWipe") return smil_transition_type( fanWipe );
|
||||
else if(tmp == L"doublefanWipe") return smil_transition_type( doubleFanWipe );
|
||||
else if(tmp == L"doublesweepWipe") return smil_transition_type( doubleSweepWipe );
|
||||
else if(tmp == L"saloondoorWipe") return smil_transition_type( saloonDoorWipe );
|
||||
else if(tmp == L"windshieldWipe") return smil_transition_type( windshieldWipe );
|
||||
else if(tmp == L"snakeWipe") return smil_transition_type( snakeWipe );
|
||||
else if(tmp == L"spiralWipe") return smil_transition_type( spiralWipe );
|
||||
else if(tmp == L"parallelsnakesWipe")return smil_transition_type( parallelSnakesWipe );
|
||||
else if(tmp == L"boxsnakesWipe") return smil_transition_type( boxSnakesWipe );
|
||||
else if(tmp == L"waterfallWipe") return smil_transition_type( waterfallWipe );
|
||||
else if(tmp == L"pushWipe") return smil_transition_type( pushWipe );
|
||||
else if(tmp == L"slideWipe") return smil_transition_type( slideWipe );
|
||||
else if(tmp == L"fade") return smil_transition_type( fade );
|
||||
else if(tmp == L"checkerboardwipe") return smil_transition_type( checkerBoardWipe);
|
||||
else if(tmp == L"blindswipe") return smil_transition_type( blindsWipe);
|
||||
else if(tmp == L"checkerboardWipe") return smil_transition_type( checkerBoardWipe);
|
||||
else if(tmp == L"blindsWipe") return smil_transition_type( blindsWipe);
|
||||
else if(tmp == L"dissolve") return smil_transition_type( dissolve);
|
||||
else if(tmp == L"randombarwipe") return smil_transition_type( randomBarWipe);
|
||||
else if(tmp == L"randombarWipe") return smil_transition_type( randomBarWipe);
|
||||
else
|
||||
{
|
||||
return smil_transition_type( barWipe );
|
||||
|
||||
@ -99,6 +99,8 @@ SOURCES += \
|
||||
../source/OdfFormat/odf_settings_context.cpp \
|
||||
../source/OdfFormat/office_settings.cpp \
|
||||
../source/OdfFormat/mediaitems_utils.cpp \
|
||||
../source/OdfFormat/office_scripts.cpp \
|
||||
../source/OdfFormat/office_event_listeners.cpp \
|
||||
../source/OdfFormat/anim_elements.cpp \
|
||||
../source/OdfFormat/draw_page.cpp \
|
||||
../source/OdfFormat/odp_conversion_context.cpp \
|
||||
@ -208,4 +210,6 @@ HEADERS += \
|
||||
../source/OdfFormat/style_presentation.h \
|
||||
../source/Oox2OdfConverter/PptxConverter.h \
|
||||
../source/OdfFormat/anim_elements.h \
|
||||
../source/OdfFormat/office_event_listeners.h \
|
||||
../source/OdfFormat/office_scripts.h \
|
||||
../source/OdfFormat/style_presentation.h
|
||||
|
||||
@ -91,3 +91,5 @@
|
||||
#include "../source/OdfFormat/odp_slide_context.cpp"
|
||||
#include "../source/OdfFormat/office_presentation.cpp"
|
||||
#include "../source/OdfFormat/style_presentation.cpp"
|
||||
#include "../source/OdfFormat/office_scripts.cpp"
|
||||
#include "../source/OdfFormat/office_event_listeners.cpp"
|
||||
|
||||
@ -59,6 +59,8 @@ void anim_par::create_child_element(const std::wstring & Ns, const std::wstring
|
||||
}
|
||||
void anim_par::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeAnimPar)
|
||||
@ -122,16 +124,18 @@ void anim_seq::add_child_element( const office_element_ptr & child)
|
||||
////////////////////////////////////////////////////////////////
|
||||
void anim_transition_filter_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"smil:direction", smil_direction_);
|
||||
CP_XML_ATTR_OPT(L"smil:subtype", smil_subtype_);
|
||||
CP_XML_ATTR_OPT(L"smil:type", smil_type_);
|
||||
CP_XML_ATTR_OPT(L"smil:fadeColor", smil_fadeColor_);
|
||||
CP_XML_ATTR_OPT(L"smil:mode", smil_mode_);
|
||||
CP_XML_ATTR_OPT(L"smil:dur", smil_dur_);
|
||||
|
||||
}
|
||||
|
||||
const wchar_t * anim_transitionFilter::ns = L"anim";
|
||||
void anim_audio_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"xlink:href", xlink_href_);
|
||||
CP_XML_ATTR_OPT(L"anim:audio-level",anim_audio_level_);
|
||||
}
|
||||
const wchar_t * anim_transitionFilter::ns = L"anim";
|
||||
const wchar_t * anim_transitionFilter::name = L"transitionFilter";
|
||||
|
||||
void anim_transitionFilter::serialize(std::wostream & _Wostream)
|
||||
@ -140,11 +144,26 @@ void anim_transitionFilter::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_attlist_.serialize(CP_GET_XML_NODE());
|
||||
filter_attlist_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
const wchar_t * anim_audio::ns = L"anim";
|
||||
const wchar_t * anim_audio::name = L"audio";
|
||||
|
||||
void anim_audio::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
common_attlist_.serialize(CP_GET_XML_NODE());
|
||||
audio_attlist_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,19 +86,24 @@ CP_REGISTER_OFFICE_ELEMENT2(anim_seq);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//anim:iterate
|
||||
//class anim_iterate : public office_element_impl<anim_iterate>//Итеративные анимации
|
||||
class anim_audio_attlist
|
||||
{
|
||||
public:
|
||||
void serialize(CP_ATTR_NODE);
|
||||
|
||||
_CP_OPT(std::wstring) xlink_href_;
|
||||
_CP_OPT(std::wstring) anim_audio_level_;
|
||||
};
|
||||
|
||||
class anim_transition_filter_attlist
|
||||
{
|
||||
public:
|
||||
void serialize(CP_ATTR_NODE);
|
||||
|
||||
_CP_OPT(std::wstring) smil_direction_;
|
||||
_CP_OPT(std::wstring) smil_subtype_;
|
||||
_CP_OPT(odf_types::smil_transition_type) smil_type_;
|
||||
_CP_OPT(std::wstring) smil_mode_;
|
||||
_CP_OPT(odf_types::color) smil_fadeColor_;
|
||||
_CP_OPT(odf_types::clockvalue) smil_dur_;
|
||||
};
|
||||
|
||||
|
||||
@ -116,11 +121,29 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & strm);
|
||||
///////////////////////////////////////////////////////////
|
||||
anim_transition_filter_attlist attlist_;
|
||||
odf_types::common_anim_smil_attlist common_attlist_;
|
||||
anim_transition_filter_attlist filter_attlist_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(anim_transitionFilter);
|
||||
|
||||
//anim:audio
|
||||
class anim_audio : public office_element_impl<anim_audio>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeAnimAudio;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_child_element( const office_element_ptr & child){}
|
||||
|
||||
virtual void serialize(std::wostream & strm);
|
||||
///////////////////////////////////////////////////////////
|
||||
odf_types::common_anim_smil_attlist common_attlist_;
|
||||
anim_audio_attlist audio_attlist_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(anim_audio);
|
||||
//anim:command
|
||||
|
||||
}
|
||||
|
||||
@ -73,10 +73,9 @@ void draw_chart_attlist::serialize(CP_ATTR_NODE)
|
||||
//CP_XML_ATTR_OPT(L"draw:filter-name", draw_filter_name_);
|
||||
}
|
||||
|
||||
// draw:image
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_image::ns = L"draw";
|
||||
const wchar_t * draw_image::name = L"image";
|
||||
//-----------------------------------------------------------------------
|
||||
const wchar_t * draw_image::ns = L"draw";
|
||||
const wchar_t * draw_image::name = L"image";
|
||||
|
||||
void draw_image::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -111,6 +110,8 @@ void draw_image::create_child_element(const std::wstring & Ns, const std::wstrin
|
||||
}
|
||||
void draw_image::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeOfficeBinaryData)
|
||||
@ -154,8 +155,7 @@ void draw_chart::add_child_element( const office_element_ptr & child_element)
|
||||
content_.push_back(child_element);
|
||||
}
|
||||
|
||||
// draw:g
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///-----------------------------------------------------------------------
|
||||
const wchar_t * draw_g::ns = L"draw";
|
||||
const wchar_t * draw_g::name = L"g";
|
||||
|
||||
@ -207,12 +207,12 @@ void draw_frame::serialize(std::wostream & _Wostream)
|
||||
void draw_frame::create_child_element( const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if (CP_CHECK_NAME(L"draw", L"text-box") ||
|
||||
CP_CHECK_NAME(L"draw", L"image") ||//копия чарта в виде картинки ну.. или просто картинка
|
||||
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение чарта
|
||||
CP_CHECK_NAME(L"draw", L"image") ||//копия чарта в виде картинки ну.. или просто картинка
|
||||
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение чарта
|
||||
CP_CHECK_NAME(L"draw", L"object-ole") ||
|
||||
CP_CHECK_NAME(L"draw", L"applet") ||
|
||||
CP_CHECK_NAME(L"draw", L"applet") ||
|
||||
CP_CHECK_NAME(L"draw", L"floating-frame") ||
|
||||
CP_CHECK_NAME(L"draw", L"plugin") ||
|
||||
CP_CHECK_NAME(L"draw", L"plugin") ||
|
||||
CP_CHECK_NAME(L"table", L"table")
|
||||
)
|
||||
{
|
||||
@ -242,9 +242,16 @@ void draw_frame::create_child_element( const std::wstring & Ns, const std::wstr
|
||||
}
|
||||
void draw_frame::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeDrawImage || type == typeDrawTextBox || type == typeDrawObject || type == typeDrawObjectOle || type == typeTableTable)
|
||||
if (type == typeDrawImage ||
|
||||
type == typeDrawTextBox ||
|
||||
type == typeDrawObject ||
|
||||
type == typeDrawObjectOle ||
|
||||
type == typeDrawPlugin ||
|
||||
type == typeTableTable)
|
||||
{
|
||||
draw_base::add_child_element(child_element);
|
||||
}
|
||||
@ -259,8 +266,6 @@ void draw_frame::add_child_element( const office_element_ptr & child_element)
|
||||
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
|
||||
void draw_text_box_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"draw:chain-next-name", draw_chain_next_name_);
|
||||
@ -271,9 +276,8 @@ void draw_text_box_attlist::serialize(CP_ATTR_NODE)
|
||||
CP_XML_ATTR_OPT(L"fo:max-height", fo_max_height_);
|
||||
}
|
||||
|
||||
// draw:text-box
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_text_box::ns = L"draw";
|
||||
//-----------------------------------------------------------------------
|
||||
const wchar_t * draw_text_box::ns = L"draw";
|
||||
const wchar_t * draw_text_box::name = L"text-box";
|
||||
|
||||
|
||||
@ -285,9 +289,9 @@ void draw_text_box::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
draw_text_box_attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
elm->serialize(CP_XML_STREAM());
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,8 +306,7 @@ void draw_text_box::add_child_element( const office_element_ptr & child_element)
|
||||
content_.push_back(child_element);
|
||||
}
|
||||
|
||||
// draw:object
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------
|
||||
const wchar_t * draw_object::ns = L"draw";
|
||||
const wchar_t * draw_object::name = L"object";
|
||||
|
||||
@ -326,10 +329,9 @@ void draw_object::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
//CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
// draw:object
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_object_ole::ns = L"draw";
|
||||
const wchar_t * draw_object_ole::name = L"object-ole";
|
||||
//-----------------------------------------------------------------------
|
||||
const wchar_t * draw_object_ole::ns = L"draw";
|
||||
const wchar_t * draw_object_ole::name = L"object-ole";
|
||||
|
||||
void draw_object_ole::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -351,5 +353,37 @@ void draw_object_ole::add_child_element( const office_element_ptr & child_elemen
|
||||
{
|
||||
//CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
//-----------------------------------------------------------------------
|
||||
const wchar_t * draw_plugin::ns = L"draw";
|
||||
const wchar_t * draw_plugin::name = L"plugin";
|
||||
|
||||
void draw_plugin::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
|
||||
CP_XML_ATTR_OPT(L"draw:mime-type", draw_mime_type_);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void draw_plugin::create_child_element( const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"draw", L"param")
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
}
|
||||
void draw_plugin::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
content_.push_back(child_element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,10 +235,33 @@ public:
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
_CP_OPT(std::wstring) draw_class_id_;
|
||||
_CP_OPT(std::wstring) draw_class_id_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole)
|
||||
|
||||
// draw:plugin
|
||||
class draw_plugin : public office_element_impl<draw_plugin>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeDrawPlugin;
|
||||
CPDOCCORE_DEFINE_VISITABLE()
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
_CP_OPT(std::wstring) draw_mime_type_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_plugin)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,6 +72,8 @@ void draw_page::create_child_element( const std::wstring & Ns, const std::wstrin
|
||||
}
|
||||
void draw_page::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
if(type == typeAnimPar)
|
||||
animation_ = child_element;
|
||||
|
||||
@ -464,7 +464,9 @@ void draw_enhanced_geometry::create_child_element( const std::wstring & Ns, cons
|
||||
}
|
||||
void draw_enhanced_geometry::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
ElementType type = child_element->get_type();
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeDrawHandle)
|
||||
{
|
||||
|
||||
@ -102,6 +102,8 @@ void text_list_item::create_child_element(const std::wstring & Ns, const std::ws
|
||||
}
|
||||
void text_list_item::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTextNumber)
|
||||
@ -148,6 +150,8 @@ void text_list_header::create_child_element(const std::wstring & Ns, const std::
|
||||
}
|
||||
void text_list_header::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTextNumber)
|
||||
|
||||
@ -42,7 +42,7 @@ class rels;
|
||||
class _mediaitems
|
||||
{
|
||||
public:
|
||||
enum Type { typeUnknown = 0, typeImage, typeAudio, typeVideo};
|
||||
enum Type { typeUnknown = 0, typeImage, typeMedia};
|
||||
//oleObject ???
|
||||
|
||||
_mediaitems()
|
||||
|
||||
@ -123,6 +123,8 @@ void number_style_base::create_child_element( const std::wstring & Ns, const std
|
||||
}
|
||||
void number_style_base::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeStyleTextProperties)
|
||||
|
||||
@ -185,12 +185,12 @@ namespace odf_writer
|
||||
{
|
||||
if (mediaitems_.count_media < 1)return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Media";
|
||||
NSDirectory::CreateDirectory(path);
|
||||
|
||||
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
|
||||
{
|
||||
if (item.type == _mediaitems::typeAudio || item.type == _mediaitems::typeVideo)
|
||||
if (item.type == _mediaitems::typeMedia)
|
||||
{
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
|
||||
|
||||
@ -342,14 +342,17 @@ namespace odf_writer
|
||||
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
|
||||
CP_XML_ATTR(L"xmlns:drawooo", L"http://openoffice.org/2010/draw" );
|
||||
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
|
||||
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
|
||||
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf_writer-interop:xmlns:form:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
|
||||
|
||||
CP_XML_ATTR(L"office:version", L"1.2");
|
||||
|
||||
//CP_XML_NODE(L"office:scripts");
|
||||
CP_XML_NODE(L"office:font-face-decls");
|
||||
if (content_)
|
||||
{
|
||||
CP_XML_STREAM() << content_->styles_str();
|
||||
@ -402,6 +405,8 @@ namespace odf_writer
|
||||
CP_XML_ATTR(L"xmlns:of", L"urn:oasis:names:tc:opendocument:xmlns:of:1.2" );
|
||||
CP_XML_ATTR(L"xmlns:xhtml", L"http://www.w3.org/1999/xhtml" );
|
||||
CP_XML_ATTR(L"xmlns:grddl", L"http://www.w3.org/2003/g/data-view#" );
|
||||
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
|
||||
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:officeooo", L"http://openoffice.org/2009/office" );
|
||||
CP_XML_ATTR(L"xmlns:textooo", L"http://openoffice.org/2013/office" );
|
||||
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
|
||||
@ -409,7 +414,7 @@ namespace odf_writer
|
||||
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
|
||||
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf_writer-interop:xmlns:form:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
|
||||
CP_XML_ATTR(L"office:version", L"1.2");
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "office_spreadsheet.h"
|
||||
#include "office_scripts.h"
|
||||
#include "office_chart.h"
|
||||
|
||||
#include "office_elements_create.h"
|
||||
@ -128,6 +129,10 @@ void odf_conversion_context::end_document()
|
||||
process_settings(object, isRoot);
|
||||
|
||||
package::content_content_ptr content_root_ = package::content_content::create();
|
||||
|
||||
if (objects_.back().scripts)
|
||||
objects_.back().scripts->serialize(content_root_->styles());
|
||||
|
||||
object.content->serialize(content_root_->content());
|
||||
BOOST_FOREACH(const office_element_ptr & elm, object.content_styles)
|
||||
{
|
||||
@ -193,6 +198,8 @@ void odf_conversion_context::start_presentation()
|
||||
{
|
||||
create_object();
|
||||
create_element(L"office", L"presentation", objects_.back().content, this, true);
|
||||
|
||||
create_element(L"office", L"scripts", objects_.back().scripts, this);
|
||||
}
|
||||
void odf_conversion_context::create_object()
|
||||
{
|
||||
@ -298,6 +305,15 @@ std::wstring odf_conversion_context::add_image(const std::wstring & image_file_n
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
std::wstring odf_conversion_context::add_media(const std::wstring & file_name)
|
||||
{
|
||||
if (file_name.empty()) return L"";
|
||||
|
||||
std::wstring odf_ref_name ;
|
||||
mediaitems()->add_or_find(file_name,_mediaitems::typeMedia, 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;
|
||||
|
||||
@ -65,6 +65,7 @@ class odf_conversion_context : boost::noncopyable
|
||||
std::wstring name;
|
||||
|
||||
office_element_ptr content;
|
||||
office_element_ptr scripts;
|
||||
std::vector<office_element_ptr> content_styles;
|
||||
std::vector<office_element_ptr> styles;
|
||||
office_element_ptr settings;
|
||||
@ -96,6 +97,7 @@ public:
|
||||
virtual void end_text_context() = 0;
|
||||
|
||||
std::wstring add_image(const std::wstring & image_file_name);
|
||||
std::wstring add_media(const std::wstring & file_name);
|
||||
|
||||
virtual odf_style_context * styles_context();
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include "odf_text_context.h"
|
||||
#include "odf_style_context.h"
|
||||
#include "odf_conversion_context.h"
|
||||
#include "office_event_listeners.h"
|
||||
|
||||
#include "draw_frame.h"
|
||||
#include "draw_shapes.h"
|
||||
@ -2332,14 +2333,37 @@ void odf_drawing_context::start_object(std::wstring name)
|
||||
draw_object* object = dynamic_cast<draw_object*>(object_elm.get());
|
||||
if (object == NULL)return;
|
||||
|
||||
object->common_xlink_attlist_.href_= std::wstring(L"./") + name;
|
||||
object->common_xlink_attlist_.type_= xlink_type::Simple;
|
||||
object->common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
object->common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
|
||||
object->common_xlink_attlist_.href_ = std::wstring(L"./") + name;
|
||||
object->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
object->common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
object->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
|
||||
|
||||
start_element(object_elm);
|
||||
}
|
||||
void odf_drawing_context::start_media(std::wstring name)
|
||||
{
|
||||
start_frame();
|
||||
|
||||
office_element_ptr plugin_elm;
|
||||
create_element(L"draw", L"plugin", plugin_elm, impl_->odf_context_);
|
||||
|
||||
draw_plugin* plugin = dynamic_cast<draw_plugin*>(plugin_elm.get());
|
||||
if (plugin == NULL)return;
|
||||
|
||||
plugin->common_xlink_attlist_.href_ = name;
|
||||
plugin->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
plugin->common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
plugin->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
|
||||
|
||||
plugin->draw_mime_type_ = L"application/vnd.sun.star.media";
|
||||
|
||||
start_element(plugin_elm);
|
||||
}
|
||||
void odf_drawing_context::end_media()
|
||||
{
|
||||
end_element();
|
||||
end_frame();
|
||||
}
|
||||
void odf_drawing_context::start_text_box()
|
||||
{
|
||||
impl_->current_drawing_state_.oox_shape_preset_ = 2000;
|
||||
@ -2369,6 +2393,95 @@ void odf_drawing_context::set_text_box_min_size(bool val)
|
||||
}
|
||||
}
|
||||
|
||||
void odf_drawing_context::start_action(std::wstring value)
|
||||
{
|
||||
office_element_ptr elm_listeners;
|
||||
create_element(L"office", L"event-listeners", elm_listeners, impl_->odf_context_);
|
||||
|
||||
start_element(elm_listeners);
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"presentation", L"event-listener", elm, impl_->odf_context_);
|
||||
|
||||
start_element(elm);
|
||||
|
||||
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
|
||||
|
||||
if (event_)
|
||||
{
|
||||
event_->attlist_.script_event_name_ = L"dom:click";
|
||||
|
||||
if (std::wstring::npos != value.find(L"noaction") ||
|
||||
std::wstring::npos != value.find(L"media"))
|
||||
{
|
||||
event_->attlist_.script_event_name_ = boost::none;
|
||||
}
|
||||
else if (std::wstring::npos != value.find(L"program"))
|
||||
{
|
||||
event_->attlist_.presentation_action_ = L"execute";
|
||||
}
|
||||
else if (std::wstring::npos != value.find(L"hlinkshowjump"))
|
||||
{
|
||||
if (std::wstring::npos != value.find(L"previousslide"))
|
||||
event_->attlist_.presentation_action_ = L"previous-page";
|
||||
if (std::wstring::npos != value.find(L"nextslide"))
|
||||
event_->attlist_.presentation_action_ = L"next-page";
|
||||
}
|
||||
else if (std::wstring::npos != value.find(L"hlinksldjump"))
|
||||
{
|
||||
event_->attlist_.presentation_action_ = L"previous-page";
|
||||
}
|
||||
else
|
||||
{//hyperlink
|
||||
event_->attlist_.presentation_action_ = L"show";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void odf_drawing_context::add_link(std::wstring href)
|
||||
{
|
||||
if (href.empty()) return;
|
||||
|
||||
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
|
||||
|
||||
if (event_)
|
||||
{
|
||||
event_->attlist_.common_xlink_attlist_.href_ = href;
|
||||
event_->attlist_.common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
event_->attlist_.common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
event_->attlist_.common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
|
||||
}
|
||||
}
|
||||
|
||||
void odf_drawing_context::add_sound(std::wstring href)
|
||||
{
|
||||
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
|
||||
if (event_)
|
||||
{
|
||||
event_->attlist_.script_event_name_ = L"dom:click";
|
||||
event_->attlist_.presentation_action_ = L"sound";
|
||||
}
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"presentation", L"sound", elm, impl_->odf_context_);
|
||||
|
||||
start_element(elm);
|
||||
|
||||
presentation_sound *sound = dynamic_cast<presentation_sound*>(elm.get());
|
||||
if (sound)
|
||||
{
|
||||
sound->common_xlink_attlist_.href_ = href;
|
||||
sound->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
sound->common_xlink_attlist_.show_ = xlink_show::New;
|
||||
sound->common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
|
||||
}
|
||||
end_element();
|
||||
}
|
||||
void odf_drawing_context::end_action()
|
||||
{
|
||||
end_element();
|
||||
end_element();
|
||||
}
|
||||
void odf_drawing_context::set_text_box_min_size(double w_pt, double h_pt)
|
||||
{
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return;
|
||||
|
||||
@ -144,6 +144,9 @@ public:
|
||||
void start_object(std::wstring name);
|
||||
void end_object();
|
||||
|
||||
void start_media(std::wstring name);
|
||||
void end_media();
|
||||
|
||||
bool isLineShape();
|
||||
void corrected_line_fill();
|
||||
|
||||
@ -260,6 +263,11 @@ public:
|
||||
void set_bitmap_tile_translate_y(double y);
|
||||
void set_bitmap_tile_translate_x(double x);
|
||||
|
||||
void start_action(std::wstring value);
|
||||
void add_sound (std::wstring href);
|
||||
void add_link (std::wstring href);
|
||||
void end_action();
|
||||
|
||||
std::map<std::wstring, OOX::Vml::CShapeType*> m_mapVmlShapeTypes;
|
||||
|
||||
private:
|
||||
|
||||
@ -214,17 +214,7 @@ void odp_conversion_context::end_note()
|
||||
current_slide().drawing_context()->end_element();
|
||||
current_slide().drawing_context()->end_drawing();
|
||||
}
|
||||
void odp_conversion_context::start_timing()
|
||||
{
|
||||
anim_state anim;
|
||||
anim.elm = current_slide().page_elm_;
|
||||
current_slide().anim_levels.push_back(anim);
|
||||
}
|
||||
void odp_conversion_context::end_timing()
|
||||
{
|
||||
current_slide().anim_levels.pop_back();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,9 +80,6 @@ public:
|
||||
void start_note(bool bMaster = false);
|
||||
void end_note();
|
||||
|
||||
void start_timing();
|
||||
void end_timing();
|
||||
|
||||
private:
|
||||
odp_slide_context slide_context_;
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ namespace odf_writer {
|
||||
odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_ptr & elm)
|
||||
: context_(Context), drawing_context_(Context), comment_context_(Context)
|
||||
{
|
||||
page_elm_ = elm;
|
||||
|
||||
page_elm_ = elm;
|
||||
page_properties_ = NULL;
|
||||
}
|
||||
void odp_page_state::set_page_id(int id)
|
||||
{
|
||||
@ -113,6 +113,8 @@ void odp_page_state::set_page_style(office_element_ptr & elm)
|
||||
|
||||
if (!office_page_style_)return;
|
||||
|
||||
page_properties_ = office_page_style_->content_.get_style_drawing_page_properties();
|
||||
|
||||
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
|
||||
if (page)
|
||||
page->attlist_.draw_style_name_ = office_page_style_->style_name_;
|
||||
@ -142,6 +144,19 @@ void odp_page_state::set_anim_id (int val)
|
||||
|
||||
//anim_levels.back().attlist->smil_begin_ = L"id" + std::to_wstring(val) + L".begin";
|
||||
}
|
||||
void odp_page_state::finalize_page()
|
||||
{
|
||||
if (transactions.empty() == false)
|
||||
{
|
||||
start_timing();
|
||||
start_timing_par();
|
||||
set_anim_duration(-1);
|
||||
set_anim_restart(L"never");
|
||||
set_anim_type(L"tmRoot");
|
||||
end_timing_par();
|
||||
end_timing();
|
||||
}
|
||||
}
|
||||
void odp_page_state::set_anim_type(std::wstring val)
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
@ -150,7 +165,7 @@ void odp_page_state::set_anim_type(std::wstring val)
|
||||
if (val == L"tmRoot")
|
||||
{
|
||||
anim_levels.back().attlist->presentation_node_type_ = L"timing-root";
|
||||
if (page_transaction)
|
||||
if (transactions.empty() == false)
|
||||
{
|
||||
std::wstring slide_id = L"slide_id" + std::to_wstring(page_id_);
|
||||
|
||||
@ -161,19 +176,22 @@ void odp_page_state::set_anim_type(std::wstring val)
|
||||
|
||||
start_timing_par();
|
||||
anim_levels.back().attlist->smil_begin_ = slide_id + L".begin";
|
||||
anim_levels.back().elm->add_child_element( page_transaction );
|
||||
while(!transactions.empty())
|
||||
{
|
||||
anim_levels.back().elm->add_child_element( transactions[0] );
|
||||
transactions.erase(transactions.begin());
|
||||
}
|
||||
end_timing_par();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void odp_page_state::set_anim_duration(std::wstring val)
|
||||
void odp_page_state::set_anim_duration(int val)
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
if (!anim_levels.back().attlist)return;
|
||||
|
||||
//if (val == L"indefinite")
|
||||
anim_levels.back().attlist->smil_dur_ = val;
|
||||
anim_levels.back().attlist->smil_dur_ = odf_types::clockvalue(val);
|
||||
|
||||
}
|
||||
void odp_page_state::set_anim_restart(std::wstring val)
|
||||
@ -185,36 +203,93 @@ void odp_page_state::set_anim_restart(std::wstring val)
|
||||
}
|
||||
void odp_page_state::start_transition()
|
||||
{
|
||||
create_element(L"anim", L"transitionFilter", page_transaction, context_);
|
||||
office_element_ptr elm;
|
||||
create_element(L"anim", L"transitionFilter", elm, context_);
|
||||
|
||||
transactions.push_back(elm);
|
||||
}
|
||||
void odp_page_state::set_transition_type(int val)
|
||||
{
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
|
||||
if (transactions.empty()) return;
|
||||
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
|
||||
if (trans)
|
||||
trans->attlist_.smil_type_ = odf_types::smil_transition_type(odf_types::smil_transition_type::dissolve);
|
||||
trans->filter_attlist_.smil_type_ = odf_types::smil_transition_type((odf_types::smil_transition_type::type)val);
|
||||
}
|
||||
void odp_page_state::set_transition_subtype(std::wstring val)
|
||||
{
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
|
||||
if (transactions.empty()) return;
|
||||
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
|
||||
if (trans)
|
||||
trans->attlist_.smil_subtype_ = val;
|
||||
trans->filter_attlist_.smil_subtype_ = val;
|
||||
}
|
||||
void odp_page_state::set_transition_speed(int val)
|
||||
{
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
|
||||
if (transactions.empty()) return;
|
||||
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
|
||||
if (trans)
|
||||
{
|
||||
if (val == 0) trans->attlist_.smil_dur_ = odf_types::clockvalue(3000);
|
||||
if (val == 1) trans->attlist_.smil_dur_ = odf_types::clockvalue(4000);
|
||||
if (val == 2) trans->attlist_.smil_dur_ = odf_types::clockvalue(5000);
|
||||
if (val == 0)
|
||||
{
|
||||
if (page_properties_)
|
||||
page_properties_->content_.presentation_transition_speed_ = L"fast";
|
||||
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(2000);
|
||||
}
|
||||
if (val == 1)
|
||||
{
|
||||
if (page_properties_)
|
||||
page_properties_->content_.presentation_transition_speed_ = L"medium";
|
||||
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(3000);
|
||||
}
|
||||
if (val == 2)
|
||||
{
|
||||
if (page_properties_)
|
||||
page_properties_->content_.presentation_transition_speed_ = L"slow";
|
||||
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(4000);
|
||||
}
|
||||
}
|
||||
}
|
||||
void odp_page_state::set_transition_duration(int val)
|
||||
{
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
|
||||
if (transactions.empty()) return;
|
||||
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
|
||||
if (trans)
|
||||
trans->attlist_.smil_dur_ = odf_types::clockvalue(val * 1000);
|
||||
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(val);
|
||||
}
|
||||
|
||||
void odp_page_state::set_transition_sound(std::wstring ref, bool loop)
|
||||
{
|
||||
if (transactions.empty()) return;
|
||||
if (ref.empty()) return;
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"anim", L"audio", elm, context_);
|
||||
|
||||
anim_audio *audio = dynamic_cast<anim_audio*>(elm.get());
|
||||
if (audio)
|
||||
{
|
||||
audio->audio_attlist_.xlink_href_ = ref;
|
||||
}
|
||||
|
||||
transactions.push_back(elm);
|
||||
|
||||
if (page_properties_)
|
||||
{
|
||||
create_element(L"presentation", L"sound", page_properties_->content_.presentation_sound_, context_);
|
||||
presentation_sound *sound = dynamic_cast<presentation_sound*>(page_properties_->content_.presentation_sound_.get());
|
||||
if (sound)
|
||||
{
|
||||
sound->common_xlink_attlist_.href_ = ref;
|
||||
sound->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
sound->common_xlink_attlist_.show_ = xlink_show::New;
|
||||
sound->common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void odp_page_state::start_timing_seq()
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
@ -231,10 +306,24 @@ void odp_page_state::start_timing_seq()
|
||||
|
||||
anim_levels.push_back(anim);
|
||||
}
|
||||
void odp_page_state::start_timing()
|
||||
{
|
||||
if (!anim_levels.empty()) return;
|
||||
|
||||
anim_state anim;
|
||||
anim.elm = page_elm_;
|
||||
|
||||
anim_levels.push_back(anim);
|
||||
}
|
||||
void odp_page_state::end_timing()
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
anim_levels.pop_back();
|
||||
}
|
||||
void odp_page_state::end_timing_seq()
|
||||
{
|
||||
anim_levels.pop_back();
|
||||
|
||||
if (anim_levels.empty()) return;
|
||||
anim_levels.pop_back();
|
||||
}
|
||||
void odp_page_state::start_timing_par()
|
||||
{
|
||||
@ -254,8 +343,8 @@ void odp_page_state::start_timing_par()
|
||||
}
|
||||
void odp_page_state::end_timing_par()
|
||||
{
|
||||
anim_levels.pop_back();
|
||||
|
||||
if (anim_levels.empty()) return;
|
||||
anim_levels.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,19 +31,13 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include"../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
#include "odf_drawing_context.h"
|
||||
#include "odf_comment_context.h"
|
||||
|
||||
#include "office_elements_create.h"
|
||||
|
||||
#include "style_presentation.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
@ -84,7 +78,7 @@ public:
|
||||
void set_layout_page(std::wstring name);
|
||||
|
||||
void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
void finalize_page();
|
||||
///////////////////////////////
|
||||
odf_drawing_context * drawing_context(){return &drawing_context_;}
|
||||
odf_comment_context * comment_context(){return &comment_context_;}
|
||||
@ -94,32 +88,37 @@ public:
|
||||
office_element_ptr page_elm_;
|
||||
office_element_ptr page_style_elm_;
|
||||
|
||||
std::vector<anim_state> anim_levels;
|
||||
office_element_ptr page_transaction;
|
||||
std::vector<anim_state> anim_levels;
|
||||
std::vector<office_element_ptr> transactions;
|
||||
|
||||
void set_anim_id (int val);
|
||||
void set_anim_type (std::wstring val);
|
||||
void set_anim_duration (std::wstring val);
|
||||
void set_anim_restart (std::wstring val);
|
||||
void start_timing();
|
||||
void start_timing_par();
|
||||
void end_timing_par();
|
||||
|
||||
void start_timing_par();
|
||||
void end_timing_par();
|
||||
void start_timing_seq();
|
||||
void end_timing_seq();
|
||||
|
||||
void start_timing_seq();
|
||||
void end_timing_seq();
|
||||
void set_anim_id (int val);
|
||||
void set_anim_type (std::wstring val);
|
||||
void set_anim_duration (int val);
|
||||
void set_anim_restart (std::wstring val);
|
||||
void end_timing();
|
||||
|
||||
void start_transition();
|
||||
void set_transition_type (int val);
|
||||
void set_transition_subtype (std::wstring val);
|
||||
void set_transition_speed (int val);
|
||||
void set_transition_duration(int val);
|
||||
void set_transition_sound (std::wstring ref, bool loop);
|
||||
void end_transition(){}
|
||||
private:
|
||||
|
||||
odf_conversion_context * context_;
|
||||
odf_conversion_context * context_;
|
||||
|
||||
odf_drawing_context drawing_context_;
|
||||
odf_comment_context comment_context_;
|
||||
odf_drawing_context drawing_context_;
|
||||
odf_comment_context comment_context_;
|
||||
|
||||
style_drawing_page_properties* page_properties_;
|
||||
|
||||
friend class odp_slide_context;
|
||||
|
||||
|
||||
@ -81,6 +81,7 @@ void odp_slide_context::start_page(office_element_ptr & elm)
|
||||
void odp_slide_context::end_page()
|
||||
{
|
||||
state().drawing_context()->finalize(state().page_elm_);
|
||||
state().finalize_page();
|
||||
}
|
||||
|
||||
void odp_slide_context::remove_page()
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include "odp_page_state.h"
|
||||
|
||||
#include "odf_table_context.h"
|
||||
|
||||
@ -124,6 +124,8 @@ void office_annotation::create_child_element(const std::wstring & Ns, const std:
|
||||
}
|
||||
void office_annotation::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeDcCreator)
|
||||
@ -186,6 +188,8 @@ void officeooo_annotation::create_child_element( const std::wstring & Ns, const
|
||||
}
|
||||
void officeooo_annotation::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeDcCreator)
|
||||
|
||||
@ -153,6 +153,7 @@ enum ElementType
|
||||
typeStyleFooterStyle,
|
||||
typeStyleHeaderFooterProperties,
|
||||
|
||||
typeStylePresentationSound,
|
||||
typeStylePresentationPageLayout,
|
||||
typeStylePresentationPlaceholder,
|
||||
typeStyleDrawingPageProperties,
|
||||
@ -235,6 +236,7 @@ enum ElementType
|
||||
typeDrawObject,
|
||||
typeDrawObjectOle,
|
||||
typeDrawChart,
|
||||
typeDrawPlugin,
|
||||
|
||||
typeDrawBase,
|
||||
typeDrawShape,
|
||||
@ -267,6 +269,9 @@ enum ElementType
|
||||
typeAnimPar,
|
||||
typeAnimSeq,
|
||||
typeAnimTransitionFilter,
|
||||
typeAnimAudio,
|
||||
typeAnimCommand,
|
||||
typeAnimIterator,
|
||||
|
||||
typeStyleGraphicPropertis,
|
||||
typeStyleDrawGradient,
|
||||
|
||||
158
ASCOfficeOdfFileW/source/OdfFormat/office_event_listeners.cpp
Normal file
158
ASCOfficeOdfFileW/source/OdfFormat/office_event_listeners.cpp
Normal file
@ -0,0 +1,158 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "office_event_listeners.h"
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
#include "office_elements_create.h"
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_writer {
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * office_event_listeners::ns = L"office";
|
||||
const wchar_t * office_event_listeners::name = L"event-listeners";
|
||||
|
||||
void office_event_listeners::create_child_element(const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME (L"presentation", L"event-listener")
|
||||
CP_CREATE_ELEMENT (presentation_event_listeners_);
|
||||
else if CP_CHECK_NAME (L"script", L"event-listener")
|
||||
CP_CREATE_ELEMENT (script_event_listeners_);
|
||||
}
|
||||
void office_event_listeners::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typePresentationEventListener)
|
||||
{
|
||||
presentation_event_listeners_.push_back(child_element);
|
||||
}
|
||||
else if (type == typeScriptEventListener)
|
||||
{
|
||||
script_event_listeners_.push_back(child_element);
|
||||
}
|
||||
}
|
||||
|
||||
void office_event_listeners::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
for (size_t i = 0; i < presentation_event_listeners_.size(); i++)
|
||||
{
|
||||
presentation_event_listeners_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
for (size_t i = 0; i < script_event_listeners_.size(); i++)
|
||||
{
|
||||
script_event_listeners_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
void presentation_event_listener_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"script:event-name", script_event_name_);
|
||||
CP_XML_ATTR_OPT(L"presentation:action", presentation_action_);
|
||||
|
||||
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * presentation_event_listener::ns = L"presentation";
|
||||
const wchar_t * presentation_event_listener::name = L"event-listener";
|
||||
|
||||
void presentation_event_listener::create_child_element(const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"presentation", L"sound")
|
||||
CP_CREATE_ELEMENT(presentation_sound_);
|
||||
else
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
void presentation_event_listener::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeStylePresentationSound)
|
||||
{
|
||||
presentation_sound_ = child_element;
|
||||
}
|
||||
}
|
||||
void presentation_event_listener::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
if (presentation_sound_)
|
||||
presentation_sound_->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// script:event-listener
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * script_event_listener::ns = L"script";
|
||||
const wchar_t * script_event_listener::name = L"event-listener";
|
||||
|
||||
void script_event_listener::create_child_element(const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
void script_event_listener::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
content_.push_back(child_element);
|
||||
}
|
||||
void script_event_listener::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
125
ASCOfficeOdfFileW/source/OdfFormat/office_event_listeners.h
Normal file
125
ASCOfficeOdfFileW/source/OdfFormat/office_event_listeners.h
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/xmlelement.h>
|
||||
#include <cpdoccore/xml/nodetype.h>
|
||||
#include "office_elements.h"
|
||||
#include "office_elements_create.h"
|
||||
|
||||
#include "common_attlists.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
class office_event_listeners : public office_element_impl<office_event_listeners>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeOfficeEventListeners;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
office_element_ptr_array presentation_event_listeners_;
|
||||
office_element_ptr_array script_event_listeners_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners);
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
class presentation_event_listener_attlist
|
||||
{
|
||||
public:
|
||||
void serialize(CP_ATTR_NODE);
|
||||
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
_CP_OPT(std::wstring) script_event_name_;
|
||||
_CP_OPT(std::wstring) presentation_action_;
|
||||
//presentation:verb
|
||||
//presentation:start-scale
|
||||
//presentation:speed
|
||||
//presentation:direction
|
||||
//presentation:effect
|
||||
};
|
||||
|
||||
class presentation_event_listener : public office_element_impl<presentation_event_listener>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typePresentationEventListener;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
//office_element_ptr_array content_;
|
||||
office_element_ptr presentation_sound_;
|
||||
presentation_event_listener_attlist attlist_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(presentation_event_listener);
|
||||
|
||||
|
||||
// script:event-listeners_
|
||||
class script_event_listener : public office_element_impl<presentation_event_listener>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeScriptEventListener;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(script_event_listener);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -61,6 +61,8 @@ void office_presentation::create_child_element(const std::wstring & Ns, const st
|
||||
|
||||
void office_presentation::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typePresentationDateTimeDecl)
|
||||
@ -83,7 +85,7 @@ void office_presentation::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
for (int i = 0; i < pages_.size(); i++)
|
||||
for (size_t i = 0; i < pages_.size(); i++)
|
||||
{
|
||||
pages_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
@ -56,8 +56,6 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
public:
|
||||
|
||||
office_element_ptr_array date_time_decls_;
|
||||
office_element_ptr_array footer_decls_;
|
||||
|
||||
|
||||
105
ASCOfficeOdfFileW/source/OdfFormat/office_scripts.cpp
Normal file
105
ASCOfficeOdfFileW/source/OdfFormat/office_scripts.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "office_scripts.h"
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
#include "office_elements_create.h"
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
const wchar_t * office_scripts::ns = L"office";
|
||||
const wchar_t * office_scripts::name = L"scripts";
|
||||
|
||||
|
||||
void office_scripts::create_child_element(const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
void office_scripts::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
content_.push_back(child_element);
|
||||
}
|
||||
void office_scripts::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * office_script::ns = L"office";
|
||||
const wchar_t * office_script::name = L"script";
|
||||
|
||||
|
||||
void office_script::create_child_element(const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
void office_script::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
content_.push_back(child_element);
|
||||
}
|
||||
void office_script::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"script:language", script_language_);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
91
ASCOfficeOdfFileW/source/OdfFormat/office_scripts.h
Normal file
91
ASCOfficeOdfFileW/source/OdfFormat/office_scripts.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/xmlelement.h>
|
||||
#include <cpdoccore/xml/nodetype.h>
|
||||
#include "office_elements.h"
|
||||
#include "office_elements_create.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
class office_scripts : public office_element_impl<office_scripts>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeOfficeScripts;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
// office-event-listeners ?
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_scripts);
|
||||
|
||||
class office_script : public office_element_impl<office_script>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeOfficeScript;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
_CP_OPT(std::wstring) script_language_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_script);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -161,6 +161,8 @@ void office_change_info::create_child_element( const std::wstring & Ns, const st
|
||||
}
|
||||
void office_change_info::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeDcCreator)
|
||||
|
||||
@ -435,6 +435,8 @@ void text_note::create_child_element( const std::wstring & Ns, const std::wstri
|
||||
}
|
||||
void text_note::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTextNoteCitation)
|
||||
@ -487,6 +489,8 @@ void text_ruby::create_child_element( const std::wstring & Ns, const std::wstrin
|
||||
}
|
||||
void text_ruby::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTextRubyBase)
|
||||
|
||||
@ -162,6 +162,8 @@ void paragraph_format_properties::create_child_element(const std::wstring & Ns,
|
||||
}
|
||||
void paragraph_format_properties::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeStyleTabStops)
|
||||
|
||||
@ -42,7 +42,7 @@ namespace cpdoccore {
|
||||
|
||||
namespace odf_writer {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * presentation_placeholder::ns = L"presentation";
|
||||
const wchar_t * presentation_placeholder::name = L"placeholder";
|
||||
|
||||
@ -62,6 +62,20 @@ void presentation_placeholder::serialize(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * presentation_sound::ns = L"presentation";
|
||||
const wchar_t * presentation_sound::name = L"sound";
|
||||
|
||||
void presentation_sound::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void drawing_page_properties::serialize(std::wostream & strm, const wchar_t * ns, const wchar_t * name )
|
||||
@ -85,17 +99,20 @@ void drawing_page_properties::serialize(std::wostream & strm, const wchar_t * ns
|
||||
CP_XML_ATTR_OPT(L"presentation:display-page-number",presentation_display_page_number_);
|
||||
CP_XML_ATTR_OPT(L"presentation:display-date-time", presentation_display_date_time_);
|
||||
CP_XML_ATTR_OPT(L"presentation:display-header", presentation_display_header_);
|
||||
|
||||
if (presentation_sound_)
|
||||
presentation_sound_->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * style_drawing_page_properties::ns = L"style";
|
||||
const wchar_t * style_drawing_page_properties::ns = L"style";
|
||||
const wchar_t * style_drawing_page_properties::name = L"drawing-page-properties";
|
||||
|
||||
void style_drawing_page_properties::serialize(std::wostream & strm)
|
||||
{
|
||||
content_.serialize(strm,ns,name);
|
||||
content_.serialize(strm, ns, name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -74,11 +74,33 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(presentation_placeholder);
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------
|
||||
class presentation_sound : public office_element_impl<presentation_sound>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStylePresentationSound;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_child_element( const office_element_ptr & child){}
|
||||
|
||||
virtual void serialize(std::wostream & strm);
|
||||
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(presentation_sound);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
class drawing_page_properties
|
||||
{
|
||||
public:
|
||||
void apply_from(const drawing_page_properties & Other);
|
||||
|
||||
void serialize(std::wostream & strm, const wchar_t * ns, const wchar_t * name );
|
||||
|
||||
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
|
||||
@ -87,23 +109,24 @@ public:
|
||||
_CP_OPT(odf_types::length_or_percent) draw_fill_image_height_;
|
||||
_CP_OPT(odf_types::length_or_percent) draw_fill_image_width_;
|
||||
|
||||
_CP_OPT(std::wstring) draw_background_size_;//"border" or "full"
|
||||
_CP_OPT(std::wstring) draw_background_size_; //"border" or "full"
|
||||
|
||||
_CP_OPT(std::wstring) presentation_transition_type_;//manual, automatic, semi-automatic (переход отделен от эффектов кликом)
|
||||
_CP_OPT(std::wstring) presentation_transition_style_;//none, fade, move, uncover,clockwise, .... игнор если smil
|
||||
_CP_OPT(std::wstring) presentation_transition_speed_;//slow, medium, fast
|
||||
_CP_OPT(std::wstring) presentation_transition_type_; //manual, automatic, semi-automatic (переход отделен от эффектов кликом)
|
||||
_CP_OPT(std::wstring) presentation_transition_style_; //none, fade, move, uncover,clockwise, .... игнор если smil
|
||||
_CP_OPT(std::wstring) presentation_transition_speed_; //slow, medium, fast
|
||||
|
||||
_CP_OPT(bool) presentation_display_footer_;
|
||||
_CP_OPT(bool) presentation_display_page_number_;
|
||||
_CP_OPT(bool) presentation_display_date_time_;
|
||||
_CP_OPT(bool) presentation_display_header_;
|
||||
_CP_OPT(std::wstring) presentation_page_duration_;
|
||||
|
||||
office_element_ptr presentation_sound_;
|
||||
|
||||
//presentation:background-objects-visible
|
||||
//presentation:background-visible
|
||||
//style:repeat
|
||||
//presentation:page-duration
|
||||
//presentation:visibility.
|
||||
//presentation:sound.
|
||||
//presentation:visibility
|
||||
//draw:background-size
|
||||
|
||||
};
|
||||
|
||||
@ -184,6 +184,8 @@ void table_table::create_child_element(const std::wstring & Ns, const std::wstri
|
||||
|
||||
void table_table::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableSource)
|
||||
@ -277,6 +279,8 @@ void table_table_columns::create_child_element(const std::wstring & Ns, const st
|
||||
}
|
||||
void table_table_columns::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableColumn)
|
||||
@ -312,6 +316,8 @@ void table_table_header_columns::create_child_element( const std::wstring & Ns,
|
||||
}
|
||||
void table_table_header_columns::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableColumn)
|
||||
@ -348,6 +354,8 @@ void table_columns::create_child_element( const std::wstring & Ns, const std::ws
|
||||
}
|
||||
void table_columns::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableColumns)
|
||||
@ -400,6 +408,8 @@ void table_columns_no_group::create_child_element( const std::wstring & Ns, con
|
||||
}
|
||||
void table_columns_no_group::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableColumns || type == typeTableTableColumn)
|
||||
@ -489,6 +499,8 @@ void table_columns_and_groups::create_child_element(const std::wstring & Ns, con
|
||||
}
|
||||
void table_columns_and_groups::add_child_element( const office_element_ptr & child_element, odf_conversion_context * Context)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableColumnGroup)
|
||||
@ -608,6 +620,8 @@ void table_table_row::create_child_element( const std::wstring & Ns, const std::
|
||||
}
|
||||
void table_table_row::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableCell || type == typeTableCoveredTableCell )
|
||||
@ -672,6 +686,8 @@ void table_table_header_rows::create_child_element( const std::wstring & Ns, con
|
||||
}
|
||||
void table_table_header_rows::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableRow)
|
||||
@ -709,6 +725,8 @@ void table_rows::create_child_element(const std::wstring & Ns, const std::wstrin
|
||||
}
|
||||
void table_rows::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableRows)
|
||||
@ -761,6 +779,8 @@ void table_rows_no_group::create_child_element( const std::wstring & Ns, const s
|
||||
}
|
||||
void table_rows_no_group::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableRows || type == typeTableTableRow)
|
||||
@ -816,6 +836,8 @@ void table_rows_and_groups::create_child_element( const std::wstring & Ns, const
|
||||
}
|
||||
void table_rows_and_groups::add_child_element( const office_element_ptr & child_element, odf_conversion_context * Context)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableTableRowGroup)
|
||||
|
||||
@ -64,7 +64,9 @@ void table_database_ranges::create_child_element(const std::wstring & Ns, const
|
||||
|
||||
void table_database_ranges::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
ElementType type = child_element->get_type();
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableDatabaseRange)
|
||||
{
|
||||
|
||||
@ -66,7 +66,9 @@ void table_named_expressions::create_child_element(const std::wstring & Ns, cons
|
||||
|
||||
void table_named_expressions::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
ElementType type = child_element->get_type();
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTableNamedRange)
|
||||
{
|
||||
|
||||
@ -255,6 +255,8 @@ void text_section::create_child_element( const std::wstring & Ns, const std::wst
|
||||
|
||||
void text_section::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeTextSectionSource)
|
||||
@ -510,6 +512,8 @@ void text_unknown_change::create_child_element(const std::wstring & Ns, const st
|
||||
|
||||
void text_unknown_change::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
if (!child_element) return;
|
||||
|
||||
ElementType type = child_element->get_type();
|
||||
|
||||
if (type == typeOfficeChangeInfo)
|
||||
|
||||
@ -171,7 +171,6 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
{
|
||||
if (!oox_picture)return;
|
||||
|
||||
bool bImage = true;
|
||||
if (oox_picture->spPr.Geometry.is_init())
|
||||
{
|
||||
int type = SimpleTypes::shapetypeRect;
|
||||
@ -203,7 +202,33 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
return;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
if (oox_picture->nvPicPr.nvPr.media.is_init())
|
||||
{
|
||||
if (oox_picture->nvPicPr.nvPr.media.is<PPTX::Logic::MediaFile>())
|
||||
{
|
||||
PPTX::Logic::MediaFile & media = oox_picture->nvPicPr.nvPr.media.as<PPTX::Logic::MediaFile>();
|
||||
|
||||
std::wstring sID = media.link.get();
|
||||
std::wstring pathMedia = find_link_by_id(sID, 3);
|
||||
|
||||
std::wstring odf_ref = odf_context()->add_media(pathMedia);
|
||||
|
||||
if (!odf_ref.empty())
|
||||
{
|
||||
odf_context()->drawing_context()->start_media(odf_ref);
|
||||
//... params
|
||||
|
||||
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
|
||||
OoxConverter::convert(&oox_picture->spPr, oox_picture->style.GetPointer());
|
||||
|
||||
odf_context()->drawing_context()->end_media();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
std::wstring odf_ref;
|
||||
std::wstring pathImage;
|
||||
if (oox_picture->blipFill.blip.IsInit())
|
||||
@ -222,7 +247,6 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
bEmbedded = false;
|
||||
}
|
||||
}
|
||||
|
||||
odf_context()->drawing_context()->start_image(odf_ref);
|
||||
{
|
||||
double Width = 0, Height = 0;
|
||||
@ -1120,6 +1144,22 @@ void OoxConverter::convert(PPTX::Logic::CNvPr *oox_cnvPr)
|
||||
}
|
||||
if (oox_cnvPr->hlinkClick.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->start_action(oox_cnvPr->hlinkClick->action.get_value_or(L""));
|
||||
|
||||
if (oox_cnvPr->hlinkClick->snd.IsInit())
|
||||
{
|
||||
std::wstring sound = find_link_by_id(oox_cnvPr->hlinkClick->snd->embed.get(), 3);
|
||||
|
||||
std::wstring href = odf_context()->add_media(sound);
|
||||
odf_context()->drawing_context()->add_sound(href);
|
||||
}
|
||||
if (oox_cnvPr->hlinkClick->id.IsInit())
|
||||
{
|
||||
std::wstring hlink = find_link_by_id(oox_cnvPr->hlinkClick->id.get(), 2);
|
||||
|
||||
odf_context()->drawing_context()->add_link(hlink);
|
||||
}
|
||||
odf_context()->drawing_context()->end_action();
|
||||
}
|
||||
//nullable_string title;
|
||||
//nullable<Hyperlink> hlinkHover;
|
||||
@ -1146,8 +1186,11 @@ void OoxConverter::convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr)
|
||||
void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr)
|
||||
{
|
||||
if (!oox_nvPr) return;
|
||||
|
||||
|
||||
|
||||
//ph уровнем выше
|
||||
|
||||
}
|
||||
|
||||
void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_props, int level)
|
||||
|
||||
@ -304,28 +304,31 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
_CP_LOG << L"[error] : no convert element(" << (oox_unknown ? oox_unknown->getType() : -1 ) << L")\n";
|
||||
}
|
||||
}
|
||||
std::wstring OoxConverter::find_link_by (smart_ptr<OOX::File> & oFile, int type)
|
||||
{
|
||||
if (!oFile.IsInit()) return L"";
|
||||
|
||||
std::wstring ref;
|
||||
if (type == 1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
//void OoxConverter::convert(OOX::Drawing::CLockedCanvas *oox_canvas)
|
||||
//{
|
||||
// if (oox_canvas == NULL)return;
|
||||
//
|
||||
// odf_context()->drawing_context()->start_group();
|
||||
// if (oox_canvas->m_oNvGroupSpPr.IsInit() && oox_canvas->m_oNvGroupSpPr->m_oCNvPr.IsInit())
|
||||
// {
|
||||
// if (oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
|
||||
// odf_context()->drawing_context()->set_group_name(*oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName);
|
||||
// if (oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
|
||||
// odf_context()->drawing_context()->set_group_z_order(oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
|
||||
// }
|
||||
// convert(oox_canvas->m_oGroupSpPr.GetPointer());
|
||||
// convert(oox_canvas->m_oSpPr.GetPointer());
|
||||
//
|
||||
// for (size_t i = 0; i < oox_canvas->m_arrItems.size(); i++)
|
||||
// {
|
||||
// convert(oox_canvas->m_arrItems[i]);
|
||||
// }
|
||||
// odf_context()->drawing_context()->end_group();
|
||||
//}
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
|
||||
{
|
||||
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
|
||||
if (pHyperlink->bHyperlink)
|
||||
ref = pHyperlink->Uri().GetPath();
|
||||
}
|
||||
if (type == 3)
|
||||
{
|
||||
OOX::Media* pMedia = (OOX::Media*)oFile.operator->();
|
||||
|
||||
ref = pMedia->filename().GetPath();
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
bool OoxConverter::convert(std::wstring sSchemeColor, DWORD & argb)
|
||||
{
|
||||
|
||||
@ -360,6 +360,7 @@ public:
|
||||
virtual PPTX::Theme *oox_theme() = 0;
|
||||
virtual PPTX::Logic::ClrMap *oox_clrMap() {return NULL;}
|
||||
|
||||
std::wstring find_link_by (NSCommon::smart_ptr<OOX::File> & oFile, int type);
|
||||
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;
|
||||
|
||||
|
||||
@ -131,48 +131,23 @@ NSCommon::smart_ptr<OOX::File> DocxConverter::find_file_by_id(std::wstring sId)
|
||||
|
||||
std::wstring DocxConverter::find_link_by_id (std::wstring sId, int type)
|
||||
{
|
||||
if (!docx_document) return L"";
|
||||
|
||||
std::wstring ref;
|
||||
smart_ptr<OOX::File> oFile;
|
||||
|
||||
if (oox_current_child_document)
|
||||
{
|
||||
oFile = oox_current_child_document->Find(sId);
|
||||
ref = OoxConverter::find_link_by(oFile, type);
|
||||
}
|
||||
if (!ref.empty()) return ref;
|
||||
|
||||
OOX::CDocument *oox_doc = docx_document->GetDocument();
|
||||
|
||||
if (oox_doc == NULL)return L"";
|
||||
|
||||
std::wstring ref;
|
||||
|
||||
if (ref.empty() && oox_current_child_document)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = oox_current_child_document->Find(sId);
|
||||
if (oFile.IsInit())
|
||||
{
|
||||
if (type==1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type==2 && oFile.IsInit() && OOX::FileTypes::HyperLink == oFile->type())
|
||||
{
|
||||
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
|
||||
|
||||
ref = pHyperlink->Uri().GetPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
smart_ptr<OOX::File> oFile = docx_document->GetDocument()->Find(sId);
|
||||
if (ref.empty() && oFile.IsInit())
|
||||
{
|
||||
if (type==1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
|
||||
{
|
||||
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
|
||||
|
||||
ref = pHyperlink->Uri().GetPath();
|
||||
}
|
||||
}
|
||||
if (oox_doc == NULL) return L"";
|
||||
|
||||
oFile = oox_doc->Find(sId);
|
||||
ref = OoxConverter::find_link_by(oFile, type);
|
||||
|
||||
return ref;
|
||||
}
|
||||
@ -253,116 +228,88 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
case OOX::et_w_ptab:
|
||||
{
|
||||
OOX::Logic::CPTab* pT= dynamic_cast<OOX::Logic::CPTab*>(oox_unknown);
|
||||
convert(pT);
|
||||
convert(dynamic_cast<OOX::Logic::CPTab*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_sdt:
|
||||
{
|
||||
OOX::Logic::CSdt* pP= dynamic_cast<OOX::Logic::CSdt*>(oox_unknown);
|
||||
convert(pP);
|
||||
convert(dynamic_cast<OOX::Logic::CSdt*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_fldSimple:
|
||||
{
|
||||
OOX::Logic::CFldSimple* pFldS= dynamic_cast<OOX::Logic::CFldSimple*>(oox_unknown);
|
||||
convert(pFldS);
|
||||
convert(dynamic_cast<OOX::Logic::CFldSimple*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_r:
|
||||
{
|
||||
OOX::Logic::CRun* pRun= dynamic_cast<OOX::Logic::CRun*>(oox_unknown);
|
||||
convert(pRun);
|
||||
convert(dynamic_cast<OOX::Logic::CRun*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_p:
|
||||
{
|
||||
OOX::Logic::CParagraph* pP= dynamic_cast<OOX::Logic::CParagraph*>(oox_unknown);
|
||||
convert(pP);
|
||||
convert(dynamic_cast<OOX::Logic::CParagraph*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_ins:
|
||||
{
|
||||
OOX::Logic::CIns* pIns= dynamic_cast<OOX::Logic::CIns*>(oox_unknown);
|
||||
convert(pIns);
|
||||
convert(dynamic_cast<OOX::Logic::CIns*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_del:
|
||||
{
|
||||
OOX::Logic::CDel* pDel= dynamic_cast<OOX::Logic::CDel*>(oox_unknown);
|
||||
convert(pDel);
|
||||
convert(dynamic_cast<OOX::Logic::CDel*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_smartTag:
|
||||
{
|
||||
OOX::Logic::CSmartTag* pTag= dynamic_cast<OOX::Logic::CSmartTag*>(oox_unknown);
|
||||
convert(pTag);
|
||||
convert(dynamic_cast<OOX::Logic::CSmartTag*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_pPr:
|
||||
{
|
||||
OOX::Logic::CParagraphProperty* pPProp= dynamic_cast<OOX::Logic::CParagraphProperty*>(oox_unknown);
|
||||
convert(pPProp);
|
||||
convert(dynamic_cast<OOX::Logic::CParagraphProperty*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_hyperlink:
|
||||
{
|
||||
OOX::Logic::CHyperlink* pH= dynamic_cast<OOX::Logic::CHyperlink*>(oox_unknown);
|
||||
convert(pH);
|
||||
convert(dynamic_cast<OOX::Logic::CHyperlink*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_rPr:
|
||||
{
|
||||
OOX::Logic::CRunProperty* pRProp= dynamic_cast<OOX::Logic::CRunProperty*>(oox_unknown);
|
||||
convert(pRProp);
|
||||
convert(dynamic_cast<OOX::Logic::CRunProperty*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_mc_alternateContent:
|
||||
{
|
||||
OOX::Logic::CAlternateContent* pAltCont= dynamic_cast<OOX::Logic::CAlternateContent*>(oox_unknown);
|
||||
convert(pAltCont);
|
||||
convert(dynamic_cast<OOX::Logic::CAlternateContent*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_drawing:
|
||||
{
|
||||
OOX::Logic::CDrawing* pDrawing= dynamic_cast<OOX::Logic::CDrawing*>(oox_unknown);
|
||||
convert(pDrawing);
|
||||
convert(dynamic_cast<OOX::Logic::CDrawing*>(oox_unknown));
|
||||
}break;
|
||||
//case OOX::et_c_chart:
|
||||
//{
|
||||
// PPTX::Logic::ChartRec* pChart = dynamic_cast<PPTX::Logic::ChartRec*>(oox_unknown);
|
||||
// convert(pChart);
|
||||
//}break;
|
||||
//case OOX::et_w_Shape:
|
||||
//{
|
||||
// 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);
|
||||
convert(dynamic_cast<OOX::Logic::CPicture*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_object:
|
||||
{
|
||||
OOX::Logic::CObject* pObj = dynamic_cast<OOX::Logic::CObject*>(oox_unknown);
|
||||
convert(pObj);
|
||||
convert(dynamic_cast<OOX::Logic::CObject*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_pic_pic:
|
||||
case OOX::et_pic:
|
||||
case OOX::et_p_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_w_GroupShape:
|
||||
case OOX::et_p_ShapeTree:
|
||||
{
|
||||
PPTX::Logic::SpTree* pGroupShape= dynamic_cast<PPTX::Logic::SpTree*>(oox_unknown);
|
||||
convert(pGroupShape);
|
||||
convert(dynamic_cast<PPTX::Logic::SpTree*>(oox_unknown));
|
||||
}break;
|
||||
|
||||
case OOX::et_w_commentRangeEnd:
|
||||
{
|
||||
OOX::Logic::CCommentRangeEnd* pCommEnd = dynamic_cast<OOX::Logic::CCommentRangeEnd*>(oox_unknown);
|
||||
convert(pCommEnd);
|
||||
convert(dynamic_cast<OOX::Logic::CCommentRangeEnd*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_commentRangeStart:
|
||||
{
|
||||
OOX::Logic::CCommentRangeStart* pCommStart = dynamic_cast<OOX::Logic::CCommentRangeStart*>(oox_unknown);
|
||||
convert(pCommStart);
|
||||
convert(dynamic_cast<OOX::Logic::CCommentRangeStart*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_commentReference:
|
||||
{
|
||||
convert(dynamic_cast<OOX::Logic::CCommentReference*>(oox_unknown)); //если нет Start - означает начало с предыдущего Run
|
||||
convert(dynamic_cast<OOX::Logic::CCommentReference*>(oox_unknown));
|
||||
//если нет Start - означает начало с предыдущего Run
|
||||
}break;
|
||||
case OOX::et_w_footnoteReference:
|
||||
{
|
||||
@ -386,13 +333,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
}break;
|
||||
case OOX::et_w_tr:
|
||||
{
|
||||
OOX::Logic::CTr* pRow= dynamic_cast<OOX::Logic::CTr*>(oox_unknown);
|
||||
convert(pRow);
|
||||
convert(dynamic_cast<OOX::Logic::CTr*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_tc:
|
||||
{
|
||||
OOX::Logic::CTc* pCell= dynamic_cast<OOX::Logic::CTc*>(oox_unknown);
|
||||
convert(pCell);
|
||||
convert(dynamic_cast<OOX::Logic::CTc*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_bookmarkStart:
|
||||
{
|
||||
|
||||
@ -42,6 +42,16 @@
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Seq.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CTn.h"
|
||||
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/EmptyTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/OrientationTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/EightDirectionTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/OptionalBlackTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SideDirectionTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/CornerDirectionTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/WheelTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SplitTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/ZoomTransition.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../OdfFormat/odp_conversion_context.h"
|
||||
@ -158,43 +168,20 @@ NSCommon::smart_ptr<OOX::File> PptxConverter::find_file_by_id(std::wstring sId)
|
||||
|
||||
std::wstring PptxConverter::find_link_by_id (std::wstring sId, int type)
|
||||
{
|
||||
std::wstring ref;
|
||||
if(!pptx_document) return L"";
|
||||
|
||||
if (ref.empty() && oox_current_child_document)
|
||||
std::wstring ref;
|
||||
smart_ptr<OOX::File> oFile;
|
||||
|
||||
if (oox_current_child_document)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = oox_current_child_document->Find(sId);
|
||||
if (oFile.IsInit())
|
||||
{
|
||||
if (type==1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type==2 && oFile.IsInit() && OOX::FileTypes::HyperLink == oFile->type())
|
||||
{
|
||||
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
|
||||
|
||||
ref = pHyperlink->Uri().GetPath();
|
||||
}
|
||||
}
|
||||
oFile = oox_current_child_document->Find(sId);
|
||||
ref = OoxConverter::find_link_by(oFile, type);
|
||||
}
|
||||
smart_ptr<OOX::File> oFile = current_slide ? current_slide->Find(sId) : pptx_document->Find(sId);
|
||||
if (ref.empty() && oFile.IsInit())
|
||||
{
|
||||
if (type==1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
if (!ref.empty()) return ref;
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
|
||||
{
|
||||
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
|
||||
|
||||
ref = pHyperlink->Uri().GetPath();
|
||||
}
|
||||
}
|
||||
oFile = current_slide ? current_slide->Find(sId) : pptx_document->Find(sId);
|
||||
ref = OoxConverter::find_link_by(oFile, type);
|
||||
|
||||
return ref;
|
||||
}
|
||||
@ -365,13 +352,18 @@ void PptxConverter::convert_slides()
|
||||
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, 3);
|
||||
|
||||
if (slide->Layout->transition.IsInit()) convert (slide->Layout->transition.GetPointer());
|
||||
else convert (slide->Master->transition.GetPointer());
|
||||
|
||||
//if (slide->Layout->timing.IsInit()) convert (slide->Layout->timing.GetPointer());
|
||||
//else convert (slide->Master->timing.GetPointer());
|
||||
|
||||
if (!presentation->notesMasterIdLst.empty())
|
||||
{
|
||||
rId = presentation->notesMasterIdLst[0].rid.get();
|
||||
smart_ptr<PPTX::NotesMaster> notes_master = ((*presentation)[rId]).smart_dynamic_cast<PPTX::NotesMaster>();
|
||||
convert(notes_master.operator->());
|
||||
}
|
||||
//add note master
|
||||
odp_context->end_master_slide();
|
||||
|
||||
m_mapMasters.insert(std::make_pair(master_name, master_style_name));
|
||||
@ -415,7 +407,7 @@ void PptxConverter::convert_slides()
|
||||
convert (slide->Note.operator->());
|
||||
|
||||
convert (slide->transition.GetPointer());
|
||||
convert (slide->timing.GetPointer());
|
||||
//convert (slide->timing.GetPointer());
|
||||
|
||||
|
||||
odp_context->end_slide();
|
||||
@ -490,6 +482,24 @@ void PptxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
|
||||
switch(oox_unknown->getType())
|
||||
{
|
||||
case OOX::et_p_EmptyTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::EmptyTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_OrientationTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::OrientationTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_EightDirectionTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::EightDirectionTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_OptionalBlackTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::OptionalBlackTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_CornerDirectionTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::CornerDirectionTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_SideDirectionTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::SideDirectionTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_WheelTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::WheelTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_SplitTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::SplitTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_ZoomTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::ZoomTransition*>(oox_unknown)); break;
|
||||
default:
|
||||
{
|
||||
OoxConverter::convert(oox_unknown);
|
||||
@ -542,18 +552,17 @@ void PptxConverter::convert( PPTX::Logic::Transition *oox_transition )
|
||||
if (oox_transition->dur.is_init())
|
||||
odp_context->current_slide().set_transition_duration(*oox_transition->dur);
|
||||
|
||||
odp_context->current_slide().set_transition_type(5);
|
||||
//convert(oox_transition->base.operator->());
|
||||
convert(oox_transition->base.base.operator->());
|
||||
|
||||
//if (oox_transition->sndAc.is_init() && oox_transition->sndAc->stSnd.is_init())
|
||||
//{
|
||||
// std::wstring sID = oox_transition->sndAc->stSnd->embed->get();
|
||||
// pathAudio = find_link_by_id(sID, 1);
|
||||
//
|
||||
// std::wstring odf_ref = odf_context()->add_media(pathAudio);
|
||||
if (oox_transition->sndAc.is_init() && oox_transition->sndAc->stSnd.is_init())
|
||||
{
|
||||
std::wstring sID = oox_transition->sndAc->stSnd->embed.get();
|
||||
std::wstring pathAudio = find_link_by_id(sID, 3);
|
||||
|
||||
std::wstring odf_ref = odf_context()->add_media(pathAudio);
|
||||
|
||||
// odp_context->current_slide().set_transition_sound(odf_ref, oox_transition->sndAc->stSnd->loop.get_value_or(false));
|
||||
//}
|
||||
odp_context->current_slide().set_transition_sound(odf_ref, oox_transition->sndAc->stSnd->loop.get_value_or(false));
|
||||
}
|
||||
|
||||
odp_context->current_slide().end_transition();
|
||||
}
|
||||
@ -562,14 +571,14 @@ void PptxConverter::convert(PPTX::Logic::Timing *oox_timing)
|
||||
if (!oox_timing) return;
|
||||
if (!oox_timing->tnLst.IsInit()) return;
|
||||
|
||||
odp_context->start_timing();
|
||||
odp_context->current_slide().start_timing();
|
||||
for (size_t i = 0; i < oox_timing->tnLst->list.size(); i++)
|
||||
{
|
||||
if (oox_timing->tnLst->list[i].is_init() == false) continue;
|
||||
|
||||
convert(&oox_timing->tnLst->list[i]);
|
||||
}
|
||||
odp_context->end_timing();
|
||||
odp_context->current_slide().end_timing();
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::TimeNodeBase *oox_time_base)
|
||||
{
|
||||
@ -591,6 +600,157 @@ void PptxConverter::convert(PPTX::Logic::TimeNodeBase *oox_time_base)
|
||||
odp_context->current_slide().end_timing_seq();
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::EmptyTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"random")
|
||||
odp_context->current_slide().set_transition_type(40);
|
||||
if (oox_transition->name == L"circle")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(16);
|
||||
odp_context->current_slide().set_transition_subtype(L"circle");
|
||||
}
|
||||
if (oox_transition->name == L"dissolve")
|
||||
odp_context->current_slide().set_transition_type(39);
|
||||
if (oox_transition->name == L"diamond")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(11);
|
||||
odp_context->current_slide().set_transition_subtype(L"diamond");
|
||||
}
|
||||
if (oox_transition->name == L"newsflash")
|
||||
odp_context->current_slide().set_transition_type(24);
|
||||
if (oox_transition->name == L"plus")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(19);
|
||||
odp_context->current_slide().set_transition_subtype(L"fourPoint");
|
||||
}
|
||||
if (oox_transition->name == L"wedge")
|
||||
odp_context->current_slide().set_transition_type(24);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::OrientationTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"comb")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(34);
|
||||
|
||||
if (oox_transition->dir.IsInit())
|
||||
{
|
||||
if (oox_transition->dir->get() == L"horz")
|
||||
odp_context->current_slide().set_transition_subtype(L"combHorizontal");
|
||||
if (oox_transition->dir->get() == L"vert")
|
||||
odp_context->current_slide().set_transition_subtype(L"combVertical");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oox_transition->name == L"blinds")
|
||||
odp_context->current_slide().set_transition_type(38);
|
||||
else if (oox_transition->name == L"checker")
|
||||
odp_context->current_slide().set_transition_type(37);
|
||||
else if (oox_transition->name == L"randomBar")
|
||||
odp_context->current_slide().set_transition_type(40);
|
||||
|
||||
//if (oox_transition->dir.IsInit())
|
||||
//{
|
||||
// if (oox_transition->dir->get() == L"horz")
|
||||
// odp_context->current_slide().set_transition_subtype(L"combHorizontal");
|
||||
// if (oox_transition->dir->get() == L"vert")
|
||||
// odp_context->current_slide().set_transition_subtype(L"combVertical");
|
||||
//}
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::EightDirectionTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"cover")
|
||||
odp_context->current_slide().set_transition_type(1);
|
||||
if (oox_transition->name == L"pull")
|
||||
odp_context->current_slide().set_transition_type(35);
|
||||
|
||||
if (oox_transition->dir.IsInit())
|
||||
{
|
||||
if (oox_transition->dir->get() == L"d") odp_context->current_slide().set_transition_subtype(L"fromTop");
|
||||
else if (oox_transition->dir->get() == L"l") odp_context->current_slide().set_transition_subtype(L"fromRight");
|
||||
else if (oox_transition->dir->get() == L"r") odp_context->current_slide().set_transition_subtype(L"fromLeft");
|
||||
else if (oox_transition->dir->get() == L"u") odp_context->current_slide().set_transition_subtype(L"fromBottom");
|
||||
|
||||
else if (oox_transition->dir->get() == L"rd") odp_context->current_slide().set_transition_subtype(L"horizontalLeft");
|
||||
else if (oox_transition->dir->get() == L"lu") odp_context->current_slide().set_transition_subtype(L"horizontalRight");
|
||||
else if (oox_transition->dir->get() == L"ld") odp_context->current_slide().set_transition_subtype(L"verticalRight");
|
||||
else if (oox_transition->dir->get() == L"ru") odp_context->current_slide().set_transition_subtype(L"verticalLeft");
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::OptionalBlackTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"cut")
|
||||
odp_context->current_slide().set_transition_type(36);
|
||||
if (oox_transition->name == L"fade")
|
||||
odp_context->current_slide().set_transition_type(36);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::SideDirectionTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"push")
|
||||
odp_context->current_slide().set_transition_type(34);
|
||||
if (oox_transition->name == L"wipe")
|
||||
odp_context->current_slide().set_transition_type(0);
|
||||
|
||||
if (oox_transition->dir.IsInit())
|
||||
{
|
||||
if (oox_transition->dir->get() == L"d") odp_context->current_slide().set_transition_subtype(L"fromTop");
|
||||
else if (oox_transition->dir->get() == L"l") odp_context->current_slide().set_transition_subtype(L"fromRight");
|
||||
else if (oox_transition->dir->get() == L"r") odp_context->current_slide().set_transition_subtype(L"fromLeft");
|
||||
else if (oox_transition->dir->get() == L"u") odp_context->current_slide().set_transition_subtype(L"fromBottom");
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::CornerDirectionTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == strips
|
||||
odp_context->current_slide().set_transition_type(4);
|
||||
|
||||
if (oox_transition->dir.IsInit())
|
||||
{
|
||||
if (oox_transition->dir->get() == L"rd") odp_context->current_slide().set_transition_subtype(L"horizontalLeft");
|
||||
else if (oox_transition->dir->get() == L"lu") odp_context->current_slide().set_transition_subtype(L"horizontalRight");
|
||||
else if (oox_transition->dir->get() == L"ld") odp_context->current_slide().set_transition_subtype(L"verticalRight");
|
||||
else if (oox_transition->dir->get() == L"ru") odp_context->current_slide().set_transition_subtype(L"verticalLeft");
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::WheelTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == wheel
|
||||
odp_context->current_slide().set_transition_type(22);
|
||||
|
||||
switch (oox_transition->spokes.get_value_or(0))
|
||||
{
|
||||
case 1: odp_context->current_slide().set_transition_subtype(L"oneBlade"); break;
|
||||
case 3: odp_context->current_slide().set_transition_subtype(L"threeBlade"); break;
|
||||
case 4: odp_context->current_slide().set_transition_subtype(L"fourBlade"); break;
|
||||
case 8: odp_context->current_slide().set_transition_subtype(L"eightBlade"); break;
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::SplitTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == split
|
||||
odp_context->current_slide().set_transition_type(8);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::ZoomTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == zoom
|
||||
odp_context->current_slide().set_transition_type(11);
|
||||
}
|
||||
|
||||
void PptxConverter::convert(PPTX::Logic::CTn *oox_time_common)
|
||||
{
|
||||
if (!oox_time_common) return;
|
||||
@ -605,7 +765,10 @@ void PptxConverter::convert(PPTX::Logic::CTn *oox_time_common)
|
||||
}
|
||||
if (oox_time_common->dur.IsInit())
|
||||
{
|
||||
odp_context->current_slide().set_anim_duration(*oox_time_common->dur);
|
||||
if (*oox_time_common->dur == L"indefinite")
|
||||
odp_context->current_slide().set_anim_duration(-1);
|
||||
else
|
||||
odp_context->current_slide().set_anim_duration(XmlUtils::GetInteger(*oox_time_common->dur));
|
||||
}
|
||||
if (oox_time_common->restart.IsInit())
|
||||
{
|
||||
|
||||
@ -69,7 +69,15 @@ namespace PPTX
|
||||
class TxStyles;
|
||||
class TimeNodeBase;
|
||||
class CTn;
|
||||
|
||||
class EmptyTransition;
|
||||
class OrientationTransition;
|
||||
class EightDirectionTransition;
|
||||
class OptionalBlackTransition;
|
||||
class CornerDirectionTransition;
|
||||
class SideDirectionTransition;
|
||||
class WheelTransition;
|
||||
class SplitTransition;
|
||||
class ZoomTransition;
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,6 +144,16 @@ namespace Oox2Odf
|
||||
|
||||
void convert(PPTX::Logic::Ln *oox_ln_border, std::wstring & odf_border);
|
||||
private:
|
||||
void convert(PPTX::Logic::EmptyTransition *oox_transition);
|
||||
void convert(PPTX::Logic::OrientationTransition *oox_transition);
|
||||
void convert(PPTX::Logic::EightDirectionTransition *oox_transition);
|
||||
void convert(PPTX::Logic::OptionalBlackTransition *oox_transition);
|
||||
void convert(PPTX::Logic::CornerDirectionTransition *oox_transition);
|
||||
void convert(PPTX::Logic::SideDirectionTransition *oox_transition);
|
||||
void convert(PPTX::Logic::WheelTransition *oox_transition);
|
||||
void convert(PPTX::Logic::SplitTransition *oox_transition);
|
||||
void convert(PPTX::Logic::ZoomTransition *oox_transition);
|
||||
|
||||
PPTX::Folder *pptx_document;
|
||||
PPTX::Presentation *presentation;
|
||||
cpdoccore::odf_writer::package::odf_document *output_document;
|
||||
|
||||
@ -115,30 +115,20 @@ smart_ptr<OOX::File> XlsxConverter::find_file_by_id(std::wstring sId)
|
||||
}
|
||||
std::wstring XlsxConverter::find_link_by_id (std::wstring sId, int type)
|
||||
{
|
||||
std::wstring ref;
|
||||
smart_ptr<OOX::File> oFile;
|
||||
std::wstring ref;
|
||||
|
||||
if (type == 1)
|
||||
if (xlsx_current_container)
|
||||
{
|
||||
if (ref.empty() && xlsx_current_container)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = xlsx_current_container->Find(sId);
|
||||
if (oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
oFile = xlsx_current_container->Find(sId);
|
||||
ref = OoxConverter::find_link_by(oFile, type);
|
||||
}
|
||||
if (!ref.empty()) return ref;
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
}
|
||||
if (ref.empty() && oox_current_child_document)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = oox_current_child_document->Find(sId);
|
||||
if (oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
}
|
||||
if (oox_current_child_document)
|
||||
{
|
||||
oFile = oox_current_child_document->Find(sId);
|
||||
ref = OoxConverter::find_link_by(oFile, type);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
@ -401,6 +401,14 @@
|
||||
RelativePath="..\OdfFormat\office_chart.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OdfFormat\office_event_listeners.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OdfFormat\office_event_listeners.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OdfFormat\office_presentation.cpp"
|
||||
>
|
||||
@ -409,6 +417,14 @@
|
||||
RelativePath="..\OdfFormat\office_presentation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OdfFormat\office_scripts.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OdfFormat\office_scripts.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OdfFormat\office_settings.cpp"
|
||||
>
|
||||
|
||||
@ -114,9 +114,14 @@ namespace PPTX
|
||||
pRelation->Type() == OOX::Presentation::FileTypes::Slide))
|
||||
{// + external audio, video ...
|
||||
|
||||
smart_ptr<OOX::File> file;
|
||||
smart_ptr<OOX::File> file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->Target()));
|
||||
|
||||
file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->Target()));
|
||||
if (pRelation->Type() == OOX::Presentation::FileTypes::Slide)
|
||||
{
|
||||
OOX::HyperLink *link = dynamic_cast<OOX::HyperLink*>(file.operator->());
|
||||
if (link)
|
||||
link->bHyperlink = false;
|
||||
}
|
||||
|
||||
normPath = pRelation->Target();
|
||||
Add(pRelation->rId(), file);
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(CornerDirectionTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_CornerDirectionTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -61,8 +65,8 @@ namespace PPTX
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::CornerDirectionVal> dir;
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::CornerDirectionVal> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(EightDirectionTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_EightDirectionTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -60,8 +64,7 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::EightDirectionVal> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -44,7 +44,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(EmptyTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_EmptyTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -55,7 +59,6 @@ namespace PPTX
|
||||
return _T("<p:") + name + _T("/>");
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -44,10 +44,14 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(OptionalBlackTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_OptionalBlackTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
node.ReadAttributeBase(L"thruBlk", thruBlk);
|
||||
}
|
||||
|
||||
@ -59,9 +63,9 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
nullable_bool thruBlk;
|
||||
std::wstring name;
|
||||
nullable_bool thruBlk;
|
||||
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(OrientationTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_OrientationTransition;
|
||||
}
|
||||
|
||||
void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -60,9 +64,8 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::Orient> dir;
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::Orient> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(SideDirectionTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_SideDirectionTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -60,8 +64,7 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::SideDirectionVal> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -46,7 +46,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(SplitTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_SplitTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"dir", dir);
|
||||
@ -62,7 +66,6 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:split"), oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_limit<Limit::InOutDirectionVal> dir;
|
||||
nullable_limit<Limit::Orient> orient;
|
||||
protected:
|
||||
|
||||
@ -44,7 +44,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(WheelTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_WheelTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"spokes", spokes);
|
||||
@ -58,7 +62,6 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:wheel"), oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_int spokes;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(ZoomTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_ZoomTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"dir", dir);
|
||||
@ -59,8 +63,7 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:zoom"), oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_limit<Limit::InOutDirectionVal> dir;
|
||||
nullable_limit<Limit::InOutDirectionVal> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -799,7 +799,7 @@ namespace ComplexTypes
|
||||
if ( m_oVal.IsInit() )
|
||||
{
|
||||
sResult += _T("w:val=\"");
|
||||
sResult += m_oVal->ToString();
|
||||
sResult += std::to_wstring(m_oVal->ToHps());
|
||||
sResult += _T("\" ");
|
||||
}
|
||||
|
||||
|
||||
@ -3085,6 +3085,11 @@ namespace SimpleTypes
|
||||
m_dValue = fabs( dValue * 72.0 );
|
||||
return m_dValue;
|
||||
}
|
||||
virtual double FromHps(double dValue)
|
||||
{
|
||||
m_dValue = dValue / 2;
|
||||
return m_dValue;
|
||||
}
|
||||
SimpleType_FromString (double)
|
||||
SimpleType_Operator_Equal (CHpsMeasure)
|
||||
UniversalMeasure_AdditionalOpearators(CHpsMeasure)
|
||||
|
||||
@ -52,8 +52,6 @@ namespace OOX
|
||||
~External()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const CPath& uri)
|
||||
{
|
||||
m_uri = uri;
|
||||
@ -61,9 +59,7 @@ namespace OOX
|
||||
virtual void write(const CPath& filename, const CPath& directory, CContentTypes& content) const
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
CPath Uri() const
|
||||
CPath Uri() const
|
||||
{
|
||||
return m_uri;
|
||||
}
|
||||
|
||||
@ -43,16 +43,16 @@ namespace OOX
|
||||
public:
|
||||
HyperLink()
|
||||
{
|
||||
bHyperlink = true;
|
||||
}
|
||||
HyperLink(const CPath& uri)
|
||||
{
|
||||
bHyperlink = true;
|
||||
read(uri);
|
||||
}
|
||||
~HyperLink()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const FileType type() const
|
||||
{
|
||||
return FileTypes::HyperLink;
|
||||
@ -65,6 +65,8 @@ namespace OOX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
bool bHyperlink; // in pptx link to slide perhaps
|
||||
};
|
||||
} // namespace OOX
|
||||
|
||||
|
||||
@ -142,6 +142,8 @@ namespace OOX
|
||||
pItem = new CSmartTag( oItem );
|
||||
//else if ( _T("w:subDoc") == sName )
|
||||
// pItem = new CSubDoc( oItem );
|
||||
else if ( _T("w:ffData") == sName )
|
||||
m_oFFData = new CFFData( oItem );
|
||||
|
||||
if ( pItem )
|
||||
m_arrItems.push_back( pItem );
|
||||
@ -232,6 +234,8 @@ namespace OOX
|
||||
pItem = new CSmartTag( oReader );
|
||||
//else if ( _T("w:subDoc") == sName )
|
||||
// pItem = new CSubDoc( oReader );
|
||||
else if ( _T("w:ffData") == sName )
|
||||
m_oFFData = new CFFData( oReader );
|
||||
|
||||
if ( pItem )
|
||||
m_arrItems.push_back( pItem );
|
||||
@ -259,6 +263,11 @@ namespace OOX
|
||||
|
||||
sResult += _T(">");
|
||||
|
||||
if (m_oFFData.IsInit())
|
||||
{
|
||||
sResult += m_oFFData->toXML();
|
||||
}
|
||||
|
||||
for (unsigned int nIndex = 0; nIndex < m_arrItems.size(); nIndex++ )
|
||||
{
|
||||
if ( m_arrItems[nIndex] )
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
#include "../WritingElement.h"
|
||||
#include "../../Common/SimpleTypes_Word.h"
|
||||
#include "../../Common/SimpleTypes_Shared.h"
|
||||
#include "../../DocxFormat/Logic/FldChar.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
@ -120,6 +121,7 @@ namespace OOX
|
||||
nullable<std::wstring > m_sInstr;
|
||||
|
||||
// Childs
|
||||
nullable<OOX::Logic::CFFData > m_oFFData;
|
||||
};
|
||||
|
||||
} // namespace Logic
|
||||
|
||||
@ -45,6 +45,7 @@ namespace OOX
|
||||
}
|
||||
Audio(const CPath& filename)
|
||||
{
|
||||
read(filename);
|
||||
}
|
||||
virtual ~Audio()
|
||||
{
|
||||
|
||||
@ -375,6 +375,16 @@ namespace OOX
|
||||
et_p_fld,
|
||||
et_p_br,
|
||||
et_p_MathPara,
|
||||
|
||||
et_p_EmptyTransition,
|
||||
et_p_OrientationTransition,
|
||||
et_p_EightDirectionTransition,
|
||||
et_p_OptionalBlackTransition,
|
||||
et_p_CornerDirectionTransition,
|
||||
et_p_SideDirectionTransition,
|
||||
et_p_WheelTransition,
|
||||
et_p_SplitTransition,
|
||||
et_p_ZoomTransition,
|
||||
|
||||
et_a_textFit,
|
||||
et_a_hyperlink,
|
||||
|
||||
@ -1,5 +1,20 @@
|
||||
DEFINES += HAVE_VA_COPY
|
||||
|
||||
core_static_link_xml_full {
|
||||
DEFINES += \
|
||||
LIBXML_READER_ENABLED \
|
||||
LIBXML_PUSH_ENABLED \
|
||||
LIBXML_HTML_ENABLED \
|
||||
LIBXML_XPATH_ENABLED \
|
||||
LIBXML_OUTPUT_ENABLED \
|
||||
LIBXML_C14N_ENABLED \
|
||||
LIBXML_SAX1_ENABLED \
|
||||
LIBXML_TREE_ENABLED \
|
||||
LIBXML_XPTR_ENABLED \
|
||||
IN_LIBXML \
|
||||
LIBXML_STATIC
|
||||
}
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../../libxml2/include \
|
||||
$$PWD/../../libxml2/include/libxml \
|
||||
|
||||
@ -1,248 +0,0 @@
|
||||
#ifndef _XML_OOXMLVERIFIER_H_
|
||||
#define _XML_OOXMLVERIFIER_H_
|
||||
|
||||
#include "./XmlCanonicalizator.h"
|
||||
#include "./XmlTransform.h"
|
||||
#include "./XmlCertificate.h"
|
||||
|
||||
#define OOXML_SIGNATURE_VALID 0
|
||||
#define OOXML_SIGNATURE_INVALID 1
|
||||
#define OOXML_SIGNATURE_NOTSUPPORTED 2
|
||||
#define OOXML_SIGNATURE_BAD 3
|
||||
|
||||
class COOXMLSignature
|
||||
{
|
||||
private:
|
||||
int m_valid;
|
||||
std::string m_guid;
|
||||
ICertificate* m_cert;
|
||||
|
||||
std::string m_sImageValidBase64;
|
||||
std::string m_sImageInvalidBase64;
|
||||
|
||||
private:
|
||||
XmlUtils::CXmlNode m_node; // signature file
|
||||
|
||||
class CXmlStackNamespaces
|
||||
{
|
||||
public:
|
||||
std::wstring m_namespaces;
|
||||
XmlUtils::CXmlNode m_node;
|
||||
|
||||
public:
|
||||
CXmlStackNamespaces(const CXmlStackNamespaces& src)
|
||||
{
|
||||
m_namespaces = src.m_namespaces;
|
||||
m_node = src.m_node;
|
||||
}
|
||||
CXmlStackNamespaces()
|
||||
{
|
||||
}
|
||||
CXmlStackNamespaces(const XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_node = node;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces& operator=(const CXmlStackNamespaces& src)
|
||||
{
|
||||
m_namespaces = src.m_namespaces;
|
||||
m_node = src.m_node;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces GetById(const std::string& id)
|
||||
{
|
||||
return GetByIdRec(*this, id);
|
||||
}
|
||||
|
||||
CXmlStackNamespaces GetByIdRec(CXmlStackNamespaces& stack, const std::string& id)
|
||||
{
|
||||
if (stack.m_node.GetAttributeA("Id") == id)
|
||||
return stack;
|
||||
|
||||
CXmlStackNamespaces ret = stack;
|
||||
|
||||
std::vector<std::wstring> _names;
|
||||
std::vector<std::wstring> _values;
|
||||
ret.m_node.ReadAllAttributes(_names, _values);
|
||||
|
||||
NSStringUtils::CStringBuilder oBuilder;
|
||||
oBuilder.WriteString(L" ");
|
||||
for (std::vector<std::wstring>::iterator i = _names.begin(), j = _values.begin(); i != _names.end(); i++, j++)
|
||||
{
|
||||
if (i->find(L"xmlns") == 0)
|
||||
{
|
||||
oBuilder.WriteString(*i);
|
||||
oBuilder.WriteString(L"=\"");
|
||||
oBuilder.WriteEncodeXmlString(*j);
|
||||
oBuilder.WriteString(L"\"");
|
||||
}
|
||||
}
|
||||
|
||||
if (oBuilder.GetCurSize() != 1)
|
||||
ret.m_namespaces += oBuilder.GetData();
|
||||
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (stack.m_node.GetChilds(oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
oNodes.GetAt(i, ret.m_node);
|
||||
CXmlStackNamespaces _retRecursion = ret.GetByIdRec(ret, id);
|
||||
if (_retRecursion.m_node.IsValid())
|
||||
return _retRecursion;
|
||||
}
|
||||
}
|
||||
|
||||
return CXmlStackNamespaces();
|
||||
}
|
||||
|
||||
std::string GetXml()
|
||||
{
|
||||
std::wstring sXml = m_node.GetXml();
|
||||
if (!m_namespaces.empty())
|
||||
{
|
||||
std::wstring sName = m_node.GetName();
|
||||
|
||||
std::wstring sXmlFind = L"<" + sName + L" ";
|
||||
if (0 == sXml.find(sXmlFind))
|
||||
sXml.replace(0, sXmlFind.length(), L"<" + sName + L" " + m_namespaces + L" ");
|
||||
}
|
||||
|
||||
return U_TO_UTF8(sXml);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
COOXMLSignature()
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_INVALID;
|
||||
m_guid = "";
|
||||
m_cert = NULL;
|
||||
}
|
||||
~COOXMLSignature()
|
||||
{
|
||||
RELEASEOBJECT(m_cert);
|
||||
}
|
||||
|
||||
public:
|
||||
int GetValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
std::string GetGuid()
|
||||
{
|
||||
return m_guid;
|
||||
}
|
||||
ICertificate* GetCertificate()
|
||||
{
|
||||
return m_cert;
|
||||
}
|
||||
std::string GetImageValidBase64()
|
||||
{
|
||||
return m_sImageValidBase64;
|
||||
}
|
||||
std::string GetImageInvalidBase64()
|
||||
{
|
||||
return m_sImageInvalidBase64;
|
||||
}
|
||||
|
||||
public:
|
||||
void Check()
|
||||
{
|
||||
// 1) get cert
|
||||
XmlUtils::CXmlNode oNodeCert = m_node.ReadNode(L"KeyInfo").ReadNode(L"X509Data").ReadNode(L"X509Certificate");
|
||||
if (!oNodeCert.IsValid())
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
m_cert = new CCertificate();
|
||||
if (!m_cert->LoadFromBase64Data(U_TO_UTF8(oNodeCert.GetText())))
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
|
||||
// 2) Objects
|
||||
XmlUtils::CXmlNodes nodesReferences;
|
||||
m_node.ReadNode(L"SignedInfo").GetNodes(L"Reference", nodesReferences);
|
||||
|
||||
CXmlStackNamespaces stack(m_node);
|
||||
int nCount = nodesReferences.GetCount();
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode nodeRef;
|
||||
nodesReferences.GetAt(i, nodeRef);
|
||||
|
||||
std::string sId = nodeRef.GetAttributeA("URI");
|
||||
if (0 == sId.find("#"))
|
||||
sId = sId.substr(1);
|
||||
|
||||
CXmlStackNamespaces _stack = stack.GetById(sId);
|
||||
std::string sTmp = _stack.GetXml();
|
||||
XML_UNUSED(sTmp);
|
||||
}
|
||||
}
|
||||
|
||||
friend class COOXMLVerifier;
|
||||
};
|
||||
|
||||
class COOXMLVerifier
|
||||
{
|
||||
public:
|
||||
std::wstring m_sFolder;
|
||||
std::vector<COOXMLSignature*> m_arSignatures;
|
||||
|
||||
public:
|
||||
COOXMLVerifier(const std::wstring& sFolder)
|
||||
{
|
||||
m_sFolder = sFolder;
|
||||
|
||||
if (!NSFile::CFileBinary::Exists(m_sFolder + L"/_xmlsignatures/origin.sigs"))
|
||||
return;
|
||||
|
||||
XmlUtils::CXmlNode oContentTypes;
|
||||
if (!oContentTypes.FromXmlFile(m_sFolder + L"/[Content_Types].xml"))
|
||||
return;
|
||||
|
||||
XmlUtils::CXmlNodes oOverrides = oContentTypes.GetNodes(L"Override");
|
||||
int nCount = oOverrides.GetCount();
|
||||
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode node;
|
||||
oOverrides.GetAt(i, node);
|
||||
|
||||
if (node.GetAttributeA("ContentType") != "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml")
|
||||
continue;
|
||||
|
||||
std::wstring sFile = m_sFolder + node.GetAttribute("PartName");
|
||||
XmlUtils::CXmlNode nodeSig;
|
||||
if (!nodeSig.FromXmlFile(sFile))
|
||||
continue;
|
||||
|
||||
if (nodeSig.GetName() != L"Signature")
|
||||
continue;
|
||||
|
||||
COOXMLSignature* pSignature = new COOXMLSignature();
|
||||
pSignature->m_node = nodeSig;
|
||||
pSignature->Check();
|
||||
|
||||
m_arSignatures.push_back(pSignature);
|
||||
}
|
||||
}
|
||||
~COOXMLVerifier()
|
||||
{
|
||||
for (std::vector<COOXMLSignature*>::iterator i = m_arSignatures.begin(); i != m_arSignatures.end(); i++)
|
||||
{
|
||||
COOXMLSignature* v = *i;
|
||||
RELEASEOBJECT(v);
|
||||
}
|
||||
m_arSignatures.clear();
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_XML_OOXMLVERIFIER_H_
|
||||
@ -1,17 +0,0 @@
|
||||
#ifndef _XMLSIGNER_CERTIFICATE_H_
|
||||
#define _XMLSIGNER_CERTIFICATE_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include "XmlSigner_mscrypto.h"
|
||||
#define CCertificate CCertificate_mscrypto
|
||||
#endif
|
||||
|
||||
#if defined(_LINUX) && !defined(_MAC)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _MAC
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _XMLSIGNER_CERTIFICATE_H_
|
||||
@ -1,55 +0,0 @@
|
||||
#ifndef _XMLSIGNER_BASE_H_
|
||||
#define _XMLSIGNER_BASE_H_
|
||||
|
||||
#include "../../common/File.h"
|
||||
#include "../../common/BigInteger.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#define OOXML_HASH_ALG_SHA1 0
|
||||
#define OOXML_HASH_ALG_INVALID 1
|
||||
|
||||
class ICertificate
|
||||
{
|
||||
public:
|
||||
ICertificate()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ICertificate()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual std::string GetNumber() = 0;
|
||||
virtual std::wstring GetSignerName() = 0;
|
||||
|
||||
virtual std::string GetCertificateBase64() = 0;
|
||||
virtual std::string GetCertificateHash() = 0;
|
||||
|
||||
public:
|
||||
virtual std::string Sign(std::string sXml) = 0;
|
||||
virtual std::string GetHash(unsigned char* pData, unsigned int nSize, int nAlg) = 0;
|
||||
virtual std::string GetHash(std::string& sXml, int nAlg) = 0;
|
||||
virtual std::string GetHash(std::wstring& sXmlFile, int nAlg) = 0;
|
||||
virtual bool Verify(std::string& sXml, std::string& sXmlSignature, int nAlg) = 0;
|
||||
|
||||
virtual bool LoadFromBase64Data(const std::string& data) = 0;
|
||||
virtual int ShowCertificate() = 0;
|
||||
|
||||
public:
|
||||
virtual bool ShowSelectDialog() = 0;
|
||||
|
||||
static int GetOOXMLHashAlg(const std::string& sAlg)
|
||||
{
|
||||
if ("http://www.w3.org/2000/09/xmldsig#rsa-sha1" == sAlg ||
|
||||
"http://www.w3.org/2000/09/xmldsig#sha1" == sAlg)
|
||||
return OOXML_HASH_ALG_SHA1;
|
||||
|
||||
return OOXML_HASH_ALG_INVALID;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _XMLSIGNER_BASE_H_
|
||||
23
DesktopEditor/xmlsec/src/include/OOXMLSigner.h
Normal file
23
DesktopEditor/xmlsec/src/include/OOXMLSigner.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef _XML_OOXMLSIGNER_H_
|
||||
#define _XML_OOXMLSIGNER_H_
|
||||
|
||||
#include "./XmlCertificate.h"
|
||||
|
||||
class COOXMLSigner_private;
|
||||
class Q_DECL_EXPORT COOXMLSigner
|
||||
{
|
||||
public:
|
||||
COOXMLSigner(const std::wstring& sFolder, ICertificate* pContext);
|
||||
~COOXMLSigner();
|
||||
|
||||
void SetGuid(const std::wstring& guid);
|
||||
void SetImageValid(const std::wstring& file);
|
||||
void SetImageInvalid(const std::wstring& file);
|
||||
|
||||
void Sign();
|
||||
|
||||
private:
|
||||
COOXMLSigner_private* m_internal;
|
||||
};
|
||||
|
||||
#endif //_XML_OOXMLSIGNER_H_
|
||||
48
DesktopEditor/xmlsec/src/include/OOXMLVerifier.h
Normal file
48
DesktopEditor/xmlsec/src/include/OOXMLVerifier.h
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef _XML_OOXMLVERIFIER_H_
|
||||
#define _XML_OOXMLVERIFIER_H_
|
||||
|
||||
#include "./XmlCertificate.h"
|
||||
|
||||
#define OOXML_SIGNATURE_VALID 0
|
||||
#define OOXML_SIGNATURE_INVALID 1
|
||||
#define OOXML_SIGNATURE_NOTSUPPORTED 2
|
||||
#define OOXML_SIGNATURE_BAD 3
|
||||
|
||||
class COOXMLSignature_private;
|
||||
class Q_DECL_EXPORT COOXMLSignature
|
||||
{
|
||||
public:
|
||||
COOXMLSignature();
|
||||
~COOXMLSignature();
|
||||
|
||||
public:
|
||||
int GetValid();
|
||||
std::string GetGuid();
|
||||
ICertificate* GetCertificate();
|
||||
std::string GetImageValidBase64();
|
||||
std::string GetImageInvalidBase64();
|
||||
|
||||
public:
|
||||
void Check();
|
||||
|
||||
friend class COOXMLVerifier_private;
|
||||
friend class COOXMLVerifier;
|
||||
private:
|
||||
COOXMLSignature_private* m_internal;
|
||||
};
|
||||
|
||||
class COOXMLVerifier_private;
|
||||
class Q_DECL_EXPORT COOXMLVerifier
|
||||
{
|
||||
public:
|
||||
COOXMLVerifier(const std::wstring& sFolder);
|
||||
~COOXMLVerifier();
|
||||
|
||||
int GetSignatureCount();
|
||||
COOXMLSignature* GetSignature(const int& index);
|
||||
|
||||
private:
|
||||
COOXMLVerifier_private* m_internal;
|
||||
};
|
||||
|
||||
#endif //_XML_OOXMLVERIFIER_H_
|
||||
47
DesktopEditor/xmlsec/src/include/XmlCertificate.h
Normal file
47
DesktopEditor/xmlsec/src/include/XmlCertificate.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef _XML_SERTIFICATE_BASE_H_
|
||||
#define _XML_SERTIFICATE_BASE_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../../../common/base_export.h"
|
||||
|
||||
#define OOXML_HASH_ALG_SHA1 0
|
||||
#define OOXML_HASH_ALG_INVALID 1
|
||||
|
||||
class Q_DECL_EXPORT ICertificate
|
||||
{
|
||||
public:
|
||||
ICertificate()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ICertificate()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual std::string GetNumber() = 0;
|
||||
virtual std::wstring GetSignerName() = 0;
|
||||
|
||||
virtual std::string GetCertificateBase64() = 0;
|
||||
virtual std::string GetCertificateHash() = 0;
|
||||
|
||||
public:
|
||||
virtual std::string Sign(const std::string& sXml) = 0;
|
||||
virtual std::string GetHash(unsigned char* pData, unsigned int nSize, int nAlg) = 0;
|
||||
virtual std::string GetHash(const std::string& sXml, int nAlg) = 0;
|
||||
virtual std::string GetHash(const std::wstring& sXmlFile, int nAlg) = 0;
|
||||
virtual bool Verify(const std::string& sXml, std::string& sXmlSignature, int nAlg) = 0;
|
||||
|
||||
virtual bool LoadFromBase64Data(const std::string& data) = 0;
|
||||
|
||||
public:
|
||||
virtual bool ShowSelectDialog() = 0;
|
||||
virtual int ShowCertificate() = 0;
|
||||
|
||||
public:
|
||||
static int GetOOXMLHashAlg(const std::string& sAlg);
|
||||
static ICertificate* CreateInstance();
|
||||
};
|
||||
|
||||
#endif // _XML_SERTIFICATE_BASE_H_
|
||||
48
DesktopEditor/xmlsec/src/ooxmlsignature.pro
Normal file
48
DesktopEditor/xmlsec/src/ooxmlsignature.pro
Normal file
@ -0,0 +1,48 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 1.0.0.1
|
||||
TARGET = ooxmlsignature
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += shared
|
||||
CONFIG += plugin
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
CONFIG += core_static_link_libstd
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
CONFIG += core_static_link_xml_full
|
||||
include($$CORE_ROOT_DIR/DesktopEditor/xml/build/qt/libxml2.pri)
|
||||
|
||||
DEFINES -= UNICODE
|
||||
|
||||
HEADERS += \
|
||||
include/XmlCertificate.h \
|
||||
include/OOXMLSigner.h \
|
||||
include/OOXMLVerifier.h
|
||||
|
||||
HEADERS += \
|
||||
src/XmlCanonicalizator.h \
|
||||
src/XmlRels.h \
|
||||
src/XmlTransform.h \
|
||||
src/XmlSigner_mscrypto.h \
|
||||
src/XmlSigner_openssl.h
|
||||
|
||||
SOURCES += \
|
||||
src/XmlTransform.cpp \
|
||||
src/XmlCertificate.cpp \
|
||||
src/OOXMLSigner.cpp \
|
||||
src/OOXMLVerifier.cpp
|
||||
|
||||
core_windows {
|
||||
|
||||
LIBS += -lcrypt32
|
||||
LIBS += -lcryptui
|
||||
LIBS += -lAdvapi32
|
||||
|
||||
}
|
||||
@ -1,11 +1,7 @@
|
||||
#ifndef _XML_OOXMLSIGNER_H_
|
||||
#define _XML_OOXMLSIGNER_H_
|
||||
#include "./../include/OOXMLSigner.h"
|
||||
#include "./../src/XmlTransform.h"
|
||||
|
||||
#include "./XmlCanonicalizator.h"
|
||||
#include "./XmlSignerBase.h"
|
||||
#include "./XmlTransform.h"
|
||||
|
||||
class COOXMLSigner
|
||||
class COOXMLSigner_private
|
||||
{
|
||||
public:
|
||||
ICertificate* m_certificate;
|
||||
@ -25,7 +21,7 @@ public:
|
||||
std::wstring m_guid;
|
||||
|
||||
public:
|
||||
COOXMLSigner(const std::wstring& sFolder, ICertificate* pContext)
|
||||
COOXMLSigner_private(const std::wstring& sFolder, ICertificate* pContext)
|
||||
{
|
||||
m_sFolder = sFolder;
|
||||
m_certificate = pContext;
|
||||
@ -35,7 +31,7 @@ public:
|
||||
m_signed_info.WriteString("<CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/>");
|
||||
m_signed_info.WriteString("<SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/>");
|
||||
}
|
||||
~COOXMLSigner()
|
||||
~COOXMLSigner_private()
|
||||
{
|
||||
}
|
||||
|
||||
@ -44,7 +40,8 @@ public:
|
||||
std::wstring sXml = L"<Reference URI=\"" + file + L"?ContentType=" + content_type + L"\">";
|
||||
sXml += L"<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>";
|
||||
sXml += L"<DigestValue>";
|
||||
sXml += UTF8_TO_U(m_certificate->GetHash(m_sFolder + file, OOXML_HASH_ALG_SHA1));
|
||||
std::string sTmp = m_certificate->GetHash(m_sFolder + file, OOXML_HASH_ALG_SHA1);
|
||||
sXml += UTF8_TO_U(sTmp);
|
||||
sXml += L"</DigestValue>";
|
||||
sXml += L"</Reference>";
|
||||
return sXml;
|
||||
@ -560,4 +557,32 @@ Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-sign
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_XML_OOXMLSIGNER_H_
|
||||
COOXMLSigner::COOXMLSigner(const std::wstring& sFolder, ICertificate* pContext)
|
||||
{
|
||||
m_internal = new COOXMLSigner_private(sFolder, pContext);
|
||||
}
|
||||
|
||||
COOXMLSigner::~COOXMLSigner()
|
||||
{
|
||||
RELEASEOBJECT(m_internal);
|
||||
}
|
||||
|
||||
void COOXMLSigner::SetGuid(const std::wstring& guid)
|
||||
{
|
||||
m_internal->SetGuid(guid);
|
||||
}
|
||||
|
||||
void COOXMLSigner::SetImageValid(const std::wstring& file)
|
||||
{
|
||||
m_internal->SetImageValid(file);
|
||||
}
|
||||
|
||||
void COOXMLSigner::SetImageInvalid(const std::wstring& file)
|
||||
{
|
||||
m_internal->SetImageInvalid(file);
|
||||
}
|
||||
|
||||
void COOXMLSigner::Sign()
|
||||
{
|
||||
m_internal->Sign();
|
||||
}
|
||||
499
DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp
Normal file
499
DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp
Normal file
@ -0,0 +1,499 @@
|
||||
#include "./XmlCanonicalizator.h"
|
||||
#include "./XmlTransform.h"
|
||||
#include "./../include/OOXMLVerifier.h"
|
||||
|
||||
class COOXMLSignature_private
|
||||
{
|
||||
public:
|
||||
int m_valid;
|
||||
std::string m_guid;
|
||||
ICertificate* m_cert;
|
||||
|
||||
std::string m_sImageValidBase64;
|
||||
std::string m_sImageInvalidBase64;
|
||||
|
||||
std::wstring m_sFolder;
|
||||
|
||||
XmlUtils::CXmlNode m_node; // signature file
|
||||
|
||||
class CXmlStackNamespaces
|
||||
{
|
||||
public:
|
||||
std::wstring m_namespaces;
|
||||
XmlUtils::CXmlNode m_node;
|
||||
|
||||
public:
|
||||
CXmlStackNamespaces(const CXmlStackNamespaces& src)
|
||||
{
|
||||
m_namespaces = src.m_namespaces;
|
||||
m_node = src.m_node;
|
||||
}
|
||||
CXmlStackNamespaces()
|
||||
{
|
||||
}
|
||||
CXmlStackNamespaces(const XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_node = node;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces& operator=(const CXmlStackNamespaces& src)
|
||||
{
|
||||
m_namespaces = src.m_namespaces;
|
||||
m_node = src.m_node;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces GetById(const std::string& id, const bool& isNameUse = false)
|
||||
{
|
||||
return GetByIdRec(*this, id, isNameUse);
|
||||
}
|
||||
|
||||
CXmlStackNamespaces GetByIdRec(CXmlStackNamespaces& stack, const std::string& id, const bool& isNameUse = false)
|
||||
{
|
||||
if (stack.m_node.GetAttributeA("Id") == id)
|
||||
return stack;
|
||||
|
||||
if (isNameUse)
|
||||
{
|
||||
std::string sName = U_TO_UTF8((stack.m_node.GetName()));
|
||||
if (sName == id)
|
||||
return stack;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces ret = stack;
|
||||
|
||||
std::vector<std::wstring> _names;
|
||||
std::vector<std::wstring> _values;
|
||||
ret.m_node.ReadAllAttributes(_names, _values);
|
||||
|
||||
NSStringUtils::CStringBuilder oBuilder;
|
||||
oBuilder.WriteString(L" ");
|
||||
for (std::vector<std::wstring>::iterator i = _names.begin(), j = _values.begin(); i != _names.end(); i++, j++)
|
||||
{
|
||||
if (i->find(L"xmlns") == 0)
|
||||
{
|
||||
oBuilder.WriteString(*i);
|
||||
oBuilder.WriteString(L"=\"");
|
||||
oBuilder.WriteEncodeXmlString(*j);
|
||||
oBuilder.WriteString(L"\"");
|
||||
}
|
||||
}
|
||||
|
||||
if (oBuilder.GetCurSize() != 1)
|
||||
ret.m_namespaces += oBuilder.GetData();
|
||||
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (stack.m_node.GetChilds(oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
oNodes.GetAt(i, ret.m_node);
|
||||
CXmlStackNamespaces _retRecursion = ret.GetByIdRec(ret, id, isNameUse);
|
||||
if (_retRecursion.m_node.IsValid())
|
||||
return _retRecursion;
|
||||
}
|
||||
}
|
||||
|
||||
return CXmlStackNamespaces();
|
||||
}
|
||||
|
||||
std::string GetXml()
|
||||
{
|
||||
std::wstring sXml = m_node.GetXml();
|
||||
if (!m_namespaces.empty())
|
||||
{
|
||||
std::wstring sName = m_node.GetName();
|
||||
|
||||
std::wstring sXmlFind = L"<" + sName + L" ";
|
||||
if (0 == sXml.find(sXmlFind))
|
||||
{
|
||||
sXml.replace(0, sXmlFind.length(), L"<" + sName + L" " + m_namespaces + L" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sXmlFind = L"<" + sName + L">";
|
||||
if (0 == sXml.find(sXmlFind))
|
||||
sXml.replace(0, sXmlFind.length(), L"<" + sName + L" " + m_namespaces + L">");
|
||||
}
|
||||
}
|
||||
|
||||
return U_TO_UTF8(sXml);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
COOXMLSignature_private()
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_INVALID;
|
||||
m_guid = "";
|
||||
m_cert = NULL;
|
||||
}
|
||||
~COOXMLSignature_private()
|
||||
{
|
||||
RELEASEOBJECT(m_cert);
|
||||
}
|
||||
|
||||
public:
|
||||
int GetValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
std::string GetGuid()
|
||||
{
|
||||
return m_guid;
|
||||
}
|
||||
ICertificate* GetCertificate()
|
||||
{
|
||||
return m_cert;
|
||||
}
|
||||
std::string GetImageValidBase64()
|
||||
{
|
||||
return m_sImageValidBase64;
|
||||
}
|
||||
std::string GetImageInvalidBase64()
|
||||
{
|
||||
return m_sImageInvalidBase64;
|
||||
}
|
||||
|
||||
public:
|
||||
void Check()
|
||||
{
|
||||
// 1) Certificate
|
||||
XmlUtils::CXmlNode oNodeCert = m_node.ReadNode(L"KeyInfo").ReadNode(L"X509Data").ReadNode(L"X509Certificate");
|
||||
if (!oNodeCert.IsValid())
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
m_cert = ICertificate::CreateInstance();
|
||||
if (!m_cert->LoadFromBase64Data(U_TO_UTF8(oNodeCert.GetText())))
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
|
||||
// 2) Check files (Manifect)
|
||||
XmlUtils::CXmlNode nodeManifect = GetObjectById("idPackageObject");
|
||||
if (!nodeManifect.IsValid())
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_INVALID;
|
||||
return;
|
||||
}
|
||||
|
||||
XmlUtils::CXmlNodes nodesManifestRefs = nodeManifect.ReadNode(L"Manifest").GetNodes(L"Reference");
|
||||
int nRefsCount = nodesManifestRefs.GetCount();
|
||||
for (int i = 0; i < nRefsCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode tmp;
|
||||
nodesManifestRefs.GetAt(i, tmp);
|
||||
|
||||
m_valid = CheckManifestReference(tmp);
|
||||
if (OOXML_SIGNATURE_VALID != m_valid)
|
||||
return;
|
||||
}
|
||||
|
||||
// 3) Images
|
||||
XmlUtils::CXmlNode nodeImageValid = GetObjectById("idValidSigLnImg");
|
||||
if (nodeImageValid.IsValid())
|
||||
m_sImageValidBase64 = U_TO_UTF8(nodeImageValid.GetText());
|
||||
XmlUtils::CXmlNode nodeImageInvalid = GetObjectById("idInvalidSigLnImg");
|
||||
if (nodeImageInvalid.IsValid())
|
||||
m_sImageInvalidBase64 = U_TO_UTF8(nodeImageInvalid.GetText());
|
||||
|
||||
// 4) Objects
|
||||
XmlUtils::CXmlNodes nodesReferences;
|
||||
m_node.ReadNode(L"SignedInfo").GetNodes(L"Reference", nodesReferences);
|
||||
nRefsCount = nodesReferences.GetCount();
|
||||
for (int i = 0; i < nRefsCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode tmp;
|
||||
nodesReferences.GetAt(i, tmp);
|
||||
|
||||
m_valid = CheckObjectReference(tmp);
|
||||
if (OOXML_SIGNATURE_VALID != m_valid)
|
||||
return;
|
||||
}
|
||||
|
||||
// 5) Check signature
|
||||
CXmlStackNamespaces stack(m_node);
|
||||
CXmlStackNamespaces stackRes = stack.GetById("SignedInfo", true);
|
||||
std::string sXml = stackRes.GetXml();
|
||||
|
||||
std::string sCanonicalizationMethod = m_node.ReadNode(L"SignedInfo").ReadNode(L"CanonicalizationMethod").GetAttributeA("Algorithm");
|
||||
std::string sSignatureMethod = m_node.ReadNode(L"SignedInfo").ReadNode(L"SignatureMethod").GetAttributeA("Algorithm");
|
||||
|
||||
int nSignatureMethod = ICertificate::GetOOXMLHashAlg(sSignatureMethod);
|
||||
if (OOXML_HASH_ALG_INVALID == nSignatureMethod)
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
|
||||
IXmlTransform* pCanonicalizationMethodTransform = IXmlTransform::GetFromType(sCanonicalizationMethod);
|
||||
if (NULL == pCanonicalizationMethodTransform)
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string sSignatureCalcValue = pCanonicalizationMethodTransform->Transform(sXml);
|
||||
RELEASEOBJECT(pCanonicalizationMethodTransform);
|
||||
|
||||
std::string sSignatureValue = U_TO_UTF8((m_node.ReadValueString(L"SignatureValue")));
|
||||
|
||||
if (!m_cert->Verify(sSignatureCalcValue, sSignatureValue, nSignatureMethod))
|
||||
m_valid = OOXML_SIGNATURE_INVALID;
|
||||
}
|
||||
|
||||
XmlUtils::CXmlNode GetObjectById(std::string sId)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes = m_node.GetNodes(L"Object");
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode tmp;
|
||||
oNodes.GetAt(i, tmp);
|
||||
if (sId == tmp.GetAttributeA("Id"))
|
||||
return tmp;
|
||||
}
|
||||
XmlUtils::CXmlNode ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
friend class COOXMLVerifier;
|
||||
|
||||
public:
|
||||
|
||||
int CheckManifestReference(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
std::wstring sFile = node.GetAttribute("URI");
|
||||
std::wstring::size_type nPos = sFile.find(L"?");
|
||||
if (nPos == std::wstring::npos)
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
sFile = sFile.substr(0, nPos);
|
||||
sFile = m_sFolder + sFile;
|
||||
|
||||
if (!NSFile::CFileBinary::Exists(sFile))
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
XmlUtils::CXmlNode nodeMethod = node.ReadNode(L"DigestMethod");
|
||||
if (!nodeMethod.IsValid())
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
int nAlg = ICertificate::GetOOXMLHashAlg(nodeMethod.GetAttributeA("Algorithm"));
|
||||
|
||||
if (OOXML_HASH_ALG_INVALID == nAlg)
|
||||
return OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
|
||||
std::string sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
std::string sCalcValue = "";
|
||||
|
||||
XmlUtils::CXmlNode nodeTransform = node.ReadNode(L"Transforms");
|
||||
if (!nodeTransform.IsValid())
|
||||
{
|
||||
// simple hash
|
||||
sCalcValue = m_cert->GetHash(sFile, nAlg);
|
||||
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
}
|
||||
else
|
||||
{
|
||||
// XML
|
||||
CXmlTransforms oTransforms(nodeTransform);
|
||||
if (!oTransforms.GetValid())
|
||||
return OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
|
||||
std::string sXml;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8A(sFile, sXml);
|
||||
|
||||
sXml = oTransforms.Transform(sXml);
|
||||
|
||||
sCalcValue = m_cert->GetHash(sXml, nAlg);
|
||||
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
}
|
||||
|
||||
if (sCalcValue != sValue)
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
return OOXML_SIGNATURE_VALID;
|
||||
}
|
||||
|
||||
int CheckObjectReference(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
std::string sURI = node.GetAttributeA("URI");
|
||||
if ("" == sURI)
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
if (0 == sURI.find("#"))
|
||||
sURI = sURI.substr(1);
|
||||
|
||||
std::string sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
|
||||
CXmlTransforms oTransforms;
|
||||
|
||||
CXmlTransformC14N* pTransform = new CXmlTransformC14N();
|
||||
pTransform->CheckC14NTransform("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
|
||||
oTransforms.AddTransform(pTransform);
|
||||
|
||||
#if 0
|
||||
XmlUtils::CXmlNode nodeTransform = node.ReadNode(L"Transforms");
|
||||
if (!nodeTransform.IsValid())
|
||||
{
|
||||
// simple hash
|
||||
sCalcValue = m_cert->GetHash(sFile, nAlg);
|
||||
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
}
|
||||
else
|
||||
{
|
||||
// XML
|
||||
CXmlTransforms oTransforms(nodeTransform);
|
||||
if (!oTransforms.GetValid())
|
||||
return OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
|
||||
std::string sXml;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8A(sFile, sXml);
|
||||
|
||||
sXml = oTransforms.Transform(sXml);
|
||||
|
||||
sCalcValue = m_cert->GetHash(sXml, nAlg);
|
||||
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
}
|
||||
#endif
|
||||
|
||||
CXmlStackNamespaces stack(m_node);
|
||||
CXmlStackNamespaces stackRes = stack.GetById(sURI);
|
||||
std::string sXml = stackRes.GetXml();
|
||||
|
||||
sXml = oTransforms.Transform(sXml);
|
||||
|
||||
XmlUtils::CXmlNode nodeMethod = node.ReadNode(L"DigestMethod");
|
||||
if (!nodeMethod.IsValid())
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
int nAlg = ICertificate::GetOOXMLHashAlg(nodeMethod.GetAttributeA("Algorithm"));
|
||||
std::string sCalcValue = m_cert->GetHash(sXml, nAlg);
|
||||
|
||||
if (sCalcValue != sValue)
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
return OOXML_SIGNATURE_VALID;
|
||||
}
|
||||
};
|
||||
|
||||
COOXMLSignature::COOXMLSignature()
|
||||
{
|
||||
m_internal = new COOXMLSignature_private();
|
||||
}
|
||||
|
||||
COOXMLSignature::~COOXMLSignature()
|
||||
{
|
||||
RELEASEOBJECT(m_internal);
|
||||
}
|
||||
|
||||
int COOXMLSignature::GetValid()
|
||||
{
|
||||
return m_internal->GetValid();
|
||||
}
|
||||
|
||||
std::string COOXMLSignature::GetGuid()
|
||||
{
|
||||
return m_internal->GetGuid();
|
||||
}
|
||||
|
||||
ICertificate* COOXMLSignature::GetCertificate()
|
||||
{
|
||||
return m_internal->GetCertificate();
|
||||
}
|
||||
|
||||
std::string COOXMLSignature::GetImageValidBase64()
|
||||
{
|
||||
return m_internal->GetImageValidBase64();
|
||||
}
|
||||
|
||||
std::string COOXMLSignature::GetImageInvalidBase64()
|
||||
{
|
||||
return m_internal->GetImageInvalidBase64();
|
||||
}
|
||||
|
||||
void COOXMLSignature::Check()
|
||||
{
|
||||
m_internal->Check();
|
||||
}
|
||||
|
||||
class COOXMLVerifier_private
|
||||
{
|
||||
public:
|
||||
std::wstring m_sFolder;
|
||||
std::vector<COOXMLSignature*> m_arSignatures;
|
||||
|
||||
public:
|
||||
COOXMLVerifier_private(const std::wstring& sFolder)
|
||||
{
|
||||
m_sFolder = sFolder;
|
||||
|
||||
if (!NSFile::CFileBinary::Exists(m_sFolder + L"/_xmlsignatures/origin.sigs"))
|
||||
return;
|
||||
|
||||
XmlUtils::CXmlNode oContentTypes;
|
||||
if (!oContentTypes.FromXmlFile(m_sFolder + L"/[Content_Types].xml"))
|
||||
return;
|
||||
|
||||
XmlUtils::CXmlNodes oOverrides = oContentTypes.GetNodes(L"Override");
|
||||
int nCount = oOverrides.GetCount();
|
||||
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode node;
|
||||
oOverrides.GetAt(i, node);
|
||||
|
||||
if (node.GetAttributeA("ContentType") != "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml")
|
||||
continue;
|
||||
|
||||
std::wstring sFile = m_sFolder + node.GetAttribute("PartName");
|
||||
XmlUtils::CXmlNode nodeSig;
|
||||
if (!nodeSig.FromXmlFile(sFile))
|
||||
continue;
|
||||
|
||||
if (nodeSig.GetName() != L"Signature")
|
||||
continue;
|
||||
|
||||
COOXMLSignature* pSignature = new COOXMLSignature();
|
||||
pSignature->m_internal->m_node = nodeSig;
|
||||
pSignature->m_internal->m_sFolder = m_sFolder;
|
||||
pSignature->Check();
|
||||
|
||||
m_arSignatures.push_back(pSignature);
|
||||
}
|
||||
}
|
||||
~COOXMLVerifier_private()
|
||||
{
|
||||
for (std::vector<COOXMLSignature*>::iterator i = m_arSignatures.begin(); i != m_arSignatures.end(); i++)
|
||||
{
|
||||
COOXMLSignature* v = *i;
|
||||
RELEASEOBJECT(v);
|
||||
}
|
||||
m_arSignatures.clear();
|
||||
}
|
||||
};
|
||||
|
||||
COOXMLVerifier::COOXMLVerifier(const std::wstring& sFolder)
|
||||
{
|
||||
m_internal = new COOXMLVerifier_private(sFolder);
|
||||
}
|
||||
|
||||
COOXMLVerifier::~COOXMLVerifier()
|
||||
{
|
||||
RELEASEOBJECT(m_internal);
|
||||
}
|
||||
|
||||
int COOXMLVerifier::GetSignatureCount()
|
||||
{
|
||||
return (int)m_internal->m_arSignatures.size();
|
||||
}
|
||||
|
||||
COOXMLSignature* COOXMLVerifier::GetSignature(const int& index)
|
||||
{
|
||||
return m_internal->m_arSignatures[index];
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
#ifndef _XML_CANONICALIZATOR_H_
|
||||
#define _XML_CANONICALIZATOR_H_
|
||||
|
||||
#include "../../common/File.h"
|
||||
#include "../../common/Directory.h"
|
||||
#include "../../../common/File.h"
|
||||
#include "../../../common/Directory.h"
|
||||
|
||||
#include "../../common/StringBuilder.h"
|
||||
#include "../../xml/include/xmlutils.h"
|
||||
#include "../../xml/libxml2/include/libxml/c14n.h"
|
||||
#include "../../../common/StringBuilder.h"
|
||||
#include "../../../xml/include/xmlutils.h"
|
||||
#include "../../../xml/libxml2/include/libxml/c14n.h"
|
||||
|
||||
#ifndef XML_UNUSED
|
||||
#define XML_UNUSED( arg ) ( (arg) = (arg) )
|
||||
28
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
Normal file
28
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#ifdef WIN32
|
||||
#include "./XmlSigner_mscrypto.h"
|
||||
#define CCertificate CCertificate_mscrypto
|
||||
#endif
|
||||
|
||||
#if defined(_LINUX) && !defined(_MAC)
|
||||
#include "./XmlSigner_openssl.h"
|
||||
#define CCertificate CCertificate_openssl
|
||||
#endif
|
||||
|
||||
#ifdef _MAC
|
||||
#include "./XmlSigner_openssl.h"
|
||||
#define CCertificate CCertificate_openssl
|
||||
#endif
|
||||
|
||||
int ICertificate::GetOOXMLHashAlg(const std::string& sAlg)
|
||||
{
|
||||
if ("http://www.w3.org/2000/09/xmldsig#rsa-sha1" == sAlg ||
|
||||
"http://www.w3.org/2000/09/xmldsig#sha1" == sAlg)
|
||||
return OOXML_HASH_ALG_SHA1;
|
||||
|
||||
return OOXML_HASH_ALG_INVALID;
|
||||
}
|
||||
|
||||
ICertificate* ICertificate::CreateInstance()
|
||||
{
|
||||
return new CCertificate();
|
||||
}
|
||||
@ -154,7 +154,7 @@ public:
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
void CheckOriginSigs(std::wstring& file)
|
||||
void CheckOriginSigs(const std::wstring& file)
|
||||
{
|
||||
int rId = 0;
|
||||
std::vector<COOXMLRelationship>::iterator i = rels.begin();
|
||||
@ -1,13 +1,16 @@
|
||||
#ifndef _XMLSIGNER_MSCRYPTO_H_
|
||||
#define _XMLSIGNER_MSCRYPTO_H_
|
||||
|
||||
#include "./XmlSignerBase.h"
|
||||
#include "./include/XmlCertificate.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#include <cryptuiapi.h>
|
||||
|
||||
#include "../../../common/File.h"
|
||||
#include "../../../common/BigInteger.h"
|
||||
|
||||
class CCertificate_mscrypto : public ICertificate
|
||||
{
|
||||
public:
|
||||
@ -97,7 +100,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
virtual std::string Sign(std::string sXml)
|
||||
virtual std::string Sign(const std::string& sXml)
|
||||
{
|
||||
BOOL bResult = TRUE;
|
||||
DWORD dwKeySpec = 0;
|
||||
@ -181,6 +184,9 @@ public:
|
||||
|
||||
bResult = CryptAcquireCertificatePrivateKey(m_context, 0, NULL, &hCryptProv, &dwKeySpec, NULL);
|
||||
|
||||
if (!bResult)
|
||||
bResult = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
||||
|
||||
if (!bResult)
|
||||
return "";
|
||||
|
||||
@ -234,12 +240,12 @@ public:
|
||||
return sReturn;
|
||||
}
|
||||
|
||||
virtual std::string GetHash(std::string& sXml, int nAlg)
|
||||
virtual std::string GetHash(const std::string& sXml, int nAlg)
|
||||
{
|
||||
return GetHash((BYTE*)sXml.c_str(), (DWORD)sXml.length(), nAlg);
|
||||
}
|
||||
|
||||
virtual std::string GetHash(std::wstring& sXmlFile, int nAlg)
|
||||
virtual std::string GetHash(const std::wstring& sXmlFile, int nAlg)
|
||||
{
|
||||
BYTE* pFileData = NULL;
|
||||
DWORD dwFileDataLen = 0;
|
||||
@ -254,7 +260,7 @@ public:
|
||||
return sReturn;
|
||||
}
|
||||
|
||||
virtual bool Verify(std::string& sXml, std::string& sXmlSignature, int nAlg)
|
||||
virtual bool Verify(const std::string& sXml, std::string& sXmlSignature, int nAlg)
|
||||
{
|
||||
DWORD dwKeySpec = 0;
|
||||
HCRYPTHASH hHash = NULL;
|
||||
@ -264,14 +270,17 @@ public:
|
||||
BOOL bResult = CryptAcquireCertificatePrivateKey(m_context, 0, NULL, &hCryptProv, &dwKeySpec, NULL);
|
||||
|
||||
if (!bResult)
|
||||
return FALSE;
|
||||
bResult = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
||||
|
||||
if (!bResult)
|
||||
return false;
|
||||
|
||||
bResult = CryptCreateHash(hCryptProv, GetHashId(nAlg), 0, 0, &hHash);
|
||||
|
||||
if (!bResult)
|
||||
{
|
||||
CryptReleaseContext(hCryptProv, 0);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE* pDataHash = NULL;
|
||||
101
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
Normal file
101
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
Normal file
@ -0,0 +1,101 @@
|
||||
#ifndef _XMLSIGNER_OPENSSL_H_
|
||||
#define _XMLSIGNER_OPENSSL_H_
|
||||
|
||||
#include "./include/XmlCertificate.h"
|
||||
|
||||
#include "../../../common/File.h"
|
||||
#include "../../../common/BigInteger.h"
|
||||
|
||||
class CCertificate_openssl : public ICertificate
|
||||
{
|
||||
public:
|
||||
|
||||
protected:
|
||||
BYTE* m_rawData;
|
||||
int m_rawDataLen;
|
||||
|
||||
public:
|
||||
CCertificate_openssl() : ICertificate()
|
||||
{
|
||||
m_rawData = NULL;
|
||||
m_rawDataLen = 0;
|
||||
}
|
||||
virtual ~CCertificate_openssl()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual std::string GetNumber()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::wstring GetSignerName()
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
|
||||
virtual std::string GetCertificateBase64()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string GetCertificateHash()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public:
|
||||
virtual std::string Sign(const std::string& sXml)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string GetHash(unsigned char* pData, unsigned int nSize, int nAlg)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string GetHash(const std::string& sXml, int nAlg)
|
||||
{
|
||||
return GetHash((BYTE*)sXml.c_str(), (DWORD)sXml.length(), nAlg);
|
||||
}
|
||||
|
||||
virtual std::string GetHash(const std::wstring& sXmlFile, int nAlg)
|
||||
{
|
||||
BYTE* pFileData = NULL;
|
||||
DWORD dwFileDataLen = 0;
|
||||
NSFile::CFileBinary::ReadAllBytes(sXmlFile, &pFileData, dwFileDataLen);
|
||||
|
||||
if (0 == dwFileDataLen)
|
||||
return "";
|
||||
|
||||
std::string sReturn = GetHash(pFileData, dwFileDataLen, nAlg);
|
||||
|
||||
RELEASEARRAYOBJECTS(pFileData);
|
||||
return sReturn;
|
||||
}
|
||||
|
||||
virtual bool Verify(const std::string& sXml, std::string& sXmlSignature, int nAlg)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool LoadFromBase64Data(const std::string& data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int ShowCertificate()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual bool ShowSelectDialog()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _XMLSIGNER_OPENSSL_H_
|
||||
21
DesktopEditor/xmlsec/src/src/XmlTransform.cpp
Normal file
21
DesktopEditor/xmlsec/src/src/XmlTransform.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "./XmlTransform.h"
|
||||
|
||||
IXmlTransform* IXmlTransform::GetFromType(const std::string& alg)
|
||||
{
|
||||
if (true)
|
||||
{
|
||||
CXmlTransformRelationship* transform = new CXmlTransformRelationship();
|
||||
if (transform->m_algorithm == alg)
|
||||
return transform;
|
||||
RELEASEOBJECT(transform);
|
||||
}
|
||||
if (true)
|
||||
{
|
||||
CXmlTransformC14N* transform = new CXmlTransformC14N();
|
||||
if (transform->CheckC14NTransform(alg))
|
||||
return transform;
|
||||
RELEASEOBJECT(transform);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -110,8 +110,9 @@ public:
|
||||
|
||||
virtual std::string Transform(const std::string& xml)
|
||||
{
|
||||
// TODO
|
||||
return xml;
|
||||
if (-1 == m_mode)
|
||||
return xml;
|
||||
return CXmlCanonicalizator::Execute(xml, m_mode, m_comments);
|
||||
}
|
||||
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node)
|
||||
@ -121,26 +122,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
IXmlTransform* IXmlTransform::GetFromType(const std::string& alg)
|
||||
{
|
||||
if (true)
|
||||
{
|
||||
CXmlTransformRelationship* transform = new CXmlTransformRelationship();
|
||||
if (transform->m_algorithm == alg)
|
||||
return transform;
|
||||
RELEASEOBJECT(transform);
|
||||
}
|
||||
if (true)
|
||||
{
|
||||
CXmlTransformC14N* transform = new CXmlTransformC14N();
|
||||
if (transform->CheckC14NTransform(alg))
|
||||
return transform;
|
||||
RELEASEOBJECT(transform);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
class CXmlTransforms
|
||||
{
|
||||
protected:
|
||||
@ -148,6 +129,11 @@ protected:
|
||||
bool m_valid;
|
||||
|
||||
public:
|
||||
CXmlTransforms()
|
||||
{
|
||||
m_valid = true;
|
||||
}
|
||||
|
||||
CXmlTransforms(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_valid = true;
|
||||
@ -181,6 +167,25 @@ public:
|
||||
m_transforms.clear();
|
||||
}
|
||||
|
||||
bool GetValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
std::string Transform(const std::string& xml)
|
||||
{
|
||||
std::string sResult = xml;
|
||||
for (std::vector<IXmlTransform*>::iterator i = m_transforms.begin(); i != m_transforms.end(); i++)
|
||||
{
|
||||
sResult = (*i)->Transform(sResult);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
|
||||
void AddTransform(IXmlTransform* transform)
|
||||
{
|
||||
m_transforms.push_back(transform);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_XML_TRANSFORM_H_
|
||||
@ -1,12 +1,10 @@
|
||||
#include "../../src/XmlCertificate.h"
|
||||
#include "../../src/OOXMLSigner.h"
|
||||
#include "../../src/OOXMLVerifier.h"
|
||||
#include "../../src/include/XmlCertificate.h"
|
||||
#include "../../src/include/OOXMLSigner.h"
|
||||
#include "../../src/include/OOXMLVerifier.h"
|
||||
|
||||
#pragma comment (lib, "crypt32.lib")
|
||||
#pragma comment (lib, "cryptui.lib")
|
||||
#pragma comment (lib, "Advapi32.lib")
|
||||
#include "../../../common/File.h"
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
//std::wstring sFolderOOOXML = NSFile::GetProcessDirectory() + L"/ImageStamp";
|
||||
//std::wstring sSignId = L"{39B6B9C7-60AD-45A2-9F61-40C74A24042E}";
|
||||
@ -17,29 +15,35 @@ void main(void)
|
||||
{
|
||||
std::wstring sSignId = L"{9792D33F-AB37-4E5B-A465-481B9465818B}";
|
||||
|
||||
CCertificate oCertificate;
|
||||
if (!oCertificate.ShowSelectDialog())
|
||||
return;
|
||||
ICertificate* pCertificate = ICertificate::CreateInstance();
|
||||
if (!pCertificate->ShowSelectDialog())
|
||||
{
|
||||
RELEASEOBJECT(pCertificate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
COOXMLSigner oOOXMLSigner(sFolderOOXML, &oCertificate);
|
||||
COOXMLSigner oOOXMLSigner(sFolderOOXML, pCertificate);
|
||||
|
||||
oOOXMLSigner.SetGuid(sSignId);
|
||||
oOOXMLSigner.SetImageValid(NSFile::GetProcessDirectory() + L"/../../../resources/valid.png");
|
||||
oOOXMLSigner.SetImageInvalid(NSFile::GetProcessDirectory() + L"/../../../resources/invalid.png");
|
||||
|
||||
oOOXMLSigner.Sign();
|
||||
|
||||
RELEASEOBJECT(pCertificate);
|
||||
}
|
||||
else
|
||||
{
|
||||
COOXMLVerifier oVerifier(sFolderOOXML);
|
||||
|
||||
size_t nCount = oVerifier.m_arSignatures.size();
|
||||
for (std::vector<COOXMLSignature*>::iterator i = oVerifier.m_arSignatures.begin(); i != oVerifier.m_arSignatures.end(); i++)
|
||||
int nCount = oVerifier.GetSignatureCount();
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
COOXMLSignature* pSign = *i;
|
||||
XML_UNUSED(pSign);
|
||||
COOXMLSignature* pSign = oVerifier.GetSignature(i);
|
||||
int nRes = pSign->GetValid();
|
||||
pSign = pSign;
|
||||
nRes = nRes;
|
||||
}
|
||||
|
||||
XML_UNUSED(nCount);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -10,26 +10,8 @@ CORE_ROOT_DIR = $$PWD/../../../../
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
DEFINES -= UNICODE
|
||||
|
||||
DEFINES += \
|
||||
LIBXML_READER_ENABLED \
|
||||
LIBXML_PUSH_ENABLED \
|
||||
LIBXML_HTML_ENABLED \
|
||||
LIBXML_XPATH_ENABLED \
|
||||
LIBXML_OUTPUT_ENABLED \
|
||||
LIBXML_C14N_ENABLED \
|
||||
LIBXML_SAX1_ENABLED \
|
||||
LIBXML_TREE_ENABLED \
|
||||
LIBXML_XPTR_ENABLED \
|
||||
LIBXML_STATIC
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -llibxml
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/xml/libxml2/include \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/xml/libxml2/include/libxml
|
||||
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -looxmlsignature
|
||||
|
||||
|
||||
|
||||
@ -45,7 +45,8 @@ namespace TestDocsWithChart
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
getFilesPivot();
|
||||
getFilesConditional();
|
||||
//getFilesPivot();
|
||||
//getFilesAlternateContent();
|
||||
//getFiles();
|
||||
//convertFiles();
|
||||
@ -74,6 +75,45 @@ namespace TestDocsWithChart
|
||||
|
||||
}
|
||||
}
|
||||
static void getFilesConditional()
|
||||
{
|
||||
//string sFindText = "conditionalFormatting";
|
||||
//string sDirInput = @"\\192.168.3.208\allusers\Files\XLSX";
|
||||
//string sDirOutput = @"D:\Files\Conditional";
|
||||
string sFindText = "type=\"expression\"";
|
||||
string sDirInput = @"D:\Files\Conditional";
|
||||
string sDirOutput = @"D:\Files\ConditionalFormulaExpression";
|
||||
String[] allfiles = System.IO.Directory.GetFiles(sDirInput, "*.*", System.IO.SearchOption.AllDirectories);
|
||||
|
||||
for (var i = 0; i < allfiles.Length; ++i)
|
||||
{
|
||||
string file = allfiles[i];
|
||||
try
|
||||
{
|
||||
ZipArchive zip = ZipFile.OpenRead(file);
|
||||
string sOutputPath = Path.Combine(sDirOutput, Path.GetFileName(file));
|
||||
foreach (ZipArchiveEntry entry in zip.Entries)
|
||||
{
|
||||
if (entry.FullName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(entry.Open(), Encoding.UTF8))
|
||||
{
|
||||
string sXml = reader.ReadToEnd();
|
||||
if (-1 != sXml.IndexOf(sFindText))
|
||||
{
|
||||
System.IO.File.Copy(file, sOutputPath, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
static void getFilesAlternateContent()
|
||||
{
|
||||
string sAlternateContent = ":Choice ";
|
||||
|
||||
Reference in New Issue
Block a user