init repo

This commit is contained in:
nikolay ivanov
2014-07-05 18:22:49 +00:00
commit a8be6b9e72
17348 changed files with 9229832 additions and 0 deletions

View File

@@ -0,0 +1,330 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "resource.h"
#include "../Common/OfficeFileTemplate.h"
#include "Reader/BinaryWriter.h"
#include "Reader/FontProcessor.h"
#include "Writer/BinaryReader.h"
[
object,
uuid("87476A4D-6A42-44e9-A947-42B8E8613070"),
dual, helpstring("IAVSOfficeXlsxSerizer Interface"),
pointer_default(unique)
]
__interface IAVSOfficeXlsxSerizer : public IAVSOfficeFileTemplate
{
[id(20)] HRESULT SetFontDir([in] BSTR bsFontDir);
[id(30)] HRESULT LoadChart([in] BSTR bsFilename, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(31)] HRESULT SaveChart([in, satype("BYTE")] SAFEARRAY* pBinaryObj, [in] LONG lStart, [in] LONG lLength, [in] BSTR bsFilename, [in] BSTR bsContentTypePath, [out] BSTR* bsContentTypeElement);
[id(32)] HRESULT SetDrawingConverter([in] IUnknown* pDocument);
[id(120)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(130)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
[
coclass,
default(IAVSOfficeXlsxSerizer),
event_receiver(native),
threading(apartment),
vi_progid("ASCOfficeXlsxSerizer.AVSDocume"),
progid("ASCOfficeXlsxSerizer.AVSDocu.1"),
version(1.0),
uuid("2A6514F2-0C01-4759-89CB-68C38669337D"),
helpstring("ASCOfficeXlsxSerizer Class")
]
class ATL_NO_VTABLE CAVSOfficeXlsxSerizer : public IAVSOfficeXlsxSerizer
{
private:
CString m_strEmbeddedFontsDirectory;
PPTXFile::IAVSOfficeDrawingConverter* m_pExternalDrawingConverter;
public:
CAVSOfficeXlsxSerizer()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
m_pExternalDrawingConverter = NULL;
return S_OK;
}
void FinalRelease()
{
RELEASEINTERFACE(m_pExternalDrawingConverter);
}
public:
STDMETHOD(LoadFromFile)(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter;
CoCreateInstance(__uuidof(PPTXFile::CAVSOfficeDrawingConverter), NULL, CLSCTX_ALL, __uuidof(PPTXFile::IAVSOfficeDrawingConverter), (void**)(&pOfficeDrawingConverter));
CString sMediaDir = sDstPath;
sMediaDir.Append(_T("\\xl\\media"));
BSTR bstrMediaDir = sMediaDir.AllocSysString();
pOfficeDrawingConverter->SetMediaDstPath(bstrMediaDir);
SysFreeString(bstrMediaDir);
TCHAR tFolder[256];
TCHAR tDrive[256];
_tsplitpath( sSrcFileName, tDrive, tFolder, NULL, NULL );
CString sFolder = CString(tFolder);
CString sDrive = CString(tDrive);
CString sFileInDir = sDrive + sFolder;
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = sFileInDir.AllocSysString();
pOfficeDrawingConverter->SetAdditionalParam(L"SourceFileDir", var);
RELEASESYSSTRING(var.bstrVal);
CString sTempTheme = CreateTheme();
BinXlsxRW::BinaryFileReader oBinaryFileReader;
oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, sTempTheme, pOfficeDrawingConverter, CString(sXMLOptions));
::DeleteFile(sTempTheme);
RELEASEINTERFACE(pOfficeDrawingConverter);
return S_OK;
}
STDMETHOD(SaveToFile)(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
CString sFontDir = m_oFontProcessor.getFontDir();
PPTXFile::IOfficeFontPicker* pFontPicker = NULL;
CoCreateInstance(__uuidof(PPTXFile::COfficeFontPicker), NULL, CLSCTX_ALL, __uuidof(PPTXFile::IOfficeFontPicker), (void**)(&pFontPicker));
BSTR bstrFontDir1 = sFontDir.AllocSysString();
pFontPicker->Init(bstrFontDir1);
SysFreeString(bstrFontDir1);
NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager = NULL;
if(false == m_strEmbeddedFontsDirectory.IsEmpty())
{
CreateDirectoryW(m_strEmbeddedFontsDirectory, NULL);
BSTR bstrEmbeddedFontsDirectory = m_strEmbeddedFontsDirectory.AllocSysString();
pFontPicker->SetEmbeddedFontsDirectory(bstrEmbeddedFontsDirectory);
SysFreeString(bstrEmbeddedFontsDirectory);
VARIANT vt;
pFontPicker->GetAdditionalParam(_T("NativeCutter"), &vt);
pEmbeddedFontsManager = (NSFontCutter::CEmbeddedFontsManager*)vt.pvRecord;
ASCGraphics::IASCFontManager* pFontManager = m_oFontProcessor.getFontManager();
pEmbeddedFontsManager->CheckFont(_T("Wingdings 3"), pFontManager);
pEmbeddedFontsManager->CheckFont(_T("Arial"), pFontManager);
pEmbeddedFontsManager->CheckFont(_T("Calibri"), pFontManager);
pEmbeddedFontsManager->CheckString(CString(_T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")));
pEmbeddedFontsManager->CheckString(CString(_T("#!/?")));
pEmbeddedFontsManager->CheckString(CString(_T(".%E+-():")));
}
PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter;
CoCreateInstance(__uuidof(PPTXFile::CAVSOfficeDrawingConverter), NULL, CLSCTX_ALL, __uuidof(PPTXFile::IAVSOfficeDrawingConverter), (void**)(&pOfficeDrawingConverter));
BSTR bstrFontDir = sFontDir.AllocSysString();
pOfficeDrawingConverter->SetFontDir(bstrFontDir);
SysFreeString(bstrFontDir);
VARIANT vt;
vt.vt = VT_UNKNOWN;
vt.punkVal = pFontPicker;
pOfficeDrawingConverter->SetAdditionalParam(_T("FontPicker"), vt);
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(m_oFontProcessor);
oBinaryFileWriter.Open(CString(sSrcPath), CString(sDstFileName), pEmbeddedFontsManager, pOfficeDrawingConverter, CString(sXMLOptions));
RELEASEINTERFACE(pFontPicker);
RELEASEINTERFACE(pOfficeDrawingConverter);
return S_OK;
}
STDMETHOD(LoadChart)(BSTR bsFilename, SAFEARRAY** ppBinary)
{
HRESULT hRes = S_FALSE;
*ppBinary = NULL;
CString sChartPath(bsFilename);
OOX::Spreadsheet::CChartSpace oChart(sChartPath);
if(oChart.m_oChart.IsInit() && oChart.m_oChart->isValid() && NULL != m_pExternalDrawingConverter)
{
long nGrowSize = 1 * 1024 * 1024;
Streams::CBuffer oBuffer;
oBuffer.Create(nGrowSize, nGrowSize);
Streams::CBufferedStream oBufferedStream;
oBufferedStream.SetBuffer(&oBuffer);
BinXlsxRW::BinaryCommonWriter oBcw(oBufferedStream);
BSTR bstrChartPath = sChartPath.AllocSysString();
m_pExternalDrawingConverter->SetRelsPath(bstrChartPath);
SysFreeString(bstrChartPath);
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(oBufferedStream, m_pExternalDrawingConverter);
oBinaryChartWriter.Write(oChart);
ULONG lBinarySize = oBufferedStream.GetPosition();
SAFEARRAY* pArray = SafeArrayCreateVector(VT_UI1, lBinarySize);
BYTE* pDataD = (BYTE*)pArray->pvData;
BYTE* pDataS = oBufferedStream.GetBuffer();
memcpy(pDataD, pDataS, lBinarySize);
*ppBinary = pArray;
hRes = S_OK;
}
return hRes;
}
STDMETHOD(SaveChart)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, BSTR bsFilename, BSTR bsContentTypePath, BSTR* bsContentTypeElement)
{
HRESULT hRes = S_FALSE;
*bsContentTypeElement = NULL;
if(NULL != m_pExternalDrawingConverter)
{
Streams::CBuffer oBuffer;
Streams::CBufferedStream oBufferedStream;
oBufferedStream.SetBuffer(&oBuffer);
oBufferedStream.Create((BYTE*)pBinaryObj->pvData + lStart, lLength);
m_pExternalDrawingConverter->SetDstContentRels();
OOX::Spreadsheet::CChartSpace oChartSpace;
oChartSpace.m_oChart.Init();
BinXlsxRW::BinaryChartReader oBinaryChartReader(oBufferedStream, pBinaryObj, m_pExternalDrawingConverter);
oBinaryChartReader.ReadChartOut(lLength, &oChartSpace);
if(oChartSpace.isValid())
{
TCHAR tDrive[256];
TCHAR tFolder[256];
TCHAR tFilename[256];
TCHAR tExt[256];
_tsplitpath( bsFilename, tDrive, tFolder, tFilename, tExt );
CString sDrive(tDrive);
CString sFolder(tFolder);
CString sFilename(tFilename);
CString sExt(tExt);
CString sRelsDir = sDrive + sFolder;
sRelsDir.Append(_T("_rels"));
DWORD dwFileAttr = ::GetFileAttributes( sRelsDir );
if( dwFileAttr == INVALID_FILE_ATTRIBUTES )
OOX::CSystemUtility::CreateDirectories(sRelsDir);
oChartSpace.write2(CString(bsFilename));
CString sRelsPath;
sRelsPath.Format(_T("%s\\%s.rels"), sRelsDir, sFilename + sExt);
BSTR bstrRelsPath = sRelsPath.AllocSysString();
m_pExternalDrawingConverter->SaveDstContentRels(bstrRelsPath);
SysFreeString(bstrRelsPath);
CString sContentTypePath(bsContentTypePath);
sContentTypePath.Append(sFilename);
sContentTypePath.Append(sExt);
CString sContentTypeXml;
sContentTypeXml.Format(_T("<Override PartName=\"%s\" ContentType=\"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\"/>"), sContentTypePath);
*bsContentTypeElement = sContentTypeXml.AllocSysString();
hRes = S_OK;
}
}
return hRes;
}
STDMETHOD(SetDrawingConverter)(IUnknown* pDocument)
{
RELEASEINTERFACE(m_pExternalDrawingConverter);
pDocument->QueryInterface(__uuidof(PPTXFile::IAVSOfficeDrawingConverter), (void**)&m_pExternalDrawingConverter);
return S_OK;
}
STDMETHOD(SetFontDir)(BSTR bsMediaDir)
{
m_oFontProcessor.setFontDir(bsMediaDir);
return S_OK;
}
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
CString sParamName; sParamName = ParamName;
if (_T("EmbeddedFontsDirectory") == sParamName && ParamValue.vt == VT_BSTR)
{
m_strEmbeddedFontsDirectory = ParamValue.bstrVal;
return S_OK;
}
return S_OK;
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
return S_OK;
}
private:
CString CreateTheme()
{
HINSTANCE hInst = _AtlBaseModule.GetModuleInstance();
CString sThemePath;
char sTempPath[MAX_PATH], sTempFile[MAX_PATH];
if ( 0 == GetTempPathA( MAX_PATH, sTempPath ) )
return sThemePath;
if ( 0 == GetTempFileNameA( sTempPath, NULL, 0, sTempFile ) )
return sThemePath;
sThemePath = sTempFile;
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_DEFAULT_XLSX_THEME), _T("XLSXSER"), sThemePath);
return sThemePath;
}
void LoadResourceFile(HINSTANCE hInst, LPCTSTR sResName, LPCTSTR sResType, const CString& strDstFile)
{
HRSRC hrRes = FindResource(hInst, sResName, sResType);
if (!hrRes)
return;
HGLOBAL hGlobal = LoadResource(hInst, hrRes);
DWORD sz = SizeofResource(hInst, hrRes);
void* ptrRes = LockResource(hGlobal);
CFile oFile;
oFile.CreateFile(strDstFile);
oFile.WriteFile(ptrRes, sz);
UnlockResource(hGlobal);
FreeResource(hGlobal);
}
private:
BinXlsxRW::FontProcessor m_oFontProcessor;
};

View File

@@ -0,0 +1,743 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
namespace BinXlsxRW
{
const double g_dKoef_mm_to_pt = 72 / (2.54 * 10);
const double g_dKoef_mm_to_twips = 20 * g_dKoef_mm_to_pt;
const double g_dKoef_mm_to_emu = 36000;
const double g_dKoef_mm_to_eightpoint = 8 * g_dKoef_mm_to_pt;
const static TCHAR* g_sFormatSignature = _T("XLSY");
const int g_nFormatVersion = 2;
namespace c_oFileTypes{enum c_oFileTypes
{
XLSX = 1,
CSV = 2
};}
namespace c_oSerConstants{enum c_oSerConstants
{
ErrorFormat = -2,
ErrorUnknown = -1,
ReadOk = 0,
ReadUnknown = 1,
ErrorStream = 0x55
};}
namespace c_oSerPropLenType{enum c_oSerPropLenType
{
Null = 0,
Byte = 1,
Short = 2,
Three = 3,
Long = 4,
Double = 5,
Variable = 6
};}
namespace c_oSerTableTypes{enum c_oSerTableTypes
{
Other = 0,
SharedStrings = 1,
Styles = 2,
Workbook = 3,
Worksheets = 4,
CalcChain = 5
};}
namespace c_oSerStylesTypes{enum c_oSerStylesTypes
{
Borders = 0,
Border = 1,
CellXfs = 2,
Xfs = 3,
Fills = 4,
Fill = 5,
Fonts = 6,
Font = 7,
NumFmts = 8,
NumFmt = 9,
Dxfs = 10,
Dxf = 11,
TableStyles = 12,
CellStyleXfs = 14,
CellStyles = 15,
CellStyle = 16
};}
namespace c_oSerBorderTypes{enum c_oSerBorderTypes
{
Bottom = 0,
Diagonal = 1,
End = 2,
Horizontal = 3,
Start = 4,
Top = 5,
Vertical = 6,
DiagonalDown = 7,
DiagonalUp = 8,
Outline = 9
};}
namespace c_oSerBorderPropTypes{enum c_oSerBorderPropTypes
{
Color = 0,
Style = 1
};}
namespace c_oSerXfsTypes{enum c_oSerXfsTypes
{
ApplyAlignment = 0,
ApplyBorder = 1,
ApplyFill = 2,
ApplyFont = 3,
ApplyNumberFormat = 4,
ApplyProtection = 5,
BorderId = 6,
FillId = 7,
FontId = 8,
NumFmtId = 9,
PivotButton = 10,
QuotePrefix = 11,
XfId = 12,
Aligment = 13,
Protection = 14
};}
namespace c_oSerAligmentTypes{enum c_oSerAligmentTypes
{
Horizontal = 0,
Indent = 1,
JustifyLastLine = 2,
ReadingOrder = 3,
RelativeIndent = 4,
ShrinkToFit = 5,
TextRotation = 6,
Vertical = 7,
WrapText = 8
};}
namespace c_oSerFillTypes{enum c_oSerFillTypes
{
PatternFill = 0,
PatternFillBgColor = 1
};}
namespace c_oSerFontTypes{enum c_oSerFontTypes
{
Bold = 0,
Color = 1,
Italic = 3,
RFont = 4,
Strike = 5,
Sz = 6,
Underline = 7,
VertAlign = 8,
Scheme = 9
};}
namespace c_oSerNumFmtTypes{enum c_oSerNumFmtTypes
{
FormatCode = 0,
NumFmtId = 1
};}
namespace c_oSerSharedStringTypes{enum c_oSerSharedStringTypes
{
Si = 0,
Run = 1,
RPr = 2,
Text = 3,
};}
namespace c_oSerWorkbookTypes{enum c_oSerWorkbookTypes
{
WorkbookPr = 0,
BookViews = 1,
WorkbookView = 2,
DefinedNames = 3,
DefinedName = 4
};}
namespace c_oSerWorkbookPrTypes{enum c_oSerWorkbookPrTypes
{
Date1904 = 0,
DateCompatibility = 1,
};}
namespace c_oSerWorkbookViewTypes{enum c_oSerWorkbookViewTypes
{
ActiveTab = 0
};}
namespace c_oSerDefinedNameTypes{enum c_oSerDefinedNameTypes
{
Name = 0,
Ref = 1,
LocalSheetId = 2
};}
namespace c_oSerWorksheetsTypes{enum c_oSerWorksheetsTypes
{
Worksheet = 0,
WorksheetProp = 1,
Cols = 2,
Col = 3,
Dimension = 4,
Hyperlinks = 5,
Hyperlink = 6,
MergeCells = 7,
MergeCell = 8,
SheetData = 9,
Row = 10,
SheetFormatPr = 11,
Drawings = 12,
Drawing = 13,
PageMargins = 14,
PageSetup = 15,
PrintOptions = 16,
Autofilter = 17,
TableParts = 18,
Comments = 19,
Comment = 20,
ConditionalFormatting = 21,
SheetViews = 22,
SheetView = 23,
SheetPr = 24
};}
namespace c_oSerWorksheetPropTypes{enum c_oSerWorksheetPropTypes
{
Name = 0,
SheetId = 1,
State = 2
};}
namespace c_oSerWorksheetColTypes{enum c_oSerWorksheetColTypes
{
BestFit = 0,
Hidden = 1,
Max = 2,
Min = 3,
Style = 4,
Width = 5,
CustomWidth = 6
};}
namespace c_oSerHyperlinkTypes{enum c_oSerWorksheetColTypes
{
Ref = 0,
Hyperlink = 1,
Location = 2,
Tooltip = 3
};}
namespace c_oSerSheetFormatPrTypes{enum c_oSerSheetFormatPrTypes
{
DefaultColWidth = 0,
DefaultRowHeight = 1,
BaseColWidth = 2
};}
namespace c_oSerRowTypes{enum c_oSerRowTypes
{
Row = 0,
Style = 1,
Height = 2,
Hidden = 3,
Cells = 4,
Cell = 5,
CustomHeight = 6
};}
namespace c_oSerCellTypes{enum c_oSerCellTypes
{
Ref = 0,
Style = 1,
Type = 2,
Value = 3,
Formula = 4
};}
namespace c_oSerFormulaTypes{enum c_oSerFormulaTypes
{
Aca = 0,
Bx = 1,
Ca = 2,
Del1 = 3,
Del2 = 4,
Dt2D = 5,
Dtr = 6,
R1 = 7,
R2 = 8,
Ref = 9,
Si = 10,
T = 11,
Text = 12
};}
namespace c_oSer_DrawingType{enum c_oSer_DrawingType
{
Type = 0,
From = 1,
To = 2,
Pos = 3,
Pic = 4,
PicSrc = 5,
GraphicFrame = 6,
Chart = 7,
Ext = 8,
pptxDrawing = 9
};}
namespace c_oSer_DrawingFromToType{enum c_oSer_DrawingFromToType
{
Col = 0,
ColOff = 1,
Row = 2,
RowOff = 3
};}
namespace c_oSer_DrawingPosType{enum c_oSer_DrawingPosType
{
X = 0,
Y = 1
};}
namespace c_oSer_DrawingExtType{enum c_oSer_DrawingExtType
{
Cx = 0,
Cy = 1
};}
namespace c_oSer_OtherType{enum c_oSer_OtherType
{
Media = 0,
MediaItem = 1,
MediaId = 2,
MediaSrc = 3,
EmbeddedFonts = 4,
Theme = 5
};}
namespace c_oSer_CalcChainType{enum c_oSer_CalcChainType
{
CalcChainItem = 0,
Array = 1,
SheetId = 2,
DependencyLevel = 3,
Ref = 4,
ChildChain = 5,
NewThread = 6
};}
namespace c_oSer_ChartType{enum c_oSer_ChartType
{
Legend = 0,
Title = 1,
PlotArea = 2,
Style = 3,
TitlePptx = 4,
ShowBorder = 5,
SpPr = 6
};}
namespace c_oSer_ChartTitlePptxType{enum c_oSer_ChartTitlePptxType
{
TxPptx = 0,
TxPrPptx = 1
};}
namespace c_oSer_ChartLegendType{enum c_oSer_ChartLegendType
{
LegendPos = 0,
Overlay = 1,
Layout = 2,
LegendEntry = 3,
TxPrPptx = 4
};}
namespace c_oSer_ChartLegendEntryType{enum c_oSer_ChartLegendEntryType
{
Delete = 0,
Index = 1,
TxPrPptx = 2
};}
namespace c_oSer_ChartLegendLayoutType{enum c_oSer_ChartLegendLayoutType
{
H = 0,
HMode = 1,
LayoutTarget = 2,
W = 3,
WMode = 4,
X = 5,
XMode = 6,
Y = 7,
YMode = 8
};}
namespace c_oSer_ChartPlotAreaType{enum c_oSer_ChartPlotAreaType
{
CatAx = 0,
ValAx = 1,
SerAx = 2,
ValAxPos = 3,
BasicChart = 4
};}
namespace c_oSer_ChartCatAxType{enum c_oSer_ChartCatAxType
{
Title = 0,
MajorGridlines = 1,
Delete = 2,
AxPos = 3,
TitlePptx = 4,
TxPrPptx = 5
};}
namespace c_oSer_BasicChartType{enum c_oSer_BasicChartType
{
Type = 0,
BarDerection = 1,
Grouping = 2,
Overlap = 3,
Series = 4,
Seria = 5,
DataLabels = 6,
};}
namespace c_oSer_ChartSeriesType{enum c_oSer_ChartSeriesType
{
Val = 0,
Tx = 1,
Marker = 2,
OutlineColor = 3,
xVal = 4,
TxRef = 5,
Index = 6,
Order = 7,
DataLabels = 8,
SpPr = 9,
Cat = 10
};}
namespace c_oSer_ChartSeriesMarkerType{enum c_oSer_ChartSeriesMarkerType
{
Size = 0,
Symbol = 1
};}
namespace c_oSer_ChartSeriesDataLabelsType{enum c_oSer_ChartSeriesDataLabelsType
{
ShowVal = 0,
TxPrPptx = 1,
ShowCatName = 2
};}
namespace c_oSer_ChartSeriesNumCacheType{enum c_oSer_ChartSeriesNumCacheType
{
Formula = 0,
NumCache = 1,
NumCacheVal = 2,
NumCacheIndex = 3,
NumCache2 = 4,
NumCacheItem = 5
};}
namespace c_oSer_ColorObjectType{enum c_oSer_ColorObjectType
{
Rgb = 0,
Type = 1,
Theme = 2,
Tint = 3
};}
namespace c_oSer_ColorType{enum c_oSer_ColorType
{
Auto = 0
};}
namespace c_oSer_PageMargins{enum c_oSer_PageMargins
{
Left = 0,
Top = 1,
Right = 2,
Bottom = 3,
Header = 4,
Footer = 5
};}
namespace c_oSer_PageSetup{enum c_oSer_PageSetup
{
Orientation = 0,
PaperSize = 1
};}
namespace c_oSer_PrintOptions{enum c_oSer_PrintOptions
{
GridLines = 0,
Headings = 1
};}
namespace c_oSer_TablePart{enum c_oSer_TablePart
{
Table = 0,
Ref = 1,
TotalsRowCount = 2,
DisplayName = 3,
AutoFilter = 4,
SortState = 5,
TableColumns = 6,
TableStyleInfo = 7,
HeaderRowCount = 8
};}
namespace c_oSer_TableStyleInfo{enum c_oSer_TableStyleInfo
{
Name = 0,
ShowColumnStripes = 1,
ShowRowStripes = 2,
ShowFirstColumn = 3,
ShowLastColumn = 4
};}
namespace c_oSer_TableColumns{enum c_oSer_TableColumns
{
TableColumn = 0,
Name = 1,
DataDxfId = 2,
TotalsRowLabel = 3,
TotalsRowFunction = 4,
TotalsRowFormula = 5,
CalculatedColumnFormula = 6
};}
namespace c_oSer_SortState{enum c_oSer_SortState
{
Ref = 0,
CaseSensitive = 1,
SortConditions = 2,
SortCondition = 3,
ConditionRef = 4,
ConditionSortBy = 5,
ConditionDescending = 6,
ConditionDxfId = 7
};}
namespace c_oSer_AutoFilter{enum c_oSer_AutoFilter
{
Ref = 0,
FilterColumns = 1,
FilterColumn = 2,
SortState = 3
};}
namespace c_oSer_FilterColumn{enum c_oSer_FilterColumn
{
ColId = 0,
Filters = 1,
Filter = 2,
DateGroupItem = 3,
CustomFilters = 4,
ColorFilter = 5,
Top10 = 6,
DynamicFilter = 7,
HiddenButton = 8,
ShowButton = 9,
FiltersBlank = 10
};}
namespace c_oSer_Filter{enum c_oSer_Filter
{
Val = 0
};}
namespace c_oSer_DateGroupItem{enum c_oSer_DateGroupItem
{
DateTimeGrouping = 0,
Day = 1,
Hour = 2,
Minute = 3,
Month = 4,
Second = 5,
Year = 6
};}
namespace c_oSer_CustomFilters{enum c_oSer_CustomFilters
{
And = 0,
CustomFilters = 1,
CustomFilter = 2,
Operator = 3,
Val = 4
};}
namespace c_oSer_DynamicFilter{enum c_oSer_DynamicFilter
{
Type = 0,
Val = 1,
MaxVal = 2
};}
namespace c_oSer_ColorFilter{enum c_oSer_ColorFilter
{
CellColor = 0,
DxfId = 1
};}
namespace c_oSer_Top10{enum c_oSer_Top10
{
FilterVal = 0,
Percent = 1,
Top = 2,
Val = 3
};}
namespace c_oSer_Dxf{enum c_oSer_Dxf
{
Alignment = 0,
Border = 1,
Fill = 2,
Font = 3,
NumFmt = 4
};}
namespace c_oSer_TableStyles{enum c_oSer_TableStyles
{
DefaultTableStyle = 0,
DefaultPivotStyle = 1,
TableStyles = 2,
TableStyle = 3
};}
namespace c_oSer_TableStyle{enum c_oSer_TableStyle
{
Name = 0,
Pivot = 1,
Table = 2,
Elements = 3,
Element = 4,
DisplayName = 5
};}
namespace c_oSer_TableStyleElement{enum c_oSer_TableStyleElement
{
DxfId = 0,
Size = 1,
Type = 2
};}
namespace c_oSer_Comments{enum c_oSer_Comments
{
Row = 0,
Col = 1,
CommentDatas = 2,
CommentData = 3,
Left = 4,
LeftOffset = 5,
Top = 6,
TopOffset = 7,
Right = 8,
RightOffset = 9,
Bottom = 10,
BottomOffset = 11,
LeftMM = 12,
TopMM = 13,
WidthMM = 14,
HeightMM = 15,
MoveWithCells = 16,
SizeWithCells = 17
};}
namespace c_oSer_CommentData{enum c_oSer_CommentData
{
Text = 0,
Time = 1,
UserId = 2,
UserName = 3,
QuoteText = 4,
Solved = 5,
Document = 6,
Replies = 7,
Reply = 8
};}
namespace c_oSer_ConditionalFormatting{enum c_oSer_ConditionalFormatting
{
Pivot = 0,
SqRef = 1,
ConditionalFormattingRule = 2
};}
namespace c_oSer_ConditionalFormattingRule{enum c_oSer_ConditionalFormattingRule
{
AboveAverage = 0,
Bottom = 1,
DxfId = 2,
EqualAverage = 3,
Operator = 4,
Percent = 5,
Priority = 6,
Rank = 7,
StdDev = 8,
StopIfTrue = 9,
Text = 10,
TimePeriod = 11,
Type = 12,
ColorScale = 14,
DataBar = 15,
FormulaCF = 16,
IconSet = 17
};}
namespace c_oSer_ConditionalFormattingRuleColorScale{enum c_oSer_ConditionalFormattingRuleElement
{
CFVO = 0,
Color = 1,
};}
namespace c_oSer_ConditionalFormattingDataBar{enum c_oSer_ConditionalFormattingDataBar
{
CFVO = 0,
Color = 1,
MaxLength = 2,
MinLength = 3,
ShowValue = 4
};}
namespace c_oSer_ConditionalFormattingIconSet{enum c_oSer_ConditionalFormattingIconSet
{
CFVO = 0,
IconSet = 1,
Percent = 2,
Reverse = 3,
ShowValue = 4
};}
namespace c_oSer_ConditionalFormattingValueObject{enum c_oSer_ConditionalFormattingValueObject
{
Gte = 0,
Type = 1,
Val = 2
};}
namespace c_oSer_SheetView{enum c_oSer_SheetView
{
ColorId = 0,
DefaultGridColor = 1,
RightToLeft = 2,
ShowFormulas = 3,
ShowGridLines = 4,
ShowOutlineSymbols = 5,
ShowRowColHeaders = 6,
ShowRuler = 7,
ShowWhiteSpace = 8,
ShowZeros = 9,
TabSelected = 10,
TopLeftCell = 11,
View = 12,
WindowProtection = 13,
WorkbookViewId = 14,
ZoomScale = 15,
ZoomScaleNormal = 16,
ZoomScalePageLayoutView = 17,
ZoomScaleSheetLayoutView = 18,
Pane = 19
};}
namespace c_oSer_Pane{enum c_oSer_Pane
{
ActivePane = 0,
State = 1,
TopLeftCell = 2,
XSplit = 3,
YSplit = 4
};}
namespace c_oSer_CellStyle{enum c_oSer_CellStyle
{
BuiltinId = 0,
CustomBuiltin = 1,
Hidden = 2,
ILevel = 3,
Name = 4,
XfId = 5
};}
namespace c_oSer_SheetPr{enum c_oSer_SheetPr
{
CodeName = 0,
EnableFormatConditionsCalculation = 1,
FilterMode = 2,
Published = 3,
SyncHorizontal = 4,
SyncRef = 5,
SyncVertical = 6,
TransitionEntry = 7,
TransitionEvaluation = 8,
TabColor = 9
};}
}

View File

@@ -0,0 +1,196 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "../../ASCOfficeDocxFile2/BinReader/FileDownloader.h"
namespace SerializeCommon
{
bool IsUnicodeSymbol( WCHAR symbol )
{
bool result = false;
if ( ( 0x0009 == symbol ) || ( 0x000A == symbol ) || ( 0x000D == symbol ) ||
( ( 0x0020 <= symbol ) && ( 0xD7FF >= symbol ) ) || ( ( 0xE000 <= symbol ) && ( symbol <= 0xFFFD ) ) ||
( ( 0x10000 <= symbol ) && symbol ) )
{
result = true;
}
return result;
}
void CorrectString(CString& strValue)
{
for (unsigned int i = 0, length = strValue.GetLength(); i < length; ++i )
{
if ( false == IsUnicodeSymbol( strValue.GetAt(i) ) )
{
strValue.SetAt(i, ' ');
}
}
strValue.Replace(_T("&"), _T("&amp;"));
strValue.Replace(_T("'"), _T("&apos;"));
strValue.Replace(_T("<"), _T("&lt;"));
strValue.Replace(_T(">"), _T("&gt;"));
strValue.Replace(_T("\""), _T("&quot;"));
}
CString DownloadImage(const CString& strFile)
{
CFileDownloader oDownloader(strFile, FALSE);
oDownloader.Start( 1 );
while ( oDownloader.IsRunned() )
{
::Sleep( 10 );
}
CString strFileName;
if ( oDownloader.IsFileDownloaded() )
{
strFileName = oDownloader.GetFilePath();
}
return strFileName;
}
VOID convertBase64ToImage (CString sImage, CString &pBase64)
{
HANDLE hFileWriteHandle;
hFileWriteHandle = ::CreateFile (sImage, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (INVALID_HANDLE_VALUE != hFileWriteHandle)
{
INT nUTF8Len = WideCharToMultiByte (CP_UTF8, 0, pBase64, pBase64.GetLength (), NULL, NULL, NULL, NULL);
CHAR *pUTF8String = new CHAR [nUTF8Len + 1];
::ZeroMemory (pUTF8String, sizeof (CHAR) * (nUTF8Len + 1));
WideCharToMultiByte (CP_UTF8, 0, pBase64, -1, pUTF8String, nUTF8Len, NULL, NULL);
CStringA sUnicode; sUnicode = pUTF8String;
delete[] pUTF8String;
int nShift = 0;
int nIndex = sUnicode.Find("base64,");
if(-1 != nIndex)
{
nShift = nIndex + 7;
}
LONG lFileSize = sUnicode.GetLength () - nShift;
INT nDstLength = lFileSize;
BYTE *pBuffer = new BYTE [lFileSize];
::ZeroMemory (pBuffer, lFileSize);
Base64::Base64Decode ((LPCSTR)sUnicode.GetBuffer () + nShift, lFileSize, pBuffer, &nDstLength);
DWORD dwBytesWrite = 0;
::WriteFile (hFileWriteHandle, pBuffer, nDstLength, &dwBytesWrite, 0);
RELEASEARRAYOBJECTS (pBuffer);
CloseHandle (hFileWriteHandle);
}
}
CString changeExtention(CString& sSourcePath, CString& sTargetExt)
{
wchar_t path_buffer[_MAX_PATH];
wchar_t drive[_MAX_DRIVE];
wchar_t dir[_MAX_DIR];
wchar_t fname[_MAX_FNAME];
wchar_t ext[_MAX_EXT];
_wsplitpath(sSourcePath, drive, dir, fname, ext);
_tmakepath(path_buffer, drive, dir, fname, sTargetExt);
return CString(path_buffer);
}
class CommentData
{
public :
CString sText;
CString sTime;
CString sUserId;
CString sUserName;
CString sQuoteText;
bool Solved;
bool Document;
bool bSolved;
bool bDocument;
CAtlArray<CommentData*> aReplies;
CommentData()
{
bSolved = false;
bDocument = false;
}
~CommentData()
{
for(int i = 0, length = aReplies.GetCount(); i < length; ++i)
delete aReplies[i];
aReplies.RemoveAll();
}
};
void ReadFileType(CString& sXMLOptions, BYTE& result, UINT& nCodePage, WCHAR& wcDelimiter)
{
result = BinXlsxRW::c_oFileTypes::XLSX;
nCodePage = CP_UTF8;
wcDelimiter = _T(',');
nullable<SimpleTypes::CUnsignedDecimalNumber<>> fileType;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> codePage;
nullable<CString> delimiter;
XmlUtils::CXmlLiteReader oReader;
if (TRUE != oReader.FromString(sXMLOptions) || TRUE != oReader.IsValid())
return;
oReader.ReadNextNode();
if (oReader.IsEmptyNode())
return;
int nCurDepth = oReader.GetDepth();
while(oReader.ReadNextSiblingNode(nCurDepth))
{
CWCharWrapper sName = oReader.GetName();
if (_T("fileOptions") == sName)
{
WritingElement_ReadAttributes_Start(oReader)
WritingElement_ReadAttributes_Read_if (oReader, _T("fileType"), fileType)
WritingElement_ReadAttributes_Read_else_if (oReader, _T("codePage"), codePage)
WritingElement_ReadAttributes_Read_else_if (oReader, _T("delimiter"), delimiter)
WritingElement_ReadAttributes_End(oReader)
result = (BYTE)fileType->GetValue();
nCodePage = (UINT)codePage->GetValue();
const CString& sDelimiter = delimiter.get();
if (0 < sDelimiter.GetLength())
wcDelimiter = sDelimiter.GetAt(0);
break;
}
}
return;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,250 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <stack>
namespace CSVReader
{
void AddCell(CString &sText, INT nStartCell, std::stack<INT> &oDeleteChars, OOX::Spreadsheet::CRow &oRow, INT nRow, INT nCol, BOOL bIsWrap)
{
while(!oDeleteChars.empty())
{
INT nIndex = oDeleteChars.top() - nStartCell;
sText.Delete(nIndex);
oDeleteChars.pop();
}
OOX::Spreadsheet::CCell *pCell = new OOX::Spreadsheet::CCell();
pCell->m_oType.Init();
WCHAR *pEndPtr;
LONG lValue = wcstol(sText, &pEndPtr, 10);
if (NULL != *pEndPtr)
{
pCell->m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeInlineStr);
pCell->m_oRichText.Init();
OOX::Spreadsheet::CText *pText = new OOX::Spreadsheet::CText();
pText->m_sText = sText;
pCell->m_oRichText->m_arrItems.Add(pText);
}
else
{
pCell->m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeNumber);
pCell->m_oValue.Init();
pCell->m_oValue->m_sText = sText;
}
if (bIsWrap)
{
pCell->m_oStyle.Init();
pCell->m_oStyle->SetValue(1);
}
pCell->m_oRef.Init();
pCell->m_oRef = OOX::Spreadsheet::CWorksheet::combineRef(nRow, nCol);
oRow.m_arrItems.Add(pCell);
}
void ReadFromCsvToXlsx(CString &sFileName, OOX::Spreadsheet::CXlsx &oXlsx, UINT nCodePage, CONST WCHAR wcDelimiter)
{
oXlsx.CreateWorkbook();
oXlsx.CreateStyles();
OOX::Spreadsheet::CStyles *pStyles = oXlsx.GetStyles();
pStyles->m_oCellXfs.Init();
pStyles->m_oCellXfs->m_oCount.Init();
pStyles->m_oCellXfs->m_oCount->SetValue(2);
OOX::Spreadsheet::CXfs* pXfs = NULL;
pXfs = new OOX::Spreadsheet::CXfs();
pXfs->m_oBorderId.Init();
pXfs->m_oBorderId->SetValue(0);
pXfs->m_oFillId.Init();
pXfs->m_oFillId->SetValue(0);
pXfs->m_oFontId.Init();
pXfs->m_oFontId->SetValue(0);
pXfs->m_oNumFmtId.Init();
pXfs->m_oNumFmtId->SetValue(0);
pStyles->m_oCellXfs->m_arrItems.Add(pXfs);
pXfs = new OOX::Spreadsheet::CXfs();
pXfs->m_oBorderId.Init();
pXfs->m_oBorderId->SetValue(0);
pXfs->m_oFillId.Init();
pXfs->m_oFillId->SetValue(0);
pXfs->m_oFontId.Init();
pXfs->m_oFontId->SetValue(0);
pXfs->m_oNumFmtId.Init();
pXfs->m_oNumFmtId->SetValue(0);
pXfs->m_oApplyAlignment.Init();
pXfs->m_oApplyAlignment->SetValue(SimpleTypes::onoffTrue);
pXfs->m_oAligment.Init();
pXfs->m_oAligment->m_oWrapText.Init();
pXfs->m_oAligment->m_oWrapText->SetValue(SimpleTypes::onoffTrue);
pStyles->m_oCellXfs->m_arrItems.Add(pXfs);
CString sSheetRId = _T("rId1");
OOX::Spreadsheet::CWorksheet* pWorksheet = new OOX::Spreadsheet::CWorksheet();
pWorksheet->m_oSheetData.Init();
OOX::Spreadsheet::CSheet *pSheet = new OOX::Spreadsheet::CSheet();
pSheet->m_oRid.Init();
pSheet->m_oRid->SetValue(sSheetRId);
OOX::Spreadsheet::CWorkbook *pWorkbook = oXlsx.GetWorkbook();
pWorkbook->m_oSheets.Init();
pWorkbook->m_oSheets->m_arrItems.Add(pSheet);
MemoryMapping::CMappingFile oMappingFile = MemoryMapping::CMappingFile();
if(FALSE != oMappingFile.Open(sFileName))
{
long nFileSize = oMappingFile.GetSize();
LPCSTR pFileData = (LPCSTR)oMappingFile.GetData();
INT nSize = MultiByteToWideChar(nCodePage, 0, pFileData, nFileSize, NULL, 0);
WCHAR *pTemp = new WCHAR [nSize];
::ZeroMemory (pTemp, sizeof(WCHAR) * nSize);
MultiByteToWideChar (nCodePage, 0, pFileData, nFileSize, pTemp, nSize);
oMappingFile.Close();
CONST WCHAR wcNewLineN = _T('\n');
CONST WCHAR wcNewLineR = _T('\r');
CONST WCHAR wcQuote = _T('"');
CONST WCHAR wcTab = _T('\t');
BOOL bIsWrap = FALSE;
WCHAR wcCurrent;
INT nStartCell = 0;
std::stack<INT> oDeleteChars;
BOOL bInQuote = FALSE;
INT nIndexRow = 0;
INT nIndexCol = 0;
OOX::Spreadsheet::CRow *pRow = new OOX::Spreadsheet::CRow();
pRow->m_oR.Init();
pRow->m_oR->SetValue(nIndexRow + 1);
for (INT nIndex = 0; nIndex < nSize; ++nIndex)
{
wcCurrent = pTemp[nIndex];
if (wcDelimiter == wcCurrent)
{
if (bInQuote)
continue;
CString sCellText(pTemp + nStartCell, nIndex - nStartCell);
AddCell(sCellText, nStartCell, oDeleteChars, *pRow, nIndexRow, nIndexCol++, bIsWrap);
bIsWrap = FALSE;
nStartCell = nIndex + 1;
if (nStartCell == nSize)
{
pWorksheet->m_oSheetData->m_arrItems.Add(pRow);
pRow = NULL;
}
}
else if (wcNewLineN == wcCurrent || wcNewLineR == wcCurrent)
{
if (bInQuote)
{
bIsWrap = TRUE;
continue;
}
if (nStartCell != nIndex)
{
CString sCellText(pTemp + nStartCell, nIndex - nStartCell);
AddCell(sCellText, nStartCell, oDeleteChars, *pRow, nIndexRow, nIndexCol++, bIsWrap);
bIsWrap = FALSE;
}
nStartCell = nIndex + 1;
pWorksheet->m_oSheetData->m_arrItems.Add(pRow);
pRow = new OOX::Spreadsheet::CRow();
pRow->m_oR.Init();
pRow->m_oR->SetValue(++nIndexRow + 1);
nIndexCol = 0;
}
else if (wcQuote == wcCurrent)
{
if (FALSE == bInQuote && nStartCell == nIndex && nIndex + 1 != nSize)
{
bInQuote = !bInQuote;
nStartCell = nIndex + 1;
}
else if (TRUE == bInQuote)
{
oDeleteChars.push(nIndex);
if (nIndex + 1 != nSize && wcQuote == pTemp[nIndex + 1])
++nIndex;
else
bInQuote = !bInQuote;
}
}
else if (wcTab == wcCurrent)
{
oDeleteChars.push(nIndex);
}
}
if (nStartCell != nSize)
{
CString sCellText(pTemp + nStartCell, nSize - nStartCell);
AddCell(sCellText, nStartCell, oDeleteChars, *pRow, nIndexRow, nIndexCol++, bIsWrap);
pWorksheet->m_oSheetData->m_arrItems.Add(pRow);
}
else
{
RELEASEOBJECT(pRow);
}
RELEASEARRAYOBJECTS(pTemp);
}
CAtlMap<CString, OOX::Spreadsheet::CWorksheet*> &arrWorksheets = oXlsx.GetWorksheets();
arrWorksheets.SetAt(sSheetRId, pWorksheet);
}
}

View File

@@ -0,0 +1,153 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "FontProcessor.h"
namespace XlsxReader {
FontProcessor::FontProcessor()
: m_pFontManager(NULL) {}
FontProcessor::~FontProcessor() {
RELEASEINTERFACE(m_pFontManager);
}
void FontProcessor::setFontDir(const CString& fontDir) {
this->m_sFontDir = fontDir;
initFontManager();
}
void FontProcessor::setFontTable(const OOX::Spreadsheet::CFonts& oFonts) {
for (int i = 0, length = oFonts.m_arrItems.GetSize(); i < length; ++i)
{
OOX::Spreadsheet::WritingElement* we = oFonts.m_arrItems[i];
if(OOX::Spreadsheet::et_Font == we->getType())
{
OOX::Spreadsheet::CFont* pFont = static_cast<OOX::Spreadsheet::CFont*>(we);
if(NULL != pFont)
addToFontMap(pFont);
}
}
}
CString FontProcessor::getFont(const CString& name) {
CString fontName = _T("Arial");
if (fontMap.find(name) != fontMap.end())
fontName = fontMap[name];
else
{
OOX::CFont font;
font.m_sName = name;
addToFontMap(font);
if (fontMap.find(name) != fontMap.end())
fontName = fontMap[name];
}
return fontName;
}
void FontProcessor::initFontManager() {
RELEASEINTERFACE(m_pFontManager);
CoCreateInstance(__uuidof(AVSGraphics::CAVSFontManager), NULL, CLSCTX_ALL, __uuidof(AVSGraphics::IAVSFontManager), (void**) &m_pFontManager);
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = m_sFontDir.AllocSysString();
m_pFontManager->SetAdditionalParam(L"InitializeFromFolder", var);
RELEASESYSSTRING(var.bstrVal);
CString defaultFontName = _T("Arial");
BSTR defFontName = defaultFontName.AllocSysString();
fontManager->SetDefaultFont(defFontName);
SysFreeString(defFontName);
}
void FontProcessor::addToFontMap(OOX::Spreadsheet::CFont* pFont) {
CString parw;
parw += _T("<FontProperties>");
if(pFont->m_oCharset.IsInit() && pFont->m_oCharset->m_oCharset.IsInit())
{
SimpleTypes::EFontCharset eCharset = pFont->m_oCharset->m_oCharset->GetValue();
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
parw += _T("<Charset value='") + pFont->m_oCharset->m_oCharset->ToHexString() + _T("'/>");
}
CString sFontName;
if(pFont->m_oRFont.IsInit())
sFontName = pFont->m_oRFont->ToString2();
if(sFontName.IsEmpty())
parw += _T("<Name value='") + CString(gc_sNoNameFont) + _T("'/>");
else
{
parw += _T("<Name value='")+ sFontName + _T("'/>");
}
if(pFont->m_oScheme->m_oFontScheme.IsInit())
{
}
parw += _T("<FamilyClass name='") + font.m_oFamily.ToString() + _T("'/>");
if(font.m_oPanose.IsInit())
parw += _T("<Panose value='") + font.m_oPanose->ToString() + _T("'/>");
if (font.m_oPitch.GetValue() == SimpleTypes::pitchFixed)
parw += _T("<FixedWidth value='1'/>");
else
parw += _T("<FixedWidth value='0'/>");
parw += _T("<UnicodeRange ");
if (font.m_oUsb0.IsInit())
parw += _T("range1='") + font.m_oUsb0->ToString() + _T("' ");
if (font.m_oUsb1.IsInit())
parw += _T("range2='") + font.m_oUsb1->ToString() + _T("' ");
if (font.m_oUsb2.IsInit())
parw += _T("range3='") + font.m_oUsb2->ToString() + _T("' ");
if (font.m_oUsb3.IsInit())
parw += _T("range4='") + font.m_oUsb3->ToString() + _T("' ");
if (font.m_oCsb0.IsInit())
parw += _T("coderange1='") + font.m_oCsb0->ToString() + _T("' ");
if (font.m_oCsb1.IsInit())
parw += _T("coderange2='") + font.m_oCsb1->ToString() + _T("' ");
parw += _T("/>");
parw += _T("</FontProperties>");
CString params = parw.GetCString();
BSTR fontPath;
long index = 0;
BSTR bstrParams = params.AllocSysString();
fontManager->GetWinFontByParams(bstrParams, &fontPath, &index);
SysFreeString(bstrParams);
int status = fontManager->LoadFontFromFile(fontPath, 12, 72, 72, index);
SysFreeString(fontPath);
BSTR familyName;
fontManager->GetFamilyName(&familyName);
CString resFontName = familyName;
SysFreeString(familyName);
fontMap[font.m_sName] = resFontName;
}
}

View File

@@ -0,0 +1,176 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "../stdafx.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Styles/Fonts.h"
namespace BinXlsxRW {
static TCHAR* gc_sNoNameFont = _T("NoNameFont");
static TCHAR* gc_sDefaultFontName = _T("Arial");
class FontProcessor {
ASCGraphics::IASCFontManager* m_pFontManager;
CAtlMap<CString, CString> m_mapFontMap;
CString m_sFontDir;
public:
FontProcessor():m_pFontManager(NULL){}
~FontProcessor()
{
RELEASEINTERFACE(m_pFontManager);
}
void setFontDir(const CString& fontDir)
{
this->m_sFontDir = fontDir;
initFontManager();
}
CString getFontDir()
{
return this->m_sFontDir;
}
void setFontTable(const OOX::Spreadsheet::CFonts& oFonts)
{
for (int i = 0, length = oFonts.m_arrItems.GetSize(); i < length; ++i)
{
OOX::Spreadsheet::CFont* pFont = oFonts.m_arrItems[i];
if(NULL != pFont)
addToFontMap(*pFont);
}
}
ASCGraphics::IASCFontManager* getFontManager()
{
return m_pFontManager;
}
CString getFont(const CString& name)
{
CString fontName = gc_sDefaultFontName;
CAtlMap<CString, CString>::CPair* pPair = m_mapFontMap.Lookup( name );
if ( NULL == pPair )
{
if(!name.IsEmpty())
{
OOX::Spreadsheet::CFont oFont;
oFont.m_oRFont.Init();
oFont.m_oRFont->m_sVal = name;
addToFontMap(oFont);
pPair = m_mapFontMap.Lookup( name );
if (NULL != pPair)
fontName = pPair->m_value;
}
}
else
fontName = pPair->m_value;
return fontName;
}
private:
void initFontManager()
{
RELEASEINTERFACE(m_pFontManager);
CoCreateInstance(ASCGraphics::CLSID_CASCFontManager, NULL, CLSCTX_ALL, ASCGraphics::IID_IASCFontManager, (void**) &m_pFontManager);
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = m_sFontDir.AllocSysString();
m_pFontManager->SetAdditionalParam(L"InitializeFromFolder", var);
RELEASESYSSTRING(var.bstrVal);
#ifdef BUILD_CONFIG_FULL_VERSION
CString defaultFontName = gc_sDefaultFontName;
BSTR defFontName = defaultFontName.AllocSysString();
m_pFontManager->SetDefaultFont(defFontName);
SysFreeString(defFontName);
#endif
}
void addToFontMap(OOX::Spreadsheet::CFont& font)
{
CString parw;
parw += _T("<FontProperties>");
if(font.m_oCharset.IsInit() && font.m_oCharset->m_oCharset.IsInit())
{
SimpleTypes::Spreadsheet::EFontCharset eCharset = font.m_oCharset->m_oCharset->GetValue();
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
parw += _T("<Charset value='") + font.m_oCharset->m_oCharset->ToHexString() + _T("'/>");
}
CString sFontName;
if(font.m_oScheme.IsInit() && font.m_oScheme->m_oFontScheme.IsInit())
{
const SimpleTypes::Spreadsheet::EFontScheme eFontScheme = font.m_oScheme->m_oFontScheme->GetValue();
if(SimpleTypes::Spreadsheet::fontschemeNone != eFontScheme)
{
}
}
if(sFontName.IsEmpty() && font.m_oRFont.IsInit() && font.m_oRFont->m_sVal.IsInit())
sFontName = font.m_oRFont->ToString2();
if(sFontName.IsEmpty())
parw += _T("<Name value='") + CString(gc_sNoNameFont) + _T("'/>");
else
{
parw += _T("<Name value='")+ sFontName + _T("'/>");
}
if(font.m_oFamily.IsInit() && font.m_oFamily->m_oFontFamily.IsInit())
{
parw += _T("<FamilyClass name='") + font.m_oFamily->m_oFontFamily->ToString() + _T("'/>");
}
parw += _T("</FontProperties>");
CString params = parw;
BSTR fontPath;
BSTR familyName;
long index = 0;
BSTR bstrParams = params.AllocSysString();
#ifdef BUILD_CONFIG_FULL_VERSION
m_pFontManager->GetWinFontByParams(bstrParams, &fontPath, &index);
int status = m_pFontManager->LoadFontFromFile(fontPath, 12, 72, 72, index);
SysFreeString(fontPath);
m_pFontManager->GetFamilyName(&familyName);
#else
m_pFontManager->GetWinFontByParams(bstrParams, &familyName, &fontPath, NULL, &index);
#endif
CString resFontName = familyName;
SysFreeString(fontPath);
SysFreeString(familyName);
SysFreeString(bstrParams);
m_mapFontMap.SetAt(sFontName, resFontName);
}
};
}

View File

@@ -0,0 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by XlsxSerializerCom.rc
//
#define IDS_PROJNAME 100
#define IDR_XLSXSERIALIZERCOM 101
#define IDB_DEFAULT_XLSX_THEME 201
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,198 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
namespace CSVWriter
{
void WriteFile(CFile *pFile, WCHAR **pWriteBuffer, INT &nCurrentIndex, CString &sWriteString, UINT &nCodePage, BOOL bIsEnd = FALSE)
{
if (NULL == pFile || NULL == pWriteBuffer)
return;
INT nCountChars = sWriteString.GetLength();
if (0 == nCountChars && !bIsEnd)
return;
CONST INT c_nSize = 1048576;
CONST INT nSizeWchar = sizeof(WCHAR);
if (NULL == *pWriteBuffer)
{
*pWriteBuffer = new WCHAR[c_nSize];
::ZeroMemory(*pWriteBuffer, nSizeWchar * c_nSize);
nCurrentIndex = 0;
}
if (nCountChars + nCurrentIndex > c_nSize || bIsEnd)
{
INT nSize = WideCharToMultiByte(nCodePage, 0, *pWriteBuffer, nCurrentIndex, NULL, NULL, NULL, NULL);
CHAR *pString = new CHAR [nSize];
::ZeroMemory (pString, sizeof (CHAR) * nSize);
WideCharToMultiByte (CP_UTF8, 0, *pWriteBuffer, -1, pString, nSize, NULL, NULL);
pFile->WriteFile(pString, sizeof (CHAR) * nSize);
RELEASEARRAYOBJECTS(pString);
::ZeroMemory(*pWriteBuffer, nSizeWchar * c_nSize);
nCurrentIndex = 0;
}
if (!bIsEnd)
{
::CopyMemory(*pWriteBuffer + nCurrentIndex, sWriteString.GetBuffer(), nCountChars * nSizeWchar);
nCurrentIndex += nCountChars;
}
}
void WriteFromXlsxToCsv(CString &sFileDst, OOX::Spreadsheet::CXlsx &oXlsx, UINT nCodePage, CONST WCHAR wcDelimiter)
{
CFile oFile;
oFile.CreateFileW(sFileDst);
LONG lActiveSheet = 0;
CString sSheetRId = _T("Sheet1");
OOX::Spreadsheet::CWorkbook *pWorkbook = oXlsx.GetWorkbook();
if (NULL != pWorkbook)
{
if (pWorkbook->m_oBookViews.IsInit() && 0 < pWorkbook->m_oBookViews->m_arrItems.GetSize())
{
if (pWorkbook->m_oBookViews->m_arrItems[0]->m_oActiveTab.IsInit())
{
lActiveSheet = pWorkbook->m_oBookViews->m_arrItems[0]->m_oActiveTab->GetValue();
if (0 > lActiveSheet)
lActiveSheet = 0;
}
}
if (pWorkbook->m_oSheets.IsInit() && 0 <= pWorkbook->m_oSheets->m_arrItems.GetSize())
{
if (lActiveSheet <= pWorkbook->m_oSheets->m_arrItems.GetSize())
sSheetRId = pWorkbook->m_oSheets->m_arrItems[lActiveSheet]->m_oName.get2();
else
sSheetRId = pWorkbook->m_oSheets->m_arrItems[0]->m_oName.get2();
}
CAtlMap<CString, OOX::Spreadsheet::CWorksheet*> &arrWorksheets = oXlsx.GetWorksheets();
CAtlMap<CString, OOX::Spreadsheet::CWorksheet*>::CPair* pPair = arrWorksheets.Lookup(sSheetRId);
if (NULL != pPair)
{
OOX::Spreadsheet::CWorksheet *pWorksheet = pPair->m_value;
if (NULL != pWorksheet && pWorksheet->m_oSheetData.IsInit())
{
OOX::Spreadsheet::CSharedStrings *pSharedStrings = oXlsx.GetSharedStrings();
CString sNewLineN = _T("\n");
CString sDelimiter = _T(""); sDelimiter += wcDelimiter;
CONST WCHAR wcQuote = _T('"');
CString sEscape = _T("\"\n");
sEscape += wcDelimiter;
INT nCurrentIndex = 0;
WCHAR *pWriteBuffer = NULL;
INT nRowCurrent = 1;
for (INT i = 0; i < pWorksheet->m_oSheetData->m_arrItems.GetSize(); ++i)
{
OOX::Spreadsheet::CRow *pRow = static_cast<OOX::Spreadsheet::CRow *>(pWorksheet->m_oSheetData->m_arrItems[i]);
INT nRow = pRow->m_oR.IsInit() ? pRow->m_oR->GetValue() : 0 == i ? nRowCurrent : nRowCurrent + 1;
while (nRow > nRowCurrent)
{
++nRowCurrent;
WriteFile(&oFile, &pWriteBuffer, nCurrentIndex, sNewLineN, nCodePage);
}
INT nColCurrent = 1;
for (INT j = 0; j < pRow->m_arrItems.GetSize(); ++j)
{
INT nRowTmp = 0;
INT nCol = 0;
if (!OOX::Spreadsheet::CWorksheet::parseRef(pRow->m_arrItems[j]->m_oRef.get2(), nRowTmp, nCol))
nCol = 0 == j ? nColCurrent : nColCurrent + 1;
while (nCol > nColCurrent)
{
++nColCurrent;
WriteFile(&oFile, &pWriteBuffer, nCurrentIndex, sDelimiter, nCodePage);
}
OOX::Spreadsheet::CCell *pCell = static_cast<OOX::Spreadsheet::CCell *>(pRow->m_arrItems[j]);
CString sCellValue = _T("");
if (pCell->m_oValue.IsInit())
{
if (pCell->m_oType.IsInit() && SimpleTypes::Spreadsheet::celltypeNumber != pCell->m_oType->GetValue())
{
int nValue = _wtoi(pCell->m_oValue->ToString());
if (0 <= nValue && nValue < pSharedStrings->m_arrItems.GetSize())
{
OOX::Spreadsheet::CSi *pSi = static_cast<OOX::Spreadsheet::CSi *>(pSharedStrings->m_arrItems[nValue]);
if (NULL != pSi && pSi->m_arrItems.GetSize() > 0)
if(NULL != pSi && pSi->m_arrItems.GetSize() > 0)
{
OOX::Spreadsheet::WritingElement* pWe = pSi->m_arrItems[0];
if(OOX::Spreadsheet::et_t == pWe->getType())
{
OOX::Spreadsheet::CText* pText = static_cast<OOX::Spreadsheet::CText*>(pWe);
sCellValue = pText->m_sText;
}
}
}
}
else
{
sCellValue = pCell->m_oValue->ToString();
}
}
if (-1 != sCellValue.FindOneOf(sEscape))
{
sCellValue.Replace(_T("\""), _T("\"\""));
sCellValue = wcQuote + sCellValue + wcQuote;
}
WriteFile(&oFile, &pWriteBuffer, nCurrentIndex, sCellValue, nCodePage);
}
}
WriteFile(&oFile, &pWriteBuffer, nCurrentIndex, sNewLineN, nCodePage, TRUE);
RELEASEARRAYOBJECTS(pWriteBuffer);
}
}
}
oFile.CloseFile();
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "stdafx.h"
#include "resource.h"
#include "ASCOfficeXlsxSerizer.h"
[ module(dll, uuid = "{E4E17295-6FF8-4bac-B4C2-E17D72111035}",
name = "XlsxSerializerCom",
helpstring = "XlsxSerializerCom 1.0 Type Library",
resource_name = "IDR_XLSXSERIALIZERCOM") ]
class CXlsxSerializerComModule
{
public:
};

View File

@@ -0,0 +1,106 @@
//Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define COMPONENT_NAME "XlsxSerializerCom"
#include "winres.h"
#include "version.h"
#include "../Common/FileInfo.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE 25, 1
#pragma code_page(1251)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION INTVER
PRODUCTVERSION INTVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION_ACTIVEX
VALUE "FileVersion", STRVER
VALUE "InternalName", FILE_DESCRIPTION_ACTIVEX
VALUE "LegalCopyright", LEGAL_COPYRIGHT
VALUE "LegalTrademarks", COMPANY_NAME
VALUE "OriginalFilename", COMPONENT_FILE_NAME_DLL
VALUE "ProductName", FILE_DESCRIPTION_ACTIVEX
VALUE "ProductVersion", STRVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "XlsxSerializerCom"
END
IDR_XLSXSERIALIZERCOM REGISTRY "XlsxSerializerCom.rgs"
////////////////////////////////////////////////////////////////////////////
#endif
IDB_DEFAULT_XLSX_THEME XLSXSER "Resource\\theme1.xml"
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,11 @@
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'XlsxSerializerCom'
'XlsxSerializerCom.DLL'
{
val AppID = s '%APPID%'
}
}
}

View File

@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsxSerializerCom", "XlsxSerializerCom.vcproj", "{87476A4D-6A42-44E9-A947-42B8E8613070}"
ProjectSection(ProjectDependencies) = postProject
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseOpenSource|Win32 = ReleaseOpenSource|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87476A4D-6A42-44E9-A947-42B8E8613070}.Debug|Win32.ActiveCfg = Debug|Win32
{87476A4D-6A42-44E9-A947-42B8E8613070}.Debug|Win32.Build.0 = Debug|Win32
{87476A4D-6A42-44E9-A947-42B8E8613070}.Release|Win32.ActiveCfg = Release|Win32
{87476A4D-6A42-44E9-A947-42B8E8613070}.Release|Win32.Build.0 = Release|Win32
{87476A4D-6A42-44E9-A947-42B8E8613070}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{87476A4D-6A42-44E9-A947-42B8E8613070}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.ActiveCfg = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.Build.0 = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.ActiveCfg = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,437 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="XlsxSerializerCom"
ProjectGUID="{87476A4D-6A42-44E9-A947-42B8E8613070}"
RootNamespace="XlsxSerializerCom"
Keyword="AtlProj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/XlsxSerializerCom.tlb"
HeaderFileName="XlsxSerializerCom.h"
DLLDataFileName=""
InterfaceIdentifierFileName="XlsxSerializerCom_i.c"
ProxyFileName="XlsxSerializerCom_p.c"
ValidateParameters="false"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Common;..\..\Common;..\..\AVSImageStudio3\Common"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
IgnoreImportLibrary="true"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(SolutionDir)/../../Common/DocxFormat/Lib/Debug&quot;"
MergedIDLBaseFileName="_XlsxSerializerCom.idl"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="..\Redist\VersionControl.exe &quot;$(ProjectDir)\version.h&quot;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/XlsxSerializerCom.tlb"
HeaderFileName="XlsxSerializerCom.h"
DLLDataFileName=""
InterfaceIdentifierFileName="XlsxSerializerCom_i.c"
ProxyFileName="XlsxSerializerCom_p.c"
ValidateParameters="false"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..\..\..\..\Common;..\..\Common;..\..\AVSImageStudio3\Common"
PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
IgnoreImportLibrary="true"
LinkIncremental="1"
MergedIDLBaseFileName="_XlsxSerializerCom.idl"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copy to redist"
CommandLine="copy $(TargetPath) ..\Redist\XlsxSerializerCom.dll"
/>
</Configuration>
<Configuration
Name="ReleaseOpenSource|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="..\Redist\VersionControl.exe &quot;$(ProjectDir)\version.h&quot;"
ExcludedFromBuild="true"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/XlsxSerializerCom.tlb"
HeaderFileName="XlsxSerializerCom.h"
DLLDataFileName=""
InterfaceIdentifierFileName="XlsxSerializerCom_i.c"
ProxyFileName="XlsxSerializerCom_p.c"
ValidateParameters="false"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..\..\..\..\Common;..\..\Common;..\..\AVSImageStudio3\Common"
PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;BUILD_CONFIG_OPENSOURCE_VERSION"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
IgnoreImportLibrary="true"
LinkIncremental="1"
MergedIDLBaseFileName="_XlsxSerializerCom.idl"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copy to redist"
CommandLine="copy $(TargetPath) ..\Redist\XlsxSerializerCom.dll"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{63524EC3-B16E-4d25-881C-BACAEE1F4D24}"
>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="ReleaseOpenSource|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\XlsxSerializerCom.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
>
<File
RelativePath=".\ASCOfficeXlsxSerizer.h"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\version.h"
>
</File>
</Filter>
<Filter
Name="Reader"
>
<File
RelativePath=".\Reader\BinaryWriter.h"
>
</File>
<File
RelativePath=".\Reader\CSVReader.h"
>
</File>
<File
RelativePath=".\Reader\FontProcessor.h"
>
</File>
</Filter>
<Filter
Name="Common"
>
<File
RelativePath=".\Common\BinReaderWriterDefines.h"
>
</File>
<File
RelativePath="..\ASCOfficePPTXFile\Editor\BinReaderWriterDefines.h"
>
</File>
<File
RelativePath=".\Common\Common.h"
>
</File>
<File
RelativePath="..\DocxWriter\FileDownloader.h"
>
</File>
</Filter>
<Filter
Name="Writer"
>
<File
RelativePath=".\Writer\BinaryReader.h"
>
</File>
<File
RelativePath=".\Writer\CSVWriter.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{764D3D92-FBD6-4c5d-A785-208F6FE895CE}"
>
<File
RelativePath=".\XlsxSerializerCom.rc"
>
</File>
<File
RelativePath=".\XlsxSerializerCom.rgs"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// AVSOfficeDocxFile2.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,78 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
#ifndef STRICT
#define STRICT
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
#endif
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _CRT_SECURE_NO_DEPRECATE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off ATL's hiding of some common and often safely ignored warning messages
#define _ATL_ALL_WARNINGS
#include <windows.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <atlcoll.h>
using namespace ATL;
#include "../Common/ASCUtils.h"
#include "../Common/Config.h"
#include <Gdiplus.h>
#pragma comment(lib, "gdiplus.lib")
using namespace Gdiplus;
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
#import "../Redist/OfficeCore.dll" named_guids raw_interfaces_only rename_namespace("OfficeCore")
#ifndef _DEFINE_NAMESPACE_ASC_GRAPHICS_
#define _DEFINE_NAMESPACE_ASC_GRAPHICS_
namespace ASCGraphics
{
typedef OfficeCore::IWinFonts IASCFontManager;
const GUID CLSID_CASCFontManager = OfficeCore::CLSID_CWinFonts;
const GUID IID_IASCFontManager = OfficeCore::IID_IWinFonts;
}
#endif
#else
#import "../Redist/ASCGraphics.dll" named_guids raw_interfaces_only rename_namespace("ASCGraphics")
#import "../Redist/ASCFontConverter.dll" named_guids raw_interfaces_only rename_namespace("Fonts")
#endif
#import "../Redist/ASCOfficePPTXFile.dll" named_guids raw_interfaces_only rename_namespace("PPTXFile"), exclude("_IAVSOfficeFileTemplateEvents"), exclude("_IAVSOfficeFileTemplateEvents2"), exclude("IASCRenderer")

View File

@@ -0,0 +1,7 @@
#pragma once
//1
//0
//0
//99
#define INTVER 1,0,0,99
#define STRVER "1,0,0,99\0"