Commit 38ee7f2b authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander Trofimov

после Revision: 66688 перестала сохраняться дополнительная информация о ole Обьектах

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@66800 954022d7-b5bf-4e40-9824-e11837661b57
parent a2494e2a

#include "ASCOfficeDrawingConverter.h" #include "ASCOfficeDrawingConverter.h"
#include "./PPTXFormat/Logic/SpTreeElem.h" #include "./PPTXFormat/Logic/SpTreeElem.h"
...@@ -439,7 +439,7 @@ namespace PPTX ...@@ -439,7 +439,7 @@ namespace PPTX
} }
void CStringTrimmer::LoadFromString(CString& strParams) void CStringTrimmer::LoadFromString(CString& strParams)
{ {
// - Mid, Find, // здесь не будем плодить тормозов - напишем без всяких Mid, Find, чтобы был только один проход
TCHAR* pData = strParams.GetBuffer(); TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength(); int nCount = strParams.GetLength();
...@@ -493,7 +493,7 @@ namespace PPTX ...@@ -493,7 +493,7 @@ namespace PPTX
{ {
Clear(); Clear();
// - Mid, Find, // здесь не будем плодить тормозов - напишем без всяких Mid, Find, чтобы был только один проход
TCHAR* pData = strParams.GetBuffer(); TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength(); int nCount = strParams.GetLength();
...@@ -519,7 +519,7 @@ namespace PPTX ...@@ -519,7 +519,7 @@ namespace PPTX
++nPosition; ++nPosition;
++pDataMem; ++pDataMem;
// // пропускаем пробелы
while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('{') == *pDataMem))) while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('{') == *pDataMem)))
{ {
++nPosition; ++nPosition;
...@@ -528,7 +528,7 @@ namespace PPTX ...@@ -528,7 +528,7 @@ namespace PPTX
int nPosOld = nPosition; int nPosOld = nPosition;
// // ищем имя настройки
while ((nPosition < nCount) && (TCHAR(':') != *pDataMem)) while ((nPosition < nCount) && (TCHAR(':') != *pDataMem))
{ {
++nPosition; ++nPosition;
...@@ -537,16 +537,16 @@ namespace PPTX ...@@ -537,16 +537,16 @@ namespace PPTX
if (nPosOld == nPosition) if (nPosOld == nPosition)
{ {
// // нету ни одной настройки
break; break;
} }
CString strName = strParams.Mid(nPosOld, nPosition - nPosOld); CString strName = strParams.Mid(nPosOld, nPosition - nPosOld);
// ':' // убираем ':'
++nPosition; ++nPosition;
++pDataMem; ++pDataMem;
// // пропускаем пробелы настройки
while ((nPosition < nCount) && (TCHAR(' ') == *pDataMem)) while ((nPosition < nCount) && (TCHAR(' ') == *pDataMem))
{ {
++nPosition; ++nPosition;
...@@ -555,7 +555,7 @@ namespace PPTX ...@@ -555,7 +555,7 @@ namespace PPTX
nPosOld = nPosition; nPosOld = nPosition;
// // пропускаем пробелы настройки
while ((nPosition < nCount) && (TCHAR(';') != *pDataMem) && (TCHAR('}') != *pDataMem)) while ((nPosition < nCount) && (TCHAR(';') != *pDataMem) && (TCHAR('}') != *pDataMem))
{ {
++nPosition; ++nPosition;
...@@ -572,7 +572,7 @@ namespace PPTX ...@@ -572,7 +572,7 @@ namespace PPTX
{ {
Clear(); Clear();
// - Mid, Find, // здесь не будем плодить тормозов - напишем без всяких Mid, Find, чтобы был только один проход
TCHAR* pData = strParams.GetBuffer(); TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength(); int nCount = strParams.GetLength();
...@@ -583,7 +583,7 @@ namespace PPTX ...@@ -583,7 +583,7 @@ namespace PPTX
while (true) while (true)
{ {
// // пропускаем пробелы
while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('{') == *pDataMem) || (TCHAR(';') == *pDataMem))) while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('{') == *pDataMem) || (TCHAR(';') == *pDataMem)))
{ {
++nPosition; ++nPosition;
...@@ -592,7 +592,7 @@ namespace PPTX ...@@ -592,7 +592,7 @@ namespace PPTX
int nPosOld = nPosition; int nPosOld = nPosition;
// // ищем имя настройки
while ((nPosition < nCount) && (TCHAR(':') != *pDataMem)) while ((nPosition < nCount) && (TCHAR(':') != *pDataMem))
{ {
++nPosition; ++nPosition;
...@@ -601,16 +601,16 @@ namespace PPTX ...@@ -601,16 +601,16 @@ namespace PPTX
if (nPosOld == nPosition) if (nPosOld == nPosition)
{ {
// // нету ни одной настройки
break; break;
} }
CString strName = strParams.Mid(nPosOld, nPosition - nPosOld); CString strName = strParams.Mid(nPosOld, nPosition - nPosOld);
// ':' // убираем ':'
++nPosition; ++nPosition;
++pDataMem; ++pDataMem;
// // пропускаем пробелы настройки
while ((nPosition < nCount) && (TCHAR(' ') == *pDataMem)) while ((nPosition < nCount) && (TCHAR(' ') == *pDataMem))
{ {
++nPosition; ++nPosition;
...@@ -619,7 +619,7 @@ namespace PPTX ...@@ -619,7 +619,7 @@ namespace PPTX
nPosOld = nPosition; nPosOld = nPosition;
// // пропускаем пробелы настройки
while ((nPosition < nCount) && (TCHAR(';') != *pDataMem) && (TCHAR('}') != *pDataMem)) while ((nPosition < nCount) && (TCHAR(';') != *pDataMem) && (TCHAR('}') != *pDataMem))
{ {
++nPosition; ++nPosition;
...@@ -631,7 +631,7 @@ namespace PPTX ...@@ -631,7 +631,7 @@ namespace PPTX
if (pData[nPosOld] == WCHAR('.')) if (pData[nPosOld] == WCHAR('.'))
strValue = (_T("0") + strValue); strValue = (_T("0") + strValue);
// [], insert, ( ) //добавляем через [], а не insert, потому что ключи могут дублироваться(а в предыдущей реализации использовалось последнее значение)
m_mapSettings[strName] = strValue; m_mapSettings[strName] = strValue;
} }
} }
...@@ -828,7 +828,7 @@ HRESULT CDrawingConverter::SetMainDocument(BinDocxRW::CDocxSerializer* pDocument ...@@ -828,7 +828,7 @@ HRESULT CDrawingConverter::SetMainDocument(BinDocxRW::CDocxSerializer* pDocument
} }
HRESULT CDrawingConverter::SetRelsPath(const CString& bsRelsPath) HRESULT CDrawingConverter::SetRelsPath(const CString& bsRelsPath)
{ {
// - - ?? // чтобы не переоткрывать рельсы - посмотрим - может у нас уже есть такой??
m_strCurrentRelsPath = bsRelsPath; m_strCurrentRelsPath = bsRelsPath;
return SetCurrentRelsPath(); return SetCurrentRelsPath();
} }
...@@ -1457,7 +1457,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo ...@@ -1457,7 +1457,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo
} }
} }
// bounds // теперь определяем bounds
int _x = INT_MAX; int _x = INT_MAX;
int _y = INT_MAX; int _y = INT_MAX;
int _r = INT_MIN; int _r = INT_MIN;
...@@ -1507,7 +1507,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo ...@@ -1507,7 +1507,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo
pPPTShape = new CPPTShape(); pPPTShape = new CPPTShape();
pPPTShape->SetShapeType((PPTShapes::ShapeType)1); pPPTShape->SetShapeType((PPTShapes::ShapeType)1);
// // иначе сохранится рект
pPPTShape->m_eType = PPTShapes::sptCustom; pPPTShape->m_eType = PPTShapes::sptCustom;
pPPTShape->LoadPathList(strPath); pPPTShape->LoadPathList(strPath);
...@@ -1554,7 +1554,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo ...@@ -1554,7 +1554,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo
{ {
pPPTShape = new CPPTShape(); pPPTShape = new CPPTShape();
pPPTShape->SetShapeType((PPTShapes::ShapeType)1); pPPTShape->SetShapeType((PPTShapes::ShapeType)1);
// // иначе сохранится рект
pPPTShape->m_eType = PPTShapes::sptCustom; pPPTShape->m_eType = PPTShapes::sptCustom;
} }
} }
...@@ -2250,7 +2250,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo ...@@ -2250,7 +2250,7 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo
} }
else else
{ {
//oProps.X , pMainProps //oProps.X выставлять не надо, они учтены в pMainProps
pShape->spPr.xfrm = new PPTX::Logic::Xfrm(); pShape->spPr.xfrm = new PPTX::Logic::Xfrm();
pShape->spPr.xfrm->offX = 0; pShape->spPr.xfrm->offX = 0;
pShape->spPr.xfrm->offY = 0; pShape->spPr.xfrm->offY = 0;
...@@ -3889,6 +3889,16 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const CString& ...@@ -3889,6 +3889,16 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const CString&
bOle = true; bOle = true;
} }
} }
else if (oElem.is<PPTX::Logic::Pic>())
{
PPTX::Logic::Pic& oPic = oElem.as<PPTX::Logic::Pic>();
if(oPic.spPr.Fill.Fill.is<PPTX::Logic::BlipFill>())
{
PPTX::Logic::BlipFill& oBlipFill = oPic.spPr.Fill.Fill.as<PPTX::Logic::BlipFill>();
if(oBlipFill.blip.IsInit() && oBlipFill.blip->oleInfo.IsInit())
bOle = true;
}
}
m_pReader->m_lDocumentType = XMLWRITER_DOC_TYPE_PPTX; m_pReader->m_lDocumentType = XMLWRITER_DOC_TYPE_PPTX;
...@@ -3912,6 +3922,10 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const CString& ...@@ -3912,6 +3922,10 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const CString&
{ {
ConvertShapeVML(oElem, bsMainProps, oXmlWriter); ConvertShapeVML(oElem, bsMainProps, oXmlWriter);
} }
else
{
ConvertPicVML(oElem, bsMainProps, oXmlWriter);
}
} }
else else
{ {
...@@ -3992,7 +4006,7 @@ HRESULT CDrawingConverter::SaveObjectEx(LONG lStart, LONG lLength, const CString ...@@ -3992,7 +4006,7 @@ HRESULT CDrawingConverter::SaveObjectEx(LONG lStart, LONG lLength, const CString
if (XMLWRITER_DOC_TYPE_DOCX == lDocType) if (XMLWRITER_DOC_TYPE_DOCX == lDocType)
{ {
m_pImageManager->m_bIsWord = true; m_pImageManager->m_bIsWord = true;
// inline/anchor + word2007 format // нужно писать всякие inline/anchor + word2007 format
return SaveObject(lStart, lLength, bsMainProps, bsXml); return SaveObject(lStart, lLength, bsMainProps, bsXml);
} }
...@@ -4043,6 +4057,18 @@ HRESULT CDrawingConverter::SaveObjectEx(LONG lStart, LONG lLength, const CString ...@@ -4043,6 +4057,18 @@ HRESULT CDrawingConverter::SaveObjectEx(LONG lStart, LONG lLength, const CString
return S_OK; return S_OK;
} }
void CDrawingConverter::ConvertPicVML(PPTX::Logic::SpTreeElem& oElem, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
{
if (bsMainProps)
{
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
}
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Pic& oPic = oElem.as<PPTX::Logic::Pic>();
oPic.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
}
void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter) void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
{ {
if (bsMainProps) if (bsMainProps)
...@@ -4050,7 +4076,7 @@ void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const CS ...@@ -4050,7 +4076,7 @@ void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const CS
ConvertMainPropsToVML(bsMainProps, oWriter, oElem); ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
} }
oWriter.m_bIsTop = true; // oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>(); PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap); oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
} }
...@@ -4059,11 +4085,11 @@ void CDrawingConverter::ConvertGroupVML(PPTX::Logic::SpTreeElem& oElem, const CS ...@@ -4059,11 +4085,11 @@ void CDrawingConverter::ConvertGroupVML(PPTX::Logic::SpTreeElem& oElem, const CS
{ {
if (bsMainProps) if (bsMainProps)
{ {
// TODO: oXmlWriter'e // TODO: здесь нужно заполнить поля в oXmlWriter'e
ConvertMainPropsToVML(bsMainProps, oWriter, oElem); ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
} }
oWriter.m_bIsTop = true; // ( ) oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе (вместе с остальными параметрами)
PPTX::Logic::SpTree& oGroup = oElem.as<PPTX::Logic::SpTree>(); PPTX::Logic::SpTree& oGroup = oElem.as<PPTX::Logic::SpTree>();
oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap); oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
} }
...@@ -4610,9 +4636,9 @@ HRESULT CDrawingConverter::SetDstContentRels() ...@@ -4610,9 +4636,9 @@ HRESULT CDrawingConverter::SetDstContentRels()
{ {
++m_pReader->m_nCurrentRelsStack; ++m_pReader->m_nCurrentRelsStack;
// m_pRels word. //чистить текущий m_pRels хорошо при последовательной записи автофигур в word.
// , m_pReader. //плохо в случае записи перезентаций, с момента перехода на единственный обьект m_pReader.
//: Rels, chart, SetDstContentRels Rels //пример: презетации записали несколько Rels, записываем chart, вызывается SetDstContentRels и трутся Rels презентаций
//if (0 == m_pReader->m_nCurrentRelsStack) //if (0 == m_pReader->m_nCurrentRelsStack)
//{ //{
// m_pReader->m_pRels->Clear(); // m_pReader->m_pRels->Clear();
......
...@@ -233,6 +233,7 @@ namespace NSBinPptxRW ...@@ -233,6 +233,7 @@ namespace NSBinPptxRW
CString GetDrawingMainProps(XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps); CString GetDrawingMainProps(XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps);
void ConvertMainPropsToVML(const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter, PPTX::Logic::SpTreeElem& oElem); void ConvertMainPropsToVML(const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter, PPTX::Logic::SpTreeElem& oElem);
void ConvertPicVML(PPTX::Logic::SpTreeElem& oElem, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void ConvertShapeVML(PPTX::Logic::SpTreeElem& oShape, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter); void ConvertShapeVML(PPTX::Logic::SpTreeElem& oShape, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void ConvertGroupVML(PPTX::Logic::SpTreeElem& oGroup, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter); void ConvertGroupVML(PPTX::Logic::SpTreeElem& oGroup, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter);
......
...@@ -120,6 +120,66 @@ namespace PPTX ...@@ -120,6 +120,66 @@ namespace PPTX
public: public:
virtual CString GetFullPicName(FileContainer* pRels = NULL)const; virtual CString GetFullPicName(FileContainer* pRels = NULL)const;
virtual CString GetFullOleName(const PPTX::RId& pRId, FileContainer* pRels = NULL)const; virtual CString GetFullOleName(const PPTX::RId& pRId, FileContainer* pRels = NULL)const;
void writeOleStart(NSBinPptxRW::CXmlWriter *pWriter, NSShapeImageGen::COleInfo& oOleInfo, bool& bOle, CString& sOleProgID, CString& sOleNodeName)
{
if(oleInfo.IsInit())
oOleInfo = oleInfo.get();
if(!oOleInfo.m_sRid.IsEmpty() && !oOleInfo.m_sOleProperty.IsEmpty())
{
std::vector<CString> aOleProp;
int nTokenPos = 0;
CString strToken = oOleInfo.m_sOleProperty.Tokenize(_T("|"), nTokenPos);
while (!strToken.IsEmpty())
{
aOleProp.push_back(strToken);
strToken = oOleInfo.m_sOleProperty.Tokenize(_T("|"), nTokenPos);
}
if(3 == aOleProp.size())
{
bOle = true;
CString dxaOrig = aOleProp[0];
CString dyaOrig = aOleProp[1];
sOleProgID = aOleProp[2];
if(_T("0") != dxaOrig && _T("0") != dyaOrig)
{
sOleNodeName = _T("w:object");
pWriter->StartNode(sOleNodeName);
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("w:dxaOrig"), dxaOrig);
pWriter->WriteAttribute(_T("w:dyaOrig"), dyaOrig);
pWriter->EndAttributes();
}
else
{
sOleNodeName = _T("w:pict");
pWriter->StartNode(sOleNodeName);
pWriter->StartAttributes();
pWriter->EndAttributes();
}
}
}
}
void writeOleEnd(NSBinPptxRW::CXmlWriter *pWriter, const NSShapeImageGen::COleInfo& oOleInfo, const CString& strId, const CString& sOleProgID, const CString& sOleNodeName)
{
if(!sOleProgID.IsEmpty())
{
pWriter->StartNode(_T("o:OLEObject"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("Type"), CString(_T("Embed")));
pWriter->WriteAttribute(_T("ProgID"), sOleProgID);
pWriter->WriteAttribute(_T("ShapeID"), strId);
pWriter->WriteAttribute(_T("DrawAspect"), CString(_T("Content")));
CString sObjectID;
sObjectID.Format(_T("_%010d"), pWriter->m_lObjectIdOle++);
pWriter->WriteAttribute(_T("ObjectID"), sObjectID);
pWriter->WriteAttribute(_T("r:id"), oOleInfo.m_sRid);
pWriter->EndAttributes();
pWriter->EndNode(_T("o:OLEObject"));
pWriter->EndNode(sOleNodeName);
}
}
public: public:
std::vector<UniEffect> Effects; std::vector<UniEffect> Effects;
......
...@@ -287,6 +287,20 @@ namespace PPTX ...@@ -287,6 +287,20 @@ namespace PPTX
smart_ptr<PPTX::Theme> oTheme = _oTheme.smart_dynamic_cast<PPTX::Theme>(); smart_ptr<PPTX::Theme> oTheme = _oTheme.smart_dynamic_cast<PPTX::Theme>();
smart_ptr<PPTX::Logic::ClrMap> oClrMap = oTheme.smart_dynamic_cast<PPTX::Logic::ClrMap>(); smart_ptr<PPTX::Logic::ClrMap> oClrMap = oTheme.smart_dynamic_cast<PPTX::Logic::ClrMap>();
NSShapeImageGen::COleInfo oOleInfo;
bool bOle = false;
CString sOleProgID;
CString sOleNodeName;
Blip* pBlip = NULL;
if(this->spPr.Fill.Fill.is<PPTX::Logic::BlipFill>())
{
PPTX::Logic::BlipFill& oBlipFill = this->spPr.Fill.Fill.as<PPTX::Logic::BlipFill>();
if(oBlipFill.blip.IsInit())
pBlip = oBlipFill.blip.GetPointer();
}
if(NULL != pBlip)
pBlip->writeOleStart(pWriter, oOleInfo, bOle, sOleProgID, sOleNodeName);
int dL = 0; int dL = 0;
int dT = 0; int dT = 0;
int dW = 0; int dW = 0;
...@@ -298,24 +312,28 @@ namespace PPTX ...@@ -298,24 +312,28 @@ namespace PPTX
strSpid.Format(_T("_x%04d_s%04d"), 0xFFFF & (pWriter->m_lObjectIdVML >> 16), 0xFFFF & pWriter->m_lObjectIdVML); strSpid.Format(_T("_x%04d_s%04d"), 0xFFFF & (pWriter->m_lObjectIdVML >> 16), 0xFFFF & pWriter->m_lObjectIdVML);
pWriter->m_lObjectIdVML++; pWriter->m_lObjectIdVML++;
if (spPr.xfrm.is_init()) NSBinPptxRW::CXmlWriter oStylesWriter;
if(_T("") == pWriter->m_strStyleMain)
{ {
if (spPr.xfrm->offX.is_init()) if (spPr.xfrm.is_init())
dL = (*spPr.xfrm->offX); {
if (spPr.xfrm->offY.is_init()) if (spPr.xfrm->offX.is_init())
dT = (*spPr.xfrm->offY); dL = (*spPr.xfrm->offX);
if (spPr.xfrm->extX.is_init()) if (spPr.xfrm->offY.is_init())
dW = (*spPr.xfrm->extX); dT = (*spPr.xfrm->offY);
if (spPr.xfrm->extY.is_init()) if (spPr.xfrm->extX.is_init())
dH = (*spPr.xfrm->extY); dW = (*spPr.xfrm->extX);
} if (spPr.xfrm->extY.is_init())
dH = (*spPr.xfrm->extY);
}
NSBinPptxRW::CXmlWriter oStylesWriter; oStylesWriter.WriteAttributeCSS(_T("position"), _T("absolute"));
oStylesWriter.WriteAttributeCSS(_T("position"), _T("absolute")); oStylesWriter.WriteAttributeCSS_int(_T("left"), dL);
oStylesWriter.WriteAttributeCSS_int(_T("left"), dL); oStylesWriter.WriteAttributeCSS_int(_T("top"), dT);
oStylesWriter.WriteAttributeCSS_int(_T("top"), dT); oStylesWriter.WriteAttributeCSS_int(_T("width"), dW);
oStylesWriter.WriteAttributeCSS_int(_T("width"), dW); oStylesWriter.WriteAttributeCSS_int(_T("height"), dH);
oStylesWriter.WriteAttributeCSS_int(_T("height"), dH); }
if (spPr.xfrm.is_init()) if (spPr.xfrm.is_init())
{ {
...@@ -363,9 +381,20 @@ namespace PPTX ...@@ -363,9 +381,20 @@ namespace PPTX
pWriter->WriteAttribute(_T("o:spid"), strSpid); pWriter->WriteAttribute(_T("o:spid"), strSpid);
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("style"), oStylesWriter.GetXmlString()); if (oStylesWriter.GetSize() == 0)
pWriter->WriteAttribute(_T("coordsize"), (CString)_T("100000,100000")); {
pWriter->WriteAttribute(_T("path"), strPath); pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain);
}
else
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
}
if(!bOle)
{
pWriter->WriteAttribute(_T("coordsize"), (CString)_T("100000,100000"));
pWriter->WriteAttribute(_T("path"), strPath);
}
if (pWriter->m_strAttributesMain) if (pWriter->m_strAttributesMain)
{ {
...@@ -415,7 +444,15 @@ namespace PPTX ...@@ -415,7 +444,15 @@ namespace PPTX
pWriter->WriteAttribute(_T("id"), strId); pWriter->WriteAttribute(_T("id"), strId);
pWriter->WriteAttribute(_T("o:spid"), strSpid); pWriter->WriteAttribute(_T("o:spid"), strSpid);
pWriter->WriteAttribute(_T("style"), oStylesWriter.GetXmlString()); if (oStylesWriter.GetSize() == 0)
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain);
}
else
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
}
pWriter->EndAttributes(); pWriter->EndAttributes();
if (blipFill.blip.is_init() && blipFill.blip->embed.is_init()) if (blipFill.blip.is_init() && blipFill.blip->embed.is_init())
...@@ -430,6 +467,10 @@ namespace PPTX ...@@ -430,6 +467,10 @@ namespace PPTX
pWriter->EndNode(_T("v:rect")); pWriter->EndNode(_T("v:rect"));
} }
pWriter->m_strStyleMain = _T("");
if(NULL != pBlip)
pBlip->writeOleEnd(pWriter, oOleInfo, strId, sOleProgID, sOleNodeName);
} }
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX
\ No newline at end of file
...@@ -378,46 +378,15 @@ namespace PPTX ...@@ -378,46 +378,15 @@ namespace PPTX
bool bOle = false; bool bOle = false;
CString sOleProgID; CString sOleProgID;
CString sOleNodeName; CString sOleNodeName;
Blip* pBlip = NULL;
if(this->spPr.Fill.Fill.is<PPTX::Logic::BlipFill>()) if(this->spPr.Fill.Fill.is<PPTX::Logic::BlipFill>())
{ {
PPTX::Logic::BlipFill& oBlipFill = this->spPr.Fill.Fill.as<PPTX::Logic::BlipFill>(); PPTX::Logic::BlipFill& oBlipFill = this->spPr.Fill.Fill.as<PPTX::Logic::BlipFill>();
if(oBlipFill.blip.IsInit() && oBlipFill.blip->oleInfo.IsInit()) if(oBlipFill.blip.IsInit())
oOleInfo = oBlipFill.blip->oleInfo.get(); pBlip = oBlipFill.blip.GetPointer();
}
if(!oOleInfo.m_sRid.IsEmpty() && !oOleInfo.m_sOleProperty.IsEmpty())
{
std::vector<CString> aOleProp;
int nTokenPos = 0;
CString strToken = oOleInfo.m_sOleProperty.Tokenize(_T("|"), nTokenPos);
while (!strToken.IsEmpty())
{
aOleProp.push_back(strToken);
strToken = oOleInfo.m_sOleProperty.Tokenize(_T("|"), nTokenPos);
}
if(3 == aOleProp.size())
{
bOle = true;
CString dxaOrig = aOleProp[0];
CString dyaOrig = aOleProp[1];
sOleProgID = aOleProp[2];
if(_T("0") != dxaOrig && _T("0") != dyaOrig)
{
sOleNodeName = _T("w:object");
pWriter->StartNode(sOleNodeName);
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("w:dxaOrig"), dxaOrig);
pWriter->WriteAttribute(_T("w:dyaOrig"), dyaOrig);
pWriter->EndAttributes();
}
else
{
sOleNodeName = _T("w:pict");
pWriter->StartNode(sOleNodeName);
pWriter->StartAttributes();
pWriter->EndAttributes();
}
}
} }
if(NULL != pBlip)
pBlip->writeOleStart(pWriter, oOleInfo, bOle, sOleProgID, sOleNodeName);
#ifdef AVS_USE_CONVERT_PPTX_TOCUSTOM_VML #ifdef AVS_USE_CONVERT_PPTX_TOCUSTOM_VML
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH); spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH);
...@@ -664,23 +633,10 @@ namespace PPTX ...@@ -664,23 +633,10 @@ namespace PPTX
pWriter->EndNode(_T("v:shape")); pWriter->EndNode(_T("v:shape"));
} }
if(!sOleProgID.IsEmpty())
{
pWriter->StartNode(_T("o:OLEObject"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("Type"), CString(_T("Embed")));
pWriter->WriteAttribute(_T("ProgID"), sOleProgID);
pWriter->WriteAttribute(_T("ShapeID"), strId);
pWriter->WriteAttribute(_T("DrawAspect"), CString(_T("Content")));
CString sObjectID;
sObjectID.Format(_T("_%010d"), pWriter->m_lObjectIdOle++);
pWriter->WriteAttribute(_T("ObjectID"), sObjectID);
pWriter->WriteAttribute(_T("r:id"), oOleInfo.m_sRid);
pWriter->EndAttributes();
pWriter->EndNode(_T("o:OLEObject"));
pWriter->EndNode(sOleNodeName); if(NULL != pBlip)
} pBlip->writeOleEnd(pWriter, oOleInfo, strId, sOleProgID, sOleNodeName);
} }
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX
\ No newline at end of file
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