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

PPTformat

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65644 954022d7-b5bf-4e40-9824-e11837661b57
parent 6affb86a
......@@ -614,8 +614,8 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
//------------- ()
std::map<int, int>::iterator it;
it = pLayout->m_pPlaceholders.find(NSOfficePPT::MasterSlideNumber);
if ( it != pLayout->m_pPlaceholders.end() &&
it = pLayout->m_mapPlaceholders.find(NSOfficePPT::MasterSlideNumber);
if ( it != pLayout->m_mapPlaceholders.end() &&
slidePlaceholders.find(NSOfficePPT::MasterSlideNumber) == slidePlaceholders.end())
{
IElement* pElement = pLayout->m_arElements[it->second]->CreateDublicate();
......@@ -623,24 +623,25 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
}
it = pLayout->m_pPlaceholders.find(MasterDate);
if ( it != pLayout->m_pPlaceholders.end() &&
it = pLayout->m_mapPlaceholders.find(MasterDate);
if ( it != pLayout->m_mapPlaceholders.end() &&
slidePlaceholders.find(NSOfficePPT::MasterDate) == slidePlaceholders.end())
{
IElement* pElement = pLayout->m_arElements[it->second]->CreateDublicate();
pSlide->m_arElements.push_back(pElement);
}
it = pLayout->m_pPlaceholders.find(MasterHeader);
if ( it != pLayout->m_pPlaceholders.end() &&
slidePlaceholders.find(NSOfficePPT::MasterHeader) == slidePlaceholders.end())
{
IElement* pElement = pLayout->m_arElements[it->second]->CreateDublicate();
pSlide->m_arElements.push_back(pElement);
}
it = pLayout->m_pPlaceholders.find(MasterFooter);
if ( it != pLayout->m_pPlaceholders.end() &&
// 97 Notes
//it = pLayout->m_mapPlaceholders.find(MasterHeader);
//if ( it != pLayout->m_mapPlaceholders.end() &&
// slidePlaceholders.find(NSOfficePPT::MasterHeader) == slidePlaceholders.end())
//{
// IElement* pElement = pLayout->m_arElements[it->second]->CreateDublicate();
// pSlide->m_arElements.push_back(pElement);
//}
it = pLayout->m_mapPlaceholders.find(MasterFooter);
if ( it != pLayout->m_mapPlaceholders.end() &&
slidePlaceholders.find(NSOfficePPT::MasterFooter) == slidePlaceholders.end())
{
IElement* pElement = pLayout->m_arElements[it->second]->CreateDublicate();
......@@ -649,21 +650,21 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
}
IElement* CPPTUserInfo::AddThemeLayoutElement (CLayout *pLayout, int placeholderType, NSPresentationEditor::CTheme* pTheme)
IElement* CPPTUserInfo::AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, NSPresentationEditor::CTheme* pTheme)
{
IElement* pElement = NULL;
std::map<int, int>::iterator it = pTheme->m_pPlaceholders.find(placeholderType);
std::map<int, int>::iterator it = pTheme->m_mapPlaceholders.find(placeholderType);
if ((it != pTheme->m_pPlaceholders.end()) && (pLayout->m_pPlaceholders.find(placeholderType) == pLayout->m_pPlaceholders.end()))
if ((it != pTheme->m_mapPlaceholders.end()) && (pLayout->m_mapPlaceholders.find(placeholderType) == pLayout->m_mapPlaceholders.end()))
{
pElement = pTheme->m_arElements[it->second]->CreateDublicate();
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pLayout->m_pPlaceholders.insert(std::pair<int, int>(it->first, pLayout->m_arElements.size()-1));
pLayout->m_mapPlaceholders.insert(std::pair<int, int>(it->first, pLayout->m_arElements.size()-1));
}
return pElement;
}
IElement* CPPTUserInfo::AddNewLayoutElement (CLayout *pLayout, int placeholderType, int placeholderSizePreset)
IElement* CPPTUserInfo::AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset)
{
if (placeholderType < 1) return NULL;
......@@ -682,13 +683,13 @@ IElement* CPPTUserInfo::AddNewLayoutElement (CLayout *pLayout, int placeholderTy
CorrectPlaceholderType(pShape->m_lPlaceholderType);
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));
pLayout->m_mapPlaceholders.insert(std::pair<int, int>(pShape->m_lPlaceholderType, pLayout->m_arElements.size()-1));
return pShape;
}
int CPPTUserInfo::AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector<CTextFullSettings> & text,
CRecordHeadersFootersAtom* headers_footers, bool addShapes, bool bMasterObjects)
int CPPTUserInfo::AddNewLayout(CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector<CTextFullSettings> & text,
CRecordHeadersFootersAtom* headers_footers, bool addShapes, bool bMasterObjects)
{
if (pTheme == NULL) return -1;
......@@ -757,52 +758,76 @@ int CPPTUserInfo::AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayou
int usualType = layoutRecord->m_pPlaceHolderID[i];
CorrectPlaceholderType(usualType);
if (!AddThemeLayoutElement(pLayout, usualType, pTheme))
if (!AddThemeLayoutPlaceholder(pLayout, usualType, pTheme))
{
AddNewLayoutElement(pLayout, usualType, defObjSize);
AddNewLayoutPlaceholder(pLayout, usualType, defObjSize);
}
}break;
default:
AddNewLayoutElement(pLayout, layoutRecord->m_pPlaceHolderID[i], defObjSize);
AddNewLayoutPlaceholder(pLayout, layoutRecord->m_pPlaceHolderID[i], defObjSize);
break;
}
}
if (layoutRecord->m_nGeom==0x0F) return ind; // big object only !!!
//if (layoutRecord->m_nGeom==0x0F) return ind; // big object only !!!
if (headers_footers)
{
if (headers_footers->m_bHasSlideNumber)
{
AddThemeLayoutElement(pLayout, MasterSlideNumber, pTheme);
AddThemeLayoutPlaceholder(pLayout, MasterSlideNumber, pTheme);
}
if (headers_footers->m_bHasTodayDate ||
headers_footers->m_bHasUserDate ||
headers_footers->m_bHasDate)
{
AddThemeLayoutElement(pLayout, MasterDate, pTheme);
}
if (headers_footers->m_bHasHeader)
{
AddThemeLayoutElement(pLayout, MasterHeader, pTheme);
AddThemeLayoutPlaceholder(pLayout, MasterDate, pTheme);
}
// 97 Notes
//if (headers_footers->m_bHasHeader)
//{
// AddThemeLayoutPlaceholder(pLayout, MasterHeader, pTheme);
//}
if (headers_footers->m_bHasFooter)
{
AddThemeLayoutElement(pLayout, MasterFooter, pTheme);
AddThemeLayoutPlaceholder(pLayout, MasterFooter, pTheme);
}
}
else if (bMasterObjects)
{
AddThemeLayoutElement(pLayout, MasterSlideNumber ,pTheme);
AddThemeLayoutElement(pLayout, MasterDate ,pTheme);
AddThemeLayoutElement(pLayout, MasterFooter ,pTheme);
AddThemeLayoutElement(pLayout, MasterHeader ,pTheme);
AddThemeLayoutPlaceholder(pLayout, MasterSlideNumber ,pTheme);
AddThemeLayoutPlaceholder(pLayout, MasterDate ,pTheme);
AddThemeLayoutPlaceholder(pLayout, MasterFooter ,pTheme);
// 97 Notes
//AddThemeLayoutPlaceholder(pLayout, MasterHeader ,pTheme);
}
return ind;
}
IElement* CPPTUserInfo::AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset)
{
if (placeholderType < 1) return NULL;
CShapeElement* pShape = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pShape->m_lPlaceholderType = placeholderType;
pShape->m_lPlaceholderSizePreset = placeholderSizePreset;
//if (pShape->m_lPlaceholderSizePreset > 0)
// pShape->m_bPlaceholderSet = true;
//else
pShape->m_bPlaceholderSet = false;
pShape->m_bLine = false;
pShape->m_bBoundsEnabled = false;
CorrectPlaceholderType(pShape->m_lPlaceholderType);
pTheme->m_arElements.push_back(dynamic_cast<IElement*>(pShape));
pTheme->m_mapPlaceholders.insert(std::pair<int, int>(pShape->m_lPlaceholderType, pTheme->m_arElements.size()-1));
return pShape;
}
void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, const LONG& lOriginHeight)
{
std::map<DWORD, LONG>::iterator pPair = m_mapMasterToTheme.find(dwMasterID);
......@@ -1011,7 +1036,7 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
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));
pTheme->m_mapPlaceholders.insert(std::pair<int, int>(pElem->m_lPlaceholderType, pTheme->m_arElements.size()-1));
}
}
......@@ -1022,34 +1047,35 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
{
if (oArrayHeadersFootersAtoms[0]->m_bHasSlideNumber)
{
if (pTheme->m_pPlaceholders.find(MasterSlideNumber) == pTheme->m_pPlaceholders.end())
if (pTheme->m_mapPlaceholders.find(MasterSlideNumber) == pTheme->m_mapPlaceholders.end())
{
CShapeElement* pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = MasterSlideNumber;
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));
AddNewThemePlaceholder(pTheme, MasterSlideNumber, 2);
}
}
if (oArrayHeadersFootersAtoms[0]->m_bHasTodayDate ||
oArrayHeadersFootersAtoms[0]->m_bHasUserDate ||
oArrayHeadersFootersAtoms[0]->m_bHasDate)
{
if (pTheme->m_pPlaceholders.find(MasterDate) == pTheme->m_pPlaceholders.end())
if (pTheme->m_mapPlaceholders.find(MasterDate) == pTheme->m_mapPlaceholders.end())
{
CShapeElement* pElement = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
pElement->m_lPlaceholderType = MasterDate;
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));
AddNewThemePlaceholder(pTheme, MasterDate, 2);
}
}
// 97 Notes
//if (oArrayHeadersFootersAtoms[0]->m_bHasHeader)
//{
// if (pLayout->m_mapPlaceholders.find(MasterHeader) == pLayout->m_mapPlaceholders.end())
// {
// AddNewThemePlaceholder(pTheme, MasterHeader, 1);
// }
//}
if (oArrayHeadersFootersAtoms[0]->m_bHasFooter)
{
if (pLayout->m_mapPlaceholders.find(MasterFooter) == pLayout->m_mapPlaceholders.end())
{
AddNewThemePlaceholder(pTheme, MasterFooter, 1);
}
}
}
}
......@@ -1231,7 +1257,7 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
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));
pLayout->m_mapPlaceholders.insert(std::pair<int, int>(pElem->m_lPlaceholderType, pLayout->m_arElements.size()-1));
}
}
......@@ -1242,20 +1268,34 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
{
if (oArrayHeadersFootersAtoms[0]->m_bHasSlideNumber)
{
if (pLayout->m_pPlaceholders.find(MasterSlideNumber) == pLayout->m_pPlaceholders.end())
if (pLayout->m_mapPlaceholders.find(MasterSlideNumber) == pLayout->m_mapPlaceholders.end())
{
AddNewLayoutElement(pLayout, MasterSlideNumber, 4);
AddNewLayoutPlaceholder(pLayout, MasterSlideNumber, 2);
}
}
if (oArrayHeadersFootersAtoms[0]->m_bHasTodayDate ||
oArrayHeadersFootersAtoms[0]->m_bHasUserDate ||
oArrayHeadersFootersAtoms[0]->m_bHasDate)
{
if (pLayout->m_pPlaceholders.find(MasterDate) == pLayout->m_pPlaceholders.end())
if (pLayout->m_mapPlaceholders.find(MasterDate) == pLayout->m_mapPlaceholders.end())
{
AddNewLayoutElement(pLayout, MasterDate, 2);
AddNewLayoutPlaceholder(pLayout, MasterDate, 2);
}
}
if (oArrayHeadersFootersAtoms[0]->m_bHasHeader)
{
if (pLayout->m_mapPlaceholders.find(MasterHeader) == pLayout->m_mapPlaceholders.end())
{
AddNewLayoutPlaceholder(pLayout, MasterHeader, 1);
}
}
if (oArrayHeadersFootersAtoms[0]->m_bHasFooter)
{
if (pLayout->m_mapPlaceholders.find(MasterFooter) == pLayout->m_mapPlaceholders.end())
{
AddNewLayoutPlaceholder(pLayout, MasterFooter, 1);
}
}
}
}
......
......@@ -257,6 +257,8 @@ public:
int AddNewLayout(NSPresentationEditor::CTheme* pTheme, SSlideLayoutAtom* layoutRecord, std::vector<CTextFullSettings> & text,
CRecordHeadersFootersAtom* headers_footers, bool addShapes, bool bMasterObjects);
IElement* AddNewLayoutElement (CLayout *pLayout, int placeholderType, int placeholderSizePreset = -1);
IElement* AddThemeLayoutElement (CLayout *pLayout, int placeholderType, NSPresentationEditor::CTheme* pTheme);
IElement* AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset = -1);
IElement* AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, CTheme* pTheme);
IElement* AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset = -1);
};
......@@ -371,6 +371,8 @@ void CTextPFRun_ppt::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation)
WORD tabStopsCount = StreamUtils::ReadWORD(pStream);
m_oRun.tabStops.clear();
tabStopsCount = tabStopsCount & 0x000f;
for (int i = 0; i < (int)tabStopsCount; ++i)
{
WORD tabPos = StreamUtils::ReadWORD(pStream);
......
......@@ -45,6 +45,8 @@ public:
while (lMemCount < m_lCount + 1)
{
if (pStream->tell() >= m_lOffsetInStream + m_oHeader.RecLen) break;
CTextPFRun_ppt elm;
m_arrPFs.push_back(elm);
m_arrPFs[lCountItems].LoadFromStream(pStream);
......@@ -57,6 +59,8 @@ public:
lCountItems = 0;
while (lMemCount < m_lCount + 1)
{
if (pStream->tell() >= m_lOffsetInStream + m_oHeader.RecLen) break;
CTextCFRun_ppt elm;
m_arrCFs.push_back(elm);
......
......@@ -9,7 +9,7 @@ namespace NSPresentationEditor
std::vector<IElement*> m_arElements;
std::vector<CColor> m_arColorScheme;
std::map<int,int> m_pPlaceholders;
std::map<int,int> m_mapPlaceholders;
bool m_bUseThemeColorScheme;
......@@ -45,7 +45,7 @@ namespace NSPresentationEditor
{
Clear();
m_arElements.insert(m_arElements.end(), oSrc.m_arElements.begin(), oSrc.m_arElements.end());
m_arElements = oSrc.m_arElements;
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
......@@ -53,7 +53,8 @@ namespace NSPresentationEditor
ADDREFINTERFACE((m_arElements[nIndex]));
}
m_arColorScheme = oSrc.m_arColorScheme;
m_mapPlaceholders = oSrc.m_mapPlaceholders;
m_arColorScheme = oSrc.m_arColorScheme;
m_bUseThemeColorScheme = oSrc.m_bUseThemeColorScheme;
......@@ -69,6 +70,8 @@ namespace NSPresentationEditor
m_bShowMasterShapes = oSrc.m_bShowMasterShapes;
m_strLayoutType = oSrc.m_strLayoutType;
m_sName = oSrc.m_sName;
return *this;
}
......@@ -91,6 +94,7 @@ namespace NSPresentationEditor
}
m_arElements.clear();
m_mapPlaceholders.clear();
m_bUseThemeColorScheme = true;
m_bShowMasterShapes = true;
......@@ -122,7 +126,7 @@ namespace NSPresentationEditor
return pNew;
}
IElement* GetPlaceholder(LONG lID, bool bIsAddRef)
IElement* GetPlaceholder(LONG lID, bool bIsAddRef)
{
size_t nCount = m_arElements.size();
......
......@@ -34,7 +34,7 @@ namespace NSPresentationEditor
CMetricInfo m_oInfo;
CString m_strComment;
std::wstring m_strComment;
std::wstring m_sName;
public:
CSlide() : m_arElements(), m_oSlideShow()
......@@ -70,7 +70,8 @@ namespace NSPresentationEditor
m_dDuration = 30000.0;
m_bShowMasterShapes = true;
m_strComment = _T("");
m_strComment.clear();
m_sName.clear();
}
......@@ -143,6 +144,7 @@ namespace NSPresentationEditor
m_bShowMasterShapes = oSrc.m_bShowMasterShapes;
m_strComment = oSrc.m_strComment;
m_sName = oSrc.m_sName;
}
public:
......@@ -213,23 +215,9 @@ namespace NSPresentationEditor
return;
}
//m_arElements[nIndexElement] = pLayoutElem->CreateDublicate();
//m_arElements[nIndexElement]->m_oProperties = pElement->m_oProperties;
m_arElements[nIndexElement]->SetupProperties(this, pTheme, pLayout);
}
virtual CString SerializeToXml()
{
CString strSlide = _T("");
strSlide.Format(_T("<Slide tid='%d' lid='%d'>"), m_lThemeID, m_lLayoutID);
for (size_t i = 0; i < m_arElements.size(); ++i)
{
strSlide += m_arElements[i]->SerializeToXml();
}
strSlide += _T("</Slide>");
return strSlide;
}
void SetMetricInfo(const CMetricInfo& oInfo)
{
m_oInfo = oInfo;
......
......@@ -13,6 +13,8 @@ namespace NSPresentationEditor
std::map<_UINT64, LONG> m_mapGeomToLayout;//
std::map<DWORD, LONG> m_mapTitleLayout; //
std::map<int,int> m_mapPlaceholders;
std::vector<CColor> m_arColorScheme;
std::vector<CFont> m_arFonts;
std::vector<CBrush> m_arBrushes;
......@@ -27,7 +29,6 @@ namespace NSPresentationEditor
std::vector<IElement*> m_arElements;
std::map<int,int> m_pPlaceholders;
CMetricInfo m_oInfo;
std::wstring m_sThemeName;
......@@ -48,13 +49,13 @@ namespace NSPresentationEditor
CTheme() : m_arColorScheme(), m_arFonts(), m_arBrushes(),
m_arPens(), m_arEffects(), m_arLayouts()
{
m_sThemeName = L"Default";
m_lOriginalWidth = m_lOriginalHeight = 0;
m_sThemeName = L"Default";
m_lOriginalWidth = m_lOriginalHeight = 0;
m_bHasDate = false;
m_bHasSlideNumber = false;
m_bHasHeader = false;
m_bHasFooter = false;
m_bHasDate = false;
m_bHasSlideNumber = false;
m_bHasHeader = false;
m_bHasFooter = false;
}
CTheme(const CTheme& oSrc)
......@@ -91,6 +92,7 @@ namespace NSPresentationEditor
m_arLayouts = oSrc.m_arLayouts;
m_mapTitleLayout = oSrc.m_mapTitleLayout;
m_mapGeomToLayout = oSrc.m_mapGeomToLayout;
m_mapPlaceholders = oSrc.m_mapPlaceholders;
m_bIsBackground = oSrc.m_bIsBackground;
m_oBackground = oSrc.m_oBackground;
......@@ -143,6 +145,10 @@ namespace NSPresentationEditor
}
m_arElements.clear();
m_arLayouts.clear();
m_mapTitleLayout.clear();
m_mapGeomToLayout.clear();
m_mapPlaceholders.clear();
m_lOriginalWidth = m_lOriginalHeight = 0;
......
......@@ -189,7 +189,7 @@ namespace NSPresentationEditor
str.Format(_T("<Relationship Id=\"rId%d\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide\" Target=\"../notesSlides/notesSlide%d.xml\"/>"), m_lNextRelsID++, nIndexSlide + 1);
m_oWriter.WriteString(str);
}
static AVSINLINE void StartNotes(int nIndexSlide, CString strDirectory, CString strComment)
static AVSINLINE void StartNotes(int nIndexSlide, CString strDirectory, std::wstring strComment)
{
CString sNum = _T("");
sNum.Format(_T("%d"), nIndexSlide + 1);
......
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