Commit ae9f3899 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

(2.0.0.10) ASC version full

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52639 954022d7-b5bf-4e40-9824-e11837661b57
parent 18312d0a
//
// Affine transformations
//
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "agg_trans_affine.h"
namespace agg
{
//------------------------------------------------------------------------
const trans_affine& trans_affine::parl_to_parl(const double* src,
const double* dst)
{
sx = src[2] - src[0];
shy = src[3] - src[1];
shx = src[4] - src[0];
sy = src[5] - src[1];
tx = src[0];
ty = src[1];
invert();
multiply(trans_affine(dst[2] - dst[0], dst[3] - dst[1],
dst[4] - dst[0], dst[5] - dst[1],
dst[0], dst[1]));
return *this;
}
//------------------------------------------------------------------------
const trans_affine& trans_affine::rect_to_parl(double x1, double y1,
double x2, double y2,
const double* parl)
{
double src[6];
src[0] = x1; src[1] = y1;
src[2] = x2; src[3] = y1;
src[4] = x2; src[5] = y2;
parl_to_parl(src, parl);
return *this;
}
//------------------------------------------------------------------------
const trans_affine& trans_affine::parl_to_rect(const double* parl,
double x1, double y1,
double x2, double y2)
{
double dst[6];
dst[0] = x1; dst[1] = y1;
dst[2] = x2; dst[3] = y1;
dst[4] = x2; dst[5] = y2;
parl_to_parl(parl, dst);
return *this;
}
//------------------------------------------------------------------------
const trans_affine& trans_affine::multiply(const trans_affine& m)
{
double t0 = sx * m.sx + shy * m.shx;
double t2 = shx * m.sx + sy * m.shx;
double t4 = tx * m.sx + ty * m.shx + m.tx;
shy = sx * m.shy + shy * m.sy;
sy = shx * m.shy + sy * m.sy;
ty = tx * m.shy + ty * m.sy + m.ty;
sx = t0;
shx = t2;
tx = t4;
return *this;
}
//------------------------------------------------------------------------
const trans_affine& trans_affine::invert()
{
double d = determinant_reciprocal();
double t0 = sy * d;
sy = sx * d;
shy = -shy * d;
shx = -shx * d;
double t4 = -tx * t0 - ty * shx;
ty = -tx * shy - ty * sy;
sx = t0;
tx = t4;
return *this;
}
//------------------------------------------------------------------------
const trans_affine& trans_affine::flip_x()
{
sx = -sx;
shy = -shy;
tx = -tx;
return *this;
}
//------------------------------------------------------------------------
const trans_affine& trans_affine::flip_y()
{
shx = -shx;
sy = -sy;
ty = -ty;
return *this;
}
//------------------------------------------------------------------------
const trans_affine& trans_affine::reset()
{
sx = sy = 1.0;
shy = shx = tx = ty = 0.0;
return *this;
}
//------------------------------------------------------------------------
bool trans_affine::is_identity(double epsilon) const
{
return is_equal_eps(sx, 1.0, epsilon) &&
is_equal_eps(shy, 0.0, epsilon) &&
is_equal_eps(shx, 0.0, epsilon) &&
is_equal_eps(sy, 1.0, epsilon) &&
is_equal_eps(tx, 0.0, epsilon) &&
is_equal_eps(ty, 0.0, epsilon);
}
//------------------------------------------------------------------------
bool trans_affine::is_valid(double epsilon) const
{
return fabs(sx) > epsilon && fabs(sy) > epsilon;
}
//------------------------------------------------------------------------
bool trans_affine::is_equal(const trans_affine& m, double epsilon) const
{
return is_equal_eps(sx, m.sx, epsilon) &&
is_equal_eps(shy, m.shy, epsilon) &&
is_equal_eps(shx, m.shx, epsilon) &&
is_equal_eps(sy, m.sy, epsilon) &&
is_equal_eps(tx, m.tx, epsilon) &&
is_equal_eps(ty, m.ty, epsilon);
}
//------------------------------------------------------------------------
double trans_affine::rotation() const
{
double x1 = 0.0;
double y1 = 0.0;
double x2 = 1.0;
double y2 = 0.0;
transform(&x1, &y1);
transform(&x2, &y2);
return atan2(y2-y1, x2-x1);
}
//------------------------------------------------------------------------
void trans_affine::translation(double* dx, double* dy) const
{
*dx = tx;
*dy = ty;
}
//------------------------------------------------------------------------
void trans_affine::scaling(double* x, double* y) const
{
double x1 = 0.0;
double y1 = 0.0;
double x2 = 1.0;
double y2 = 1.0;
trans_affine t(*this);
t *= trans_affine_rotation(-rotation());
t.transform(&x1, &y1);
t.transform(&x2, &y2);
*x = x2 - x1;
*y = y2 - y1;
}
}
This diff is collapsed.
This diff is collapsed.
#ifndef _AGGPLUSTYPES_H
#define _AGGPLUSTYPES_H
#include "windows.h"
namespace Aggplus
{
typedef float REAL;
typedef int INT;
typedef unsigned int *PUINT;
typedef unsigned long ARGB;
typedef INT PixelFormat;
#define REAL_MAX FLT_MAX
#define REAL_MIN FLT_MIN
#define REAL_TOLERANCE (FLT_MIN * 100)
#define REAL_EPSILON 1.192092896e-07F /* FLT_EPSILON */
//--------------------------------------------------------------------------
// Status return values from AGG+ methods
//--------------------------------------------------------------------------
enum Status
{
Ok = 0,
GenericError = 1,
InvalidParameter = 2,
OutOfMemory = 3,
ObjectBusy = 4,
InsufficientBuffer = 5,
NotImplemented = 6,
Win32Error = 7,
WrongState = 8,
Aborted = 9,
FileNotFound = 10,
ValueOverflow = 11,
AccessDenied = 12,
UnknownImageFormat = 13,
FontFamilyNotFound = 14,
FontStyleNotFound = 15,
NotTrueTypeFont = 16,
UnsupportedGdiplusVersion = 17,
AggplusNotInitialized = 18,
PropertyNotFound = 19,
PropertyNotSupported = 20
};
class SizeF
{
public:
SizeF() : Width(0.0f), Height(0.0f) { }
SizeF(const SizeF& size) : Width(size.Width), Height(size.Height) { }
SizeF(REAL width, REAL height) : Width(width), Height(height) { }
SizeF operator+(const SizeF& sz) const { return SizeF(Width+sz.Width, Height+sz.Height); }
SizeF operator-(const SizeF& sz) const { return SizeF(Width-sz.Width, Height-sz.Height); }
BOOL Equals(const SizeF& sz) const { return((Width == sz.Width) && (Height == sz.Height)); }
BOOL Empty() const { return(Width == 0.0f && Height == 0.0f); }
public:
REAL Width, Height;
};
class PointF
{
public:
PointF() : X(0.0f), Y(0.0f) { }
PointF(const PointF &point) : X(point.X), Y(point.Y) { }
PointF(const SizeF &size) : X(size.Width), Y(size.Height) { }
PointF(REAL x, REAL y) : X(x), Y(y) { }
//~PointF() { }
BOOL Equals(const PointF& point) const { return(X==point.X && Y==point.Y); }
PointF operator+(const PointF& point) const { return PointF(X + point.X, Y + point.Y); }
PointF operator-(const PointF& point) const { return PointF(X - point.X, Y - point.Y); }
public:
REAL X, Y;
};
class RectF
{
public:
RectF() : X(0.0f), Y(0.0f), Width(0.0f), Height(0.0f) { }
RectF(REAL x, REAL y, REAL width, REAL height) : X(x), Y(y), Width(width), Height(height) { }
RectF(RECT rct)
{ X = REAL(rct.left); Y = REAL(rct.top); Width = REAL(rct.right-rct.left); Height=REAL(rct.bottom-rct.top);}
RectF(const PointF& location, const SizeF& size) : X(location.X), Y(location.Y), Width(size.Width), Height(size.Height) { }
RectF* Clone() const { return new RectF(X, Y, Width, Height); }
void GetLocation(PointF* point) const { point->X = X; point->Y = Y; }
void GetSize(SizeF* size) const { size->Width = Width; size->Height = Height; }
void GetBounds(RectF* rect) const { rect->X = X; rect->Y = Y; rect->Width = Width; rect->Height = Height; }
REAL GetLeft() const { return X; }
REAL GetTop() const { return Y; }
REAL GetRight() const { return X+Width; }
REAL GetBottom() const { return Y+Height; }
BOOL IsEmptyArea() const { return (Width <= REAL_EPSILON) || (Height <= REAL_EPSILON); }
BOOL Equals(const RectF & rect) const
{
return X == rect.X && Y == rect.Y &&
Width == rect.Width && Height == rect.Height;
}
BOOL Contains(REAL x, REAL y) const
{
return x >= X && x < X+Width &&
y >= Y && y < Y+Height;
}
BOOL Contains(const PointF& pt) const { return Contains(pt.X, pt.Y); }
BOOL Contains(const RectF& rect) const
{
return (X <= rect.X) && (rect.GetRight() <= GetRight()) &&
(Y <= rect.Y) && (rect.GetBottom() <= GetBottom());
}
void Inflate(REAL dx, REAL dy) { X -= dx; Y -= dy; Width += 2*dx; Height += 2*dy; }
void Inflate(const PointF& point) { Inflate(point.X, point.Y); }
BOOL Intersect(const RectF& rect) { return Intersect(*this, *this, rect); }
static BOOL Intersect(RectF& c, const RectF& a, const RectF& b)
{
REAL right = min(a.GetRight(), b.GetRight());
REAL bottom = min(a.GetBottom(), b.GetBottom());
REAL left = max(a.GetLeft(), b.GetLeft());
REAL top = max(a.GetTop(), b.GetTop());
c.X = left;
c.Y = top;
c.Width = right - left;
c.Height = bottom - top;
return !c.IsEmptyArea();
}
BOOL IntersectsWith(const RectF& rect) const
{
return (GetLeft() < rect.GetRight() &&
GetTop() < rect.GetBottom() &&
GetRight() > rect.GetLeft() &&
GetBottom() > rect.GetTop());
}
static BOOL Union(RectF& c, const RectF& a, const RectF& b)
{
REAL right = max(a.GetRight(), b.GetRight());
REAL bottom = max(a.GetBottom(), b.GetBottom());
REAL left = min(a.GetLeft(), b.GetLeft());
REAL top = min(a.GetTop(), b.GetTop());
c.X = left;
c.Y = top;
c.Width = right - left;
c.Height = bottom - top;
return !c.IsEmptyArea();
}
void Offset(const PointF& point) { Offset(point.X, point.Y); }
void Offset(REAL dx, REAL dy) { X += dx; Y += dy; }
public:
REAL X, Y, Width, Height;
};
} //namespace Aggplus
#endif // _AGGPLUSTYPES_H
\ No newline at end of file
#pragma once
#include "ap_AggPlusEnums.h"
#include "ap_AggPlusTypes.h"
#include "agg_trans_affine.h"
namespace NSDocxRenderer
{
class CMatrix
{
public:
CMatrix(double m11, double m12, double m21, double m22, double dx, double dy) : m_agg_mtx(m11, m12, m21, m22, dx, dy)
{
}
CMatrix() : m_agg_mtx()
{
}
~CMatrix()
{
}
void Translate(double offsetX, double offsetY, Aggplus::MatrixOrder order = Aggplus::MatrixOrderPrepend)
{
if (order == Aggplus::MatrixOrderPrepend)
{
m_agg_mtx.premultiply(agg::trans_affine_translation(offsetX, offsetY));
}
else
{
m_agg_mtx.multiply(agg::trans_affine_translation(offsetX, offsetY));
}
}
void Scale(double scaleX, double scaleY, Aggplus::MatrixOrder order = Aggplus::MatrixOrderPrepend)
{
if (order == Aggplus::MatrixOrderPrepend)
{
m_agg_mtx.premultiply(agg::trans_affine_scaling(scaleX, scaleY));
}
else
{
m_agg_mtx.multiply(agg::trans_affine_scaling(scaleX, scaleY));
}
}
void Shear(double shearX, double shearY, Aggplus::MatrixOrder order = Aggplus::MatrixOrderPrepend)
{
if (order == Aggplus::MatrixOrderPrepend)
{
m_agg_mtx.premultiply(agg::trans_affine_skewing(shearX, shearY));
}
else
{
m_agg_mtx.multiply(agg::trans_affine_skewing(shearX, shearY));
}
}
void TransformPoint(double& x, double& y)
{
m_agg_mtx.transform(&x, &y);
}
void Rotate(double angle, Aggplus::MatrixOrder order = Aggplus::MatrixOrderPrepend)
{
if (order == Aggplus::MatrixOrderPrepend)
{
m_agg_mtx.premultiply(agg::trans_affine_rotation(agg::deg2rad(angle)));
}
else
{
m_agg_mtx.multiply(agg::trans_affine_rotation(agg::deg2rad(angle)));
}
}
void RotateAt(double angle, double x, double y, Aggplus::MatrixOrder order = Aggplus::MatrixOrderPrepend)
{
Translate(-x, -y, order);
if (order == Aggplus::MatrixOrderPrepend)
{
m_agg_mtx.premultiply(agg::trans_affine_rotation(agg::deg2rad(angle)));
}
else
{
m_agg_mtx.multiply(agg::trans_affine_rotation(agg::deg2rad(angle)));
}
Translate(x, y, order);
}
void Multiply(const CMatrix* matrix, Aggplus::MatrixOrder order = Aggplus::MatrixOrderPrepend)
{
if (order == Aggplus::MatrixOrderPrepend)
{
m_agg_mtx.premultiply(matrix->m_agg_mtx);
}
else
{
m_agg_mtx.multiply(matrix->m_agg_mtx);
}
}
double OffsetX() const
{
double M[6]; m_agg_mtx.store_to(M);
return (M[4]);
}
double OffsetY() const
{
double M[6]; m_agg_mtx.store_to(M);
return (M[5]);
}
bool GetElements(float* m) const
{
double M[6]; m_agg_mtx.store_to(M);
m[0]=(float)M[0];
m[1]=(float)M[1];
m[2]=(float)M[2];
m[3]=(float)M[3];
m[4]=(float)M[4];
m[5]=(float)M[5];
return true;
}
bool GetElements(double* m) const
{
m_agg_mtx.store_to(m);
return true;
}
void Reset()
{
m_agg_mtx.reset();
}
const CMatrix& operator=(const CMatrix& Src)
{
m_agg_mtx = Src.m_agg_mtx;
return *this;
}
bool Invert()
{
double d = m_agg_mtx.determinant();
if (0.0001 >= abs(d))
return false;
m_agg_mtx.invert();
return true;
}
//Temp
//Used in X_BrushLinearGradient constructor
double z_Rotation() const
{
return agg::rad2deg(m_agg_mtx.rotation());
}
__forceinline void SetElements(const double& m11, const double& m12, const double& m21, const double& m22, const double& dx, const double& dy)
{
m_agg_mtx.sx = m11;
m_agg_mtx.shy = m12;
m_agg_mtx.shx = m21;
m_agg_mtx.sy = m22;
m_agg_mtx.tx = dx;
m_agg_mtx.ty = dy;
}
public:
agg::trans_affine m_agg_mtx;
};
}
\ No newline at end of file
This diff is collapsed.
#pragma once
const long g_clFilePartSize = 20*1024;
class CCalculatorCRC32
{
public:
CCalculatorCRC32()
{
m_dwMagicWord = 0xEDB88320;
m_dwInitCrc = 0xFFFFFFFF;
m_bInitTable = FALSE;
}
public:
DWORD Calc(BYTE const*pStream, int nSize)
{
InitCRCTable();
DWORD dwRes = m_dwInitCrc;
for (int i=0;i<nSize;i++)
{
dwRes = m_arCRCTable[(dwRes ^ pStream[i])& 0xFF] ^ (dwRes >> 8);
}
dwRes = dwRes ^ 0xFFFFFFFF;
return dwRes;
}
DWORD Calc(const CString &sStream)
{
InitCRCTable();
DWORD dwRes = m_dwInitCrc;
int nSize = sStream.GetLength();
for (int i=0;i<nSize;i++)
{
dwRes = m_arCRCTable[(dwRes ^ (BYTE)sStream[i]) & 0xFF] ^ (dwRes >> 8);
}
dwRes = dwRes ^ 0xFFFFFFFF;
return dwRes;
}
DWORD CalcPartFile(const CString &sFilepath)
{
DWORD dwRet = 0xFFFFFFFF;
//LPBYTE pBuffer = new BYTE[g_clFilePartSize];
//if (NULL==pBuffer)
// return dwRet;
//FILE *pFile = fopen(sFilepath, "rb");
//if (NULL==pFile)
//{
// delete [] pBuffer;
// return dwRet;
//}
//size_t nReaded = fread(pBuffer, 1, 1024, pFile);
//fclose(pFile);
//dwRet = CCalculatorCRC32::Calc(pBuffer, nReaded);
//
////ATLTRACE("CRC32: 0x%08X\n", dwRet);
//delete [] pBuffer;
return dwRet;
}
private:
void InitCRCTable()
{
if (m_bInitTable)
return;
DWORD dwTemp;
for (int i=0;i<256;i++)
{
dwTemp = i;
for (int j=0;j<8;j++)
{
if (0x1==(dwTemp & 0x1))
dwTemp = (dwTemp >> 1) ^ m_dwMagicWord;
else
dwTemp = dwTemp >> 1;
}
m_arCRCTable[i] = dwTemp;
}
}
DWORD m_dwMagicWord;
DWORD m_dwInitCrc;
DWORD m_arCRCTable[255];
BOOL m_bInitTable;
};
This diff is collapsed.
This diff is collapsed.
#pragma once
#include "Common.h"
namespace NSDocxRenderer
{
static _bstr_t g_bstr_image_1 = L"<w:r><w:pict><v:shape id=\"\" type=\"\" style=\"position:absolute;";
static _bstr_t g_bstr_image_2 = L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page\" filled=\"f\">";
static _bstr_t g_bstr_image_3 = L"</v:shape></w:pict></w:r>";
static CString g_string_image_position = _T("margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;");
static CString g_string_image_position_rotate = _T("margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;rotation:%d;");
static CString g_string_image_rid = _T("<v:imagedata r:id=\"rId%d\" o:title=\"\"/>");
class CImage : public CBaseItem
{
public:
CString m_strPath;
LONG m_lID;
double m_dLeft;
double m_dTop;
double m_dWidth;
double m_dHeight;
double m_dRotate;
public:
CImage()
{
m_eType = etImage;
m_strPath = _T("");
m_lID = -1;
}
CImage(const CImage& oSrc)
{
*this = oSrc;
}
CImage(const CImageInfo& oInfo, const CString& strDstMedia)
{
m_eType = etImage;
m_strPath = strDstMedia;
m_lID = oInfo.m_lID;
}
CImage& operator=(const CImage& oSrc)
{
m_eType = etImage;
m_strPath = oSrc.m_strPath;
m_lID = oSrc.m_lID;
m_dLeft = oSrc.m_dLeft;
m_dTop = oSrc.m_dTop;
m_dWidth = oSrc.m_dWidth;
m_dHeight = oSrc.m_dHeight;
m_dRotate = oSrc.m_dRotate;
return *this;
}
virtual void ToXml(NSDocxRenderer::CStringWriter& oWriter)
{
oWriter.WriteString(g_bstr_image_1);
if (0.0 == m_dRotate)
{
CString strPosition = _T("");
strPosition.Format(g_string_image_position, m_dLeft, m_dTop, m_dWidth, m_dHeight);
oWriter.WriteString(strPosition);
}
else
{
CString strPosition = _T("");
strPosition.Format(g_string_image_position_rotate, m_dLeft, m_dTop, m_dWidth, m_dHeight, (int)m_dRotate);
oWriter.WriteString(strPosition);
}
oWriter.WriteString(g_bstr_image_2);
CString strRid = _T("");
strRid.Format(g_string_image_rid, 10 + m_lID);
oWriter.WriteString(strRid);
oWriter.WriteString(g_bstr_image_3);
}
};
}
\ No newline at end of file
This diff is collapsed.
#pragma once
#include "Common.h"
namespace NSDocxRenderer
{
static _bstr_t g_vml_bstr_ClosePath = L"x";
static _bstr_t g_vml_bstr_EndPath = L"e";
static _bstr_t g_vml_bstr_NoFill = L"nf";
static _bstr_t g_vml_bstr_NoStroke = L"ns";
static CString g_vml_string_MoveTo = _T("m%d,%d");
static CString g_vml_string_LineTo = _T("l%d,%d");
static CString g_vml_string_CurveTo = _T("c%d,%d %d,%d %d,%d");
static _bstr_t g_bstr_shape1 = L"<w:r><w:pict><v:shape id=\"\" o:spid=\"\" style=\"position:absolute;";
static _bstr_t g_bstr_shape2 = L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page;\"";
static CString g_string_shape_position = _T("margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;");
static CString g_string_shape_geometry = _T(" coordsize=\"%d,%d\" path=\"%s\" fillcolor=\"#%06x\" strokecolor=\"#%06x\" strokeweight=\"%.2lfmm\">");
static CString g_string_tx_rid = _T("<v:imagedata r:id=\"rId%d\" o:title=\"\"/>");
static CString g_string_fill_opacity = _T("<v:fill opacity=\"%.2lf\"/>");
static CString g_string_stroke_opacity = _T("<v:stroke opacity=\"%.2lf\"/>");
static _bstr_t g_bstr_shape3 = L"<w10:wrap anchorx=\"page\" anchory=\"page\"/></v:shape></w:pict></w:r>";
class CVectorGraphics
{
public:
double* m_pData;
size_t m_lSize;
double* m_pDataCur;
size_t m_lSizeCur;
public:
double m_dLeft;
double m_dTop;
double m_dRight;
double m_dBottom;
public:
CVectorGraphics()
{
m_pData = NULL;
m_lSize = 0;
m_pDataCur = m_pData;
m_lSizeCur = m_lSize;
End();
}
~CVectorGraphics()
{
RELEASEMEM(m_pData);
}
AVSINLINE void AddSize(size_t nSize)
{
if (NULL == m_pData)
{
m_lSize = max(nSize, 500);
m_pData = (double*)malloc(m_lSize * sizeof(double));
m_lSizeCur = 0;
m_pDataCur = m_pData;
return;
}
if ((m_lSizeCur + nSize) > m_lSize)
{
while ((m_lSizeCur + nSize) > m_lSize)
{
m_lSize *= 2;
}
double* pRealloc = (double*)realloc(m_pData, m_lSize * sizeof(double));
if (NULL != pRealloc)
{
//
m_pData = pRealloc;
m_pDataCur = m_pData + m_lSizeCur;
}
else
{
double* pMalloc = (double*)malloc(m_lSize * sizeof(double));
memcpy(pMalloc, m_pData, m_lSizeCur * sizeof(double));
free(m_pData);
m_pData = pMalloc;
m_pDataCur = m_pData + m_lSizeCur;
}
}
}
public:
AVSINLINE void MoveTo(const double& x1, const double& y1)
{
AddSize(3);
*m_pDataCur = 0; ++m_pDataCur;
*m_pDataCur = x1; ++m_pDataCur;
*m_pDataCur = y1; ++m_pDataCur;
m_lSizeCur += 3;
CheckPoint(x1, y1);
}
AVSINLINE void LineTo(const double& x1, const double& y1)
{
AddSize(3);
*m_pDataCur = 1; ++m_pDataCur;
*m_pDataCur = x1; ++m_pDataCur;
*m_pDataCur = y1; ++m_pDataCur;
m_lSizeCur += 3;
CheckPoint(x1, y1);
}
AVSINLINE void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3)
{
AddSize(7);
*m_pDataCur = 2; ++m_pDataCur;
*m_pDataCur = x1; ++m_pDataCur;
*m_pDataCur = y1; ++m_pDataCur;
*m_pDataCur = x2; ++m_pDataCur;
*m_pDataCur = y2; ++m_pDataCur;
*m_pDataCur = x3; ++m_pDataCur;
*m_pDataCur = y3; ++m_pDataCur;
m_lSizeCur += 7;
CheckPoint(x1, y1);
CheckPoint(x2, y2);
CheckPoint(x3, y3);
}
AVSINLINE void Close()
{
AddSize(1);
*m_pDataCur = 3; ++m_pDataCur;
m_lSizeCur += 1;
}
AVSINLINE size_t GetCurSize()
{
return m_lSizeCur;
}
AVSINLINE void Clear()
{
RELEASEMEM(m_pData);
m_pData = NULL;
m_lSize = 0;
m_pDataCur = m_pData;
m_lSizeCur = 0;
}
AVSINLINE void ClearNoAttack()
{
m_pDataCur = m_pData;
m_lSizeCur = 0;
}
AVSINLINE void End()
{
ClearNoAttack();
m_dLeft = 0xFFFFFF;
m_dTop = 0xFFFFFF;
m_dRight = -0xFFFFFF;
m_dBottom = -0xFFFFFF;
}
AVSINLINE void CheckPoint(const double& x, const double& y)
{
if (m_dLeft > x)
m_dLeft = x;
if (m_dRight < x)
m_dRight = x;
if (m_dTop > y)
m_dTop = y;
if (m_dBottom < y)
m_dBottom = y;
}
};
class CShape : public CBaseItem
{
public:
CString m_strPath;
NSStructures::CBrush m_oBrush;
NSStructures::CPen m_oPen;
double m_dLeft;
double m_dTop;
double m_dWidth;
double m_dHeight;
bool m_bIsFill;
bool m_bIsStroke;
LONG m_lCoordSizeX;
LONG m_lCoordSizeY;
LONG m_lTxId;
public:
CShape()
{
m_dLeft = 0;
m_dTop = 0;
m_dWidth = 0;
m_dHeight = 0;
m_bIsFill = false;
m_bIsStroke = false;
m_lCoordSizeX = 100000;
m_lCoordSizeY = 100000;
m_lTxId = -1;
}
CShape(const CShape& oSrc)
{
*this = oSrc;
}
CShape& operator=(const CShape& oSrc)
{
m_eType = etShape;
m_strPath = oSrc.m_strPath;
m_oBrush = oSrc.m_oBrush;
m_oPen = oSrc.m_oPen;
m_dLeft = oSrc.m_dLeft;
m_dTop = oSrc.m_dTop;
m_dWidth = oSrc.m_dWidth;
m_dHeight = oSrc.m_dHeight;
m_bIsFill = oSrc.m_bIsFill;
m_bIsStroke = oSrc.m_bIsStroke;
m_lTxId = oSrc.m_lTxId;
return *this;
}
void CreateFromVectorData(CVectorGraphics* pVector, NSDocxRenderer::CStringWriter& oWriter, const LONG& lCoordSize, LONG lType)
{
m_dLeft = pVector->m_dLeft;
m_dTop = pVector->m_dTop;
m_dWidth = pVector->m_dRight - m_dLeft;
m_dHeight = pVector->m_dBottom - m_dTop;
m_lCoordSizeX = lCoordSize;
m_lCoordSizeY = lCoordSize;
size_t nCount = pVector->GetCurSize();
double* pData = pVector->m_pData;
while (nCount > 0)
{
double dType = *pData++;
if (0 == dType)
{
LONG lX = (LONG)((*pData - m_dLeft) * lCoordSize / m_dWidth);
++pData;
LONG lY = (LONG)((*pData - m_dTop) * lCoordSize / m_dHeight);
++pData;
CString strPath = _T("");
strPath.Format(g_vml_string_MoveTo, lX, lY);
oWriter.WriteString(strPath);
nCount -= 3;
}
else if (1 == dType)
{
LONG lX = (LONG)((*pData - m_dLeft) * lCoordSize / m_dWidth);
++pData;
LONG lY = (LONG)((*pData - m_dTop) * lCoordSize / m_dHeight);
++pData;
CString strPath = _T("");
strPath.Format(g_vml_string_LineTo, lX, lY);
oWriter.WriteString(strPath);
nCount -= 3;
}
else if (2 == dType)
{
LONG lX1 = (LONG)((*pData - m_dLeft) * lCoordSize / m_dWidth);
++pData;
LONG lY1 = (LONG)((*pData - m_dTop) * lCoordSize / m_dHeight);
++pData;
LONG lX2 = (LONG)((*pData - m_dLeft) * lCoordSize / m_dWidth);
++pData;
LONG lY2 = (LONG)((*pData - m_dTop) * lCoordSize / m_dHeight);
++pData;
LONG lX3 = (LONG)((*pData - m_dLeft) * lCoordSize / m_dWidth);
++pData;
LONG lY3 = (LONG)((*pData - m_dTop) * lCoordSize / m_dHeight);
++pData;
CString strPath = _T("");
strPath.Format(g_vml_string_CurveTo, lX1, lY1, lX2, lY2, lX3, lY3);
oWriter.WriteString(strPath);
nCount -= 7;
}
else
{
oWriter.WriteString(g_vml_bstr_ClosePath);
--nCount;
}
}
if (0x00 == (lType & 0x01))
oWriter.WriteString(g_vml_bstr_NoStroke);
if (0x00 == (lType >> 8))
oWriter.WriteString(g_vml_bstr_NoFill);
oWriter.WriteString(g_vml_bstr_EndPath);
m_strPath = oWriter.GetData();
oWriter.ClearNoAttack();
}
virtual void ToXml(NSDocxRenderer::CStringWriter& oWriter)
{
oWriter.WriteString(g_bstr_shape1);
CString strPosition = _T("");
strPosition.Format(g_string_shape_position, m_dLeft, m_dTop, m_dWidth, m_dHeight);
oWriter.WriteString(strPosition);
oWriter.WriteString(strPosition);
oWriter.WriteString(g_bstr_shape2);
CString strStyle = _T("");
strStyle.Format(g_string_shape_geometry, m_lCoordSizeX, m_lCoordSizeY, m_strPath, ConvertColor(m_oBrush.Color1), ConvertColor(m_oPen.Color), m_oPen.Size);
oWriter.WriteString(strStyle);
if (c_BrushTypeTexture == m_oBrush.Type)
{
CString strImage = _T("");
strImage.Format(g_string_tx_rid, 10 + m_lTxId);
oWriter.WriteString(strImage);
if (0xFF != m_oBrush.TextureAlpha)
{
CString strFillOpacity = _T("");
strFillOpacity.Format(g_string_fill_opacity, (double)m_oBrush.TextureAlpha / 255.0);
oWriter.WriteString(strFillOpacity);
}
}
else
{
if (0xFF != m_oBrush.Alpha1)
{
CString strFillOpacity = _T("");
strFillOpacity.Format(g_string_fill_opacity, (double)m_oBrush.Alpha1 / 255.0);
oWriter.WriteString(strFillOpacity);
}
if (0xFF != m_oPen.Alpha)
{
CString strPenOpacity = _T("");
strPenOpacity.Format(g_string_stroke_opacity, (double)m_oPen.Alpha / 255.0);
oWriter.WriteString(strPenOpacity);
}
}
oWriter.WriteString(g_bstr_shape3);
}
};
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/></Relationships>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Default Extension="png" ContentType="image/png"/><Default Extension="jpg" ContentType="image/jpg"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/><Override PartName="/word/webSettings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"/><Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"/><Override PartName="/word/theme/theme.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"><Template>Normal.dotm</Template><TotalTime>1</TotalTime><Pages>1</Pages><Words>0</Words><Characters>0</Characters><Application>Microsoft Office Word</Application><DocSecurity>0</DocSecurity><Lines>1</Lines><Paragraphs>1</Paragraphs><ScaleCrop>false</ScaleCrop><LinksUpToDate>false</LinksUpToDate><CharactersWithSpaces>0</CharactersWithSpaces><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>12.0000</AppVersion></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/"><dc:title/><dc:subject/><dc:creator/><cp:keywords/><dc:description/><cp:lastModifiedBy/><cp:revision>1</cp:revision></cp:coreProperties>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml"><w:zoom w:percent="100"/><w:defaultTabStop w:val="708"/><w:drawingGridHorizontalSpacing/><w:displayHorizontalDrawingGridEvery/><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="3074"/><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/><o:rules v:ext=""/></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"/></a:dk2><a:lt2><a:srgbClr val="EEECE1"/></a:lt2><a:accent1><a:srgbClr val="4F81BD"/></a:accent1><a:accent2><a:srgbClr val="C0504D"/></a:accent2><a:accent3><a:srgbClr val="9BBB59"/></a:accent3><a:accent4><a:srgbClr val="8064A2"/></a:accent4><a:accent5><a:srgbClr val="4BACC6"/></a:accent5><a:accent6><a:srgbClr val="F79646"/></a:accent6><a:hlink><a:srgbClr val="0000FF"/></a:hlink><a:folHlink><a:srgbClr val="800080"/></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"><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"><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"><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:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:optimizeForBrowser/></w:webSettings>
\ No newline at end of file
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by AVSOfficeDocxRenderer.rc
//
#define IDS_PROJNAME 100
#define IDR_ASCOFFICEDOCXRENDERER 101
#define IDB_DEFAULT_DOC_RELS 201
#define IDB_DEFAULT_DOC_CONTENT_TYPES 202
#define IDB_DEFAULT_DOC_APP 203
#define IDB_DEFAULT_DOC_CORE 204
#define IDB_DEFAULT_DOC_STYLES 205
#define IDB_DEFAULT_DOC_THEME 206
#define IDB_DEFAULT_DOC_WEBSETTINGS 207
#define IDB_DEFAULT_DOC_SETTINGS 208
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 209
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif
// stdafx.cpp : source file that includes just the standard includes
// AVSOfficeDocxRenderer.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
\ No newline at end of file
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