Skip to content

Commit

Permalink
fix bug #66057
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaSubbotina committed Feb 22, 2024
1 parent 620827a commit 0bc356e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 8 deletions.
21 changes: 17 additions & 4 deletions OOXML/DocxFormat/DocxFlat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,24 @@ namespace OOX
}
else if (L"w:docSuppData" == sName && !oReader.IsEmptyNode())
{
m_oDocSuppData = new OOX::Logic::CDocSuppData(WritingElement::m_pMainDocument);
m_oDocSuppData->fromXML(oReader);

ParsingSuppData();
//m_oDocSuppData = new OOX::Logic::CDocSuppData(WritingElement::m_pMainDocument);
//m_oDocSuppData->fromXML(oReader);
//
//ParsingSuppData();
}
//CustomDocumentProperties
}

if (!m_sCompatibilityMode.IsInit() && m_pCore.IsInit() && (m_pCore->m_sVersion.IsInit()))
{
if (false == m_pSettings.IsInit()) m_pSettings = new CSettings(this);
if (m_pSettings->m_oCompat.IsInit()) m_pSettings->m_oCompat.Init();

Settings::CCompatSetting* pSett = new Settings::CCompatSetting();
pSett->m_sName = L"compatibilityMode";
pSett->m_sUri = L"http://schemas.microsoft.com/office/word";
pSett->m_sVal = m_pCore->m_sVersion;
m_pSettings->m_oCompat->m_arrCompatSettings.push_back(pSett);
}

if ((m_oDocSuppData.IsInit()) && (m_oDocSuppData->m_oBinData.IsInit()) && (m_pDocument.IsInit()))
Expand Down
2 changes: 2 additions & 0 deletions OOXML/DocxFormat/DocxFlat.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ namespace OOX
nullable<CApp> m_pApp;
nullable<CCore> m_pCore;
//-----------------------------------------------------------
nullable_string m_sCompatibilityMode;

std::map<std::wstring, NSCommon::smart_ptr<OOX::File>> m_mapImages;
std::map<std::wstring, NSCommon::smart_ptr<OOX::File>> m_mapOleData;

Expand Down
39 changes: 36 additions & 3 deletions OOXML/DocxFormat/Settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ namespace Settings
}
void CCompatSetting::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
if ( oReader.GetAttributesCount() <= 0 )
return;

Expand Down Expand Up @@ -554,6 +553,15 @@ namespace Settings
wsName = oReader.GetName();
}
oReader.MoveToElement();

if (m_sName.IsInit() && (*m_sName == L"compatibilityMode") && m_sVal.IsInit())
{
CDocxFlat* flat_docx = dynamic_cast<CDocxFlat*>(m_pMainDocument);
if (flat_docx)
{
flat_docx->m_sCompatibilityMode = *m_sVal;
}
}
}

//--------------------------------------------------------------------------------
Expand Down Expand Up @@ -669,24 +677,49 @@ namespace Settings
m_oLayoutRawTableWidth = oReader;
else if ( L"w:layoutTableRowsApart" == sName )
m_oLayoutTableRowsApart = oReader;
else if ( L"w:useWord97LineBreakRules" == sName )
else if ( L"w:useWord97LineBreakRules" == sName )
m_oUseWord97LineBreakRules = oReader;
else if (L"w:breakWrappedTables" == sName)
{
m_oDoNotBreakWrappedTables = oReader;
m_oDoNotBreakWrappedTables->m_oVal.FromBool(!m_oDoNotBreakWrappedTables->m_oVal.ToBool());
}
else if ( L"w:doNotBreakWrappedTables" == sName )
m_oDoNotBreakWrappedTables = oReader;
else if (L"w:snapToGridInCell" == sName)
{
m_oDoNotSnapToGridInCell = oReader;
m_oDoNotSnapToGridInCell->m_oVal.FromBool(!m_oDoNotSnapToGridInCell->m_oVal.ToBool());
}
else if ( L"w:doNotSnapToGridInCell" == sName )
m_oDoNotSnapToGridInCell = oReader;
else if ( L"w:selectFldWithFirstOrLastChar" == sName )
m_oSelectFldWithFirstOrLastChar = oReader;
else if ( L"w:applyBreakingRules" == sName )
m_oApplyBreakingRules = oReader;
else if (L"w:wrapTextWithPunct" == sName)
{
m_oDoNotWrapTextWithPunct = oReader;
m_oDoNotWrapTextWithPunct->m_oVal.FromBool(!m_oDoNotWrapTextWithPunct->m_oVal.ToBool());
}
else if ( L"w:doNotWrapTextWithPunct" == sName )
m_oDoNotWrapTextWithPunct = oReader;
else if (L"w:useAsianBreakRules" == sName)
{
m_oDoNotUseEastAsianBreakRules = oReader;
m_oDoNotUseEastAsianBreakRules->m_oVal.FromBool(!m_oDoNotUseEastAsianBreakRules->m_oVal.ToBool());
}
else if ( L"w:doNotUseEastAsianBreakRules" == sName )
m_oDoNotUseEastAsianBreakRules = oReader;
else if ( L"w:useWord2002TableStyleRules" == sName )
m_oUseWord2002TableStyleRules = oReader;
else if ( L"w:growAutofit" == sName )
m_oGrowAutofit = oReader;
else if (L"w:dontGrowAutofit" == sName)
{
m_oGrowAutofit = oReader;
m_oGrowAutofit->m_oVal.FromBool(!m_oGrowAutofit->m_oVal.ToBool());
}
else if ( L"w:useFELayout" == sName )
m_oUseFELayout = oReader;
else if ( L"w:useNormalStyleForList" == sName )
Expand Down Expand Up @@ -724,7 +757,7 @@ namespace Settings
OOX::Settings::CCompatSetting *oCS = new OOX::Settings::CCompatSetting();
*oCS = oReader;

if (oCS)m_arrCompatSettings.push_back( oCS );
if (oCS) m_arrCompatSettings.push_back( oCS );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion OOXML/XlsxFormat/Workbook/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ namespace OOX

writer.WriteString(L"<futureMetadata");
WritingStringNullableAttrEncodeXmlString2(L"name", m_oName);
writer.WriteString(L" count=\"" + std::to_wstring(m_arrItems.size()) + L"\">");
writer.WriteString(L" count=\"" + std::to_wstring(m_arrItems.size()));
writer.WriteString(L">");

for (size_t i = 0; i < m_arrItems.size(); ++i)
Expand Down

0 comments on commit 0bc356e

Please sign in to comment.