Commit 3d525eef authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

XlsFormat - wordart (пока как текст в текстбоксе)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@67695 954022d7-b5bf-4e40-9824-e11837661b57
parent 75984f1f
...@@ -66,25 +66,31 @@ OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record) ...@@ -66,25 +66,31 @@ OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record)
case 0x007F: case 0x007F:
fopte = OfficeArtFOPTEPtr(new ProtectionBooleanProperties); fopte = OfficeArtFOPTEPtr(new ProtectionBooleanProperties);
break; break;
/*todo*/case 0x0080://lTxid case NSOfficeDrawing::lTxid:
case 0x0081://dxTextLeft case NSOfficeDrawing::dxTextLeft:
case 0x0082://dyTextTop case NSOfficeDrawing::dyTextTop:
case 0x0083://dxTextRight case NSOfficeDrawing::dxTextRight:
case 0x0084://dyTextBottom case NSOfficeDrawing::dyTextBottom:
case 0x0085://WrapText case NSOfficeDrawing::WrapText:
case 0x0086://unused134 case NSOfficeDrawing::anchorText:
case 0x0087://anchorText case NSOfficeDrawing::txflTextFlow:
case 0x0088://txflTextFlow case NSOfficeDrawing::cdirFont:
case 0x0089://cdirFont case NSOfficeDrawing::hspNext:
case 0x008a://hspNext case NSOfficeDrawing::txdir:
case 0x008b://txdir case NSOfficeDrawing::gtextRTF:
case 0x008c://unused140 case NSOfficeDrawing::gtextAlign:
case 0x008d://unused141 case NSOfficeDrawing::gtextSize:
case NSOfficeDrawing::gtextSpacing:
case NSOfficeDrawing::gtextFont:
case NSOfficeDrawing::gtextCSSFont:
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE); fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);
break; break;
case 0x00BF: case NSOfficeDrawing::fFitTextToShape:
fopte = OfficeArtFOPTEPtr(new TextBooleanProperties); fopte = OfficeArtFOPTEPtr(new TextBooleanProperties);
break; break;
case NSOfficeDrawing::gtextUNICODE:
fopte = OfficeArtFOPTEPtr(new anyString);
break;
case 0x0100: case 0x0100:
fopte = OfficeArtFOPTEPtr(new cropFromTop); fopte = OfficeArtFOPTEPtr(new cropFromTop);
break; break;
...@@ -402,6 +408,16 @@ void anyString::ReadComplexData(XLS::CFRecord& record) ...@@ -402,6 +408,16 @@ void anyString::ReadComplexData(XLS::CFRecord& record)
#else #else
string_ = XLS::convertUtf16ToWString(record.getCurData<UTF16>(), op); string_ = XLS::convertUtf16ToWString(record.getCurData<UTF16>(), op);
#endif #endif
if (!string_.empty())
{
int i, length = min(op, string_.length());
for (i = 0; i < length; i++)
{
if (string_.at(i) < 14 ) break;
}
string_ = string_.substr(0, i);
}
record.skipNunBytes(op); record.skipNunBytes(op);
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "MSO_enums.h" #include "MSO_enums.h"
#include <Logic/Biff_structures/HyperlinkObject.h> #include <Logic/Biff_structures/HyperlinkObject.h>
#include "../../../ascofficepptxfile/editor/drawing/shapes/baseshape/pptshape/enums.h"
namespace XLS namespace XLS
{ {
class CFRecord; class CFRecord;
......
...@@ -814,7 +814,7 @@ void XlsConverter::convert_fill_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr ...@@ -814,7 +814,7 @@ void XlsConverter::convert_fill_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
ODRAW::FillStyleBooleanProperties * fill = (ODRAW::FillStyleBooleanProperties *)(props[i].get()); ODRAW::FillStyleBooleanProperties * fill = (ODRAW::FillStyleBooleanProperties *)(props[i].get());
if (fill) if (fill)
{ {
if (fill->fFilled == false) if (fill->fUsefFilled && fill->fFilled == false)
xlsx_context->get_drawing_context().set_fill_type(0); xlsx_context->get_drawing_context().set_fill_type(0);
} }
}break; }break;
...@@ -1000,10 +1000,101 @@ void XlsConverter::convert_geometry_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & ...@@ -1000,10 +1000,101 @@ void XlsConverter::convert_geometry_text(std::vector<ODRAW::OfficeArtFOPTEPtr> &
{ {
for (int i = 0 ; i < props.size() ; i++) for (int i = 0 ; i < props.size() ; i++)
{ {
switch(props[i]->opid)
{
case NSOfficeDrawing::gtextUNICODE://word art text
{
ODRAW::anyString *str = dynamic_cast<ODRAW::anyString*>(props[i].get());
xlsx_context->get_drawing_context().set_wordart_text(str->string_);
}break;
case NSOfficeDrawing::gtextFont:
{
ODRAW::anyString *str = dynamic_cast<ODRAW::anyString*>(props[i].get());
//xlsx_context->get_drawing_context().set_text_font(str->string_);
}break;
case NSOfficeDrawing::gtextSize:
//xlsx_context->get_drawing_context().set_text_font_size((INT)((props[i]->op >> 16) & 0x0000FFFF));
break;
case NSOfficeDrawing::gtextAlign:
{
//switch (props[i]->op)
//{
//case NSOfficeDrawing::alignTextLeft:
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 0; break;
//case NSOfficeDrawing::alignTextCenter:
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1; break;
//case NSOfficeDrawing::alignTextRight:
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 2; break;
//default:
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
//}
}break;
}
} }
} }
void XlsConverter::convert_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & props) void XlsConverter::convert_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{ {
for (int i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
case NSOfficeDrawing::lTxid:
break;
case NSOfficeDrawing::dxTextLeft:
//pParentShape->m_dTextMarginX = (double)pProperty->m_lValue / EMU_MM; break;
case NSOfficeDrawing::dxTextRight:
//pParentShape->m_dTextMarginRight = (double)pProperty->m_lValue / EMU_MM; break;
case NSOfficeDrawing::dyTextTop:
//pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM; break;
case NSOfficeDrawing::dyTextBottom:
//pParentShape->m_dTextMarginBottom = (double)pProperty->m_lValue / EMU_MM; break;
case NSOfficeDrawing::WrapText:
{
int lWrapMode = props[i]->op;
}break;
case NSOfficeDrawing::anchorText:
{
//switch (props[i]->op)
//{
//case NSOfficeDrawing::anchorTop:
//case NSOfficeDrawing::anchorTopBaseline:
// pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 0; break;
//case NSOfficeDrawing::anchorMiddle:
// pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 1; break;
//
//case NSOfficeDrawing::anchorBottom:
//case NSOfficeDrawing::anchorBottomBaseline:
// {
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 0;
// pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 2;
// }break;
//case NSOfficeDrawing::anchorTopCentered:
//case NSOfficeDrawing::anchorTopCenteredBaseline:
// {
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
// pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 0;
// }break;
//case NSOfficeDrawing::anchorMiddleCentered:
// {
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
// pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 1;
// }break;
//case NSOfficeDrawing::anchorBottomCentered:
//case NSOfficeDrawing::anchorBottomCenteredBaseline:
// {
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
// pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 2;
// }break;
//default:
// {
// pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
// pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = -1; // not set
// }break;
//}
}break;
}
}
} }
void XlsConverter::convert_shadow(std::vector<ODRAW::OfficeArtFOPTEPtr> & props) void XlsConverter::convert_shadow(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{ {
......
...@@ -1124,12 +1124,12 @@ void xlsx_drawing_context::set_fill_color (int index, int type, bool background) ...@@ -1124,12 +1124,12 @@ void xlsx_drawing_context::set_fill_color (int index, int type, bool background)
} }
else else
{ {
// color.index = index; if (index < 64)
// color.sRGB = L""; {
// color.bScheme = true; color.nRGB = shemeDefaultColor[index];
color.nRGB = shemeDefaultColor[index]; color.sRGB = STR::toRGB(color.nRGB);
}
color.index = -1; color.index = -1;
color.sRGB = STR::toRGB(color.nRGB);
} }
if (background) current_drawing_states->back()->fill.color2 = color; if (background) current_drawing_states->back()->fill.color2 = color;
...@@ -1243,6 +1243,28 @@ void xlsx_drawing_context::set_path (const std::wstring & path) ...@@ -1243,6 +1243,28 @@ void xlsx_drawing_context::set_path (const std::wstring & path)
current_drawing_states->back()->path = path; current_drawing_states->back()->path = path;
} }
void xlsx_drawing_context::set_wordart_text(const std::wstring & text)
{
if (current_drawing_states == NULL) return;
std::wstringstream strm;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:r")
{
//Fmt = run->formatRun.ifnt;
//serialize_rPr(CP_XML_STREAM(), Fmt );
CP_XML_NODE(L"a:t")
{
CP_XML_STREAM() << xml::utils::replace_text_to_xml(text);
}
}
}
set_text(strm.str());
}
void xlsx_drawing_context::set_text (const std::wstring & text) void xlsx_drawing_context::set_text (const std::wstring & text)
{ {
if (current_drawing_states == NULL) return; if (current_drawing_states == NULL) return;
......
...@@ -238,6 +238,7 @@ public: ...@@ -238,6 +238,7 @@ public:
void set_path (const std::wstring & path); void set_path (const std::wstring & path);
void set_text (const std::wstring & text); void set_text (const std::wstring & text);
void set_wordart_text(const std::wstring & text);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void serialize_shape (_drawing_state_ptr & drawing_state); void serialize_shape (_drawing_state_ptr & drawing_state);
......
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