Commit 4ea7f5f9 authored by konovalovsergey's avatar konovalovsergey

for docx background

parent 50a1f3f5
......@@ -292,9 +292,9 @@ public:
if(ThemeColor.bColor)
sBackground += L" w:themeColor=\"" + ThemeColor.ToStringColor() + L"\"";
if(ThemeColor.bTint)
sBackground += L" w:themeColorTint=\"" + ThemeColor.ToStringTint() + L"\"";
sBackground += L" w:themeTint=\"" + ThemeColor.ToStringTint() + L"\"";
if(ThemeColor.bShade)
sBackground += L" w:themeColorShade=\"" + ThemeColor.ToStringShade() + L"\"";
sBackground += L" w:themeShade=\"" + ThemeColor.ToStringShade() + L"\"";
}
if (!bColor && !bThemeColor)
......
......@@ -6572,30 +6572,15 @@ public:
}
else if( c_oSerBackgroundType::pptxDrawing == type )
{
CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr());
oCDrawingProperty.bType = oCDrawingProperty.bHeight = oCDrawingProperty.bWidth = true;
oCDrawingProperty.Type = c_oAscWrapStyle::Inline;
CString sDrawingProperty = oCDrawingProperty.Write();
BYTE type = m_oBufferedStream.GetUChar();
long lenType = m_oBufferedStream.GetUChar();
int nRealLen = m_oBufferedStream.GetLong();
CString* bstrDrawingXml = NULL;
long nCurPos = m_oBufferedStream.GetPos();
m_oFileWriter.m_pDrawingConverter->SaveObjectEx(nCurPos, nRealLen, sDrawingProperty, XMLWRITER_DOC_TYPE_DOCX, &bstrDrawingXml);
if(NULL != bstrDrawingXml && false == bstrDrawingXml->IsEmpty())
{
pBackground->sObject = *bstrDrawingXml;
}
RELEASEOBJECT(bstrDrawingXml);
CDrawingProperty oCDrawingProperty(0);
res = Read2(length, &Binary_DocumentTableReader::ReadPptxDrawing, this, &oCDrawingProperty);
m_oBufferedStream.Seek(nCurPos + nRealLen);
if (oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength)
{
long nCurPos = m_oBufferedStream.GetPos();
pBackground->sObject = m_oFileWriter.m_pDrawingConverter->SaveObjectBackground(oCDrawingProperty.DataPos, oCDrawingProperty.DataLength);
m_oBufferedStream.Seek(nCurPos);
}
}
else
res = c_oSerConstants::ReadUnknown;
......
......@@ -1233,10 +1233,8 @@ rIns=\"91440\" bIns=\"45720\" numCol=\"1\" spcCol=\"0\" rtlCol=\"0\" fromWordArt
}
else if (strName == L"background")
{
m_pBinaryWriter->StartRecord(1);
PPTX::Logic::SpTreeElem oElem = doc_LoadShape(oParseNode, pMainProps, false);
m_pBinaryWriter->WriteRecord1(1, oElem);
m_pBinaryWriter->EndRecord();
PPTX::Logic::SpTreeElem oElem = doc_LoadShape(oParseNode, pMainProps, false);
m_pBinaryWriter->WriteRecord1(1, oElem);
break;
}
else if (strName == L"pict" || strName == L"object")
......@@ -4414,6 +4412,39 @@ HRESULT CDrawingConverter::SaveObjectEx(LONG lStart, LONG lLength, const CString
m_pReader->Seek(_e);
return S_OK;
}
std::wstring CDrawingConverter::SaveObjectBackground(LONG lStart, LONG lLength)
{
m_pReader->Seek(lStart);
++m_nCurrentIndexObject;
BYTE typeRec1 = m_pReader->GetUChar(); // must be 0;
LONG _e = m_pReader->GetPos() + m_pReader->GetLong() + 4;
m_pReader->Skip(5); // type record (must be 1) + 4 byte - len record
PPTX::Logic::SpTreeElem oElem;
m_pReader->m_lDocumentType = XMLWRITER_DOC_TYPE_DOCX;
oElem.fromPPTY(m_pReader);
m_pReader->m_lDocumentType = XMLWRITER_DOC_TYPE_PPTX;
NSBinPptxRW::CXmlWriter oXmlWriter;
SaveObjectExWriterInit(oXmlWriter, XMLWRITER_DOC_TYPE_DOCX);
oXmlWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap);
--m_nCurrentIndexObject;
SaveObjectExWriterRelease(oXmlWriter);
m_pReader->Seek(_e);
return oXmlWriter.GetXmlString();
}
void CDrawingConverter::ConvertPicVML(PPTX::Logic::SpTreeElem& oElem, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
{
......
......@@ -221,6 +221,7 @@ namespace NSBinPptxRW
HRESULT SaveObjectEx (long lStart, long lLength, const CString& bsMainProps, long lDocType, CString** bsXml);
void SaveObjectExWriterInit(NSBinPptxRW::CXmlWriter& oXmlWriter, LONG lDocType);
void SaveObjectExWriterRelease(NSBinPptxRW::CXmlWriter& oXmlWriter);
std::wstring SaveObjectBackground(LONG lStart, LONG lLength);
HRESULT GetRecordBinary (long lRecordType, const CString& bsXml);
HRESULT GetRecordXml (long lStart, long lLength, long lRecType, long lDocType, CString** bsXml);
......
......@@ -654,5 +654,31 @@ namespace PPTX
pWriter->EndNode(_T("v:shape"));
}
}
void Shape::toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap)
{
CString strFillAttr = _T("");
CString strFillNode = _T("");
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false);
pWriter->StartNode(_T("v:background"));
pWriter->StartAttributes();
pWriter->WriteString(L" id=\"_x0000_s1025\"");
if (!pWriter->m_strAttributesMain.empty())
{
pWriter->WriteString(pWriter->m_strAttributesMain);
pWriter->m_strAttributesMain.clear();
}
pWriter->WriteString(strFillAttr);
pWriter->EndAttributes();
pWriter->WriteString(strFillNode);
pWriter->EndNode(_T("v:background"));
}
} // namespace Logic
} // namespace PPTX
......@@ -134,6 +134,7 @@ namespace PPTX
}
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
void toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
......
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