Commit b7d20666 authored by Ivan.Shulga's avatar Ivan.Shulga Committed by Alexander Trofimov

CAtlMap -> std::map

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58805 954022d7-b5bf-4e40-9824-e11837661b57
parent 05c580cd
#pragma once #pragma once
#ifdef _WIN32
#include <atlbase.h> #include <atlbase.h>
#include <atlcom.h> #include <atlcom.h>
#include <atlwin.h> #include <atlwin.h>
...@@ -7,8 +8,13 @@ ...@@ -7,8 +8,13 @@
#include <atlctl.h> #include <atlctl.h>
#include <atlhost.h> #include <atlhost.h>
#include <atlcoll.h> #include <atlcoll.h>
#else
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#include "../../DesktopEditor/common/Types.h"
#endif
#include <vector> #include <vector>
#include <map>
#define MAX_STACK_SIZE 1024 #define MAX_STACK_SIZE 1024
...@@ -55,22 +61,22 @@ namespace NSBinPptxRW ...@@ -55,22 +61,22 @@ namespace NSBinPptxRW
LONG m_lThemeIndex; LONG m_lThemeIndex;
CStringA m_strImageBase64; CStringA m_strImageBase64;
CAtlArray<LONG> m_arLayoutIndexes; std::vector<LONG> m_arLayoutIndexes;
CAtlArray<CStringA> m_arLayoutImagesBase64; std::vector<CStringA> m_arLayoutImagesBase64;
}; };
class CCommonWriter class CCommonWriter
{ {
public: public:
CAtlMap<size_t, LONG> themes; std::map<size_t, LONG> themes;
CAtlMap<size_t, LONG> slideMasters; std::map<size_t, LONG> slideMasters;
CAtlMap<size_t, LONG> slides; std::map<size_t, LONG> slides;
CAtlMap<size_t, LONG> layouts; std::map<size_t, LONG> layouts;
CAtlMap<size_t, LONG> notes; std::map<size_t, LONG> notes;
CAtlMap<size_t, LONG> notesMasters; std::map<size_t, LONG> notesMasters;
CAtlArray<CMasterSlideInfo> m_oRels; std::vector<CMasterSlideInfo> m_oRels;
CAtlArray<LONG> m_oSlide_Layout_Rels; std::vector<LONG> m_oSlide_Layout_Rels;
NSShapeImageGen::CImageManager* m_pImageManager; NSShapeImageGen::CImageManager* m_pImageManager;
...@@ -92,7 +98,7 @@ namespace NSBinPptxRW ...@@ -92,7 +98,7 @@ namespace NSBinPptxRW
class CImageManager2 class CImageManager2
{ {
private: private:
CAtlMap<CString, CString> m_mapImages; std::map<CString, CString> m_mapImages;
LONG m_lIndexNextImage; LONG m_lIndexNextImage;
CString m_strDstMedia; CString m_strDstMedia;
...@@ -114,17 +120,14 @@ namespace NSBinPptxRW ...@@ -114,17 +120,14 @@ namespace NSBinPptxRW
pWriter->WriteINT(m_lIndexNextImage); pWriter->WriteINT(m_lIndexNextImage);
pWriter->WriteString(m_strDstMedia); pWriter->WriteString(m_strDstMedia);
int lCount = (int)m_mapImages.GetCount(); int lCount = (int)m_mapImages.size();
pWriter->WriteINT(lCount); pWriter->WriteINT(lCount);
POSITION pos = m_mapImages.GetStartPosition(); for (std::map<CString, CString>::const_iterator pPair = m_mapImages.begin(); pPair != m_mapImages.end(); ++pPair)
while (NULL != pos) {
{ pWriter->WriteString(pPairfirst);
CAtlMap<CString, CString>::CPair* pPair = m_mapImages.GetNext(pos); pWriter->WriteString(pPair->second);
}
pWriter->WriteString(pPair->m_key);
pWriter->WriteString(pPair->m_value);
}
} }
template <typename T> template <typename T>
...@@ -470,4 +473,4 @@ namespace NSBinPptxRW ...@@ -470,4 +473,4 @@ namespace NSBinPptxRW
void Deserialize(NSBinPptxRW::CImageManager2* pManager, LPSAFEARRAY pArray); void Deserialize(NSBinPptxRW::CImageManager2* pManager, LPSAFEARRAY pArray);
void Deserialize(NSShapeImageGen::CImageManager* pManager, LPSAFEARRAY pArray); void Deserialize(NSShapeImageGen::CImageManager* pManager, LPSAFEARRAY pArray);
}; };
} }
\ No newline at end of file
#pragma once #pragma once
#include "../stdafx.h" //#include "../stdafx.h"
#include "../../Common/DocxFormat/Source/SystemUtility/File.h" #include "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "BinReaderWriterDefines.h" #include "BinReaderWriterDefines.h"
#include "FontCutter.h" #include "FontCutter.h"
...@@ -164,4 +164,4 @@ public: ...@@ -164,4 +164,4 @@ public:
{ {
return &m_oPicker.m_oEmbeddedFonts; return &m_oPicker.m_oEmbeddedFonts;
} }
}; };
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "DocxFormat/ContentTypes/File.h" #include "DocxFormat/ContentTypes/File.h"
#include "DocxFormat/FileType.h" #include "DocxFormat/FileType.h"
#include "DocxFormat/FileTypes.h" #include "DocxFormat/FileTypes.h"
#include "DocxFormat/External/Hyperlink.h" #include "DocxFormat/External/HyperLink.h"
#include "WrapperFile.h" #include "WrapperFile.h"
#include <map> #include <map>
...@@ -43,7 +43,7 @@ namespace PPTX ...@@ -43,7 +43,7 @@ namespace PPTX
const PPTX::Rels::RelationShip* pRelation = &(rels.Relations.m_items[i]); const PPTX::Rels::RelationShip* pRelation = &(rels.Relations.m_items[i]);
OOX::CPath normPath = path / pRelation->target(); OOX::CPath normPath = path / pRelation->target();
CAtlMap<CString, smart_ptr<PPTX::File>>::CPair* pPair = map.find(normPath); std::map<CString, smart_ptr<PPTX::File>>::const_iterator pPair = map.find(normPath);
if (bIsSlide && (pRelation->type() == PPTX::FileTypes::Slide)) if (bIsSlide && (pRelation->type() == PPTX::FileTypes::Slide))
{ {
...@@ -62,9 +62,9 @@ namespace PPTX ...@@ -62,9 +62,9 @@ namespace PPTX
} }
else else
{ {
if (NULL != pPair) if (pPair != map.m_map.end())
{ {
add(pRelation->rId(), pPair->m_value); add(pRelation->rId(), pPair->second);
} }
else else
{ {
...@@ -191,4 +191,4 @@ namespace PPTX ...@@ -191,4 +191,4 @@ namespace PPTX
OOX::CPath path = filename.GetDirectory(); OOX::CPath path = filename.GetDirectory();
_read(rels, path); _read(rels, path);
} }
} // namespace PPTX } // namespace PPTX
\ No newline at end of file
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
#define PPTX_FILEMAP_INCLUDE_H_ #define PPTX_FILEMAP_INCLUDE_H_
#include "DocxFormat/File.h" #include "DocxFormat/File.h"
#include <map>
namespace PPTX namespace PPTX
{ {
class FileMap class FileMap
...@@ -16,23 +19,24 @@ namespace PPTX ...@@ -16,23 +19,24 @@ namespace PPTX
{ {
} }
public: public:
CAtlMap<CString, smart_ptr<PPTX::File>> m_map;
std::map<CString, smart_ptr<PPTX::File>> m_map;
public: public:
AVSINLINE CAtlMap<CString, smart_ptr<PPTX::File>>::CPair* find(const OOX::CPath& path) AVSINLINE std::map<CString, smart_ptr<PPTX::File>>::const_iterator find(const OOX::CPath& path)
{ {
return m_map.Lookup(path.m_strFilename); return m_map.find(path.m_strFilename);
} }
AVSINLINE void add(const OOX::CPath& key, const smart_ptr<PPTX::File>& value) AVSINLINE void add(const OOX::CPath& key, const smart_ptr<PPTX::File>& value)
{ {
m_map.SetAt(key.m_strFilename, value); m_map[key.m_strFilename] = value;
} }
AVSINLINE bool empty() const {return m_map.IsEmpty();} AVSINLINE bool empty() const {return m_map.empty();}
AVSINLINE size_t size() const {return m_map.GetCount();} AVSINLINE size_t size() const {return m_map.size();}
}; };
} // namespace PPTX } // namespace PPTX
#endif // PPTX_FILEMAP_INCLUDE_H_ #endif // PPTX_FILEMAP_INCLUDE_H_
\ No newline at end of file
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "Slide.h" #include "Slide.h"
#include "NotesMaster.h" #include "NotesMaster.h"
#include <map>
namespace PPTX namespace PPTX
{ {
Folder::Folder() Folder::Folder()
...@@ -41,75 +43,68 @@ namespace PPTX ...@@ -41,75 +43,68 @@ namespace PPTX
_presentation->commentAuthors = _presentation->get(PPTX::FileTypes::CommentAuthors).smart_dynamic_cast<PPTX::Authors>(); _presentation->commentAuthors = _presentation->get(PPTX::FileTypes::CommentAuthors).smart_dynamic_cast<PPTX::Authors>();
} }
pos = map.m_map.GetStartPosition(); for (std::map<CString, smart_ptr<PPTX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
while (NULL != pos) {
{ const PPTX::FileType& curType = pPair->second->type();
CAtlMap<CString, smart_ptr<PPTX::File>>::CPair* pPair = map.m_map.GetNext(pos);
const PPTX::FileType& curType = pPair->m_value->type(); if (PPTX::FileTypes::ThemePPTX == curType)
{
if (PPTX::FileTypes::ThemePPTX == curType) smart_ptr<PPTX::Theme> pTheme = pPair->second.smart_dynamic_cast<PPTX::Theme>();
{ if (pTheme.IsInit())
smart_ptr<PPTX::Theme> pTheme = pPair->m_value.smart_dynamic_cast<PPTX::Theme>(); pTheme->Presentation = _presentation;
if (pTheme.IsInit()) }
pTheme->Presentation = _presentation; }
}
} for (std::map<CString, smart_ptr<PPTX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
{
pos = map.m_map.GetStartPosition(); const PPTX::FileType& curType = pPair->second->type();
while (NULL != pos)
{ if (PPTX::FileTypes::SlideMaster == curType)
CAtlMap<CString, smart_ptr<PPTX::File>>::CPair* pPair = map.m_map.GetNext(pos); {
const PPTX::FileType& curType = pPair->m_value->type(); smart_ptr<PPTX::SlideMaster> pointer = pPair->second.smart_dynamic_cast<PPTX::SlideMaster>();
if (pointer.is_init())
if (PPTX::FileTypes::SlideMaster == curType) pointer->ApplyRels();
{ }
smart_ptr<PPTX::SlideMaster> pointer = pPair->m_value.smart_dynamic_cast<PPTX::SlideMaster>();
if (pointer.is_init()) }
pointer->ApplyRels();
}
} for (std::map<CString, smart_ptr<PPTX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
{
pos = map.m_map.GetStartPosition(); const PPTX::FileType& curType = pPair->second->type();
while (NULL != pos)
{ if (PPTX::FileTypes::SlideLayout == curType)
CAtlMap<CString, smart_ptr<PPTX::File>>::CPair* pPair = map.m_map.GetNext(pos); {
const PPTX::FileType& curType = pPair->m_value->type(); smart_ptr<PPTX::SlideLayout> pointer = pPair->second.smart_dynamic_cast<PPTX::SlideLayout>();
if (pointer.is_init())
if (PPTX::FileTypes::SlideLayout == curType) pointer->ApplyRels();
{ }
smart_ptr<PPTX::SlideLayout> pointer = pPair->m_value.smart_dynamic_cast<PPTX::SlideLayout>();
if (pointer.is_init()) }
pointer->ApplyRels();
} for (std::map<CString, smart_ptr<PPTX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
} {
const PPTX::FileType& curType = pPair->second->type();
pos = map.m_map.GetStartPosition();
while (NULL != pos) if (PPTX::FileTypes::Slide == curType)
{ {
CAtlMap<CString, smart_ptr<PPTX::File>>::CPair* pPair = map.m_map.GetNext(pos); smart_ptr<PPTX::Slide> pointer = pPair->second.smart_dynamic_cast<PPTX::Slide>();
const PPTX::FileType& curType = pPair->m_value->type(); if (pointer.is_init())
pointer->ApplyRels();
if (PPTX::FileTypes::Slide == curType) }
{ }
smart_ptr<PPTX::Slide> pointer = pPair->m_value.smart_dynamic_cast<PPTX::Slide>();
if (pointer.is_init())
pointer->ApplyRels(); for (std::map<CString, smart_ptr<PPTX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
} {
} const PPTX::FileType& curType = pPair->second->type();
if (PPTX::FileTypes::NotesMaster == curType)
pos = map.m_map.GetStartPosition(); {
while (NULL != pos) smart_ptr<PPTX::NotesMaster> pointer = pPair->second.smart_dynamic_cast<PPTX::NotesMaster>();
{ if (pointer.is_init())
CAtlMap<CString, smart_ptr<PPTX::File>>::CPair* pPair = map.m_map.GetNext(pos); pointer->ApplyRels();
const PPTX::FileType& curType = pPair->m_value->type(); }
}
if (PPTX::FileTypes::NotesMaster == curType)
{
smart_ptr<PPTX::NotesMaster> pointer = pPair->m_value.smart_dynamic_cast<PPTX::NotesMaster>();
if (pointer.is_init())
pointer->ApplyRels();
}
}
Event->Progress(0, 1000000); Event->Progress(0, 1000000);
} }
...@@ -155,4 +150,4 @@ namespace PPTX ...@@ -155,4 +150,4 @@ namespace PPTX
{ {
return OOX::CSystemUtility::GetFilesCount(path.GetDirectory(), true); return OOX::CSystemUtility::GetFilesCount(path.GetDirectory(), true);
} }
} // namespace PPTX } // namespace PPTX
\ No newline at end of file
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
#include "../../../Common/DocxFormat/Source/Base/Base.h" #include "../../../Common/DocxFormat/Source/Base/Base.h"
#ifndef _WIN32
#include "../../../DesktopEditor/common/Types.h"
#endif
#define _USE_STRING_OPERATOR \ #define _USE_STRING_OPERATOR \
virtual void operator=(const CString& value) \ virtual void operator=(const CString& value) \
{ \ { \
...@@ -71,4 +75,4 @@ namespace PPTX ...@@ -71,4 +75,4 @@ namespace PPTX
} // namespace Limit } // namespace Limit
} // namespace PPTX } // namespace PPTX
#endif // PPTX_LIMIT_BASE_INCLUDE_H_ #endif // PPTX_LIMIT_BASE_INCLUDE_H_
\ No newline at end of file
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
#define PPTX_LIMIT_SCHEMECLRVAL_INCLUDE_H_ #define PPTX_LIMIT_SCHEMECLRVAL_INCLUDE_H_
#include "BaseLimit.h" #include "BaseLimit.h"
#ifndef _WIN32
#include "../../../DesktopEditor/common/Types.h"
#endif
namespace PPTX namespace PPTX
...@@ -90,4 +93,4 @@ namespace PPTX ...@@ -90,4 +93,4 @@ namespace PPTX
} // namespace Limit } // namespace Limit
} // namespace PPTX } // namespace PPTX
#endif // PPTX_LIMIT_SCHEMECLRVAL_INCLUDE_H_ #endif // PPTX_LIMIT_SCHEMECLRVAL_INCLUDE_H_
\ No newline at end of file
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
#define PPTX_LOGIC_EFFECTLST_INCLUDE_H_ #define PPTX_LOGIC_EFFECTLST_INCLUDE_H_
#include "./../WrapperWritingElement.h" #include "./../WrapperWritingElement.h"
#include "Effects\Blur.h" #include "Effects/Blur.h"
#include "Effects\Glow.h" #include "Effects/Glow.h"
#include "Effects\OuterShdw.h" #include "Effects/OuterShdw.h"
#include "Effects\PrstShdw.h" #include "Effects/PrstShdw.h"
#include "Effects\InnerShdw.h" #include "Effects/InnerShdw.h"
#include "Effects\Reflection.h" #include "Effects/Reflection.h"
#include "Effects\SoftEdge.h" #include "Effects/SoftEdge.h"
#include "Effects\FillOverlay.h" #include "Effects/FillOverlay.h"
namespace PPTX namespace PPTX
{ {
...@@ -120,4 +120,4 @@ namespace PPTX ...@@ -120,4 +120,4 @@ namespace PPTX
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX
#endif // PPTX_LOGIC_EFFECTLST_INCLUDE_H_ #endif // PPTX_LOGIC_EFFECTLST_INCLUDE_H_
\ No newline at end of file
...@@ -15,6 +15,9 @@ DEFINES += UNICODE _UNICODE _USE_LIBXML2_READER_ _LINUX_QT _USE_XMLLITE_READER_ ...@@ -15,6 +15,9 @@ DEFINES += UNICODE _UNICODE _USE_LIBXML2_READER_ _LINUX_QT _USE_XMLLITE_READER_
INCLUDEPATH += \ INCLUDEPATH += \
/usr/include/libxml2 /usr/include/libxml2
INCLUDEPATH += \
../../../../DesktopEditor/freetype-2.5.2/include
SOURCES += pptxformatlib.cpp \ SOURCES += pptxformatlib.cpp \
../../../PPTXFormat/DocxFormat/IFileContainer.cpp \ ../../../PPTXFormat/DocxFormat/IFileContainer.cpp \
../../../PPTXFormat/Logic/Colors/SchemeClr.cpp \ ../../../PPTXFormat/Logic/Colors/SchemeClr.cpp \
...@@ -52,7 +55,9 @@ SOURCES += pptxformatlib.cpp \ ...@@ -52,7 +55,9 @@ SOURCES += pptxformatlib.cpp \
../../../PPTXFormat/FileContainer.cpp \ ../../../PPTXFormat/FileContainer.cpp \
../../../PPTXFormat/FileFactory.cpp \ ../../../PPTXFormat/FileFactory.cpp \
../../../PPTXFormat/FileMap.cpp \ ../../../PPTXFormat/FileMap.cpp \
../../../PPTXFormat/Folder.cpp ../../../PPTXFormat/Folder.cpp \
../../../Editor/BinaryFileReaderWriter.cpp \
../../../Editor/FontPicker.cpp
HEADERS += pptxformatlib.h \ HEADERS += pptxformatlib.h \
../../../PPTXFormat/DocxFormat/ContentTypes/Default.h \ ../../../PPTXFormat/DocxFormat/ContentTypes/Default.h \
...@@ -453,7 +458,18 @@ HEADERS += pptxformatlib.h \ ...@@ -453,7 +458,18 @@ HEADERS += pptxformatlib.h \
../../../PPTXFormat/ViewProps.h \ ../../../PPTXFormat/ViewProps.h \
../../../PPTXFormat/VmlDrawing.h \ ../../../PPTXFormat/VmlDrawing.h \
../../../PPTXFormat/WrapperFile.h \ ../../../PPTXFormat/WrapperFile.h \
../../../PPTXFormat/WrapperWritingElement.h ../../../PPTXFormat/WrapperWritingElement.h \
../../../Editor/BinaryFileReaderWriter.h \
../../../Editor/BinReaderWriterDefines.h \
../../../Editor/BinWriters.h \
../../../Editor/CalculatorCRC32.h \
../../../Editor/Converter.h \
../../../Editor/FontCutter.h \
../../../Editor/FontPicker.h \
../../../Editor/imagemanager.h \
../../../Editor/PPTXWriter.h \
../../../Editor/WMFToImageConverter.h \
../../../Editor/XmlWriter.h
unix { unix {
target.path = /usr/lib target.path = /usr/lib
INSTALLS += target INSTALLS += target
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
// turns off ATL's hiding of some common and often safely ignored warning messages // turns off ATL's hiding of some common and often safely ignored warning messages
#define _ATL_ALL_WARNINGS #define _ATL_ALL_WARNINGS
#ifdef _WIN32
#include <atlbase.h> #include <atlbase.h>
#include <atlcom.h> #include <atlcom.h>
#include <atlwin.h> #include <atlwin.h>
...@@ -45,9 +46,13 @@ ...@@ -45,9 +46,13 @@
#include <atlcoll.h> #include <atlcoll.h>
#include "../Common/atldefine.h" #include "../Common/atldefine.h"
#include <wingdi.h>
//#define _USE_MATH_DEFINES //#define _USE_MATH_DEFINES
#include <math.h> #include <math.h>
#include <wingdi.h>
//#define NODOCX //#define NODOCX
//#define PPTX_DEF //#define PPTX_DEF
...@@ -64,6 +69,8 @@ using namespace ATL; ...@@ -64,6 +69,8 @@ using namespace ATL;
//#import "../Redist/ASCOfficeDocxFile2.dll" named_guids raw_interfaces_only rename_namespace("DocxFile2") //#import "../Redist/ASCOfficeDocxFile2.dll" named_guids raw_interfaces_only rename_namespace("DocxFile2")
//#import "../Redist/XlsxSerializerCom.dll" named_guids raw_interfaces_only rename_namespace("XlsxCom"), exclude("_IAVSOfficeFileTemplateEvents"), exclude("_IAVSOfficeFileTemplateEvents2") //#import "../Redist/XlsxSerializerCom.dll" named_guids raw_interfaces_only rename_namespace("XlsxCom"), exclude("_IAVSOfficeFileTemplateEvents"), exclude("_IAVSOfficeFileTemplateEvents2")
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION #ifdef BUILD_CONFIG_OPENSOURCE_VERSION
#import "../Redist/OfficeCore.dll" named_guids raw_interfaces_only rename_namespace("OfficeCore") #import "../Redist/OfficeCore.dll" named_guids raw_interfaces_only rename_namespace("OfficeCore")
...@@ -93,4 +100,6 @@ namespace ASCGraphics ...@@ -93,4 +100,6 @@ namespace ASCGraphics
//#import "../Redist/ASCGraphics.dll" named_guids raw_interfaces_only rename_namespace("ASCGraphics") //#import "../Redist/ASCGraphics.dll" named_guids raw_interfaces_only rename_namespace("ASCGraphics")
#import "../Redist/ASCFontConverter.dll" named_guids raw_interfaces_only rename_namespace("Fonts") #import "../Redist/ASCFontConverter.dll" named_guids raw_interfaces_only rename_namespace("Fonts")
#endif #endif // #ifdef _WIN32
\ No newline at end of file
#endif
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