diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h index 9f04631be9..ffb609cdbb 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h +++ b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h @@ -25,7 +25,7 @@ public: private: - LONG m_Status; + int m_Status; void* m_pReader; diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfo.h b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfo.h index a62d1b0409..d8c8d514ba 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfo.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfo.h @@ -93,9 +93,9 @@ public: } } - LONG GetCountPicturesUsed(size_t nUser) + int GetCountPicturesUsed(size_t nUser) { - LONG lRes = 0; + int lRes = 0; for (size_t i = 0; i < m_arUsers[nUser]->m_arEmptyPictures.size(); ++i) { if (!m_arUsers[nUser]->m_arEmptyPictures[i]) diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.cpp b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.cpp index 797cd19171..333464eb2b 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.cpp @@ -557,11 +557,11 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide) } } -LONG CPPTUserInfo::AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector & text, bool addShapes) +int CPPTUserInfo::AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector & text, bool addShapes) { if (pTheme == NULL) return -1; - LONG ind = pTheme->m_arLayouts.size(); + int ind = pTheme->m_arLayouts.size(); CLayout layout; pTheme->m_arLayouts.push_back(layout); diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.h b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.h index 94ec6ce51e..d30bfe0db6 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfoOneUser.h @@ -284,5 +284,5 @@ public: void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement); void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath); - LONG AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector & text, bool addShapes = true); + int AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector & text, bool addShapes = true); }; diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/SlideInfo.h b/ASCOfficePPTFile/PPTFormatLib/Reader/SlideInfo.h index b1eca115fa..20f0e2a7bd 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/SlideInfo.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/SlideInfo.h @@ -4,14 +4,14 @@ class CElementInfo { public: - LONG m_lOffsetTextStyle; - LONG m_lOffsetTextProp; + int m_lOffsetTextStyle; + int m_lOffsetTextProp; POLE::Stream* m_pStream; - LONG m_lPersistIndex; + int m_lPersistIndex; - LONG m_lMasterTextType; - LONG m_lMasterPlaceholderType; + int m_lMasterTextType; + int m_lMasterPlaceholderType; public: CElementInfo() @@ -100,7 +100,7 @@ public: if (NULL == m_parEmptyPictures) return lIndex; - LONG lResult = 0; + int lResult = 0; DWORD nCount = m_parEmptyPictures->size(); if (lIndex > nCount) diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h index 88cb394010..d3a79de973 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h @@ -1366,7 +1366,7 @@ public: PPTShapes::ShapeType eType = (PPTShapes::ShapeType)oArrayShape[0]->m_oHeader.RecInstance; ElementType elType = GetTypeElem((NSOfficeDrawing::SPT)oArrayShape[0]->m_oHeader.RecInstance); - LONG lMasterID = -1; + int lMasterID = -1; IElement * pElementLayout = NULL; @@ -1539,8 +1539,8 @@ public: GetRecordsByType(&oArrayPlaceHolder, true, true); if (0 < oArrayPlaceHolder.size()) { - pElem->m_lPlaceholderID = (LONG)(oArrayPlaceHolder[0]->m_nPosition); - pElem->m_lPlaceholderType = (LONG)(oArrayPlaceHolder[0]->m_nPlacementID); + pElem->m_lPlaceholderID = (int)(oArrayPlaceHolder[0]->m_nPosition); + pElem->m_lPlaceholderType = (int)(oArrayPlaceHolder[0]->m_nPlacementID); if (0 == pElem->m_lPlaceholderType) pElem->m_lPlaceholderID = 1; @@ -1732,12 +1732,12 @@ public: double dAngle = pShapeElem->m_dRotate; if (0 <= dAngle) { - LONG lCount = (LONG)dAngle / 360; + int lCount = (int)dAngle / 360; dAngle -= (lCount * 360.0); } else { - LONG lCount = (LONG)dAngle / 360; + int lCount = (int)dAngle / 360; dAngle += ((-lCount + 1) * 360.0); } if (((dAngle > 45) && (dAngle < 135)) || ((dAngle > 225) && (dAngle < 315))) @@ -1796,19 +1796,19 @@ public: return; // здесь переводим координаты, чтобы они не зависили от группы - LONG lWidthClient = m_pGroupClientAnchor->right - m_pGroupClientAnchor->left; - LONG lHeightClient = m_pGroupClientAnchor->bottom - m_pGroupClientAnchor->top; - LONG lWidthGroup = m_pGroupBounds->right - m_pGroupBounds->left; - LONG lHeightGroup = m_pGroupBounds->bottom - m_pGroupBounds->top; + long lWidthClient = m_pGroupClientAnchor->right - m_pGroupClientAnchor->left; + long lHeightClient = m_pGroupClientAnchor->bottom - m_pGroupClientAnchor->top; + long lWidthGroup = m_pGroupBounds->right - m_pGroupBounds->left; + long lHeightGroup = m_pGroupBounds->bottom - m_pGroupBounds->top; double dScaleX = (double)(lWidthClient) / (lWidthGroup); double dScaleY = (double)(lHeightClient) / (lHeightGroup); - rcChildAnchor.left = m_pGroupClientAnchor->left + (LONG)(dScaleX * (rcChildAnchor.left - m_pGroupBounds->left)); - rcChildAnchor.right = m_pGroupClientAnchor->left + (LONG)(dScaleX * (rcChildAnchor.right - m_pGroupBounds->left)); + rcChildAnchor.left = m_pGroupClientAnchor->left + (long)(dScaleX * (rcChildAnchor.left - m_pGroupBounds->left)); + rcChildAnchor.right = m_pGroupClientAnchor->left + (long)(dScaleX * (rcChildAnchor.right - m_pGroupBounds->left)); - rcChildAnchor.top = m_pGroupClientAnchor->top + (LONG)(dScaleY * (rcChildAnchor.top - m_pGroupBounds->top)); - rcChildAnchor.bottom = m_pGroupClientAnchor->top + (LONG)(dScaleY * (rcChildAnchor.bottom - m_pGroupBounds->top)); + rcChildAnchor.top = m_pGroupClientAnchor->top + (long)(dScaleY * (rcChildAnchor.top - m_pGroupBounds->top)); + rcChildAnchor.bottom = m_pGroupClientAnchor->top + (long)(dScaleY * (rcChildAnchor.bottom - m_pGroupBounds->top)); } NSPresentationEditor::ElementType GetTypeElem(SPT eType) @@ -1887,8 +1887,8 @@ protected: // выставим тип мастера if (NULL != pSlide) { - LONG ph_type = pShape->m_lPlaceholderType; - LONG ph_pos = pShape->m_lPlaceholderID; + int ph_type = pShape->m_lPlaceholderType; + int ph_pos = pShape->m_lPlaceholderID; pTextSettings->m_lPlaceholderType = ph_type; @@ -1921,8 +1921,8 @@ protected: // persist ---------------------------------------------------------------------- std::vector* pArrayPlaseHolders = &pSlideWrapper->m_arTextPlaceHolders; - LONG lCountPersistObjects = (LONG)pArrayPlaseHolders->size(); - LONG lPersistIndex = oElemInfo.m_lPersistIndex; + int lCountPersistObjects = pArrayPlaseHolders->size(); + int lPersistIndex = oElemInfo.m_lPersistIndex; if ((lPersistIndex >= 0) && (lPersistIndex < lCountPersistObjects)) { @@ -2282,25 +2282,25 @@ protected: std::vector* pRanges = &pShape->m_oActions.m_arRanges; CTextAttributesEx* pTextAttributes = &pShape->m_oShape.m_oText; - LONG lCountHyper = (LONG)pRanges->size(); + int lCountHyper = pRanges->size(); if (0 == lCountHyper) return; size_t nCountPars = pTextAttributes->m_arParagraphs.size(); - for (LONG nIndexRange = 0; nIndexRange < lCountHyper; ++nIndexRange) + for (int nIndexRange = 0; nIndexRange < lCountHyper; ++nIndexRange) { - LONG lStart = (*pRanges)[nIndexRange].m_lStart; - LONG lEnd = (*pRanges)[nIndexRange].m_lEnd; + int lStart = (*pRanges)[nIndexRange].m_lStart; + int lEnd = (*pRanges)[nIndexRange].m_lEnd; - LONG lCurrentStart = 0; + int lCurrentStart = 0; for (size_t nIndexPar = 0; nIndexPar < nCountPars; ++nIndexPar) { CParagraph* pParagraph = &pTextAttributes->m_arParagraphs[nIndexPar]; for (size_t nIndexSpan = 0; nIndexSpan < pParagraph->m_arSpans.size(); ++nIndexSpan) { - LONG lCurrentEnd = lCurrentStart + pParagraph->m_arSpans[nIndexSpan].m_strText.GetLength() - 1; + int lCurrentEnd = lCurrentStart + pParagraph->m_arSpans[nIndexSpan].m_strText.GetLength() - 1; if (lCurrentStart > lEnd || lCurrentEnd < lStart) { @@ -2308,8 +2308,8 @@ protected: continue; } - LONG lStart_ = (std::max)(lStart, lCurrentStart); - LONG lEnd_ = (std::min)(lEnd, lCurrentEnd); + int lStart_ = (std::max)(lStart, lCurrentStart); + int lEnd_ = (std::min)(lEnd, lCurrentEnd); CSpan oRunProp = pParagraph->m_arSpans[nIndexSpan]; diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/PlaceHolderAtom.h b/ASCOfficePPTFile/PPTFormatLib/Records/PlaceHolderAtom.h index 9797b64db4..f04a5fa5d2 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/PlaceHolderAtom.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/PlaceHolderAtom.h @@ -4,7 +4,7 @@ class CRecordPlaceHolderAtom : public CUnknownRecord { public: - LONG m_nPosition; + int m_nPosition; BYTE m_nPlacementID; BYTE m_nSize; diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/TextMasterStyleAtom.h b/ASCOfficePPTFile/PPTFormatLib/Records/TextMasterStyleAtom.h index 86915c865d..2d7764e875 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/TextMasterStyleAtom.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/TextMasterStyleAtom.h @@ -26,7 +26,7 @@ public: bool bIsLevelsPresent = (0x05 <= m_oHeader.RecInstance); - LONG lLevels = StreamUtils::ReadWORD(pStream); + int lLevels = StreamUtils::ReadWORD(pStream); if (0 < lLevels) LoadLevel(0, pStream, bIsLevelsPresent); if (1 < lLevels) diff --git a/ASCPresentationEditor/OfficeDrawing/Document.h b/ASCPresentationEditor/OfficeDrawing/Document.h index 21c4fb0402..275cb0f3f2 100644 --- a/ASCPresentationEditor/OfficeDrawing/Document.h +++ b/ASCPresentationEditor/OfficeDrawing/Document.h @@ -119,7 +119,7 @@ namespace NSPresentationEditor size_t nCount = m_arSlides.size(); for (size_t nIndex = 0; nIndex < nCount; ++nIndex) { - LONG lThemeID = m_arSlides[nIndex]->m_lThemeID; + int lThemeID = m_arSlides[nIndex]->m_lThemeID; if ((0 > lThemeID) || (lThemeID >= (LONG)m_arThemes.size())) { @@ -171,7 +171,7 @@ namespace NSPresentationEditor CString Source = CString ( _T("") ); int EffectID = 1; - LONG lEffectDirection = oSlide.m_oSlideShow.m_oTransition.m_nEffectDirection; + int lEffectDirection = oSlide.m_oSlideShow.m_oTransition.m_nEffectDirection; switch ( oSlide.m_oSlideShow.m_oTransition.m_nEffectType ) { @@ -395,7 +395,7 @@ namespace NSPresentationEditor { CaclulateSlideTimes(); - LONG lCount = (LONG)m_arSlides.size(); + int lCount = (LONG)m_arSlides.size(); double dAllDuration = 0; if (lCount > 0) @@ -591,8 +591,8 @@ namespace NSPresentationEditor CShapeElement* pShape = dynamic_cast(pElement); if (!pLayout->m_bUseThemeColorScheme && NULL != pShape) { - LONG lPhType = pElement->m_lPlaceholderType; - LONG lIndex = 0; + int lPhType = pElement->m_lPlaceholderType; + int lIndex = 0; if (15 == lPhType) lIndex = 1; else if (0 == lPhType) diff --git a/ASCPresentationEditor/OfficeDrawing/Element.h b/ASCPresentationEditor/OfficeDrawing/Element.h index 4079bac842..d8a638f6d4 100644 --- a/ASCPresentationEditor/OfficeDrawing/Element.h +++ b/ASCPresentationEditor/OfficeDrawing/Element.h @@ -33,11 +33,11 @@ namespace NSPresentationEditor CAnimationInfo m_oAnimations; CEffects m_oEffects; - LONG m_lID; - LONG m_lLayoutID; + int m_lID; + int m_lLayoutID; - LONG m_lPlaceholderID; - LONG m_lPlaceholderType; + int m_lPlaceholderID; + int m_lPlaceholderType; bool m_bPlaceholderSet; // метрика diff --git a/ASCPresentationEditor/OfficeDrawing/Interactive.h b/ASCPresentationEditor/OfficeDrawing/Interactive.h index 3a9096e811..1725a0c4c1 100644 --- a/ASCPresentationEditor/OfficeDrawing/Interactive.h +++ b/ASCPresentationEditor/OfficeDrawing/Interactive.h @@ -10,8 +10,8 @@ namespace NSPresentationEditor class CTextRange { public: - LONG m_lStart; - LONG m_lEnd; + int m_lStart; + int m_lEnd; public: CTextRange() diff --git a/ASCPresentationEditor/OfficeDrawing/Shapes/BaseShape/PPTShape/BinaryReader.h b/ASCPresentationEditor/OfficeDrawing/Shapes/BaseShape/PPTShape/BinaryReader.h index 40f19a4c30..ffb1b870c2 100644 --- a/ASCPresentationEditor/OfficeDrawing/Shapes/BaseShape/PPTShape/BinaryReader.h +++ b/ASCPresentationEditor/OfficeDrawing/Shapes/BaseShape/PPTShape/BinaryReader.h @@ -1,4 +1,5 @@ #pragma once +#include "../../../../../Common/DocxFormat/Source/Base/Types_32.h" namespace NSOfficeDrawing { @@ -32,14 +33,14 @@ namespace NSOfficeDrawing } public: - LONG ReadLONG() + LONG ReadLONG() // int32 подразумевается { DWORD lOldOrigin = m_lOrigin; m_lOrigin += 4; BINARY_READER_CHECK_OUT_RANGE(m_lOrigin, m_lCount) - return *(LONG*)(m_pBuffer + lOldOrigin); + return *(_INT32*)(m_pBuffer + lOldOrigin); } DWORD ReadDWORD() { @@ -66,7 +67,7 @@ namespace NSOfficeDrawing BINARY_READER_CHECK_OUT_RANGE(m_lOrigin, m_lCount) - return *(SHORT*)(m_pBuffer + lOldOrigin); + return *(short*)(m_pBuffer + lOldOrigin); } double ReadDOUBLE() { diff --git a/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.cpp b/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.cpp index 01bc6a2891..b21f8967cd 100644 --- a/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.cpp +++ b/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.cpp @@ -182,32 +182,44 @@ namespace NSPresentationEditor void CTextAttributesEx::RecalcParagraphsPPT(CTheme* pTheme) { - for (LONG i = 0; i < (LONG)m_arParagraphs.size(); ++i) + for (int i = 0; i < m_arParagraphs.size(); ++i) { - bool bIsBreak = true; - LONG lCountCFs = (LONG)m_arParagraphs[i].m_arSpans.size(); - for (LONG j = 0; j < lCountCFs; ++j) + for (int j = 0; j < m_arParagraphs[i].m_arSpans.size(); ++j) + { + if (m_arParagraphs[i].m_arSpans[j].m_strText.GetLength() > 2) + { + //if (m_arParagraphs[i].m_arSpans[j].m_strText[0] == (TCHAR)13) + // m_arParagraphs[i].m_arSpans[j].m_strText = m_arParagraphs[i].m_arSpans[j].m_strText.Mid(1); + if (m_arParagraphs[i].m_arSpans[j].m_strText[m_arParagraphs[i].m_arSpans[j].m_strText.GetLength() -1] == (TCHAR)13) + m_arParagraphs[i].m_arSpans[j].m_strText = m_arParagraphs[i].m_arSpans[j].m_strText.Mid(0, m_arParagraphs[i].m_arSpans[j].m_strText.GetLength() -1); + } + } + } + for (int i = 0; i < m_arParagraphs.size(); ++i) + { + bool bIsBreak = true; + int lCountCFs = m_arParagraphs[i].m_arSpans.size(); + for (int j = 0; j < lCountCFs; ++j) { CString s = m_arParagraphs[i].m_arSpans[j].m_strText; int s_size = s.GetLength(); int lFoundEnter = m_arParagraphs[i].m_arSpans[j].m_strText.Find((TCHAR)13); - //lFound = -1; //todooo разобраться как и что нужно делить и нужно ли ваще. проверить что с памятью - - if( (lFoundEnter >= 0 && s_size > 1) && lFoundEnter < s_size -1 )//todooo если в s тока интер + + if( lFoundEnter >= 0 && s_size > 1) { - bool bIsBreakAttack = false; - if (bIsBreak && (0 == lFoundEnter)) - bIsBreakAttack = true; + //bool bIsBreakAttack = false; + //if (bIsBreak && (0 == lFoundEnter)) + // bIsBreakAttack = true; - if (bIsBreakAttack) - { - CParagraph oParBreak = m_arParagraphs[i]; - oParBreak.m_arSpans.clear(); - oParBreak.m_arSpans.push_back(m_arParagraphs[i].m_arSpans[j]); - oParBreak.m_arSpans[0].m_strText = _T(" "); - } + //if (bIsBreakAttack) + //{ + // CParagraph oParBreak = m_arParagraphs[i]; + // oParBreak.m_arSpans.clear(); + // oParBreak.m_arSpans.push_back(m_arParagraphs[i].m_arSpans[j]); + // oParBreak.m_arSpans[0].m_strText = _T(" "); + //} - bIsBreak = true; + //bIsBreak = true; // разбиваем параграф CParagraph oNewPar = m_arParagraphs[i]; diff --git a/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h b/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h index 38fdb51502..82126438c6 100644 --- a/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h +++ b/ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h @@ -18,8 +18,8 @@ namespace NSPresentationEditor LONG m_lTextMasterType; // only ppt property public: DWORD m_lTextType; - LONG m_lPlaceholderType; - LONG m_lPlaceholderID; + int m_lPlaceholderType; + int m_lPlaceholderID; // граница Aggplus::RECT m_oBounds; @@ -32,7 +32,7 @@ namespace NSPresentationEditor bool m_bVertical; bool m_bRightToLeft; - LONG m_lWrapMode; // 0 - square, default; 1 - none wrap + int m_lWrapMode; // 0 - square, default; 1 - none wrap // для ппт. чтобы не менять счас ничего CTextRuler m_oRuler; @@ -42,7 +42,7 @@ namespace NSPresentationEditor // из пптх bool m_bIsSlideFontRef; - LONG m_lFontRef; + int m_lFontRef; public: CTextAttributesEx() : diff --git a/ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp b/ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp index 2542b85fb2..dc385bf608 100644 --- a/ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp +++ b/ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp @@ -289,7 +289,7 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo() if (0 == m_pShapeElement->m_lPlaceholderType) m_pShapeElement->m_lPlaceholderID = 1; - if (-1 == m_pShapeElement->m_lPlaceholderID) + if ( m_pShapeElement->m_lPlaceholderID < 0) { m_oWriter.WriteString(std::wstring(L"m_lPlaceholderType) + _T("\"")); if (5 == m_pShapeElement->m_lPlaceholderType)