Commit 8e7561c6 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@55723 954022d7-b5bf-4e40-9824-e11837661b57
parent afa0ff34
......@@ -16,7 +16,6 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Oox2OdfConverter", "source\Oox2OdfConverter.vcproj", "{BEE01B53-244A-44E6-8947-ED9342D9247E}"
ProjectSection(ProjectDependencies) = postProject
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
EndProjectSection
EndProject
......@@ -27,8 +26,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileWTest", "AS
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpformulasconvert", "..\ASCOfficeOdfFile\formulasconvert\formulasconvert.vcproj", "{94954A67-A853-43B1-A727-6EF2774C5A6A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
......@@ -72,12 +69,6 @@ Global
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Release|Win32.Build.0 = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.ReleaseASC|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|Win32.ActiveCfg = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|Win32.Build.0 = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseASC|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -41,7 +41,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\ASCOfficeOdfFile\src\odf\datatypes;.\OdfFormat;.\Oox2OdfConverter;..\..\Common\DocxFormat\Source;..\..\Common\DocxFormat\Source\XML;..\..\ASCOfficeOdfFile\include;..\..\ASCOfficeOdfFile\3dparty\utf8cpp\include;..\..\ASCOfficePPTXFile\PPTXFormat\"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_USE_XMLLITE_READER_;USE_LITE_READER"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_DOCWRAPPER_"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......
......@@ -13,6 +13,9 @@
#include "odf_text_context.h"
#include "odf_drawing_context.h"
#include <XlsxFormat\Xlsx.h>
namespace Oox2Odf
{
static double pt2emu(double Val)
......@@ -445,4 +448,9 @@ void OoxConverter::convert(OOX::Drawing::CPath2DClose *oox_geom_path)
std::wstring path_elm ;
odf_context()->drawing_context().add_path_element(std::wstring(L"N"), path_elm);
}
void OoxConverter::convert_BodyPr(OOX::Drawing::CTextBodyProperties* oox_bodyPr)
{
if (!oox_bodyPr) return;
}
} // namespace Docx2Odt
\ No newline at end of file
......@@ -44,7 +44,7 @@ namespace OOX
class CSystemColor;
class CPresetColor;
class CLineProperties;
//class ;
class CTextBodyProperties;
namespace Colors
{
......@@ -70,6 +70,7 @@ public:
void convert_CNvPr(OOX::Drawing::CNonVisualDrawingProps * oox_cnvPr);
void convert_SpPr(OOX::Drawing::CShapeProperties * oox_spPr);
void convert_BodyPr(OOX::Drawing::CTextBodyProperties *oox_bodyPr);
void convert(OOX::Drawing::CCustomGeometry2D *oox_cust_geom);
void convert(OOX::Drawing::CPresetGeometry2D *oox_prst_geom);
......
......@@ -3,6 +3,7 @@
#include "stdAfx.h"
#include "XlsxConverter.h"
#include "XlsxTextShapeConverter.h"
#include <boost/foreach.hpp>
......@@ -18,6 +19,8 @@
#include "style_paragraph_properties.h"
#include "style_graphic_properties.h"
#include <XlsxFormat\Xlsx.h>
using namespace cpdoccore;
namespace Oox2Odf
......@@ -1064,7 +1067,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape)
//
}
if (oox_shape->m_oTxBody.IsInit())
{
convert_BodyPr(oox_shape->m_oTxBody->m_oBodyPr.GetPointer());
}
}
if (type == 2000)ods_context->drawing_context().end_text_box();
else ods_context->drawing_context().end_shape();
......
......@@ -5,11 +5,43 @@
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>
#include <XlsxFormat\Xlsx.h>
namespace OOX
{
class CDocx;
class CTheme;
namespace Spreadsheet
{
class CXlsx;
class WritingElement;
class CWorksheet;
class CDrawing;
class CCol;
class CRow;
class CCell;
class CRun;
class CRPr;
class CText;
class CFormula;
class CHyperlink;
class CSheetFormatPr;
class CSheetPr;
class CFont;
class CBorder;
class CFill;
class CColor;
class CBorderProp;
class CXfs;
class CCellStyle;
class CNumFmt;
class CCellAnchor;
class CDrawing;
class CFromTo;
class CPic;
class CShape;
class CConnShape;
}
}
namespace cpdoccore
......@@ -64,7 +96,7 @@ namespace Oox2Odf
private:
OOX::Spreadsheet::CXlsx *xlsx_document;
odf::package::odf_document *output_document;
OOX::Spreadsheet::CDrawing *xlsx_current_drawing; // ..
OOX::Spreadsheet::CDrawing *xlsx_current_drawing; // .. ,
odf::ods_conversion_context *ods_context;
......@@ -113,6 +145,6 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CPic* oox_picture);
void convert(OOX::Spreadsheet::CShape* oox_shape);
void convert(OOX::Spreadsheet::CConnShape* oox_conn_shape);
};
}
\ No newline at end of file
#pragma once
#include "stdAfx.h"
#include "XlsxTextShapeConverter.h"
#include <boost/foreach.hpp>
#include "ods_conversion_context.h"
#include "odf_text_context.h"
#include "odf_drawing_context.h"
#include "styles.h"
#include "style_table_properties.h"
#include "style_text_properties.h"
#include "style_paragraph_properties.h"
#include "style_graphic_properties.h"
#include <Logic\TxBody.h>
using namespace cpdoccore;
namespace Oox2Odf
{
void XlsxTextShapeConverter::convert(CString &strParagraphs)
{
if (strParagraphs.GetLength() < 1)return;
CString xml_txBody;
xml_txBody += _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
xml_txBody += _T("<xdr:txBody xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\">");
xml_txBody += _T("<a:bodyPr/>");
xml_txBody += strParagraphs;
xml_txBody += _T("</xdr:txBody>");
XmlUtils::CXmlNode oXmlNode;
if (!oXmlNode.FromXmlString(xml_txBody)) return;
PPTX::Logic::TxBody * txBody = new PPTX::Logic::TxBody(oXmlNode);
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <atlbase.h>
#include <atlstr.h>
// TODO: reference additional headers your program requires here
......@@ -2,6 +2,6 @@
//1
//2
//0
//19
#define INTVER 1,2,0,19
#define STRVER "1,2,0,19\0"
//21
#define INTVER 1,2,0,21
#define STRVER "1,2,0,21\0"
......@@ -824,6 +824,10 @@
RelativePath="..\Source\DocxFormat\Drawing\DrawingGraphic.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingParagraph.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingPicture.h"
>
......@@ -848,6 +852,10 @@
RelativePath="..\Source\DocxFormat\Drawing\DrawingStyles2.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingTables.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingTransform.h"
>
......
......@@ -4731,7 +4731,71 @@ namespace SimpleTypes
unsigned char m_unA;
};
//--------------------------------------------------------------------------------
// TextAlignmentType 20.1.10.59 (Part 1)
//--------------------------------------------------------------------------------
enum ETextAlignmentType
{
textalignmenttypeL = 0,
textalignmenttypeCtr = 1,
textalignmenttypeDist = 2,
textalignmenttypeJust = 3,
textalignmenttypeR = 4,
};
template<ETextAlignmentType eDefValue = textalignmenttypeL>
class CTextAlignmentType : public CSimpleType<ETextAlignmentType, eDefValue>
{
public:
CTextAlignmentType() {}
virtual ETextAlignmentType FromString(CString &sValue)
{
m_eValue = eDefValue;
if ( sValue.GetLength() <= 0 )
return m_eValue;
wchar_t wChar = sValue.GetAt(0);
switch ( wChar )
{
case 'l':
if ( _T("l") == sValue ) m_eValue = textalignmenttypeL;
break;
case 'c':
if ( _T("ctr") == sValue ) m_eValue = textalignmenttypeCtr;
break;
case 'd':
if ( _T("dist") == sValue ) m_eValue = textalignmenttypeDist;
break;
case 'j':
if ( _T("just") == sValue ) m_eValue = textalignmenttypeJust;
break;
case 'r':
if ( _T("r") == sValue ) m_eValue = textalignmenttypeR;
break;
}
return m_eValue;
}
virtual CString ToString () const
{
switch(m_eValue)
{
case textalignmenttypeR : return _T("r");
case textalignmenttypeCtr : return _T("ctr");
case textalignmenttypeDist: return _T("dist");
case textalignmenttypeJust: return _T("just");
case textalignmenttypeL : return _T("l");
default : return _T("l");
}
}
SimpleType_FromString (ETextAlignmentType)
SimpleType_Operator_Equal (CTextAlignmentType)
};
//--------------------------------------------------------------------------------
// TextAnchoringType 20.1.10.60 (Part 1)
//--------------------------------------------------------------------------------
......@@ -4834,6 +4898,70 @@ namespace SimpleTypes
SimpleType_FromString (unsigned char)
SimpleType_Operator_Equal (CTextColumnCount)
};
//--------------------------------------------------------------------------------
// 20.1.10.66 TextFontAlignType (Font Alignment Types)
//--------------------------------------------------------------------------------
enum ETextFontAlignType
{
textfontaligntypeAuto = 0,
textfontaligntypeCtr = 1,
textfontaligntypeBase = 2,
textfontaligntypeT = 3,
textfontaligntypeB = 4,
};
template<ETextFontAlignType eDefValue = textfontaligntypeAuto>
class CTextFontAlignType : public CSimpleType<ETextFontAlignType, eDefValue>
{
public:
CTextFontAlignType() {}
virtual ETextFontAlignType FromString(CString &sValue)
{
m_eValue = eDefValue;
if ( sValue.GetLength() <= 0 )
return m_eValue;
wchar_t wChar = sValue.GetAt(0);
switch ( wChar )
{
case 'a':
if ( _T("a") == sValue ) m_eValue = textfontaligntypeAuto;
break;
case 'c':
if ( _T("ctr") == sValue ) m_eValue = textfontaligntypeCtr;
break;
case 'b':
if ( _T("base") == sValue ) m_eValue = textfontaligntypeBase;
if ( _T("b") == sValue ) m_eValue = textfontaligntypeB;
break;
case 't':
if ( _T("just") == sValue ) m_eValue = textfontaligntypeT;
break;
}
return m_eValue;
}
virtual CString ToString () const
{
switch(m_eValue)
{
case textfontaligntypeB : return _T("b");
case textfontaligntypeCtr : return _T("ctr");
case textfontaligntypeT : return _T("t");
case textfontaligntypeBase: return _T("base");
case textfontaligntypeAuto: return _T("auto");
default : return _T("auto");
}
}
SimpleType_FromString (ETextFontAlignType)
SimpleType_Operator_Equal (CTextFontAlignType)
};
//--------------------------------------------------------------------------------
// TextFontScalePercentOrPercentString 20.1.10.67 (Part 1) + 12.1.2.5 (Part4)
//--------------------------------------------------------------------------------
......
#pragma once
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Drawing.h"
#include "../../Common/SimpleTypes_Shared.h"
#include "../WritingElement.h"
namespace OOX
{
namespace Drawing
{
//--------------------------------------------------------------------------------
// 21.1.2.2.7 pPr (Text Paragraph Properties)
//--------------------------------------------------------------------------------
class CParagraphProperty : public WritingElement
{
public:
WritingElement_AdditionConstructors(CParagraphProperty)
CParagraphProperty()
{
}
virtual ~CParagraphProperty()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:extLst") == sName )
m_oExtLst = Reader;
}
}
virtual CString toXML() const
{
return _T("");
}
virtual EElementType getType() const
{
return et_a_pPr;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("rtl"), m_oRtl)
WritingElement_ReadAttributes_ReadSingle( oReader, _T("lvl"), m_oLvl)
WritingElement_ReadAttributes_ReadSingle( oReader, _T("algn"), m_oAlgn)
WritingElement_ReadAttributes_ReadSingle( oReader, _T("fontAlgn"), m_oFontAlgn)
WritingElement_ReadAttributes_ReadSingle( oReader, _T("marL"), m_oMarR)
WritingElement_ReadAttributes_ReadSingle( oReader, _T("marR"), m_oMarL)
WritingElement_ReadAttributes_End ( oReader )
}
public:
// Attributes
nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse>> m_oRtl;
nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse>> m_oHangingPunct;
nullable<SimpleTypes::CDecimalNumber<> > m_oLvl;
nullable<SimpleTypes::CDecimalNumber<> > m_oLatinLnBrk;
nullable<SimpleTypes::CDecimalNumber<> > m_oIndent;
nullable<SimpleTypes::CDecimalNumber<> > m_oEaLnBrk;
nullable<SimpleTypes::CDecimalNumber<> > m_oDefTabSz;
nullable<SimpleTypes::CTextAlignmentType<>> m_oAlgn;
nullable<SimpleTypes::CTextFontAlignType<>> m_oFontAlgn;
nullable<SimpleTypes::CCoordinate32> m_oMarR;
nullable<SimpleTypes::CCoordinate32> m_oMarL;
// Childs
//buAutoNum //(Auto-Numbered Bullet) 21.1.2.4.1
//buBlip //(Picture Bullet) 21.1.2.4.2
//buChar //(Character Bullet) 21.1.2.4.3
//buClr //(Color Specified) 21.1.2.4.4
//buClrTx //(Follow Text) 21.1.2.4.5
//buFont //(Specified) 21.1.2.4.6
//buFontTx //(Follow text) 21.1.2.4.7
//buNone //(No Bullet) 21.1.2.4.8
//buSzPct //(Bullet Size Percentage) 21.1.2.4.9
//buSzPts //(Bullet Size Points) 21.1.2.4.10
//buSzTx //(Bullet Size Follows Text) 21.1.2.4.11
//defRPr //(Default Text Run Properties) 21.1.2.3.2
nullable<OOX::Drawing::COfficeArtExtensionList > m_oExtLst; //(Extension List) 20.1.2.2.15
//lnSpc //(Line Spacing) 21.1.2.2.5
//spcAft// (Space After) 21.1.2.2.9
//spcBef //(Space Before) 21.1.2.2.10
//tabLst //(Tab List) 21.1.2.2.14
};
//--------------------------------------------------------------------------------
// 21.1.2.2.6 p (Text Paragraphs)
//--------------------------------------------------------------------------------
class CParagraph : public WritingElementWithChilds<>
{
public:
WritingElement_AdditionConstructors(CParagraph)
CParagraph()
{
}
virtual ~CParagraph()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("a:pPr") == sName )
m_arrItems.Add( new CParagraphProperty( oReader ));
else if ( _T("a:r") == sName )
m_arrItems.Add( new CRun( oReader ));
// if ( _T("a:br") == sName )
// pItem = new CBr( oReader );
//else if ( _T("a:fld") == sName )
// pItem = new CField( oReader );
//else if ( _T("a:endParaRPr") == sName )
// pItem = new CEndParaRPr( oReader );
}
}
virtual CString toXML() const
{
return _T("");
}
virtual EElementType getType() const
{
return et_a_p;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
};
} // namespace Drawing
} // namespace OOX
......@@ -277,6 +277,8 @@ namespace OOX
et_a_txDef, // <a:txDef>
et_a_up, // <a:up>
et_a_xfrm, // <a:xfrm>
et_a_p, // <a:p>
et_a_pPr, // <a:pPr>
et_ds_schemaRef, // <ds:shemeRef>
et_ds_schemaRefs, // <ds:schemaRefs>
......@@ -677,4 +679,24 @@ namespace OOX
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) {}
};
template<typename ElemType = WritingElement>
class WritingElementWithChilds : public WritingElement
{
public:
WritingElementWithChilds(){}
virtual ~WritingElementWithChilds() {ClearItems();}
virtual void ClearItems()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
CSimpleArray<ElemType *> m_arrItems;
};
}
......@@ -8,6 +8,7 @@
#include "../DocxFormat/Drawing/DrawingCoreInfo.h"
#include "../DocxFormat/Drawing/DrawingEffects.h"
#include "../DocxFormat/Drawing/DrawingBody.h"
#include "../DocxFormat/Drawing/DrawingParagraph.h"
#include "ComplexTypes_Spreadsheet.h"
#include "FileTypes_Spreadsheet.h"
......
......@@ -12,7 +12,7 @@ namespace OOX
//--------------------------------------------------------------------------------
// 20.5.2.34 txBody (Shape Text Body)
//--------------------------------------------------------------------------------
class CTextBody : public WritingElement
class CTextBody : public WritingElementWithChilds<Drawing::CParagraph>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CTextBody)
......@@ -47,12 +47,8 @@ namespace OOX
m_oBodyPr = oReader;
//if ( _T("a:lstStyle") == sName )
// m_oLstStyle = oReader;
//if ( _T("a:p") == sName )
//{
// // .. OOX::Logic namespace "a", !!! "w"
// OOX::WritingElement *pItem = new OOX::Logic::CParagraph( oReader );
// if ( pItem ) m_arrItems.Add( pItem );
//}
else if ( _T("a:p") == sName )
m_arrItems.Add( new Drawing::CParagraph( oReader ));
}
}
......@@ -64,15 +60,12 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
public:
nullable<OOX::Drawing::CTextBodyProperties> m_oBodyPr;
//nullable<OOX::Drawing::CTextListStyle> m_oLstStyle;
//CSimpleArray<OOX::WritingElement*> m_arrItems;
//lstStyle (Text List Styles) 21.1.2.4.12
//p (Text Paragraphs)
};
//--------------------------------------------------------------------------------
// 20.5.2.9 cNvSpPr (Connection Non-Visual Shape Properties)
......@@ -231,10 +224,13 @@ namespace OOX
if ( _T("xdr:nvSpPr") == sName )
m_oNvSpPr = oReader;
if ( _T("xdr:spPr") == sName )
else if ( _T("xdr:spPr") == sName )
m_oSpPr = oReader;
if ( _T("xdr:style") == sName )
m_oShapeStyle = oReader; }
else if ( _T("xdr:style") == sName )
m_oShapeStyle = oReader;
else if (_T("xdr:txBody") == sName)
m_oTxBody = oReader;
}
}
virtual EElementType getType () const
......@@ -250,7 +246,7 @@ namespace OOX
nullable<CShapeNonVisual> m_oNvSpPr;
nullable<OOX::Drawing::CShapeProperties> m_oSpPr;
nullable<OOX::Drawing::CShapeStyle> m_oShapeStyle;
nullable<OOX::Spreadsheet::CTextBody> m_oTxBody;
nullable<OOX::Spreadsheet::CTextBody> m_oTxBody;
};
//--------------------------------------------------------------------------------
......
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