Commit 48185ed4 authored by ElenaSubbotina's avatar ElenaSubbotina

DocxFormat - fix vml single geom position

RtfFormat - read/write background page (solid, pattern, gradient, image)
parent 7bea0867
...@@ -63,8 +63,7 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type) ...@@ -63,8 +63,7 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
if (odf_context()->drawing_context()->m_mapVmlShapeTypes.find( sId ) == if (odf_context()->drawing_context()->m_mapVmlShapeTypes.find( sId ) ==
odf_context()->drawing_context()->m_mapVmlShapeTypes.end()) odf_context()->drawing_context()->m_mapVmlShapeTypes.end())
{ {
odf_context()->drawing_context()->m_mapVmlShapeTypes.insert(odf_context()->drawing_context()->m_mapVmlShapeTypes.begin(), odf_context()->drawing_context()->m_mapVmlShapeTypes.insert(std::make_pair(sId, vml_shape_type));
std::pair<std::wstring, OOX::Vml::CShapeType*>(sId, vml_shape_type));
} }
} }
......
...@@ -1676,13 +1676,6 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type) ...@@ -1676,13 +1676,6 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
{ {
if (oox_background == NULL) return; if (oox_background == NULL) return;
if (oox_background->m_oDrawing.IsInit())
{
//подложка
}
else
{
//цветовая подложка
_CP_OPT(odf_types::color) color; _CP_OPT(odf_types::color) color;
convert ( oox_background->m_oColor.GetPointer(), convert ( oox_background->m_oColor.GetPointer(),
oox_background->m_oThemeColor.GetPointer(), oox_background->m_oThemeColor.GetPointer(),
...@@ -1690,6 +1683,14 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type) ...@@ -1690,6 +1683,14 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
oox_background->m_oThemeShade.GetPointer(), color); oox_background->m_oThemeShade.GetPointer(), color);
odt_context->set_background(color, type); odt_context->set_background(color, type);
if (oox_background->m_oDrawing.IsInit())
{
convert(oox_background->m_oDrawing.GetPointer());
}
else if (oox_background->m_oBackground.IsInit())
{
convert(oox_background->m_oBackground.GetPointer());
} }
} }
......
...@@ -38,6 +38,8 @@ class OOXReader; ...@@ -38,6 +38,8 @@ class OOXReader;
class RtfWriter; class RtfWriter;
class RtfReader; class RtfReader;
namespace OOX { namespace Vml { class CShapeType; } }
class RtfConvertationManager class RtfConvertationManager
{ {
public: public:
...@@ -58,6 +60,7 @@ public: ...@@ -58,6 +60,7 @@ public:
void OnCompleteItemRtf(); void OnCompleteItemRtf();
void OnCompleteItemOOX(); void OnCompleteItemOOX();
private: private:
OOXWriter* m_poOOXWriter; OOXWriter* m_poOOXWriter;
OOXReader* m_poOOXReader; OOXReader* m_poOOXReader;
......
...@@ -309,6 +309,15 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader ...@@ -309,6 +309,15 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
RtfInfoReader oInfoReader; RtfInfoReader oInfoReader;
return StartSubReader( oInfoReader, oDocument, oReader ); return StartSubReader( oInfoReader, oDocument, oReader );
} }
else if ( "background" == sCommand )
{
oDocument.m_pBackground = RtfShapePtr( new RtfShape() );
oDocument.m_pBackground->m_bBackground = true;
RtfBackgroundReader oBackgroundReader( *oDocument.m_pBackground );
return StartSubReader( oBackgroundReader, oDocument, oReader );
}
//else if ( "colorschememapping" == sCommand ) //else if ( "colorschememapping" == sCommand )
//{ //{
// RtfColorSchemeReader oSchemeReader; // RtfColorSchemeReader oSchemeReader;
......
...@@ -983,7 +983,31 @@ public: ...@@ -983,7 +983,31 @@ public:
return true; return true;
} }
}; };
class RtfBackgroundReader : public RtfShapeReader
{
public:
RtfShape& m_oShape;
RtfBackgroundReader( RtfShape& oShape ) : RtfShapeReader(oShape), m_oShape(oShape)
{
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
{
if( "background" == sCommand )
{
return true;
}
else if( "shp" == sCommand )
{
RtfShapeReader oShapeReader( m_oShape );
StartSubReader( oShapeReader, oDocument, oReader );
}
else
return RtfShapeReader::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter);
return true;
}
};
class RtfOldShapeReader : public RtfAbstractReader class RtfOldShapeReader : public RtfAbstractReader
{ {
private: private:
......
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
*/ */
#pragma once #pragma once
#include "OOXShapeReader.h"
#include "OOXTextItemReader.h" #include "OOXTextItemReader.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Document.h" #include "../../../../Common/DocxFormat/Source/DocxFormat/Document.h"
class OOXDocumentReader class OOXDocumentReader
...@@ -59,6 +61,13 @@ public: ...@@ -59,6 +61,13 @@ public:
m_poReader = oParam.oReader; m_poReader = oParam.oReader;
m_poDocument = oParam.oRtf; m_poDocument = oParam.oRtf;
if ( m_ooxDocument->m_oBackground.IsInit())
{
m_poDocument->m_pBackground = RtfShapePtr(new RtfShape());
OOXBackgroundReader oBackgroundReader(m_ooxDocument->m_oBackground.GetPointer());
oBackgroundReader.Parse( oParam, m_poDocument->m_pBackground);
}
int last_section_start = 0; int last_section_start = 0;
//считаем количесво секций и заполняем их свойства .. //считаем количесво секций и заполняем их свойства ..
......
...@@ -745,17 +745,24 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap ...@@ -745,17 +745,24 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
RtfShapePtr pNewShape ( new RtfShape() ); RtfShapePtr pNewShape ( new RtfShape() );
pNewShape->m_oCharProperty = oNewProperty; pNewShape->m_oCharProperty = oNewProperty;
OOXShapeReader *pShapeReader = NULL; OOXShapeReader* pShapeReader = NULL;
if (ooxPicture->m_oShapeType.IsInit())
if (ooxPicture->m_oShape.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShape.GetPointer()); {
else if (ooxPicture->m_oShapeType.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeType.GetPointer()); pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeType.GetPointer());
else if (ooxPicture->m_oShapeArc.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeArc.GetPointer()); if(pShapeReader)
{
pShapeReader->Parse( oParam, pNewShape );
delete pShapeReader; pShapeReader = NULL;
}
}
if (ooxPicture->m_oShapeArc.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeArc.GetPointer());
else if (ooxPicture->m_oShapeRect.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeRect.GetPointer()); else if (ooxPicture->m_oShapeRect.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeRect.GetPointer());
else if (ooxPicture->m_oShapeRoundRect.IsInit())pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeRoundRect.GetPointer()); else if (ooxPicture->m_oShapeRoundRect.IsInit())pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeRoundRect.GetPointer());
else if (ooxPicture->m_oShapeOval.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeOval.GetPointer()); else if (ooxPicture->m_oShapeOval.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeOval.GetPointer());
else if (ooxPicture->m_oShapeLine.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeLine.GetPointer()); else if (ooxPicture->m_oShapeLine.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeLine.GetPointer());
else if (ooxPicture->m_oShapePolyLine.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapePolyLine.GetPointer()); else if (ooxPicture->m_oShapePolyLine.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapePolyLine.GetPointer());
else if (ooxPicture->m_oShapeCurve.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeCurve.GetPointer()); else if (ooxPicture->m_oShapeCurve.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeCurve.GetPointer());
else if (ooxPicture->m_oShape.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShape.GetPointer());
if (pShapeReader) if (pShapeReader)
{ {
......
...@@ -249,7 +249,7 @@ bool ParseStyle(RtfShape* pShape, SimpleTypes::Vml::CCssProperty* prop) ...@@ -249,7 +249,7 @@ bool ParseStyle(RtfShape* pShape, SimpleTypes::Vml::CCssProperty* prop)
} }
OOXShapeReader::OOXShapeReader(OOX::WritingElementWithChilds<OOX::WritingElement> * elem) OOXShapeReader::OOXShapeReader(OOX::WritingElementWithChilds<OOX::WritingElement> * elem)
{ {
m_arrElement = elem; m_arrElement = elem;
...@@ -328,7 +328,7 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput) ...@@ -328,7 +328,7 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
case SimpleTypes::filltypeFrame : oOutput->m_nFillType = 3; break; case SimpleTypes::filltypeFrame : oOutput->m_nFillType = 3; break;
case SimpleTypes::filltypeGradient: oOutput->m_nFillType = 4; break; case SimpleTypes::filltypeGradient: oOutput->m_nFillType = 4; break;
case SimpleTypes::filltypeGradientCenter: oOutput->m_nFillType = 4; break; case SimpleTypes::filltypeGradientCenter: oOutput->m_nFillType = 4; break;
case SimpleTypes::filltypeGradientRadial: oOutput->m_nFillType = 4; break; case SimpleTypes::filltypeGradientRadial: oOutput->m_nFillType = 6; break;
case SimpleTypes::filltypeGradientUnscaled: oOutput->m_nFillType = 4; break; case SimpleTypes::filltypeGradientUnscaled: oOutput->m_nFillType = 4; break;
case SimpleTypes::filltypePattern: oOutput->m_nFillType = 1; break; case SimpleTypes::filltypePattern: oOutput->m_nFillType = 1; break;
case SimpleTypes::filltypeTile: oOutput->m_nFillType = 2; break; case SimpleTypes::filltypeTile: oOutput->m_nFillType = 2; break;
...@@ -346,6 +346,21 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput) ...@@ -346,6 +346,21 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
{ {
oOutput->m_nFillFocus = fill->m_oFocus->GetValue(); oOutput->m_nFillFocus = fill->m_oFocus->GetValue();
} }
if (fill->m_oFocusPosition.IsInit())
{
if (fill->m_oFocusPosition->GetY() > 0.99 || fill->m_oFocusPosition->GetX() > 0.99)
oOutput->m_nFillType = 5;
int toBottom = (1. - fill->m_oFocusPosition->GetY()) * 65535;
int toTop = (fill->m_oFocusPosition->GetY()) * 65535;
int toRight = (1. - fill->m_oFocusPosition->GetX()) * 65535;
int toLeft = (fill->m_oFocusPosition->GetX()) * 65535;
if (toBottom > 0) oOutput->m_nFillToBottom = toBottom;
if (toTop > 0) oOutput->m_nFillToTop = toTop;
if (toRight > 0) oOutput->m_nFillToRight = toRight;
if (toLeft > 0) oOutput->m_nFillToLeft = toLeft;
}
}break; }break;
case OOX::et_v_stroke: case OOX::et_v_stroke:
{ {
...@@ -825,3 +840,58 @@ void OOXShapeReader::ParseAdjustment(RtfShape& oShape, std::wstring sAdjustment) ...@@ -825,3 +840,58 @@ void OOXShapeReader::ParseAdjustment(RtfShape& oShape, std::wstring sAdjustment)
} }
} }
} }
bool OOXBackgroundReader::Parse( ReaderParameter oParam , RtfShapePtr& oOutput)
{
if (!m_ooxBackground) return false;
oOutput->m_nShapeType = 1;
oOutput->m_bBackground = true;
oOutput->m_bFilled = true;
if (m_ooxBackground->m_oColor.IsInit() && m_ooxBackground->m_oColor->GetValue() == SimpleTypes::hexcolorRGB)
{
unsigned char ucR = m_ooxBackground->m_oColor->Get_R();
unsigned char ucB = m_ooxBackground->m_oColor->Get_B();
unsigned char ucG = m_ooxBackground->m_oColor->Get_G();
unsigned char ucA = m_ooxBackground->m_oColor->Get_A();
oOutput->m_nFillColor = RGB(ucR, ucG , ucB);
if (ucA != 0xff)
oOutput->m_nFillOpacity = ucA / 255. * 100;
}
else if (m_ooxBackground->m_oThemeColor.IsInit())
{
//nullable<SimpleTypes::CUcharHexNumber<> > m_oThemeShade;
//nullable<SimpleTypes::CUcharHexNumber<> > m_oThemeTint;
}
if (m_ooxBackground->m_oBackground.IsInit())
{
OOXShapeReader sub_reader(m_ooxBackground->m_oBackground.GetPointer());
sub_reader.Parse(oParam, oOutput);
}
else if (m_ooxBackground->m_oDrawing.IsInit())
{
OOXDrawingReader oDrawingReader(m_ooxBackground->m_oDrawing.GetPointer());
if( false == oDrawingReader.Parse( oParam, *oOutput ) )
{
if (!m_ooxBackground->m_oDrawing->m_sXml.IsInit())
{
OOXDrawingGraphicReader oGraphiceReader(*m_ooxBackground->m_oDrawing->m_sXml);
OOX::Logic::CPicture *ooxPicture = oGraphiceReader.Parse( oParam, *oOutput );
if (ooxPicture)
{
OOXShapeReader sub_reader(ooxPicture);
sub_reader.Parse(oParam, oOutput);
delete ooxPicture;
}
}
}
}
return true;
}
...@@ -69,7 +69,6 @@ private: ...@@ -69,7 +69,6 @@ private:
} }
}; };
class OOXShapeGroupReader class OOXShapeGroupReader
{ {
private: private:
...@@ -91,3 +90,16 @@ public: ...@@ -91,3 +90,16 @@ public:
bool Parse( ReaderParameter oParam , RtfShapeGroupPtr& oOutput); bool Parse( ReaderParameter oParam , RtfShapeGroupPtr& oOutput);
}; };
class OOXBackgroundReader
{
private:
OOX::Logic::CBackground *m_ooxBackground;
public:
OOXBackgroundReader(OOX::Logic::CBackground *oox_background)
{
m_ooxBackground = oox_background;
}
bool Parse( ReaderParameter oParam , RtfShapePtr& oOutput);
};
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "RtfGlobalTables.h" #include "RtfGlobalTables.h"
#include "RtfSection.h" #include "RtfSection.h"
#include "RtfMath.h" #include "RtfMath.h"
#include "RtfShape.h"
struct _section struct _section
{ {
...@@ -56,6 +57,7 @@ public: ...@@ -56,6 +57,7 @@ public:
RtfStyleTable m_oStyleTable; RtfStyleTable m_oStyleTable;
RtfRevisionTable m_oRevisionTable; RtfRevisionTable m_oRevisionTable;
RtfInformation m_oInformation; RtfInformation m_oInformation;
RtfShapePtr m_pBackground;
RtfListTable m_oListTable; RtfListTable m_oListTable;
RtfListOverrideTable m_oListOverrideTable; RtfListOverrideTable m_oListOverrideTable;
...@@ -80,8 +82,10 @@ public: ...@@ -80,8 +82,10 @@ public:
void SetShapeId( int nShapeId ) void SetShapeId( int nShapeId )
{ {
for( int i = 0; i < (int)m_aShapeId.size(); i++ ) for( int i = 0; i < (int)m_aShapeId.size(); i++ )
{
if( nShapeId == m_aShapeId[i] ) if( nShapeId == m_aShapeId[i] )
return; return;
}
m_aShapeId.push_back( nShapeId ); m_aShapeId.push_back( nShapeId );
} }
int GetShapeId( int& nShapeId ) int GetShapeId( int& nShapeId )
......
...@@ -146,6 +146,10 @@ void RtfShape::SetDefault() ...@@ -146,6 +146,10 @@ void RtfShape::SetDefault()
DEFAULT_PROPERTY( m_nFillOpacity ) DEFAULT_PROPERTY( m_nFillOpacity )
DEFAULT_PROPERTY( m_nFillFocus ) DEFAULT_PROPERTY( m_nFillFocus )
DEFAULT_PROPERTY( m_nFillAngle ) DEFAULT_PROPERTY( m_nFillAngle )
DEFAULT_PROPERTY( m_nFillToBottom )
DEFAULT_PROPERTY( m_nFillToTop )
DEFAULT_PROPERTY( m_nFillToRight )
DEFAULT_PROPERTY( m_nFillToLeft )
//Line //Line
DEFAULT_PROPERTY_DEF( m_bLine, true ) DEFAULT_PROPERTY_DEF( m_bLine, true )
DEFAULT_PROPERTY( m_nLineColor ) DEFAULT_PROPERTY( m_nLineColor )
...@@ -168,7 +172,7 @@ void RtfShape::SetDefault() ...@@ -168,7 +172,7 @@ void RtfShape::SetDefault()
m_aTextItems = TextItemContainerPtr(); m_aTextItems = TextItemContainerPtr();
m_oPicture = RtfPicturePtr(); m_oPicture = RtfPicturePtr();
m_bBackground = false;
m_bIsOle = false; m_bIsOle = false;
m_bInGroup = false; m_bInGroup = false;
...@@ -234,6 +238,9 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter) ...@@ -234,6 +238,9 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
} }
else else
{ {
if (m_bBackground)
sResult += L"{\\*\\background";
sResult += L"{\\shp"; sResult += L"{\\shp";
sResult += L"{\\*\\shpinst"; sResult += L"{\\*\\shpinst";
...@@ -281,7 +288,7 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter) ...@@ -281,7 +288,7 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
sResult += L"{\\sp{\\sn fLockRotation}{\\sv 1}}"; sResult += L"{\\sp{\\sn fLockRotation}{\\sv 1}}";
//picture //picture
if( 0 != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 9) if( 0 != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 3 || m_nFillType == 9)
{ {
sResult += L"{\\sp{\\sn fillBlip}{\\sv "; sResult += L"{\\sp{\\sn fillBlip}{\\sv ";
sResult += m_oPicture->RenderToRtf( oRenderParameter ); sResult += m_oPicture->RenderToRtf( oRenderParameter );
...@@ -296,6 +303,9 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter) ...@@ -296,6 +303,9 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
} }
sResult += L"}"; sResult += L"}";
sResult += L"}"; sResult += L"}";
if (m_bBackground)
sResult += L"}";
} }
} }
else // anchor else // anchor
...@@ -419,6 +429,7 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter ...@@ -419,6 +429,7 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
RENDER_RTF_SHAPE_PROP(L"shapeType", sResult, m_nShapeType); RENDER_RTF_SHAPE_PROP(L"shapeType", sResult, m_nShapeType);
RENDER_RTF_SHAPE_PROP(L"fBehindDocument",sResult, m_nZOrderRelative); RENDER_RTF_SHAPE_PROP(L"fBehindDocument",sResult, m_nZOrderRelative);
RENDER_RTF_SHAPE_PROP(L"fHidden", sResult, m_bHidden); RENDER_RTF_SHAPE_PROP(L"fHidden", sResult, m_bHidden);
RENDER_RTF_SHAPE_PROP(L"fBackground", sResult, m_bBackground);
//Text //Text
//sResult += L"{\\sp{\\sn fLockText}{\\sv 0}}"; //sResult += L"{\\sp{\\sn fLockText}{\\sv 0}}";
...@@ -507,7 +518,12 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter ...@@ -507,7 +518,12 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
if (PROP_DEF != m_nFillAngle) if (PROP_DEF != m_nFillAngle)
RENDER_RTF_SHAPE_PROP(L"fillAngle", sResult, m_nFillAngle * 65536 ); RENDER_RTF_SHAPE_PROP(L"fillAngle", sResult, m_nFillAngle * 65536 );
//Line
RENDER_RTF_SHAPE_PROP(L"fillToBottom", sResult, m_nFillToBottom )
RENDER_RTF_SHAPE_PROP(L"fillToTop", sResult, m_nFillToTop )
RENDER_RTF_SHAPE_PROP(L"fillToRight", sResult, m_nFillToRight )
RENDER_RTF_SHAPE_PROP(L"fillToLeft", sResult, m_nFillToLeft )
//Line
if( 0 == m_bLine ) if( 0 == m_bLine )
sResult += L"{\\sp{\\sn fLine}{\\sv 0}}"; sResult += L"{\\sp{\\sn fLine}{\\sv 0}}";
RENDER_RTF_SHAPE_PROP(L"lineColor", sResult, m_nLineColor ); RENDER_RTF_SHAPE_PROP(L"lineColor", sResult, m_nLineColor );
...@@ -642,9 +658,11 @@ std::wstring RtfShape::RenderToOOX(RenderParameter oRenderParameter) ...@@ -642,9 +658,11 @@ std::wstring RtfShape::RenderToOOX(RenderParameter oRenderParameter)
return sResult; return sResult;
} }
std::wstring RtfShape::GetShapeNodeName(int type) std::wstring RtfShape::GetShapeNodeName()
{ {
switch(type) if (m_bBackground) return L"v:background";
switch(m_nShapeType)
{ {
case NSOfficeDrawing::sptRectangle: return L"v:rect"; case NSOfficeDrawing::sptRectangle: return L"v:rect";
case NSOfficeDrawing::sptEllipse: return L"v:oval"; case NSOfficeDrawing::sptEllipse: return L"v:oval";
...@@ -707,7 +725,9 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter) ...@@ -707,7 +725,9 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
} }
if (oRenderParameter.sValue.empty()) if (oRenderParameter.sValue.empty())
oRenderParameter.sValue = GetShapeNodeName(m_nShapeType); {
oRenderParameter.sValue = GetShapeNodeName();
}
sResult += L"<" + oRenderParameter.sValue; sResult += L"<" + oRenderParameter.sValue;
...@@ -1285,7 +1305,9 @@ std::wstring RtfShape::RenderToOOXEnd(RenderParameter oRenderParameter) ...@@ -1285,7 +1305,9 @@ std::wstring RtfShape::RenderToOOXEnd(RenderParameter oRenderParameter)
std::wstring sResult; std::wstring sResult;
if (oRenderParameter.sValue.empty()) if (oRenderParameter.sValue.empty())
oRenderParameter.sValue = GetShapeNodeName(m_nShapeType); {
oRenderParameter.sValue = GetShapeNodeName();
}
sResult += L"</" + oRenderParameter.sValue + L">"; sResult += L"</" + oRenderParameter.sValue + L">";
......
...@@ -39,6 +39,7 @@ private: ...@@ -39,6 +39,7 @@ private:
bool m_bDelete; bool m_bDelete;
public: public:
bool m_bBackground;
bool m_bIsOle; bool m_bIsOle;
bool m_bInGroup; //local anchor bool m_bInGroup; //local anchor
...@@ -166,6 +167,10 @@ public: ...@@ -166,6 +167,10 @@ public:
int m_nFillOpacity; int m_nFillOpacity;
int m_nFillFocus; int m_nFillFocus;
int m_nFillAngle; int m_nFillAngle;
int m_nFillToBottom;
int m_nFillToTop;
int m_nFillToRight;
int m_nFillToLeft;
//int m_bFillShape; //есть копия заливки картинкой //int m_bFillShape; //есть копия заливки картинкой
//Line //Line
int m_bLine; //fLine Has a line int m_bLine; //fLine Has a line
...@@ -251,7 +256,7 @@ public: ...@@ -251,7 +256,7 @@ public:
} }
} }
std::wstring RenderToRtfShapeProperty(RenderParameter oRenderParameter); std::wstring RenderToRtfShapeProperty(RenderParameter oRenderParameter);
std::wstring GetShapeNodeName(int type); std::wstring GetShapeNodeName();
}; };
......
...@@ -274,6 +274,7 @@ int RtfWriter::GetCount() ...@@ -274,6 +274,7 @@ int RtfWriter::GetCount()
std::wstring RtfWriter::CreateRtfStart() std::wstring RtfWriter::CreateRtfStart()
{ {
RenderParameter oRenderParameter; RenderParameter oRenderParameter;
oRenderParameter.poDocument = &m_oDocument; oRenderParameter.poDocument = &m_oDocument;
oRenderParameter.poWriter = this; oRenderParameter.poWriter = this;
oRenderParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN; oRenderParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
...@@ -283,19 +284,27 @@ std::wstring RtfWriter::CreateRtfStart() ...@@ -283,19 +284,27 @@ std::wstring RtfWriter::CreateRtfStart()
sResult += m_oDocument.m_oProperty.RenderToRtf( oRenderParameter ); sResult += m_oDocument.m_oProperty.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oFontTable.RenderToRtf( oRenderParameter ); sResult += m_oDocument.m_oFontTable.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oColorTable.RenderToRtf( oRenderParameter ); sResult += m_oDocument.m_oColorTable.RenderToRtf( oRenderParameter );
//---------- test
std::wstring sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter ); std::wstring sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter );
if( false == sDefCharProp.empty() ) if( false == sDefCharProp.empty() )
sResult += L"{\\*\\defchp " + sDefCharProp + L"}"; sResult += L"{\\*\\defchp " + sDefCharProp + L"}";
std::wstring sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter ); std::wstring sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter );
if( false == sDefParProp.empty() ) if( false == sDefParProp.empty() )
sResult += L"{\\*\\defpap " + sDefParProp+ L"}"; sResult += L"{\\*\\defpap " + sDefParProp+ L"}";
sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter ); sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter );
//---------- test
sResult += m_oDocument.m_oListTable.RenderToRtf ( oRenderParameter ); sResult += m_oDocument.m_oListTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oListOverrideTable.RenderToRtf ( oRenderParameter ); sResult += m_oDocument.m_oListOverrideTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oRevisionTable.RenderToRtf ( oRenderParameter ); sResult += m_oDocument.m_oRevisionTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oInformation.RenderToRtf ( oRenderParameter ); sResult += m_oDocument.m_oInformation.RenderToRtf ( oRenderParameter );
if (m_oDocument.m_pBackground)
{
sResult += m_oDocument.m_pBackground->RenderToRtf ( oRenderParameter );
}
sResult += L"\\fet2";//0 Footnotes only or nothing at all (the default). 1 Endnotes only. 2 Both footnotes and endnotes sResult += L"\\fet2";//0 Footnotes only or nothing at all (the default). 1 Endnotes only. 2 Both footnotes and endnotes
std::wstring sFootnote; std::wstring sFootnote;
...@@ -323,7 +332,6 @@ std::wstring RtfWriter::CreateRtfStart() ...@@ -323,7 +332,6 @@ std::wstring RtfWriter::CreateRtfStart()
if( !sFootnote.empty() ) if( !sFootnote.empty() )
sResult += L"{\\*\\aftnsepc " + sFootnote + L"}"; sResult += L"{\\*\\aftnsepc " + sFootnote + L"}";
} }
sResult += L"\n\n"; sResult += L"\n\n";
return sResult; return sResult;
} }
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
* *
*/ */
#include "OOXDocumentWriter.h" #include "OOXDocumentWriter.h"
//#include "OOXContentTypesWriter.h"
#include "OOXRelsWriter.h" #include "OOXRelsWriter.h"
#include "OOXDocumentWriter.h" #include "OOXDocumentWriter.h"
#include "OOXNumberingWriter.h" #include "OOXNumberingWriter.h"
...@@ -41,8 +40,6 @@ ...@@ -41,8 +40,6 @@
#include "OOXFootnoteWriter.h" #include "OOXFootnoteWriter.h"
#include "OOXStylesWriter.h" #include "OOXStylesWriter.h"
//#include "../../../../ASCOfficeDocxFile2/BinReader/ContentTypesWriter.h"
std::wstring OOXDocumentWriter::CreateXmlStart() std::wstring OOXDocumentWriter::CreateXmlStart()
{ {
//пишем Footnotes //пишем Footnotes
...@@ -52,22 +49,33 @@ std::wstring OOXDocumentWriter::CreateXmlStart() ...@@ -52,22 +49,33 @@ std::wstring OOXDocumentWriter::CreateXmlStart()
oNewParam.poRels = &m_oWriter.m_oDocRels; oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
//пишем document.xml
std::wstring sResult = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";
sResult += L"<w:document";
sResult += L" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"";
sResult += L" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"";
sResult += L" xmlns:v=\"urn:schemas-microsoft-com:vml\"";
sResult += L" xmlns:o=\"urn:schemas-microsoft-com:office:office\"";
sResult += L" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\"";
sResult += L" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\"";
sResult += L" xmlns:w10=\"urn:schemas-microsoft-com:office:word\"";
sResult += L" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
sResult += L">";
if (m_oDocument.m_pBackground)
{
RtfColor color(m_oDocument.m_pBackground->m_nFillColor);
sResult += L"<w:background w:color=\"" + color.ToHexColor() + L"\">";
{
oNewParam.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2;
sResult += m_oDocument.m_pBackground->RenderToOOX(oNewParam);
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
}
sResult += L"</w:background>";
}
//пишем document.xml sResult += L"<w:body>";
std::wstring sResult = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n");
sResult += _T("<w:document");
sResult += _T(" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"");
sResult += _T(" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"");
sResult += _T(" xmlns:v=\"urn:schemas-microsoft-com:vml\"");
sResult += _T(" xmlns:o=\"urn:schemas-microsoft-com:office:office\"");
sResult += _T(" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\"");
sResult += _T(" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\"");
sResult += _T(" xmlns:w10=\"urn:schemas-microsoft-com:office:word\"");
sResult += _T(" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"");
sResult += _T(">");
sResult += _T("<w:body>");
return sResult; return sResult;
} }
std::wstring OOXDocumentWriter::CreateXmlEnd( ) std::wstring OOXDocumentWriter::CreateXmlEnd( )
...@@ -88,25 +96,25 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( ) ...@@ -88,25 +96,25 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( )
{ {
oNewParam.poRels = poFootnoteWriter->m_oRelsWriter.get(); oNewParam.poRels = poFootnoteWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poFootnoteWriter->AddFootnoteBegin( _T("continuationSeparator"), 1, m_oDocument.m_oFootnoteCon->RenderToOOX( oNewParam ) ); poFootnoteWriter->AddFootnoteBegin( L"continuationSeparator", 1, m_oDocument.m_oFootnoteCon->RenderToOOX( oNewParam ) );
} }
if( NULL != m_oDocument.m_oFootnoteSep ) if( NULL != m_oDocument.m_oFootnoteSep )
{ {
oNewParam.poRels = poFootnoteWriter->m_oRelsWriter.get(); oNewParam.poRels = poFootnoteWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poFootnoteWriter->AddFootnoteBegin( _T("separator"), 0, m_oDocument.m_oFootnoteSep->RenderToOOX(oNewParam) ); poFootnoteWriter->AddFootnoteBegin( L"separator", 0, m_oDocument.m_oFootnoteSep->RenderToOOX(oNewParam) );
} }
if( NULL != m_oDocument.m_oEndnoteCon ) if( NULL != m_oDocument.m_oEndnoteCon )
{ {
oNewParam.poRels = poEndnoteWriter->m_oRelsWriter.get(); oNewParam.poRels = poEndnoteWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poEndnoteWriter->AddEndnoteBegin( _T("continuationSeparator"), 1, m_oDocument.m_oEndnoteSep->RenderToOOX(oNewParam) ); poEndnoteWriter->AddEndnoteBegin( L"continuationSeparator", 1, m_oDocument.m_oEndnoteSep->RenderToOOX(oNewParam) );
} }
if( NULL != m_oDocument.m_oEndnoteSep ) if( NULL != m_oDocument.m_oEndnoteSep )
{ {
oNewParam.poRels = poEndnoteWriter->m_oRelsWriter.get(); oNewParam.poRels = poEndnoteWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poEndnoteWriter->AddEndnoteBegin( _T("separator"), 0, m_oDocument.m_oEndnoteSep->RenderToOOX(oNewParam) ); poEndnoteWriter->AddEndnoteBegin( L"separator", 0, m_oDocument.m_oEndnoteSep->RenderToOOX(oNewParam) );
} }
//fontTable.xml //fontTable.xml
...@@ -142,20 +150,20 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( ) ...@@ -142,20 +150,20 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( )
if( false == sTempParaDef.empty() || false == sTempCharDef.empty() ) if( false == sTempParaDef.empty() || false == sTempCharDef.empty() )
{ {
sStyles += _T("<w:docDefaults>"); sStyles += L"<w:docDefaults>";
if( false == sTempCharDef.empty() ) if( false == sTempCharDef.empty() )
{ {
sStyles += _T("<w:rPrDefault><w:rPr>"); sStyles += L"<w:rPrDefault><w:rPr>";
sStyles += sTempCharDef ; sStyles += sTempCharDef ;
sStyles += _T("</w:rPr></w:rPrDefault>"); sStyles += L"</w:rPr></w:rPrDefault>";
} }
if( false == sTempParaDef.empty() ) if( false == sTempParaDef.empty() )
{ {
sStyles += _T("<w:pPrDefault><w:pPr>"); sStyles += L"<w:pPrDefault><w:pPr>";
sStyles += sTempParaDef; sStyles += sTempParaDef;
sStyles += _T("</w:pPr></w:pPrDefault>"); sStyles += L"</w:pPr></w:pPrDefault>";
} }
sStyles += _T("</w:docDefaults>"); sStyles += L"</w:docDefaults>";
} }
sStyles += m_oDocument.m_oStyleTable.RenderToOOX(oNewParam); sStyles += m_oDocument.m_oStyleTable.RenderToOOX(oNewParam);
...@@ -182,28 +190,28 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( ) ...@@ -182,28 +190,28 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( )
sResult += m_oDocument[0].props->m_oProperty.RenderToOOX(oNewParam); sResult += m_oDocument[0].props->m_oProperty.RenderToOOX(oNewParam);
sResult += _T("</w:body>"); sResult += L"</w:body>";
sResult += _T("</w:document>"); sResult += L"</w:document>";
return sResult; return sResult;
} }
bool OOXDocumentWriter::SaveByItemStart( std::wstring sFolder ) bool OOXDocumentWriter::SaveByItemStart( std::wstring sFolder )
{ {
std::wstring pathWord = sFolder + FILE_SEPARATOR_STR + _T("word"); std::wstring pathWord = sFolder + FILE_SEPARATOR_STR + L"word";
NSDirectory::CreateDirectory(pathWord) ; NSDirectory::CreateDirectory(pathWord) ;
try try
{ {
std::wstring sFilename = pathWord + FILE_SEPARATOR_STR + _T("document.xml"); std::wstring sFilename = pathWord + FILE_SEPARATOR_STR + L"document.xml";
m_oFileWriter = new NFileWriter::CBufferedFileWriter( sFilename ); m_oFileWriter = new NFileWriter::CBufferedFileWriter( sFilename );
} }
catch(...) catch(...)
{ {
return false; return false;
} }
m_oWriter.m_oRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"), _T("word/document.xml") ); m_oWriter.m_oRels.AddRelationship( L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", L"word/document.xml" );
m_oWriter.m_oContentTypes.AddContent( _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"), _T("/word/document.xml") ); m_oWriter.m_oContentTypes.AddContent( L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", L"/word/document.xml" );
std::wstring sXml = CreateXmlStart( ); std::wstring sXml = CreateXmlStart( );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml); std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml);
...@@ -261,7 +269,7 @@ bool OOXDocumentWriter::SaveByItem() ...@@ -261,7 +269,7 @@ bool OOXDocumentWriter::SaveByItem()
else else
{ {
//генерация ??? //генерация ???
sXml = _T("<w:p><w:pPr>") + sectPr + _T("</w:pPr></w:p>"); sXml = L"<w:p><w:pPr>" + sectPr + L"</w:pPr></w:p>";
} }
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml); std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml);
......
...@@ -64,7 +64,9 @@ public: ...@@ -64,7 +64,9 @@ public:
{ {
int nCount = 0; int nCount = 0;
for( int i = 0; i < m_oDocument.GetCount(); i++ ) for( int i = 0; i < m_oDocument.GetCount(); i++ )
{
nCount += m_oDocument[i].props->GetCount(); nCount += m_oDocument[i].props->GetCount();
}
return nCount; return nCount;
} }
}; };
...@@ -2889,8 +2889,13 @@ namespace SimpleTypes ...@@ -2889,8 +2889,13 @@ namespace SimpleTypes
int nPos = (int)sValue.find( _T(",") ); int nPos = (int)sValue.find( _T(",") );
if ( -1 == nPos ) if ( -1 == nPos )
return 0; {//only x position
std::wstring strX = sValue;
XmlUtils::replace_all(strX, L"@", L"");
m_nX = strX.empty() ? 0 : _wtoi(strX.c_str() );
return 0;
}
std::wstring strX = sValue.substr( 0, nPos ); std::wstring strX = sValue.substr( 0, nPos );
XmlUtils::replace_all(strX, L"@", L""); XmlUtils::replace_all(strX, L"@", L"");
...@@ -2898,7 +2903,12 @@ namespace SimpleTypes ...@@ -2898,7 +2903,12 @@ namespace SimpleTypes
int nPos2 = (int)sValue.find( _T(","), nPos + 1 ); int nPos2 = (int)sValue.find( _T(","), nPos + 1 );
if ( -1 == nPos2 ) if ( -1 == nPos2 )
{// only x, y position
std::wstring strY = sValue.substr( nPos + 1);
XmlUtils::replace_all(strY, L"@", L"");
m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() );
return 0; return 0;
}
std::wstring strY = sValue.substr( nPos + 1, nPos2 - nPos - 1); std::wstring strY = sValue.substr( nPos + 1, nPos2 - nPos - 1);
std::wstring strZ = sValue.substr( nPos2 + 1, nLen - nPos2 - 1 ) ; std::wstring strZ = sValue.substr( nPos2 + 1, nLen - nPos2 - 1 ) ;
...@@ -2909,7 +2919,6 @@ namespace SimpleTypes ...@@ -2909,7 +2919,6 @@ namespace SimpleTypes
m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() ); m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() );
m_nZ = strZ.empty() ? 0 : _wtoi(strZ.c_str() ); m_nZ = strZ.empty() ? 0 : _wtoi(strZ.c_str() );
return 0; return 0;
} }
...@@ -2965,23 +2974,21 @@ namespace SimpleTypes ...@@ -2965,23 +2974,21 @@ namespace SimpleTypes
int nPos = (int)sValue.find( _T(",") ); int nPos = (int)sValue.find( _T(",") );
std::wstring strX, strY;
if ( -1 == nPos ) if ( -1 == nPos )
{ {//only x coord
//only x coord strX = sValue;
XmlUtils::replace_all(sValue, L"@", L"");
m_nX = sValue.empty() ? 0 : _wtoi(sValue.c_str() );
} }
else else
{ {
std::wstring strX = sValue.substr( 0, nPos ); strX = sValue.substr( 0, nPos );
std::wstring strY = sValue.substr( nPos + 1, nLen - nPos - 1 ) ; strY = sValue.substr( nPos + 1, nLen - nPos - 1 ) ;
}
XmlUtils::replace_all(strY, L"@", L""); XmlUtils::replace_all(strY, L"@", L"");
XmlUtils::replace_all(strX, L"@", L""); XmlUtils::replace_all(strX, L"@", L"");
m_nX = strX.empty() ? 0 : _wtoi(strX.c_str() ); m_nX = strX.empty() ? 0 : _wtoi(strX.c_str() );
m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() ); m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() );
}
return 0; return 0;
} }
...@@ -3036,11 +3043,17 @@ namespace SimpleTypes ...@@ -3036,11 +3043,17 @@ namespace SimpleTypes
return 0; return 0;
int nPos = (int)sValue.find( _T(",") ); int nPos = (int)sValue.find( _T(",") );
if ( -1 == nPos )
return 0;
std::wstring strX = sValue.substr( 0, nPos ); std::wstring strX, strY;
std::wstring strY = sValue.substr( nPos + 1, nLen - nPos - 1 ) ; if ( -1 == nPos )
{
strX = sValue.substr( 0, nPos );
}
else
{
strX = sValue.substr( 0, nPos );
strY = sValue.substr( nPos + 1, nLen - nPos - 1 ) ;
}
m_dX = strX.empty() ? 0 : _wtof(strX.c_str() ); m_dX = strX.empty() ? 0 : _wtof(strX.c_str() );
m_dY = strY.empty() ? 0 : _wtof(strY.c_str() ); m_dY = strY.empty() ? 0 : _wtof(strY.c_str() );
...@@ -4176,7 +4189,11 @@ namespace SimpleTypes ...@@ -4176,7 +4189,11 @@ namespace SimpleTypes
int nPos = (int)sValue.find( _T(",") ); int nPos = (int)sValue.find( _T(",") );
if ( -1 == nPos ) if ( -1 == nPos )
{//only x position
SimpleTypes::CPoint oPt1 = sValue;
m_dX = oPt1.GetValue();
return 0; return 0;
}
SimpleTypes::CPoint oPt1 = sValue.substr( 0, nPos ); SimpleTypes::CPoint oPt1 = sValue.substr( 0, nPos );
m_dX = oPt1.GetValue(); m_dX = oPt1.GetValue();
...@@ -4238,7 +4255,11 @@ namespace SimpleTypes ...@@ -4238,7 +4255,11 @@ namespace SimpleTypes
int nPos = (int)sValue.find( _T(",") ); int nPos = (int)sValue.find( _T(",") );
if ( -1 == nPos ) if ( -1 == nPos )
{//only x position
SimpleTypes::CPercentage oPerc1 = sValue;
m_dX = oPerc1.GetValue();
return 0; return 0;
}
SimpleTypes::CPercentage oPerc1 = sValue.substr( 0, nPos ); SimpleTypes::CPercentage oPerc1 = sValue.substr( 0, nPos );
m_dX = oPerc1.GetValue(); m_dX = oPerc1.GetValue();
...@@ -4300,7 +4321,11 @@ namespace SimpleTypes ...@@ -4300,7 +4321,11 @@ namespace SimpleTypes
int nPos = (int)sValue.find( _T(",") ); int nPos = (int)sValue.find( _T(",") );
if ( -1 == nPos ) if ( -1 == nPos )
{//only x position
SimpleTypes::Vml::CVml_1_65536 oFraction1 = sValue;
m_dX = oFraction1.GetValue();
return 0; return 0;
}
SimpleTypes::Vml::CVml_1_65536 oFraction1 = sValue.substr( 0, nPos ); SimpleTypes::Vml::CVml_1_65536 oFraction1 = sValue.substr( 0, nPos );
m_dX = oFraction1.GetValue(); m_dX = oFraction1.GetValue();
......
...@@ -631,7 +631,7 @@ namespace OOX ...@@ -631,7 +631,7 @@ namespace OOX
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// CBackground 14.1.2.2 (Part4) // CBackground 14.1.2.2 (Part4)
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
class CBackground : public WritingElement class CBackground : public CVmlCommonElements
{ {
public: public:
WritingElement_AdditionConstructors(CBackground) WritingElement_AdditionConstructors(CBackground)
...@@ -652,27 +652,16 @@ namespace OOX ...@@ -652,27 +652,16 @@ namespace OOX
{ {
ReadAttributes( oReader ); ReadAttributes( oReader );
if ( oReader.IsEmptyNode() ) CVmlCommonElements::ReadAttributes( oReader );
return; CVmlCommonElements::ReadElements( oReader );
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
if ( _T("v:fill") == sName )
m_oFill = oReader;
}
} }
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
std::wstring sResult = _T("<v:background "); std::wstring sResult = _T("<v:background ");
ComplexTypes_WriteAttribute2( _T("id=\""), m_sId ); sResult += CVmlCommonElements::WriteAttributes();
if ( SimpleTypes::booleanTrue != m_oFilled.GetValue() )
sResult += _T("filled=\"false\" ");
ComplexTypes_WriteAttribute ( _T("fillcolor=\""), m_oFillColor );
ComplexTypes_WriteAttribute ( _T("o:bwmode=\""), m_oBwMode ); ComplexTypes_WriteAttribute ( _T("o:bwmode=\""), m_oBwMode );
ComplexTypes_WriteAttribute ( _T("o:bwpure=\""), m_oBwPure ); ComplexTypes_WriteAttribute ( _T("o:bwpure=\""), m_oBwPure );
ComplexTypes_WriteAttribute ( _T("o:bwnormal=\""), m_oBwNormal ); ComplexTypes_WriteAttribute ( _T("o:bwnormal=\""), m_oBwNormal );
...@@ -680,8 +669,7 @@ namespace OOX ...@@ -680,8 +669,7 @@ namespace OOX
sResult += _T(">"); sResult += _T(">");
if ( m_oFill.IsInit() ) sResult += CVmlCommonElements::WriteElements();
sResult += m_oFill->toXML();
sResult += _T("</v:background>"); sResult += _T("</v:background>");
...@@ -709,15 +697,6 @@ namespace OOX ...@@ -709,15 +697,6 @@ namespace OOX
wchar_t wsChar = wsName[0]; wchar_t wsChar = wsName[0];
switch ( wsChar ) switch ( wsChar )
{ {
case 'f':
if ( _T("fillcolor") == wsName ) m_oFillColor = oReader.GetText();
else if ( _T("filled") == wsName ) m_oFilled = oReader.GetText();
break;
case 'i':
if ( _T("id") == wsName ) m_sId = oReader.GetText();
break;
case 'o': case 'o':
if ( _T("o:bwmode") == wsName ) m_oBwMode = oReader.GetText(); if ( _T("o:bwmode") == wsName ) m_oBwMode = oReader.GetText();
else if ( _T("o:bwnormal") == wsName ) m_oBwNormal = oReader.GetText(); else if ( _T("o:bwnormal") == wsName ) m_oBwNormal = oReader.GetText();
...@@ -743,14 +722,8 @@ namespace OOX ...@@ -743,14 +722,8 @@ namespace OOX
nullable<SimpleTypes::CBWMode<>> m_oBwMode; nullable<SimpleTypes::CBWMode<>> m_oBwMode;
nullable<SimpleTypes::CBWMode<>> m_oBwNormal; nullable<SimpleTypes::CBWMode<>> m_oBwNormal;
nullable<SimpleTypes::CBWMode<>> m_oBwPure; nullable<SimpleTypes::CBWMode<>> m_oBwPure;
nullable<SimpleTypes::CColorType<>> m_oFillColor;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oFilled;
nullable<std::wstring> m_sId;
nullable<SimpleTypes::CScreenSize<>> m_oTargetScreenSize; nullable<SimpleTypes::CScreenSize<>> m_oTargetScreenSize;
// Childs
nullable<OOX::Vml::CFill> m_oFill;
}; };
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// CFormulas 14.1.2.6 (Part4) // CFormulas 14.1.2.6 (Part4)
...@@ -2865,8 +2838,6 @@ namespace OOX ...@@ -2865,8 +2838,6 @@ namespace OOX
} }
public: public:
// Attributes // Attributes
// AG_AllCoreAttributes // AG_AllCoreAttributes
......
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