Compare commits

...

153 Commits

Author SHA1 Message Date
578327bab6 XlsFormat - split sheets by type (ala original file) 2017-11-22 20:05:03 +03:00
52908908a5 fix linux build 2017-11-22 11:44:33 +03:00
24d9b99a44 Merge remote-tracking branch 'origin/hotfix/v5.0.5' into develop 2017-11-21 18:10:56 +03:00
dce58b628f fix bug #36322 2017-11-21 18:10:05 +03:00
f42cb4580c fix users files
XlsFormat olap hierarchy
...
2017-11-21 17:02:22 +03:00
52777e36cb refactoring 2017-11-21 12:49:32 +03:00
7b7e9f3e6e . 2017-11-20 16:21:58 +03:00
d39fa156e7 fix build 2017-11-20 15:47:40 +03:00
48bf40919c fix... 2017-11-17 19:33:38 +03:00
fd53a987be fix bug #36272 2017-11-17 19:02:51 +03:00
b4d298542a fix bug #36251 2017-11-17 15:58:19 +03:00
bae854027b fix bug #36380
Problem with picture in footnote
2017-11-17 13:18:20 +03:00
9723c379dd . 2017-11-17 12:44:51 +03:00
e8d8b2e56c . 2017-11-17 12:27:58 +03:00
adb84b0f05 x2t version up 2017-11-17 12:01:51 +03:00
a4ee30d031 fix bug #36201 2017-11-17 11:44:07 +03:00
e05194b277 Move ASCDOCUMENTSCORE to separated target 2017-11-16 18:14:37 +03:00
21f7f6ed5b fix bug #36335 2017-11-15 13:28:19 +03:00
80863ae25b v5.0.4 2017-11-13 17:46:10 +03:00
07562a9582 v5.0.4 2017-11-13 17:44:36 +03:00
6da196e426 fix bug #36311 2017-11-13 11:48:28 +03:00
d220cc8c79 removed stubs on writing tblLayout 2017-11-09 19:56:04 +03:00
f53c3d9f50 Merge pull request #51 from ONLYOFFICE/feature/pre5.0.4
pdf reader bug
2017-11-07 10:40:46 +03:00
fa98f22e3d fixed crush on Revision: 069544bf6c 2017-11-03 19:07:29 +03:00
e01c09bcc9 XlsFormat - olap .. 2017-11-03 15:36:15 +03:00
069544bf6c tab leader 2017-11-02 19:09:00 +03:00
b0f0f656af Merge pull request #50 from ONLYOFFICE/feature/bug36176
fix bug 36176
2017-11-02 18:00:26 +03:00
99191e65b0 XlsFormat - fix connections (oleDb, query...) 2017-11-02 15:39:18 +03:00
fb41720817 for bug 35900 (CWorkbookPr::toXml) 2017-11-02 13:31:14 +03:00
406c290be4 . 2017-11-01 15:40:15 +03:00
5ae4d7f819 XlsFormat - ... 2017-11-01 13:43:24 +03:00
e69c1677b2 v5.0.3 2017-10-31 18:49:25 +03:00
4d836c180a XlsFormat - mso storage (customXml) 2017-10-31 17:40:49 +03:00
e08b6542d4 XlsFormat - ctrlProps 2017-10-31 15:15:44 +03:00
e1340c63ec pdf reader bug 2017-10-30 15:06:43 +03:00
4b122c0b94 . 2017-10-30 13:47:16 +03:00
867438833b fix bug 36176 2017-10-30 13:40:57 +03:00
8b80aa94b7 XlsFormat - .. 2017-10-27 19:51:00 +03:00
f960fc60bb removed all stubs for FldChar 2017-10-27 19:05:06 +03:00
64213746b0 XlsFormat - query tables 2017-10-26 18:18:09 +03:00
09941c67ac . 2017-10-26 17:16:29 +03:00
c2605bb582 x2t - vps 2017-10-26 12:55:06 +03:00
ab2703c825 XlsFormat - vps 2017-10-26 11:04:35 +03:00
08ce8cb3f5 XlsFormat ... 2017-10-26 10:47:36 +03:00
5efe043ab3 refactoring 2017-10-25 18:34:05 +03:00
f2af1ccd36 refactoring 2017-10-25 18:22:51 +03:00
113d5b4ca3 refactoring 2017-10-25 18:10:59 +03:00
d3461dd3cb refactor 2017-10-25 17:54:27 +03:00
e95a0fb765 XlsFormat - activeX objects 2017-10-25 11:48:53 +03:00
c5ce1e27e4 x2t version up 2017-10-21 14:01:11 +03:00
7ecc7fa1df compaund file stream in unicode 2017-10-21 13:28:29 +03:00
c46cd9e6e5 Merge pull request #48 from ONLYOFFICE/hotfix/v5.0.3
Hotfix/v5.0.3
2017-10-20 17:45:01 +03:00
e299e59d11 fix write compaund files 2017-10-20 15:52:09 +03:00
1e0f4d6fdb XlsFormat - developers controls (buttons, options, ....), fix vba stream 2017-10-19 17:39:00 +03:00
4dae8f50fa Merge pull request #47 from ONLYOFFICE/feature/ooxmlsign
Feature/ooxmlsign
2017-10-18 19:08:30 +03:00
9cc5ed1db0 . 2017-10-18 19:03:58 +03:00
6d1dd9c420 ms crypto bug 2017-10-18 18:58:04 +03:00
a038e1562f XlsFormat - control objects 2017-10-18 14:38:31 +03:00
549e3dc579 Merge pull request #46 from ONLYOFFICE/feature/crypt
crypto fix padding size
2017-10-17 13:01:29 +03:00
8440b18223 crypto fix padding size 2017-10-17 12:57:47 +03:00
9c7a03fdc5 OdfFormatWriter - add ole objects 2017-10-17 11:40:37 +03:00
9272b27a69 crypto fix padding size 2017-10-16 19:37:18 +03:00
ef57330a79 . 2017-10-16 19:20:28 +03:00
d35619eeae Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  x2t binary - fix convert ole without vml drawing
  OdsFormat - fix absolute anchor for ole
  XlsFormat - activeX, controls & ole embedded & links
  xml string as second command-line param(first - path to xml)
  .
  --all-fonts-path param
  Added empty files
  v8 (windows correct)
  Added docbuilder target
2017-10-16 17:53:40 +03:00
b38c552cc5 fixed serialize 2017-10-16 17:53:31 +03:00
1b91ee579c x2t binary - fix convert ole without vml drawing 2017-10-16 14:22:53 +03:00
337c92e522 OdsFormat - fix absolute anchor for ole 2017-10-16 12:22:30 +03:00
8fe1eb7525 XlsFormat - activeX, controls & ole embedded & links 2017-10-16 11:28:46 +03:00
1deb2a6905 Merge 2017-10-13 14:44:53 +03:00
470eddf2b1 Merge 2017-10-13 14:43:33 +03:00
69a787411c xml string as second command-line param(first - path to xml) 2017-10-13 13:51:27 +03:00
22f986295f . 2017-10-12 18:17:16 +03:00
86d2bde83b x2t version up 2017-10-12 12:01:44 +03:00
07041d60f6 . 2017-10-12 11:54:47 +03:00
a5466ab740 XlsFormatReader - external data (dde, workbook, ..) 2017-10-12 11:41:21 +03:00
dfd54ff53f _MSC_VER >= 1900 build 2017-10-11 16:30:37 +03:00
6ec7d77e19 speed logger 2017-10-09 15:21:16 +03:00
3813be21c7 --all-fonts-path param 2017-10-09 15:11:30 +03:00
356ccba104 fixed bug#35998 2017-10-06 14:09:56 +03:00
68c8c0cb29 Merge pull request #42 from ONLYOFFICE/feature/docbuilder
Feature/docbuilder
2017-10-06 11:57:57 +03:00
3044d1122a OdfFormatReader - fix pilot tables (groups & references) 2017-10-06 11:36:00 +03:00
fb00ba7ecb fix users file 2017-10-06 11:35:03 +03:00
ab0c5703a5 Added empty files 2017-10-06 11:04:59 +03:00
e22b63347f v8 (windows correct) 2017-10-05 18:13:52 +03:00
9dd115ec56 v5.0.1 2017-10-05 14:48:07 +03:00
438ba3aded v5.0.1 2017-10-05 14:46:28 +03:00
29b002ca80 Added docbuilder target 2017-10-04 14:56:03 +03:00
34083d996b preload cef library 2017-10-03 16:10:20 +03:00
244d549cf8 --save-use-only-names mode 2017-10-03 11:07:01 +03:00
ef96571879 outlineLvl 2017-10-02 17:18:50 +03:00
7a27150de6 OdfFormatReader - fix math after testing 2017-10-02 17:11:12 +03:00
2197fddb7b RtfFormatReader - fix ole 2017-09-29 19:29:05 +03:00
d31344d7d3 correct metafile bounds 2017-09-29 17:29:21 +03:00
f7617b42cb Merge remote-tracking branch 'origin/hotfix/v5.0.1' into develop 2017-09-29 15:57:28 +03:00
8312cce2c3 . 2017-09-29 15:56:39 +03:00
dc89e1d484 Merge branch 'hotfix/v5.0.1' of https://github.com/ONLYOFFICE/core into hotfix/v5.0.1 2017-09-29 15:33:18 +03:00
17f4903347 Merge remote-tracking branch 'origin/hotfix/v5.0.1' into develop 2017-09-29 15:31:52 +03:00
ebdfb2f785 OOxmlFormat - fix users files 2017-09-29 15:28:46 +03:00
ec2901bf48 RtfFormat - fix users file 2017-09-29 14:24:57 +03:00
f9e87624c0 . 2017-09-29 13:31:08 +03:00
5f0e6349cc . 2017-09-29 11:06:48 +03:00
3bdf44b8c7 Merge remote-tracking branch 'origin/hotfix/v5.0.1' into develop 2017-09-29 10:56:48 +03:00
d586698025 x2t version up 2017-09-29 10:54:08 +03:00
eb6fb03ca5 Merge remote-tracking branch 'origin/hotfix/v5.0.1' into develop 2017-09-28 19:27:08 +03:00
ad40f51dee OdsFormatReader - fix after testing 2017-09-28 19:26:35 +03:00
5e60456fc1 fix for crash sample.docx file 2017-09-28 17:30:13 +03:00
1f9e3f4fd8 OdpFormatReader - fix after testing 2017-09-27 19:49:10 +03:00
334620cd5a hidePivotFieldList in Editor.bin 2017-09-26 17:19:58 +03:00
4a5fca5ccf hidePivotFieldList in Editor.bin 2017-09-26 17:18:05 +03:00
828df16fe5 OdfFormat - fix transactions 2017-09-26 16:41:43 +03:00
66dae03919 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  fix bug #35895
  x2t version up
  OdfFormatReader - fix after testing
2017-09-26 16:37:52 +03:00
114a01f364 event for drag&drop content in ios11 2017-09-26 16:37:43 +03:00
2ddaf33156 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-09-25 19:07:39 +03:00
1af37af850 Merge remote-tracking branch 'origin/hotfix/v5.0.1' into develop 2017-09-25 19:06:43 +03:00
b58026ea66 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatReader - fix after testing
  .
  PptFormat - support vba macros
  DocFormat - vba macros
2017-09-25 18:54:39 +03:00
09a8a6794a log for errors 2017-09-25 18:54:31 +03:00
941cbe4f9b fix bug #35895 2017-09-25 17:10:50 +03:00
668d0c2abf x2t version up 2017-09-25 16:53:39 +03:00
66db5b09e6 Merge remote-tracking branch 'origin/hotfix/v5.0.1' into develop 2017-09-25 16:49:31 +03:00
e7dae4b381 OdfFormatReader - fix after testing 2017-09-25 16:46:32 +03:00
7dbbacf336 OdfFormatReader - fix after testing 2017-09-22 20:00:21 +03:00
f43a0bbfe2 . 2017-09-21 17:06:44 +03:00
746c228261 PptFormat - support vba macros 2017-09-21 16:59:38 +03:00
d8c7d41462 DocFormat - vba macros 2017-09-20 17:58:41 +03:00
4a9abce180 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  .
  x2t version up
2017-09-20 14:21:11 +03:00
a78711a19c fix build for ios11 2017-09-20 14:21:04 +03:00
b69051a5b4 . 2017-09-20 10:04:34 +03:00
04e4f1adae Merge remote-tracking branch 'origin/hotfix/v5.0.1' into develop 2017-09-20 10:03:11 +03:00
6e15370af2 x2t version up 2017-09-19 19:46:10 +03:00
57465b60bf Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatReader - support pilot(pivot) tables add flat open office formats ...
2017-09-19 19:33:48 +03:00
24d58fe189 fix for build 2017-09-19 19:33:41 +03:00
56bb39f716 Merge remote-tracking branch 'origin/hotfix/v5.0.1' into develop 2017-09-19 18:21:33 +03:00
60bcca0090 OdfFormatReader - support pilot(pivot) tables
add flat open office formats
...
2017-09-19 18:20:33 +03:00
92ce863bdf v5.0.0 2017-09-19 17:04:56 +03:00
48d4b72d4b Merge pull request #39 from ONLYOFFICE/release/v5.0.0
xhtml bug
2017-09-18 10:35:39 +03:00
85de7ec7a6 xhtml bug 2017-09-15 19:07:14 +03:00
9e6d4950c2 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  store Editor.xlsx without m_bSaveXFile flag
  .
  font names project (full work)
  .
  fix open html file with incorrect extension
  .
  .
  .
  pivot table build on server
  XlsFormat pivots - fix after testing
  build error (not windows)
  first version zip reader (doctrenderer)
2017-09-14 17:08:28 +03:00
cb4befa078 up 2017-09-14 17:08:19 +03:00
ac1292a17a Merge remote-tracking branch 'origin/release/v5.0.0' into develop 2017-09-14 13:35:25 +03:00
007a984c36 store Editor.xlsx without m_bSaveXFile flag 2017-09-13 19:35:56 +03:00
d3d3180402 . 2017-09-13 19:06:32 +03:00
fa9c096f3c font names project (full work) 2017-09-13 17:20:50 +03:00
e1ec9d942e . 2017-09-13 13:14:32 +03:00
4acaa75b06 Merge branch 'release/v5.0.0' of https://github.com/ONLYOFFICE/core into release/v5.0.0 2017-09-12 18:17:02 +03:00
431115ef48 fix open html file with incorrect extension 2017-09-12 18:16:26 +03:00
2d66d9902e . 2017-09-12 18:15:26 +03:00
206dd12a47 . 2017-09-12 16:14:08 +03:00
e8d3059fe8 . 2017-09-12 16:07:20 +03:00
f624f731de fix for build 2017-09-12 15:23:45 +03:00
ed373b7e2d pivot table build on server 2017-09-12 14:11:57 +03:00
a67eb5644d XlsFormat pivots - fix after testing 2017-09-12 13:11:41 +03:00
5040220d82 build error (not windows) 2017-09-12 10:42:54 +03:00
4f0b889f04 first version zip reader (doctrenderer) 2017-09-11 18:44:52 +03:00
815 changed files with 28142 additions and 20041 deletions

View File

@ -501,7 +501,7 @@ namespace DocFileFormat
facet.widen((char*)bytes, (char*)bytes + size, &result[0]);
for (long i=0; i < result.length(); i++)
for (size_t i=0; i < result.length(); i++)
{
STLCollection->push_back(result[i]);
}
@ -536,7 +536,7 @@ namespace DocFileFormat
delete [] pStrUtf16;
return GetSTLCollectionFromLocale(STLCollection, bytes,size);
}
for (long i=0; i < nLength; i++)
for (unsigned int i = 0; i < nLength; i++)
{
STLCollection->push_back(pStrUtf16[i]);
}
@ -566,7 +566,7 @@ namespace DocFileFormat
delete [] pStrUtf32;
return GetSTLCollectionFromLocale(STLCollection, bytes, size);
}
for (long i=0; i < nLength; i++)
for (unsigned int i = 0; i < nLength; i++)
{
STLCollection->push_back(pStrUtf32[i]);
}
@ -652,7 +652,7 @@ namespace DocFileFormat
NSUnicodeConverter::CUnicodeConverter oConverter;
std::wstring unicode_string = oConverter.toUnicode((char*)bytes, size, sCodePage.c_str());
for (long i=0; i < unicode_string.size(); i++)
for (size_t i = 0; i < unicode_string.size(); i++)
{
STLCollection->push_back(unicode_string[i]);
}

View File

@ -393,7 +393,7 @@ namespace XMLTools
else
{
std::string s(m_str.begin(), m_str.end());
file.WriteFile((unsigned char*)s.c_str(), s.length());
file.WriteFile((unsigned char*)s.c_str(), (DWORD)s.length());
}
file.CloseFile();
return true;

View File

@ -321,7 +321,7 @@ namespace DocFileFormat
case sprmCFtcBi :
{//default from FontTable
SHORT nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
size_t nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
if( nIndex < _doc->FontTable->Data.size() )
{
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
@ -373,7 +373,7 @@ namespace DocFileFormat
case sprmOldCFtc:
case sprmCRgFtc0:
{ // font family
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex < _doc->FontTable->Data.size() )
{
@ -388,7 +388,8 @@ namespace DocFileFormat
case sprmCRgFtc1:
{
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( L"w:eastAsia" );
@ -403,7 +404,8 @@ namespace DocFileFormat
case sprmCRgFtc2:
{
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( L"w:hAnsi" );

View File

@ -157,6 +157,7 @@ namespace OpenXmlRelationshipTypes
static const wchar_t* OleObject = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
static const wchar_t* GlossaryDocument = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument";
static const wchar_t* Package = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
static const wchar_t* VbaProject = L"http://schemas.microsoft.com/office/2006/relationships/vbaProject";
}
namespace MicrosoftWordRelationshipTypes

View File

@ -65,7 +65,7 @@ namespace DocFileFormat
{
ConversionContext context( doc, docx );
//Write styles.xml
//Write styles.xml
if (doc->Styles)
{
StyleSheetMapping styleSheetMapping( &context );
@ -88,9 +88,7 @@ namespace DocFileFormat
return S_FALSE;
}
}
//Write numbering.xml
//Write numbering.xml
if (doc->listTable)
{
NumberingMapping numberingMapping( &context );
@ -110,7 +108,7 @@ namespace DocFileFormat
}
}
//Write fontTable.xml
//Write fontTable.xml
if (doc->FontTable)
{
FontTableMapping fontTableMapping( &context );
@ -130,7 +128,7 @@ namespace DocFileFormat
}
}
//write the footnotes
//write the footnotes
FootnotesMapping footnotesMapping( &context );
doc->Convert( &footnotesMapping );
@ -147,7 +145,7 @@ namespace DocFileFormat
}
}
//write the endnotes
//write the endnotes
EndnotesMapping endnotesMapping( &context );
doc->Convert( &endnotesMapping );
@ -164,7 +162,7 @@ namespace DocFileFormat
}
}
//write the comments
//write the comments
CommentsMapping commentsMapping( &context );
doc->Convert( &commentsMapping );
@ -181,13 +179,13 @@ namespace DocFileFormat
}
}
//write settings.xml at last because of the rsid list
//write settings.xml at last because of the rsid list
if (doc->DocProperties)
{
SettingsMapping settingsMapping( &context );
doc->DocProperties->Convert( &settingsMapping );
}
if ( progress != NULL )
{
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 975000 );
@ -204,7 +202,7 @@ namespace DocFileFormat
return S_OK;
}
long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress)
long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
{
long result = S_FALSE;
@ -219,7 +217,7 @@ namespace DocFileFormat
if (result == S_OK)
{
docx.SaveDocument();
docx.SaveDocument(bMacros);
if (progress)progress->OnProgress(progress->caller, DOC_ONPROGRESSEVENT_ID, 1000000);

View File

@ -48,7 +48,7 @@ namespace DocFileFormat
std::wstring m_sTempFolder;
long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress);
long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
private:
long Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);

View File

@ -88,7 +88,7 @@ namespace DocFileFormat
int DocumentMapping::getCurrentSection(int cp)
{
//if cp is the last char of a section, the next section will start at cp +1
int current = 0;
size_t current = 0;
for (std::vector<int>::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter)
{
@ -107,7 +107,7 @@ namespace DocFileFormat
{
if ( !m_document->ListPlex ) return -1;
for (int i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
for (size_t i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
{
if ((fc >= m_document->ListPlex->CharacterPositions[i-1]) && (fc_end <= m_document->ListPlex->CharacterPositions[i]))
{
@ -382,7 +382,7 @@ namespace DocFileFormat
int DocumentMapping::writeRun (std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp)
{
int cp = initialCp;
int result_cp = cp + chars->size();
int result_cp = cp + (int)chars->size();
if ((_skipRuns <= 0) && (chars->size() > 0))
{
@ -564,7 +564,7 @@ namespace DocFileFormat
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
std::wstring f;
if (cpFieldEnd < m_document->Text->size())
if (cpFieldEnd < (int)m_document->Text->size())
f = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
std::wstring EMBED ( L" EMBED" );
@ -660,11 +660,11 @@ namespace DocFileFormat
if (search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end())
{
int d = f1.find(PAGEREF);
int d = (int)f1.find(PAGEREF);
_writeWebHidden = true;
std::wstring _writeTocLink =f1.substr(d + 9);
d = _writeTocLink.find(L" ");
d = (int)_writeTocLink.find(L" ");
_writeTocLink = _writeTocLink.substr(0, d);
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
@ -902,7 +902,7 @@ namespace DocFileFormat
{
int shape_type = oPicture.shapeContainer->getShapeType();
if (shape_type != msosptPictureFrame) picture = false;
if (shape_type != msosptPictureFrame) picture = false;//шаблон 1.doc картинка в колонтитуле
}
if (picture)
@ -1176,7 +1176,8 @@ namespace DocFileFormat
TableInfo tai( papx );
//build the table grid
std::vector<short>* grid = buildTableGrid( cp, nestingLevel );
std::vector<short> grid, grid_write;
buildTableGrid( cp, nestingLevel, grid, grid_write );
//find first row end
int fcRowEnd = findRowEndFc( cp, nestingLevel );
@ -1187,7 +1188,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeBegin( L"w:tbl" );
//Convert it
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, grid );
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, &grid, &grid_write );
row1Tapx.Convert( tpMapping );
@ -1200,7 +1201,7 @@ namespace DocFileFormat
//only convert the cells with the given nesting level
while ( tai.iTap == nestingLevel )
{
cp = writeTableRow( cp, grid, nestingLevel );
cp = writeTableRow( cp, &grid, &grid_write, nestingLevel );
//?fc = m_document->FindFileCharPos(cp );
fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
papx = findValidPapx( fc );
@ -1213,7 +1214,7 @@ namespace DocFileFormat
//convert until the end of table is reached
while ( tai.fInTable )
{
cp = writeTableRow( cp, grid, nestingLevel );
cp = writeTableRow( cp, &grid, &grid_write, nestingLevel );
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
@ -1224,18 +1225,16 @@ namespace DocFileFormat
//close w:tbl
m_pXmlWriter->WriteNodeEnd( L"w:tbl" );
RELEASEOBJECT( grid );
return cp;
}
// Builds a list that contains the width of the several columns of the table.
std::vector<short>* DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel)
bool DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel, std::vector<short>& grid, std::vector<short>& grid_write)
{
ParagraphPropertyExceptions* backup = _lastValidPapx;
std::vector<short> boundaries;
std::vector<short>* grid = new std::vector<short>();
std::vector<short> boundaries_all;
int cp = initialCp;
int fc = m_document->FindFileCharPos( cp );
@ -1252,25 +1251,43 @@ namespace DocFileFormat
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
{
//find the tDef SPRM
if ( iter->OpCode == sprmTDefTable || iter->OpCode == sprmOldTDefTable)
DWORD code = iter->OpCode;
switch(iter->OpCode)
{
unsigned char itcMac = iter->Arguments[0];
for (int i = 0; i < itcMac; i++)
case sprmTDefTable:
case sprmOldTDefTable:
{
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
unsigned char itcMac = iter->Arguments[0];
if ( find( boundaries.begin(), boundaries.end(), boundary1 ) == boundaries.end() )
while(boundaries.size() < itcMac + 1)
boundaries.push_back(-0x7fff);
short boundary0 = -0x7fff;
for (unsigned char i = 0; i < itcMac; i++)
{
boundaries.push_back( boundary1 );
}
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 2 ), iter->argumentsSize );
short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 2 ), iter->argumentsSize );
if (boundary2 - boundary1 > 1 && boundary1 - boundary0 > 1)
{
if ( boundaries[i] == -0x7fff || boundaries[i+1] == -0x7fff)
{
boundaries[i] = boundary1;
boundaries[i+1] = boundary2;
}
}
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary1 ) == boundaries_all.end() )
{
boundaries_all.push_back( boundary1 );
}
if ( find( boundaries.begin(), boundaries.end(), boundary2 ) == boundaries.end() )
{
boundaries.push_back( boundary2 );
}
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary2 ) == boundaries_all.end() )
{
boundaries_all.push_back( boundary2 );
}
boundary0 = boundary1;
}break;
}
}
}
@ -1286,19 +1303,25 @@ namespace DocFileFormat
}
//build the grid based on the boundaries
sort( boundaries.begin(), boundaries.end() );
sort( boundaries_all.begin(), boundaries_all.end() );
if ( !boundaries.empty() )
{
for ( unsigned int i = 0; i < ( boundaries.size() - 1 ); i++ )
for ( size_t i = 0; i < ( boundaries.size() - 1 ); i++ )
{
grid->push_back( boundaries[i + 1] - boundaries[i] );
grid_write.push_back( boundaries[i + 1] - boundaries[i] );
}
}
if ( !boundaries_all.empty() )
{
for ( size_t i = 0; i < ( boundaries_all.size() - 1 ); i++ )
{
grid.push_back( boundaries_all[i + 1] - boundaries_all[i] );
}
}
_lastValidPapx = backup;
return grid;
return true;
}
// Finds the FC of the next row end mark.
@ -1418,7 +1441,7 @@ namespace DocFileFormat
}
/// Writes the table row that starts at the given cp value and ends at the next row end mark
int DocumentMapping::writeTableRow(int initialCp, std::vector<short>* grid, unsigned int nestingLevel)
int DocumentMapping::writeTableRow(int initialCp, std::vector<short>* grid, std::vector<short>* grid_write, unsigned int nestingLevel)
{
int cp = initialCp;
int fc = m_document->FindFileCharPos( cp );
@ -1448,7 +1471,7 @@ namespace DocFileFormat
//Write until the first "inner trailer paragraph" is reached
while ( !( ( m_document->Text->at( cp ) == TextMark::ParagraphEnd ) && ( tai.fInnerTtp ) ) && tai.fInTable )
{
cp = writeTableCell( cp, &tapx, grid, gridIndex, cellIndex, nestingLevel );
cp = writeTableCell( cp, &tapx, grid, grid_write, gridIndex, cellIndex, nestingLevel );
cellIndex++;
//each cell has it's own PAPX
@ -1465,7 +1488,7 @@ namespace DocFileFormat
while ( !( ( m_document->Text->at( cp ) == TextMark::CellOrRowMark ) && ( tai.fTtp ) )
&& tai.fInTable )
{
cp = writeTableCell( cp, &tapx, grid, gridIndex, cellIndex, nestingLevel );
cp = writeTableCell( cp, &tapx, grid, grid_write, gridIndex, cellIndex, nestingLevel );
cellIndex++;
//each cell has it's own PAPX
@ -1488,18 +1511,15 @@ namespace DocFileFormat
}
/// Writes the table cell that starts at the given cp value and ends at the next cell end mark
int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel )
int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, std::vector<short>* grid_write, int& gridIndex, int cellIndex, unsigned int nestingLevel )
{
int cp = initialCp;
int cp = initialCp;
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
//start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
//start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
//find cell end
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
//convert the properties
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, gridIndex, cellIndex );
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, grid_write, gridIndex, cellIndex );
if ( tapx != NULL )
{
@ -1510,7 +1530,7 @@ namespace DocFileFormat
RELEASEOBJECT( tcpMapping );
//write the paragraphs of the cell
//write the paragraphs of the cell
while ( cp < cpCellEnd )
{
//cp = writeParagraph(cp);
@ -1541,7 +1561,7 @@ namespace DocFileFormat
}
}
//end w:tc
//end w:tc
m_pXmlWriter->WriteNodeEnd( L"w:tc" );
return cp;

View File

@ -108,15 +108,15 @@ namespace DocFileFormat
// Writes the table starts at the given cp value
int writeTable ( int initialCp, unsigned int nestingLevel );
// Builds a list that contains the width of the several columns of the table.
std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel );
bool buildTableGrid( int initialCp, unsigned int nestingLevel, std::vector<short>& grid, std::vector<short>& grid_write );
// Finds the FC of the next row end mark.
int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel );
// Finds the FC of the next row end mark.
int findRowEndFc ( int initialCp, unsigned int nestingLevel );
// Writes the table row that starts at the given cp value and ends at the next row end mark
int writeTableRow ( int initialCp, std::vector<short>* grid, unsigned int nestingLevel );
int writeTableRow ( int initialCp, std::vector<short>* grid, std::vector<short>* grid_write, unsigned int nestingLevel );
// Writes the table cell that starts at the given cp value and ends at the next cell end mark
int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, std::vector<short>* grid_write, int& gridIndex, int cellIndex, unsigned int nestingLevel );
int findCellEndCp ( int initialCp, unsigned int nestingLevel );
bool writeBookmarks ( int cp );

View File

@ -33,6 +33,8 @@
#include "IMapping.h"
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
namespace DocFileFormat
{
class IVisitable

View File

@ -50,8 +50,7 @@ namespace DocFileFormat
void MainDocumentMapping::Apply(IVisitable* visited)
{
m_document = static_cast<WordDocument*>(visited);
m_context->_docx->RegisterDocument();
// Header
m_pXmlWriter->WriteNodeBegin(L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
m_pXmlWriter->WriteNodeBegin(L"w:document", TRUE );

View File

@ -582,7 +582,7 @@ namespace DocFileFormat
// The style id is used for a reverse reference.
// It can happen that the reference points to the wrong style.
if (styleIndex != ListData::ISTD_NIL)
if (styleIndex != ListData::ISTD_NIL && styleIndex < m_document->Styles->Styles->size())
{
m_pXmlWriter->WriteNodeBegin( L"w:pStyle", TRUE );
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::XmlEncode(StyleSheetMapping::MakeStyleId(m_document->Styles->Styles->at(styleIndex))));

View File

@ -136,7 +136,7 @@ namespace DocFileFormat
if (lMinF <= point.x)
{
int index = (DWORD)point.x - 0x80000000;
if (index >= 0 && index < guides.size())
if (index >= 0 && index < (int)guides.size())
{
point.x = guides[index].param3;
}
@ -144,12 +144,19 @@ namespace DocFileFormat
if (lMinF <= point.y)
{
int index = (DWORD)point.y - 0x80000000;
if (index >= 0 && index < guides.size())
if (index >= 0 && index < (int)guides.size())
{
point.y = guides[index].param3;
}
}
if ((size_t)point.y > 0xffff)
{
point.y &= 0xffff;
}
if ((size_t)point.x > 0xffff)
{
point.x &= 0xffff;
}
m_arPoints.push_back(point);
}
}

View File

@ -63,8 +63,25 @@ namespace DocFileFormat
Shape* sh = dynamic_cast<Shape*>( *iter );
if (sh)
{
if (sh->shapeType) return sh->shapeType->GetTypeCode();
else return 0;
if (sh->shapeType)
{
return sh->shapeType->GetTypeCode();
}
else
{
for ( std::vector<Record*>::const_iterator iter1 = this->Children.begin(); iter1 != this->Children.end(); iter1++ )
{
ShapeOptions* sh_options = dynamic_cast<ShapeOptions*>( *iter1 );
if (sh_options)
{
if (sh_options->OptionsByID.end() != sh_options->OptionsByID.find(Pib))
{
return msosptPictureFrame;
}
}
}
return 0;
}
}
}
return 0;

View File

@ -46,35 +46,35 @@ OleObject::OleObject( const CharacterPropertyExceptions* chpx, StructuredStorage
HRESULT res = S_OK;
POLE::Stream* ObjectPoolStorage = new POLE::Stream(oleStorage, "ObjectPool");
POLE::Stream* ObjectPoolStorage = new POLE::Stream(oleStorage, L"ObjectPool");
if (ObjectPoolStorage)
{
ObjectId = getOleEntryName( chpx );
std::string sObjectId( ObjectId.begin(), ObjectId.end() );
std::wstring sObjectId( ObjectId.begin(), ObjectId.end() );
{
std::string name = "ObjectPool/" + sObjectId + "/";
processOleStream( name + "Ole" );
std::wstring name = L"ObjectPool/" + sObjectId + L"/";
processOleStream( name + L"Ole" );
if ( bLinked )
{
processLinkInfoStream( name + "LinkInfo" );
processLinkInfoStream( name + L"LinkInfo" );
}
else
{
processCompObjStream( name + "CompObj" );
processCompObjStream( name + L"CompObj" );
}
processPICStream( name + "PIC" );
processPICStream( name + L"PIC" );
processEquationNativeStream( name + "Equation Native" );
processEquationNativeStream( name + L"Equation Native" );
}
delete ObjectPoolStorage;
}
}
void OleObject::processLinkInfoStream( const std::string& linkStream )
void OleObject::processLinkInfoStream( const std::wstring& linkStream )
{
try
{
@ -125,7 +125,7 @@ void OleObject::processLinkInfoStream( const std::string& linkStream )
}
}
void OleObject::processEquationNativeStream( const std::string& eqStream )
void OleObject::processEquationNativeStream( const std::wstring& eqStream )
{
try
{
@ -156,7 +156,7 @@ void OleObject::processEquationNativeStream( const std::string& eqStream )
}
}
void OleObject::processPICStream( const std::string& picStream )
void OleObject::processPICStream( const std::wstring& picStream )
{
try
{
@ -191,7 +191,7 @@ void OleObject::processPICStream( const std::string& picStream )
}
}
void OleObject::processCompObjStream( const std::string& compStream )
void OleObject::processCompObjStream( const std::wstring& compStream )
{
try
{
@ -206,11 +206,11 @@ void OleObject::processCompObjStream( const std::string& compStream )
//skip the CompObjHeader
reader.ReadBytes( 28, false );
int sz_obj = reader.GetSize() - reader.GetPosition();
unsigned int sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
{
UserType = reader.ReadLengthPrefixedAnsiString(sz_obj);
UserType = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
@ -218,7 +218,7 @@ void OleObject::processCompObjStream( const std::string& compStream )
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
Program = reader.ReadLengthPrefixedAnsiString(sz_obj);
Program = reader.ReadLengthPrefixedAnsiString(sz_obj);
}
delete pCompStream;
}
@ -228,7 +228,7 @@ void OleObject::processCompObjStream( const std::string& compStream )
}
}
void OleObject::processOleStream( const std::string& oleStreamName )
void OleObject::processOleStream( const std::wstring& oleStreamName )
{
try
{

View File

@ -74,11 +74,11 @@ namespace DocFileFormat
private:
POLE::Storage *oleStorage;
void processLinkInfoStream ( const std::string& linkStream );
void processEquationNativeStream( const std::string& eqStream );
void processPICStream ( const std::string& picStream );
void processCompObjStream ( const std::string& compStream );
void processOleStream ( const std::string& oleStreamName );
void processLinkInfoStream ( const std::wstring& linkStream );
void processEquationNativeStream( const std::wstring& eqStream );
void processPICStream ( const std::wstring& picStream );
void processCompObjStream ( const std::wstring& compStream );
void processOleStream ( const std::wstring& oleStreamName );
std::wstring getOleEntryName ( const CharacterPropertyExceptions* chpx );
};

View File

@ -73,7 +73,6 @@ namespace DocFileFormat
NSDirectory::CreateDirectory( m_strOutputPath + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"_rels" );
WriteRelsFile( DocumentRelationshipsFile );
WriteRelsFile( FootnotesRelationshipsFile );
@ -137,15 +136,17 @@ namespace DocFileFormat
{
NSFile::CFileBinary file;
file.CreateFileW(fileName);
file.WriteFile((BYTE*)data.c_str(), data.size());
file.WriteFile((BYTE*)data.c_str(), (_UINT32)data.size());
file.CloseFile();
return S_OK;
}
HRESULT OpenXmlPackage::SaveOLEObject( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure )
{
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
if (storageOut == NULL || docFile == NULL) return S_FALSE;
if (docFile == NULL) return S_FALSE;
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
if (storageOut == NULL) return S_FALSE;
if (storageOut->open(true, true)==false)
{
delete storageOut;
@ -155,20 +156,19 @@ namespace DocFileFormat
POLE::Storage *storageInp = docFile->GetStorage()->GetStorage();
{
std::string id(oleObjectFileStructure.objectID.begin(),oleObjectFileStructure.objectID.end());
POLE::Stream* oleStorage = new POLE::Stream(storageInp, id);
POLE::Stream* oleStorage = new POLE::Stream(storageInp, oleObjectFileStructure.objectID);
if (oleStorage)
{
std::string path = "ObjectPool/" + id;
std::list<std::string> entries = storageInp->entries(path);
for (std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++)
std::wstring path = L"ObjectPool/" + oleObjectFileStructure.objectID;
std::list<std::wstring> entries = storageInp->entries(path);
for (std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++)
{
POLE::Stream *stream_inp = new POLE::Stream(storageInp, path + "/"+ (*it));
POLE::Stream *stream_inp = new POLE::Stream(storageInp, path + L"/"+ (*it));
if (stream_inp == NULL)continue;
int size = stream_inp->size();
POLE::uint64 size = stream_inp->size();
POLE::Stream *stream_out = new POLE::Stream(storageOut, *it, true, size);
@ -199,7 +199,14 @@ namespace DocFileFormat
{
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
}
int OpenXmlPackage::RegisterDocumentMacros()
{
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
}
int OpenXmlPackage::RegisterVbaProject()
{
return AddPart( L"word", L"vbaProject.bin", MicrosoftWordContentTypes::VbaProject, OpenXmlRelationshipTypes::VbaProject );
}
int OpenXmlPackage::RegisterFontTable()
{
return AddPart( L"word", L"fontTable.xml", WordprocessingMLContentTypes::FontTable, OpenXmlRelationshipTypes::FontTable );

View File

@ -118,6 +118,8 @@ namespace DocFileFormat
class OpenXmlPackage
{
public:
const WordDocument* docFile;
private:
ContentTypesFile DocumentContentTypesFile;
RelationshipsFile MainRelationshipsFile;
@ -137,8 +139,6 @@ namespace DocFileFormat
int _footerCounter;
int _oleCounter;
const WordDocument* docFile;
int AddHeaderPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
int AddFooterPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
int AddFootnotesPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
@ -166,6 +166,7 @@ namespace DocFileFormat
HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data );
int RegisterDocument();
int RegisterDocumentMacros();
int RegisterFontTable();
int RegisterNumbering();
int RegisterSettings();
@ -179,5 +180,6 @@ namespace DocFileFormat
int RegisterOLEObject ( const IMapping* mapping, const std::wstring& objectType );
int RegisterPackage ( const IMapping* mapping, const std::wstring& objectType);
int RegisterExternalOLEObject( const IMapping* mapping, const std::wstring& objectType, const std::wstring& uri );
int RegisterVbaProject();
};
}

View File

@ -154,7 +154,7 @@ namespace DocFileFormat
case sprmPFBiDi:
{
bool val = iter->argumentsSize > 0 ? iter->Arguments[0] : true;
bool val = iter->argumentsSize > 0 ? (iter->Arguments[0] != 0) : true;
appendFlagElement( _pPr, *iter, L"bidi", val);
_isBidi = val;
}break;
@ -427,7 +427,7 @@ namespace DocFileFormat
if (m_document->listTable)
{
m_document->listTable->appendNumbering( desc );
short numId = m_document->listTable->listNumbering.size();
short numId = static_cast<short>(m_document->listTable->listNumbering.size());
appendValueElement( &numPr, L"numId", numId, true );
}
}break;
@ -485,7 +485,7 @@ namespace DocFileFormat
{
XMLTools::XMLElement tabs( L"w:tabs" );
int pos = 0;
unsigned int pos = 0;
//read the removed tabs
unsigned char itbdDelMax = iter->Arguments[pos];

View File

@ -462,57 +462,60 @@ namespace DocFileFormat
void PropertiesMapping::appendShading( XMLTools::XMLElement* parent, const ShadingDescriptor& desc )
{
std::wstring pattern = getShadingPattern( desc );
if ( ( parent != NULL ) && ( desc.shadingSpecialValue == shadingSpecialValueNormal ))
{
XMLTools::XMLElement shd( L"w:shd" );
//fill color
XMLTools::XMLAttribute fill( L"w:fill" );
if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvBackAuto )
{
fill.SetValue( L"auto" );
}
else
{
fill.SetValue( RGBColor( (int)desc.cvBack, RedLast ).SixDigitHexCode);
}
}
else
{
fill.SetValue( FormatUtils::MapValueToWideString( desc.icoBack, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( fill );
//foreground color
XMLTools::XMLAttribute color( L"w:color" );
if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvForeAuto )
{
color.SetValue( L"auto" );
}
else
{
color.SetValue( RGBColor( (int)desc.cvFore, RedLast ).SixDigitHexCode);
}
}
else
{
color.SetValue( FormatUtils::MapValueToWideString( desc.icoFore, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( color );
//pattern
XMLTools::XMLAttribute val( L"w:val" );
val.SetValue( getShadingPattern( desc ));
val.SetValue( pattern);
shd.AppendAttribute( val );
if (pattern != L"nil")
{
//fill color
XMLTools::XMLAttribute fill( L"w:fill" );
if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvBackAuto )
{
fill.SetValue( L"auto" );
}
else
{
fill.SetValue( RGBColor( (int)desc.cvBack, RedLast ).SixDigitHexCode);
}
}
else
{
fill.SetValue( FormatUtils::MapValueToWideString( desc.icoBack, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( fill );
//foreground color
XMLTools::XMLAttribute color( L"w:color" );
if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvForeAuto )
{
color.SetValue( L"auto" );
}
else
{
color.SetValue( RGBColor( (int)desc.cvFore, RedLast ).SixDigitHexCode);
}
}
else
{
color.SetValue( FormatUtils::MapValueToWideString( desc.icoFore, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( color );
}
parent->RemoveChildByName( L"w:shd" );
parent->AppendChild( shd );
}

View File

@ -174,9 +174,9 @@ namespace DocFileFormat
//it's a Word 97 SPRM
short val = FormatUtils::BytesToInt16(bytes, 0, size);
icoFore = (val & 0x1F);
icoBack = ((val >> 5) & 0x1F);
ipat = (ShadingPattern) ((val >> 10) & 0x3F);
icoFore = GETBITS(val, 0, 4);
icoBack = GETBITS(val, 5, 9);
ipat = (ShadingPattern) GETBITS(val, 10, 15);
shadingType = shadingTypeShd80;
@ -209,7 +209,7 @@ namespace DocFileFormat
else if (0x0F == icoFore) { cvFore = RGB2 (0x80, 0x80, 0x80); }
else if (0x10 == icoFore) { cvFore = RGB2 (0xC0, 0xC0, 0xC0); }
if (0x00 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); cvBackAuto = true; }
if (0x00 == icoBack) { cvBack = RGB2 (0xFF, 0xFF, 0xFF); cvBackAuto = true; }
else if (0x01 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); }
else if (0x02 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0xFF); }
else if (0x03 == icoBack) { cvBack = RGB2 (0x00, 0xFF, 0xFF); }

View File

@ -41,7 +41,7 @@ namespace DocFileFormat
{
TC80()
{
horzMerge = wWidth = 0;
wWidth = horzMerge =0;
textFlow = Global::lrTb;
vertMerge = Global::fvmClear;
@ -95,13 +95,14 @@ namespace DocFileFormat
int pointer = 1;
// rgdxaCenter
for (int i = 0; i < numberOfColumns + 1; ++i)
{
rgdxaCenter.push_back(FormatUtils::BytesToInt16(bytes, pointer, size));
int pos = FormatUtils::BytesToInt16(bytes, pointer, size);
rgdxaCenter.push_back(pos);
pointer += 2;
}
// rgTc80
for (int i = 0; i < numberOfColumns; ++i)

View File

@ -81,7 +81,7 @@ namespace DocFileFormat
}
}
ByteStructure* operator [] ( unsigned int index ) const
ByteStructure* operator [] ( size_t index ) const
{
if ( index < this->Data.size() )
{

View File

@ -42,7 +42,6 @@ namespace DocFileFormat
{
}
~StructuredStorageReader()
{
if(m_pStorage)
@ -62,12 +61,18 @@ namespace DocFileFormat
}
return false;
}
bool GetStream (const char *path, POLE::Stream** ppStream)
bool isDirectory( const std::wstring& name )
{
if (( m_pStorage != NULL ) && ( path != NULL ))
if (!m_pStorage) return false;
return m_pStorage->isDirectory(name);
}
bool GetStream (const std::wstring & path, POLE::Stream** ppStream)
{
if (( m_pStorage != NULL ) && ( !path.empty() ))
{
*ppStream = new POLE::Stream(m_pStorage, path);
*ppStream = new POLE::Stream(m_pStorage, path.c_str());
}
if ((*ppStream) && ((*ppStream)->size() > 0))
return true;
@ -79,8 +84,78 @@ namespace DocFileFormat
{
return m_pStorage;
}
void copy( int indent, std::wstring path, POLE::Storage * storageOut, bool withRoot = true)
{
std::list<std::wstring> entries, entries_sort;
entries = m_pStorage->entries_with_prefix( path );
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
{
std::wstring name = *it;
std::wstring fullname = path + name;
if( m_pStorage->isDirectory( fullname ) )
{
entries_sort.push_back(name);
}
else
{
entries_sort.push_front(name);
}
}
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
for( std::list<std::wstring>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
{
std::wstring name = *it;
std::wstring fullname = path + name;
if( m_pStorage->isDirectory( fullname ) )
{
copy( indent + 1, fullname + L"/", storageOut, withRoot );
}
else
{
copy_stream(fullname, storageOut, withRoot);
}
}
}
private:
void copy_stream(std::wstring streamName, POLE::Storage * storageOut, bool withRoot = true)
{
POLE::Stream *stream = new POLE::Stream(m_pStorage, streamName);
if (!stream) return;
stream->seek(0);
POLE::int64 size_stream = stream->size();
if (withRoot == false)
{
int pos = (int)streamName.find(L"/");
if (pos >= 0)
streamName = streamName.substr(pos + 1);
}
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
if (!streamNew) return;
unsigned char* data_stream = new unsigned char[size_stream];
if (data_stream)
{
stream->read(data_stream, size_stream);
streamNew->write(data_stream, size_stream);
delete []data_stream;
data_stream = NULL;
}
streamNew->flush();
delete streamNew;
delete stream;
}
POLE::Storage* m_pStorage;
};

View File

@ -35,13 +35,13 @@
namespace DocFileFormat
{
TableCellPropertiesMapping::TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* tableGrid, int gridIndex, int cellIndex) :
TableCellPropertiesMapping::TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* grid, const std::vector<short>* grid_write, int gridIndex, int cellIndex) :
PropertiesMapping(pWriter)
{
_width = 0;
_gridIndex = gridIndex;
_grid = tableGrid;
_grid = grid;
_cellIndex = cellIndex;
_brcTop = NULL;
@ -75,6 +75,8 @@ namespace DocFileFormat
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>(visited);
int nComputedCellWidth = 0;
_gridSpan = 1;
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
{
@ -87,7 +89,7 @@ namespace DocFileFormat
int cc = tdef.numberOfColumns;
_tGrid = tdef.rgdxaCenter;
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)]; // NOTE: fix for crash
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)];
appendValueElement( _tcPr, L"textDirection", FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ), false );
@ -111,13 +113,19 @@ namespace DocFileFormat
{
appendValueElement( _tcPr, L"noWrap", L"", true );
}
nComputedCellWidth = (short)( tdef.rgdxaCenter[(size_t)(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1) + 1] -
tdef.rgdxaCenter[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)] ); // NOTE: fix for crash
int ind = (std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1);
int ind1 = ind;
while (ind1 < tdef.rgdxaCenter.size() - 1)
{
int sz = tdef.rgdxaCenter[ ind1 + 1] - tdef.rgdxaCenter[ ind1 ] ;
if (sz > 1)
break;
ind1++;
}
nComputedCellWidth = tdef.rgdxaCenter[ ind1 + 1] - tdef.rgdxaCenter[ ind ] ;
if (!IsTableBordersDefined(tapx->grpprl))
{ //borders
{
RELEASEOBJECT(_brcTop);
_brcTop = new BorderCode(*_tcDef.brcTop);
@ -134,8 +142,7 @@ namespace DocFileFormat
break;
case sprmTCellPadding:
{ //margins
{
unsigned char first = iter->Arguments[0];
unsigned char lim = iter->Arguments[1];
unsigned char ftsMargin = iter->Arguments[3];
@ -165,7 +172,6 @@ namespace DocFileFormat
}
}
break;
case sprmTDefTableShd80:
{
if (!tapx->IsSkipShading97()) // если такой операнд единственный то учитываем его, иначе скипаем его
@ -270,24 +276,23 @@ namespace DocFileFormat
}
}
//width
XMLTools::XMLElement tcW ( L"w:tcW" );
XMLTools::XMLAttribute tcWType ( L"w:type", FormatUtils::MapValueToWideString( _ftsWidth, &Global::CellWidthTypeMap[0][0], 4, 5 ) );
XMLTools::XMLAttribute tcWVal ( L"w:w", FormatUtils::IntToWideString( _width ) );
XMLTools::XMLElement tcW ( L"w:tcW" );
tcW.AppendAttribute( tcWType );
XMLTools::XMLAttribute tcWVal ( L"w:w", FormatUtils::IntToWideString( _width > 1 ? _width : nComputedCellWidth) );
XMLTools::XMLAttribute tcWType ( L"w:type", _width > 1 ? FormatUtils::MapValueToWideString( _ftsWidth, &Global::CellWidthTypeMap[0][0], 4, 5 ) : L"dxa" );
tcW.AppendAttribute( tcWType );
tcW.AppendAttribute( tcWVal );
_tcPr->AppendChild( tcW );
//grid span
_gridSpan = 1;
if ( ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
{
//check the number of merged cells
int w = _grid->at( _gridIndex );
for ( unsigned int i = _gridIndex + 1; i < _grid->size(); i++ )
for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
{
_gridSpan++;
@ -349,7 +354,7 @@ namespace DocFileFormat
void TableCellPropertiesMapping::apppendCellShading (unsigned char* sprmArg, int size, int cellIndex)
{
if (sprmArg)
if (sprmArg && cellIndex >= 0)
{
//shading descriptor can have 10 bytes (Word 2000) or 2 bytes (Word 97)
int shdLength = 2;

View File

@ -58,7 +58,7 @@ namespace DocFileFormat
public:
virtual ~TableCellPropertiesMapping();
TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* tableGrid, int gridIndex, int cellIndex);
TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* grid, const std::vector<short>* grid_write, int gridIndex, int cellIndex);
virtual void Apply( IVisitable* visited );
inline int GetGridSpan() const
@ -71,9 +71,7 @@ namespace DocFileFormat
void apppendCellShading (unsigned char* sprmArg, int size, int cellIndex);
bool IsTableBordersDefined (const std::list<SinglePropertyModifier>* grpprl) const;
bool IsTableCellWidthDefined (const std::list<SinglePropertyModifier>* grpprl) const;
private:
int _gridIndex;
int _cellIndex;
@ -93,7 +91,6 @@ namespace DocFileFormat
BorderCode* _brcRight;
BorderCode* _brcBottom;
/// The grind span of this cell
int _gridSpan;
int _gridSpan;
};
}

View File

@ -106,7 +106,7 @@ namespace DocFileFormat
cellElements.clear();
}
void TableCell::Convert(IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, int& gridIndex, int nCellIndex)
void TableCell::Convert(IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, const std::vector<short>* grid_write, int& gridIndex, int nCellIndex)
{
if (NULL != mapping)
{
@ -116,14 +116,14 @@ namespace DocFileFormat
ParagraphPropertyExceptions* papxBackup = documentMapping->_lastValidPapx;
SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx;
//start w:tc
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tc" );
//find cell end
//find cell end
int cpCellEnd = documentMapping->findCellEndCp(cp, depth);
//convert the properties
TableCellPropertiesMapping tcpMapping(documentMapping->GetXMLWriter(), grid, gridIndex, nCellIndex);
//start w:tc
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tc" );
//convert the properties
TableCellPropertiesMapping tcpMapping(documentMapping->GetXMLWriter(), grid, grid_write, gridIndex, nCellIndex);
if ( tapx != NULL )
{
@ -140,7 +140,7 @@ namespace DocFileFormat
(*iter)->Convert( mapping );
}
//end w:tc
//end w:tc
documentMapping->GetXMLWriter()->WriteNodeEnd( L"w:tc" );
}
@ -193,7 +193,7 @@ namespace DocFileFormat
cells.clear();
}
void TableRow::Convert(IMapping* mapping, const std::vector<short>* grid)
void TableRow::Convert(IMapping* mapping, const std::vector<short>* grid, const std::vector<short>* grid_write)
{
if ( mapping != NULL )
{
@ -234,7 +234,7 @@ namespace DocFileFormat
{
for ( std::list<TableCell>::iterator iter = cells.begin(); iter != cells.end(); iter++ )
{
iter->Convert( mapping, &tapx, grid, gridIndex, nCellIndex++ );
iter->Convert( mapping, &tapx, grid, grid_write, gridIndex, nCellIndex++);
}
}
@ -516,7 +516,8 @@ namespace DocFileFormat
SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx;
//build the table grid
std::vector<short>* grid = documentMapping->buildTableGrid( cpStart, depth );
std::vector<short> grid, grid_write;
documentMapping->buildTableGrid( cpStart, depth, grid, grid_write );
//find first row end
int fcRowEnd = documentMapping->findRowEndFc( cpStart, depth );
@ -529,7 +530,7 @@ namespace DocFileFormat
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tbl" );
//Convert it
TablePropertiesMapping tpMapping( documentMapping->GetXMLWriter(), documentMapping->m_document->Styles, grid );
TablePropertiesMapping tpMapping( documentMapping->GetXMLWriter(), documentMapping->m_document->Styles, &grid, &grid_write );
row1Tapx.Convert( &tpMapping );
@ -538,13 +539,12 @@ namespace DocFileFormat
for ( std::list<TableRow>::iterator iter = rows.begin(); iter != rows.end(); iter++ )
{
iter->Convert( mapping, grid );
iter->Convert( mapping, &grid, &grid_write );
}
//close w:tbl
documentMapping->GetXMLWriter()->WriteNodeEnd( L"w:tbl" );
RELEASEOBJECT( grid );
}
}

View File

@ -58,7 +58,7 @@ namespace DocFileFormat
void AddItem( const ITableCellElement& _tableCellElement );
bool IsEmpty() const;
void Clear();
void Convert( IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, int& gridIndex, int cellIndex );
void Convert( IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, const std::vector<short>* grid_write, int& gridIndex, int cellIndex );
~TableCell();
private:
@ -81,7 +81,7 @@ namespace DocFileFormat
void AddCell( const TableCell& _tableCell );
bool IsEmpty() const;
void Clear();
void Convert( IMapping* mapping, const std::vector<short>* grid );
void Convert( IMapping* mapping, const std::vector<short>* grid, const std::vector<short>* grid_write );
~TableRow();
private:

View File

@ -34,15 +34,13 @@
namespace DocFileFormat
{
TablePropertiesMapping::TablePropertiesMapping (XMLTools::CStringXmlWriter* pWriter, StyleSheet* styles, std::vector<short>* grid, bool isTableStyleNeeded ):
PropertiesMapping(pWriter), _tblPr(NULL), _tblGrid(NULL), _tblBorders(NULL), _grid(NULL),
brcLeft(NULL), brcTop(NULL), brcBottom(NULL), brcRight(NULL), brcHorz(NULL), brcVert(NULL), _styles(NULL),
TablePropertiesMapping::TablePropertiesMapping (XMLTools::CStringXmlWriter* pWriter, StyleSheet* styles, std::vector<short>* grid, std::vector<short>* grid_write, bool isTableStyleNeeded ):
PropertiesMapping(pWriter), _tblPr(NULL), _tblGrid(NULL), _tblBorders(NULL), _grid(grid), _grid_write(grid_write),
brcLeft(NULL), brcTop(NULL), brcBottom(NULL), brcRight(NULL), brcHorz(NULL), brcVert(NULL), _styles(styles),
_isTableStyleNeeded(isTableStyleNeeded)
{
_styles = styles;
_tblPr = new XMLTools::XMLElement( L"w:tblPr");
_tblBorders = new XMLTools::XMLElement( L"w:tblBorders");
_grid = grid;
}
TablePropertiesMapping::~TablePropertiesMapping()
{
@ -74,6 +72,9 @@ namespace DocFileFormat
short marginLeft = 0;
short marginRight = 0;
BYTE itcFirst = 0;
BYTE itcLim = 0;
for ( std::list<SinglePropertyModifier>::iterator iter = tapx->grpprl->begin(); iter != tapx->grpprl->end(); iter++ )
{
switch( iter->OpCode )
@ -120,7 +121,15 @@ namespace DocFileFormat
_tblPr->AppendChild( tblW );
}
break;
case sprmTMerge:
{
itcFirst = iter->Arguments[0];
itcLim = iter->Arguments[1];
}break;
case sprmTSplit:
{
}break;
case sprmOldTJc:
case sprmTJc:
case sprmTJcRow:
@ -144,7 +153,7 @@ namespace DocFileFormat
if ( _isTableStyleNeeded )
{
int ind = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
size_t ind = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
std::wstring id = ind < _styles->Styles->size() ? StyleSheetMapping::MakeStyleId( _styles->Styles->at( ind ) ) : L"";
@ -486,7 +495,7 @@ namespace DocFileFormat
bWriteGridCol = true;
else
{
for ( unsigned int i = 0, nSize = _grid->size(); i < nSize; i++ )
for ( size_t i = 0, nSize = _grid_write->size(); i < nSize; i++ )
{
if(_grid->at(i) % DocFileFormat::gc_nZeroWidth != 0)
{
@ -497,10 +506,10 @@ namespace DocFileFormat
}
if(true == bWriteGridCol)
{
for ( unsigned int i = 0; i < _grid->size(); i++ )
for ( size_t i = 0; i < _grid_write->size(); i++ )
{
XMLTools::XMLElement gridCol( L"w:gridCol");
XMLTools::XMLAttribute gridColW( L"w:w", FormatUtils::IntToWideString( _grid->at( i ) ) );
XMLTools::XMLAttribute gridColW( L"w:w", FormatUtils::IntToWideString( _grid_write->at( i ) ) );
gridCol.AppendAttribute( gridColW );
_tblGrid->AppendChild( gridCol );
}

View File

@ -71,7 +71,7 @@ namespace DocFileFormat
class TablePropertiesMapping: public PropertiesMapping, public IMapping
{
public:
TablePropertiesMapping( XMLTools::CStringXmlWriter* writer, StyleSheet* styles, std::vector<short>* grid, bool isTableStyleNeeded = true );
TablePropertiesMapping( XMLTools::CStringXmlWriter* writer, StyleSheet* styles, std::vector<short>* grid, std::vector<short>* grid_write, bool isTableStyleNeeded = true );
virtual ~TablePropertiesMapping();
void Apply( IVisitable* visited );
@ -83,6 +83,7 @@ namespace DocFileFormat
StyleSheet* _styles;
std::vector<short>* _grid;
std::vector<short>* _grid_write;
BorderCode* brcLeft;
BorderCode* brcTop;

View File

@ -62,8 +62,9 @@ namespace DocFileFormat
for (std::list<SinglePropertyModifier>::iterator oSpmIter = papx->grpprl->begin(); oSpmIter != papx->grpprl->end(); ++oSpmIter)
{
if (oSpmIter->OpCode == sprmTDefTableShd || oSpmIter->OpCode == sprmTDefTableShd2nd ||
oSpmIter->OpCode == sprmTDefTableShd2nd || oSpmIter->OpCode == sprmTDefTableShd3rd)
if (oSpmIter->OpCode == sprmTDefTableShd ||
oSpmIter->OpCode == sprmTDefTableShd2nd ||
oSpmIter->OpCode == sprmTDefTableShd3rd)
{
m_bSkipShading97 = TRUE;
}

View File

@ -159,13 +159,13 @@ namespace DocFileFormat
OOX::CDocument docEmbedded(path, path);
bool res = false;
for (int i = 0 ; i < docEmbedded.m_arrItems.size(); i++)
for (size_t i = 0 ; i < docEmbedded.m_arrItems.size(); i++)
{
if (docEmbedded.m_arrItems[i]->getType() == OOX::et_w_p)
{
OOX::Logic::CParagraph *paragraph = dynamic_cast<OOX::Logic::CParagraph *>(docEmbedded.m_arrItems[i]);
for (int j = 0; (paragraph) && (j < paragraph->m_arrItems.size()); j++)
for (size_t j = 0; (paragraph) && (j < paragraph->m_arrItems.size()); j++)
{
if (paragraph->m_arrItems[j]->getType() == OOX::et_m_oMath)
{
@ -177,7 +177,7 @@ namespace DocFileFormat
{
OOX::Logic::COMathPara *mathPara = dynamic_cast<OOX::Logic::COMathPara *>(paragraph->m_arrItems[j]);
for (int k = 0; (mathPara) && (k < mathPara->m_arrItems.size()); k++)
for (size_t k = 0; (mathPara) && (k < mathPara->m_arrItems.size()); k++)
{
if (mathPara->m_arrItems[k]->getType() == OOX::et_m_oMath)
{

View File

@ -744,7 +744,7 @@ namespace DocFileFormat
text = FormatUtils::XmlEncode(text);
if (0 <= text.find(L"\n"))
if (std::wstring::npos != text.find(L"\n"))
{
m_textpath.AppendText(text);
}
@ -754,7 +754,7 @@ namespace DocFileFormat
case gtextFont:
{
std::wstring font = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex.get(), (iter->op)/2);
int i = font.size();
size_t i = font.size();
while (i > 0)
{
if (font[i-1] != 0) break;
@ -1905,13 +1905,13 @@ namespace DocFileFormat
switch (pSpa->wr)
{
case 0:
case 2: wrapType = L"square";
case 1: wrapType = L"topAndBottom";
case 3: wrapType = L"through";
case 2: wrapType = L"square"; break;
case 1: wrapType = L"topAndBottom"; break;
case 3: wrapType = L"through"; break;
case 4:
case 5: wrapType = L"tight";
case 5: wrapType = L"tight"; break;
default:
wrapType = L"none";
wrapType = L"none"; break;
}
}
@ -1963,7 +1963,7 @@ namespace DocFileFormat
{
int index = (DWORD)val - 0x80000000;
if (index >= 0 && index < m_arrGuides.size())
if (index >= 0 && index < (int)m_arrGuides.size())
{
new_val = m_arrGuides[index].param3;
}
@ -2130,7 +2130,7 @@ namespace DocFileFormat
void VMLShapeMapping::ApplyPrimitives(DrawingPrimitives * primitives)
{
int index = 0;
size_t index = 0;
while(true)
{
@ -2142,7 +2142,7 @@ namespace DocFileFormat
static int currentTextBoxIndex = 1;
int VMLShapeMapping::ApplyPrimitive(DrawingPrimitives * primitives, int index)
size_t VMLShapeMapping::ApplyPrimitive(DrawingPrimitives * primitives, size_t index)
{
if (!primitives) return index++;
if (index >= primitives->size()) return index++;
@ -2165,7 +2165,7 @@ namespace DocFileFormat
//todooo нарисовать кастомный шейп
}
else
WritePrimitiveProps(primitive, (index==0?true:false));
WritePrimitiveProps(primitive, (index==0 ? true : false));
if (primitive->type == 0x0000)
@ -2241,11 +2241,11 @@ namespace DocFileFormat
{
//strStyle += L"left:" + FormatUtils::IntToWideString( x.ToPoints()) + L"pt;";
//strStyle += L"top:" + FormatUtils::IntToWideString( y.ToPoints()) + L"pt;";
strStyle += L"width:" + FormatUtils::IntToWideString( w.ToPoints()) + L"pt;";
strStyle += L"height:" + FormatUtils::IntToWideString( h.ToPoints()) + L"pt;";
strStyle += L"width:" + FormatUtils::IntToWideString( (int)w.ToPoints()) + L"pt;";
strStyle += L"height:" + FormatUtils::IntToWideString( (int)h.ToPoints()) + L"pt;";
strStyle += L"margin-left:" + FormatUtils::IntToWideString( x.ToPoints()) + L"pt;";
strStyle += L"margin-top:" + FormatUtils::IntToWideString( y.ToPoints()) + L"pt;";
strStyle += L"margin-left:" + FormatUtils::IntToWideString( (int)x.ToPoints()) + L"pt;";
strStyle += L"margin-top:" + FormatUtils::IntToWideString( (int)y.ToPoints()) + L"pt;";
std::wstring xMargin;
std::wstring yMargin;

View File

@ -73,7 +73,7 @@ namespace DocFileFormat
private:
void ApplyPrimitives (DrawingPrimitives * primitives );
int ApplyPrimitive (DrawingPrimitives * primitives, int index);
size_t ApplyPrimitive (DrawingPrimitives * primitives, size_t index);
void WritePrimitiveProps(DrawingPrimitive * primitive, bool root);

View File

@ -134,7 +134,7 @@ public:
if (position + count > stream->size())
{
if (position > stream->size()) count = 0;
else count = stream->size() - position;
else count = (unsigned int)(stream->size() - position);
}
rdBytes = new unsigned char[count];
}
@ -152,7 +152,7 @@ public:
virtual unsigned long GetPosition() const
{
return this->position;
return (unsigned long)this->position;
}
virtual unsigned long GetSize() const
@ -161,7 +161,7 @@ public:
if ( stream != NULL )
{
size = stream->size();
size = (unsigned long)stream->size();
}
return size;
@ -246,7 +246,7 @@ public:
/// The string must have the following structure:
/// unsigned char 1-4: Character count (cch)
/// unsigned char 5-cch+4: ANSI characters terminated by \0
std::wstring ReadLengthPrefixedAnsiString(int max_size)
std::wstring ReadLengthPrefixedAnsiString(unsigned int max_size)
{
std::wstring result;
@ -257,8 +257,8 @@ public:
if (cch > max_size)
{
//error ... skip to 0
int pos_orinal = GetPosition();
int pos = 0;
unsigned int pos_orinal = GetPosition();
unsigned int pos = 0;
stringBytes = ReadBytes( max_size, true );

View File

@ -95,7 +95,7 @@ namespace DocFileFormat
return AVS_ERROR_FILEFORMAT;
}
//-----------------------------------------------------------------------------------------------------------------
if (m_pStorage->GetStream ("WordDocument", &WordDocumentStream) == false)
if (m_pStorage->GetStream (L"WordDocument", &WordDocumentStream) == false)
{
Clear();
return AVS_ERROR_FILEFORMAT;
@ -121,16 +121,16 @@ namespace DocFileFormat
if (FIB->m_FibBase.fWhichTblStm)
{
if (!m_pStorage->GetStream ("1Table", &TableStream))
if (!m_pStorage->GetStream (L"1Table", &TableStream))
{
res = m_pStorage->GetStream ("0Table", &TableStream);
res = m_pStorage->GetStream (L"0Table", &TableStream);
}
}
else
{
if (!m_pStorage->GetStream ("0Table", &TableStream))
if (!m_pStorage->GetStream (L"0Table", &TableStream))
{
res = m_pStorage->GetStream ("1Table", &TableStream);
res = m_pStorage->GetStream (L"1Table", &TableStream);
}
}
@ -176,8 +176,8 @@ namespace DocFileFormat
POLE::Stream * Summary = NULL;
POLE::Stream * DocSummary = NULL;
m_pStorage->GetStream ("SummaryInformation", &Summary);
m_pStorage->GetStream ("DocumentSummaryInformation", &DocSummary);
m_pStorage->GetStream (L"SummaryInformation", &Summary);
m_pStorage->GetStream (L"DocumentSummaryInformation", &DocSummary);
document_code_page = ENCODING_WINDOWS_1250;
@ -206,7 +206,7 @@ namespace DocFileFormat
//-------------------------------------------------------------------------------------------------
try
{
m_pStorage->GetStream ("Data", &DataStream);
m_pStorage->GetStream (L"Data", &DataStream);
}
catch (...)
{
@ -216,7 +216,7 @@ namespace DocFileFormat
if (TableStream->size() < 1 && bOlderVersion)
{
RELEASEOBJECT(TableStream);
m_pStorage->GetStream ("WordDocument", &TableStream);
m_pStorage->GetStream (L"WordDocument", &TableStream);
}
RevisionAuthorTable = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfRMark, FIB->m_FibWord97.lcbSttbfRMark, bOlderVersion);
@ -483,7 +483,7 @@ namespace DocFileFormat
delete storageOut;
return false;
}
DecryptStream( 0, "/", storageIn, storageOut, Decryptor);
DecryptStream( 0, L"/", storageIn, storageOut, Decryptor);
//std::list<std::string> listStream = storageIn->entries();
@ -514,46 +514,60 @@ namespace DocFileFormat
m_pStorage->SetFile(m_sTempDecryptFileName.c_str());
if (m_pStorage->GetStream ("WordDocument", &WordDocumentStream) == false) return false;
if (m_pStorage->GetStream (L"WordDocument", &WordDocumentStream) == false) return false;
if (FIB->m_FibBase.fWhichTblStm)
{
if (!m_pStorage->GetStream ("1Table", &TableStream)) m_pStorage->GetStream ("0Table", &TableStream);
if (!m_pStorage->GetStream (L"1Table", &TableStream)) m_pStorage->GetStream (L"0Table", &TableStream);
}
else
{
if (!m_pStorage->GetStream ("0Table", &TableStream)) m_pStorage->GetStream ("1Table", &TableStream);
if (!m_pStorage->GetStream (L"0Table", &TableStream)) m_pStorage->GetStream (L"1Table", &TableStream);
}
return true;
}
void WordDocument::DecryptStream( int level, std::string path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
void WordDocument::DecryptStream( int level, std::wstring path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
{
std::list<std::string> entries;
entries = storageIn->entries( path );
std::list<std::string>::iterator it;
for( it = entries.begin(); it != entries.end(); ++it )
std::list<std::wstring> entries, entries_files, entries_dir;
entries = storageIn->entries_with_prefix( path );
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
{
std::string name = *it;
std::string fullname = path + name;
std::wstring name = *it;
std::wstring fullname = path + name;
if( storageIn->isDirectory( fullname ) )
{
DecryptStream( level + 1, fullname + "/", storageIn, storageOut, Decryptor );
entries_dir.push_back(name);
}
else
{
DecryptStream(fullname, storageIn, storageOut, Decryptor );
entries_files.push_front(name);
}
}
for( std::list<std::wstring>::iterator it = entries_dir.begin(); it != entries_dir.end(); ++it )
{
std::wstring fullname = path + *it;
DecryptStream( level + 1, fullname + L"/", storageIn, storageOut, Decryptor );
}
//if (bSortFiles)
entries_files.sort();
for( std::list<std::wstring>::iterator it = entries_files.begin(); it != entries_files.end(); ++it )
{
std::wstring fullname = path + *it;
DecryptStream(fullname, storageIn, storageOut, Decryptor );
}
}
bool WordDocument::DecryptStream(std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
bool WordDocument::DecryptStream(std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
{
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
if (!stream) return false;
stream->seek(0);
int size_stream = stream->size();
POLE::uint64 size_stream = stream->size();
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
if (!streamNew) return false;
@ -564,7 +578,7 @@ namespace DocFileFormat
unsigned char* data_store = NULL;
int size_data_store = 0;
if ( std::wstring::npos != streamName.find("WordDocument") )
if ( std::wstring::npos != streamName.find(L"WordDocument") )
{
size_data_store = 68;
data_store = new unsigned char[size_data_store];
@ -573,8 +587,10 @@ namespace DocFileFormat
if (data_store)
memcpy(data_store, data_stream, size_data_store);
int size_block = 0x200;
for (int pos = 0, block = 0 ; pos < size_stream; pos += size_block, block++)
size_t size_block = 0x200;
unsigned long block = 0;
for (POLE::uint64 pos = 0; pos < size_stream; pos += size_block, block++)
{
if (pos + size_block > size_stream)
size_block = size_stream - pos;

View File

@ -99,18 +99,17 @@ namespace DocFileFormat
bool bOlderVersion;
int document_code_page;
private:
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
bool DecryptStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
void DecryptStream (int level, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
inline StructuredStorageReader* GetStorage() const
{
return m_pStorage;
}
private:
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
bool DecryptStream (std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
void DecryptStream (int level, std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
inline OfficeArtContent* GetOfficeArt ()
{
return officeArtContent;

View File

@ -71,7 +71,7 @@ namespace ImageHelper
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
if (!header) return result;
result == Global::msoblipDIB;
result = Global::msoblipDIB;
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
{
@ -180,10 +180,37 @@ namespace DocFileFormat
{
}
void WordprocessingDocument::SaveDocument()
void WordprocessingDocument::SaveDocument(bool &bMacros)
{
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ;
NSDirectory::CreateDirectory( pathWord );
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ;
NSDirectory::CreateDirectory( pathWord );
if (bMacros && docFile->GetStorage()->isDirectory(L"Macros"))
{
std::wstring sVbaProjectFile = pathWord + FILE_SEPARATOR_STR + L"vbaProject.bin";
POLE::Storage *storageVbaProject = new POLE::Storage(sVbaProjectFile.c_str());
if ((storageVbaProject) && (storageVbaProject->open(true, true)))
{
docFile->GetStorage()->copy(0, L"Macros/", storageVbaProject, false);
storageVbaProject->close();
delete storageVbaProject;
RegisterDocumentMacros();
RegisterVbaProject();
//output_document->get_xl_files().add_vba_project();
}
else bMacros = false;
}
else
bMacros = false;
if (!bMacros)
{
RegisterDocument();
}
WritePackage();

View File

@ -76,6 +76,7 @@ namespace DocFileFormat
public:
WordprocessingDocument(const std::wstring & _docxDirectory, const WordDocument* _docFile);
virtual ~WordprocessingDocument();
void SaveDocument();
void SaveDocument(bool &bMacros);
};
}

View File

@ -34,14 +34,14 @@
#include "../DocDocxConverter/Converter.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, ProgressCallback *ffCallBack )
HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
{
HRESULT hr = S_FALSE;
DocFileFormat::Converter docToDocx;
docToDocx.m_sTempFolder = m_sTempFolder;
hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, ffCallBack);
hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, ffCallBack, bMacros);
return hr;
}

View File

@ -53,7 +53,7 @@ public:
std::wstring m_sTempFolder;
HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, ProgressCallback *ffCallBack = NULL);
HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
HRESULT SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
};

View File

@ -44,7 +44,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"

View File

@ -49,22 +49,32 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
int _tmain(int argc, _TCHAR* argv[])
#pragma comment(lib, "Rpcrt4.lib")
HRESULT convert_single(std::wstring sSrcDoc)
{
if (argc < 2) return 1;
HRESULT hr = S_OK;
std::wstring sSrcDoc = argv[1];
std::wstring sDstDocx = argc > 2 ? argv[2] : sSrcDoc + L"-my.docx";
std::wstring outputDir = NSDirectory::GetFolderPath(sDstDocx);
std::wstring outputDir = NSDirectory::GetFolderPath(sSrcDoc);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
COfficeDocFile docFile;
docFile.m_sTempFolder = outputDir;
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", NULL);
bool bMacros = true;
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", bMacros, NULL);
std::wstring sDstDocx;
if (bMacros)
{
sDstDocx = sSrcDoc + L"-my.docm";
}
else
{
sDstDocx = sSrcDoc + L"-my.docx";
}
if (hRes == S_OK)
{
COfficeUtils oCOfficeUtils(NULL);
@ -76,3 +86,33 @@ int _tmain(int argc, _TCHAR* argv[])
return hRes;
}
HRESULT convert_directory(std::wstring pathName)
{
HRESULT hr = S_OK;
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(pathName, false);
for (size_t i = 0; i < arFiles.size(); i++)
{
convert_single(arFiles[i]);
}
return S_OK;
}
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 2) return 1;
HRESULT hr = -1;
if (NSFile::CFileBinary::Exists(argv[1]))
{
hr = convert_single(argv[1]);
}
else if (NSDirectory::Exists(argv[1]))
{
hr = convert_directory(argv[1]);
}
return hr;
}

View File

@ -55,7 +55,9 @@ namespace Writers
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8( std::wstring(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>")));
oFile.WriteStringUTF8( std::wstring(_T("<w:document \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \

View File

@ -60,16 +60,50 @@ namespace Writers
std::wstring rId;
SimpleTypes::EHdrFtr eType;
};
static std::wstring g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_hdr_End = _T("</w:hdr>");
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_ftr_End = _T("</w:ftr>");
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_footnotes_End = _T("</w:footnotes>");
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_endnotes_End = _T("</w:endnotes>");
class HeaderFooterWriter

View File

@ -355,10 +355,13 @@ class Tab
public:
BYTE Val;
double Pos;
BYTE Leader;
bool bLeader;
Tab()
{
Val = shd_Nil;
Pos = 0;
bLeader = false;
}
};
class Tabs
@ -1697,7 +1700,7 @@ public:
std::vector<std::wstring> arSplit;
boost::algorithm::split(arSplit, pComment->UserName, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
for (int i = 0; i < arSplit.size(); i++)
for (size_t i = 0; i < arSplit.size(); i++)
{
sInitials += arSplit[i][0];
}
@ -1733,7 +1736,7 @@ public:
bool bFirst = true;
int nPrevIndex = 0;
for(size_t i = 0; i < sText.length(); i++)
for (int i = 0; i < (int)sText.length(); i++)
{
wchar_t cToken = sText[i];
if('\n' == cToken)
@ -2337,7 +2340,7 @@ public:
{
return Jc.empty() && TableInd.empty() && TableW.empty() && TableCellMar.empty() && TableBorders.empty() && Shd.empty() && tblpPr.empty()&& Style.empty() && Look.empty() && tblPrChange.empty() && TableCellSpacing.empty() && RowBandSize.empty() && ColBandSize.empty();
}
std::wstring Write(bool bBandSize, bool bLayout)
std::wstring Write()
{
std::wstring sRes;
sRes += L"<w:tblPr>";
@ -2361,13 +2364,8 @@ public:
sRes += (TableBorders);
if(false == Shd.empty())
sRes += (Shd);
if(bLayout)
{
if(false == Layout.empty())
sRes += (Layout);
else if(g_nCurFormatVersion < 4)
sRes += L"<w:tblLayout w:type=\"fixed\"/>";
}
if(false == Layout.empty())
sRes += (Layout);
if(false == TableCellMar.empty())
sRes += (TableCellMar);
if(false == Look.empty())
@ -2755,7 +2753,7 @@ public:
}
if(NULL != tblPr)
{
pCStringWriter->WriteString(tblPr->Write(false, true));
pCStringWriter->WriteString(tblPr->Write());
}
if(NULL != tblGridChange)
{

View File

@ -827,7 +827,23 @@ public:
case g_tabtype_clear: sVal = L"clear"; break;
default: sVal = L"left"; break;
}
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(nTab) + L"\"/>");
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(nTab) + L"\"");
if (oTab.bLeader)
{
std::wstring sLeader;
switch(oTab.Leader)
{
case SimpleTypes::tabtlcDot : sLeader = (L"dot");break;
case SimpleTypes::tabtlcHeavy : sLeader = (L"heavy");break;
case SimpleTypes::tabtlcHyphen : sLeader = (L"hyphen");break;
case SimpleTypes::tabtlcMiddleDot : sLeader = (L"middleDot");break;
case SimpleTypes::tabtlcNone : sLeader = (L"none");break;
case SimpleTypes::tabtlcUnderscore : sLeader = (L"underscore");break;
default : sLeader = (L"none");break;
}
pCStringWriter->WriteString(L" w:leader=\"" + sLeader + L"\"");
}
pCStringWriter->WriteString(L"/>");
}
pCStringWriter->WriteString(std::wstring(L"</w:tabs>"));
}
@ -885,6 +901,11 @@ public:
pCStringWriter->WriteString(oSectPr.Write());
pCStringWriter->WriteString(std::wstring(_T("</w:sectPr>")));
}break;
case c_oSerProp_pPrType::outlineLvl:
{
long outlineLvl = m_oBufferedStream.GetLong();
pCStringWriter->WriteString(L"<w:outlineLvl w:val=\"" + std::to_wstring(outlineLvl) + L"\"/>");
}break;
default:
res = c_oSerConstants::ReadUnknown;
break;
@ -1003,6 +1024,11 @@ public:
poTabItem->Val = m_oBufferedStream.GetUChar();
else if(c_oSerProp_pPrType::Tab_Item_Pos == type)
poTabItem->Pos = m_oBufferedStream.GetDouble();
else if(c_oSerProp_pPrType::Tab_Item_Leader == type)
{
poTabItem->bLeader = true;
poTabItem->Leader = m_oBufferedStream.GetUChar();
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -2800,7 +2826,7 @@ public:
{
CWiterTblPr oWiterTblPr;
oBinary_tblPrReader.Read_tblPrOut(length, &oWiterTblPr);
odocStyle->TablePr = oWiterTblPr.Write(true, false);
odocStyle->TablePr = oWiterTblPr.Write();
}
else if(c_oSer_sts::Style_RowPr == type)
{
@ -2896,7 +2922,7 @@ public:
oBinary_tblPrReader.Read_tblPrOut(length, &oWiterTblPr);
if(false == oWiterTblPr.IsEmpty())
ptblStylePr->Writer.WriteString(oWiterTblPr.Write(false, false));
ptblStylePr->Writer.WriteString(oWiterTblPr.Write());
}
else if(c_oSerProp_tblStylePrType::TrPr == type)
{
@ -4003,6 +4029,19 @@ public:
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadFldChar(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Logic::CFldChar* pFldChar = static_cast<OOX::Logic::CFldChar*>(poResult);
if ( c_oSer_FldSimpleType::CharType == type )
{
pFldChar->m_oFldCharType.Init();
pFldChar->m_oFldCharType->SetValue((SimpleTypes::EFldCharType)m_oBufferedStream.GetUChar());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadFldSimple(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -6629,7 +6668,7 @@ public:
//сбрасываем Shd
oBinary_tblPrReader.m_sCurTableShd.clear();
}
else if(c_oSerRunType::fldstart == type)
else if(c_oSerRunType::fldstart_deprecated == type)
{
std::wstring sField(m_oBufferedStream.GetString3(length));
sField = XmlUtils::EncodeXmlString(sField);
@ -6643,7 +6682,7 @@ public:
m_oCur_rPr.Write(&GetRunStringWriter());
GetRunStringWriter().WriteString(std::wstring(_T("<w:fldChar w:fldCharType=\"separate\"/>")));
}
else if(c_oSerRunType::fldend == type)
else if(c_oSerRunType::fldend_deprecated == type)
{
GetRunStringWriter().WriteString(std::wstring(_T("<w:fldChar w:fldCharType=\"end\"/>")));
}
@ -6692,6 +6731,28 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadEndnoteRef, this, &oEndnoteRef);
GetRunStringWriter().WriteString(oEndnoteRef.toXML());
}
else if ( c_oSerRunType::fldChar == type)
{
OOX::Logic::CFldChar oFldChar;
res = Read1(length, &Binary_DocumentTableReader::ReadFldChar, this, &oFldChar);
GetRunStringWriter().WriteString(oFldChar.toXML());
}
else if ( c_oSerRunType::instrText == type)
{
GetRunStringWriter().WriteString(std::wstring(_T("<w:instrText xml:space=\"preserve\">")));
std::wstring sText(m_oBufferedStream.GetString3(length));
sText = XmlUtils::EncodeXmlString(sText);
GetRunStringWriter().WriteString(sText);
GetRunStringWriter().WriteString(std::wstring(_T("</w:instrText>")));
}
else if ( c_oSerRunType::delInstrText == type)
{
GetRunStringWriter().WriteString(std::wstring(_T("<w:delInstrText xml:space=\"preserve\">")));
std::wstring sText(m_oBufferedStream.GetString3(length));
sText = XmlUtils::EncodeXmlString(sText);
GetRunStringWriter().WriteString(sText);
GetRunStringWriter().WriteString(std::wstring(_T("</w:delInstrText>")));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -6790,7 +6851,7 @@ public:
{
CWiterTblPr oWiterTblPr;
oBinary_tblPrReader.Read_tblPrOut(length, &oWiterTblPr);
pCStringWriter->WriteString(oWiterTblPr.Write(false, true));
pCStringWriter->WriteString(oWiterTblPr.Write());
}
else if( c_oSerDocTableType::tblGrid == type )
{
@ -7064,21 +7125,22 @@ public:
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(nChartIndex) + L".xlsx";
std::wstring sXlsxPath = pathChartsWorksheetDir.GetPath() + FILE_SEPARATOR_STR + sXlsxFilename;
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace);
if (oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace))
{
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rIdXlsx;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rIdXlsx;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(L"xlsx");
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
pChartSpace->m_oChartSpace.m_externalData->m_id = new std::wstring();
pChartSpace->m_oChartSpace.m_externalData->m_id->append(L"rId");
pChartSpace->m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rIdXlsx));
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(L"xlsx");
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
pChartSpace->m_oChartSpace.m_externalData->m_id = new std::wstring();
pChartSpace->m_oChartSpace.m_externalData->m_id->append(L"rId");
pChartSpace->m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rIdXlsx));
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
}
//save chart.xml
NSStringUtils::CStringBuilder sw;

View File

@ -144,9 +144,13 @@ namespace MathEquation
void AddAccent (MEMBELTYPE eType)
{
LONG lPos = GetSize() - 1;
if (lPos < 0) return;
EquationRun oRun;
oRun = arrRun[lPos];
RemoveElem(lPos);
oRun.bAccent = true;
oRun.eType = eType;
Add(oRun);
@ -557,11 +561,11 @@ namespace MathEquation
BYTE horAlign;
switch(eHorAlign)
{
case matrixhoralignLeft: horAlign = SimpleTypes::xalignLeft;
case matrixhoralignCenter: horAlign = SimpleTypes::xalignCenter;
case matrixhoralignRight: horAlign = SimpleTypes::xalignRight;
case matrixhoralignEqualSign: horAlign = SimpleTypes::xalignCenter;
case matrixhoralignCommaSign: horAlign = SimpleTypes::xalignCenter;
case matrixhoralignLeft: horAlign = SimpleTypes::xalignLeft; break;
case matrixhoralignCenter: horAlign = SimpleTypes::xalignCenter; break;
case matrixhoralignRight: horAlign = SimpleTypes::xalignRight; break;
case matrixhoralignEqualSign: horAlign = SimpleTypes::xalignCenter; break;
case matrixhoralignCommaSign: horAlign = SimpleTypes::xalignCenter; break;
}
WriteItemVal(BinDocxRW::c_oSer_OMathBottomNodesType::McJc, horAlign);
@ -1675,7 +1679,7 @@ namespace MathEquation
void WriteEndNode(BinaryEquationWriter* pWriter)
{
int nCurPos;
int nCurPos = -1;
if (!m_aBaseStack.empty())
{
nCurPos = m_aBaseStack.top();
@ -1687,14 +1691,20 @@ namespace MathEquation
}
if (bPile && bEqArrayStart)
{
pWriter->WriteItemEnd(nCurPos);
}
else if (!bPile && !bEqArrayStart)
{
pWriter->WriteItemEnd(nCurPos);
}
else if (!bPile && bEqArrayStart)
{
pWriter->m_aRowsCounter.push(nRows);
bEqArrayStart = false;
pWriter->WriteItemEnd(nCurPos);//eqArr
if (nCurPos > 0)
pWriter->WriteItemEnd(nCurPos);//eqArr
if (!m_aBaseStack.empty())
{

View File

@ -344,7 +344,9 @@ extern int g_nCurFormatVersion;
FramePr = 30,
SectPr = 31,
numPr_Ins = 32,
pPrChange = 33
pPrChange = 33,
outlineLvl = 34,
Tab_Item_Leader = 35
};}
namespace c_oSerProp_rPrType{enum c_oSerProp_rPrType
{
@ -502,8 +504,8 @@ extern int g_nCurFormatVersion;
image = 6,
table = 7,
Content = 8,
fldstart = 9,
fldend = 10,
fldstart_deprecated = 9,
fldend_deprecated = 10,
CommentReference = 11,
pptxDrawing = 12,
object = 14,
@ -520,7 +522,10 @@ extern int g_nCurFormatVersion;
endnoteRef = 25,
footnoteReference = 26,
endnoteReference = 27,
arPr = 28
arPr = 28,
fldChar = 29,
instrText = 30,
delInstrText = 31
};}
namespace c_oSerVbaProjectTypes{enum c_oSerVbaProjectType
{
@ -928,7 +933,8 @@ extern int g_nCurFormatVersion;
{
Content = 0,
Instr = 1,
FFData = 2
FFData = 2,
CharType = 3
};}
namespace c_oSer_ColorThemeType{ enum c_oSer_ColorThemeType
{

View File

@ -76,18 +76,6 @@ namespace BinDocxRW
{
}
};
class FldStruct
{
protected:
int m_nType;
public:
std::wstring m_sFld;
FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){}
int GetType()
{
return m_nType;
}
};
class BinaryCommonWriter
{
public:
@ -1024,6 +1012,12 @@ namespace BinDocxRW
WritePPrChange(pPr.m_oPPrChange.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(pPr.m_oOutlineLvl.IsInit() && pPr.m_oOutlineLvl->m_oVal.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::outlineLvl);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pPr.m_oOutlineLvl->m_oVal->GetValue());
}
//SectPr
if(NULL != m_oBinaryHeaderFooterTableWriter && pPr.m_oSectPr.IsInit())
{
@ -1185,6 +1179,12 @@ namespace BinDocxRW
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(TabItem.m_oPos.get().ToMm());
}
if(false != TabItem.m_oLeader.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Tab_Item_Leader);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE((BYTE)TabItem.m_oLeader->GetValue());
}
}
void WriteNumPr(const OOX::Logic::CNumPr& numPr, const OOX::Logic::CParagraphProperty& pPr)
{
@ -2986,11 +2986,6 @@ namespace BinDocxRW
std::wstring m_sCurParStyle;
OOX::CSettings* m_oSettings;
//для fldChar
//todo в документации описан случай если нет fldchartypeEnd, у нас работает не так.
std::vector<FldStruct*> m_aFldChars;
std::wstring m_sFldChar;
SimpleTypes::EFldCharType m_eFldState;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
std::map<int, bool>* m_mapIgnoreComments;
public:
@ -3006,14 +3001,6 @@ namespace BinDocxRW
pBackground = NULL;
pSectPr = NULL;
m_bWriteSectPr = false;
m_eFldState = SimpleTypes::fldchartypeEnd;
}
~BinaryDocumentTableWriter()
{
for(size_t i = 0, length = m_aFldChars.size(); i < length; ++i)
{
RELEASEOBJECT(m_aFldChars[i]);
}
}
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer *rels, std::vector<std::wstring>& aShapeTypes)
{
@ -3163,24 +3150,6 @@ namespace BinDocxRW
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
FldStruct* ParseField(const std::wstring& sFld)
{
std::wstring sFldCopy = sFld;
boost::algorithm::trim (sFldCopy);
boost::algorithm::to_upper (sFldCopy);
FldStruct* pRes = NULL;
int nIndex = 0;
if(-1 != (nIndex = (int)sFldCopy.find(_T("TOC"))))
pRes = new FldStruct(sFldCopy, fieldstruct_toc);
else if(-1 != (nIndex = (int)sFldCopy.find(_T("HYPERLINK"))))
pRes = new FldStruct(sFldCopy, fieldstruct_hyperlink);
else
pRes = new FldStruct(sFldCopy, fieldstruct_none);
return pRes;
}
void WriteParagraphContent(const std::vector<OOX::WritingElement *>& Content, bool bHyperlink = false)
{
int nCurPos = 0;
@ -3459,6 +3428,16 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteFldChar(OOX::Logic::CFldChar* pFldChar)
{
int nCurPos = 0;
if(pFldChar->m_oFldCharType.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::CharType);
m_oBcw.m_oStream.WriteBYTE((BYTE)pFldChar->m_oFldCharType->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteFldSimple(OOX::Logic::CFldSimple* pFldSimple)
{
int nCurPos = 0;
@ -3610,7 +3589,7 @@ namespace BinDocxRW
m_oBcw.m_oStream.WriteLONG(oDDList.m_oResult->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
for(int i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
for(size_t i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
{
ComplexTypes::Word::String* pVal = oDDList.m_arrListEntry[i];
if(pVal->m_sVal.IsInit())
@ -5416,51 +5395,6 @@ namespace BinDocxRW
int nCurPos = 0;
OOX::Logic::CRunProperty* oCur_rPr = pRun->m_oRunProperty;
if(NULL != oCur_rPr)
{
//Заглушка для содержания
if(false == bHyperlink)
{
//Случай если Hyperlink задан как field
for(size_t i = 0, length = m_aFldChars.size(); i < length; ++i)
{
if(fieldstruct_hyperlink == m_aFldChars[i]->GetType())
{
bHyperlink = true;
break;
}
}
}
if(bHyperlink)
{
bool bInTOC = false;
for(size_t i = 0, length = m_aFldChars.size(); i < length; ++i)
{
if(fieldstruct_toc == m_aFldChars[i]->GetType())
{
bInTOC = true;
break;
}
}
if(bInTOC)
{
//убираем Runstyle
if(oCur_rPr->m_oRStyle.IsInit())
oCur_rPr->m_oRStyle.reset();
//Если настройки выставлены явно, то убираем их
if(oCur_rPr->m_oColor.IsInit() && oCur_rPr->m_oColor->m_oVal.IsInit() && SimpleTypes::hexcolorRGB == oCur_rPr->m_oColor->m_oVal->GetValue())
{
unsigned char bR = oCur_rPr->m_oColor->m_oVal->Get_R();
unsigned char bG = oCur_rPr->m_oColor->m_oVal->Get_G();
unsigned char bB = oCur_rPr->m_oColor->m_oVal->Get_B();
if(0x00 == bR && 0x00 == bG && 0xFF == bB)
oCur_rPr->m_oColor->m_oVal->Set_B(0x00);
}
if(oCur_rPr->m_oU.IsInit() && oCur_rPr->m_oU->m_oVal.IsInit() && SimpleTypes::underlineSingle == oCur_rPr->m_oU->m_oVal->GetValue())
oCur_rPr->m_oU->m_oVal->SetValue(SimpleTypes::underlineNone);
}
}
}
//Если первый элемент символ надо выставить в его настройки шрифт
if(nIndexStart < (int)pRun->m_arrItems.size() && OOX::et_w_sym == pRun->m_arrItems[nIndexStart]->getType())
{
@ -5537,51 +5471,21 @@ namespace BinDocxRW
case OOX::et_w_fldChar:
{
OOX::Logic::CFldChar* pFldChar = static_cast<OOX::Logic::CFldChar*>(item);
if(pFldChar->m_oFldCharType.IsInit())
{
if(SimpleTypes::fldchartypeBegin == pFldChar->m_oFldCharType.get().GetValue())
{
m_eFldState = SimpleTypes::fldchartypeBegin;
m_sFldChar.clear();
}
else if(SimpleTypes::fldchartypeEnd == pFldChar->m_oFldCharType.get().GetValue())
{
m_eFldState = SimpleTypes::fldchartypeEnd;
if(m_aFldChars.size() > 0)
{
int nIndex = (int)m_aFldChars.size() - 1;
FldStruct* pFldStruct = m_aFldChars[nIndex];
RELEASEOBJECT(pFldStruct);
m_aFldChars.erase(m_aFldChars.begin() + nIndex);
m_oBcw.m_oStream.WriteBYTE(c_oSerRunType::fldend);
m_oBcw.m_oStream.WriteLONG(c_oSerPropLenType::Null);
}
}
else if(SimpleTypes::fldchartypeSeparate == pFldChar->m_oFldCharType.get().GetValue())
{
m_eFldState = SimpleTypes::fldchartypeSeparate;
FldStruct* pFldStruct = ParseField(m_sFldChar);
m_aFldChars.push_back(pFldStruct);
m_oBcw.m_oStream.WriteBYTE(c_oSerRunType::fldstart);
m_oBcw.m_oStream.WriteStringW(m_sFldChar);
}
}
int nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::fldChar);
WriteFldChar(pFldChar);
m_oBcw.WriteItemEnd(nCurPos);
}
break;
case OOX::et_w_delInstrText:
{
OOX::Logic::CDelInstrText* pInstrText = static_cast<OOX::Logic::CDelInstrText*>(item);
WriteText(pInstrText->m_sText, c_oSerRunType::delInstrText);
}
break;
case OOX::et_w_instrText:
{
OOX::Logic::CInstrText* pInstrText = static_cast<OOX::Logic::CInstrText*>(item);
if(SimpleTypes::fldchartypeBegin == m_eFldState)
m_sFldChar += pInstrText->m_sText;
else
{
if(!pInstrText->m_sText.empty())
{
WriteText(pInstrText->m_sText);
}
}
WriteText(pInstrText->m_sText, c_oSerRunType::instrText);
}
break;
case OOX::et_w_nonBreakHyphen:
@ -5613,25 +5517,19 @@ namespace BinDocxRW
OOX::Logic::CSym* oSym = static_cast<OOX::Logic::CSym*>(item);
wchar_t ch = 0x0FFF & oSym->m_oChar->GetValue();
std::wstring sText(&ch, 1);
WriteText(sText);
WriteText(sText, c_oSerRunType::run);
break;
}
case OOX::et_w_delText:
{
std::wstring& sText = static_cast<OOX::Logic::CDelText*>(item)->m_sText;
if(!sText.empty())
{
WriteDelText(sText);
}
WriteText(sText, c_oSerRunType::delText);
}
break;
case OOX::et_w_t:
{
std::wstring& sText = static_cast<OOX::Logic::CText*>(item)->m_sText;
if(!sText.empty())
{
WriteText(sText);
}
WriteText(sText, c_oSerRunType::run);
}
break;
case OOX::et_w_tab:
@ -5721,19 +5619,15 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteDelText(const std::wstring& text)
void WriteText(const std::wstring& text, BYTE type)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerRunType::delText);
m_oBcw.m_oStream.WriteStringW(text.c_str());
if(NULL != m_oBcw.m_pEmbeddedFontsManager)
m_oBcw.m_pEmbeddedFontsManager->CheckString(text);
}
void WriteText(const std::wstring& text)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerRunType::run);
m_oBcw.m_oStream.WriteStringW(text);
if(NULL != m_oBcw.m_pEmbeddedFontsManager)
m_oBcw.m_pEmbeddedFontsManager->CheckString(text);
if(!text.empty())
{
m_oBcw.m_oStream.WriteBYTE(type);
m_oBcw.m_oStream.WriteStringW(text);
if(NULL != m_oBcw.m_pEmbeddedFontsManager)
m_oBcw.m_pEmbeddedFontsManager->CheckString(text);
}
}
void WriteDrawingPptx(OOX::WritingElement* item)
{

View File

@ -658,8 +658,7 @@ namespace BinXlsxRW{
std::wstring wb, sheetFrom, sheetTo;
int nRow1, nCol1, nRow2, nCol2;
if(OOX::Spreadsheet::CCell::parse3DRef(*pStrRef->m_f, wb, sheetFrom, sheetTo, nRow1, nCol1, nRow2, nCol2) &&
sheetFrom.length() > 0 && 0 == wb.length() && 0 == sheetTo.length() &&
NULL != pStrRef->m_strCache)
sheetFrom.length() > 0 && 0 == sheetTo.length() && NULL != pStrRef->m_strCache)
{
bool bRow = nRow1 == nRow2;
if(bUpdateRange)
@ -727,7 +726,7 @@ namespace BinXlsxRW{
std::wstring wb, sheetFrom, sheetTo;
int nRow1, nCol1, nRow2, nCol2;
if(OOX::Spreadsheet::CCell::parse3DRef(*pNumRef->m_f, wb, sheetFrom, sheetTo, nRow1, nCol1, nRow2, nCol2) &&
sheetFrom.length() > 0 && 0 == wb.length() && 0 == sheetTo.length() && NULL != pNumRef->m_numCache)
sheetFrom.length() > 0 && 0 == sheetTo.length() && NULL != pNumRef->m_numCache)
{
bool bRow = nRow1 == nRow2;
if(bUpdateRange)

View File

@ -181,20 +181,22 @@ namespace BinXlsxRW{
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
writeChartXlsx(sXlsxPath, oChartSpace);
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
if (writeChartXlsx(sXlsxPath, oChartSpace))
{
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rId);
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rId);
oChartSpace.m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
oChartSpace.m_oChartSpace.m_externalData->m_id = new std::wstring();
oChartSpace.m_oChartSpace.m_externalData->m_id->append(L"rId");
oChartSpace.m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rId));
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
oChartSpace.m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
oChartSpace.m_oChartSpace.m_externalData->m_id = new std::wstring();
oChartSpace.m_oChartSpace.m_externalData->m_id->append(L"rId");
oChartSpace.m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rId));
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
}
}
std::wstring strFilepath = sFilepath;
@ -233,7 +235,7 @@ namespace BinXlsxRW{
m_bIsNoBase64 = bIsNoBase64;
}
void CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, const OOX::Spreadsheet::CChartSpace& oChart)
bool CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, const OOX::Spreadsheet::CChartSpace& oChart)
{
//анализируем chart
BinXlsxRW::ChartWriter helper;
@ -252,11 +254,15 @@ namespace BinXlsxRW{
helper.toXlsx(oXlsx);
//write
OOX::CContentTypes oContentTypes;
oXlsx.Write(oPath, oContentTypes);
//zip
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(sTempDir, sDstFile, true);
bool res = oXlsx.Write(oPath, oContentTypes);
if (res)
{
//zip
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(sTempDir, sDstFile, true);
}
//clean
NSDirectory::DeleteDirectory(sTempDir);
return res;
}
};

View File

@ -72,7 +72,7 @@ namespace BinXlsxRW {
void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter);
void setIsNoBase64 (bool bIsNoBase64);
void writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
bool writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
};
}
#endif // #ifndef XLSX_SERIALIZER

View File

@ -314,7 +314,7 @@
17E17ED41AC453F800BEA2EA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Ascensio System SIA";
};
buildConfigurationList = 17E17ED71AC453F800BEA2EA /* Build configuration list for PBXProject "ASCOfficeDocxFile2Lib" */;
@ -402,6 +402,7 @@
EXECUTABLE_PREFIX = lib;
GCC_ENABLE_CPP_EXCEPTIONS = YES;
GCC_ENABLE_CPP_RTTI = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
@ -441,14 +442,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@ -470,7 +477,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -486,14 +493,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@ -509,7 +522,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;

View File

@ -34,9 +34,11 @@
#include <stdio.h>
#include <tchar.h>
#include "../../Common/OfficeFileFormatChecker.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../src/ConvertOO2OOX.h"
#include "../include/logging.h"
#if defined(_WIN64)
@ -45,30 +47,55 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
int _tmain(int argc, _TCHAR* argv[])
HRESULT convert_single(std::wstring srcFileName)
{
if (argc < 2) return 1;
HRESULT hr = S_OK;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.docx"; //xlsx pptx docx
COfficeFileFormatChecker fileChecker(srcFileName);
std::wstring dstPath = srcFileName;// + ; //xlsx pptx docx
switch(fileChecker.nFileType)
{
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT: dstPath += L"-my.docx"; break;
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT: dstPath += L"-my.xlsx"; break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT: dstPath += L"-my.pptx"; break;
default:
return S_FALSE;
}
//---------------------------------------------------------------------------------------------------
COfficeUtils oCOfficeUtils(NULL);
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
std::wstring srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring srcTempPath;
// распаковываем исходник во временную директорию
COfficeUtils oCOfficeUtils(NULL);
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), srcTempPath.c_str(), NULL, 0))
return S_FALSE;
if (fileChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT ||
fileChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS ||
fileChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP)
{
srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), srcTempPath.c_str(), NULL, 0))
return S_FALSE;
}
else // flat
{
srcTempPath = srcFileName;
}
_CP_LOG << L"[info] " << srcFileName << std::endl;
hr = ConvertOO2OOX(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", false, NULL);
NSDirectory::DeleteDirectory(srcTempPath);
if (srcTempPath != srcFileName)
{
NSDirectory::DeleteDirectory(srcTempPath);
}
if (hr != S_OK) return hr;
@ -77,6 +104,35 @@ int _tmain(int argc, _TCHAR* argv[])
NSDirectory::DeleteDirectory(dstTempPath);
////////////////////////////////////////////////////////////////////////
return 0;
return hr;
}
HRESULT convert_directory(std::wstring pathName)
{
HRESULT hr = S_OK;
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(pathName, false);
for (size_t i = 0; i < arFiles.size(); i++)
{
convert_single(arFiles[i]);
}
return S_OK;
}
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 2) return 1;
HRESULT hr = -1;
if (NSFile::CFileBinary::Exists(argv[1]))
{
hr = convert_single(argv[1]);
}
else if (NSDirectory::Exists(argv[1]))
{
hr = convert_directory(argv[1]);
}
return hr;
}

View File

@ -336,6 +336,14 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\Common\OfficeFileFormatChecker.h"
>
</File>
<File
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
@ -348,6 +356,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Common\DocxFormat\Source\Base\unicode_util.cpp"
>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>

View File

@ -389,29 +389,37 @@ namespace formulasconvert {
}
std::wstring forbidden_formulas[] =
{
L"NULLFORMULA"
//L"BETADIST",
//L"CEILING",
//L"FLOOR",
//L"RANK",
//L"ROUND",
//L"ROUNDDOWN",
//L"ROUNDUP",
//L"SUBTOTAL",
//L"FORMULA",
//L"ISREF"
};
//std::wstring forbidden_formulas[] =
//{
// L"NULLFORMULA"
// //L"BETADIST",
// //L"CEILING",
// //L"FLOOR",
// //L"RANK",
// //L"ROUND",
// //L"ROUNDDOWN",
// //L"ROUNDUP",
// //L"SUBTOTAL",
// //L"FORMULA",
// //L"ISREF"
//};
bool is_forbidden(const std::wstring & formula)
std::wstring is_forbidden(const std::wstring & formula)
{
for (size_t i = 0; i < 1/*forbidden_formulas.size()*/; i++)
std::wstring result = formula;
std::map<std::wstring, std::wstring> forbidden_formulas;
forbidden_formulas.insert(std::make_pair(L"FORMULA", L"_xlfn.FORMULATEXT"));
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); it++)
{
if (boost::algorithm::contains(formula, forbidden_formulas[i]))
return true;
if (boost::algorithm::contains(formula, it->first))
{
XmlUtils::replace_all(result, it->first, it->second);
}
}
return false;
return result;
}
// заменить вертикальную черту во всех вхождениях в фигурных скобках, но не внутри строк
@ -437,10 +445,7 @@ namespace formulasconvert {
std::wstring odf2oox_converter::Impl::convert(const std::wstring& expr)
{
if (is_forbidden(expr))
return L"NULLFORMULA()";
std::wstring workstr = expr;
std::wstring workstr = is_forbidden(expr);
//boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// Better_Donut.ods- cell(c27)
//std::wstring workstr = boost::regex_replace(
// expr,
@ -449,7 +454,7 @@ namespace formulasconvert {
// boost::match_default | boost::format_all);
bool isFormula = check_formula(workstr);
boost::regex_replace(
workstr,
boost::wregex(L"('.*?')|(\".*?\")"),
@ -472,6 +477,12 @@ namespace formulasconvert {
}
//todooo INDEX((A1:C6~A8:C11),2,2,2) - ???? - INDEX_emb.ods
}
else
{
size_t sz_workstr = workstr.length();
if (workstr.substr(0, (std::min)((size_t)3, sz_workstr)) == L"of:")//sample_02neu_crashes.ods
workstr = workstr.substr(3);
}
//-----------------------------------------------------------
@ -517,10 +528,8 @@ namespace formulasconvert {
std::wstring odf2oox_converter::Impl::convert_chart_distance(const std::wstring& expr)
{
if (is_forbidden(expr))
return L"NULLFORMULA()";
std::wstring workstr = is_forbidden(expr);
std::wstring workstr = expr;
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
workstr = boost::regex_replace(

View File

@ -35,11 +35,15 @@
#include "../CPSharedPtr.h"
#include "../CPScopedPtr.h"
struct ProgressCallback;
namespace cpdoccore {
namespace xml
{
class sax;
}
namespace oox {
class docx_conversion_context;
class xlsx_conversion_context;
@ -54,9 +58,10 @@ class odf_document
{
public:
odf_document(const std::wstring & Folder, const ProgressCallback* CallBack);
~odf_document();
odf_document(xml::sax * Reader);
~odf_document();
public:
odf_read_context & odf_context();
bool docx_convert(oox::docx_conversion_context & Context);
@ -77,6 +82,7 @@ private:
_CP_SCOPED_PTR(Impl) impl_;
};
typedef shared_ptr<odf_document>::Type odf_document_ptr;
}
}

View File

@ -154,7 +154,7 @@ namespace cpdoccore
if (val)
{
std::wstring tmp = *val;
XmlUtils::GetLower(tmp);
tmp = XmlUtils::GetLower(tmp);
return optional<bool>::Type((tmp == xml_char_value_type::trueVal));
}
else

View File

@ -217,6 +217,7 @@ SOURCES += \
../src/odf/datatypes/tableorientation.cpp \
../src/odf/datatypes/tablefunction.cpp \
../src/odf/datatypes/tableorder.cpp \
../src/odf/datatypes/dategroup.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
../src/docx/docx_content_type.cpp \
@ -554,7 +555,6 @@ HEADERS += \
../src/docx/xlsx_xf.h \
../include/logging.h \
../include/cpdoccore/CPColorUtils.h \
../include/cpdoccore/CPHash.h \
../include/cpdoccore/CPNoncopyable.h \
../include/cpdoccore/CPOptional.h \
../include/cpdoccore/CPScopedPtr.h \

View File

@ -126,3 +126,4 @@
#include "../src/odf/datatypes/tableorientation.cpp"
#include "../src/odf/datatypes/tablefunction.cpp"
#include "../src/odf/datatypes/tableorder.cpp"
#include "../src/odf/datatypes/dategroup.cpp"

View File

@ -97,14 +97,6 @@ HRESULT ConvertOO2OOX(const std::wstring & srcPath, const std::wstring & dstPath
if (encrypted) return AVS_ERROR_DRM;
//if (type<1)
//{
// if (ext == L".odt")type = 1;
// if (ext == L".ods")type = 2;
// if (ext == L".odp")type = 3;
//}
if (bOnlyPresentation && type != 3)return AVS_ERROR_UNEXPECTED;
switch (type)

View File

@ -96,7 +96,7 @@ void text_tracked_context::start_change (std::wstring id)
{
current_state_.clear();
current_state_.id = id;
current_state_.id = id;
}
void text_tracked_context::end_change ()
{
@ -378,7 +378,8 @@ void docx_conversion_context::start_document()
output_stream() << L"xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" ";
output_stream() << L"xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" ";
output_stream() << L"xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" ";
output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" ";
output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" ";
output_stream() << L"xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" ";
output_stream() << L"mc:Ignorable=\"w14 wp14\">";
@ -406,14 +407,12 @@ void docx_conversion_context::end_document()
output_document_->get_word_files().set_notes(notes_context_);
////////////////////////
int count = 0;
BOOST_FOREACH(const oox_chart_context_ptr& chart, charts_)
for (size_t i = 0; i < charts_.size(); i++)
{
count++;
package::chart_content_ptr content = package::chart_content::create();
chart->serialize(content->content());
chart->dump_rels(content->get_rel_file()->get_rels());
charts_[i]->serialize(content->content());
charts_[i]->dump_rels(content->get_rel_file()->get_rels());
output_document_->get_word_files().add_charts(content);
@ -580,10 +579,10 @@ mc:Ignorable=\"w14 wp14\">";
strm << L"</w:abstractNum>";
}
BOOST_FOREACH(int numId, numIds)
for (size_t i = 0; i < numIds.size(); i++)
{
strm << L"<w:num w:numId=\"" << numId << L"\" >";
strm << L"<w:abstractNumId w:val=\"" << numId << "\" />";
strm << L"<w:num w:numId=\"" << numIds[i] << L"\" >";
strm << L"<w:abstractNumId w:val=\"" << numIds[i] << "\" />";
strm << L"</w:num>";
}
@ -801,7 +800,7 @@ bool docx_conversion_context::process_page_properties(std::wostream & strm)
if (page_layout_instance_)
{
page_layout_instance_->docx_convert_serialize(strm, *this);
page_layout_instance_->docx_serialize(strm, *this);
}
else
{
@ -1286,7 +1285,8 @@ void docx_conversion_context::start_text_changes (std::wstring id)
L" w:author=\"" + state.author + L"\"" ;
finish_run();
state.active = true;
state.active = true;
state.in_drawing = get_drawing_state_content();
if (state.type == 1)
{
@ -1420,6 +1420,9 @@ void docx_conversion_context::end_changes()
if (state.type == 0) continue; //unknown change ... libra format change skip
if (state.type == 3) continue;
if (!state.active) continue;
if (state.in_drawing != get_drawing_state_content())
continue;
if (state.type == 1) output_stream() << L"</w:ins>";
if (state.type == 2) output_stream() << L"</w:del>";

View File

@ -224,8 +224,9 @@ public:
bool & get_use_image_replace()
{
bool res = false;
if (frames_.size()>0) return frames_.back().use_image_replace;
else return res;
if (!frames_.empty()) return frames_.back().use_image_replace;
else
throw;
}
std::wstring & get_text_stream_shape()
@ -492,10 +493,11 @@ public:
std::wstring id;
std::wstring author;
std::wstring date;
int type;
int type = 0;
std::wstring style_name;
std::vector<std::wstring> content; //delete elements
bool active;
bool active = false;
bool in_drawing = false;
void clear()
{
@ -505,6 +507,7 @@ public:
date.clear();
content.clear();
active = false;
in_drawing = false;
}
};
std::wstring dumpPPr_;

View File

@ -392,8 +392,11 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
{
CP_XML_NODE(L"wp:extent")
{
CP_XML_ATTR(L"cx", val.cx);
CP_XML_ATTR(L"cy", val.cy);
if (val.cx > 0 || val.cy > 0)
{
CP_XML_ATTR(L"cx", val.cx);
CP_XML_ATTR(L"cy", val.cy);
}
serialize_null_extent(CP_XML_STREAM());
}
@ -463,10 +466,13 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
}
}
}
CP_XML_NODE(L"wp:extent")
if (val.cx > 0 || val.cy > 0)
{
CP_XML_ATTR(L"cx", val.cx);
CP_XML_ATTR(L"cy", val.cy);
CP_XML_NODE(L"wp:extent")
{
CP_XML_ATTR(L"cx", val.cx);
CP_XML_ATTR(L"cy", val.cy);
}
}
serialize_wrap(CP_XML_STREAM(), val);

View File

@ -319,6 +319,7 @@ namespace
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" >";
//mc:Ignorable=\"w14 wp14\"

View File

@ -181,7 +181,11 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
sub_path = L"embeddings/";
}
else
{
isMediaInternal = is_internal(href, odf_packet_);
if (href.empty() && type == typeImage)
return L"";
}
int number=0;
@ -205,9 +209,9 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
if ( type == typeChart) outputPath = outputPath + L".xml";
std::wstring id;
for (int i = 0 ; i < items_.size(); i++)
for (size_t i = 0 ; i < items_.size(); i++)
{
if (items_[i].href == inputPath)
if ((items_[i].href == inputPath && !inputPath.empty()) || (items_[i].type == type && inputPath.empty()))
{
id = items_[i].Id;
outputPath = items_[i].outputName;

View File

@ -127,6 +127,7 @@ public:
if (sExt == L"m4v") return typeVideo;
if (sExt == L"mp4") return typeVideo;
if (sExt == L"mov") return typeVideo;
if (sExt == L"mkv") return typeVideo;
return typeMedia;
}

View File

@ -118,6 +118,23 @@ void oox_chart_context::serialize(std::wostream & strm)
{
CP_XML_ATTR(L"val",L"en-US");
}
if (pivot_source_.empty() == false)
{
set_cache_only(true);
CP_XML_NODE(L"c:pivotSource")
{
CP_XML_NODE(L"c:name")
{
CP_XML_STREAM() << pivot_source_;
}
CP_XML_NODE(L"c:fmtId")
{
CP_XML_ATTR(L"val", 0);
}
}
}
CP_XML_NODE(L"c:chart")
{
if (plot_area_.current_chart_->is3D_)
@ -148,10 +165,42 @@ void oox_chart_context::serialize(std::wostream & strm)
shape.set(graphic_properties_, fill_);
shape.oox_serialize(CP_XML_STREAM());
if (pivot_source_.empty() == false)
{
CP_XML_NODE(L"c:extLst")
{
CP_XML_NODE(L"c:ext")
{
CP_XML_ATTR(L"uri", L"{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}");
CP_XML_ATTR(L"xmlns:c14", L"http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
CP_XML_NODE(L"c14:pivotOptions")
{
CP_XML_NODE(L"c14:dropZoneFilter")
{
CP_XML_ATTR(L"val", 1);
}
CP_XML_NODE(L"c14:dropZoneCategories")
{
CP_XML_ATTR(L"val", 1);
}
CP_XML_NODE(L"c14:dropZoneData")
{
CP_XML_ATTR(L"val", 1);
}
CP_XML_NODE(L"c14:dropZoneSeries")
{
CP_XML_ATTR(L"val", 1);
}
CP_XML_NODE(L"c14:dropZonesVisible")
{
CP_XML_ATTR(L"val", 1);
}
}
}
}
}
}
}
}
oox_chart_context::~oox_chart_context()
@ -160,7 +209,7 @@ oox_chart_context::~oox_chart_context()
void oox_chart_context::set_cache_only (bool val)
{
for (int i = 0 ; i < plot_area_.charts_.size(); i++)
for (size_t i = 0 ; i < plot_area_.charts_.size(); i++)
{
plot_area_.charts_[i]->set_cache_only(val);
}

View File

@ -63,6 +63,10 @@ public:
void serialize(std::wostream & strm);
void dump_rels(rels & Rels);
void set_pivot_chart(const std::wstring &source)
{
pivot_source_ = source;
}
void set_title(odf_reader::chart::title & t)
{
title_.set_content(t);
@ -130,6 +134,8 @@ private:
cpdoccore::oox::oox_plot_area plot_area_;
cpdoccore::oox::oox_chart_legend legend_;
std::wstring pivot_source_;
std::vector<odf_reader::_property> graphic_properties_;
_oox_fill fill_;
};

View File

@ -32,7 +32,7 @@
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "oox_chart_legend.h"

View File

@ -37,6 +37,8 @@
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"
#include "xlsx_utils.h"
#include "oox_chart_series.h"
#include "../formulasconvert/formulasconvert.h"
@ -55,6 +57,7 @@ oox_chart_series::oox_chart_series()
iSymbolMarkerType_ = 0;
bLocalTable_ = false;
labelPosEnabled_ = true;
}
void oox_chart_series::setName(std::wstring &value)
{
@ -67,8 +70,7 @@ void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & f
if (ind == 0)
{
long res = value.find(L"local-table");
if (res >=0) return;
if (std::wstring::npos != value.find(L"local-table")) return;
values_[ind].strRef_.formula = converter.convert_chart_distance(value);
values_[ind].strRef_.present = true;
@ -76,8 +78,8 @@ void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & f
}
else
{
long res = value.find(L"local-table");
if (res >=0 && !bLocalTable_ ) return; //в xlsx низя .... нужно сделать тогда отдельную table.xml
if (std::wstring::npos != value.find(L"local-table") && !bLocalTable_ ) return;
//в xlsx низя .... нужно сделать тогда отдельную table.xml
values_[ind].numRef_.formula = converter.convert_chart_distance(value);
values_[ind].numRef_.present = true;
@ -133,7 +135,7 @@ void oox_chart_series::parse_properties()
if (*intVal == 2) data_labels_->set_showPercent(true);
}
odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
if (intVal)
if (intVal && labelPosEnabled_)
{
if (!data_labels_) data_labels_ = oox_data_labels();
@ -218,12 +220,24 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
shape.set(content_.graphic_properties_, content_.fill_);
shape.oox_serialize(_Wostream);
for (int i=0; i < 5; i++)
for (int i = 0; i < 5; i++)
{
if (values_[i].present)
{
if (bLocalTable_)
{
if (values_[i].numRef_.present && values_[i].numRef_.num_cache_count == 0)
{
continue;
}
if (values_[i].strRef_.present && values_[i].strRef_.str_cache_count == 0 )
{
continue;
}
}
CP_XML_NODE(values_[i].type)
{
if (values_[i].numRef_.present && !bLocalTable_)
{
CP_XML_NODE(L"c:numRef")
@ -258,8 +272,11 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
CP_XML_ATTR(L"idx", j);
double val = 0;
try { val = boost::lexical_cast<double>(v);}
catch(...){}
if (oox::IsNumber(v))
{
try { val = boost::lexical_cast<double>(v);}
catch(...){}
}
CP_XML_NODE(L"c:v")
{
CP_XML_CONTENT(val);
@ -293,8 +310,11 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
CP_XML_ATTR(L"idx", j);
double val = 0;
try { val = boost::lexical_cast<double>(v);}
catch(...){}
if (oox::IsNumber(v))
{
try { val = boost::lexical_cast<double>(v);}
catch(...){}
}
CP_XML_NODE(L"c:v")
{
CP_XML_CONTENT(val);

View File

@ -55,6 +55,7 @@ public:
virtual void oox_serialize(std::wostream & _Wostream) = 0;
bool labelPosEnabled_;
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
int id_;
std::wstring name_; //tx (Series Text) §21.2.2.215

View File

@ -30,7 +30,7 @@
*
*/
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "oox_chart_shape.h"

View File

@ -144,7 +144,7 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
namespace oox
{
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) :
base_font_size_(12), fonts_container_(fonts)
base_font_size_(12), fonts_container_(fonts), is_need_e_(false)
{
graphRPR_ = graphic;

View File

@ -106,6 +106,8 @@ namespace oox {
std::wstring nsRPr_;
bool graphRPR_;
bool is_need_e_;
private:
std::wstringstream math_stream_;
std::wstringstream math_style_stream_;

View File

@ -31,7 +31,7 @@
*/
#include <cpdoccore/CPHash.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "oox_data_labels.h"
@ -117,15 +117,15 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
case 1: CP_XML_ATTR(L"val", L"b"); break;
case 2: CP_XML_ATTR(L"val", L"b"); break;
case 3: CP_XML_ATTR(L"val", L"b"); break;
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
case 5: CP_XML_ATTR(L"val", L"inEnd"); break;
case 6: CP_XML_ATTR(L"val", L"l"); break;
case 7: CP_XML_ATTR(L"val", L"inBase"); break;
case 8: CP_XML_ATTR(L"val", L"outEnd"); break;
case 9: CP_XML_ATTR(L"val", L"r"); break;
case 10: CP_XML_ATTR(L"val", L"t"); break;
case 11: CP_XML_ATTR(L"val", L"t"); break;
case 12: CP_XML_ATTR(L"val", L"t"); break;
case 5: //CP_XML_ATTR(L"val", L"inEnd"); break;
case 8: //CP_XML_ATTR(L"val", L"outEnd"); break;
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
}
}

View File

@ -171,7 +171,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
if ( color.empty() )
{
if (always_draw) color = L"000000";
else color = L"ffffff";
else color = L"FFFFFF";
}
CP_XML_NODE(L"a:srgbClr")
@ -210,16 +210,15 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
}
}
}
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:avLst")
{
_CP_OPT(bool) bModifiers;
_CP_OPT(std::wstring) strModifiers;
odf_reader::GetProperty(prop, L"bModifiers", bModifiers);
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
if (strModifiers)
{
std::vector< std::wstring > values;
@ -227,17 +226,61 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
if (!values.empty() && values.back().empty()) values.pop_back();
std::vector<std::wstring> names;
if (std::wstring::npos != shapeGeomPreset.find(L"math") ||
std::wstring::npos != shapeGeomPreset.find(L"bentConnector") ||
std::wstring::npos != shapeGeomPreset.find(L"curvedConnector")||
std::wstring::npos != shapeGeomPreset.find(L"frame"))
{
names.push_back(L"adj1");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
{
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
{
names.push_back(L"hf");
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"hexagon"))
{
names.push_back(L"adj");
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"star5")||
std::wstring::npos != shapeGeomPreset.find(L"star7"))
{
names.push_back(L"adj");
names.push_back(L"hf");
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"star6") ||
std::wstring::npos != shapeGeomPreset.find(L"star10"))
{
names.push_back(L"adj");
names.push_back(L"hf");
}
for (size_t i = 0; i < values.size(); i++)
{
if (values[i].empty()) continue;
CP_XML_NODE(L"a:gd")
{
if (values.size() > 1 || bModifiers)
//весьма странное .. для некоторых модификаторов (напр math...) нужно указывать множественность их
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i+1));
if (names.size() > i)
{
CP_XML_ATTR(L"name", names[i]);
}
else
CP_XML_ATTR(L"name", L"adj");
{
if (values.size() > 1)
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i + 1));
else
CP_XML_ATTR(L"name", L"adj");
}
CP_XML_ATTR(L"fmla", L"val " + values[i]);
}
}
@ -263,8 +306,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
odf_reader::GetProperty(prop,L"text-padding-bottom" , dPaddingBottom);
if (dPaddingLeft) CP_XML_ATTR(L"lIns", (int)(*dPaddingLeft));
if (dPaddingRight) CP_XML_ATTR(L"rIns", (int)(*dPaddingRight));
if (dPaddingTop) CP_XML_ATTR(L"tIns", (int)(*dPaddingTop));
if (dPaddingRight) CP_XML_ATTR(L"rIns", (int)(*dPaddingRight));
if (dPaddingBottom) CP_XML_ATTR(L"bIns", (int)(*dPaddingBottom));
if (inGroup == false)
@ -321,7 +364,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
CP_XML_NODE(L"a:prstTxWarp")
{
CP_XML_ATTR(L"prst", shapeType);
oox_serialize_aLst(CP_XML_STREAM(), prop);
oox_serialize_aLst(CP_XML_STREAM(), prop, shapeType);
}
}
}
@ -370,7 +414,8 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
{
CP_XML_NODE(L"a:custGeom")
{
oox_serialize_aLst(CP_XML_STREAM(), additional);
std::vector<std::wstring> names;
oox_serialize_aLst(CP_XML_STREAM(), additional, L"");
CP_XML_NODE(L"a:ahLst");
CP_XML_NODE(L"a:gdLst");
@ -391,8 +436,14 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
{
CP_XML_NODE(L"a:path")
{
CP_XML_ATTR(L"w", w ? *w : cx);
CP_XML_ATTR(L"h", h ? *h : cy);
int path_w = w ? *w : cx;
int path_h = h ? *h : cy;
if (path_w < 1) path_w = 1024;
if (path_h < 1) path_h = 1024;
CP_XML_ATTR(L"w", path_w);
CP_XML_ATTR(L"h", path_h);
if (sCustomPath)
{
@ -414,11 +465,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
CP_XML_ATTR(L"prst", shapeGeomPreset);
if (!bWordArt)
{
if (std::wstring::npos != shapeGeomPreset.find(L"mathPlus"))
{
additional.push_back(odf_reader::_property(L"bModifiers", true));
}
oox_serialize_aLst(CP_XML_STREAM(), additional);
oox_serialize_aLst(CP_XML_STREAM(), additional, shapeGeomPreset);
}
}
}
@ -508,10 +555,13 @@ void _oox_drawing::serialize_xfrm(std::wostream & strm, const std::wstring & nam
CP_XML_ATTR(L"x", 0);
CP_XML_ATTR(L"y", 0);
}
CP_XML_NODE(L"a:chExt")
if (cx > 0 || cy > 0)
{
CP_XML_ATTR(L"cx", cx);
CP_XML_ATTR(L"cy", cy);
CP_XML_NODE(L"a:chExt")
{
CP_XML_ATTR(L"cx", cx);
CP_XML_ATTR(L"cy", cy);
}
}
}
}
@ -525,9 +575,6 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
{
CP_XML_NODE(L"a:hlinkClick")
{
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
if (!val.action.empty())
CP_XML_ATTR(L"action", val.action);
@ -544,6 +591,8 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
CP_XML_ATTR(L"name", L"sound");
}
}
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
}
}
}

View File

@ -83,7 +83,7 @@ namespace oox {
class _oox_drawing
{
public:
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), name(L"object")
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), name(L"object"), extExternal(false)
{
}
RelsType type;
@ -103,6 +103,7 @@ namespace oox {
std::wstring objectProgId;
std::wstring extId;
bool extExternal;
_action_desc action;
std::vector<_hlink_desc> hlinks;
@ -118,7 +119,7 @@ namespace oox {
typedef _CP_PTR(_oox_drawing) oox_drawing_ptr;
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset);
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
}

View File

@ -37,7 +37,7 @@
namespace cpdoccore {
namespace oox {
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false),bTile(false),isInternal(true)
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false), bTile(false), isInternal(true)
{
memset(cropRect,0,sizeof(double)*4);
}
@ -186,10 +186,10 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE(L"a:srcRect")
{
CP_XML_ATTR(L"l", static_cast<size_t>(val.bitmap->cropRect[0]*1000));
CP_XML_ATTR(L"t", static_cast<size_t>(val.bitmap->cropRect[1]*1000));
CP_XML_ATTR(L"r", static_cast<size_t>(val.bitmap->cropRect[2]*1000));
CP_XML_ATTR(L"b", static_cast<size_t>(val.bitmap->cropRect[3]*1000));
CP_XML_ATTR(L"l", static_cast<int>(val.bitmap->cropRect[0]*1000));
CP_XML_ATTR(L"t", static_cast<int>(val.bitmap->cropRect[1]*1000));
CP_XML_ATTR(L"r", static_cast<int>(val.bitmap->cropRect[2]*1000));
CP_XML_ATTR(L"b", static_cast<int>(val.bitmap->cropRect[3]*1000));
}
}
if (val.bitmap->bTile)

View File

@ -147,6 +147,6 @@ namespace oox {
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val);
}
}

View File

@ -32,7 +32,7 @@
#include "oox_layout.h"
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"

View File

@ -70,17 +70,19 @@ static std::wstring get_mime_type(const std::wstring & extension)
else if (L"tif" == extension) return L"image/x-tiff";
else if (L"tiff" == extension) return L"image/x-tiff";
else if (L"pdf" == extension) return L"application/pdf";
else if (L"bmp" == extension) return L"image/bmp";
else if (L"wav" == extension) return L"audio/wav";
else if (L"mp3" == extension) return L"audio/mpeg";
else if (L"wma" == extension) return L"audio/x-ms-wma";
else if (L"m4a" == extension) return L"audio/unknown";
else if (L"avi" == extension) return L"video/avi";
else if (L"avi" == extension) return L"video/x-msvideo";
else if (L"wmv" == extension) return L"video/x-ms-wmv";
else if (L"mov" == extension) return L"video/unknown";
else if (L"mp4" == extension) return L"video/unknown";
else if (L"m4v" == extension) return L"video/unknown";
else if (L"mkv" == extension) return L"video/unknown";
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

View File

@ -33,7 +33,7 @@
#include "oox_plot_area.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"

View File

@ -32,7 +32,7 @@
#include "oox_title.h"
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"

View File

@ -102,6 +102,10 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream)
}
for (size_t i = 0; i < series_.size(); i++)
{
if (is3D_ || type_ == CHART_TYPE_AREA || type_ == CHART_TYPE_DOUGHNUT || type_ == CHART_TYPE_RADAR)
{
series_[i]->labelPosEnabled_ = false;
}
series_[i]->oox_serialize(_Wostream);
}
for (size_t i = 0; i < axisId_.size(); i++)
@ -469,7 +473,7 @@ void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
//{
// //shape.oox_serialize(CP_XML_STREAM());
//}
CP_XML_NODE(L"upDownBars")
CP_XML_NODE(L"c:upDownBars")
{
CP_XML_NODE(L"c:gapWidth")
{

View File

@ -150,15 +150,30 @@ void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
CP_XML_NODE(L"p14:media")
{
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
CP_XML_ATTR(L"r:embed", val.extId);
if (val.extExternal)
{
CP_XML_ATTR(L"r:link", val.extId);
}
else
{
CP_XML_ATTR(L"r:embed", val.extId);
}
}
}
}
}
}
if (val.fill.bitmap)
{
val.fill.bitmap->name_space = L"p";
oox_serialize_fill(CP_XML_STREAM(), val.fill);
oox_serialize_bitmap_fill(strm, val.fill);
val.fill.bitmap.reset();
}
else
{
CP_XML_NODE(L"p:blipFill");
}
CP_XML_NODE(L"p:spPr")
{
@ -169,7 +184,8 @@ void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
CP_XML_ATTR(L"prst", L"rect");
CP_XML_NODE(L"a:avLst");
}
oox_serialize_ln(CP_XML_STREAM(), val.additional);
oox_serialize_fill (CP_XML_STREAM(), val.fill);
oox_serialize_ln (CP_XML_STREAM(), val.additional);
}
//_CP_OPT(std::wstring) strTextContent;
//odf::GetProperty(properties,L"text-content",strTextContent);

View File

@ -472,6 +472,13 @@ void pptx_slide_context::set_media_param(std::wstring name, std::wstring value)
void pptx_slide_context::set_image(const std::wstring & path)
{
int pos_replaicement = path.find(L"ObjectReplacements");
if (pos_replaicement >= 0)
{
if (path.length() - (pos_replaicement + 18) < 2)
return; //object without image
}
if (impl_->object_description_.type_ == typeUnknown)
{
impl_->object_description_.type_ = typeImage;
@ -547,8 +554,9 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
std::wstring ref;/// это ссылка на выходной внешний объект
bool isMediaInternal = false;
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->isInternal = isMediaInternal;
if (drawing.type == typeShape)
{
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
@ -640,11 +648,12 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
drawing.extId = L"ext" + drawing.objectId;
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
drawing.extId = L"ext" + drawing.objectId;
drawing.extExternal = !isMediaInternal;
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
add_additional_rels( true, drawing.extId, ref, typeMedia);
add_additional_rels( isMediaInternal, drawing.extId, ref, typeMedia);
if (drawing.fill.bitmap)
{
@ -744,10 +753,10 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
{
CP_XML_ATTR(L"spd",impl_->transition_.Speed.get());
}
if (impl_->transition_.Time)
/* if (impl_->transition_.Time)
{
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
}
}*/
if (impl_->transition_.PageTime)
{
CP_XML_ATTR(L"advTm", impl_->transition_.PageTime.get());

View File

@ -332,21 +332,34 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
}
if (style_cell_attlist.common_padding_attlist_.fo_padding_)
{
CP_XML_ATTR(L"marT", *style_cell_attlist.common_padding_attlist_.fo_padding_);
CP_XML_ATTR(L"marB", *style_cell_attlist.common_padding_attlist_.fo_padding_);
CP_XML_ATTR(L"marL", *style_cell_attlist.common_padding_attlist_.fo_padding_);
CP_XML_ATTR(L"marR", *style_cell_attlist.common_padding_attlist_.fo_padding_);
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_->get_value_unit(odf_types::length::emu);
CP_XML_ATTR(L"marT", (long)padding);
CP_XML_ATTR(L"marB", (long)padding);
CP_XML_ATTR(L"marL", (long)padding);
CP_XML_ATTR(L"marR", (long)padding);
}
else
{
if (style_cell_attlist.common_padding_attlist_.fo_padding_top_)
CP_XML_ATTR(L"marT", *style_cell_attlist.common_padding_attlist_.fo_padding_top_);
{
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_top_->get_value_unit(odf_types::length::emu);
CP_XML_ATTR(L"marT", (long)padding);
}
if (style_cell_attlist.common_padding_attlist_.fo_padding_bottom_)
CP_XML_ATTR(L"marB", *style_cell_attlist.common_padding_attlist_.fo_padding_bottom_);
{
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_bottom_->get_value_unit(odf_types::length::emu);
CP_XML_ATTR(L"marB", (long)padding);
}
if (style_cell_attlist.common_padding_attlist_.fo_padding_left_)
CP_XML_ATTR(L"marL", *style_cell_attlist.common_padding_attlist_.fo_padding_left_);
{
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_left_->get_value_unit(odf_types::length::emu);
CP_XML_ATTR(L"marL", (long)padding);
}
if (style_cell_attlist.common_padding_attlist_.fo_padding_right_)
CP_XML_ATTR(L"marR", *style_cell_attlist.common_padding_attlist_.fo_padding_right_);
{
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_right_->get_value_unit(odf_types::length::emu);
CP_XML_ATTR(L"marR", (long)padding);
}
}
//vert //
//style_cell_attlist.pptx_serialize(Context, CP_XML_STREAM()); //nodes

View File

@ -32,7 +32,7 @@
#include "xlsx_border.h"
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"

View File

@ -55,8 +55,8 @@ public:
void add_format(std::wstring const & condition, std::wstring const & format)
{
std::wstring c = condition;
XmlUtils::GetLower(c);
std::wstring c = XmlUtils::GetLower(condition);
XmlUtils::replace_all( c, L" ", L"");
XmlUtils::replace_all( c, L"\t", L"");

View File

@ -281,6 +281,11 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert_named_expr(val);
}
else if (0 <= (pos = f.find(L"is-error")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsErrors";
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
}
else if (0 <= (pos = f.find(L"duplicate")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";

View File

@ -299,6 +299,13 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w
}
void xlsx_drawing_context::set_image(const std::wstring & path)
{
int pos_replaicement = path.find(L"ObjectReplacements");
if (pos_replaicement >= 0)
{
if (path.length() - (pos_replaicement + 18) < 2)
return; //object without image
}
if (impl_->object_description_.type_ == typeUnknown)
{
impl_->object_description_.type_ = typeImage;
@ -569,11 +576,31 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
}
void xlsx_drawing_context::process_object(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
{
std::wstring ref;
bool isMediaInternal = true;
if (drawing.type_anchor == 2) // absolute
{
//пересчет нужен для оле
xlsx_table_position from, to;
process_position_properties (obj, table_metrics, from, to);
drawing.from_.type = xlsx_drawing_position::from;
drawing.from_.position.col = from.col;
drawing.from_.position.colOff = static_cast<size_t>(odf_types::length(from.colOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.from_.position.row = from.row;
drawing.from_.position.rowOff = static_cast<size_t>(odf_types::length(from.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.to_.type = xlsx_drawing_position::to;
drawing.to_.position.col = to.col;
drawing.to_.position.colOff = static_cast<size_t>(odf_types::length(to.colOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.to_.position.row = to.row;
drawing.to_.position.rowOff = static_cast<size_t>(odf_types::length(to.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
}
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectProgId = obj.descriptor_;
@ -595,7 +622,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
{
xlsx_drawings_ptr xlsx_drawings_child(xlsx_drawings::create(true));
process_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
process_group_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
std::wstringstream strm;
@ -613,9 +640,9 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
}
void xlsx_drawing_context::process_objects(xlsx_table_metrics & table_metrics)
{
process_objects(impl_->objects_, table_metrics, impl_->get_drawings());
process_group_objects(impl_->objects_, table_metrics, impl_->get_drawings());
}
void xlsx_drawing_context::process_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
{
for (size_t i = 0 ; i < objects.size(); i++)
{
@ -654,7 +681,7 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio
case typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
case typeMsObject:
case typeOleObject:
process_object ( obj, drawing, xlsx_drawings_); break;
process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
}
}
}

View File

@ -133,13 +133,13 @@ private:
class Impl;
_CP_PTR(Impl) impl_;
void process_objects (std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_);
void process_group (drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_group_objects (std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_);
void process_image (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_chart (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_shape (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_object (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_object (drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_common_properties (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_table_metrics & table_metrics);

View File

@ -65,7 +65,7 @@ public:
if (sheet_rel)
{
for (int i = 0 ; i < xlsx_sheet_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_sheet_rels_.size(); i++)
{
if (xlsx_sheet_rels_[i].rid == rid && xlsx_sheet_rels_[i].ref == ref)
present = true;
@ -75,7 +75,7 @@ public:
}
else
{
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
present = true;
@ -89,7 +89,7 @@ public:
{
if (inGroup)
{
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
{
xlsx_drawings_[i].serialize(strm);
}
@ -114,7 +114,7 @@ public:
}
void serialize_objects(std::wostream & strm)
{
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
{
if (xlsx_drawings_[i].type != typeOleObject && xlsx_drawings_[i].type != typeMsObject) continue;
@ -129,7 +129,7 @@ public:
void dump_rels_drawing(rels & Rels)
{
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (xlsx_drawing_rels_[i].type == typeImage ||
xlsx_drawing_rels_[i].type == typeMedia ||
@ -146,7 +146,7 @@ public:
}
void dump_rels_sheet(rels & Rels)
{
for (int i = 0 ; i < xlsx_sheet_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_sheet_rels_.size(); i++)
{
Rels.add(relationship( xlsx_sheet_rels_[i].rid,
mediaitems::get_rel_type(xlsx_sheet_rels_[i].type),

File diff suppressed because it is too large Load Diff

View File

@ -49,21 +49,53 @@ public:
void start_table();
int end_table();
void start_field();
void set_field_name(std::wstring name);
void set_field_type(int type);
void set_field_function(int type);
void set_field_user_function(std::wstring f);
void add_field_subtotal(int function_type);
void add_field_cache(int index, std::wstring value);
void start_field ();
void set_field_name (std::wstring name);
void set_field_display (std::wstring name);
void set_field_type (int type, int hierarchy);
void set_field_function (int type);
void set_field_user_function (std::wstring f);
void add_field_subtotal (int function_type);
void add_field_cache (int index, std::wstring value, bool show_details = true);
void set_field_show_empty (bool val);
void set_field_data_layout (bool val);
void set_field_sort (int type);
void set_repeat_item_labels(bool val);
void set_field_groups (int type);
void set_field_groups_source(std::wstring name);
void start_field_group();
void set_field_group_name (std::wstring name);
void end_field_group();
void start_field_reference();
void set_field_ref_name(std::wstring name);
void set_field_ref_type (int type);
void set_field_ref_member_name(std::wstring name);
void set_field_ref_member_type(int type);
void end_field_reference();
void end_field();
int get_count();
void set_view_name(std::wstring name);
void set_view_target_range(std::wstring ref);
void set_view_target_table_name(std::wstring name);
void add_button_header(std::wstring ref);
void set_identify_categories(bool val);
void set_ignore_empty_rows(bool val);
void set_drill(bool val);
void set_grand_total(int type);
void set_source_range(std::wstring table_name, std::wstring ref);
void set_source_database(std::wstring database, std::wstring table_name);
void set_source_database_query(std::wstring database, std::wstring query);
void set_source_database_sql(std::wstring database, std::wstring sql);
void write_cache_definitions_to (int index, std::wostream & strm);
void write_cache_records_to (int index, std::wostream & strm);
@ -74,13 +106,14 @@ public:
void dump_rels_cache(int index, rels & Rels);
void dump_rels_view (int index, rels & Rels);
std::wstring get_chart_source(std::wstring name);
void add_connections(std::wstring connections);
bool is_connections();
private:
class Impl;
_CP_PTR(Impl) impl_;
};
}

View File

@ -358,7 +358,18 @@ void xlsx_table_state::serialize_page_properties (std::wostream & strm)
page_layout->xlsx_serialize(strm, *context_);
}
void xlsx_table_state::serialize_background (std::wostream & strm)
{
if (tableBackground_.empty()) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"picture")
{
CP_XML_ATTR(L"r:id", tableBackground_);
}
}
}
void xlsx_table_state::serialize_table_format (std::wostream & strm)
{
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
@ -394,6 +405,7 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
{
CP_XML_NODE(L"dimension")
{
if (current_table_column_ < 0) current_table_column_ = columns_count_;
std::wstring ref2 = getCellAddress( current_table_column_, current_table_row_);
CP_XML_ATTR(L"ref", L"A1:" + ref2);
}
@ -433,10 +445,10 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
{
CP_XML_NODE(L"selection")
{
CP_XML_ATTR(L"sqref", getCellAddress(col, row));
CP_XML_ATTR(L"activeCellId", 0);
CP_XML_ATTR(L"activeCell", getCellAddress(col, row));
CP_XML_ATTR(L"activeCellId", 0);
CP_XML_ATTR(L"pane", L"topLeft");
CP_XML_ATTR(L"sqref", getCellAddress(col, row));
}
}

View File

@ -120,10 +120,12 @@ public:
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() {return xlsx_conditionalFormatting_context_;}
void table_column_last_width(double w) { table_column_last_width_ = w; }
double table_column_last_width() const { return table_column_last_width_; };
double table_column_last_width() const { return table_column_last_width_; };
void start_hyperlink ();
std::wstring end_hyperlink (std::wstring const & ref, std::wstring const & href, std::wstring const & display);
std::wstring end_hyperlink (std::wstring const & ref, std::wstring const & href, std::wstring const & display);
void set_background (std::wstring rId) { tableBackground_ = rId; }
void serialize_conditionalFormatting (std::wostream & _Wostream);
void serialize_table_format (std::wostream & _Wostream);
@ -131,6 +133,7 @@ public:
void serialize_hyperlinks (std::wostream & _Wostream);
void serialize_ole_objects (std::wostream & _Wostream);
void serialize_page_properties (std::wostream & _Wostream);
void serialize_background (std::wostream & _Wostream);
void dump_rels_hyperlinks (rels & Rels);
void dump_rels_ole_objects (rels & Rels);
@ -154,6 +157,7 @@ private:
std::wstring tableName_;
int tableId_;
std::wstring tableBackground_;
std::wstring table_style_;
std::wstring table_row_style_;

View File

@ -320,6 +320,10 @@ void xlsx_table_context::serialize_page_properties(std::wostream & _Wostream)
{
return state()->serialize_page_properties(_Wostream);
}
void xlsx_table_context::serialize_background(std::wostream & _Wostream)
{
return state()->serialize_background(_Wostream);
}
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{
return state()->serialize_hyperlinks(_Wostream);

View File

@ -90,6 +90,7 @@ public:
void serialize_hyperlinks (std::wostream & _Wostream);
void serialize_ole_objects (std::wostream & _Wostream);
void serialize_page_properties (std::wostream & _Wostream);
void serialize_background (std::wostream & _Wostream);
xlsx_table_metrics & get_table_metrics();

Some files were not shown because too many files have changed in this diff Show More