Compare commits

..

67 Commits

Author SHA1 Message Date
5ac71aff74 x2t - fix build 2018-06-22 11:45:57 +03:00
5ae7acb65c OdfFormatWriter - table of contetnt .. 2018-06-21 19:57:33 +03:00
33f07d69ad OdfFormat... 2018-06-21 17:20:56 +03:00
187bf8823a x2t - version up 2018-06-21 11:28:58 +03:00
cd7c85967c Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-06-21 11:19:45 +03:00
045b00ad5a x2t - version up 2018-06-21 11:17:42 +03:00
9b5784e344 . 2018-06-20 19:37:32 +03:00
2b6650dde1 Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-06-20 18:56:53 +03:00
ff8ecb2d2f RtfFormat - fix users files 2018-06-20 18:54:06 +03:00
5893b93e3a XlsFormatFile - fix users files 2018-06-19 13:48:57 +03:00
92313e106d OdfReader - .. bibliography sources 2018-06-18 19:30:06 +03:00
c462f522d6 x2t - fix bugs #37945, #37946 2018-06-18 15:57:38 +03:00
5feb4b7b82 [x2t] Revert toXML2 2018-06-18 15:37:18 +03:00
678ec98721 . 2018-06-18 13:34:40 +03:00
c17fa8462d x2t - add document ID for crypt ooxml 2018-06-18 13:24:59 +03:00
04eda04870 Add StopNoJoin method to BaseThread 2018-06-15 11:46:21 +03:00
cd9cc22185 OdfReader - convert bibliography 2018-06-09 19:03:22 +03:00
f01eb91316 * [x2t] Add to/from binary conversion for LvlLegacy 2018-06-09 16:58:29 +03:00
b9216e9bdc OdfFormatReader - convert tables of indexes 2018-06-08 19:20:18 +03:00
0295ef2d54 RtfFormatReader - fix bug #37902 2018-06-07 18:01:45 +03:00
797b745b35 [s2t] Fix open file with unknown picture format
As result, different file names were obtained in binary and file system
2018-06-07 14:42:45 +03:00
253c24cf03 [x2t] Fix bug #36574 2018-06-07 14:31:14 +03:00
02e8649a61 . 2018-06-06 19:32:16 +03:00
447dc81426 [ios][x2t] enable txt format 2018-06-06 16:02:57 +03:00
0f3c883d24 . 2018-06-06 15:24:54 +03:00
0b16b9a7f9 . 2018-06-05 19:35:00 +03:00
37c276b736 [x2t] Fix bug #37892 2018-06-04 18:46:13 +03:00
7014faa9a1 . 2018-06-04 15:27:48 +03:00
93287c84c8 OdfFormatReader - meta data file, new convert tabs stop 2018-06-04 15:24:49 +03:00
dafcbacfaf [ios][x2t] add version property 2018-06-04 13:48:09 +03:00
41ea42459a . 2018-06-01 19:23:56 +03:00
bc68323506 . 2018-06-01 19:20:35 +03:00
1c73ff0c3f Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-06-01 18:18:31 +03:00
5a8c9069be OdfFormatReader - fix users file 2018-06-01 18:17:56 +03:00
4ba2e1fa6d x2t - split version info in separate file 2018-06-01 16:11:13 +03:00
95af281145 x2t - write embedded ms package with zero offsets 2018-05-31 17:29:44 +03:00
00fb2ba7bb [ios][x2t] update converter 2018-05-31 14:44:14 +03:00
0f65e36517 Merge branch 'feature/graphics' into develop 2018-05-31 11:39:29 +03:00
aa1af73fda x2t version up 2018-05-30 19:20:18 +03:00
1610978821 [ios][se][pe] fixed build 2018-05-30 18:08:43 +03:00
20faf24556 RtfFormatWriter - add comments (fix bug #37807) 2018-05-30 16:37:41 +03:00
ae90e4ae96 Merge pull request #87 from ONLYOFFICE/feature/onlypass
Feature/onlypass
2018-05-30 13:58:42 +03:00
6fae9115ea Merge branch 'hotfix/v5.1.5' into feature/onlypass 2018-05-30 13:58:29 +03:00
c14a21b2da Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-05-30 13:21:14 +03:00
b952692225 . 2018-05-30 12:50:50 +03:00
23249e69f9 . 2018-05-29 19:53:13 +03:00
09f6c3f4e8 . 2018-05-29 19:03:58 +03:00
111ceff368 [ios][x2t] update converter 2018-05-29 18:55:18 +03:00
867b0634f3 Fix bug #36423
Fix problem with the clip in the EMF
2018-05-29 18:33:49 +03:00
f9c27275a7 . 2018-05-29 17:01:34 +03:00
dd12ee0b9e Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-05-29 16:24:03 +03:00
de83971832 [x2t] Fix dependence of docx comments with empty text 2018-05-29 16:01:50 +03:00
0d158e46b5 OdfFormatWriter - extending number formats 2018-05-29 16:03:08 +03:00
dde6b8bdc7 . 2018-05-29 14:15:32 +03:00
b66bb0d63f RtfFormatReader - add commetns 2018-05-29 14:14:33 +03:00
d666da2697 OdfFormatReader - fix bug #37832 2018-05-28 13:35:45 +03:00
8e35f9b063 [ios][x2t] fixed build 2018-05-25 12:25:37 +03:00
25268b706d OdfFormatreader - content of illustrations 2018-05-24 18:40:01 +03:00
97ff1efba8 XlsFormat -fix issue 308 2018-05-24 17:52:21 +03:00
1879ce8dbb v5.1.4 2018-05-24 15:34:46 +03:00
50ff5fc0b2 v5.1.4 2018-05-24 15:32:34 +03:00
1c2b86519e [bug] Fix bug 37565 2018-05-23 16:38:24 +03:00
323d1b44cd openssl 2018-05-23 13:36:26 +03:00
83fa44edcd Use system libcurl 2018-05-21 18:12:06 +03:00
2ead42a513 Build on linux 2018-05-17 15:32:23 +03:00
427046cb8f Fix build on mac 2018-05-17 12:14:12 +03:00
e60cc05b6e Downgrade icu to v58.2
ICU58 is the last version that works on Windows XP and Windows Vista.
2018-05-16 12:20:15 +03:00
482 changed files with 12092 additions and 5433 deletions

View File

@ -1321,6 +1321,12 @@ public:
NSStringUtils::CStringBuilder ParaPr;
NSStringUtils::CStringBuilder TextPr;
std::wstring PStyle;
bool Tentative;
unsigned long Tplc;
bool IsLgl;
bool Legacy;
long LegacyIndent;
unsigned long LegacySpace;
bool bILvl;
bool bFormat;
@ -1332,6 +1338,14 @@ public:
bool bParaPr;
bool bTextPr;
bool bPStyle;
bool bTentative;
bool bTplc;
bool bIsLgl;
bool bLvlLegacy;
bool bLegacy;
bool bLegacyIndent;
bool bLegacySpace;
docLvl()
{
bILvl = false;
@ -1344,6 +1358,13 @@ public:
bParaPr = false;
bTextPr = false;
bPStyle = false;
bTentative = false;
bTplc = false;
bIsLgl = false;
bLvlLegacy = false;
bLegacy = false;
bLegacyIndent = false;
bLegacySpace = false;
}
~docLvl()
{
@ -1359,6 +1380,19 @@ public:
{
oWriter.WriteString(L" w:ilvl=\"" + std::to_wstring(ILvl) + L"\"");
}
if(bTentative)
{
if(Tentative)
oWriter.WriteString(L" w:tentative=\"1\"");
else
oWriter.WriteString(L" w:tentative=\"0\"");
}
if(bTplc)
{
oWriter.WriteString(L" w:tplc=\"");
oWriter.WriteString(XmlUtils::IntToString(Tplc, L"%08X"));
oWriter.WriteString(L"\"");
}
oWriter.WriteString(L">");
if(bStart)
{
@ -1392,6 +1426,13 @@ public:
std::wstring sStyleName = XmlUtils::EncodeXmlString(PStyle);
oWriter.WriteString(L"<w:pStyle w:val=\"" + sStyleName + L"\"/>");
}
if(bIsLgl)
{
if(IsLgl)
oWriter.WriteString(L"<w:isLgl/>");
else
oWriter.WriteString(L"<w:isLgl w:val=\"false\"/>");
}
if(bSuff)
{
std::wstring sSuff;
@ -1430,6 +1471,30 @@ public:
oWriter.WriteString(sTextXml);
}
if(bLvlLegacy)
{
oWriter.WriteString(L"<w:legacy");
if(bLegacy)
{
if(Legacy)
oWriter.WriteString(L" w:legacy=\"1\"");
else
oWriter.WriteString(L" w:legacy=\"0\"");
}
if(bLegacyIndent)
{
oWriter.WriteString(L" w:legacyIndent=\"");
oWriter.WriteString(std::to_wstring(LegacyIndent));
oWriter.WriteString(L"\"");
}
if(bLegacySpace)
{
oWriter.WriteString(L" w:legacySpace=\"");
oWriter.WriteString(std::to_wstring(LegacySpace));
oWriter.WriteString(L"\"");
}
oWriter.WriteString(L"/>");
}
if(bJc)
{
std::wstring sJc;
@ -1877,25 +1942,22 @@ public:
sRes += L"\"";
}
sRes += L">";
if(false == pComment->Text.empty())
std::wstring sText = pComment->Text;
XmlUtils::replace_all(sText, L"\r", L"");
bool bFirst = true;
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
{
std::wstring sText = pComment->Text;
XmlUtils::replace_all(sText, L"\r", L"");
bool bFirst = true;
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
wchar_t cToken = sText[i];
if('\n' == cToken)
{
wchar_t cToken = sText[i];
if('\n' == cToken)
{
bFirst = writeContentWritePart(pComment, sText, nPrevIndex, i, bFirst, sRes);
nPrevIndex = i + 1;
}
bFirst = writeContentWritePart(pComment, sText, nPrevIndex, i, bFirst, sRes);
nPrevIndex = i + 1;
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
sRes += L"</w:comment>";
return sRes;
}

View File

@ -2654,6 +2654,49 @@ public:
odocLvl->bILvl = true;
odocLvl->ILvl = m_oBufferedStream.GetLong();
}
else if ( c_oSerNumTypes::Tentative == type )
{
odocLvl->bTentative = true;
odocLvl->Tentative = m_oBufferedStream.GetBool();
}
else if ( c_oSerNumTypes::Tplc == type )
{
odocLvl->bTplc = true;
odocLvl->Tplc = m_oBufferedStream.GetULong();
}
else if ( c_oSerNumTypes::IsLgl == type )
{
odocLvl->bIsLgl = true;
odocLvl->IsLgl = m_oBufferedStream.GetBool();
}
else if ( c_oSerNumTypes::LvlLegacy == type )
{
odocLvl->bLvlLegacy = true;
READ1_DEF(length, res, this->ReadLvlLegacy, odocLvl);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadLvlLegacy(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
docLvl* odocLvl = static_cast<docLvl*>(poResult);
if ( c_oSerNumTypes::Legacy == type )
{
odocLvl->bLegacy = true;
odocLvl->Legacy = m_oBufferedStream.GetBool();
}
else if ( c_oSerNumTypes::LegacyIndent == type )
{
odocLvl->bLegacyIndent = true;
odocLvl->LegacyIndent = m_oBufferedStream.GetLong();
}
else if ( c_oSerNumTypes::LegacySpace == type )
{
odocLvl->bLegacySpace = true;
odocLvl->LegacySpace = m_oBufferedStream.GetULong();
}
else
res = c_oSerConstants::ReadUnknown;
return res;

View File

@ -204,7 +204,14 @@ extern int g_nCurFormatVersion;
NumFmtFormat = 26,
Num_LvlOverride = 27,
StartOverride = 28,
ILvl = 29
ILvl = 29,
Tentative = 30,
Tplc = 31,
IsLgl = 32,
LvlLegacy = 33,
Legacy = 34,
LegacyIndent = 35,
LegacySpace = 36
};}
namespace c_oSerOtherTableTypes{enum c_oSerOtherTableTypes
{

View File

@ -2987,6 +2987,54 @@ namespace BinDocxRW
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(lvl.m_oIlvl->GetValue());
}
if(lvl.m_oTentative.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::Tentative);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBOOL(lvl.m_oTentative->ToBool());
}
if(lvl.m_oTplc.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::Tplc);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG(lvl.m_oTplc->GetValue());
}
if(lvl.m_oIsLgl.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::IsLgl);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBOOL(lvl.m_oIsLgl->m_oVal.ToBool());
}
if(lvl.m_oLegacy.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::LvlLegacy);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
nCurPos = m_oBcw.WriteItemWithLengthStart();
WriteLvlLegacy(lvl.m_oLegacy.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteLvlLegacy(const ComplexTypes::Word::CLvlLegacy& lvlLegacy)
{
int nCurPos = 0;
if (lvlLegacy.m_oLegacy.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::Legacy);
m_oBcw.m_oStream.WriteBOOL(lvlLegacy.m_oLegacy->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (lvlLegacy.m_oLegacyIndent.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::LegacyIndent);
m_oBcw.m_oStream.WriteLONG(lvlLegacy.m_oLegacyIndent->ToTwips());
m_oBcw.WriteItemEnd(nCurPos);
}
if (lvlLegacy.m_oLegacySpace.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::LegacySpace);
m_oBcw.m_oStream.WriteULONG(lvlLegacy.m_oLegacySpace->ToUnsignedTwips());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteLevelText(const std::wstring& text)
{

View File

@ -19,9 +19,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormulasConvert", "..\wi
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeFileCrypt", "..\..\OfficeCryptReader\win32\ECMACryptReader.vcproj", "{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}"

View File

@ -33,7 +33,7 @@
#include <string>
#include <vector>
#include "../include/cpdoccore/CPScopedPtr.h"
#include "../include/CPScopedPtr.h"
namespace cpdoccore {
namespace formulasconvert {

View File

@ -1,44 +1,44 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
namespace cpdoccore {
// поиск ближайшего цвета из
// Black, Green, White, Blue, Magenta, Yellow, Cyan, Red
std::wstring RGBToString(int r, int g, int b);
// разбор HEX-строки с цветом
bool HEXStringToRGB(std::wstring const & str, int &r, int &g, int &b);
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
namespace cpdoccore {
// поиск ближайшего цвета из
// Black, Green, White, Blue, Magenta, Yellow, Cyan, Red
std::wstring RGBToString(int r, int g, int b);
// разбор HEX-строки с цветом
bool HEXStringToRGB(std::wstring const & str, int &r, int &g, int &b);
}

View File

@ -1,40 +1,40 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/noncopyable.hpp>
namespace cpdoccore {
typedef ::boost::noncopyable noncopyable;
} // namespace cpdoccore
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/noncopyable.hpp>
namespace cpdoccore {
typedef ::boost::noncopyable noncopyable;
} // namespace cpdoccore

View File

@ -1,48 +1,48 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/optional/optional_io.hpp>
#include <boost/optional.hpp>
/// внешнее объявление для Optional, используем boost::optional
template <class T>
struct optional
{
typedef T Base;
typedef boost::optional<T> Type;
};
#define _CP_OPT(V) optional<V>::Type
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/optional/optional_io.hpp>
#include <boost/optional.hpp>
/// внешнее объявление для Optional, используем boost::optional
template <class T>
struct optional
{
typedef T Base;
typedef boost::optional<T> Type;
};
#define _CP_OPT(V) optional<V>::Type

View File

@ -1,46 +1,46 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/scoped_ptr.hpp>
namespace cpdoccore {
template <class T>
struct scoped_ptr
{
typedef ::boost::scoped_ptr<T> Type;
};
#define _CP_SCOPED_PTR(T) scoped_ptr< T >::Type
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/scoped_ptr.hpp>
namespace cpdoccore {
template <class T>
struct scoped_ptr
{
typedef ::boost::scoped_ptr<T> Type;
};
#define _CP_SCOPED_PTR(T) scoped_ptr< T >::Type
}

View File

@ -1,48 +1,48 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
namespace cpdoccore {
template <class T>
struct shared_ptr
{
typedef ::boost::shared_ptr<T> Type;
};
#define _CP_PTR(T) shared_ptr< T >::Type
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
namespace cpdoccore {
template <class T>
struct shared_ptr
{
typedef ::boost::shared_ptr<T> Type;
};
#define _CP_PTR(T) shared_ptr< T >::Type
}

View File

@ -1,39 +1,39 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <string>
namespace cpdoccore {
std::string ansi_to_utf8(const std::string & _AnsiString);
std::wstring utf8_to_utf16(const std::string & _Utf8String);
std::string utf16_to_utf8(const std::wstring & _Utf16String);
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <string>
namespace cpdoccore {
std::string ansi_to_utf8(const std::string & _AnsiString);
std::wstring utf8_to_utf16(const std::string & _Utf8String);
std::string utf16_to_utf8(const std::wstring & _Utf16String);
}

View File

@ -1,44 +1,44 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/weak_ptr.hpp>
namespace cpdoccore {
template <class T>
struct weak_ptr
{
typedef ::boost::weak_ptr<T> Type;
};
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <boost/weak_ptr.hpp>
namespace cpdoccore {
template <class T>
struct weak_ptr
{
typedef ::boost::weak_ptr<T> Type;
};
}

View File

@ -1,76 +1,76 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include "../CPSharedPtr.h"
namespace cpdoccore {
namespace xml {
class sax;
class attributes;
typedef attributes attributes_wc;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
}
namespace common {
// Базовый класс для элемента, который может быть прочитан sax-reader -ом
// Для каждого элемента будут вызваны методы
// add_attributes, add_child_element, add_text как колбеки для чтения соответствующих данных
class read_doc_element
{
public:
bool read_sax( xml::sax * Reader);
virtual ~read_doc_element() = 0;
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
virtual void add_text (const std::wstring & Text) = 0;
};
inline read_doc_element::~read_doc_element()
{
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include "../CPSharedPtr.h"
namespace cpdoccore {
namespace xml {
class sax;
class attributes;
typedef attributes attributes_wc;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
}
namespace common {
// Базовый класс для элемента, который может быть прочитан sax-reader -ом
// Для каждого элемента будут вызваны методы
// add_attributes, add_child_element, add_text как колбеки для чтения соответствующих данных
class read_doc_element
{
public:
bool read_sax( xml::sax * Reader);
virtual ~read_doc_element() = 0;
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
virtual void add_text (const std::wstring & Text) = 0;
};
inline read_doc_element::~read_doc_element()
{
}
}
}

View File

@ -1,45 +1,45 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <cpdoccore/CPOptional.h>
#include "logging.h"
namespace cpdoccore {
namespace common {
template <class T, class StringT>
typename optional<T>::Type read_string( const StringT & Value );
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "../CPOptional.h"
#include "logging.h"
namespace cpdoccore {
namespace common {
template <class T, class StringT>
typename optional<T>::Type read_string( const StringT & Value );
}
}

View File

@ -1,62 +1,62 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
namespace cpdoccore {
namespace xml {
class sax;
template <class StringT>
class attributes;
typedef attributes< std::wstring > attributes_wc;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
}
namespace common {
class write_doc_element {
public:
virtual std::wostream & write_stream( std::wostream & _Wostream ) = 0;
virtual ~write_doc_element() = 0;
};
inline write_doc_element::~write_doc_element()
{
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
namespace cpdoccore {
namespace xml {
class sax;
template <class StringT>
class attributes;
typedef attributes< std::wstring > attributes_wc;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
}
namespace common {
class write_doc_element {
public:
virtual std::wostream & write_stream( std::wostream & _Wostream ) = 0;
virtual ~write_doc_element() = 0;
};
inline write_doc_element::~write_doc_element()
{
}
}
}

View File

@ -1,90 +1,90 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include "../CPSharedPtr.h"
#include "../CPScopedPtr.h"
struct ProgressCallback;
namespace cpdoccore {
namespace xml
{
class sax;
}
namespace oox {
class docx_conversion_context;
class xlsx_conversion_context;
class pptx_conversion_context;
}
namespace odf_reader {
class odf_read_context;
class odf_document
{
public:
odf_document(const std::wstring & SrcPath, const std::wstring & TempPath, const std::wstring& Password, const ProgressCallback* CallBack);
odf_document(xml::sax * Reader, const std::wstring & TempPath);
~odf_document();
odf_read_context & odf_context();
bool docx_convert(oox::docx_conversion_context & Context);
bool xlsx_convert(oox::xlsx_conversion_context & Context);
bool pptx_convert(oox::pptx_conversion_context & Context);
const std::wstring & get_folder() const;
const std::wstring & get_temp_folder() const;
int get_office_mime_type();
bool get_encrypted();
bool get_error();
class Impl;
Impl * get_impl() { return impl_.get(); }
bool UpdateProgress(long Complete);
private:
_CP_SCOPED_PTR(Impl) impl_;
};
typedef shared_ptr<odf_document>::Type odf_document_ptr;
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include "../CPSharedPtr.h"
#include "../CPScopedPtr.h"
struct ProgressCallback;
namespace cpdoccore {
namespace xml
{
class sax;
}
namespace oox {
class docx_conversion_context;
class xlsx_conversion_context;
class pptx_conversion_context;
}
namespace odf_reader {
class odf_read_context;
class odf_document
{
public:
odf_document(const std::wstring & SrcPath, const std::wstring & TempPath, const std::wstring& Password, const ProgressCallback* CallBack);
odf_document(xml::sax * Reader, const std::wstring & TempPath);
~odf_document();
odf_read_context & odf_context();
bool docx_convert(oox::docx_conversion_context & Context);
bool xlsx_convert(oox::xlsx_conversion_context & Context);
bool pptx_convert(oox::pptx_conversion_context & Context);
const std::wstring & get_folder() const;
const std::wstring & get_temp_folder() const;
int get_office_mime_type();
bool get_encrypted();
bool get_error();
class Impl;
Impl * get_impl() { return impl_.get(); }
bool UpdateProgress(long Complete);
private:
_CP_SCOPED_PTR(Impl) impl_;
};
typedef shared_ptr<odf_document>::Type odf_document_ptr;
}
}

View File

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

View File

@ -1,34 +1,34 @@
// Copyright 2006 Nemanja Trifunovic
/*
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
#define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
#include "utf8/checked.h"
#include "utf8/unchecked.h"
#endif // header guard
// Copyright 2006 Nemanja Trifunovic
/*
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
#define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
#include "utf8/checked.h"
#include "utf8/unchecked.h"
#endif // header guard

View File

@ -161,12 +161,12 @@ namespace utf8
template <typename octet_iterator>
uint32_t prior(octet_iterator& it, octet_iterator start)
{
{
// can't do much if it == start
if (it == start)
if (it == start)
throw not_enough_room();
octet_iterator end = it;
octet_iterator end = it;
// Go back until we hit either a lead octet or start
while (internal::is_trail(*(--it)))
if (it == start)

View File

@ -1,259 +1,259 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <vector>
#include "../../cpdoccore/CPSharedPtr.h"
#include "../../cpdoccore/CPOptional.h"
#include "../../cpdoccore/xml/xmlchar.h"
#include "../../logging.h"
#include <boost/variant.hpp>
#include <boost/lexical_cast.hpp>
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
namespace cpdoccore
{
namespace odf_reader
{
struct _property
{
_property(std::wstring n, std::wstring s) { name_ = n; val_ = s;}
_property(std::wstring n, bool b) { name_ = n; val_ = b;}
_property(std::wstring n, int i) { name_ = n; val_ = i;}
_property(std::wstring n, double d) {name_ = n;val_ = d;}
std::wstring name_;
boost::variant<bool,std::wstring,double,int> val_;
};
template <class T>
bool GetProperty(const std::vector<_property> & Heap, const std::wstring Name, T & Val)
{
typedef typename T::value_type T_value_type;
Val.reset();
for (size_t i = 0 ; i < Heap.size(); i++)
{
if (Heap[i].name_ == Name )
{
try
{
Val = boost::get<T_value_type>(Heap[i].val_);
}
catch(...)
{
_CP_LOG << L"[warning] : incorrect type convert \'" << Name << L"\'\n";
}
return true;
}
}
return false;
}
}
namespace xml
{
class sax;
class attributes
{
public:
typedef optional<std::wstring>::Type value_type;
typedef std::pair< std::wstring, std::wstring> key_value;
public:
virtual value_type get(const std::wstring & QualifiedName) const = 0;
template <class V> typename optional<V>::Type get_val(const std::wstring & QualifiedName);
virtual const key_value & at(size_t _Pos) const = 0;
virtual size_t size() const = 0;
size_t length() const ;
bool empty() const;
virtual void reset_check() const = 0;
virtual bool check() const = 0;
virtual ~attributes() = 0;
};
template <class V>
class attributes_get_val_impl
{
public:
typedef typename optional<V>::Type optional_V_type;
static typename optional<V>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
try
{
return optional_V_type (boost::lexical_cast<V>( *val ) );
//return common::read_string<V>( *val );
}
catch(...)
{
_CP_LOG << L"[warning] : could't read attribute \'" << QualifiedName << L"\'\n";
}
}
return optional_V_type();
}
};
template<>
class attributes_get_val_impl<bool>
{
public:
typedef xml::xml_char<wchar_t> xml_char_value_type;
static optional<bool>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
std::wstring tmp = *val;
tmp = XmlUtils::GetLower(tmp);
return optional<bool>::Type((tmp == xml_char_value_type::trueVal));
}
else
return optional<bool>::Type();
}
};
template<>
class attributes_get_val_impl<char>
{
public:
static optional<char>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
std::wstring tmp = *val;
return optional<char>::Type( (tmp.size() > 0) ? tmp[0] : ' ');
}
else
return optional<char>::Type();
}
};
template<>
class attributes_get_val_impl<wchar_t>
{
public:
static optional<wchar_t>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
std::wstring tmp = *val;
return optional<wchar_t>::Type( (tmp.size() > 0) ? tmp[0] : L' ');
}
else
return optional<wchar_t>::Type();
}
};
template <class V>
inline typename optional<V>::Type attributes::get_val(const std::wstring & QualifiedName)
{
return attributes_get_val_impl<V>::get_val(*this, QualifiedName);
}
inline attributes::~attributes()
{}
inline size_t attributes::length() const
{
return this->size();
}
inline bool attributes::empty() const
{
return (this->size() == 0);
}
struct attributes_ptr
{
typedef shared_ptr< attributes >::Type Type;
};
typedef attributes attributes_wc;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
template <class T>
static bool _cp_apply_attribute(xml::attributes_wc_ptr attr, const std::wstring & QualifiedName, T & Val)
{
Val = attr->get_val<typename T::value_type>(QualifiedName);
return (!!Val);
}
template <class T>
static bool _cp_apply_attribute(xml::attributes_wc_ptr attr, const std::wstring & QualifiedName, T & Val, const T & Default)
{
typedef typename optional<T>::Type type_opt_t;
type_opt_t tmp;
try
{
tmp = attr->get_val<T>(QualifiedName);
Val = tmp.get_value_or(Default);
}catch(...)
{
}
return (!!tmp);
}
#if defined(_WIN32) || defined(_WIN64)
#define CP_APPLY_ATTR(NAME, VAL, ...) _cp_apply_attribute(Attributes, (NAME), (VAL), __VA_ARGS__)
#else
#define CP_APPLY_ATTR(NAME, VAL, ...) _cp_apply_attribute(Attributes, (NAME), (VAL), ##__VA_ARGS__)
#endif
attributes_wc_ptr read_attributes(sax * SaxReader);
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <vector>
#include "../CPSharedPtr.h"
#include "../CPOptional.h"
#include "../xml/xmlchar.h"
#include "../logging.h"
#include <boost/variant.hpp>
#include <boost/lexical_cast.hpp>
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
namespace cpdoccore
{
namespace odf_reader
{
struct _property
{
_property(std::wstring n, std::wstring s) { name_ = n; val_ = s;}
_property(std::wstring n, bool b) { name_ = n; val_ = b;}
_property(std::wstring n, int i) { name_ = n; val_ = i;}
_property(std::wstring n, double d) {name_ = n;val_ = d;}
std::wstring name_;
boost::variant<bool,std::wstring,double,int> val_;
};
template <class T>
bool GetProperty(const std::vector<_property> & Heap, const std::wstring Name, T & Val)
{
typedef typename T::value_type T_value_type;
Val.reset();
for (size_t i = 0 ; i < Heap.size(); i++)
{
if (Heap[i].name_ == Name )
{
try
{
Val = boost::get<T_value_type>(Heap[i].val_);
}
catch(...)
{
_CP_LOG << L"[warning] : incorrect type convert \'" << Name << L"\'\n";
}
return true;
}
}
return false;
}
}
namespace xml
{
class sax;
class attributes
{
public:
typedef optional<std::wstring>::Type value_type;
typedef std::pair< std::wstring, std::wstring> key_value;
public:
virtual value_type get(const std::wstring & QualifiedName) const = 0;
template <class V> typename optional<V>::Type get_val(const std::wstring & QualifiedName);
virtual const key_value & at(size_t _Pos) const = 0;
virtual size_t size() const = 0;
size_t length() const ;
bool empty() const;
virtual void reset_check() const = 0;
virtual bool check() const = 0;
virtual ~attributes() = 0;
};
template <class V>
class attributes_get_val_impl
{
public:
typedef typename optional<V>::Type optional_V_type;
static typename optional<V>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
try
{
return optional_V_type (boost::lexical_cast<V>( *val ) );
//return common::read_string<V>( *val );
}
catch(...)
{
_CP_LOG << L"[warning] : could't read attribute \'" << QualifiedName << L"\'\n";
}
}
return optional_V_type();
}
};
template<>
class attributes_get_val_impl<bool>
{
public:
typedef xml::xml_char<wchar_t> xml_char_value_type;
static optional<bool>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
std::wstring tmp = *val;
tmp = XmlUtils::GetLower(tmp);
return optional<bool>::Type((tmp == xml_char_value_type::trueVal));
}
else
return optional<bool>::Type();
}
};
template<>
class attributes_get_val_impl<char>
{
public:
static optional<char>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
std::wstring tmp = *val;
return optional<char>::Type( (tmp.size() > 0) ? tmp[0] : ' ');
}
else
return optional<char>::Type();
}
};
template<>
class attributes_get_val_impl<wchar_t>
{
public:
static optional<wchar_t>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
std::wstring tmp = *val;
return optional<wchar_t>::Type( (tmp.size() > 0) ? tmp[0] : L' ');
}
else
return optional<wchar_t>::Type();
}
};
template <class V>
inline typename optional<V>::Type attributes::get_val(const std::wstring & QualifiedName)
{
return attributes_get_val_impl<V>::get_val(*this, QualifiedName);
}
inline attributes::~attributes()
{}
inline size_t attributes::length() const
{
return this->size();
}
inline bool attributes::empty() const
{
return (this->size() == 0);
}
struct attributes_ptr
{
typedef shared_ptr< attributes >::Type Type;
};
typedef attributes attributes_wc;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
template <class T>
static bool _cp_apply_attribute(xml::attributes_wc_ptr attr, const std::wstring & QualifiedName, T & Val)
{
Val = attr->get_val<typename T::value_type>(QualifiedName);
return (!!Val);
}
template <class T>
static bool _cp_apply_attribute(xml::attributes_wc_ptr attr, const std::wstring & QualifiedName, T & Val, const T & Default)
{
typedef typename optional<T>::Type type_opt_t;
type_opt_t tmp;
try
{
tmp = attr->get_val<T>(QualifiedName);
Val = tmp.get_value_or(Default);
}catch(...)
{
}
return (!!tmp);
}
#if defined(_WIN32) || defined(_WIN64)
#define CP_APPLY_ATTR(NAME, VAL, ...) _cp_apply_attribute(Attributes, (NAME), (VAL), __VA_ARGS__)
#else
#define CP_APPLY_ATTR(NAME, VAL, ...) _cp_apply_attribute(Attributes, (NAME), (VAL), ##__VA_ARGS__)
#endif
attributes_wc_ptr read_attributes(sax * SaxReader);
}
}

View File

@ -1,55 +1,55 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
namespace cpdoccore {
namespace xml {
enum NodeType
{
typeNone = 0,
typeEOF,
typeElement,
typeAttribute,
typeText,
typeCDATA,
typeProcessingInstruction,
typeComment,
typeDocumentType,
typeWhitespace,
typeEndElement,
typeXmlDeclaration
};
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
namespace cpdoccore {
namespace xml {
enum NodeType
{
typeNone = 0,
typeEOF,
typeElement,
typeAttribute,
typeText,
typeCDATA,
typeProcessingInstruction,
typeComment,
typeDocumentType,
typeWhitespace,
typeEndElement,
typeXmlDeclaration
};
}
}

View File

@ -1,114 +1,114 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <exception>
#include <iosfwd>
#include "../CPSharedPtr.h"
#include "nodetype.h"
namespace cpdoccore {
namespace xml {
class sax;
typedef _CP_PTR(sax) sax_ptr;
class sax
{
public:
struct error : virtual public std::exception
{
public:
enum Code {
no = 0,
openFile,
createReader,
internalErr
};
public:
error(Code _code) : code_(_code){};
Code code() const { return code_; }
private:
Code code_;
};
public:
//virtual std::wstring baseURI() = 0;
virtual unsigned int depth() = 0;
// <p:abc/>, returns "abc".
virtual std::wstring nodeLocalName() = 0;
// <p:abc />, returns "p:abc".
virtual std::wstring nodeQualifiedName() = 0;
// <xyz:abc xmlns:xyz="u://1" />, it returns "xyz".
virtual std::wstring namespacePrefix() = 0;
//// Returns "u://1" for the element <xyz:abc xmlns:xyz="u://1" />.
//virtual std::wstring namespaceUri() = 0;
virtual NodeType nodeType() = 0;
virtual std::wstring value() = 0;
virtual unsigned int attrCount() = 0;
//virtual std::wstring value() = 0;
virtual bool attrDefault() = 0;
// <element attribute="123"></element> — false
// <element attribute="123"/> - true
virtual bool isEmptyElement() = 0;
virtual bool moveToAttrFirst() = 0;
virtual bool moveToAttrNext() = 0;
virtual bool moveToAttrOwner() = 0;
virtual NodeType next(int Depth) = 0;
virtual ~sax() = 0;
};
inline sax::~sax() {};
sax_ptr create_sax(const wchar_t * FileName);
} // namespace xml
} // namespace cpdoccore
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <exception>
#include <iosfwd>
#include "../CPSharedPtr.h"
#include "nodetype.h"
namespace cpdoccore {
namespace xml {
class sax;
typedef _CP_PTR(sax) sax_ptr;
class sax
{
public:
struct error : virtual public std::exception
{
public:
enum Code {
no = 0,
openFile,
createReader,
internalErr
};
public:
error(Code _code) : code_(_code){};
Code code() const { return code_; }
private:
Code code_;
};
public:
//virtual std::wstring baseURI() = 0;
virtual unsigned int depth() = 0;
// <p:abc/>, returns "abc".
virtual std::wstring nodeLocalName() = 0;
// <p:abc />, returns "p:abc".
virtual std::wstring nodeQualifiedName() = 0;
// <xyz:abc xmlns:xyz="u://1" />, it returns "xyz".
virtual std::wstring namespacePrefix() = 0;
//// Returns "u://1" for the element <xyz:abc xmlns:xyz="u://1" />.
//virtual std::wstring namespaceUri() = 0;
virtual NodeType nodeType() = 0;
virtual std::wstring value() = 0;
virtual unsigned int attrCount() = 0;
//virtual std::wstring value() = 0;
virtual bool attrDefault() = 0;
// <element attribute="123"></element> — false
// <element attribute="123"/> - true
virtual bool isEmptyElement() = 0;
virtual bool moveToAttrFirst() = 0;
virtual bool moveToAttrNext() = 0;
virtual bool moveToAttrOwner() = 0;
virtual NodeType next(int Depth) = 0;
virtual ~sax() = 0;
};
inline sax::~sax() {};
sax_ptr create_sax(const wchar_t * FileName);
} // namespace xml
} // namespace cpdoccore

View File

@ -1,326 +1,326 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <iostream>
#include <sstream>
#include <stack>
#include <cassert>
namespace cpdoccore
{
namespace xml
{
namespace writer
{
template <class T> struct chars { };
template <>
struct chars<char>
{
static const char eq = '=';
static const char quote = '\"';
static const char space = ' ';
static const char left_brocket = '<';
static const char right_brocket = '>';
static const char slash = '/';
static const char colon = ':';
static const char amp = '&';
static const char apos = '\'';
static const char * cdata_open() { return "<![CDATA["; }
static const char * cdata_close() { return "]]>"; }
static const char * amp_str(){ return "&amp;"; }
static const char * left_brocket_str() { return "&lt;"; }
static const char * right_brocket_str() { return "&gt;"; }
static const char * apos_str() { return "&apos;"; }
static const char * quote_str() { return "&quot;"; }
};
template <>
struct chars<wchar_t>
{
static const wchar_t eq = L'=';
static const wchar_t quote = L'\"';
static const wchar_t space = L' ';
static const wchar_t left_brocket = L'<';
static const wchar_t right_brocket = L'>';
static const wchar_t slash = L'/';
static const wchar_t colon = L':';
static const wchar_t amp = L'&';
static const wchar_t apos = L'\'';
static const wchar_t * cdata_open() { return L"<![CDATA["; }
static const wchar_t * cdata_close() { return L"]]>"; }
static const wchar_t * amp_str(){ return L"&amp;"; }
static const wchar_t * left_brocket_str() { return L"&lt;"; }
static const wchar_t * right_brocket_str() { return L"&gt;"; }
static const wchar_t * apos_str() { return L"&apos;"; }
static const wchar_t * quote_str() { return L"&quot;"; }
};
template <class V>
class element;
//
// xml::writer class
//
template <class T>
class writer
{
public:
// writer must be bound to an ostream
writer(std::basic_ostream<T>& os, bool need_header = false) : level_(0), os_(os), need_header_(need_header) {}
~writer(void) { assert(elements_.empty()); }
private:
size_t level_;
std::basic_ostream<T>& os_; // output stream
bool need_header_; // have we written an XML header yet?
std::stack<element<T>*> elements_; // stack of open element tags
// write XML header, if necessary
writer& header()
{
if (need_header_)
{
// TODO
//os_ << "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
need_header_ = false;
}
return *this;
}
// write a single character to the output stream
writer& putc(T c)
{
os_.put(c);
return *this;
}
// write a string to the output stream
writer& puts(const T* str) {
os_ << str;
return *this;
}
template <class V>
friend class element;
};
//
// xml::element class
//
template <class T>
class element
{
public:
// create a new element tag, bound to an xml::writer
element(writer<T>& wr, std::basic_string<T, std::char_traits<T>, std::allocator<T> > const & name) : wr_(wr), name_(name)
{
wr_.level_++;
check_parent();
wr_.header().putc('<').puts(name_.c_str());
tagopen_ = true;
wr_.elements_.push(this);
}
// close the current element tag
~element()
{
if (!wr_.elements_.empty() && wr_.elements_.top() == this)
{
wr_.elements_.pop();
if (tagopen_)
wr_.putc(chars<T>::slash)
.putc(chars<T>::right_brocket);
else
wr_.putc(chars<T>::left_brocket)
.putc(chars<T>::slash)
.puts(name_.c_str())
.putc(chars<T>::right_brocket);
}
wr_.level_--;
}
// write an attribute for the current element
element& attr(const T* name, const T* value)
{
assert(name != 0);
assert(value != 0);
assert(tagopen_);
wr_.putc(chars<T>::space)
.puts(name)
.putc(chars<T>::eq)
.putc(chars<T>::quote);
qputs(value);
wr_.putc(chars<T>::quote);
return *this;
}
// attr() overload for std::string type
element& attr(const T* name, const std::basic_string<T, std::char_traits<T>, std::allocator<T> >& value)
{
return attr(name, value.c_str());
}
// attr() function template for all streamable types
template <class V>
element& attr(const T* name, V value)
{
std::basic_stringstream<T, std::char_traits<T>, std::allocator<T> > ss;
ss << value;
attr(name, ss.str());
return *this;
}
// write text content for the current element
element& contents(const T* str)
{
assert(str != 0);
check_parent();
qputs(str);
return *this;
}
// contents() overload for std::string type
element& contents(const std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str)
{
return contents(str.c_str());
}
// contents() function template for all streamable types
template <class V>
element& contents(V value)
{
std::basic_stringstream<T, std::char_traits<T>, std::allocator<T> > ss;
ss << value;
contents(ss.str());
return *this;
}
std::basic_ostream<T>& stream()
{
check_parent();
return wr_.os_;
}
// write CDATA section
element& cdata(const T * str)
{
assert(str != 0);
check_parent();
wr_.puts(chars<T>::cdata_open());
wr_.puts(str);
wr_.puts(chars<T>::cdata_close());
return *this;
}
// cdata() overload for std::string type
element& cdata(const std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str)
{
return cdata(str.c_str());
}
private:
writer<T>& wr_; // bound XML writer
//const T* name_; // name of current element
const std::basic_string<T, std::char_traits<T>, std::allocator<T> > name_;
bool tagopen_; // is the element tag for this element still open?
// write a string quoting characters which have meaning in xml
element& qputs(const T* str)
{
for (; *str; ++str)
{
switch (*str)
{
case chars<T>::amp:
wr_.puts(chars<T>::amp_str()); break;
case chars<T>::left_brocket:
wr_.puts(chars<T>::left_brocket_str()); break;
case chars<T>::right_brocket:
wr_.puts(chars<T>::right_brocket_str()); break;
case chars<T>::apos:
wr_.puts(chars<T>::apos_str()); break;
case chars<T>::quote:
wr_.puts(chars<T>::quote_str()); break;
default:
wr_.putc(*str); break;
}
}
return *this;
}
// check to see if we have a parent tag which needs to be closed
void check_parent()
{
if (!wr_.elements_.empty() && wr_.elements_.top()->tagopen_)
{
wr_.putc(chars<T>::right_brocket);
wr_.elements_.top()->tagopen_ = false;
}
}
};
}
}
typedef xml::writer::writer<wchar_t> xml_writer;
typedef xml::writer::element<wchar_t> xml_element;
#define CP_XML_WRITER(STRM) if (bool _b_ = false) {} else for (xml_writer _xml_wr_((STRM));!_b_;_b_=true)
#define CP_XML_NODE(NAME) if (bool _b_ = false) {} else for (xml_element _xml_node_(_xml_wr_, (NAME));!_b_;_b_=true)
#define CP_XML_ATTR(NAME, VAL) _xml_node_.attr((NAME),(VAL))
#define CP_XML_CONTENT(VAL) _xml_node_.contents((VAL))
#define CP_XML_STREAM() _xml_node_.stream()
#define CP_GET_XML_NODE() _xml_node_
#define CP_ATTR_NODE xml_element & _xml_node_
#define CP_XML_ATTR_OPT(NAME, VAL) if (VAL)CP_XML_ATTR(NAME, (*VAL))
#define CP_XML_NODE_SIMPLE() std::wstring NS_NAME = std::wstring(ns) + std::wstring(L":") + std::wstring(name); CP_XML_NODE(NS_NAME)
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <iostream>
#include <sstream>
#include <stack>
#include <cassert>
namespace cpdoccore
{
namespace xml
{
namespace writer
{
template <class T> struct chars { };
template <>
struct chars<char>
{
static const char eq = '=';
static const char quote = '\"';
static const char space = ' ';
static const char left_brocket = '<';
static const char right_brocket = '>';
static const char slash = '/';
static const char colon = ':';
static const char amp = '&';
static const char apos = '\'';
static const char * cdata_open() { return "<![CDATA["; }
static const char * cdata_close() { return "]]>"; }
static const char * amp_str(){ return "&amp;"; }
static const char * left_brocket_str() { return "&lt;"; }
static const char * right_brocket_str() { return "&gt;"; }
static const char * apos_str() { return "&apos;"; }
static const char * quote_str() { return "&quot;"; }
};
template <>
struct chars<wchar_t>
{
static const wchar_t eq = L'=';
static const wchar_t quote = L'\"';
static const wchar_t space = L' ';
static const wchar_t left_brocket = L'<';
static const wchar_t right_brocket = L'>';
static const wchar_t slash = L'/';
static const wchar_t colon = L':';
static const wchar_t amp = L'&';
static const wchar_t apos = L'\'';
static const wchar_t * cdata_open() { return L"<![CDATA["; }
static const wchar_t * cdata_close() { return L"]]>"; }
static const wchar_t * amp_str(){ return L"&amp;"; }
static const wchar_t * left_brocket_str() { return L"&lt;"; }
static const wchar_t * right_brocket_str() { return L"&gt;"; }
static const wchar_t * apos_str() { return L"&apos;"; }
static const wchar_t * quote_str() { return L"&quot;"; }
};
template <class V>
class element;
//
// xml::writer class
//
template <class T>
class writer
{
public:
// writer must be bound to an ostream
writer(std::basic_ostream<T>& os, bool need_header = false) : level_(0), os_(os), need_header_(need_header) {}
~writer(void) { assert(elements_.empty()); }
private:
size_t level_;
std::basic_ostream<T>& os_; // output stream
bool need_header_; // have we written an XML header yet?
std::stack<element<T>*> elements_; // stack of open element tags
// write XML header, if necessary
writer& header()
{
if (need_header_)
{
// TODO
//os_ << "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
need_header_ = false;
}
return *this;
}
// write a single character to the output stream
writer& putc(T c)
{
os_.put(c);
return *this;
}
// write a string to the output stream
writer& puts(const T* str) {
os_ << str;
return *this;
}
template <class V>
friend class element;
};
//
// xml::element class
//
template <class T>
class element
{
public:
// create a new element tag, bound to an xml::writer
element(writer<T>& wr, std::basic_string<T, std::char_traits<T>, std::allocator<T> > const & name) : wr_(wr), name_(name)
{
wr_.level_++;
check_parent();
wr_.header().putc('<').puts(name_.c_str());
tagopen_ = true;
wr_.elements_.push(this);
}
// close the current element tag
~element()
{
if (!wr_.elements_.empty() && wr_.elements_.top() == this)
{
wr_.elements_.pop();
if (tagopen_)
wr_.putc(chars<T>::slash)
.putc(chars<T>::right_brocket);
else
wr_.putc(chars<T>::left_brocket)
.putc(chars<T>::slash)
.puts(name_.c_str())
.putc(chars<T>::right_brocket);
}
wr_.level_--;
}
// write an attribute for the current element
element& attr(const T* name, const T* value)
{
assert(name != 0);
assert(value != 0);
assert(tagopen_);
wr_.putc(chars<T>::space)
.puts(name)
.putc(chars<T>::eq)
.putc(chars<T>::quote);
qputs(value);
wr_.putc(chars<T>::quote);
return *this;
}
// attr() overload for std::string type
element& attr(const T* name, const std::basic_string<T, std::char_traits<T>, std::allocator<T> >& value)
{
return attr(name, value.c_str());
}
// attr() function template for all streamable types
template <class V>
element& attr(const T* name, V value)
{
std::basic_stringstream<T, std::char_traits<T>, std::allocator<T> > ss;
ss << value;
attr(name, ss.str());
return *this;
}
// write text content for the current element
element& contents(const T* str)
{
assert(str != 0);
check_parent();
qputs(str);
return *this;
}
// contents() overload for std::string type
element& contents(const std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str)
{
return contents(str.c_str());
}
// contents() function template for all streamable types
template <class V>
element& contents(V value)
{
std::basic_stringstream<T, std::char_traits<T>, std::allocator<T> > ss;
ss << value;
contents(ss.str());
return *this;
}
std::basic_ostream<T>& stream()
{
check_parent();
return wr_.os_;
}
// write CDATA section
element& cdata(const T * str)
{
assert(str != 0);
check_parent();
wr_.puts(chars<T>::cdata_open());
wr_.puts(str);
wr_.puts(chars<T>::cdata_close());
return *this;
}
// cdata() overload for std::string type
element& cdata(const std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str)
{
return cdata(str.c_str());
}
private:
writer<T>& wr_; // bound XML writer
//const T* name_; // name of current element
const std::basic_string<T, std::char_traits<T>, std::allocator<T> > name_;
bool tagopen_; // is the element tag for this element still open?
// write a string quoting characters which have meaning in xml
element& qputs(const T* str)
{
for (; *str; ++str)
{
switch (*str)
{
case chars<T>::amp:
wr_.puts(chars<T>::amp_str()); break;
case chars<T>::left_brocket:
wr_.puts(chars<T>::left_brocket_str()); break;
case chars<T>::right_brocket:
wr_.puts(chars<T>::right_brocket_str()); break;
case chars<T>::apos:
wr_.puts(chars<T>::apos_str()); break;
case chars<T>::quote:
wr_.puts(chars<T>::quote_str()); break;
default:
wr_.putc(*str); break;
}
}
return *this;
}
// check to see if we have a parent tag which needs to be closed
void check_parent()
{
if (!wr_.elements_.empty() && wr_.elements_.top()->tagopen_)
{
wr_.putc(chars<T>::right_brocket);
wr_.elements_.top()->tagopen_ = false;
}
}
};
}
}
typedef xml::writer::writer<wchar_t> xml_writer;
typedef xml::writer::element<wchar_t> xml_element;
#define CP_XML_WRITER(STRM) if (bool _b_ = false) {} else for (xml_writer _xml_wr_((STRM));!_b_;_b_=true)
#define CP_XML_NODE(NAME) if (bool _b_ = false) {} else for (xml_element _xml_node_(_xml_wr_, (NAME));!_b_;_b_=true)
#define CP_XML_ATTR(NAME, VAL) _xml_node_.attr((NAME),(VAL))
#define CP_XML_CONTENT(VAL) _xml_node_.contents((VAL))
#define CP_XML_STREAM() _xml_node_.stream()
#define CP_GET_XML_NODE() _xml_node_
#define CP_ATTR_NODE xml_element & _xml_node_
#define CP_XML_ATTR_OPT(NAME, VAL) if (VAL)CP_XML_ATTR(NAME, (*VAL))
#define CP_XML_NODE_SIMPLE() std::wstring NS_NAME = std::wstring(ns) + std::wstring(L":") + std::wstring(name); CP_XML_NODE(NS_NAME)
}

View File

@ -1,70 +1,70 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
namespace cpdoccore {
namespace xml {
namespace utils {
namespace details {
std::wstring replace_text_to_xml_ImplRegEx(const std::wstring & Text);
std::string replace_text_to_xml_ImplRegEx(const std::string & Text);
std::wstring replace_xml_to_text_ImplRegEx(const std::wstring & Text);
std::string replace_xml_to_text_ImplRegEx(const std::string & Text);
std::wstring replace_text_to_xml_ImplReplace(const std::wstring & Text);
std::string replace_text_to_xml_ImplReplace(const std::string & Text);
std::wstring replace_amp_text_to_xml_ImplReplace(const std::wstring & Text);
std::string replace_amp_text_to_xml_ImplReplace(const std::string & Text);
std::wstring replace_xml_to_text_ImplReplace(const std::wstring & Text);
std::string replace_xml_to_text_ImplReplace(const std::string & Text);
}
std::wstring replace_text_to_xml(const std::wstring & Text);
std::string replace_text_to_xml(const std::string & Text);
std::wstring replace_amp_text_to_xml(const std::wstring & Text);
std::wstring replace_lt_gt(const std::wstring & Text);
std::wstring replace_xml_to_text(const std::wstring & Text);
std::string replace_xml_to_text(const std::string & Text);
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
namespace cpdoccore {
namespace xml {
namespace utils {
namespace details {
std::wstring replace_text_to_xml_ImplRegEx(const std::wstring & Text);
std::string replace_text_to_xml_ImplRegEx(const std::string & Text);
std::wstring replace_xml_to_text_ImplRegEx(const std::wstring & Text);
std::string replace_xml_to_text_ImplRegEx(const std::string & Text);
std::wstring replace_text_to_xml_ImplReplace(const std::wstring & Text);
std::string replace_text_to_xml_ImplReplace(const std::string & Text);
std::wstring replace_amp_text_to_xml_ImplReplace(const std::wstring & Text);
std::string replace_amp_text_to_xml_ImplReplace(const std::string & Text);
std::wstring replace_xml_to_text_ImplReplace(const std::wstring & Text);
std::string replace_xml_to_text_ImplReplace(const std::string & Text);
}
std::wstring replace_text_to_xml(const std::wstring & Text);
std::string replace_text_to_xml(const std::string & Text);
std::wstring replace_amp_text_to_xml(const std::wstring & Text);
std::wstring replace_lt_gt(const std::wstring & Text);
std::wstring replace_xml_to_text(const std::wstring & Text);
std::string replace_xml_to_text(const std::string & Text);
}
}
}

View File

@ -1,101 +1,101 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
namespace cpdoccore {
namespace xml {
template <class ElemT>
class xml_char
{
public:
//static const ElemT eq;
//static const ElemT quote;
//static const ElemT space;
//static const ElemT left_brocket;
//static const ElemT right_brocket;
//static const ElemT slash;
//static const ElemT colon;
//static const ElemT * openTag;
//static const ElemT * closeTag;
//static const ElemT * endTag;
//static const ElemT * trueVal;
//static const ElemT * falseVal;
};
template <>
class xml_char<char>
{
public:
static const char eq;
static const char quote;
static const char space;
static const char left_brocket;
static const char right_brocket;
static const char slash;
static const char colon;
static const char * openTag;
static const char * closeTag;
static const char * endTag;
static const char * trueVal;
static const char * falseVal;
};
template <>
class xml_char<wchar_t>
{
public:
static const wchar_t eq;
static const wchar_t quote;
static const wchar_t space;
static const wchar_t left_brocket;
static const wchar_t right_brocket;
static const wchar_t slash;
static const wchar_t colon;
static const wchar_t * openTag;
static const wchar_t * closeTag;
static const wchar_t * endTag;
static const wchar_t * trueVal;
static const wchar_t * falseVal;
};
typedef xml_char<char> xml_char_c;
typedef xml_char<wchar_t> xml_char_wc;
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
namespace cpdoccore {
namespace xml {
template <class ElemT>
class xml_char
{
public:
//static const ElemT eq;
//static const ElemT quote;
//static const ElemT space;
//static const ElemT left_brocket;
//static const ElemT right_brocket;
//static const ElemT slash;
//static const ElemT colon;
//static const ElemT * openTag;
//static const ElemT * closeTag;
//static const ElemT * endTag;
//static const ElemT * trueVal;
//static const ElemT * falseVal;
};
template <>
class xml_char<char>
{
public:
static const char eq;
static const char quote;
static const char space;
static const char left_brocket;
static const char right_brocket;
static const char slash;
static const char colon;
static const char * openTag;
static const char * closeTag;
static const char * endTag;
static const char * trueVal;
static const char * falseVal;
};
template <>
class xml_char<wchar_t>
{
public:
static const wchar_t eq;
static const wchar_t quote;
static const wchar_t space;
static const wchar_t left_brocket;
static const wchar_t right_brocket;
static const wchar_t slash;
static const wchar_t colon;
static const wchar_t * openTag;
static const wchar_t * closeTag;
static const wchar_t * endTag;
static const wchar_t * trueVal;
static const wchar_t * falseVal;
};
typedef xml_char<char> xml_char_c;
typedef xml_char<wchar_t> xml_char_wc;
}
}

View File

@ -1,102 +1,102 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <iosfwd>
#include <sstream>
#include "nodetype.h"
namespace cpdoccore {
namespace xml {
class attributes;
template <class CharT>
class element
{
public:
virtual const CharT * get_ns() const = 0;
virtual const CharT * get_name() const = 0;
virtual NodeType get_xml_type() const = 0;
virtual std::basic_ostream<CharT> & text_to_stream(std::basic_ostream<CharT> & _Wostream) const
{
return _Wostream;
}
virtual std::basic_ostream<CharT> & xml_to_stream(std::basic_ostream<CharT> & _Wostream) const = 0;
std::basic_string<CharT> text_to_string() const;
std::basic_string<CharT> xml_to_string() const;
virtual ~element() = 0;
// virtual const attributes< std::basic_string<CharT> > * get_attributes() const = 0;
};
template <class CharT>
inline element<CharT>::~element()
{}
typedef element<char> element_c;
typedef element<wchar_t> element_wc;
template <class Element, class CharT = wchar_t>
class element_impl : public element<CharT>
{
public:
virtual const CharT * get_ns() const { return Element::ns; }
virtual const CharT * get_name() const { return Element::name; }
virtual NodeType get_xml_type() const { return Element::xml_type; };
// virtual const attributes< std::basic_string<CharT> > * get_attributes() const = 0;
};
template <class CharT>
inline std::basic_string<CharT> element<CharT>::text_to_string() const
{
std::basic_stringstream<CharT> strm;
text_to_stream(strm);
return strm.str();
}
template <class CharT>
inline std::basic_string<CharT> element<CharT>::xml_to_string() const
{
std::basic_stringstream<CharT> strm;
xml_to_stream(strm);
return strm.str();
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <iosfwd>
#include <sstream>
#include "nodetype.h"
namespace cpdoccore {
namespace xml {
class attributes;
template <class CharT>
class element
{
public:
virtual const CharT * get_ns() const = 0;
virtual const CharT * get_name() const = 0;
virtual NodeType get_xml_type() const = 0;
virtual std::basic_ostream<CharT> & text_to_stream(std::basic_ostream<CharT> & _Wostream) const
{
return _Wostream;
}
virtual std::basic_ostream<CharT> & xml_to_stream(std::basic_ostream<CharT> & _Wostream) const = 0;
std::basic_string<CharT> text_to_string() const;
std::basic_string<CharT> xml_to_string() const;
virtual ~element() = 0;
// virtual const attributes< std::basic_string<CharT> > * get_attributes() const = 0;
};
template <class CharT>
inline element<CharT>::~element()
{}
typedef element<char> element_c;
typedef element<wchar_t> element_wc;
template <class Element, class CharT = wchar_t>
class element_impl : public element<CharT>
{
public:
virtual const CharT * get_ns() const { return Element::ns; }
virtual const CharT * get_name() const { return Element::name; }
virtual NodeType get_xml_type() const { return Element::xml_type; };
// virtual const attributes< std::basic_string<CharT> > * get_attributes() const = 0;
};
template <class CharT>
inline std::basic_string<CharT> element<CharT>::text_to_string() const
{
std::basic_stringstream<CharT> strm;
text_to_stream(strm);
return strm.str();
}
template <class CharT>
inline std::basic_string<CharT> element<CharT>::xml_to_string() const
{
std::basic_stringstream<CharT> strm;
xml_to_stream(strm);
return strm.str();
}
}
}

View File

@ -77,6 +77,7 @@ SOURCES += \
../src/odf/office_settings.cpp \
../src/odf/office_spreadsheet.cpp \
../src/odf/office_text.cpp \
../src/odf/office_meta.cpp \
../src/odf/paragraph_elements.cpp \
../src/odf/ruby.cpp \
../src/odf/search_table_cell.cpp \
@ -185,6 +186,7 @@ SOURCES += \
../src/odf/datatypes/styleverticalrel.cpp \
../src/odf/datatypes/stylewrap.cpp \
../src/odf/datatypes/stylewrapcontourmode.cpp \
../src/odf/datatypes/stylenumformat.cpp \
../src/odf/datatypes/tablealign.cpp \
../src/odf/datatypes/tablecentering.cpp \
../src/odf/datatypes/tablemode.cpp \
@ -212,6 +214,7 @@ SOURCES += \
../src/odf/datatypes/tablefunction.cpp \
../src/odf/datatypes/tableorder.cpp \
../src/odf/datatypes/dategroup.cpp \
../src/odf/datatypes/bibliography \
../src/odfcommandtype.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
@ -341,6 +344,7 @@ HEADERS += \
../src/odf/office_settings.h \
../src/odf/office_spreadsheet.h \
../src/odf/office_text.h \
../src/odf/office_meta.h \
../src/odf/paragraph_elements.h \
../src/odf/ruby.h \
../src/odf/search_table_cell.h \
@ -449,6 +453,7 @@ HEADERS += \
../src/odf/datatypes/styleverticalpos.h \
../src/odf/datatypes/styleverticalrel.h \
../src/odf/datatypes/stylewrap.h \
../src/odf/datatypes/stylenumformat.h \
../src/odf/datatypes/stylewrapcontourmode.h \
../src/odf/datatypes/tablealign.h \
../src/odf/datatypes/tablecentering.h \
@ -552,27 +557,27 @@ HEADERS += \
../src/docx/xlsx_utils.h \
../src/docx/xlsx_xf.h \
../include/logging.h \
../include/cpdoccore/CPColorUtils.h \
../include/cpdoccore/CPNoncopyable.h \
../include/cpdoccore/CPOptional.h \
../include/cpdoccore/CPScopedPtr.h \
../include/cpdoccore/CPSharedPtr.h \
../include/cpdoccore/CPString.h \
../include/cpdoccore/CPWeakPtr.h \
../include/cpdoccore/common/readdocelement.h \
../include/cpdoccore/common/readstring.h \
../include/cpdoccore/common/writedocelement.h \
../include/cpdoccore/odf/odf_document.h \
../include/cpdoccore/odf/odfformat.h \
../include/cpdoccore/utf8cpp/utf8/checked.h \
../include/cpdoccore/utf8cpp/utf8/core.h \
../include/cpdoccore/utf8cpp/utf8/unchecked.h \
../include/cpdoccore/utf8cpp/utf8.h \
../include/cpdoccore/xml/attributes.h \
../include/cpdoccore/xml/nodetype.h \
../include/cpdoccore/xml/sax.h \
../include/cpdoccore/xml/simple_xml_writer.h \
../include/cpdoccore/xml/utils.h \
../include/cpdoccore/xml/xmlchar.h \
../include/cpdoccore/xml/xmlelement.h
../include/CPColorUtils.h \
../include/CPNoncopyable.h \
../include/CPOptional.h \
../include/CPScopedPtr.h \
../include/CPSharedPtr.h \
../include/CPString.h \
../include/CPWeakPtr.h \
../include/common/readdocelement.h \
../include/common/readstring.h \
../include/common/writedocelement.h \
../include/odf/odf_document.h \
../include/odf/odfformat.h \
../include/utf8cpp/utf8/checked.h \
../include/utf8cpp/utf8/core.h \
../include/utf8cpp/utf8/unchecked.h \
../include/utf8cpp/utf8.h \
../include/xml/attributes.h \
../include/xml/nodetype.h \
../include/xml/sax.h \
../include/xml/simple_xml_writer.h \
../include/xml/utils.h \
../include/xml/xmlchar.h \
../include/xml/xmlelement.h

View File

@ -67,6 +67,7 @@
#include "../src/odf/office_settings.cpp"
#include "../src/odf/office_spreadsheet.cpp"
#include "../src/odf/office_text.cpp"
#include "../src/odf/office_meta.cpp"
#include "../src/odf/paragraph_elements.cpp"
#include "../src/odf/ruby.cpp"
#include "../src/odf/search_table_cell.cpp"

View File

@ -128,3 +128,5 @@
#include "../src/odf/datatypes/tableorder.cpp"
#include "../src/odf/datatypes/dategroup.cpp"
#include "../src/odf/datatypes/commandtype.cpp"
#include "../src/odf/datatypes/stylenumformat.cpp"
#include "../src/odf/datatypes/bibliography.cpp"

View File

@ -41,7 +41,7 @@
#include "../src/docx/pptx_conversion_context.h"
#include "../src/docx/xlsxconversioncontext.h"
#include "../include/cpdoccore/odf/odf_document.h"
#include "../include/odf/odf_document.h"
int ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
{

View File

@ -29,7 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../../include/cpdoccore/CPString.h"
#include "../../include/CPString.h"
#include "../../../DesktopEditor/common/File.h"
namespace cpdoccore {

View File

@ -30,9 +30,9 @@
*
*/
#include "../../include/cpdoccore/common/readdocelement.h"
#include "../../include/cpdoccore/xml/attributes.h"
#include "../../include/cpdoccore/xml/sax.h"
#include "../../include/common/readdocelement.h"
#include "../../include/xml/attributes.h"
#include "../../include/xml/sax.h"
namespace cpdoccore {
namespace common {

View File

@ -31,8 +31,8 @@
*/
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/attributes.h>
#include <xml/simple_xml_writer.h>
#include "docx_content_type.h"
#include "namespaces.h"

View File

@ -33,7 +33,7 @@
#include <string>
#include <iosfwd>
#include <cpdoccore/xml/xmlelement.h>
#include <xml/xmlelement.h>
namespace cpdoccore {
namespace oox {

View File

@ -35,9 +35,9 @@
#include <iostream>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/utils.h>
#include <odf/odf_document.h>
#include <xml/simple_xml_writer.h>
#include "docx_conversion_context.h"
@ -334,29 +334,121 @@ void docx_conversion_context::end_math_formula()
output_stream() << L"<m:oMath>" << math_content << L"</m:oMath>";
}
}
void docx_conversion_context::start_table_content()
void docx_conversion_context::start_sdt(int type)
{
in_table_content_ = true;
output_stream() << L"<w:sdt>";
output_stream() << L"<w:sdtPr>";
//output_stream() << L"<w:id w:val=\"-505364165\"/>";
output_stream() << L"<w:docPartObj>";
output_stream() << L"<w:docPartGallery w:val=\"Table of Contents\"/>";
output_stream() << L"<w:docPartUnique/>";
output_stream() << L"</w:docPartObj>";
output_stream() << L"</w:sdtPr>";
output_stream() << L"<w:sdtContent>";
table_content_context_.type_table_content = type;
if (table_content_context_.type_table_content < 4)
{
output_stream() << L"<w:sdt><w:sdtPr>";
if (table_content_context_.type_table_content == 3)
{
output_stream() << L"<w:bibliography/>";
}
else
{
output_stream() << L"<w:docPartObj><w:docPartGallery w:val=\"";
if (table_content_context_.type_table_content == 1) output_stream() << L"Table of Contents";
if (table_content_context_.type_table_content == 2) output_stream() << L"List od Illustrations";
output_stream() << L"\"/><w:docPartUnique/></w:docPartObj>";
}
output_stream() << L"</w:sdtPr><w:sdtContent>";
}
}
void docx_conversion_context::end_table_content()
void docx_conversion_context::start_index_content()
{
if (!in_table_content_) return;
output_stream() << L"</w:sdtContent>";
output_stream() << L"</w:sdt>";
start_paragraph(false);
std::wstring sInstrText;
switch(table_content_context_.type_table_content)
{
case 1: sInstrText += L" TOC \\f \\h \\u"; break;
case 2:
case 4:
case 6:
case 7: sInstrText += L" TOC \\h \\z"; break;
case 5: sInstrText += L" INDEX \\z"; break;
case 3: sInstrText += L" BIBLIOGRAPHY"; break;
}
if (table_content_context_.min_outline_level > 0)
{
if (table_content_context_.max_outline_level > 9)
table_content_context_.max_outline_level = 9;
sInstrText += L" \\o \"" + std::to_wstring(table_content_context_.min_outline_level) + L"-" +
std::to_wstring(table_content_context_.max_outline_level) + L"\" ";
}
/*\\l 1-3*/
if (!table_content_context_.caption_sequence_name.empty())
{
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\"";
}
output_stream() << L"<w:r>";
output_stream() << L"<w:fldChar w:fldCharType=\"begin\"/>";
output_stream() << L"</w:r>";
output_stream() << L"<w:r>";
output_stream() << L"<w:instrText xml:space=\"preserve\">" << sInstrText << L" </w:instrText>";
output_stream() << L"</w:r>";
output_stream() << L"<w:r>";
//output_stream() << L"<w:rPr>
//output_stream() << L"<w:rFonts w:ascii="Minion Pro" w:eastAsia="DejaVuSans" w:hAnsi="Minion Pro"/>
//output_stream() << L"<w:bCs w:val="0"/>
//output_stream() << L"<w:sz w:val="21"/>
//output_stream() << L"<w:szCs w:val="24"/>
//output_stream() << L"</w:rPr>
output_stream() << L"<w:fldChar w:fldCharType=\"separate\"/>";
output_stream() << L"</w:r>";
finish_paragraph();
}
void docx_conversion_context::end_index_content()
{
if (!in_table_content_) return;
start_paragraph(false);
output_stream() << L"<w:r>";
//output_stream() << L"<w:rPr>";
//output_stream() << L"<w:rFonts w:ascii="Minion Pro" w:hAnsi="Minion Pro"/>";
//output_stream() << L"<w:sz w:val="20"/>
//output_stream() << L"</w:rPr>";
output_stream() << L"<w:fldChar w:fldCharType=\"end\"/>";
output_stream() << L"</w:r>";
finish_paragraph();
}
void docx_conversion_context::end_sdt()
{
if (!in_table_content_) return;
if (table_content_context_.type_table_content < 4)
{
output_stream() << L"</w:sdtContent></w:sdt>";
}
in_table_content_ = false;
table_content_context_.clear_all();
}
void docx_conversion_context::start_index_element()
{
table_content_context_.clear_current_content_template_index();
}
void docx_conversion_context::end_index_element()
{
table_content_context_.clear_current_content_template_index();
}
void docx_conversion_context::add_bibliography_item (const std::wstring & item)
{
arBibliography.push_back(item);
}
void docx_conversion_context::start_bookmark (const std::wstring &name)
{
@ -394,6 +486,64 @@ void docx_conversion_context::end_bookmark (const std::wstring &name)
output_stream() << L"<w:bookmarkEnd w:id=\"" << std::to_wstring(id) << L"\"/>";
}
void docx_conversion_context::start_alphabetical_index (const std::wstring &id)
{
std::map<std::wstring, std::vector<odf_reader::office_element_ptr>>::iterator pFind = mapAlphabeticals.find(id);
if (pFind != mapAlphabeticals.end()) return;
std::vector<odf_reader::office_element_ptr> texts;
mapAlphabeticals.insert(std::make_pair(id, texts));
current_alphabetic_index_ = id;
}
void docx_conversion_context::add_alphabetical_index_text (odf_reader::office_element_ptr & elem)
{
std::map<std::wstring, std::vector<odf_reader::office_element_ptr>>::iterator pFind = mapAlphabeticals.find(current_alphabetic_index_);
if (pFind == mapAlphabeticals.end())
{
return;
}
pFind->second.push_back(elem);
}
void docx_conversion_context::end_alphabetical_index (const std::wstring &id)
{
std::map<std::wstring, std::vector<odf_reader::office_element_ptr>>::iterator pFind = mapAlphabeticals.find(id);
if (pFind == mapAlphabeticals.end())
{
return;
}
finish_run();
output_stream() << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
output_stream() << L"<w:r><w:instrText>XE \"";
ElementType type;
for (size_t i = 0; i < pFind->second.size(); i++)
{
type = pFind->second[i]->get_type();
pFind->second[i]->text_to_stream(output_stream());
}
output_stream() << L"\"</w:instrText></w:r>";
output_stream() << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
for (size_t i = 0; i < pFind->second.size(); i++)
{
pFind->second[i]->docx_convert(*this);
}
mapAlphabeticals.erase(pFind);
if (mapAlphabeticals.empty())
current_alphabetic_index_.clear();
else
current_alphabetic_index_ = mapAlphabeticals.begin()->first; // todooo vector+map+level
}
void docx_conversion_context::start_chart(std::wstring name)
{
charts_.push_back(oox_chart_context_ptr(new oox_chart_context(mediaitems_, name)));
@ -496,7 +646,7 @@ void docx_conversion_context::end_document()
output_stream() << L"</w:document>";
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml",dump_settings_document()));
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml", dump_settings_document()));
output_document_->get_word_files().set_media ( mediaitems_, applicationFonts_);
output_document_->get_word_files().set_comments ( comments_context_);
output_document_->get_word_files().set_headers_footers( headers_footers_);
@ -505,6 +655,7 @@ void docx_conversion_context::end_document()
content_file_.set_media( mediaitems_);
////////////////////////////////////////////////////////////////////////////
dump_bibliography();
dump_hyperlinks (notes_context_.footnotesRels(), hyperlinks::footnote_place);
dump_hyperlinks (notes_context_.endnotesRels(), hyperlinks::endnote_place);
@ -521,13 +672,66 @@ void docx_conversion_context::end_document()
}
////////////////////////////////
//content->add_rel(relationship(dId, kType, dName));
output_document_->get_word_files().update_rels(*this);
/////////////////////////////////////
}
void docx_conversion_context::dump_bibliography()
{
if (arBibliography.empty()) return;
std::wstringstream output(L"");
CP_XML_WRITER(output)
{
CP_XML_NODE(L"b:Sources")
{
CP_XML_ATTR(L"Version", 6);
CP_XML_ATTR(L"StyleName", L"APA");
CP_XML_ATTR(L"SelectedStyle", L"\\APASixthEditionOfficeOnline.xsl");
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography");
CP_XML_ATTR(L"xmlns:b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography");
for (size_t i = 0; i < arBibliography.size(); i++)
{
CP_XML_NODE(L"b:Source")
{
CP_XML_STREAM() << arBibliography[i];
CP_XML_NODE(L"b:RefOrder")
{
CP_XML_STREAM() << std::to_wstring(i + 1);
}
}
}
}
}
std::wstringstream output_props(L"");
CP_XML_WRITER(output_props)
{
CP_XML_NODE(L"ds:datastoreItem")
{
CP_XML_ATTR(L"xmlns:ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml");
CP_XML_ATTR(L"ds:itemID", L"{28C8D49A-D84A-4837-A0AC-8E2C3AE46B82}");
CP_XML_NODE(L"ds:schemaRefs")
{
CP_XML_NODE(L"ds:schemaRef")
{
CP_XML_ATTR(L"ds:uri", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography");
}
}
}
}
package::customXml_content_ptr content = package::customXml_content::create(output.str(), output_props.str());
int id = output_document_->add_customXml(content);
const std::wstring sRId = std::wstring(L"cstId") + std::to_wstring(id);
const std::wstring sRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml";
const std::wstring sFileRef = std::wstring(L"../customXml/item") + std::to_wstring(id) + L".xml";
output_document_->get_word_files().add_rels(relationship(sRId, sRel, sFileRef));
}
std::wstring docx_conversion_context::dump_settings_document()
{
@ -551,21 +755,25 @@ std::wstring docx_conversion_context::dump_settings_document()
_CP_OPT(std::wstring) strVal;
_CP_OPT(int) intVal;
if (odf_reader::GetProperty(settings_properties_,L"evenAndOddHeaders",boolVal))
if (odf_reader::GetProperty(settings_properties_,L"evenAndOddHeaders", boolVal))
{
CP_XML_NODE(L"w:evenAndOddHeaders");
}
if (odf_reader::GetProperty(settings_properties_,L"displayBackgroundShape",boolVal))
if (odf_reader::GetProperty(settings_properties_,L"displayBackgroundShape", boolVal))
{
CP_XML_NODE(L"w:displayBackgroundShape");
}
if (odf_reader::GetProperty(settings_properties_,L"zoom",intVal))
if (odf_reader::GetProperty(settings_properties_,L"zoom", intVal))
{
CP_XML_NODE(L"w:zoom")
{
CP_XML_ATTR(L"w:percent",intVal.get());
}
}
if (odf_reader::GetProperty(settings_properties_,L"mirrorMargins", boolVal))
{
CP_XML_NODE(L"w:mirrorMargins");
}
}
}
return output.str();
@ -945,7 +1153,7 @@ bool docx_conversion_context::process_page_properties(std::wostream & strm)
if (page_layout_instance_)
{
page_layout_instance_->docx_serialize(strm, *this);
page_layout_instance_->docx_serialize(strm, *this);
}
else
{
@ -1054,7 +1262,8 @@ void docx_conversion_context::start_automatic_style(const std::wstring & ParentI
void docx_conversion_context::end_automatic_style()
{
in_automatic_style_ = false;
automatic_parent_style_ = L"";
automatic_parent_style_.clear();
tabs_context_.clear();
}
bool docx_conversion_context::in_automatic_style()
@ -1258,7 +1467,11 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
if (false == Attr->text_style_name_.empty())
{
if (odf_reader::style_instance * styleInst =
if (in_table_content_ && Attr->text_style_name_.empty())
{
table_content_context_.set_current_level(Attr->text_style_name_);
}
if (odf_reader::style_instance * styleInst =
root()->odf_context().styleContainer().style_by_name(Attr->text_style_name_, odf_types::style_family::Paragraph, process_headers_footers_)
)
{
@ -1268,33 +1481,39 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
if (odf_reader::style_content * styleContent = styleInst->content())
{
std::wstring id;
//office_element_ptr parent_tab_stops_;
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
{
id = styles_map_.get( parentStyleContent->name(), parentStyleContent->type() );
std::wstring parent_name = parentStyleContent->name();
id = styles_map_.get( parent_name, parentStyleContent->type() );
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
{
table_content_context_.set_current_level(parent_name);
}
}
start_automatic_style(id);
{//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
if (properties.style_writing_mode_)
odf_reader::calc_tab_stops(styleInst, get_tabs_context());
//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
if (properties.style_writing_mode_)
{
odf_types::writing_mode::type type = properties.style_writing_mode_->get_type();
switch(type)
{
odf_types::writing_mode::type type = properties.style_writing_mode_->get_type();
switch(type)
{
case odf_types::writing_mode::RlTb:
case odf_types::writing_mode::TbRl:
case odf_types::writing_mode::Rl:
set_rtl(true);
break;
default:
set_rtl(false);
}
case odf_types::writing_mode::RlTb:
case odf_types::writing_mode::TbRl:
case odf_types::writing_mode::Rl:
set_rtl(true);
break;
default:
set_rtl(false);
}
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
//for calculate tabs
}
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
styleContent->docx_convert(*this);
@ -1407,7 +1626,7 @@ void docx_conversion_context::process_page_break_after(const odf_reader::style_i
{
if (inst->content() && inst->content()->get_style_paragraph_properties())
{
_CP_OPT(odf_types::fo_break) fo_break_val = inst->content()->get_style_paragraph_properties()->content().fo_break_after_;
_CP_OPT(odf_types::fo_break) fo_break_val = inst->content()->get_style_paragraph_properties()->content_.fo_break_after_;
if (fo_break_val)
{
if (fo_break_val->get_type() == odf_types::fo_break::Page)
@ -1611,7 +1830,7 @@ void docx_conversion_context::add_note_reference ()
typedef std::map<std::wstring, text_tracked_context::_state>::iterator map_changes_iterator;
void docx_conversion_context::start_text_changes (std::wstring id)
void docx_conversion_context::start_text_changes (const std::wstring &id)
{
text_tracked_context::_state &state_add = text_tracked_context_.get_tracked_change(id);
if (state_add.id != id) return;
@ -1778,7 +1997,7 @@ void docx_conversion_context::end_changes()
text_tracked_context_.dumpPPr_.clear();
text_tracked_context_.dumpRPr_.clear();
}
void docx_conversion_context::end_text_changes (std::wstring id)
void docx_conversion_context::end_text_changes (const std::wstring &id)
{
if (map_current_changes_.empty()) return;
@ -1803,6 +2022,7 @@ void docx_conversion_context::add_user_field(const std::wstring & name, const st
{
map_user_fields.insert(std::make_pair(name, value));
}
std::wstring docx_conversion_context::get_user_field(const std::wstring & name)
{
std::map<std::wstring, std::wstring>::iterator pFind = map_user_fields.find(name);

View File

@ -222,6 +222,7 @@ public:
{
current_level_--;
frames_.pop_back();
caption_.clear();
}
std::wstring & get_text_stream_frame()
@ -257,6 +258,7 @@ public:
current_shape_ = NULL;
shape_text_content_.clear();
current_shape_id_ = 0;
caption_.clear();
}
void stop_control()
{
@ -264,6 +266,7 @@ public:
current_control_ = NULL;
shape_text_content_.clear();
current_shape_id_ = 0;
caption_.clear();
}
void stop_group()
{
@ -288,6 +291,11 @@ public:
else return NULL;
}
odf_reader::draw_shape * get_current_shape() const { return current_shape_; }
void set_next_object_caption(const std::wstring & value)
{
caption_ = value;
}
private:
std::wstring shape_text_content_;
@ -306,6 +314,7 @@ private:
odf_reader::draw_control*current_control_;
std::wstring zero_string_;
std::wstring caption_;
};
@ -604,6 +613,152 @@ private:
_state current_state_;
std::map<std::wstring, _state> mapElements_;
};
class table_content_context
{
public:
table_content_context()
{
clear_all();
}
enum template_type
{
TableContent = 1,
Illustrations = 2,
Bibliography = 3,
Tables = 4
};
enum level_type
{
Span = 1,
Text = 2,
LinkStart = 3,
LinkEnd = 4,
TabStop = 5,
PageNumber = 6,
Chapter = 7
};
struct _state
{
std::wstring name;
int outline_level = -1;
std::vector<int> content;
void clear()
{
name.clear();
content.clear();
outline_level = -1;
}
};
void start_template(int type)
{
current_template.clear();
type_table_content = type;
}
void end_template()
{
}
void start_level(const std::wstring& style_name)
{
current_state.name = style_name;
}
void add_level_content(int type)
{
current_state.content.push_back(type);
}
void set_outline_level(int level)
{
if (min_outline_level == -1 || min_outline_level > level)
min_outline_level = level;
if (max_outline_level == -1 || max_outline_level < level)
max_outline_level = level;
current_state.outline_level = level;
}
void end_level()
{
current_template.insert(std::make_pair(current_state.name, current_state));
current_state.clear();
}
void set_current_level(const std::wstring &name)
{
std::map<std::wstring, _state>::iterator pFind = current_template.find(name);
if (pFind == current_template.end())
{
current_content_template_.clear();
}
current_content_template_ = pFind->second.content;
current_content_template_index_ = 0;
}
void next_level_index()
{
current_content_template_index_++;
}
int get_type_current_content_template_index()
{
if (current_content_template_index_ < (int)current_content_template_.size() && current_content_template_index_ >= 0)
return current_content_template_[current_content_template_index_];
return 0;
}
void clear_current_content_template_index()
{
current_content_template_index_ = 0;
current_content_template_.clear();
}
bool empty_current_table_content_level_index()
{
return current_content_template_.empty();
}
void clear_all()
{
type_table_content = 0;
current_content_template_index_ = 0;
current_content_template_.clear();
current_template.clear();
current_state.clear();
caption_sequence_name.clear();
min_outline_level = -1;
max_outline_level = -1;
}
void add_sequence(const std::wstring & name, int outline_level)
{
//sequences.insert(std::make_pair(name, outline_level));
sequences.push_back(name);
}
std::wstring get_sequence (const std::wstring & ref)
{
for (size_t i = 0; i < sequences.size(); i++)
{
if (std::wstring:: npos != ref.find(sequences[i]))
{
return sequences[i];
}
}
return L"";
}
std::wstring caption_sequence_name;
int type_table_content;
int min_outline_level;
int max_outline_level;
private:
std::vector<int> current_content_template_;
int current_content_template_index_;
std::map<std::wstring, _state> current_template;
_state current_state;
//std::map<std::wstring, int> sequences;
std::vector<std::wstring> sequences;
};
//---------------------------------------------------------------------------------------------------------
class docx_conversion_context : boost::noncopyable
{
@ -624,10 +779,11 @@ public:
return temp_stream_;
}
void add_bibliography_item (const std::wstring & item);
void add_user_field (const std::wstring & name, const std::wstring & value);
std::wstring get_user_field (const std::wstring & name);
void add_element_to_run (std::wstring parenStyleId = _T(""));
void add_element_to_run (std::wstring parenStyleId = _T(""));
void finish_run ();
void add_new_run (std::wstring parentStyleId = _T(""));
bool get_run_state () { return in_run_; }
@ -636,6 +792,7 @@ public:
void start_paragraph (bool is_header = false);
void finish_paragraph ();
bool is_alphabetical_index () { return false == mapAlphabeticals.empty();}
bool is_table_content () { return in_table_content_; }
bool is_paragraph_header () { return in_header_; }
bool get_paragraph_state () { return in_paragraph_; }
@ -656,6 +813,7 @@ public:
void dump_headers_footers (rels & Rels) const;
void dump_notes (rels & Rels) const;
void dump_bibliography();
std::wstring dump_settings_document();
bool next_dump_page_properties_;
@ -675,8 +833,14 @@ public:
void start_office_text ();
void end_office_text ();
void start_table_content ();
void end_table_content ();
void start_sdt (int type);
void end_sdt ();
void start_index_content();
void end_index_content();
void start_index_element();
void end_index_element();
void process_styles ();
void process_fonts ();
@ -752,6 +916,9 @@ public:
notes_context & get_notes_context() { return notes_context_; }
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
text_forms_context & get_forms_context() { return text_forms_context_; }
tabs_context & get_tabs_context() { return tabs_context_;}
table_content_context & get_table_content_context() { return table_content_context_;}
void docx_convert_delayed ();
void add_delayed_element (odf_reader::office_element * Elm);
@ -782,12 +949,16 @@ public:
void start_math_formula ();
void end_math_formula ();
void start_text_changes (std::wstring id);
void end_text_changes (std::wstring id);
void start_text_changes (const std::wstring &id);
void end_text_changes (const std::wstring &id);
void start_bookmark (const std::wstring &name);
void end_bookmark (const std::wstring &name);
void start_alphabetical_index (const std::wstring &id);
void end_alphabetical_index (const std::wstring &id);
void add_alphabetical_index_text (odf_reader::office_element_ptr & elem);
void set_process_headers_footers(bool Val) { process_headers_footers_ = Val; }
headers_footers & get_headers_footers() { return headers_footers_; }
header_footer_context & get_header_footer_context() { return header_footer_context_; }
@ -813,6 +984,7 @@ private:
std::wstringstream footer_xml_;
std::wstringstream header_xml_;
std::wstringstream settings_xml_;
std::wstringstream meta_xml_;
styles_context styles_context_;
math_context math_context_;
@ -825,6 +997,8 @@ private:
notes_context notes_context_;
text_tracked_context text_tracked_context_;
text_forms_context text_forms_context_;
tabs_context tabs_context_;
table_content_context table_content_context_;
boost::shared_ptr<streams_man> streams_man_;
@ -859,18 +1033,23 @@ private:
bool is_rtl_; // right-to-left
bool is_paragraph_keep_;
std::wstring current_alphabetic_index_;
int current_margin_left_;
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
NoteType process_note_;
std::vector<odf_reader::office_element*> delayed_elements_;
std::vector<odf_reader::office_element*> delayed_elements_;
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
std::map<std::wstring, text_tracked_context::_state> map_current_changes_;
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;// цепочки переименований нумераций
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
std::map<std::wstring, text_tracked_context::_state> map_current_changes_;
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;// цепочки переименований нумераций
std::map<std::wstring, std::wstring> map_user_fields;
std::map<std::wstring, int> mapBookmarks;
std::map<std::wstring, std::wstring> map_user_fields;
std::map<std::wstring, int> mapBookmarks;
std::map<std::wstring, std::vector<odf_reader::office_element_ptr>> mapAlphabeticals;
std::vector<std::wstring> arBibliography;
};
}

View File

@ -31,7 +31,7 @@
*/
#include "docx_drawing.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "../odf/datatypes/custom_shape_types_convert.h"
namespace cpdoccore {
@ -209,8 +209,8 @@ void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
CP_XML_NODE(L"pic:cNvPr")
{
//CP_XML_ATTR(L"desc text",L"");
CP_XML_ATTR(L"id",val.id);
CP_XML_ATTR(L"name",val.name);
CP_XML_ATTR(L"id", val.id + 1);
CP_XML_ATTR(L"name", val.name);
}
CP_XML_NODE(L"pic:cNvPicPr")
{
@ -316,7 +316,7 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
CP_XML_NODE(L"wp:docPr")
{
CP_XML_ATTR(L"name", val.name);
CP_XML_ATTR(L"id", val.id + 1);
CP_XML_ATTR(L"id", 0xf000 + val.id + 1);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
@ -398,8 +398,8 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
CP_XML_ATTR(L"cy", val.cy);
}
serialize_null_extent(CP_XML_STREAM());
}
serialize_null_extent(CP_XML_STREAM());
}
else//anchor
{

View File

@ -33,9 +33,9 @@
#include <iosfwd>
#include <iostream>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/attributes.h>
#include <CPScopedPtr.h>
#include <CPOptional.h>
#include <xml/attributes.h>
#include "oox_drawing.h"
#include "mediaitems.h"

View File

@ -124,7 +124,7 @@ void word_files::write(const std::wstring & RootPath)
charts_files_.set_main_document(get_main_document());
charts_files_.write(path);
}
if (notes_)
{
notes_->write( path );
@ -207,7 +207,50 @@ void word_files::set_comments(comments_context & commentsContext)
elm->set_main_document( get_main_document() );
comments_ = element_ptr( elm );
}
///////////////////
void word_files::add_rels(relationship const & r)
{
rels_files_.add(r);
}
//----------------------------------------------------------
int customXml_files::add_customXml(customXml_content_ptr customXml)
{
customXmls_.push_back(customXml);
return customXmls_.size();
}
void customXml_files::write(const std::wstring & RootPath)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"customXml";
NSDirectory::CreateDirectory(path.c_str());
std::wstring path_rels = path + FILE_SEPARATOR_STR + L"_rels";
NSDirectory::CreateDirectory(path_rels.c_str());
for (size_t i = 0 ; i < customXmls_.size(); i++)
{
if (!customXmls_[i]) continue;
const std::wstring fileNameItem = std::wstring(L"item") + std::to_wstring(i+1) + L".xml";
const std::wstring fileNameProps = std::wstring(L"itemProps") + std::to_wstring(i+1) + L".xml";
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/customXml/") + fileNameProps,
L"application/vnd.openxmlformats-officedocument.customXmlProperties+xml");
package::simple_element(fileNameItem, customXmls_[i]->item()).write(path);
package::simple_element(fileNameProps, customXmls_[i]->props()).write(path);
rels_file_ptr rels_file = rels_file::create(fileNameItem + L".rels");
rels_file->get_rels().add(relationship(L"rId1",
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
fileNameProps));
rels_file->write(path_rels);
}
}
//----------------------------------------------------------
void docx_charts_files::add_chart(chart_content_ptr chart)
{
charts_.push_back(chart);
@ -220,7 +263,7 @@ void docx_charts_files::write(const std::wstring & RootPath)
size_t count = 0;
for (int i = 0 ; i < charts_.size(); i++)
for (size_t i = 0 ; i < charts_.size(); i++)
{
if (!charts_[i]) continue;
@ -434,8 +477,10 @@ void comments_elements::write(const std::wstring & RootPath)
docx_document::docx_document()
{
this->set_main_document(this);
word_files_.set_main_document(this);
word_files_.set_main_document(this);
customXml_files_.set_main_document(this);
rels_file_ptr relFile = rels_file_ptr( new rels_file(L".rels") );
relFile->get_rels().relationships().push_back(
relationship(L"rId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", L"docProps/app.xml" )
@ -450,16 +495,18 @@ docx_document::docx_document()
rels_files_.add_rel_file( relFile );
}
int docx_document::add_customXml(customXml_content_ptr customXml)
{
return customXml_files_.add_customXml(customXml);
}
void docx_document::write(const std::wstring & RootPath)
{
if (word_files_.has_numbering())
{
content_type_file_.content()->get_override().push_back( override_content_type(L"/word/numbering.xml",
L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml") );
}
customXml_files_.write (RootPath);
word_files_.write (RootPath);
rels_files_.write (RootPath);
docProps_files_.write (RootPath);

View File

@ -34,7 +34,7 @@
#include <string>
#include <vector>
#include <cpdoccore/CPSharedPtr.h>
#include <CPSharedPtr.h>
#include "oox_rels.h"
#include "docx_content_type.h"
@ -103,8 +103,17 @@ private:
};
// xl_charts_files
class docx_charts_files : public element
class customXml_files : public element
{
public:
customXml_files(){}
int add_customXml(customXml_content_ptr customXml);
virtual void write(const std::wstring & RootPath);
std::vector<customXml_content_ptr> customXmls_;
};
class docx_charts_files : public element
{
public:
docx_charts_files(){}
@ -137,6 +146,8 @@ public:
void add_charts(chart_content_ptr chart);
void add_rels(relationship const & r);
private:
docx_charts_files charts_files_;
rels_files rels_files_;
@ -165,11 +176,13 @@ public:
word_files & get_word_files() { return word_files_; }
virtual content_types_file & get_content_types_file() { return content_type_file_; }
virtual void write(const std::wstring & RootPath);
void write(const std::wstring & RootPath);
int add_customXml(customXml_content_ptr customXml);
private:
docx_content_types_file content_type_file_;
word_files word_files_;
customXml_files customXml_files_;
rels_files rels_files_;
docProps_files docProps_files_;
};

View File

@ -33,16 +33,15 @@
#include "docx_conversion_context.h"
#include "logging.h"
#include <iostream>
#include <cpdoccore/odf/odf_document.h>
#include <odf/odf_document.h>
#include "../odf/odfcontext.h"
namespace cpdoccore {
namespace oox {
/**/
docx_table_state::docx_table_state(docx_conversion_context & Context,
const std::wstring & StyleName) : context_(Context),
docx_table_state::docx_table_state(docx_conversion_context & Context, const std::wstring & StyleName) :
context_(Context),
table_style_(StyleName),
current_table_column_(-1),
columns_spanned_num_(0),
@ -93,6 +92,19 @@ std::wstring docx_table_state::current_row_style() const
return L"";
}
double docx_table_state::get_current_cell_width()
{
if (current_table_column_ < columns_width_.size())
return columns_width_[current_table_column_];
else
return 0;
}
void docx_table_state::add_column_width(double width)
{
columns_width_.push_back(width);
}
void docx_table_state::start_cell()
{
current_table_column_++;
@ -102,7 +114,6 @@ void docx_table_state::start_cell()
void docx_table_state::end_cell()
{}
bool docx_table_state::start_covered_cell(docx_conversion_context & Context)
{
std::wostream & _Wostream = context_.output_stream();

View File

@ -70,6 +70,8 @@ public:
void set_rows_spanned(unsigned int Column, unsigned int Val, unsigned int ColumnsSpanned, const std::wstring & Style);
unsigned int current_rows_spanned(unsigned int Column) const;
double get_current_cell_width();
void add_column_width(double width);
private:
docx_conversion_context & context_;
std::wstring table_style_;
@ -81,7 +83,8 @@ private:
std::vector<table_row_spanned> rows_spanned_;
bool close_table_covered_cell_;
std::vector<unsigned int> columns_;
std::vector<std::wstring> columnsDefaultCellStyleName_;
std::vector<double> columns_width_;
std::vector<std::wstring> columnsDefaultCellStyleName_;
};
@ -135,6 +138,14 @@ public:
{
return table_states_.back().start_cell();
}
double get_current_cell_width()
{
return table_states_.back().get_current_cell_width();
}
void add_column_width(double width)
{
table_states_.back().add_column_width(width);
}
void end_cell()
{

View File

@ -33,7 +33,7 @@
#include "hyperlinks.h"
#include "oox_rels.h"
#include <cpdoccore/xml/utils.h>
#include <xml/utils.h>
namespace cpdoccore {
namespace oox {

View File

@ -34,7 +34,7 @@
#include <boost/regex.hpp>
#include <cpdoccore/xml/utils.h>
#include <xml/utils.h>
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"

View File

@ -32,7 +32,7 @@
#include "oox_chart_axis.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "oox_title.h"
#include "oox_chart_shape.h"

View File

@ -32,8 +32,8 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPSharedPtr.h>
#include <CPOptional.h>
#include <CPSharedPtr.h>
#include "oox_chart_shape.h"

View File

@ -32,7 +32,7 @@
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "oox_rels.h"
#include "oox_chart_context.h"

View File

@ -32,10 +32,10 @@
#pragma once
#include "oox_package.h"
#include <cpdoccore/CPNoncopyable.h>
#include <CPNoncopyable.h>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPSharedPtr.h>
#include <CPScopedPtr.h>
#include <CPSharedPtr.h>
#include "oox_title.h"
#include "oox_plot_area.h"

View File

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

View File

@ -32,8 +32,8 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPScopedPtr.h>
#include <CPOptional.h>
#include <CPScopedPtr.h>
#include "oox_layout.h"

View File

@ -34,7 +34,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/ref.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"
#include "xlsx_utils.h"

View File

@ -32,7 +32,7 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <CPOptional.h>
#include "../odf/chart_objects.h"
#include "oox_chart_values.h"

View File

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

View File

@ -32,8 +32,8 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPScopedPtr.h>
#include <CPOptional.h>
#include <CPScopedPtr.h>
#include "../odf/chart_objects.h"
#include "oox_drawing_fills.h"

View File

@ -32,7 +32,7 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <CPOptional.h>
namespace cpdoccore {

View File

@ -33,15 +33,64 @@
#include "oox_conversion_context.h"
#include <iostream>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/utils.h>
#include <odf/odf_document.h>
#include <xml/simple_xml_writer.h>
#include "../odf/odfcontext.h"
#include "../odf/style_text_properties.h"
#include "../odf/style_paragraph_properties.h"
namespace cpdoccore {
void tabs_context::reset()
{
for (size_t i = 0; i < tabs.size(); i++)
{
odf_reader::style_tab_stop *tab_stop = dynamic_cast<odf_reader::style_tab_stop*>(tabs[i].get());
if (tab_stop)
{
clear_tabs.insert(std::make_pair(tab_stop->style_position_.get_value(), tabs[i]));
}
}
tabs.clear();
}
void tabs_context::add(const odf_reader::office_element_ptr & element)
{
odf_reader::style_tab_stop *tab_stop = dynamic_cast<odf_reader::style_tab_stop*>(element.get());
if (tab_stop)
{
std::map<double, odf_reader::office_element_ptr>::iterator pFind = clear_tabs.find(tab_stop->style_position_.get_value());
if (pFind != clear_tabs.end())
{
clear_tabs.erase(pFind);
}
tabs.push_back(element);
}
}
void tabs_context::docx_convert(oox::docx_conversion_context & Context)
{
if (clear_tabs.empty() && tabs.empty()) return;
std::wstringstream & _pPr = Context.get_styles_context().paragraph_nodes();
_pPr << L"<w:tabs>";
for (std::map<double, odf_reader::office_element_ptr>::iterator it = clear_tabs.begin(); it != clear_tabs.end(); ++it)
{
odf_reader::style_tab_stop * tab_stop = dynamic_cast<odf_reader::style_tab_stop*>(it->second.get());
tab_stop->docx_convert(Context, true);
}
for (size_t i = 0; i < tabs.size(); i++)
{
odf_reader::style_tab_stop * tab_stop = dynamic_cast<odf_reader::style_tab_stop*>(tabs[i].get());
tab_stop->docx_convert(Context, false);
}
_pPr << L"</w:tabs>";
}
void styles_context::start_process_style(const odf_reader::style_instance * Instance)
{
current_processed_style_ = Instance;

View File

@ -33,6 +33,8 @@
#include <sstream>
#include <iosfwd>
#include <map>
#include <vector>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
@ -40,14 +42,41 @@
namespace cpdoccore {
namespace oox{
class docx_conversion_context;
class pptx_conversion_context;
};
namespace odf_reader
{
class style_instance;
class style_text_properties;
class fonts_container;
typedef boost::shared_ptr<style_text_properties> style_text_properties_ptr;
class office_element;
typedef boost::shared_ptr<office_element> office_element_ptr;
};
class tabs_context : boost::noncopyable
{
public:
std::vector<odf_reader::office_element_ptr> tabs;
std::map<double, odf_reader::office_element_ptr> clear_tabs;
void clear()
{
tabs.clear();
clear_tabs.clear();
}
void reset();
void add(const odf_reader::office_element_ptr & element);
void docx_convert(oox::docx_conversion_context & Context);
};
class styles_context : boost::noncopyable
{
public:

View File

@ -31,8 +31,8 @@
*/
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <CPOptional.h>
#include <xml/simple_xml_writer.h>
#include "oox_data_labels.h"
#include "oox_chart_shape.h"

View File

@ -36,9 +36,9 @@
#include <vector>
#include <boost/noncopyable.hpp>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/xml/attributes.h>
#include <CPOptional.h>
#include <CPScopedPtr.h>
#include <xml/attributes.h>
namespace cpdoccore {
namespace oox {

View File

@ -33,7 +33,7 @@
#include <boost/algorithm/string.hpp>
#include "oox_drawing.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "../odf/datatypes/custom_shape_types_convert.h"

View File

@ -33,9 +33,9 @@
#include <iosfwd>
#include <iostream>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/attributes.h>
#include <CPScopedPtr.h>
#include <CPOptional.h>
#include <xml/attributes.h>
#include "mediaitems.h"
#include "oox_drawing_fills.h"

View File

@ -32,7 +32,7 @@
#include "oox_drawing_fills.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
namespace cpdoccore {
namespace oox {

View File

@ -32,8 +32,8 @@
#pragma once
#include <string>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPSharedPtr.h>
#include <CPOptional.h>
#include <CPSharedPtr.h>
#include "../odf/datatypes/lengthorpercent.h"

View File

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

View File

@ -32,8 +32,8 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPScopedPtr.h>
#include <CPOptional.h>
#include <CPScopedPtr.h>
#include "../odf/chart_objects.h"

View File

@ -34,7 +34,7 @@
#include <boost/ref.hpp>
#include <cpdoccore/utf8cpp/utf8.h>
#include <utf8cpp/utf8.h>
#include "mediaitems.h"
#include "../../DesktopEditor/common/File.h"
@ -254,30 +254,31 @@ void rels_files::add(std::wstring const & Id,
{
return add(relationship(Id, Type, Target, TargetMode));
}
///////////////////////////////////////////
//-----------------------------------------------------------------------------------------------
chart_content::chart_content() : rels_(rels_file::create(L""))
{
}
_CP_PTR(chart_content) chart_content::create()
{
return boost::make_shared<chart_content>();
}
void chart_content::add_rel(relationship const & r)
{
rels_->get_rels().add(r);
}
///////////////////////////////////////////
//-----------------------------------------------------------------------------------------------
_CP_PTR(customXml_content) customXml_content::create(const std::wstring &item, const std::wstring &props)
{
return boost::make_shared<customXml_content>(item, props);
}
//-----------------------------------------------------------------------------------------------
element_ptr simple_element::create(const std::wstring & FileName, const std::wstring & Content)
{
return boost::make_shared<simple_element>(FileName, Content);
}
////////////
//-----------------------------------------------------------------------------------------------
void core_file::write(const std::wstring & RootPath)
{

View File

@ -33,8 +33,8 @@
#define _CPDOCCORE_OOX_PACKAGE_H_75f74d15
#include <vector>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPNoncopyable.h>
#include <CPSharedPtr.h>
#include <CPNoncopyable.h>
#include "docx_content_type.h"
#include "oox_rels.h"
@ -61,7 +61,7 @@ typedef std::vector<element_ptr> element_ptr_array;
class document;
// element
//------------------------------------------------------------------------
class element
{
public:
@ -108,10 +108,10 @@ private:
};
//------------------------------------------------------------------------
class rels_file;
typedef boost::shared_ptr<rels_file> rels_file_ptr;
// rels_file
class rels_file : public element
{
public:
@ -132,7 +132,7 @@ private:
rels rels_;
};
// rels_files
//------------------------------------------------------------------------
class rels_files : public element
{
public:
@ -150,13 +150,29 @@ private:
rels_file_ptr rels_file_;
};
//------------------------------------------------------------------------
class customXml_content;
typedef _CP_PTR(customXml_content) customXml_content_ptr;
////////////////////////////////////////
///\class chart_files
class customXml_content : boost::noncopyable
{
public:
customXml_content(const std::wstring &item, const std::wstring &props) : content_item(item), content_props(props) {}
static _CP_PTR(customXml_content) create(const std::wstring &item, const std::wstring &props);
std::wstring item() { return content_item; }
std::wstring props() { return content_props; }
friend class customXml_files;
private:
std::wstring content_item;
std::wstring content_props;
};
///------------------------------------------------------------------------
class chart_content;
typedef _CP_PTR(chart_content) chart_content_ptr;
class chart_content : noncopyable
class chart_content : boost::noncopyable
{
public:
chart_content();
@ -169,7 +185,7 @@ private:
std::wstringstream content_;
rels_file_ptr rels_;
};
/////////////////////////////////
//------------------------------------------------------------------------
class document : public element
{
public:

View File

@ -32,8 +32,8 @@
#include "oox_plot_area.h"
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <CPOptional.h>
#include <xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"

View File

@ -32,8 +32,8 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPScopedPtr.h>
#include <CPOptional.h>
#include <CPScopedPtr.h>
#include "oox_types_chart.h"
#include "oox_chart_axis.h"

View File

@ -31,9 +31,9 @@
*/
#include "oox_rels.h"
#include <cpdoccore/xml/attributes.h>
#include <xml/attributes.h>
#include "namespaces.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
namespace cpdoccore {
namespace oox {

View File

@ -34,8 +34,8 @@
#include <string>
#include <vector>
#include <iosfwd>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/CPSharedPtr.h>
#include <xml/xmlelement.h>
#include <CPSharedPtr.h>
namespace cpdoccore {
namespace oox {

View File

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

View File

@ -32,8 +32,8 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/CPScopedPtr.h>
#include <CPOptional.h>
#include <CPScopedPtr.h>
#include "oox_layout.h"

View File

@ -30,7 +30,7 @@
*
*/
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "oox_types_chart.h"
#include "oox_chart_shape.h"

View File

@ -34,8 +34,8 @@
#include <iosfwd>
#include <boost/noncopyable.hpp>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPSharedPtr.h>
#include <CPScopedPtr.h>
#include <CPSharedPtr.h>
#include "xlsx_color.h"
#include "oox_chart_series.h"

View File

@ -31,7 +31,7 @@
*/
#pragma once
#include <cpdoccore/CPSharedPtr.h>
#include <CPSharedPtr.h>
#include <string>
namespace cpdoccore {

View File

@ -32,7 +32,7 @@
#include "pptx_comments.h"
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "oox_rels.h"
namespace cpdoccore {

View File

@ -32,9 +32,9 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/xml/attributes.h>
#include <CPScopedPtr.h>
#include <CPSharedPtr.h>
#include <xml/attributes.h>
#include "mediaitems.h"
namespace cpdoccore {

View File

@ -35,7 +35,7 @@
#include "../odf/datatypes/length.h"
#include "xlsx_utils.h"
//#include <cpdoccore/formulasconvert.h>
//#include <formulasconvert.h>
namespace cpdoccore {
namespace oox {

View File

@ -34,8 +34,8 @@
#include <string>
#include <boost/noncopyable.hpp>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPSharedPtr.h>
#include <CPScopedPtr.h>
#include <CPSharedPtr.h>
#include "pptx_comments.h"

View File

@ -34,8 +34,8 @@
#include "pptx_package.h"
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <odf/odf_document.h>
#include <xml/simple_xml_writer.h>
#include <iostream>

View File

@ -31,7 +31,7 @@
*/
#pragma once
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
namespace cpdoccore {

View File

@ -31,7 +31,7 @@
*/
#include "pptx_drawing.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "../odf/datatypes/custom_shape_types_convert.h"
namespace cpdoccore {

View File

@ -33,9 +33,9 @@
#include <iosfwd>
#include <iostream>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/attributes.h>
#include <CPScopedPtr.h>
#include <CPOptional.h>
#include <xml/attributes.h>
#include "oox_drawing.h"
#include "mediaitems.h"

View File

@ -31,7 +31,7 @@
*/
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "oox_rels.h"

View File

@ -32,9 +32,9 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/xml/attributes.h>
#include <CPScopedPtr.h>
#include <CPSharedPtr.h>
#include <xml/attributes.h>
#include "mediaitems.h"
namespace cpdoccore {

View File

@ -32,7 +32,7 @@
#include <boost/make_shared.hpp>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
#include "pptx_output_xml.h"

View File

@ -32,9 +32,9 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPNoncopyable.h>
#include <CPSharedPtr.h>
#include <CPScopedPtr.h>
#include <CPNoncopyable.h>
#include "oox_rels.h"

View File

@ -34,7 +34,7 @@
#include "pptx_package.h"
#include "pptx_output_xml.h"
#include <cpdoccore/utf8cpp/utf8.h>
#include <utf8cpp/utf8.h>
namespace cpdoccore {
namespace oox {

View File

@ -32,7 +32,7 @@
#pragma once
#include "oox_package.h"
#include <cpdoccore/CPNoncopyable.h>
#include <CPNoncopyable.h>
#include "pptx_comments.h"
namespace NSFonts

View File

@ -31,9 +31,9 @@
*/
#include <iostream>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/odf/odf_document.h>
#include <xml/simple_xml_writer.h>
#include <xml/utils.h>
#include <odf/odf_document.h>
#include "pptx_drawing.h"
#include "pptx_drawings.h"

View File

@ -32,8 +32,8 @@
#include <iostream>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/odf/odf_document.h>
#include <xml/simple_xml_writer.h>
#include <odf/odf_document.h>
#include "../odf/odfcontext.h"
#include "../odf/draw_common.h"

View File

@ -37,9 +37,9 @@
#include <iostream>
#include <list>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/utils.h>
#include <xml/simple_xml_writer.h>
#include <odf/odf_document.h>
#include <xml/utils.h>
#include "../odf/odfcontext.h"
#include "../odf/style_text_properties.h"
@ -287,17 +287,17 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
odf_reader::office_element_ptr elm = text_list_style->get_content()[Level];
odf_reader::office_element_ptr elm_list;
if (elm->get_type() == odf_reader::typeTextListLevelStyleBullet)
if (elm->get_type() == typeTextListLevelStyleBullet)
{
odf_reader::text_list_level_style_bullet* list_bullet = dynamic_cast<odf_reader::text_list_level_style_bullet *>(elm.get());
if (list_bullet)elm_list = list_bullet->style_list_level_properties_;
}
if (elm->get_type() == odf_reader::typeTextListLevelStyleNumber)
if (elm->get_type() == typeTextListLevelStyleNumber)
{
odf_reader::text_list_level_style_number* list_number = dynamic_cast<odf_reader::text_list_level_style_number *>(elm.get());
if (list_number)elm_list = list_number->style_list_level_properties_;
}
if (elm->get_type() == odf_reader::typeTextListLevelStyleImage)
if (elm->get_type() == typeTextListLevelStyleImage)
{
odf_reader::text_list_level_style_image* list_image = dynamic_cast<odf_reader::text_list_level_style_image *>(elm.get());
if (list_image)elm_list = list_image->style_list_level_properties_;

View File

@ -33,10 +33,10 @@
#include <string>
#include <boost/noncopyable.hpp>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPOptional.h>
#include <CPScopedPtr.h>
#include <CPOptional.h>
#include <cpdoccore/xml/attributes.h>
#include <xml/attributes.h>
#include "oox_conversion_context.h"
#include "../odf/datatypes/stylefamily.h"

View File

@ -40,7 +40,7 @@
#include <ostream>
#include <boost/functional.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <xml/simple_xml_writer.h>
namespace cpdoccore {
namespace oox {

View File

@ -32,7 +32,7 @@
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <CPOptional.h>
#include <string>
namespace cpdoccore {

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