Skip to content

Commit

Permalink
fix bug #69947
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaSubbotina committed Aug 29, 2024
1 parent a748b08 commit 2685f28
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 48 deletions.
3 changes: 2 additions & 1 deletion MsBinaryFile/PptFile/PPTXWriter/TableWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,8 @@ void TCell::FillLn(PPTX::Logic::Ln &Ln, TCell::eBorderPossition eBP, CElementPtr
pLineEnd->len = new PPTX::Limit::LineEndSize;
Ln.tailEnd = pLineEnd;

Ln.Join.type = PPTX::Logic::eJoin::JoinRound;
Ln.Join.Init();
Ln.Join->type = PPTX::Logic::eJoin::JoinRound;
}

void TCell::SetLnName(PPTX::Logic::Ln &Ln, eBorderPossition eBP) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5667,9 +5667,10 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();

if (*sLineJoin == L"bevel") pSpPr->ln->Join.type = PPTX::Logic::JoinBevel;
else if (*sLineJoin == L"miter") pSpPr->ln->Join.type = PPTX::Logic::JoinMiter;
else if (*sLineJoin == L"round") pSpPr->ln->Join.type = PPTX::Logic::JoinRound;
pSpPr->ln->Join.Init();
if (*sLineJoin == L"bevel") pSpPr->ln->Join->type = PPTX::Logic::JoinBevel;
else if (*sLineJoin == L"miter") pSpPr->ln->Join->type = PPTX::Logic::JoinMiter;
else if (*sLineJoin == L"round") pSpPr->ln->Join->type = PPTX::Logic::JoinRound;
}
}
nullable_string sStroked;
Expand Down
3 changes: 1 addition & 2 deletions OOXML/PPTXFormat/Logic/LineJoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ namespace PPTX
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);

public:
eJoin type;
eJoin type = Logic::JoinEmpty;
nullable_int lim;

protected:
Expand Down
84 changes: 43 additions & 41 deletions OOXML/PPTXFormat/Logic/Ln.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,30 @@ namespace PPTX
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("bevel") == sName ||
_T("miter") == sName ||
_T("round") == sName )
if (L"bevel" == sName ||
L"miter" == sName ||
L"round" == sName )
{
Join.fromXML(oReader);
Join = oReader;
}
else if ( _T("tailEnd") == sName )
else if ( L"tailEnd" == sName )
tailEnd = oReader;
else if ( _T("headEnd") == sName )
else if ( L"headEnd" == sName )
headEnd = oReader;

else if ( _T("gradFill") == sName ||
_T("noFill") == sName ||
_T("pattFill") == sName ||
_T("solidFill") == sName )
else if ( L"gradFill" == sName ||
L"noFill" == sName ||
L"pattFill" == sName ||
L"solidFill" == sName )
{
Fill.fromXML(oReader);
}
else if ( _T("custDash") == sName )
else if ( L"custDash" == sName )
{
//custDash = oReader;
//m_eDashType = OOX::Drawing::linedashtypeCustom;
}
else if ( _T("prstDash") == sName )
else if ( L"prstDash" == sName )
{
prstDash = oReader;
//m_eDashType = OOX::Drawing::linedashtypePreset;
Expand Down Expand Up @@ -113,20 +113,20 @@ namespace PPTX
XmlMacroReadAttributeBase(node, L"w", w);

Fill.GetFillFrom(node);
prstDash = node.ReadNodeNoNS(_T("prstDash"));
Join.GetJoinFrom(node);
headEnd = node.ReadNodeNoNS(_T("headEnd"));
tailEnd = node.ReadNodeNoNS(_T("tailEnd"));
prstDash = node.ReadNodeNoNS(L"prstDash");
Join.Init(); Join->GetJoinFrom(node);
headEnd = node.ReadNodeNoNS(L"headEnd");
tailEnd = node.ReadNodeNoNS(L"tailEnd");

FillParentPointersForChilds();
}
void Ln::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("algn"), algn )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cap"), cap )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cmpd"), cmpd )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w"), w )
WritingElement_ReadAttributes_Read_if ( oReader, L"algn", algn )
WritingElement_ReadAttributes_Read_else_if( oReader, L"cap", cap )
WritingElement_ReadAttributes_Read_else_if( oReader, L"cmpd", cmpd )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w", w )
WritingElement_ReadAttributes_End_No_NS( oReader )

Normalize();
Expand All @@ -135,23 +135,23 @@ namespace PPTX
{
std::wstring _name = m_name;
if (_name.empty())
_name = _T("a:ln");
_name = L"a:ln";

std::wstring sAttrNamespace;

if (_name == L"w14:textOutline")
sAttrNamespace = _T("w14:");
sAttrNamespace = L"w14:";

XmlUtils::CAttribute oAttr;
oAttr.Write (sAttrNamespace + _T("w"), w);
oAttr.WriteLimitNullable(sAttrNamespace + _T("cap"), cap);
oAttr.WriteLimitNullable(sAttrNamespace + _T("cmpd"), cmpd);
oAttr.WriteLimitNullable(sAttrNamespace + _T("algn"), algn);
oAttr.Write (sAttrNamespace + L"w", w);
oAttr.WriteLimitNullable(sAttrNamespace + L"cap", cap);
oAttr.WriteLimitNullable(sAttrNamespace + L"cmpd", cmpd);
oAttr.WriteLimitNullable(sAttrNamespace + L"algn", algn);

XmlUtils::CNodeValue oValue;
oValue.Write(Fill);
oValue.WriteNullable(prstDash);
oValue.Write(Join);
oValue.WriteNullable(Join);
oValue.WriteNullable(headEnd);
oValue.WriteNullable(tailEnd);

Expand All @@ -161,27 +161,27 @@ namespace PPTX
{
std::wstring _name = m_name;
if (_name.empty())
_name = _T("a:ln");
_name = L"a:ln";

std::wstring sAttrNamespace;
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
{
_name = _T("w14:textOutline");
sAttrNamespace = _T("w14:");
_name = L"w14:textOutline";
sAttrNamespace = L"w14:";
}

pWriter->StartNode(_name);

pWriter->StartAttributes();
pWriter->WriteAttribute(sAttrNamespace + _T("w"), w);
pWriter->WriteAttribute(sAttrNamespace + _T("cap"), cap);
pWriter->WriteAttribute(sAttrNamespace + _T("cmpd"), cmpd);
pWriter->WriteAttribute(sAttrNamespace + _T("algn"), algn);
pWriter->WriteAttribute(sAttrNamespace + L"w", w);
pWriter->WriteAttribute(sAttrNamespace + L"cap", cap);
pWriter->WriteAttribute(sAttrNamespace + L"cmpd", cmpd);
pWriter->WriteAttribute(sAttrNamespace + L"algn", algn);
pWriter->EndAttributes();

Fill.toXmlWriter(pWriter);
pWriter->Write(prstDash);
Join.toXmlWriter(pWriter);
pWriter->Write(Join);
pWriter->Write(headEnd);
pWriter->Write(tailEnd);

Expand All @@ -198,13 +198,13 @@ namespace PPTX

pWriter->WriteRecord1(0, Fill);
pWriter->WriteRecord2(1, prstDash);
pWriter->WriteRecord1(2, Join);
pWriter->WriteRecord2(2, Join);
pWriter->WriteRecord2(3, headEnd);
pWriter->WriteRecord2(4, tailEnd);
}
void Ln::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
m_name = _T("a:ln");
m_name = L"a:ln";

LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 4;
pReader->Skip(1); // start attributes
Expand Down Expand Up @@ -260,20 +260,21 @@ namespace PPTX
}
case 2:
{
Join.fromPPTY(pReader);
Join.Init();
Join->fromPPTY(pReader);
break;
}
case 3:
{
headEnd = new Logic::LineEnd();
headEnd->m_name = _T("a:headEnd");
headEnd->m_name = L"a:headEnd";
headEnd->fromPPTY(pReader);
break;
}
case 4:
{
tailEnd = new Logic::LineEnd();
tailEnd->m_name = _T("a:tailEnd");
tailEnd->m_name = L"a:tailEnd";
tailEnd->fromPPTY(pReader);
break;
}
Expand Down Expand Up @@ -334,7 +335,8 @@ namespace PPTX
void Ln::FillParentPointersForChilds()
{
Fill.SetParentPointer(this);
Join.SetParentPointer(this);
if (Join.IsInit())
Join->SetParentPointer(this);
if(prstDash.IsInit())
prstDash->SetParentPointer(this);
if(headEnd.IsInit())
Expand Down
2 changes: 1 addition & 1 deletion OOXML/PPTXFormat/Logic/Ln.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace PPTX

nullable<PrstDash> prstDash;
//custDash (Custom Dash) ยง20.1.8.21
LineJoin Join;
nullable<LineJoin> Join;
nullable<LineEnd> headEnd;
nullable<LineEnd> tailEnd;

Expand Down

0 comments on commit 2685f28

Please sign in to comment.