Commit b025e737 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

PPTFormat нумерация, даты, колонтитулы

правка багов

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65445 954022d7-b5bf-4e40-9824-e11837661b57
parent 8d465218
......@@ -375,7 +375,6 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
//
CTransition* pTransition = &pSlide->m_oSlideShow.m_oTransition;
if (pRecordSlide->m_bExistsTransition)
......@@ -487,7 +486,13 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
std::map<std::wstring, LONG>::iterator pPairLayoutGeom = pTheme->m_mapGeomToLayout.find(strLayoutType);
if (pPairLayoutGeom == pTheme->m_mapGeomToLayout.end())
{
pSlide->m_lLayoutID = AddNewLayout(pTheme, &oArraySlideAtoms[0]->m_oLayout, pRecordSlide->m_oPersist.m_arTextAttrs);
std::vector<CRecordHeadersFootersAtom*> oArrayHeadersFootersAtoms;
pRecordSlide->GetRecordsByType(&oArrayHeadersFootersAtoms, true, true);
CRecordHeadersFootersAtom* headers_footers = NULL;
if (!oArrayHeadersFootersAtoms.empty()) headers_footers = oArrayHeadersFootersAtoms[0];
pSlide->m_lLayoutID = AddNewLayout(pTheme, &oArraySlideAtoms[0]->m_oLayout, pRecordSlide->m_oPersist.m_arTextAttrs, headers_footers);
pLayout = &pTheme->m_arLayouts[pSlide->m_lLayoutID];
pLayout->m_bShowMasterShapes = true;
}
......@@ -539,8 +544,6 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
}
}
}
// ---------------------------------------------------------------------------------
// ...
std::vector<CRecordShapeContainer*> oArrayShapes;
......@@ -549,6 +552,8 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
pSlide->m_bShowMasterShapes = bMasterObjects;
pSlide->m_bIsBackground = false;
std::vector<int> slidePlaceholders;
for (int nShape = 0; nShape < oArrayShapes.size(); ++nShape)
{
IElement* pElem = NULL;
......@@ -578,11 +583,25 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
{
pSlide->m_arElements.push_back(pElem);
}
if (pElem->m_lPlaceholderType > 0 )
slidePlaceholders.push_back( pElem->m_lPlaceholderType );
}
}
//
//for (std::map<int, int>::iterator it = pLayout->m_pPlaceholders.begin(); it != pLayout->m_pPlaceholders.end(); it++)
//{
// if ( std::find(slidePlaceholders.begin(), slidePlaceholders.end(), it->first) == slidePlaceholders.end() )
// {
// IElement * elm = pLayout->m_arElements[it->second]->CreateDublicate();
// pSlide->m_arElements.push_back(elm);
// }
//}
}
int 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,
CRecordHeadersFootersAtom* headers_footers, bool addShapes)
{
if (pTheme == NULL) return -1;
......@@ -609,7 +628,6 @@ int CPPTUserInfo::AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayou
if (!addShapes) return ind;
for (int i = 0 ; i < 8; i ++)
{
if (layoutRecord->m_pPlaceHolderID[i] == 0) break;
......@@ -620,6 +638,106 @@ int CPPTUserInfo::AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayou
pShape->m_bPlaceholderSet = false;
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pShape));
pLayout->m_pPlaceholders.insert(std::pair<int, int>(pShape->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
if (headers_footers)
{
std::map<int, int>::iterator it;
if (headers_footers->m_bHasSlideNumber)
{
IElement* pElement = NULL;
it = pLayout->m_pPlaceholders.find(12);
if ( it == pLayout->m_pPlaceholders.end())
{
pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = 12;
pElement->m_bPlaceholderSet = false;
//pElement->m_bBoundsEnabled = false;
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pLayout->m_pPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
else
{
pElement = pLayout->m_arElements[it->second];
}
if (pElement)
{
}
}
if (headers_footers->m_bHasTodayDate ||
headers_footers->m_bHasUserDate ||
headers_footers->m_bHasDate)
{
IElement* pElement = NULL;
it = pLayout->m_pPlaceholders.find(5);
if (it == pLayout->m_pPlaceholders.end())
{
pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = 5;
pElement->m_bPlaceholderSet = false;
//pElement->m_bBoundsEnabled = false;
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pLayout->m_pPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
else
{
pElement = pLayout->m_arElements[it->second];
}
if (pElement)
{
}
}
if (headers_footers->m_bHasHeader)
{
IElement* pElement = NULL;
it = pLayout->m_pPlaceholders.find(7);
if (it == pLayout->m_pPlaceholders.end())
{
pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = 7;
pElement->m_bPlaceholderSet = false;
//pElement->m_bBoundsEnabled = false;
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pLayout->m_pPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
else
{
pElement = pLayout->m_arElements[it->second];
}
if (pElement)
{
}
}
if (headers_footers->m_bHasFooter)
{
IElement* pElement = NULL;
it = pLayout->m_pPlaceholders.find(6);
if (it == pLayout->m_pPlaceholders.end())
{
pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = 6;
pElement->m_bPlaceholderSet = false;
//pElement->m_bBoundsEnabled = false;
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pLayout->m_pPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
else
{
pElement = pLayout->m_arElements[it->second];
}
if (pElement)
{
}
}
}
return ind;
......@@ -833,6 +951,45 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
continue;
}
pTheme->m_arElements.push_back(pElem);
if ( pElem->m_lPlaceholderType >0)
pTheme->m_pPlaceholders.insert(std::pair<int, int>(pElem->m_lPlaceholderType, pTheme->m_arElements.size()-1));
}
}
std::vector<CRecordHeadersFootersAtom*> oArrayHeadersFootersAtoms;
pMaster->GetRecordsByType(&oArrayHeadersFootersAtoms, true, true);
if (!oArrayHeadersFootersAtoms.empty())
{
if (oArrayHeadersFootersAtoms[0]->m_bHasSlideNumber)
{
if (pTheme->m_pPlaceholders.find(12) == pTheme->m_pPlaceholders.end())
{
CShapeElement* pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = 12;
pElement->m_bPlaceholderSet = false;
//pElement->m_bBoundsEnabled = false;
pTheme->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pTheme->m_pPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pTheme->m_arElements.size()-1));
}
}
if (oArrayHeadersFootersAtoms[0]->m_bHasTodayDate ||
oArrayHeadersFootersAtoms[0]->m_bHasUserDate ||
oArrayHeadersFootersAtoms[0]->m_bHasDate)
{
if (pTheme->m_pPlaceholders.find(5) == pTheme->m_pPlaceholders.end())
{
CShapeElement* pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = 5;
pElement->m_bPlaceholderSet = false;
//pElement->m_bBoundsEnabled = false;
pTheme->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pTheme->m_pPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pTheme->m_arElements.size()-1));
}
}
}
}
......@@ -929,15 +1086,11 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
CLayout* pLayout = NULL;
std::map<std::wstring, LONG>::iterator pPair1 = pTheme->m_mapGeomToLayout.find(strLayoutType);
// !!! //if (pPair1 == pTheme->m_mapGeomToLayout.end())
{
int lLayoutID = AddNewLayout(pTheme, &oArraySlideAtoms[0]->m_oLayout, pCurMaster->m_oPersist.m_arTextAttrs, false);
pLayout = &pTheme->m_arLayouts[lLayoutID];
pLayout->m_bShowMasterShapes = false;
pTheme->m_mapTitleLayout[dwMasterID] = lLayoutID;
}
std::vector<NSPresentationEditor::CColor>* pArrayColorScheme = &pTheme->m_arColorScheme;
// -----------------------------------------------------------
......@@ -1007,8 +1160,48 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
pElem->m_bPlaceholderSet = true;
pLayout->m_arElements.push_back(pElem);
if ( pElem->m_lPlaceholderType >0)
pLayout->m_pPlaceholders.insert(std::pair<int, int>(pElem->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
}
std::vector<CRecordHeadersFootersAtom*> oArrayHeadersFootersAtoms;
pCurMaster->GetRecordsByType(&oArrayHeadersFootersAtoms, true, true);
if (!oArrayHeadersFootersAtoms.empty())
{
if (oArrayHeadersFootersAtoms[0]->m_bHasSlideNumber)
{
if (pLayout->m_pPlaceholders.find(12) == pLayout->m_pPlaceholders.end())
{
CShapeElement* pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = 12;
pElement->m_bPlaceholderSet = false;
//pElement->m_bBoundsEnabled = false;
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pLayout->m_pPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
}
if (oArrayHeadersFootersAtoms[0]->m_bHasTodayDate ||
oArrayHeadersFootersAtoms[0]->m_bHasUserDate ||
oArrayHeadersFootersAtoms[0]->m_bHasDate)
{
if (pLayout->m_pPlaceholders.find(5) == pLayout->m_pPlaceholders.end())
{
CShapeElement* pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = 5;
pElement->m_bPlaceholderSet = false;
//pElement->m_bBoundsEnabled = false;
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pLayout->m_pPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
}
}
}
void CPPTUserInfo::LoadSlideFromPrevUsers(DWORD dwSlideID)
......
......@@ -251,5 +251,6 @@ public:
void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement);
void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath);
int AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector<CTextFullSettings> & text, bool addShapes = true);
int AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector<CTextFullSettings> & text,
CRecordHeadersFootersAtom* headers_footers = NULL, bool addShapes = true);
};
#pragma once
//#include "../../../ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h"
#include "ReadStructures.h"
#include <zlib.h>
using namespace NSPresentationEditor;
namespace NSZLib
{
bool Decompress(const BYTE* pSrcBuffer, const ULONG& lSrcBufferLen,
BYTE* pDstBuffer, ULONG& lDstBufferLen)
{
try
{
if (Z_OK == uncompress(pDstBuffer, &lDstBufferLen, pSrcBuffer, lSrcBufferLen))
{
return true;
}
}
catch(...)
{
}
return false;
}
}
namespace NSStreamReader
{
void Read(POLE::Stream* pStream, NSPresentationEditor::CTextSIRun& oRun, bool bIsIndentation)
{
if (bIsIndentation)
{
oRun.lCount = StreamUtils::ReadDWORD(pStream);
}
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
oRun.bSpell = (0x01 == (0x01 & flag1));
oRun.bLang = (0x02 == (0x02 & flag1));
oRun.bAltLang = (0x04 == (0x04 & flag1));
// unused
// unused
oRun.bPp10ext = (0x20 == (0x20 & flag1));
oRun.bBidi = (0x40 == (0x40 & flag1));
// unused
// reserved
oRun.bSmartTag = (0x02 == (0x02 & flag2));
if (oRun.bSpell)
{
oRun.Spell = StreamUtils::ReadWORD(pStream);
}
if (oRun.bLang)
{
oRun.Lang = StreamUtils::ReadWORD(pStream);
}
if (oRun.bAltLang)
{
oRun.AltLang = StreamUtils::ReadWORD(pStream);
}
if (oRun.bBidi)
{
oRun.Bidi = StreamUtils::ReadWORD(pStream);
}
if (oRun.bPp10ext)
{
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
BYTE flag3 = (BYTE)(dwFlags >> 16);
BYTE flag4 = (BYTE)(dwFlags >> 24);
oRun.pp10runid = (0x0F & flag1);
oRun.bGramma = (0x80 == (0x80 & flag4));
}
/*if (bSmartTag)
{
DWORD tabStopsCount = StreamUtils::ReadDWORD(pStream);
arSmartTags.clear();
for (int i = 0; i < (int)tabStopsCount; ++i)
{
arSmartTags.Add(StreamUtils::ReadDWORD(pStream));
}
}*/
}
void Read(POLE::Stream* pStream, NSPresentationEditor::CTextRuler& oRun)
{
double dScaleX = 625 * 2.54 ;
//1/576 inch = 72/576 pt = 360000 *72 * 2.54 /(72*576) emu
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
BYTE flag3 = (BYTE)(dwFlags >> 16);
BYTE flag4 = (BYTE)(dwFlags >> 24);
bool bDefaultTabSize_ = (0x01 == (0x01 & flag1));
bool bCLevels_ = (0x02 == (0x02 & flag1));
bool bTabStops_ = (0x04 == (0x04 & flag1));
bool bLeftMargin1_ = (0x08 == (0x08 & flag1));
bool bLeftMargin2_ = (0x10 == (0x10 & flag1));
bool bLeftMargin3_ = (0x20 == (0x20 & flag1));
bool bLeftMargin4_ = (0x40 == (0x40 & flag1));
bool bLeftMargin5_ = (0x80 == (0x80 & flag1));
bool bIndent1_ = (0x01 == (0x01 & flag2));
bool bIndent2_ = (0x02 == (0x02 & flag2));
bool bIndent3_ = (0x04 == (0x04 & flag2));
bool bIndent4_ = (0x08 == (0x08 & flag2));
bool bIndent5_ = (0x10 == (0x10 & flag2));
if (bCLevels_)
oRun.CLevels = StreamUtils::ReadSHORT(pStream);
if (bDefaultTabSize_)
oRun.DefaultTabSize = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bTabStops_)
{
WORD tabStopsCount = StreamUtils::ReadWORD(pStream);
oRun.tabsStops.clear();
for (int i = 0; i < (int)tabStopsCount; ++i)
{
oRun.tabsStops.push_back(StreamUtils::ReadDWORD(pStream) * dScaleX);
}
}
if (bLeftMargin1_)
oRun.LeftMargin1 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent1_)
oRun.Indent1 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bLeftMargin2_)
oRun.LeftMargin2 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent2_)
oRun.Indent2 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bLeftMargin3_)
oRun.LeftMargin3 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent3_)
oRun.Indent3 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bLeftMargin4_)
oRun.LeftMargin4 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent4_)
oRun.Indent4 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bLeftMargin5_)
oRun.LeftMargin5 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent5_)
oRun.Indent5 = StreamUtils::ReadSHORT(pStream) * dScaleX;
}
}
void CTextPFRun_ppt::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation)
{
double dScaleX = 625 * 2.54 ;
//1/576 inch = 72/576 pt = 360000 *72 * 2.54 /(72*576) emu
if (bIsIndentation)
{
m_lCount = StreamUtils::ReadLONG(pStream);
m_lLevel = (LONG)StreamUtils::ReadWORD(pStream);
if (m_lLevel > 0x0004)
m_lLevel = 0x0004;
}
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
BYTE flag3 = (BYTE)(dwFlags >> 16);
BYTE flag4 = (BYTE)(dwFlags >> 24);
bool hasBullet_ = (0x01 == (0x01 & flag1));
bool bulletHasFont_ = (0x02 == (0x02 & flag1));
bool bulletHasColor_ = (0x04 == (0x04 & flag1));
bool bulletHasSize_ = (0x08 == (0x08 & flag1));
bool bulletFontRef_ = (0x10 == (0x10 & flag1));
bool bulletColor_ = (0x20 == (0x20 & flag1));
bool bulletSize_ = (0x40 == (0x40 & flag1));
bool bulletChar_ = (0x80 == (0x80 & flag1));
bool leftMargin_ = (0x01 == (0x01 & flag2));
// reserved
bool indent_ = (0x04 == (0x04 & flag2));
bool textAlignment_ = (0x08 == (0x08 & flag2));
bool lineSpacing_ = (0x10 == (0x10 & flag2));
bool spaceBefore_ = (0x20 == (0x20 & flag2));
bool spaceAfter_ = (0x40 == (0x40 & flag2));
bool defaultTabSize_ = (0x80 == (0x80 & flag2));
bool fontAlign_ = (0x01 == (0x01 & flag3));
bool charWrap_ = (0x02 == (0x02 & flag3));
bool wordWrap_ = (0x04 == (0x04 & flag3));
bool overflow_ = (0x08 == (0x08 & flag3));
bool tabStops_ = (0x10 == (0x10 & flag3));
bool textDirection_ = (0x20 == (0x20 & flag3));
//reserved
bool bulletBlip_ = (0x80 == (0x80 & flag3));
bool bulletScheme_ = (0x01 == (0x01 & flag4));
bool bulletHasScheme_ = (0x02 == (0x02 & flag4));
if (hasBullet_ || bulletHasFont_ || bulletHasColor_ || bulletHasSize_)
{
WORD bulletFlag = StreamUtils::ReadWORD(pStream);
if (bulletFlag & 0x0F)
m_oRun.hasBullet = (bool)(0x01 == (bulletFlag & 0x01));
else
m_oRun.hasBullet = false;
}
if (bulletChar_)
{
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_)
m_oRun.bulletSize = StreamUtils::ReadWORD(pStream);
if (bulletColor_)
{
SColorAtom oColorAtom;
NSStreamReader::Read(pStream, oColorAtom);
NSPresentationEditor::CColor oColor;
oColor.R = oColorAtom.R;
oColor.G = oColorAtom.G;
oColor.B = oColorAtom.B;
oColor.A = 255;
oColor.m_lSchemeIndex = -1;
if (oColorAtom.Index < 10)
{
oColor.m_lSchemeIndex = oColorAtom.Index;
NSPresentationEditor::CorrectColorPPT(oColor.m_lSchemeIndex);
}
m_oRun.bulletColor = oColor;
}
if (textAlignment_)
m_oRun.textAlignment = StreamUtils::ReadWORD(pStream);
if (lineSpacing_)
m_oRun.lineSpacing = - StreamUtils::ReadSHORT(pStream);
if (spaceBefore_)
m_oRun.spaceBefore = - (LONG)StreamUtils::ReadSHORT(pStream);
if (spaceAfter_)
m_oRun.spaceAfter = - (LONG)StreamUtils::ReadSHORT(pStream);
if (leftMargin_)
m_oRun.leftMargin = (LONG)StreamUtils::ReadSHORT(pStream) * dScaleX;
if (indent_)
m_oRun.indent = (LONG)StreamUtils::ReadSHORT(pStream) * dScaleX;
if (defaultTabSize_)
m_oRun.defaultTabSize = (LONG)StreamUtils::ReadWORD(pStream) * dScaleX;
if (tabStops_)
{
WORD tabStopsCount = StreamUtils::ReadWORD(pStream);
m_oRun.tabStops.clear();
if (tabStopsCount > 10)
tabStopsCount = 10;
for (int i = 0; i < (int)tabStopsCount; ++i)
{
m_oRun.tabStops.push_back(StreamUtils::ReadDWORD(pStream) * dScaleX );
}
if (0 < m_oRun.tabStops.size())
m_oRun.defaultTabSize = m_oRun.tabStops[0];
}
if (fontAlign_)
m_oRun.fontAlign = StreamUtils::ReadWORD(pStream);
if (charWrap_ || wordWrap_ || overflow_)
{
m_oRun.wrapFlags = StreamUtils::ReadWORD(pStream);
}
if (textDirection_)
m_oRun.textDirection = StreamUtils::ReadWORD(pStream);
}
void CTextCFRun_ppt::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation)
{
if (bIsIndentation)
{
m_lCount = StreamUtils::ReadLONG(pStream);
}
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
BYTE flag3 = (BYTE)(dwFlags >> 16);
BYTE flag4 = (BYTE)(dwFlags >> 24);
bool hasBold = (0x01 == (0x01 & flag1));
bool hasItalic = (0x02 == (0x02 & flag1));
bool hasUnderline = (0x04 == (0x04 & flag1));
// unused
bool hasShadow = (0x10 == (0x10 & flag1));
bool hasFehint = (0x20 == (0x20 & flag1));
// unused
bool hasKimi = (0x80 == (0x80 & flag1));
// unused
bool hasEmboss = (0x02 == (0x02 & flag2));
// unused
BYTE hasStyle = ((0x3C & flag2) >> 2);
// unused
bool typeface_ = (0x01 == (0x01 & flag3));
bool size_ = (0x02 == (0x02 & flag3));
bool color_ = (0x04 == (0x04 & flag3));
bool BaseLineOffset_ = (0x08 == (0x08 & flag3));
bool EAFontRef_ = (0x20 == (0x20 & flag3));
bool AnsiFontRef_ = (0x40 == (0x40 & flag3));
bool SymbolFontRef_ = (0x80 == (0x80 & flag3));
bool hasNewEATypeface = (0x01 == (0x01 & flag4));
bool hasCsTypeface = (0x02 == (0x02 & flag4));
bool hasPp11ext = (0x04 == (0x04 & flag4));
bool bIsFontStylePresent = (hasBold || hasItalic || hasUnderline || hasShadow ||
hasFehint || hasKimi || hasEmboss || hasStyle != 0);
if (bIsFontStylePresent)
{
WORD fontStyle = StreamUtils::ReadWORD(pStream);
if (0x01 == (0x01 & fontStyle))
m_oRun.FontBold = true;
if (0x02 == (0x02 & fontStyle))
m_oRun.FontItalic = true;
if (0x04 == (0x04 & fontStyle))
m_oRun.FontUnderline = true;
if (0x10 == (0x10 & fontStyle))
m_oRun.FontShadow = true;
}
if (typeface_)
m_oRun.Typeface = StreamUtils::ReadWORD(pStream);
if (EAFontRef_)
m_oRun.EAFontRef = StreamUtils::ReadWORD(pStream);
if (AnsiFontRef_)
m_oRun.AnsiFontRef = StreamUtils::ReadWORD(pStream);
if (SymbolFontRef_)
m_oRun.SymbolFontRef = StreamUtils::ReadWORD(pStream);
if (size_)
m_oRun.Size = StreamUtils::ReadWORD(pStream);
if (color_)
{
SColorAtom oColorAtom;
NSStreamReader::Read(pStream, oColorAtom);
NSPresentationEditor::CColor oColor;
oColor.R = oColorAtom.R;
oColor.G = oColorAtom.G;
oColor.B = oColorAtom.B;
oColor.A = 255;
oColor.m_lSchemeIndex = -1;
if (oColorAtom.Index < 10/* && oColorAtom.bSchemeIndex*/)
{
oColor.m_lSchemeIndex = oColorAtom.Index;
NSPresentationEditor::CorrectColorPPT(oColor.m_lSchemeIndex);
}
else
{
}
m_oRun.Color = oColor;
}
if (BaseLineOffset_)
m_oRun.BaseLineOffset = (double)StreamUtils::ReadSHORT(pStream);
// ????
}
namespace NSPresentationEditor
{
void ConvertPPTTextToEditorStructure(std::vector<CTextPFRun_ppt>& oArrayPF, std::vector<CTextCFRun_ppt>& oArrayCF,
std::wstring& strText, NSPresentationEditor::CTextAttributesEx& oAttributes)
{
int nCountPFs = (int)oArrayPF.size();
int nCountCFs = (int)oArrayCF.size();
oAttributes.m_arParagraphs.clear();
int nCurrentPF = 0;
int nCurrentCF = 0;
int nOffsetCF = 0;
int nIndexLast = strText.length();
int nIndexText = 0;
for (int nIndexPF = 0; nIndexPF < nCountPFs; ++nIndexPF)
{
CParagraph elm;
oAttributes.m_arParagraphs.push_back(elm);
NSPresentationEditor::CParagraph* pPar = &oAttributes.m_arParagraphs[nIndexPF];
pPar->m_oPFRun = oArrayPF[nIndexPF].m_oRun;
pPar->m_lTextType = oAttributes.m_lTextType;
pPar->m_lTextLevel = oArrayPF[nIndexPF].m_lLevel;
int nCountInPF = oArrayPF[nIndexPF].m_lCount;
while (true)
{
if (nCurrentCF >= nCountCFs)
break;
int nCountAdd = oArrayCF[nCurrentCF].m_lCount - nOffsetCF;
int nCountAddTrue = nCountAdd;
if (nIndexText + nCountAdd > nIndexLast)
{
nCountAddTrue = nIndexLast - nIndexText;
if (nCountAddTrue < 0) nCountAddTrue = 0;
}
if (nCountAdd > nCountInPF)
{
nOffsetCF += nCountInPF;
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
nCountAddTrue = nCountInPF;
if (nIndexText + nCountInPF > nIndexLast)
{
nCountAddTrue = nIndexLast - nIndexText;
if (nCountAddTrue < 0) nCountAddTrue = 0;
}
if (nCountAddTrue > 0)
{
oSpan.m_strText = strText.substr(nIndexText, nCountAddTrue);
pPar->m_arSpans.push_back(oSpan);
}
nIndexText += nCountInPF;
break;
}
else if (nCountAdd == nCountInPF)
{
nOffsetCF = 0;
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
if (nCountAddTrue > 0)
{
oSpan.m_strText = strText.substr(nIndexText, nCountAddTrue);
pPar->m_arSpans.push_back(oSpan);
}
nIndexText += nCountAdd;
++nCurrentCF;
break;
}
else
{
nOffsetCF = 0;
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
if (nCountAddTrue > 0)
{
oSpan.m_strText = strText.substr(nIndexText, nCountAddTrue);
pPar->m_arSpans.push_back(oSpan);
}
nIndexText += nCountAdd;
nCountInPF -= nCountAdd;
++nCurrentCF;
}
}
}
}
}
......@@ -3,29 +3,14 @@
#include "../../../ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h"
#include "SlidePersist.h"
#include <zlib.h>
using namespace NSPresentationEditor;
namespace NSZLib
{
static bool Decompress(const BYTE* pSrcBuffer, const ULONG& lSrcBufferLen,
BYTE* pDstBuffer, ULONG& lDstBufferLen)
{
try
{
if (Z_OK == uncompress(pDstBuffer, &lDstBufferLen, pSrcBuffer, lSrcBufferLen))
{
return true;
}
}
catch(...)
{
}
return false;
}
bool Decompress(const BYTE* pSrcBuffer, const ULONG& lSrcBufferLen,
BYTE* pDstBuffer, ULONG& lDstBufferLen);
}
/**************************************************************
...
......@@ -365,136 +350,8 @@ namespace NSStreamReader
oAtom.bSysIndex = (0x10 == (oAtom.Index & 0x10));
}
static inline void Read(POLE::Stream* pStream, NSPresentationEditor::CTextSIRun& oRun, bool bIsIndentation = true)
{
if (bIsIndentation)
{
oRun.lCount = StreamUtils::ReadDWORD(pStream);
}
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
oRun.bSpell = (0x01 == (0x01 & flag1));
oRun.bLang = (0x02 == (0x02 & flag1));
oRun.bAltLang = (0x04 == (0x04 & flag1));
// unused
// unused
oRun.bPp10ext = (0x20 == (0x20 & flag1));
oRun.bBidi = (0x40 == (0x40 & flag1));
// unused
// reserved
oRun.bSmartTag = (0x02 == (0x02 & flag2));
if (oRun.bSpell)
{
oRun.Spell = StreamUtils::ReadWORD(pStream);
}
if (oRun.bLang)
{
oRun.Lang = StreamUtils::ReadWORD(pStream);
}
if (oRun.bAltLang)
{
oRun.AltLang = StreamUtils::ReadWORD(pStream);
}
if (oRun.bBidi)
{
oRun.Bidi = StreamUtils::ReadWORD(pStream);
}
if (oRun.bPp10ext)
{
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
BYTE flag3 = (BYTE)(dwFlags >> 16);
BYTE flag4 = (BYTE)(dwFlags >> 24);
oRun.pp10runid = (0x0F & flag1);
oRun.bGramma = (0x80 == (0x80 & flag4));
}
/*if (bSmartTag)
{
DWORD tabStopsCount = StreamUtils::ReadDWORD(pStream);
arSmartTags.clear();
for (int i = 0; i < (int)tabStopsCount; ++i)
{
arSmartTags.Add(StreamUtils::ReadDWORD(pStream));
}
}*/
}
static inline void Read(POLE::Stream* pStream, NSPresentationEditor::CTextRuler& oRun)
{
double dScaleX = 625 * 2.54 ;
//1/576 inch = 72/576 pt = 360000 *72 * 2.54 /(72*576) emu
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
BYTE flag3 = (BYTE)(dwFlags >> 16);
BYTE flag4 = (BYTE)(dwFlags >> 24);
bool bDefaultTabSize_ = (0x01 == (0x01 & flag1));
bool bCLevels_ = (0x02 == (0x02 & flag1));
bool bTabStops_ = (0x04 == (0x04 & flag1));
bool bLeftMargin1_ = (0x08 == (0x08 & flag1));
bool bLeftMargin2_ = (0x10 == (0x10 & flag1));
bool bLeftMargin3_ = (0x20 == (0x20 & flag1));
bool bLeftMargin4_ = (0x40 == (0x40 & flag1));
bool bLeftMargin5_ = (0x80 == (0x80 & flag1));
bool bIndent1_ = (0x01 == (0x01 & flag2));
bool bIndent2_ = (0x02 == (0x02 & flag2));
bool bIndent3_ = (0x04 == (0x04 & flag2));
bool bIndent4_ = (0x08 == (0x08 & flag2));
bool bIndent5_ = (0x10 == (0x10 & flag2));
if (bCLevels_)
oRun.CLevels = StreamUtils::ReadSHORT(pStream);
if (bDefaultTabSize_)
oRun.DefaultTabSize = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bTabStops_)
{
WORD tabStopsCount = StreamUtils::ReadWORD(pStream);
oRun.tabsStops.clear();
for (int i = 0; i < (int)tabStopsCount; ++i)
{
oRun.tabsStops.push_back(StreamUtils::ReadDWORD(pStream) * dScaleX);
}
}
if (bLeftMargin1_)
oRun.LeftMargin1 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent1_)
oRun.Indent1 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bLeftMargin2_)
oRun.LeftMargin2 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent2_)
oRun.Indent2 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bLeftMargin3_)
oRun.LeftMargin3 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent3_)
oRun.Indent3 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bLeftMargin4_)
oRun.LeftMargin4 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent4_)
oRun.Indent4 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bLeftMargin5_)
oRun.LeftMargin5 = StreamUtils::ReadSHORT(pStream) * dScaleX;
if (bIndent5_)
oRun.Indent5 = StreamUtils::ReadSHORT(pStream) * dScaleX;
}
void Read(POLE::Stream* pStream, NSPresentationEditor::CTextSIRun& oRun, bool bIsIndentation = true);
void Read(POLE::Stream* pStream, NSPresentationEditor::CTextRuler& oRun);
}
class CTextPFRun_ppt
......@@ -504,7 +361,6 @@ public:
LONG m_lLevel;
LONG m_lCount;
public:
CTextPFRun_ppt() : m_oRun()
{
m_lLevel = -1;
......@@ -522,156 +378,7 @@ public:
return *this;
}
public:
void LoadFromStream(POLE::Stream* pStream, bool bIsIndentation = true)
{
double dScaleX = 625 * 2.54 ;
//1/576 inch = 72/576 pt = 360000 *72 * 2.54 /(72*576) emu
if (bIsIndentation)
{
m_lCount = StreamUtils::ReadLONG(pStream);
m_lLevel = (LONG)StreamUtils::ReadWORD(pStream);
if (m_lLevel > 0x0004)
m_lLevel = 0x0004;
}
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
BYTE flag3 = (BYTE)(dwFlags >> 16);
BYTE flag4 = (BYTE)(dwFlags >> 24);
bool hasBullet_ = (0x01 == (0x01 & flag1));
bool bulletHasFont_ = (0x02 == (0x02 & flag1));
bool bulletHasColor_ = (0x04 == (0x04 & flag1));
bool bulletHasSize_ = (0x08 == (0x08 & flag1));
bool bulletFontRef_ = (0x10 == (0x10 & flag1));
bool bulletColor_ = (0x20 == (0x20 & flag1));
bool bulletSize_ = (0x40 == (0x40 & flag1));
bool bulletChar_ = (0x80 == (0x80 & flag1));
bool leftMargin_ = (0x01 == (0x01 & flag2));
// reserved
bool indent_ = (0x04 == (0x04 & flag2));
bool textAlignment_ = (0x08 == (0x08 & flag2));
bool lineSpacing_ = (0x10 == (0x10 & flag2));
bool spaceBefore_ = (0x20 == (0x20 & flag2));
bool spaceAfter_ = (0x40 == (0x40 & flag2));
bool defaultTabSize_ = (0x80 == (0x80 & flag2));
bool fontAlign_ = (0x01 == (0x01 & flag3));
bool charWrap_ = (0x02 == (0x02 & flag3));
bool wordWrap_ = (0x04 == (0x04 & flag3));
bool overflow_ = (0x08 == (0x08 & flag3));
bool tabStops_ = (0x10 == (0x10 & flag3));
bool textDirection_ = (0x20 == (0x20 & flag3));
//reserved
bool bulletBlip_ = (0x80 == (0x80 & flag3));
bool bulletScheme_ = (0x01 == (0x01 & flag4));
bool bulletHasScheme_ = (0x02 == (0x02 & flag4));
if (hasBullet_ || bulletHasFont_ || bulletHasColor_ || bulletHasSize_)
{
WORD bulletFlag = StreamUtils::ReadWORD(pStream);
if (bulletFlag & 0x0F)
m_oRun.hasBullet = (bool)(0x01 == (bulletFlag & 0x01));
else
m_oRun.hasBullet = false;
}
if (bulletChar_)
{
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_)
m_oRun.bulletSize = StreamUtils::ReadWORD(pStream);
if (bulletColor_)
{
SColorAtom oColorAtom;
NSStreamReader::Read(pStream, oColorAtom);
NSPresentationEditor::CColor oColor;
oColor.R = oColorAtom.R;
oColor.G = oColorAtom.G;
oColor.B = oColorAtom.B;
oColor.A = 255;
oColor.m_lSchemeIndex = -1;
if (oColorAtom.Index < 10)
{
oColor.m_lSchemeIndex = oColorAtom.Index;
NSPresentationEditor::CorrectColorPPT(oColor.m_lSchemeIndex);
}
m_oRun.bulletColor = oColor;
}
if (textAlignment_)
m_oRun.textAlignment = StreamUtils::ReadWORD(pStream);
if (lineSpacing_)
m_oRun.lineSpacing = - StreamUtils::ReadSHORT(pStream);
if (spaceBefore_)
m_oRun.spaceBefore = - (LONG)StreamUtils::ReadSHORT(pStream);
if (spaceAfter_)
m_oRun.spaceAfter = - (LONG)StreamUtils::ReadSHORT(pStream);
if (leftMargin_)
m_oRun.leftMargin = (LONG)StreamUtils::ReadSHORT(pStream) * dScaleX;
if (indent_)
m_oRun.indent = (LONG)StreamUtils::ReadSHORT(pStream) * dScaleX;
if (defaultTabSize_)
m_oRun.defaultTabSize = (LONG)StreamUtils::ReadWORD(pStream) * dScaleX;
if (tabStops_)
{
WORD tabStopsCount = StreamUtils::ReadWORD(pStream);
m_oRun.tabStops.clear();
if (tabStopsCount > 10)
tabStopsCount = 10;
for (int i = 0; i < (int)tabStopsCount; ++i)
{
m_oRun.tabStops.push_back(StreamUtils::ReadDWORD(pStream) * dScaleX );
}
if (0 < m_oRun.tabStops.size())
m_oRun.defaultTabSize = m_oRun.tabStops[0];
}
if (fontAlign_)
m_oRun.fontAlign = StreamUtils::ReadWORD(pStream);
if (charWrap_ || wordWrap_ || overflow_)
{
m_oRun.wrapFlags = StreamUtils::ReadWORD(pStream);
}
if (textDirection_)
m_oRun.textDirection = StreamUtils::ReadWORD(pStream);
}
void LoadFromStream(POLE::Stream* pStream, bool bIsIndentation = true);
};
class CTextCFRun_ppt
......@@ -680,7 +387,6 @@ public:
NSPresentationEditor::CTextCFRun m_oRun;
LONG m_lCount;
public:
CTextCFRun_ppt() : m_oRun()
{
m_lCount = 0;
......@@ -696,187 +402,11 @@ public:
return *this;
}
public:
void LoadFromStream(POLE::Stream* pStream, bool bIsIndentation = true)
{
if (bIsIndentation)
{
m_lCount = StreamUtils::ReadLONG(pStream);
}
DWORD dwFlags = StreamUtils::ReadDWORD(pStream);
BYTE flag1 = (BYTE)(dwFlags);
BYTE flag2 = (BYTE)(dwFlags >> 8);
BYTE flag3 = (BYTE)(dwFlags >> 16);
BYTE flag4 = (BYTE)(dwFlags >> 24);
bool hasBold = (0x01 == (0x01 & flag1));
bool hasItalic = (0x02 == (0x02 & flag1));
bool hasUnderline = (0x04 == (0x04 & flag1));
// unused
bool hasShadow = (0x10 == (0x10 & flag1));
bool hasFehint = (0x20 == (0x20 & flag1));
// unused
bool hasKimi = (0x80 == (0x80 & flag1));
// unused
bool hasEmboss = (0x02 == (0x02 & flag2));
// unused
BYTE hasStyle = ((0x3C & flag2) >> 2);
// unused
bool typeface_ = (0x01 == (0x01 & flag3));
bool size_ = (0x02 == (0x02 & flag3));
bool color_ = (0x04 == (0x04 & flag3));
bool BaseLineOffset_ = (0x08 == (0x08 & flag3));
bool EAFontRef_ = (0x20 == (0x20 & flag3));
bool AnsiFontRef_ = (0x40 == (0x40 & flag3));
bool SymbolFontRef_ = (0x80 == (0x80 & flag3));
bool hasNewEATypeface = (0x01 == (0x01 & flag4));
bool hasCsTypeface = (0x02 == (0x02 & flag4));
bool hasPp11ext = (0x04 == (0x04 & flag4));
bool bIsFontStylePresent = (hasBold || hasItalic || hasUnderline || hasShadow ||
hasFehint || hasKimi || hasEmboss || hasStyle != 0);
if (bIsFontStylePresent)
{
WORD fontStyle = StreamUtils::ReadWORD(pStream);
if (0x01 == (0x01 & fontStyle))
m_oRun.FontBold = true;
if (0x02 == (0x02 & fontStyle))
m_oRun.FontItalic = true;
if (0x04 == (0x04 & fontStyle))
m_oRun.FontUnderline = true;
if (0x10 == (0x10 & fontStyle))
m_oRun.FontShadow = true;
}
if (typeface_)
m_oRun.Typeface = StreamUtils::ReadWORD(pStream);
if (EAFontRef_)
m_oRun.EAFontRef = StreamUtils::ReadWORD(pStream);
if (AnsiFontRef_)
m_oRun.AnsiFontRef = StreamUtils::ReadWORD(pStream);
if (SymbolFontRef_)
m_oRun.SymbolFontRef = StreamUtils::ReadWORD(pStream);
if (size_)
m_oRun.Size = StreamUtils::ReadWORD(pStream);
if (color_)
{
SColorAtom oColorAtom;
NSStreamReader::Read(pStream, oColorAtom);
NSPresentationEditor::CColor oColor;
oColor.R = oColorAtom.R;
oColor.G = oColorAtom.G;
oColor.B = oColorAtom.B;
oColor.A = 255;
oColor.m_lSchemeIndex = -1;
if (oColorAtom.Index < 10/* && oColorAtom.bSchemeIndex*/)
{
oColor.m_lSchemeIndex = oColorAtom.Index;
NSPresentationEditor::CorrectColorPPT(oColor.m_lSchemeIndex);
}
else
{
}
m_oRun.Color = oColor;
}
if (BaseLineOffset_)
m_oRun.BaseLineOffset = (double)StreamUtils::ReadSHORT(pStream);
// ????
}
void LoadFromStream(POLE::Stream* pStream, bool bIsIndentation = true);
};
namespace NSPresentationEditor
{
static void ConvertPPTTextToEditorStructure(std::vector<CTextPFRun_ppt>& oArrayPF, std::vector<CTextCFRun_ppt>& oArrayCF,
std::wstring& strText, NSPresentationEditor::CTextAttributesEx& oAttributes)
{
int nCountPFs = (int)oArrayPF.size();
int nCountCFs = (int)oArrayCF.size();
oAttributes.m_arParagraphs.clear();
int nCurrentPF = 0;
int nCurrentCF = 0;
int nOffsetCF = 0;
int nIndexLast = strText.length();
int nIndexText = 0;
for (int nIndexPF = 0; nIndexPF < nCountPFs; ++nIndexPF)
{
CParagraph elm;
oAttributes.m_arParagraphs.push_back(elm);
NSPresentationEditor::CParagraph* pPar = &oAttributes.m_arParagraphs[nIndexPF];
pPar->m_oPFRun = oArrayPF[nIndexPF].m_oRun;
pPar->m_lTextType = oAttributes.m_lTextType;
pPar->m_lTextLevel = oArrayPF[nIndexPF].m_lLevel;
int nCountInPF = oArrayPF[nIndexPF].m_lCount;
while (true)
{
if (nCurrentCF >= nCountCFs)
break;
int nCountAdd = oArrayCF[nCurrentCF].m_lCount - nOffsetCF;
if (nCountAdd > nCountInPF)
{
nOffsetCF += nCountInPF;
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
oSpan.m_strText = strText.substr(nIndexText, nCountInPF);
pPar->m_arSpans.push_back(oSpan);
nIndexText += nCountInPF;
break;
}
else if (nCountAdd == nCountInPF)
{
nOffsetCF = 0;
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
oSpan.m_strText = strText.substr(nIndexText, nCountAdd);
pPar->m_arSpans.push_back(oSpan);
nIndexText += nCountAdd;
++nCurrentCF;
break;
}
else
{
nOffsetCF = 0;
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
oSpan.m_strText = strText.substr(nIndexText, nCountAdd);
pPar->m_arSpans.push_back(oSpan);
nIndexText += nCountAdd;
nCountInPF -= nCountAdd;
++nCurrentCF;
}
}
}
}
void ConvertPPTTextToEditorStructure(std::vector<CTextPFRun_ppt>& oArrayPF, std::vector<CTextCFRun_ppt>& oArrayCF,
std::wstring& strText, NSPresentationEditor::CTextAttributesEx& oAttributes);
}
......@@ -1858,7 +1858,7 @@ protected:
int ph_type = pShape->m_lPlaceholderType;
int ph_pos = pShape->m_lPlaceholderID;
pTextSettings->m_lPlaceholderType = ph_type;
pTextSettings->m_lPlaceholderType = pShape->m_lPlaceholderType;
size_t lElemsCount = 0;
......@@ -2156,7 +2156,7 @@ protected:
if (RECORD_TYPE_TEXTSPECINFO_ATOM == oHeader.RecType)
{
CRecordTextSpecInfoAtom* pSpecInfo = new CRecordTextSpecInfoAtom();
pSpecInfo->m_lCount = strText.length();
pSpecInfo->m_lCount = -1;
pSpecInfo->ReadFromStream(oHeader, oElemInfo.m_pStream);
pSpecInfo->ApplyProperties(&(pShape->m_oShape.m_oText));
......
......@@ -3,6 +3,7 @@
class CRecordHeadersFootersAtom : public CUnknownRecord
{
public:
WORD m_nFormatID;
bool m_bHasDate;
......@@ -12,8 +13,6 @@ class CRecordHeadersFootersAtom : public CUnknownRecord
bool m_bHasHeader;
bool m_bHasFooter;
public:
CRecordHeadersFootersAtom()
{
}
......@@ -38,34 +37,14 @@ public:
}
virtual CString ToString()
{
XmlUtils::CXmlWriter oWriter;
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.WriteNodeEnd(strName, TRUE, FALSE);
CDirectory::WriteValueToNode(_T("FormatID"), (DWORD)m_nFormatID, &oWriter);
CDirectory::WriteValueToNode(_T("HasDate"), m_bHasDate, &oWriter);
CDirectory::WriteValueToNode(_T("HasTodayDate"), m_bHasTodayDate, &oWriter);
CDirectory::WriteValueToNode(_T("HasUserDate"), m_bHasUserDate, &oWriter);
CDirectory::WriteValueToNode(_T("HasSlideNumber"), m_bHasSlideNumber, &oWriter);
CDirectory::WriteValueToNode(_T("HasHeader"), m_bHasHeader, &oWriter);
CDirectory::WriteValueToNode(_T("HasFooter"), m_bHasFooter, &oWriter);
oWriter.WriteNodeEnd(strName);
return oWriter.GetXmlString();
return L"";
}
};
class CRecordRoundTripHeaderFooterDefaults12Atom : public CUnknownRecord
{
public:
WORD m_nFormatID;
bool m_bIncludeDate;
......@@ -73,8 +52,6 @@ class CRecordRoundTripHeaderFooterDefaults12Atom : public CUnknownRecord
bool m_bIncludeHeader;
bool m_bIncludeSlideNumber;
public:
CRecordRoundTripHeaderFooterDefaults12Atom()
{
}
......
......@@ -28,29 +28,24 @@ public:
m_oHeader = oHeader;
StreamUtils::StreamPosition(m_lOffsetInStream, pStream);
if (0 == m_lCount)
{
StreamUtils::StreamSeek(m_lOffsetInStream + m_oHeader.RecLen, pStream);
return;
}
DWORD lMemCount = 0;
DWORD lCountItems = 0;
while (lMemCount < m_lCount + 1)
while (true)
{
NSPresentationEditor::CTextSIRun elm;
m_arrSIs.push_back(elm);
NSStreamReader::Read(pStream, m_arrSIs[lCountItems]);
lMemCount += m_arrSIs[lCountItems].lCount;
NSStreamReader::Read(pStream, m_arrSIs.back());
lMemCount += m_arrSIs.back().lCount;
int sz = pStream->tell() - m_lOffsetInStream;
++lCountItems;
if (sz >= m_oHeader.RecLen)
break;
}
// ...
// (.. - placeholder ) -
// m_lCount...
// m_lCount... m_lCount .. si
StreamUtils::StreamSeek(m_lOffsetInStream + m_oHeader.RecLen, pStream);
}
......@@ -62,7 +57,7 @@ public:
int ind = 0;
for (int i = 0; i < pText->m_arParagraphs.size(); i++)
{
if (ind > m_arrSIs.size()) break;
if (ind >= m_arrSIs.size()) break;
for (int j = 0 ; j < pText->m_arParagraphs[i].m_arSpans.size(); j++)
{
......@@ -71,7 +66,7 @@ public:
pos_si += m_arrSIs[ind].lCount;
ind++;
}
if (ind > m_arrSIs.size()) break;
if (ind >= m_arrSIs.size()) break;
if (m_arrSIs[ind].bLang)
pText->m_arParagraphs[i].m_arSpans[j].m_oRun.Language = m_arrSIs[ind].Lang;
pos_text += pText->m_arParagraphs[i].m_arSpans[j].m_strText.length() ;
......
......@@ -470,6 +470,10 @@
RelativePath="..\Reader\PPTFileReader.h"
>
</File>
<File
RelativePath="..\Reader\ReadStructures.cpp"
>
</File>
<File
RelativePath="..\Reader\ReadStructures.h"
>
......@@ -926,14 +930,6 @@
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\Attributes.h"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\PPTXWriter\Converter.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\PPTXWriter\Converter.h"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\PPTXWriter\CSS.h"
>
......@@ -1078,6 +1074,14 @@
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\ContentTypesWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\PPTXWriter\Converter.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\PPTXWriter\Converter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\DefaultThemeWriterWin.h"
>
......
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficePPTFile", "ASCOfficePPTFile.vcproj", "{C1E5043D-4844-4893-980D-BD79CDCD05C1}"
ProjectSection(ProjectDependencies) = postProject
{7B27E40E-F70A-4A74-A77C-0944D7931D15} = {7B27E40E-F70A-4A74-A77C-0944D7931D15}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeUtilsLib", "..\..\ASCOfficeUtils\ASCOfficeUtilsLib\Win\ASCOfficeUtilsLib.vcproj", "{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}"
ProjectSection(ProjectDependencies) = postProject
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
ProjectSection(ProjectDependencies) = postProject
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agg2d", "..\..\DesktopEditor\agg-2.4\agg_vs2005.vcproj", "{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
ProjectSection(ProjectDependencies) = postProject
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agg2d", "..\..\DesktopEditor\agg-2.4\agg_vs2005.vcproj", "{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
ProjectSection(ProjectDependencies) = postProject
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "..\..\DesktopEditor\cximage\jpeg\Jpeg_vs2005.vcproj", "{818753F2-DBB9-4D3B-898A-A604309BE470}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
......@@ -76,19 +71,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpsd", "..\..\DesktopEdit
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTFormatLib", "..\PPTFormatLib\Win32\PPTFormatLib.vcproj", "{7B27E40E-F70A-4A74-A77C-0944D7931D15}"
ProjectSection(ProjectDependencies) = postProject
{A0E976CE-133D-466C-AF0E-9DD62715121F} = {A0E976CE-133D-466C-AF0E-9DD62715121F}
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6} = {3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6} = {3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}
{A0E976CE-133D-466C-AF0E-9DD62715121F} = {A0E976CE-133D-466C-AF0E-9DD62715121F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PptFormatTest", "..\..\Test\Applications\DocxFormatTests\PptFormatTest\win32\PptFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject
{7B27E40E-F70A-4A74-A77C-0944D7931D15} = {7B27E40E-F70A-4A74-A77C-0944D7931D15}
{C1E5043D-4844-4893-980D-BD79CDCD05C1} = {C1E5043D-4844-4893-980D-BD79CDCD05C1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml2", "..\..\Common\DocxFormat\Source\XML\libxml2\win_build\libxml2.vcproj", "{21663823-DE45-479B-91D0-B4FEF4916EF0}"
......@@ -99,6 +95,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig2", "..\..\DesktopEdito
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnicodeConverterLib", "..\..\UnicodeConverter\UnicodeConverterLib.vcproj", "{A0E976CE-133D-466C-AF0E-9DD62715121F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficePPTFile", "ASCOfficePPTFile.vcproj", "{C1E5043D-4844-4893-980D-BD79CDCD05C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
......@@ -111,22 +109,6 @@ Global
Unicode Release|x64 = Unicode Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Debug|Win32.ActiveCfg = Debug|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Debug|Win32.Build.0 = Debug|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Debug|x64.ActiveCfg = Debug|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Debug|x64.Build.0 = Debug|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Release|Win32.ActiveCfg = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Release|Win32.Build.0 = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Release|x64.ActiveCfg = Release|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Release|x64.Build.0 = Release|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Debug|Win32.Build.0 = Debug|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Debug|x64.ActiveCfg = Debug|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Debug|x64.Build.0 = Debug|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Release|Win32.ActiveCfg = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Release|Win32.Build.0 = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Release|x64.ActiveCfg = Release|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Release|x64.Build.0 = Release|x64
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}.Debug|Win32.ActiveCfg = Debug|Win32
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}.Debug|Win32.Build.0 = Debug|Win32
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}.Debug|x64.ActiveCfg = Debug|x64
......@@ -475,6 +457,22 @@ Global
{A0E976CE-133D-466C-AF0E-9DD62715121F}.Unicode Release|Win32.ActiveCfg = Release|Win32
{A0E976CE-133D-466C-AF0E-9DD62715121F}.Unicode Release|Win32.Build.0 = Release|Win32
{A0E976CE-133D-466C-AF0E-9DD62715121F}.Unicode Release|x64.ActiveCfg = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Debug|Win32.ActiveCfg = Debug|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Debug|Win32.Build.0 = Debug|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Debug|x64.ActiveCfg = Debug|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Debug|x64.Build.0 = Debug|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Release|Win32.ActiveCfg = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Release|Win32.Build.0 = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Release|x64.ActiveCfg = Release|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Release|x64.Build.0 = Release|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Debug|Win32.Build.0 = Debug|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Debug|x64.ActiveCfg = Debug|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Debug|x64.Build.0 = Debug|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Release|Win32.ActiveCfg = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Release|Win32.Build.0 = Release|Win32
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Release|x64.ActiveCfg = Release|x64
{C1E5043D-4844-4893-980D-BD79CDCD05C1}.Unicode Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -25,6 +25,7 @@ namespace NSPresentationEditor
ElementType m_etType;
CDoubleRect m_rcBounds;
CDoubleRect m_rcBoundsOriginal;
bool m_bBoundsEnabled;
double m_dStartTime;
double m_dEndTime;
......@@ -109,6 +110,8 @@ namespace NSPresentationEditor
m_etType = etPicture;
m_bBoundsEnabled = true;
m_rcBounds.left = 0;
m_rcBounds.top = 0;
m_rcBounds.right = 1;
......@@ -160,6 +163,8 @@ namespace NSPresentationEditor
if (NULL == pDublicate)
return;
pDublicate->m_bBoundsEnabled = m_bBoundsEnabled;
pDublicate->m_bIsBackground = m_bIsBackground;
pDublicate->m_bHaveAnchor = m_bHaveAnchor;
......
......@@ -9,6 +9,8 @@ namespace NSPresentationEditor
std::vector<IElement*> m_arElements;
std::vector<CColor> m_arColorScheme;
std::map<int,int> m_pPlaceholders;
bool m_bUseThemeColorScheme;
// ""( ),
......
......@@ -27,6 +27,7 @@ namespace NSPresentationEditor
std::vector<IElement*> m_arElements;
std::map<int,int> m_pPlaceholders;
CMetricInfo m_oInfo;
std::wstring m_sThemeName;
......@@ -35,12 +36,22 @@ namespace NSPresentationEditor
long m_lOriginalWidth;
long m_lOriginalHeight;
bool m_bHasDate;
bool m_bHasSlideNumber;
bool m_bHasHeader;
bool m_bHasFooter;
//------------------------------------------------------------------------------------
CTheme() : m_arColorScheme(), m_arFonts(), m_arBrushes(),
m_arPens(), m_arEffects(), m_arLayouts()
{
m_sThemeName = L"Default";
m_lOriginalWidth = m_lOriginalHeight = 0;
m_bHasDate = false;
m_bHasSlideNumber = false;
m_bHasHeader = false;
m_bHasFooter = false;
}
CTheme(const CTheme& oSrc)
......@@ -61,6 +72,10 @@ namespace NSPresentationEditor
m_lOriginalWidth = oSrc.m_lOriginalWidth ;
m_lOriginalHeight = oSrc.m_lOriginalHeight;
m_bHasDate = oSrc.m_bHasDate;
m_bHasSlideNumber = oSrc.m_bHasSlideNumber;
m_bHasHeader = oSrc.m_bHasHeader;
m_bHasFooter = oSrc.m_bHasFooter;
for (int i = 0; i < oSrc.m_arExtraColorScheme.size(); ++i)
{
......@@ -129,6 +144,11 @@ namespace NSPresentationEditor
m_lOriginalWidth = m_lOriginalHeight = 0;
m_sThemeName = L"Default";
m_bHasDate = false;
m_bHasSlideNumber = false;
m_bHasHeader = false;
m_bHasFooter = false;
}
~CTheme()
......
......@@ -766,7 +766,7 @@ void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRe
if (bIsEqualTransform)
{
if (pElement->m_rcBounds.IsEqual(pElLayout->m_rcBounds, 0.5))
m_pShapeWriter->SetIsWriteGeom(false);
pElement->m_bBoundsEnabled = false;
}
break;
......
......@@ -250,8 +250,6 @@ NSPresentationEditor::CShapeWriter::CShapeWriter()
m_pRels = NULL;
m_lNextShapeID = 1000;
m_bIsWriteGeom = true;
m_bWordArt = false;
m_bTextBox = false;
......@@ -956,30 +954,6 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{
std::wstring str_lang = msLCID2wstring(pCF->Language.get());
//#if defined(_WIN32) || defined(_WIN64)
// wchar_t buf[29] = {};
//
// int ccBuf = GetLocaleInfo(pCF->Language.get(), LOCALE_SISO639LANGNAME, buf, 29);
//
// if (ccBuf > 0)
// {
// str_lang.append(buf);
// str_lang.append(_T("-"));
// }
//
// ccBuf = GetLocaleInfo(pCF->Language.get(), LOCALE_SISO3166CTRYNAME, buf, 29);
//
// if (ccBuf > 0) str_lang.append(buf);
//#else
// for (int i = 0; i < 136; i++)
// {
// if (LCID_ms_convert[i].LCID_int == pCF->Language.get())
// {
// str_lang = LCID_ms_convert[i].LCID_string;
// break;
// }
// }
//#endif
if (str_lang.length() > 0)
m_oWriter.WriteString(std::wstring(L" lang=\"") + str_lang + _T("\""));
}
......@@ -1105,7 +1079,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
m_oWriter.WriteString(std::wstring(L"<p:spPr>"));
if (m_bIsWriteGeom)
if (m_pShapeElement->m_bBoundsEnabled)
{
CString str;
......@@ -1237,7 +1211,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertImage()
m_oWriter.WriteString(std::wstring(L"<p:spPr>"));
if (m_bIsWriteGeom)
if (m_pImageElement->m_bBoundsEnabled)
{
CString str;
......
......@@ -48,7 +48,6 @@ namespace NSPresentationEditor
NSPresentationEditor::CRelsGenerator* m_pRels;
LONG m_lNextShapeID;
bool m_bIsWriteGeom;
bool m_bWordArt;
bool m_bTextBox;
......@@ -75,7 +74,6 @@ namespace NSPresentationEditor
m_oBounds = m_pImageElement->m_rcBounds;
m_oTextRect = m_oBounds;
m_bIsWriteGeom = true;
m_bWordArt = false;
m_bTextBox = false;
......@@ -93,7 +91,6 @@ namespace NSPresentationEditor
m_oBounds = m_pShapeElement->m_rcBounds;
m_oTextRect = m_oBounds;
m_bIsWriteGeom = true;
m_bWordArt = false;
m_bTextBox = false;
......@@ -106,10 +103,6 @@ namespace NSPresentationEditor
m_oWriterPath.ClearNoAttack();
m_oWriterVML.ClearNoAttack();
}
AVSINLINE void SetIsWriteGeom(bool bIsWrite)
{
m_bIsWriteGeom = bIsWrite;
}
//--------------------------------------------------------------------
CString ConvertShape ();
CString ConvertImage ();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment