Compare commits

...

103 Commits

Author SHA1 Message Date
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
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
537e774f79 . 2018-05-24 15:08:20 +03:00
6d3761c20b XlsFormatReader - fix arrow 2018-05-24 12:18:43 +03:00
ee41b4ccb2 [x2t] Replace XmlUtils::CStringWriter with NSStringUtils::CStringBuilder 2018-05-24 12:00:53 +03:00
7b0f902c0f [x2t] Turn on DeleteNoUnicode option for bug #37789 2018-05-23 20:32:03 +03:00
e6039f7f6f OdfFormatReader - convert table content to sdt table content 2018-05-23 19:28:29 +03:00
755119c825 fix bug #35107 2018-05-23 15:24:40 +03:00
3a73480437 fix bug #37537 2018-05-23 14:51:05 +03:00
a99a195c68 OdfFormatReader - convert form elements aka field elements (in editor visualization is worse) 2018-05-22 17:43:30 +03:00
0d979b8033 OdfFormatReader - convert form elements aka sdt elements 2018-05-22 16:23:42 +03:00
dd3b671e57 . 2018-05-21 19:47:31 +03:00
74bd059607 OdfFormatReader - forms, controls 2018-05-21 19:46:56 +03:00
83fa44edcd Use system libcurl 2018-05-21 18:12:06 +03:00
80fe4c0164 Add dependency for pdfwriter project 2018-05-21 13:35:32 +03:00
04f7527f9e OdfFormatReader - restore xlsx table chart from cache - bug #37705 2018-05-19 16:34:14 +03:00
d92aa1f793 [x2t] Add lvlOverride to binary 2018-05-18 20:21:51 +03:00
af4e135fe2 . 2018-05-18 16:22:44 +03:00
a5ef8c01b3 PdfWriter - encrypt in AES256 2018-05-18 15:28:31 +03:00
1b7f35b317 . 2018-05-18 11:22:56 +03:00
4079dea224 [bug] builder crash 2018-05-17 16:56:10 +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
f4c112d523 Merge pull request #84 from ONLYOFFICE/feature/remove_function_pointers
Feature/remove function pointers
2018-05-16 20:37:14 +03:00
b082ffe20c PdfReader - decrypt files revision 6(fix bug #17002) 2018-05-16 18:24:41 +03:00
c589a6c947 [x2t] Remove name collision in READ1_DEF, READ2_DEF, READ_TABLE_DEF. For Bug #36436 2018-05-16 16:41:05 +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
15b08aeebf [x2t] Remove function pointers at CComment. For Bug #36436 2018-05-15 17:52:29 +03:00
672129c242 [x2t] Remove function pointers at Binary_CommonReader.ReadTable. For Bug #36436 2018-05-15 17:52:29 +03:00
92689a7a57 [x2t] Remove function pointers at Binary_CommonReader.Read1. For Bug #36436 2018-05-15 17:52:28 +03:00
31ebd7b14c [x2t] Remove function pointers at Binary_CommonReader.Read2. For Bug #36436 2018-05-15 17:52:28 +03:00
1695668a6f [x2t] Remove function pointers at Binary_CommonReader.ReadTable. For Bug #36436 2018-05-15 17:52:27 +03:00
77dfd5c12a [x2t] Remove function pointers at Binary_CommonReader.Read2. For Bug #36436 2018-05-15 17:52:27 +03:00
e600fe93b7 [x2t] Remove function pointers at Binary_CommonReader.Read1. For Bug #36436 2018-05-15 17:52:27 +03:00
889a1f827a Merge remote-tracking branch 'origin/hotfix/v5.1.4' into develop 2018-05-15 16:48:11 +03:00
8cd55fb9c4 OdfFormatReader - fix bug #37746 2018-05-15 16:47:14 +03:00
01b9309f09 x2t - fix bug #37740 2018-05-15 13:39:22 +03:00
d3a4f00f76 Add curl source to gitignore 2018-05-11 19:45:49 +03:00
f65196d95b Revert wrong merge 2018-05-11 19:07:10 +03:00
3ee5d685c2 Fix build error 2018-05-11 18:32:51 +03:00
c0cd75dbd5 Move curl.pri to kernel.pro 2018-05-11 18:05:24 +03:00
a69453af4b Merge branch 'hotfix/v5.1.4' into develop 2018-05-11 17:36:59 +03:00
3adcfecfb9 Bug with draw combo fonts 2018-05-10 20:11:04 +03:00
a7d2191649 Add static libcurl (#81) 2018-05-10 19:23:59 +03:00
db50e87fe0 [x2t] Add customStyle style property to binary 2018-05-10 18:10:01 +03:00
36bdc7376a Change lib name 2018-05-10 14:24:16 +03:00
1321211336 . 2018-05-10 14:06:57 +03:00
8c834c5041 Remove curl 2018-05-10 12:41:47 +03:00
c75aacaed8 Add cryptopp project 2018-05-10 12:04:44 +03:00
a4445cacaa PdfReader builds (windows) 2018-05-10 09:43:34 +03:00
d6ad9e84e2 Export CorrentPathW function in kernel library 2018-05-10 09:11:23 +03:00
d9687387f9 PdfReader - decrypt files (up to rev.5) 2018-05-08 18:44:57 +03:00
eaa01c7995 Merge remote-tracking branch 'origin/feature/static-libcurl' into develop 2018-05-08 13:00:39 +03:00
597f360336 . 2018-05-08 13:00:17 +03:00
d502206726 Add static libcurl 2018-05-08 12:18:15 +03:00
d0d90c641c Add building static libcurl 2018-05-08 10:59:50 +03:00
14fa14de3f RtfFormatReader - fix bug 37500 2018-05-07 19:26:38 +03:00
cced8f4912 x2t - fix bug 37670 2018-05-07 17:32:35 +03:00
2e40b96ed9 . 2018-05-05 13:17:39 +03:00
50ee7d7cc1 x2t - fix linux build 2018-05-04 17:44:23 +03:00
f9b54bffd4 Merge remote-tracking branch 'origin/hotfix/v5.1.4' into develop
# Conflicts:
#	DesktopEditor/common/Directory.h
#	DesktopEditor/common/File.h
2018-05-04 16:12:30 +03:00
a52a8e982e Merge pull request #80 from ONLYOFFICE/feature/desktop(5.1.3+)
Feature/desktop(5.1.3+)
2018-05-04 13:53:59 +03:00
128529ba80 x2t - from https://github.com/ONLYOFFICE/core/pull/65. 2018-05-03 19:44:09 +03:00
a571c88798 PdfReader - test project, fix image renderer 2018-05-03 18:12:51 +03:00
34bb84a792 [ios][x2t] fixed build 2018-05-03 16:50:50 +03:00
92d0d0d7ea . 2018-05-03 16:39:24 +03:00
449e3fc131 . 2018-05-03 16:18:33 +03:00
ce9fdb33b5 OdfFormatWriter - encrypted 2018-05-03 16:11:49 +03:00
2591f0a202 x2t - update crypto++ 2018-05-03 12:36:33 +03:00
6bc04fc06f . 2018-04-30 15:33:58 +03:00
047850dbd6 OdfFormatWriter - encryption 2018-04-29 17:22:44 +03:00
6afa54ebef x2t - fix users files 2018-04-28 17:04:49 +03:00
27a0e77ef1 [bugs] Crypto bugs 2018-04-28 15:08:38 +03:00
76b682063e x2t - save comments for presentation (undelete ms office) 2018-04-27 19:11:58 +03:00
effdab1ff4 Add not sha1 algorithms to sign/verify providers 2018-04-27 19:01:51 +03:00
48aa99af83 Merge pull request #79 from ONLYOFFICE/feature/konovalovsergey-patch-1
[x2t] Bump compatibilityMode setting
2018-04-27 17:42:09 +03:00
261e48227d Bugs 2018-04-26 18:29:39 +03:00
b9b843f25d Windows: add long file names support (x2t) 2018-04-26 13:45:02 +03:00
d7e2bedc6b Openssl errors 2018-04-25 16:51:10 +03:00
58cd45f4ee [x2t] Bump compatibilityMode setting
Prevent opening files in compatibility mode in Word 2016.
2018-04-24 18:52:25 +03:00
33f7ee49df Bugs 2018-04-24 17:45:58 +03:00
617 changed files with 67227 additions and 42237 deletions

7
.gitignore vendored
View File

@ -13,6 +13,11 @@ Common/3dParty/cef/win_32
Common/3dParty/cef/linux_64
Common/3dParty/cef/linux_32
Common/3dParty/cef/mac_64
Common/3dParty/curl/win_64
Common/3dParty/curl/win_32
Common/3dParty/curl/linux_64
Common/3dParty/curl/linux_32
Common/3dParty/curl/mac_64
Common/3dParty/v8/v8
Common/3dParty/v8/depot_tools
Common/3dParty/v8/win_64
@ -40,6 +45,8 @@ ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_i.c
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_p.c
ASCOfficeXlsFile2/win32/dlldata.c
OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
X2tConverter/**/Makefile.*
*.7z
*.obj
*.pdb
*.tlb

View File

@ -58,6 +58,9 @@
#include <boost/format.hpp>
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
#define GETBIT(from, num) ((from & (1 << num)) != 0)
namespace DocFileFormat
{
typedef unsigned char Bool8;

View File

@ -72,10 +72,14 @@ namespace DocFileFormat
{
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
unsigned short index_author = atrdPre10->GetAuthorIndex();
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
m_pXmlWriter->WriteAttribute( L"w:author",
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ) ));
if (index_author < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
{
m_pXmlWriter->WriteAttribute( L"w:author",
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( index_author ) ));
}
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());
//!!!TODO!!!

View File

@ -53,7 +53,7 @@ namespace DocFileFormat
/*========================================================================================================*/
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion ):
FormattedDiskPage(), rgb(NULL), grpchpxSize(NULL), grpchpx(NULL)
FormattedDiskPage(), rgb(NULL), grpchpxSize(0), grpchpx(NULL)
{
Type = Character;
WordStream = wordStream;

View File

@ -93,7 +93,7 @@ HRESULT convert_single(std::wstring srcFileName)
if (hRes == S_OK)
{
COfficeUtils oCOfficeUtils(NULL);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath, -1);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath, true);
}
NSDirectory::DeleteDirectory(dstTempPath);

View File

@ -39,7 +39,7 @@ namespace Writers
{
class DocumentWriter : public ContentWriter
{
XmlUtils::CStringWriter m_oWriter;
NSStringUtils::CStringBuilder m_oWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
public:
std::wstring m_sDir;

View File

@ -40,9 +40,9 @@ namespace Writers
class ContentWriter
{
public:
XmlUtils::CStringWriter m_oBackground;
XmlUtils::CStringWriter m_oContent;
XmlUtils::CStringWriter m_oSecPr;
NSStringUtils::CStringBuilder m_oBackground;
NSStringUtils::CStringBuilder m_oContent;
NSStringUtils::CStringBuilder m_oSecPr;
};
class HdrFtrItem
{

View File

@ -38,7 +38,7 @@ namespace Writers
{
class MediaWriter
{
XmlUtils::CStringWriter m_oWriter;
NSStringUtils::CStringBuilder m_oWriter;
std::wstring m_sDir;
std::wstring m_sMediaDir;
public:

View File

@ -41,11 +41,11 @@ namespace Writers
class NumberingWriter
{
XmlUtils::CStringWriter m_oWriter;
NSStringUtils::CStringBuilder m_oWriter;
std::wstring m_sDir;
public:
XmlUtils::CStringWriter m_oANum;
XmlUtils::CStringWriter m_oNumList;
NSStringUtils::CStringBuilder m_oANum;
NSStringUtils::CStringBuilder m_oNumList;
NumberingWriter( std::wstring sDir) : m_sDir(sDir)
{

View File

@ -516,7 +516,7 @@ public:
bRStyle || bSpacing || bDStrikeout || bCaps || bSmallCaps || bPosition || bFontHint || bBoldCs || bItalicCs || bFontSizeCs || bCs || bRtl || bLang || bLangBidi || bLangEA || bThemeColor || bVanish ||
!Outline.empty() || !Fill.empty() || !Del.empty() || !Ins.empty() || !MoveFrom.empty() || !MoveTo.empty() || !rPrChange.empty();
}
void Write(XmlUtils::CStringWriter* pCStringWriter)
void Write(NSStringUtils::CStringBuilder* pCStringWriter)
{
pCStringWriter->WriteString(L"<w:rPr>");
if(bRStyle)
@ -780,7 +780,9 @@ public:
std::wstring Name;
std::wstring Id;
BYTE byteType;
bool bDefault;
bool Default;
bool Custom;
std::wstring Aliases;
std::wstring BasedOn;
std::wstring NextId;
std::wstring Link;
@ -789,6 +791,11 @@ public:
bool hidden;
bool semiHidden;
bool unhideWhenUsed;
bool autoRedefine;
bool locked;
bool personal;
bool personalCompose;
bool personalReply;
std::wstring TextPr;
std::wstring ParaPr;
std::wstring TablePr;
@ -796,24 +803,38 @@ public:
std::wstring CellPr;
std::vector<std::wstring> TblStylePr;
bool bDefault;
bool bCustom;
bool bqFormat;
bool buiPriority;
bool bhidden;
bool bsemiHidden;
bool bunhideWhenUsed;
bool bautoRedefine;
bool blocked;
bool bpersonal;
bool bpersonalCompose;
bool bpersonalReply;
public:
docStyle()
{
byteType = styletype_Paragraph;
bDefault = false;
bCustom = false;
bqFormat = false;
buiPriority = false;
bhidden = false;
bsemiHidden = false;
bunhideWhenUsed = false;
bautoRedefine = false;
blocked = false;
bpersonal = false;
bpersonalCompose = false;
bpersonalReply = false;
}
void Write(XmlUtils::CStringWriter* pCStringWriter)
void Write(NSStringUtils::CStringBuilder* pCStringWriter)
{
std::wstring sType;
switch(byteType)
@ -827,10 +848,35 @@ public:
{
std::wstring sStyle = L"<w:style w:type=\"" + sType + L"\" w:styleId=\"" + Id + L"\"";
if(bDefault)
sStyle += L" w:default=\"1\"";
{
if(Default)
sStyle += L" w:default=\"1\"";
else
sStyle += L" w:default=\"0\"";
}
if(bCustom)
{
if(Custom)
sStyle += L" w:customStyle=\"1\"";
else
sStyle += L" w:customStyle=\"0\"";
}
sStyle += L">";
pCStringWriter->WriteString(sStyle);
if(!Aliases.empty())
{
pCStringWriter->WriteString(L"<w:aliases w:val=\"");
pCStringWriter->WriteEncodeXmlString(Aliases);
pCStringWriter->WriteString(L"\"/>");
}
if(bautoRedefine)
{
if(autoRedefine)
pCStringWriter->WriteString(L"<w:autoRedefine/>");
else
pCStringWriter->WriteString(L"<w:autoRedefine val=\"false\"/>");
}
if(!Name.empty())
{
pCStringWriter->WriteString(L"<w:name w:val=\"" + Name + L"\"/>");
@ -843,12 +889,40 @@ public:
{
pCStringWriter->WriteString(L"<w:next w:val=\"" + NextId + L"\"/>");
}
if(bpersonal)
{
if(personal)
pCStringWriter->WriteString(L"<w:personal/>");
else
pCStringWriter->WriteString(L"<w:personal val=\"false\"/>");
}
if(bpersonalCompose)
{
if(personalCompose)
pCStringWriter->WriteString(L"<w:personalCompose/>");
else
pCStringWriter->WriteString(L"<w:personalCompose val=\"false\"/>");
}
if(bpersonalReply)
{
if(personalReply)
pCStringWriter->WriteString(L"<w:personalReply/>");
else
pCStringWriter->WriteString(L"<w:personalReply val=\"false\"/>");
}
if(!Link.empty())
{
pCStringWriter->WriteString(L"<w:link w:val=\"");
pCStringWriter->WriteEncodeXmlString(Link);
pCStringWriter->WriteString(L"\"/>");
}
if(blocked)
{
if(locked)
pCStringWriter->WriteString(L"<w:locked/>");
else
pCStringWriter->WriteString(L"<w:locked val=\"false\"/>");
}
if(bqFormat)
{
if(qFormat)
@ -916,7 +990,7 @@ public:
class tblStylePr
{
public:
XmlUtils::CStringWriter Writer;
NSStringUtils::CStringBuilder Writer;
BYTE Type;
bool bType;
public:
@ -976,7 +1050,7 @@ public:
bHeight = false;
bPaddings = false;
}
void Write(XmlUtils::CStringWriter* pCStringWriter)
void Write(NSStringUtils::CStringBuilder* pCStringWriter)
{
if(bType)
{
@ -1037,7 +1111,7 @@ public:
// tblPr()
// {
// }
// void Write(CStringWriter* pCStringWriter)
// void Write(NSStringUtils::CStringBuilder* pCStringWriter)
// {
// }
//};
@ -1057,7 +1131,7 @@ public:
bW = false;
bWDocx = false;
}
void Write(XmlUtils::CStringWriter& pCStringWriter, const std::wstring& sName)
void Write(NSStringUtils::CStringBuilder& pCStringWriter, const std::wstring& sName)
{
pCStringWriter.WriteString(Write(sName));
}
@ -1111,7 +1185,7 @@ public:
bValue = false;
bThemeColor = false;
}
void Write(std::wstring sName, XmlUtils::CStringWriter* pCStringWriter, bool bCell)
void Write(std::wstring sName, NSStringUtils::CStringBuilder* pCStringWriter, bool bCell)
{
if(bValue)
{
@ -1202,7 +1276,7 @@ public:
{
return !(bLeft || bTop || bRight || bBottom || bInsideV || bInsideH || bBetween);
}
void Write(XmlUtils::CStringWriter* pCStringWriter, bool bCell)
void Write(NSStringUtils::CStringBuilder* pCStringWriter, bool bCell)
{
if(bLeft)
oLeft.Write(L"w:left", pCStringWriter, bCell);
@ -1237,16 +1311,18 @@ public:
class docLvl
{
public:
long ILvl;
long Format;
BYTE Jc;
std::vector<docLvlText*> Text;
long Restart;
long Start;
BYTE Suff;
XmlUtils::CStringWriter ParaPr;
XmlUtils::CStringWriter TextPr;
NSStringUtils::CStringBuilder ParaPr;
NSStringUtils::CStringBuilder TextPr;
std::wstring PStyle;
bool bILvl;
bool bFormat;
bool bJc;
bool bText;
@ -1258,6 +1334,7 @@ public:
bool bPStyle;
docLvl()
{
bILvl = false;
bFormat = false;
bJc = false;
bText = false;
@ -1275,9 +1352,14 @@ public:
delete Text[i];
}
}
void Write(XmlUtils::CStringWriter& oWriter, int index)
void Write(NSStringUtils::CStringBuilder& oWriter)
{
oWriter.WriteString(L"<w:lvl w:ilvl=\"" + std::to_wstring(index) + L"\">");
oWriter.WriteString(L"<w:lvl");
if(bILvl)
{
oWriter.WriteString(L" w:ilvl=\"" + std::to_wstring(ILvl) + L"\"");
}
oWriter.WriteString(L">");
if(bStart)
{
oWriter.WriteString(L"<w:start w:val=\"" + std::to_wstring(Start) + L"\"/>");
@ -1374,6 +1456,48 @@ public:
oWriter.WriteString(L"</w:lvl>");
}
};
class docLvlOverride
{
public:
long ILvl;
long StartOverride;
docLvl* Lvl;
bool bILvl;
bool bStartOverride;
docLvlOverride()
{
bILvl = false;
bStartOverride = false;
Lvl = NULL;
}
~docLvlOverride()
{
RELEASEOBJECT(Lvl);
}
void Write(NSStringUtils::CStringBuilder& oWriter)
{
oWriter.WriteString(L"<w:lvlOverride");
if (bILvl)
{
oWriter.WriteString(L" w:ilvl=\"");
oWriter.WriteString(std::to_wstring(ILvl));
oWriter.WriteString(L"\"");
}
oWriter.WriteString(L">");
if (bStartOverride)
{
oWriter.WriteString(L"<w:startOverride w:val=\"");
oWriter.WriteString(std::to_wstring(StartOverride));
oWriter.WriteString(L"\"/>");
}
if(NULL != Lvl)
{
Lvl->Write(oWriter);
}
oWriter.WriteString(L"</w:lvlOverride>");
}
};
class docANum
{
public:
@ -1394,7 +1518,7 @@ public:
delete Lvls[i];
}
}
void Write(XmlUtils::CStringWriter& oWriterANum)
void Write(NSStringUtils::CStringBuilder& oWriterANum)
{
if(bId)
{
@ -1411,7 +1535,7 @@ public:
}
for(int i = 0, length = (int)Lvls.size(); i < length; ++i)
{
Lvls[i]->Write(oWriterANum, i);
Lvls[i]->Write(oWriterANum);
}
oWriterANum.WriteString(L"</w:abstractNum>");
}
@ -1422,6 +1546,7 @@ class docNum
public:
long AId;
long Id;
std::vector<docLvlOverride*> LvlOverrides;
bool bAId;
bool bId;
@ -1430,12 +1555,21 @@ public:
bAId = false;
bId = false;
}
void Write(XmlUtils::CStringWriter& oWriterNumList)
~docNum()
{
for(size_t i = 0; i < LvlOverrides.size(); ++i){
RELEASEOBJECT(LvlOverrides[i]);
}
}
void Write(NSStringUtils::CStringBuilder& oWriterNumList)
{
if(bAId && bId)
{
oWriterNumList.WriteString(L"<w:num w:numId=\"" + std::to_wstring(Id) + L"\"><w:abstractNumId w:val=\"" +
std::to_wstring(AId) + L"\"/></w:num>");
oWriterNumList.WriteString(L"<w:num w:numId=\"" + std::to_wstring(Id) + L"\"><w:abstractNumId w:val=\"" + std::to_wstring(AId) + L"\"/>");
for(size_t i = 0; i < LvlOverrides.size(); ++i){
LvlOverrides[i]->Write(oWriterNumList);
}
oWriterNumList.WriteString(L"</w:num>");
}
}
};
@ -1451,7 +1585,7 @@ public:
sName = name;
bGridAfter = false;
}
void Write(XmlUtils::CStringWriter& writer)
void Write(NSStringUtils::CStringBuilder& writer)
{
if(bGridAfter && nGridAfter > 0)
{
@ -1468,7 +1602,7 @@ public:
std::wstring href;
std::wstring anchor;
std::wstring tooltip;
XmlUtils::CStringWriter writer;
NSStringUtils::CStringBuilder writer;
static WriteHyperlink* Parse(std::wstring fld)
{
WriteHyperlink* res = NULL;
@ -1547,7 +1681,7 @@ public:
}
return res;
}
void Write(XmlUtils::CStringWriter& wr)
void Write(NSStringUtils::CStringBuilder& wr)
{
if(false == rId.empty())
{
@ -1593,7 +1727,6 @@ public:
};
class CComment{
private:
typedef std::wstring (*funcArg)(CComment* pComment);
IdCounter& m_oParaIdCounter;
IdCounter& m_oFormatIdCounter;
public:
@ -1654,13 +1787,13 @@ public:
}
return sRes;
}
std::wstring writeTemplates(funcArg fReadFunction)
std::wstring writeTemplates(bool isExt)
{
std::wstring sRes;
sRes += (fReadFunction(this));
sRes += isExt ? writeContentExt(this) : writeContent(this);
for(size_t i = 0; i < replies.size(); ++i)
sRes += (fReadFunction(replies[i]));
sRes += isExt ? writeContentExt(replies[i]) : writeContent(replies[i]);
return sRes;
}
static std::wstring writeRef(CComment* pComment, const std::wstring& sBefore, const std::wstring& sRef, const std::wstring& sAfter)
@ -1744,25 +1877,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;
}
@ -1852,7 +1982,7 @@ public:
std::wstring sRes;
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += (it->second->writeTemplates(CComment::writeContent));
sRes += it->second->writeTemplates(false);
}
return sRes;
}
@ -1861,7 +1991,7 @@ public:
std::wstring sRes;
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += (it->second->writeTemplates(CComment::writeContentExt));
sRes += it->second->writeTemplates(true);
}
return sRes;
}
@ -2457,7 +2587,7 @@ public: CFramePr()
{
return !(bDropCap || bH || bHAnchor || bHRule || bHSpace || bLines || bVAnchor || bVSpace || bW || bWrap || bX || bXAlign || bY || bYAlign);
}
void Write(XmlUtils::CStringWriter& oStringWriter)
void Write(NSStringUtils::CStringBuilder& oStringWriter)
{
oStringWriter.WriteString(L"<w:framePr");
if(bDropCap)
@ -2595,7 +2725,7 @@ public:
std::wstring sDocLocation;
std::wstring sTgtFrame;
XmlUtils::CStringWriter writer;
NSStringUtils::CStringBuilder writer;
bool bHistory;
public:
@ -2603,7 +2733,7 @@ public:
{
bHistory = false;
}
void Write(XmlUtils::CStringWriter& wr)
void Write(NSStringUtils::CStringBuilder& wr)
{
if(false == rId.empty())
{
@ -2634,12 +2764,12 @@ public:
class CFldSimple{
public:
std::wstring sInstr;
XmlUtils::CStringWriter writer;
NSStringUtils::CStringBuilder writer;
public:
CFldSimple()
{
}
void Write(XmlUtils::CStringWriter& wr)
void Write(NSStringUtils::CStringBuilder& wr)
{
if(false == sInstr.empty())
{
@ -2664,14 +2794,14 @@ public:
long* vMergeOrigin;
rPr* RPr;
XmlUtils::CStringWriter* PPr;
NSStringUtils::CStringBuilder* PPr;
SectPr* sectPr;
CWiterTblPr* tblPr;
XmlUtils::CStringWriter* tblGridChange;
XmlUtils::CStringWriter* trPr;
XmlUtils::CStringWriter* tcPr;
XmlUtils::CStringWriter* content;
XmlUtils::CStringWriter* contentRun;
NSStringUtils::CStringBuilder* tblGridChange;
NSStringUtils::CStringBuilder* trPr;
NSStringUtils::CStringBuilder* tcPr;
NSStringUtils::CStringBuilder* content;
NSStringUtils::CStringBuilder* contentRun;
TrackRevision()
{
Id = NULL;
@ -2708,11 +2838,11 @@ public:
}
std::wstring ToString(std::wstring sName)
{
XmlUtils::CStringWriter writer;
NSStringUtils::CStringBuilder writer;
Write(&writer, sName);
return writer.GetData();
}
void Write(XmlUtils::CStringWriter* pCStringWriter, std::wstring sName)
void Write(NSStringUtils::CStringBuilder* pCStringWriter, std::wstring sName)
{
if(IsNoEmpty())
{

View File

@ -47,7 +47,9 @@ Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReade
}
int Binary_HdrFtrTableReader::Read()
{
return ReadTable(&Binary_HdrFtrTableReader::ReadHdrFtrContent, this);
int res = c_oSerConstants::ReadOk;
READ_TABLE_DEF(res, this->ReadHdrFtrContent, NULL);
return res;
}
int Binary_HdrFtrTableReader::ReadHdrFtrContent(BYTE type, long length, void* poResult)
{
@ -55,7 +57,7 @@ int Binary_HdrFtrTableReader::ReadHdrFtrContent(BYTE type, long length, void* po
if ( c_oSerHdrFtrTypes::Header == type || c_oSerHdrFtrTypes::Footer == type )
{
nCurType = type;
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrFEO, this, poResult);
READ1_DEF(length, res, this->ReadHdrFtrFEO, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
@ -67,7 +69,7 @@ int Binary_HdrFtrTableReader::ReadHdrFtrFEO(BYTE type, long length, void* poResu
if ( c_oSerHdrFtrTypes::HdrFtr_First == type || c_oSerHdrFtrTypes::HdrFtr_Even == type || c_oSerHdrFtrTypes::HdrFtr_Odd == type )
{
nCurHeaderType = type;
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItem, this, poResult);
READ1_DEF(length, res, this->ReadHdrFtrItem, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
@ -99,7 +101,7 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes
}
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
READ1_DEF(length, res, this->ReadHdrFtrItemContent, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + L"_rels"+
@ -118,4 +120,4 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItemContent(BYTE type, long length, void
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -37,13 +37,13 @@
namespace Writers
{
static std::wstring g_string_set_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><w:settings xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:v=\"urn:schemas-microsoft-com:vml\">");
static std::wstring g_string_set_Default = _T("<w:zoom w:percent=\"100\"/><w:characterSpacingControl w:val=\"doNotCompress\"/><w:compat><w:compatSetting w:name=\"compatibilityMode\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"14\"/><w:compatSetting w:name=\"overrideTableStyleFontSizeAndJustification\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"enableOpenTypeFeatures\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"doNotFlipMirrorIndents\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/></w:compat><w:themeFontLang w:val=\"en-US\" w:eastAsia=\"zh-CN\"/><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults><w:decimalSymbol w:val=\".\"/><w:listSeparator w:val=\",\"/>");
static std::wstring g_string_set_Default = _T("<w:zoom w:percent=\"100\"/><w:characterSpacingControl w:val=\"doNotCompress\"/><w:compat><w:compatSetting w:name=\"compatibilityMode\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"15\"/><w:compatSetting w:name=\"overrideTableStyleFontSizeAndJustification\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"enableOpenTypeFeatures\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"doNotFlipMirrorIndents\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/></w:compat><w:themeFontLang w:val=\"en-US\" w:eastAsia=\"zh-CN\"/><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults><w:decimalSymbol w:val=\".\"/><w:listSeparator w:val=\",\"/>");
static std::wstring g_string_set_End = _T("</w:settings>");
class SettingWriter
{
std::wstring m_sDir;
XmlUtils::CStringWriter m_oSettingWriter;
NSStringUtils::CStringBuilder m_oSettingWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
public:
SettingWriter(std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir),m_oHeaderFooterWriter(oHeaderFooterWriter)

View File

@ -46,12 +46,12 @@ namespace Writers
class StylesWriter
{
XmlUtils::CStringWriter m_oWriter;
NSStringUtils::CStringBuilder m_oWriter;
std::wstring m_sDir;
public:
XmlUtils::CStringWriter m_Styles;
XmlUtils::CStringWriter m_rPrDefault;
XmlUtils::CStringWriter m_pPrDefault;
NSStringUtils::CStringBuilder m_Styles;
NSStringUtils::CStringBuilder m_rPrDefault;
NSStringUtils::CStringBuilder m_pPrDefault;
int m_nVersion;
StylesWriter(std::wstring sDir, int nVersion):m_sDir(sDir),m_nVersion(nVersion)
{

View File

@ -43,7 +43,7 @@ namespace Writers
class FontTableWriter
{
XmlUtils::CStringWriter m_oWriter;
NSStringUtils::CStringBuilder m_oWriter;
std::wstring m_sDir;
NSFonts::IApplicationFonts* m_pApplicationFonts;
NSFonts::IFontManager* m_pFontManager;

View File

@ -201,7 +201,10 @@ extern int g_nCurFormatVersion;
StyleLink = 23,
lvl_NumFmt = 24,
NumFmtVal = 25,
NumFmtFormat = 26
NumFmtFormat = 26,
Num_LvlOverride = 27,
StartOverride = 28,
ILvl = 29
};}
namespace c_oSerOtherTableTypes{enum c_oSerOtherTableTypes
{
@ -262,7 +265,14 @@ extern int g_nCurFormatVersion;
Style_RowPr = 15,
Style_CellPr = 16,
Style_TblStylePr = 17,
Style_Link = 18
Style_Link = 18,
Style_CustomStyle = 19,
Style_Aliases = 20,
Style_AutoRedefine = 21,
Style_Locked = 22,
Style_Personal = 23,
Style_PersonalCompose = 24,
Style_PersonalReply = 25
};}
namespace c_oSerProp_tblStylePrType{enum c_oSerProp_tblStylePrType
{

File diff suppressed because it is too large Load Diff

View File

@ -599,7 +599,7 @@ namespace BinXlsxRW{
//как в CsvReader - подозрительный код
WCHAR *pEndPtr;
wcstod(val.c_str(), &pEndPtr);
if (NULL != *pEndPtr)
if (0 != *pEndPtr)
{
// Не число
aSharedStrings.push_back(val);

View File

@ -341,7 +341,7 @@ bool BinDocxRW::CDocxSerializer::getXmlContent(NSBinPptxRW::CBinaryFileReader& o
long nLength = oBufferedStream.GetLong();
Writers::ContentWriter oTempContentWriter;
BinDocxRW::Binary_DocumentTableReader oBinary_DocumentTableReader(oBufferedStream, *m_pCurFileWriter, oTempContentWriter, m_pCurFileWriter->m_pComments);
int res = oBinary_DocumentTableReader.Read1(nLength, &BinDocxRW::Binary_DocumentTableReader::ReadDocumentContent, &oBinary_DocumentTableReader, NULL);
oBinary_DocumentTableReader.ReadDocumentContentOut(nLength);
sOutputXml = oTempContentWriter.m_oContent.GetData();
return true;
@ -433,13 +433,13 @@ bool BinDocxRW::CDocxSerializer::getXmlContentElem(OOX::EElementType eType, NSBi
if(OOX::et_m_oMathPara == eType)
{
oTempContentWriter.m_oContent.WriteString(std::wstring(_T("<m:oMathPara>")));
oBinary_DocumentTableReader.Read1(nLength, &BinDocxRW::Binary_DocumentTableReader::ReadMathOMathPara, &oBinary_DocumentTableReader, NULL);
oBinary_DocumentTableReader.ReadMathOMathParaOut(nLength);
oTempContentWriter.m_oContent.WriteString(std::wstring(_T("</m:oMathPara>")));
}
else if(OOX::et_m_oMath == eType)
{
oTempContentWriter.m_oContent.WriteString(std::wstring(_T("<m:oMath>")));
oBinary_DocumentTableReader.Read1(nLength, &BinDocxRW::Binary_DocumentTableReader::ReadMathArg, &oBinary_DocumentTableReader, NULL);
oBinary_DocumentTableReader.ReadMathArgOut(nLength);
oTempContentWriter.m_oContent.WriteString(std::wstring(_T("</m:oMath>")));
}

View File

@ -115,7 +115,7 @@ HRESULT convert_single(std::wstring srcFileName)
if (nResult == 0)
{
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), true))
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath, dstPath, true))
nResult = -2;
}

View File

@ -73,6 +73,7 @@ SOURCES += \
../src/odf/office_event_listeners.cpp \
../src/odf/office_presentation.cpp \
../src/odf/office_scripts.cpp \
../src/odf/office_forms.cpp \
../src/odf/office_settings.cpp \
../src/odf/office_spreadsheet.cpp \
../src/odf/office_text.cpp \
@ -184,6 +185,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 \
@ -211,6 +213,7 @@ SOURCES += \
../src/odf/datatypes/tablefunction.cpp \
../src/odf/datatypes/tableorder.cpp \
../src/odf/datatypes/dategroup.cpp \
../src/odfcommandtype.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
../src/docx/docx_content_type.cpp \
@ -335,6 +338,7 @@ HEADERS += \
../src/odf/office_event_listeners.h \
../src/odf/office_presentation.h \
../src/odf/office_scripts.h \
../src/odf/office_forms.h \
../src/odf/office_settings.h \
../src/odf/office_spreadsheet.h \
../src/odf/office_text.h \
@ -372,6 +376,7 @@ HEADERS += \
../src/odf/datatypes/mathvariant.h \
../src/odf/calcext_elements.h \
../src/odf/table_database_ranges.h \
../src/odfcommandtype.h \
../src/odf/datatypes/anchortype.h \
../src/odf/datatypes/backgroundcolor.h \
../src/odf/datatypes/bool.h \
@ -445,6 +450,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 \

View File

@ -63,6 +63,7 @@
#include "../src/odf/office_event_listeners.cpp"
#include "../src/odf/office_presentation.cpp"
#include "../src/odf/office_scripts.cpp"
#include "../src/odf/office_forms.cpp"
#include "../src/odf/office_settings.cpp"
#include "../src/odf/office_spreadsheet.cpp"
#include "../src/odf/office_text.cpp"

View File

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

View File

@ -42,6 +42,8 @@
#include "docx_conversion_context.h"
#include "../odf/odfcontext.h"
#include "../odf/text_content.h"
#include "../odf/calcs_styles.h"
#include "../odf/style_paragraph_properties.h"
#include "../odf/style_text_properties.h"
#include "../odf/style_table_properties.h"
@ -100,7 +102,7 @@ void text_tracked_context::start_change (std::wstring id)
}
void text_tracked_context::end_change ()
{
mapChanges_.insert( std::pair<std::wstring, _state>(current_state_.id, current_state_));
mapChanges_.insert( std::make_pair(current_state_.id, current_state_));
current_state_.clear();
}
@ -130,7 +132,54 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
return current_state_; //empty
}
//----------------------------------------------------------------------------------------------------------------
void text_forms_context::start_element (int type)
{
current_state_.clear();
current_state_.type = type;
}
void text_forms_context::set_id (const std::wstring& id)
{
current_state_.id = id;
}
void text_forms_context::set_name (const std::wstring& name)
{
current_state_.name = name;
}
void text_forms_context::set_label (const std::wstring& label)
{
current_state_.label = label;
}
void text_forms_context::set_uuid (const std::wstring& uuid)
{
current_state_.uuid = uuid;
}
void text_forms_context::set_value (const std::wstring &value)
{
current_state_.value = value;
}
void text_forms_context::set_element(odf_reader::form_element *elm)
{
current_state_.element = elm;
}
void text_forms_context::end_element ()
{
mapElements_.insert( std::make_pair(current_state_.id, current_state_));
current_state_.clear();
}
text_forms_context::_state& text_forms_context::get_state_element (std::wstring id)
{
std::map<std::wstring, _state>::iterator it = mapElements_.find(id);
if (it != mapElements_.end())
{
return it->second;
}
else
return current_state_; //empty
}
//----------------------------------------------------------------------------------------------------------------
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
next_dump_page_properties_ (false),
page_break_ (false),
@ -141,6 +190,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
in_paragraph_ (false),
in_header_ (false),
in_drawing_content_ (false),
in_table_content_ (false),
text_tracked_context_ (*this),
table_context_ (*this),
output_document_ (NULL),
@ -254,20 +304,21 @@ void docx_conversion_context::finish_paragraph()
void docx_conversion_context::finish_run()
{
if (in_run_)
{
output_stream() << L"</w:r>";
in_run_ = false;
if (get_comments_context().state()==2)
{
output_stream()<< L"<w:commentRangeEnd w:id=\"" << get_comments_context().current_id() << L"\" />";
add_element_to_run();
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().current_id() << L"\" />";
get_comments_context().state(0);
finish_run();
}
}
if (false == in_run_) return;
output_stream() << L"</w:r>";
in_run_ = false;
if (get_comments_context().state()==2)
{
output_stream()<< L"<w:commentRangeEnd w:id=\"" << get_comments_context().current_id() << L"\"/>";
add_element_to_run();
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().current_id() << L"\"/>";
get_comments_context().state(0);
finish_run();
}
}
void docx_conversion_context::start_math_formula()
{
@ -283,6 +334,73 @@ void docx_conversion_context::end_math_formula()
output_stream() << L"<m:oMath>" << math_content << L"</m:oMath>";
}
}
void docx_conversion_context::start_table_content(int type)
{
in_table_content_ = true;
std::wstring sType;
switch(type)
{
case 1: sType = L"Table of Contents"; break;
case 2: sType = L"List od Illustrations"; break;
}
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=\"" << sType << L"\"/>";
output_stream() << L"<w:docPartUnique/>";
output_stream() << L"</w:docPartObj>";
output_stream() << L"</w:sdtPr>";
output_stream() << L"<w:sdtContent>";
}
void docx_conversion_context::end_table_content()
{
if (!in_table_content_) return;
output_stream() << L"</w:sdtContent>";
output_stream() << L"</w:sdt>";
in_table_content_ = false;
}
void docx_conversion_context::start_bookmark (const std::wstring &name)
{
std::map<std::wstring, int>::iterator pFind = mapBookmarks.find(name);
int id = -1;
if (pFind == mapBookmarks.end())
{
id = mapBookmarks.size() + 1;
mapBookmarks.insert(std::make_pair(name, id));
}
else
{
id = pFind->second;
}
finish_run();
output_stream() << L"<w:bookmarkStart w:id=\"" << std::to_wstring(id) << L"\" w:name=\"" << name << L"\"/>";
}
void docx_conversion_context::end_bookmark (const std::wstring &name)
{
std::map<std::wstring, int>::iterator pFind = mapBookmarks.find(name);
int id = -1;
if (pFind == mapBookmarks.end())
{
return; //???
}
else
{
id = pFind->second;
}
finish_run();
output_stream() << L"<w:bookmarkEnd w:id=\"" << std::to_wstring(id) << L"\"/>";
}
void docx_conversion_context::start_chart(std::wstring name)
{
@ -333,17 +451,11 @@ hyperlinks::_ref docx_conversion_context::last_hyperlink()
return hyperlinks_.last();
}
void docx_conversion_context::dump_hyperlinks(rels & Rels, hyperlinks::_type_place type)
{
hyperlinks_.dump_rels(Rels, type);
}
void docx_conversion_context::dump_mediaitems(rels & Rels)
{
mediaitems_.dump_rels(Rels);
}
void docx_conversion_context::dump_headers_footers(rels & Rels) const
{
headers_footers_.dump_rels(Rels);
@ -353,12 +465,6 @@ void docx_conversion_context::dump_notes(rels & Rels) const
{
notes_context_.dump_rels(Rels);
}
std::wstring docx_conversion_context::add_mediaitem(const std::wstring & uri, RelsType type, bool & isInternal, std::wstring & ref)
{
return mediaitems_.add_or_find(uri, type, isInternal, ref);
}
void docx_conversion_context::start_document()
{
streams_man_ = streams_man::create(document_xml_);
@ -381,7 +487,11 @@ void docx_conversion_context::start_document()
output_stream() << L"xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" ";
output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" ";
output_stream() << L"xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" ";
output_stream() << L"mc:Ignorable=\"w14 wp14\">";
output_stream() << L"xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" ";
output_stream() << L"xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" ";
output_stream() << L"xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" ";
output_stream() << L"xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex\" ";
output_stream() << L"mc:Ignorable=\"w14 w15 w16se wne wp14\">";
//apply page-default prop
@ -868,13 +978,13 @@ bool docx_conversion_context::process_page_properties(std::wostream & strm)
void docx_conversion_context::end_process_style_content(bool in_styles)
{
docx_serialize_paragraph_style(output_stream(), automatic_parent_style_, in_styles);
serialize_paragraph_style(output_stream(), automatic_parent_style_, in_styles);
if (automatic_parent_style_.empty())
styles_context_.docx_serialize_text_style( output_stream(), L"", text_tracked_context_.dumpRPr_);
}
void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & strm, const std::wstring & ParentId, bool in_styles)
void docx_conversion_context::serialize_paragraph_style(std::wostream & strm, const std::wstring & ParentId, bool in_styles)
//in_styles = true -> styles.xml
//почему то конструкция <pPr><rPr/></pPr><rPr/> "не работает" в части в rPr в ms2010 )
{
@ -919,7 +1029,7 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
}
}
CP_XML_STREAM() << paragraph_style.str();
docx_serialize_list_properties(CP_XML_STREAM());
serialize_list_properties(CP_XML_STREAM());
if ((run_style.tellp() > 0 && in_styles == false) || !get_text_tracked_context().dumpRPrInsDel_.empty())
@ -1125,8 +1235,205 @@ std::wstring docx_conversion_context::find_list_rename(const std::wstring & List
void docx_conversion_context::end_list_item()
{
}
int docx_conversion_context::process_text_attr(odf_reader::text::paragraph_attrs *Attr)
{
if ( Attr->text_style_name_.empty() ) return 0;
void docx_conversion_context::docx_serialize_list_properties(std::wostream & strm)
odf_reader::style_instance * styleInst =
root()->odf_context().styleContainer().style_by_name(Attr->text_style_name_, odf_types::style_family::Paragraph, process_headers_footers_);
if (!styleInst) return 0;
if (false == styleInst->is_automatic()) return 0;
odf_reader::style_content *styleContent = styleInst->content();
if (!styleContent) return 0;
push_text_properties(styleContent->get_style_text_properties());
return 1;
}
int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_attrs *Attr)
{
if (!Attr) return 0;
bool in_drawing = false;
if (get_drawing_context().get_current_shape() || get_drawing_context().get_current_frame())
{
in_drawing = true;
}
if (false == Attr->text_style_name_.empty())
{
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_)
)
{
process_page_break_after(styleInst);
if (styleInst->is_automatic())
{
if (odf_reader::style_content * styleContent = styleInst->content())
{
std::wstring id;
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
{
id = styles_map_.get( parentStyleContent->name(), parentStyleContent->type() );
}
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_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);
}
}
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
}
styleContent->docx_convert(*this);
end_automatic_style();
push_text_properties(styleContent->get_style_text_properties());
if (!get_section_context().dump_.empty()
&& !get_table_context().in_table()
&& (get_process_note() == oox::docx_conversion_context::noNote)
&& !in_drawing)
{
output_stream() << L"<w:pPr>";
if (is_paragraph_header() )
{
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
output_stream() << L"</w:pPr>";
finish_paragraph();
start_paragraph();
}
else
{
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
output_stream() << L"</w:pPr>";
}
}
return 1;
}
}
else
{
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
output_stream() << L"<w:pPr>";
//todooo причесать
if (!get_section_context().dump_.empty()
&& !get_table_context().in_table()
&& (get_process_note() == oox::docx_conversion_context::noNote)
&& !in_drawing)
{
if (is_paragraph_header() )
{
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
output_stream() << L"</w:pPr>";
finish_paragraph();
start_paragraph();
output_stream() << L"<w:pPr>";
}
else
{
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
}
}
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
if (!get_text_tracked_context().dumpPPr_.empty())
{
output_stream() << get_text_tracked_context().dumpPPr_;
get_text_tracked_context().dumpPPr_.clear();
}
serialize_list_properties(output_stream());
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
{
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\" />";
}
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
{
output_stream() << L"<w:rPr>";
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
get_text_tracked_context().dumpRPrInsDel_.clear();
output_stream() << L"</w:rPr>";
}
output_stream() << L"</w:pPr>";
return 2;
}
}
}
if (!get_section_context().dump_.empty()
&& !get_table_context().in_table()
&& (get_process_note() == oox::docx_conversion_context::noNote)
&& !in_drawing)
{
output_stream() << L"<w:pPr>";
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
//todooo выяснить реальны ли заголовки без стилей и свойств
output_stream() << L"</w:pPr>";
return 3;
}
return 0;
}
void docx_conversion_context::process_page_break_after(const odf_reader::style_instance * styleInst)
{
if (styleInst)
{
const odf_reader::style_instance * inst = styleInst;
while (inst)
{
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_;
if (fo_break_val)
{
if (fo_break_val->get_type() == odf_types::fo_break::Page)
{
set_page_break_after(true);
break;
}
else if (fo_break_val->get_type() == odf_types::fo_break::Auto)
{
break;
}
}
}
inst = inst->parent();
}
}
}
void docx_conversion_context::serialize_list_properties(std::wostream & strm)
{
if (!list_style_stack_.empty())
{
@ -1203,7 +1510,7 @@ namespace
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
rels internal_rels;
Context.dump_mediaitems(internal_rels);
Context.get_mediaitems().dump_rels(internal_rels);
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);

View File

@ -33,20 +33,20 @@
#include "../odf/datatypes/stylefamily.h"
#include "../odf/datatypes/length.h"
#include "../odf/datatypes/noteclass.h"
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <list>
#include "hyperlinks.h"
#include "mediaitems.h"
#include "headers_footers.h"
#include "docx_table_context.h"
#include "../odf/datatypes/noteclass.h"
#include "oox_conversion_context.h"
#include "oox_chart_context.h"
#include "headers_footers.h"
#include "hyperlinks.h"
#include "mediaitems.h"
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
namespace cpdoccore {
@ -62,12 +62,15 @@ namespace cpdoccore {
class style_text_properties;
class draw_frame;
class draw_shape;
class draw_control;
class office_element;
class style_columns;
class form_element;
namespace text
{
class note_citation;
class paragraph_attrs;
}
}
@ -117,8 +120,6 @@ private:
std::wstring name(const std::wstring & Name, odf_types::style_family::type Type);
size_t count_;
//boost::unordered_map<std::wstring, std::wstring> map_;
std::multimap<std::wstring, std::wstring> map_;
};
@ -164,7 +165,16 @@ public:
current_object_name_ = L"";
current_shape_ = drawShape;
}
void start_group()
void start_control(odf_reader::draw_control * drawControl)
{
current_level_++;
objects_count_++;
current_shape_id_ = objects_count_;
current_object_name_ = L"";
current_control_ = drawControl;
}
void start_group()
{
current_level_++;
objects_count_++;
@ -212,6 +222,7 @@ public:
{
current_level_--;
frames_.pop_back();
caption_.clear();
}
std::wstring & get_text_stream_frame()
@ -228,7 +239,6 @@ public:
else
throw;
}
std::wstring & get_text_stream_shape()
{
return shape_text_content_;
@ -239,15 +249,24 @@ public:
}
void clear_stream_frame()
{
if (frames_.size()>0)
frames_.back().text_content=L"";
if (!frames_.empty())
frames_.back().text_content.clear();
}
void stop_shape()
{
current_level_--;
current_shape_ = NULL;
shape_text_content_=L"";
current_shape_id_ =0;
shape_text_content_.clear();
current_shape_id_ = 0;
caption_.clear();
}
void stop_control()
{
current_level_--;
current_control_ = NULL;
shape_text_content_.clear();
current_shape_id_ = 0;
caption_.clear();
}
void stop_group()
{
@ -257,10 +276,10 @@ public:
int get_current_frame_id() const
{
if (frames_.size()>0) return frames_.back().id;
if (!frames_.empty()) return frames_.back().id;
else return 0;
}
bool in_group() { return groups_.size() > 0; }
bool in_group() { return !groups_.empty(); }
int get_current_level() const { return current_level_; }
int get_current_shape_id() const { return current_shape_id_; }
@ -268,10 +287,15 @@ public:
odf_reader::draw_frame * get_current_frame() const
{
if (frames_.size()>0) return frames_.back().ptr;
if (!frames_.empty()) return frames_.back().ptr;
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_;
@ -284,10 +308,13 @@ private:
std::vector<_group> groups_;
std::vector<_frame> frames_;
odf_reader::draw_shape * current_shape_;
odf_reader::draw_shape *current_shape_;
size_t current_shape_id_;
odf_reader::draw_control*current_control_;
std::wstring zero_string_;
std::wstring caption_;
};
@ -544,6 +571,48 @@ private:
std::map<std::wstring, _state> mapChanges_;
};
class text_forms_context
{
public:
struct _state
{
std::wstring id;
std::wstring name;
int type = 0; //enum?
std::wstring label;
std::wstring uuid;
std::wstring value;
odf_reader::form_element* element = NULL;
void clear()
{
type = 0;
id.clear();
name.clear();
label.clear();
value.clear();
uuid.clear();
element = NULL;
}
};
text_forms_context(){}
void start_element (int type);
void set_id (const std::wstring& id);
void set_name (const std::wstring& name);
void set_label (const std::wstring& label);
void set_uuid (const std::wstring& uuid);
void set_value (const std::wstring& value);
void set_element(odf_reader::form_element *elm);
void end_element ();
_state& get_state_element (std::wstring id);
private:
_state current_state_;
std::map<std::wstring, _state> mapElements_;
};
//---------------------------------------------------------------------------------------------------------
class docx_conversion_context : boost::noncopyable
{
@ -576,11 +645,13 @@ public:
void start_paragraph (bool is_header = false);
void finish_paragraph ();
bool is_table_content () { return in_table_content_; }
bool is_paragraph_header () { return in_header_; }
bool get_paragraph_state () { return in_paragraph_; }
void set_paragraph_state (bool val) { in_paragraph_ = val; }
bool get_paragraph_keep () { return is_paragraph_keep_;}
void set_paragraph_keep (bool val) { is_paragraph_keep_ = val; }
bool get_delete_text_state () { return is_delete_text_; }
void set_delete_text_state (bool Val) { is_delete_text_ = Val; }
@ -591,9 +662,6 @@ public:
hyperlinks::_ref last_hyperlink ();
void dump_hyperlinks (rels & Rels, hyperlinks::_type_place type);
std::wstring add_mediaitem(const std::wstring & uri, RelsType type, bool & isInternal, std::wstring & ref);
void dump_mediaitems (rels & Rels);
void dump_headers_footers (rels & Rels) const;
void dump_notes (rels & Rels) const;
@ -616,7 +684,10 @@ public:
void start_office_text ();
void end_office_text ();
void process_styles ();
void start_table_content (int type);
void end_table_content ();
void process_styles ();
void process_fonts ();
void process_list_styles ();
@ -624,6 +695,10 @@ public:
void process_comments ();
bool process_page_properties(std::wostream & strm);
void process_section (std::wostream & strm, odf_reader::style_columns * columns = NULL);
int process_paragraph_attr (odf_reader::text::paragraph_attrs *attr);
int process_text_attr (odf_reader::text::paragraph_attrs *Attr);
void process_page_break_after(const odf_reader::style_instance *styleInst);
std::vector<odf_reader::_property> & get_settings_properties ();
void set_settings_property (const odf_reader::_property & prop);
@ -670,13 +745,14 @@ public:
void start_list_item (bool restart = false);
void end_list_item ();
void docx_serialize_list_properties(std::wostream & strm);
void docx_serialize_paragraph_style(std::wostream & strm, const std::wstring & ParentId, bool in_styles = false);
void serialize_list_properties(std::wostream & strm);
void serialize_paragraph_style(std::wostream & strm, const std::wstring & ParentId, bool in_styles = false);
std::wstring find_list_rename(const std::wstring & ListStyleName) const;
styles_map * get_style_map() { return &styles_map_; }
mediaitems & get_mediaitems() {return mediaitems_;}
styles_context & get_styles_context() { return styles_context_; }
drawing_context & get_drawing_context() { return drawing_context_; }
comments_context & get_comments_context() { return comments_context_; }
@ -684,6 +760,7 @@ public:
section_context & get_section_context() { return section_context_; }
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_; }
void docx_convert_delayed ();
void add_delayed_element (odf_reader::office_element * Elm);
@ -717,6 +794,9 @@ public:
void start_text_changes (std::wstring id);
void end_text_changes (std::wstring id);
void start_bookmark (const std::wstring &name);
void end_bookmark (const std::wstring &name);
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_; }
@ -753,6 +833,7 @@ private:
header_footer_context header_footer_context_;
notes_context notes_context_;
text_tracked_context text_tracked_context_;
text_forms_context text_forms_context_;
boost::shared_ptr<streams_man> streams_man_;
@ -779,6 +860,7 @@ private:
bool in_automatic_style_;
bool in_drawing_content_;
bool in_table_content_;
bool in_paragraph_;
bool in_run_;
bool in_header_;
@ -797,6 +879,7 @@ private:
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;
};
}

View File

@ -607,6 +607,42 @@ void docx_serialize_object(std::wostream & strm, _docx_drawing & val)
}
}
void docx_serialize_control(std::wostream & strm, _docx_drawing & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"w:pict")
{
CP_XML_NODE(L"v:shape")
{
CP_XML_ATTR(L"id", L"control_" + val.objectId);
std::wstring style_str; // = L"width:730.6pt; height:261.8pt";
style_str += L"width:" + boost::lexical_cast<std::wstring>(val.cx / 12700.) + L"pt;";
style_str += L"height:" + boost::lexical_cast<std::wstring>(val.cy / 12700.) + L"pt;";
CP_XML_ATTR(L"style", style_str);
if (val.fill.bitmap)
{
CP_XML_NODE(L"v:imagedata")
{
CP_XML_ATTR(L"o:title", val.name);
CP_XML_ATTR(L"r:id", val.fill.bitmap->rId);
}
}
}
CP_XML_NODE(L"w:control")
{
CP_XML_ATTR(L"w:name", val.name);
CP_XML_ATTR(L"w:shapeid", L"control_" + val.objectId);
CP_XML_ATTR(L"r:id", val.objectId);
}
}
}
}
void _docx_drawing::serialize(std::wostream & strm/*, bool insideOtherDrawing*/)
{
if (type == typeUnknown) return;
@ -619,6 +655,10 @@ void _docx_drawing::serialize(std::wostream & strm/*, bool insideOtherDrawing*/)
{
docx_serialize_object(strm, *this);
}
else if (type == typeControl)
{
docx_serialize_control(strm, *this);
}
else
{
//if (insideOtherDrawing)

View File

@ -134,8 +134,9 @@ void word_files::write(const std::wstring & RootPath)
void word_files::update_rels(docx_conversion_context & Context)
{
Context.get_mediaitems().dump_rels(rels_files_.get_rel_file()->get_rels());
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), hyperlinks::document_place);
Context.dump_mediaitems (rels_files_.get_rel_file()->get_rels());
Context.dump_headers_footers(rels_files_.get_rel_file()->get_rels());
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
}

View File

@ -39,10 +39,9 @@
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

@ -70,7 +70,14 @@ void oox_chart_context::reset_fill(oox::_oox_fill &f)
rels_.push_back(_rel(isInternal, f.bitmap->rId, ref, typeImage));
}
}
void oox_chart_context::set_externalData(const std::wstring & href)
{
bool isInternal = true;
std::wstring href_out;
externalDataId_ = mediaitems_.add_or_find(href, typeMsObject, isInternal, href_out);
rels_.push_back(_rel(isInternal, externalDataId_, href_out, typeMsObject));
}
std::wostream & oox_chart_context::chartData()
{
return impl_->chartData_;
@ -78,7 +85,7 @@ std::wostream & oox_chart_context::chartData()
void oox_chart_context::dump_rels(rels & Rels)
{
for (int i = 0; i < rels_.size(); i++)
for (size_t i = 0; i < rels_.size(); i++)
{
_rel & r = rels_[i];
@ -88,8 +95,7 @@ void oox_chart_context::dump_rels(rels & Rels)
r.rid,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
r.is_internal ? std::wstring(L"../") + r.ref : r.ref,
(r.is_internal ? L"" : L"External")
)
(r.is_internal ? L"" : L"External"))
);
}
else if (r.type == typeHyperlink)
@ -101,6 +107,15 @@ void oox_chart_context::dump_rels(rels & Rels)
L"External")
);
}
else if (r.type == typeMsObject)
{
Rels.add(relationship(
r.rid,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package",
r.is_internal ? std::wstring(L"../") + r.ref : r.ref,
(r.is_internal ? L"" : L"External"))
);
}
}
}
@ -199,10 +214,21 @@ void oox_chart_context::serialize(std::wostream & strm)
}
}
}
if (externalDataId_.empty() == false)
{
CP_XML_NODE(L"c:externalData")
{
CP_XML_ATTR(L"r:id", externalDataId_);
CP_XML_NODE(L"c:autoUpdate")
{
CP_XML_ATTR(L"val", false);
}
}
}
}
}
}
oox_chart_context::~oox_chart_context()
{
}

View File

@ -82,6 +82,7 @@ public:
plot_area_.charts_[i]->is3D_ = val;
}
}
void set_externalData(const std::wstring & href);
void add_chart(int type)
{
plot_area_.add_chart(type);
@ -135,6 +136,7 @@ private:
cpdoccore::oox::oox_chart_legend legend_;
std::wstring pivot_source_;
std::wstring externalDataId_;
std::vector<odf_reader::_property> graphic_properties_;
_oox_fill fill_;

View File

@ -70,17 +70,12 @@ void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & f
if (ind == 0)
{
if (std::wstring::npos != value.find(L"local-table")) return;
values_[ind].strRef_.formula = converter.convert_chart_distance(value);
values_[ind].strRef_.present = true;
values_[ind].present = true;
}
else
{
if (std::wstring::npos != value.find(L"local-table") && !bLocalTable_ ) return;
//в xlsx низя .... нужно сделать тогда отдельную table.xml
values_[ind].numRef_.formula = converter.convert_chart_distance(value);
values_[ind].numRef_.present = true;
values_[ind].numRef_.formatCode = formatCode;

View File

@ -55,7 +55,8 @@ enum RelsType
typeOleObject,
typeSlide,
typeVideo,
typeAudio
typeAudio,
typeControl
};
struct _rel

View File

@ -184,7 +184,7 @@ void oox_bar_chart::oox_serialize(std::wostream & _Wostream)
}
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
CP_XML_ATTR(L"val", varyColors_ ? L"1" : L"0");
}
oox_serialize_common(CP_XML_STREAM());
@ -226,7 +226,7 @@ void oox_line_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
CP_XML_ATTR(L"val", varyColors_ ? L"1" : L"0");
}
oox_serialize_common(CP_XML_STREAM());
@ -259,7 +259,7 @@ void oox_area_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
CP_XML_ATTR(L"val", varyColors_ ? L"1" : L"0");
}
oox_serialize_common(CP_XML_STREAM());
@ -289,7 +289,7 @@ void oox_bubble_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
CP_XML_ATTR(L"val", varyColors_ ? L"1" : L"0");
}
oox_serialize_common(CP_XML_STREAM());
//CP_XML_NODE(L"c:bubbleScale")
@ -326,7 +326,7 @@ void oox_doughnut_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
CP_XML_ATTR(L"val", varyColors_ ? L"1" : L"0");
}
oox_serialize_common(CP_XML_STREAM());
@ -366,7 +366,7 @@ void oox_pie_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
CP_XML_ATTR(L"val", varyColors_ ? L"1" : L"0");
}
oox_serialize_common(CP_XML_STREAM());
}
@ -398,7 +398,7 @@ void oox_radar_chart::oox_serialize(std::wostream & _Wostream)
}
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
CP_XML_ATTR(L"val", varyColors_ ? L"1" : L"0");
}
oox_serialize_common(CP_XML_STREAM());
@ -436,7 +436,7 @@ void oox_scatter_chart::oox_serialize(std::wostream & _Wostream)
}
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
CP_XML_ATTR(L"val", varyColors_ ? L"1" : L"0");
}
oox_serialize_common(CP_XML_STREAM());

View File

@ -67,6 +67,7 @@ public:
is3D_ = false;
type_ = 0;
dispBlanksAs_ = L"zero";
varyColors_ = true;
}
~oox_chart(){}
@ -99,6 +100,7 @@ public:
int type_;
bool is3D_;
bool varyColors_;
std::wstring dispBlanksAs_;
std::vector<int> axisId_; // axId (Axis ID) §21.2.2.9
std::wstring grouping_; // clustered | percentStacked | stacked | standard

View File

@ -54,7 +54,7 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
odf_reader::GetProperty ( val.additional ,L"text-content", strTextContent);
if (!strTextContent)return;
if (strTextContent.get().length()<1)return;
if (strTextContent->empty())return;
CP_XML_WRITER(strm)
{
@ -65,7 +65,7 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
CP_XML_NODE(L"a:lstStyle");
if (strTextContent)
{
CP_XML_STREAM() << strTextContent.get();
CP_XML_STREAM() << *strTextContent;
}
}
}

View File

@ -38,6 +38,7 @@
#include "office_spreadsheet.h"
#include "office_presentation.h"
#include "office_scripts.h"
#include "office_forms.h"
#include "office_settings.h"
#include "paragraph_elements.h"
#include "office_binary_data.h"

View File

@ -212,7 +212,14 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
oox_convert(chart_context);
chart_context.set_cache_only(true);
if (embeddedData.empty())
{
chart_context.set_cache_only(true);
}
else
{
chart_context.set_externalData(embeddedData);
}
Context.end_chart();
}
@ -259,7 +266,14 @@ void object_odf_context::pptx_convert(oox::pptx_conversion_context & Context)
oox_convert(chart_context);
chart_context.set_cache_only(true);
if (embeddedData.empty())
{
chart_context.set_cache_only(true);
}
else
{
chart_context.set_externalData(embeddedData);
}
Context.end_chart();
}
else if (object_type_ == 2 && office_text_)
@ -382,6 +396,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
if (!current) continue;
if (1 == series_.size())
{
current->varyColors_ = false;
}
current->set_properties(plot_area_.properties_);
current->set_additional_properties(chart_graphic_properties_);
@ -420,7 +439,8 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
formatCode = *strVal;
}
if (domain_cell_range_adress_.empty() == false)
if (domain_cell_range_adress_.empty() == false ||
last_set_type == chart_scatter)
{
if (last_set_type == chart_bubble)
{ //bubble(x)
@ -434,13 +454,19 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
}
else
{ //x
if (!bPivotChart_)
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (2, domain_cash);
if (false == domain_cash.empty())
{
if (!bPivotChart_)
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (2, domain_cash);
}
//y
if (!bPivotChart_)
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series (3, cell_cash);
if (false == cell_cash.empty())
{
if (!bPivotChart_)
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series (3, cell_cash);
}
}
}
else
@ -476,7 +502,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
is3D = true;
}
for (int i = 0; i < axises_.size(); i++)
for (size_t i = 0; i < axises_.size(); i++)
{
axis & a = axises_[i];
@ -667,7 +693,7 @@ void process_build_object::visit(office_body& val)
}
void process_build_object::visit(office_chart& val)
{
ACCEPT_ALL_CONTENT_CONST(val.content_);
ACCEPT_ALL_CONTENT(val.content_);
}
void process_build_object::visit(office_text& val)
{
@ -684,7 +710,7 @@ void process_build_object::visit(office_spreadsheet& val)
object_odf_context_.object_type_ = 4;
object_odf_context_.office_spreadsheet_ = &val; //конвертация будет уровнем выше
}
void process_build_object::visit(const chart_chart& val)
void process_build_object::visit(chart_chart& val)
{
object_odf_context_.object_type_ = 1;
@ -704,11 +730,11 @@ void process_build_object::visit(const chart_chart& val)
if (val.attlist_.loext_data_pilot_source_)
object_odf_context_.set_pivot_source(*val.attlist_.loext_data_pilot_source_);
ACCEPT_ALL_CONTENT_CONST(val.content_);
ACCEPT_ALL_CONTENT(val.content_);
}
void process_build_object::visit(const chart_title& val)
void process_build_object::visit(chart_title& val)
{
title t;
@ -735,7 +761,7 @@ void process_build_object::visit(const chart_title& val)
}
void process_build_object::visit(const chart_subtitle & val)
void process_build_object::visit(chart_subtitle & val)
{
title t;
std::wstringstream v;
@ -751,7 +777,7 @@ void process_build_object::visit(const chart_subtitle & val)
object_odf_context_.sub_title_ = t;
}
void process_build_object::visit(const chart_footer& val)
void process_build_object::visit(chart_footer& val)
{
object_odf_context_.footer_.bEnabled = true;
@ -760,7 +786,7 @@ void process_build_object::visit(const chart_footer& val)
ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.footer_.text_properties_);
}
void process_build_object::visit(const chart_legend& val)
void process_build_object::visit(chart_legend& val)
{
object_odf_context_.legend_.bEnabled = true;
object_odf_context_.legend_.position = L"r";
@ -791,9 +817,9 @@ void process_build_object::visit(const chart_legend& val)
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.text_properties_);
}
void process_build_object::visit(const chart_plot_area& val)
void process_build_object::visit(chart_plot_area& val)
{
ACCEPT_ALL_CONTENT_CONST(val.content_);
ACCEPT_ALL_CONTENT(val.content_);
object_odf_context_.plot_area_.cell_range_address_ = val.attlist_.table_cell_range_address_.get_value_or(L"");
@ -803,13 +829,13 @@ void process_build_object::visit(const chart_plot_area& val)
}
void process_build_object::visit(const chart_axis& val)
void process_build_object::visit(chart_axis& val)
{
object_odf_context_.start_axis(val.attlist_.chart_dimension_.get_value_or(L""),
val.attlist_.chart_name_.get_value_or(L""),
val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""));
ACCEPT_ALL_CONTENT_CONST(val.content_);
ACCEPT_ALL_CONTENT(val.content_);
std::wstring style_name = val.attlist_.common_attlist_.chart_style_name_.get_value_or(L"");
@ -820,7 +846,7 @@ void process_build_object::visit(const chart_axis& val)
object_odf_context_.end_axis();
}
void process_build_object::visit(const chart_series& val)
void process_build_object::visit(chart_series& val)
{
const chart_series_attlist & att = val.attlist_;
@ -834,7 +860,7 @@ void process_build_object::visit(const chart_series& val)
att.common_attlist_.chart_style_name_.get_value_or(L"")
);
ACCEPT_ALL_CONTENT_CONST(val.content_);
ACCEPT_ALL_CONTENT(val.content_);
ApplyChartProperties (att.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().properties_);
ApplyGraphicProperties (att.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().graphic_properties_,object_odf_context_.series_.back().fill_);
@ -842,14 +868,14 @@ void process_build_object::visit(const chart_series& val)
}
void process_build_object::visit(const chart_domain& val)
void process_build_object::visit(chart_domain& val)
{
if (object_odf_context_.domain_cell_range_adress_.empty())
object_odf_context_.domain_cell_range_adress_ = val.table_cell_range_address_.get_value_or(L"");
else
object_odf_context_.domain_cell_range_adress2_ = val.table_cell_range_address_.get_value_or(L"");
}
void process_build_object::visit(const chart_grid& val)
void process_build_object::visit(chart_grid& val)
{
object_odf_context_.add_grid(val.attlist_.chart_class_.get_value_or(L""),
val.attlist_.common_attlist_.chart_style_name_.get_value_or(L"") );
@ -859,7 +885,7 @@ void process_build_object::visit(const chart_grid& val)
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), (object_odf_context_.axises_.back()).grids_.back().graphic_properties_, fill);
}
void process_build_object::visit(const chart_wall& val)
void process_build_object::visit(chart_wall& val)
{
object_odf_context_.wall_.bEnabled = true;
@ -868,7 +894,7 @@ void process_build_object::visit(const chart_wall& val)
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.wall_.text_properties_);
}
void process_build_object::visit(const chart_floor& val)
void process_build_object::visit(chart_floor& val)
{
object_odf_context_.floor_.bEnabled = true;
@ -877,7 +903,7 @@ void process_build_object::visit(const chart_floor& val)
ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.floor_.text_properties_);
}
void process_build_object::visit(const chart_data_point & val)
void process_build_object::visit(chart_data_point & val)
{
object_odf_context_.add_point( val.attlist_.chart_repeated_.get_value_or(1));
@ -892,16 +918,16 @@ void process_build_object::visit(const chart_data_point & val)
}
}
void process_build_object::visit(const chart_mean_value & val)
void process_build_object::visit(chart_mean_value & val)
{
ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().mean_value_.properties_);
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().mean_value_.graphic_properties_, object_odf_context_.series_.back().mean_value_.fill_);
}
void process_build_object::visit(const chart_error_indicator & val)
void process_build_object::visit(chart_error_indicator & val)
{
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().error_indicator_.graphic_properties_,object_odf_context_.series_.back().error_indicator_.fill_ );
}
void process_build_object::visit(const chart_regression_curve & val)
void process_build_object::visit(chart_regression_curve & val)
{
oox::_oox_fill fill;
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().regression_curve_.line_properties_, fill);
@ -913,7 +939,7 @@ void process_build_object::visit(const chart_regression_curve & val)
val.chart_equation_->accept(*this);
}
}
void process_build_object::visit(const chart_equation & val)
void process_build_object::visit(chart_equation & val)
{
if (object_odf_context_.series_.back().regression_curve_.bEquation == false)return;
@ -925,7 +951,7 @@ void process_build_object::visit(const chart_equation & val)
ApplyTextProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().regression_curve_.equation_properties_.text_properties_);
}
void process_build_object::visit(const chart_categories& val)
void process_build_object::visit(chart_categories& val)
{
if (object_odf_context_.in_axis_)
{
@ -936,49 +962,48 @@ void process_build_object::visit(const chart_categories& val)
if (val.table_cell_range_address_)
object_odf_context_.add_categories(*val.table_cell_range_address_);
}
void process_build_object::visit(const table_table& val)
void process_build_object::visit(table_table& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_columns_and_groups_.content_);
ACCEPT_ALL_CONTENT_CONST(val.table_rows_and_groups_.content_);
object_odf_context_.table_table_ = &val;
ACCEPT_ALL_CONTENT(val.table_columns_and_groups_.content_);
ACCEPT_ALL_CONTENT(val.table_rows_and_groups_.content_);
}
void process_build_object::visit(const table_table_rows& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_table_row_);
}
void process_build_object::visit(table_table_rows& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_table_row_);
ACCEPT_ALL_CONTENT(val.table_table_row_);
}
void process_build_object::visit(const table_table_row & val)
void process_build_object::visit(table_table_row & val)
{
unsigned int repeated = val.attlist_.table_number_rows_repeated_;
ACCEPT_ALL_CONTENT_CONST(val.content_);
ACCEPT_ALL_CONTENT(val.content_);
visit_rows(repeated);
}
void process_build_object::visit(const table_table_column& val)
void process_build_object::visit(table_table_column& val)
{
const unsigned int columnsRepeated = val.table_table_column_attlist_.table_number_columns_repeated_;
visit_column(columnsRepeated);
}
void process_build_object::visit(const table_table_row_group& val)
void process_build_object::visit(table_table_row_group& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_rows_and_groups_.content_);
ACCEPT_ALL_CONTENT(val.table_rows_and_groups_.content_);
}
void process_build_object::visit(const table_table_column_group& val)
void process_build_object::visit(table_table_column_group& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_columns_and_groups_.content_);
ACCEPT_ALL_CONTENT(val.table_columns_and_groups_.content_);
}
void process_build_object::visit(table_table_columns& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_table_column_);
ACCEPT_ALL_CONTENT(val.table_table_column_);
}
void process_build_object::visit(const table_columns_no_group& val)
void process_build_object::visit(table_columns_no_group& val)
{
if (val.table_columns_1_.table_table_columns_)
val.table_columns_1_.table_table_columns_->accept(*this);
ACCEPT_ALL_CONTENT_CONST(val.table_columns_1_.table_table_column_);
ACCEPT_ALL_CONTENT(val.table_columns_1_.table_table_column_);
if (val.table_table_header_columns_)
val.table_table_header_columns_->accept(*this);
@ -986,14 +1011,14 @@ void process_build_object::visit(const table_columns_no_group& val)
if (val.table_columns_2_.table_table_columns_)
val.table_columns_2_.table_table_columns_->accept(*this);
ACCEPT_ALL_CONTENT_CONST(val.table_columns_2_.table_table_column_);
ACCEPT_ALL_CONTENT(val.table_columns_2_.table_table_column_);
}
void process_build_object::visit(const table_rows_no_group& val)
void process_build_object::visit(table_rows_no_group& val)
{
if (val.table_rows_1_.table_table_rows_)
val.table_rows_1_.table_table_rows_->accept(*this);
else
ACCEPT_ALL_CONTENT_CONST(val.table_rows_1_.table_table_row_);
ACCEPT_ALL_CONTENT(val.table_rows_1_.table_table_row_);
if (val.table_table_header_rows_)
val.table_table_header_rows_->accept(*this);
@ -1001,9 +1026,9 @@ void process_build_object::visit(const table_rows_no_group& val)
if (val.table_rows_2_.table_table_rows_)
val.table_rows_2_.table_table_rows_->accept(*this);
else
ACCEPT_ALL_CONTENT_CONST(val.table_rows_2_.table_table_row_);
ACCEPT_ALL_CONTENT(val.table_rows_2_.table_table_row_);
}
void process_build_object::visit(const table_table_cell& val)
void process_build_object::visit(table_table_cell& val)
{
const table_table_cell_attlist & attlist = val.attlist_;
@ -1046,7 +1071,7 @@ void process_build_object::visit(const table_table_cell& val)
object_odf_context_.cash_pivot.insert(std::make_pair(cell_desc, cell_));
}
}
void process_build_object::visit(const table_covered_table_cell& val)
void process_build_object::visit(table_covered_table_cell& val)
{
unsigned int repeated = val.attlist_.table_number_columns_repeated_;
@ -1055,15 +1080,11 @@ void process_build_object::visit(const table_covered_table_cell& val)
}
void process_build_object::visit(table_table_header_columns& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_table_column_);
}
void process_build_object::visit(const table_table_header_rows& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_table_row_);
ACCEPT_ALL_CONTENT(val.table_table_column_);
}
void process_build_object::visit(table_table_header_rows& val)
{
ACCEPT_ALL_CONTENT_CONST(val.table_table_row_);
ACCEPT_ALL_CONTENT(val.table_table_row_);
}
}
}

View File

@ -120,6 +120,7 @@ public:
office_text_ (NULL),
office_math_ (NULL),
office_spreadsheet_ (NULL),
table_table_ (NULL),
baseRef_ (ref),
baseFontHeight_ (12)
{
@ -164,6 +165,7 @@ public:
office_text *office_text_;
office_math *office_math_;
office_spreadsheet *office_spreadsheet_;
table_table *table_table_;
int baseFontHeight_;
std::wstring baseRef_;
@ -203,6 +205,7 @@ public:
std::vector<_cell> cash_values;
std::map<std::wstring, _cell>cash_pivot;
std::wstring embeddedData;
//---------------------------------------
std::wstring target_table_;
std::wstring table_name_;
@ -234,48 +237,45 @@ class process_build_object
public visitor<office_math>,
public visitor<office_spreadsheet>,
public const_visitor<chart_chart>,
public visitor<chart_chart>,
public const_visitor<chart_title>,
public const_visitor<chart_subtitle>,
public const_visitor<chart_footer>,
public const_visitor<chart_legend>,
public visitor<chart_title>,
public visitor<chart_subtitle>,
public visitor<chart_footer>,
public visitor<chart_legend>,
public const_visitor<chart_plot_area>,
public visitor<chart_plot_area>,
public const_visitor<chart_axis>,
public const_visitor<chart_categories>,
public const_visitor<chart_grid>,
public visitor<chart_axis>,
public visitor<chart_categories>,
public visitor<chart_grid>,
public const_visitor<chart_series>,
public const_visitor<chart_domain>,
public const_visitor<chart_data_point>,
public const_visitor<chart_mean_value>,
public const_visitor<chart_regression_curve>,
public const_visitor<chart_equation>,
public const_visitor<chart_error_indicator>,
public const_visitor<chart_wall>,
public const_visitor<chart_floor>,
public visitor<chart_series>,
public visitor<chart_domain>,
public visitor<chart_data_point>,
public visitor<chart_mean_value>,
public visitor<chart_regression_curve>,
public visitor<chart_equation>,
public visitor<chart_error_indicator>,
public visitor<chart_wall>,
public visitor<chart_floor>,
public const_visitor<table_table>,
public visitor<table_table>,
public const_visitor<table_table_row_group>,
public const_visitor<table_rows_no_group>,
public const_visitor<table_table_header_rows>,
public const_visitor<table_table_rows>,
public const_visitor<table_table_row>,
public visitor<table_table_rows>,
public visitor<table_table_row_group>,
public visitor<table_rows_no_group>,
public visitor<table_table_header_rows>,
public visitor<table_table_rows>,
public visitor<table_table_row>,
public const_visitor<table_table_cell>,
public const_visitor<table_covered_table_cell>,
public visitor<table_table_cell>,
public visitor<table_covered_table_cell>,
public const_visitor<table_table_column_group>,
public visitor<table_table_column_group>,
public visitor<table_table_header_columns>,
public visitor<table_table_columns>,
public const_visitor<table_table_column>,
public const_visitor<table_columns_no_group>
public visitor<table_table_column>,
public visitor<table_columns_no_group>
{
public:
@ -303,44 +303,39 @@ public:
virtual void visit(office_math & val);
virtual void visit(office_spreadsheet & val);
virtual void visit(const chart_chart & val);
virtual void visit(const chart_title & val);
virtual void visit(const chart_subtitle & val);
virtual void visit(const chart_footer & val);
virtual void visit(const chart_legend & val);
virtual void visit(const chart_plot_area& val);
virtual void visit(const chart_axis & val);
virtual void visit(const chart_series & val);
virtual void visit(const chart_domain & val);
virtual void visit(const chart_data_point & val);
virtual void visit(const chart_mean_value & val);
virtual void visit(const chart_error_indicator & val);
virtual void visit(const chart_regression_curve & val);
virtual void visit(const chart_equation & val);
virtual void visit(const chart_categories & val);
virtual void visit(const chart_grid & val);
virtual void visit(const chart_wall & val);
virtual void visit(const chart_floor & val);
virtual void visit(const table_table & val);
virtual void visit(chart_chart & val);
virtual void visit(chart_title & val);
virtual void visit(chart_subtitle & val);
virtual void visit(chart_footer & val);
virtual void visit(chart_legend & val);
virtual void visit(chart_plot_area& val);
virtual void visit(chart_axis & val);
virtual void visit(chart_series & val);
virtual void visit(chart_domain & val);
virtual void visit(chart_data_point & val);
virtual void visit(chart_mean_value & val);
virtual void visit(chart_error_indicator & val);
virtual void visit(chart_regression_curve & val);
virtual void visit(chart_equation & val);
virtual void visit(chart_categories & val);
virtual void visit(chart_grid & val);
virtual void visit(chart_wall & val);
virtual void visit(chart_floor & val);
virtual void visit(table_table & val);
virtual void visit(const table_table_rows & val);
virtual void visit(const table_rows_no_group & val);
virtual void visit(const table_table_row_group & val);
virtual void visit(const table_table_header_rows& val);
virtual void visit(table_table_header_rows & val);
virtual void visit(table_table_rows & val);
virtual void visit(table_table_row & val);
virtual void visit(table_rows_no_group & val);
virtual void visit(table_table_row_group & val);
virtual void visit(table_table_header_rows & val);
virtual void visit(table_table_rows & val);
virtual void visit(const table_table_row & val);
virtual void visit(const table_columns_no_group & val);
virtual void visit(table_columns_no_group & val);
virtual void visit(table_table_header_columns & val);
virtual void visit(table_table_columns & val);
virtual void visit(const table_table_column_group& val);
virtual void visit(const table_table_column & val);
virtual void visit(const table_table_cell& val);
virtual void visit(const table_covered_table_cell& val);
virtual void visit(table_table_columns & val);
virtual void visit(table_table_column_group & val);
virtual void visit(table_table_column & val);
virtual void visit(table_table_cell & val);
virtual void visit(table_covered_table_cell & val);
private:
bool stop_;

View File

@ -0,0 +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
*
*/
#include <boost/algorithm/string.hpp>
#include "commandtype.h"
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const command_type & _Val)
{
switch(_Val.get_type())
{
case command_type::command:
_Wostream << L"command";
break;
case command_type::query:
_Wostream << L"query";
break;
case command_type::table:
_Wostream << L"table";
break;
default:
break;
}
return _Wostream;
}
command_type command_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"command")
return command_type( command );
else if (tmp == L"query")
return command_type( query );
else if (tmp == L"table")
return command_type( table );
else
{
return command_type( command );
}
}
} }

View File

@ -1,39 +1,74 @@
/*
* (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
*
*/
// stdafx.cpp : source file that includes just the standard includes
// PdfReaderTest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
/*
* (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>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class command_type
{
public:
enum type
{
command,
query,
table
};
command_type() {}
command_type(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static command_type parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const command_type & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::command_type);
}

View File

@ -49,6 +49,7 @@
#include "styleverticalpos.h"
#include "stylehorizontalpos.h"
#include "stylehorizontalrel.h"
#include "stylenumformat.h"
#include "percentorscale.h"
#include "anchortype.h"
#include "linewidth.h"
@ -331,8 +332,8 @@ public:
void apply_from(const common_num_format_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) style_num_format_;
_CP_OPT(Bool) style_num_letter_sync_;
_CP_OPT(odf_types::style_numformat) style_num_format_;
_CP_OPT(Bool) style_num_letter_sync_;
};

View File

@ -0,0 +1,140 @@
/*
* (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 "stylenumformat.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const style_numformat & _Val)
{
switch(_Val.get_type())
{
case style_numformat::arabic:
_Wostream << L"1";
break;
case style_numformat::romanUc:
_Wostream << L"I";
break;
case style_numformat::romanLc:
_Wostream << L"i";
break;
case style_numformat::alphaUc:
_Wostream << L"A";
break;
case style_numformat::alphaLc:
_Wostream << L"a";
break;
case style_numformat::aiueo:
_Wostream << L"ア, イ, ウ, ...";
break;
case style_numformat::chineseCounting:
_Wostream << L"イ, ロ, ハ, ...";
break;
case style_numformat::chineseLegal:
_Wostream << L"一, 二, 三, ...";
break;
case style_numformat::ideographLegal:
_Wostream << L"壹, 貳, 參, ...";
break;
case style_numformat::ideographTraditional:
_Wostream << L"甲, 乙, 丙, ...";
break;
case style_numformat::ideographZodiac:
_Wostream << L"子, 丑, 寅, ...";
break;
case style_numformat::ideographZodiacTraditional:
_Wostream << L"甲子, 乙丑, 丙寅, ...";
break;
case style_numformat::iroha:
_Wostream << L"イ, ロ, ハ, ...";
break;
case style_numformat::koreanDigital:
_Wostream << L"일, 이, 삼, ...";
break;
case style_numformat::russianLo:
_Wostream << L"А, Б, .., Аа, Аб, ... (ru)";
break;
case style_numformat::russianUp:
_Wostream << L"А, Б, .., Аа, Аб, ... (ru)";
break;
default:
break;
}
return _Wostream;
}
style_numformat style_numformat::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"1")
return style_numformat( arabic );
else if (tmp == L"I")
return style_numformat( romanUc );
else if (tmp == L"i")
return style_numformat( romanLc );
else if (tmp == L"A")
return style_numformat( alphaUc );
else if (tmp == L"a")
return style_numformat( alphaLc );
else if (tmp == L"А, Б, .., Аа, Аб, ... (ru)")
return style_numformat( russianUp );
else if (tmp == L"일, 이, 삼, ...")
return style_numformat( koreanDigital );
else if (tmp == L"イ, ロ, ハ, ...")
return style_numformat( iroha );
else if (tmp == L"甲, 乙, 丙, ...")
return style_numformat( ideographTraditional );
else if (tmp == L"甲子, 乙丑, 丙寅, ...")
return style_numformat( ideographZodiacTraditional );
else if (tmp == L"子, 丑, 寅, ...")
return style_numformat( ideographZodiac );
else if (tmp == L"壹, 貳, 參, ...")
return style_numformat( ideographLegal );
else if (tmp == L"一, 二, 三, ...")
return style_numformat( chineseLegal );
else if (tmp == L"イ, ロ, ハ, ...")
return style_numformat( chineseCounting );
else if (tmp == L"ア, イ, ウ, ...")
return style_numformat( aiueo );
else
{
return style_numformat( arabic );
}
}
} }

View File

@ -1,51 +1,94 @@
/*
* (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
*
*/
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#ifdef _DEBUG
#pragma comment(lib, "../x64/Debug/PdfReader.lib")
#pragma comment(lib, "../../SDK/lib/win_64/DEBUG/graphics.lib")
#pragma comment(lib, "../../PdfWriter/x64/Debug/PdfWriter.lib")
#else
#pragma comment(lib, "../x64/Release/PdfReader.lib")
#pragma comment(lib, "../../SDK/lib/win_64/graphics.lib")
#pragma comment(lib, "../../PdfWriter/x64/Release/PdfWriter.lib")
#endif
// TODO: reference additional headers your program requires here
/*
* (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_ODF_STYLENUMFORMAT_H_
#define _CPDOCCORE_ODF_STYLENUMFORMAT_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class style_numformat
{
public:
enum type
{
arabic,
romanUc,
romanLc,
alphaUc,
alphaLc,
aiueo,
chineseCounting,
chineseLegal,
ideographLegal,
ideographTraditional,
ideographZodiac,
ideographZodiacTraditional,
iroha,
koreanDigital,
russianLo,
russianUp
};
style_numformat() {}
style_numformat(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static style_numformat parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const style_numformat & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::style_numformat);
}
#endif

View File

@ -412,11 +412,11 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{
if (style_background_image * image = dynamic_cast<style_background_image *>(style_image.get()))
{
if ((image) && (image->common_xlink_attlist_))
if ((image) && (image->xlink_attlist_))
{
fill.type = 2;
fill.bitmap = oox::oox_bitmap_fill::create();
fill.bitmap->xlink_href_ = image->common_xlink_attlist_->href_.get_value_or(L"");
fill.bitmap->xlink_href_ = image->xlink_attlist_->href_.get_value_or(L"");
if (image->style_repeat_)
{
switch(image->style_repeat_->get_type())
@ -550,7 +550,7 @@ void draw_a::add_child_element( xml::sax * Reader, const std::wstring & Ns, cons
}
void draw_a::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"office:name" , office_name_ , std::wstring(L""));
CP_APPLY_ATTR(L"office:target-frame-name" , office_target_frame_name_);
@ -562,7 +562,7 @@ void draw_a::add_attributes( const xml::attributes_wc_ptr & Attributes )
void draw_a::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_drawing_context().start_action(L"");
Context.get_drawing_context().set_link(common_xlink_attlist_.href_.get_value_or(L""));
Context.get_drawing_context().set_link(xlink_attlist_.href_.get_value_or(L""));
Context.get_drawing_context().end_action();
for (size_t i = 0; i < content_.size(); i++)
@ -573,7 +573,7 @@ void draw_a::xlsx_convert(oox::xlsx_conversion_context & Context)
void draw_a::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().start_action(L"");
Context.get_slide_context().set_link(common_xlink_attlist_.href_.get_value_or(L""));
Context.get_slide_context().set_link(xlink_attlist_.href_.get_value_or(L""));
Context.get_slide_context().end_action();
for (size_t i = 0; i < content_.size(); i++)
@ -583,7 +583,7 @@ void draw_a::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_a::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring rId = Context.add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""), true);//гиперлинк с объекта, а не с текста ..
std::wstring rId = Context.add_hyperlink(xlink_attlist_.href_.get_value_or(L""), true);//гиперлинк с объекта, а не с текста ..
for (size_t i = 0; i < content_.size(); i++)
{

View File

@ -99,7 +99,7 @@ public:
friend class odf_document;
private:
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
std::wstring office_name_;
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;

View File

@ -90,7 +90,7 @@ const wchar_t * draw_image::name = L"image";
void draw_image::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_image_attlist_.add_attributes(Attributes);
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
}
void draw_image::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -122,7 +122,7 @@ std::wostream & draw_chart::text_to_stream(std::wostream & _Wostream) const
void draw_chart::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_chart_attlist_.add_attributes(Attributes);
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
}
void draw_chart::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -266,7 +266,7 @@ const wchar_t * draw_object::name = L"object";
void draw_object::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_object_attlist_.add_attributes(Attributes);
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
}
void draw_object::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -278,7 +278,7 @@ void draw_object::add_child_element( xml::sax * Reader, const std::wstring & Ns,
}
}
// draw:object
// draw:object-ole
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_object_ole::ns = L"draw";
const wchar_t * draw_object_ole::name = L"object-ole";
@ -287,7 +287,7 @@ void draw_object_ole::add_attributes( const xml::attributes_wc_ptr & Attributes
{
CP_APPLY_ATTR(L"draw:class-id", draw_class_id_);
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
}
void draw_object_ole::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -362,7 +362,7 @@ std::wstring draw_object::office_convert(odf_document_ptr odfDocument, int type)
{
outputDocx.write(objectOutPath);
href_result = common_xlink_attlist_.href_.get_value_or(L"Object");
href_result = xlink_attlist_.href_.get_value_or(L"Object");
int pos = href_result.find(L"./");
if (pos >= 0) href_result = href_result.substr(2);
@ -381,7 +381,7 @@ std::wstring draw_object::office_convert(odf_document_ptr odfDocument, int type)
{
outputXlsx.write(objectOutPath);
href_result = common_xlink_attlist_.href_.get_value_or(L"Object");
href_result = xlink_attlist_.href_.get_value_or(L"Object");
int pos = href_result.find(L"./");
if (pos >= 0) href_result = href_result.substr(2);
@ -393,7 +393,7 @@ std::wstring draw_object::office_convert(odf_document_ptr odfDocument, int type)
std::wstring temp_file = folderPath + FILE_SEPARATOR_STR + href_result;
COfficeUtils oCOfficeUtils(NULL);
oCOfficeUtils.CompressFileOrDirectory(objectOutPath.c_str(), temp_file.c_str(), true);
oCOfficeUtils.CompressFileOrDirectory(objectOutPath, temp_file, true);
}
NSDirectory::DeleteDirectory(objectOutPath);
@ -423,14 +423,36 @@ void draw_plugin::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:mime-type", draw_mime_type_);
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
}
void draw_plugin::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
// draw:control
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_control::ns = L"draw";
const wchar_t * draw_control::name = L"control";
void draw_control::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"xml:id", xml_id_);
CP_APPLY_ATTR(L"draw:caption-id", caption_id_);
CP_APPLY_ATTR(L"draw:control", control_id_);
draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes);
draw_attlists_.position_.add_attributes(Attributes);
draw_attlists_.rel_size_.add_attributes(Attributes);
}
void draw_control::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"draw", L"glue-point")
{
CP_CREATE_ELEMENT(draw_glue_point_);
}
}
}
}

View File

@ -81,7 +81,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
draw_image_attlist draw_image_attlist_;
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
office_element_ptr office_binary_data_;
@ -121,7 +121,7 @@ private:
private:
draw_chart_attlist draw_chart_attlist_;
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
office_element_ptr_array content_;
//office_element_ptr title_;
@ -294,7 +294,7 @@ public:
virtual void pptx_convert (oox::pptx_conversion_context & Context);
draw_object_attlist draw_object_attlist_;
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
odf_document_ptr odf_document_;
@ -320,7 +320,7 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) draw_class_id_;
private:
@ -331,7 +331,7 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole);
//----------------------------------------------------------------------------------------------
class draw_param : public office_element_impl<draw_param>
{
public:
@ -354,7 +354,7 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(draw_param);
//----------------------------------------------------------------------------------------------
class draw_plugin : public office_element_impl<draw_plugin>
{
public:
@ -368,7 +368,7 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context);
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) draw_mime_type_;
office_element_ptr_array content_;
@ -377,9 +377,34 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_plugin);
//----------------------------------------------------------------------------------------------
class draw_control : public office_element_impl<draw_control>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawControl;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
odf_types::union_common_draw_attlists draw_attlists_;
_CP_OPT(std::wstring) xml_id_;
_CP_OPT(std::wstring) caption_id_;
_CP_OPT(std::wstring) control_id_;
office_element_ptr draw_glue_point_;
//<svg:desc>
//<svg:title>
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_control);
}
}

View File

@ -30,6 +30,7 @@
*
*/
#include "office_forms.h"
#include "draw_frame.h"
#include <ostream>
@ -39,6 +40,7 @@
#include <boost/regex.hpp>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/utils.h>
#include "serialize_elements.h"
@ -46,7 +48,10 @@
#include "odf_document_impl.h"
#include "draw_common.h"
#include "../docx/docx_drawing.h"
#include "../docx/xlsx_package.h"
#include "chart_build_oox.h"
#include "calcs_styles.h"
@ -55,6 +60,7 @@
#include "datatypes/borderstyle.h"
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
#include "../../../OfficeUtils/src/OfficeUtils.h"
namespace cpdoccore {
@ -880,7 +886,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
{
std::wstring href = drawing->fill.bitmap->xlink_href_;
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
drawing->fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
}
////////////////////////////////////////////////////
@ -1093,10 +1099,10 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
void draw_image::docx_convert(oox::docx_conversion_context & Context)
{
if (!common_xlink_attlist_.href_)
if (!xlink_attlist_.href_)
return;
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
int pos_replaicement = href.find(L"ObjectReplacements");
const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner
@ -1155,7 +1161,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing->fill.bitmap = oox::oox_bitmap_fill::create();
drawing->fill.type = 2;
drawing->fill.bitmap->isInternal = false;
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
drawing->fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
drawing->fill.bitmap->bStretch = true;
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
@ -1241,10 +1247,13 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
size_t min_y = get_value_emu(draw_text_box_attlist_.fo_min_height_->get_length());
if (drawing->cy < min_y)
{
auto_fit_text = true;
drawing->cy = min_y;
}
if (drawing->cy < 36000) auto_fit_shape = true;
//if (drawing->cy < 36000)
//{
// auto_fit_shape = true;
//}
auto_fit_shape = true;
}
@ -1256,7 +1265,11 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
auto_fit_text = true;
drawing->cx = min_x;
}
if (drawing->cx < 36000) auto_fit_shape = true;
if (drawing->cx < 36000)
{
auto_fit_text = false;
auto_fit_shape = true;
}
}
@ -1457,13 +1470,13 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
{
try
{
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
std::wstring tempPath = Context.root()->get_temp_folder();
std::wstring odfPath = Context.root()->get_folder();
if (!odf_document_ && !href.empty())
{
std::wstring tempPath = Context.root()->get_temp_folder();
std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
std::wstring objectPath = odfPath + FILE_SEPARATOR_STR + href;
// normalize path ???? todooo
XmlUtils::replace_all( objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
@ -1481,6 +1494,30 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
process_build_object process_build_object_(objectBuild, odf_document_->odf_context());
contentSubDoc->accept(process_build_object_);
if (objectBuild.table_table_)
{
oox::xlsx_conversion_context xlsx_context(odf_document_.get());
cpdoccore::oox::package::xlsx_document outputXlsx;
xlsx_context.set_output_document (&outputXlsx);
xlsx_context.start_document();
objectBuild.table_table_->xlsx_convert(xlsx_context);
xlsx_context.end_document();
std::wstring href_folder = tempPath + FILE_SEPARATOR_STR + L"temp_xlsx";
NSDirectory::CreateDirectory(href_folder);
outputXlsx.write(href_folder);
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems().count_object + 1) + L".xlsx";
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.CompressFileOrDirectory(href_folder, odfPath + FILE_SEPARATOR_STR + href, true))
{
objectBuild.embeddedData = href;
}
}
objectBuild.docx_convert(Context);
frame = Context.get_drawing_context().get_current_frame(); //owner
@ -1498,7 +1535,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
drawing->type = oox::typeChart;
bool isMediaInternal = true;
drawing->objectId = Context.add_mediaitem(href, drawing->type, isMediaInternal, href);
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
}
else if (objectBuild.object_type_ == 2 ) //embedded text
{
@ -1556,7 +1593,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
bool isMediaInternal = true;
href += FILE_SEPARATOR_STR + href_new;
drawing->objectId = Context.add_mediaitem(href, drawing->type, isMediaInternal, href);
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
drawing->objectProgId = L"Excel.Sheet.12";
}
}
@ -1579,7 +1616,7 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
use_image_replace = true;
//------------------------------------------------
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
@ -1594,10 +1631,141 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
drawing->type = oox::typeOleObject;
bool isMediaInternal = true;
drawing->objectId = Context.add_mediaitem(href, drawing->type, isMediaInternal, href);
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
drawing->objectProgId = detectObject(objectPath);
}
void draw_control::docx_convert(oox::docx_conversion_context & Context)
{
if (!control_id_) return;
oox::text_forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
if (state.id.empty()) return;
Context.get_drawing_context().start_shape(NULL);
Context.get_drawing_context().add_name_object(state.name.empty() ? L"Control" : state.name);
//--------------------------------------------------------------------------------------------------
oox::_docx_drawing drawing = oox::_docx_drawing();
drawing.type = oox::typeShape;
drawing.id = Context.get_drawing_context().get_current_shape_id();
drawing.name = Context.get_drawing_context().get_current_object_name();
drawing.inGroup = Context.get_drawing_context().in_group();
drawing.sub_type = 1;
//---------------------------------------------------------------------------------------------------------
oox::StreamsManPtr prev = Context.get_stream_man();
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_shape());
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
bool pState = Context.get_paragraph_state ();
bool runState = Context.get_run_state ();
bool keepState = Context.get_paragraph_keep ();
Context.set_run_state (false);
Context.set_paragraph_state (false);
bool drState = Context.get_drawing_state_content();
Context.set_drawing_state_content(true);
Context.start_paragraph(false);
if (draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
text::paragraph_attrs attrs_;
attrs_.text_style_name_ = *draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_;
int textStyle = Context.process_paragraph_attr(&attrs_);
}
if (state.element)
{
state.element->docx_convert_sdt(Context, this);
//state.element->docx_convert_field(Context, this);
}
else
{
std::wstring text;
if (!state.label.empty()) text = state.label;
else if (!state.value.empty()) text = state.value;
Context.add_new_run(L"");
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
Context.output_stream() << xml::utils::replace_text_to_xml( text );
Context.output_stream() << L"</w:t>";
Context.finish_run();
}
Context.finish_paragraph();
Context.get_drawing_context().get_text_stream_shape() = temp_stream.str();
Context.set_stream_man(prev);
Context.set_run_state (runState);
Context.set_paragraph_state (pState);
Context.set_drawing_state_content (drState);
Context.set_paragraph_keep (keepState);
const std::wstring & content = Context.get_drawing_context().get_text_stream_shape();
drawing.additional.push_back(_property(L"text-content",content));
Context.get_drawing_context().clear_stream_shape();
drawing.additional.push_back(_property(L"text-padding-left", 0.));
drawing.additional.push_back(_property(L"text-padding-top", 0.));
drawing.additional.push_back(_property(L"text-padding-right", 0.));
drawing.additional.push_back(_property(L"text-padding-bottom", 0.));
//---------------------------------------------------------------------------------------------------------
/////////
common_draw_docx_convert(Context, draw_attlists_, &drawing);
/////////
std::wostream & strm = Context.output_stream();
pState = Context.get_paragraph_state();
runState = Context.get_run_state();
keepState = Context.get_paragraph_keep();
//Context.set_run_state (false);
Context.set_paragraph_state (false);
bool new_run = false;
if ((pState == false && Context.get_drawing_context().get_current_level() == 1) || (Context.get_drawing_context().in_group()))
{
}
else
{
if (!Context.get_drawing_context().in_group() && !runState)
{
if (!pState)
{
Context.start_paragraph();
}
Context.add_new_run(L"");
new_run = true;
}
}
drawing.serialize(strm/*, Context.get_drawing_state_content()*/);
if (new_run)
{
Context.finish_run();
if (!pState)
{
Context.finish_paragraph();
}
}
Context.set_paragraph_state(pState);
Context.get_drawing_context().stop_shape();
}
}
}

View File

@ -39,11 +39,10 @@
#include <boost/regex.h>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h>
#include "serialize_elements.h"
#include <cpdoccore/odf/odf_document.h>
#include "style_graphic_properties.h"
@ -53,9 +52,11 @@
#include "odf_document_impl.h"
#include "calcs_styles.h"
#include "../docx/pptx_drawing.h"
#include "chart_build_oox.h"
#include "../docx/pptx_drawing.h"
#include "../docx/xlsx_package.h"
#include "datatypes/length.h"
#include "datatypes/borderstyle.h"
@ -208,7 +209,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
{
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
const std::wstring href = xlink_attlist_.href_.get_value_or(L"");
Context.get_slide_context().set_image(href);
////////////////////////////////////в принципе достаточно общая часть ...
@ -227,7 +228,7 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_chart::pptx_convert(oox::pptx_conversion_context & Context)
{
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
const std::wstring href = xlink_attlist_.href_.get_value_or(L"");
Context.get_slide_context().set_chart(href);
for (size_t i = 0; i < content_.size(); i++)
@ -257,13 +258,13 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
{
try
{
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring tempPath = Context.root()->get_temp_folder();
std::wstring odfPath = Context.root()->get_folder();
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
if (!odf_document_ && !href.empty())
{
std::wstring tempPath = Context.root()->get_temp_folder();
std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
std::wstring objectPath = odfPath + FILE_SEPARATOR_STR + href;
// normalize path ???? todooo
XmlUtils::replace_all( objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
@ -282,11 +283,34 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
process_build_object process_build_object_(objectBuild, odf_document_->odf_context() );
contentSubDoc->accept(process_build_object_);
if (objectBuild.table_table_)
{
oox::xlsx_conversion_context xlsx_context(odf_document_.get());
cpdoccore::oox::package::xlsx_document outputXlsx;
xlsx_context.set_output_document (&outputXlsx);
xlsx_context.start_document();
objectBuild.table_table_->xlsx_convert(xlsx_context);
xlsx_context.end_document();
std::wstring href_folder = tempPath + FILE_SEPARATOR_STR + L"temp_xlsx";
NSDirectory::CreateDirectory(href_folder);
outputXlsx.write(href_folder);
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems().count_object + 1) + L".xlsx";
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.CompressFileOrDirectory(href_folder, odfPath + FILE_SEPARATOR_STR + href, true))
{
objectBuild.embeddedData = href;
}
}
//---------------------------------------------------------------------------------------------------------------------
if (objectBuild.object_type_ == 1)//диаграмма
{
const std::wstring href_draw = common_xlink_attlist_.href_.get_value_or(L"Chart");
const std::wstring href_draw = xlink_attlist_.href_.get_value_or(L"Chart");
objectBuild.pptx_convert(Context);
Context.get_slide_context().set_chart(href_draw); // в рисовательной части только место объекта, рамочки ... и релсы
@ -355,7 +379,7 @@ void draw_object_ole::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().set_use_image_replacement();
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
@ -374,7 +398,7 @@ void draw_plugin::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().set_use_image_replacement();
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;

View File

@ -203,7 +203,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
{
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
if (href.empty() && office_binary_data_)
{
@ -234,7 +234,7 @@ void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
void draw_chart::xlsx_convert(oox::xlsx_conversion_context & Context)
{
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
const std::wstring href = xlink_attlist_.href_.get_value_or(L"");
Context.get_drawing_context().set_chart(href);
for (size_t i = 0 ; i < content_.size(); i++)
@ -264,7 +264,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
{
try
{
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
if (!odf_document_ && !href.empty())
{
@ -291,7 +291,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
//---------------------------------------------------------------------------------------------------------------------
if (objectBuild.object_type_ == 1) //диаграмма
{
const std::wstring href_draw = common_xlink_attlist_.href_.get_value_or(L"chart");
const std::wstring href_draw = xlink_attlist_.href_.get_value_or(L"chart");
objectBuild.xlsx_convert(Context);
Context.get_drawing_context().set_chart(href_draw); // в рисовательной части только место объекта, рамочки ... и релсы
@ -352,7 +352,7 @@ void draw_object_ole::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_drawing_context().set_use_image_replacement();
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;

View File

@ -65,6 +65,9 @@ public:
draw_shape() : bad_shape_(false), word_art_(false), idx_in_owner(-1) {}
CPDOCCORE_DEFINE_VISITABLE();
friend class odf_document;
//----------------------------------------------------------------------------------------------
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
@ -79,14 +82,11 @@ public:
odf_types::union_common_draw_attlists common_draw_attlists_;
draw_shape_attlist draw_shape_attlist_;
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) draw_id_; //используется для анимашек
office_element_ptr_array content_;
CPDOCCORE_DEFINE_VISITABLE();
friend class odf_document;
//----------------------------------------------------------------------------------------------
bool bad_shape_;
bool word_art_;
int sub_type_;

View File

@ -134,7 +134,7 @@ void svg_font_face_name::add_text(const std::wstring & Text)
void common_svg_font_face_xlink_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
}
// svg:definition-src

View File

@ -56,7 +56,7 @@ class common_svg_font_face_xlink_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
};
// svg:font-face-uri
class svg_font_face_uri : public office_element_impl<svg_font_face_uri>

View File

@ -54,6 +54,7 @@
#include "office_annotation.h"
#include "office_settings.h"
#include "office_scripts.h"
#include "office_forms.h"
#include "office_event_listeners.h"
#include "styles.h"
@ -306,7 +307,6 @@ bool odf_document::Impl::decrypt_file (const std::wstring &password, const std::
manifest_key_derivation* key_derivation = dynamic_cast<manifest_key_derivation*>(encryption_data->key_derivation_.get());
manifest_start_key_generation* start_key_generation = dynamic_cast<manifest_start_key_generation*>(encryption_data->start_key_generation_.get());
CRYPT::ODFDecryptor decryptor;
CRYPT::_odfCryptData cryptData;
if (key_derivation)
@ -395,25 +395,24 @@ bool odf_document::Impl::decrypt_file (const std::wstring &password, const std::
unsigned char* data_out = NULL;
file_inp.ReadFile(data, lengthRead, dwSizeRead);
file_inp.CloseFile();
//------------------------------------------------------------------------------------------
CRYPT::ODFDecryptor decryptor;
decryptor.SetCryptData(cryptData);
bool result = decryptor.Decrypt(password, data, dwSizeRead, data_out, file_size);
delete []data;
//------------------------------------------------------------------------------------------------------------
if (result && data_out)
{
NSFile::CFileBinary file_out;
file_out.CreateFileW(dstPath);
file_out.WriteFile(data_out, file_size);
file_out.CloseFile();
delete []data_out;
return result;
delete []data_out;
}
return result;
}
const std::wstring & odf_document::Impl::get_temp_folder() const
@ -692,12 +691,13 @@ void odf_document::Impl::parse_styles(office_element *element)
( L"common:" + styleInst->style_name_,
styleInst->style_display_name_.get_value_or(L""),
styleInst->style_family_.get_type(),
&(styleInst->style_content_),
&(styleInst->content_),
true,
false,
styleInst->style_parent_style_name_.get_value_or(L""),
styleInst->style_next_style_name_.get_value_or(L""),
styleInst->style_data_style_name_.get_value_or(L"")
styleInst->style_data_style_name_.get_value_or(L""),
styleInst->style_class_.get_value_or(L"")
);
}
// list styles
@ -771,12 +771,13 @@ void odf_document::Impl::parse_styles(office_element *element)
context_->styleContainer().add_style(L"",
L"",
styleInst->style_family_.get_type(),
&(styleInst->style_content_),
&(styleInst->content_),
false,
true,
L"",
L"",
L"");
L"",
L"");
}
for (size_t i = 0; i < docStyles->style_presentation_page_layout_.size(); i++)
{
@ -808,12 +809,13 @@ void odf_document::Impl::parse_styles(office_element *element)
context_->styleContainer().add_style(styleInst->style_name_,
styleInst->style_display_name_.get_value_or(L""),
styleInst->style_family_.get_type(),
&(styleInst->style_content_),
&(styleInst->content_),
false,
false,
styleInst->style_parent_style_name_.get_value_or(L""),
styleInst->style_next_style_name_.get_value_or(L""),
styleInst->style_data_style_name_.get_value_or(L"")
styleInst->style_data_style_name_.get_value_or(L""),
styleInst->style_class_.get_value_or(L"")
);
}
@ -958,12 +960,13 @@ void odf_document::Impl::parse_styles(office_element *element)
context_->styleContainer().add_style(styleInst->style_name_,
styleInst->style_display_name_.get_value_or(L""),
styleInst->style_family_.get_type(),
&(styleInst->style_content_),
&(styleInst->content_),
true,
false,
styleInst->style_parent_style_name_.get_value_or(L""),
styleInst->style_next_style_name_.get_value_or(L""),
styleInst->style_data_style_name_.get_value_or(L"")
styleInst->style_data_style_name_.get_value_or(L""),
styleInst->style_class_.get_value_or(L"")
);
}

View File

@ -47,7 +47,8 @@ style_instance::style_instance(
bool IsDefault,
const std::wstring & ParentStyleName,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName
const std::wstring & DataStyleName,
const std::wstring & StyleClass
) :
container_ (Container),
name_ (Name),
@ -56,6 +57,7 @@ style_instance::style_instance(
is_automatic_ (IsAutomatic),
is_default_ (IsDefault),
next_name_ (NextStyleName),
style_class_ (StyleClass),
next_ (Container->style_by_name(NextStyleName, style_type_, false)),
data_style_name_(DataStyleName)
{
@ -83,7 +85,8 @@ void styles_container::add_style( const std::wstring & Name,
bool IsDefault,
const std::wstring & ParentStyleName_,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName)
const std::wstring & DataStyleName,
const std::wstring & StyleClass)
{
std::wstring ParentStyleName = ParentStyleName_;
@ -91,9 +94,8 @@ void styles_container::add_style( const std::wstring & Name,
{
ParentStyleName = L"";//иначе в коде возможно зацикливание.
}
style_instance_ptr newStyle = style_instance_ptr(
new style_instance(this, Name, Type, Content, IsAutomatic, IsDefault, ParentStyleName, NextStyleName, DataStyleName)
);
style_instance_ptr newStyle = style_instance_ptr( new style_instance(this, Name, Type, Content, IsAutomatic, IsDefault,
ParentStyleName, NextStyleName, DataStyleName, StyleClass));
instances_.push_back(newStyle);
int pos = static_cast<int>(instances_.size() - 1);
@ -180,6 +182,10 @@ const std::wstring & style_instance::data_style_name() const
{
return data_style_name_;
}
const std::wstring & style_instance::style_class() const
{
return style_class_;
}
style_instance * styles_container::style_by_name(const std::wstring & Name, style_family::type Type, bool object_in_styles) const
{

View File

@ -64,7 +64,8 @@ public:
bool IsDefault,
const std::wstring & ParentStyleName,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName
const std::wstring & DataStyleName,
const std::wstring & StyleClass
);
@ -77,6 +78,7 @@ public:
const std::wstring & next_name() const;
const styles_container * container() const { return container_; }
const std::wstring & data_style_name() const;
const std::wstring & style_class() const;
bool is_automatic() const;
bool is_default() const;
@ -90,6 +92,7 @@ private:
bool is_automatic_;
bool is_default_;
std::wstring style_class_;
std::wstring parent_name_;
std::wstring next_name_;
mutable style_instance * parent_;
@ -145,7 +148,8 @@ public:
bool IsDefault,
const std::wstring & ParentStyleName,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName);
const std::wstring & DataStyleName,
const std::wstring & StyleClass);
void add_master_page_name(const std::wstring & StyleName, const std::wstring & MasterPageName);

View File

@ -67,7 +67,6 @@ std::wstring office_binary_data::write_to(const std::wstring & path)
{
std::wstring result;
NSFile::CBase64Converter base64;
int nLength = 0;
unsigned char *pData = NULL;

View File

@ -126,7 +126,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, fill.bitmap->isInternal, href);
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
}
int id = Context.get_drawing_context().get_current_shape_id();
if (layout_properties->docx_background_serialize(Context.output_stream(), Context, fill, id))

View File

@ -46,9 +46,14 @@ enum ElementType
typeTextBookmark,
typeTextBookmarkStart,
typeTextBookmarkEnd,
typeTextBookmarkRef,
typeTextReferenceMark,
typeTextReferenceMarkStart,
typeTextReferenceMarkEnd,
typeTextFieldFieldmarkStart,
typeTextFieldFieldmarkEnd,
typeTextSpan,
typeTextA,
typeTextNote,
@ -408,6 +413,36 @@ enum ElementType
typeDr3dRotate,
typeDr3dSphere,
typeOfficeForms,
typeFormForm,
typeFormProperties,
typeFormProperty,
typeFormListProperty,
typeFormListValue,
typeFormElement,
typeFormButton,
typeFormCheckbox,
typeFormText,
typeFormCombobox,
typeFormListbox,
typeFormConnectionResource,
typeFormDate,
typeFormFile,
typeFormFixedText,
typeFormFormattedText,
typeFormFrame,
typeFormGenericControl,
typeFormGrid,
typeFormHidden,
typeFormImage,
typeFormImageFrame,
typeFormNumber,
typeFormPassword,
typeFormRadio,
typeFormTextarea,
typeFormTime,
typeFormValueRange,
typeDrawPage,
typePresentationFooterDecl,
typePresentationDateTimeDecl,

View File

@ -73,7 +73,7 @@ void office_event_listeners::pptx_convert(oox::pptx_conversion_context & Context
void presentation_event_listener_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"script:event-name", script_event_name_);
CP_APPLY_ATTR(L"presentation:action", presentation_action_);
@ -101,8 +101,8 @@ void presentation_event_listener::pptx_convert(oox::pptx_conversion_context & Co
{
Context.get_slide_context().start_action(attlist_.presentation_action_.get_value_or(L""));
if (attlist_.common_xlink_attlist_.href_)
Context.get_slide_context().set_link(*attlist_.common_xlink_attlist_.href_);
if (attlist_.xlink_attlist_.href_)
Context.get_slide_context().set_link(*attlist_.xlink_attlist_.href_);
if (presentation_sound_)
{

View File

@ -72,7 +72,7 @@ class presentation_event_listener_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) script_event_name_;
_CP_OPT(std::wstring) presentation_action_;

View File

@ -0,0 +1,431 @@
/*
* (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 "office_forms.h"
#include "draw_frame.h"
#include "text_content.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include "serialize_elements.h"
namespace cpdoccore {
namespace odf_reader {
// office:forms
//----------------------------------------------------------------------------------
const wchar_t * office_forms::ns = L"office";
const wchar_t * office_forms::name = L"forms";
void office_forms::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"form:apply-design-mode", apply_design_mode_);
CP_APPLY_ATTR(L"form:automatic-focus", automatic_focus_);
}
void office_forms::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void office_forms::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
// form:form
//----------------------------------------------------------------------------------
const wchar_t * form_form::ns = L"form";
const wchar_t * form_form::name = L"form";
void form_form::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"form:allow-deletes", allow_deletes_);
CP_APPLY_ATTR(L"form:allow-inserts", allow_inserts_);
CP_APPLY_ATTR(L"form:allow-updates", allow_updates_);
CP_APPLY_ATTR(L"form:apply-filter", apply_filter_);
CP_APPLY_ATTR(L"form:command", command_);
CP_APPLY_ATTR(L"form:command_type", command_type_);
CP_APPLY_ATTR(L"form:control-implementation", control_implementation_);
CP_APPLY_ATTR(L"form:datasource", datasource_);
CP_APPLY_ATTR(L"form:detail-fields", detail_fields_);
CP_APPLY_ATTR(L"form:enctype", enctype_);
CP_APPLY_ATTR(L"form:escape-processing",escape_processing_);
CP_APPLY_ATTR(L"form:filter", filter_);
CP_APPLY_ATTR(L"form:ignore-result", ignore_result_);
CP_APPLY_ATTR(L"form:master-fields", master_fields_);
CP_APPLY_ATTR(L"form:method", method_);
CP_APPLY_ATTR(L"form:name", name_);
CP_APPLY_ATTR(L"form:navigation-mode", navigation_mode_);
CP_APPLY_ATTR(L"form:order", order_);
CP_APPLY_ATTR(L"form:tabcycle", tabcycle_);
CP_APPLY_ATTR(L"office:target-frame", office_target_frame_);
xlink_attlist_.add_attributes(Attributes);
}
void form_form::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"form", L"properties")
{
CP_CREATE_ELEMENT(properties_);
}
else if CP_CHECK_NAME(L"office", L"event-listeners")
{
CP_CREATE_ELEMENT(office_event_listeners_);
}
else
CP_CREATE_ELEMENT(content_);
}
void form_form::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
// form:properties
//----------------------------------------------------------------------------------
const wchar_t * form_properties::ns = L"form";
const wchar_t * form_properties::name = L"properties";
void form_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void form_properties::docx_convert(oox::docx_conversion_context & Context)
{
//for (size_t i = 0; i < content_.size(); i++)
// {
// content_[i]->docx_convert(Context);
// }
}
// form:property
//----------------------------------------------------------------------------------
const wchar_t * form_property::ns = L"form";
const wchar_t * form_property::name = L"property";
void form_property::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"form:property-name", property_name_);
value_and_type_.add_attributes(Attributes);
}
// form:list-property
//----------------------------------------------------------------------------------
const wchar_t * form_list_property::ns = L"form";
const wchar_t * form_list_property::name = L"list-property";
void form_list_property::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"form:property-name", property_name_);
CP_APPLY_ATTR(L"form:value-type", value_type_);
}
void form_list_property::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void form_list_property::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
// form:list-value
//----------------------------------------------------------------------------------
const wchar_t * form_list_value::ns = L"form";
const wchar_t * form_list_value::name = L"list-value";
void form_list_value::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
value_and_type_.add_attributes(Attributes);
}
//----------------------------------------------------------------------------------
const wchar_t * form_element::ns = L"form";
const wchar_t * form_element::name = L"element";
void form_element::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"form:control_implementation", control_implementation_);
CP_APPLY_ATTR(L"form:data-field", data_field_);
CP_APPLY_ATTR(L"form:linked-cell", linked_cell_);
CP_APPLY_ATTR(L"form:disabled", disabled_);
CP_APPLY_ATTR(L"form:id", id_);
CP_APPLY_ATTR(L"form:label", label_);
CP_APPLY_ATTR(L"form:name", name_);
CP_APPLY_ATTR(L"form:printable", printable_);
CP_APPLY_ATTR(L"form:tab-index", tab_index_);
CP_APPLY_ATTR(L"form:tab-stop", tab_stop_);
CP_APPLY_ATTR(L"form:title", title_);
CP_APPLY_ATTR(L"form:value", value_);
CP_APPLY_ATTR(L"form:current-value",current_value_);
CP_APPLY_ATTR(L"xml:id", xml_id_);
CP_APPLY_ATTR(L"xforms:bind", xforms_bind_);
}
void form_element::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"form", L"properties")
{
CP_CREATE_ELEMENT(properties_);
}
else if CP_CHECK_NAME(L"office", L"event-listeners")
{
CP_CREATE_ELEMENT(office_event_listeners_);
}
}
void form_element::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring id = id_ ? *id_ : (xml_id_ ? *xml_id_ : L"");
Context.get_forms_context().set_id(id);
if (name_) Context.get_forms_context().set_name(*name_);
if (label_) Context.get_forms_context().set_label(*label_);
if (current_value_) Context.get_forms_context().set_value(*current_value_);
else if (value_) Context.get_forms_context().set_value(*value_);
if (control_implementation_) Context.get_forms_context().set_uuid(*control_implementation_);
Context.get_forms_context().end_element();
}
// form:button
//----------------------------------------------------------------------------------
const wchar_t * form_button::ns = L"form";
const wchar_t * form_button::name = L"button";
void form_button::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
form_element::add_attributes(Attributes);
}
void form_button::docx_convert(oox::docx_conversion_context & Context)
{
Context.get_forms_context().start_element(1);
form_element::docx_convert(Context);
}
// form:text
//----------------------------------------------------------------------------------
const wchar_t * form_text::ns = L"form";
const wchar_t * form_text::name = L"text";
void form_text::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
form_element::add_attributes(Attributes);
}
void form_text::docx_convert(oox::docx_conversion_context & Context)
{
Context.get_forms_context().start_element(2);
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
form_element::docx_convert(Context);
}
void form_text::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
{
if (!draw) return;
Context.output_stream() << L"<w:sdt>";
Context.output_stream() << L"<w:sdtPr>";
{
if (name_)
{
Context.output_stream() << L"<w:alias w:val=\"" + xml::utils::replace_text_to_xml(*name_) + L"\"/>";
}
Context.output_stream() << L"<w:id w:val=\"" + std::to_wstring(Context.get_drawing_context().get_current_shape_id()) + L"\"/>";
//<w:lock w:val="sdtLocked"/>
//<w:placeholder>
// <w:docPart w:val="DefaultPlaceholder_-1854013440"/>
//</w:placeholder>
}
Context.output_stream() << L"</w:sdtPr>";
Context.output_stream() << L"<w:sdtContent>";
{
Context.add_new_run(L"");
if (current_value_)
{
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
Context.output_stream() << xml::utils::replace_text_to_xml(*current_value_ );
Context.output_stream() << L"</w:t>";
}
Context.finish_run();
}
Context.output_stream() << L"</w:sdtContent>";
Context.output_stream() << L"</w:sdt>";
}
void form_text::docx_convert_field(oox::docx_conversion_context & Context, draw_control *draw)
{
if (!draw) return;
XmlUtils::replace_all( *name_, L" ", L"_");
Context.add_new_run(L"");
Context.output_stream() << L"<w:fldChar w:fldCharType=\"begin\"><w:ffData><w:name w:val=\"" << *name_ << L"\"/><w:enabled/>";
Context.output_stream() << L"</w:ffData></w:fldChar>";
Context.finish_run();
Context.add_new_run(L"");
Context.output_stream() << L"<w:instrText>FORMTEXT</w:instrText>";
Context.finish_run();
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
Context.add_new_run(L"");
Context.output_stream() << L"<w:t>" << *current_value_ << L"</w:t>";
Context.finish_run();
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
// form:checkbox
//----------------------------------------------------------------------------------
const wchar_t * form_checkbox::ns = L"form";
const wchar_t * form_checkbox::name = L"checkbox";
void form_checkbox::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
_CP_OPT(std::wstring) strVal;
CP_APPLY_ATTR(L"form:current-state", strVal);
if ((strVal) && (*strVal == L"checked"))
current_state_ = true;
else current_state_ = false;
form_element::add_attributes(Attributes);
}
void form_checkbox::docx_convert(oox::docx_conversion_context & Context)
{
Context.get_forms_context().start_element(3);
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
form_element::docx_convert(Context);
}
void form_checkbox::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
{
if (!draw) return;
Context.output_stream() << L"<w:sdt>";
Context.output_stream() << L"<w:sdtPr>";
{
if (name_)
{
Context.output_stream() << L"<w:alias w:val=\"" + xml::utils::replace_text_to_xml(*name_) + L"\"/>";
}
Context.output_stream() << L"<w:id w:val=\"" + std::to_wstring(Context.get_drawing_context().get_current_shape_id()) + L"\"/>";
Context.output_stream() << L"<w14:checkbox>";
Context.output_stream() << L"<w14:checked w14:val=\"" + std::to_wstring(current_state_ ? 1 : 0) + L"\"/>";
//Context.output_stream() << L"<w14:checkedState w14:val=\"2612\" w14:font=\"MS Gothic\"/>";
//Context.output_stream() << L"<w14:uncheckedState w14:val=\"2610\" w14:font=\"MS Gothic\"/>";
Context.output_stream() << L"</w14:checkbox>";
}
Context.output_stream() << L"</w:sdtPr>";
Context.output_stream() << L"<w:sdtContent>";
{
Context.add_new_run(L"");
if (current_state_)
Context.output_stream() << L"<w:t>☒</w:t>";
else
Context.output_stream() << L"<w:t>☐</w:t>";
Context.finish_run();
}
Context.output_stream() << L"</w:sdtContent>";
Context.output_stream() << L"</w:sdt>";
if (label_)
{
Context.add_new_run(L"");
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
Context.output_stream() << xml::utils::replace_text_to_xml(*label_ );
Context.output_stream() << L"</w:t>";
Context.finish_run();
}
}
void form_checkbox::docx_convert_field(oox::docx_conversion_context & Context, draw_control *draw)
{
if (!draw) return;
XmlUtils::replace_all( *name_, L" ", L"_");
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"begin\"><w:ffData><w:name w:val=\"" << *name_ << L"\"/><w:enabled/>";
Context.output_stream() << L"<w:label w:val=\"" << xml::utils::replace_text_to_xml(*label_ ) << L"\"/>";
Context.output_stream() << L"<w:checkBox><w:default w:val=\"" << std::to_wstring(current_state_) << L"\"/></w:checkBox></w:ffData>";
Context.output_stream() << L"</w:fldChar></w:r>";
Context.output_stream() << L"<w:r><w:instrText>FORMCHECKBOX</w:instrText></w:r>";
//Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
//Context.output_stream() << L"<w:r><w:t>" << xml::utils::replace_text_to_xml(*label_ ) << L"</w:t></w:r>";
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
Context.add_new_run(L"");
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
Context.output_stream() << xml::utils::replace_text_to_xml(*label_ );
Context.output_stream() << L"</w:t>";
Context.finish_run();
}
// form:combobox
//----------------------------------------------------------------------------------
const wchar_t * form_combobox::ns = L"form";
const wchar_t * form_combobox::name = L"combobox";
void form_combobox::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
form_element::add_attributes(Attributes);
}
void form_combobox::docx_convert(oox::docx_conversion_context & Context)
{
Context.get_forms_context().start_element(4);
form_element::docx_convert(Context);
}
// form:listbox
//----------------------------------------------------------------------------------
const wchar_t * form_listbox::ns = L"form";
const wchar_t * form_listbox::name = L"listbox";
void form_listbox::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
form_element::add_attributes(Attributes);
}
void form_listbox::docx_convert(oox::docx_conversion_context & Context)
{
Context.get_forms_context().start_element(5);
form_element::docx_convert(Context);
}
}
}

View File

@ -0,0 +1,402 @@
/*
* (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>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
#include "datatypes/commandtype.h"
namespace cpdoccore {
namespace odf_reader {
class draw_control;
// office:forms
class office_forms : public office_element_impl<office_forms>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeForms;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void docx_convert(oox::docx_conversion_context & Context) ;
public:
office_element_ptr_array content_;
_CP_OPT(odf_types::Bool) apply_design_mode_;
_CP_OPT(odf_types::Bool) automatic_focus_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_forms);
// form:form
class form_form : public office_element_impl<form_form>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormForm;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void docx_convert(oox::docx_conversion_context & Context) ;
public:
office_element_ptr_array content_;
office_element_ptr office_event_listeners_;
office_element_ptr properties_;
_CP_OPT(odf_types::Bool) allow_deletes_;
_CP_OPT(odf_types::Bool) allow_inserts_;
_CP_OPT(odf_types::Bool) allow_updates_;
_CP_OPT(odf_types::Bool) apply_filter_;
_CP_OPT(std::wstring) command_;
_CP_OPT(odf_types::command_type) command_type_;
_CP_OPT(std::wstring) control_implementation_;
_CP_OPT(std::wstring) datasource_;
_CP_OPT(std::wstring) detail_fields_;
_CP_OPT(std::wstring) enctype_;
_CP_OPT(odf_types::Bool) escape_processing_;
_CP_OPT(std::wstring) filter_;
_CP_OPT(odf_types::Bool) ignore_result_;
_CP_OPT(std::wstring) master_fields_;
_CP_OPT(std::wstring) method_;
_CP_OPT(std::wstring) name_;
_CP_OPT(std::wstring) navigation_mode_;
_CP_OPT(std::wstring) order_;
_CP_OPT(std::wstring) tabcycle_;
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) office_target_frame_;
};
CP_REGISTER_OFFICE_ELEMENT2(form_form);
// form:properties
class form_properties : public office_element_impl<form_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormProperties;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void docx_convert(oox::docx_conversion_context & Context) ;
public:
office_element_ptr_array content_; //form property && form list-property
};
CP_REGISTER_OFFICE_ELEMENT2(form_properties);
// form:property
class form_property : public office_element_impl<form_property>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormProperty;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
_CP_OPT(std::wstring) property_name_;
odf_types::common_value_and_type_attlist value_and_type_;
};
CP_REGISTER_OFFICE_ELEMENT2(form_property);
// form:list-property
class form_list_property : public office_element_impl<form_list_property>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormListProperty;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void docx_convert(oox::docx_conversion_context & Context) ;
public:
_CP_OPT(std::wstring) property_name_;
_CP_OPT(odf_types::office_value_type) value_type_;
office_element_ptr_array content_; // form:list-value
};
CP_REGISTER_OFFICE_ELEMENT2(form_list_property);
// form:list-value
class form_list_value : public office_element_impl<form_list_value>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormListValue;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
public:
odf_types::common_value_and_type_attlist value_and_type_;
};
CP_REGISTER_OFFICE_ELEMENT2(form_list_value);
//-----------------------------------------------------------------------------------------------------
class form_element : public office_element_impl<form_element>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormElement;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) {}
virtual void pptx_convert(oox::pptx_conversion_context & Context) {}
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw) {}
virtual void docx_convert_field (oox::docx_conversion_context & Context, draw_control* draw) {}
form_element() {}
//CPDOCCORE_DEFINE_VISITABLE();
friend class odf_document;
//----------------------------------------------------------------------------------------------
office_element_ptr office_event_listeners_;
office_element_ptr properties_;
_CP_OPT(std::wstring) control_implementation_;
_CP_OPT(std::wstring) data_field_;
_CP_OPT(std::wstring) linked_cell_;//cell ref
_CP_OPT(odf_types::Bool) disabled_;
_CP_OPT(std::wstring) id_;
_CP_OPT(std::wstring) label_;
_CP_OPT(std::wstring) name_;
_CP_OPT(odf_types::Bool) printable_;
_CP_OPT(unsigned int) tab_index_;
_CP_OPT(odf_types::Bool) tab_stop_;
_CP_OPT(std::wstring) title_;
_CP_OPT(std::wstring) value_;
_CP_OPT(std::wstring) xml_id_;
_CP_OPT(std::wstring) xforms_bind_;
_CP_OPT(std::wstring) current_value_;
};
// form:button
class form_button : public form_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormButton;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
//form:image-align
//form:image-position
//form:button-type 19.255,
//form:default-button 19.265,
//form:delayfor-repeat
//form:focus-on-click
//form:image-data
//form:repeat
//form:toggle
//form:xforms-submission
//office:target-frame
//xlink:href
};
CP_REGISTER_OFFICE_ELEMENT2(form_button);
// form:text
class form_text : public form_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormText;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert (oox::docx_conversion_context & Context) ;
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw);
virtual void docx_convert_field (oox::docx_conversion_context & Context, draw_control* draw);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
//form:convert-empty-to-null
//form:current-value
//form:readonly
//form:max-length
};
CP_REGISTER_OFFICE_ELEMENT2(form_text);
// form:checkbox
class form_checkbox : public form_text
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormCheckbox;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert (oox::docx_conversion_context & Context) ;
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control *draw);
virtual void docx_convert_field (oox::docx_conversion_context & Context, draw_control* draw);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
bool current_state_;
//form:image-align
//form:image-position
//form:current-state
//form:is-tristate
//form:visual-effect
};
CP_REGISTER_OFFICE_ELEMENT2(form_checkbox);
// form:combobox
class form_combobox : public form_text
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormCombobox;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert (oox::docx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
//form:list-source-type
//form:size
//form:auto-complete
//form:list-source
//form:sourcecell-range
//form:dropdown
};
CP_REGISTER_OFFICE_ELEMENT2(form_combobox);
// form:listbox
class form_listbox : public form_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeFormListbox;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert (oox::docx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
//form:list-source-type
//form:size
//form:list-source
//form:source-cell-range
//form:dropdown
//form:bound-column
//form:xforms-list-source
//form:multiple
//form:listlinkage-type
};
CP_REGISTER_OFFICE_ELEMENT2(form_listbox);
}
}
//<form:connection-resource>7.6.2,
//<form:date> 13.5.8,
//<form:file> 13.5.5,
//<form:fixed-text> 13.5.10,
//<form:form> 13.3,
//<form:formatted-text> 13.5.6,
//<form:frame> 13.5.19,
//<form:generic-control> 13.5.25,
//<form:grid> 13.5.22,
//<form:hidden> 13.5.21,
//<form:image> 13.5.16,
//<form:image-frame> 13.5.20,
//<form:number> 13.5.7,
//<form:password> 13.5.4,
//<form:radio> 13.5.18,
//<form:textarea> 13.5.3,
//<form:time>
//<form:value-range> 13.5.24 and

View File

@ -52,7 +52,7 @@ void office_scripts::add_attributes( const xml::attributes_wc_ptr & Attributes )
void office_scripts::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"office", L"script")
CP_CREATE_ELEMENT(office_script_);
CP_CREATE_ELEMENT(content_);
else
CP_NOT_APPLICABLE_ELM();
}

View File

@ -58,7 +58,7 @@ private:
virtual void add_text(const std::wstring & Text);
private:
office_element_ptr_array office_script_;
office_element_ptr_array content_;
// office-event-listeners ?

View File

@ -100,7 +100,11 @@ bool is_text_content(const std::wstring & ns, const std::wstring & name)
void office_text::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"tracked-changes")
if CP_CHECK_NAME(L"office", L"forms")
{
CP_CREATE_ELEMENT(forms_);
}
else if CP_CHECK_NAME(L"text", L"tracked-changes")
{
CP_CREATE_ELEMENT(tracked_changes_);
}
@ -142,7 +146,10 @@ void office_text::docx_convert(oox::docx_conversion_context & Context)
if (tracked_changes_)
tracked_changes_->docx_convert(Context);
Context.start_office_text();
if (forms_)
forms_->docx_convert(Context);
Context.start_office_text();
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);

View File

@ -67,6 +67,7 @@ private:
office_element_ptr user_fields_;
office_element_ptr variables_;
office_element_ptr sequences_;
office_element_ptr forms_;
office_element_ptr_array content_;
};

View File

@ -287,13 +287,25 @@ std::wostream & line_break::text_to_stream(std::wostream & _Wostream) const
_Wostream << std::wstring(L"\r\n");
return _Wostream;
}
void line_break::docx_convert(oox::docx_conversion_context & Context)
{
Context.add_element_to_run();
Context.output_stream() << L"<w:br/>";
}
bool in_drawing = false;
if (Context.get_drawing_context().get_current_shape() || Context.get_drawing_context().get_current_frame())
{
in_drawing = true;
Context.finish_run();
Context.finish_paragraph();
Context.start_paragraph();
}
else
{
Context.add_element_to_run();
Context.output_stream() << L"<w:br/>";
}
}
void line_break::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_text_context().add_text(L"\n");
@ -316,7 +328,6 @@ void bookmark::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_, std::wstring(L""));
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * bookmark_start::ns = L"text";
const wchar_t * bookmark_start::name = L"bookmark-start";
@ -325,12 +336,14 @@ std::wostream & bookmark_start::text_to_stream(std::wostream & _Wostream) const
{
return _Wostream;
}
void bookmark_start::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_, std::wstring(L""));
CP_APPLY_ATTR(L"text:name", name_, std::wstring(L""));
}
void bookmark_start::docx_convert(oox::docx_conversion_context & Context)
{
Context.start_bookmark(name_);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * bookmark_end::ns = L"text";
const wchar_t * bookmark_end::name = L"bookmark-end";
@ -339,12 +352,32 @@ std::wostream & bookmark_end::text_to_stream(std::wostream & _Wostream) const
{
return _Wostream;
}
void bookmark_end::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_, std::wstring(L""));
CP_APPLY_ATTR(L"text:name", name_, std::wstring(L""));
}
void bookmark_end::docx_convert(oox::docx_conversion_context & Context)
{
Context.end_bookmark(name_);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * bookmark_ref::ns = L"text";
const wchar_t * bookmark_ref::name = L"bookmark-ref";
std::wostream & bookmark_ref::text_to_stream(std::wostream & _Wostream) const
{
return _Wostream;
}
void bookmark_ref::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:ref-name", text_ref_name_, std::wstring(L""));
CP_APPLY_ATTR(L"text:reference-format", text_reference_format_);
}
void bookmark_ref::add_text(const std::wstring & Text)
{
content_ = Text;
}
// text:reference-mark
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * reference_mark::ns = L"text";
@ -518,7 +551,7 @@ std::wostream & a::text_to_stream(std::wostream & _Wostream) const
void a::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"office:name", office_name_, std::wstring(L""));
CP_APPLY_ATTR(L"office:target-frame-name", office_target_frame_name_);
@ -539,25 +572,32 @@ void a::add_text(const std::wstring & Text)
void a::docx_convert(oox::docx_conversion_context & Context)
{
bool pushed = false;
bool addNewRun = false;
bool pushed_style = false;
bool addNewRun = false;
Context.finish_run();
style_text_properties_ptr tempStyleTextProp;
std::wostream & _Wostream = Context.output_stream();
std::wstring rId;
rId = Context.add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""), false);
_Wostream << L"<w:hyperlink r:id=\"" << rId << L"\">";
std::wstring ref = xlink_attlist_.href_.get_value_or(L"");
if (Context.is_table_content())
{
_Wostream << L"<w:hyperlink w:anchor=\"" << ref.substr(1) << L"\" w:history=\"1\">"; //без #
}
else
{
std::wstring rId;
rId = Context.add_hyperlink(ref, false);
_Wostream << L"<w:hyperlink r:id=\"" << rId << L"\">";
}
style_instance * styleInst = NULL;
if (!text_style_name_.empty())
styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text,Context.process_headers_footers_);
else
styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text, Context.process_headers_footers_);
else if (false == Context.is_table_content())
styleInst = Context.root()->odf_context().styleContainer().hyperlink_style();
if (styleInst)
@ -567,7 +607,7 @@ void a::docx_convert(oox::docx_conversion_context & Context)
if (const style_content * styleContent = styleInst->content())
{
Context.push_text_properties(styleContent->get_style_text_properties());
pushed = true;
pushed_style = true;
Context.get_styles_context().start_process_style(styleInst);
Context.add_new_run();
Context.get_styles_context().end_process_style();
@ -576,16 +616,17 @@ void a::docx_convert(oox::docx_conversion_context & Context)
}
else
{
const std::wstring id = Context.styles_map_.get( styleInst->name(), styleInst->type() );
style_text_properties_ptr tempStyleTextProp;
const std::wstring id = Context.styles_map_.get( styleInst->name(), styleInst->type() );
tempStyleTextProp = style_text_properties_ptr( new style_text_properties(id) );
Context.push_text_properties( tempStyleTextProp.get() );
pushed = true;
pushed_style = true;
Context.add_new_run();
addNewRun = true;
}
}
}
if (!addNewRun)
Context.add_new_run();
@ -597,7 +638,7 @@ void a::docx_convert(oox::docx_conversion_context & Context)
Context.finish_run();
if (pushed)
if (pushed_style)
Context.pop_text_properties();
_Wostream << L"</w:hyperlink>";
}
@ -609,7 +650,7 @@ void a::xlsx_convert(oox::xlsx_conversion_context & Context)
{
content_[i]->xlsx_convert(Context);
}
Context.end_hyperlink(common_xlink_attlist_.href_.get_value_or(L""));
Context.end_hyperlink(xlink_attlist_.href_.get_value_or(L""));
}
void a::pptx_convert(oox::pptx_conversion_context & Context)
{
@ -619,7 +660,7 @@ void a::pptx_convert(oox::pptx_conversion_context & Context)
content_[i]->pptx_convert(Context);
}
std::wstring hId = Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""));
std::wstring hId = Context.get_slide_context().add_hyperlink(xlink_attlist_.href_.get_value_or(L""));
Context.get_text_context().end_hyperlink(hId);
}
@ -1137,6 +1178,11 @@ std::wostream & sequence::text_to_stream(std::wostream & _Wostream) const
void sequence::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:num-format", style_num_format_);
CP_APPLY_ATTR(L"style:num-letter-sync", style_num_letter_sync_);
CP_APPLY_ATTR(L"text:formula", text_formula_);
CP_APPLY_ATTR(L"text:ref-name", text_ref_name_);
CP_APPLY_ATTR(L"text:name", text_name_);
}
void sequence::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -1152,10 +1198,75 @@ void sequence::add_text(const std::wstring & Text)
void sequence::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->docx_convert(Context);
}
std::wstring ref;
if (text_ref_name_ && text_name_)
{
size_t pos = text_ref_name_->find(L"ref" + *text_name_);
if (pos != std::wstring::npos)
{
ref = *text_name_ + L"!" + text_ref_name_->substr(pos + 3 + text_name_->length()) + L"|sequence";
}
}
if (!ref.empty())
{
Context.start_bookmark(ref);
}
Context.add_new_run();
Context.output_stream() << L"<w:t>" << template_ << L"</w:t>";
Context.finish_run();
std::wstring num_format = L"ARABIC";
if (style_num_format_)
{
switch(style_num_format_->get_type())
{
case odf_types::style_numformat::romanUc: num_format= L"ROMANUC"; break;
case odf_types::style_numformat::romanLc: num_format= L"ROMANLC"; break;
case odf_types::style_numformat::alphaUc: num_format= L"ALPHAUC"; break;
case odf_types::style_numformat::alphaLc: num_format= L"ALPHALC"; break;
case odf_types::style_numformat::arabic:
default:
num_format= L"ARABIC"; break;
}
}
Context.output_stream() << L"<w:fldSimple w:instr=\" SEQ " << template_ << L" \\* " << num_format << L" \">";
Context.add_new_run();
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->docx_convert(Context);
}
Context.finish_run();
if (!ref.empty())
{
Context.end_bookmark(ref);
}
Context.output_stream() << L"</w:fldSimple>";
//Context.add_new_run();
// Context.output_stream() << L"<w:fldChar w:fldCharType=\"begin\"/>";
//Context.finish_run();
//
//Context.add_new_run();
//Context.output_stream() << L"<w:instrText xml:space=\"preserve\"> SEQ " << template_ << L" \\* ARABIC </w:instrText>";
// Context.finish_run();
//Context.add_new_run();
// Context.output_stream() << L"<w:fldChar w:fldCharType=\"separate\"/>";
//Context.finish_run();
//
//for (size_t i = 0; i < text_.size(); i++)
//{
// text_[i]->docx_convert(Context);
//}
//Context.end_bookmark();
//
//Context.add_new_run();
// Context.output_stream() << L"<w:fldChar w:fldCharType=\"end\"/>";
//Context.finish_run();
}
void sequence::pptx_convert(oox::pptx_conversion_context & Context)
{
@ -1446,6 +1557,17 @@ void presentation_date_time::pptx_convert(oox::pptx_conversion_context & Context
{
Context.get_text_context().start_field(oox::date, L"");
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * field_fieldmark_start::ns = L"field";
const wchar_t * field_fieldmark_start::name = L"fieldmark-start";
void field_fieldmark_start::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_);
CP_APPLY_ATTR(L"field:type", field_type_);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * field_fieldmark_end::ns = L"field";
const wchar_t * field_fieldmark_end::name = L"fieldmark-end";
}
}

View File

@ -202,14 +202,13 @@ public:
bookmark() {}
bookmark(const std::wstring & Name) : text_name_(Name){};
const std::wstring & attr_name() const { return text_name_; }
std::wstring text_name_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text) {}
std::wstring text_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(bookmark);
@ -226,11 +225,12 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
virtual void docx_convert(oox::docx_conversion_context & Context);
bookmark_start() {}
bookmark_start(const std::wstring & Name) : text_name_(Name){};
bookmark_start(const std::wstring & Name) : name_(Name){};
std::wstring text_name_;
std::wstring name_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -238,7 +238,6 @@ private:
virtual void add_text(const std::wstring & Text) {}
};
CP_REGISTER_OFFICE_ELEMENT2(bookmark_start);
//-------------------------------------------------------------------------------------------------------------------
// text:bookmark-end
@ -252,12 +251,13 @@ public:
static const ElementType type = typeTextBookmarkEnd;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
bookmark_end() {} ;
bookmark_end(const std::wstring & Name) : text_name_(Name){};
bookmark_end(const std::wstring & Name) : name_(Name){};
std::wstring text_name_;
std::wstring name_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -265,8 +265,35 @@ private:
virtual void add_text(const std::wstring & Text) {}
};
CP_REGISTER_OFFICE_ELEMENT2(bookmark_end);
//-------------------------------------------------------------------------------------------------------------------
// text:bookmark-ref
//-------------------------------------------------------------------------------------------------------------------
class bookmark_ref : public paragraph_content_element<bookmark_ref>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextBookmarkRef;
CPDOCCORE_DEFINE_VISITABLE();
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
bookmark_ref() {} ;
std::wstring text_ref_name_;
_CP_OPT(std::wstring) text_reference_format_;
std::wstring content_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(bookmark_ref);
//-------------------------------------------------------------------------------------------------------------------
// text:reference-mark
//-------------------------------------------------------------------------------------------------------------------
@ -402,7 +429,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
std::wstring office_name_;
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;
@ -597,13 +624,13 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
virtual void add_text(const std::wstring & Text);
_CP_OPT(std::wstring) style_num_format_;
_CP_OPT(odf_types::Bool) style_num_letter_sync_;
_CP_OPT(odf_types::Bool) text_fixed_;
_CP_OPT(int) text_page_adjust_;
_CP_OPT(std::wstring) text_select_page_; //todooo to type
_CP_OPT(odf_types::style_numformat) style_num_format_;
_CP_OPT(odf_types::Bool) style_num_letter_sync_;
_CP_OPT(odf_types::Bool) text_fixed_;
_CP_OPT(int) text_page_adjust_;
_CP_OPT(std::wstring) text_select_page_; //todooo to type
office_element_ptr text_;
office_element_ptr text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_page_number);
@ -624,8 +651,8 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
_CP_OPT(std::wstring) style_num_format_;
_CP_OPT(odf_types::Bool) style_num_letter_sync_;
_CP_OPT(odf_types::style_numformat) style_num_format_;
_CP_OPT(odf_types::Bool) style_num_letter_sync_;
office_element_ptr text_;
private:
@ -791,13 +818,19 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
_CP_OPT(odf_types::style_numformat) style_num_format_;
_CP_OPT(std::wstring) style_num_letter_sync_;
_CP_OPT(std::wstring) text_formula_;
_CP_OPT(std::wstring) text_name_;
_CP_OPT(std::wstring) text_ref_name_;
_CP_OPT(std::wstring) template_;
office_element_ptr_array text_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
// todooo attributes
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(sequence);
@ -1165,5 +1198,44 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_date_time);
//-------------------------------------------------------------------------------------------------------------------
// field:fieldmark-start
//-------------------------------------------------------------------------------------------------------------------
class field_fieldmark_start : public text::paragraph_content_element<field_fieldmark_start>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextFieldFieldmarkStart;
CPDOCCORE_DEFINE_VISITABLE();
_CP_OPT(std::wstring) text_name_;
_CP_OPT(std::wstring) field_type_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
};
CP_REGISTER_OFFICE_ELEMENT2(field_fieldmark_start);
//-------------------------------------------------------------------------------------------------------------------
// field:fieldmark-end
//-------------------------------------------------------------------------------------------------------------------
class field_fieldmark_end : public text::paragraph_content_element<field_fieldmark_end>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextFieldFieldmarkStart;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
};
CP_REGISTER_OFFICE_ELEMENT2(field_fieldmark_end);
} // namespace odf_reader
} // namespace cpdoccore

View File

@ -150,7 +150,7 @@ void style_background_image::add_attributes( const xml::attributes_wc_ptr & Attr
common_xlink_attlist tmp;
if (tmp.add_attributes(Attributes))
{
common_xlink_attlist_ = _CP_OPT(common_xlink_attlist)(tmp);
xlink_attlist_ = _CP_OPT(common_xlink_attlist)(tmp);
}
}
@ -382,12 +382,12 @@ std::wostream & style_paragraph_properties::text_to_stream(std::wostream & _Wost
void style_paragraph_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
style_paragraph_properties_content_.add_attributes(Attributes);
content_.add_attributes(Attributes);
}
void style_paragraph_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if (!style_paragraph_properties_content_.add_child_element(Reader, Ns, Name, getContext()))
if (!content_.add_child_element(Reader, Ns, Name, getContext()))
CP_NOT_APPLICABLE_ELM();
}

View File

@ -164,7 +164,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
_CP_OPT(odf_types::common_xlink_attlist) common_xlink_attlist_;
_CP_OPT(odf_types::common_xlink_attlist) xlink_attlist_;
};
@ -191,7 +191,7 @@ public:
_CP_OPT(std::wstring) filter_name_;
_CP_OPT(odf_types::percent) draw_opacity_;
_CP_OPT(odf_types::common_xlink_attlist) common_xlink_attlist_;
_CP_OPT(odf_types::common_xlink_attlist) xlink_attlist_;
office_element_ptr office_binary_data_;
};
@ -212,52 +212,53 @@ public:
void xlsx_convert(std::wostream & strm, bool in_draw);
_CP_OPT(odf_types::line_width) fo_line_height_; // +
_CP_OPT(odf_types::length) style_line_height_at_least_; // +
_CP_OPT(odf_types::length) style_line_spacing_; // +
_CP_OPT(bool) style_font_independent_line_spacing_; // ???
_CP_OPT(odf_types::text_align) fo_text_align_; // +
_CP_OPT(odf_types::text_align) fo_text_align_last_;
_CP_OPT(bool) style_justify_single_word_;
_CP_OPT(odf_types::keep_together) fo_keep_together_; // +
_CP_OPT(unsigned int) fo_widows_; // +
_CP_OPT(unsigned int) fo_orphans_;
office_element_ptr style_tab_stops_; // +
_CP_OPT(odf_types::length) style_tab_stop_distance_;
_CP_OPT(odf_types::hyphenation_keep) fo_hyphenation_keep_;
_CP_OPT(odf_types::integer_or_nolimit) fo_hyphenation_ladder_count_;
office_element_ptr style_drop_cap_;
_CP_OPT(bool) style_register_true_;
_CP_OPT(odf_types::length_or_percent) fo_margin_left_; // +
_CP_OPT(odf_types::length_or_percent) fo_margin_right_; // +
_CP_OPT(odf_types::length_or_percent) fo_text_indent_; // +
_CP_OPT(bool) style_auto_text_indent_; // ???
_CP_OPT(odf_types::length_or_percent) fo_margin_top_; // +
_CP_OPT(odf_types::length_or_percent) fo_margin_bottom_; // +
_CP_OPT(odf_types::length_or_percent) fo_margin_;
_CP_OPT(odf_types::fo_break) fo_break_before_; // +
_CP_OPT(odf_types::fo_break) fo_break_after_;
_CP_OPT(odf_types::background_color) fo_background_color_;
office_element_ptr style_background_image_;
_CP_OPT(odf_types::border_style) fo_border_; // +
_CP_OPT(odf_types::border_style) fo_border_top_; // +
_CP_OPT(odf_types::border_style) fo_border_bottom_; // +
_CP_OPT(odf_types::border_style) fo_border_left_; // +
_CP_OPT(odf_types::border_style) fo_border_right_; // +
_CP_OPT( odf_types::border_widths ) style_border_line_width_; // +
_CP_OPT(odf_types::line_width) fo_line_height_;
_CP_OPT(odf_types::length) style_line_height_at_least_;
_CP_OPT(odf_types::length) style_line_spacing_;
_CP_OPT(bool) style_font_independent_line_spacing_; // ???
_CP_OPT(odf_types::text_align) fo_text_align_;
_CP_OPT(odf_types::text_align) fo_text_align_last_;
_CP_OPT(bool) style_justify_single_word_;
_CP_OPT(odf_types::keep_together) fo_keep_together_;
_CP_OPT(unsigned int) fo_widows_;
_CP_OPT(unsigned int) fo_orphans_;
_CP_OPT(odf_types::length) style_tab_stop_distance_;
_CP_OPT(odf_types::hyphenation_keep) fo_hyphenation_keep_;
_CP_OPT(odf_types::integer_or_nolimit) fo_hyphenation_ladder_count_;
_CP_OPT(bool) style_register_true_;
_CP_OPT(odf_types::length_or_percent) fo_margin_left_;
_CP_OPT(odf_types::length_or_percent) fo_margin_right_;
_CP_OPT(odf_types::length_or_percent) fo_text_indent_;
_CP_OPT(bool) style_auto_text_indent_; // ???
_CP_OPT(odf_types::length_or_percent) fo_margin_top_;
_CP_OPT(odf_types::length_or_percent) fo_margin_bottom_;
_CP_OPT(odf_types::length_or_percent) fo_margin_;
_CP_OPT(odf_types::fo_break) fo_break_before_;
_CP_OPT(odf_types::fo_break) fo_break_after_;
_CP_OPT(odf_types::background_color) fo_background_color_;
_CP_OPT( odf_types::border_widths ) style_border_line_width_top_; // +
_CP_OPT( odf_types::border_widths ) style_border_line_width_bottom_;// +
_CP_OPT( odf_types::border_widths ) style_border_line_width_left_; // +
_CP_OPT( odf_types::border_widths ) style_border_line_width_right_; // +
office_element_ptr style_background_image_;
office_element_ptr style_drop_cap_;
office_element_ptr style_tab_stops_;
_CP_OPT(odf_types::length) fo_padding_; // +
_CP_OPT(odf_types::length) fo_padding_top_; // +
_CP_OPT(odf_types::length) fo_padding_bottom_; // +
_CP_OPT(odf_types::length) fo_padding_left_; // +
_CP_OPT(odf_types::length) fo_padding_right_; // +
_CP_OPT(odf_types::border_style) fo_border_;
_CP_OPT(odf_types::border_style) fo_border_top_;
_CP_OPT(odf_types::border_style) fo_border_bottom_;
_CP_OPT(odf_types::border_style) fo_border_left_;
_CP_OPT(odf_types::border_style) fo_border_right_;
_CP_OPT( odf_types::border_widths ) style_border_line_width_;
_CP_OPT( odf_types::border_widths ) style_border_line_width_top_;
_CP_OPT( odf_types::border_widths ) style_border_line_width_bottom_;
_CP_OPT( odf_types::border_widths ) style_border_line_width_left_;
_CP_OPT( odf_types::border_widths ) style_border_line_width_right_;
_CP_OPT(odf_types::length) fo_padding_;
_CP_OPT(odf_types::length) fo_padding_top_;
_CP_OPT(odf_types::length) fo_padding_bottom_;
_CP_OPT(odf_types::length) fo_padding_left_;
_CP_OPT(odf_types::length) fo_padding_right_;
_CP_OPT(odf_types::shadow_type) style_shadow_;
_CP_OPT(odf_types::keep_together) fo_keep_with_next_;
_CP_OPT(bool) text_number_lines_;
@ -289,7 +290,7 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
const paragraph_format_properties & content() const { return style_paragraph_properties_content_; }
const paragraph_format_properties & content() const { return content_; }
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
@ -301,7 +302,7 @@ private:
private:
paragraph_format_properties style_paragraph_properties_content_;
paragraph_format_properties content_;
};

View File

@ -539,7 +539,7 @@ void style_tab_stop::docx_convert(oox::docx_conversion_context & Context)
void style_paragraph_properties::docx_convert(oox::docx_conversion_context & Context)
{
style_paragraph_properties_content_.docx_convert(Context);
content_.docx_convert(Context);
}

View File

@ -635,7 +635,7 @@ void style_tab_stop::pptx_convert(oox::pptx_conversion_context & Context)
void style_paragraph_properties::pptx_convert(oox::pptx_conversion_context & Context)
{
style_paragraph_properties_content_.pptx_convert(Context);
content_.pptx_convert(Context);
}

View File

@ -90,7 +90,7 @@ const wchar_t * presentation_sound::name = L"sound";
void presentation_sound::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
}
void presentation_sound::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -100,7 +100,7 @@ void presentation_sound::add_child_element( xml::sax * Reader, const std::wstrin
void presentation_sound::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().set_link(common_xlink_attlist_.href_.get_value_or(L""), oox::typeAudio);
Context.get_slide_context().set_link(xlink_attlist_.href_.get_value_or(L""), oox::typeAudio);
}
//-------------------------------------------------------------------------------------------------
const wchar_t * style_drawing_page_properties::ns = L"style";

View File

@ -87,7 +87,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);

View File

@ -207,10 +207,9 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
{
std::wostream & strm = Context.output_stream();
if (attlist_.style_column_width_)
{
double kf_max_width_ms =1.;
double kf_max_width_ms = 1.;
const page_layout_instance * pp = Context.root()->odf_context().pageLayoutContainer().page_layout_first();//
if ((pp) && (pp->properties()))
@ -226,17 +225,15 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
int val = attlist_.style_column_width_->get_value_unit(length::pt);
double width = 0.5 + 20.0 * val * kf_max_width_ms;
//_CP_OPT(int) iUnormalWidth;
//if (odf_reader::GetProperty(Context.get_settings_properties(),L"UnormalWidthPage",iUnormalWidth))
{
//kf_max_width_ms = 31680./iUnormalWidth.get();//эквивалент 22"
}
strm << L"<w:gridCol w:w=\"" <<
(int)(0.5 + 20.0 * val * kf_max_width_ms) << "\"/>";
Context.get_table_context().add_column_width(width);
strm << L"<w:gridCol w:w=\"" << (int)(width) << "\"/>";
}
else
{
Context.get_table_context().add_column_width(0);
}
}
@ -244,7 +241,6 @@ void style_table_column_properties::pptx_convert(oox::pptx_conversion_context &
{
std::wostream & strm = Context.get_table_context().tableData();
if (attlist_.style_column_width_)
{
int val = attlist_.style_column_width_->get_value_unit(length::emu);

View File

@ -303,7 +303,7 @@ void default_style::add_attributes( const xml::attributes_wc_ptr & Attributes )
void default_style::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
style_content_.add_child_element(Reader, Ns, Name, getContext());
content_.add_child_element(Reader, Ns, Name, getContext());
}
void default_style::add_text(const std::wstring & Text)
@ -433,7 +433,7 @@ void style::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
CP_CREATE_ELEMENT(style_map_);
}
else
style_content_.add_child_element(Reader, Ns, Name, getContext());
content_.add_child_element(Reader, Ns, Name, getContext());
}
void style::add_text(const std::wstring & Text)

View File

@ -136,7 +136,7 @@ public:
odf_types::style_family style_family_;
style_content style_content_;
style_content content_;
friend class odf_document;
@ -251,6 +251,7 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(draw_opacity);
// style_draw_fill_image
class draw_fill_image : public office_element_impl<draw_fill_image>
{
@ -281,7 +282,6 @@ typedef weak_ptr<style>::Type style_weak_ptr;
typedef std::vector< style_weak_ptr > style_weak_ptr_array;
typedef std::vector< style_ptr > style_ptr_array;
// style
/// style:style
class style : public office_element_impl<style>
{
@ -302,7 +302,6 @@ private:
virtual void add_text(const std::wstring & Text);
public:
// attr
std::wstring style_name_;
bool style_auto_update_; // default = false
@ -317,7 +316,7 @@ public:
_CP_OPT( std::wstring ) style_class_;
_CP_OPT( std::wstring ) style_default_outline_level_;
style_content style_content_;
style_content content_;
office_element_ptr_array style_map_;
friend class odf_document;

View File

@ -117,7 +117,7 @@ void text_list_level_style_bullet_attr::add_attributes( const xml::attributes_wc
void text_list_level_style_image_attr::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
}
@ -244,22 +244,6 @@ void text_list_level_style_bullet::add_child_element( xml::sax * Reader, const s
namespace {
std::wstring GetNumFormat(const std::wstring & Format)
{
if (L"1" == Format)
return L"decimal";
else if (L"i" == Format)
return L"lowerRoman";
else if (L"I" == Format)
return L"upperRoman";
else if (L"a" == Format)
return L"lowerLetter";
else if (L"A" == Format)
return L"upperLetter";
else
return L"decimal";
}
std::wstring GetLevelText(unsigned int displayLevels,
unsigned int textLevel,
oox::docx_conversion_context & Context)
@ -356,7 +340,21 @@ void text_list_level_style_number::docx_convert(oox::docx_conversion_context & C
}
CP_XML_NODE(L"w:numFmt")
{
CP_XML_ATTR(L"w:val",GetNumFormat( text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_.get_value_or(L"") ));
std::wstring num_format = L"arabic";
if (text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_)
{
switch(text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_->get_type())
{
case odf_types::style_numformat::romanUc: num_format= L"romanUc"; break;
case odf_types::style_numformat::romanLc: num_format= L"romanLc"; break;
case odf_types::style_numformat::alphaUc: num_format= L"alphaUc"; break;
case odf_types::style_numformat::alphaLc: num_format= L"alphaLc"; break;
case odf_types::style_numformat::arabic:
default:
num_format= L"arabic"; break;
}
}
CP_XML_ATTR(L"w:val", num_format);
}
CP_XML_NODE(L"w:suff")
{
@ -477,19 +475,17 @@ void text_list_level_style_number::pptx_convert(oox::pptx_conversion_context & C
if (text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_)
{
if (*text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_ == L"1")
num_format= L"arabic";
else if (*text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_ == L"I")
num_format= L"romanUc";
else if (*text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_ == L"i")
num_format= L"romanLc";
else if (*text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_ == L"A")
num_format= L"alphaUc";
else if (*text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_ == L"a")
num_format= L"alphaLc";
else
num_format= L"arabic";
}else num_format= L"arabic";
switch(text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_->get_type())
{
case odf_types::style_numformat::romanUc: num_format= L"romanUc"; break;
case odf_types::style_numformat::romanLc: num_format= L"romanLc"; break;
case odf_types::style_numformat::alphaUc: num_format= L"alphaUc"; break;
case odf_types::style_numformat::alphaLc: num_format= L"alphaLc"; break;
case odf_types::style_numformat::arabic:
default:
num_format= L"arabic"; break;
}
}
if (text_list_level_style_number_attr_.common_num_format_prefix_suffix_attlist_.style_num_prefix_)
{

View File

@ -256,7 +256,7 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
friend class text_list_level_style_image;

View File

@ -112,7 +112,7 @@ void table_table_source_attlist::add_attributes( const xml::attributes_wc_ptr &
void table_linked_source_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"table:filter-name", table_filter_name_);
CP_APPLY_ATTR(L"table:filter-options", table_filter_options_);
@ -162,7 +162,8 @@ void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns,
else if ((L"table" == Ns && L"table-row-group" == Name) ||
(L"table" == Ns && L"table-rows" == Name) ||
(L"table" == Ns && L"table-row" == Name) ||
(L"table" == Ns && L"table-header-rows" == Name))
(L"table" == Ns && L"table-header-rows" == Name)||
(L"text" == Ns && L"soft-page-break" == Name))
{
table_rows_and_groups_.add_child_element(Reader, Ns, Name, getContext());
}
@ -533,7 +534,8 @@ void table_rows::add_child_element( xml::sax * Reader, const std::wstring & Ns,
{
CP_CREATE_ELEMENT_SIMPLE(table_table_rows_);
}
else if CP_CHECK_NAME(L"table", L"table-row")
else if (CP_CHECK_NAME(L"table", L"table-row") || CP_CHECK_NAME(L"text", L"soft-page-break"))
{
CP_CREATE_ELEMENT_SIMPLE(table_table_row_);
}
@ -605,7 +607,8 @@ void table_rows_no_group::add_child_element( xml::sax * Reader, const std::wstri
}
void table_rows_no_group::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context)
{
if (CP_CHECK_NAME(L"table", L"table-rows") || CP_CHECK_NAME(L"table", L"table-row"))
if (CP_CHECK_NAME(L"table", L"table-rows") || CP_CHECK_NAME(L"table", L"table-row") ||
CP_CHECK_NAME(L"text", L"soft-page-break"))
{
if (!was_header_)
table_rows_1_.add_child_element(Reader, Ns, Name, Context);
@ -639,7 +642,8 @@ void table_rows_and_groups::add_child_element( xml::sax * Reader, const std::wst
{
CP_CREATE_ELEMENT_SIMPLE(content_);
}
else if (L"table" == Ns && (L"table-rows" == Name || L"table-row" == Name || L"table-header-rows" == Name) )
else if ((L"table" == Ns && (L"table-rows" == Name || L"table-row" == Name || L"table-header-rows" == Name)) ||
(L"text" == Ns && L"soft-page-break" == Name))
{
bool add_new_no_group = false;
if (content_.empty()) add_new_no_group = true;

View File

@ -130,7 +130,7 @@ class table_linked_source_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) table_filter_name_;
_CP_OPT(std::wstring) table_filter_options_;

View File

@ -238,16 +238,24 @@ void table_table_column::docx_convert(oox::docx_conversion_context & Context)
for (unsigned int i = 0; i < columnsRepeated; ++i)
{
bool bAddWidth = false;
if (table_table_column_attlist_.table_style_name_)
{
const std::wstring colStyleName = table_table_column_attlist_.table_style_name_.get();
if (style_instance * inst =
Context.root()->odf_context().styleContainer().style_by_name( colStyleName , style_family::TableColumn,Context.process_headers_footers_ ))
Context.root()->odf_context().styleContainer().style_by_name( colStyleName , style_family::TableColumn, Context.process_headers_footers_ ))
{
if (inst->content())
{
inst->content()->docx_convert(Context);
bAddWidth = true;
}
}
}
if (false == bAddWidth)
{
Context.get_table_context().add_column_width(0);
}
}
}
@ -266,22 +274,27 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
_Wostream << L"<w:tcPr>";
const std::wstring styleName = attlist_.table_style_name_.get_value_or(L"");
//_Wostream << L"<w:tcW w:w=\"0\" w:type=\"auto\" />";
if (attlist_extra_.table_number_rows_spanned_ > 1)
{
_Wostream << L"<w:vMerge w:val=\"restart\" />";
_Wostream << L"<w:vMerge w:val=\"restart\"/>";
Context.get_table_context().set_rows_spanned(Context.get_table_context().current_column(),
attlist_extra_.table_number_rows_spanned_ - 1,
attlist_extra_.table_number_columns_spanned_ - 1,
styleName
);
}
double width = Context.get_table_context().get_current_cell_width();
if (width > 0.01)
{
_Wostream << L"<w:tcW w:w=\"" << (int)width << L"\" w:type=\"dxa\"/>";
}
if (attlist_extra_.table_number_columns_spanned_ > 1)
{
_Wostream << L"<w:gridSpan w:val=\"" << attlist_extra_.table_number_columns_spanned_ << "\" />";
_Wostream << L"<w:gridSpan w:val=\"" << attlist_extra_.table_number_columns_spanned_ << "\"/>";
Context.get_table_context().set_columns_spanned(attlist_extra_.table_number_columns_spanned_ - 1);
}
@ -324,8 +337,7 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
/// Стиль по умолчанию для данной строки
{
const std::wstring & defaultCellStyle =
Context.get_table_context().get_default_cell_style_row();
const std::wstring & defaultCellStyle = Context.get_table_context().get_default_cell_style_row();
if (const style_instance * inst =
Context.root()->odf_context().styleContainer().style_by_name(defaultCellStyle, style_family::TableCell,Context.process_headers_footers_))

View File

@ -328,7 +328,7 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
table_table_source* table_source = dynamic_cast<table_table_source*>( table_table_source_.get() );
if ( table_source)
{
if (table_source->table_linked_source_attlist_.common_xlink_attlist_.href_)return;
if (table_source->table_linked_source_attlist_.xlink_attlist_.href_)return;
}
}

View File

@ -62,39 +62,13 @@ const wchar_t * h::name = L"h";
namespace {
void process_page_break_after(const style_instance * styleInst, oox::docx_conversion_context & Context)
{
if (styleInst)
{
const style_instance * inst = styleInst;
while (inst)
{
if (inst->content() && inst->content()->get_style_paragraph_properties())
{
_CP_OPT(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() == fo_break::Page)
{
Context.set_page_break_after(true);
break;
}
else if (fo_break_val->get_type() == fo_break::Auto)
{
break;
}
}
}
inst = inst->parent();
}
}
}
typedef std::map<std::wstring, oox::text_tracked_context::_state>::iterator map_changes_iterator;
void process_paragraph_drop_cap_attr(const paragraph_attrs & Attr, oox::docx_conversion_context & Context)
{
if (Attr.text_style_name_.empty())return;
style_instance * styleInst
= Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_, style_family::Paragraph,Context.process_headers_footers_);
= Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_, style_family::Paragraph, Context.process_headers_footers_);
if ((!styleInst) || (styleInst->is_automatic() == false))return;
style_content * styleContent = styleInst->content();
@ -129,165 +103,27 @@ void process_paragraph_drop_cap_attr(const paragraph_attrs & Attr, oox::docx_con
text_properties->content().fo_font_size_, Context.get_styles_context().get_current_processed_style(), false, //1.);
7.25 * (Context.get_drop_cap_context().Scale + (Context.get_drop_cap_context().Scale-1) * 0.7));//формула ачуметь !! - подбор вручную
}
return;
}
typedef std::map<std::wstring, oox::text_tracked_context::_state>::iterator map_changes_iterator;
int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_context & Context)
void process_paragraph_index(const paragraph_attrs & Attr, oox::docx_conversion_context & Context)
{
bool in_drawing = false;
if (false == Context.is_table_content()) return;
if (Context.get_drawing_context().get_current_shape() || Context.get_drawing_context().get_current_frame())
{
in_drawing = true;
}
if (!Attr.text_style_name_.empty())
{
if (style_instance * styleInst =
Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_, style_family::Paragraph, Context.process_headers_footers_)
)
{
process_page_break_after(styleInst, Context);
if (styleInst->is_automatic())
{
if (style_content * styleContent = styleInst->content())
{
std::wstring id;
if (const style_instance * parentStyleContent = styleInst->parent())
{
id = Context.styles_map_.get( parentStyleContent->name(), parentStyleContent->type() );
}
if (Attr.text_style_name_.empty())return;
Context.start_automatic_style(id);
{//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
paragraph_format_properties properties = calc_paragraph_properties_content(styleInst);
style_instance * styleInst
= Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_, style_family::Paragraph, Context.process_headers_footers_);
if ((!styleInst) || (styleInst->is_automatic() == false))return;
if (properties.style_writing_mode_)
{
writing_mode::type type = properties.style_writing_mode_->get_type();
switch(type)
{
case writing_mode::RlTb:
case writing_mode::TbRl:
case writing_mode::Rl:
Context.set_rtl(true);
break;
default:
Context.set_rtl(false);
}
}
Context.set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(length::pt) : 0);
//for calculate tabs
}
styleContent->docx_convert(Context);
Context.end_automatic_style();
if (L"index" != styleInst->style_class()) return;
Context.push_text_properties(styleContent->get_style_text_properties());
if (!Context.get_section_context().dump_.empty()
&& !Context.get_table_context().in_table()
&& (Context.get_process_note() == oox::docx_conversion_context::noNote)
&& !in_drawing)
{
Context.output_stream() << L"<w:pPr>";
if (Context.is_paragraph_header() )
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
Context.output_stream() << L"</w:pPr>";
Context.finish_paragraph();
Context.start_paragraph();
}
else
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
Context.output_stream() << L"</w:pPr>";
}
}
return 1;
}
}
else
{
const std::wstring id = Context.styles_map_.get( styleInst->name(), styleInst->type() );
Context.output_stream() << L"<w:pPr>";
//todooo причесать
if (!Context.get_section_context().dump_.empty()
&& !Context.get_table_context().in_table()
&& (Context.get_process_note() == oox::docx_conversion_context::noNote)
&& !in_drawing)
{
if (Context.is_paragraph_header() )
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
Context.output_stream() << L"</w:pPr>";
Context.finish_paragraph();
Context.start_paragraph();
Context.output_stream() << L"<w:pPr>";
}
else
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
}
}
Context.output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
if (!Context.get_text_tracked_context().dumpPPr_.empty())
{
Context.output_stream() << Context.get_text_tracked_context().dumpPPr_;
Context.get_text_tracked_context().dumpPPr_.clear();
}
Context.docx_serialize_list_properties(Context.output_stream());
if ((Attr.outline_level_) && (*Attr.outline_level_ > 0))
{
Context.output_stream() << L"<w:outlineLvl w:val=\"" << *Attr.outline_level_ - 1 << L"\" />";
}
if (!Context.get_text_tracked_context().dumpRPrInsDel_.empty())
{
Context.output_stream() << L"<w:rPr>";
Context.output_stream() << Context.get_text_tracked_context().dumpRPrInsDel_;
Context.get_text_tracked_context().dumpRPrInsDel_.clear();
Context.output_stream() << L"</w:rPr>";
}
Context.output_stream() << L"</w:pPr>";
return 2;
}
}
}
if (!Context.get_section_context().dump_.empty()
&& !Context.get_table_context().in_table()
&& (Context.get_process_note() == oox::docx_conversion_context::noNote)
&& !in_drawing)
{
Context.output_stream() << L"<w:pPr>";
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
//todooo выяснить реальны ли заголовки без стилей и свойств
Context.output_stream() << L"</w:pPr>";
return 3;
}
return 0;
}
}
}
std::wostream & paragraph::text_to_stream(std::wostream & _Wostream) const
{
// TODO!!!!
CP_SERIALIZE_TEXT(content_);
_Wostream << L"\n";
return _Wostream;
@ -300,7 +136,24 @@ void paragraph::add_attributes( const xml::attributes_wc_ptr & Attributes )
void paragraph::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context)
{
CP_CREATE_ELEMENT_SIMPLE(content_);
if CP_CHECK_NAME(L"text", L"sequence")
{
CP_CREATE_ELEMENT_SIMPLE(sequence_);
if ((false == content_.empty()) && (content_.back()->get_type() == typeTextText))
{
sequence* q = dynamic_cast<sequence*>(sequence_.get());
text* t = dynamic_cast<text*>(content_.back().get());
if (q && t)
{
q->template_ = t->text_;
content_.pop_back();
}
}
content_.push_back(sequence_);
}
else
CP_CREATE_ELEMENT_SIMPLE(content_);
}
void paragraph::add_text(const std::wstring & Text)
@ -355,7 +208,7 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
str = store_str.substr(0,Context.get_drop_cap_context().Length);
int textStyle = process_paragraph_attr(attrs_, Context);
int textStyle = Context.process_paragraph_attr(&attrs_);
first_text_paragraph->docx_convert(Context);
size_t str_start = Context.get_drop_cap_context().Length;
@ -425,6 +278,14 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
if (Context.get_drawing_context().get_current_shape() || Context.get_drawing_context().get_current_frame())
{
in_drawing = true;
if (sequence_)
{
std::wstringstream _Wostream;
CP_SERIALIZE_TEXT(content_);
Context.get_drawing_context().set_next_object_caption(_Wostream.str());
}
}
bool bIsNewParagraph = true;
@ -450,8 +311,6 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
if (bIsNewParagraph)
Context.start_paragraph(is_header_);
std::wostream & _Wostream = Context.output_stream();
const _CP_OPT(std::wstring) masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(styleName);
if (masterPageName)
@ -509,7 +368,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
}
int textStyle = process_paragraph_attr(attrs_, Context);
int textStyle = Context.process_paragraph_attr(&attrs_);
Context.add_note_reference();
@ -518,8 +377,8 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
if (Context.get_page_break())
{
if (Context.process_headers_footers_ == false)
//_Wostream << L"<w:lastRenderedPageBreak/>";
_Wostream << L"<w:br w:type=\"page\"/>";
//Context.output_stream() << L"<w:lastRenderedPageBreak/>";
Context.output_stream() << L"<w:br w:type=\"page\"/>";
Context.set_page_break(false);
}
content_[i]->docx_convert(Context);
@ -548,7 +407,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
is_empty = false;
Context.add_new_run(_T(""));
_Wostream << L"<w:br w:type=\"page\"/>";
Context.output_stream() << L"<w:br w:type=\"page\"/>";
Context.finish_run();
}
@ -863,7 +722,7 @@ void text_section::docx_convert(oox::docx_conversion_context & Context)
void text_section_source_attr::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"text:section-name", text_section_name_);
CP_APPLY_ATTR(L"text:filter-name", text_filter_name_);
@ -893,7 +752,7 @@ const wchar_t * text_index_body::name = L"index-body";
std::wostream & text_index_body::text_to_stream(std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(index_content_main_);
CP_SERIALIZE_TEXT(content_);
return _Wostream;
}
@ -903,21 +762,21 @@ void text_index_body::add_attributes( const xml::attributes_wc_ptr & Attributes
void text_index_body::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(index_content_main_);
CP_CREATE_ELEMENT(content_);
}
void text_index_body::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < index_content_main_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
index_content_main_[i]->docx_convert(Context);
content_[i]->docx_convert(Context);
}
}
void text_index_body::pptx_convert(oox::pptx_conversion_context & Context)
{
for (size_t i = 0; i < index_content_main_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
index_content_main_[i]->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
}
// text:index-title
@ -928,21 +787,21 @@ const wchar_t * text_index_title::name = L"index-title";
void text_index_title::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < index_content_main_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
index_content_main_[i]->docx_convert(Context);
content_[i]->docx_convert(Context);
}
}
void text_index_title::pptx_convert(oox::pptx_conversion_context & Context)
{
for (size_t i = 0; i < index_content_main_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
index_content_main_[i]->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
}
std::wostream & text_index_title::text_to_stream(std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(index_content_main_);
CP_SERIALIZE_TEXT(content_);
return _Wostream;
}
@ -953,7 +812,7 @@ void text_index_title::add_attributes( const xml::attributes_wc_ptr & Attributes
void text_index_title::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(index_content_main_);
CP_CREATE_ELEMENT(content_);
}
// text:table-of-content
@ -963,8 +822,11 @@ const wchar_t * text_table_of_content::name = L"table-of-content";
void text_table_of_content::docx_convert(oox::docx_conversion_context & Context)
{
if (text_index_body_)
text_index_body_->docx_convert(Context);
if (!text_index_body_) return;
Context.start_table_content(1);
text_index_body_->docx_convert(Context);
Context.end_table_content();
}
void text_table_of_content::pptx_convert(oox::pptx_conversion_context & Context)
@ -991,7 +853,10 @@ void text_table_of_content::add_child_element( xml::sax * Reader, const std::wst
{
CP_CREATE_ELEMENT(text_index_body_);
}
// TODO text-table-of-content-source
else if CP_CHECK_NAME(L"text", L"table-of-content-source")
{
CP_CREATE_ELEMENT(text_table_of_content_source_);
}
}
// text:table-index
@ -1059,14 +924,18 @@ void text_illustration_index::afterReadContent()
}
void text_illustration_index::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section (text_section_attr_.text_name_,text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
//std::wstring current_page_properties = Context.get_page_properties();
//
//Context.get_section_context().add_section (text_section_attr_.text_name_,text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
//
//Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);
// if (text_index_body_)
// text_index_body_->docx_convert(Context);
Context.start_table_content(2);
text_index_body_->docx_convert(Context);
Context.end_table_content();
}
void text_illustration_index::pptx_convert(oox::pptx_conversion_context & Context)

View File

@ -82,6 +82,7 @@ public:
size_t drop_cap_docx_convert(oox::docx_conversion_context & Context);
office_element_ptr_array content_;
office_element_ptr sequence_;
private:
void drop_cap_text_docx_convert(office_element_ptr first_text_paragraph,oox::docx_conversion_context & Context);
@ -271,7 +272,7 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) text_section_name_;
_CP_OPT(std::wstring) text_filter_name_;
@ -319,7 +320,8 @@ private:
public:
text_section_attr text_section_attr_;
office_element_ptr text_table_of_content_source_;
office_element_ptr text_table_of_content_source_;
office_element_ptr text_index_body_;
};
@ -506,7 +508,7 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
office_element_ptr_array index_content_main_;
office_element_ptr_array content_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -535,7 +537,7 @@ private:
public:
text_section_attr text_section_attr_;
office_element_ptr_array index_content_main_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_index_title);

View File

@ -353,6 +353,10 @@
RelativePath="..\src\odf\datatypes\calcext_type.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\calcext_type.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\chartdatalabelnumber.cpp"
>
@ -441,6 +445,14 @@
RelativePath="..\src\odf\datatypes\color.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\commandtype.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\commandtype.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\common_attlists.cpp"
>
@ -853,6 +865,14 @@
RelativePath="..\src\odf\datatypes\styleleadercolor.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\stylenumformat.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\stylenumformat.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\styleposition.cpp"
>

View File

@ -1583,6 +1583,14 @@
RelativePath="..\src\odf\office_event_listeners.h"
>
</File>
<File
RelativePath="..\src\odf\office_forms.cpp"
>
</File>
<File
RelativePath="..\src\odf\office_forms.h"
>
</File>
<File
RelativePath="..\src\odf\office_presentation.cpp"
>

View File

@ -96,14 +96,16 @@ HRESULT convert_single(std::wstring srcFileName)
Oox2Odf::Converter converter(srcTempPath, type, L"C:\\Windows\\Fonts", NULL);
std::wstring sPassword = L"password";
converter.convert();
converter.write(dstTempPath);
converter.write(dstTempPath, srcTempPath, sPassword);
NSDirectory::DeleteDirectory(srcTempPath);
if (hr != S_OK) return hr;
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), -1))
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), false, sPassword.empty() ? Z_DEFLATED : 0))
return hr;
NSDirectory::DeleteDirectory(dstTempPath);

View File

@ -7,12 +7,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Oox2OdfConverter", "..\sour
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileWriterTest", "OdfFileWTest.vcproj", "{FBA8446A-150F-4A10-B4DA-1022048D6473}"
ProjectSection(ProjectDependencies) = postProject
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{BEE01B53-244A-44E6-8947-ED9342D9247E} = {BEE01B53-244A-44E6-8947-ED9342D9247E}
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
{BEE01B53-244A-44E6-8947-ED9342D9247E} = {BEE01B53-244A-44E6-8947-ED9342D9247E}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
@ -23,10 +25,21 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfCommon", "..\..\ASCOffic
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeFileCrypt", "..\..\OfficeCryptReader\win32\ECMACryptReader.vcproj", "{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}"
ProjectSection(ProjectDependencies) = postProject
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptlib", "..\..\Common\3dParty\cryptopp\cryptlib.vcproj", "{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DLL-Import Debug|Win32 = DLL-Import Debug|Win32
DLL-Import Debug|x64 = DLL-Import Debug|x64
DLL-Import Release|Win32 = DLL-Import Release|Win32
DLL-Import Release|x64 = DLL-Import Release|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
@ -35,6 +48,14 @@ Global
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.Build.0 = Debug|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|x64.ActiveCfg = Debug|x64
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|x64.Build.0 = Debug|x64
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.DLL-Import Debug|Win32.Build.0 = Debug|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.DLL-Import Debug|x64.ActiveCfg = Debug|x64
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.DLL-Import Debug|x64.Build.0 = Debug|x64
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.DLL-Import Release|Win32.ActiveCfg = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.DLL-Import Release|Win32.Build.0 = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.DLL-Import Release|x64.ActiveCfg = Release|x64
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.DLL-Import Release|x64.Build.0 = Release|x64
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.ActiveCfg = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.Build.0 = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|x64.ActiveCfg = Release|x64
@ -43,6 +64,14 @@ Global
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.Build.0 = Debug|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|x64.ActiveCfg = Debug|x64
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|x64.Build.0 = Debug|x64
{BEE01B53-244A-44E6-8947-ED9342D9247E}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.DLL-Import Debug|Win32.Build.0 = Debug|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.DLL-Import Debug|x64.ActiveCfg = Debug|x64
{BEE01B53-244A-44E6-8947-ED9342D9247E}.DLL-Import Debug|x64.Build.0 = Debug|x64
{BEE01B53-244A-44E6-8947-ED9342D9247E}.DLL-Import Release|Win32.ActiveCfg = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.DLL-Import Release|Win32.Build.0 = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.DLL-Import Release|x64.ActiveCfg = Release|x64
{BEE01B53-244A-44E6-8947-ED9342D9247E}.DLL-Import Release|x64.Build.0 = Release|x64
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|Win32.ActiveCfg = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|Win32.Build.0 = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|x64.ActiveCfg = Release|x64
@ -51,6 +80,14 @@ Global
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|Win32.Build.0 = Debug|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|x64.ActiveCfg = Debug|x64
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|x64.Build.0 = Debug|x64
{FBA8446A-150F-4A10-B4DA-1022048D6473}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.DLL-Import Debug|Win32.Build.0 = Debug|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.DLL-Import Debug|x64.ActiveCfg = Debug|x64
{FBA8446A-150F-4A10-B4DA-1022048D6473}.DLL-Import Debug|x64.Build.0 = Debug|x64
{FBA8446A-150F-4A10-B4DA-1022048D6473}.DLL-Import Release|Win32.ActiveCfg = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.DLL-Import Release|Win32.Build.0 = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.DLL-Import Release|x64.ActiveCfg = Release|x64
{FBA8446A-150F-4A10-B4DA-1022048D6473}.DLL-Import Release|x64.Build.0 = Release|x64
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|Win32.ActiveCfg = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|Win32.Build.0 = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|x64.ActiveCfg = Release|x64
@ -59,6 +96,14 @@ Global
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.Build.0 = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|x64.ActiveCfg = Debug|x64
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|x64.Build.0 = Debug|x64
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.DLL-Import Debug|Win32.Build.0 = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.DLL-Import Debug|x64.ActiveCfg = Debug|x64
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.DLL-Import Debug|x64.Build.0 = Debug|x64
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.DLL-Import Release|Win32.ActiveCfg = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.DLL-Import Release|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.DLL-Import Release|x64.ActiveCfg = Release|x64
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.DLL-Import Release|x64.Build.0 = Release|x64
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.ActiveCfg = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|x64.ActiveCfg = Release|x64
@ -67,6 +112,14 @@ Global
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Debug|Win32.Build.0 = Debug|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Debug|x64.ActiveCfg = Debug|x64
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Debug|x64.Build.0 = Debug|x64
{94954A67-A853-43B1-A727-6EF2774C5A6A}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.DLL-Import Debug|Win32.Build.0 = Debug|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.DLL-Import Debug|x64.ActiveCfg = Debug|x64
{94954A67-A853-43B1-A727-6EF2774C5A6A}.DLL-Import Debug|x64.Build.0 = Debug|x64
{94954A67-A853-43B1-A727-6EF2774C5A6A}.DLL-Import Release|Win32.ActiveCfg = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.DLL-Import Release|Win32.Build.0 = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.DLL-Import Release|x64.ActiveCfg = Release|x64
{94954A67-A853-43B1-A727-6EF2774C5A6A}.DLL-Import Release|x64.Build.0 = Release|x64
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Release|Win32.ActiveCfg = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Release|Win32.Build.0 = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Release|x64.ActiveCfg = Release|x64
@ -75,6 +128,14 @@ Global
{609ED938-3CA8-4BED-B363-25096D4C4812}.Debug|Win32.Build.0 = Debug|Win32
{609ED938-3CA8-4BED-B363-25096D4C4812}.Debug|x64.ActiveCfg = Debug|x64
{609ED938-3CA8-4BED-B363-25096D4C4812}.Debug|x64.Build.0 = Debug|x64
{609ED938-3CA8-4BED-B363-25096D4C4812}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32
{609ED938-3CA8-4BED-B363-25096D4C4812}.DLL-Import Debug|Win32.Build.0 = Debug|Win32
{609ED938-3CA8-4BED-B363-25096D4C4812}.DLL-Import Debug|x64.ActiveCfg = Debug|x64
{609ED938-3CA8-4BED-B363-25096D4C4812}.DLL-Import Debug|x64.Build.0 = Debug|x64
{609ED938-3CA8-4BED-B363-25096D4C4812}.DLL-Import Release|Win32.ActiveCfg = Release|Win32
{609ED938-3CA8-4BED-B363-25096D4C4812}.DLL-Import Release|Win32.Build.0 = Release|Win32
{609ED938-3CA8-4BED-B363-25096D4C4812}.DLL-Import Release|x64.ActiveCfg = Release|x64
{609ED938-3CA8-4BED-B363-25096D4C4812}.DLL-Import Release|x64.Build.0 = Release|x64
{609ED938-3CA8-4BED-B363-25096D4C4812}.Release|Win32.ActiveCfg = Release|Win32
{609ED938-3CA8-4BED-B363-25096D4C4812}.Release|Win32.Build.0 = Release|Win32
{609ED938-3CA8-4BED-B363-25096D4C4812}.Release|x64.ActiveCfg = Release|x64
@ -83,10 +144,50 @@ Global
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|Win32.Build.0 = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|x64.ActiveCfg = Debug|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|x64.Build.0 = Debug|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.DLL-Import Debug|Win32.Build.0 = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.DLL-Import Debug|x64.ActiveCfg = Debug|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.DLL-Import Debug|x64.Build.0 = Debug|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.DLL-Import Release|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.DLL-Import Release|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.DLL-Import Release|x64.ActiveCfg = Release|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.DLL-Import Release|x64.Build.0 = Release|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|x64.ActiveCfg = Release|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|x64.Build.0 = Release|x64
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.Debug|Win32.ActiveCfg = Debug|Win32
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.Debug|Win32.Build.0 = Debug|Win32
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.Debug|x64.ActiveCfg = Debug|x64
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.Debug|x64.Build.0 = Debug|x64
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.DLL-Import Debug|Win32.Build.0 = Debug|Win32
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.DLL-Import Debug|x64.ActiveCfg = Debug|x64
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.DLL-Import Debug|x64.Build.0 = Debug|x64
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.DLL-Import Release|Win32.ActiveCfg = Release|Win32
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.DLL-Import Release|Win32.Build.0 = Release|Win32
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.DLL-Import Release|x64.ActiveCfg = Release|x64
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.DLL-Import Release|x64.Build.0 = Release|x64
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.Release|Win32.ActiveCfg = Release|Win32
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.Release|Win32.Build.0 = Release|Win32
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.Release|x64.ActiveCfg = Release|x64
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}.Release|x64.Build.0 = Release|x64
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.ActiveCfg = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.Build.0 = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|x64.ActiveCfg = Debug|x64
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|x64.Build.0 = Debug|x64
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Debug|Win32.ActiveCfg = DLL-Import Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Debug|Win32.Build.0 = DLL-Import Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Debug|x64.ActiveCfg = DLL-Import Debug|x64
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Debug|x64.Build.0 = DLL-Import Debug|x64
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Release|Win32.ActiveCfg = DLL-Import Release|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Release|Win32.Build.0 = DLL-Import Release|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Release|x64.ActiveCfg = DLL-Import Release|x64
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Release|x64.Build.0 = DLL-Import Release|x64
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|Win32.ActiveCfg = Release|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|Win32.Build.0 = Release|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|x64.ActiveCfg = Release|x64
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -38,6 +38,7 @@ SOURCES += \
core_debug {
SOURCES += \
../source/utils.cpp \
../source/OdfFormat/office_document.cpp \
../source/OdfFormat/abstract_xml.cpp \
../source/OdfFormat/calcext_elements.cpp \
../source/OdfFormat/draw_base.cpp \
@ -115,6 +116,7 @@ SOURCES += \
../source/Oox2OdfConverter/PptxConverter.cpp
HEADERS += \
../source/OdfFormat/office_document.h \
../source/OdfFormat/abstract_xml.h \
../source/OdfFormat/calcext_elements.h \
../source/OdfFormat/draw_base.h \

View File

@ -37,6 +37,7 @@
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
#include "../source/OdfFormat/office_document.cpp"
#include "../source/OdfFormat/calcext_elements.cpp"
#include "../source/OdfFormat/draw_base.cpp"
#include "../source/OdfFormat/draw_frame.cpp"

View File

@ -40,6 +40,7 @@
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../../Common/3dParty/cryptopp/osrng.h"
namespace cpdoccore
{
@ -56,7 +57,7 @@ namespace odf_writer
content_utf8_ = std::string( Content.begin(), Content.end());
}
void simple_element::write(const std::wstring & RootPath)
void simple_element::write(const std::wstring & RootPath, bool add_padding)
{
NSFile::CFileBinary file;
@ -65,9 +66,34 @@ namespace odf_writer
if (utf8_)
{
std::string root = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
file.WriteFile((BYTE*)root.c_str(), root.length());
file.WriteFile((BYTE*)root.c_str(), (DWORD)root.length());
if (add_padding)
{
CryptoPP::RandomPool prng;
CryptoPP::SecByteBlock padding(1024);
CryptoPP::OS_GenerateRandomBlock(false, padding, padding.size());
prng.IncorporateEntropy(padding, padding.size());
std::string padding_start = "<!-- ";
std::string padding_end = "-->";
file.WriteFile((BYTE*)padding_start.c_str(), (DWORD)padding_start.length());
//--------------------------------
int nLength = 0;
char *pData = NULL;
NSFile::CBase64Converter::Encode(padding.data(), padding.size(), pData, nLength, NSBase64::B64_BASE64_FLAG_NOCRLF);
if (pData)
{
file.WriteFile((BYTE*)pData, nLength);
delete []pData; pData = NULL;
}
//--------------------------------
file.WriteFile((BYTE*)padding_end.c_str(), (DWORD)padding_end.length());
}
}
file.WriteFile((BYTE*)content_utf8_.c_str(), content_utf8_.length());
file.WriteFile((BYTE*)content_utf8_.c_str(), (DWORD)content_utf8_.length());
file.CloseFile();
}
@ -89,10 +115,9 @@ namespace odf_writer
//-------------------------------------------------------------------------------
void manifect_file::add_rels(rels & r)
{
std::vector<relationship> & rels = r.relationships();
for (size_t i = 0; i < rels.size(); i++)
for (size_t i = 0; i < r.relationships_.size(); i++)
{
rels_.add(rels[i]);
rels_.add(r.relationships_[i]);
}
}
manifect_file::manifect_file(std::wstring t)
@ -103,7 +128,7 @@ namespace odf_writer
{
type_ = t;
}
void mimetype_file::write(const std::wstring & RootPath)
void mimetype_file::write(const std::wstring & RootPath, bool add_padding)
{
std::wstringstream resStream;
@ -111,9 +136,9 @@ namespace odf_writer
resStream << type_;
simple_element elm(L"mimetype", resStream.str(),false);
elm.write(RootPath);
elm.write(RootPath, false);
}
void manifect_file::write(const std::wstring & RootPath)
void manifect_file::write(const std::wstring & RootPath, bool add_padding)
{
std::wstringstream resStream;
@ -129,10 +154,10 @@ namespace odf_writer
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"META-INF";
NSDirectory::CreateDirectory(path);
simple_element elm(L"manifest.xml", resStream.str());
elm.write(path);
elm.write(path, false);
}
void meta_file::write(const std::wstring & RootPath)
void meta_file::write(const std::wstring & RootPath, bool add_padding)
{
std::wstringstream resStream;
CP_XML_WRITER(resStream)
@ -175,14 +200,14 @@ namespace odf_writer
}
simple_element elm(L"meta.xml", resStream.str());
elm.write(RootPath);
elm.write(RootPath, add_padding);
}
//-------------------------------------------------------------------------------
media::media(_mediaitems & mediaitems, const std::wstring internal_folder, int type) : mediaitems_(mediaitems), type_(type), folder_(internal_folder)
media_files::media_files(_mediaitems & mediaitems, const std::wstring internal_folder, int type) : mediaitems_(mediaitems), type_(type), folder_(internal_folder)
{
}
void media::write(const std::wstring & RootPath)
void media_files::write(const std::wstring & RootPath, bool add_padding)
{
OOX::CPath path (RootPath + (folder_.empty() ? L"" : FILE_SEPARATOR_STR) + folder_);
NSDirectory::CreateDirectory(path.GetPath());
@ -204,48 +229,48 @@ namespace odf_writer
//-------------------------------------------------------------------------------
void object_files::set_content(content_content_ptr & _content)
{
content_.set_content(_content);
meta_ = element_ptr(new meta_file());
content.set_content(_content);
meta = element_ptr(new meta_file());
}
void object_files::set_mediaitems(_mediaitems & mediaitems)
{
if (mediaitems.count_image > 0)
{
pictures_ = element_ptr( new media(mediaitems, L"Pictures", 1) );
pictures = element_ptr( new media_files(mediaitems, L"Pictures", 1) );
}
if (mediaitems.count_media > 0)
{
media_ = element_ptr( new media(mediaitems, L"Media", 2) );
media = element_ptr( new media_files(mediaitems, L"Media", 2) );
}
if (mediaitems.count_object > 0)
{
oleObjects_ = element_ptr( new media(mediaitems, L"", 3) );
oleObjects = element_ptr( new media_files(mediaitems, L"", 3) );
}
if (mediaitems.count_object > 0)
{
imageObjects_ = element_ptr( new media(mediaitems, L"ObjectReplacements", 4) );
imageObjects = element_ptr( new media_files(mediaitems, L"ObjectReplacements", 4) );
}
}
void object_files::set_styles(content_simple_ptr & _content)
{
styles_.set_content(_content);
styles.set_content(_content);
}
void object_files::set_settings(content_simple_ptr & _content)
{
settings_.set_content(_content);
settings.set_content(_content);
}
void object_files::write(const std::wstring & RootPath)
void object_files::write(const std::wstring & RootPath, bool add_padding)
{
content_.write(RootPath);
styles_.write(RootPath);
settings_.write(RootPath);
content.write(RootPath, add_padding);
styles.write(RootPath, add_padding);
settings.write(RootPath, add_padding);
if (meta_) meta_->write(RootPath);
if (meta) meta->write(RootPath, add_padding);
if (media_) media_->write(RootPath);
if (pictures_) pictures_->write(RootPath);
if (oleObjects_) oleObjects_->write(RootPath);
if (imageObjects_) imageObjects_->write(RootPath);
if (media) media->write(RootPath, add_padding);
if (pictures) pictures->write(RootPath, add_padding);
if (oleObjects) oleObjects->write(RootPath, add_padding);
if (imageObjects) imageObjects->write(RootPath, add_padding);
}
void odf_document::add_object(element_ptr _object, bool root)
@ -272,23 +297,30 @@ namespace odf_writer
manifest_ = element_ptr(new manifect_file(type));
mimetype_ = element_ptr(new mimetype_file(type));
}
void odf_document::write(const std::wstring & RootPath)
void odf_document::write_manifest(const std::wstring & RootPath)
{
if (base_)base_->write(RootPath);
if (mimetype_)
mimetype_->write(RootPath);
if (manifest_)
manifest_->write(RootPath);
}
void odf_document::write(const std::wstring & RootPath, bool add_padding)
{
if (base_)base_->write(RootPath, add_padding);
for (size_t i = 0; i < objects_.size(); i++)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + objects_[i]->local_path;
NSDirectory::CreateDirectory(path);
objects_[i]->write(path);
objects_[i]->write(path, add_padding);
}
if (manifest_) manifest_->write(RootPath);
if (mimetype_) mimetype_->write(RootPath);
if (settings_) settings_->write(RootPath);
if (manifest_) manifest_->write(RootPath, add_padding);
if (mimetype_) mimetype_->write(RootPath, add_padding);
if (settings_) settings_->write(RootPath, add_padding);
}
void content_file::write(const std::wstring & RootPath)
void content_file::write(const std::wstring & RootPath, bool add_padding)
{
std::wstringstream resStream;
CP_XML_WRITER(resStream)
@ -339,24 +371,24 @@ namespace odf_writer
CP_XML_ATTR(L"office:version", L"1.2");
CP_XML_NODE(L"office:font-face-decls");
if (content_)
if (content)
{
CP_XML_STREAM() << content_->styles_str();
CP_XML_STREAM() << content->styles_str();
}
CP_XML_NODE(L"office:body")
{
if (content_)
if (content)
{
CP_XML_STREAM() << content_->content_str();
CP_XML_STREAM() << content->content_str();
}
}
}
}
simple_element elm(L"content.xml", resStream.str());
elm.write(RootPath);
elm.write(RootPath, add_padding);
}
void styles_file::write(const std::wstring & RootPath)
void styles_file::write(const std::wstring & RootPath, bool add_padding)
{
std::wstringstream resStream;
CP_XML_WRITER(resStream)
@ -414,9 +446,9 @@ namespace odf_writer
}
simple_element elm(L"styles.xml", resStream.str());
elm.write(RootPath);
elm.write(RootPath, add_padding);
}
void settings_file::write(const std::wstring & RootPath)
void settings_file::write(const std::wstring & RootPath, bool add_padding)
{
std::wstringstream resStream;
CP_XML_WRITER(resStream)
@ -438,7 +470,7 @@ namespace odf_writer
}
simple_element elm(L"settings.xml", resStream.str());
elm.write(RootPath);
elm.write(RootPath, add_padding);
}
}
}

View File

@ -44,8 +44,6 @@ namespace cpdoccore
namespace odf_writer
{
class _mediaitems;//picture & media
class rels;
namespace package
{
@ -91,7 +89,7 @@ namespace odf_writer
public:
virtual ~element() = 0;
virtual void write(const std::wstring & RootPath) = 0;
virtual void write(const std::wstring & RootPath, bool add_padding = false) = 0;
std::wstring local_path;
private:
element * element_;
@ -107,35 +105,35 @@ namespace odf_writer
simple_element(const std::wstring & FileName, const std::wstring & Content, bool utf8 = true);
static element_ptr create(const std::wstring & FileName, const std::wstring & Content, bool utf8 = true);
virtual void write(const std::wstring & RootPath);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
private:
std::wstring file_name_;
std::string content_utf8_;
bool utf8_;
std::wstring file_name_;
std::string content_utf8_;
bool utf8_;
};
class meta_file : public element
{
public:
virtual void write(const std::wstring & RootPath);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
};
class content_file : public element
{
public:
void set_content(content_content_ptr & c){content_ = c;}
virtual void write(const std::wstring & RootPath);
void set_content(content_content_ptr & c){content = c;}
virtual void write(const std::wstring & RootPath, bool add_padding = false);
content_content_ptr content_;
content_content_ptr content;
};
class styles_file : public element
{
public:
void set_content(content_simple_ptr & c) {content_ = c;}
virtual void write(const std::wstring & RootPath);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
content_simple_ptr content_;
};
@ -143,7 +141,7 @@ namespace odf_writer
{
public:
void set_content(content_simple_ptr & c) {content_ = c;}
virtual void write(const std::wstring & RootPath);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
content_simple_ptr content_;
};
@ -152,9 +150,11 @@ namespace odf_writer
public:
manifect_file(std::wstring type);
virtual void write(const std::wstring & RootPath);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
void add_rels(rels & r);
rels *get_rels() {return &rels_;}
private:
rels rels_;
std::wstring type_;
@ -165,17 +165,17 @@ namespace odf_writer
public:
mimetype_file(std::wstring type);
virtual void write(const std::wstring & RootPath);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
private:
std::wstring type_;
};
class media : public element
class media_files : public element
{
public:
media(_mediaitems & mediaitems, const std::wstring internal_folder, int type);
virtual void write(const std::wstring & RootPath);
media_files(_mediaitems & mediaitems, const std::wstring internal_folder, int type);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
private:
_mediaitems& mediaitems_;
@ -195,19 +195,19 @@ namespace odf_writer
void set_mediaitems (_mediaitems & mediaitems);
virtual void write(const std::wstring & RootPath);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
private:
content_file content_;
settings_file settings_;
styles_file styles_;
content_file content;
settings_file settings;
styles_file styles;
element_ptr meta_;
element_ptr meta;
element_ptr media_;
element_ptr pictures_;
element_ptr oleObjects_;
element_ptr imageObjects_;
element_ptr media;
element_ptr pictures;
element_ptr oleObjects;
element_ptr imageObjects;
};
class odf_document : public element
{
@ -218,7 +218,11 @@ namespace odf_writer
void set_rels(rels & r);
virtual void write(const std::wstring & RootPath);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
void write_manifest(const std::wstring & RootPath);
manifect_file* get_manifest() {return dynamic_cast<manifect_file*>(manifest_.get());}
private:
element_ptr base_;

View File

@ -1055,7 +1055,10 @@ bool odf_drawing_context::isLineShape()
case 48: //SimpleTypes::shapetypeCurvedConnector3:
case 49: //SimpleTypes::shapetypeCurvedConnector4:
case 50: //SimpleTypes::shapetypeCurvedConnector5:
return true;
return true;
case 1000:
if (impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_.get_value_or(draw_fill(draw_fill::solid)).get_type() == draw_fill::none)
return true;
default:
return false;
}

View File

@ -250,13 +250,13 @@ int odf_lists_styles_context::start_style_level(int level, int type)
int odf_type =1;
int format_type = -1;
std::wstring num_format = L"1";
style_numformat num_format;
bool sync_letter = false;
switch(type)
{
case 0: //numberformatAiueo :
case 1: //numberformatAiueoFullWidth :
num_format = L"ア, イ, ウ, ...";
num_format = style_numformat(style_numformat::aiueo);
break;
case 2: //numberformatArabicAbjad :
break;
@ -272,19 +272,19 @@ int odf_lists_styles_context::start_style_level(int level, int type)
case 7: //numberformatChicago :
break;
case 8: //numberformatChineseCounting :
num_format = L"イ, ロ, ハ, ...";
num_format = style_numformat(style_numformat::chineseCounting);
break;
case 9: //numberformatChineseCountingThousand :
break;
case 10: //numberformatChineseLegalSimplified :
num_format = L"一, 二, 三, ...";
num_format = style_numformat(style_numformat::chineseLegal);
break;
case 11: //numberformatChosung :
break;
case 12: //numberformatCustom :
break;
case 13: //numberformatDecimal :
num_format = L"1";
num_format = style_numformat(style_numformat::arabic);
break;
case 14: //numberformatDecimalEnclosedCircle :
break;
@ -326,19 +326,19 @@ int odf_lists_styles_context::start_style_level(int level, int type)
case 32: //numberformatIdeographEnclosedCircle :
break;
case 33: //numberformatIdeographLegalTraditional :
num_format = L"壹, 貳, 參, ...";
num_format = style_numformat(style_numformat::ideographLegal);
break;
case 34: //numberformatIdeographTraditional :
num_format = L"甲, 乙, 丙, ...";
num_format = style_numformat(style_numformat::ideographTraditional);
break;
case 35: //numberformatIdeographZodiac :
num_format = L"子, 丑, 寅, ...";
num_format = style_numformat(style_numformat::ideographZodiac);
break;
case 36: //numberformatIdeographZodiacTraditional :
num_format = L"甲子, 乙丑, 丙寅, ...";
num_format = style_numformat(style_numformat::ideographZodiacTraditional);
break;
case 37: //numberformatIroha :
num_format = L"イ, ロ, ハ, ...";
num_format = style_numformat(style_numformat::iroha);
break;
case 38: //numberformatIrohaFullWidth :
break;
@ -350,21 +350,21 @@ int odf_lists_styles_context::start_style_level(int level, int type)
break;
case 42: //numberformatKoreanCounting :
case 43: //numberformatKoreanDigital :
num_format = L"일, 이, 삼, ...";
num_format = style_numformat(style_numformat::koreanDigital);
break;
case 44: //numberformatKoreanDigital2 :
break;
case 45: //numberformatKoreanLegal :
break;
case 46: //numberformatLowerLetter
num_format = L"a";
num_format = style_numformat(style_numformat::alphaLc);
sync_letter = true;
break;
case 47: //numberformatLowerRoman :
num_format = L"i";
num_format = style_numformat(style_numformat::romanLc);
break;
case 48: //numberformatNone :
num_format = L"";
//num_format = L"";
break;
case 49: //numberformatNumberInDash : //??
//suffix -
@ -375,11 +375,11 @@ int odf_lists_styles_context::start_style_level(int level, int type)
case 51: //numberformatOrdinalText :
break;
case 52: //numberformatRussianLower :
num_format = L"А, Б, .., Аа, Аб, ... (ru)";
num_format = style_numformat(style_numformat::russianLo);
sync_letter = true;
break;
case 53: //numberformatRussianUpper :
num_format = L"А, Б, .., Аа, Аб, ... (ru)";
num_format = style_numformat(style_numformat::russianUp);
sync_letter = true;
break;
case 54: //numberformatTaiwaneseCounting :
@ -395,11 +395,11 @@ int odf_lists_styles_context::start_style_level(int level, int type)
case 59: //numberformatThaiNumbers :
break;
case 60: //numberformatUpperLetter :
num_format = L"A";
num_format = style_numformat(style_numformat::alphaUc);
sync_letter = true;
break;
case 61: //numberformatUpperRoman :
num_format = L"I";
num_format = style_numformat(style_numformat::romanUc);
break;
case 62: //numberformatVietnameseCounting :
break;

View File

@ -537,7 +537,7 @@ void odf_page_layout_context::set_page_number_format(_CP_OPT(int) & type, _CP_OP
case 34: break; //numberformatIdeographTraditional = 34,
case 35: break; //numberformatIdeographZodiac = 35,
case 36: break; //numberformatIdeographZodiacTraditional = 36,
case 37: break; //numberformatIroha = 37,
case 37: layout_state_list_.back().page_number_format = style_numformat(style_numformat::iroha); break;
case 38: break; //numberformatIrohaFullWidth = 38,
case 39: break; //numberformatJapaneseCounting = 39,
case 40: break; //numberformatJapaneseDigitalTenThousand = 40,
@ -546,26 +546,27 @@ void odf_page_layout_context::set_page_number_format(_CP_OPT(int) & type, _CP_OP
case 43: break; //numberformatKoreanDigital = 43,
case 44: break; //numberformatKoreanDigital2 = 44,
case 45: break; //numberformatKoreanLegal = 45,
case 46: layout_state_list_.back().page_number_format = L"a"; break; //numberformatLowerLetter = 46,
case 47: layout_state_list_.back().page_number_format = L"i"; break; //numberformatLowerRoman = 47,
case 46: layout_state_list_.back().page_number_format = style_numformat(style_numformat::alphaLc); break; //numberformatLowerLetter = 46,
case 47: layout_state_list_.back().page_number_format = style_numformat(style_numformat::romanLc); break; //numberformatLowerRoman = 47,
case 48: break; //numberformatNone = 48,
case 49: break; //numberformatnumberInDash = 49,
case 50: break; //numberformatOrdinal = 50,
case 51: break; //numberformatOrdinalText = 51,
case 52: break; //numberformatRussianLower = 52,
case 53: break; //numberformatRussianUpper = 53,
case 52: layout_state_list_.back().page_number_format = style_numformat(style_numformat::russianUp); break;
case 53: layout_state_list_.back().page_number_format = style_numformat(style_numformat::russianLo); break;
case 54: break; //numberformatTaiwaneseCounting = 54,
case 55: break; //numberformatTaiwaneseCountingThousand = 55,
case 56: break; //numberformatTaiwaneseDigital = 56,
case 57: break; //numberformatThaiCounting = 57,
case 58: break; //numberformatThaiLetters = 58,
case 59: break; //numberformatThainumbers = 59,
case 60: layout_state_list_.back().page_number_format = L"A"; break; //numberformatUpperLetter = 60,
case 61: layout_state_list_.back().page_number_format = L"I"; break; //numberformatUpperRoman = 61,
case 60: layout_state_list_.back().page_number_format = style_numformat(style_numformat::alphaUc); break; //numberformatUpperLetter = 60,
case 61: layout_state_list_.back().page_number_format = style_numformat(style_numformat::romanUc); break; //numberformatUpperRoman = 61,
case 62: break; //numberformatVietnameseCounting = 62
default:
break;
}
}//todooo
}
}

View File

@ -37,6 +37,7 @@
#include "office_elements_create.h"
#include "length.h"
#include "stylenumformat.h"
namespace cpdoccore {
namespace odf_writer {
@ -106,7 +107,7 @@ public:
_CP_OPT(odf_types::length) header_size_;
_CP_OPT(odf_types::length) footer_size_;
_CP_OPT(std::wstring) page_number_format;
_CP_OPT(odf_types::style_numformat) page_number_format;
private:
std::wstring style_oox_name_;

View File

@ -45,23 +45,38 @@ void relationship::serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"manifest:file-entry")
{
CP_XML_ATTR(L"manifest:full-path", target());
CP_XML_ATTR(L"manifest:media-type", type());
}
CP_XML_ATTR(L"manifest:full-path", target_);
if (target_ == L"/")
{
CP_XML_ATTR(L"manifest:version", L"1.2");
}
CP_XML_ATTR(L"manifest:media-type", type_);
if (size_ >= 0)
{
CP_XML_ATTR(L"manifest:size", size_);
}
if (!encryption_.empty())
{
CP_XML_STREAM() << encryption_;
}
}
}
}
void rels::serialize(std::wostream & strm)
{
for (size_t i = 0; i < relationship_.size(); i++)
for (size_t i = 0; i < relationships_.size(); i++)
{
relationship_[i].serialize(strm);
relationships_[i].serialize(strm);
}
}
void rels::add(relationship const & r)
{
relationships().push_back(r);
relationships_.push_back(r);
}
}

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