From 8e6ee145f74ecbc48877062a1de57e83df34eb55 Mon Sep 17 00:00:00 2001 From: "Elen.Subbotina" Date: Fri, 18 Sep 2015 16:59:19 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BD=D0=B2=D0=B5=D1=80=D1=82?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20ppt=20->=20pptx=20.=20=D0=A3=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=BC=D0=B5=D0=B6?= =?UTF-8?q?=D1=83=D1=82=D0=BE=D1=87=D0=BD=D0=B0=D1=8F=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=82=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B2=20xml?= =?UTF-8?q?,=20+=20crop=20image,=20+=20text=20anchor,=20....=20=D0=A2?= =?UTF-8?q?=D0=B0=D0=BA=D0=B6=D0=B5=20=D1=87=D0=B0=D1=81=D1=82=D0=B8=D1=87?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B7=D0=B0=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=20CSt?= =?UTF-8?q?ring=20=D0=BD=D0=B0=20std.=20Bug=2030205.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64814 954022d7-b5bf-4e40-9824-e11837661b57 --- .../PPTFormatLib/PPTFormatLib.cpp | 25 +- .../Reader/PPTDocumentInfoOneUser.cpp | 137 +++++--- .../Reader/PPTDocumentInfoOneUser.h | 18 +- .../PPTFormatLib/Reader/ReadStructures.h | 19 +- .../PPTFormatLib/Reader/Records.cpp | 220 ++++++------ .../PPTFormatLib/Reader/SlideInfo.h | 4 +- .../PPTFormatLib/Records/CString.h | 4 +- .../Records/Drawing/ShapeContainer.h | 170 +++++---- .../PPTFormatLib/Records/FontEntityAtom.h | 4 +- .../RoundTripOriginalMainMasterId12Atom.h | 9 +- .../PPTFormatLib/Records/SlideAtom.h | 5 +- .../PPTFormatLib/Records/SoundDataBlob.h | 8 +- .../PPTFormatLib/Win32/PPTFormatLib.vcproj | 6 +- ASCOfficePPTFile/Win32/ASCOfficePPTFile.sln | 59 ++-- .../Win32/ASCOfficePPTFile.vcproj | 6 +- ASCOfficePPTFile/version.h | 6 +- .../source/win32/XlsFormat.vcproj | 48 +-- .../OfficeDrawing/Attributes.h | 127 +++---- .../OfficeDrawing/AudioOverlay.h | 30 +- .../OfficeDrawing/Document.h | 15 +- ASCPresentationEditor/OfficeDrawing/Element.h | 8 +- .../OfficeDrawing/ElementProperties.h | 28 +- .../OfficeDrawing/Elements.h | 177 ++++++---- .../OfficeDrawing/Layout.cpp | 26 +- .../OfficeDrawing/SVGConverter.cpp | 20 +- .../OfficeDrawing/SVGConverter.h | 2 +- .../OfficeDrawing/SVGFramework.cpp | 2 +- ASCPresentationEditor/OfficeDrawing/Slide.h | 19 +- .../OfficeDrawing/Structures.h | 29 +- .../OfficeDrawing/TextAttributesEx.h | 89 ++++- .../OfficeDrawing/TextStructures.h | 68 ++-- ASCPresentationEditor/OfficeDrawing/Theme.cpp | 36 +- ASCPresentationEditor/OfficeDrawing/Theme.h | 9 +- .../OfficeDrawing/XmlWriter.h | 4 +- .../PPTXWriter/Converter.cpp | 317 +++++++++++------ ASCPresentationEditor/PPTXWriter/Converter.h | 29 +- .../PPTXWriter/ImageManager.h | 48 +-- .../PPTXWriter/ShapeWriter.cpp | 322 +++++++++++++++++- .../PPTXWriter/ShapeWriter.h | 308 ++++++----------- .../PPTXWriter/StylesWriter.h | 44 ++- Common/DocxFormat/Source/SystemUtility/File.h | 10 + Common/FileDownloader.h | 30 +- XlsxSerializerCom/Common/Common.cpp | 4 +- 43 files changed, 1573 insertions(+), 976 deletions(-) diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp index 7dafe0bf91..d3b93605d9 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp @@ -72,30 +72,14 @@ HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDs if (0 < ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers.size()) { - m_strEditorXml = ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]->ToXmlEditor2(); - } -////////////////////////////////////// - - if (m_strEditorXml.GetLength() <1) return S_FALSE; - - if (sDstPath.length() > 0) - { - - NSPresentationEditor::CDocument oPresentationEditor; NSPresentationEditor::CPPTXWriter oPPTXWriter; - - oPresentationEditor.LoadFromXML(m_strEditorXml); - oPPTXWriter.m_strTempDirectory = std_string2string(sDstPath); - oPPTXWriter.CreateFile(&oPresentationEditor); + oPPTXWriter.CreateFile(((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]); oPPTXWriter.CloseFile(); - + } - - //CloseFile(); нельзя тута- поскольку в Win32 используется PresentationEditor для конвертации xml -> pptx - return S_OK; } @@ -107,6 +91,11 @@ HRESULT COfficePPTFile::GetAdditionalParam (CString sParamName, VARIANT* ParamVa if (_T("EditorXml") == sParamName) { #if defined(_WIN32) || defined (_WIN64) + if (m_strEditorXml.IsEmpty()) + { + m_strEditorXml = ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]->ToXmlEditor2(); + } + ParamValue->bstrVal = m_strEditorXml.AllocSysString(); #else ParamValue->bstrVal = m_strEditorXml; diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.cpp b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.cpp index bbd470f5c8..9b98307a34 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.cpp @@ -9,14 +9,14 @@ #include "../Records/SoundCollectionContainer.h" #include "../Records/SoundContainer.h" -CPPTUserInfo::CPPTUserInfo() : CDocument(), -m_oUser(), -m_mapOffsetInPIDs(), -m_oDocument(), -m_mapMasters(), -m_mapNotes(), -m_mapSlides(), -m_arEmptyPictures() +CPPTUserInfo::CPPTUserInfo() : CDocument(), + m_oUser(), + m_mapOffsetInPIDs(), + m_oDocument(), + m_mapMasters(), + m_mapNotes(), + m_mapSlides(), + m_arEmptyPictures() { m_pDocumentInfo = NULL; m_lIndexThisUser = -1; @@ -235,7 +235,7 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr for (int nIndex = 0; nIndex < oArrayFonts.size(); ++nIndex) { CFont oFont; - oFont.Name = (CString)oArrayFonts[nIndex]->m_strFaceName; + oFont.Name = oArrayFonts[nIndex]->m_strFaceName; oFont.Charset = oArrayFonts[nIndex]->m_lfCharSet; switch (oArrayFonts[nIndex]->m_lfPitchAndFamily / 0x10) @@ -305,7 +305,6 @@ void CPPTUserInfo::FromDocument() double DurationSlide = PPT_DEFAULT_SLIDE_DURATION; - //for (std::map::iterator pPair = m_mapSlides.begin(); pPair != m_mapSlides.end(); ++pPair) for (int i=0; i< m_arrSlidesOrder.size(); i++) { std::map::iterator pPair = m_mapSlides.find(m_arrSlidesOrder[i]); @@ -537,7 +536,7 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide) pRecordSlide->GetRecordsByType(&oArrayShapes, true); - pSlide->m_bShowMasterShapes = (TRUE == oArrayAtoms[0]->m_bMasterObjects); + pSlide->m_bShowMasterShapes = oArrayAtoms[0]->m_bMasterObjects; pSlide->m_bIsBackground = false; for (int nShape = 0; nShape < oArrayShapes.size(); ++nShape) @@ -586,18 +585,18 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co if (m_mapMasters.end() == pPairMaster) return; - std::vector oArraySlideAtoms; CRecordSlide* pMaster = pPairMaster->second; if (pMaster == NULL) return; //todooo 20080720.ppt + + std::vector oArraySlideAtoms; pMaster->GetRecordsByType(&oArraySlideAtoms, true); if (0 == oArraySlideAtoms.size()) return; - DWORD dwID = (DWORD)oArraySlideAtoms[0]->m_nMasterIDRef; - + DWORD dwID = (DWORD)oArraySlideAtoms[0]->m_nMasterIDRef; if (0 != dwID) { // - main!!! @@ -605,13 +604,6 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co // title . return; } - - std::vector oArrayOrigId; - pMaster->GetRecordsByType(&oArrayOrigId, false, true); - - if (0 != oArrayOrigId.size()) - m_mapMasterOriginalIds.insert(std::pair(oArrayOrigId[0]->m_dwID, dwMasterID)); - std::vector oArrayCompId; pMaster->GetRecordsByType(&oArrayCompId, false, true); if (0 != oArrayCompId.size()) @@ -620,7 +612,18 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co // main, - title // title . return; - } + } + + bool bMasterColorScheme = oArraySlideAtoms[0]->m_bMasterScheme; + bool bMasterBackGround = oArraySlideAtoms[0]->m_bMasterBackground; + bool bMasterObjects = oArraySlideAtoms[0]->m_bMasterObjects; + + std::vector oArrayOrigId; + pMaster->GetRecordsByType(&oArrayOrigId, false, true); + + if (0 != oArrayOrigId.size()) + m_mapMasterOriginalIds.insert(std::pair(oArrayOrigId[0]->m_dwID, dwMasterID)); + LONG lIndexTheme = (LONG)m_arThemes.size(); @@ -631,6 +634,16 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co m_arThemes.push_back(theme); CTheme* pTheme = &m_arThemes[lIndexTheme]; + std::vector oArrayStrings; + pMaster->GetRecordsByType(&oArrayStrings, false, false); + for (int i=0; i < oArrayStrings.size(); i++) + { + if (oArrayStrings[i]->m_oHeader.RecType == 0x0fba) + { + pTheme->m_sThemeName = oArrayStrings[i]->m_strText; + } + } + CLayout layout; pTheme->m_arLayouts.push_back(layout); CLayout* pLayout = &pTheme->m_arLayouts.back(); @@ -654,14 +667,24 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co int nColorCount = oArrayColors.size(); for (int i = 0; i < nColorCount; ++i) { - if (0x01 == oArrayColors[i]->m_oHeader.RecInstance) + if (0x01 == oArrayColors[i]->m_oHeader.RecInstance && m_oSchemeColors.size() < 1) { oArrayColors[i]->ToArray(&pTheme->m_arColorScheme); oArrayColors[i]->ToArray(&m_oSchemeColors); } + if (0x06 == oArrayColors[i]->m_oHeader.RecInstance) + { + std::vector extra; + oArrayColors[i]->ToArray(&extra); + + CorrectColorScheme(extra); + pTheme->m_arExtraColorScheme.push_back(extra); + } + } CorrectColorScheme(pTheme->m_arColorScheme); + //CorrectColorScheme(m_oSchemeColors);//?? // --------------------------------------------------------------------------------- @@ -713,7 +736,6 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co pTheme->m_pStyles[3].ApplyAfter(pMasterWrapper->m_pStyles[3].get()); // --------------------------------------------------------------------------------- - pLayout->m_lOriginalWidth = lOriginWidth; pLayout->m_lOriginalHeight = lOriginHeight; @@ -721,8 +743,8 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co pLayout->m_lHeight = (LONG)(c_dMasterUnitsToMillimetreKoef * lOriginHeight); pLayout->m_bUseThemeColorScheme = true; - pLayout->m_bShowMasterShapes = true; - pLayout->m_strLayoutType = ConvertLayoutType(oArraySlideAtoms[0]->m_oLayout.m_nGeom, oArraySlideAtoms[0]->m_oLayout.m_pPlaceHolderID); + pLayout->m_bShowMasterShapes = bMasterObjects; + pLayout->m_strLayoutType = ConvertLayoutType(oArraySlideAtoms[0]->m_oLayout.m_nGeom, oArraySlideAtoms[0]->m_oLayout.m_pPlaceHolderID); // ...----------------------------------------------------------- std::vector oArrayShapes; @@ -739,32 +761,51 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co { AddAnimation ( dwMasterID, lOriginWidth, lOriginHeight, pElem ); - if (pElem->m_bIsBackground) - { - CShapeElement* pShape = dynamic_cast(pElem); - if (NULL != pShape) - { - pShape->SetupProperties(NULL, pTheme, pLayout); - - pTheme->m_bIsBackground = true; - pTheme->m_oBackground = pShape->m_oShape.m_oBrush; - } - - RELEASEINTERFACE(pElem); - continue; - } - if (-1 == pElem->m_lPlaceholderType) + { + if (pElem->m_bIsBackground) + { + CShapeElement* pShape = dynamic_cast(pElem); + if (NULL != pShape) + { + pShape->SetupProperties(NULL, pTheme, pLayout); + + pTheme->m_bIsBackground = true; + pTheme->m_oBackground = pShape->m_oShape.m_oBrush; + } + + RELEASEINTERFACE(pElem); + continue; + } pTheme->m_arElements.push_back(pElem); + } else + { + if (pElem->m_bIsBackground) + { + if (!bMasterBackGround) + { + CShapeElement* pShape = dynamic_cast(pElem); + + if (NULL != pShape) + { + pShape->SetupProperties(NULL, pTheme, pLayout); + + pLayout->m_bIsBackground = true; + pLayout->m_oBackground = pShape->m_oShape.m_oBrush; + } + } + RELEASEINTERFACE(pElem); + continue; + } pLayout->m_arElements.push_back(pElem); + } } } } void CPPTUserInfo::LoadMasters(const LONG& lOriginWidth, const LONG& lOriginHeight) { - //for (std::map::iterator pPair = m_mapMasters.begin(); pPair != m_mapMasters.end(); ++pPair) for (long i=0; i< m_arrMastersOrder.size(); i++) { std::map::iterator pPair = m_mapMasters.find(m_arrMastersOrder[i]); @@ -773,7 +814,6 @@ void CPPTUserInfo::LoadMasters(const LONG& lOriginWidth, const LONG& lOriginHeig LoadMainMaster(pPair->first, lOriginWidth, lOriginHeight); } - //for (std::map::iterator pPair = m_mapMasters.begin(); pPair != m_mapMasters.end(); ++pPair) for (long i=0; i< m_arrMastersOrder.size(); i++) { std::map::iterator pPair = m_mapMasters.find(m_arrMastersOrder[i]); @@ -857,8 +897,8 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, pMasterWrapper->m_parEmptyPictures = &m_arEmptyPictures; pLayout->m_bUseThemeColorScheme = true; - pLayout->m_bShowMasterShapes = (bMasterObjects == TRUE) ? true : false; - pLayout->m_strLayoutType = ConvertLayoutType(oArraySlideAtoms[0]->m_oLayout.m_nGeom, oArraySlideAtoms[0]->m_oLayout.m_pPlaceHolderID); + pLayout->m_bShowMasterShapes = bMasterObjects; + pLayout->m_strLayoutType = ConvertLayoutType(oArraySlideAtoms[0]->m_oLayout.m_nGeom, oArraySlideAtoms[0]->m_oLayout.m_pPlaceHolderID); std::vector* pArrayColorScheme = &pTheme->m_arColorScheme; // ----------------------------------------------------------- @@ -904,9 +944,6 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, pLayout->Clear(); - //if (!bMasterObjects) - // pTheme->m_arElements.clear(); - // --------------------------------------------------------------------------------- // ... @@ -1163,7 +1200,7 @@ void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects) NSPresentationEditor::CExFilesInfo oInfo; oInfo.m_strFilePath = m_oExMedia.m_strPresentationDirectory + FILE_SEPARATOR_STR + oArrayStrings[0]->m_strText + _T(".audio"); - oInfo.m_dwID = (DWORD)XmlUtils::GetInteger(oArrayStrings[2]->m_strText); + oInfo.m_dwID = (DWORD)XmlUtils::GetInteger(oArrayStrings[2]->m_strText.c_str()); oArrayData[0]->SaveToFile(oInfo.m_strFilePath); @@ -1338,7 +1375,7 @@ void CPPTUserInfo::AddAnimation ( DWORD dwSlideID, double Width, double Height, } } -void CPPTUserInfo::AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const CString& strFilePath) +void CPPTUserInfo::AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath) { if (NULL==pTransition) return; diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.h b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.h index 4e3f643ebf..c0bf2d64a3 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.h @@ -137,20 +137,22 @@ public: void CorrectColorScheme(std::vector& oScheme) { + if (oScheme.size() < 1) return; + std::vector oArrayMem; oArrayMem.push_back(oScheme[0]);//0 oArrayMem.push_back(oScheme[1]);//1 oArrayMem.push_back(oScheme[2]);//2 oArrayMem.push_back(oScheme[3]);//3 oArrayMem.push_back(oScheme[0]);//4 - oArrayMem.push_back(oScheme[5]);//5 //accent1 - oArrayMem.push_back(oScheme[6]);//6 //accent2 - oArrayMem.push_back(oScheme[7]);//7 //accent3 + oArrayMem.push_back(oScheme[4]);//5 //accent1 + oArrayMem.push_back(oScheme[5]);//6 //accent2 + oArrayMem.push_back(oScheme[0]);//7 //accent3 oArrayMem.push_back(oScheme[5]);//8 //accent4 - oArrayMem.push_back(oScheme[6]);//9 //accent5 + oArrayMem.push_back(oScheme[4]);//9 //accent5 oArrayMem.push_back(oScheme[7]);//10 //accent6 - oArrayMem.push_back(oScheme[5]);//11 //hlink - oArrayMem.push_back(oScheme[6]);//12 //folHlink + oArrayMem.push_back(oScheme[6]);//11 //hlink + oArrayMem.push_back(oScheme[7]);//12 //folHlink oArrayMem.push_back(oScheme[0]);//13 //lt1 oArrayMem.push_back(oScheme[1]);//14 //dk1 oArrayMem.push_back(oScheme[2]);//15 //lt2 @@ -279,6 +281,6 @@ public: return _T("obj"); } - void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement); - void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const CString& strFilePath); + void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement); + void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath); }; diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h b/ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h index 7ca9f7a32c..b82e79b4ed 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h @@ -599,7 +599,19 @@ public: } if (bulletChar_) - m_oRun.bulletChar = (WCHAR)StreamUtils::ReadWORD(pStream); + { + if (sizeof(wchar_t) == 2) + { + m_oRun.bulletChar = (WCHAR)StreamUtils::ReadWORD(pStream); + } + else + { + unsigned short utf16 = (unsigned short)StreamUtils::ReadWORD(pStream); + std::wstring utf32 = NSFile::CUtf8Converter::GetWStringFromUTF16(&utf16, 1); + if (!utf32.empty()) + m_oRun.bulletChar = utf32.c_str()[0]; + } + } if (bulletFontRef_) m_oRun.bulletFontRef = StreamUtils::ReadWORD(pStream); if (bulletSize_) @@ -788,11 +800,14 @@ public: oColor.A = 255; oColor.m_lSchemeIndex = -1; - if (oColorAtom.Index < 10) + if (oColorAtom.Index < 10/* && oColorAtom.bSchemeIndex*/) { oColor.m_lSchemeIndex = oColorAtom.Index; NSPresentationEditor::CorrectColorPPT(oColor.m_lSchemeIndex); } + else + { + } m_oRun.Color = oColor; } diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/Records.cpp b/ASCOfficePPTFile/PPTFormatLib/Reader/Records.cpp index 3381491d42..8ae96b5330 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/Records.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/Records.cpp @@ -2,6 +2,8 @@ #include "../Records/RecordsIncluder.h" +#include + void SRecordHeader::ToXmlWriter(XmlUtils::CXmlWriter* pWriter, POLE::Stream* pStream) { if (IsContainer()) @@ -72,136 +74,142 @@ IRecord* CreateByType(SRecordHeader oHeader) IRecord* pRecord = NULL; switch (oHeader.RecType) { - CREATE_BY_TYPE(RECORD_TYPE_SLIDELISTWITHTEXT, CRecordSlideListWithText) - CREATE_BY_TYPE(RECORD_TYPE_DOCUMENT_ATOM, CRecordDocumentAtom) - //CREATE_BY_TYPE(RECORD_TYPE_ENDDOCUMENT, CRecordEndDocument) - //CREATE_BY_TYPE(RECORD_TYPE_SSLIDE_LAYOUT_ATOM, CRecordSSlideLayoutAtom) - CREATE_BY_TYPE(RECORD_TYPE_SLIDE_ATOM, CRecordSlideAtom) - CREATE_BY_TYPE(RECORD_TYPE_NOTES_ATOM, CRecordNotesAtom) - CREATE_BY_TYPE(RECORD_TYPE_SLIDE_PERSIST_ATOM, CRecordSlidePersistAtom) - CREATE_BY_TYPE(RECORD_TYPE_ENVIRONMENT, CRecordDocumentTextInfo) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordMasterPersistAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordNotesPersistAtom) - CREATE_BY_TYPE(RECORD_TYPE_SSSLIDE_INFO_ATOM, CSlideShowSlideInfoAtom) - //CREATE_BY_TYPE(RECORD_TYPE_GUIDE_ATOM, CRecordGuideAtom) - //CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM, CRecordZoomViewInfoAtom) - //CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM, CRecordNoZoomViewInfoAtom) - CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM, CRecordViewInfoAtom) - CREATE_BY_TYPE(RECORD_TYPE_SLIDE_VIEWINFO_ATOM, CRecordSlideViewInfoAtom) - //CREATE_BY_TYPE(RECORD_TYPE_VBAINFO_ATOM, CRecordVBAInfoAtom) - //CREATE_BY_TYPE(RECORD_TYPE_SSDOCINFO_ATOM, CRecordSSDocInfoAtom) - //CREATE_BY_TYPE(RECORD_TYPE_DOC_ROUTING_SLIP, CRecordDocRoutingSlipAtom) - //CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM, CRecordExObjListAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordGridSpacing10Atom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordRoundTripThemeAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordRoundTripColorMappingAtom) - //CREATE_BY_TYPE(RECORD_TYPE_NAMEDSHOW_SLIDES, CRecordNamedShowSlidesAtom) - //CREATE_BY_TYPE(RECORD_TYPE_SHEET_PROPERTIES, CRecordNormalViewSetInfoAtom) + CREATE_BY_TYPE(RECORD_TYPE_SLIDELISTWITHTEXT , CRecordSlideListWithText) + CREATE_BY_TYPE(RECORD_TYPE_DOCUMENT_ATOM , CRecordDocumentAtom) + //CREATE_BY_TYPE(RECORD_TYPE_ENDDOCUMENT , CRecordEndDocument) + //CREATE_BY_TYPE(RECORD_TYPE_SSLIDE_LAYOUT_ATOM , CRecordSSlideLayoutAtom) + CREATE_BY_TYPE(RECORD_TYPE_SLIDE_ATOM , CRecordSlideAtom) + CREATE_BY_TYPE(RECORD_TYPE_NOTES_ATOM , CRecordNotesAtom) + CREATE_BY_TYPE(RECORD_TYPE_SLIDE_PERSIST_ATOM , CRecordSlidePersistAtom) + CREATE_BY_TYPE(RECORD_TYPE_ENVIRONMENT , CRecordDocumentTextInfo) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordMasterPersistAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordNotesPersistAtom) + CREATE_BY_TYPE(RECORD_TYPE_SSSLIDE_INFO_ATOM , CSlideShowSlideInfoAtom) + //CREATE_BY_TYPE(RECORD_TYPE_GUIDE_ATOM , CRecordGuideAtom) + //CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM , CRecordZoomViewInfoAtom) + //CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM , CRecordNoZoomViewInfoAtom) + CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM , CRecordViewInfoAtom) + CREATE_BY_TYPE(RECORD_TYPE_SLIDE_VIEWINFO_ATOM , CRecordSlideViewInfoAtom) + //CREATE_BY_TYPE(RECORD_TYPE_VBAINFO_ATOM , CRecordVBAInfoAtom) + //CREATE_BY_TYPE(RECORD_TYPE_SSDOCINFO_ATOM , CRecordSSDocInfoAtom) + //CREATE_BY_TYPE(RECORD_TYPE_DOC_ROUTING_SLIP , CRecordDocRoutingSlipAtom) + //CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM , CRecordExObjListAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordGridSpacing10Atom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordRoundTripThemeAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordRoundTripColorMappingAtom) + //CREATE_BY_TYPE(RECORD_TYPE_NAMEDSHOW_SLIDES , CRecordNamedShowSlidesAtom) + //CREATE_BY_TYPE(RECORD_TYPE_SHEET_PROPERTIES , CRecordNormalViewSetInfoAtom) - CREATE_BY_TYPE(RECORD_TYPE_COLOR_SCHEME_ATOM, CRecordColorSchemeAtom) + CREATE_BY_TYPE(RECORD_TYPE_COLOR_SCHEME_ATOM , CRecordColorSchemeAtom) - CREATE_BY_TYPE(RECORD_TYPE_ORIGINALMAINMASTERID, CRecordTripOriginalMasterId12Atom) - CREATE_BY_TYPE(RECORD_TYPE_COMPOSITEMASTERID, CRecordTripCompositeMasterId12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCONTENTMASTERINFO12, CRecordRoundTripContentMasterInfo12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPSHAPEID12, CRecordRoundTripShapeId12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHFPLACEHOLDER12, CRecordRoundTripHFPlaceholder12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCONTENTMASTERID, CRecordRoundTripContentMasterId12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPOARTTEXTSTYLES12, CRecordRoundTripOArtTextStyles12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM, CRecordRoundTripHeaderFooterDefaults12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPDOCFLAGS12, CRecordRoundTripDocFlags12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPSHAPECHECKSUMFORCUSTOMLAYOUTS12, CRecordRoundTripShapeCheckSumForCustomLayouts12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12, CRecordRoundTripNotesMasterTextStyles12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCUSTOMTABLESTYLES12, CRecordRoundTripCustomTableStyles12Atom) + CREATE_BY_TYPE(RECORD_TYPE_ORIGINALMAINMASTERID , CRecordTripOriginalMasterId12Atom) + CREATE_BY_TYPE(RECORD_TYPE_COMPOSITEMASTERID , CRecordTripCompositeMasterId12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCONTENTMASTERINFO12 , CRecordRoundTripContentMasterInfo12Atom) // ECMA-376 + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPSHAPEID12 , CRecordRoundTripShapeId12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHFPLACEHOLDER12 , CRecordRoundTripHFPlaceholder12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCONTENTMASTERID , CRecordRoundTripContentMasterId12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPOARTTEXTSTYLES12 , CRecordRoundTripOArtTextStyles12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM , CRecordRoundTripHeaderFooterDefaults12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPDOCFLAGS12 , CRecordRoundTripDocFlags12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPSHAPECHECKSUMFORCUSTOMLAYOUTS12 , CRecordRoundTripShapeCheckSumForCustomLayouts12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12 , CRecordRoundTripNotesMasterTextStyles12Atom) + //CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCUSTOMTABLESTYLES12 , CRecordRoundTripCustomTableStyles12Atom) - //CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_SEED_ATOM, CRecordBookmarkSeedAtom) - //CREATE_BY_TYPE(RECORD_TYPE_COLOR_SCHEME_ATOM, CRecordSlideColorSchemeAtom) + //CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_SEED_ATOM , CRecordBookmarkSeedAtom) + //CREATE_BY_TYPE(RECORD_TYPE_COLOR_SCHEME_ATOM , CRecordSlideColorSchemeAtom) //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordSchemeListElementColorSchemeAtom) //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordBlipEntityAtom) //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordExObjRefAtom) - CREATE_BY_TYPE(RECORD_TYPE_OEPLACEHOLDER_ATOM, CRecordPlaceHolderAtom) + CREATE_BY_TYPE(RECORD_TYPE_OEPLACEHOLDER_ATOM , CRecordPlaceHolderAtom) //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordShapeFlagsAtom) //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordShapeFlags10Atom) //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordRoundTripNewPlaceholderId12Atom) - CREATE_BY_TYPE(RECORD_TYPE_OUTLINE_TEXTREF_ATOM, CRecordOutlineTextRefAtom) - CREATE_BY_TYPE(RECORD_TYPE_TEXT_HEADER_ATOM, CRecordTextHeaderAtom) - CREATE_BY_TYPE(RECORD_TYPE_TEXT_CHARS_ATOM, CRecordTextCharsAtom) - CREATE_BY_TYPE(RECORD_TYPE_STYLE_TEXTPROP_ATOM, CRecordStyleTextPropAtom) - CREATE_BY_TYPE(RECORD_TYPE_TEXTSPECINFO_ATOM, CRecordTextSpecInfoAtom) - CREATE_BY_TYPE(RECORD_TYPE_BASE_TEXTPROP_ATOM, CRecordMasterTextPropAtom) - CREATE_BY_TYPE(RECORD_TYPE_TXMASTERSTYLE_ATOM, CRecordTextMasterStyleAtom) + CREATE_BY_TYPE(RECORD_TYPE_OUTLINE_TEXTREF_ATOM , CRecordOutlineTextRefAtom) + CREATE_BY_TYPE(RECORD_TYPE_TEXT_HEADER_ATOM , CRecordTextHeaderAtom) + CREATE_BY_TYPE(RECORD_TYPE_TEXT_CHARS_ATOM , CRecordTextCharsAtom) + CREATE_BY_TYPE(RECORD_TYPE_STYLE_TEXTPROP_ATOM , CRecordStyleTextPropAtom) + CREATE_BY_TYPE(RECORD_TYPE_TEXTSPECINFO_ATOM , CRecordTextSpecInfoAtom) + CREATE_BY_TYPE(RECORD_TYPE_BASE_TEXTPROP_ATOM , CRecordMasterTextPropAtom) + CREATE_BY_TYPE(RECORD_TYPE_TXMASTERSTYLE_ATOM , CRecordTextMasterStyleAtom) - CREATE_BY_TYPE(RECORD_TYPE_TXCFSTYLE_ATOM, CRecordTextCFExceptionAtom) - CREATE_BY_TYPE(RECORD_TYPE_TXPFSTYLE_ATOM, CRecordTextPFExceptionAtom) - CREATE_BY_TYPE(RECORD_TYPE_TXSISTYLE_ATOM, CRecordTextSIExceptionAtom) + CREATE_BY_TYPE(RECORD_TYPE_TXCFSTYLE_ATOM , CRecordTextCFExceptionAtom) + CREATE_BY_TYPE(RECORD_TYPE_TXPFSTYLE_ATOM , CRecordTextPFExceptionAtom) + CREATE_BY_TYPE(RECORD_TYPE_TXSISTYLE_ATOM , CRecordTextSIExceptionAtom) - CREATE_BY_TYPE(RECORD_TYPE_TEXTRULER_ATOM, CRecordTextRulerAtom) - //CREATE_BY_TYPE(RECORD_TYPE_TEXTBOOKMARK_ATOM, CRecordTextBookmarkAtom) - CREATE_BY_TYPE(RECORD_TYPE_TEXTBYTES_ATOM, CRecordTextBytesAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordOutlineTextPropsHeaderExAtom) + CREATE_BY_TYPE(RECORD_TYPE_TEXTRULER_ATOM , CRecordTextRulerAtom) + //CREATE_BY_TYPE(RECORD_TYPE_TEXTBOOKMARK_ATOM , CRecordTextBookmarkAtom) + CREATE_BY_TYPE(RECORD_TYPE_TEXTBYTES_ATOM , CRecordTextBytesAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordOutlineTextPropsHeaderExAtom) - CREATE_BY_TYPE(RECORD_TYPE_GUIDE_ATOM, CRecordGuideAtom) + CREATE_BY_TYPE(RECORD_TYPE_GUIDE_ATOM , CRecordGuideAtom) - CREATE_BY_TYPE(RECORD_TYPE_FONTENTITY_ATOM, CRecordFontEntityAtom) - //CREATE_BY_TYPE(RECORD_TYPE_FONT_EMBEDDEDDATA, CRecordFontEmbedDataBlob) - //CREATE_BY_TYPE(RECORD_TYPE_METAFILE, CRecordMetafileBlob) - CREATE_BY_TYPE(RECORD_TYPE_CSTRING, CRecordCString) - //CREATE_BY_TYPE(RECORD_TYPE_EXOLEOBJ_ATOM, CRecordExOleObjAtom) - //CREATE_BY_TYPE(RECORD_TYPE_EXEMBEDATOM, CRecordExOleEmbedAtom) - //CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_ENTITY_ATOM, CRecordBookmarkEntityAtom) - //CREATE_BY_TYPE(RECORD_TYPE_EXLINK_ATOM, CRecordExOleLinkAtom) + CREATE_BY_TYPE(RECORD_TYPE_FONTENTITY_ATOM , CRecordFontEntityAtom) + //CREATE_BY_TYPE(RECORD_TYPE_FONT_EMBEDDEDDATA , CRecordFontEmbedDataBlob) + //CREATE_BY_TYPE(RECORD_TYPE_METAFILE , CRecordMetafileBlob) + CREATE_BY_TYPE(RECORD_TYPE_CSTRING , CRecordCString) + //CREATE_BY_TYPE(RECORD_TYPE_EXOLEOBJ_ATOM , CRecordExOleObjAtom) + //CREATE_BY_TYPE(RECORD_TYPE_EXEMBEDATOM , CRecordExOleEmbedAtom) + //CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_ENTITY_ATOM , CRecordBookmarkEntityAtom) + //CREATE_BY_TYPE(RECORD_TYPE_EXLINK_ATOM , CRecordExOleLinkAtom) - //CREATE_BY_TYPE(RECORD_TYPE_SRKINSOKU_ATOM, CRecordKinsokuAtom) - //CREATE_BY_TYPE(RECORD_TYPE_EXHYPERLINK_ATOM, CRecordExHyperlinkAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordSlideNumberMCAtom) - CREATE_BY_TYPE(RECORD_TYPE_HEADERSFOOTERS_ATOM, CRecordHeadersFootersAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordMouseTextInteractiveInfoAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordRecolorInfoAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordAnimationInfoAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordDateTimeMCAtom) - //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordGenericDateMCAtom) - CREATE_BY_TYPE(RECORD_TYPE_EX_VIDEOCONTAINER, CRecordExVideoContainer) - CREATE_BY_TYPE(RECORD_TYPE_EX_OBJREF_ATOM, CRecordExObjRefAtom) - CREATE_BY_TYPE(RECORD_TYPE_EX_MEDIA_ATOM, CRecordExMediaAtom) - //CREATE_BY_TYPE(RECORD_TYPE_EXCONTROL_ATOM, CRecordExControlAtom) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSTORE_CONTAINER, CRecordBlipStoreContainer) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSE, CRecordBlipStoreEntry) + //CREATE_BY_TYPE(RECORD_TYPE_SRKINSOKU_ATOM , CRecordKinsokuAtom) + //CREATE_BY_TYPE(RECORD_TYPE_EXHYPERLINK_ATOM , CRecordExHyperlinkAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordSlideNumberMCAtom) + CREATE_BY_TYPE(RECORD_TYPE_HEADERSFOOTERS_ATOM , CRecordHeadersFootersAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordMouseTextInteractiveInfoAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordRecolorInfoAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordAnimationInfoAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordDateTimeMCAtom) + //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordGenericDateMCAtom) + CREATE_BY_TYPE(RECORD_TYPE_EX_VIDEOCONTAINER , CRecordExVideoContainer) + CREATE_BY_TYPE(RECORD_TYPE_EX_OBJREF_ATOM , CRecordExObjRefAtom) + CREATE_BY_TYPE(RECORD_TYPE_EX_MEDIA_ATOM , CRecordExMediaAtom) + //CREATE_BY_TYPE(RECORD_TYPE_EXCONTROL_ATOM , CRecordExControlAtom) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSTORE_CONTAINER , CRecordBlipStoreContainer) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSE , CRecordBlipStoreEntry) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DG_CONTAINER, CRecordDrawingContainer) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DGG, CRecordDrawingGroup) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DG, CRecordDrawingRecord) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SPGR, CRecordGroupShape) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SPGR_CONTAINER, CRecordGroupShapeContainer) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SP_CONTAINER, CRecordShapeContainer) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SP, CRecordShape) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_CLIENTANCHOR, CRecordClientAnchor) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_CHILDANCHOR, CRecordChildAnchor) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_OPT, CRecordShapeProperties) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SECONDARY_OPT, CRecordShapeProperties) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_TETRIARY_OPT, CRecordShapeProperties) - CREATE_BY_TYPE(RECORD_TYPE_ESCHER_REGROUPITEMS, CRecordRegGroupItems) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DG_CONTAINER , CRecordDrawingContainer) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DGG , CRecordDrawingGroup) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DG , CRecordDrawingRecord) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SPGR , CRecordGroupShape) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SPGR_CONTAINER , CRecordGroupShapeContainer) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SP_CONTAINER , CRecordShapeContainer) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SP , CRecordShape) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_CLIENTANCHOR , CRecordClientAnchor) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_CHILDANCHOR , CRecordChildAnchor) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_OPT , CRecordShapeProperties) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SECONDARY_OPT , CRecordShapeProperties) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_TETRIARY_OPT , CRecordShapeProperties) + CREATE_BY_TYPE(RECORD_TYPE_ESCHER_REGROUPITEMS , CRecordRegGroupItems) - CREATE_BY_TYPE(RECORD_TYPE_EX_CDAUDIO, CRecordExCDAudioContainer) - CREATE_BY_TYPE(RECORD_TYPE_EX_WAVAUDIOLINK, CRecordWAVAudioLinkContainer) - CREATE_BY_TYPE(RECORD_TYPE_EX_WAVAUDIOEMBEDDED, CRecordWAVAudioEmbeddedContainer) - CREATE_BY_TYPE(RECORD_TYPE_EX_MIDIAUDIO, CRecordExMIDIAudioContainer) + CREATE_BY_TYPE(RECORD_TYPE_EX_CDAUDIO , CRecordExCDAudioContainer) + CREATE_BY_TYPE(RECORD_TYPE_EX_WAVAUDIOLINK , CRecordWAVAudioLinkContainer) + CREATE_BY_TYPE(RECORD_TYPE_EX_WAVAUDIOEMBEDDED , CRecordWAVAudioEmbeddedContainer) + CREATE_BY_TYPE(RECORD_TYPE_EX_MIDIAUDIO , CRecordExMIDIAudioContainer) // - CREATE_BY_TYPE(RECORD_TYPE_INTERACTIVEINFO_ATOM, CRecordInteractiveInfoAtom) - CREATE_BY_TYPE(RECORD_TYPE_TXINTERACTIVEINFO_ATOM, CRecordTextInteractiveInfoAtom) + CREATE_BY_TYPE(RECORD_TYPE_INTERACTIVEINFO_ATOM , CRecordInteractiveInfoAtom) + CREATE_BY_TYPE(RECORD_TYPE_TXINTERACTIVEINFO_ATOM , CRecordTextInteractiveInfoAtom) // - CREATE_BY_TYPE ( RECORD_PROG_TAGS, SlideProgTagsContainer ) + CREATE_BY_TYPE ( RECORD_PROG_TAGS , SlideProgTagsContainer ) - CREATE_BY_TYPE(RECORD_TYPE_SOUNDCOLLECTION, CRecordSoundCollectionContainer) - CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST, CRecordExObjListContainer) + CREATE_BY_TYPE(RECORD_TYPE_SOUNDCOLLECTION , CRecordSoundCollectionContainer) + CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST , CRecordExObjListContainer) - CREATE_BY_TYPE(RECORD_TYPE_SOUND, CRecordSoundContainer) - CREATE_BY_TYPE(RECORD_TYPE_SOUNDDATA, CRecordSoundDataBlob) + CREATE_BY_TYPE(RECORD_TYPE_SOUND , CRecordSoundContainer) + CREATE_BY_TYPE(RECORD_TYPE_SOUNDDATA , CRecordSoundDataBlob) - - - default: break; + default: + { +#ifdef _DEBUG + char str[1024]={}; + sprintf(str, "Unknown record type: %xd\n" , oHeader.RecType); + std::cout << str; +#endif + } + break; }; if (NULL == pRecord) diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/SlideInfo.h b/ASCOfficePPTFile/PPTFormatLib/Reader/SlideInfo.h index ead2969359..3088e9cbb2 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/SlideInfo.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/SlideInfo.h @@ -98,9 +98,9 @@ public: size_t nCount = m_parEmptyPictures->size(); if (lIndex > nCount) - return 0; + return lIndex; - for (size_t nIndex = 0; nIndex < lIndex; ++nIndex) + for (size_t nIndex = 0; nIndex < min(lIndex, nCount); ++nIndex) { if ((*m_parEmptyPictures)[nIndex]) ++lResult; diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/CString.h b/ASCOfficePPTFile/PPTFormatLib/Records/CString.h index 1f8e20a3c8..4aa906f995 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/CString.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/CString.h @@ -4,7 +4,7 @@ class CRecordCString : public CUnknownRecord { public: - CStringW m_strText; + std::wstring m_strText; public: @@ -32,7 +32,7 @@ public: oWriter.WriteAttribute(_T("instance"), CDirectory::ToString(m_oHeader.RecInstance)); oWriter.WriteNodeEnd(strName, TRUE, FALSE); - CDirectory::WriteValueToNode(_T("String"), (CString)m_strText, &oWriter); + CDirectory::WriteValueToNode(_T("String"), std_string2string(m_strText), &oWriter); oWriter.WriteNodeEnd(strName); diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h index 778b60399d..7ddd20f717 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h @@ -28,47 +28,64 @@ public: { switch (lType) { - case 0x01: - case 0x0D: - case 0x11: - return 15; // title - case 0x02: - case 0x0E: - case 0x06: - case 0x12: - case 0x0C: - return 0; // body - case 0x03: - case 0x0F: - return 15; // centerTitle - case 0x04: - case 0x10: - return 0; // subtitle - case 0x13: - case 0x19: - return 9; // object - case 0x05: - case 0x14: - case 0x0B: - return 11; // slideImg - case 0x15: - return 14; // table - case 0x16: - return 2; // clipArt - case 0x17: - return 1; // chart - case 0x18: - return 8; // media - case 0x1A: - return 10; // picture - case 0x07: - return 5; // date - case 0x08: - return 12; // sldNum - case 0x09: - return 6; // footer - case 0x0A: - return 7; // header + case 0x00: //PT_None + break; + + case 0x01: //PT_MasterTitle + case 0x0D: //PT_Title + case 0x11: //PT_VerticalTitle + return 15; // title + + case 0x02: //PT_MasterBody + case 0x0E: //PT_Body + case 0x06: //PT_MasterNotesBody + case 0x12: //PT_VerticalBody + case 0x0C: //PT_NotesBody + return 0; // body + + case 0x03: //PT_MasterCenterTitle + case 0x0F: //PT_CenterTitle + return 3; // ctrTitle + + case 0x04: //PT_MasterSubTitle + case 0x10: //PT_SubTitle + return 13; // subtitle + + case 0x13: //PT_Object + case 0x19: //PT_VerticalObject + return 9; // object + + case 0x05: //PT_MasterNotesSlideImage + case 0x14: //PT_Graph //???? + case 0x0B: //PT_NotesSlideImage + return 11; // slideImg + + case 0x15: //PT_Table + return 14; // table + + case 0x16: //PT_ClipArt + return 2; // clipArt + + case 0x17: //PT_OrgChart + return 1; // chart + + case 0x18: //PT_Media + return 8; // media + + case 0x1A: //PT_Picture + return 10; // picture + + case 0x07: //PT_MasterDate + return 5; // date + + case 0x08: //PT_MasterSlideNumber + return 12; // sldNum + + case 0x09: //PT_MasterFooter + return 6; // footer + + case 0x0A: //PT_MasterHeader + return 7; // header default: break; } @@ -136,6 +153,16 @@ public: { switch (pProperty->m_ePID) { + case wzName: + { + pElement->m_sName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1); + return true; + } + case wzDescription: + { + pElement->m_sDescription = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1); + return true; + } case hspMaster: { pElement->m_lLayoutID = (LONG)pProperty->m_lValue; @@ -181,15 +208,44 @@ public: } inline void SetUpPropertyImage(CImageElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty) { - if (SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty)) - return; + SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty); - if (Pib == pProperty->m_ePID) + switch(pProperty->m_ePID) { - DWORD dwIndex = pInfo->GetIndexPicture(pProperty->m_lValue); + case Pib: + { + DWORD dwIndex = pInfo->GetIndexPicture(pProperty->m_lValue); - CString strVal = CDirectory::ToString(dwIndex); - pElement->m_strFileName = pElement->m_strFileName + strVal + L".jpg"; + CString strVal = CDirectory::ToString(dwIndex); + pElement->m_strFileName = pElement->m_strFileName + strVal.GetBuffer() + L".jpg"; + }break; + case pibName: + { + pElement->m_sName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2); + }break; + case cropFromTop: + { + pElement->m_lcropFromTop = pProperty->m_lValue; + pElement->m_bCropEnabled = true; + }break; + case cropFromBottom: + { + pElement->m_lcropFromBottom = pProperty->m_lValue; + pElement->m_bCropEnabled = true; + }break; + case cropFromLeft: + { + pElement->m_lcropFromLeft = pProperty->m_lValue; + pElement->m_bCropEnabled = true; + }break; + case cropFromRight: + { + pElement->m_lcropFromRight = pProperty->m_lValue; + pElement->m_bCropEnabled = true; + }break; + case pibFlags: + { + }break; } } inline void SetUpPropertyShape(CShapeElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty) @@ -279,8 +335,8 @@ public: } case NSOfficeDrawing::dyTextTop: { - //pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM; - pElemProps->SetAt(CElementProperty::epTextMarginTop, pProperty->m_lValue); + pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM; + //pElemProps->SetAt(CElementProperty::epTextMarginTop, pProperty->m_lValue); break; } case NSOfficeDrawing::dyTextBottom: @@ -358,15 +414,15 @@ public: CString strVal = CDirectory::ToString(dwIndex); - int nIndex = pParentShape->m_oBrush.TexturePath.ReverseFind(FILE_SEPARATOR_CHAR); - int nLen = pParentShape->m_oBrush.TexturePath.GetLength() - 1; + int nIndex = pParentShape->m_oBrush.TexturePath.rfind(FILE_SEPARATOR_CHAR); + int nLen = pParentShape->m_oBrush.TexturePath.length() - 1; if (nLen != nIndex) { - pParentShape->m_oBrush.TexturePath.Delete(nIndex + 1, nLen - nIndex); + pParentShape->m_oBrush.TexturePath.erase(nIndex + 1, nLen - nIndex); } //pElemProps->SetAt(CElementProperty::epBrushTxPath, pParentShape->m_oBrush.TexturePath + strVal + L".jpg"); - pParentShape->m_oBrush.TexturePath = pParentShape->m_oBrush.TexturePath + strVal + L".jpg"; + pParentShape->m_oBrush.TexturePath = pParentShape->m_oBrush.TexturePath + strVal.GetBuffer() + L".jpg"; break; } case NSOfficeDrawing::fillColor: @@ -621,7 +677,7 @@ public: { if (pProperty->m_bComplex && 0 < pProperty->m_lValue) { - CStringW str = CDirectory::BYTEArrayToStringW(pProperty->m_pOptions, pProperty->m_lValue); + std::wstring str = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue/2); //pParentShape->m_oText.m_sText = str; } break; @@ -631,8 +687,8 @@ public: { if (pProperty->m_bComplex && 0 < pProperty->m_lValue) { - CStringW str = CDirectory::BYTEArrayToStringW(pProperty->m_pOptions, pProperty->m_lValue); - pParentShape->m_oText.m_oAttributes.m_oFont.Name = (CString)str; + std::wstring str = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue/2); + pParentShape->m_oText.m_oAttributes.m_oFont.Name = std_string2string(str); //pElemProps->SetAt(CElementProperty::epFontName, (CString)str); } break; @@ -994,7 +1050,7 @@ public: CExFilesInfo oInfo; - CString strPathPicture = _T(""); + std::wstring strPathPicture = _T(""); // ( ) CExFilesInfo::ExFilesType exType = CExFilesInfo::eftNone; diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/FontEntityAtom.h b/ASCOfficePPTFile/PPTFormatLib/Records/FontEntityAtom.h index eba56a70b6..3c27ee58da 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/FontEntityAtom.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/FontEntityAtom.h @@ -53,13 +53,13 @@ public: , &pStrUtf32_Conv, &pStrUtf32 [lLen] , strictConversion)) { - m_strFaceName = CString((wchar_t*)pStrUtf32, lLen); + m_strFaceName = CString((wchar_t*)pStrUtf32/*, lLen*/); } delete [] pStrUtf32; } else { - m_strFaceName = CString((wchar_t*)utf16FaceName, lReadByte/2); + m_strFaceName = CString((wchar_t*)utf16FaceName/*, lReadByte/2*/); // по факту .. нули нам не нужны } m_lfCharSet = StreamUtils::ReadBYTE(pStream); diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/RoundTripOriginalMainMasterId12Atom.h b/ASCOfficePPTFile/PPTFormatLib/Records/RoundTripOriginalMainMasterId12Atom.h index cf50299211..fb694f3303 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/RoundTripOriginalMainMasterId12Atom.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/RoundTripOriginalMainMasterId12Atom.h @@ -28,10 +28,9 @@ public: CString strName = GetRecordName((DWORD)m_oHeader.RecType); oWriter.WriteNodeBegin(strName, TRUE); - oWriter.WriteAttribute(_T("length"), CDirectory::ToString(m_oHeader.RecLen)); - oWriter.WriteAttribute(_T("type"), CDirectory::ToString(m_oHeader.RecType)); - oWriter.WriteAttribute(_T("instance"), CDirectory::ToString(m_oHeader.RecInstance)); - + oWriter.WriteAttribute(_T("length"), CDirectory::ToString(m_oHeader.RecLen)); + oWriter.WriteAttribute(_T("type"), CDirectory::ToString(m_oHeader.RecType)); + oWriter.WriteAttribute(_T("instance"), CDirectory::ToString(m_oHeader.RecInstance)); oWriter.WriteNodeEnd(strName, TRUE, FALSE); CDirectory::WriteValueToNode(_T("ID"), m_dwID, &oWriter); @@ -40,4 +39,4 @@ public: return oWriter.GetXmlString(); } -}; \ No newline at end of file +}; diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/SlideAtom.h b/ASCOfficePPTFile/PPTFormatLib/Records/SlideAtom.h index d8ab668ea9..b0d6e7596d 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/SlideAtom.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/SlideAtom.h @@ -36,8 +36,9 @@ public: m_nNotesIDRef = (UINT)StreamUtils::ReadDWORD(pStream); USHORT nFlag = StreamUtils::ReadWORD(pStream); - m_bMasterObjects = ((nFlag & 0x01) == 0x01); - m_bMasterScheme = ((nFlag & 0x02) == 0x02); + + m_bMasterObjects = ((nFlag & 0x01) == 0x01); + m_bMasterScheme = ((nFlag & 0x02) == 0x02); m_bMasterBackground = ((nFlag & 0x04) == 0x04); StreamUtils::StreamSkip(2, pStream); diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/SoundDataBlob.h b/ASCOfficePPTFile/PPTFormatLib/Records/SoundDataBlob.h index 485b636cd2..e0cfbed54c 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/SoundDataBlob.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/SoundDataBlob.h @@ -40,15 +40,15 @@ public: RELEASEARRAYOBJECTS(m_pData); } - void SaveToFile(CString strFile) + void SaveToFile(std::wstring strFile) { if ((NULL == m_pData) || (0 >= m_lSize)) return; - CFile oFile; - oFile.CreateFile(strFile); + NSFile::CFileBinary oFile; + oFile.CreateFileW(strFile); - oFile.WriteFile((void*)m_pData, (DWORD)m_lSize); + oFile.WriteFile((BYTE*)m_pData, (DWORD)m_lSize); oFile.CloseFile(); ReleaseData(); diff --git a/ASCOfficePPTFile/PPTFormatLib/Win32/PPTFormatLib.vcproj b/ASCOfficePPTFile/PPTFormatLib/Win32/PPTFormatLib.vcproj index a56b8bb09f..525e3d71d6 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Win32/PPTFormatLib.vcproj +++ b/ASCOfficePPTFile/PPTFormatLib/Win32/PPTFormatLib.vcproj @@ -59,7 +59,7 @@ PreprocessorDefinitions="_DEBUG;_LIB;_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_" MinimalRebuild="true" BasicRuntimeChecks="3" - RuntimeLibrary="1" + RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" @@ -215,8 +215,8 @@ - - - - - - - - - - - - - - - - diff --git a/ASCPresentationEditor/OfficeDrawing/Attributes.h b/ASCPresentationEditor/OfficeDrawing/Attributes.h index 0d51fc99e9..b76db9eb8f 100644 --- a/ASCPresentationEditor/OfficeDrawing/Attributes.h +++ b/ASCPresentationEditor/OfficeDrawing/Attributes.h @@ -30,15 +30,15 @@ namespace NSPresentationEditor eftAudio = 2 }; public: - DWORD m_dwID; - CString m_strFilePath; + DWORD m_dwID; + std::wstring m_strFilePath; // clip - double m_dStartTime; - double m_dEndTime; + double m_dStartTime; + double m_dEndTime; // loop - bool m_bLoop; + bool m_bLoop; public: CExFilesInfo() @@ -72,8 +72,8 @@ namespace NSPresentationEditor class CExMedia { public: - CString m_strPresentationDirectory; - CString m_strSourceDirectory; + std::wstring m_strPresentationDirectory; + std::wstring m_strSourceDirectory; std::vector m_arVideos; std::vector m_arImages; @@ -626,14 +626,15 @@ namespace NSPresentationEditor CColor Color1; CColor Color2; + long Alpha1; long Alpha2; - CString TexturePath; + std::wstring TexturePath; long TextureAlpha; long TextureMode; - bool Rectable; + bool Rectable; Gdiplus::RectF Rect; double LinearAngle; @@ -817,7 +818,7 @@ namespace NSPresentationEditor else if (IsTexture()) { //BSTR bstrTexturePath = TexturePath.AllocSysString(); - pRenderer->put_BrushTexturePath(string2std_string(TexturePath)); + pRenderer->put_BrushTexturePath(TexturePath); //SysFreeString(bstrTexturePath); pRenderer->put_BrushTextureMode(TextureMode); pRenderer->put_BrushTextureAlpha(TextureAlpha); @@ -845,27 +846,27 @@ namespace NSPresentationEditor public: inline CString ToString() { - return _T(""); + return _T(""); } inline CString ToXmlWriter(NSPresentationEditor::CXmlWriter* pWriter) { - pWriter->WriteNodeBegin(_T("brush"), true); + pWriter->WriteNodeBegin(_T("brush"), true); pWriter->WriteAttributeLONG(_T("brush-type"), Type); pWriter->WriteAttributeString(_T("brush-color1"), Color1.ToString()); pWriter->WriteAttributeString(_T("brush-color2"), Color2.ToString()); pWriter->WriteAttributeLONG(_T("brush-alpha1"), Alpha1); pWriter->WriteAttributeLONG(_T("brush-alpha2"), Alpha2); - pWriter->WriteAttributeString(_T("brush-texturepath"), TexturePath); + pWriter->WriteAttributeString(_T("brush-texturepath"), std_string2string(TexturePath)); pWriter->WriteAttributeDouble(_T("brush-texturealpha"), TextureAlpha); pWriter->WriteAttributeDouble(_T("brush-texturemode"), TextureMode); - pWriter->WriteNodeEnd(_T("brush"), true); + pWriter->WriteNodeEnd(_T("brush"), true); return CString(_T("")); } @@ -875,25 +876,25 @@ namespace NSPresentationEditor { public: - CString Path; - CString Name; - double Size; - bool Bold; - bool Italic; - BYTE Underline; - BYTE Strikeout; + std::wstring Path; + std::wstring Name; + double Size; + bool Bold; + bool Italic; + BYTE Underline; + BYTE Strikeout; - bool StringGID; - double CharSpace; + bool StringGID; + double CharSpace; - CString PitchFamily; - BYTE Charset; - CString Panose; - bool Monospace; + std::wstring PitchFamily; + BYTE Charset; + std::wstring Panose; + bool Monospace; public: - bool IsEqual(CFont* pFont) + bool IsEqual(CFont* pFont) { if (NULL == pFont) return false; @@ -902,7 +903,7 @@ namespace NSPresentationEditor (Bold == pFont->Bold) && (Italic == pFont->Italic) && (Underline == pFont->Underline) && (Strikeout == pFont->Strikeout)); } - bool IsEqual2(CFont* pFont) + bool IsEqual2(CFont* pFont) { if (NULL == pFont) return false; @@ -924,15 +925,15 @@ namespace NSPresentationEditor } void SetStyle(LONG const& lStyle) { - Bold = (0x01 == (0x01 & lStyle)); - Italic = (0x02 == (0x02 & lStyle)); - Underline = (BYTE)(0x7C & lStyle) >> 2; - Strikeout = (BYTE)(0x0180 & lStyle) >> 7; + Bold = (0x01 == (0x01 & lStyle)); + Italic = (0x02 == (0x02 & lStyle)); + Underline = (BYTE)(0x7C & lStyle) >> 2; + Strikeout = (BYTE)(0x0180 & lStyle) >> 7; } void SetToRenderer(IRenderer *pRenderer) { - pRenderer->put_FontName(string2std_string(Name)); - pRenderer->put_FontPath(string2std_string(Path)); + pRenderer->put_FontName(Name); + pRenderer->put_FontPath(Path); pRenderer->put_FontSize(Size); @@ -946,18 +947,18 @@ namespace NSPresentationEditor Path = _T(""); Size = 0; - Bold = false; - Italic = false; + Bold = false; + Italic = false; Underline = 0; Strikeout = 0; - StringGID = false; + StringGID = false; CharSpace = 0.0; PitchFamily = _T(""); Charset = 0; Panose = _T(""); - Monospace = false; + Monospace = false; } public: @@ -1000,7 +1001,7 @@ namespace NSPresentationEditor CString strFont = _T(""); strFont.Format(_T("font-name='%s' font-size='%d' font-bold='%s' font-italic='%s' font-underline='%s' font-strikeout='%s' "), - Name, (int)Size, NSPresentationEditor::ToString(Bold), NSPresentationEditor::ToString(Italic), + std_string2string(Name), (int)Size, NSPresentationEditor::ToString(Bold), NSPresentationEditor::ToString(Italic), NSPresentationEditor::ToString(Underline), NSPresentationEditor::ToString(Strikeout)); return strFont; @@ -1011,7 +1012,7 @@ namespace NSPresentationEditor { public: - bool Visible; + bool Visible; double DistanceX; double DistanceY; double BlurSize; @@ -1159,7 +1160,7 @@ namespace NSPresentationEditor m_oTextBrush.Color1 = 0xFF; m_nTextAlignHorizontal = 0; - m_nTextAlignVertical = 0; + m_nTextAlignVertical = 1; //middle m_dTextRotate = 0; } CTextAttributes& operator =(const CTextAttributes& oSrc) @@ -1180,14 +1181,14 @@ namespace NSPresentationEditor CString strText = _T("WriteNodeBegin(_T("Attributes"), true); // add Brush Param - pWriter->WriteAttributeLONG(_T("brush-type"), m_oTextBrush.Type); - pWriter->WriteAttributeString(_T("brush-color1"), m_oTextBrush.Color1.ToString()); - pWriter->WriteAttributeString(_T("brush-color2"), m_oTextBrush.Color2.ToString()); - pWriter->WriteAttributeLONG(_T("brush-alpha1"), m_oTextBrush.Alpha1); - pWriter->WriteAttributeLONG(_T("brush-alpha2"), m_oTextBrush.Alpha2); - pWriter->WriteAttributeString(_T("brush-texturepath"), m_oTextBrush.TexturePath); - pWriter->WriteAttributeLONG(_T("brush-texturealpha"), m_oTextBrush.TextureAlpha); - pWriter->WriteAttributeLONG(_T("brush-texturemode"), m_oTextBrush.TextureMode); - pWriter->WriteAttributeLONG(_T("brush-rectable"), 0); + pWriter->WriteAttributeLONG(_T("brush-type") , m_oTextBrush.Type); + pWriter->WriteAttributeString(_T("brush-color1") , m_oTextBrush.Color1.ToString()); + pWriter->WriteAttributeString(_T("brush-color2") , m_oTextBrush.Color2.ToString()); + pWriter->WriteAttributeLONG(_T("brush-alpha1") , m_oTextBrush.Alpha1); + pWriter->WriteAttributeLONG(_T("brush-alpha2") , m_oTextBrush.Alpha2); + pWriter->WriteAttributeString(_T("brush-texturepath") , std_string2string(m_oTextBrush.TexturePath)); + pWriter->WriteAttributeLONG(_T("brush-texturealpha") , m_oTextBrush.TextureAlpha); + pWriter->WriteAttributeLONG(_T("brush-texturemode") , m_oTextBrush.TextureMode); + pWriter->WriteAttributeLONG(_T("brush-rectable") , 0); // add Font Param pWriter->WriteString(m_oFont.ToString()); diff --git a/ASCPresentationEditor/OfficeDrawing/AudioOverlay.h b/ASCPresentationEditor/OfficeDrawing/AudioOverlay.h index f123423fab..62f8ed53bd 100644 --- a/ASCPresentationEditor/OfficeDrawing/AudioOverlay.h +++ b/ASCPresentationEditor/OfficeDrawing/AudioOverlay.h @@ -6,22 +6,22 @@ namespace NSPresentationEditor class CAudioPart { public: - CString m_strFile; + std::wstring m_strFile; - double m_dStartTime; - double m_dEndTime; + double m_dStartTime; + double m_dEndTime; - double m_dClipStartTime; - double m_dClipEndTime; + double m_dClipStartTime; + double m_dClipEndTime; - double m_dAudioDuration; + double m_dAudioDuration; - bool m_bLoop; - bool m_bStop; + bool m_bLoop; + bool m_bStop; - bool m_bIsTransition; + bool m_bIsTransition; - double m_dAmplify; + double m_dAmplify; public: CAudioPart() @@ -244,15 +244,15 @@ namespace NSPresentationEditor strOverlay1.Format(_T(""), pPart->m_dStartTime, pPart->m_dEndTime - pPart->m_dStartTime, pPart->m_dAmplify); - int lIndex = pPart->m_strFile.Find(L"file:///"); + int lIndex = pPart->m_strFile.find(L"file:///"); if (0 == lIndex) { - pPart->m_strFile = pPart->m_strFile.Mid(8); - pPart->m_strFile.Replace('/', '\\'); - pPart->m_strFile.Replace(L"%20", L" "); + pPart->m_strFile = pPart->m_strFile.substr(8); + //pPart->m_strFile.Replace('/', '\\'); + //pPart->m_strFile.Replace(L"%20", L" "); } - CString strFile_ = pPart->m_strFile; + CString strFile_ = std_string2string(pPart->m_strFile); CorrectXmlString(strFile_); strOverlay2.Format(_T(""), diff --git a/ASCPresentationEditor/OfficeDrawing/Document.h b/ASCPresentationEditor/OfficeDrawing/Document.h index 054cc04228..4c7ce9b3c6 100644 --- a/ASCPresentationEditor/OfficeDrawing/Document.h +++ b/ASCPresentationEditor/OfficeDrawing/Document.h @@ -102,7 +102,7 @@ namespace NSPresentationEditor } else { - pLayout->m_arElements[nElem]->SetupProperties(NULL, &m_arThemes[i], NULL); + //pLayout->m_arElements[nElem]->SetupProperties(NULL, &m_arThemes[i], NULL); } } } @@ -934,17 +934,18 @@ namespace NSPresentationEditor strMetric.Format(_T(" hor_mm=\"%d\" ver_mm=\"%d\" hor_uni=\"%d\" ver_uni=\"%d\">"), m_oInfo.m_lMillimetresHor, m_oInfo.m_lMillimetresVer, m_oInfo.m_lUnitsHor, m_oInfo.m_lUnitsVer); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); size_t nCount = m_arThemes.size(); for (size_t i = 0; i < nCount; ++i) { oWriter.WriteString(m_arThemes[i].ToXmlEditor(m_oInfo)); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); nCount = m_arSlides.size(); for (size_t i = 0; i < nCount; ++i) { @@ -964,9 +965,9 @@ namespace NSPresentationEditor oWriter.WriteString(m_arSlides[i].ToXmlEditor(pThemeSlide, pLayoutSlide, m_oInfo)); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); oWriter.CorrectUnicodeString(); return oWriter.GetData(); diff --git a/ASCPresentationEditor/OfficeDrawing/Element.h b/ASCPresentationEditor/OfficeDrawing/Element.h index 8701e5a64f..566bbd909e 100644 --- a/ASCPresentationEditor/OfficeDrawing/Element.h +++ b/ASCPresentationEditor/OfficeDrawing/Element.h @@ -56,6 +56,9 @@ namespace NSPresentationEditor CTheme* m_pTheme; CLayout* m_pLayout; + std::wstring m_sName; + std::wstring m_sDescription; + protected: ULONG m_lCountRef; @@ -129,8 +132,9 @@ namespace NSPresentationEditor } virtual void NormalizeCoordsByMetric() { - double dScaleX = m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor; - double dScaleY = m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer; + double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor; + double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer; + m_rcBoundsOriginal.left = dScaleX * m_rcBounds.left; m_rcBoundsOriginal.right = dScaleX * m_rcBounds.right; m_rcBoundsOriginal.top = dScaleY * m_rcBounds.top; diff --git a/ASCPresentationEditor/OfficeDrawing/ElementProperties.h b/ASCPresentationEditor/OfficeDrawing/ElementProperties.h index d5de394335..0af77e566e 100644 --- a/ASCPresentationEditor/OfficeDrawing/ElementProperties.h +++ b/ASCPresentationEditor/OfficeDrawing/ElementProperties.h @@ -81,7 +81,6 @@ namespace NSPresentationEditor { m_ID = type; m_dwValue = 0; - m_strAdvanced = NULL; } CElementProperty(const CElementProperty& oSrc) { @@ -91,26 +90,16 @@ namespace NSPresentationEditor { m_ID = oSrc.m_ID; m_dwValue = oSrc.m_dwValue; - m_strAdvanced = NULL; + m_strAdvanced = oSrc.m_strAdvanced; - if (NULL != oSrc.m_strAdvanced) - { - m_strAdvanced = new WCHAR[m_dwValue]; - memcpy(m_strAdvanced, oSrc.m_strAdvanced, m_dwValue * sizeof(WCHAR)); - } return *this; } - inline bool IsAdvanced() - { - return (NULL != m_strAdvanced); - } - public: - Type m_ID; - DWORD m_dwValue; + Type m_ID; + DWORD m_dwValue; - LPWSTR m_strAdvanced; + std::wstring m_strAdvanced; }; class CElementProperties @@ -173,15 +162,12 @@ namespace NSPresentationEditor m_arProperties[eType] = oProp; } - inline void SetAt(const CElementProperty::Type& eType, CString strValue) + inline void SetAt(const CElementProperty::Type& eType, std::wstring strValue) { CElementProperty oProp(eType); - oProp.m_dwValue = strValue.GetLength() + 1; + oProp.m_dwValue = strValue.length() + 1; - oProp.m_strAdvanced = new WCHAR[oProp.m_dwValue]; - memcpy(oProp.m_strAdvanced, strValue.GetBuffer(), strValue.GetLength() * sizeof(WCHAR)); - - oProp.m_strAdvanced[oProp.m_dwValue - 1] = 0; + oProp.m_strAdvanced = strValue; m_arProperties[eType] = oProp; } diff --git a/ASCPresentationEditor/OfficeDrawing/Elements.h b/ASCPresentationEditor/OfficeDrawing/Elements.h index 367e027e70..ff0861199b 100644 --- a/ASCPresentationEditor/OfficeDrawing/Elements.h +++ b/ASCPresentationEditor/OfficeDrawing/Elements.h @@ -273,15 +273,15 @@ namespace NSPresentationEditor class CVideoElement : public IElement { public: - CString m_strFileName; - double m_dVideoDuration; - BYTE m_nAlpha; - LONG m_lAngle; + std::wstring m_strFileName; + double m_dVideoDuration; + BYTE m_nAlpha; + LONG m_lAngle; - double m_dClipStartTime; - double m_dClipEndTime; + double m_dClipStartTime; + double m_dClipEndTime; - bool m_bLoop; + bool m_bLoop; public: CVideoElement() : IElement() @@ -353,14 +353,14 @@ namespace NSPresentationEditor inline CString GetVideoStream () { - int lIndex = m_strFileName.Find(L"file:///"); + int lIndex = m_strFileName.find(L"file:///"); if (0 == lIndex) { - m_strFileName = m_strFileName.Mid(8); - m_strFileName.Replace('/', '\\'); + m_strFileName = m_strFileName.substr(8); + /*m_strFileName.Replace('/', '\\');*/ } - CString strFileName = m_strFileName; + CString strFileName = std_string2string(m_strFileName); CorrectXmlString(strFileName); CString element; @@ -395,15 +395,15 @@ namespace NSPresentationEditor CString element = _T(""); element.Format(_T(""), m_dStartTime, m_dEndTime - m_dStartTime, 100.0, m_bLoop); - int lIndex = m_strFileName.Find(L"file:///"); + int lIndex = m_strFileName.find(L"file:///"); if (0 == lIndex) { - m_strFileName = m_strFileName.Mid(8); - m_strFileName.Replace('/', '\\'); - m_strFileName.Replace(L"%20", L" "); + m_strFileName = m_strFileName.substr(8); + //m_strFileName.Replace('/', '\\'); + //m_strFileName.Replace(L"%20", L" "); } - CString strFileName = m_strFileName; + CString strFileName = std_string2string(m_strFileName); CorrectXmlString(strFileName); CString source; @@ -433,26 +433,39 @@ namespace NSPresentationEditor class CImageElement : public IElement { public: - CString m_strFileName; + std::wstring m_strFileName; - BYTE m_nAlpha; - bool m_bApplyBounds; - CDoubleRect m_rcImageBounds; + BYTE m_nAlpha; + + bool m_bCropEnabled; + + long m_lcropFromRight; + long m_lcropFromLeft; + long m_lcropFromTop; + long m_lcropFromBottom; + + bool m_bStretch; + bool m_bTile; public: CImageElement() : IElement() { m_etType = etPicture; - m_strFileName = _T(""); + m_strFileName = _T(""); - m_nAlpha = 0xFF; + m_nAlpha = 0xFF; + + m_bCropEnabled = false; + + m_lcropFromRight = 0; + m_lcropFromLeft = 0; + m_lcropFromTop = 0; + m_lcropFromBottom = 0; + + m_bStretch = true; + m_bTile = false; - m_bApplyBounds = false; - m_rcImageBounds.top = 0.0; - m_rcImageBounds.left = 0.0; - m_rcImageBounds.right = 0.0; - m_rcImageBounds.bottom = 0.0; } virtual ~CImageElement() @@ -526,15 +539,18 @@ namespace NSPresentationEditor SetProperiesToDublicate((IElement*)pImageElement); - pImageElement->m_strFileName = m_strFileName; - pImageElement->m_nAlpha = m_nAlpha; + pImageElement->m_strFileName = m_strFileName; + pImageElement->m_nAlpha = m_nAlpha; - pImageElement->m_bApplyBounds = m_bApplyBounds; - pImageElement->m_rcImageBounds.top = m_rcImageBounds.top; - pImageElement->m_rcImageBounds.left = m_rcImageBounds.left; - pImageElement->m_rcImageBounds.right = m_rcImageBounds.right; - pImageElement->m_rcImageBounds.bottom = m_rcImageBounds.bottom; + pImageElement->m_bCropEnabled = m_bCropEnabled; + pImageElement->m_lcropFromRight = m_lcropFromRight; + pImageElement->m_lcropFromLeft = m_lcropFromLeft; + pImageElement->m_lcropFromTop = m_lcropFromTop; + pImageElement->m_lcropFromBottom = m_lcropFromBottom; + + pImageElement->m_bStretch = m_bStretch; + pImageElement->m_bTile = m_bTile; return (IElement*)pImageElement; } @@ -557,9 +573,9 @@ namespace NSPresentationEditor //if (m_oShape.m_pShape != NULL) // eShapeType = m_oShape.m_pShape->GetClassType(); -//#ifdef ENABLE_PPT_TO_PPTX_CONVERT -// strPPTXShape = ConvertPPTShapeToPPTX(); -//#endif +#ifdef ENABLE_PPT_TO_PPTX_CONVERT + strPPTXShape = ConvertPPTShapeToPPTX(); +#endif NSHtmlRenderer::CASCSVGRenderer* pSVG = new NSHtmlRenderer::CASCSVGRenderer(); //todo FontManager @@ -569,7 +585,7 @@ namespace NSPresentationEditor pSVG->CreateOfficeFile(L"", 0); - pSVG->DrawImageFromFile(std::wstring(m_strFileName.GetString()), m_rcBounds.left, m_rcBounds.top, m_rcBounds.right - m_rcBounds.left, m_rcBounds.bottom - m_rcBounds.top, 255); + pSVG->DrawImageFromFile(m_strFileName, m_rcBounds.left, m_rcBounds.top, m_rcBounds.right - m_rcBounds.left, m_rcBounds.bottom - m_rcBounds.top, 255); pSVG->CloseFile(0); @@ -599,7 +615,7 @@ namespace NSPresentationEditor double _dWidth = (m_rcBounds.right - m_rcBounds.left) * 96 / 25.4; double _dHeight = (m_rcBounds.bottom - m_rcBounds.top) * 96 / 25.4; - CString strTxPath = m_strFileName; + CString strTxPath = std_string2string(m_strFileName); if (_T("") != strTxPath) CorrectXmlString(strTxPath); @@ -607,13 +623,13 @@ namespace NSPresentationEditor CorrectXmlString(strPPTXShape); CString strElement = _T(""); - strElement.Format(_T("0) - // strElement += _T(" pptx_shape=\"") + strPPTXShape + _T("\""); + if (strPPTXShape.GetLength() >0) + strElement += _T(" pptx_shape=\"") + strPPTXShape + _T("\""); strElement += _T(">"); strXml = strElement + strXml + _T(""); @@ -664,10 +680,10 @@ namespace NSPresentationEditor #endif #endif - AVSINLINE CString DownloadImage(const CString& strFile) + AVSINLINE std::wstring DownloadImage(const std::wstring& strFile) { #ifndef DISABLE_FILE_DOWNLOADER - CFileDownloader oDownloader(strFile, true); + CFileDownloader oDownloader(strFile, true); oDownloader.Start( 1 ); while ( oDownloader.IsRunned() ) { @@ -715,7 +731,18 @@ namespace NSPresentationEditor m_oShape.LoadFromXML(str); m_ClassType = m_oShape.m_pShape->GetClassType(); } + virtual void NormalizeCoordsByMetric() + { + IElement::NormalizeCoordsByMetric(); + double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor; + double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer; + + m_oShape.m_oText.m_oBounds.left *= dScaleX; + m_oShape.m_oText.m_oBounds.right *= dScaleX; + m_oShape.m_oText.m_oBounds.top *= dScaleY; + m_oShape.m_oText.m_oBounds.bottom *= dScaleY; + } virtual ~CShapeElement() { } @@ -816,9 +843,9 @@ namespace NSPresentationEditor SetupTextProperties(pSlide, pTheme, pLayout); - CalculateColor(m_oShape.m_oPen.Color, pSlide, pTheme, pLayout); - CalculateColor(m_oShape.m_oBrush.Color1, pSlide, pTheme, pLayout); - CalculateColor(m_oShape.m_oBrush.Color2, pSlide, pTheme, pLayout); + CalculateColor(m_oShape.m_oPen.Color , pSlide, pTheme, pLayout); + CalculateColor(m_oShape.m_oBrush.Color1 , pSlide, pTheme, pLayout); + CalculateColor(m_oShape.m_oBrush.Color2 , pSlide, pTheme, pLayout); } virtual void SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout); @@ -998,17 +1025,12 @@ namespace NSPresentationEditor #ifdef BUILD_CONFIG_OPENSOURCE_VERSION return _T(""); #else - CString strPPTXShape = _T(""); NSBaseShape::ClassType eShapeType = NSBaseShape::unknown; if (m_oShape.m_pShape != NULL) eShapeType = m_oShape.m_pShape->GetClassType(); -#ifdef ENABLE_PPT_TO_PPTX_CONVERT - if (eShapeType == NSBaseShape::ppt) - strPPTXShape = ConvertPPTShapeToPPTX(); -#endif - + CString strPPTXShape = _T(""); CGeomShapeInfo oInfo; oInfo.SetBounds(m_rcBounds); @@ -1073,11 +1095,9 @@ namespace NSPresentationEditor CString strTxPath = _T(""); if (c_BrushTypeTexture == m_oShape.m_oBrush.Type) - strTxPath = m_oShape.m_oBrush.TexturePath; + strTxPath = std_string2string(m_oShape.m_oBrush.TexturePath); CorrectXmlString(strTxPath); - if (_T("") != strPPTXShape) - CorrectXmlString(strPPTXShape); CString strElement = _T(""); @@ -1086,8 +1106,15 @@ namespace NSPresentationEditor strElement += _T(" txpath=\"") + strTxPath + _T("\""); +#ifdef ENABLE_PPT_TO_PPTX_CONVERT + if (eShapeType == NSBaseShape::ppt) + strPPTXShape = ConvertPPTShapeToPPTX(); +#endif if (strPPTXShape.GetLength() >0) + { + CorrectXmlString(strPPTXShape); strElement += _T(" pptx_shape=\"") + strPPTXShape + _T("\""); + } strElement += _T(">"); strXml = strElement + strXml + _T(""); @@ -1109,10 +1136,7 @@ namespace NSPresentationEditor CString strTxPath = _T(""); if (c_BrushTypeTexture == m_oShape.m_oBrush.Type) - strTxPath = m_oShape.m_oBrush.TexturePath; - - if (_T("") != strPPTXShape) - CorrectXmlString(strPPTXShape); + strTxPath = std_string2string(m_oShape.m_oBrush.TexturePath); CorrectXmlString(strTxPath); @@ -1122,8 +1146,15 @@ namespace NSPresentationEditor strElement += _T(" txpath=\"") + strTxPath + _T("\""); - if (strPPTXShape.GetLength() >0) + #ifdef ENABLE_PPT_TO_PPTX_CONVERT + if (eShapeType == NSBaseShape::ppt) + strPPTXShape = ConvertPPTShapeToPPTX(); +#endif + if (strPPTXShape.GetLength() >0) + { + CorrectXmlString(strPPTXShape); strElement += _T(" pptx_shape=\"") + strPPTXShape + _T("\""); + } strElement += _T(">"); @@ -1555,15 +1586,15 @@ namespace NSPresentationEditor class CAudioElement : public IElement { public: - CString m_strFileName; + std::wstring m_strFileName; - BYTE m_nAmplify; - bool m_bWithVideo; - double m_dAudioDuration; + BYTE m_nAmplify; + bool m_bWithVideo; + double m_dAudioDuration; - double m_dClipStartTime; - double m_dClipEndTime; - bool m_bLoop; + double m_dClipStartTime; + double m_dClipEndTime; + bool m_bLoop; public: CAudioElement() : IElement() @@ -1591,15 +1622,15 @@ namespace NSPresentationEditor CString element = _T(""); element.Format(_T(""), m_dStartTime, m_dEndTime-m_dStartTime, (double)m_nAmplify); - int lIndex = m_strFileName.Find(L"file:///"); + int lIndex = m_strFileName.find(L"file:///"); if (0 == lIndex) { - m_strFileName = m_strFileName.Mid(8); - m_strFileName.Replace('/', '\\'); - m_strFileName.Replace(L"%20", L" "); + m_strFileName = m_strFileName.substr(8); + //m_strFileName.Replace('/', '\\'); + //m_strFileName.Replace(L"%20", L" "); } - CString strFileName = m_strFileName; + CString strFileName = std_string2string(m_strFileName); CorrectXmlString(strFileName); CString source; diff --git a/ASCPresentationEditor/OfficeDrawing/Layout.cpp b/ASCPresentationEditor/OfficeDrawing/Layout.cpp index c5774dc970..da824763e8 100644 --- a/ASCPresentationEditor/OfficeDrawing/Layout.cpp +++ b/ASCPresentationEditor/OfficeDrawing/Layout.cpp @@ -15,7 +15,7 @@ namespace NSPresentationEditor if (!m_bUseThemeColorScheme) { // colors ---- - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); size_t nCountColors = m_arColorScheme.size(); for (size_t i = 0; i < nCountColors; ++i) @@ -27,7 +27,7 @@ namespace NSPresentationEditor oWriter.WriteString(strFormat); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // ----------- } @@ -59,14 +59,14 @@ namespace NSPresentationEditor oElem.m_bIsBackground = true; oElem.m_bIsChangeable = false; - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); oElem.SetupProperties(NULL, pTheme, this); oWriter.WriteString(oElem.ToXmlEditor()); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); } // ----------- // elements (no placeholders) - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); size_t nCountElems = m_arElements.size(); for (size_t i = 0; i < nCountElems; ++i) @@ -80,13 +80,13 @@ namespace NSPresentationEditor } } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // ---------------- // placeholders - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - CString strStylesPh = _T(""); - CString strFontRefs = _T(""); + std::wstring strStylesPh = _T(""); + std::wstring strFontRefs = _T(""); for (size_t i = 0; i < nCountElems; ++i) { @@ -133,12 +133,12 @@ namespace NSPresentationEditor } } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("") + strStylesPh + _T("")); - oWriter.WriteString(_T("") + strFontRefs + _T("")); + oWriter.WriteString(std::wstring(L"") + strStylesPh + _T("")); + oWriter.WriteString(std::wstring(L"") + strFontRefs + _T("")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); return oWriter.GetData(); } diff --git a/ASCPresentationEditor/OfficeDrawing/SVGConverter.cpp b/ASCPresentationEditor/OfficeDrawing/SVGConverter.cpp index 6d27efbb34..0dfbc3740a 100644 --- a/ASCPresentationEditor/OfficeDrawing/SVGConverter.cpp +++ b/ASCPresentationEditor/OfficeDrawing/SVGConverter.cpp @@ -33,16 +33,12 @@ void NSPresentationEditor::CSVGConverter::_SetFont() if (_T("") == m_oFont.Path) { - std::wstring bsName = string2std_string(m_oFont.Name); - - m_pFontManager->LoadFontByName(bsName, (float)m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY); + m_pFontManager->LoadFontByName(m_oFont.Name, (float)m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY); } else { - std::wstring bsName = string2std_string(m_oFont.Path); - - m_pFontManager->LoadFontFromFile(bsName, (float)m_oFont.Size, m_dDpiX, m_dDpiY, 0); + m_pFontManager->LoadFontFromFile(m_oFont.Path, (float)m_oFont.Size, m_dDpiX, m_dDpiY, 0); } m_oInstalledFont = m_oFont; @@ -292,12 +288,12 @@ HRESULT NSPresentationEditor::CSVGConverter::put_BrushAlpha2(const LONG& lAlpha) HRESULT NSPresentationEditor::CSVGConverter::get_BrushTexturePath(std::wstring* bsPath) { if (bsPath == NULL) return S_FALSE; - *bsPath = string2std_string(m_oBrush.TexturePath); + *bsPath = m_oBrush.TexturePath; return S_OK; } HRESULT NSPresentationEditor::CSVGConverter::put_BrushTexturePath(const std::wstring& bsPath) { - m_oBrush.TexturePath = std_string2string(bsPath); + m_oBrush.TexturePath = bsPath; return S_OK; } HRESULT NSPresentationEditor::CSVGConverter::get_BrushTextureMode(LONG* lMode) @@ -344,22 +340,22 @@ HRESULT NSPresentationEditor::CSVGConverter::BrushRect(const INT& val, const dou HRESULT NSPresentationEditor::CSVGConverter::get_FontName(std::wstring* bsName) { - *bsName = string2std_string(m_oFont.Name); + *bsName = m_oFont.Name; return S_OK; } HRESULT NSPresentationEditor::CSVGConverter::put_FontName(const std::wstring& bsName) { - m_oFont.Name = std_string2string(bsName); + m_oFont.Name = bsName; return S_OK; } HRESULT NSPresentationEditor::CSVGConverter::get_FontPath(std::wstring* bsName) { - *bsName = string2std_string(m_oFont.Path); + *bsName = m_oFont.Path; return S_OK; } HRESULT NSPresentationEditor::CSVGConverter::put_FontPath(const std::wstring& bsName) { - m_oFont.Path = std_string2string(bsName); + m_oFont.Path = bsName; return S_OK; } HRESULT NSPresentationEditor::CSVGConverter::get_FontSize(double* dSize) diff --git a/ASCPresentationEditor/OfficeDrawing/SVGConverter.h b/ASCPresentationEditor/OfficeDrawing/SVGConverter.h index 1e893085ab..226b952fa9 100644 --- a/ASCPresentationEditor/OfficeDrawing/SVGConverter.h +++ b/ASCPresentationEditor/OfficeDrawing/SVGConverter.h @@ -17,7 +17,7 @@ namespace NSPresentationEditor { //#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) //#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." - //#endif + //#endiflo //// ISVGConverter //[ object, uuid("4EE9D2C3-7317-4540-A205-DB78DBEB9BD0"), dual, pointer_default(unique) ] diff --git a/ASCPresentationEditor/OfficeDrawing/SVGFramework.cpp b/ASCPresentationEditor/OfficeDrawing/SVGFramework.cpp index 09de51bef5..e8d2d48954 100644 --- a/ASCPresentationEditor/OfficeDrawing/SVGFramework.cpp +++ b/ASCPresentationEditor/OfficeDrawing/SVGFramework.cpp @@ -1745,7 +1745,7 @@ namespace SVG if ((strClassName.GetLength () > 1) && (-1 == lLongAttribute ) && (alpha > 0.0)) { - m_render->put_BrushColor1 (0); + m_render->put_BrushColor1 (0xffffff); m_render->put_BrushAlpha1 ((LONG)( dAlplaFill * 255.0 * alpha)); return true; diff --git a/ASCPresentationEditor/OfficeDrawing/Slide.h b/ASCPresentationEditor/OfficeDrawing/Slide.h index 6d66f1cb0f..14e261cf65 100644 --- a/ASCPresentationEditor/OfficeDrawing/Slide.h +++ b/ASCPresentationEditor/OfficeDrawing/Slide.h @@ -53,6 +53,7 @@ namespace NSPresentationEditor IElement* pElem = m_arElements[nIndex]; RELEASEINTERFACE(pElem); } + m_arColorScheme.clear(); m_arElements.clear(); m_lThemeID = -1; @@ -83,6 +84,8 @@ namespace NSPresentationEditor m_arElements.push_back(oSrc.m_arElements[nIndex]->CreateDublicate()); } + m_arColorScheme = oSrc.m_arColorScheme; + m_oSlideShow = oSrc.m_oSlideShow; m_lThemeID = oSrc.m_lThemeID; @@ -117,6 +120,8 @@ namespace NSPresentationEditor m_arElements.push_back(oSrc.m_arElements[nIndex]->CreateDublicate()); } + m_arColorScheme = oSrc.m_arColorScheme; + m_oSlideShow = oSrc.m_oSlideShow; m_lThemeID = oSrc.m_lThemeID; @@ -391,13 +396,13 @@ namespace NSPresentationEditor oElem.m_bIsBackground = true; oElem.m_bIsChangeable = false; - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); oElem.SetupProperties(this, pTheme, pLayout); oWriter.WriteString(oElem.ToXmlEditor()); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); } - CString strFontRefs = _T(""); + std::wstring strFontRefs = _T(""); // elements size_t nCount = m_arElements.size(); @@ -415,7 +420,7 @@ namespace NSPresentationEditor oWriter.WriteString(strElement); oWriter.WriteString(pElement->ToXmlEditor()); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); if (etShape == pElement->m_etType) { @@ -428,15 +433,15 @@ namespace NSPresentationEditor CString strRef = _T(""); strRef.Format(_T("s_font%d { font-index:%d;font-family:%ls; }\n"), pTextElement->m_lID, lFontRef, pTheme->m_arFonts[lFontRef].Name); - strFontRefs += strRef; + strFontRefs += string2std_string(strRef); } } } } - oWriter.WriteString(_T("") + strFontRefs + _T("")); + oWriter.WriteString(std::wstring(L"") + strFontRefs + _T("")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); return oWriter.GetData(); } diff --git a/ASCPresentationEditor/OfficeDrawing/Structures.h b/ASCPresentationEditor/OfficeDrawing/Structures.h index 9d439ddb48..55c6df7de2 100644 --- a/ASCPresentationEditor/OfficeDrawing/Structures.h +++ b/ASCPresentationEditor/OfficeDrawing/Structures.h @@ -13,6 +13,25 @@ namespace NSPresentationEditor //0x05 //Accent 1 color //0x06 //Accent 2 color //0x07 //Accent 3 color + +// [0]);//0 +// [1]);//1 +// [2]);//2 +// [3]);//3 +// [0]);//4 +// [4]);//5 //accent1 +// [5]);//6 //accent2 +// [0]);//7 //accent3 +// [5]);//8 //accent4 +// [4]);//9 //accent5 +// [7]);//10 //accent6 +// [6]);//11 //hlink +// [7]);//12 //folHlink +// [0]);//13 //lt1 +// [1]);//14 //dk1 +// [2]);//15 //lt2 +// [3]);//16 //dk2 + switch (lSchemeIndex) { case 0: @@ -22,22 +41,22 @@ namespace NSPresentationEditor lSchemeIndex = 14; break; case 2: - lSchemeIndex = 16; + lSchemeIndex = 15; break; case 3: - lSchemeIndex = 15; + lSchemeIndex = 16; break; case 4: lSchemeIndex = 5; break; case 5: - lSchemeIndex = 5;//6 + lSchemeIndex = 6; break; case 6: - lSchemeIndex = 6;//11 + lSchemeIndex = 11; break; case 7: - lSchemeIndex = 7;//12 + lSchemeIndex = 12; break; default: lSchemeIndex = -1; diff --git a/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h b/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h index c7fb115ed5..282a067258 100644 --- a/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h +++ b/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h @@ -126,6 +126,93 @@ namespace NSPresentationEditor void RecalcParagraphs(CTheme* pTheme = NULL); + void NormalizeCoordsByMetric(const CMetricInfo & oMetric) + { + double dScaleX = (double)oMetric.m_lUnitsHor / oMetric.m_lMillimetresHor / 24.; + double dScaleY = (double)oMetric.m_lUnitsVer / oMetric.m_lMillimetresVer / 24.; + + size_t lCount = m_arParagraphs.size(); + for (size_t i = 0; i < lCount; ++i) + { + CTextPFRun* pPar = &m_arParagraphs[i].m_oPFRun; + + WORD lIndentLevel = (WORD)m_arParagraphs[i].m_lTextLevel; + switch (lIndentLevel) + { + case 0: + { + if (m_oRuler.LeftMargin1.is_init()) + pPar->leftMargin = (LONG)m_oRuler.LeftMargin1.get(); + if (m_oRuler.Indent1.is_init()) + pPar->indent = (LONG)m_oRuler.Indent1.get(); + + if (pPar->indent.is_init() && pPar->leftMargin.get()) + pPar->indent.get() -= pPar->leftMargin.get(); + break; + } + case 1: + { + if (m_oRuler.LeftMargin2.is_init()) + pPar->leftMargin = (LONG)m_oRuler.LeftMargin2.get(); + if (m_oRuler.Indent2.is_init()) + pPar->indent = (LONG)m_oRuler.Indent2.get(); + + if (pPar->indent.is_init() && pPar->leftMargin.get()) + pPar->indent.get() -= pPar->leftMargin.get(); + break; + } + case 2: + { + if (m_oRuler.LeftMargin3.is_init()) + pPar->leftMargin = (LONG)m_oRuler.LeftMargin3.get(); + if (m_oRuler.Indent3.is_init()) + pPar->indent = (LONG)m_oRuler.Indent3.get(); + + if (pPar->indent.is_init() && pPar->leftMargin.get()) + pPar->indent.get() -= pPar->leftMargin.get(); + break; + } + case 3: + { + if (m_oRuler.LeftMargin4.is_init()) + pPar->leftMargin = (LONG)m_oRuler.LeftMargin4.get(); + if (m_oRuler.Indent4.is_init()) + pPar->indent = (LONG)m_oRuler.Indent4.get(); + + if (pPar->indent.is_init() && pPar->leftMargin.get()) + pPar->indent.get() -= pPar->leftMargin.get(); + break; + } + case 4: + { + if (m_oRuler.LeftMargin5.is_init()) + pPar->leftMargin = (LONG)m_oRuler.LeftMargin5.get(); + if (m_oRuler.Indent5.is_init()) + pPar->indent = (LONG)m_oRuler.Indent5.get(); + + if (pPar->indent.is_init() && pPar->leftMargin.get()) + pPar->indent.get() -= pPar->leftMargin.get(); + break; + } + default: + break; + } + + if (pPar->leftMargin.is_init()) + pPar->leftMargin = pPar->leftMargin.get() * dScaleX; + if (pPar->indent.is_init()) + pPar->indent = pPar->indent.get() * dScaleX; + if (pPar->lineSpacing.is_init()) + pPar->lineSpacing =- pPar->lineSpacing.get();// * dScaleY; + if (pPar->spaceAfter.is_init()) + pPar->spaceAfter = -pPar->spaceAfter.get() ;//* dScaleY; + if (pPar->spaceBefore.is_init()) + pPar->spaceBefore = -pPar->spaceBefore.get() ;//* dScaleY; + if (pPar->defaultTabSize.is_init()) + pPar->defaultTabSize = pPar->defaultTabSize.get()* dScaleX; + } + } + void CorrectRuler() { size_t lCount = m_arParagraphs.size(); @@ -193,7 +280,7 @@ namespace NSPresentationEditor } default: break; - }; + } } } diff --git a/ASCPresentationEditor/OfficeDrawing/TextStructures.h b/ASCPresentationEditor/OfficeDrawing/TextStructures.h index 7ea01ab3ad..b74ede7a05 100644 --- a/ASCPresentationEditor/OfficeDrawing/TextStructures.h +++ b/ASCPresentationEditor/OfficeDrawing/TextStructures.h @@ -65,12 +65,12 @@ namespace NSPresentationEditor class CFontProperties { public: - BYTE FontNameProp; - CString strFontName; - CString strPanose; - CString strPitchFamily; - LONG lFontFixed; - std::vector arFontCharsets; + BYTE FontNameProp; + std::wstring strFontName; + std::wstring strPanose; + std::wstring strPitchFamily; + LONG lFontFixed; + std::vector arFontCharsets; public: CFontProperties() : FontNameProp(0), strFontName(_T("")), strPanose(_T("")), strPitchFamily(_T("")), lFontFixed(0), arFontCharsets() @@ -112,11 +112,11 @@ namespace NSPresentationEditor { public: - NSCommon::nullable_base FontBold; - NSCommon::nullable_base FontItalic; - NSCommon::nullable_base FontUnderline; - NSCommon::nullable_base FontStrikeout; - NSCommon::nullable_base FontShadow; + NSCommon::nullable_base FontBold; + NSCommon::nullable_base FontItalic; + NSCommon::nullable_base FontUnderline; + NSCommon::nullable_base FontStrikeout; + NSCommon::nullable_base FontShadow; NSCommon::nullable_base Typeface; // fontRef NSCommon::nullable_base EAFontRef; // eaFontRef @@ -313,26 +313,26 @@ namespace NSPresentationEditor if (FontProperties.is_init()) { - strXml += (_T("") + FontProperties->strFontName + _T("")); + strXml += (_T("") + std_string2string(FontProperties->strFontName) + _T("")); oWriter.WriteString(strXml); oWriter.WriteNodeEnd(_T("Attributes")); // font properties strXml = _T(""); - strXml += (_T("")); + strXml += (_T("")); if (0 < FontProperties->arFontCharsets.size()) strXml += (_T("")); if (_T("unknown") != FontProperties->strPitchFamily) - strXml += (_T("")); + strXml += (_T("")); if (-1 != FontProperties->lFontFixed) strXml += (_T("")); if (_T("") != FontProperties->strPanose) - strXml += (_T("")); + strXml += (_T("")); strXml += (_T("")); + oWriter.WriteString(std::wstring(L"")); return oWriter.GetData(); } }; diff --git a/ASCPresentationEditor/OfficeDrawing/Theme.cpp b/ASCPresentationEditor/OfficeDrawing/Theme.cpp index b89ab59926..2ed84f61b2 100644 --- a/ASCPresentationEditor/OfficeDrawing/Theme.cpp +++ b/ASCPresentationEditor/OfficeDrawing/Theme.cpp @@ -6,10 +6,12 @@ namespace NSPresentationEditor { NSPresentationEditor::CStringWriter oWriter; - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // colors ---- - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); size_t nCountColors = m_arColorScheme.size(); for (size_t i = 0; i < nCountColors; ++i) @@ -21,11 +23,11 @@ namespace NSPresentationEditor oWriter.WriteString(strFormat); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // ----------- // fonts ----- - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); size_t nCountFonts = m_arFonts.size(); //if (nCountFonts > 1) @@ -40,12 +42,12 @@ namespace NSPresentationEditor oWriter.WriteString(strFormat); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // ----------- // fonts dublicate - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); for (size_t i = 0; i < nCountFonts; ++i) { CString strFormat = _T(""); @@ -54,18 +56,18 @@ namespace NSPresentationEditor oWriter.WriteString(strFormat); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // ----------- // textstyles ------ - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); for (long i = 0; i < g_ThemeTextStylesCount; ++i) { oWriter.WriteString(m_pStyles[i].ToXmlEditor(oInfo, false, i, -1)); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // ----------------- // background @@ -94,13 +96,13 @@ namespace NSPresentationEditor oElem.NormalizeCoords(dScaleX, dScaleY); oElem.m_oShape.m_oBrush = m_oBackground; - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); oElem.SetupProperties(NULL, this, NULL); oWriter.WriteString(oElem.ToXmlEditor()); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // ----------- // elements - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); size_t nCountElems = m_arElements.size(); for (size_t i = 0; i < nCountElems; ++i) @@ -111,10 +113,10 @@ namespace NSPresentationEditor oWriter.WriteString(m_arElements[i]->ToXmlEditor()); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); // ---------------- // layouts - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); size_t nCountLayouts = m_arLayouts.size(); for (size_t i = 0; i < nCountLayouts; ++i) @@ -122,9 +124,9 @@ namespace NSPresentationEditor oWriter.WriteString(m_arLayouts[i].ToXmlEditor(this, oInfo)); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); return oWriter.GetData(); } @@ -133,6 +135,8 @@ namespace NSPresentationEditor { #ifdef _PRESENTATION_WRITER_ //colors + m_sThemeName = oNode.GetAttribute(L"name", L"default"); + m_arColorScheme.clear(); XmlUtils::CXmlNode oNodeColors; if (oNode.GetNode(_T("Colors"), oNodeColors)) diff --git a/ASCPresentationEditor/OfficeDrawing/Theme.h b/ASCPresentationEditor/OfficeDrawing/Theme.h index 066a835f76..838c55525a 100644 --- a/ASCPresentationEditor/OfficeDrawing/Theme.h +++ b/ASCPresentationEditor/OfficeDrawing/Theme.h @@ -26,10 +26,15 @@ namespace NSPresentationEditor CMetricInfo m_oInfo; - public: + std::wstring m_sThemeName; + + std::vector>m_arExtraColorScheme; + +//------------------------------------------------------------------------------------ CTheme() : m_arColorScheme(), m_arFonts(), m_arBrushes(), m_arPens(), m_arEffects(), m_arLayouts() { + m_sThemeName = L"Default"; } CTheme(const CTheme& oSrc) @@ -44,6 +49,8 @@ namespace NSPresentationEditor m_arBrushes = oSrc.m_arBrushes; m_arPens = oSrc.m_arPens; m_arEffects = oSrc.m_arEffects; + + m_sThemeName = oSrc.m_sThemeName; for (int i = 0; i < g_ThemeTextStylesCount; ++i) m_pStyles[i] = oSrc.m_pStyles[i]; diff --git a/ASCPresentationEditor/OfficeDrawing/XmlWriter.h b/ASCPresentationEditor/OfficeDrawing/XmlWriter.h index 3310eb4929..120aa66278 100644 --- a/ASCPresentationEditor/OfficeDrawing/XmlWriter.h +++ b/ASCPresentationEditor/OfficeDrawing/XmlWriter.h @@ -106,12 +106,12 @@ namespace NSPresentationEditor WriteString(bsString.GetBSTR(), nLen); } #endif // #if defined(_WIN32) || defined(_WIN64) - AVSINLINE void WriteString(std::wstring& wString) + AVSINLINE void WriteString(const std::wstring & wString) { size_t nLen = wString.length(); WriteString(wString.c_str(), nLen); } - AVSINLINE void WriteString(const CString& sString) + AVSINLINE void WriteString(const CString & sString) { size_t nLen = (size_t)sString.GetLength(); diff --git a/ASCPresentationEditor/PPTXWriter/Converter.cpp b/ASCPresentationEditor/PPTXWriter/Converter.cpp index d82d448e32..56eeab9b78 100644 --- a/ASCPresentationEditor/PPTXWriter/Converter.cpp +++ b/ASCPresentationEditor/PPTXWriter/Converter.cpp @@ -4,6 +4,7 @@ #include "../../Common/DocxFormat/Source/SystemUtility/File.h" #include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h" +#include "../../ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfo.h" #include "ShapeWriter.h" #include "StylesWriter.h" @@ -41,6 +42,7 @@ NSPresentationEditor::CPPTXWriter::CPPTXWriter() m_strDstFileName = FileSystem::Directory::GetTempPath() + FILE_SEPARATOR_STR + _T("Test.pptx"); m_pDocument = NULL; + m_pUserInfo = NULL; m_pShapeWriter = new CShapeWriter(); } @@ -50,6 +52,56 @@ NSPresentationEditor::CPPTXWriter::~CPPTXWriter() RELEASEOBJECT(m_pShapeWriter); } +void NSPresentationEditor::CPPTXWriter::CreateFile(CPPTUserInfo* pUserInfo ) +{ + m_pUserInfo = pUserInfo; + + m_pDocument = dynamic_cast(pUserInfo); + + m_pDocument->m_oInfo.m_lUnitsHor = 36000 * m_pDocument->m_oInfo.m_lMillimetresHor; + m_pDocument->m_oInfo.m_lUnitsVer = 36000 * m_pDocument->m_oInfo.m_lMillimetresVer; + + m_oManager.Clear(); + m_oManager.SetDstMedia(m_strTempDirectory + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR); + + m_pShapeWriter->InitNextId(); + + FileSystem::Directory::CreateDirectory(m_strTempDirectory); + CFile oFile; + CString strMemory = _T(""); + + // _rels + FileSystem::Directory::CreateDirectory(m_strTempDirectory + FILE_SEPARATOR_STR + _T("_rels")); + + oFile.CreateFile(m_strTempDirectory + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + _T(".rels")); + strMemory = NSPPTXWriterConst::g_string_rels_presentation; + oFile.WriteStringUTF8(strMemory); + oFile.CloseFile(); + + // docProps + FileSystem::Directory::CreateDirectory(m_strTempDirectory + FILE_SEPARATOR_STR + _T("docProps")); + + // core + oFile.CreateFile(m_strTempDirectory + FILE_SEPARATOR_STR + _T("docProps") + FILE_SEPARATOR_STR + _T("core.xml")); + strMemory = NSPPTXWriterConst::g_string_core; + oFile.WriteStringUTF8(strMemory); + oFile.CloseFile(); + + // app + oFile.CreateFile(m_strTempDirectory + FILE_SEPARATOR_STR + _T("docProps") + FILE_SEPARATOR_STR + _T("app.xml")); + WriteApp(oFile); + oFile.CloseFile(); + + // content types + WriteContentTypes(); + + // ppt + FileSystem::Directory::CreateDirectory(m_strTempDirectory + FILE_SEPARATOR_STR + _T("ppt")); + WritePresInfo(); + + WriteAll(); +} + void NSPresentationEditor::CPPTXWriter::CreateFile(CDocument* pDocument) { m_pDocument = pDocument; @@ -399,61 +451,43 @@ void NSPresentationEditor::CPPTXWriter::WriteAll() oFileRels.CloseFile(); // ----------------------------------------------------- + WriteThemes(); + + WriteSlides(); +} + +void NSPresentationEditor::CPPTXWriter::WriteThemes() +{ + CString strPptDirectory = m_strTempDirectory + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR ; + int nCount = (int)m_pDocument->m_arThemes.size(); int nStartLayout = 0; for (int nIndexTheme = 0; nIndexTheme < nCount; ++nIndexTheme) { - CString strThemeXml = _T("\ -\ -"); - CTheme* pTheme = &m_pDocument->m_arThemes[nIndexTheme]; - - CString strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[14].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[13].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[16].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[15].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[5].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[6].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[7].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[8].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[9].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[10].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[11].GetLONG_RGB()); - strThemeXml += strVal; - strVal = _T(""); strVal.Format(_T(""), pTheme->m_arColorScheme[12].GetLONG_RGB()); - strThemeXml += strVal; + CString strThemeFile; + strThemeFile.Format(_T("theme%d.xml"), nIndexTheme + 1); + strThemeFile = strPptDirectory + _T("theme") + FILE_SEPARATOR_STR + strThemeFile; + + CFile oFile; + oFile.CreateFile(strThemeFile); - strThemeXml += _T(""); + NSPresentationEditor::CStringWriter oStringWriter; - _T(""); + oStringWriter.WriteString(std::wstring(L"m_sThemeName); + oStringWriter.WriteString(std::wstring(L"\">")); + + WriteColorScheme(oStringWriter, L"Default", pTheme->m_arColorScheme); - CString sFont1 = _T(""); - if (0 < pTheme->m_arFonts.size()) - sFont1 = pTheme->m_arFonts[0].Name; - CString sFont2 = _T(""); - if (1 < pTheme->m_arFonts.size()) - sFont2 = pTheme->m_arFonts[1].Name; - - CString strFonts = _T(""); - - strThemeXml += strFonts; + oStringWriter.WriteString(std::wstring(L"m_arFonts[0].Name); + oStringWriter.WriteString(std::wstring(L"\"/>m_arFonts[1].Name); + oStringWriter.WriteString(std::wstring(L"\"/>")); - strThemeXml += _T("\ + oStringWriter.WriteString(std::wstring(L"\ \ \ \ @@ -478,21 +512,28 @@ void NSPresentationEditor::CPPTXWriter::WriteAll() \ \ \ -"); +")); - strThemeXml += _T(""); + oStringWriter.WriteString(std::wstring(L"")); + oStringWriter.WriteString(std::wstring(L"")); + + for (int i = 0 ; i < pTheme->m_arExtraColorScheme.size(); i++) + { + CString str; + str.Format(_T(" %d"), i + 1); + WriteColorScheme(oStringWriter, pTheme->m_sThemeName + string2std_string(str), pTheme->m_arExtraColorScheme[i], true); //extra + } + + oStringWriter.WriteString(std::wstring(L"")); + oStringWriter.WriteString(std::wstring(L"")); - CString strThemeFile; - strThemeFile.Format(_T("theme%d.xml"), nIndexTheme + 1); - strThemeFile = strPptDirectory + _T("theme") + FILE_SEPARATOR_STR + strThemeFile; - CFile oFile; - oFile.CreateFile(strThemeFile); - oFile.WriteStringUTF8(strThemeXml); + oFile.WriteStringUTF8(oStringWriter.GetData()); oFile.CloseFile(); // masterslide CRelsGenerator oRels(&m_oManager); int nCountLayouts = (int)pTheme->m_arLayouts.size(); + oRels.StartMaster(nIndexTheme, nStartLayout, nCountLayouts); CStringWriter oWriter; @@ -513,12 +554,12 @@ void NSPresentationEditor::CPPTXWriter::WriteAll() for (size_t nEl = 0; nEl < nElements; ++nEl) WriteElement(oWriter, oRels, pTheme->m_arElements[nEl]); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); CString strOverrideColorScheme = _T(""); oWriter.WriteString(strOverrideColorScheme); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); size_t __nCountLayouts = 0; for (int nIndexLayout = 0; nIndexLayout < nCountLayouts; ++nIndexLayout) @@ -530,23 +571,23 @@ void NSPresentationEditor::CPPTXWriter::WriteAll() WriteLayout(pTheme->m_arLayouts[nIndexLayout], nIndexLayout, nStartLayout, nIndexTheme); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); CStylesWriter::ConvertStyles(pTheme->m_pStyles[1], pTheme->m_oInfo, oWriter, 9); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); CStylesWriter::ConvertStyles(pTheme->m_pStyles[2], pTheme->m_oInfo, oWriter, 9); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); CStylesWriter::ConvertStyles(pTheme->m_pStyles[3], pTheme->m_oInfo, oWriter, 9); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); CString strSlideMasterFile; strSlideMasterFile.Format(_T("slideMaster%d.xml"), nIndexTheme + 1); @@ -567,12 +608,63 @@ void NSPresentationEditor::CPPTXWriter::WriteAll() nStartLayout += nCountLayouts; } +} - size_t nCountSlides = m_pDocument->m_arSlides.size(); - for (size_t nIndexS = 0; nIndexS < nCountSlides; ++nIndexS) +void NSPresentationEditor::CPPTXWriter::WriteColorScheme(CStringWriter& oStringWriter, const std::wstring & name, const std::vector & colors, bool extra) +{ + if (colors.size() < 1) return; + + if (extra) + oStringWriter.WriteString(std::wstring(L"")); + + oStringWriter.WriteString(std::wstring(L"")); + CString strVal; + + strVal.Format(_T(""), colors[14].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[13].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[16].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[15].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[5].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[6].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[7].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[8].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[9].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[10].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[11].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + strVal.Format(_T(""), colors[12].GetLONG_RGB()); + oStringWriter.WriteString(strVal); + + oStringWriter.WriteString(std::wstring(L"")); + if (extra) { - CRelsGenerator::StartNotes((int)nIndexS, m_strTempDirectory, m_pDocument->m_arSlides[nIndexS].m_strComment); - WriteSlide((int)nIndexS); + oStringWriter.WriteString(std::wstring(L"")); + oStringWriter.WriteString(std::wstring(L"")); } } @@ -605,40 +697,58 @@ void NSPresentationEditor::CPPTXWriter::WriteBackground(CStringWriter& oWriter, void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout) { - if (etShape != pElement->m_etType) - return; + CImageElement* pImageElem = dynamic_cast(pElement); + if (pImageElem) + { + pImageElem->m_oMetric = m_pDocument->m_oInfo; + pImageElem->NormalizeCoordsByMetric(); + + m_pShapeWriter->SetShape(pImageElem); + } CShapeElement* pShapeElem = dynamic_cast(pElement); - m_pShapeWriter->SetShape(pShapeElem); - m_pShapeWriter->SetRelsGenerator(&oRels); - - if (NULL != pLayout) + if (pShapeElem) { - if (-1 != pElement->m_lPlaceholderType) + pShapeElem->m_oMetric = m_pDocument->m_oInfo; + pShapeElem->NormalizeCoordsByMetric(); + + pShapeElem->m_oShape.m_oText.RecalcParagraphs(pShapeElem->m_pTheme); + pShapeElem->m_oShape.m_oText.NormalizeCoordsByMetric(m_pDocument->m_oInfo); + + m_pShapeWriter->SetShape(pShapeElem); + } + + if (pImageElem || pShapeElem) + { + m_pShapeWriter->SetRelsGenerator(&oRels); + + if (NULL != pLayout) { - size_t nCountElements = pLayout->m_arElements.size(); - for (size_t nIndex = 0; nIndex < nCountElements; ++nIndex) + if (-1 != pElement->m_lPlaceholderType) { - if ((pElement->m_lPlaceholderType == pLayout->m_arElements[nIndex]->m_lPlaceholderType) && - (pElement->m_lPlaceholderID == pLayout->m_arElements[nIndex]->m_lPlaceholderID)) + size_t nCountElements = pLayout->m_arElements.size(); + for (size_t nIndex = 0; nIndex < nCountElements; ++nIndex) { - IElement* pElLayout = pLayout->m_arElements[nIndex]; - bool bIsEqualTransform = ((pElement->m_dRotate == pElLayout->m_dRotate) - && (pElement->m_bFlipH == pElLayout->m_bFlipH) && (pElement->m_bFlipV == pElLayout->m_bFlipV)); - - if (bIsEqualTransform) + if ((pElement->m_lPlaceholderType == pLayout->m_arElements[nIndex]->m_lPlaceholderType) && + (pElement->m_lPlaceholderID == pLayout->m_arElements[nIndex]->m_lPlaceholderID)) { - if (pElement->m_rcBounds.IsEqual(pElLayout->m_rcBounds, 0.5)) - m_pShapeWriter->SetIsWriteGeom(false); - } + IElement* pElLayout = pLayout->m_arElements[nIndex]; + bool bIsEqualTransform = ((pElement->m_dRotate == pElLayout->m_dRotate) + && (pElement->m_bFlipH == pElLayout->m_bFlipH) && (pElement->m_bFlipV == pElLayout->m_bFlipV)); - break; + if (bIsEqualTransform) + { + if (pElement->m_rcBounds.IsEqual(pElLayout->m_rcBounds, 0.5)) + m_pShapeWriter->SetIsWriteGeom(false); + } + + break; + } } } } + oWriter.WriteString(m_pShapeWriter->ConvertShape()); } - - oWriter.WriteString(m_pShapeWriter->ConvertShape()); } void NSPresentationEditor::CPPTXWriter::WriteLayout(CLayout& oLayout, int nIndexLayout, int nStartLayout, int nIndexTheme) @@ -652,7 +762,7 @@ void NSPresentationEditor::CPPTXWriter::WriteLayout(CLayout& oLayout, int nIndex str1 += _T(""); oWriter.WriteString(str1); @@ -670,10 +780,10 @@ void NSPresentationEditor::CPPTXWriter::WriteLayout(CLayout& oLayout, int nIndex for (size_t nEl = 0; nEl < nElements; ++nEl) WriteElement(oWriter, oRels, oLayout.m_arElements[nEl]); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); + oWriter.WriteString(std::wstring(L"")); oRels.CloseRels(); @@ -726,11 +836,11 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide) { WriteElement(oWriter, oRels, oSlide.m_arElements[nEl], &m_pDocument->m_arThemes[oSlide.m_lThemeID].m_arLayouts[oSlide.m_lLayoutID]); } - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); - oWriter.WriteString(_T("")); - oWriter.WriteString(_T("")); - oWriter.WriteString(_T("")); + oWriter.WriteString(std::wstring(L"")); + oWriter.WriteString(std::wstring(L"")); + oWriter.WriteString(std::wstring(L"")); oRels.CloseRels(); @@ -748,3 +858,14 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide) strFile.Format(_T("slide%d.xml.rels"), nIndexSlide + 1); oRels.SaveRels(strFileSlidePath + _T("_rels") + FILE_SEPARATOR_STR + strFile); } + + +void NSPresentationEditor::CPPTXWriter::WriteSlides() +{ + size_t nCountSlides = m_pDocument->m_arSlides.size(); + for (size_t nIndexS = 0; nIndexS < nCountSlides; ++nIndexS) + { + CRelsGenerator::StartNotes((int)nIndexS, m_strTempDirectory, m_pDocument->m_arSlides[nIndexS].m_strComment); + WriteSlide((int)nIndexS); + } +} \ No newline at end of file diff --git a/ASCPresentationEditor/PPTXWriter/Converter.h b/ASCPresentationEditor/PPTXWriter/Converter.h index e55adb8499..fc7af08a6b 100644 --- a/ASCPresentationEditor/PPTXWriter/Converter.h +++ b/ASCPresentationEditor/PPTXWriter/Converter.h @@ -4,6 +4,7 @@ class CStylesWriter; +class CPPTUserInfo; namespace NSPresentationEditor { @@ -16,16 +17,19 @@ namespace NSPresentationEditor CString m_strTempDirectory; CString m_strDstFileName; - CDocument* m_pDocument; + CDocument * m_pDocument; + CPPTUserInfo* m_pUserInfo; CImageManager m_oManager; CShapeWriter* m_pShapeWriter; + public: CPPTXWriter(); ~CPPTXWriter(); - void CreateFile(CDocument* pDocument); + void CreateFile(CDocument * pDocument); + void CreateFile(CPPTUserInfo* pUserInfo); void CloseFile(); @@ -34,14 +38,19 @@ namespace NSPresentationEditor } protected: - void WriteContentTypes(); - void WriteApp(CFile& oFile); - void WritePresInfo(); - void WriteAll(); - void WriteBackground(CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground); - void WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout = NULL); - void WriteLayout(CLayout& oLayout, int nIndexLayout, int nStartLayout, int nIndexTheme); - void WriteSlide(int nIndexSlide); + void WriteApp (CFile& oFile); + void WriteContentTypes (); + void WritePresInfo (); + void WriteAll (); + void WriteThemes (); + void WriteSlides (); + void WriteLayout (CLayout& oLayout, int nIndexLayout, int nStartLayout, int nIndexTheme); + void WriteSlide (int nIndexSlide); + + void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector & colors, bool extra = false); + void WriteBackground (CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground); + void WriteElement (CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout = NULL); + }; } \ No newline at end of file diff --git a/ASCPresentationEditor/PPTXWriter/ImageManager.h b/ASCPresentationEditor/PPTXWriter/ImageManager.h index c0ae5d8db5..e4b59205fa 100644 --- a/ASCPresentationEditor/PPTXWriter/ImageManager.h +++ b/ASCPresentationEditor/PPTXWriter/ImageManager.h @@ -9,9 +9,9 @@ namespace NSPresentationEditor class CImageManager { private: - std::map m_mapImages; - LONG m_lIndexNextImage; - CString m_strDstMedia; + std::map m_mapImages; + LONG m_lIndexNextImage; + std::wstring m_strDstMedia; public: CImageManager() : m_mapImages(), m_lIndexNextImage(0) @@ -31,19 +31,21 @@ namespace NSPresentationEditor } public: - AVSINLINE CString GenerateImage(const CString& strInput) + AVSINLINE std::wstring GenerateImage(const std::wstring& strInput) { - std::map::iterator pPair = m_mapImages.find(strInput); + std::map::iterator pPair = m_mapImages.find(strInput); if (m_mapImages.end() != pPair) + { return pPair->second; + } if (IsNeedDownload(strInput)) return DownloadImage(strInput); - CString strExts = _T(".jpg"); - int nIndexExt = strInput.ReverseFind(TCHAR('.')); + std::wstring strExts = _T(".jpg"); + int nIndexExt = strInput.rfind(TCHAR('.')); if (-1 != nIndexExt) - strExts = strInput.Mid(nIndexExt); + strExts = strInput.substr(nIndexExt); if (strExts == _T(".tmp")) strExts = _T(".png"); @@ -51,27 +53,27 @@ namespace NSPresentationEditor CString strImage = _T(""); strImage.Format(_T("image%d"), m_lIndexNextImage++); - CString strOutput = m_strDstMedia + strImage + strExts; - strImage = _T("../media/") + strImage + strExts; - m_mapImages[strInput] = strImage; + std::wstring strOutput = m_strDstMedia + string2std_string(strImage) + strExts; + strImage = _T("../media/") + strImage + std_string2string(strExts); + m_mapImages[strInput] = string2std_string(strImage); // if (strOutput != strInput) - CDirectory::CopyFile(strInput, strOutput, NULL, NULL); + CDirectory::CopyFile(std_string2string(strInput), std_string2string(strOutput), NULL, NULL); return strImage; } - AVSINLINE bool IsNeedDownload(const CString& strFile) + AVSINLINE bool IsNeedDownload(const std::wstring& strFile) { - int n1 = strFile.Find(_T("www")); - int n2 = strFile.Find(_T("http")); - int n3 = strFile.Find(_T("ftp")); + int n1 = strFile.find(_T("www")); + int n2 = strFile.find(_T("http")); + int n3 = strFile.find(_T("ftp")); if (((n1 >= 0) && (n1 < 10)) || ((n2 >= 0) && (n2 < 10)) || ((n3 >= 0) && (n3 < 10))) return true; return false; } - AVSINLINE CString DownloadImage(const CString& strFile) + AVSINLINE std::wstring DownloadImage(const std::wstring& strFile) { #ifndef DISABLE_FILE_DOWNLOADER CFileDownloader oDownloader(strFile, TRUE); @@ -95,7 +97,7 @@ namespace NSPresentationEditor private: NSPresentationEditor::CStringWriter m_oWriter; int m_lNextRelsID; - std::map m_mapImages; + std::map m_mapImages; CImageManager* m_pManager; public: @@ -218,10 +220,10 @@ namespace NSPresentationEditor oFile.CloseFile(); } - AVSINLINE CString WriteImage(const CString& strImagePath) + AVSINLINE CString WriteImage(const std::wstring& strImagePath) { - CString strImage = m_pManager->GenerateImage(strImagePath); - std::map::iterator pPair = m_mapImages.find(strImage); + std::wstring strImage = m_pManager->GenerateImage(strImagePath); + std::map::iterator pPair = m_mapImages.find(strImage); if (m_mapImages.end() != pPair) { @@ -235,9 +237,9 @@ namespace NSPresentationEditor CString strRid = _T(""); strRid.Format(_T("rId%d"), m_lNextRelsID++); - CString strRels = _T(""); m_oWriter.WriteString(strRels); diff --git a/ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp b/ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp index 57d9f7c45d..0aacad6fa8 100644 --- a/ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp +++ b/ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp @@ -22,8 +22,314 @@ NSPresentationEditor::CShapeWriter::CShapeWriter() m_dHeight = 100; m_pFontManager = NULL; + + m_pImageElement = NULL; + m_pShapeElement = NULL; } +CString NSPresentationEditor::CShapeWriter::ConvertShape() +{ + if (m_pImageElement) return ConvertImage(); + + if (m_pShapeElement == NULL) return _T(""); + + m_oWriter.WriteString(std::wstring(L"")); + + WriteShapeInfo(); + + CGeomShapeInfo oInfo; + oInfo.SetBounds(m_oBounds); + + oInfo.m_dRotate = m_pShapeElement->m_dRotate; + oInfo.m_bFlipH = m_pShapeElement->m_bFlipH; + oInfo.m_bFlipV = m_pShapeElement->m_bFlipV; + + oInfo.m_lOriginalWidth = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetWidth(); + oInfo.m_lOriginalHeight = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetHeight(); + + m_oWriter.WriteString(std::wstring(L"")); + + if (m_bIsWriteGeom) + { + CString strPosition = _T(""); + if (0 == m_pShapeElement->m_dRotate) + { + strPosition.Format(_T(""), + (size_t) m_pShapeElement->m_rcBoundsOriginal.left, + (size_t) m_pShapeElement->m_rcBoundsOriginal.top, + (size_t)(m_pShapeElement->m_rcBoundsOriginal.right - m_pShapeElement->m_rcBoundsOriginal.left), + (size_t)(m_pShapeElement->m_rcBoundsOriginal.bottom - m_pShapeElement->m_rcBoundsOriginal.top)); + } + else + { + strPosition.Format(_T(""), + (int)(m_pShapeElement->m_dRotate * 60000), m_pShapeElement->m_bFlipH ? 1 : 0, m_pShapeElement->m_bFlipV ? 1 : 0, + (int) m_pShapeElement->m_rcBoundsOriginal.left, + (int) m_pShapeElement->m_rcBoundsOriginal.top, + (int)(m_pShapeElement->m_rcBoundsOriginal.right - m_pShapeElement->m_rcBoundsOriginal.left), + (int)(m_pShapeElement->m_rcBoundsOriginal.bottom - m_pShapeElement->m_rcBoundsOriginal.top)); + } + m_oWriter.WriteString(strPosition); + } + + if (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Graphic) + { + m_pShapeElement->m_oShape.ToRenderer(dynamic_cast(this), oInfo, m_oMetricInfo, 0.0, 1.0); + } + + if (m_oWriterVML.GetCurSize() >= 10) + { + if (_T("") == m_pShapeElement->m_oShape.m_strPPTXShape) + { + m_oWriter.WriteString(std::wstring(L"")); + + double dW = (std::max)(m_oBounds.GetWidth(), 0.1); + double dH = (std::max)(m_oBounds.GetHeight(), 0.1); + + int __l = (int)((m_oTextRect.left - m_oBounds.left) * 100000 / dW); + int __t = (int)((m_oTextRect.top - m_oBounds.top) * 100000 / dH); + int __r = (int)((m_oTextRect.right - m_oBounds.left) * 100000 / dW); + int __b = (int)((m_oTextRect.bottom - m_oBounds.top) * 100000 / dH); + + size_t __nCount = m_pShapeElement->m_oShape.m_oText.m_arParagraphs.size(); + if (0 == __nCount || (0x00 == (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Text))) + { + m_oWriter.WriteString(std::wstring(L"")); + } + else + { + CString strGuides = _T(""); + strGuides.Format(_T("\ + "), __l, __t, __r, __b); + m_oWriter.WriteString(strGuides); + + m_oWriter.WriteString(std::wstring(L"")); + } + m_oWriter.WriteString(std::wstring(L"")); + m_oWriter.Write(m_oWriterVML); + m_oWriter.WriteString(std::wstring(L"")); + + m_oWriter.WriteString(std::wstring(L"")); + } + else + { + m_oWriter.WriteString(m_pShapeElement->m_oShape.m_strPPTXShape); + } + + CBrush* pBrush = &m_pShapeElement->m_oShape.m_oBrush; + + if (pBrush->Type == c_BrushTypeTexture) + { + CString strRid = m_pRels->WriteImage(pBrush->TexturePath); + + CString strWrite = _T(""); + + m_oWriter.WriteString(strWrite); + } + else if (pBrush->Color1.m_lSchemeIndex == -1) + { + if (255 == pBrush->Alpha1) + { + CString str = _T(""); + str.Format(_T(""), pBrush->Color1.GetLONG_RGB()); + m_oWriter.WriteString(str); + } + else + { + CString str = _T(""); + str.Format(_T(""), pBrush->Color1.GetLONG_RGB(), (int)(pBrush->Alpha1 * 100000 / 255)); + m_oWriter.WriteString(str); + } + } + else + { + if (255 == pBrush->Alpha1) + { + CString str = _T("Color1.m_lSchemeIndex) + _T("\"/>"); + m_oWriter.WriteString(str); + } + else + { + CString strAlpha; strAlpha.Format(_T("%d"), (int)(pBrush->Alpha1 * 100000 / 255)); + + CString str = _T("Color1.m_lSchemeIndex) + _T("\">"); + + m_oWriter.WriteString(str); + } + } + //m_oWriter.WriteString(std::wstring(L"")); + + CPen* pPen = &m_pShapeElement->m_oShape.m_oPen; + CString strLine = _T(""); + strLine.Format(_T(""), (int)(pPen->Size * 36000)); + m_oWriter.WriteString(strLine); + + if (pPen->Color.m_lSchemeIndex == -1) + { + if (255 == pPen->Alpha) + { + CString str = _T(""); + str.Format(_T(""), pPen->Color.GetLONG_RGB()); + m_oWriter.WriteString(str); + } + else + { + CString str = _T(""); + str.Format(_T(""), pPen->Color.GetLONG_RGB(), (int)(pPen->Alpha * 100000 / 255)); + m_oWriter.WriteString(str); + } + } + else + { + if (255 == pPen->Alpha) + { + CString str = _T("Color.m_lSchemeIndex) + _T("\"/>"); + m_oWriter.WriteString(str); + } + else + { + CString strAlpha; strAlpha.Format(_T("%d"), (int)(pPen->Alpha * 100000 / 255)); + + CString str = _T("Color.m_lSchemeIndex) + _T("\">"); + m_oWriter.WriteString(str); + } + } + + m_oWriter.WriteString(std::wstring(L"")); + } + + m_oWriter.WriteString(std::wstring(L"")); + + WriteTextInfo(); + m_oWriter.WriteString(std::wstring(L"")); + + m_pShapeElement = NULL; + + return m_oWriter.GetData(); +} + +CString NSPresentationEditor::CShapeWriter::ConvertImage() +{ + m_oWriter.WriteString(std::wstring(L"")); + + WriteImageInfo(); + + CGeomShapeInfo oInfo; + oInfo.SetBounds(m_oBounds); + + oInfo.m_dRotate = m_pImageElement->m_dRotate; + oInfo.m_bFlipH = m_pImageElement->m_bFlipH; + oInfo.m_bFlipV = m_pImageElement->m_bFlipV; + + oInfo.m_lOriginalWidth = (LONG)m_pImageElement->m_rcBoundsOriginal.GetWidth(); + oInfo.m_lOriginalHeight = (LONG)m_pImageElement->m_rcBoundsOriginal.GetHeight(); + + m_oWriter.WriteString(std::wstring(L"")); + CString strRid = m_pRels->WriteImage(m_pImageElement->m_strFileName); + + CString strWrite = _T(""); + + m_oWriter.WriteString(strWrite); + + m_oWriter.WriteString(std::wstring(L"m_bCropEnabled) + { + CString sCrop; + sCrop.Format(L" l=\"%d\"", (size_t)(m_pImageElement->m_lcropFromLeft*1.5)); + m_oWriter.WriteString(sCrop); + sCrop.Format(L" t=\"%d\"", (size_t)(m_pImageElement->m_lcropFromTop*1.5)); + m_oWriter.WriteString(sCrop); + sCrop.Format(L" r=\"%d\"", (size_t)(m_pImageElement->m_lcropFromRight*1.5)); + m_oWriter.WriteString(sCrop); + sCrop.Format(L" b=\"%d\"", (size_t)(m_pImageElement->m_lcropFromBottom*1.5)); + m_oWriter.WriteString(sCrop); + } + m_oWriter.WriteString(std::wstring(L"/>")); + + if (m_pImageElement->m_bTile) + { + m_oWriter.WriteString(std::wstring(L"")); + } + else if (m_pImageElement->m_bStretch) + { + m_oWriter.WriteString(std::wstring(L"")); + } + + m_oWriter.WriteString(std::wstring(L"")); + + m_oWriter.WriteString(std::wstring(L"")); + + if (m_bIsWriteGeom) + { + CString strPosition = _T(""); + if (0 == m_pImageElement->m_dRotate) + { + strPosition.Format(_T(""), + (size_t) m_pImageElement->m_rcBoundsOriginal.left, + (size_t) m_pImageElement->m_rcBoundsOriginal.top, + (size_t)(m_pImageElement->m_rcBoundsOriginal.right - m_pImageElement->m_rcBoundsOriginal.left), + (size_t)(m_pImageElement->m_rcBoundsOriginal.bottom - m_pImageElement->m_rcBoundsOriginal.top)); + } + else + { + strPosition.Format(_T(""), + (int)(m_pImageElement->m_dRotate * 60000), m_pImageElement->m_bFlipH ? 1 : 0, m_pImageElement->m_bFlipV ? 1 : 0, + (int) m_pImageElement->m_rcBoundsOriginal.left, + (int) m_pImageElement->m_rcBoundsOriginal.top, + (int)(m_pImageElement->m_rcBoundsOriginal.right - m_pImageElement->m_rcBoundsOriginal.left), + (int)(m_pImageElement->m_rcBoundsOriginal.bottom - m_pImageElement->m_rcBoundsOriginal.top)); + } + m_oWriter.WriteString(strPosition); + } + m_oWriter.WriteString(std::wstring(L"")); + m_oWriter.WriteString(std::wstring(L"")); + + + //CPen* pPen = &m_pImageElement->m_oShape.m_oPen; + //CString strLine = _T(""); + //strLine.Format(_T(""), (int)(pPen->Size * 36000)); + //m_oWriter.WriteString(strLine); + + //if (pPen->Color.m_lSchemeIndex == -1) + //{ + // if (255 == pPen->Alpha) + // { + // CString str = _T(""); + // str.Format(_T(""), pPen->Color.GetLONG_RGB()); + // m_oWriter.WriteString(str); + // } + // else + // { + // CString str = _T(""); + // str.Format(_T(""), pPen->Color.GetLONG_RGB(), (int)(pPen->Alpha * 100000 / 255)); + // m_oWriter.WriteString(str); + // } + //} + //else + //{ + // if (255 == pPen->Alpha) + // { + // CString str = _T("Color.m_lSchemeIndex) + _T("\"/>"); + // m_oWriter.WriteString(str); + // } + // else + // { + // CString strAlpha; strAlpha.Format(_T("%d"), (int)(pPen->Alpha * 100000 / 255)); + + // CString str = _T("Color.m_lSchemeIndex) + _T("\">"); + // m_oWriter.WriteString(str); + // } + //} + //m_oWriter.WriteString(std::wstring(L"")); + + m_oWriter.WriteString(std::wstring(L"")); + + m_oWriter.WriteString(std::wstring(L"")); + + m_pImageElement = NULL; + return m_oWriter.GetData(); +} HRESULT NSPresentationEditor::CShapeWriter::get_Type(LONG* lType) { @@ -271,12 +577,12 @@ HRESULT NSPresentationEditor::CShapeWriter::put_BrushAlpha2(const LONG& lAlpha) HRESULT NSPresentationEditor::CShapeWriter::get_BrushTexturePath(std::wstring* bsPath) { if (bsPath == NULL) return S_OK; - *bsPath = string2std_string(m_oBrush.TexturePath); + *bsPath = m_oBrush.TexturePath; return S_OK; } HRESULT NSPresentationEditor::CShapeWriter::put_BrushTexturePath(const std::wstring& bsPath) { - m_oBrush.TexturePath = std_string2string(bsPath); + m_oBrush.TexturePath = bsPath; return S_OK; } HRESULT NSPresentationEditor::CShapeWriter::get_BrushTextureMode(LONG* lMode) @@ -338,18 +644,18 @@ HRESULT NSPresentationEditor::CShapeWriter::SetFont(BSTR bsXML) HRESULT NSPresentationEditor::CShapeWriter::get_FontName(std::wstring* bsName) { if (bsName == NULL) return S_OK; - *bsName = string2std_string(m_oFont.Name); + *bsName = m_oFont.Name; return S_OK; } HRESULT NSPresentationEditor::CShapeWriter::put_FontName(const std::wstring& bsName) { - m_oFont.Name = std_string2string(bsName); + m_oFont.Name = bsName; return S_OK; } HRESULT NSPresentationEditor::CShapeWriter::get_FontPath(std::wstring* bsName) { if (bsName == NULL) return S_OK; - *bsName = string2std_string(m_oFont.Path); + *bsName = m_oFont.Path; return S_OK; } HRESULT NSPresentationEditor::CShapeWriter::put_FontPath(const std::wstring& bsName) @@ -696,7 +1002,7 @@ HRESULT NSPresentationEditor::CShapeWriter::DrawPath(const LONG& nType) str.Format(_T("")); m_oWriterVML.WriteString(str); m_oWriterVML.Write(m_oWriterPath); - m_oWriterVML.WriteString(_T("")); + m_oWriterVML.WriteString(std::wstring(L"")); } else if (bIsStroke) { @@ -704,7 +1010,7 @@ HRESULT NSPresentationEditor::CShapeWriter::DrawPath(const LONG& nType) str.Format(_T("")); m_oWriterVML.WriteString(str); m_oWriterVML.Write(m_oWriterPath); - m_oWriterVML.WriteString(_T("")); + m_oWriterVML.WriteString(std::wstring(L"")); } else if (bIsFill) { @@ -712,7 +1018,7 @@ HRESULT NSPresentationEditor::CShapeWriter::DrawPath(const LONG& nType) str.Format(_T("")); m_oWriterVML.WriteString(str); m_oWriterVML.Write(m_oWriterPath); - m_oWriterVML.WriteString(_T("")); + m_oWriterVML.WriteString(std::wstring(L"")); } return S_OK; diff --git a/ASCPresentationEditor/PPTXWriter/ShapeWriter.h b/ASCPresentationEditor/PPTXWriter/ShapeWriter.h index 6c3667edc0..041b86bdcf 100644 --- a/ASCPresentationEditor/PPTXWriter/ShapeWriter.h +++ b/ASCPresentationEditor/PPTXWriter/ShapeWriter.h @@ -43,6 +43,7 @@ namespace NSPresentationEditor NSPresentationEditor::CMetricInfo m_oMetricInfo; NSPresentationEditor::CShapeElement* m_pShapeElement; + NSPresentationEditor::CImageElement* m_pImageElement; NSPresentationEditor::CRelsGenerator* m_pRels; @@ -62,7 +63,21 @@ namespace NSPresentationEditor { m_lNextShapeID = 1000; } + AVSINLINE void SetShape(CImageElement* pShapeElem) + { + m_pSimpleGraphicsConverter->PathCommandEnd(); + m_pImageElement = pShapeElem; + m_oMetricInfo = m_pImageElement->m_oMetric; + m_oBounds = m_pImageElement->m_rcBounds; + m_oTextRect = m_oBounds; + + m_bIsWriteGeom = true; + + m_oWriter.ClearNoAttack(); + m_oWriterPath.ClearNoAttack(); + m_oWriterVML.ClearNoAttack(); + } AVSINLINE void SetShape(CShapeElement* pShapeElem) { m_pSimpleGraphicsConverter->PathCommandEnd(); @@ -87,178 +102,8 @@ namespace NSPresentationEditor { m_bIsWriteGeom = bIsWrite; } - AVSINLINE CString ConvertShape() - { - m_oWriter.WriteString(_T("")); - - WriteShapeInfo(); - - CGeomShapeInfo oInfo; - oInfo.SetBounds(m_oBounds); - - oInfo.m_dRotate = m_pShapeElement->m_dRotate; - oInfo.m_bFlipH = m_pShapeElement->m_bFlipH; - oInfo.m_bFlipV = m_pShapeElement->m_bFlipV; - - oInfo.m_lOriginalWidth = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetWidth(); - oInfo.m_lOriginalHeight = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetHeight(); - - m_oWriter.WriteString(_T("")); - - if (m_bIsWriteGeom) - { - CString strPosition = _T(""); - if (0 == m_pShapeElement->m_dRotate) - { - strPosition.Format(_T(""), (size_t)m_pShapeElement->m_rcBoundsOriginal.left, (size_t)m_pShapeElement->m_rcBoundsOriginal.top, - (size_t)(m_pShapeElement->m_rcBoundsOriginal.right - m_pShapeElement->m_rcBoundsOriginal.left), - (size_t)(m_pShapeElement->m_rcBoundsOriginal.bottom - m_pShapeElement->m_rcBoundsOriginal.top)); - } - else - { - strPosition.Format(_T(""), - (int)(m_pShapeElement->m_dRotate * 60000), m_pShapeElement->m_bFlipH ? 1 : 0, m_pShapeElement->m_bFlipV ? 1 : 0, - (int)m_pShapeElement->m_rcBoundsOriginal.left, (int)m_pShapeElement->m_rcBoundsOriginal.top, - (int)(m_pShapeElement->m_rcBoundsOriginal.right - m_pShapeElement->m_rcBoundsOriginal.left), - (int)(m_pShapeElement->m_rcBoundsOriginal.bottom - m_pShapeElement->m_rcBoundsOriginal.top)); - } - m_oWriter.WriteString(strPosition); - } - - if (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Graphic) - { - m_pShapeElement->m_oShape.ToRenderer(dynamic_cast(this), oInfo, m_oMetricInfo, 0.0, 1.0); - } - - if (m_oWriterVML.GetCurSize() >= 10) - { - if (_T("") == m_pShapeElement->m_oShape.m_strPPTXShape) - { - m_oWriter.WriteString(_T("")); - - double dW = (std::max)(m_oBounds.GetWidth(), 0.1); - double dH = (std::max)(m_oBounds.GetHeight(), 0.1); - - int __l = (int)((m_oTextRect.left - m_oBounds.left) * 100000 / dW); - int __t = (int)((m_oTextRect.top - m_oBounds.top) * 100000 / dH); - int __r = (int)((m_oTextRect.right - m_oBounds.left) * 100000 / dW); - int __b = (int)((m_oTextRect.bottom - m_oBounds.top) * 100000 / dH); - - size_t __nCount = m_pShapeElement->m_oShape.m_oText.m_arParagraphs.size(); - if (0 == __nCount || (0x00 == (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Text))) - { - m_oWriter.WriteString(_T("")); - } - else - { - CString strGuides = _T(""); - strGuides.Format(_T("\ - "), __l, __t, __r, __b); - m_oWriter.WriteString(strGuides); - - m_oWriter.WriteString(_T("")); - } - m_oWriter.WriteString(_T("")); - m_oWriter.Write(m_oWriterVML); - m_oWriter.WriteString(_T("")); - - m_oWriter.WriteString(_T("")); - } - else - { - m_oWriter.WriteString(m_pShapeElement->m_oShape.m_strPPTXShape); - } - - CBrush* pBrush = &m_pShapeElement->m_oShape.m_oBrush; - - if (pBrush->Type == c_BrushTypeTexture) - { - CString strRid = m_pRels->WriteImage(pBrush->TexturePath); - - CString strWrite = _T(""); - - m_oWriter.WriteString(strWrite); - } - else if (pBrush->Color1.m_lSchemeIndex == -1) - { - if (255 == pBrush->Alpha1) - { - CString str = _T(""); - str.Format(_T(""), pBrush->Color1.GetLONG_RGB()); - m_oWriter.WriteString(str); - } - else - { - CString str = _T(""); - str.Format(_T(""), pBrush->Color1.GetLONG_RGB(), (int)(pBrush->Alpha1 * 100000 / 255)); - m_oWriter.WriteString(str); - } - } - else - { - if (255 == pBrush->Alpha1) - { - CString str = _T("Color1.m_lSchemeIndex) + _T("\"/>"); - m_oWriter.WriteString(str); - } - else - { - CString strAlpha; strAlpha.Format(_T("%d"), (int)(pBrush->Alpha1 * 100000 / 255)); - - CString str = _T("Color1.m_lSchemeIndex) + _T("\">"); - - m_oWriter.WriteString(str); - } - } - //m_oWriter.WriteString(_T("")); - - CPen* pPen = &m_pShapeElement->m_oShape.m_oPen; - CString strLine = _T(""); - strLine.Format(_T(""), (int)(pPen->Size * 36000)); - m_oWriter.WriteString(strLine); - - if (pPen->Color.m_lSchemeIndex == -1) - { - if (255 == pPen->Alpha) - { - CString str = _T(""); - str.Format(_T(""), pPen->Color.GetLONG_RGB()); - m_oWriter.WriteString(str); - } - else - { - CString str = _T(""); - str.Format(_T(""), pPen->Color.GetLONG_RGB(), (int)(pPen->Alpha * 100000 / 255)); - m_oWriter.WriteString(str); - } - } - else - { - if (255 == pPen->Alpha) - { - CString str = _T("Color.m_lSchemeIndex) + _T("\"/>"); - m_oWriter.WriteString(str); - } - else - { - CString strAlpha; strAlpha.Format(_T("%d"), (int)(pPen->Alpha * 100000 / 255)); - - CString str = _T("Color.m_lSchemeIndex) + _T("\">"); - m_oWriter.WriteString(str); - } - } - - m_oWriter.WriteString(_T("")); - } - - m_oWriter.WriteString(_T("")); - - WriteTextInfo(); - m_oWriter.WriteString(_T("")); - return m_oWriter.GetData(); - } - + CString ConvertShape(); + CString ConvertImage(); // ----------------------------------------------------------------------------- virtual HRESULT get_Type(LONG* lType) ; //-------- -------------------------------------------------- @@ -441,13 +286,11 @@ namespace NSPresentationEditor if (_T("") == m_oFont.Path) { - std::wstring bsName = string2std_string(m_oFont.Name); - m_pFontManager->LoadFontByName(bsName, (float)m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY); + m_pFontManager->LoadFontByName(m_oFont.Name, (float)m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY); } else { - std::wstring bsName = string2std_string(m_oFont.Path); - m_pFontManager->LoadFontFromFile(bsName, (float)m_oFont.Size, m_dDpiX, m_dDpiY, 0); + m_pFontManager->LoadFontFromFile(m_oFont.Path, (float)m_oFont.Size, m_dDpiX, m_dDpiY, 0); } m_oInstalledFont = m_oFont; @@ -539,13 +382,18 @@ namespace NSPresentationEditor void WriteShapeInfo() { - CString str1 = _T(""); - m_oWriter.WriteString(str1); + m_oWriter.WriteString(std::wstring(L"")); CString strShapeID = _T(""); - strShapeID.Format(_T(""), - m_lNextShapeID, m_lNextShapeID); - m_oWriter.WriteString(strShapeID); + strShapeID.Format(_T("%d", m_lNextShapeID)); + + m_oWriter.WriteString(std::wstring(L"m_sName.empty()) m_pShapeElement->m_sName = std::wstring(L"Shape ") + string2std_string(strShapeID); + + m_oWriter.WriteString(std::wstring(L" name=\"") + m_pShapeElement->m_sName + L"\""); + + m_oWriter.WriteString(std::wstring(L">")); ++m_lNextShapeID; @@ -572,13 +420,60 @@ namespace NSPresentationEditor } else { - m_oWriter.WriteString(_T("")); + m_oWriter.WriteString(std::wstring(L"")); } CString str2 = _T(""); m_oWriter.WriteString(str2); } + void WriteImageInfo() + { + m_oWriter.WriteString(std::wstring(L"")); + + CString strShapeID; + strShapeID.Format(_T("%d"), m_lNextShapeID); + + m_oWriter.WriteString(std::wstring(L"m_sName.empty()) m_pImageElement->m_sName = std::wstring(L"Image ") + string2std_string(strShapeID); + + m_oWriter.WriteString(std::wstring(L" name=\"") + m_pImageElement->m_sName + L"\""); + + m_oWriter.WriteString(std::wstring(L">")); + + ++m_lNextShapeID; + + if (-1 != m_pImageElement->m_lPlaceholderType) + { + if (15 == m_pImageElement->m_lPlaceholderType) + m_pImageElement->m_lPlaceholderID = -1; + if (0 == m_pImageElement->m_lPlaceholderType) + m_pImageElement->m_lPlaceholderID = 1; + + if (-1 == m_pImageElement->m_lPlaceholderID) + { + CString strPlaceholder = _T("m_lPlaceholderType) +_T("\"/>"); + + m_oWriter.WriteString(strPlaceholder); + } + else + { + CString strIdx; strIdx.Format(_T("%d"), m_pImageElement->m_lPlaceholderID); + CString strPlaceholder = _T("m_lPlaceholderType) + _T("\" idx=\"") + strIdx + _T("\"/>"); + + m_oWriter.WriteString(strPlaceholder); + } + } + else + { + m_oWriter.WriteString(std::wstring(L"")); + } + + CString str2 = _T(""); + m_oWriter.WriteString(str2); + } + void WriteTextInfo() { size_t nCount = m_pShapeElement->m_oShape.m_oText.m_arParagraphs.size(); @@ -592,11 +487,13 @@ namespace NSPresentationEditor return; } - CString str1 = _T(""); - m_oWriter.WriteString(str1); + m_oWriter.WriteString(std::wstring(L"")); - CString str2 = _T(""); - m_oWriter.WriteString(str2); + m_oWriter.WriteString(std::wstring(L"m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 0 ) m_oWriter.WriteString(" anchor=\"t\""); + if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 2 ) m_oWriter.WriteString(" anchor=\"b\""); + m_oWriter.WriteString(std::wstring(L"/>")); CString str3 = _T(""); m_oWriter.WriteString(str3); @@ -619,7 +516,7 @@ namespace NSPresentationEditor if (pPF->fontAlign.is_init()) { CString strProp = CStylesWriter::GetFontAlign(pPF->fontAlign.get()); - m_oWriter.WriteString(_T(" fontAlgn=\"") + strProp + _T("\"")); + m_oWriter.WriteString(std::wstring(L" fontAlgn=\"") + string2std_string(strProp) + _T("\"")); } if (pPF->leftMargin.is_init()) { @@ -636,7 +533,7 @@ namespace NSPresentationEditor if (pPF->textAlignment.is_init()) { CString strProp = CStylesWriter::GetTextAlign(pPF->textAlignment.get()); - m_oWriter.WriteString(_T(" algn=\"") + strProp + _T("\"")); + m_oWriter.WriteString(std::wstring(L" algn=\"") + string2std_string(strProp) + _T("\"")); } if (pPF->defaultTabSize.is_init()) { @@ -701,17 +598,22 @@ namespace NSPresentationEditor { if (pPF->hasBullet.get()) { - m_oWriter.WriteString(_T("")); + wchar_t bu = 0x2022; + m_oWriter.WriteString(std::wstring(L"bulletChar.is_init()) + { + bu = pPF->bulletChar.get(); + } + m_oWriter.WriteString(bu); + m_oWriter.WriteString(std::wstring(L"\"/>")); } else { - m_oWriter.WriteString(_T("")); + m_oWriter.WriteString(std::wstring(L"")); } } - m_oWriter.WriteString(_T("")); + m_oWriter.WriteString(std::wstring(L"")); size_t nCountSpans = pParagraph->m_arSpans.size(); for (size_t nSpan = 0; nSpan < nCountSpans; ++nSpan) @@ -729,7 +631,7 @@ namespace NSPresentationEditor } else { - m_oWriter.WriteString(_T("")); + m_oWriter.WriteString(std::wstring(L"")); } continue; } @@ -764,18 +666,18 @@ namespace NSPresentationEditor if (pCF->FontBold.is_init()) { if (pCF->FontBold.get()) - m_oWriter.WriteString(_T(" b=\"1\"")); + m_oWriter.WriteString(std::wstring(L" b=\"1\"")); else - m_oWriter.WriteString(_T(" b=\"0\"")); + m_oWriter.WriteString(std::wstring(L" b=\"0\"")); } if (pCF->FontItalic.is_init()) { if (pCF->FontItalic.get()) - m_oWriter.WriteString(_T(" i=\"1\"")); + m_oWriter.WriteString(std::wstring(L" i=\"1\"")); else - m_oWriter.WriteString(_T(" i=\"0\"")); + m_oWriter.WriteString(std::wstring(L" i=\"0\"")); } - m_oWriter.WriteString(_T(">")); + m_oWriter.WriteString(std::wstring(L">")); if (pCF->Color.is_init()) { @@ -809,10 +711,10 @@ namespace NSPresentationEditor } else if (pCF->FontProperties.is_init()) { - m_oWriter.WriteString(_T("FontProperties->strFontName + _T("\"/>")); + m_oWriter.WriteString(std::wstring(L"FontProperties->strFontName + _T("\"/>")); } - m_oWriter.WriteString(_T("")); + m_oWriter.WriteString(std::wstring(L"")); if (!bIsBr) { @@ -826,11 +728,11 @@ namespace NSPresentationEditor CString strT2 = _T(""); m_oWriter.WriteString(strT2); - m_oWriter.WriteString(_T("")); + m_oWriter.WriteString(std::wstring(L"")); } else { - m_oWriter.WriteString(_T("")); + m_oWriter.WriteString(std::wstring(L"")); } } diff --git a/ASCPresentationEditor/PPTXWriter/StylesWriter.h b/ASCPresentationEditor/PPTXWriter/StylesWriter.h index e5f4938f64..8496f70d0e 100644 --- a/ASCPresentationEditor/PPTXWriter/StylesWriter.h +++ b/ASCPresentationEditor/PPTXWriter/StylesWriter.h @@ -34,7 +34,23 @@ public: return _T("justLow"); return _T("l"); } - + //oArrayMem.push_back(oScheme[0]);//0 + //oArrayMem.push_back(oScheme[1]);//1 + //oArrayMem.push_back(oScheme[2]);//2 + //oArrayMem.push_back(oScheme[3]);//3 + //oArrayMem.push_back(oScheme[0]);//4 + //oArrayMem.push_back(oScheme[4]);//5 //accent1 + //oArrayMem.push_back(oScheme[5]);//6 //accent2 + //oArrayMem.push_back(oScheme[0]);//7 //accent3 + //oArrayMem.push_back(oScheme[5]);//8 //accent4 + //oArrayMem.push_back(oScheme[4]);//9 //accent5 + //oArrayMem.push_back(oScheme[7]);//10 //accent6 + //oArrayMem.push_back(oScheme[6]);//11 //hlink + //oArrayMem.push_back(oScheme[7]);//12 //folHlink + //oArrayMem.push_back(oScheme[0]);//13 //lt1 + //oArrayMem.push_back(oScheme[1]);//14 //dk1 + //oArrayMem.push_back(oScheme[2]);//15 //lt2 + //oArrayMem.push_back(oScheme[3]);//16 //dk2 AVSINLINE static CString GetColorInScheme(const LONG& lIndex) { switch (lIndex) @@ -112,7 +128,7 @@ public: if (pPF->fontAlign.is_init()) { CString strProp = GetFontAlign(pPF->fontAlign.get()); - oWriter.WriteString(_T(" fontAlgn=\"") + strProp + _T("\"")); + oWriter.WriteString(std::wstring(L" fontAlgn=\"") + string2std_string(strProp) + _T("\"")); } if (pPF->leftMargin.is_init()) { @@ -129,7 +145,7 @@ public: if (pPF->textAlignment.is_init()) { CString strProp = GetTextAlign(pPF->textAlignment.get()); - oWriter.WriteString(_T(" algn=\"") + strProp + _T("\"")); + oWriter.WriteString(std::wstring(L" algn=\"") + string2std_string(strProp) + _T("\"")); } if (pPF->defaultTabSize.is_init()) { @@ -144,8 +160,14 @@ public: { if (pPF->hasBullet.get()) { - CString strB = _T(""); //todooo - oWriter.WriteString(strB); + wchar_t bu = 0x2022; + if (pPF->bulletChar.is_init()) + { + bu = pPF->bulletChar.get(); + } + oWriter.WriteString(std::wstring(L"")); } else { @@ -218,18 +240,18 @@ public: if (pCF->FontBold.is_init()) { if (pCF->FontBold.get()) - oWriter.WriteString(_T(" b=\"1\"")); + oWriter.WriteString(std::wstring(L" b=\"1\"")); else - oWriter.WriteString(_T(" b=\"0\"")); + oWriter.WriteString(std::wstring(L" b=\"0\"")); } if (pCF->FontItalic.is_init()) { if (pCF->FontItalic.get()) - oWriter.WriteString(_T(" i=\"1\"")); + oWriter.WriteString(std::wstring(L" i=\"1\"")); else - oWriter.WriteString(_T(" i=\"0\"")); + oWriter.WriteString(std::wstring(L" i=\"0\"")); } - oWriter.WriteString(_T(">")); + oWriter.WriteString(std::wstring(L">")); if (pCF->Color.is_init()) { @@ -263,7 +285,7 @@ public: } else if (pCF->FontProperties.is_init()) { - oWriter.WriteString(_T("FontProperties->strFontName + _T("\"/>")); + oWriter.WriteString(std::wstring(L"FontProperties->strFontName + _T("\"/>")); } CString strCF2 = _T(""); diff --git a/Common/DocxFormat/Source/SystemUtility/File.h b/Common/DocxFormat/Source/SystemUtility/File.h index 6890ef3761..9506e2225b 100644 --- a/Common/DocxFormat/Source/SystemUtility/File.h +++ b/Common/DocxFormat/Source/SystemUtility/File.h @@ -269,7 +269,17 @@ public: RELEASEARRAYOBJECTS(pData); } + void WriteStringUTF8(const std::wstring& strXml) + { + BYTE* pData = NULL; + LONG lLen = 0; + NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strXml.c_str(), strXml.length(), pData, lLen, false); + + WriteFile(pData, lLen); + + RELEASEARRAYOBJECTS(pData); + } protected: FILE* m_pFile; diff --git a/Common/FileDownloader.h b/Common/FileDownloader.h index c787887a0d..a890d62458 100644 --- a/Common/FileDownloader.h +++ b/Common/FileDownloader.h @@ -29,7 +29,7 @@ class CFileDownloader : public CBaseThread { public : - CFileDownloader (CString sFileUrl, bool bDelete = true) : CBaseThread(0) + CFileDownloader (std::wstring sFileUrl, bool bDelete = true) : CBaseThread(0) { m_pFile = NULL; m_sFilePath = _T(""); @@ -44,16 +44,16 @@ public : ::fclose( m_pFile ); m_pFile = NULL; } - if ( m_sFilePath.GetLength() > 0 && m_bDelete ) + if ( m_sFilePath.length() > 0 && m_bDelete ) { - DeleteFileW( m_sFilePath.GetBuffer() ); + DeleteFileW( m_sFilePath.c_str() ); m_sFilePath = _T(""); } } - CString GetFilePath() + std::wstring GetFilePath() { return m_sFilePath; } @@ -63,7 +63,7 @@ public : } protected : - unsigned int DownloadFile(CString sFileUrl) + unsigned int DownloadFile(std::wstring sFileUrl) { // Проверяем состояние соединения if ( FALSE == InternetGetConnectedState ( 0, 0 ) ) @@ -90,7 +90,7 @@ protected : // Заголовок запроса ( пока содержит 0 байт ( необходимо для проверки ) ) CString sHTTPHdr = _T ("Range: bytes=0-0"); // Открываем ссылку для проверки на ее существование, а также на возможность чтения частями - HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternetSession, sFileUrl, sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 ); + HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternetSession, sFileUrl.c_str(), sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 ); if ( NULL != hInternetOpenURL ) { // Открытие произошло, проверяем ответ @@ -173,7 +173,7 @@ protected : return S_OK; } - DWORD DownloadFilePath ( HINTERNET hInternet, LPBYTE pBuffer, LONGLONG nStartByte, LONGLONG nEndByte, CString sFileURL ) + DWORD DownloadFilePath ( HINTERNET hInternet, LPBYTE pBuffer, LONGLONG nStartByte, LONGLONG nEndByte, std::wstring sFileURL ) { // Неоткрытая сессия if ( NULL == hInternet ) @@ -186,7 +186,7 @@ protected : // Заголовок запроса ( содержит nEndByte - nStartByte байт ) CString sHTTPHdr = _T (""); sHTTPHdr.Format ( _T ("Range: bytes=%lld-%lld"), nStartByte, nEndByte ); // Открываем ссылку для закачки - HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternet, sFileURL, sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 ); + HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternet, sFileURL.c_str(), sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 ); if ( NULL == hInternetOpenURL ) return -1; // Открытие произошло, проверяем ответ @@ -329,7 +329,7 @@ protected : return nFileSize; } - HRESULT DownloadFileAll(CString sFileURL, CString strFileOutput) + HRESULT DownloadFileAll(std::wstring sFileURL, std::wstring strFileOutput) { if ( m_pFile ) { @@ -337,7 +337,7 @@ protected : m_pFile = NULL; } // Скачиваем файл - return URLDownloadToFile (NULL, sFileURL, strFileOutput, NULL, NULL); + return URLDownloadToFile (NULL, sFileURL.c_str(), strFileOutput.c_str(), NULL, NULL); } public: @@ -357,12 +357,12 @@ public: protected : - FILE *m_pFile; // Хэндл на временный файл - CString m_sFilePath; // Путь к сохраненному файлу на диске - CString m_sFileUrl; // Ссылка на скачивание файла + FILE *m_pFile; // Хэндл на временный файл + std::wstring m_sFilePath; // Путь к сохраненному файлу на диске + std::wstring m_sFileUrl; // Ссылка на скачивание файла - bool m_bComplete; // Закачался файл или нет - bool m_bDelete; // Удалять ли файл в деструкторе + bool m_bComplete; // Закачался файл или нет + bool m_bDelete; // Удалять ли файл в деструкторе }; #else diff --git a/XlsxSerializerCom/Common/Common.cpp b/XlsxSerializerCom/Common/Common.cpp index cf466812f9..3c02b9afd0 100644 --- a/XlsxSerializerCom/Common/Common.cpp +++ b/XlsxSerializerCom/Common/Common.cpp @@ -18,7 +18,7 @@ namespace SerializeCommon CString DownloadImage(const CString& strFile) { #ifndef DISABLE_FILE_DOWNLOADER - CFileDownloader oDownloader(strFile, false); + CFileDownloader oDownloader(string2std_string(strFile), false); oDownloader.Start( 1 ); while ( oDownloader.IsRunned() ) { @@ -27,7 +27,7 @@ namespace SerializeCommon CString strFileName; if ( oDownloader.IsFileDownloaded() ) { - strFileName = oDownloader.GetFilePath(); + strFileName = std_string2string(oDownloader.GetFilePath()); } return strFileName; #else