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

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@61921 954022d7-b5bf-4e40-9824-e11837661b57
parent f49c8a05
......@@ -366,6 +366,12 @@ ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/project.xcworkspace/xcuser
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/xcuserdata svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad/xcschemes svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/RtfFormatLib svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/RtfFormatLib/Win32 svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/RtfFormatLib/source svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/RtfFormatLib/source/Reader svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/RtfFormatLib/source/Writer svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/Win32 svnc_tsvn_003alogminsize=5
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/xls-xlsx.odp svn_mime_002dtype=application%2Foctet-stream
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/xls-xlsx_short.odp svn_mime_002dtype=application%2Foctet-stream
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/Презентация[!!-~]конвертера[!!-~]XLSX.doc svn_mime_002dtype=application%2Foctet-stream
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><TotalTime>1</TotalTime><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><Company>none</Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged></Properties>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title></dc:title><dc:subject></dc:subject><cp:keywords></cp:keywords><dc:description></dc:description><cp:revision>1</cp:revision></cp:coreProperties>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:fonts xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:font w:name="Calibri"><w:panose1 w:val="020F0502020204030204"/><w:charset w:val="CC"/><w:family w:val="swiss"/><w:pitch w:val="variable"/><w:sig w:usb0="A00002EF" w:usb1="4000207B" w:usb2="00000000" w:usb3="00000000" w:csb0="0000009F" w:csb1="00000000"/></w:font><w:font w:name="Times New Roman"><w:panose1 w:val="02020603050405020304"/><w:charset w:val="CC"/><w:family w:val="roman"/><w:pitch w:val="variable"/><w:sig w:usb0="20002A87" w:usb1="80000000" w:usb2="00000008" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/></w:font><w:font w:name="Cambria"><w:panose1 w:val="02040503050406030204"/><w:charset w:val="CC"/><w:family w:val="roman"/><w:pitch w:val="variable"/><w:sig w:usb0="A00002EF" w:usb1="4000004B" w:usb2="00000000" w:usb3="00000000" w:csb0="0000009F" w:csb1="00000000"/></w:font></w:fonts>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:settings xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main"><w:zoom w:val="bestFit" w:percent="151"/><w:defaultTabStop w:val="708"/><w:characterSpacingControl w:val="doNotCompress"/><w:compat/><m:mathPr><m:mathFont m:val="Cambria Math"/><m:brkBin m:val="before"/><m:brkBinSub m:val="--"/><m:smallFrac m:val="off"/><m:dispDef/><m:lMargin m:val="0"/><m:rMargin m:val="0"/><m:defJc m:val="centerGroup"/><m:wrapIndent m:val="1440"/><m:intLim m:val="subSup"/><m:naryLim m:val="undOvr"/></m:mathPr><w:themeFontLang w:val="ru-RU"/><w:clrSchemeMapping w:bg1="light1" w:t1="dark1" w:bg2="light2" w:t2="dark2" w:accent1="accent1" w:accent2="accent2" w:accent3="accent3" w:accent4="accent4" w:accent5="accent5" w:accent6="accent6" w:hyperlink="hyperlink" w:followedHyperlink="followedHyperlink"/><w:shapeDefaults><o:shapedefaults v:ext="edit" spidmax="2050"/><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout></w:shapeDefaults><w:decimalSymbol w:val=","/><w:listSeparator w:val=";"/></w:settings>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="1F497D" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:dk2><a:lt2><a:srgbClr val="EEECE1" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:lt2><a:accent1><a:srgbClr val="4F81BD" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:accent1><a:accent2><a:srgbClr val="C0504D" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:accent2><a:accent3><a:srgbClr val="9BBB59" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:accent3><a:accent4><a:srgbClr val="8064A2" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:accent4><a:accent5><a:srgbClr val="4BACC6" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:accent5><a:accent6><a:srgbClr val="F79646" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:accent6><a:hlink><a:srgbClr val="0000FF" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:hlink><a:folHlink><a:srgbClr val="800080" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Cambria"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Angsana New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/></a:majorFont><a:minorFont><a:latin typeface="Calibri"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS 明朝"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Cordia New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="1"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:shade val="51000"/><a:satMod val="130000"/></a:schemeClr></a:gs><a:gs pos="80000"><a:schemeClr val="phClr"><a:shade val="93000"/><a:satMod val="130000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="94000"/><a:satMod val="135000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"><a:alpha val="38000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="" xmlns:a14="http://schemas.microsoft.com/office/drawing/2007/7/7/main"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst><a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d><a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/></a:theme>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:webSettings xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:optimizeForBrowser/></w:webSettings>
\ No newline at end of file
This diff is collapsed.
#pragma once
#include <vector>
#include "IdGenerator.h"
#include "RtfDefine.h"
#include <boost/shared_ptr.hpp>
typedef enum{ mu_none, mu_Auto, mu_Percent, mu_Twips } MetricUnits;
class RenderParameter
{
public:
void* poWriter;
void* poDocument;
void* poRels;
int nType;
int nValue;
CString sValue;
int RtfType;
RenderParameter()
{
poWriter = NULL;
poDocument = NULL;
poRels = NULL;
nType = RENDER_TO_OOX_PARAM_UNKNOWN;
nValue = PROP_DEF;
RtfType = RTF_MAX;
}
};
class IDocumentElement
{
public:
virtual int GetType()
{
return TYPE_UNKNOWN;
}
virtual bool IsValid()
{
return true;
}
virtual CString RenderToRtf(RenderParameter oRenderParameter) = 0;
virtual CString RenderToOOX(RenderParameter oRenderParameter) = 0;
};
class IRenderableProperty: public IDocumentElement
{
public:
virtual void SetDefault() = 0;
virtual void SetDefaultRtf() {}
virtual void SetDefaultOOX() {}
};
template<class T> class ItemContainer
{
protected:
std::vector<T> m_aArray;
public:
ItemContainer( )
{
}
ItemContainer( const ItemContainer& oItemContainer )
{
m_aArray.clear();
m_aArray = oItemContainer.m_aArray;
}
const ItemContainer& operator=( const ItemContainer& oItemContainer )
{
m_aArray.clear();
m_aArray = oItemContainer.m_aArray;
return (*this);
}
T& operator[]( int nIndex )
{
return m_aArray[nIndex];
}
int AddItem( T piRend)
{
m_aArray.push_back(piRend);
return (int)m_aArray.size() - 1;
}
int Find( T piRend )
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
if( m_aArray[i] == piRend )
return i;
return -1;
}
void RemoveItem( T piRend )
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
if( m_aArray[i] == piRend )
{
m_aArray.erase(m_aArray.begin()+i);
}
}
void RemoveItem( int nIndex = -1 )
{
if( nIndex >= 0 && nIndex < (int)m_aArray.size() )
m_aArray.erase(m_aArray.begin() + nIndex );
else if( -1 == nIndex && 0 < (int)m_aArray.size() )
m_aArray.pop_back();
}
void RemoveAll()
{
m_aArray.clear();
}
bool GetItem(T& oOutput,int nIndex = -1)
{
if( -1 == nIndex && (int)m_aArray.size() > 0 )
{
oOutput = m_aArray[m_aArray.size() - 1];
return true;
}
if( nIndex >= 0 && nIndex < (int)m_aArray.size())
{
oOutput = m_aArray[nIndex];
return true;
}
return false;
}
void InsertItem(T& oOutput,int nIndex = -1)
{
if( -1 == nIndex )
{
AddItem( oOutput );
}
if( nIndex >= 0 && nIndex <= (int)m_aArray.size())
{
m_aArray.insert(m_aArray.begin() + nIndex, oOutput);
}
}
void SetItem(T& oOutput,int nIndex = -1)
{
if( -1 == nIndex )
{
AddItem( oOutput );
}
if( nIndex >= 0 && nIndex < (int)m_aArray.size())
{
m_aArray[ nIndex ] = oOutput;
}
}
int GetCount()
{
return (int)m_aArray.size();
}
};
template<class T> class ItemSingleContainer: public ItemContainer<T>
{
public:
int AddItem( T piRend)
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
if( m_aArray[i] == piRend )
return i;
m_aArray.push_back(piRend);
return (int)m_aArray.size() - 1;
}
};
template<class T> class ItemWithLastContainer: public ItemContainer<T>
{
public:
void RemoveItem( T piRend )
{
if( (int)m_aArray.size() > 1 )
{
ItemContainer::RemoveItem( piRend );
}
}
void RemoveItem( int nIndex = -1 )
{
if( (int)m_aArray.size() > 1 )
{
ItemContainer::RemoveItem( nIndex );
}
}
};
class ITextItem : public IDocumentElement
{
};
typedef boost::shared_ptr<ITextItem> ITextItemPtr;
class ITextItemContainer : public IDocumentElement, public ItemContainer< ITextItemPtr >
{
};
typedef boost::shared_ptr<IDocumentElement> IDocumentElementPtr;
typedef boost::shared_ptr<ITextItemContainer> ITextItemContainerPtr;
class TextItemContainer : public ITextItemContainer
{
public:
CString RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sResult.Append( m_aArray[i]->RenderToRtf( oRenderParameter ) );
if( TYPE_RTF_PARAGRAPH == m_aArray[i]->GetType() && i != (int)m_aArray.size() - 1)
{
sResult += _T("\\par") ;
}
}
return sResult;
}
CString RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult;
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult += m_aArray[i]->RenderToOOX(oRenderParameter);
return sResult;
}
bool IsValid()
{
return m_aArray.size() > 0;
}
};
typedef boost::shared_ptr<TextItemContainer> TextItemContainerPtr;
#pragma once
#include "RtfReader.h"
#include "RtfDocument.h"
#include "RtfWriter.h"
#include "Writer/OOXWriter.h"
#include "Reader/OOXReader.h"
const double g_cdMaxReadRtfPercent = 0.70;
const double g_cdMaxWriteRtfPercent = 0.30;
const double g_cdMaxReadOoxPercent = 0.70;
const double g_cdMaxWriteOoxPercent = 0.30;
//#define MEMORY_SAFE_CONVERTATION
class ConvertationManager
{
public:
CString m_sTempFolder;
ConvertationManager( )
{
}
HRESULT ConvertRtfToOOX( CString sSrcFileName, CString sDstPath, CString sXMLOptions )
{
m_bParseFirstItem = true;
RtfDocument oDocument;
oDocument.m_oProperty.SetDefaultRtf();
RtfReader oReader( oDocument, sSrcFileName );
OOXWriter oWriter( oDocument, sDstPath );
oReader.m_sTempFolder = sDstPath;
oWriter.m_sTempFolder = sDstPath;
m_poRtfReader = &oReader;
m_poOOXWriter = &oWriter;
bool succes = oReader.Load( );
//ATLASSERT( true == succes );
#ifdef MEMORY_SAFE_CONVERTATION
// OnCompleteItemRtfReader
//
if( true == m_bParseFirstItem )
{
m_bParseFirstItem = false;
oWriter.SaveByItemStart( );
}
m_poOOXWriter->SaveByItem();
oWriter.SaveByItemEnd( );
#else
if( true == succes)
{
succes = oWriter.Save( );
//ATLASSERT( true == succes );
}
#endif
if( true == succes )
return S_OK;
else
return S_FALSE;
}
HRESULT ConvertOOXToRtf( CString sDstFileName, CString sSrcPath, CString sXMLOptions )
{
m_bParseFirstItem = true;
RtfDocument oDocument;
oDocument.m_oProperty.SetDefaultOOX();
OOXReader oReader( oDocument, sSrcPath );
RtfWriter oWriter( oDocument, sDstFileName, sSrcPath );
oReader.m_sTempFolder = m_sTempFolder;
oWriter.m_sTempFolder = m_sTempFolder;
m_poOOXReader = &oReader;
m_poRtfWriter = &oWriter;
bool succes = oReader.Parse( );
//ATLASSERT( true == succes );
#ifdef MEMORY_SAFE_CONVERTATION
// OnCompleteItemRtfReader
//
if( true == m_bParseFirstItem )
{
m_bParseFirstItem = false;
oWriter.SaveByItemStart( );
}
oWriter.SaveByItemEnd( );
#else
if( true == succes && true)
{
succes = oWriter.Save( );
//ATLASSERT( true == succes );
//succes = oWriter.Save( oDocument, CString("d:\\testOOX") );
////ATLASSERT( true == succes );
}
#endif
return S_OK;
}
private:
OOXWriter* m_poOOXWriter;
OOXReader* m_poOOXReader;
RtfWriter* m_poRtfWriter;
RtfReader* m_poRtfReader;
bool m_bParseFirstItem;
};
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
#pragma once
#include <map>
#ifdef _WIN32
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
class IdGenerator
{
private:
int m_nOleId;
int m_nPnListId;
int m_nShapeId;
int m_nImageProp;
int m_nEndnoteNumber;
int m_nrIdCount;
int m_nFitTextIdCount;
int m_nImageIndex;
int m_nOleIndex;
int m_nHeaderNumber;
int m_nFootnoteNumber;
int m_nFooterNumber;
int m_nBookmarkNumber;
public:
IdGenerator()
{
m_nrIdCount = 1;
m_nFitTextIdCount = 1;
m_nImageIndex = 1;
m_nOleIndex = 1;
m_nHeaderNumber = 1;
m_nFooterNumber = 1;
m_nBookmarkNumber = 1;
m_nFootnoteNumber = 2;
m_nEndnoteNumber = 2;
m_nImageProp = 1;
m_nShapeId = 1;
m_nOleId = 1;
m_nPnListId = 1;
}
CString Generate_rId()
{
CString sResult;
sResult.AppendFormat( _T("rId%d"), m_nrIdCount++ );
return sResult;
}
CString Generate_FitTextId()
{
CString sResult;
sResult.AppendFormat( _T("%d"), m_nFitTextIdCount++ );
return sResult;
}
int Generate_ImageIndex()
{
return m_nImageIndex++;
}
int Generate_OleIndex()
{
return m_nOleIndex++;
}
int Generate_HeaderNumber()
{
return m_nHeaderNumber++;
}
int Generate_FooterNumber()
{
return m_nFooterNumber++;
}
int Generate_BookmarkNumber()
{
return m_nBookmarkNumber++;
}
int Generate_FootnoteNumber()
{
return m_nFootnoteNumber++;
}
int Generate_EndnoteNumber()
{
return m_nEndnoteNumber++;
}
int Generate_ImagePropId()
{
return m_nImageProp++;
}
int Generate_ShapeId()
{
return m_nShapeId++;
}
CString Generate_OleId()
{
CString sId;
sId.AppendFormat( _T("%d"), m_nOleId++ );
CString sResult = _T("_1330071130");
sResult = sResult.Left( sResult.GetLength() - sId.GetLength() );
sResult.Append( sId );
return sResult;
}
int Generate_PnId()
{
return m_nPnListId++;
}
};
class OOXIdGenerator
{
private:
std::map<CString, long> m_mapId;
int m_nCounter;
public:
OOXIdGenerator()
{
m_nCounter = 1;
}
int GetId( CString sKey )
{
std::map<CString, long>::iterator pPair = m_mapId.find( sKey );
if( m_mapId.end() == pPair )
{
int nResult = m_nCounter;
m_mapId[sKey] = nResult;
m_nCounter++;
return nResult;
}
else
return pPair->second;
}
};
\ No newline at end of file
#pragma once
#include "../RtfProperty.h"
struct OOXColorTableItem
{
ThemeColor oTheme;
RtfColor oColor;
}
class OOXColorTable
{
private:
std::vector<OOXColorTableItem> m_aTable;
public:
OOXColorTable()
{
}
void AddItem( RtfColor& oColor,ThemeColor& oTheme )
{
OOXColorTableItem oItem;
oItem.oColor = oColor;
oItem.oTheme = oTheme;
m_aTable.push_back( oItem );
}
bool GetItem( int nIndex, RtfColor& oOutput )
{
if( nIndex >= 0 && nIndex< m_aTable.size())
{
oOutput = m_aTable[i].oColor;
retrun true;
}
return false;
}
bool GetItem( ThemeColor eTheme, RtfColor& oOutput )
{
for( int i = 0 ; i < m_aTable.size(); i++ )
if( m_aTable[i].oTheme == eTheme )
{
oOutput = m_aTable[i].oColor;
return true;
}
return false;
}
bool GetItem( CString sTheme, RtfColor& oOutput )
{
ThemeColor oThemeColor;
if( true == RtfColor.GetThemeByString("",oThemeColor) )
{
return GetItem(sTheme,oOutput);
}
return false;
}
int GetCount()
{
return m_aTable.size();
}
};
#pragma once
#include "OOXLevelReader.h"
class OOXAbstractNumReader
{
private:
OOX::Numbering::CAbstractNum *m_ooxAbstractNum;
public:
OOXAbstractNumReader(OOX::Numbering::CAbstractNum *ooxAbstractNum)
{
m_ooxAbstractNum = ooxAbstractNum;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxAbstractNum == NULL) return false;
RtfListProperty oNewList;
if (m_ooxAbstractNum->m_oAbstractNumId.IsInit())
oNewList.m_nID = m_ooxAbstractNum->m_oAbstractNumId->GetValue();
if (m_ooxAbstractNum->m_oMultiLevelType.IsInit())
{
switch(m_ooxAbstractNum->m_oMultiLevelType->m_oVal->GetValue())
{
case SimpleTypes::emultileveltypeHybridMultilevel : oNewList.m_bListHybrid = 1; break;
case SimpleTypes::emultileveltypeSingleLevel : oNewList.m_nListSimple = 1; break;
case SimpleTypes::emultileveltypeMultilevel :
default : break;
}
}
if (m_ooxAbstractNum->m_oName.IsInit())
oNewList.m_sName = m_ooxAbstractNum->m_oName->m_sVal.get2();
if (m_ooxAbstractNum->m_oTmpl.IsInit() && m_ooxAbstractNum->m_oTmpl->m_oVal.IsInit())
oNewList.m_nTemplateId = m_ooxAbstractNum->m_oTmpl->m_oVal->GetValue();
for (long i=0 ; i < m_ooxAbstractNum->m_arrLvl.size(); i++)
{
OOXLevelReader oLevelReader(m_ooxAbstractNum->m_arrLvl[i]);
RtfListLevelProperty oNewLevel;
if( true == oLevelReader.Parse( oParam, oNewLevel) )
oNewList.AddItem( oNewLevel );
}
oParam.oRtf->m_oListTabel.AddItem( oNewList );
return true;
}
};
\ No newline at end of file
#pragma once
#include "../RtfDocument.h"
#include "OOXReader.h"
class OOXAppReader
{
private:
OOX::CApp *m_ooxApp;
public:
OOXAppReader(OOX::CApp *ooxApp)
{
m_ooxApp = ooxApp;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxApp == NULL) return false;
if(m_ooxApp->m_nTotalTime.IsInit())
{
oParam.oRtf->m_oInformation.m_nEndingTime = m_ooxApp->m_nTotalTime.get2();
}
if(m_ooxApp->m_nPages.IsInit())
{
oParam.oRtf->m_oInformation.m_nNumberOfPages = m_ooxApp->m_nPages.get2();
}
if(m_ooxApp->m_nWords.IsInit())
{
oParam.oRtf->m_oInformation.m_nNumberOfWords = m_ooxApp->m_nWords.get2();
}
if(m_ooxApp->m_nCharacters.IsInit())
{
oParam.oRtf->m_oInformation.m_nNumberOfCharactersWithoutSpace = m_ooxApp->m_nCharacters.get2();
}
if(m_ooxApp->m_nCharactersWithSpaces.IsInit())
{
oParam.oRtf->m_oInformation.m_nNumberOfCharactersWithSpace = m_ooxApp->m_nCharactersWithSpaces.get2();
}
if(m_ooxApp->m_sAppVersion.IsInit())
{
oParam.oRtf->m_oInformation.m_nVersion= Strings::ToInteger( m_ooxApp->m_sAppVersion.get2() );
}
return true;
}
};
This diff is collapsed.
#pragma once
#include "../RtfProperty.h"
#include "OOXReader.h"
#include "OOXReaderBasic.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Drawing/DrawingStyles.h"
class OOXColorReader
{
public:
OOXColorReader()
{
}
bool Parse( ReaderParameter oParam, OOX::Drawing::CStyleColor & ooxColor, RtfColor & oOutputColor )
{
if (ooxColor.getType() == OOX::Drawing::colorHsl)
{
double dHue, dSat, dLum;
ooxColor.m_oHslClr.GetHSL(dHue,dSat,dLum);
oOutputColor.SetHSL( dHue, dSat, dLum );
return true;
}
else if(ooxColor.getType() == OOX::Drawing::colorPrst)
{
oOutputColor = RtfColor(ooxColor.m_oPrstClr.m_oVal.Get_R(), ooxColor.m_oPrstClr.m_oVal.Get_G(), ooxColor.m_oPrstClr.m_oVal.Get_B());
return true;
}
else if(ooxColor.getType() == OOX::Drawing::colorSheme)
{
RtfColor::ThemeColor oTheme;
if( true == RtfColor::GetThemeByOOX( ooxColor.m_oShemeClr.m_oVal.GetValue(), oTheme ))
return oParam.oRtf->m_oColorTable.GetColor( oTheme, oOutputColor );
return false;
}
else if( ooxColor.getType() == OOX::Drawing::colorSRgb)
{
oOutputColor = RtfColor(ooxColor.m_oSrgbClr.m_oVal.Get_R(), ooxColor.m_oSrgbClr.m_oVal.Get_G(), ooxColor.m_oSrgbClr.m_oVal.Get_B());
return true;
}
else if( ooxColor.getType() == OOX::Drawing::colorScRgb)
{
unsigned char r, g, b, a;
ooxColor.m_oScrgbClr.GetRGBA( r, g, b, a);
oOutputColor = RtfColor(r, g, b);
return true;
}
else if( ooxColor.getType() == OOX::Drawing::colorSys)
{
//if (ooxColor.m_oSysClr.m_oLastClr)
//{
//}
unsigned char r, g, b, a;
ooxColor.m_oSysClr.GetRGBA( r, g, b, a);
oOutputColor = RtfColor(r, g, b);
return true;
}
return false;
}
bool Parse (ReaderParameter oParam, ComplexTypes::Word::CColor ooxColor, RtfColor & oOutputColor)
{
if (ooxColor.m_oThemeColor.IsInit())
{
oParam.oRtf->m_oColorTable.GetColor( ooxColor.m_oThemeColor->GetValue() , oOutputColor );
}
if (ooxColor.m_oThemeShade.IsInit())
{
oOutputColor.SetShade( ooxColor.m_oThemeShade->GetValue() );
}
if (ooxColor.m_oThemeTint.IsInit())
{
oOutputColor.SetTint( ooxColor.m_oThemeTint->GetValue() );
}
if (ooxColor.m_oVal.IsInit())
{
oOutputColor.SetRGB(ooxColor.m_oVal->Get_R(), ooxColor.m_oVal->Get_G(), ooxColor.m_oVal->Get_B());
}
return true;
}
};
#pragma once
#include "RtfDocument.h"
#include "RtfProperty.h"
class OOXColorReader2
{
public:
OOXColorReader2( )
{
}
bool Parse( ReaderParameter oParam, RtfColor& oOutputColor,CString sColor, CString sTheme,CString sThemeShade, CString sThemeTint )
{
//XmlUtils::CXmlLiteReader oXmlReader;
//if( TRUE == oXmlReader.OpenFromXmlNode( oParam.oNode ) )
//{
// CString sThemeColor = oXmlReader.ReadNodeAttribute(sTheme, _T("") );
// CString themeShade = oXmlReader.ReadNodeAttribute(sThemeShade, _T("0") );
// CString themeTint = oXmlReader.ReadNodeAttribute(sThemeTint, _T("255") );
// CString val = oXmlReader.ReadNodeAttribute(sColor, _T("") );
// if( _T("") != sThemeColor )
// {
// //Todo tx1 - text1
// RtfColor::ThemeColor oTheme = RtfColor::TC_NONE;
// if( sThemeColor == _T("accent1") )
// oTheme = RtfColor::caccentone;
// else if( sThemeColor == _T("accent2") )
// oTheme = RtfColor::caccenttwo;
// else if( sThemeColor == _T("accent3") )
// oTheme = RtfColor::caccentthree;
// else if( sThemeColor == _T("accent4") )
// oTheme = RtfColor::caccentfour;
// else if( sThemeColor == _T("accent5") )
// oTheme = RtfColor::caccentfive;
// else if( sThemeColor == _T("accent6") )
// oTheme = RtfColor::caccentsix;
// else if( sThemeColor == _T("bg1") )
// oTheme = RtfColor::cbackgroundone;
// else if( sThemeColor == _T("bg2") )
// oTheme = RtfColor::cbackgroundtwo;
// else if( sThemeColor == _T("dk1") )
// oTheme = RtfColor::cmaindarkone;
// else if( sThemeColor == _T("dk2") )
// oTheme = RtfColor::cmaindarktwo;
// else if( sThemeColor == _T("folHlink") )
// oTheme = RtfColor::cfollowedhyperlink;
// else if( sThemeColor == _T("hlink") )
// oTheme = RtfColor::chyperlink;
// else if( sThemeColor == _T("lt1") )
// oTheme = RtfColor::cmainlightone;
// else if( sThemeColor == _T("lt2") )
// oTheme = RtfColor::cmainlighttwo;
// else if( sThemeColor == _T("phClr") )
// oTheme = RtfColor::cmainlighttwo;
// else if( sThemeColor == _T("tx1") )
// oTheme = RtfColor::ctextone;
// else if( sThemeColor = _T("tx2") )
// oTheme = RtfColor::ctexttwo;
// if( true == oParam.oRtf->m_oColorTable.GetColor( oTheme , oOutputColor ) )
// {
// // themeColor
// int nShade = Strings::ToInteger( themeShade );
// if( nShade < 0 )
// nShade = 0;
// if( nShade > 255 )
// nShade = 255;
// int nTint = Strings::ToInteger( themeTint );
// if( nTint < 0 )
// nTint = 0;
// if( nTint > 255 )
// nTint = 255;
// oOutputColor.SetTint( nTint );
// oOutputColor.SetShade( nShade );
// return true;
// }
// else if( false == val.IsEmpty() )
// {
// oOutputColor.SetHEXString( val );
// return true;
// }
// else
// return false;
// }
// else if( _T("auto") != val )
// {
// oOutputColor.SetHEXString( val );
// return true;
// }
// else
// return false;
//}
return false;
}
};
#pragma once
#include "OOXColorReader.h"
#include "../RtfProperty.h"
class OOXColorSchemeReader
{
private:
OOX::Drawing::CColorScheme * m_ooxColorScheme;
public:
OOXColorSchemeReader(OOX::Drawing::CColorScheme * ooxColorScheme)
{
m_ooxColorScheme = ooxColorScheme;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxColorScheme == NULL) return false;
RtfColor oNewColor;
OOXColorReader oColorReader;
oColorReader.Parse( oParam, m_ooxColorScheme->m_oAccent1, oNewColor);
oNewColor.m_eTheme = RtfColor::caccentone;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oAccent2, oNewColor);
oNewColor.m_eTheme = RtfColor::caccenttwo;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oAccent3, oNewColor);
oNewColor.m_eTheme = RtfColor::caccentthree;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oAccent4, oNewColor);
oNewColor.m_eTheme = RtfColor::caccentfour;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oAccent5, oNewColor);
oNewColor.m_eTheme = RtfColor::caccentfive;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oAccent6, oNewColor);
oNewColor.m_eTheme = RtfColor::caccentsix;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oDk1, oNewColor);
oNewColor.m_eTheme = RtfColor::cmaindarkone;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oDk2, oNewColor);
oNewColor.m_eTheme = RtfColor::cmaindarktwo;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oLt1, oNewColor);
oNewColor.m_eTheme = RtfColor::cmainlightone;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oLt2, oNewColor);
oNewColor.m_eTheme = RtfColor::cmainlighttwo;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oHlink, oNewColor);
oNewColor.m_eTheme = RtfColor::chyperlink;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
oColorReader.Parse( oParam, m_ooxColorScheme->m_oFolHlink, oNewColor);
oNewColor.m_eTheme = RtfColor::cfollowedhyperlink;
oParam.oRtf->m_oColorTable.AddItem( oNewColor );
//else if( _T("a:bg1") == sNodeName )
// oNewColor.m_eTheme = RtfColor::cbackgroundone;
//else if( _T("a:bg2") == sNodeName )
// oNewColor.m_eTheme = RtfColor::cbackgroundtwo;
//else if( _T("a:phClr") == sNodeName )
// oNewColor.m_eTheme = RtfColor::cmainlighttwo;
//else if( _T("a:tx1") == sNodeName )
// oNewColor.m_eTheme = RtfColor::ctextone;
//else if( _T("a:tx2") == sNodeName )
// oNewColor.m_eTheme = RtfColor::ctexttwo;
return true;
}
};
\ No newline at end of file
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
class OOXContentTypeReader
{
private: CString m_sFilepath;
private: XmlUtils::CXmlLiteReader m_oReader;
public: OOXContentTypeReader(CString sFilePath)
{
m_sFilepath = sFilePath;
m_oReader.OpenFromFile(m_sFilepath);
m_oReader.ReadRootNode("Relationships");
m_oReader.ReadNodeList("Relationship");
}
public: bool GetByType(CString sType, std::vector<CString>& aOutArray)
{
aOutArray.clear();
for(int i=0;i<oParam.oReader->GetLengthList();i++)
{
if(oParam.oReader->ReadNodeAttribute(i,"Type") == sType)
{
CString sResult = oParam.oReader->ReadNodeAttribute(i,"Target");
sResult = sResult.Replace('/','\\');
aOutArray.Append( sResult );
}
}
return aOutArray.size() > 0;
}
public: CString GetByID(CString sId)
{
for(int i=0;i<oParam.oReader->GetLengthList();i++)
{
if(oParam.oReader->ReadNodeAttribute(i,"Id") == sId)
{
CString sResult = oParam.oReader->ReadNodeAttribute(i,"Target");
sResult = sResult.Replace('/','\\');
return sResult;
}
}
return "";
}
};
\ No newline at end of file
#pragma once
#include "../RtfDocument.h"
#include "OOXReader.h"
class OOXCoreReader
{
private:
OOX::CCore * m_ooxCore;
public:
OOXCoreReader(OOX::CCore * ooxCore)
{
m_ooxCore = ooxCore;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxCore == NULL) return false;
if (m_ooxCore->m_sTitle.IsInit())
{
oParam.oRtf->m_oInformation.m_sTitle = m_ooxCore->m_sTitle.get2();
}
if (m_ooxCore->m_sSubject.IsInit())
{
oParam.oRtf->m_oInformation.m_sSubject = m_ooxCore->m_sSubject.get2();
}
if (m_ooxCore->m_sCreator.IsInit())
{
oParam.oRtf->m_oInformation.m_sAuthor = m_ooxCore->m_sCreator.get2();
}
if (m_ooxCore->m_sDescription.IsInit())
{
oParam.oRtf->m_oInformation.m_sComment = m_ooxCore->m_sDescription.get2();
}
if (m_ooxCore->m_sKeywords.IsInit())
{
oParam.oRtf->m_oInformation.m_sKeywords = m_ooxCore->m_sKeywords.get2();
}
return true;
}
};
#pragma once
#include "OOXrPrReader.h"
#include "OOXpPrReader.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Styles.h"
class OOXDocDefaultsReader
{
private:
OOX::CDocDefaults* m_ooxDefaults;
public:
OOXDocDefaultsReader(OOX::CDocDefaults* ooxDefaults)
{
m_ooxDefaults = ooxDefaults;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxDefaults == NULL) return false;
if (m_ooxDefaults->m_oRunPr.IsInit())
{
RtfCharProperty oNewProperty;
oNewProperty.SetDefaultOOX();
OOXrPrReader orPrReader(m_ooxDefaults->m_oRunPr.GetPointer());
orPrReader.m_bDefStyle = false;
if( true == orPrReader.Parse( oParam, oNewProperty ) )
oParam.oRtf->m_oDefaultCharProp = oNewProperty;
}
if (m_ooxDefaults->m_oParPr.IsInit())
{
RtfParagraphProperty oNewProperty;
OOXpPrReader opPrReader(m_ooxDefaults->m_oParPr.GetPointer());
opPrReader.m_bDefStyle = false;
bool bStartNewSectoion;
if( true == opPrReader.Parse( oParam, oNewProperty, CcnfStyle(), bStartNewSectoion ) )
oParam.oRtf->m_oDefaultParagraphProp = oNewProperty;
}
return true;
}
};
#pragma once
#include "OOXTextItemReader.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Document.h"
class OOXDocumentReader
{
private:
OOXTextItemReader m_oTextItemReader;
OOXReader * m_poReader;
RtfDocument * m_poDocument;
OOX::CDocument* m_ooxDocument;
public:
OOXDocumentReader(OOX::CDocument* ooxDocument)
{
m_ooxDocument = ooxDocument;
}
~OOXDocumentReader()
{
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxDocument == NULL) return false;
m_poReader = oParam.oReader;
m_poDocument = oParam.oRtf;
RtfSectionPtr oCurSection;
if( true == oParam.oRtf->GetItem( oCurSection ) )
{
oCurSection->m_oProperty.SetDefaultOOX();
// ..
for (long i = 0; i < m_ooxDocument->m_arrItems.size(); i++)
{
if (m_ooxDocument->m_arrItems[i] == NULL) continue;
if (m_ooxDocument->m_arrItems[i]->getType() == OOX::et_w_p)
{
OOX::Logic::CParagraph * para = dynamic_cast<OOX::Logic::CParagraph *>(m_ooxDocument->m_arrItems[i]);
if ((para) && (para->m_oParagraphProperty))
{
if (para->m_oParagraphProperty->m_oSectPr.IsInit())
{
OOXSectionPropertyReader oSectReader(para->m_oParagraphProperty->m_oSectPr.GetPointer());
if( true == oSectReader.Parse( oParam, oCurSection->m_oProperty ) )
{
//
oCurSection = RtfSectionPtr( new RtfSection() );
oCurSection->m_oProperty.SetDefaultOOX();
oParam.oRtf->AddItem( oCurSection );
}
}
}
}
}
if (m_ooxDocument->m_oSectPr.IsInit())//
{
OOXSectionPropertyReader oSectReader(m_ooxDocument->m_oSectPr.GetPointer());
oSectReader.Parse( oParam, oCurSection->m_oProperty );
}
RtfSectionPtr oFirstSection;
if( true == m_poDocument->GetItem( oFirstSection, 0 ) )
{
m_oTextItemReader.m_oTextItems = oFirstSection;
for (long i = 0; i < m_ooxDocument->m_arrItems.size(); i++)
{
m_oTextItemReader.Parse(m_ooxDocument->m_arrItems[i], oParam );
}
}
}
return true;
}
};
\ No newline at end of file
#pragma once
#include "OOXReader.h"
#include "OOXReaderBasic.h"
#include "../RtfDocument.h"
class OOXFontReader
{
private:
OOX::CFont* m_ooxFont;
public:
OOXFontReader(OOX::CFont* ooxFont)
{
m_ooxFont = ooxFont;
}
bool Parse( ReaderParameter oParam, RtfFont& oOutputFont)
{
if (!m_ooxFont) return false;
CString sFontName = m_ooxFont->m_sName;
if( sFontName.GetLength() < 1 ) return false;
oOutputFont.m_sName = sFontName;
oOutputFont.m_nID = oParam.oRtf->m_oFontTable.GetCount() + 1;
if( m_ooxFont->m_oAltName.IsInit() )
oOutputFont.m_sAltName = m_ooxFont->m_oAltName.get2();
else if(m_ooxFont->m_oPanose.IsInit() )
oOutputFont.m_sPanose = m_ooxFont->m_oPanose->ToString();
else if( m_ooxFont->m_oFamily.IsInit() )
{
switch(m_ooxFont->m_oFamily->GetValue())
{
case SimpleTypes::fontfamilyDecorative : oOutputFont.m_eFontFamily = RtfFont::ff_fdecor; break;
case SimpleTypes::fontfamilyModern : oOutputFont.m_eFontFamily = RtfFont::ff_fmodern; break;
case SimpleTypes::fontfamilyRoman : oOutputFont.m_eFontFamily = RtfFont::ff_froman; break;
case SimpleTypes::fontfamilyScript : oOutputFont.m_eFontFamily = RtfFont::ff_fscript; break;
case SimpleTypes::fontfamilySwiss : oOutputFont.m_eFontFamily = RtfFont::ff_fswiss; break;
case SimpleTypes::fontfamilyAuto :
default : oOutputFont.m_eFontFamily =RtfFont::ff_fnil; break;
}
}
else if( m_ooxFont->m_oPitch.IsInit())
{
switch(m_ooxFont->m_oPitch->GetValue())
{
case SimpleTypes::pitchFixed : oOutputFont.m_nPitch = 1; break;
case SimpleTypes::pitchVariable : oOutputFont.m_nPitch = 2; break;
case SimpleTypes::pitchDefault :
default : oOutputFont.m_nPitch = 0; break;
}
}
else if( m_ooxFont->m_oCharset.IsInit() )
{
oOutputFont.m_nCharset = m_ooxFont->m_oCharset->GetValue();
}
return true;
}
};
class OOXFontReader2
{
private:
ComplexTypes::Word::CFonts * m_ooxFont;
public:
OOXFontReader2(ComplexTypes::Word::CFonts * ooxFont)
{
m_ooxFont = ooxFont;
}
bool Parse( ReaderParameter oParam, int& nFont)
{
if (!m_ooxFont) return false;
CString sAscii, sAsciiTheme, sCs, sCsTheme, sEastAsia, sEastAsiaTheme, sHAnsi, sHAnsiTheme;
if (m_ooxFont->m_sAscii.IsInit()) sAscii = m_ooxFont->m_sAscii.get2();
if (m_ooxFont->m_oAsciiTheme.IsInit()) sAsciiTheme = m_ooxFont->m_oAsciiTheme->ToString();
if (m_ooxFont->m_sCs.IsInit()) sCs = m_ooxFont->m_sCs.get2();
if (m_ooxFont->m_oCsTheme.IsInit()) sCsTheme = m_ooxFont->m_oCsTheme->ToString();
if (m_ooxFont->m_sEastAsia.IsInit()) sEastAsia = m_ooxFont->m_sEastAsia.get2();
if (m_ooxFont->m_oEastAsiaTheme.IsInit()) sEastAsiaTheme = m_ooxFont->m_oEastAsiaTheme->ToString();
if (m_ooxFont->m_sHAnsi.IsInit()) sHAnsi = m_ooxFont->m_sHAnsi.get2();
if (m_ooxFont->m_oHAnsiTheme.IsInit()) sHAnsiTheme = m_ooxFont->m_oHAnsiTheme->ToString();
CString sFont;
CString sTempFont;
if( _T("") != sAscii )
sFont = sAscii;
else if( _T("") != sAsciiTheme && _T("") != GetThemeFont(sAsciiTheme, *oParam.oReader) )
sFont = GetThemeFont(sAsciiTheme, *oParam.oReader);
else if( _T("") != sHAnsi )
sFont = sHAnsi;
else if( _T("") != sHAnsiTheme && _T("") != GetThemeFont(sHAnsiTheme, *oParam.oReader) )
sFont = GetThemeFont(sHAnsiTheme, *oParam.oReader);
else if( _T("") != sCs )
sFont = sCs;
else if( _T("") != sCsTheme && _T("") != GetThemeFont(sCsTheme, *oParam.oReader) )
sFont = GetThemeFont(sCsTheme, *oParam.oReader);
else if( _T("") != sEastAsia )
sFont = sEastAsia;
else if( _T("") != sEastAsiaTheme && _T("") != GetThemeFont(sEastAsiaTheme, *oParam.oReader) )
sFont = GetThemeFont(sEastAsiaTheme, *oParam.oReader);
if( _T("") != sFont )
{
RtfFont oCurFont;
if( true == oParam.oRtf->m_oFontTable.GetFont( sFont, oCurFont ) )
nFont = oCurFont.m_nID;
else
{
oCurFont.m_sName = sFont;
nFont = oParam.oRtf->m_oFontTable.GetCount() + 1;
oCurFont.m_nID = nFont;
oParam.oRtf->m_oFontTable.AddItem( oCurFont );
}
}
return true;
}
private:
CString GetThemeFont( CString sTheme, OOXReader & oReader )
{
CString sFont;
if( _T("majorAscii") == sTheme )
sFont = oReader.m_smajorAscii;
else if( _T("majorBidi") == sTheme )
sFont = oReader.m_smajorBidi;
else if( _T("majorEastAsia") == sTheme )
sFont = oReader.m_smajorEastAsia;
else if( _T("majorHAnsi") == sTheme )
sFont = oReader.m_smajorHAnsi;
else if( _T("minorAscii") == sTheme )
sFont = oReader.m_sminorAscii;
else if( _T("minorBidi") == sTheme )
sFont = oReader.m_sminorBidi;
else if( _T("minorEastAsia") == sTheme )
sFont = oReader.m_sminorEastAsia;
else if( _T("minorHAnsi") == sTheme )
sFont = oReader.m_sminorHAnsi;
return sFont;
}
};
#pragma once
#include "OOXFontReader.h"
#include "../RtfProperty.h"
class OOXFontSchemeReader
{
private:
OOX::Drawing::CFontScheme * m_ooxFontScheme;
public:
OOXFontSchemeReader(OOX::Drawing::CFontScheme * ooxFontScheme)
{
m_ooxFontScheme = ooxFontScheme;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxFontScheme == NULL) return false;
if (m_ooxFontScheme->m_oMajorFont.m_oLatin.m_oTypeFace.IsInit())
{
oParam.oReader->m_smajorAscii = m_ooxFontScheme->m_oMajorFont.m_oLatin.m_oTypeFace->GetValue();
oParam.oReader->m_smajorHAnsi = m_ooxFontScheme->m_oMajorFont.m_oLatin.m_oTypeFace->GetValue();
}
if (m_ooxFontScheme->m_oMajorFont.m_oEa.m_oTypeFace.IsInit())
{
oParam.oReader->m_smajorEastAsia = m_ooxFontScheme->m_oMajorFont.m_oEa.m_oTypeFace->GetValue();
}
if (m_ooxFontScheme->m_oMajorFont.m_oCs.m_oTypeFace.IsInit())
{
oParam.oReader->m_smajorBidi = m_ooxFontScheme->m_oMajorFont.m_oCs.m_oTypeFace->GetValue();
}
//for (long i=0 ; i < m_ooxFontScheme->m_oMajorFont.m_arrFont.size(); i++)
//{
//}
if (m_ooxFontScheme->m_oMinorFont.m_oLatin.m_oTypeFace.IsInit())
{
oParam.oReader->m_sminorAscii = m_ooxFontScheme->m_oMinorFont.m_oLatin.m_oTypeFace->GetValue();
oParam.oReader->m_sminorHAnsi = m_ooxFontScheme->m_oMinorFont.m_oLatin.m_oTypeFace->GetValue();
}
if (m_ooxFontScheme->m_oMinorFont.m_oEa.m_oTypeFace.IsInit())
{
oParam.oReader->m_sminorEastAsia = m_ooxFontScheme->m_oMinorFont.m_oEa.m_oTypeFace->GetValue();
}
if (m_ooxFontScheme->m_oMinorFont.m_oCs.m_oTypeFace.IsInit())
{
oParam.oReader->m_sminorBidi = m_ooxFontScheme->m_oMinorFont.m_oCs.m_oTypeFace->GetValue();
}
//for (long i=0 ; i < m_ooxFontScheme->m_oMinorFont.m_arrFont.size(); i++)
//{
//}
return true;
}
};
#pragma once
#include "OOXFontReader.h"
class OOXFontTableReader
{
private:
OOX::CFontTable* m_fontTable;
public:
OOXFontTableReader(OOX::CFontTable* fontTable)
{
m_fontTable = fontTable;
}
bool Parse( ReaderParameter oParam )
{
for (long i = 0; i < m_fontTable->m_arrFonts.size(); i++)
{
OOXFontReader oFontReader(m_fontTable->m_arrFonts[i]);
RtfFont oNewFont;
if( true == oFontReader.Parse( oParam, oNewFont ) )
oParam.oRtf->m_oFontTable.AddItem(oNewFont);
}
return true;
}
};
#pragma once
#include "OOXReader.h"
#include "../RtfDocument.h"
#include <limits.h>
class OOXFootnotesReader
{
private:
OOX::CEndnotes * m_ooxEndNotes;
OOX::CFootnotes * m_ooxFootNotes;
public:
OOXFootnotesReader(OOX::CEndnotes * ooxNotes)
{
m_ooxFootNotes = NULL;
m_ooxEndNotes = ooxNotes;
}
OOXFootnotesReader(OOX::CFootnotes * ooxNotes)
{
m_ooxFootNotes = ooxNotes;
m_ooxEndNotes = NULL;
}
bool Parse( ReaderParameter oParam)
{
int nSeparatorId = 0;
int nContinueId = 1;
if (m_ooxEndNotes)
{
int nMin1 = INT_MAX;
if( oParam.oRtf->m_oProperty.m_aSpecialEndnotes.size() > 0 )
{
int nMin1 = INT_MAX;
int nMin2 = INT_MAX;
for( int i = 0; i < (int)oParam.oRtf->m_oProperty.m_aSpecialEndnotes.size(); i++ )
if( nMin1 > oParam.oRtf->m_oProperty.m_aSpecialEndnotes[i] )
{
nMin2 = nMin1;
nMin1 = oParam.oRtf->m_oProperty.m_aSpecialEndnotes[i];
}
if( INT_MAX != nMin1 )
nSeparatorId = nMin1;
if( INT_MAX != nMin2 )
nContinueId = nMin1;
}
for (long i =0 ; i < m_ooxEndNotes->m_arrEndnote.size() ; i++)
ParseOne(m_ooxEndNotes->m_arrEndnote[i], oParam, false, nSeparatorId, nContinueId);
}
if (m_ooxFootNotes)
{
int nMin1 = INT_MAX;
if( oParam.oRtf->m_oProperty.m_aSpecialFootnotes.size() > 0 )
{
int nMin1 = INT_MAX;
int nMin2 = INT_MAX;
for( int i = 0; i < (int)oParam.oRtf->m_oProperty.m_aSpecialFootnotes.size(); i++ )
if( nMin1 > oParam.oRtf->m_oProperty.m_aSpecialFootnotes[i] )
{
nMin2 = nMin1;
nMin1 = oParam.oRtf->m_oProperty.m_aSpecialFootnotes[i];
}
if( INT_MAX != nMin1 )
nSeparatorId = nMin1;
if( INT_MAX != nMin2 )
nContinueId = nMin1;
}
for (long i =0 ; i < m_ooxFootNotes->m_arrFootnote.size() ; i++)
ParseOne(m_ooxFootNotes->m_arrFootnote[i], oParam, true, nSeparatorId, nContinueId);
}
return true;
}
bool ParseOne(OOX::CFtnEdn* ooxFtnEdn, ReaderParameter & oParam, bool bFootnote, int nSeparatorId, int nContinueId)
{
if (ooxFtnEdn == NULL) return false;
if (ooxFtnEdn->m_oId.IsInit() == false) return false;
int nId = ooxFtnEdn->m_oId->GetValue();
OOXTextItemReader oTextItemReader;
for (long i = 0 ; i < ooxFtnEdn->m_arrItems.size(); i++)
{
if( nSeparatorId == nId )
{
TextItemContainerPtr oNewTextItem( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
{
if( true == bFootnote )
oParam.oRtf->m_oFootnoteSep = oNewTextItem;
else
oParam.oRtf->m_oEndnoteSep = oNewTextItem;
}
}
else if( nContinueId == nId )
{
TextItemContainerPtr oNewTextItem( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
{
if( true == bFootnote )
oParam.oRtf->m_oFootnoteCon = oNewTextItem;
else
oParam.oRtf->m_oEndnoteCon = oNewTextItem;
}
}
else
{
TextItemContainerPtr oNewTextItem( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
{
if( true == bFootnote )
oParam.oReader->m_mapFootnotes[ nId] = oNewTextItem;
else
oParam.oReader->m_mapEndnotes[ nId] = oNewTextItem;
}
}
}
return true;
}
};
#include "OOXHeaderReader.h"
#include "OOXTextItemReader.h"
#include "OOXRelsReader.h"
bool OOXHeaderReader::Parse( ReaderParameter oParam, CString sRID, TextItemContainerPtr& oOutput, bool bHeader )
{
if (m_ref == NULL) return false;
if (m_ref->m_oId.IsInit() == false ) return false;
OOX::CHdrFtr *pHdrFtr = oParam.oDocx->GetHeaderOrFooter(m_ref->m_oId->GetValue());
if (pHdrFtr == NULL) return false;
OOXTextItemReader oOOXTextItemReader;
oOutput = TextItemContainerPtr( new TextItemContainer() );
oOOXTextItemReader.m_oTextItems = oOutput;
for (long i=0; i < pHdrFtr->m_arrItems.size(); i++)
{
oOOXTextItemReader.Parse(pHdrFtr->m_arrItems[i], oParam );
}
return true;
}
#pragma once
#include "../RtfDocument.h"
#include "OOXReader.h"
#include "OOXReaderBasic.h"
class OOXHeaderReader
{
private:
ComplexTypes::Word::CHdrFtrRef* m_ref;
public:
OOXHeaderReader(ComplexTypes::Word::CHdrFtrRef* ref)
{
m_ref = ref;
}
bool Parse(ReaderParameter oParam, CString sRID, TextItemContainerPtr& oOutput, bool bHeader );
};
#pragma once
#include "../RtfDocument.h"
#include "../RtfProperty.h"
class OOXLatentStyleReader
{
public:
OOXLatentStyleReader()
{
}
bool Parse( ReaderParameter oParam )
{
XmlUtils::CXmlLiteReader oXmlReader;
if( TRUE == oXmlReader.OpenFromXmlNode(oParam.oNode) )
{
CString nCount = oXmlReader.ReadNodeAttribute( _T("w:count") );
if( _T("") != nCount )
oParam.oRtf->m_oLatentStyleTable.m_nCount = Strings::ToInteger( nCount );
CString nLocked = oXmlReader.ReadNodeAttribute( _T("w:defLockedState") );
if( _T("") != nLocked )
oParam.oRtf->m_oLatentStyleTable.m_nLocked= Strings::ToInteger( nLocked );
CString nSemiHid = oXmlReader.ReadNodeAttribute( _T("w:defSemiHidden") );
if( _T("") != nSemiHid )
oParam.oRtf->m_oLatentStyleTable.m_nSemiHidden= Strings::ToInteger( nSemiHid );
CString nUNhidWU = oXmlReader.ReadNodeAttribute( _T("w:defUnhideWhenUsed") );
if( _T("") != nUNhidWU )
oParam.oRtf->m_oLatentStyleTable.m_nUnHiddenWhenUse= Strings::ToInteger( nUNhidWU );
CString nQFormat = oXmlReader.ReadNodeAttribute( _T("w:defQFormat") );
if( _T("") != nQFormat )
oParam.oRtf->m_oLatentStyleTable.m_nQFormat= Strings::ToInteger( nQFormat );
CString nUIPriority = oXmlReader.ReadNodeAttribute( _T("w:defUIPriority") );
if( _T("") != nUIPriority )
oParam.oRtf->m_oLatentStyleTable.m_nPriority= Strings::ToInteger( nUIPriority );
oXmlReader.ReadNodeList( _T("w:lsdException") );
for( int i = 0; i < oXmlReader.GetLengthList(); i++ )
{
RtfStyleException oNewException;
oNewException.m_sName = oXmlReader.ReadNodeAttribute( _T("w:name"), _T("") );
CString nPriority = oXmlReader.ReadNodeAttribute( _T("w:uiPriority"));
if( _T("") != nPriority )
oNewException.m_nPriority = Strings::ToInteger( nPriority );
CString nHiddenWhenUse = oXmlReader.ReadNodeAttribute( _T("w:unhideWhenUsed") );
if( _T("") != nHiddenWhenUse )
oNewException.m_nHiddenWhenUse = Strings::ToInteger( nHiddenWhenUse );
CString nQFormat = oXmlReader.ReadNodeAttribute( _T("w:qFormat") );
if( _T("") != nQFormat )
oNewException.m_nQFormat = Strings::ToInteger( nQFormat );
CString nLocked = oXmlReader.ReadNodeAttribute( _T("w:locked") );
if( _T("") != nLocked )
oNewException.m_nLocked = Strings::ToInteger( nLocked );
CString nSemiHidden = oXmlReader.ReadNodeAttribute( _T("w:semiHidden") );
if( _T("") != nSemiHidden )
oNewException.m_nSemiHidden = Strings::ToInteger( nSemiHidden );
if( true == oNewException.IsValid() )
oParam.oRtf->m_oLatentStyleTable.AddItem( oNewException );
}
}
return false;
}
};
#pragma once
#include "../RtfDocument.h"
#include "../RtfProperty.h"
#include "../Utils.h"
class OOXLevelReader
{
OOX::Numbering::CLvl* m_ooxLvlNum;
public:
OOXLevelReader(OOX::Numbering::CLvl* ooxLvlNum)
{
m_ooxLvlNum = ooxLvlNum;
}
bool Parse( ReaderParameter oParam, RtfListLevelProperty& oLevelProperty )
{
if (m_ooxLvlNum == NULL) return false;
if (m_ooxLvlNum->m_oIlvl.IsInit())
oLevelProperty.m_nLevel = m_ooxLvlNum->m_oIlvl->GetValue();
if (m_ooxLvlNum->m_oTentative.IsInit())
oLevelProperty.m_bTentative = m_ooxLvlNum->m_oTentative->ToBool();
if (m_ooxLvlNum->m_oLvlJc.IsInit() && m_ooxLvlNum->m_oLvlJc->m_oVal.IsInit())
{
switch(m_ooxLvlNum->m_oLvlJc->m_oVal->GetValue())
{
case SimpleTypes::jcCenter : oLevelProperty.m_nJustification = 1; break;
case SimpleTypes::jcEnd : oLevelProperty.m_nJustification = 2; break;
case SimpleTypes::jcStart : oLevelProperty.m_nJustification = 0; break;
case SimpleTypes::jcLeft : oLevelProperty.m_nJustification = 0; break;
case SimpleTypes::jcRight : oLevelProperty.m_nJustification = 2; break;
}
}
if (m_ooxLvlNum->m_oLvlRestart.IsInit() && m_ooxLvlNum->m_oLvlRestart->m_oVal.IsInit())
{
int nVal = m_ooxLvlNum->m_oLvlRestart->m_oVal->GetValue();
if( 0 == nVal )
oLevelProperty.m_nNoRestart = 0;
//todooo "0"
}
if (m_ooxLvlNum->m_oIsLgl.IsInit() )
oLevelProperty.m_nLegal = m_ooxLvlNum->m_oIsLgl->m_oVal.ToBool();
if (m_ooxLvlNum->m_oLvlText.IsInit() && m_ooxLvlNum->m_oLvlText->m_sVal.IsInit())
{
oLevelProperty.SetLevelTextOOX( m_ooxLvlNum->m_oLvlText->m_sVal.get2() );
//null???? todooo
}
if (m_ooxLvlNum->m_oNumFmt.IsInit() && m_ooxLvlNum->m_oNumFmt->m_oVal.IsInit())
{
oLevelProperty.m_nNumberType = oLevelProperty.GetFormat( m_ooxLvlNum->m_oNumFmt->m_oVal->ToString() );
}
if (m_ooxLvlNum->m_oLvlPicBulletId.IsInit() && m_ooxLvlNum->m_oLvlPicBulletId->m_oVal.IsInit())
{
int nID = m_ooxLvlNum->m_oLvlPicBulletId->m_oVal->GetValue();
std::map<int, int>::iterator poPair = oParam.oReader->m_mapPictureBullet.find( nID );
if( oParam.oReader->m_mapPictureBullet.end() != poPair )
{
oLevelProperty.m_nPictureIndex = poPair->second;
}
}
if (m_ooxLvlNum->m_oStart.IsInit() && m_ooxLvlNum->m_oStart->m_oVal.IsInit())
oLevelProperty.m_nStart = m_ooxLvlNum->m_oStart->m_oVal->GetValue();
if (m_ooxLvlNum->m_oSuffix.IsInit() && m_ooxLvlNum->m_oSuffix->m_oVal.IsInit())
{
switch(m_ooxLvlNum->m_oSuffix->m_oVal->GetValue())
{
case SimpleTypes::levelsuffixSpace : oLevelProperty.m_nFollow = 1; break;
case SimpleTypes::levelsuffixTab : oLevelProperty.m_nFollow = 0; break;
case SimpleTypes::levelsuffixNothing : oLevelProperty.m_nFollow = 2; break;
}
}
if (m_ooxLvlNum->m_oRPr.IsInit())
{
RtfCharProperty oNewProperty;
oNewProperty.SetDefaultOOX();
OOXrPrReader orPrReader(m_ooxLvlNum->m_oRPr.GetPointer());
orPrReader.m_bDefStyle = false;
if( true == orPrReader.Parse( oParam, oNewProperty ) )
oLevelProperty.m_oCharProp = oNewProperty;
}
if (m_ooxLvlNum->m_oPPr.IsInit())
{
RtfParagraphProperty oNewProperty;
OOXpPrReader opPrReader(m_ooxLvlNum->m_oPPr.GetPointer());
bool bStartNewSectoion;
if( true == opPrReader.Parse( oParam, oNewProperty, CcnfStyle(), bStartNewSectoion ) )
{
oLevelProperty.m_nFirstIndent = oNewProperty.m_nIndFirstLine;
oLevelProperty.m_nIndent = oNewProperty.m_nIndLeft;
oLevelProperty.m_nIndentStart = oNewProperty.m_nIndStart;
oLevelProperty.m_oTabs = oNewProperty.m_oTabs;
}
}
return true;
}
};
#pragma once
#include "../RtfDocument.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h"
class OOXMathPropReader
{
private:
OOX::Logic::CMathPr *m_ooxMathPr;
public:
OOXMathPropReader(OOX::Logic::CMathPr *ooxMathPr)
{
m_ooxMathPr = ooxMathPr;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxMathPr == NULL) return false;
for (long i = 0; i < m_ooxMathPr->m_arrItems.size(); i++)
{
if (m_ooxMathPr->m_arrItems[i] == NULL) continue;
switch(m_ooxMathPr->m_arrItems[i]->getType())
{
case OOX::et_m_mathFont:
{
OOX::Logic::CMathFont* pFont = static_cast<OOX::Logic::CMathFont*>(m_ooxMathPr->m_arrItems[i]);
RtfFont oFont;
if (( pFont && pFont->m_val.IsInit()) && (true == oParam.oRtf->m_oFontTable.GetFont(pFont->m_val.get2(), oFont)))
oParam.oRtf->m_oMathProp.mmathFont = oFont.m_nID;
}break;
case OOX::et_m_brkBin:
{
OOX::Logic::CBrkBin* pBrkBin = static_cast<OOX::Logic::CBrkBin*>(m_ooxMathPr->m_arrItems[i]);
if ((pBrkBin) && (pBrkBin->m_val.IsInit()))
{
switch(pBrkBin->m_val->GetValue())
{
case SimpleTypes::breakBinAfter : oParam.oRtf->m_oMathProp.mbrkBin = 1; break;
case SimpleTypes::breakBinBefore : oParam.oRtf->m_oMathProp.mbrkBin = 0; break;
case SimpleTypes::breakBinRepeat :
default : oParam.oRtf->m_oMathProp.mbrkBin = 2; break;
}
}
}break;
case OOX::et_m_brkBinSub:
{
OOX::Logic::CBrkBinSub* pBrkBinSub = static_cast<OOX::Logic::CBrkBinSub*>(m_ooxMathPr->m_arrItems[i]);
if ((pBrkBinSub) && (pBrkBinSub->m_val.IsInit()))
{
switch(pBrkBinSub->m_val->GetValue())
{
case SimpleTypes::breakBinPlusMinus : oParam.oRtf->m_oMathProp.mbrkBinSub = 1; break;
case SimpleTypes::breakBinMinusPlus : oParam.oRtf->m_oMathProp.mbrkBinSub = 2; break;
case SimpleTypes::breakBinMinusMinus : oParam.oRtf->m_oMathProp.mbrkBinSub = 0; break;
}
}
}break;
case OOX::et_m_defJc:
{
OOX::Logic::CDefJc* pDefJc = static_cast<OOX::Logic::CDefJc*>(m_ooxMathPr->m_arrItems[i]);
if ((pDefJc) && (pDefJc->m_val.IsInit()))
{
switch(pDefJc->m_val->GetValue())
{
case SimpleTypes::mjcCenter : oParam.oRtf->m_oMathProp.mbrkBinSub = 2; break;
case SimpleTypes::mjcLeft : oParam.oRtf->m_oMathProp.mbrkBinSub = 3; break;
case SimpleTypes::mjcRight : oParam.oRtf->m_oMathProp.mbrkBinSub = 4; break;
case SimpleTypes::mjcCenterGroup:
default : oParam.oRtf->m_oMathProp.mbrkBinSub = 1; break;
}
}
}break;
case OOX::et_m_dispDef:
{
OOX::Logic::CDispDef* pDispDef = static_cast<OOX::Logic::CDispDef*>(m_ooxMathPr->m_arrItems[i]);
if ((pDispDef) && (pDispDef->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mdispDef = pDispDef->m_val->ToBool();
}break;
case OOX::et_m_interSp:
{
OOX::Logic::CInterSp* pInterSp = static_cast<OOX::Logic::CInterSp*>(m_ooxMathPr->m_arrItems[i]);
if ((pInterSp) && (pInterSp->m_val.IsInit()))
oParam.oRtf->m_oMathProp.minterSp = pInterSp->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_intraSp:
{
OOX::Logic::CIntraSp* pIntraSp = static_cast<OOX::Logic::CIntraSp*>(m_ooxMathPr->m_arrItems[i]);
if ((pIntraSp) && (pIntraSp->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mintraSp = pIntraSp->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_lMargin:
{
OOX::Logic::CLMargin* pMargin = static_cast<OOX::Logic::CLMargin*>(m_ooxMathPr->m_arrItems[i]);
if ((pMargin) && (pMargin->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mlMargin = pMargin->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_rMargin:
{
OOX::Logic::CRMargin* pMargin = static_cast<OOX::Logic::CRMargin*>(m_ooxMathPr->m_arrItems[i]);
if ((pMargin) && (pMargin->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mrMargin = pMargin->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_naryLim:
{
OOX::Logic::CNaryLim* pNaryLim = static_cast<OOX::Logic::CNaryLim*>(m_ooxMathPr->m_arrItems[i]);
if ( (pNaryLim) && (pNaryLim->m_val.IsInit()) )
{
if( pNaryLim->m_val->GetValue() == SimpleTypes::limLocSubSup) oParam.oRtf->m_oMathProp.mnaryLim = 0;
else if( pNaryLim->m_val->GetValue() == SimpleTypes::limLocUndOvr) oParam.oRtf->m_oMathProp.mnaryLim = 1;
}
}break;
case OOX::et_m_postSp:
{
OOX::Logic::CPostSp* pPostSp = static_cast<OOX::Logic::CPostSp*>(m_ooxMathPr->m_arrItems[i]);
if ((pPostSp) && (pPostSp->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mpostSp = pPostSp->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_preSp:
{
OOX::Logic::CPreSp* pPreSp = static_cast<OOX::Logic::CPreSp*>(m_ooxMathPr->m_arrItems[i]);
if ((pPreSp) && (pPreSp->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mpreSp = pPreSp->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_smallFrac:
{
OOX::Logic::CSmallFrac* pSmallFrac = static_cast<OOX::Logic::CSmallFrac*>(m_ooxMathPr->m_arrItems[i]);
if ((pSmallFrac) && (pSmallFrac->m_val.IsInit()))
oParam.oRtf->m_oMathProp.msmallFrac = pSmallFrac->m_val->ToBool();
}break;
case OOX::et_m_wrapIndent:
{
OOX::Logic::CWrapIndent* pWrapIndent = static_cast<OOX::Logic::CWrapIndent*>(m_ooxMathPr->m_arrItems[i]);
if ((pWrapIndent) && (pWrapIndent->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mwrapIndent = pWrapIndent->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_wrapRight:
{
OOX::Logic::CWrapRight* pWrapRight = static_cast<OOX::Logic::CWrapRight*>(m_ooxMathPr->m_arrItems[i]);
if ((pWrapRight) && (pWrapRight->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mwrapRight = pWrapRight->m_val->ToBool(); //todooo
}break;
}
}
return true;
}
};
This diff is collapsed.
#pragma once
#include "../RtfDocument.h"
#include "OOXLevelReader.h"
class OOXNumberingMapReader
{
private:
OOX::Numbering::CNum *m_ooxNum;
public:
OOXNumberingMapReader(OOX::Numbering::CNum *ooxNum)
{
m_ooxNum = ooxNum;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxNum == NULL) return false;
RtfListOverrideProperty oNewOverride;
if (m_ooxNum->m_oNumId.IsInit())
oNewOverride.m_nIndex = m_ooxNum->m_oNumId->GetValue();
if (m_ooxNum->m_oAbstractNumId.IsInit() && m_ooxNum->m_oAbstractNumId->m_oVal.IsInit())
oNewOverride.m_nListID = m_ooxNum->m_oAbstractNumId->m_oVal->GetValue();
for (long i=0 ;i < m_ooxNum->m_arrLvlOverride.size(); i++)
{
if (m_ooxNum->m_arrLvlOverride[i] == NULL) continue;
RtfListOverrideProperty::ListOverrideLevels::ListOverrideLevel oOverrideLevel;
if (m_ooxNum->m_arrLvlOverride[i]->m_oIlvl.IsInit())
oOverrideLevel.m_nLevelIndex = m_ooxNum->m_arrLvlOverride[i]->m_oIlvl->GetValue();
else
oOverrideLevel.m_nLevelIndex = 0;
if (m_ooxNum->m_arrLvlOverride[i]->m_oStartOverride.IsInit() && m_ooxNum->m_arrLvlOverride[i]->m_oStartOverride->m_oVal.IsInit())
{
oOverrideLevel.m_nStart = m_ooxNum->m_arrLvlOverride[i]->m_oStartOverride->m_oVal->GetValue();
}
if (m_ooxNum->m_arrLvlOverride[i]->m_oLvl.IsInit())
{
OOXLevelReader oLevelReader(m_ooxNum->m_arrLvlOverride[i]->m_oLvl.GetPointer());
oLevelReader.Parse( oParam, oOverrideLevel.m_oLevel );
}
oNewOverride.m_oOverrideLevels.m_aOverrideLevels.push_back( oOverrideLevel );
}
oParam.oRtf->m_oListOverrideTabel.AddItem( oNewOverride );
return true;
}
};
#pragma once
#include "OOXAbstractNumReader.h"
#include "OOXNumberingMapReader.h"
#include "OOXShapeReader.h"
class OOXNumberingReader
{
private:
OOX::CNumbering* m_ooxNumbering;
public:
OOXNumberingReader( OOX::CNumbering* ooxNumbering)
{
m_ooxNumbering = ooxNumbering;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxNumbering == NULL) return false;
for (long i=0; m_ooxNumbering->m_arrNumPicBullet.size(); i++)
{
if (m_ooxNumbering->m_arrNumPicBullet[i] == NULL) continue;
int nID = m_ooxNumbering->m_arrNumPicBullet[i]->m_oNumPicBulletId.GetValue();
if (m_ooxNumbering->m_arrNumPicBullet[i]->m_oVmlDrawing.IsInit())
{
OOXShapeReader oShapeReader(m_ooxNumbering->m_arrNumPicBullet[i]->m_oVmlDrawing.GetPointer());
RtfShapePtr oNewShape( new RtfShape() );
if( true == oShapeReader.Parse( oParam, oNewShape ) )
{
oNewShape->m_eShapeType = RtfShape::st_inline;
oNewShape->m_nPositionHRelative = 3;
oNewShape->m_nPositionVRelative = 3;
int nIndex = oParam.oRtf->m_oListTabel.m_aPictureList.GetCount();
oParam.oReader->m_mapPictureBullet[nID] = nIndex;
oParam.oRtf->m_oListTabel.m_aPictureList.AddItem( oNewShape );
}
}
if (m_ooxNumbering->m_arrNumPicBullet[i]->m_oDrawing.IsInit())
{
//???? todooo
}
}
for (long i=0; i < m_ooxNumbering->m_arrAbstractNum.size(); i++)
{
OOXAbstractNumReader oParagraph(m_ooxNumbering->m_arrAbstractNum[i]);
oParagraph.Parse( oParam );
}
for (long i=0; i < m_ooxNumbering->m_arrNum.size(); i++)
{
OOXNumberingMapReader oParagraph(m_ooxNumbering->m_arrNum[i]);
oParagraph.Parse( oParam );
}
return true;
}
};
#pragma once
#include "OOXRunReader.h"
#include "OOXpPrReader.h"
#include "OOXMathReader.h"
#include "../RtfDocument.h"
#include "../RtfField.h"
class OOXParagraphReader
{
private:
//OOXRunReader m_oRunReader; //????
OOX::Logic::CParagraph *m_ooxParagraph;
OOX::WritingElementWithChilds<OOX::WritingElement> *m_ooxElement;
public:
OOXParagraphReader (OOX::Logic::CParagraph *ooxParagraph)
{
m_ooxElement = NULL;
m_ooxParagraph = ooxParagraph;
}
OOXParagraphReader (OOX::WritingElementWithChilds<OOX::WritingElement> *ooxElement)
{
m_ooxParagraph = NULL;
m_ooxElement = ooxElement;
}
bool Parse( ReaderParameter oParam , RtfParagraph& oOutputParagraph, CcnfStyle oConditionalTableStyle, bool& bStartNewSection );
bool Parse2( ReaderParameter oParam , RtfParagraph& oOutputParagraph, CcnfStyle oConditionalTableStyle, bool& bStartNewSection, RtfStylePtr poStyle);
};
#pragma once
#include "OOXPictureGraphicReader.h"
class OOXPictureInlineReader
{
private:
OOX::Drawing::CInline *m_ooxInline;
public:
OOXPictureInlineReader(OOX::Drawing::CInline *ooxInline)
{
m_ooxInline = ooxInline;
}
bool Parse( ReaderParameter oParam, RtfShape& oOutput)
{
if (m_ooxInline == NULL) return false;
oOutput.m_oPicture = RtfPicturePtr( new RtfPicture() );
oOutput.m_eShapeType = RtfShape::st_inline;
oOutput.m_nShapeType = 75;
oOutput.m_nLeft = 0;
oOutput.m_nTop = 0;
oOutput.m_nPositionHRelative = 3;
oOutput.m_nPositionVRelative = 3;
int nDistLeft = m_ooxInline->m_oDistL.IsInit() ? m_ooxInline->m_oDistL->ToTwips() : PROP_DEF;
int nDistTop = m_ooxInline->m_oDistT.IsInit() ? m_ooxInline->m_oDistT->ToTwips() : PROP_DEF;
int nDistRight = m_ooxInline->m_oDistR.IsInit() ? m_ooxInline->m_oDistR->ToTwips() : PROP_DEF;
int nDistBottom = m_ooxInline->m_oDistB.IsInit() ? m_ooxInline->m_oDistB->ToTwips() : PROP_DEF;
int nWidth = PROP_DEF;
int nHeight = PROP_DEF;
if( m_ooxInline->m_oExtent.IsInit() )
{
nWidth = m_ooxInline->m_oExtent->m_oCx.GetValue();
nHeight = m_ooxInline->m_oExtent->m_oCy.GetValue();
if( PROP_DEF != nWidth && PROP_DEF != nHeight )
{
nWidth = RtfUtility::Emu2Twips( nWidth );
nHeight = RtfUtility::Emu2Twips( nHeight );
if( PROP_DEF != oOutput.m_nLeft && PROP_DEF != oOutput.m_nTop )
{
oOutput.m_nRight = oOutput.m_nLeft + nWidth;
oOutput.m_nBottom = oOutput.m_nTop + nHeight;
}
oOutput.m_oPicture->m_nWidthGoal = nWidth;
oOutput.m_oPicture->m_nHeightGoal = nHeight;
}
}
if(m_ooxInline->m_oGraphic.IsInit())
{
OOXPictureGraphicReader oGraphicReader(m_ooxInline->m_oGraphic.GetPointer());
oGraphicReader.Parse( oParam, *oOutput.m_oPicture );
}
// scale
if( PROP_DEF != nWidth && PROP_DEF != oOutput.m_oPicture->m_nWidthGoal )
{
double dNewScale = 100 * ( 1.0 * nWidth / oOutput.m_oPicture->m_nWidthGoal );
oOutput.m_oPicture->m_dScaleX = dNewScale;
}
if( PROP_DEF != nHeight && PROP_DEF != oOutput.m_oPicture->m_nHeightGoal )
{
double dNewScale = 100 * ( 1.0 * nHeight / oOutput.m_oPicture->m_nHeightGoal );
oOutput.m_oPicture->m_dScaleY = dNewScale;
}
return true;
}
};
#pragma once
#include "../RtfPicture.h"
#include "OOXPictureAnchorReader.h"
#include "OOXPictureInlineReader.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Drawing/Drawing.h"
class OOXPictureReader
{
private:
OOX::Logic::CDrawing* m_ooxDrawing;
public:
OOXPictureReader(OOX::Logic::CDrawing* ooxDrawing)
{
m_ooxDrawing = ooxDrawing;
}
bool Parse( ReaderParameter oParam , RtfShape& oOutput)
{
if (m_ooxDrawing == NULL) return false;
//if( oParam.oReader->m_nCurItap != 0 )
// oOutput.m_bLayoutInCell = 1;
if (m_ooxDrawing->m_oInline.IsInit())
{
OOXPictureInlineReader oPictureInlineReader(m_ooxDrawing->m_oInline.GetPointer());
return oPictureInlineReader.Parse( oParam, oOutput );
}
if (m_ooxDrawing->m_oAnchor.IsInit())
{
OOXPictureAnchorReader oPictureAnchorReader(m_ooxDrawing->m_oAnchor.GetPointer());
return oPictureAnchorReader.Parse( oParam, oOutput );
}
return false;
}
};
This diff is collapsed.
This diff is collapsed.
#pragma once
#include "../RtfDocument.h"
#include "../RtfReader.h"
#include "OOXReader.h"
class ReaderParameter
{
public:
OOXReader* oReader;
OOX::CDocx* oDocx;
RtfDocument* oRtf;
RtfTableStylePtr poTableStyle;
};
This diff is collapsed.
This diff is collapsed.
#pragma once
#include "OOXReaderBasic.h"
#include "OOXHeaderReader.h"
class OOXSectionPropertyReader
{
private:
OOX::Logic::CSectionProperty *m_ooxSectionProperty;
public:
OOXSectionPropertyReader(OOX::Logic::CSectionProperty *ooxSectionProperty)
{
m_ooxSectionProperty = ooxSectionProperty;
}
bool Parse( ReaderParameter oParam , RtfSectionProperty& oOutput);
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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