Commit fa3fdd7f 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@55469 954022d7-b5bf-4e40-9824-e11837661b57
parent 879794a1
...@@ -954,14 +954,6 @@ ...@@ -954,14 +954,6 @@
<Filter <Filter
Name="odf spreadsheet" Name="odf spreadsheet"
> >
<File
RelativePath=".\OdfFormat\odf_text_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_text_context.h"
>
</File>
<File <File
RelativePath=".\OdfFormat\ods_conversion_context.cpp" RelativePath=".\OdfFormat\ods_conversion_context.cpp"
> >
...@@ -1139,24 +1131,44 @@ ...@@ -1139,24 +1131,44 @@
Name="odf presentation" Name="odf presentation"
> >
</Filter> </Filter>
<Filter
Name="odf common"
>
<File <File
RelativePath=".\OdfFormat\abstract_xml.cpp" RelativePath=".\OdfFormat\odf_conversion_context.cpp"
> >
</File> </File>
<File <File
RelativePath=".\OdfFormat\abstract_xml.h" RelativePath=".\OdfFormat\odf_conversion_context.h"
> >
</File> </File>
<File <File
RelativePath=".\OdfFormat\logging.cpp" RelativePath=".\OdfFormat\odf_drawing_context.cpp"
> >
</File> </File>
<File <File
RelativePath=".\OdfFormat\odf_conversion_context.cpp" RelativePath=".\OdfFormat\odf_drawing_context.h"
> >
</File> </File>
<File <File
RelativePath=".\OdfFormat\odf_conversion_context.h" RelativePath=".\OdfFormat\odf_text_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_text_context.h"
>
</File>
</Filter>
<File
RelativePath=".\OdfFormat\abstract_xml.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\abstract_xml.h"
>
</File>
<File
RelativePath=".\OdfFormat\logging.cpp"
> >
</File> </File>
<File <File
......
...@@ -13,7 +13,7 @@ namespace odf { ...@@ -13,7 +13,7 @@ namespace odf {
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
odf_conversion_context::odf_conversion_context(package::odf_document * outputDocument) : style_context_(*this) odf_conversion_context::odf_conversion_context(package::odf_document * outputDocument) : style_context_(*this),drawing_context_(&style_context_, this)
{ {
output_document_ = outputDocument; output_document_ = outputDocument;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "object_package.h" #include "object_package.h"
#include "odf_style_context.h" #include "odf_style_context.h"
#include "odf_drawing_context.h"
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
...@@ -31,6 +32,7 @@ public: ...@@ -31,6 +32,7 @@ public:
package::odf_document * output_document_; package::odf_document * output_document_;
odf_style_context & styles_context(){return style_context_;} odf_style_context & styles_context(){return style_context_;}
odf_drawing_context& drawing_context(){return drawing_context_;}
odf_number_styles_context & numbers_styles_context() {return style_context_.numbers_styles();} odf_number_styles_context & numbers_styles_context() {return style_context_.numbers_styles();}
...@@ -41,6 +43,7 @@ private: ...@@ -41,6 +43,7 @@ private:
public: public:
odf_drawing_context drawing_context_;
odf_style_context style_context_; odf_style_context style_context_;
//styles_container & styleContainer() { return major_style_container_; } //styles_container & styleContainer() { return major_style_container_; }
......
#pragma once
#include <string>
#include <vector>
//
//#include "ods_drawing_context.h"
//#include "ods_comments_context.h"
//#include "ods_hyperlinks.h"
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf
{
class odf_conversion_context;
class odf_style_context;
class paragraph;
struct odf_drawing_state
{
office_element_ptr elm;
std::wstring style_name;
office_element_ptr style_elm;
int level;
};
class odf_drawing_context: boost::noncopyable
{
public:
odf_drawing_context(odf_style_context * styles_context_,odf_conversion_context *odf_context);
~odf_drawing_context();
public:
void set_styles_context(odf_style_context* styles_context);// embedded
void start_drawing(){}
void start_image(std::wstring & path){}
void end_image();
office_element_ptr & end_drawing(){return current_level_.back();}
std::vector<office_element_ptr> current_level_;//
std::vector<odf_drawing_state> drawing_elements_list_;//, , ... - ( ?? + ????
private:
odf_style_context * styles_context_;
odf_conversion_context *odf_context_;
};
}
}
\ No newline at end of file
...@@ -41,7 +41,6 @@ public: ...@@ -41,7 +41,6 @@ public:
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
ods_table_state & current_table() { return table_context_.state();} ods_table_state & current_table() { return table_context_.state();}
odf_text_context* current_text_context(){return current_text_context_;} odf_text_context* current_text_context(){return current_text_context_;}
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
void start_text_context(); void start_text_context();
void end_text_context(); void end_text_context();
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_text_context.h"
#include "odf_style_context.h"
#include "odf_conversion_context.h"
namespace cpdoccore {
namespace odf
{
odf_drawing_context::odf_drawing_context(odf_style_context * styles_context,odf_conversion_context *odf_context)
{
styles_context_ = styles_context;
odf_context_ = odf_context;
}
odf_drawing_context::~odf_drawing_context()
{
}
void odf_drawing_context::set_styles_context(odf_style_context* styles_context)
{
styles_context_ = styles_context;
}
}
}
\ No newline at end of file
...@@ -478,6 +478,11 @@ void ods_table_state::set_cell_formula(std::wstring & formula) ...@@ -478,6 +478,11 @@ void ods_table_state::set_cell_formula(std::wstring & formula)
cell->table_table_cell_attlist_.table_formula_ = odfFormula; cell->table_table_cell_attlist_.table_formula_ = odfFormula;
} }
void ods_table_state::add_child_element(office_element_ptr & child_element)
{
office_table_->add_child_element(child_element);
}
void ods_table_state::set_cell_text(odf_text_context* text_context) void ods_table_state::set_cell_text(odf_text_context* text_context)
{ {
if (text_context == NULL)return; if (text_context == NULL)return;
......
...@@ -87,6 +87,8 @@ public: ...@@ -87,6 +87,8 @@ public:
void set_cell_text(odf_text_context *text_context); void set_cell_text(odf_text_context *text_context);
void set_cell_formula(std::wstring &formula); void set_cell_formula(std::wstring &formula);
void add_child_element(office_element_ptr & child_element);
/////////////////////////////// ///////////////////////////////
void add_hyperlink(std::wstring & ref,int col, int row, std::wstring & link); void add_hyperlink(std::wstring & ref,int col, int row, std::wstring & link);
...@@ -97,6 +99,7 @@ public: ...@@ -97,6 +99,7 @@ public:
bool is_cell_hyperlink(); bool is_cell_hyperlink();
int is_cell_hyperlink(int col, int row); int is_cell_hyperlink(int col, int row);
ods_hyperlink_state & current_hyperlink(); ods_hyperlink_state & current_hyperlink();
int current_column() const; int current_column() const;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ods_conversion_context.h" #include "ods_conversion_context.h"
#include "odf_text_context.h" #include "odf_text_context.h"
#include "odf_drawing_context.h"
#include "styles.h" #include "styles.h"
...@@ -951,6 +952,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool ...@@ -951,6 +952,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor) void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
{ {
ods_context->drawing_context().start_drawing();
//SimpleTypes::Spreadsheet::CCellAnchorType<> m_oAnchorType; //SimpleTypes::Spreadsheet::CCellAnchorType<> m_oAnchorType;
std::wstring ref_from, ref_to; std::wstring ref_from, ref_to;
int col_from, col_to, row_from, row_to; int col_from, col_to, row_from, row_to;
...@@ -973,15 +975,21 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor) ...@@ -973,15 +975,21 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
{ {
//m_oChartGraphic //m_oChartGraphic
} }
if (oox_anchor->m_oPicture.IsInit())
{
convert(oox_anchor->m_oPicture.GetPointer());
}
if (oox_anchor->m_oXml.IsInit()) if (oox_anchor->m_oXml.IsInit())
{ {
//m_oXml //m_oXml
} }
ods_context->current_table().add_child_element(ods_context->drawing_context().end_drawing());
} }
void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing) void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
{ {
if (!oox_drawing)return; if (!oox_drawing)return;
xlsx_current_drawing = oox_drawing;
for (long dr = 0 ; dr < oox_drawing->m_arrItems.GetSize(); dr++) for (long dr = 0 ; dr < oox_drawing->m_arrItems.GetSize(); dr++)
{ {
...@@ -994,4 +1002,72 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, std::wstring ...@@ -994,4 +1002,72 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, std::wstring
{ {
} }
void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
{
if (!oox_picture)return;
//std::wstring name;
//if (oox_picture->m_oNvPicPr.IsInit())
//{
// //OOX::Drawing::CNonVisualPictureProperties m_oCNvPicPr;
// //OOX::Drawing::CNonVisualDrawingProps m_oCNvPr;
//
// //
// if(oox_picture->m_oNvPicPr->m_oCNvPr.IsInit())
// {
// name = string2std_string(oox_picture->m_oNvPicPr->m_oCNvPr->m_sName.get());
// //nullable<CString> m_sDescr;
// //nullable<SimpleTypes::COnOff<>> m_oHidden;
// //nullable<SimpleTypes::CDrawingElementId<>> m_oId;
// //nullable<CString> m_sTitle;
// }
// if (oox_picture->m_oCNvPicPr.IsInit() && oox_picture->m_oCNvPicPr->m_oPicLocks.IsInit())
// {
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoChangeAspect.IsInit())
// {
// }
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoCrop.IsInit())
// {
// }
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoResize.IsInit())
// {
// }
// }
//
//}
//if (oox_picture->m_oSpPr.IsInit())
//{
//}
CString pathImage;
int type = 1;
if (oox_picture->m_oBlipFill.IsInit())
{
if (oox_picture->m_oBlipFill->m_oBlip.IsInit())
{
CString sID = oox_picture->m_oBlipFill->m_oBlip->m_oEmbed.GetValue();
smart_ptr<OOX::File> oFile = xlsx_current_drawing->Find(sID);
if (oFile.IsInit() && OOX::Spreadsheet::FileTypes::Image == oFile->type())
{
OOX::Spreadsheet::Image* pImage = (OOX::Spreadsheet::Image*)oFile.operator->();
pathImage = pImage->filename().GetPath();
}
}
if (oox_picture->m_oBlipFill->m_oTile.IsInit())
type=2;//
if (oox_picture->m_oBlipFill->m_oSrcRect.IsInit())
{
//set client rect // m_oB; m_oL; m_oR; m_oT;
}
}
ods_context->drawing_context().start_image(string2std_string(pathImage));
ods_context->drawing_context().end_image();
}
} // namespace Docx2Odt } // namespace Docx2Odt
\ No newline at end of file
...@@ -57,6 +57,7 @@ namespace Oox2Odf ...@@ -57,6 +57,7 @@ namespace Oox2Odf
private: private:
OOX::Spreadsheet::CXlsx *xlsx_document; OOX::Spreadsheet::CXlsx *xlsx_document;
odf::package::odf_document *output_document; odf::package::odf_document *output_document;
OOX::Spreadsheet::CDrawing *xlsx_current_drawing; // ..
odf::ods_conversion_context *ods_context; odf::ods_conversion_context *ods_context;
...@@ -101,5 +102,7 @@ namespace Oox2Odf ...@@ -101,5 +102,7 @@ namespace Oox2Odf
void convert_sharing_string(int number); void convert_sharing_string(int number);
void convert(OOX::Spreadsheet::CFromTo* oox_from_to, std::wstring & odf_ref, int & col, int & row); void convert(OOX::Spreadsheet::CFromTo* oox_from_to, std::wstring & odf_ref, int & col, int & row);
void convert(OOX::Spreadsheet::CPic* oox_picture);
}; };
} }
\ No newline at end of file
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include "../Common/SimpleTypes_Shared.h" #include "../Common/SimpleTypes_Shared.h"
#include "../DocxFormat/Rels.h" #include "../DocxFormat/Rels.h"
#include "../DocxFormat/Drawing/DrawingCoreInfo.h"
#include "../DocxFormat/Drawing/DrawingEffects.h"
#include "ComplexTypes_Spreadsheet.h" #include "ComplexTypes_Spreadsheet.h"
#include "FileTypes_Spreadsheet.h" #include "FileTypes_Spreadsheet.h"
#include "WritingElement.h" #include "WritingElement.h"
......
...@@ -96,7 +96,9 @@ namespace OOX ...@@ -96,7 +96,9 @@ namespace OOX
m_oExt = oReader; m_oExt = oReader;
else if ( _T("xdr:graphicFrame") == sName ) else if ( _T("xdr:graphicFrame") == sName )
m_oGraphicFrame = oReader; m_oGraphicFrame = oReader;
else if ( _T("xdr:pic") == sName || _T("xdr:sp") == sName || _T("xdr:grpSp") == sName || _T("xdr:cxnSp") == sName || _T("mc:AlternateContent") == sName) else if (_T("xdr:pic") == sName )
m_oPicture = oReader;
else if (_T("xdr:sp") == sName || _T("xdr:grpSp") == sName || _T("xdr:cxnSp") == sName || _T("mc:AlternateContent") == sName)
m_oXml = oReader.GetOuterXml(); m_oXml = oReader.GetOuterXml();
} }
} }
...@@ -134,6 +136,7 @@ namespace OOX ...@@ -134,6 +136,7 @@ namespace OOX
nullable<OOX::Spreadsheet::CPos> m_oPos; nullable<OOX::Spreadsheet::CPos> m_oPos;
nullable<OOX::Spreadsheet::CExt> m_oExt; nullable<OOX::Spreadsheet::CExt> m_oExt;
nullable<OOX::Spreadsheet::CGraphicFrame> m_oGraphicFrame; nullable<OOX::Spreadsheet::CGraphicFrame> m_oGraphicFrame;
nullable<OOX::Spreadsheet::CPic> m_oPicture;
nullable<CString> m_oXml; nullable<CString> m_oXml;
}; };
} //Spreadsheet } //Spreadsheet
......
...@@ -6,53 +6,10 @@ ...@@ -6,53 +6,10 @@
namespace OOX namespace OOX
{ {
namespace Spreadsheet using namespace Drawing;
{
class CBlip : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CBlip)
CBlip()
{
}
virtual ~CBlip()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_Blip;
}
private: namespace Spreadsheet
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{ {
//
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:embed"), m_oEmbed )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CRelationshipId> m_oEmbed;
};
class CBlipFill : public WritingElement class CBlipFill : public WritingElement
{ {
public: public:
...@@ -86,6 +43,12 @@ namespace OOX ...@@ -86,6 +43,12 @@ namespace OOX
if ( _T("a:blip") == sName ) if ( _T("a:blip") == sName )
m_oBlip = oReader; m_oBlip = oReader;
else if ( _T("a:srcRect") == sName )
m_oSrcRect = oReader;
else if ( _T("a:stretch") == sName )
m_oStretch = oReader;
else if ( _T("a:tile") == sName )
m_oTile = oReader;
} }
} }
...@@ -97,9 +60,20 @@ namespace OOX ...@@ -97,9 +60,20 @@ namespace OOX
private: private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dpi"), m_oDpi )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), m_oRotWithShape )
WritingElement_ReadAttributes_End( oReader )
} }
public: public:
// Attributes
nullable<SimpleTypes::CDecimalNumber<>> m_oDpi;
nullable<SimpleTypes::COnOff<>> m_oRotWithShape;
// Childs
nullable<CBlip> m_oBlip; nullable<CBlip> m_oBlip;
nullable<OOX::Drawing::CRelativeRect> m_oSrcRect;
nullable<OOX::Drawing::CTileInfoProperties> m_oTile;
nullable<OOX::Drawing::CStretchInfoProperties> m_oStretch;
}; };
class CPic : public WritingElement class CPic : public WritingElement
{ {
...@@ -119,9 +93,10 @@ namespace OOX ...@@ -119,9 +93,10 @@ namespace OOX
} }
virtual void toXML(XmlUtils::CStringWriter& writer) const virtual void toXML(XmlUtils::CStringWriter& writer) const
{ {
if(m_oBlipFill.IsInit() && m_oBlipFill->m_oBlip.IsInit() && m_oBlipFill->m_oBlip->m_oEmbed.IsInit()) if(m_oBlipFill.IsInit() && m_oBlipFill->m_oBlip.IsInit())
{ {
CString sRes;sRes.Format(_T("<xdr:pic><xdr:nvPicPr><xdr:cNvPr id=\"1\" name=\"image\"/><xdr:cNvPicPr><a:picLocks noChangeAspect=\"1\"/></xdr:cNvPicPr></xdr:nvPicPr><xdr:blipFill><a:blip xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:embed=\"%s\" cstate=\"print\"><a:extLst><a:ext uri=\"{28A0092B-C50C-407E-A947-70E740481C1C}\"><a14:useLocalDpi xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" val=\"0\"/></a:ext></a:extLst></a:blip><a:stretch><a:fillRect/></a:stretch></xdr:blipFill><xdr:spPr><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></xdr:spPr></xdr:pic><xdr:clientData/>"), m_oBlipFill->m_oBlip->m_oEmbed->GetValue()); CString sRes;
sRes.Format(_T("<xdr:pic><xdr:nvPicPr><xdr:cNvPr id=\"1\" name=\"image\"/><xdr:cNvPicPr><a:picLocks noChangeAspect=\"1\"/></xdr:cNvPicPr></xdr:nvPicPr><xdr:blipFill><a:blip xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:embed=\"%s\" cstate=\"print\"><a:extLst><a:ext uri=\"{28A0092B-C50C-407E-A947-70E740481C1C}\"><a14:useLocalDpi xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" val=\"0\"/></a:ext></a:extLst></a:blip><a:stretch><a:fillRect/></a:stretch></xdr:blipFill><xdr:spPr><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></xdr:spPr></xdr:pic><xdr:clientData/>"), m_oBlipFill->m_oBlip->m_oEmbed.GetValue());
writer.WriteString(sRes); writer.WriteString(sRes);
} }
} }
...@@ -139,6 +114,10 @@ namespace OOX ...@@ -139,6 +114,10 @@ namespace OOX
if ( _T("xdr:blipFill") == sName ) if ( _T("xdr:blipFill") == sName )
m_oBlipFill = oReader; m_oBlipFill = oReader;
//if ( _T("xdr:nvPicPr") == sName )
// m_oBlipFill = oReader;
//if ( _T("xdr:spPr") == sName )
// m_oBlipFill = oReader;
} }
} }
...@@ -153,6 +132,8 @@ namespace OOX ...@@ -153,6 +132,8 @@ namespace OOX
} }
public: public:
nullable<CBlipFill> m_oBlipFill; nullable<CBlipFill> m_oBlipFill;
//CNonVisualPictureProperties m_oCNvPicPr;
//CNonVisualDrawingProps m_oCSpPr;
}; };
} //Spreadsheet } //Spreadsheet
} // namespace OOX } // namespace OOX
......
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