Commit a810253b authored by konovalovsergey's avatar konovalovsergey

opne/save drawing docPr

parent 05e42b19
...@@ -1921,6 +1921,7 @@ public: ...@@ -1921,6 +1921,7 @@ public:
CString sSizeRelV; CString sSizeRelV;
int m_nDocPr; int m_nDocPr;
CString sGraphicFramePr; CString sGraphicFramePr;
CString sDocPr;
CDrawingPropertyWrap DrawingPropertyWrap; CDrawingPropertyWrap DrawingPropertyWrap;
...@@ -2015,9 +2016,9 @@ public: ...@@ -2015,9 +2016,9 @@ public:
sXml.AppendFormat(_T("<wp:effectExtent l=\"%lld\" t=\"%lld\" r=\"%lld\" b=\"%lld\"/>"), emuEffectExtentL, emuEffectExtentT, emuEffectExtentR, emuEffectExtentB); sXml.AppendFormat(_T("<wp:effectExtent l=\"%lld\" t=\"%lld\" r=\"%lld\" b=\"%lld\"/>"), emuEffectExtentL, emuEffectExtentT, emuEffectExtentR, emuEffectExtentB);
} }
if(bChart) if(!sDocPr.IsEmpty())
{ {
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"Chart %d\"/>"), m_nDocPr, m_nDocPr); sXml.Append(sDocPr);
} }
else else
{ {
...@@ -2233,9 +2234,9 @@ public: ...@@ -2233,9 +2234,9 @@ public:
else else
sXml.Append(_T("<wp:wrapNone/>")); sXml.Append(_T("<wp:wrapNone/>"));
if(bChart) if(!sDocPr.IsEmpty())
{ {
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"Chart %d\"/>"), m_nDocPr, m_nDocPr); sXml.Append(sDocPr);
} }
else else
{ {
......
...@@ -6572,7 +6572,7 @@ public: ...@@ -6572,7 +6572,7 @@ public:
} }
else if( c_oSerBackgroundType::pptxDrawing == type ) else if( c_oSerBackgroundType::pptxDrawing == type )
{ {
CDrawingProperty oCDrawingProperty(0); CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr());
res = Read2(length, &Binary_DocumentTableReader::ReadPptxDrawing, this, &oCDrawingProperty); res = Read2(length, &Binary_DocumentTableReader::ReadPptxDrawing, this, &oCDrawingProperty);
if (oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength) if (oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength)
...@@ -6799,6 +6799,13 @@ public: ...@@ -6799,6 +6799,13 @@ public:
oGraphicFramePr.m_oGraphicFrameLocks.reset(pLocking); oGraphicFramePr.m_oGraphicFrameLocks.reset(pLocking);
pDrawingProperty->sGraphicFramePr = oGraphicFramePr.toXML(); pDrawingProperty->sGraphicFramePr = oGraphicFramePr.toXML();
} }
else if ( c_oSerImageType2::DocPr == type )
{
OOX::Drawing::CNonVisualDrawingProps pNonVisualDrawingProps;
pNonVisualDrawingProps.m_eType = OOX::et_wp_docPr;
res = Read1(length, &Binary_DocumentTableReader::ReadDocPr, this, &pNonVisualDrawingProps);
pDrawingProperty->sDocPr = pNonVisualDrawingProps.toXML();
}
else else
res = c_oSerConstants::ReadUnknown; res = c_oSerConstants::ReadUnknown;
return res; return res;
...@@ -6841,6 +6848,39 @@ public: ...@@ -6841,6 +6848,39 @@ public:
res = c_oSerConstants::ReadUnknown; res = c_oSerConstants::ReadUnknown;
return res; return res;
} }
int ReadDocPr(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Drawing::CNonVisualDrawingProps* pNonVisualDrawingProps = static_cast<OOX::Drawing::CNonVisualDrawingProps*>(poResult);
if ( c_oSerDocPr::Id == type )
{
pNonVisualDrawingProps->m_oId.Init();
pNonVisualDrawingProps->m_oId->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerDocPr::Name == type )
{
pNonVisualDrawingProps->m_sName.Init();
pNonVisualDrawingProps->m_sName->Append(m_oBufferedStream.GetString3(length));
}
else if ( c_oSerDocPr::Hidden == type )
{
pNonVisualDrawingProps->m_oHidden.Init();
pNonVisualDrawingProps->m_oHidden->FromBool(m_oBufferedStream.GetBool());
}
else if ( c_oSerDocPr::Title == type )
{
pNonVisualDrawingProps->m_sTitle.Init();
pNonVisualDrawingProps->m_sTitle->Append(m_oBufferedStream.GetString3(length));
}
else if ( c_oSerDocPr::Descr == type )
{
pNonVisualDrawingProps->m_sDescr.Init();
pNonVisualDrawingProps->m_sDescr->Append(m_oBufferedStream.GetString3(length));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadEffectExtent(BYTE type, long length, void* poResult) int ReadEffectExtent(BYTE type, long length, void* poResult)
{ {
int res = c_oSerConstants::ReadOk; int res = c_oSerConstants::ReadOk;
......
...@@ -557,7 +557,8 @@ extern int g_nCurFormatVersion; ...@@ -557,7 +557,8 @@ extern int g_nCurFormatVersion;
SizeRelH = 27, SizeRelH = 27,
SizeRelV = 28, SizeRelV = 28,
Embedded = 29, Embedded = 29,
GraphicFramePr = 30 GraphicFramePr = 30,
DocPr = 31
};} };}
namespace c_oSerEffectExtent{enum c_oSerEffectExtent namespace c_oSerEffectExtent{enum c_oSerEffectExtent
{ {
...@@ -986,6 +987,14 @@ extern int g_nCurFormatVersion; ...@@ -986,6 +987,14 @@ extern int g_nCurFormatVersion;
PrEndPos = 10, PrEndPos = 10,
PrRef = 11 PrRef = 11
};} };}
namespace c_oSerDocPr{enum c_oSerDocPr
{
Id = 0,
Name = 1,
Hidden = 2,
Title = 3,
Descr = 4
};}
} }
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES #endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
...@@ -5538,6 +5538,14 @@ namespace BinDocxRW ...@@ -5538,6 +5538,14 @@ namespace BinDocxRW
WriteNvGraphicFramePr(pInline.m_oCNvGraphicFramePr.get()); WriteNvGraphicFramePr(pInline.m_oCNvGraphicFramePr.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos); m_oBcw.WriteItemWithLengthEnd(nCurPos);
} }
if(pInline.m_oDocPr.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DocPr);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
nCurPos = m_oBcw.WriteItemWithLengthStart();
WriteDocPr(pInline.m_oDocPr.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
} }
} }
else if(img.m_oAnchor.IsInit() ) else if(img.m_oAnchor.IsInit() )
...@@ -5713,6 +5721,14 @@ namespace BinDocxRW ...@@ -5713,6 +5721,14 @@ namespace BinDocxRW
WriteNvGraphicFramePr(pAnchor.m_oCNvGraphicFramePr.get()); WriteNvGraphicFramePr(pAnchor.m_oCNvGraphicFramePr.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos); m_oBcw.WriteItemWithLengthEnd(nCurPos);
} }
if(pAnchor.m_oDocPr.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DocPr);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
nCurPos = m_oBcw.WriteItemWithLengthStart();
WriteDocPr(pAnchor.m_oDocPr.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
} }
} }
if(bDeleteDrawing) if(bDeleteDrawing)
...@@ -5761,6 +5777,40 @@ namespace BinDocxRW ...@@ -5761,6 +5777,40 @@ namespace BinDocxRW
} }
} }
} }
void WriteDocPr(const OOX::Drawing::CNonVisualDrawingProps& oDocPr)
{
int nCurPos;
if(oDocPr.m_oId.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerDocPr::Id);
m_oBcw.m_oStream.WriteLONG(oDocPr.m_oId->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oDocPr.m_sName.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerDocPr::Name);
m_oBcw.m_oStream.WriteStringW3(oDocPr.m_sName.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oDocPr.m_oHidden.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerDocPr::Hidden);
m_oBcw.m_oStream.WriteBOOL(oDocPr.m_oHidden->ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oDocPr.m_sTitle.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerDocPr::Title);
m_oBcw.m_oStream.WriteStringW3(oDocPr.m_sTitle.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oDocPr.m_sDescr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerDocPr::Descr);
m_oBcw.m_oStream.WriteStringW3(oDocPr.m_sDescr.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteEffectExtent(const OOX::Drawing::CEffectExtent& oEffectExtent) void WriteEffectExtent(const OOX::Drawing::CEffectExtent& oEffectExtent)
{ {
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Left); m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Left);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment