Commit f42cb458 authored by ElenaSubbotina's avatar ElenaSubbotina

fix users files

XlsFormat olap hierarchy
...
parent 52777e36
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib") #pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif #endif
#pragma comment(lib, "Rpcrt4.lib")
HRESULT convert_single(std::wstring sSrcDoc) HRESULT convert_single(std::wstring sSrcDoc)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
......
...@@ -144,9 +144,13 @@ namespace MathEquation ...@@ -144,9 +144,13 @@ namespace MathEquation
void AddAccent (MEMBELTYPE eType) void AddAccent (MEMBELTYPE eType)
{ {
LONG lPos = GetSize() - 1; LONG lPos = GetSize() - 1;
if (lPos < 0) return;
EquationRun oRun; EquationRun oRun;
oRun = arrRun[lPos]; oRun = arrRun[lPos];
RemoveElem(lPos); RemoveElem(lPos);
oRun.bAccent = true; oRun.bAccent = true;
oRun.eType = eType; oRun.eType = eType;
Add(oRun); Add(oRun);
...@@ -1675,7 +1679,7 @@ namespace MathEquation ...@@ -1675,7 +1679,7 @@ namespace MathEquation
void WriteEndNode(BinaryEquationWriter* pWriter) void WriteEndNode(BinaryEquationWriter* pWriter)
{ {
int nCurPos; int nCurPos = -1;
if (!m_aBaseStack.empty()) if (!m_aBaseStack.empty())
{ {
nCurPos = m_aBaseStack.top(); nCurPos = m_aBaseStack.top();
...@@ -1687,14 +1691,20 @@ namespace MathEquation ...@@ -1687,14 +1691,20 @@ namespace MathEquation
} }
if (bPile && bEqArrayStart) if (bPile && bEqArrayStart)
{
pWriter->WriteItemEnd(nCurPos); pWriter->WriteItemEnd(nCurPos);
}
else if (!bPile && !bEqArrayStart) else if (!bPile && !bEqArrayStart)
{
pWriter->WriteItemEnd(nCurPos); pWriter->WriteItemEnd(nCurPos);
}
else if (!bPile && bEqArrayStart) else if (!bPile && bEqArrayStart)
{ {
pWriter->m_aRowsCounter.push(nRows); pWriter->m_aRowsCounter.push(nRows);
bEqArrayStart = false; bEqArrayStart = false;
pWriter->WriteItemEnd(nCurPos);//eqArr
if (nCurPos > 0)
pWriter->WriteItemEnd(nCurPos);//eqArr
if (!m_aBaseStack.empty()) if (!m_aBaseStack.empty())
{ {
......
...@@ -794,7 +794,7 @@ void NSPresentationEditor::CPPTXWriter::WriteBackground(CStringWriter& oWriter, ...@@ -794,7 +794,7 @@ void NSPresentationEditor::CPPTXWriter::WriteBackground(CStringWriter& oWriter,
oWriter.WriteString(std::wstring(L"</p:bgPr></p:bg>")); oWriter.WriteString(std::wstring(L"</p:bgPr></p:bg>"));
} }
void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout) void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, CElementPtr pElement, CLayout* pLayout)
{ {
if (!pElement) return; if (!pElement) return;
...@@ -817,7 +817,7 @@ void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRe ...@@ -817,7 +817,7 @@ void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRe
if ((pElement->m_lPlaceholderType == pLayout->m_arElements[nIndex]->m_lPlaceholderType) && if ((pElement->m_lPlaceholderType == pLayout->m_arElements[nIndex]->m_lPlaceholderType) &&
(pElement->m_lPlaceholderID == pLayout->m_arElements[nIndex]->m_lPlaceholderID)) (pElement->m_lPlaceholderID == pLayout->m_arElements[nIndex]->m_lPlaceholderID))
{ {
IElement* pElLayout = pLayout->m_arElements[nIndex]; CElementPtr pElLayout = pLayout->m_arElements[nIndex];
bool bIsEqualTransform = ((pElement->m_dRotate == pElLayout->m_dRotate) bool bIsEqualTransform = ((pElement->m_dRotate == pElLayout->m_dRotate)
&& (pElement->m_bFlipH == pElLayout->m_bFlipH) && (pElement->m_bFlipV == pElLayout->m_bFlipV)); && (pElement->m_bFlipH == pElLayout->m_bFlipH) && (pElement->m_bFlipV == pElLayout->m_bFlipV));
......
...@@ -82,7 +82,7 @@ namespace NSPresentationEditor ...@@ -82,7 +82,7 @@ namespace NSPresentationEditor
void WriteTransition (CStringWriter& oWriter, CTransition& transition); void WriteTransition (CStringWriter& oWriter, CTransition& transition);
void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector<CColor> & colors, bool extra = false); void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector<CColor> & colors, bool extra = false);
void WriteBackground (CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground); void WriteBackground (CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground);
void WriteElement (CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout = NULL); void WriteElement (CStringWriter& oWriter, CRelsGenerator& oRels, CElementPtr pElement, CLayout* pLayout = NULL);
}; };
......
...@@ -293,10 +293,10 @@ NSPresentationEditor::CShapeWriter::CShapeWriter() ...@@ -293,10 +293,10 @@ NSPresentationEditor::CShapeWriter::CShapeWriter()
m_pImageElement = NULL; m_pImageElement = NULL;
m_pShapeElement = NULL; m_pShapeElement = NULL;
} }
bool NSPresentationEditor::CShapeWriter::SetElement(IElement* pElem) bool NSPresentationEditor::CShapeWriter::SetElement(CElementPtr pElem)
{ {
m_pShapeElement = dynamic_cast<CShapeElement*>(pElem); m_pShapeElement = dynamic_cast<CShapeElement*>(pElem.get());
m_pImageElement = dynamic_cast<CImageElement*>(pElem); m_pImageElement = dynamic_cast<CImageElement*>(pElem.get());
m_pSimpleGraphicsConverter->PathCommandEnd(); m_pSimpleGraphicsConverter->PathCommandEnd();
...@@ -309,7 +309,7 @@ bool NSPresentationEditor::CShapeWriter::SetElement(IElement* pElem) ...@@ -309,7 +309,7 @@ bool NSPresentationEditor::CShapeWriter::SetElement(IElement* pElem)
if (m_pShapeElement) if (m_pShapeElement)
{ {
m_pShapeElement->m_oShape.GetTextRect(m_oTextRect); m_pShapeElement->m_pShape->GetTextRect(m_oTextRect);
} }
m_oWriter.ClearNoAttack(); m_oWriter.ClearNoAttack();
...@@ -809,7 +809,7 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo() ...@@ -809,7 +809,7 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo()
} }
void NSPresentationEditor::CShapeWriter::WriteTextInfo() void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{ {
size_t nCount = m_pShapeElement->m_oShape.m_oText.m_arParagraphs.size(); size_t nCount = m_pShapeElement->m_pShape->m_oText.m_arParagraphs.size();
m_oWriter.WriteString(std::wstring(L"<p:txBody>")); m_oWriter.WriteString(std::wstring(L"<p:txBody>"));
...@@ -826,21 +826,21 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo() ...@@ -826,21 +826,21 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
// m_oWriter.WriteString(std::wstring(L" lIns=\"0\" tIns=\"0\" rIns=\"0\" bIns=\"0\"")); // m_oWriter.WriteString(std::wstring(L" lIns=\"0\" tIns=\"0\" rIns=\"0\" bIns=\"0\""));
if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 0 ) if (m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_nTextAlignVertical == 0 )
m_oWriter.WriteString(L" anchor=\"t\""); m_oWriter.WriteString(L" anchor=\"t\"");
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 2 ) else if (m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_nTextAlignVertical == 2 )
m_oWriter.WriteString(L" anchor=\"b\""); m_oWriter.WriteString(L" anchor=\"b\"");
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 1 ) else if (m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_nTextAlignVertical == 1 )
{ {
m_oWriter.WriteString(L" anchor=\"ctr\""); m_oWriter.WriteString(L" anchor=\"ctr\"");
m_oWriter.WriteString(L" anchorCtr=\"0\""); m_oWriter.WriteString(L" anchorCtr=\"0\"");
} }
if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate > 0) if (m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_dTextRotate > 0)
{ {
std::wstring strProp = std::to_wstring((int)(m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate * 60000)); std::wstring strProp = std::to_wstring((int)(m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_dTextRotate * 60000));
m_oWriter.WriteString(L" rot=\"" + strProp + L"\""); m_oWriter.WriteString(L" rot=\"" + strProp + L"\"");
} }
if (m_pShapeElement->m_oShape.m_oText.m_bVertical) if (m_pShapeElement->m_pShape->m_oText.m_bVertical)
{ {
m_oWriter.WriteString(L" vert=\"eaVert\""); m_oWriter.WriteString(L" vert=\"eaVert\"");
} }
...@@ -853,7 +853,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo() ...@@ -853,7 +853,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstTxWarp + _T("\">")); m_oWriter.WriteString(std::wstring(L" prst=\"") + prstTxWarp + _T("\">"));
m_oWriter.WriteString(std::wstring(L"<a:avLst>"));//модификаторы m_oWriter.WriteString(std::wstring(L"<a:avLst>"));//модификаторы
CPPTShape *pPPTShape = dynamic_cast<CPPTShape *>(m_pShapeElement->m_oShape.getBaseShape()); CPPTShape *pPPTShape = dynamic_cast<CPPTShape *>(m_pShapeElement->m_pShape->getBaseShape().get());
std::wstring strVal; std::wstring strVal;
for (int i = 0 ; (pPPTShape) && (i < pPPTShape->m_arAdjustments.size()); i++) for (int i = 0 ; (pPPTShape) && (i < pPPTShape->m_arAdjustments.size()); i++)
...@@ -875,7 +875,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo() ...@@ -875,7 +875,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(L"</a:avLst>"); m_oWriter.WriteString(L"</a:avLst>");
m_oWriter.WriteString(L"</a:prstTxWarp>"); m_oWriter.WriteString(L"</a:prstTxWarp>");
} }
if (m_pShapeElement->m_oShape.m_oText.m_bAutoFit) if (m_pShapeElement->m_pShape->m_oText.m_bAutoFit)
{ {
m_oWriter.WriteString(L"<a:spAutoFit/>"); m_oWriter.WriteString(L"<a:spAutoFit/>");
} }
...@@ -890,14 +890,14 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo() ...@@ -890,14 +890,14 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
if (!m_bWordArt) if (!m_bWordArt)
{ {
CStylesWriter::ConvertStyles(m_pShapeElement->m_oShape.m_oText.m_oStyles, m_oMetricInfo, m_oWriter); CStylesWriter::ConvertStyles(m_pShapeElement->m_pShape->m_oText.m_oStyles, m_oMetricInfo, m_oWriter);
} }
m_oWriter.WriteString(std::wstring(L"</a:lstStyle>")); m_oWriter.WriteString(std::wstring(L"</a:lstStyle>"));
for (size_t nIndexPar = 0; nIndexPar < nCount; ++nIndexPar) for (size_t nIndexPar = 0; nIndexPar < nCount; ++nIndexPar)
{ {
NSPresentationEditor::CParagraph* pParagraph = &m_pShapeElement->m_oShape.m_oText.m_arParagraphs[nIndexPar]; NSPresentationEditor::CParagraph* pParagraph = &m_pShapeElement->m_pShape->m_oText.m_arParagraphs[nIndexPar];
//if (m_bWordArt && nIndexPar == nCount-1) //if (m_bWordArt && nIndexPar == nCount-1)
//{ //{
...@@ -1308,11 +1308,11 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShape() ...@@ -1308,11 +1308,11 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShape()
m_oWriter.WriteString(std::wstring(L"</a:xfrm>")); m_oWriter.WriteString(std::wstring(L"</a:xfrm>"));
} }
CBaseShape *shape = m_pShapeElement->m_oShape.getBaseShape(); CBaseShapePtr & shape = m_pShapeElement->m_pShape->getBaseShape();
if (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Graphic || shape->m_bCustomShape) if (m_pShapeElement->m_pShape->m_lDrawType & c_ShapeDrawType_Graphic || shape->m_bCustomShape)
{ {
m_pShapeElement->m_oShape.ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0); m_pShapeElement->m_pShape->ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0);
} }
if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty() && !shape->m_bCustomShape) if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty() && !shape->m_bCustomShape)
......
...@@ -170,7 +170,7 @@ namespace NSPresentationEditor ...@@ -170,7 +170,7 @@ namespace NSPresentationEditor
m_lNextShapeID = 1000; m_lNextShapeID = 1000;
} }
bool SetElement(IElement* pElem); bool SetElement(CElementPtr pElem);
//-------------------------------------------------------------------- //--------------------------------------------------------------------
std::wstring ConvertShape (); std::wstring ConvertShape ();
std::wstring ConvertImage (); std::wstring ConvertImage ();
......
...@@ -93,7 +93,8 @@ public: ...@@ -93,7 +93,8 @@ public:
bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream); bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream);
offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit; m_bMacros = pInfo->m_bMacros;
offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit;
m_oCurrentUser.m_bIsEncrypt = pInfo->m_bEncrypt; m_oCurrentUser.m_bIsEncrypt = pInfo->m_bEncrypt;
if (bResult == false) if (bResult == false)
......
...@@ -310,15 +310,15 @@ public: ...@@ -310,15 +310,15 @@ public:
return _T("blank"); return _T("blank");
} }
void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement); void AddAnimation (DWORD dwSlideID, double Width, double Height, CElementPtr pElement);
void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath); void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath);
int AddNewLayout(NSPresentationEditor::CTheme* pTheme, CRecordSlide* pRecordSlide, bool addShapes, bool bMasterObjects); int AddNewLayout(NSPresentationEditor::CTheme* pTheme, CRecordSlide* pRecordSlide, bool addShapes, bool bMasterObjects);
IElement* AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset = -1); CElementPtr AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset = -1);
IElement* AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset = -1); CElementPtr AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset = -1);
IElement* AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, CTheme* pTheme, bool idx_only = false); CElementPtr AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, CTheme* pTheme, bool idx_only = false);
IElement* AddLayoutSlidePlaceholder (CSlide *pSlide, int placeholderType, CLayout *pLayout, bool idx_only = false); CElementPtr AddLayoutSlidePlaceholder (CSlide *pSlide, int placeholderType, CLayout *pLayout, bool idx_only = false);
}; };
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <tchar.h> #include <tchar.h>
#pragma comment(lib, "Rpcrt4.lib")
#if defined(_WIN64) #if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib") #pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32) #elif defined (_WIN32)
...@@ -46,6 +48,10 @@ ...@@ -46,6 +48,10 @@
int _tmain(int argc, _TCHAR* argv[]) int _tmain(int argc, _TCHAR* argv[])
{ {
//#ifdef _DEBUG
// _CrtDumpMemoryLeaks();
//#endif
if (argc < 2) return 1; if (argc < 2) return 1;
std::wstring sSrcPpt = argv[1]; std::wstring sSrcPpt = argv[1];
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include" AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS" PreprocessorDefinitions="_DEBUG;_CONSOLE;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
......
...@@ -982,12 +982,12 @@ HRESULT CDrawingConverter::AddShapeType(const std::wstring& bsXml) ...@@ -982,12 +982,12 @@ HRESULT CDrawingConverter::AddShapeType(const std::wstring& bsXml)
std::wstring strId = oNodeST.GetAttribute(L"id"); std::wstring strId = oNodeST.GetAttribute(L"id");
pShape->LoadFromXMLShapeType(oNodeST); pShape->LoadFromXMLShapeType(oNodeST);
CShape* pS = new CShape(NSBaseShape::unknown, 0); CShapePtr pS = CShapePtr(new CShape(NSBaseShape::unknown, 0));
pS->setBaseShape(pShape); pS->setBaseShape(CBaseShapePtr(pShape));
LoadCoordSize(oNodeST, pS); LoadCoordSize(oNodeST, pS);
m_mapShapeTypes.insert(std::pair<std::wstring, CShape*>(strId, pS)); m_mapShapeTypes.insert(std::pair<std::wstring, CShapePtr>(strId, pS));
} }
return S_OK; return S_OK;
...@@ -1845,12 +1845,16 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C ...@@ -1845,12 +1845,16 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
{ {
strType = strType.substr(1); strType = strType.substr(1);
std::map<std::wstring, CShape*>::iterator pPair = m_mapShapeTypes.find(strType); std::map<std::wstring, CShapePtr>::iterator pPair = m_mapShapeTypes.find(strType);
if (m_mapShapeTypes.end() != pPair) if (m_mapShapeTypes.end() != pPair)
{ {
CBaseShapePtr & base_shape_type = pPair->second->getBaseShape();
CPPTShape* ppt_shape_type = dynamic_cast<CPPTShape*>(base_shape_type.get());
pPPTShape = new CPPTShape(); pPPTShape = new CPPTShape();
pPair->second->getBaseShape()->SetToDublicate(pPPTShape); base_shape_type->SetToDublicate(pPPTShape);
pPPTShape->m_eType = ((CPPTShape*)(pPair->second->getBaseShape()))->m_eType;
pPPTShape->m_eType = ppt_shape_type->m_eType;
} }
} }
...@@ -1880,28 +1884,28 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C ...@@ -1880,28 +1884,28 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
pPPTShape->m_eType = PPTShapes::sptCustom; pPPTShape->m_eType = PPTShapes::sptCustom;
} }
} }
oShapeElem.m_oShape.setBaseShape(pPPTShape); oShapeElem.m_pShape->setBaseShape(CBaseShapePtr(pPPTShape));
if (bIsNeedCoordSizes) if (bIsNeedCoordSizes)
{ {
LoadCoordPos(oNodeShape, &oShapeElem.m_oShape); //for path calculate LoadCoordPos(oNodeShape, oShapeElem.m_pShape); //for path calculate
} }
pPPTShape->LoadFromXMLShapeType(oNodeShape); pPPTShape->LoadFromXMLShapeType(oNodeShape);
} }
if (pPPTShape != NULL) if (pPPTShape != NULL)
{ {
oShapeElem.m_oShape.setBaseShape(pPPTShape); oShapeElem.m_pShape->setBaseShape(CBaseShapePtr(pPPTShape));
if (bIsNeedCoordSizes) if (bIsNeedCoordSizes)
{ {
LoadCoordSize(oNodeShape, &oShapeElem.m_oShape); LoadCoordSize(oNodeShape, oShapeElem.m_pShape);
} }
else else
{ {
oShapeElem.m_oShape.m_dWidthLogic = 21600; oShapeElem.m_pShape->m_dWidthLogic = 21600;
oShapeElem.m_oShape.m_dHeightLogic = 21600; oShapeElem.m_pShape->m_dHeightLogic = 21600;
oShapeElem.m_oShape.getBaseShape()->m_oPath.SetCoordsize(21600, 21600); oShapeElem.m_pShape->getBaseShape()->m_oPath.SetCoordsize(21600, 21600);
} }
std::wstring strXmlPPTX; std::wstring strXmlPPTX;
...@@ -2812,12 +2816,12 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils: ...@@ -2812,12 +2816,12 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
pShape->LoadFromXMLShapeType(oNodeT); pShape->LoadFromXMLShapeType(oNodeT);
CShape* pS = new CShape(NSBaseShape::unknown, 0); CShapePtr pS = CShapePtr(new CShape(NSBaseShape::unknown, 0));
pS->setBaseShape(pShape); pS->setBaseShape(CBaseShapePtr(pShape));
LoadCoordSize(oNodeT, pS); LoadCoordSize(oNodeT, pS);
m_mapShapeTypes.insert(std::pair<std::wstring, CShape*>(strId, pS)); m_mapShapeTypes.insert(std::pair<std::wstring, CShapePtr>(strId, pS));
} }
} }
} }
...@@ -2989,8 +2993,10 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils: ...@@ -2989,8 +2993,10 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
result->InitElem(pTree); result->InitElem(pTree);
} }
void CDrawingConverter::LoadCoordPos(XmlUtils::CXmlNode& oNode, CShape* pShape) void CDrawingConverter::LoadCoordPos(XmlUtils::CXmlNode& oNode, CShapePtr pShape)
{ {
if (!pShape) return;
pShape->m_dXLogic = 0; pShape->m_dXLogic = 0;
pShape->m_dYLogic = 0; pShape->m_dYLogic = 0;
...@@ -3030,8 +3036,10 @@ void CDrawingConverter::LoadCoordPos(XmlUtils::CXmlNode& oNode, CShape* pShape) ...@@ -3030,8 +3036,10 @@ void CDrawingConverter::LoadCoordPos(XmlUtils::CXmlNode& oNode, CShape* pShape)
} }
void CDrawingConverter::LoadCoordSize(XmlUtils::CXmlNode& oNode, CShape* pShape) void CDrawingConverter::LoadCoordSize(XmlUtils::CXmlNode& oNode, CShapePtr pShape)
{ {
if (!pShape) return;
pShape->m_dWidthLogic = ShapeSizeVML; pShape->m_dWidthLogic = ShapeSizeVML;
pShape->m_dHeightLogic = ShapeSizeVML; pShape->m_dHeightLogic = ShapeSizeVML;
...@@ -5327,16 +5335,10 @@ int CDrawingConverter::GetDocumentChartsCount () ...@@ -5327,16 +5335,10 @@ int CDrawingConverter::GetDocumentChartsCount ()
OOX::CContentTypes* CDrawingConverter::GetContentTypes() OOX::CContentTypes* CDrawingConverter::GetContentTypes()
{ {
return m_pImageManager->m_pContentTypes; return m_pImageManager->m_pContentTypes;
//return m_pReader->mm_strContentTypes;
} }
void CDrawingConverter::Clear() void CDrawingConverter::Clear()
{ {
for (std::map<std::wstring, CShape*>::iterator pPair = m_mapShapeTypes.begin(); pPair != m_mapShapeTypes.end(); ++pPair)
{
CShape* pMem = pPair->second;
RELEASEOBJECT(pMem);
}
m_mapShapeTypes.clear(); m_mapShapeTypes.clear();
} }
void CDrawingConverter::SetRels(smart_ptr<OOX::IFileContainer> container) void CDrawingConverter::SetRels(smart_ptr<OOX::IFileContainer> container)
......
...@@ -43,11 +43,14 @@ ...@@ -43,11 +43,14 @@
#include <map> #include <map>
class IRenderer; class IRenderer;
class CShape;
class CPPTShape;
class CFontManager; class CFontManager;
class COfficeFontPicker; class COfficeFontPicker;
class CShape;
typedef boost::shared_ptr<CShape> CShapePtr;
class CPPTShape;
namespace XmlUtils namespace XmlUtils
{ {
class CXmlNode; class CXmlNode;
...@@ -187,7 +190,7 @@ namespace NSBinPptxRW ...@@ -187,7 +190,7 @@ namespace NSBinPptxRW
}; };
std::map<std::wstring, CShape*> m_mapShapeTypes; std::map<std::wstring, CShapePtr> m_mapShapeTypes;
NSBinPptxRW::CBinaryFileWriter* m_pBinaryWriter; NSBinPptxRW::CBinaryFileWriter* m_pBinaryWriter;
int m_lNextId; int m_lNextId;
...@@ -276,8 +279,8 @@ namespace NSBinPptxRW ...@@ -276,8 +279,8 @@ namespace NSBinPptxRW
void CheckBrushShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape); void CheckBrushShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void CheckPenShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape); void CheckPenShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShape* pShape); void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
void LoadCoordPos (XmlUtils::CXmlNode& oNode, ::CShape* pShape); void LoadCoordPos (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
std::wstring GetDrawingMainProps (XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps); std::wstring GetDrawingMainProps (XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps);
......
...@@ -103,13 +103,13 @@ namespace NSPresentationEditor ...@@ -103,13 +103,13 @@ namespace NSPresentationEditor
size_t nCountElems = pSlide->m_arElements.size(); size_t nCountElems = pSlide->m_arElements.size();
for (size_t i = 0; i < nCountElems; ++i) for (size_t i = 0; i < nCountElems; ++i)
{ {
IElement* pElement = pSlide->m_arElements[i]; CElementPtr pElement = pSlide->m_arElements[i];
switch (pElement->m_etType) switch (pElement->m_etType)
{ {
case etAudio: case etAudio:
{ {
CAudioElement* pAudioElem = dynamic_cast<CAudioElement*>(pElement); CAudioElement* pAudioElem = dynamic_cast<CAudioElement*>(pElement.get());
if (NULL != pAudioElem) if (NULL != pAudioElem)
{ {
...@@ -147,9 +147,9 @@ namespace NSPresentationEditor ...@@ -147,9 +147,9 @@ namespace NSPresentationEditor
} }
} }
void ResetAutoText(IElement *pElement, vector_string const (&placeholdersReplaceString)[3]) void ResetAutoText(CElementPtr pElement, vector_string const (&placeholdersReplaceString)[3])
{ {
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement); CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL == pShape) return; if (NULL == pShape) return;
...@@ -193,7 +193,7 @@ namespace NSPresentationEditor ...@@ -193,7 +193,7 @@ namespace NSPresentationEditor
size_t nCountElems = pTheme->m_arElements.size(); size_t nCountElems = pTheme->m_arElements.size();
for (size_t nIndexEl = 0; nIndexEl < nCountElems; ++nIndexEl) for (size_t nIndexEl = 0; nIndexEl < nCountElems; ++nIndexEl)
{ {
IElement* pElement = pTheme->m_arElements[nIndexEl]; CElementPtr pElement = pTheme->m_arElements[nIndexEl];
if (pElement->m_lPlaceholderType > 0) if (pElement->m_lPlaceholderType > 0)
{ {
...@@ -219,7 +219,7 @@ namespace NSPresentationEditor ...@@ -219,7 +219,7 @@ namespace NSPresentationEditor
size_t nCountLayoutElements = pLayout->m_arElements.size(); size_t nCountLayoutElements = pLayout->m_arElements.size();
for (size_t nIndexLayoutEl = 0; nIndexLayoutEl < nCountLayoutElements; ++nIndexLayoutEl) for (size_t nIndexLayoutEl = 0; nIndexLayoutEl < nCountLayoutElements; ++nIndexLayoutEl)
{ {
IElement* pElement = pLayout->m_arElements[nIndexLayoutEl]; CElementPtr pElement = pLayout->m_arElements[nIndexLayoutEl];
if (pElement->m_lPlaceholderType > 0) if (pElement->m_lPlaceholderType > 0)
{ {
...@@ -232,7 +232,7 @@ namespace NSPresentationEditor ...@@ -232,7 +232,7 @@ namespace NSPresentationEditor
pElement->m_pTheme = pTheme; pElement->m_pTheme = pTheme;
pElement->m_pLayout = NULL; pElement->m_pLayout = NULL;
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement); CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (!pLayout->m_bUseThemeColorScheme && NULL != pShape) if (!pLayout->m_bUseThemeColorScheme && NULL != pShape)
{ {
int lPhType = pElement->m_lPlaceholderType; int lPhType = pElement->m_lPlaceholderType;
...@@ -253,20 +253,20 @@ namespace NSPresentationEditor ...@@ -253,20 +253,20 @@ namespace NSPresentationEditor
if (pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex == -1) if (pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex == -1)
continue; continue;
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0].is_init()) if (pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0].is_init())
{ {
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color.is_init()) if (pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color.is_init())
{ {
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex != -1) if (pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex != -1)
continue; continue;
LONG lIndexSchemeT = pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex; LONG lIndexSchemeT = pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex = -1; pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex = -1;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->R = pLayout->m_arColorScheme[lIndexSchemeT].R; pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->R = pLayout->m_arColorScheme[lIndexSchemeT].R;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->G = pLayout->m_arColorScheme[lIndexSchemeT].G; pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->G = pLayout->m_arColorScheme[lIndexSchemeT].G;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->B = pLayout->m_arColorScheme[lIndexSchemeT].B; pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->B = pLayout->m_arColorScheme[lIndexSchemeT].B;
bIsPlaceholderSetUp = true; bIsPlaceholderSetUp = true;
} }
...@@ -301,7 +301,7 @@ namespace NSPresentationEditor ...@@ -301,7 +301,7 @@ namespace NSPresentationEditor
size_t nCountElems = pSlide->m_arElements.size(); size_t nCountElems = pSlide->m_arElements.size();
for (size_t nIndexEl = 0; nIndexEl < nCountElems; ++nIndexEl) for (size_t nIndexEl = 0; nIndexEl < nCountElems; ++nIndexEl)
{ {
IElement* pElement = pSlide->m_arElements[nIndexEl]; CElementPtr pElement = pSlide->m_arElements[nIndexEl];
if (pElement->m_lPlaceholderType > 0) if (pElement->m_lPlaceholderType > 0)
{ {
......
...@@ -124,11 +124,11 @@ namespace NSPresentationEditor ...@@ -124,11 +124,11 @@ namespace NSPresentationEditor
class CLayout; class CLayout;
class CSlide; class CSlide;
class IElement class CElement;
typedef boost::shared_ptr<CElement> CElementPtr;
class CElement
{ {
protected:
ULONG m_lCountRef;
public: public:
ElementType m_etType; ElementType m_etType;
CDoubleRect m_rcBounds; CDoubleRect m_rcBounds;
...@@ -181,23 +181,7 @@ namespace NSPresentationEditor ...@@ -181,23 +181,7 @@ namespace NSPresentationEditor
std::wstring m_sHyperlink; std::wstring m_sHyperlink;
virtual ULONG AddRef() CElement()
{
++m_lCountRef;
return m_lCountRef;
}
virtual ULONG Release()
{
--m_lCountRef;
if (0 == m_lCountRef)
{
delete this;
return 0;
}
return m_lCountRef;
}
IElement()
{ {
m_bIsBackground = false; m_bIsBackground = false;
m_bHaveAnchor = true; m_bHaveAnchor = true;
...@@ -237,12 +221,10 @@ namespace NSPresentationEditor ...@@ -237,12 +221,10 @@ namespace NSPresentationEditor
m_bFlipV = false; m_bFlipV = false;
m_bLine = true; m_bLine = true;
m_lCountRef = 1;
m_pTheme = NULL; m_pTheme = NULL;
m_pLayout = NULL; m_pLayout = NULL;
} }
virtual ~IElement() virtual ~CElement()
{ {
} }
...@@ -263,12 +245,11 @@ namespace NSPresentationEditor ...@@ -263,12 +245,11 @@ namespace NSPresentationEditor
m_rcBoundsOriginal.top = dScaleY * m_rcBounds.top; m_rcBoundsOriginal.top = dScaleY * m_rcBounds.top;
m_rcBoundsOriginal.bottom = dScaleY * m_rcBounds.bottom; m_rcBoundsOriginal.bottom = dScaleY * m_rcBounds.bottom;
} }
virtual IElement* CreateDublicate() = 0; virtual CElementPtr CreateDublicate() = 0;
protected: virtual void SetProperiesToDublicate(CElementPtr pDublicate)
virtual void SetProperiesToDublicate(IElement* pDublicate)
{ {
if (NULL == pDublicate) if (!pDublicate)
return; return;
pDublicate->m_bBoundsEnabled = m_bBoundsEnabled; pDublicate->m_bBoundsEnabled = m_bBoundsEnabled;
......
...@@ -63,7 +63,7 @@ void NSPresentationEditor::CShapeElement::CalculateColor(CColor& oColor, CSlide* ...@@ -63,7 +63,7 @@ void NSPresentationEditor::CShapeElement::CalculateColor(CColor& oColor, CSlide*
void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout) void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{ {
NSPresentationEditor::CTextAttributesEx* pAttributes = &m_oShape.m_oText; NSPresentationEditor::CTextAttributesEx* pAttributes = &m_pShape->m_oText;
int nCountColors = 0; int nCountColors = 0;
if (NULL != pTheme) if (NULL != pTheme)
nCountColors = (int)pTheme->m_arColorScheme.size(); nCountColors = (int)pTheme->m_arColorScheme.size();
...@@ -123,7 +123,7 @@ void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CT ...@@ -123,7 +123,7 @@ void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CT
bool NSPresentationEditor::CShapeElement::SetUpTextPlaceholder(std::wstring newText) bool NSPresentationEditor::CShapeElement::SetUpTextPlaceholder(std::wstring newText)
{ {
bool result = false; bool result = false;
NSPresentationEditor::CTextAttributesEx* pText = &m_oShape.m_oText; NSPresentationEditor::CTextAttributesEx* pText = &m_pShape->m_oText;
for (size_t p = 0 ; p < pText->m_arParagraphs.size(); p++) //тут по всем -> 1-(33).ppt for (size_t p = 0 ; p < pText->m_arParagraphs.size(); p++) //тут по всем -> 1-(33).ppt
{ {
......
...@@ -284,7 +284,7 @@ namespace PPTX2EditorAdvanced ...@@ -284,7 +284,7 @@ namespace PPTX2EditorAdvanced
namespace NSPresentationEditor namespace NSPresentationEditor
{ {
class CImageElement : public IElement class CImageElement : public CElement
{ {
public: public:
std::wstring m_strImageFileName; std::wstring m_strImageFileName;
...@@ -306,7 +306,7 @@ namespace NSPresentationEditor ...@@ -306,7 +306,7 @@ namespace NSPresentationEditor
std::wstring m_sImageName; std::wstring m_sImageName;
CImageElement() : IElement() CImageElement() : CElement()
{ {
m_etType = etPicture; m_etType = etPicture;
...@@ -328,11 +328,13 @@ namespace NSPresentationEditor ...@@ -328,11 +328,13 @@ namespace NSPresentationEditor
virtual ~CImageElement() virtual ~CImageElement()
{ {
} }
virtual IElement* CreateDublicate() virtual CElementPtr CreateDublicate()
{ {
CImageElement* pImageElement = new CImageElement(); CImageElement* pImageElement = new CImageElement();
CElementPtr pElement = CElementPtr( pImageElement );
SetProperiesToDublicate((IElement*)pImageElement); SetProperiesToDublicate(pElement);
pImageElement->m_strImageFileName = m_strImageFileName; pImageElement->m_strImageFileName = m_strImageFileName;
pImageElement->m_nAlpha = m_nAlpha; pImageElement->m_nAlpha = m_nAlpha;
...@@ -349,7 +351,7 @@ namespace NSPresentationEditor ...@@ -349,7 +351,7 @@ namespace NSPresentationEditor
pImageElement->m_bImagePresent = m_bImagePresent; pImageElement->m_bImagePresent = m_bImagePresent;
pImageElement->m_bOLE = m_bOLE; pImageElement->m_bOLE = m_bOLE;
return (IElement*)pImageElement; return pElement;
} }
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false) AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{ {
...@@ -389,79 +391,90 @@ namespace NSPresentationEditor ...@@ -389,79 +391,90 @@ namespace NSPresentationEditor
} }
}; };
class CShapeElement : public IElement class CShapeElement : public CElement
{ {
public: public:
NSBaseShape::ClassType m_ClassType; NSBaseShape::ClassType m_ClassType;
int m_lShapeType; int m_lShapeType;
CShape m_oShape; CShapePtr m_pShape;
bool m_bShapePreset; // or rect ( bool m_bShapePreset; // or rect (
CShapeElement(NSBaseShape::ClassType ClassType, int eType) : IElement(), m_lShapeType(eType), m_oShape(ClassType, eType) CShapeElement(NSBaseShape::ClassType ClassType, int eType) : CElement()
{ {
m_lShapeType = eType;
m_ClassType = ClassType; m_ClassType = ClassType;
m_etType = etShape; m_etType = etShape;
m_oShape.m_rcBounds = m_rcBounds; m_pShape = CShapePtr( new CShape(ClassType, eType));
m_pShape->m_rcBounds = m_rcBounds;
m_oShape.m_dStartTime = m_dStartTime; m_pShape->m_dStartTime = m_dStartTime;
m_oShape.m_dStartTime = m_dEndTime; m_pShape->m_dStartTime = m_dEndTime;
m_bShapePreset = false; m_bShapePreset = false;
} }
CShapeElement() : m_oShape(NSBaseShape::unknown, 0x1000) CShapeElement() : CElement()
{ {
m_lShapeType = 0x1000; m_lShapeType = 0x1000;
m_etType = etShape; m_etType = etShape;
m_bShapePreset = false; m_bShapePreset = false;
m_pShape = CShapePtr( new CShape(NSBaseShape::unknown, 0x1000));
} }
CShapeElement(const std::wstring& str) : IElement(), m_oShape(NSBaseShape::unknown, 0x1000) CShapeElement(const std::wstring& str) : CElement()
{ {
m_lShapeType = 0x1000; m_lShapeType = 0x1000;
m_bShapePreset = false; m_bShapePreset = false;
m_oShape.LoadFromXML(str); m_pShape = CShapePtr( new CShape(NSBaseShape::unknown, 0x1000));
m_ClassType = m_oShape.getBaseShape()->GetClassType(); m_pShape->LoadFromXML(str);
m_ClassType = m_pShape->getBaseShape()->GetClassType();
} }
virtual void NormalizeCoordsByMetric() virtual void NormalizeCoordsByMetric()
{ {
IElement::NormalizeCoordsByMetric(); CElement::NormalizeCoordsByMetric();
double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor; double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor;
double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer; double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer;
m_oShape.m_oText.m_oBounds.left = (int)(dScaleX * m_oShape.m_oText.m_oBounds.left); m_pShape->m_oText.m_oBounds.left = (int)(dScaleX * m_pShape->m_oText.m_oBounds.left);
m_oShape.m_oText.m_oBounds.right = (int)(dScaleX * m_oShape.m_oText.m_oBounds.right); m_pShape->m_oText.m_oBounds.right = (int)(dScaleX * m_pShape->m_oText.m_oBounds.right);
m_oShape.m_oText.m_oBounds.top = (int)(dScaleY * m_oShape.m_oText.m_oBounds.top); m_pShape->m_oText.m_oBounds.top = (int)(dScaleY * m_pShape->m_oText.m_oBounds.top);
m_oShape.m_oText.m_oBounds.bottom = (int)(dScaleY * m_oShape.m_oText.m_oBounds.bottom); m_pShape->m_oText.m_oBounds.bottom = (int)(dScaleY * m_pShape->m_oText.m_oBounds.bottom);
} }
virtual ~CShapeElement() virtual ~CShapeElement()
{ {
} }
virtual IElement* CreateDublicate() virtual CElementPtr CreateDublicate()
{ {
CShapeElement* pShapeElement = new CShapeElement(m_ClassType, m_lShapeType); CShapeElement* pShapeElement = new CShapeElement(m_ClassType, m_lShapeType);
SetProperiesToDublicate((IElement*)pShapeElement); CElementPtr pElement = CElementPtr( pShapeElement );
SetProperiesToDublicate(pElement);
pShapeElement->m_lShapeType = m_lShapeType; pShapeElement->m_lShapeType = m_lShapeType;
pShapeElement->m_bShapePreset = m_bShapePreset; pShapeElement->m_bShapePreset = m_bShapePreset;
m_oShape.SetToDublicate(&pShapeElement->m_oShape); m_pShape->SetToDublicate(pShapeElement->m_pShape.get());
return (IElement*)pShapeElement;
return pElement;
} }
bool SetUpTextPlaceholder(std::wstring newText); bool SetUpTextPlaceholder(std::wstring newText);
virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout) virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{ {
m_oShape.m_oText.m_lPlaceholderType = m_lPlaceholderType; m_pShape->m_oText.m_lPlaceholderType = m_lPlaceholderType;
m_oShape.m_oText.m_lPlaceholderID = m_lPlaceholderID; m_pShape->m_oText.m_lPlaceholderID = m_lPlaceholderID;
m_oShape.getBaseShape()->ReCalculate(); m_pShape->getBaseShape()->ReCalculate();
SetupTextProperties(pSlide, pTheme, pLayout); SetupTextProperties(pSlide, pTheme, pLayout);
...@@ -476,7 +489,7 @@ namespace NSPresentationEditor ...@@ -476,7 +489,7 @@ namespace NSPresentationEditor
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false) AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{ {
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_oShape.getBaseShape()); CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape->getBaseShape().get());
if (NULL == pPPTShape) if (NULL == pPPTShape)
{ {
// такого быть не может // такого быть не может
...@@ -712,11 +725,12 @@ namespace NSPresentationEditor ...@@ -712,11 +725,12 @@ namespace NSPresentationEditor
{ {
} }
virtual IElement* CreateDublicate() virtual CElementPtr CreateDublicate()
{ {
CAudioElement* pAudioElement = new CAudioElement(); CAudioElement* pAudioElement = new CAudioElement();
CElementPtr pElement = CElementPtr( pAudioElement );
SetProperiesToDublicate((CImageElement*)pAudioElement); SetProperiesToDublicate(pElement);
pAudioElement->m_strAudioFileName = m_strAudioFileName; pAudioElement->m_strAudioFileName = m_strAudioFileName;
pAudioElement->m_nAmplify = m_nAmplify; pAudioElement->m_nAmplify = m_nAmplify;
...@@ -728,7 +742,7 @@ namespace NSPresentationEditor ...@@ -728,7 +742,7 @@ namespace NSPresentationEditor
pAudioElement->m_dClipStartTime = m_dClipStartTime; pAudioElement->m_dClipStartTime = m_dClipStartTime;
pAudioElement->m_dClipEndTime = m_dClipEndTime; pAudioElement->m_dClipEndTime = m_dClipEndTime;
return (IElement*)pAudioElement; return pElement;
} }
}; };
class CVideoElement : public CImageElement class CVideoElement : public CImageElement
...@@ -759,11 +773,13 @@ namespace NSPresentationEditor ...@@ -759,11 +773,13 @@ namespace NSPresentationEditor
{ {
} }
virtual IElement* CreateDublicate() virtual CElementPtr CreateDublicate()
{ {
CVideoElement* pVideoElement = new CVideoElement(); CVideoElement* pVideoElement = new CVideoElement();
SetProperiesToDublicate((CImageElement*)pVideoElement); CElementPtr pElement = CElementPtr( pVideoElement );
SetProperiesToDublicate(pElement);
pVideoElement->m_strVideoFileName = m_strVideoFileName; pVideoElement->m_strVideoFileName = m_strVideoFileName;
pVideoElement->m_nAlpha = m_nAlpha; pVideoElement->m_nAlpha = m_nAlpha;
...@@ -774,7 +790,7 @@ namespace NSPresentationEditor ...@@ -774,7 +790,7 @@ namespace NSPresentationEditor
pVideoElement->m_dClipEndTime = m_dClipEndTime; pVideoElement->m_dClipEndTime = m_dClipEndTime;
pVideoElement->m_bLoop = m_bLoop; pVideoElement->m_bLoop = m_bLoop;
return (IElement*)pVideoElement; return pElement;
} }
}; };
......
...@@ -37,7 +37,7 @@ namespace NSPresentationEditor ...@@ -37,7 +37,7 @@ namespace NSPresentationEditor
class CLayout class CLayout
{ {
public: public:
std::vector<IElement*> m_arElements; std::vector<CElementPtr>m_arElements;
std::vector<CColor> m_arColorScheme; std::vector<CColor> m_arColorScheme;
std::multimap<int,int> m_mapPlaceholders; std::multimap<int,int> m_mapPlaceholders;
...@@ -66,7 +66,7 @@ namespace NSPresentationEditor ...@@ -66,7 +66,7 @@ namespace NSPresentationEditor
std::wstring m_strLayoutType; std::wstring m_strLayoutType;
std::wstring m_sName; std::wstring m_sName;
public:
CLayout() CLayout()
{ {
Clear(); Clear();
...@@ -81,12 +81,10 @@ namespace NSPresentationEditor ...@@ -81,12 +81,10 @@ namespace NSPresentationEditor
{ {
Clear(); Clear();
m_arElements = oSrc.m_arElements; size_t nCount = oSrc.m_arElements.size();
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex) for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{ {
ADDREFINTERFACE((m_arElements[nIndex])); m_arElements.push_back(oSrc.m_arElements[nIndex]->CreateDublicate());
} }
m_mapPlaceholders = oSrc.m_mapPlaceholders; m_mapPlaceholders = oSrc.m_mapPlaceholders;
...@@ -108,7 +106,8 @@ namespace NSPresentationEditor ...@@ -108,7 +106,8 @@ namespace NSPresentationEditor
m_bHasFooter = oSrc.m_bHasFooter; m_bHasFooter = oSrc.m_bHasFooter;
m_nFormatDate = oSrc.m_nFormatDate; m_nFormatDate = oSrc.m_nFormatDate;
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i] = oSrc.m_PlaceholdersReplaceString[i]; for (int i = 0 ; i < 3 ; i++)
m_PlaceholdersReplaceString[i] = oSrc.m_PlaceholdersReplaceString[i];
m_bShowMasterShapes = oSrc.m_bShowMasterShapes; m_bShowMasterShapes = oSrc.m_bShowMasterShapes;
m_strLayoutType = oSrc.m_strLayoutType; m_strLayoutType = oSrc.m_strLayoutType;
...@@ -127,15 +126,8 @@ namespace NSPresentationEditor ...@@ -127,15 +126,8 @@ namespace NSPresentationEditor
m_lOriginalHeight = m_oInfo.m_lUnitsVer; m_lOriginalHeight = m_oInfo.m_lUnitsVer;
} }
public:
void Clear() void Clear()
{ {
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
RELEASEINTERFACE((m_arElements[nIndex]));
}
m_arElements.clear(); m_arElements.clear();
m_mapPlaceholders.clear(); m_mapPlaceholders.clear();
...@@ -143,7 +135,9 @@ namespace NSPresentationEditor ...@@ -143,7 +135,9 @@ namespace NSPresentationEditor
m_bHasSlideNumber = false; m_bHasSlideNumber = false;
m_bHasFooter = false; m_bHasFooter = false;
m_nFormatDate = 1; m_nFormatDate = 1;
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i].clear();
for (int i = 0 ; i < 3 ; i++)
m_PlaceholdersReplaceString[i].clear();
m_bUseThemeColorScheme = true; m_bUseThemeColorScheme = true;
m_bShowMasterShapes = true; m_bShowMasterShapes = true;
...@@ -159,12 +153,11 @@ namespace NSPresentationEditor ...@@ -159,12 +153,11 @@ namespace NSPresentationEditor
for (size_t nIndex = 0; nIndex < m_arElements.size(); ++nIndex) for (size_t nIndex = 0; nIndex < m_arElements.size(); ++nIndex)
{ {
IElement* pElem = m_arElements[nIndex]; CElementPtr pElem = m_arElements[nIndex];
if (NULL != pElem) if (NULL != pElem)
{ {
m_arElements[nIndex] = pElem->CreateDublicate(); m_arElements[nIndex] = pElem->CreateDublicate();
} }
RELEASEINTERFACE(pElem);
} }
} }
...@@ -175,24 +168,21 @@ namespace NSPresentationEditor ...@@ -175,24 +168,21 @@ namespace NSPresentationEditor
return pNew; return pNew;
} }
IElement* GetPlaceholder(LONG lID, bool bIsAddRef) CElementPtr GetPlaceholder(LONG lID)
{ {
size_t nCount = m_arElements.size(); size_t nCount = m_arElements.size();
for (size_t i = 0; i < nCount; ++i) for (size_t i = 0; i < nCount; ++i)
{ {
IElement* pElem = m_arElements[i]; CElementPtr pElem = m_arElements[i];
if (pElem->m_lPlaceholderType == lID) if (pElem->m_lPlaceholderType == lID)
{ {
if (bIsAddRef)
ADDREFINTERFACE(pElem);
return pElem; return pElem;
} }
} }
return NULL; return CElementPtr();
} }
LONG GetCountPlaceholderWithType(LONG lType) LONG GetCountPlaceholderWithType(LONG lType)
...@@ -209,10 +199,6 @@ namespace NSPresentationEditor ...@@ -209,10 +199,6 @@ namespace NSPresentationEditor
return lFound; return lFound;
} }
public:
NSPresentationEditor::CColor GetColor(const LONG& lIndexScheme) NSPresentationEditor::CColor GetColor(const LONG& lIndexScheme)
{ {
if (lIndexScheme < (LONG)m_arColorScheme.size()) if (lIndexScheme < (LONG)m_arColorScheme.size())
......
...@@ -36,8 +36,9 @@ ...@@ -36,8 +36,9 @@
#include "PPTXShape/PptxShape.h" #include "PPTXShape/PptxShape.h"
#include "PPTShape/PptShape.h" #include "PPTShape/PptShape.h"
using namespace NSPresentationEditor;
NSPresentationEditor::CBaseShape* NSPresentationEditor::CBaseShape::CreateByType(NSPresentationEditor::NSBaseShape::ClassType ClassType, int ShapeType) CBaseShapePtr CBaseShape::CreateByType(NSBaseShape::ClassType ClassType, int ShapeType)
{ {
if(ClassType == pptx) if(ClassType == pptx)
{ {
...@@ -52,7 +53,7 @@ NSPresentationEditor::CBaseShape* NSPresentationEditor::CBaseShape::CreateByType ...@@ -52,7 +53,7 @@ NSPresentationEditor::CBaseShape* NSPresentationEditor::CBaseShape::CreateByType
return NULL; return NULL;
} }
bool NSPresentationEditor::CBaseShape::SetType(NSPresentationEditor::NSBaseShape::ClassType ClassType, int ShapeType) bool CBaseShape::SetType(NSBaseShape::ClassType ClassType, int ShapeType)
{ {
if (ClassType != GetClassType()) if (ClassType != GetClassType())
return false; return false;
......
...@@ -30,9 +30,12 @@ ...@@ -30,9 +30,12 @@
* *
*/ */
#pragma once #pragma once
#include "Path.h" #include "Path.h"
#include "../../../../../Common/DocxFormat/Source/Common/SimpleTypes_Base.h" #include "../../../../../Common/DocxFormat/Source/Common/SimpleTypes_Base.h"
#include <boost/shared_ptr.hpp>
namespace NSPresentationEditor namespace NSPresentationEditor
{ {
using namespace NSBaseShape; using namespace NSBaseShape;
...@@ -61,7 +64,10 @@ namespace NSPresentationEditor ...@@ -61,7 +64,10 @@ namespace NSPresentationEditor
return (*this); return (*this);
} }
}; };
//
class CBaseShape;
typedef boost::shared_ptr<CBaseShape> CBaseShapePtr;
class CBaseShape class CBaseShape
{ {
public: public:
...@@ -120,7 +126,7 @@ namespace NSPresentationEditor ...@@ -120,7 +126,7 @@ namespace NSPresentationEditor
virtual void AddGuide(const std::wstring& strGuide) {} virtual void AddGuide(const std::wstring& strGuide) {}
static CBaseShape* CreateByType(ClassType ClassType, int ShapeType); static CBaseShapePtr CreateByType(ClassType ClassType, int ShapeType);
virtual const ClassType GetClassType()const = 0; virtual const ClassType GetClassType()const = 0;
bool SetType(ClassType ClassType, int ShapeType); bool SetType(ClassType ClassType, int ShapeType);
......
...@@ -48,34 +48,40 @@ LONG NSGuidesVML::CFormula::Calculate(NSGuidesVML::CFormulasManager* pManager) ...@@ -48,34 +48,40 @@ LONG NSGuidesVML::CFormula::Calculate(NSGuidesVML::CFormulasManager* pManager)
LONG lAdjCount = (LONG)pManager->m_pAdjustments->size(); LONG lAdjCount = (LONG)pManager->m_pAdjustments->size();
LONG a1 = m_lParam1; LONG a1 = m_lParam1;
if (ptFormula == m_eType1) if (ptFormula == m_eType1 && !pManager->m_bCalc)
{ {
pManager->m_bCalc = true;
a1 = (m_lParam1 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam1].Calculate(pManager); a1 = (m_lParam1 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam1].Calculate(pManager);
} }
else if (ptAdjust == m_eType1) else if (ptAdjust == m_eType1)
{ {
a1 = (m_lParam1 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam1]; a1 = (m_lParam1 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam1];
} }
pManager->m_bCalc = false;
LONG b1 = m_lParam2; LONG b1 = m_lParam2;
if (ptFormula == m_eType2) if (ptFormula == m_eType2 && !pManager->m_bCalc)
{ {
pManager->m_bCalc = true;
b1 = (m_lParam2 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam2].Calculate(pManager); b1 = (m_lParam2 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam2].Calculate(pManager);
} }
else if (ptAdjust == m_eType2) else if (ptAdjust == m_eType2)
{ {
b1 = (m_lParam2 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam2]; b1 = (m_lParam2 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam2];
} }
pManager->m_bCalc = false;
LONG c1 = m_lParam3; LONG c1 = m_lParam3;
if (ptFormula == m_eType3) if (ptFormula == m_eType3 && !pManager->m_bCalc)
{ {
pManager->m_bCalc = true;
c1 = (m_lParam3 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam3].Calculate(pManager); c1 = (m_lParam3 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam3].Calculate(pManager);
} }
else if (ptAdjust == m_eType3) else if (ptAdjust == m_eType3)
{ {
c1 = (m_lParam3 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam3]; c1 = (m_lParam3 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam3];
} }
pManager->m_bCalc = false;
double a = (double)a1; double a = (double)a1;
double b = (double)b1; double b = (double)b1;
......
...@@ -341,8 +341,9 @@ namespace NSGuidesVML ...@@ -341,8 +341,9 @@ namespace NSGuidesVML
long m_lShapeWidth; long m_lShapeWidth;
long m_lShapeHeight; long m_lShapeHeight;
public: bool m_bCalc; //status
CFormulasManager() : m_arFormulas(), m_arResults()
CFormulasManager() : m_bCalc(false)
{ {
m_pAdjustments = NULL; m_pAdjustments = NULL;
m_lShapeWidth = ShapeSizeVML; m_lShapeWidth = ShapeSizeVML;
...@@ -350,6 +351,7 @@ namespace NSGuidesVML ...@@ -350,6 +351,7 @@ namespace NSGuidesVML
} }
CFormulasManager& operator =(const CFormulasManager& oSrc) CFormulasManager& operator =(const CFormulasManager& oSrc)
{ {
m_bCalc = oSrc.m_bCalc;
m_pAdjustments = oSrc.m_pAdjustments; m_pAdjustments = oSrc.m_pAdjustments;
m_lShapeWidth = oSrc.m_lShapeWidth; m_lShapeWidth = oSrc.m_lShapeWidth;
m_lShapeHeight = oSrc.m_lShapeHeight; m_lShapeHeight = oSrc.m_lShapeHeight;
...@@ -370,6 +372,7 @@ namespace NSGuidesVML ...@@ -370,6 +372,7 @@ namespace NSGuidesVML
void Clear() void Clear()
{ {
m_bCalc = false;
m_pAdjustments = NULL; m_pAdjustments = NULL;
m_lShapeWidth = ShapeSizeVML; m_lShapeWidth = ShapeSizeVML;
m_lShapeHeight = ShapeSizeVML; m_lShapeHeight = ShapeSizeVML;
......
...@@ -42,7 +42,26 @@ const double EMU_MM = 36000; ...@@ -42,7 +42,26 @@ const double EMU_MM = 36000;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
using namespace PPTShapes; using namespace PPTShapes;
CPPTShape* CPPTShape::CreateByType(PPTShapes::ShapeType type) using namespace NSPresentationEditor;
CPPTShape::CPPTShape() : CBaseShape(), m_arStringTextRects()
{
m_eType = PPTShapes::sptMin;
m_arStringTextRects.push_back(_T("0,0,21600,21600"));
m_strPathLimoX = _T("");
m_strPathLimoY = _T("");
m_bIsShapeType = false;
m_bIsFilled = true;
m_bIsStroked = true;
}
CPPTShape::~CPPTShape()
{
}
CBaseShapePtr CPPTShape::CreateByType(PPTShapes::ShapeType type)
{ {
CPPTShape* pShape = NULL; CPPTShape* pShape = NULL;
switch (type) switch (type)
...@@ -288,6 +307,143 @@ CPPTShape* CPPTShape::CreateByType(PPTShapes::ShapeType type) ...@@ -288,6 +307,143 @@ CPPTShape* CPPTShape::CreateByType(PPTShapes::ShapeType type)
if (NULL != pShape) if (NULL != pShape)
pShape->m_eType = type; pShape->m_eType = type;
return pShape; return CBaseShapePtr(pShape);
} }
bool CPPTShape::LoadFromXML(const std::wstring& xml)
{
XmlUtils::CXmlNode oNodePict;
if (oNodePict.FromXmlString(xml))
{
return LoadFromXML(oNodePict);
}
return false;
}
bool CPPTShape::LoadFromXML(XmlUtils::CXmlNode& oNodePict)
{
std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
bool isPathList = false;
if (id != _T(""))
{
SetShapeType((PPTShapes::ShapeType)XmlUtils::GetInteger(id));
}
else
{
XmlUtils::CXmlNode oNodeTemplate;
if (oNodePict.GetNode(_T("template"), oNodeTemplate))
{
std::wstring strAdj = oNodeTemplate.GetAttributeOrValue(_T("adj"));
LoadAdjustValuesList(strAdj);
XmlUtils::CXmlNode oNodeGuides;
if (oNodeTemplate.GetNode(_T("v:formulas"), oNodeGuides))
{
LoadGuidesList(oNodeGuides.GetXml());
}
std::wstring strPath = oNodeTemplate.GetAttributeOrValue(_T("path"));
if (strPath != _T(""))
{
LoadPathList(strPath);
isPathList = true;
}
}
}
XmlUtils::CXmlNode oNodeGuides;
if (oNodePict.GetNode(_T("path"), oNodeGuides))
{
std::wstring strPath = oNodeGuides.GetAttributeOrValue(_T("val"));
if (strPath != _T(""))
{
LoadPathList(strPath);
isPathList = true;
}
}
if (!isPathList)
ReCalculate();
return true;
}
bool CPPTShape::LoadFromXMLShapeType(XmlUtils::CXmlNode& oNodeShapeType) // vml object
{ // из за особенносей форматирования vmlDrawing могут вылезти пустые текстовые значения - value ..
std::wstring sId = oNodeShapeType.GetAttribute(_T("o:spt"));
bool bIsNeedRecalc = true;
if (sId != _T(""))
{
int id = XmlUtils::GetInteger(sId);
if (id > 0)
{
SetShapeType((PPTShapes::ShapeType)id);
//ReCalculate();
m_eType = (PPTShapes::ShapeType)id;
}
}
std::wstring strAdj = oNodeShapeType.GetAttribute(_T("adj"));
if (strAdj != _T(""))
LoadAdjustValuesList(strAdj);
XmlUtils::CXmlNode oNodeGuides;
if (oNodeShapeType.GetNode(_T("v:formulas"), oNodeGuides))
{
LoadGuidesList(oNodeGuides.GetXml());
}
XmlUtils::CXmlNode oNodePath;
if (oNodeShapeType.GetNode(_T("v:path"), oNodePath))
{
std::wstring strTextR = oNodePath.GetAttribute(_T("textboxrect"));
if (strTextR != _T(""))
LoadTextRect(strTextR);
}
XmlUtils::CXmlNode oNodeAHs;
if (oNodeShapeType.GetNode(_T("v:handles"), oNodeAHs))
{
LoadAHList(oNodeAHs);
}
std::wstring strPath = oNodeShapeType.GetAttribute(_T("path"));
if (strPath != _T(""))
{
LoadPathList(strPath);
}
XmlUtils::CXmlNode oNodeTextPath;
if (oNodeShapeType.GetNode(_T("v:textpath"), oNodeTextPath))
{
if (m_eType < PPTShapes::ShapeType::sptCTextPlain || m_eType > PPTShapes::ShapeType::sptCTextCanDown)
m_eType = PPTShapes::ShapeType::sptCTextPlain;
}
std::wstring strFilled = oNodeShapeType.GetAttribute(_T("filled"));
std::wstring strStroked = oNodeShapeType.GetAttribute(_T("stroked"));
if (strFilled != _T(""))
{
if (strFilled == _T("false") || strFilled == _T("f"))
m_bIsFilled = false;
else
m_bIsFilled = true;
}
if (strStroked != _T(""))
{
if (strStroked == _T("false") || strStroked == _T("f"))
m_bIsStroked = false;
else
m_bIsStroked = true;
}
XmlUtils::CXmlNode oNodeSignature;
if (oNodeShapeType.GetNode(_T("o:signatureline"), oNodeSignature))
{
m_oSignatureLine = oNodeSignature;
}
ReCalculate();
return true;
}
...@@ -56,240 +56,12 @@ public: ...@@ -56,240 +56,12 @@ public:
bool m_bIsStroked; bool m_bIsStroked;
nullable<OOX::VmlOffice::CSignatureLine> m_oSignatureLine; nullable<OOX::VmlOffice::CSignatureLine> m_oSignatureLine;
public: CPPTShape();
CPPTShape() : CBaseShape(), m_arStringTextRects() virtual ~CPPTShape();
{
m_eType = PPTShapes::sptMin;
m_arStringTextRects.push_back(_T("0,0,21600,21600"));
m_strPathLimoX = _T("");
m_strPathLimoY = _T("");
m_bIsShapeType = false;
m_bIsFilled = true;
m_bIsStroked = true;
}
~CPPTShape()
{
}
virtual bool LoadFromXML(const std::wstring& xml)
{
XmlUtils::CXmlNode oNodePict;
if (oNodePict.FromXmlString(xml))
{
return LoadFromXML(oNodePict);
}
return false;
}
//virtual bool LoadFromXML(const std::wstring& xml)
//{
// XmlUtils::CXmlNode oNodePict;
// if (oNodePict.FromXmlString(xml))
// {
// if (_T("shape") == oNodePict.GetName())
// {
// std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
// if (id != _T(""))
// {
// SetShapeType((PPTShapes::ShapeType)Strings::ToInteger(id));
// }
// else
// {
// XmlUtils::CXmlNode oNodeTemplate;
// if (oNodePict.GetNode(_T("template"), oNodeTemplate))
// {
// std::wstring strAdj = oNodeTemplate.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeTemplate.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeTemplate.GetAttributeOrValue(_T("path"));
// LoadPathList(strPath);
// }
// }
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodePict.GetNode(_T("path"), oNodeGuides))
// {
// std::wstring strPath = oNodeGuides.GetAttributeOrValue(_T("val"));
// LoadPathList(strPath);
// }
// /*XmlUtils::CXmlNode oNodeShapeType;
// if (oNodePict.GetNode(_T("v:shapetype"), oNodeShapeType))
// {
// std::wstring strAdj = oNodeShapeType.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeShapeType.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeShapeType.GetAttributeOrValue(_T("path"));
// LoadAdjustValuesList(strPath);
// }
// else
// {
// XmlUtils::CXmlNode oNodeShape;
// if (oNodePict.GetNode(_T("v:shape"), oNodeShape))
// {
// std::wstring strAdj = oNodeShape.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeShape.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeShape.GetAttributeOrValue(_T("path"));
// LoadPathList(strPath);
// }
// }*/
// return true;
// }
// }
// return false;
//}
virtual bool LoadFromXML(XmlUtils::CXmlNode& oNodePict)
{
std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
bool isPathList = false;
if (id != _T(""))
{
SetShapeType((PPTShapes::ShapeType)XmlUtils::GetInteger(id));
}
else
{
XmlUtils::CXmlNode oNodeTemplate;
if (oNodePict.GetNode(_T("template"), oNodeTemplate))
{
std::wstring strAdj = oNodeTemplate.GetAttributeOrValue(_T("adj"));
LoadAdjustValuesList(strAdj);
XmlUtils::CXmlNode oNodeGuides;
if (oNodeTemplate.GetNode(_T("v:formulas"), oNodeGuides))
{
LoadGuidesList(oNodeGuides.GetXml());
}
std::wstring strPath = oNodeTemplate.GetAttributeOrValue(_T("path"));
if (strPath != _T(""))
{
LoadPathList(strPath);
isPathList = true;
}
}
}
XmlUtils::CXmlNode oNodeGuides;
if (oNodePict.GetNode(_T("path"), oNodeGuides))
{
std::wstring strPath = oNodeGuides.GetAttributeOrValue(_T("val"));
if (strPath != _T(""))
{
LoadPathList(strPath);
isPathList = true;
}
}
if (!isPathList)
ReCalculate();
return true;
}
virtual bool LoadFromXMLShapeType(XmlUtils::CXmlNode& oNodeShapeType) // vml object
{ // из за особенносей форматирования vmlDrawing могут вылезти пустые текстовые значения - value ..
std::wstring sId = oNodeShapeType.GetAttribute(_T("o:spt"));
bool bIsNeedRecalc = true;
if (sId != _T(""))
{
int id = XmlUtils::GetInteger(sId);
if (id > 0)
{
SetShapeType((PPTShapes::ShapeType)id);
//ReCalculate();
m_eType = (PPTShapes::ShapeType)id;
}
}
std::wstring strAdj = oNodeShapeType.GetAttribute(_T("adj"));
if (strAdj != _T(""))
LoadAdjustValuesList(strAdj);
XmlUtils::CXmlNode oNodeGuides;
if (oNodeShapeType.GetNode(_T("v:formulas"), oNodeGuides))
{
LoadGuidesList(oNodeGuides.GetXml());
}
XmlUtils::CXmlNode oNodePath;
if (oNodeShapeType.GetNode(_T("v:path"), oNodePath))
{
std::wstring strTextR = oNodePath.GetAttribute(_T("textboxrect"));
if (strTextR != _T(""))
LoadTextRect(strTextR);
}
XmlUtils::CXmlNode oNodeAHs;
if (oNodeShapeType.GetNode(_T("v:handles"), oNodeAHs))
{
LoadAHList(oNodeAHs);
}
std::wstring strPath = oNodeShapeType.GetAttribute(_T("path"));
if (strPath != _T(""))
{
LoadPathList(strPath);
}
XmlUtils::CXmlNode oNodeTextPath;
if (oNodeShapeType.GetNode(_T("v:textpath"), oNodeTextPath))
{
if (m_eType < PPTShapes::ShapeType::sptCTextPlain || m_eType > PPTShapes::ShapeType::sptCTextCanDown)
m_eType = PPTShapes::ShapeType::sptCTextPlain;
}
std::wstring strFilled = oNodeShapeType.GetAttribute(_T("filled"));
std::wstring strStroked = oNodeShapeType.GetAttribute(_T("stroked"));
if (strFilled != _T(""))
{
if (strFilled == _T("false") || strFilled == _T("f"))
m_bIsFilled = false;
else
m_bIsFilled = true;
}
if (strStroked != _T(""))
{
if (strStroked == _T("false") || strStroked == _T("f"))
m_bIsStroked = false;
else
m_bIsStroked = true;
}
XmlUtils::CXmlNode oNodeSignature;
if (oNodeShapeType.GetNode(_T("o:signatureline"), oNodeSignature))
{
m_oSignatureLine = oNodeSignature;
}
ReCalculate();
return true;
}
virtual bool LoadFromXML(const std::wstring& xml);
virtual bool LoadFromXML(XmlUtils::CXmlNode& oNodePict);
virtual bool LoadFromXMLShapeType(XmlUtils::CXmlNode& oNodeShapeType);
virtual bool LoadAdjustValuesList(const std::wstring& xml) virtual bool LoadAdjustValuesList(const std::wstring& xml)
{ {
std::wstring strXml = xml; std::wstring strXml = xml;
...@@ -484,8 +256,9 @@ public: ...@@ -484,8 +256,9 @@ public:
LoadPathList(m_strPath); LoadPathList(m_strPath);
} }
static CPPTShape* CreateByType(PPTShapes::ShapeType type); static CBaseShapePtr CreateByType(PPTShapes::ShapeType type);
virtual const ClassType GetClassType()const
virtual const ClassType GetClassType()const
{ {
return NSBaseShape::ppt; return NSBaseShape::ppt;
} }
...@@ -533,13 +306,13 @@ public: ...@@ -533,13 +306,13 @@ public:
bool SetShapeType(PPTShapes::ShapeType type) bool SetShapeType(PPTShapes::ShapeType type)
{ {
CPPTShape* l_pShape = CreateByType(type); CBaseShapePtr pShape = CreateByType(type);
if(l_pShape != NULL)
if(pShape)
{ {
m_eType = type; m_eType = type;
SetProperties(l_pShape); SetProperties(pShape.get());
delete l_pShape;
return true; return true;
} }
......
...@@ -34,8 +34,9 @@ ...@@ -34,8 +34,9 @@
#include "PptxShape.h" #include "PptxShape.h"
//#include "PresetShapesHeader.h" //#include "PresetShapesHeader.h"
CPPTXShape* CPPTXShape::CreateByType(OOXMLShapes::ShapeType type) CBaseShapePtr CPPTXShape::CreateByType(OOXMLShapes::ShapeType type)
{ {
CBaseShapePtr shape;
// switch(type) // switch(type)
// { // {
// case OOXMLShapes::sptCAccentBorderCallout1: return new OOXMLShapes::CAccentBorderCallout1(); // case OOXMLShapes::sptCAccentBorderCallout1: return new OOXMLShapes::CAccentBorderCallout1();
...@@ -266,5 +267,5 @@ CPPTXShape* CPPTXShape::CreateByType(OOXMLShapes::ShapeType type) ...@@ -266,5 +267,5 @@ CPPTXShape* CPPTXShape::CreateByType(OOXMLShapes::ShapeType type)
// case OOXMLShapes::sptCWedgeRectCallout: return new OOXMLShapes::CWedgeRectCallout(); // case OOXMLShapes::sptCWedgeRectCallout: return new OOXMLShapes::CWedgeRectCallout();
// case OOXMLShapes::sptCWedgeRoundRectCallout: return new OOXMLShapes::CWedgeRoundRectCallout(); // case OOXMLShapes::sptCWedgeRoundRectCallout: return new OOXMLShapes::CWedgeRoundRectCallout();
// } // }
return NULL; return shape;
} }
...@@ -280,7 +280,7 @@ public: ...@@ -280,7 +280,7 @@ public:
OOXMLShapes::ShapeType m_eType; OOXMLShapes::ShapeType m_eType;
NSGuidesOOXML::CFormulaManager FManager; NSGuidesOOXML::CFormulaManager FManager;
public:
CPPTXShape() : CBaseShape(), FManager(m_arAdjustments, m_arGuides) CPPTXShape() : CBaseShape(), FManager(m_arAdjustments, m_arGuides)
{ {
m_eType = OOXMLShapes::sptMin; m_eType = OOXMLShapes::sptMin;
...@@ -507,7 +507,7 @@ public: ...@@ -507,7 +507,7 @@ public:
LoadPathList(m_strPath); LoadPathList(m_strPath);
} }
static CPPTXShape* CreateByType(OOXMLShapes::ShapeType type); static CBaseShapePtr CreateByType(OOXMLShapes::ShapeType type);
virtual const ClassType GetClassType()const virtual const ClassType GetClassType()const
{ {
...@@ -540,13 +540,12 @@ public: ...@@ -540,13 +540,12 @@ public:
bool SetShapeType(OOXMLShapes::ShapeType type) bool SetShapeType(OOXMLShapes::ShapeType type)
{ {
CPPTXShape* l_pShape = CreateByType(type); CBaseShapePtr pShape = CreateByType(type);
if(l_pShape != NULL) if(pShape)
{ {
m_eType = type; m_eType = type;
SetProperties(l_pShape); SetProperties(pShape.get());
delete l_pShape;
return true; return true;
} }
......
...@@ -49,10 +49,13 @@ const LONG c_ShapeDrawType_Graphic = 0x01; ...@@ -49,10 +49,13 @@ const LONG c_ShapeDrawType_Graphic = 0x01;
const LONG c_ShapeDrawType_Text = 0x02; const LONG c_ShapeDrawType_Text = 0x02;
const LONG c_ShapeDrawType_All = c_ShapeDrawType_Graphic | c_ShapeDrawType_Text; const LONG c_ShapeDrawType_All = c_ShapeDrawType_Graphic | c_ShapeDrawType_Text;
class CShape;
typedef boost::shared_ptr<CShape> CShapePtr;
class CShape class CShape
{ {
private: private:
CBaseShape* m_pShape; CBaseShapePtr m_pShape;
public: public:
double m_dStartTime; double m_dStartTime;
double m_dEndTime; double m_dEndTime;
...@@ -103,15 +106,11 @@ public: ...@@ -103,15 +106,11 @@ public:
m_dTextMarginRight = 0; m_dTextMarginRight = 0;
m_dTextMarginBottom = 0; m_dTextMarginBottom = 0;
m_strPPTXShape = _T("");
m_pShape = NULL;
m_classType = classType; m_classType = classType;
if (m_classType == NSBaseShape::pptx) if (m_classType == NSBaseShape::pptx)
{ {
m_pShape = new CPPTXShape(); m_pShape = CBaseShapePtr(new CPPTXShape());
m_pShape->SetType(NSBaseShape::pptx, ShapeType_); m_pShape->SetType(NSBaseShape::pptx, ShapeType_);
} }
else if (m_classType == NSBaseShape::ppt) else if (m_classType == NSBaseShape::ppt)
...@@ -119,7 +118,7 @@ public: ...@@ -119,7 +118,7 @@ public:
m_pShape = CPPTShape::CreateByType((PPTShapes::ShapeType)ShapeType_ ); m_pShape = CPPTShape::CreateByType((PPTShapes::ShapeType)ShapeType_ );
if (m_pShape == NULL) if (m_pShape == NULL)
{ {
m_pShape = new CPPTShape(); m_pShape = CBaseShapePtr(new CPPTShape());
m_pShape->SetType(NSBaseShape::ppt, ShapeType_); m_pShape->SetType(NSBaseShape::ppt, ShapeType_);
} }
...@@ -135,20 +134,17 @@ public: ...@@ -135,20 +134,17 @@ public:
~CShape() ~CShape()
{ {
RELEASEOBJECT(m_pShape);
} }
CBaseShape* getBaseShape() CBaseShapePtr getBaseShape()
{ {
return m_pShape; return m_pShape;
} }
void setBaseShape(CBaseShape* pShape) void setBaseShape(CBaseShapePtr pShape)
{ {
if (pShape == NULL) return; CPPTXShape *pptxShape = dynamic_cast<CPPTXShape*>(pShape.get());
CPPTShape *pptShape = dynamic_cast<CPPTShape*>(pShape.get());
CPPTXShape *pptxShape = dynamic_cast<CPPTXShape*>(pShape);
CPPTShape *pptShape = dynamic_cast<CPPTShape*>(pShape);
if (pptxShape) m_classType = NSBaseShape::pptx; if (pptxShape) m_classType = NSBaseShape::pptx;
if (pptShape) m_classType = NSBaseShape::ppt; if (pptShape) m_classType = NSBaseShape::ppt;
...@@ -180,7 +176,7 @@ public: ...@@ -180,7 +176,7 @@ public:
if (NSBaseShape::ppt == m_pShape->GetClassType()) if (NSBaseShape::ppt == m_pShape->GetClassType())
{ {
// как будто могло быть иначе // как будто могло быть иначе
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape); CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape.get());
if (NULL != pPPTShape) if (NULL != pPPTShape)
{ {
pPPTShape->CalcTextRectOffsets(dPercentLeft, dPercentTop, dPercentRight, dPercentBottom); pPPTShape->CalcTextRectOffsets(dPercentLeft, dPercentTop, dPercentRight, dPercentBottom);
...@@ -251,7 +247,7 @@ public: ...@@ -251,7 +247,7 @@ public:
if ((m_pShape) && (NSBaseShape::ppt == m_pShape->GetClassType())) if ((m_pShape) && (NSBaseShape::ppt == m_pShape->GetClassType()))
{ {
// как будто могло быть иначе // как будто могло быть иначе
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape); CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape.get());
if (NULL != pPPTShape) if (NULL != pPPTShape)
{ {
//pPPTShape->CalcTextRectOffsets(dPercentLeft, dPercentTop, dPercentRight, dPercentBottom); //pPPTShape->CalcTextRectOffsets(dPercentLeft, dPercentTop, dPercentRight, dPercentBottom);
...@@ -338,23 +334,23 @@ public: ...@@ -338,23 +334,23 @@ public:
{ {
if(_T("ooxml-shape") == root.GetName()) if(_T("ooxml-shape") == root.GetName())
{ {
if(m_pShape != NULL) m_pShape = CBaseShapePtr(new CPPTXShape());
delete m_pShape;
m_pShape = new CPPTXShape(); CPPTXShape* pptx_shape = dynamic_cast<CPPTXShape*>(m_pShape.get());
//return m_pShape->LoadFromXML(xml);
return ((CPPTXShape*)m_pShape)->LoadFromXML(root); return pptx_shape ? pptx_shape->LoadFromXML(root) : false;
} }
else if(_T("shape") == root.GetName()) else if(_T("shape") == root.GetName())
{ {
if(m_pShape != NULL) m_pShape = CBaseShapePtr(new CPPTShape());
delete m_pShape;
m_pShape = new CPPTShape();
SetCoordSize(root); SetCoordSize(root);
SetPen (root); SetPen (root);
SetBrush (root); SetBrush (root);
return ((CPPTShape*)m_pShape)->LoadFromXML(root); CPPTShape* ppt_shape = dynamic_cast<CPPTShape*>(m_pShape.get());
return ppt_shape ? ppt_shape->LoadFromXML(root) : false;
} }
return false; return false;
...@@ -386,7 +382,7 @@ public: ...@@ -386,7 +382,7 @@ public:
Shape->m_dTextMarginBottom = m_dTextMarginBottom; Shape->m_dTextMarginBottom = m_dTextMarginBottom;
if (m_pShape) if (m_pShape)
return m_pShape->SetToDublicate(Shape->m_pShape); return m_pShape->SetToDublicate(Shape->m_pShape.get());
return true; return true;
} }
......
...@@ -44,7 +44,7 @@ namespace NSPresentationEditor ...@@ -44,7 +44,7 @@ namespace NSPresentationEditor
LONG m_lSlideID; //for notes rels LONG m_lSlideID; //for notes rels
LONG m_lNotesID; //for slide rels LONG m_lNotesID; //for slide rels
std::vector<IElement*> m_arElements; std::vector<CElementPtr>m_arElements;
CSlideShowInfo m_oSlideShow; CSlideShowInfo m_oSlideShow;
std::multimap<int,int> m_mapPlaceholders; std::multimap<int,int> m_mapPlaceholders;
...@@ -73,7 +73,7 @@ namespace NSPresentationEditor ...@@ -73,7 +73,7 @@ namespace NSPresentationEditor
std::wstring m_strComment; std::wstring m_strComment;
std::wstring m_sName; std::wstring m_sName;
CSlide() : m_arElements(), m_oSlideShow() CSlide() : m_oSlideShow()
{ {
Clear(); Clear();
} }
...@@ -84,11 +84,6 @@ namespace NSPresentationEditor ...@@ -84,11 +84,6 @@ namespace NSPresentationEditor
void Clear() void Clear()
{ {
for (size_t nIndex = 0; nIndex < m_arElements.size(); ++nIndex)
{
IElement* pElem = m_arElements[nIndex];
RELEASEINTERFACE(pElem);
}
m_arColorScheme.clear(); m_arColorScheme.clear();
m_arElements.clear(); m_arElements.clear();
...@@ -111,7 +106,8 @@ namespace NSPresentationEditor ...@@ -111,7 +106,8 @@ namespace NSPresentationEditor
m_strComment.clear(); m_strComment.clear();
m_sName.clear(); m_sName.clear();
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i].clear(); for (int i = 0 ; i < 3 ; i++)
m_PlaceholdersReplaceString[i].clear();
} }
CSlide(const CSlide& oSrc) CSlide(const CSlide& oSrc)
...@@ -171,7 +167,7 @@ namespace NSPresentationEditor ...@@ -171,7 +167,7 @@ namespace NSPresentationEditor
{ {
if (-1 != m_arElements[nEl]->m_lPlaceholderType && etShape == m_arElements[nEl]->m_etType) if (-1 != m_arElements[nEl]->m_lPlaceholderType && etShape == m_arElements[nEl]->m_etType)
{ {
CShapeElement* pSlideElement = dynamic_cast<CShapeElement*>(m_arElements[nEl]); CShapeElement* pSlideElement = dynamic_cast<CShapeElement*>(m_arElements[nEl].get());
if (NULL != pSlideElement) if (NULL != pSlideElement)
{ {
...@@ -185,10 +181,10 @@ namespace NSPresentationEditor ...@@ -185,10 +181,10 @@ namespace NSPresentationEditor
if ((pLayout->m_arElements[i]->m_lPlaceholderType == pSlideElement->m_lPlaceholderType) && if ((pLayout->m_arElements[i]->m_lPlaceholderType == pSlideElement->m_lPlaceholderType) &&
(pLayout->m_arElements[i]->m_etType == etShape)) (pLayout->m_arElements[i]->m_etType == etShape))
{ {
CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i]); CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i].get());
if (NULL != pLayoutElement) if (NULL != pLayoutElement)
{ {
pSlideElement->m_oShape.m_oText.m_oLayoutStyles = pLayoutElement->m_oShape.m_oText.m_oStyles; pSlideElement->m_pShape->m_oText.m_oLayoutStyles = pLayoutElement->m_pShape->m_oText.m_oStyles;
} }
} }
} }
...@@ -198,10 +194,10 @@ namespace NSPresentationEditor ...@@ -198,10 +194,10 @@ namespace NSPresentationEditor
(pLayout->m_arElements[i]->m_lPlaceholderID == pSlideElement->m_lPlaceholderID) && (pLayout->m_arElements[i]->m_lPlaceholderID == pSlideElement->m_lPlaceholderID) &&
(pLayout->m_arElements[i]->m_etType == etShape)) (pLayout->m_arElements[i]->m_etType == etShape))
{ {
CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i]); CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i].get());
if (NULL != pLayoutElement) if (NULL != pLayoutElement)
{ {
pSlideElement->m_oShape.m_oText.m_oLayoutStyles = pLayoutElement->m_oShape.m_oText.m_oStyles; pSlideElement->m_pShape->m_oText.m_oLayoutStyles = pLayoutElement->m_pShape->m_oText.m_oStyles;
} }
} }
} }
......
...@@ -57,7 +57,7 @@ namespace NSPresentationEditor ...@@ -57,7 +57,7 @@ namespace NSPresentationEditor
bool m_bIsBackground; bool m_bIsBackground;
CBrush m_oBackground; CBrush m_oBackground;
std::vector<IElement*> m_arElements; std::vector<CElementPtr> m_arElements;
CMetricInfo m_oInfo; CMetricInfo m_oInfo;
...@@ -133,11 +133,6 @@ namespace NSPresentationEditor ...@@ -133,11 +133,6 @@ namespace NSPresentationEditor
m_arElements = oSrc.m_arElements; m_arElements = oSrc.m_arElements;
nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
ADDREFINTERFACE((m_arElements[nIndex]));
}
CreateDublicateElements(); CreateDublicateElements();
for (long nIndexStyle = 0; nIndexStyle < g_ThemeTextStylesCount; ++nIndexStyle) for (long nIndexStyle = 0; nIndexStyle < g_ThemeTextStylesCount; ++nIndexStyle)
...@@ -154,23 +149,16 @@ namespace NSPresentationEditor ...@@ -154,23 +149,16 @@ namespace NSPresentationEditor
size_t nCount = m_arElements.size(); size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex) for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{ {
IElement* pElem = m_arElements[nIndex]; CElementPtr pElem = m_arElements[nIndex];
if (NULL != pElem) if (NULL != pElem)
{ {
m_arElements[nIndex] = pElem->CreateDublicate(); m_arElements[nIndex] = pElem->CreateDublicate();
} }
RELEASEINTERFACE(pElem);
} }
} }
void Clear() void Clear()
{ {
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
RELEASEINTERFACE((m_arElements[nIndex]));
}
m_arElements.clear(); m_arElements.clear();
m_arLayouts.clear(); m_arLayouts.clear();
m_mapTitleLayout.clear(); m_mapTitleLayout.clear();
...@@ -186,15 +174,13 @@ namespace NSPresentationEditor ...@@ -186,15 +174,13 @@ namespace NSPresentationEditor
m_bHasFooter = false; m_bHasFooter = false;
m_nFormatDate = 1; m_nFormatDate = 1;
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i].clear(); for (int i = 0 ; i < 3 ; i++)
m_PlaceholdersReplaceString[i].clear();
} }
~CTheme() ~CTheme()
{ {
} }
public:
NSPresentationEditor::CColor GetColor(const LONG& lIndexScheme) NSPresentationEditor::CColor GetColor(const LONG& lIndexScheme)
{ {
if (lIndexScheme < (LONG)m_arColorScheme.size()) if (lIndexScheme < (LONG)m_arColorScheme.size())
......
...@@ -54,7 +54,7 @@ namespace PPTX ...@@ -54,7 +54,7 @@ namespace PPTX
lpShapeElement = new NSPresentationEditor::CShapeElement(NSBaseShape::pptx, (int)_lspt); lpShapeElement = new NSPresentationEditor::CShapeElement(NSBaseShape::pptx, (int)_lspt);
std::wstring strAdjustValues = lpGeom.GetODString(); std::wstring strAdjustValues = lpGeom.GetODString();
lpShapeElement->m_oShape.getBaseShape()->LoadAdjustValuesList(strAdjustValues); lpShapeElement->m_pShape->getBaseShape()->LoadAdjustValuesList(strAdjustValues);
} }
else if (this->is<PPTX::Logic::CustGeom>()) else if (this->is<PPTX::Logic::CustGeom>())
{ {
...@@ -71,8 +71,8 @@ namespace PPTX ...@@ -71,8 +71,8 @@ namespace PPTX
LONG lCoordSize = 100000; LONG lCoordSize = 100000;
lpShapeElement->m_oShape.getBaseShape()->SetWidthHeightLogic(dCoordSizeX, dCoordSizeY); lpShapeElement->m_pShape->getBaseShape()->SetWidthHeightLogic(dCoordSizeX, dCoordSizeY);
lpShapeElement->m_oShape.getBaseShape()->ReCalculate(); lpShapeElement->m_pShape->getBaseShape()->ReCalculate();
pOOXToVMLRenderer->put_Width((double)lCoordSize / dCoordSizeX); pOOXToVMLRenderer->put_Width((double)lCoordSize / dCoordSizeX);
pOOXToVMLRenderer->put_Height((double)lCoordSize / dCoordSizeY); pOOXToVMLRenderer->put_Height((double)lCoordSize / dCoordSizeY);
...@@ -85,7 +85,7 @@ namespace PPTX ...@@ -85,7 +85,7 @@ namespace PPTX
oInfo.m_dWidth = dCoordSizeX; oInfo.m_dWidth = dCoordSizeX;
oInfo.m_dHeight = dCoordSizeY; oInfo.m_dHeight = dCoordSizeY;
NSPresentationEditor::CPath& oPath = lpShapeElement->m_oShape.getBaseShape()->m_oPath; NSPresentationEditor::CPath& oPath = lpShapeElement->m_pShape->getBaseShape()->m_oPath;
COOXToVMLGeometry* pOOXToVMLGeometry = dynamic_cast<COOXToVMLGeometry*>(pOOXToVMLRenderer); COOXToVMLGeometry* pOOXToVMLGeometry = dynamic_cast<COOXToVMLGeometry*>(pOOXToVMLRenderer);
...@@ -111,19 +111,19 @@ namespace PPTX ...@@ -111,19 +111,19 @@ namespace PPTX
if(NULL != pOOXToVMLGeometry) if(NULL != pOOXToVMLGeometry)
pOOXToVMLGeometry->ResultPath(&strPath); pOOXToVMLGeometry->ResultPath(&strPath);
if (lpShapeElement->m_oShape.getBaseShape()->m_arTextRects.size() <= 0) if (lpShapeElement->m_pShape->getBaseShape()->m_arTextRects.size() <= 0)
{ {
strRect = _T("0,0,100000,100000"); strRect = _T("0,0,100000,100000");
} }
else else
{ {
Aggplus::RECT& txRect = lpShapeElement->m_oShape.getBaseShape()->m_arTextRects[0]; Aggplus::RECT& txRect = lpShapeElement->m_pShape->getBaseShape()->m_arTextRects[0];
//double dkoefX = (double)lCoordSize / max(1, dCoordSizeX); //double dkoefX = (double)lCoordSize / max(1, dCoordSizeX);
//double dkoefY = (double)lCoordSize / max(1, dCoordSizeY); //double dkoefY = (double)lCoordSize / max(1, dCoordSizeY);
double _dWidth = ShapeSize; double _dWidth = ShapeSize;
double _dHeight = ShapeSize; double _dHeight = ShapeSize;
lpShapeElement->m_oShape.getBaseShape()->GetWidthHeightLogic(_dWidth, _dHeight); lpShapeElement->m_pShape->getBaseShape()->GetWidthHeightLogic(_dWidth, _dHeight);
double dkoefX = (double)lCoordSize / (std::max)(1., _dWidth); double dkoefX = (double)lCoordSize / (std::max)(1., _dWidth);
double dkoefY = (double)lCoordSize / (std::max)(1., _dHeight); double dkoefY = (double)lCoordSize / (std::max)(1., _dHeight);
......
...@@ -233,7 +233,7 @@ namespace PPTX ...@@ -233,7 +233,7 @@ namespace PPTX
} }
NSDirectory::DeleteDirectory(oox_unpacked.GetPath()); NSDirectory::DeleteDirectory(oox_unpacked.GetPath());
} }
else if ( L"Equation.3" == sProgID || L"Equation.2" == sProgID ) else if ( std::wstring::npos != sProgID.find(L"Equation"))
{ {
pWriter->StartRecord(1); pWriter->StartRecord(1);
pWriter->WriteBYTE(4); pWriter->WriteBYTE(4);
......
...@@ -49,6 +49,7 @@ global_info_(global_info) ...@@ -49,6 +49,7 @@ global_info_(global_info)
skippable_records_names.push_back("StartBlock"); skippable_records_names.push_back("StartBlock");
skippable_records_names.push_back("EndBlock"); skippable_records_names.push_back("EndBlock");
skippable_records_names.push_back("ChartFrtInfo"); skippable_records_names.push_back("ChartFrtInfo");
skippable_records_names.push_back("FrtWrapper");
} }
...@@ -100,7 +101,7 @@ CFRecordPtr CFStreamCacheReader::getNextRecord(const CFRecordType::TypeId desira ...@@ -100,7 +101,7 @@ CFRecordPtr CFStreamCacheReader::getNextRecord(const CFRecordType::TypeId desira
} }
if(skippable_records_names.end() != std::find(skippable_records_names.begin(), skippable_records_names.end(), rec_name)) if(skippable_records_names.end() != std::find(skippable_records_names.begin(), skippable_records_names.end(), rec_name))
{ {
Log::warning("The extracted record has been skipped (" + rec_name + ")"); //Log::warning("The extracted record has been skipped (" + rec_name + ")");
records_cache.pop_front(); records_cache.pop_front();
continue; continue;
} }
......
...@@ -55,7 +55,10 @@ void DefColWidth::readFields(CFRecord& record) ...@@ -55,7 +55,10 @@ void DefColWidth::readFields(CFRecord& record)
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo(); GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
record >> cchdefColWidth; record >> cchdefColWidth;
global_info->sheet_size_info.back().defaultColumnWidth = cchdefColWidth ; if (!global_info->sheet_size_info.empty())
{
global_info->sheet_size_info.back().defaultColumnWidth = cchdefColWidth ;
}
} }
} // namespace XLS } // namespace XLS
......
...@@ -65,7 +65,10 @@ void DefaultRowHeight::readFields(CFRecord& record) ...@@ -65,7 +65,10 @@ void DefaultRowHeight::readFields(CFRecord& record)
record >> miyRw; record >> miyRw;
global_info->sheet_size_info.back().defaultRowHeight = miyRw / 20.; if (!global_info->sheet_size_info.empty())
{
global_info->sheet_size_info.back().defaultRowHeight = miyRw / 20.;
}
} }
......
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
*/ */
#include "AI.h" #include "AI.h"
#include <Logic/Biff_records/BRAI.h> #include "../Biff_records/BRAI.h"
#include <Logic/Biff_records/SeriesText.h> #include "../Biff_records/SeriesText.h"
//#include <Logic/Biff_unions/PAGESETUP.h>
namespace XLS namespace XLS
{ {
......
...@@ -31,23 +31,22 @@ ...@@ -31,23 +31,22 @@
*/ */
#include "ATTACHEDLABEL.h" #include "ATTACHEDLABEL.h"
#include <Logic/Biff_records/Text.h> #include "AI.h"
#include <Logic/Biff_records/Begin.h> #include "FRAME.h"
#include <Logic/Biff_records/Pos.h> #include "TEXTPROPS.h"
#include <Logic/Biff_records/FontX.h> #include "CRTMLFRT.h"
#include <Logic/Biff_records/AlRuns.h>
#include <Logic/Biff_records/ObjectLink.h> #include "../Biff_records/Text.h"
#include <Logic/Biff_records/DataLabExtContents.h> #include "../Biff_records/Begin.h"
#include <Logic/Biff_records/CrtLayout12.h> #include "../Biff_records/Pos.h"
#include <Logic/Biff_records/End.h> #include "../Biff_records/FontX.h"
#include <Logic/Biff_records/SeriesText.h> #include "../Biff_records/AlRuns.h"
#include <Logic/Biff_records/Font.h> #include "../Biff_records/ObjectLink.h"
#include <Logic/Biff_records/FrtWrapper.h> #include "../Biff_records/DataLabExtContents.h"
#include "../Biff_records/CrtLayout12.h"
#include <Logic/Biff_unions/AI.h> #include "../Biff_records/End.h"
#include <Logic/Biff_unions/FRAME.h> #include "../Biff_records/SeriesText.h"
#include <Logic/Biff_unions/TEXTPROPS.h> #include "../Biff_records/Font.h"
#include <Logic/Biff_unions/CRTMLFRT.h>
#include <utils.h> #include <utils.h>
...@@ -149,7 +148,7 @@ const bool ATTACHEDLABEL::loadContent(BinProcessor& proc) ...@@ -149,7 +148,7 @@ const bool ATTACHEDLABEL::loadContent(BinProcessor& proc)
} }
proc.optional<CRTMLFRT>(); proc.optional<CRTMLFRT>();
proc.optional<FrtWrapper>();
proc.mandatory<End>(); elements_.pop_back(); proc.mandatory<End>(); elements_.pop_back();
return true; return true;
......
...@@ -69,7 +69,7 @@ const bool AXISPARENT::loadContent(BinProcessor& proc) ...@@ -69,7 +69,7 @@ const bool AXISPARENT::loadContent(BinProcessor& proc)
m_AxisParent = elements_.back(); m_AxisParent = elements_.back();
elements_.pop_back(); elements_.pop_back();
proc.mandatory<Begin>(); elements_.pop_back(); if (proc.optional<Begin>()) elements_.pop_back();
if (proc.optional<Pos>()) if (proc.optional<Pos>())
{ {
...@@ -93,7 +93,7 @@ const bool AXISPARENT::loadContent(BinProcessor& proc) ...@@ -93,7 +93,7 @@ const bool AXISPARENT::loadContent(BinProcessor& proc)
count--; count--;
} }
if (proc.mandatory<End>()) elements_.pop_back(); if (proc.optional<End>()) elements_.pop_back();
return true; return true;
} }
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
*/ */
#include "AXM.h" #include "AXM.h"
#include <Logic/Biff_records/YMult.h> #include "ATTACHEDLABEL.h"
#include <Logic/Biff_records/StartObject.h>
#include <Logic/Biff_unions/ATTACHEDLABEL.h> #include "../Biff_records/YMult.h"
#include <Logic/Biff_records/EndObject.h> #include "../Biff_records/StartObject.h"
#include <Logic/Biff_records/FrtWrapper.h> #include "../Biff_records/EndObject.h"
namespace XLS namespace XLS
{ {
...@@ -68,7 +68,6 @@ const bool AXM::loadContent(BinProcessor& proc) ...@@ -68,7 +68,6 @@ const bool AXM::loadContent(BinProcessor& proc)
if (proc.optional<StartObject>()) elements_.pop_back(); if (proc.optional<StartObject>()) elements_.pop_back();
int count = proc.repeated<FrtWrapper>(0,0);
if (proc.optional<ATTACHEDLABEL>()) if (proc.optional<ATTACHEDLABEL>())
{ {
m_ATTACHEDLABEL = elements_.back(); elements_.pop_back(); m_ATTACHEDLABEL = elements_.back(); elements_.pop_back();
......
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
#include "../Biff_records/EndObject.h" #include "../Biff_records/EndObject.h"
#include "../Biff_records/End.h" #include "../Biff_records/End.h"
#include "../Biff_records/ObjectLink.h" #include "../Biff_records/ObjectLink.h"
#include "../Biff_records/FrtWrapper.h"
#include "../Biff_records/TextPropsStream.h" #include "../Biff_records/TextPropsStream.h"
#include "../Biff_records/FrtFontList.h"
namespace XLS namespace XLS
{ {
...@@ -86,7 +86,10 @@ public: ...@@ -86,7 +86,10 @@ public:
const bool loadContent(BinProcessor& proc) const bool loadContent(BinProcessor& proc)
{ {
if(proc.optional<DataLabExt>()) bool bData = proc.optional<DataLabExt>();
bool bFont = proc.optional<FrtFontList>();
if(bFont || bData)
{ {
while (true) while (true)
{ {
...@@ -254,11 +257,8 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc) ...@@ -254,11 +257,8 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc)
cf.attachedLABEL = NULL; cf.attachedLABEL = NULL;
} }
cf.dataLabExt = elements_.front(); cf.dataLabExt = elements_.front();
elements_.pop_front();
count--;
continue;
} }
if ("ATTACHEDLABEL" == elements_.front()->getClassName()) else if ("ATTACHEDLABEL" == elements_.front()->getClassName())
{//обязат {//обязат
if (cf.attachedLABEL) if (cf.attachedLABEL)
{ {
...@@ -266,10 +266,12 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc) ...@@ -266,10 +266,12 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc)
cf.dataLabExt = NULL; cf.dataLabExt = NULL;
} }
cf.attachedLABEL = elements_.front(); cf.attachedLABEL = elements_.front();
elements_.pop_front();
count--;
continue;
} }
else
{
}
elements_.pop_front();
count--;
} }
if (proc.optional<TEXTPROPS>()) if (proc.optional<TEXTPROPS>())
{ {
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of COLUMNS union of records
class COLUMNS: public CompositeObject class COLUMNS: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(COLUMNS) BASE_OBJECT_DEFINE_CLASS_NAME(COLUMNS)
...@@ -51,7 +49,7 @@ public: ...@@ -51,7 +49,7 @@ public:
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
static const ElementType type = typeCOLUMNS; static const ElementType type = typeCOLUMNS;
BaseObjectPtr m_DefColWidth; BaseObjectPtr m_DefColWidth;
......
...@@ -31,43 +31,43 @@ ...@@ -31,43 +31,43 @@
*/ */
#include "CRT.h" #include "CRT.h"
#include <Logic/Biff_records/ChartFormat.h> #include "../Biff_records/ChartFormat.h"
#include <Logic/Biff_records/Begin.h> #include "../Biff_records/Begin.h"
#include <Logic/Biff_records/Bar.h> #include "../Biff_records/Bar.h"
#include <Logic/Biff_records/Line.h> #include "../Biff_records/Line.h"
#include <Logic/Biff_records/BopPop.h> #include "../Biff_records/BopPop.h"
#include <Logic/Biff_records/BopPopCustom.h> #include "../Biff_records/BopPopCustom.h"
#include <Logic/Biff_records/Pie.h> #include "../Biff_records/Pie.h"
#include <Logic/Biff_records/Area.h> #include "../Biff_records/Area.h"
#include <Logic/Biff_records/Scatter.h> #include "../Biff_records/Scatter.h"
#include <Logic/Biff_records/Radar.h> #include "../Biff_records/Radar.h"
#include <Logic/Biff_records/RadarArea.h> #include "../Biff_records/RadarArea.h"
#include <Logic/Biff_records/Surf.h> #include "../Biff_records/Surf.h"
#include <Logic/Biff_records/CrtLink.h> #include "../Biff_records/CrtLink.h"
#include <Logic/Biff_records/SeriesList.h> #include "../Biff_records/SeriesList.h"
#include <Logic/Biff_records/Chart3d.h> #include "../Biff_records/Chart3d.h"
#include <Logic/Biff_unions/LD.h> #include "../Biff_unions/LD.h"
#include <Logic/Biff_unions/DROPBAR.h> #include "../Biff_unions/DROPBAR.h"
#include <Logic/Biff_records/CrtLine.h> #include "../Biff_records/CrtLine.h"
#include <Logic/Biff_records/LineFormat.h> #include "../Biff_records/LineFormat.h"
#include <Logic/Biff_unions/DFTTEXT.h> #include "../Biff_unions/DFTTEXT.h"
#include <Logic/Biff_records/DataLabExtContents.h> #include "../Biff_records/DataLabExtContents.h"
#include <Logic/Biff_unions/SS.h> #include "../Biff_unions/SS.h"
#include <Logic/Biff_unions/SHAPEPROPS.h> #include "../Biff_unions/SHAPEPROPS.h"
#include <Logic/Biff_records/End.h> #include "../Biff_records/End.h"
#include <Logic/Biff_records/ValueRange.h> #include "../Biff_records/ValueRange.h"
#include <Logic/Biff_records/Tick.h> #include "../Biff_records/Tick.h"
#include <Logic/Biff_records/FontX.h> #include "../Biff_records/FontX.h"
#include <Logic/Biff_records/AxisLine.h> #include "../Biff_records/AxisLine.h"
#include <Logic/Biff_records/LineFormat.h> #include "../Biff_records/LineFormat.h"
#include <Logic/Biff_records/ShapePropsStream.h> #include "../Biff_records/ShapePropsStream.h"
#include <Logic/Biff_records/TextPropsStream.h> #include "../Biff_records/TextPropsStream.h"
#include <Logic/Biff_records/PlotArea.h> #include "../Biff_records/PlotArea.h"
#include <Logic/Biff_records/DropBar.h> #include "../Biff_records/DropBar.h"
#include <Logic/Biff_records/CrtMlFrt.h> #include "../Biff_records/CrtMlFrt.h"
#include <Logic/Biff_records/StartObject.h> #include "../Biff_records/StartObject.h"
#include <Logic/Biff_records/EndObject.h> #include "../Biff_records/EndObject.h"
namespace XLS namespace XLS
{ {
...@@ -176,7 +176,8 @@ const bool CRT::loadContent(BinProcessor& proc) ...@@ -176,7 +176,8 @@ const bool CRT::loadContent(BinProcessor& proc)
m_ChartFormat = elements_.back(); m_ChartFormat = elements_.back();
elements_.pop_back(); elements_.pop_back();
proc.mandatory<Begin>(); elements_.pop_back(); if (proc.optional<Begin>()) elements_.pop_back();
proc.mandatory<Parenthesis_CRT_1>(); proc.mandatory<Parenthesis_CRT_1>();
m_ChartType = elements_.front(); m_ChartType = elements_.front();
...@@ -196,7 +197,9 @@ const bool CRT::loadContent(BinProcessor& proc) ...@@ -196,7 +197,9 @@ const bool CRT::loadContent(BinProcessor& proc)
} }
if (proc.optional<StartObject>()) if (proc.optional<StartObject>())
{ {
proc.optional<EndObject>(); elements_.pop_back();
if (proc.optional<EndObject>())
elements_.pop_back();
} }
if (proc.optional<SeriesList>()) if (proc.optional<SeriesList>())
{ {
...@@ -252,6 +255,7 @@ const bool CRT::loadContent(BinProcessor& proc) ...@@ -252,6 +255,7 @@ const bool CRT::loadContent(BinProcessor& proc)
m_DataLabExtContents = elements_.back(); m_DataLabExtContents = elements_.back();
elements_.pop_back(); elements_.pop_back();
} }
if (proc.optional<SS>()) if (proc.optional<SS>())
{ {
m_SS = elements_.back(); m_SS = elements_.back();
...@@ -268,7 +272,7 @@ const bool CRT::loadContent(BinProcessor& proc) ...@@ -268,7 +272,7 @@ const bool CRT::loadContent(BinProcessor& proc)
elements_.pop_back(); elements_.pop_back();
} }
proc.mandatory<End>(); elements_.pop_back(); if (proc.optional<End>()) elements_.pop_back();
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
m_bIs3D = false; m_bIs3D = false;
if (m_Chart3d) if (m_Chart3d)
......
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
*/ */
#include "DFTTEXT.h" #include "DFTTEXT.h"
#include <Logic/Biff_records/DataLabExt.h> #include "ATTACHEDLABEL.h"
#include <Logic/Biff_records/StartObject.h>
#include <Logic/Biff_records/DefaultText.h>
#include <Logic/Biff_records/EndObject.h>
#include <Logic/Biff_unions/ATTACHEDLABEL.h> #include "../Biff_records/DataLabExt.h"
#include "../Biff_records/DataLabExtContents.h"
#include "../Biff_records/StartObject.h"
#include "../Biff_records/DefaultText.h"
#include "../Biff_records/EndObject.h"
namespace XLS namespace XLS
{ {
...@@ -66,30 +67,32 @@ const bool DFTTEXT::loadContent(BinProcessor& proc) ...@@ -66,30 +67,32 @@ const bool DFTTEXT::loadContent(BinProcessor& proc)
m_DataLabExt = elements_.back(); m_DataLabExt = elements_.back();
elements_.pop_back(); elements_.pop_back();
proc.mandatory<StartObject>(); elements_.pop_back(); if (proc.optional<StartObject>()) elements_.pop_back();
proc.mandatory<DefaultText>(); }
if(proc.mandatory<DefaultText>())
{
m_DefaultText = elements_.back(); m_DefaultText = elements_.back();
elements_.pop_back(); elements_.pop_back();
} }
else if (proc.optional<DataLabExtContents>())
{ {
if(!proc.mandatory<DefaultText>()) m_DataLabExtContents = elements_.back();
{ elements_.pop_back();
return false; }
} if (proc.mandatory<ATTACHEDLABEL>())
m_DefaultText = elements_.back(); {
m_ATTACHEDLABEL = elements_.back();
elements_.pop_back(); elements_.pop_back();
} }
proc.mandatory<ATTACHEDLABEL>();
m_ATTACHEDLABEL = elements_.back();
elements_.pop_back();
if (proc.optional<EndObject>()) elements_.pop_back(); if (proc.optional<EndObject>()) elements_.pop_back();
return true; if (m_DefaultText || m_DataLabExtContents)
return true;
else
return false;
} }
} // namespace XLS } // namespace XLS
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of DFTTEXT union of records
class DFTTEXT: public CompositeObject class DFTTEXT: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(DFTTEXT) BASE_OBJECT_DEFINE_CLASS_NAME(DFTTEXT)
...@@ -49,9 +47,11 @@ public: ...@@ -49,9 +47,11 @@ public:
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeDFTTEXT; static const ElementType type = typeDFTTEXT;
BaseObjectPtr m_DefaultText; BaseObjectPtr m_DefaultText;
BaseObjectPtr m_DataLabExtContents;
BaseObjectPtr m_ATTACHEDLABEL; BaseObjectPtr m_ATTACHEDLABEL;
BaseObjectPtr m_DataLabExt; BaseObjectPtr m_DataLabExt;
}; };
......
...@@ -31,12 +31,11 @@ ...@@ -31,12 +31,11 @@
*/ */
#include "FONTLIST.h" #include "FONTLIST.h"
#include <Logic/Biff_records/FrtFontList.h> #include "../Biff_records/FrtFontList.h"
#include <Logic/Biff_records/StartObject.h> #include "../Biff_records/StartObject.h"
#include <Logic/Biff_records/Font.h> #include "../Biff_records/Font.h"
#include <Logic/Biff_records/Fbi.h> #include "../Biff_records/Fbi.h"
#include <Logic/Biff_records/EndObject.h> #include "../Biff_records/EndObject.h"
#include <Logic/Biff_records/FrtWrapper.h>
namespace XLS namespace XLS
{ {
...@@ -88,9 +87,9 @@ const bool FONTLIST::loadContent(BinProcessor& proc) ...@@ -88,9 +87,9 @@ const bool FONTLIST::loadContent(BinProcessor& proc)
return false; return false;
} }
proc.mandatory<StartObject>(); elements_.pop_back(); proc.mandatory<StartObject>(); elements_.pop_back();
proc.repeated<Parenthesis_FONTLIST_1>(0, 0); proc.repeated<Parenthesis_FONTLIST_1>(0, 0);
proc.optional<FrtWrapper>();
proc.mandatory<EndObject>(); elements_.pop_back(); proc.mandatory<EndObject>(); elements_.pop_back();
return true; return true;
......
...@@ -38,7 +38,7 @@ namespace XLS ...@@ -38,7 +38,7 @@ namespace XLS
{ {
PIVOTADDL::PIVOTADDL() : current( &content) PIVOTADDL::PIVOTADDL() : current( &content), m_SXADDLCONDFMTS(NULL, -1), m_SXADDLSXFILTERS12(NULL, -1)
{ {
_sxAddl elm(NULL, 0); _sxAddl elm(NULL, 0);
current->push_back(elm); current->push_back(elm);
...@@ -94,38 +94,51 @@ const bool PIVOTADDL::loadContent(BinProcessor& proc) ...@@ -94,38 +94,51 @@ const bool PIVOTADDL::loadContent(BinProcessor& proc)
result = true; result = true;
if (addl->bEndElement) if (level == 0 && addl->bEndElement)
{ {
elements_.pop_back(); elements_.pop_back(); //end элемент не нужен в дальнейшем
break;
}
else if (addl->bEndElement)
{
level--;
std::vector<_sxAddl> *current_old = current;
_sxAddl & current_level = current->back();
current = current_level.prev;
current_level.prev = NULL;
if (level == 0) if (level == 0)
break; {
else level--; switch(addl->sxc)
{
case 0x01:
case 0x17:
m_arSXADDLFIELD.push_back(current_level); break;
case 0x02: m_arSXADDLHIERARCHY.push_back(current_level); break;
case 0x03: m_arSXADDLCALCMEMBER.push_back(current_level); break;
case 0x1a: m_SXADDLCONDFMTS = current_level; break;
case 0x1c: m_SXADDLSXFILTERS12 = current_level; break;
}
}
current = current->back().prev; elements_.pop_back(); //end элемент не нужен в дальнейшем
continue; continue;
} }
if (level == 0) else if (level == 0)
{ {
SXAddl_SXCView_SXDId* p0 = dynamic_cast<SXAddl_SXCView_SXDId*>(addl->content.get()); switch(addl->sxd)
if (p0)
{
m_SXAddl_SXCView_SXDId = addl->content;
}
SXAddl_SXCView_SXDTableStyleClient* p1 = dynamic_cast<SXAddl_SXCView_SXDTableStyleClient*>(addl->content.get());
if (p1)
{
m_SXAddl_SXCView_SXDTableStyleClient = addl->content;
}
SXAddl_SXCView_SXDVer10Info* p2 = dynamic_cast<SXAddl_SXCView_SXDVer10Info*>(addl->content.get());
if (p2)
{ {
m_SXAddl_SXCView_SXDVer10Info = addl->content; case 0x00: m_SXAddl_SXCView_SXDId = addl->content; break;
case 0x02: m_SXAddl_SXCView_SXDVer10Info = addl->content; break;
case 0x19: m_SXAddl_SXCView_SXDVer12Info = addl->content; break;
case 0x1E: m_SXAddl_SXCView_SXDTableStyleClient = addl->content; break;
} }
SXAddl_SXCView_SXDVer12Info* p3 = dynamic_cast<SXAddl_SXCView_SXDVer12Info*>(addl->content.get()); if (addl->sxd == 0x00 || addl->sxd == 0x02 || addl->sxd == 0x19 || addl->sxd == 0x1e)
if (p3)
{ {
m_SXAddl_SXCView_SXDVer12Info = addl->content; elements_.pop_back();
continue;
} }
} }
......
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
namespace XLS namespace XLS
{ {
class PIVOTADDL: public CompositeObject class PIVOTADDL: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTADDL)
public:
struct _sxAddl struct _sxAddl
{ {
_sxAddl(std::vector<_sxAddl> *p, int l) : prev(p), level (l) {} _sxAddl(std::vector<_sxAddl> *p, int l) : prev(p), level (l) {}
...@@ -48,10 +48,8 @@ class PIVOTADDL: public CompositeObject ...@@ -48,10 +48,8 @@ class PIVOTADDL: public CompositeObject
int level = 0; int level = 0;
std::vector<BaseObjectPtr> elements; std::vector<BaseObjectPtr> elements;
std::vector<_sxAddl> levels; std::vector<_sxAddl> levels;
}; };
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTADDL)
public:
PIVOTADDL(); PIVOTADDL();
~PIVOTADDL(); ~PIVOTADDL();
...@@ -72,6 +70,14 @@ public: ...@@ -72,6 +70,14 @@ public:
std::vector<BiffStructurePtr> m_arSXAddl_SXCView_SXDVerUpdInv; std::vector<BiffStructurePtr> m_arSXAddl_SXCView_SXDVerUpdInv;
std::vector<BiffStructurePtr> m_arSXAddl_SXCView_SXDSXPIIvmb; std::vector<BiffStructurePtr> m_arSXAddl_SXCView_SXDSXPIIvmb;
std::vector<_sxAddl> m_arSXADDLHIERARCHY;
std::vector<_sxAddl> m_arSXADDLFIELD;
std::vector<_sxAddl> m_arSXADDLCALCMEMBER;
_sxAddl m_SXADDLCONDFMTS;
_sxAddl m_SXADDLSXFILTERS12;
//others
std::vector<_sxAddl> content; std::vector<_sxAddl> content;
std::vector<_sxAddl> *current; std::vector<_sxAddl> *current;
......
...@@ -200,8 +200,10 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -200,8 +200,10 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
} }
} }
} }
if (bOLAP) if (olap_view)
{ {
olap_view->m_PIVOTADDL = m_PIVOTADDL;
olap_view->serialize(CP_XML_STREAM()); olap_view->serialize(CP_XML_STREAM());
} }
} }
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of PIVOTCACHEDEFINITION union of records
class PIVOTCACHEDEFINITION: public CompositeObject class PIVOTCACHEDEFINITION: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTCACHEDEFINITION) BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTCACHEDEFINITION)
...@@ -52,7 +50,7 @@ public: ...@@ -52,7 +50,7 @@ public:
int serialize_definitions(std::wostream & stream); int serialize_definitions(std::wostream & stream);
int serialize_records(std::wostream & stream); int serialize_records(std::wostream & stream);
static const ElementType type = typePIVOTCACHEDEFINITION; static const ElementType type = typePIVOTCACHEDEFINITION;
BaseObjectPtr m_SXStreamID; BaseObjectPtr m_SXStreamID;
BaseObjectPtr m_SXVS; BaseObjectPtr m_SXVS;
...@@ -60,7 +58,9 @@ public: ...@@ -60,7 +58,9 @@ public:
BaseObjectPtr m_SXADDLCACHE; BaseObjectPtr m_SXADDLCACHE;
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
GlobalWorkbookInfoPtr global_info_; GlobalWorkbookInfoPtr global_info_;
BaseObjectPtr m_PIVOTVIEWEX; BaseObjectPtr m_PIVOTVIEWEX;
BaseObjectPtr m_PIVOTADDL;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -102,28 +102,33 @@ const bool PIVOTVIEW::loadContent(BinProcessor& proc) ...@@ -102,28 +102,33 @@ const bool PIVOTVIEW::loadContent(BinProcessor& proc)
PIVOTCACHEDEFINITION* pivot_cache = dynamic_cast<PIVOTCACHEDEFINITION*>(global_info_->arPIVOTCACHEDEFINITION[view->iCache].get()); PIVOTCACHEDEFINITION* pivot_cache = dynamic_cast<PIVOTCACHEDEFINITION*>(global_info_->arPIVOTCACHEDEFINITION[view->iCache].get());
if (pivot_cache) if (pivot_cache)
{ {
SXStreamID *stream_id = dynamic_cast<SXStreamID*>(pivot_cache->m_SXStreamID.get()); SXSRC* src = dynamic_cast<SXSRC*> (pivot_cache->m_SXSRC.get());
indexStream = stream_id->idStm; SXStreamID * stream_id = dynamic_cast<SXStreamID*> (pivot_cache->m_SXStreamID.get());
PIVOTFRT* frt = dynamic_cast<PIVOTFRT*> (m_PIVOTFRT.get());
if (m_PIVOTFRT && pivot_cache->m_SXSRC) indexStream = stream_id ? stream_id->idStm : -1;
{
SXSRC* src = dynamic_cast<SXSRC*>(pivot_cache->m_SXSRC.get());
PIVOTFRT* frt = dynamic_cast<PIVOTFRT*>(m_PIVOTFRT.get());
PIVOTFRT9* frt9 = frt ? dynamic_cast<PIVOTFRT9*>(frt->m_PIVOTFRT9.get()) : NULL; if (frt && src)
{
pivot_cache->m_PIVOTADDL = frt->m_PIVOTADDL;
DBQUERY * db_query = dynamic_cast<DBQUERY*>(src->m_source.get()); PIVOTFRT9* frt9 = dynamic_cast<PIVOTFRT9*>(frt->m_PIVOTFRT9.get());
if (db_query && frt9) if (frt9)
{ {
QsiSXTag *qsiTag =dynamic_cast<QsiSXTag*>(frt9->m_QsiSXTag.get()); pivot_cache->m_PIVOTVIEWEX = frt9->m_PIVOTVIEWEX;
if (qsiTag->fTensorEx)
DBQUERY * db_query = dynamic_cast<DBQUERY*>(src->m_source.get());
if (db_query)
{ {
//OLAP !!! QsiSXTag *qsiTag =dynamic_cast<QsiSXTag*>(frt9->m_QsiSXTag.get());
src->bOLAP = true; if (qsiTag->fTensorEx)
core->bOLAP = true; {
//OLAP !!!
src->bOLAP = true;
core->bOLAP = true;
}
db_query->m_DBQUERYEXT = frt9->m_DBQUERYEXT;
} }
db_query->m_DBQUERYEXT = frt9->m_DBQUERYEXT;
pivot_cache->m_PIVOTVIEWEX = frt9->m_PIVOTVIEWEX;
} }
} }
} }
......
...@@ -54,6 +54,8 @@ public: ...@@ -54,6 +54,8 @@ public:
std::vector<BaseObjectPtr> m_arPIVOTTH; std::vector<BaseObjectPtr> m_arPIVOTTH;
std::vector<BaseObjectPtr> m_arSXPIEx; std::vector<BaseObjectPtr> m_arSXPIEx;
std::vector<BaseObjectPtr> m_arPIVOTVDTEX; std::vector<BaseObjectPtr> m_arPIVOTVDTEX;
//-------------------------------------------------------------
BaseObjectPtr m_PIVOTADDL;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -148,7 +148,9 @@ public: ...@@ -148,7 +148,9 @@ public:
std::map<int, double> customRowsHeight; std::map<int, double> customRowsHeight;
double defaultColumnWidth = 8.0; double defaultColumnWidth = 8.0;
double defaultRowHeight = 14.4; double defaultRowHeight = 14.4;
bool bMacrosSheet = false;
}; };
std::vector<_sheet_size_info> sheet_size_info; std::vector<_sheet_size_info> sheet_size_info;
......
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