This commit is contained in:
Elena.Subbotina
2023-09-22 07:32:09 +03:00
parent 6b004b035d
commit 9eeeb141ab
2 changed files with 70 additions and 60 deletions

View File

@ -54,6 +54,8 @@ namespace OOX
}
void CDefinedName::toXML(NSStringUtils::CStringBuilder& writer) const
{
if (false == m_oRef.IsInit() && false == m_oName.IsInit()) return;
writer.WriteString(L"<definedName");
WritingStringNullableAttrEncodeXmlString(L"name", m_oName, *m_oName);
WritingStringNullableAttrInt(L"localSheetId", m_oLocalSheetId, m_oLocalSheetId->GetValue());
@ -85,26 +87,32 @@ namespace OOX
void CDefinedName::ReadAttributes(XLS::BaseObjectPtr& obj)
{
auto ptr = static_cast<XLSB::Name*>(obj.get());
m_oComment = ptr->comment.value();
// m_oCustomMenu = ptr->.value();
m_oDescription = ptr->description.value();
m_oFunction = ptr->fFunc;
m_oFunctionGroupId = ptr->fGrp;
m_oHelp = ptr->helpTopic.value();
m_oHidden = ptr->fHidden;
std::wstring ref = ptr->rgce.getAssembledFormula();
if (ref.empty()) return; // ???
m_oComment = ptr->comment.value();
// m_oCustomMenu = ptr->.value();
m_oDescription = ptr->description.value();
m_oFunction = ptr->fFunc;
m_oFunctionGroupId = ptr->fGrp;
m_oHelp = ptr->helpTopic.value();
if (ptr->fHidden)
m_oHidden = ptr->fHidden;
if(ptr->itab != 0xFFFFFFFF)
m_oLocalSheetId = ptr->itab;
m_oName = ptr->name.value();
m_oPublishToServer = ptr->fPublished;
m_oShortcutKey = std::to_wstring(ptr->chKey);
//m_oStatusBar = ;
m_oVbProcedure = ptr->fOB;
m_oWorkbookParameter = ptr->fWorkbookParam;
m_oXlm = ptr->fFutureFunction;
m_oRef = ptr->rgce.getAssembledFormula();
m_oName = ptr->name.value();
m_oPublishToServer = ptr->fPublished;
m_oShortcutKey = std::to_wstring(ptr->chKey);
//m_oStatusBar = ;
m_oVbProcedure = ptr->fOB;
m_oWorkbookParameter = ptr->fWorkbookParam;
m_oXlm = ptr->fFutureFunction;
m_oRef = ref;
}
CDefinedNames::CDefinedNames(OOX::Document *pMain) : WritingElementWithChilds<CDefinedName>(pMain)

View File

@ -102,72 +102,74 @@ namespace OOX
toXML2(writer, false);
}
void CDataValidation::toXML2(NSStringUtils::CStringBuilder& writer, bool bExtendedWrite) const
{
std::wstring node_name = bExtendedWrite ? L"x14:dataValidation" : L"dataValidation";
{
if (!m_oSqRef.IsInit()) return;
writer.WriteString(L"<" + node_name);
std::wstring node_name = bExtendedWrite ? L"x14:dataValidation" : L"dataValidation";
writer.WriteString(L"<" + node_name);
if (bExtendedWrite)
{
if (false == m_oUuid.IsInit())
{
m_oUuid = L"{" + XmlUtils::GenerateGuid() + L"}";
}
WritingStringNullableAttrString (L"xr:uid", m_oUuid, m_oUuid.get());
WritingStringNullableAttrString(L"xr:uid", m_oUuid, m_oUuid.get());
}
else
{
WritingStringNullableAttrString(L"sqref", m_oSqRef, m_oSqRef.get());
}
WritingStringNullableAttrString (L"type", m_oType, m_oType->ToString());
WritingStringNullableAttrInt (L"allowBlank", m_oAllowBlank, m_oAllowBlank->GetValue());
WritingStringNullableAttrEncodeXmlStringHHHH(L"error", m_oError, m_oError.get());
WritingStringNullableAttrString (L"errorStyle", m_oErrorStyle, m_oErrorStyle->ToString());
WritingStringNullableAttrEncodeXmlStringHHHH(L"errorTitle", m_oErrorTitle, m_oErrorTitle.get());
WritingStringNullableAttrString (L"imeMode", m_oImeMode, m_oImeMode->ToString());
WritingStringNullableAttrString (L"operator", m_oOperator, m_oOperator->ToString());
WritingStringNullableAttrEncodeXmlStringHHHH(L"prompt", m_oPrompt, m_oPrompt.get());
WritingStringNullableAttrEncodeXmlStringHHHH(L"promptTitle", m_oPromptTitle, m_oPromptTitle.get());
WritingStringNullableAttrInt (L"showDropDown", m_oShowDropDown, m_oShowDropDown->GetValue());
WritingStringNullableAttrInt (L"showErrorMessage",m_oShowErrorMessage,m_oShowErrorMessage->GetValue());
WritingStringNullableAttrInt (L"showInputMessage",m_oShowInputMessage,m_oShowInputMessage->GetValue());
writer.WriteString(L">");
WritingStringNullableAttrString(L"type", m_oType, m_oType->ToString());
WritingStringNullableAttrInt(L"allowBlank", m_oAllowBlank, m_oAllowBlank->GetValue());
WritingStringNullableAttrEncodeXmlStringHHHH(L"error", m_oError, m_oError.get());
WritingStringNullableAttrString(L"errorStyle", m_oErrorStyle, m_oErrorStyle->ToString());
WritingStringNullableAttrEncodeXmlStringHHHH(L"errorTitle", m_oErrorTitle, m_oErrorTitle.get());
WritingStringNullableAttrString(L"imeMode", m_oImeMode, m_oImeMode->ToString());
WritingStringNullableAttrString(L"operator", m_oOperator, m_oOperator->ToString());
WritingStringNullableAttrEncodeXmlStringHHHH(L"prompt", m_oPrompt, m_oPrompt.get());
WritingStringNullableAttrEncodeXmlStringHHHH(L"promptTitle", m_oPromptTitle, m_oPromptTitle.get());
WritingStringNullableAttrInt(L"showDropDown", m_oShowDropDown, m_oShowDropDown->GetValue());
WritingStringNullableAttrInt(L"showErrorMessage", m_oShowErrorMessage, m_oShowErrorMessage->GetValue());
WritingStringNullableAttrInt(L"showInputMessage", m_oShowInputMessage, m_oShowInputMessage->GetValue());
writer.WriteString(L">");
if (bExtendedWrite)
{
if (m_oFormula1.IsInit())
if (bExtendedWrite)
{
writer.WriteString(L"<x14:formula1>");
if (m_oFormula1.IsInit())
{
writer.WriteString(L"<x14:formula1>");
m_oFormula1->toXML2(writer, true);
writer.WriteString(L"</x14:formula1>");
}
if (m_oFormula2.IsInit())
{
writer.WriteString(L"<x14:formula2>");
writer.WriteString(L"</x14:formula1>");
}
if (m_oFormula2.IsInit())
{
writer.WriteString(L"<x14:formula2>");
m_oFormula2->toXML2(writer, true);
writer.WriteString(L"</x14:formula2>");
writer.WriteString(L"</x14:formula2>");
}
if (m_oSqRef.IsInit())
{
writer.WriteString(L"<xm:sqref>" + m_oSqRef.get() + L"</xm:sqref>");
}
}
if (m_oSqRef.IsInit())
else
{
writer.WriteString(L"<xm:sqref>" + m_oSqRef.get() + L"</xm:sqref>");
}
}
else
{
if (m_oFormula1.IsInit())
{
writer.WriteString(L"<formula1>");
if (m_oFormula1.IsInit())
{
writer.WriteString(L"<formula1>");
writer.WriteString(m_oFormula1->m_sText);
writer.WriteString(L"</formula1>");
}
if (m_oFormula2.IsInit())
{
writer.WriteString(L"<formula2>");
writer.WriteString(L"</formula1>");
}
if (m_oFormula2.IsInit())
{
writer.WriteString(L"<formula2>");
writer.WriteString(m_oFormula2->m_sText);
writer.WriteString(L"</formula2>");
writer.WriteString(L"</formula2>");
}
}
writer.WriteString(L"</" + node_name + L">");
}
writer.WriteString(L"</" + node_name + L">");
}
bool CDataValidation::IsExtended()
{
bool result1 = true, result2 = true;