PPTFormatReader fix по результатам тестирования (linux)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65254 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
Elen.Subbotina
2015-10-10 15:29:48 +00:00
committed by Alexander Trofimov
parent 167e347a4e
commit f08420743c
15 changed files with 89 additions and 76 deletions

View File

@ -25,7 +25,7 @@ public:
private:
LONG m_Status;
int m_Status;
void* m_pReader;

View File

@ -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])

View File

@ -557,11 +557,11 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
}
}
LONG CPPTUserInfo::AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector<CTextFullSettings> & text, bool addShapes)
int CPPTUserInfo::AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector<CTextFullSettings> & 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);

View File

@ -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<CTextFullSettings> & text, bool addShapes = true);
int AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector<CTextFullSettings> & text, bool addShapes = true);
};

View File

@ -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)

View File

@ -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;
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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:
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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<CTextFullSettings>* 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<CTextRange>* 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];

View File

@ -4,7 +4,7 @@
class CRecordPlaceHolderAtom : public CUnknownRecord
{
public:
LONG m_nPosition;
int m_nPosition;
BYTE m_nPlacementID;
BYTE m_nSize;

View File

@ -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)

View File

@ -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<CShapeElement*>(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)

View File

@ -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;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@ -10,8 +10,8 @@ namespace NSPresentationEditor
class CTextRange
{
public:
LONG m_lStart;
LONG m_lEnd;
int m_lStart;
int m_lEnd;
public:
CTextRange()

View File

@ -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 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
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()
{

View File

@ -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 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( (lFoundEnter >= 0 && s_size > 1) && lFoundEnter < s_size -1 )//todooo <20><><EFBFBD><EFBFBD> <20> s <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
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;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CParagraph oNewPar = m_arParagraphs[i];

View File

@ -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;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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
// <20><><EFBFBD> <20><><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CTextRuler m_oRuler;
@ -42,7 +42,7 @@ namespace NSPresentationEditor
// <20><> <20><><EFBFBD><EFBFBD>
bool m_bIsSlideFontRef;
LONG m_lFontRef;
int m_lFontRef;
public:
CTextAttributesEx() :

View File

@ -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"<p:nvPr><p:ph type=\"") + GetPhType(m_pShapeElement->m_lPlaceholderType) + _T("\""));
if (5 == m_pShapeElement->m_lPlaceholderType)