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

PPTFormat

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65667 954022d7-b5bf-4e40-9824-e11837661b57
parent 27aac365
...@@ -42,7 +42,8 @@ public: ...@@ -42,7 +42,8 @@ public:
std::vector<CFont> m_arrFonts; std::vector<CFont> m_arrFonts;
NSPresentationEditor::CTextStyles m_oDefaultTextStyle; NSPresentationEditor::CTextStyles m_oDefaultTextStyle;
std::vector<std::wstring> m_oFootersHeaderString; std::vector<std::wstring> m_PlaceholdersReplaceString[3]; //0-dates, 1 - headers, 2 - footers
bool m_bHasDate; bool m_bHasDate;
bool m_bHasSlideNumber; bool m_bHasSlideNumber;
bool m_bHasFooter; bool m_bHasFooter;
...@@ -260,8 +261,10 @@ public: ...@@ -260,8 +261,10 @@ public:
int AddNewLayout(NSPresentationEditor::CTheme* pTheme, CRecordSlide* pRecordSlide, bool addShapes, bool bMasterObjects); int AddNewLayout(NSPresentationEditor::CTheme* pTheme, CRecordSlide* pRecordSlide, bool addShapes, bool bMasterObjects);
IElement* AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset = -1); 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); IElement* AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset = -1);
IElement* AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, CTheme* pTheme);
IElement* AddLayoutSlidePlaceholder (CSlide *pSlide, int placeholderType, CLayout *pLayout, bool idx_only = false);
}; };
...@@ -1474,7 +1474,18 @@ public: ...@@ -1474,7 +1474,18 @@ public:
if (0 < oArrayDateMeta.size()) if (0 < oArrayDateMeta.size())
{ {
pElem->m_lPlaceholderType = PT_MasterDate; pElem->m_lPlaceholderType = PT_MasterDate;
pElem->m_lPlaceholderUserStr = oArrayDateMeta[0]->m_nPosition;
CRecordDateTimeMetaAtom* format_data = dynamic_cast<CRecordDateTimeMetaAtom*>(oArrayDateMeta[0]);
if (format_data)
{
pElem->m_nFormatDate = 1;
//todooo
}
else
{
pElem->m_lPlaceholderUserStr = oArrayDateMeta[0]->m_nPosition;
pElem->m_nFormatDate = 2;
}
} }
//------------- --------------------------------------------------------------------------------- //------------- ---------------------------------------------------------------------------------
std::vector<CRecordClientAnchor*> oArrayAnchor; std::vector<CRecordClientAnchor*> oArrayAnchor;
...@@ -1601,7 +1612,10 @@ public: ...@@ -1601,7 +1612,10 @@ public:
} }
if (pElem->m_lPlaceholderType == PT_MasterSlideNumber && strShapeText.length() > 5) if (pElem->m_lPlaceholderType == PT_MasterSlideNumber && strShapeText.length() > 5)
pElem->m_lPlaceholderType = PT_MasterFooter; ///???? 1-(33).ppt {
int pos = strShapeText.find(L"*");
if (pos < 0) pElem->m_lPlaceholderType = PT_MasterFooter; ///???? 1-(33).ppt
}
//------ shape properties ---------------------------------------------------------------------------------------- //------ shape properties ----------------------------------------------------------------------------------------
for (int nIndexProp = 0; nIndexProp < oArrayOptions.size(); ++nIndexProp) for (int nIndexProp = 0; nIndexProp < oArrayOptions.size(); ++nIndexProp)
......
#pragma once #pragma once
#include "../Reader/Records.h" #include "../Reader/Records.h"
#include "CString.h"
class CRecordHeadersFootersContainer : public CRecordsContainer
{
};
class CRecordHeadersFootersAtom : public CUnknownRecord class CRecordHeadersFootersAtom : public CUnknownRecord
{ {
...@@ -31,13 +28,15 @@ public: ...@@ -31,13 +28,15 @@ public:
m_nFormatID = StreamUtils::ReadWORD(pStream); m_nFormatID = StreamUtils::ReadWORD(pStream);
USHORT nFlag = StreamUtils::ReadWORD(pStream); BYTE nFlag = StreamUtils::ReadBYTE(pStream);
m_bHasDate = ((nFlag & 0x01) == 0x01); m_bHasDate = ((nFlag & 0x01) == 0x01);
m_bHasTodayDate = ((nFlag & 0x02) == 0x02); m_bHasTodayDate = ((nFlag & 0x02) == 0x02);
m_bHasUserDate = ((nFlag & 0x04) == 0x04); m_bHasUserDate = ((nFlag & 0x04) == 0x04);
m_bHasSlideNumber = ((nFlag & 0x08) == 0x08); m_bHasSlideNumber = ((nFlag & 0x08) == 0x08);
m_bHasHeader = ((nFlag & 0x10) == 0x10); m_bHasHeader = ((nFlag & 0x10) == 0x10);
m_bHasFooter = ((nFlag & 0x20) == 0x20); m_bHasFooter = ((nFlag & 0x20) == 0x20);
StreamUtils::ReadBYTE(pStream);//reserved
} }
}; };
...@@ -92,7 +91,10 @@ public: ...@@ -92,7 +91,10 @@ public:
{ {
m_oHeader = oHeader; m_oHeader = oHeader;
m_nPosition = StreamUtils::ReadDWORD(pStream); if (oHeader.RecLen >=4)
{
m_nPosition = StreamUtils::ReadDWORD(pStream);
}
} }
}; };
...@@ -116,13 +118,23 @@ public: ...@@ -116,13 +118,23 @@ public:
class CRecordDateTimeMetaAtom : public CRecordGenericDateMetaAtom class CRecordDateTimeMetaAtom : public CRecordGenericDateMetaAtom
{ {
public: public:
BYTE m_FormatID; DWORD m_FormatID;
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{ {
int lPosition = pStream->tell();
CRecordGenericDateMetaAtom::ReadFromStream(oHeader, pStream); CRecordGenericDateMetaAtom::ReadFromStream(oHeader, pStream);
m_FormatID = StreamUtils::ReadBYTE(pStream); if (oHeader.RecLen == 8)
{
m_FormatID = StreamUtils::ReadDWORD(pStream);
}
else if (oHeader.RecLen >4)
{
m_FormatID = StreamUtils::ReadBYTE(pStream);
StreamUtils::StreamSeek(lPosition + m_oHeader.RecLen, pStream);
}
} }
}; };
...@@ -137,4 +149,44 @@ class CRecordHeaderMetaAtom : public CRecordMetaCharacterAtom ...@@ -137,4 +149,44 @@ class CRecordHeaderMetaAtom : public CRecordMetaCharacterAtom
class CRecordSlideNumberMetaAtom : public CRecordMetaCharacterAtom class CRecordSlideNumberMetaAtom : public CRecordMetaCharacterAtom
{ {
}; };
\ No newline at end of file
class CRecordHeadersFootersContainer : public CRecordsContainer
{
public:
std::vector<std::wstring> m_HeadersFootersString[3]; //0-dates, 1 - headers, 2 - footers
CRecordHeadersFootersAtom *m_oHeadersFootersAtom;
CRecordHeadersFootersContainer()
{
m_oHeadersFootersAtom = NULL;
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
CRecordsContainer::ReadFromStream(oHeader, pStream);
for (int i = 0 ; i < m_arRecords.size(); i++)
{
switch(m_arRecords[i]->m_oHeader.RecType)
{
case 0x0FDA:
m_oHeadersFootersAtom = dynamic_cast<CRecordHeadersFootersAtom *>(m_arRecords[i]);
break;
case 0xFBA:
{
CRecordCString *str = dynamic_cast<CRecordCString *>(m_arRecords[i]);
switch(m_arRecords[i]->m_oHeader.RecInstance)
{
case 0x000: m_HeadersFootersString[0].push_back(str->m_strText); break;
case 0x001: m_HeadersFootersString[1].push_back(str->m_strText); break;
case 0x002: m_HeadersFootersString[2].push_back(str->m_strText); break;
}
}break;
}
}
}
};
...@@ -530,10 +530,6 @@ ...@@ -530,10 +530,6 @@
RelativePath="..\Records\CurrentUserAtom.h" RelativePath="..\Records\CurrentUserAtom.h"
> >
</File> </File>
<File
RelativePath="..\Records\DateTimeMCAtom.h"
>
</File>
<File <File
RelativePath="..\Records\DocRoutingSlipAtom.h" RelativePath="..\Records\DocRoutingSlipAtom.h"
> >
......
...@@ -89,20 +89,23 @@ void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CT ...@@ -89,20 +89,23 @@ void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CT
} }
} }
void NSPresentationEditor::CShapeElement::SetUpText(std::wstring newText) bool NSPresentationEditor::CShapeElement::SetUpTextPlaceholder(std::wstring newText)
{ {
bool result = false;
NSPresentationEditor::CTextAttributesEx* pText = &m_oShape.m_oText; NSPresentationEditor::CTextAttributesEx* pText = &m_oShape.m_oText;
if (pText->m_arParagraphs.size() > 0) if (pText->m_arParagraphs.size() > 0)
{ {
if (pText->m_arParagraphs[0].m_arSpans.size() >0) if (pText->m_arParagraphs[0].m_arSpans.size() >0)
{ {
ReplaceAll(pText->m_arParagraphs[0].m_arSpans[0].m_strText, L"*", newText); int pos = pText->m_arParagraphs[0].m_arSpans[0].m_strText.find(L"*");
pText->m_arParagraphs[0].m_arSpans.erase(pText->m_arParagraphs[0].m_arSpans.begin()+1,pText->m_arParagraphs[0].m_arSpans.end());
if (pos >= 0)
{
ReplaceAll(pText->m_arParagraphs[0].m_arSpans[0].m_strText, L"*", newText);
result = true;
}
} }
pText->m_arParagraphs.erase(pText->m_arParagraphs.begin()+1,pText->m_arParagraphs.end());
} }
return result;
} }
\ No newline at end of file
...@@ -509,7 +509,7 @@ namespace NSPresentationEditor ...@@ -509,7 +509,7 @@ namespace NSPresentationEditor
m_oShape.SetToDublicate(&pShapeElement->m_oShape); m_oShape.SetToDublicate(&pShapeElement->m_oShape);
return (IElement*)pShapeElement; return (IElement*)pShapeElement;
} }
void SetUpText(std::wstring newText); bool SetUpTextPlaceholder(std::wstring newText);
virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout) virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{ {
......
...@@ -8,8 +8,7 @@ namespace NSPresentationEditor ...@@ -8,8 +8,7 @@ namespace NSPresentationEditor
public: public:
std::vector<IElement*> m_arElements; std::vector<IElement*> m_arElements;
std::vector<CColor> m_arColorScheme; std::vector<CColor> m_arColorScheme;
std::multimap<int,int> m_mapPlaceholders;
std::map<int,int> m_mapPlaceholders;
bool m_bUseThemeColorScheme; bool m_bUseThemeColorScheme;
......
...@@ -12,6 +12,7 @@ namespace NSPresentationEditor ...@@ -12,6 +12,7 @@ namespace NSPresentationEditor
std::vector<IElement*> m_arElements; std::vector<IElement*> m_arElements;
CSlideShowInfo m_oSlideShow; CSlideShowInfo m_oSlideShow;
std::multimap<int,int> m_mapPlaceholders;
// //
long m_lWidth; long m_lWidth;
......
...@@ -13,7 +13,7 @@ namespace NSPresentationEditor ...@@ -13,7 +13,7 @@ namespace NSPresentationEditor
std::map<_UINT64, LONG> m_mapGeomToLayout;// std::map<_UINT64, LONG> m_mapGeomToLayout;//
std::map<DWORD, LONG> m_mapTitleLayout; // std::map<DWORD, LONG> m_mapTitleLayout; //
std::map<int,int> m_mapPlaceholders; std::multimap<int,int> m_mapPlaceholders;
std::vector<CColor> m_arColorScheme; std::vector<CColor> m_arColorScheme;
std::vector<CFont> m_arFonts; std::vector<CFont> m_arFonts;
...@@ -44,7 +44,7 @@ namespace NSPresentationEditor ...@@ -44,7 +44,7 @@ namespace NSPresentationEditor
int m_nFormatDate;//1- current, 2 - user int m_nFormatDate;//1- current, 2 - user
std::vector<std::wstring> m_oFootersHeaderString; std::vector<std::wstring> m_PlaceholdersReplaceString[3]; //0-dates, 1 - headers, 2 - footers
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
CTheme() : m_arColorScheme(), m_arFonts(), m_arBrushes(), CTheme() : m_arColorScheme(), m_arFonts(), m_arBrushes(),
......
...@@ -541,7 +541,7 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo() ...@@ -541,7 +541,7 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
if (-1 != m_pImageElement->m_lPlaceholderID) if (-1 != m_pImageElement->m_lPlaceholderID)
{ {
CString strIdx; strIdx.Format(_T("%d"), m_pImageElement->m_lPlaceholderID); CString strIdx; strIdx.Format(_T("%d"), m_pImageElement->m_lPlaceholderID );
m_oWriter.WriteString(std::wstring(L" idx=\"") + string2std_string(strIdx) + _T("\"")); m_oWriter.WriteString(std::wstring(L" idx=\"") + string2std_string(strIdx) + _T("\""));
} }
...@@ -610,7 +610,7 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo() ...@@ -610,7 +610,7 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo()
if ( m_pShapeElement->m_lPlaceholderID != -1) if ( m_pShapeElement->m_lPlaceholderID != -1)
{ {
CString strIdx; strIdx.Format(_T("%d"), m_pShapeElement->m_lPlaceholderID); CString strIdx; strIdx.Format(_T("%d"), m_pShapeElement->m_lPlaceholderID );
m_oWriter.WriteString(std::wstring(L" idx=\"") + string2std_string(strIdx) + _T("\"")); m_oWriter.WriteString(std::wstring(L" idx=\"") + string2std_string(strIdx) + _T("\""));
} }
......
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