mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
fix bug #59772
This commit is contained in:
@ -627,7 +627,7 @@ namespace DocFileFormat
|
|||||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||||
// pPr
|
// pPr
|
||||||
bool isBidi = false;
|
bool isBidi = false;
|
||||||
ParagraphPropertiesMapping oppMapping(m_pXmlWriter, m_context, m_document, NULL, isBidi);
|
ParagraphPropertiesMapping oppMapping(m_pXmlWriter, m_context, m_document, NULL, isBidi, NULL, -1, false);
|
||||||
lvl->grpprlPapx->Convert(&oppMapping);
|
lvl->grpprlPapx->Convert(&oppMapping);
|
||||||
|
|
||||||
// пишем rPr
|
// пишем rPr
|
||||||
|
|||||||
@ -43,14 +43,8 @@ namespace DocFileFormat
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~StyleSheet();
|
virtual ~StyleSheet();
|
||||||
/// Parses the streams to retrieve a StyleSheet.
|
|
||||||
StyleSheet(FileInformationBlock* fib, POLE::Stream* tableStream, POLE::Stream* dataStream);
|
StyleSheet(FileInformationBlock* fib, POLE::Stream* tableStream, POLE::Stream* dataStream);
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// The StyleSheetInformation of the stylesheet.
|
|
||||||
StyleSheetInformation* stshi;
|
StyleSheetInformation* stshi;
|
||||||
/// The list contains all styles.
|
|
||||||
std::vector<StyleSheetDescription*>* Styles;
|
std::vector<StyleSheetDescription*>* Styles;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -81,12 +81,17 @@ namespace DocFileFormat
|
|||||||
//NormalTable
|
//NormalTable
|
||||||
writeNormalTableStyle();
|
writeNormalTableStyle();
|
||||||
}
|
}
|
||||||
|
int count_styles = 0;
|
||||||
for ( size_t i = 0; i < sheet->Styles->size(); ++i)
|
for ( size_t i = 0; i < sheet->Styles->size(); ++i)
|
||||||
{
|
{
|
||||||
StyleSheetDescription* style = sheet->Styles->at(i);
|
StyleSheetDescription* style = sheet->Styles->at(i);
|
||||||
if (!style) continue;
|
if (!style) continue;
|
||||||
|
|
||||||
|
count_styles++;
|
||||||
|
|
||||||
|
if (count_styles > 4080) // todooo - skip/remap equal styles
|
||||||
|
break;
|
||||||
|
|
||||||
m_pXmlWriter->WriteNodeBegin(L"w:style", true);
|
m_pXmlWriter->WriteNodeBegin(L"w:style", true);
|
||||||
|
|
||||||
m_pXmlWriter->WriteAttribute(L"w:type", FormatUtils::MapValueToWideString(style->stk, &StyleKindMap[0][0], 5, 10));
|
m_pXmlWriter->WriteAttribute(L"w:type", FormatUtils::MapValueToWideString(style->stk, &StyleKindMap[0][0], 5, 10));
|
||||||
@ -101,15 +106,30 @@ namespace DocFileFormat
|
|||||||
m_pXmlWriter->WriteAttribute(L"w:styleId", FormatUtils::XmlEncode(MakeStyleId(style)));
|
m_pXmlWriter->WriteAttribute(L"w:styleId", FormatUtils::XmlEncode(MakeStyleId(style)));
|
||||||
m_pXmlWriter->WriteNodeEnd(L"", true, false);
|
m_pXmlWriter->WriteNodeEnd(L"", true, false);
|
||||||
|
|
||||||
// <w:name val="" />
|
std::wstring sAliases;
|
||||||
std::wstring sName = FormatUtils::XmlEncode(getStyleName(style), true);
|
std::wstring sName = FormatUtils::XmlEncode(getStyleName(style), true);
|
||||||
m_pXmlWriter->WriteNodeBegin(L"w:name", true);
|
m_pXmlWriter->WriteNodeBegin(L"w:name", true);
|
||||||
if (style->sti == StyleIdentifier::Normal)
|
if (style->sti == StyleIdentifier::Normal)
|
||||||
m_pXmlWriter->WriteAttribute(L"w:val", L"Normal");
|
m_pXmlWriter->WriteAttribute(L"w:val", L"Normal");
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
std::size_t pos = sName.find(L",");
|
||||||
|
if (pos != std::wstring::npos)
|
||||||
|
{
|
||||||
|
sAliases = sName.substr(pos + 1);
|
||||||
|
sName = sName.substr(0, pos);
|
||||||
|
}
|
||||||
m_pXmlWriter->WriteAttribute(L"w:val", sName);
|
m_pXmlWriter->WriteAttribute(L"w:val", sName);
|
||||||
|
}
|
||||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||||
|
|
||||||
|
if (false == sAliases.empty())
|
||||||
|
{
|
||||||
|
m_pXmlWriter->WriteNodeBegin(L"w:aliases", true);
|
||||||
|
m_pXmlWriter->WriteAttribute(L"w:val", sAliases);
|
||||||
|
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
if (style->sti == StyleIdentifier::Normal) // ??? < sti < 159
|
if (style->sti == StyleIdentifier::Normal) // ??? < sti < 159
|
||||||
{
|
{
|
||||||
m_pXmlWriter->WriteNodeBegin(L"w:aliases", true);
|
m_pXmlWriter->WriteNodeBegin(L"w:aliases", true);
|
||||||
@ -117,7 +137,6 @@ namespace DocFileFormat
|
|||||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <w:basedOn val="" />
|
|
||||||
if ((style->istdBase != 4095) && (style->istdBase < sheet->Styles->size()))
|
if ((style->istdBase != 4095) && (style->istdBase < sheet->Styles->size()))
|
||||||
{
|
{
|
||||||
m_pXmlWriter->WriteNodeBegin(L"w:basedOn", true);
|
m_pXmlWriter->WriteNodeBegin(L"w:basedOn", true);
|
||||||
@ -125,7 +144,6 @@ namespace DocFileFormat
|
|||||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <w:next val="" />
|
|
||||||
if (style->istdNext < sheet->Styles->size())
|
if (style->istdNext < sheet->Styles->size())
|
||||||
{
|
{
|
||||||
m_pXmlWriter->WriteNodeBegin(L"w:next", true);
|
m_pXmlWriter->WriteNodeBegin(L"w:next", true);
|
||||||
@ -133,7 +151,6 @@ namespace DocFileFormat
|
|||||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <w:link val="" />
|
|
||||||
if (style->istdLink < sheet->Styles->size())
|
if (style->istdLink < sheet->Styles->size())
|
||||||
{
|
{
|
||||||
m_pXmlWriter->WriteNodeBegin(L"w:link", true);
|
m_pXmlWriter->WriteNodeBegin(L"w:link", true);
|
||||||
|
|||||||
Reference in New Issue
Block a user