Compare commits

...

109 Commits

Author SHA1 Message Date
03edd40850 Pptx binary - write notes & master notes 2017-06-13 15:38:13 +03:00
9ff87b3c6b Merge tag 'v4.3.6' into develop
v4.3.6 v4.3.6
2017-06-13 15:28:45 +03:00
645cbef1ef . 2017-06-09 17:46:00 +03:00
02238f7eea Fixed bug with drawing a char with negative size of the font. 2017-06-09 15:11:47 +03:00
907e00a3ac . 2017-06-09 12:19:35 +03:00
2470bfd335 Fixed bug with caching fonts for different pages. Fixed bug with drawing a text. 2017-06-09 11:25:56 +03:00
3ae52bd221 . 2017-06-08 18:15:43 +03:00
227d4f18d6 . 2017-06-08 17:24:17 +03:00
36bdbad685 for bug 27765
external OleLink/DdeLink
2017-06-08 17:08:08 +03:00
525b828540 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  TextParagraphPr swap marR/marL
  .
  .
  .
  Use `uname -m` for determine linux x64\x686
  Add travis example config
  .
2017-06-08 15:48:04 +03:00
f64ee80a1a add event 2017-06-08 15:47:56 +03:00
f6402813c4 TextParagraphPr swap marR/marL 2017-06-08 13:19:53 +03:00
224ac7d6e2 . 2017-06-07 18:53:35 +03:00
2e2bd8989d . 2017-06-07 18:39:24 +03:00
8f434efb95 . 2017-06-07 18:36:40 +03:00
244dafb02b Merge pull request #31 from ONLYOFFICE/ShockwaveNN-patch-1
Use `uname -m` for determine linux x64\x686
2017-06-07 18:35:57 +03:00
149a1bdbd5 Use uname -m for determine linux x64\x686
`uname -p` return `unknown` on several system (including debian, but not including ubuntu)
2017-06-07 18:34:18 +03:00
a79d9041bc Merge pull request #30 from ONLYOFFICE/fix/travis-status-green
Add travis example config
2017-06-07 17:26:08 +03:00
3954c42602 Add travis example config 2017-06-07 17:16:51 +03:00
29dc0aee32 . 2017-06-06 16:50:39 +03:00
d805972d6d Merge pull request #28 from ONLYOFFICE/hotfix/v4.3.5
Hotfix/v4.3.5
2017-06-05 17:19:24 +03:00
549d5a46a6 Merge branch 'develop' into hotfix/v4.3.5 2017-06-05 17:12:36 +03:00
9e867be756 Merge branch 'hotfix/v4.3.5' 2017-06-05 16:48:24 +03:00
771bf2d55c for bug 27765
EncodeXml
2017-06-05 15:03:29 +03:00
3c58cd96fc for bug 27765 2017-06-05 14:36:34 +03:00
e50864fa98 . 2017-06-05 10:39:58 +03:00
c8c0924c74 for oox2mscrypt 2017-06-02 18:43:38 +03:00
af732e4e85 . 2017-06-02 18:38:44 +03:00
47ffdae8cc PptxFormat - partly fix 35054 2017-06-02 14:35:41 +03:00
fd5870083b . 2017-06-02 11:16:59 +03:00
5ba62cb25d . 2017-06-01 16:54:16 +03:00
79e0588544 fix partly 35047 2017-06-01 16:16:39 +03:00
a3d08cfc35 XlsxFormat - fix object without replacement image 2017-06-01 14:39:41 +03:00
5caccb284a Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-06-01 12:27:46 +03:00
ce19969b52 PptxFormat - fix objects without replacement image 2017-06-01 12:24:27 +03:00
0f91dc392e test ParseAllCultureInfo 2017-06-01 11:52:36 +03:00
e9805cef30 PptxFormat - fix Ole object without image cash 2017-05-31 19:22:26 +03:00
e3e05eb2db test 2017-05-31 19:01:24 +03:00
c09f17cffb . 2017-05-31 17:56:45 +03:00
ce73dd5987 linux build error 2017-05-31 15:48:59 +03:00
77df8aacb9 . 2017-05-31 14:13:54 +03:00
ce45b2802f fix bug #34953 2017-05-31 13:46:49 +03:00
7886018d6f Oox file crypter 2017-05-31 12:35:27 +03:00
5b5cb4188e OfficeCryptReader - check data integrity 2017-05-30 19:49:54 +03:00
f797af5f17 . 2017-05-30 16:05:49 +03:00
055977535e fixed build error 2017-05-30 16:04:33 +03:00
6ab24f10f0 Added prefix for lib targets 2017-05-30 15:55:31 +03:00
12a03da231 Changed extension for ooxmlsignature 2017-05-30 15:29:43 +03:00
cb7088979a . 2017-05-30 15:26:56 +03:00
1fb1fc6c97 Added OOXMLSIGNATURE project 2017-05-30 13:15:14 +03:00
e633c3c5d1 fix bug 35012 2017-05-29 17:11:10 +03:00
0f04de34b1 OdfFormatWriter - dont write backgroud master notes, notes (errors in libre & open office) 2017-05-29 16:19:26 +03:00
3f8c2c293a XlsFormatReader - fix users file 2017-05-28 17:18:27 +03:00
2c97e743da . 2017-05-28 15:44:49 +03:00
2c83860c04 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
Conflicts:
	DesktopEditor/raster/Metafile/Emf/EmfFile.cpp
2017-05-27 15:27:51 +03:00
c64b624de2 . 2017-05-27 15:24:50 +03:00
5e3990937d OdfFormatReader - fix after testing 2017-05-27 15:17:46 +03:00
21744c1607 . 2017-05-26 17:50:23 +03:00
0892e2549f . 2017-05-26 17:48:13 +03:00
cff6f305d4 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-05-26 17:09:34 +03:00
5060071227 fix bug #35006 2017-05-26 17:07:38 +03:00
d64109eaa4 imagedata for document signature 2017-05-26 17:06:40 +03:00
ec064bbd50 signing documents 2017-05-26 16:53:02 +03:00
baf952a151 fix bug 35004 2017-05-26 16:22:25 +03:00
0dd36c5e6a . 2017-05-25 16:41:19 +03:00
474404a8f9 . 2017-05-24 16:41:05 +03:00
f2f6483b6f x2t linux build 2.4.461 2017-05-24 10:49:41 +03:00
c30161dbd0 . 2017-05-23 19:24:41 +03:00
ec4f4fe476 Fix for cross compiling 2017-05-23 15:04:53 +03:00
634509ae28 Fix for cross compilation 2017-05-23 14:50:07 +03:00
1244048c50 x2t - binary - read/write audio/video content for presentation 2017-05-23 14:30:50 +03:00
a62b69fb31 . 2017-05-22 18:12:18 +03:00
5eb36efb63 . 2017-05-22 10:46:00 +03:00
fb8c4231b0 PptFormat - actions 2017-05-21 16:52:09 +03:00
9774d1de46 PptFormatReader - add presentation video & audio 2017-05-20 15:32:00 +03:00
f5b141eeee . 2017-05-19 18:34:36 +03:00
1e47dc1111 . 2017-05-19 14:15:59 +03:00
d3f4a2127d OdfFormat, PptxFormat - presentation transitions 2017-05-19 13:09:05 +03:00
4d5f328c30 open/save vml signatureline 2017-05-19 12:58:31 +03:00
b18cd44cf6 . 2017-05-18 18:10:19 +03:00
6705045dd4 add param m_sTempDir 2017-05-18 12:04:15 +03:00
533bc2c250 OdfFormatReader - presentation - actions 2017-05-17 19:47:34 +03:00
85226c0821 OdfFormatWriter - presentation audio backgrounds 2017-05-17 17:53:48 +03:00
fecefb672d . 2017-05-17 15:55:32 +03:00
f91e030836 . 2017-05-17 12:05:06 +03:00
d0591483bc Merge branches 'develop' and 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-05-17 11:59:41 +03:00
729f9f246f . 2017-05-17 11:57:44 +03:00
17a6ba735b linux & mac fake realize 2017-05-17 11:49:30 +03:00
de22fb4737 OdfFormatWriter - presentation sound, video objects, actions for shapes 2017-05-17 11:32:01 +03:00
8197fb8900 do not read theme.xml if there is rels file but there is no xml file 2017-05-16 18:18:55 +03:00
751774419e . 2017-05-16 16:34:23 +03:00
8278609f10 . 2017-05-16 15:20:48 +03:00
445eedc7a3 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-05-16 14:46:03 +03:00
ed7661b93c ooxmlsignature library & test (full work version) 2017-05-16 14:22:22 +03:00
a17a04298a build linux 2017-05-16 12:39:01 +03:00
f7ba686f0c TestDocsWithChart 2017-05-15 20:21:11 +03:00
c41385e1ae open/save field ffdata 2017-05-15 20:20:26 +03:00
f582a9b690 . 2017-05-15 19:14:50 +03:00
b36c2dbaf9 verify ooxml file. first worked version 2017-05-15 18:14:19 +03:00
10b9e9e5e8 verify ooxml file. developing... 2017-05-15 16:44:50 +03:00
1beb5440f9 OdfFormatWriter - transitions 2017-05-15 14:03:20 +03:00
9a9ba4cc62 OdfFormatWriter - animations 2017-05-14 16:52:47 +03:00
5b4c6363bb OdfFormat - fix layouts 2017-05-13 16:05:23 +03:00
2026d064ef DocFormatReader - fix shape freeforms 2017-05-13 16:04:54 +03:00
42257ca447 verify ooxml file. developing... 2017-05-12 18:59:57 +03:00
6f2fdcd971 verify ooxml file. developing... 2017-05-12 18:25:18 +03:00
9b4b7a26fd verify ooxml file. developing... 2017-05-12 18:04:13 +03:00
4d688b3922 . 2017-05-12 13:46:13 +03:00
be8d427e26 . 2017-05-12 13:17:26 +03:00
320 changed files with 11821 additions and 5243 deletions

2
.gitignore vendored
View File

@ -20,6 +20,7 @@ Common/3dParty/v8/win_32
Common/3dParty/v8/linux_64
Common/3dParty/v8/linux_32
Common/3dParty/v8/mac_64
Common/3dParty/openssl/openssl
**/core_build
**/Release
**/Debug
@ -43,3 +44,4 @@ OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
*.pdb
*.tlb
*.idb
**/.hg

View File

@ -1 +1,14 @@
language: cpp
language: cpp
compiler: gcc
dist: trusty
addons:
apt:
packages:
- p7zip-full
script:
- exit 0
# Build fails anyway. See explanation in
# https://github.com/ONLYOFFICE/core/pull/29#issuecomment-306773327
- cd Common/3dParty && ./make.sh
- cd ../../
- make

View File

@ -811,10 +811,10 @@ namespace DocFileFormat
{
Symbol s = getSymbol( chpx );
m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
m_pXmlWriter->WriteNodeEnd(L"", true);
//m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
//m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
//m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
//m_pXmlWriter->WriteNodeEnd(L"", true);
}
else if ((TextMark::DrawnObject == code) && fSpec)
{
@ -1663,12 +1663,17 @@ namespace DocFileFormat
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( fontIndex ) );
ret.FontName = ffn->xszFtn;
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );//-123 - ShortToFormattedWideString
break;
}
}
if (ret.HexValue.length() > 4)
{
ret.HexValue = ret.HexValue.substr(ret.HexValue.length() - 4, 4);
}
return ret;
}

View File

@ -35,11 +35,23 @@
namespace DocFileFormat
{
struct _guides
{
unsigned char type;
unsigned char param_type1;
unsigned char param_type2;
unsigned char param_type3;
WORD param1;
WORD param2;
WORD param3;
};
class PathParser
{
public:
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize)
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides)
{
if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0))
{
@ -105,31 +117,40 @@ namespace DocFileFormat
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize);
unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize);
if (0xfff0 == cb)
{
cb = 4;
for (unsigned short i = 0; i < nElems; ++i)
for (unsigned short i = 0; i < nElems; ++i)
{
POINT point;
if (0xfff0 == cb)
{
POINT point;
cb = 4;
point.x = FormatUtils::BytesToInt16(pVertices + 6, (i * cb), pVerticesSize);
point.y = FormatUtils::BytesToInt16(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
m_arPoints.push_back(point);
}
}
else
{
for (unsigned short i = 0; i < nElems; ++i)
else
{
POINT point;
point.x = FormatUtils::BytesToInt32(pVertices + 6, (i * cb), pVerticesSize);
point.y = FormatUtils::BytesToInt32(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
m_arPoints.push_back(point);
}
LONG lMinF = (LONG)0x80000000;
if (lMinF <= point.x)
{
int index = (DWORD)point.x - 0x80000000;
if (index >= 0 && index < guides.size())
{
point.x = guides[index].param3;
}
}
if (lMinF <= point.y)
{
int index = (DWORD)point.y - 0x80000000;
if (index >= 0 && index < guides.size())
{
point.y = guides[index].param3;
}
}
m_arPoints.push_back(point);
}
}
}
@ -163,104 +184,100 @@ namespace DocFileFormat
std::vector<PathSegment>::const_iterator end = m_arSegments.end();
for (std::vector<PathSegment>::const_iterator iter = m_arSegments.begin(); iter != end; ++iter, cc++)
{
try
switch (iter->Type)
{
switch (iter->Type)
case PathSegment::msopathLineTo:
{
case PathSegment::msopathLineTo:
for (int i = 0; i < iter->Count; ++i)
{
for (int i = 0; i < iter->Count; ++i)
if (valuePointer + 1 > (int)m_arPoints.size())
{
if (valuePointer >= (int)m_arPoints.size())
{
break;
break;
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
++valuePointer;
//break;
}
else
{
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
++valuePointer;
}
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
++valuePointer;
//break;
}
}
break;
case PathSegment::msopathCurveTo:
{
for (int i = 0; i < iter->Count; ++i)
else
{
strVmlPath += L"c";
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
valuePointer += 3;
++valuePointer;
}
}
break;
}
break;
case PathSegment::msopathMoveTo:
case PathSegment::msopathCurveTo:
{
for (int i = 0; i < iter->Count; ++i)
{
strVmlPath += L"m";
if (valuePointer + 3 > (int)m_arPoints.size())
break;
strVmlPath += L"c";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
valuePointer += 3;
}
}
break;
case PathSegment::msopathMoveTo:
{
if (valuePointer < (int)m_arPoints.size())
{
strVmlPath += L"m";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
++valuePointer;
}
break;
case PathSegment::msopathClose:
{
strVmlPath += L"x";
}
break;
case PathSegment::msopathEnd:
{
strVmlPath += L"e";
}
break;
case PathSegment::msopathEscape:
{
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
strVmlPath += L"nf";
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
strVmlPath += L"ns";
}
case PathSegment::msopathClientEscape:
case PathSegment::msopathInvalid:
{
//ignore escape segments and invalid segments
}
break;
}
}
catch (...)
{
// Sometimes there are more Segments than available m_arPoints.
// Accordingly to the spec this should never happen :)
break;
case PathSegment::msopathClose:
{
strVmlPath += L"x";
}
break;
case PathSegment::msopathEnd:
{
strVmlPath += L"e";
}
break;
case PathSegment::msopathEscape:
{
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
strVmlPath += L"nf";
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
strVmlPath += L"ns";
}
case PathSegment::msopathClientEscape:
case PathSegment::msopathInvalid:
{
//ignore escape segments and invalid segments
}
break;
}
}

View File

@ -106,21 +106,20 @@ namespace DocFileFormat
return new ShapeContainer( _reader, bodySize, typeCode, version, instance );
}
std::list<OptionEntry> ExtractOptions() const
std::vector<OptionEntryPtr> ExtractOptions() const
{
std::list<OptionEntry> ret;
std::vector<OptionEntryPtr> ret;
//build the list of all option entries of this shape
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
{
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( *iter );
if ( opt != NULL )
if ( opt == NULL ) continue;
for ( size_t i = 0; i < opt->Options.size(); i++)
{
for ( std::vector<OptionEntry>::iterator oeIter = opt->Options.begin(); oeIter != opt->Options.end(); oeIter++ )
{
ret.push_back( *oeIter );
}
ret.push_back( opt->Options[i]);
}
}

View File

@ -568,18 +568,19 @@ namespace DocFileFormat
struct OptionEntry
{
OptionEntry() : pid(PropertyId_left), fBid(false), fComplex(false), op(0), opComplex(NULL)
OptionEntry() : pid(PropertyId_left), fBid(false), fComplex(false), op(0)
{
}
PropertyId pid;
bool fBid;
bool fComplex;
unsigned int op;
unsigned char* opComplex;
std::shared_ptr<unsigned char> opComplex;
};
typedef std::shared_ptr<OptionEntry> OptionEntryPtr;
class ShapeOptions: public Record
{
public:
@ -587,8 +588,8 @@ namespace DocFileFormat
static const unsigned short TYPE_CODE_0xF121 = 0xF121;
static const unsigned short TYPE_CODE_0xF122 = 0xF122;
std::vector<OptionEntry> Options;
std::map<PropertyId, OptionEntry> OptionsByID;
std::vector<OptionEntryPtr> Options;
std::map<PropertyId, OptionEntryPtr> OptionsByID;
ShapeOptions() : Record()
{
@ -596,8 +597,8 @@ namespace DocFileFormat
virtual ~ShapeOptions()
{
for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
RELEASEARRAYOBJECTS( iter->opComplex );
//for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
// RELEASEARRAYOBJECTS( iter->opComplex );
}
ShapeOptions (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance)
@ -606,16 +607,16 @@ namespace DocFileFormat
//instance is the count of properties stored in this record
OptionEntry entry;
//parse the flags and the simple values
for (unsigned int i = 0; i < instance; ++i)
{
OptionEntryPtr entry = std::shared_ptr<OptionEntry>(new OptionEntry());
unsigned short flag = Reader->ReadUInt16();
entry.pid = (PropertyId)FormatUtils::BitmaskToInt (flag, 0x3FFF);
entry.fBid = FormatUtils::BitmaskToBool (flag, 0x4000);
entry.fComplex = FormatUtils::BitmaskToBool (flag, 0x8000);
entry.op = Reader->ReadUInt32();
entry->pid = (PropertyId)FormatUtils::BitmaskToInt (flag, 0x3FFF);
entry->fBid = FormatUtils::BitmaskToBool (flag, 0x4000);
entry->fComplex = FormatUtils::BitmaskToBool (flag, 0x8000);
entry->op = Reader->ReadUInt32();
Options.push_back( entry );
}
@ -625,21 +626,12 @@ namespace DocFileFormat
//of the OptionEntry arry, sorted by pid
for (unsigned int i = 0; i < instance; ++i)
{
if (Options[i].fComplex)
{
int read_size = (int)Options[i].op + 6 ; //????
//todooo !!!! проверить все остальные !! тут размер в зависимости от типа Complex!!!
switch(Options[i].pid)
{
case PropertyId::gtextUNICODE:
case PropertyId::gtextFont:
read_size = (int)Options[i].op;
break;
}
Options[i].opComplex = Reader->ReadBytes( read_size, true );
if (Options[i]->fComplex && Options[i]->op > 0)
{
Options[i]->opComplex = std::shared_ptr<unsigned char>(Reader->ReadBytes( Options[i]->op, true ));
}
OptionsByID.insert(std::pair<PropertyId, OptionEntry>(Options[i].pid, Options[i]));
OptionsByID.insert(std::make_pair(Options[i]->pid, Options[i]));
}
Reader->Seek(( pos + size ), 0/*STREAM_SEEK_SET*/);

View File

@ -241,7 +241,7 @@ namespace DocFileFormat
std::wstring strHeight = FormatUtils::DoubleToWideString( height.ToPoints() );
std::wstring strStyle;
std::list<OptionEntry> options;
std::vector<OptionEntryPtr> options;
PictureFrameType type;
if ((pict->shapeContainer || pict->blipStoreEntry) && pict->shapeContainer->Children.size() > 0)
@ -282,9 +282,9 @@ namespace DocFileFormat
}
//todooo oбъединить с shape_mapping
std::list<OptionEntry>::iterator end = options.end();
for (std::list<OptionEntry>::iterator iter = options.begin(); iter != end; ++iter)
for (size_t i = 0; i < options.size(); i++)
{
OptionEntryPtr & iter = options[i];
switch ( iter->pid )
{
case wzEquationXML:
@ -292,7 +292,7 @@ namespace DocFileFormat
m_isEquation = true;
m_isEmbedded = true;
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
if (ParseEmbeddedEquation( m_embeddedData, m_equationXml))
{
@ -303,7 +303,7 @@ namespace DocFileFormat
{
//встроенная неведомая хуйня
m_isEmbedded = true;
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
//{

View File

@ -143,8 +143,9 @@ namespace DocFileFormat
ShapeContainer* groupShape = static_cast<ShapeContainer*>(container->Children[0]);
GroupShapeRecord* gsr = static_cast<GroupShapeRecord*>(groupShape->Children[0]);
Shape* shape = static_cast<Shape*>(groupShape->Children[1]);
std::list<OptionEntry> options = groupShape->ExtractOptions();
ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>();
ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>();
std::vector<OptionEntryPtr> options = groupShape->ExtractOptions();
m_shapeId = GetShapeID(shape);
@ -155,14 +156,13 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + L"," + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)));
// Write wrap coords
std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
for (size_t i = 0; i < options.size(); i++)
{
switch (iter->pid)
switch (options[i]->pid)
{
case pWrapPolygonVertices:
case pWrapPolygonVertices:
{
std::wstring wrapCoords = getWrapCoords(*iter);
std::wstring wrapCoords = GetWrapCoords(options[i]);
if (wrapCoords.length())
m_pXmlWriter->WriteAttribute(L"wrapcoords", wrapCoords);
}
@ -226,9 +226,9 @@ namespace DocFileFormat
bool freeform = true;
std::wstring sShapeId;
std::list<OptionEntry> options = pContainer->ExtractOptions();
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
std::vector<OptionEntryPtr> options = pContainer->ExtractOptions();
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
WriteBeginShapeNode (pShape);
@ -294,13 +294,17 @@ namespace DocFileFormat
std::wstring sTextboxStyle;
std::wstring adjValues[8];
ShadowStyleBooleanProperties shadowBoolean(0);
std::vector<std::wstring> arrInscribe;
OptionEntryPtr opSegmentInfo;
OptionEntryPtr opVerticles;
OptionEntryPtr opInscribe;
OptionEntryPtr opConnectAngles;
OptionEntryPtr opConnectLocs;
std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
for (size_t i = 0; i < options.size(); i++)
{
OptionEntryPtr & iter = options[i];
switch (iter->pid)
{
//BOOLEANS
@ -335,19 +339,16 @@ namespace DocFileFormat
}
}
break;
case protectionBooleans:
{
ProtectionBooleanProperties booleans(iter->op);
}
break;
case diagramBooleans:
{
DiagramBooleanProperties booleans(iter->op);
}
break;
case groupShapeBooleans:
{
GroupShapeBooleanProperties booleans(iter->op);
@ -357,56 +358,80 @@ namespace DocFileFormat
}
}
break;
// GEOMETRY
// GEOMETRY
case shapePath :
{
bHavePath = true;
}break;
case pVertices:
{
opVerticles = iter;
}break;
case pSegmentInfo:
{
opSegmentInfo = iter;
}break;
case pGuides:
{
GetGuides(iter);
}break;
case pConnectionSites:
{
opConnectLocs = iter;
}break;
case pConnectionSitesDir:
{
opConnectAngles = iter;
}break;
case pInscribe:
{
opInscribe = iter;
}break;
case adjustValue:
{
adjValues[0] = FormatUtils::IntToWideString( (int)iter->op );
nAdjValues = (std::max)(nAdjValues,1);
m_nAdjValues[0] = (int)iter->op;
nAdjValues = (std::max)(nAdjValues,1);
}
break;
case adjust2Value:
{
adjValues[1] = FormatUtils::IntToWideString( (int)iter->op );
nAdjValues = (std::max)(nAdjValues,2);
m_nAdjValues[1] = (int)iter->op;
nAdjValues = (std::max)(nAdjValues, 2);
}
break;
case adjust3Value:
{
adjValues[2] = FormatUtils::IntToWideString( (int)iter->op );
nAdjValues = (std::max)(nAdjValues,3);
m_nAdjValues[2] = (int)iter->op;
nAdjValues =(std::max)(nAdjValues, 3);
}break;
case adjust4Value:
{
adjValues[3] = FormatUtils::IntToWideString( (int)iter->op );
nAdjValues = (std::max)(nAdjValues,4);
m_nAdjValues[3] = (int)iter->op;
nAdjValues = (std::max)(nAdjValues, 4);
}break;
case adjust5Value:
{
adjValues[4] = FormatUtils::IntToWideString( (int)iter->op );
nAdjValues = (std::max)(nAdjValues,5);
m_nAdjValues[4] = (int)iter->op;
nAdjValues = (std::max)(nAdjValues, 5);
}break;
case adjust6Value:
{
adjValues[5] = FormatUtils::IntToWideString( (int)iter->op );
nAdjValues = (std::max)(nAdjValues,6);
m_nAdjValues[5] = (int)iter->op;
nAdjValues = (std::max)(nAdjValues, 6);
}break;
case adjust7Value:
{
adjValues[6] = FormatUtils::IntToWideString( (int)iter->op );
nAdjValues = (std::max)(nAdjValues,7);
m_nAdjValues[6] = (int)iter->op;
nAdjValues = (std::max)(nAdjValues, 7);
}break;
case adjust8Value:
{
adjValues[7] = FormatUtils::IntToWideString( (int)iter->op );
nAdjValues = (std::max)(nAdjValues,8);
m_nAdjValues[7] = (int)iter->op;
nAdjValues = (std::max)(nAdjValues, 8);
}break;
case pWrapPolygonVertices:
{
std::wstring wrapCoords = getWrapCoords(*iter);
std::wstring wrapCoords = GetWrapCoords(iter);
if (!wrapCoords.empty())
{
@ -421,13 +446,6 @@ namespace DocFileFormat
{
yCoord = iter->op;
}break;
case pGuides:
{
}break;
case pInscribe:
{
arrInscribe = GetTextRectangles(*iter);
}break;
// OUTLINE
case lineColor:
{
@ -497,7 +515,7 @@ namespace DocFileFormat
}break;
case fillShadeColors:
{
appendValueAttribute(&m_fill, L"colors", getFillColorString( iter->opComplex, iter->op ));
appendValueAttribute(&m_fill, L"colors", getFillColorString( iter->opComplex.get(), iter->op ));
}break;
case fillFocus:
{
@ -602,7 +620,7 @@ namespace DocFileFormat
case pibName:
{
std::wstring name;
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex, iter->op, ENCODING_UTF16);
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex.get(), iter->op, ENCODING_UTF16);
if (!name.empty())
appendValueAttribute(&m_imagedata, L"o:title", FormatUtils::XmlEncode(name));
}break;
@ -676,10 +694,10 @@ namespace DocFileFormat
hasTextbox = true;
nLTxID = (((iter->op) >> 16) & 0xFFFF);
}break;
case dxTextLeft: {ndxTextLeft = (int)iter->op;break;}
case dyTextTop: {ndyTextTop = (int)iter->op;break;}
case dxTextRight: {ndxTextRight = (int)iter->op;break;}
case dyTextBottom: {ndyTextBottom = (int)iter->op;break;}
case dxTextLeft: {ndxTextLeft = (int)iter->op; break;}
case dyTextTop: {ndyTextTop = (int)iter->op; break;}
case dxTextRight: {ndxTextRight = (int)iter->op; break;}
case dyTextBottom: {ndyTextBottom = (int)iter->op; break;}
case txflTextFlow:
{
switch(iter->op)
@ -700,7 +718,7 @@ namespace DocFileFormat
// Word Art
case gtextUNICODE:
{
std::wstring text = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex, (iter->op)/2);
std::wstring text = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex.get(), (iter->op)/2);
text = FormatUtils::XmlEncode(text);
@ -713,7 +731,7 @@ namespace DocFileFormat
}break;
case gtextFont:
{
std::wstring font = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex, (iter->op)/2);
std::wstring font = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex.get(), (iter->op)/2);
int i = font.size();
while (i > 0)
{
@ -764,31 +782,31 @@ namespace DocFileFormat
appendStyleProperty(&m_textPathStyle, L"font-weight", L"bold");
}
}break;
// PATH
case shapePath :
{
bHavePath = true;
std::wstring path = ParsePath(options);
if (false == path.empty())
m_pXmlWriter->WriteAttribute (L"path", path);
}break;
default:
default:
{
int val = iter->op;
}break;
}
}
if (false == bHavePath) // фигура может быть задана только наборами вершин и индексов
if (opVerticles && opSegmentInfo)
{
std::wstring path = ParsePath(options);
const unsigned char* pVP = opVerticles->opComplex.get();
unsigned int nVP = opVerticles->op;
const unsigned char* pSI = opSegmentInfo->opComplex.get();
unsigned int nSI = opSegmentInfo->op;
PathParser oParser (pSI, nSI, pVP, nVP, m_arrGuides);
std::wstring path = oParser.GetVmlPath();
if (false == path.empty())
m_pXmlWriter->WriteAttribute (L"path", path);
}
if (freeform && (xCoord == 0 || yCoord == 0 ))
{
xCoord = 21600;
yCoord = 21600;
}
if ( !filled )
{
m_pXmlWriter->WriteAttribute( L"filled", L"f" );
@ -804,10 +822,10 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute(L"o:allowincell", L"f");
}
if ( ( xCoord > 0 ) && ( yCoord > 0 ) )
if ( xCoord > 0 && yCoord > 0 )
{
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString( xCoord ) + L"," + FormatUtils::IntToWideString( yCoord ) ));
}
}
int nCode = 0;
if (pShape->GetShapeType())
@ -819,17 +837,17 @@ namespace DocFileFormat
{
if (nAdjValues)
{
m_pXmlWriter->WriteAttribute(L"arcsize", adjValues[0]);
m_pXmlWriter->WriteAttribute(L"arcsize", m_nAdjValues[0]);
}
}
else
{
if (nAdjValues)
if (nAdjValues > 0)
{
std::wstring adjTag = adjValues[0];
std::wstring adjTag = std::to_wstring(m_nAdjValues[0]);
for (int i = 1; i < nAdjValues; ++i)
adjTag += std::wstring(L",") + adjValues[i];
adjTag += L"," + std::to_wstring(m_nAdjValues[i]);
m_pXmlWriter->WriteAttribute(L"adj", adjTag);
}
@ -982,10 +1000,24 @@ namespace DocFileFormat
}
if (freeform)
{
if (arrInscribe.size())
if (opInscribe || opConnectAngles || opConnectLocs)
{
std::vector<std::wstring> arrInscribe = GetTextRectangles(opInscribe);
std::wstring strConnectAngles = GetConnectAngles(opConnectAngles);
std::wstring strConnectLocs = GetConnectLocs(opConnectLocs);
m_pXmlWriter->WriteNodeBegin(L"v:path", true);
m_pXmlWriter->WriteAttribute(L"textboxrect", arrInscribe[0]);
if (!arrInscribe.empty())
m_pXmlWriter->WriteAttribute(L"textboxrect", arrInscribe[0]);
if (!strConnectAngles.empty() || !strConnectLocs.empty())
{
m_pXmlWriter->WriteAttribute(L"o:connecttype", L"custom");
if (!strConnectLocs.empty())
m_pXmlWriter->WriteAttribute(L"o:connectlocs", strConnectLocs);
if (!strConnectAngles.empty())
m_pXmlWriter->WriteAttribute(L"o:connectangles", strConnectAngles);
}
m_pXmlWriter->WriteNodeEnd(L"", true);
}
}
@ -1182,11 +1214,13 @@ namespace DocFileFormat
}
/// Build the VML wrapcoords string for a given pWrapPolygonVertices
std::wstring VMLShapeMapping::getWrapCoords(const OptionEntry& pWrapPolygonVertices) const
std::wstring VMLShapeMapping::GetWrapCoords(const OptionEntryPtr& pWrapPolygonVertices) const
{
if (!pWrapPolygonVertices) return L"";
std::wstring coords;
MemoryStream oStream(pWrapPolygonVertices.opComplex, pWrapPolygonVertices.op);
MemoryStream oStream(pWrapPolygonVertices->opComplex.get(), pWrapPolygonVertices->op);
std::list<int> arrVertices;
unsigned short nElems = oStream.ReadUInt16();
@ -1498,7 +1532,7 @@ namespace DocFileFormat
}
}
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::list<OptionEntry>& options, int zIndex) const
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::vector<OptionEntryPtr>& options, int zIndex) const
{
bool bRelH = false;
bool bRelV = false;
@ -1508,9 +1542,9 @@ namespace DocFileFormat
bool bZIndex = false;
std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
for (size_t i = 0; i < options.size(); i++)
{
const OptionEntryPtr & iter = options[i];
switch (iter->pid)
{
// POSITIONING
@ -1616,15 +1650,16 @@ namespace DocFileFormat
}
//
std::wstring VMLShapeMapping::buildStyle (const Shape* shape, const ChildAnchor* anchor, const std::list<OptionEntry>& options, int zIndex) const
std::wstring VMLShapeMapping::buildStyle (const Shape* shape, const ChildAnchor* anchor, const std::vector<OptionEntryPtr>& options, int zIndex) const
{
std::wstring style;
// Check if some properties are set that cause the dimensions to be twisted
bool twistDimensions = false;
std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
for (size_t i = 0; i < options.size(); i++)
{
const OptionEntryPtr & iter = options[i];
if (geometryTextBooleanProperties == iter->pid)
{
GeometryTextBooleanProperties props(iter->op);
@ -1860,61 +1895,210 @@ namespace DocFileFormat
return wrapType;
}
std::wstring VMLShapeMapping::ParsePath (const std::list<OptionEntry>& options) const
std::wstring VMLShapeMapping::GetConnectAngles(const OptionEntryPtr& opAngles) const
{
const unsigned char* pVP = NULL;
unsigned int nVP = 0;
const unsigned char* pSI = NULL;
unsigned int nSI = 0;
if (!opAngles) return L"";
if (!opAngles->opComplex) return L"";
std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
MemoryStream reader(opAngles->opComplex.get(), opAngles->op);
unsigned short nElems = reader.ReadUInt16();
unsigned short nElemsAlloc = reader.ReadUInt16();
unsigned short nElemSize = reader.ReadUInt16();
bool bTruncated = false;
if (0xFFF0 == nElemSize)
{
nElemSize = 4;
bTruncated = true;
}
long dwSize = nElems * nElemSize;
if (opAngles->op - 6 != (dwSize))
{
bool b = false;
}
if (nElemSize < 1) return L"";
int count = dwSize / nElemSize;
std::wstring angles;
for (int i = 0; i < count; ++i)
{
if (iter->pid == pVertices)
{
pVP = iter->opComplex;
nVP = iter->op;
}
if (iter->pid == pSegmentInfo)
{
pSI = iter->opComplex;
nSI = iter->op;
}
DWORD v = reader.ReadUInt32();
double val = (double)((WORD)(v >> 16) + ((WORD)(v) / 65536.0));
angles += std::to_wstring((int)val) + (i < (count - 1) ? L"," : L"");
}
return angles;
}
int VMLShapeMapping::UpdateFromGuides(const int val) const
{
int new_val = val;
LONG lMinF = (LONG)0x80000000;
if (lMinF <= val)
{
int index = (DWORD)val - 0x80000000;
if (index >= 0 && index < m_arrGuides.size())
{
new_val = m_arrGuides[index].param3;
}
PathParser oParser (pSI, nSI, pVP, nVP);
return oParser.GetVmlPath();
}
return new_val;
}
void VMLShapeMapping::GetGuides( const OptionEntryPtr& opGuides )
{
if (!opGuides) return;
if (!opGuides->opComplex) return;
MemoryStream reader(opGuides->opComplex.get(), opGuides->op);
unsigned short nElems = reader.ReadUInt16();
unsigned short nElemsAlloc = reader.ReadUInt16();
unsigned short nElemSize = reader.ReadUInt16();
bool bTruncated = false;
if (0xFFF0 == nElemSize)
{
nElemSize = 4;
bTruncated = true;
}
long dwSize = nElems * nElemSize;
if (opGuides->op - 6 != (dwSize))
{
bool b = false;
}
int count = dwSize / nElemSize; //1x (int or short)
for (int i = 0; i < count; ++i)
{
_guides g;
WORD flags = reader.ReadUInt16();
g.type = flags & 0x1FFF;
g.param_type1 = (unsigned char)(flags & 0x04);
g.param_type2 = (unsigned char)(flags & 0x02);
g.param_type3 = (unsigned char)(flags & 0x01);
g.param1 = reader.ReadUInt16();
g.param2 = reader.ReadUInt16();
g.param3 = reader.ReadUInt16();
m_arrGuides.push_back(g);
}
}
//
std::vector<std::wstring> VMLShapeMapping::GetTextRectangles(const OptionEntry& inscribe) const
std::wstring VMLShapeMapping::GetConnectLocs( const OptionEntryPtr& opLocs ) const
{
MemoryStream reader(inscribe.opComplex, inscribe.op + 6);
if (!opLocs) return L"";
if (!opLocs->opComplex) return L"";
unsigned short elems = reader.ReadUInt16();
unsigned short allocElems = reader.ReadUInt16();
unsigned short cb = reader.ReadUInt16();
MemoryStream reader(opLocs->opComplex.get(), opLocs->op);
unsigned short nElems = reader.ReadUInt16();
unsigned short nElemsAlloc = reader.ReadUInt16();
unsigned short nElemSize = reader.ReadUInt16();
bool bTruncated = false;
if (0xFFF0 == nElemSize)
{
nElemSize = 4;
bTruncated = true;
}
long dwSize = nElems * nElemSize;
if (opLocs->op - 6 != (dwSize))
{
bool b = false;
}
int count = dwSize / nElemSize; //2x (int or short)
std::wstring locs;
for (int i = 0; i < count; ++i)
{
POINT pt;
if (bTruncated)
{
pt.x = reader.ReadInt16();
pt.y = reader.ReadInt16();
}
else
{
pt.x = reader.ReadInt32();
pt.y = reader.ReadInt32();
}
pt.x = UpdateFromGuides(pt.x);
pt.y = UpdateFromGuides(pt.y);
locs += std::to_wstring(pt.x) + L"," + std::to_wstring(pt.y) + (i < (count - 1) ? L";" : L"");
}
return locs;
}
std::vector<std::wstring> VMLShapeMapping::GetTextRectangles( const OptionEntryPtr& opInscribe ) const
{
std::vector<std::wstring> rectangles;
if (!opInscribe) return rectangles;
if (!opInscribe->opComplex) return rectangles;
if (16 != cb) return rectangles; // TODO: доделать
MemoryStream reader(opInscribe->opComplex.get(), opInscribe->op);
int count = (inscribe.op) / 16;
unsigned short nElems = reader.ReadUInt16();
unsigned short nElemsAlloc = reader.ReadUInt16();
unsigned short nElemSize = reader.ReadUInt16();
bool bTruncated = false;
if (0xFFF0 == nElemSize)
{
nElemSize = 4;
bTruncated = true;
}
long dwSize = nElems * nElemSize;
if (opInscribe->op - 6 != (dwSize))
{
bool b = false;
}
int count = dwSize / nElemSize; //4x (int or short)
for (int i = 0; i < count; ++i)
{
RECT rc;
rc.top = reader.ReadInt32();
rc.left = reader.ReadInt32();
rc.right = reader.ReadInt32();
rc.bottom = reader.ReadInt32();
if (bTruncated)
{
rc.top = reader.ReadInt16();
rc.left = reader.ReadInt16();
rc.right = reader.ReadInt16();
rc.bottom = reader.ReadInt16();
}
else
{
rc.top = reader.ReadInt32();
rc.left = reader.ReadInt32();
rc.right = reader.ReadInt32();
rc.bottom = reader.ReadInt32();
}
rc.top = UpdateFromGuides(rc.top);
rc.left = UpdateFromGuides(rc.left);
rc.right = UpdateFromGuides(rc.right);
rc.bottom = UpdateFromGuides(rc.bottom);
std::wstringstream sstream;
sstream << boost::wformat(L"%d,%d,%d,%d") % rc.top % rc.left % rc.right % rc.bottom;
rectangles.push_back(sstream.str());
rectangles.push_back( std::to_wstring(rc.top) + L"," + std::to_wstring(rc.left) + L"," +
std::to_wstring(rc.right) + L"," + std::to_wstring(rc.bottom));
}
return rectangles;

View File

@ -77,17 +77,10 @@ namespace DocFileFormat
void WritePrimitiveProps(DrawingPrimitive * primitive, bool root);
// Converts a group of shapes
void WriteGroup(const GroupContainer* pContainer);
// Converts a single shape
void WriteShape (const ShapeContainer* pContainer);
/// Generates a string id for the given shape
std::wstring GenShapeId(const Shape* pShape) const;
/// Build the VML wrapcoords string for a given pWrapPolygonVertices
std::wstring getWrapCoords( const OptionEntry& pWrapPolygonVertices ) const;
/// Copies the picture from the binary stream to the zip archive
/// and creates the relationships for the image.
bool copyPicture( const BlipStoreEntry* bse );
std::wstring GetTargetExt( Global::BlipType _type ) const;
@ -98,21 +91,22 @@ namespace DocFileFormat
std::wstring getTextboxAnchor( unsigned int anchor ) const;
void AppendOptionsToStyle( std::wstring* style, const std::list<OptionEntry>& options, int zIndex ) const;
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<OptionEntryPtr>& options, int zIndex ) const;
void AppendOptionsToStyle ( std::wstring* style, const std::vector<OptionEntryPtr>& options, int zIndex ) const;
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::list<OptionEntry>& options, int zIndex ) const;
int UpdateFromGuides(const int val) const;
std::wstring getLineStyle ( unsigned int p ) const;
std::wstring getArrowStyle ( unsigned int op ) const;
std::wstring getArrowLength ( unsigned int op ) const;
std::wstring getArrowWidth ( unsigned int op ) const;
std::wstring getFillMethod ( unsigned int p ) const;
std::wstring getFillColorString( const unsigned char* p, unsigned int size ) const;
/// Returns the OpenXML fill type of a fill effect
std::wstring getFillType ( unsigned int p ) const;
std::wstring getShadowType ( unsigned int p ) const;
/// Returns the OpenXML wrap type of the shape
std::wstring getWrapType (const Spa* pSpa) const;
std::wstring ParsePath (const std::list<OptionEntry>& options) const;
void WriteBeginShapeNode (const Shape* pShape);
void WriteEndShapeNode (const Shape* pShape);
@ -121,9 +115,15 @@ namespace DocFileFormat
std::wstring GetLineFrom (const ChildAnchor* pAnchor) const;
std::wstring GetLineTo (const ChildAnchor* pAnchor) const;
std::vector<std::wstring> GetTextRectangles(const OptionEntry& inscribe) const;
std::wstring GetWrapCoords ( const OptionEntryPtr& pOpt ) const;
std::vector<std::wstring> GetTextRectangles ( const OptionEntryPtr& pOpt ) const;
std::wstring GetConnectAngles ( const OptionEntryPtr& pOpt ) const;
std::wstring GetConnectLocs ( const OptionEntryPtr& pOpt ) const;
void GetGuides ( const OptionEntryPtr& pOpt );
private:
int m_nAdjValues[8];
std::vector<_guides> m_arrGuides;
bool m_isInlineShape;
Spa* m_pSpa;
IMapping* m_pCaller;

View File

@ -3801,19 +3801,228 @@ public:
{
int res = c_oSerConstants::ReadOk;
CFldSimple* pFldSimple = static_cast<CFldSimple*>(poResult);
if ( c_oSer_HyperlinkType::Link == type )
if ( c_oSer_FldSimpleType::Instr == type )
pFldSimple->sInstr = m_oBufferedStream.GetString3(length);
else if ( c_oSer_HyperlinkType::Content == type )
else if ( c_oSer_FldSimpleType::Content == type )
{
XmlUtils::CStringWriter* pPrevWriter = m_pCurWriter;
m_pCurWriter = &pFldSimple->writer;
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, NULL);
m_pCurWriter = pPrevWriter;
}
else if ( c_oSer_FldSimpleType::FFData == type )
{
OOX::Logic::CFFData oFFData;
res = Read1(length, &Binary_DocumentTableReader::ReadFFData, this, &oFFData);
pFldSimple->writer.WriteString(oFFData.toXML());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadFFData(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Logic::CFFData* pFFData = static_cast<OOX::Logic::CFFData*>(poResult);
if ( c_oSerFFData::CalcOnExit == type )
{
pFFData->m_oCalcOnExit.Init();
pFFData->m_oCalcOnExit->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else if ( c_oSerFFData::CheckBox == type )
{
pFFData->m_oCheckBox.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadFFCheckBox, this, pFFData->m_oCheckBox.GetPointer());
}
else if ( c_oSerFFData::DDList == type )
{
pFFData->m_oDDList.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadDDList, this, pFFData->m_oDDList.GetPointer());
}
else if ( c_oSerFFData::Enabled == type )
{
pFFData->m_oEnabled.Init();
pFFData->m_oEnabled->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else if ( c_oSerFFData::EntryMacro == type )
{
std::wstring sVal = m_oBufferedStream.GetString3(length);
pFFData->m_oEntryMacro.Init();
pFFData->m_oEntryMacro->m_oVal.Init();
pFFData->m_oEntryMacro->m_oVal->SetValue(sVal);
}
else if ( c_oSerFFData::ExitMacro == type )
{
std::wstring sVal = m_oBufferedStream.GetString3(length);
pFFData->m_oExitMacro.Init();
pFFData->m_oExitMacro->m_oVal.Init();
pFFData->m_oExitMacro->m_oVal->SetValue(sVal);
}
else if ( c_oSerFFData::HelpText == type )
{
pFFData->m_oHelpText.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadFFHelpText, this, pFFData->m_oHelpText.GetPointer());
}
else if ( c_oSerFFData::Label == type )
{
pFFData->m_oLabel.Init();
pFFData->m_oLabel->m_oVal.Init();
pFFData->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerFFData::Name == type )
{
std::wstring sVal = m_oBufferedStream.GetString3(length);
pFFData->m_oName.Init();
pFFData->m_oName->m_oVal.Init();
pFFData->m_oName->m_oVal->SetValue(sVal);
}
else if ( c_oSerFFData::StatusText == type )
{
pFFData->m_oStatusText.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadFFStatusText, this, pFFData->m_oStatusText.GetPointer());
}
else if ( c_oSerFFData::TabIndex == type )
{
pFFData->m_oTabIndex.Init();
pFFData->m_oTabIndex->m_oVal.Init();
pFFData->m_oTabIndex->m_oVal->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerFFData::TextInput == type )
{
pFFData->m_oTextInput.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadTextInput, this, pFFData->m_oTextInput.GetPointer());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadFFCheckBox(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Logic::CFFCheckBox* pFFCheckBox = static_cast<OOX::Logic::CFFCheckBox*>(poResult);
if ( c_oSerFFData::CBChecked == type )
{
pFFCheckBox->m_oChecked.Init();
pFFCheckBox->m_oChecked->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else if ( c_oSerFFData::CBDefault == type )
{
pFFCheckBox->m_oDefault.Init();
pFFCheckBox->m_oDefault->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else if ( c_oSerFFData::CBSize == type )
{
pFFCheckBox->m_oSize.Init();
pFFCheckBox->m_oSize->m_oVal.Init();
pFFCheckBox->m_oSize->m_oVal->FromHps(m_oBufferedStream.GetULong());
}
else if ( c_oSerFFData::CBSizeAuto == type )
{
pFFCheckBox->m_oSizeAuto.Init();
pFFCheckBox->m_oSizeAuto->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadDDList(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Logic::CFFDDList* pDDList = static_cast<OOX::Logic::CFFDDList*>(poResult);
if ( c_oSerFFData::DLDefault == type )
{
pDDList->m_oDefault.Init();
pDDList->m_oDefault->m_oVal.Init();
pDDList->m_oDefault->m_oVal->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerFFData::DLResult == type )
{
pDDList->m_oResult.Init();
pDDList->m_oResult->m_oVal.Init();
pDDList->m_oResult->m_oVal->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerFFData::DLListEntry == type )
{
ComplexTypes::Word::String* pVal = new ComplexTypes::Word::String();
pVal->m_sVal.Init();
pVal->m_sVal->append(m_oBufferedStream.GetString3(length));
pDDList->m_arrListEntry.push_back(pVal);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadFFHelpText(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
ComplexTypes::Word::CFFHelpText* pHelpText = static_cast<ComplexTypes::Word::CFFHelpText*>(poResult);
if ( c_oSerFFData::HTType == type )
{
pHelpText->m_oType.Init();
pHelpText->m_oType->SetValue((SimpleTypes::EInfoTextType)m_oBufferedStream.GetUChar());
}
else if ( c_oSerFFData::HTVal == type )
{
std::wstring sVal = m_oBufferedStream.GetString3(length);
pHelpText->m_oVal.Init();
pHelpText->m_oVal->SetValue(sVal);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadFFStatusText(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
ComplexTypes::Word::CFFStatusText* pStatusText = static_cast<ComplexTypes::Word::CFFStatusText*>(poResult);
if ( c_oSerFFData::HTType == type )
{
pStatusText->m_oType.Init();
pStatusText->m_oType->SetValue((SimpleTypes::EInfoTextType)m_oBufferedStream.GetUChar());
}
else if ( c_oSerFFData::HTVal == type )
{
std::wstring sVal = m_oBufferedStream.GetString3(length);
pStatusText->m_oVal.Init();
pStatusText->m_oVal->SetValue(sVal);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadTextInput(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Logic::CFFTextInput* pTextInput = static_cast<OOX::Logic::CFFTextInput*>(poResult);
if ( c_oSerFFData::TIDefault == type )
{
pTextInput->m_oDefault.Init();
pTextInput->m_oDefault->m_sVal.Init();
pTextInput->m_oDefault->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if ( c_oSerFFData::TIFormat == type )
{
pTextInput->m_oFormat.Init();
pTextInput->m_oFormat->m_sVal.Init();
pTextInput->m_oFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if ( c_oSerFFData::TIMaxLength == type )
{
pTextInput->m_oMaxLength.Init();
pTextInput->m_oMaxLength->m_oVal.Init();
pTextInput->m_oMaxLength->m_oVal->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerFFData::TIType == type )
{
pTextInput->m_oType.Init();
pTextInput->m_oType->m_oVal.Init();
pTextInput->m_oType->m_oVal->SetValue((SimpleTypes::EFFTextType)m_oBufferedStream.GetUChar());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadHyperlink(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;

View File

@ -912,7 +912,8 @@ extern int g_nCurFormatVersion;
namespace c_oSer_FldSimpleType{ enum c_oSer_FldSimpleType
{
Content = 0,
Instr = 1
Instr = 1,
FFData = 2
};}
namespace c_oSer_ColorThemeType{ enum c_oSer_ColorThemeType
{
@ -1044,6 +1045,34 @@ extern int g_nCurFormatVersion;
Temporary = 34,
MultiLine = 35
};}
namespace c_oSerFFData{enum c_oSerFFData
{
CalcOnExit = 0,
CheckBox = 1,
DDList = 2,
Enabled = 3,
EntryMacro = 4,
ExitMacro = 5,
HelpText = 6,
Label = 7,
Name = 8,
StatusText = 9,
TabIndex = 10,
TextInput = 11,
CBChecked = 12,
CBDefault = 13,
CBSize = 14,
CBSizeAuto = 15,
DLDefault = 16,
DLResult = 17,
DLListEntry = 18,
HTType = 19,
HTVal = 20,
TIDefault = 21,
TIFormat = 22,
TIMaxLength = 23,
TIType = 24,
};}
}
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES

View File

@ -3321,11 +3321,208 @@ namespace BinDocxRW
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::Instr);
m_oBcw.m_oStream.WriteStringW3(*pFldSimple->m_sInstr);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
//FFData
if(pFldSimple->m_oFFData.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::FFData);
WriteFFData(pFldSimple->m_oFFData.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Content
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::Content);
WriteParagraphContent(pFldSimple->m_arrItems);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
void WriteFFData(const OOX::Logic::CFFData& oFFData)
{
int nCurPos = 0;
if(oFFData.m_oCalcOnExit.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CalcOnExit);
m_oBcw.m_oStream.WriteBOOL(oFFData.m_oCalcOnExit->m_oVal.ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oCheckBox.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CheckBox);
WriteFFCheckBox(oFFData.m_oCheckBox.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oDDList.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DDList);
WriteDDList(oFFData.m_oDDList.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oEnabled.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Enabled);
m_oBcw.m_oStream.WriteBOOL(oFFData.m_oEnabled->m_oVal.ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oEntryMacro.IsInit() && oFFData.m_oEntryMacro->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::EntryMacro);
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oEntryMacro->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oExitMacro.IsInit() && oFFData.m_oExitMacro->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::ExitMacro);
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oExitMacro->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oHelpText.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HelpText);
WriteFFHelpText(oFFData.m_oHelpText.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oLabel.IsInit() && oFFData.m_oLabel->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Label);
m_oBcw.m_oStream.WriteLONG(oFFData.m_oLabel->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oName.IsInit() && oFFData.m_oName->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Name);
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oName->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oStatusText.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::StatusText);
WriteFFStatusText(oFFData.m_oStatusText.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oTabIndex.IsInit() && oFFData.m_oTabIndex->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TabIndex);
m_oBcw.m_oStream.WriteLONG(oFFData.m_oTabIndex->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oTextInput.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TextInput);
WriteTextInput(oFFData.m_oTextInput.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteFFCheckBox(const OOX::Logic::CFFCheckBox& oCheckBox)
{
int nCurPos = 0;
if(oCheckBox.m_oChecked.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBChecked);
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oChecked->m_oVal.ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oCheckBox.m_oDefault.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBDefault);
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oDefault->m_oVal.ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oCheckBox.m_oSize.IsInit() && oCheckBox.m_oSize->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBSize);
m_oBcw.m_oStream.WriteULONG(oCheckBox.m_oSize->m_oVal->ToHps());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oCheckBox.m_oSizeAuto.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBSizeAuto);
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oSizeAuto->m_oVal.ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteDDList(const OOX::Logic::CFFDDList& oDDList)
{
int nCurPos = 0;
if(oDDList.m_oDefault.IsInit() && oDDList.m_oDefault->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLDefault);
m_oBcw.m_oStream.WriteLONG(oDDList.m_oDefault->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oDDList.m_oResult.IsInit() && oDDList.m_oResult->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLResult);
m_oBcw.m_oStream.WriteLONG(oDDList.m_oResult->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
for(int i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
{
ComplexTypes::Word::String* pVal = oDDList.m_arrListEntry[i];
if(pVal->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLListEntry);
m_oBcw.m_oStream.WriteStringW3(pVal->m_sVal.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
}
void WriteFFHelpText(const ComplexTypes::Word::CFFHelpText& oHelpText)
{
int nCurPos = 0;
if(oHelpText.m_oType.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTType);
m_oBcw.m_oStream.WriteBYTE(oHelpText.m_oType->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oHelpText.m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTVal);
m_oBcw.m_oStream.WriteStringW3(oHelpText.m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteFFStatusText(const ComplexTypes::Word::CFFStatusText& oStatusText)
{
int nCurPos = 0;
if(oStatusText.m_oType.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTType);
m_oBcw.m_oStream.WriteBYTE(oStatusText.m_oType->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oStatusText.m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTVal);
m_oBcw.m_oStream.WriteStringW3(oStatusText.m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteTextInput(const OOX::Logic::CFFTextInput& oTextInput)
{
int nCurPos = 0;
if(oTextInput.m_oDefault.IsInit() && oTextInput.m_oDefault->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIDefault);
m_oBcw.m_oStream.WriteStringW3(oTextInput.m_oDefault->m_sVal.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oTextInput.m_oFormat.IsInit() && oTextInput.m_oFormat->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIFormat);
m_oBcw.m_oStream.WriteStringW3(oTextInput.m_oFormat->m_sVal.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oTextInput.m_oMaxLength.IsInit() && oTextInput.m_oMaxLength->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIMaxLength);
m_oBcw.m_oStream.WriteLONG(oTextInput.m_oMaxLength->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oTextInput.m_oType.IsInit() && oTextInput.m_oType->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIType);
m_oBcw.m_oStream.WriteBYTE(oTextInput.m_oType->m_oVal->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteHyperlink(OOX::Logic::CHyperlink* pHyperlink)
{

View File

@ -178,7 +178,9 @@ namespace BinXlsxRW{
{
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
writeChartXlsx(sXlsxPath, oChartSpace);
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;

View File

@ -188,7 +188,7 @@ std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family:
}
else
{
const std::wstring id = std::wstring(L"style") + boost::lexical_cast<std::wstring>(count_++);
const std::wstring id = std::wstring(L"style") + std::to_wstring(count_++);
map_.insert(std::make_pair(n, id));
return id;
}
@ -1060,7 +1060,7 @@ void docx_conversion_context::start_list_item(bool restart)
if (restart && !list_style_stack_.empty())
{
const std::wstring curStyleName = current_list_style();
const std::wstring newStyleName = curStyleName + boost::lexical_cast<std::wstring>(new_list_style_number_++);
const std::wstring newStyleName = curStyleName + std::to_wstring(new_list_style_number_++);
list_style_renames_[curStyleName] = newStyleName;
odf_reader::list_style_container & lists = root()->odf_context().listStyleContainer();
@ -1240,7 +1240,7 @@ std::wstring notes_context::add(const std::wstring & Content, const std::wstring
std::wstring notes_context::next_id()
{
instances_map & map = (type_ == odf_types::noteclass::Endnote) ? instances_endnotes_ : instances_footnotes_;
const std::wstring s = boost::lexical_cast<std::wstring>(map.size() + 1);
const std::wstring s = std::to_wstring(map.size() + 1);
return s;
}
@ -1291,14 +1291,14 @@ void docx_conversion_context::start_text_changes (std::wstring id)
if (state.type == 1)
{
output_stream() << L"<w:ins" << format_change << L" w:id=\"" << boost::lexical_cast<std::wstring>(current_id_changes++) << L"\">";
output_stream() << L"<w:ins" << format_change << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\">";
}
if (state.type == 2)
{
for (size_t i = 0 ; i < state.content.size(); i++)
{
output_stream() << L"<w:del" << format_change << L" w:id=\"" << boost::lexical_cast<std::wstring>(current_id_changes++) << L"\">";
output_stream() << L"<w:del" << format_change << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\">";
output_stream() << state.content[i];
@ -1330,7 +1330,7 @@ void docx_conversion_context::start_changes()
std::wstring change_attr;
change_attr += L" w:date=\"" + state.date + L"\"";
change_attr += L" w:author=\"" + state.author + L"\"";
change_attr += L" w:id=\"" + boost::lexical_cast<std::wstring>(current_id_changes++) + L"\"";
change_attr += L" w:id=\"" + std::to_wstring(current_id_changes++) + L"\"";
if (state.type == 1)
{

View File

@ -317,7 +317,8 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
{
CP_XML_ATTR(L"name", val.name);
CP_XML_ATTR(L"id", val.id + 1);
oox_serialize_hlink(CP_XML_STREAM(), val.hlinks);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(L"wp:cNvGraphicFramePr")
@ -529,7 +530,7 @@ mso-position-vertical-relative:text;";
strStyle += L"margin-top:" + boost::lexical_cast<std::wstring>(val.y / 12700.) + L"pt;";
strStyle += L"width:" + boost::lexical_cast<std::wstring>(val.cx / 12700.) + L"pt;";
strStyle += L"height:" + boost::lexical_cast<std::wstring>(val.cy / 12700.) + L"pt;";
strStyle += L"z-index:" + boost::lexical_cast<std::wstring>(0xF000800 - val.id);
strStyle += L"z-index:" + std::to_wstring(0xF000800 - val.id);
CP_XML_ATTR(L"id", L"Rect" + std::to_wstring(val.id));
CP_XML_ATTR(L"o:spid", L"_x0000_s" + std::to_wstring(1024 + val.id));

View File

@ -223,7 +223,7 @@ void docx_charts_files::write(const std::wstring & RootPath)
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml";
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
@ -307,6 +307,7 @@ namespace
content << L"<w:" << Node << L"s \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \

View File

@ -62,7 +62,9 @@ struct drawing_object_description
double anchor_x_;
double anchor_y_;
_action_desc action_;
std::vector<_hlink_desc> hlinks_;
std::vector<odf_reader::_property> additional_; //shape properties
std::wstring xlink_href_; //ссылка на внешний объект

View File

@ -39,13 +39,13 @@ namespace oox {
std::wstring headers_footers::create_id(size_t i)
{
return std::wstring(L"rHFId") + boost::lexical_cast<std::wstring>(i);
return std::wstring(L"rHFId") + std::to_wstring(i);
}
std::wstring headers_footers::create_name(size_t i, headers_footers::Type _Type)
{
return ((_Type == header || _Type == headerLeft || _Type == headerFirst) ? std::wstring(L"header") : std::wstring(L"footer") )
+ boost::lexical_cast<std::wstring>(i) + L".xml";
+ std::to_wstring(i) + L".xml";
}
std::wstring headers_footers::add(const std::wstring & StyleName,
@ -64,9 +64,10 @@ std::wstring headers_footers::add(const std::wstring & StyleName,
}
instance_ptr inst = instance_ptr( new instance(id, Content, type, name) );
BOOST_FOREACH(const relationship & r, _rels.relationships())
std::vector<relationship> & rels = _rels.relationships();
for (size_t i = 0; i < rels.size(); i++)
{
inst->rels_.add(r);
inst->rels_.add(rels[i]);
}
instances_[StyleName].push_back(inst);
return id;

View File

@ -44,7 +44,8 @@ namespace oox {
hyperlinks::_ref hyperlinks::last()
{
_ref r={};
if (hrefs_.size()>0)
if (!hrefs_.empty())
r = hrefs_.back();
return r;
@ -52,9 +53,9 @@ hyperlinks::_ref hyperlinks::last()
std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place, bool drawing)
{
std::wstring id = std::wstring(L"rHpId") + boost::lexical_cast<std::wstring>(hrefs_.size()+1);
std::wstring id = std::wstring(L"rHpId") + std::to_wstring(hrefs_.size() + 1);
_ref r ={xml::utils::replace_text_to_xml(href), type_place, drawing, id, false};
_ref r = {xml::utils::replace_text_to_xml(href), type_place, drawing, id};
hrefs_.push_back(r);
@ -65,14 +66,14 @@ std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place,
void hyperlinks::dump_rels(rels & Rels, _type_place type)
{
size_t i = 0;
BOOST_FOREACH(_ref & elm, hrefs_)
for (size_t i = 0; i < hrefs_.size(); i++)
{
if (elm.used_rels)continue; // уже использовали этот релс
if (hrefs_[i].used_rels)continue; // уже использовали этот релс
if (elm.type_place == type)
if (hrefs_[i].type_place == type)
{
Rels.add( relationship(elm.id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", elm.href, L"External" ) );
elm.used_rels = true;
Rels.add( relationship(hrefs_[i].id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hrefs_[i].href, L"External" ) );
hrefs_[i].used_rels = true;
}
}
}

View File

@ -71,7 +71,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
// for (int i = 0; i <= 9; ++i)
{
//if (FALSE == (hr = pFontManager->LoadString2( boost::lexical_cast<std::wstring>(i), 0, 0)))
//if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
// return std::pair<float, float>(7,8);
if (FALSE == (hr = pFontManager->LoadString2( L"xxxxx" , 0, 0)))

View File

@ -33,9 +33,6 @@
#include "mediaitems.h"
#include <boost/regex.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/xml/utils.h>
@ -92,12 +89,18 @@ std::wstring static get_default_file_name(RelsType type)
return L"image";
case typeChart:
return L"chart";
case typeMedia:
return L"media";
case typeMsObject:
return L"msObject";
case typeOleObject:
return L"oleObject";
case typeMedia:
return L"media";
case typeSlide:
return L"slide";
case typeVideo:
return L"video";
case typeAudio:
return L"audio";
default:
return L"";
}
@ -140,10 +143,9 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
if (type == typeOleObject && sExt.empty())
sExt = L".bin";
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
return get_default_file_name(type) + std::to_wstring(Num) + sExt;
}
std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
{
CFile file;
@ -187,6 +189,9 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
else if ( type == typeImage) number = count_image + 1;
else if ( type == typeShape) number = count_shape + 1;
else if ( type == typeMedia) number = count_media + 1;
else if ( type == typeAudio) number = count_audio + 1;
else if ( type == typeVideo) number = count_video + 1;
else if ( type == typeSlide) number = count_slide + 1;
else if ( type == typeMsObject ||
type == typeOleObject) number = count_object + 1;
else
@ -219,7 +224,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
{
if ( type == typeChart)
{
id = std::wstring(L"chId") + boost::lexical_cast<std::wstring>(count_charts + 1);
id = std::wstring(L"chId") + std::to_wstring(count_charts + 1);
count_charts++;
}
else if ( type == typeImage)
@ -232,17 +237,32 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
//------------------------------------------------
if (inputFileName.empty()) return L"";
id = std::wstring(L"picId") + boost::lexical_cast<std::wstring>(count_image + 1);
id = std::wstring(L"picId") + std::to_wstring(count_image + 1);
count_image++;
}
else if ( type == typeMsObject || type == typeOleObject)
{
id = std::wstring(L"objId") + boost::lexical_cast<std::wstring>(count_object + 1);
id = std::wstring(L"objId") + std::to_wstring(count_object + 1);
count_object++;
}
else if ( type == typeAudio)
{
id = std::wstring(L"aId") + std::to_wstring(count_audio + 1);
count_audio++;
}
else if ( type == typeVideo)
{
id = std::wstring(L"vId") + std::to_wstring(count_video + 1);
count_video++;
}
else if ( type == typeMedia)
{
id = std::wstring(L"mId") + std::to_wstring(count_media + 1);
count_media++;
}
else
{
id = std::wstring(L"rId") + boost::lexical_cast<std::wstring>(count_shape + 1);
id = std::wstring(L"rId") + std::to_wstring(count_shape + 1);
count_shape++;
}

View File

@ -31,11 +31,10 @@
*/
#pragma once
#include <vector>
#include <string>
#include "oox_rels.h"
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
namespace cpdoccore {
namespace oox {
@ -50,6 +49,9 @@ public:
count_tables = 0;
count_media = 0;
count_object = 0;
count_audio = 0;
count_video = 0;
count_slide = 0;
}
struct item
@ -74,6 +76,9 @@ public:
size_t count_charts;
size_t count_image;
size_t count_media;
size_t count_audio;
size_t count_video;
size_t count_slide;
size_t count_shape;
size_t count_tables;
size_t count_object;
@ -88,20 +93,47 @@ public:
{
switch (type)
{
case typeImage: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
case typeChart: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
case typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
case typeOleObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
case typeHyperlink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
default:
return L"";
case typeImage: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
case typeChart: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
case typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
case typeOleObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
case typeHyperlink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
case typeMedia: return L"http://schemas.microsoft.com/office/2007/relationships/media";
case typeAudio: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio";
case typeVideo: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video";
case typeSlide: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
default:
return L"";
}
}
static RelsType detectMediaType(const std::wstring & fileName)
{
int pos = fileName.rfind(L".");
std::wstring sExt = (pos >=0 ? fileName.substr(pos + 1) : L"");
if (sExt.empty()) return typeMedia;
sExt = XmlUtils::GetLower(sExt);
if (sExt == L"wmv") return typeVideo;
if (sExt == L"avi") return typeVideo;
if (sExt == L"wmv") return typeVideo;
if (sExt == L"wma") return typeAudio;
if (sExt == L"wav") return typeAudio;
if (sExt == L"mp3") return typeAudio;
if (sExt == L"m4a") return typeAudio;
if (sExt == L"m4v") return typeVideo;
if (sExt == L"mp4") return typeVideo;
if (sExt == L"mov") return typeVideo;
return typeMedia;
}
private:
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
std::wstring detectImageFileExtension (std::wstring &fileName);
std::wstring detectImageFileExtension (const std::wstring &fileName);
items_array items_;
std::wstring odf_packet_;

View File

@ -516,22 +516,32 @@ void _oox_drawing::serialize_xfrm(std::wostream & strm, const std::wstring & nam
}
}
}
void oox_serialize_hlink(std::wostream & strm, std::vector<_hlink_desc> const & val)
void oox_serialize_action(std::wostream & strm, _action_desc const & val)
{
if (val.enabled == false) return;
CP_XML_WRITER(strm)
{
BOOST_FOREACH(const _hlink_desc & h, val)
CP_XML_NODE(L"a:hlinkClick")
{
if (h.in_object == true)
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
if (!val.action.empty())
CP_XML_ATTR(L"action", val.action);
if (val.highlightClick)
CP_XML_ATTR(L"highlightClick", val.highlightClick);
CP_XML_ATTR(L"r:id", val.hId);
if (!val.hSoundId.empty())
{
CP_XML_NODE(L"a:hlinkClick")
CP_XML_NODE(L"a:snd")
{
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"r:id", h.hId);
CP_XML_ATTR(L"r:embed", val.hSoundId);
CP_XML_ATTR(L"name", L"sound");
}
break;
}
}
}

View File

@ -51,10 +51,35 @@ namespace oox {
{
std::wstring hId;
std::wstring hRef;
bool in_object;
};
};
struct _action_desc
{
_action_desc() : enabled(false), highlightClick(false) {}
void clear()
{
enabled = false;
highlightClick = false;
hSoundId.clear();
hSoundRef.clear();
hId.clear();
hRef.clear();
action.clear();
}
bool enabled;
std::wstring action;
std::wstring hSoundId;
std::wstring hSoundRef;
std::wstring hId;
std::wstring hRef;
RelsType typeRels;
bool highlightClick;
};
class _oox_drawing
{
public:
@ -74,10 +99,14 @@ namespace oox {
_oox_fill fill;
std::wstring objectId;
std::wstring objectProgId;
std::wstring objectId;
std::wstring objectProgId;
std::wstring extId;
_action_desc action;
std::vector<_hlink_desc> hlinks;
std::vector<_hlink_desc> hlinks;
std::vector<odf_reader::_property> additional;
virtual void serialize (std::wostream & strm) = 0;
@ -90,7 +119,7 @@ namespace oox {
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val);
void oox_serialize_hlink (std::wostream & strm, const std::vector<_hlink_desc> & val);
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
}
}

View File

@ -71,7 +71,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double)
{
CP_XML_NODE(L"a:alpha")
{
CP_XML_ATTR(L"val", boost::lexical_cast<std::wstring>((int)(*opacity)*1000));// + L"%");
CP_XML_ATTR(L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
}
}
}
@ -88,7 +88,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_type
{
CP_XML_NODE(L"a:alpha")
{
CP_XML_ATTR(L"val", boost::lexical_cast<std::wstring>((int)opacity->get_value()*1000));// + L"%");
CP_XML_ATTR(L"val", std::to_wstring((int)opacity->get_value()*1000));// + L"%");
}
}
}

View File

@ -71,7 +71,18 @@ static std::wstring get_mime_type(const std::wstring & extension)
else if (L"tif" == extension) return L"image/x-tiff";
else if (L"tiff" == extension) return L"image/x-tiff";
else if (L"pdf" == extension) return L"application/pdf";
else if (L"wav" == extension) return L"audio/wav";
else if (L"mp3" == extension) return L"audio/mpeg";
else if (L"wma" == extension) return L"audio/x-ms-wma";
else if (L"m4a" == extension) return L"audio/unknown";
else if (L"avi" == extension) return L"video/avi";
else if (L"wmv" == extension) return L"video/x-ms-wmv";
else if (L"mov" == extension) return L"video/unknown";
else if (L"mp4" == extension) return L"video/unknown";
else if (L"m4v" == extension) return L"video/unknown";
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
else if (L"docx" == extension) return L"application/vnd.openxmlformats-officedocument.wordprocessingml.document";
@ -130,7 +141,7 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
{
std::vector<override_content_type> & override_ = content_type_content_.get_override();
for (int i = 0 ; i < override_.size(); i++)
for (size_t i = 0 ; i < override_.size(); i++)
{
if (override_[i].part_name() == fileName)
return true;
@ -158,14 +169,18 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
void content_types_file::set_media(mediaitems & _Mediaitems)
{
BOOST_FOREACH( mediaitems::item & item, _Mediaitems.items() )
std::vector<mediaitems::item> & items_ = _Mediaitems.items();
for (size_t i = 0; i < items_.size(); i++)
{
if ((item.type == typeImage || item.type == typeMedia) && item.mediaInternal)
if ((items_[i].type == typeImage ||
items_[i].type == typeMedia ||
items_[i].type == typeVideo ||
items_[i].type == typeAudio) && items_[i].mediaInternal)
{
int n = item.outputName.rfind(L".");
int n = items_[i].outputName.rfind(L".");
if (n > 0)
{
add_or_find_default(item.outputName.substr(n+1, item.outputName.length() - n));
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
}
}
}
@ -320,9 +335,12 @@ void media::write(const std::wstring & RootPath)
NSDirectory::CreateDirectory(path.c_str());
mediaitems::items_array & items = mediaitems_.items();
for (int i = 0; i < items.size(); i++ )
for (size_t i = 0; i < items.size(); i++ )
{
if (items[i].mediaInternal && items[i].valid && (items[i].type == typeImage || items[i].type == typeMedia))
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
items[i].type == typeMedia ||
items[i].type == typeAudio ||
items[i].type == typeVideo ))
{
std::wstring & file_name = items[i].href;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].outputName;
@ -359,7 +377,7 @@ void embeddings::write(const std::wstring & RootPath)
content_types_file & content_types = get_main_document()->get_content_types_file();
mediaitems::items_array & items = embeddingsitems_.items();
for (int i = 0; i < items.size(); i++ )
for (size_t i = 0; i < items.size(); i++ )
{
if ( items[i].mediaInternal && items[i].valid &&
(items[i].type == typeMsObject || items[i].type == typeOleObject))

View File

@ -56,18 +56,6 @@ std::wostream & relationship::xml_to_stream(std::wostream & _Wostream) const
CP_XML_ATTR(L"TargetMode", target_mode());
}
}
//_Wostream << L"<Relationship ";
//CP_XML_SERIALIZE_ATTR(L"Id", id());
//CP_XML_SERIALIZE_ATTR(L"Type", type());
//CP_XML_SERIALIZE_ATTR(L"Target", target());
//
//if (!target_mode().empty())
//{
// CP_XML_SERIALIZE_ATTR(L"TargetMode", target_mode());
//}
//_Wostream << L" />";
return _Wostream;
}
@ -82,23 +70,12 @@ std::wostream & rels::xml_to_stream(std::wostream & _Wostream) const
{
CP_XML_ATTR(L"xmlns", xmlns::rels.value);
BOOST_FOREACH(const relationship & r, relationship_)
for (size_t i = 0; i < relationship_.size(); i++)
{
r.xml_to_stream(CP_XML_STREAM());
relationship_[i].xml_to_stream(CP_XML_STREAM());
}
} // "Relationships"
}
}
//_Wostream << L"<Relationships ";
//CP_XML_SERIALIZE_ATTR(L"xmlns", xmlns::rels.value);
//_Wostream << L">";
//BOOST_FOREACH(const relationship & r, relationship_)
//{
// r.xml_to_stream(_Wostream);
//}
//_Wostream << L"</Relationships>";
return _Wostream;
}

View File

@ -52,7 +52,10 @@ enum RelsType
typeMedia,
typeGroupShape,
typeMsObject,
typeOleObject
typeOleObject,
typeSlide,
typeVideo,
typeAudio
};
struct _rel

View File

@ -54,13 +54,13 @@ public:
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content,pptx_comments_ptr comments)
{
const std::wstring file_id = boost::lexical_cast<std::wstring>(next_file_id_++);
const std::wstring file_id = std::to_wstring(next_file_id_++);
const std::wstring fileName = std::wstring(L"comment") + file_id + L".xml";
comments_.push_back(pptx_comment_elm(fileName, content, comments));
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(fileName, rId);
}

View File

@ -132,7 +132,7 @@ void pptx_conversion_context::process_layouts()
type == odf_types::presentation_class::header ||
type == odf_types::presentation_class::page_number)
{
if (frame->idx_in_owner <0)
if (frame->idx_in_owner < 0)
frame->idx_in_owner = last_idx_placeHolder++;
frame->pptx_convert_placeHolder(*this);
@ -195,7 +195,7 @@ void pptx_conversion_context::process_theme(std::wstring name)
if (name.empty())
{
name = L"User Theme: " + boost::lexical_cast<std::wstring>(current);
name = L"User Theme: " + std::to_wstring(current);
}
start_theme(name);
//
@ -489,7 +489,7 @@ bool pptx_conversion_context::start_layout(int layout_index)
root()->odf_context().styleContainer().presentation_masters().add_layout_to(layouts.content[layout_index].master_name,layouts.content[layout_index]);
current_layout().Rels().add(relationship(L"smId1"/*master_id.second*/, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster",
std::wstring(L"../slideMasters/slideMaster") + boost::lexical_cast<std::wstring>(master_id.first) + L".xml"));
std::wstring(L"../slideMasters/slideMaster") + std::to_wstring(master_id.first) + L".xml"));
//
}

View File

@ -76,7 +76,7 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val)
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(), val.hlinks);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(L"p:cNvPicPr")
@ -109,6 +109,75 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val)
}
}
}
void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"p:pic")
{
CP_XML_NODE(L"p:nvPicPr")
{
CP_XML_NODE(L"p:cNvPr")
{
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(L"p:cNvPicPr")
{
}
CP_XML_NODE(L"p:nvPr")
{
std::wstring strNode;
if (val.type == typeVideo) strNode = L"a:videoFile";
else if (val.type == typeAudio) strNode = L"a:audioFile";
if (strNode.empty() == false)
{
CP_XML_NODE(strNode)
{
CP_XML_ATTR(L"r:link", val.objectId);
}
}
CP_XML_NODE(L"p:extLst")
{
CP_XML_NODE(L"p:ext")
{
CP_XML_ATTR(L"uri", L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}");
CP_XML_NODE(L"p14:media")
{
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
CP_XML_ATTR(L"r:embed", val.extId);
}
}
}
}
}
if (val.fill.bitmap)
val.fill.bitmap->name_space = L"p";
oox_serialize_fill(CP_XML_STREAM(), val.fill);
CP_XML_NODE(L"p:spPr")
{
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
CP_XML_NODE(L"a:prstGeom")
{
CP_XML_ATTR(L"prst", L"rect");
CP_XML_NODE(L"a:avLst");
}
oox_serialize_ln(CP_XML_STREAM(), val.additional);
}
//_CP_OPT(std::wstring) strTextContent;
//odf::GetProperty(properties,L"text-content",strTextContent);
//pptx_serialize_text(CP_XML_STREAM(),val.additional);
//на картинке тект нельзя... - выше сменили тип на рект с заливкой
}
}
}
void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
{
@ -123,7 +192,7 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks);
oox_serialize_action(CP_XML_STREAM(),val.action);
}
CP_XML_NODE(L"p:cNvSpPr")//non visual properies (собственно тока 1 там)
{
@ -155,8 +224,11 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
odf_reader::GetProperty(val.additional,L"no_rect",bNoRect);
if (!bNoRect)
{
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
{
if (val.cx != 0 || val.cy != 0) //layout
{
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
}
val.serialize_shape(CP_XML_STREAM());
oox_serialize_ln(CP_XML_STREAM(), val.additional);
@ -307,11 +379,14 @@ void _pptx_drawing::serialize(std::wostream & strm)
{
pptx_serialize_table(strm, *this);
}
else if (type == typeMsObject ||
type == typeOleObject)
else if (type == typeMsObject || type == typeOleObject)
{
pptx_serialize_object(strm, *this);
}
else if (type == typeMedia || type == typeAudio || type == typeVideo )
{
pptx_serialize_media(strm, *this);
}
}

View File

@ -65,11 +65,16 @@ public:
{
pptx_drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
}
for (int i = 0; i < d.hlinks.size(); i++)
for (size_t i = 0; i < d.hlinks.size(); i++)
{
pptx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
}
}
if (!d.action.hId.empty())
{
bool bInternal = (d.action.typeRels != typeHyperlink);
pptx_drawing_rels_.push_back(_rel(bInternal, d.action.hId, d.action.hRef, d.action.typeRels));
}
}
void add(/**/
bool isInternal,
@ -120,10 +125,13 @@ public:
}
else
{
std::wstring ref = pptx_drawing_rels_[i].ref;
if (pptx_drawing_rels_[i].is_internal && ref != L"NULL")
{
ref = L"../" + ref;
}
Rels.add(relationship( pptx_drawing_rels_[i].rid,
mediaitems::get_rel_type(pptx_drawing_rels_[i].type),
(pptx_drawing_rels_[i].is_internal ? std::wstring(L"../") + pptx_drawing_rels_[i].ref : pptx_drawing_rels_[i].ref),
(pptx_drawing_rels_[i].is_internal ? L"" : L"External")) );
mediaitems::get_rel_type(pptx_drawing_rels_[i].type), ref, (pptx_drawing_rels_[i].is_internal ? L"" : L"External")) );
}
}
}

View File

@ -54,7 +54,7 @@ std::wstring pptx_xml_slide::rId() const
pptx_xml_slide_ptr pptx_xml_slide::create(std::wstring const & name,int id)
{
const std::wstring rId = std::wstring(L"sId") + std::to_wstring(id);
return boost::make_shared<pptx_xml_slide>(name,rId);
return boost::make_shared<pptx_xml_slide>(name, rId);
}
pptx_xml_slide::pptx_xml_slide(std::wstring const & name,std::wstring const & id)
@ -273,7 +273,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
CP_XML_ATTR(L"accent6",L"accent6");
CP_XML_ATTR(L"accent5",L"accent5");
CP_XML_ATTR(L"accent4",L"accent4");
CP_XML_ATTR(L"accent3",L"accent5");
CP_XML_ATTR(L"accent3",L"accent3");
CP_XML_ATTR(L"accent2",L"accent2");
CP_XML_ATTR(L"accent1",L"accent1");
CP_XML_ATTR(L"tx2",L"dk2");
@ -283,7 +283,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
}
CP_XML_NODE(L"p:sldLayoutIdLst")
{
for (int i = 0; i < layoutsId_.size(); i++)
for (size_t i = 0; i < layoutsId_.size(); i++)
{
CP_XML_NODE(L"p:sldLayoutId")
{
@ -420,10 +420,14 @@ void pptx_xml_presentation::write_to(std::wostream & strm)
{
CP_XML_STREAM() << slideMastersData_.str();
}
CP_XML_NODE(L"p:notesMasterIdLst")
{
CP_XML_STREAM() << slideNotesMastersData_.str();
}
std::wstring notesMaster = slideNotesMastersData_.str();
if (notesMaster.empty() == false)
{
CP_XML_NODE(L"p:notesMasterIdLst")
{
CP_XML_STREAM() << notesMaster;
}
}
CP_XML_NODE(L"p:sldIdLst")
{
CP_XML_STREAM() << slidesData_.str();

View File

@ -100,7 +100,7 @@ void slide_content::add_rels(rels & _r)
{
std::vector<relationship> & r = _r.relationships();
for (int i = 0; i < r.size(); i++)
for (size_t i = 0; i < r.size(); i++)
{
rels_->get_rels().add(r[i]);
}

View File

@ -60,6 +60,7 @@ public:
_CP_OPT(std::wstring) Speed;
_CP_OPT(int) Time;
_CP_OPT(int) PageTime;
_CP_OPT(std::wstring) Dir;
_CP_OPT(std::wstring) Param;
bool onClick;
@ -135,6 +136,7 @@ private:
void process_chart (drawing_object_description& obj, _pptx_drawing & drawing);
void process_table (drawing_object_description& obj, _pptx_drawing & drawing);
void process_object (drawing_object_description& obj, _pptx_drawing & drawing);
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
size_t rId_;
mediaitems mediaitems_;
@ -160,6 +162,7 @@ void pptx_slide_context::Impl::process_drawings()
case typeChart: process_chart(objects_[i], drawing); break;
case typeShape: process_shape(objects_[i], drawing); break;
case typeTable: process_table(objects_[i], drawing); break;
case typeMedia: process_media(objects_[i], drawing); break;
case typeMsObject:
case typeOleObject: process_object(objects_[i], drawing); break;
}
@ -228,6 +231,8 @@ void pptx_slide_context::default_set()
impl_->object_description_.svg_rect_ = boost::none;
impl_->object_description_.hlinks_.clear();
impl_->object_description_.action_.clear();
impl_->object_description_.additional_.clear();
impl_->object_description_.fill_.clear();
@ -323,15 +328,15 @@ void pptx_slide_context::set_fill(_oox_fill & fill)
impl_->object_description_.fill_= fill;
}
std::wstring pptx_slide_context::add_hyperlink(std::wstring const & href,bool object)
std::wstring pptx_slide_context::add_hyperlink(std::wstring const & href)
{
++hlinks_size_;
std::wstring hId=std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_size_);
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
_hlink_desc desc={hId, href_correct, object};
_hlink_desc desc = {hId, href_correct};
impl_->object_description_.hlinks_.push_back(desc);
return hId;
@ -347,14 +352,12 @@ void pptx_slide_context::add_background(_oox_fill & fill)
fill.bitmap->rId = get_mediaitems().add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
}
impl_->background_fill_ = fill;
}
void pptx_slide_context::set_name(std::wstring const & name)
{
impl_->object_description_.name_ = name;
}
void pptx_slide_context::start_shape(int type)
@ -362,6 +365,74 @@ void pptx_slide_context::start_shape(int type)
impl_->object_description_.type_ = typeShape;
impl_->object_description_.shape_type_ = type; //2,3...
}
void pptx_slide_context::start_action(std::wstring action)
{
impl_->object_description_.action_.enabled = true;
if (action == L"sound")
{
impl_->object_description_.action_.action = L"ppaction://noaction";
impl_->object_description_.action_.typeRels = typeAudio;
impl_->object_description_.action_.highlightClick = true;
}
else if (action == L"next-page")
{
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=nextslide";
impl_->object_description_.action_.highlightClick = true;
}
else if (action == L"previous-page")
{
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=previousslide";
impl_->object_description_.action_.highlightClick = true;
}
else if (action == L"first-page")
{
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=firstslide";
impl_->object_description_.action_.highlightClick = true;
}
else if (action == L"last-page")
{
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=lastslide";
impl_->object_description_.action_.highlightClick = true;
}
//ppaction://hlinkshowjump?jump=endshow
else if (action == L"execute")
{
impl_->object_description_.action_.action = L"ppaction://program";
impl_->object_description_.action_.typeRels = typeHyperlink;
impl_->object_description_.action_.highlightClick = true;
}
}
void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
{
++hlinks_size_;
impl_->object_description_.action_.highlightClick = true;
if (typeRels == typeAudio)
{
bool isMediaInternal = true;
impl_->object_description_.action_.hSoundId = get_mediaitems().add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
}
else
{
impl_->object_description_.action_.typeRels = typeRels;
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
link = xml::utils::replace_text_to_xml(link);
if (typeRels == typeHyperlink)
XmlUtils::replace_all( link, L" .", L"."); //1 (130).odt
impl_->object_description_.action_.hId = hId;
impl_->object_description_.action_.hRef = link;
}
}
void pptx_slide_context::end_action()
{
}
void pptx_slide_context::start_table()
{
@ -385,6 +456,20 @@ void pptx_slide_context::set_ole_object(const std::wstring & path, const std::ws
impl_->object_description_.xlink_href_ = path;
impl_->object_description_.descriptor_ = progId;
}
void pptx_slide_context::set_media(const std::wstring & path)
{
if (path.empty()) return;
impl_->object_description_.type_ = typeMedia;
impl_->object_description_.xlink_href_ = path;
impl_->object_description_.action_.enabled = true;
impl_->object_description_.action_.action = L"ppaction://media";
}
void pptx_slide_context::set_media_param(std::wstring name, std::wstring value)
{
}
void pptx_slide_context::set_image(const std::wstring & path)
{
@ -532,7 +617,6 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);
}
void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _pptx_drawing & drawing)
{
std::wstring ref;
@ -550,30 +634,48 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
}
}
void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _pptx_drawing & drawing)
{
std::wstring ref;
bool isMediaInternal = true;
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
drawing.extId = L"ext" + drawing.objectId;
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
add_additional_rels( true, drawing.extId, ref, typeMedia);
if (drawing.fill.bitmap)
{
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
}
}
void pptx_slide_context::Impl::process_common_properties(drawing_object_description & pic, _pptx_drawing & drawing)
{
if (pic.svg_rect_)
{
//todooo непонятки с отрицательными значениями
int val = (int)(0.5 + odf_types::length(pic.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >= 0) drawing.x = val;
if ( val >= 0) drawing.x = val;
val = (int)(0.5 + odf_types::length(pic.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >= 0) drawing.y = val;
if ( val >= 0 ) drawing.y = val;
val = (int)(0.5 + odf_types::length(pic.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >=0) drawing.cx = val;
if ( val >=0 ) drawing.cx = val;
val = (int)(0.5 + odf_types::length(pic.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >=0) drawing.cy = val;
if ( val >=0 ) drawing.cy = val;
}
drawing.additional = pic.additional_;
drawing.hlinks = pic.hlinks_;
drawing.fill = pic.fill_;
drawing.additional = pic.additional_;
drawing.hlinks = pic.hlinks_;
drawing.action = pic.action_;
drawing.fill = pic.fill_;
}
void pptx_slide_context::dump_rels(rels & Rels)
@ -645,8 +747,12 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
}
if (impl_->transition_.Time)
{
CP_XML_ATTR(L"advTm",impl_->transition_.Time.get());
}
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
}
if (impl_->transition_.PageTime)
{
CP_XML_ATTR(L"advTm", impl_->transition_.PageTime.get());
}
CP_XML_ATTR(L"advClick", impl_->transition_.onClick);
CP_XML_NODE(std::wstring(L"p:" + impl_->transition_.Type))
@ -669,9 +775,22 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
//p:sndAc
}
}
//CP_XML_NODE(L"p:timing")- последовательности p:par
//{
//}
CP_XML_NODE(L"p:timing")
{
CP_XML_NODE(L"p:tnLst")
{
CP_XML_NODE(L"p:par")
{
CP_XML_NODE(L"p:cTn")
{
CP_XML_ATTR(L"nodeType", L"tmRoot");
CP_XML_ATTR(L"id", 1);
CP_XML_ATTR(L"dur", L"indefinite");
CP_XML_ATTR(L"restart", L"never");
}
}
}
}
}
}

View File

@ -75,7 +75,7 @@ public:
void set_placeHolder_type (std::wstring typeHolder);
void set_placeHolder_idx (int idx);
std::wstring add_hyperlink(std::wstring const & ref, bool object);
std::wstring add_hyperlink(std::wstring const & ref);
void start_frame();
void set_image (const std::wstring & path);
@ -83,8 +83,14 @@ public:
void set_ms_object (const std::wstring & path, const std::wstring & progId);
void set_ole_object (const std::wstring & path, const std::wstring & progId);
void set_text_box ();
void set_media (const std::wstring & path);
void set_media_param(std::wstring name, std::wstring value);
void end_frame();
void start_action (std::wstring action);
void set_link (std::wstring link, RelsType typeRels = typeHyperlink);
void end_action ();
void start_table();
void end_table();

View File

@ -631,7 +631,7 @@ void pptx_text_context::Impl::start_list_item(bool restart)
if (restart && !list_style_stack_.empty())
{
const std::wstring curStyleName = current_list_style();
const std::wstring newStyleName = curStyleName + boost::lexical_cast<std::wstring>(new_list_style_number_++);
const std::wstring newStyleName = curStyleName + std::to_wstring(new_list_style_number_++);
list_style_renames_[curStyleName] = newStyleName;
odf_reader::list_style_container & lists = odf_context_.listStyleContainer();

View File

@ -143,9 +143,9 @@ public:
std::wstring style = std::wstring(L"position:absolute;");
style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;");
style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;");
style += std::wstring(L"margin-top:") + boost::lexical_cast<std::wstring>(c.top_) + std::wstring(L"pt;");
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(c.height_) + std::wstring(L"pt;");
if (c.visibly_ == false)style += std::wstring(L"visibility:hidden;");
@ -227,14 +227,14 @@ public:
if (c.author_ == author_list_[i])
{
find=true;
c.author_ = boost::lexical_cast<std::wstring>(i);
c.author_ = std::to_wstring(i);
break;
}
}
if (!find)
{
author_list_.push_back(c.author_);
c.author_ = boost::lexical_cast<std::wstring>(author_list_.size()-1);
c.author_ = std::to_wstring(author_list_.size()-1);
}
xlsx_comment_.push_back(c);
}

View File

@ -54,21 +54,21 @@ public:
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
{
const std::wstring file_id = boost::lexical_cast<std::wstring>(next_file_id_++);
const std::wstring file_id = std::to_wstring(next_file_id_++);
const std::wstring fileName = std::wstring(L"comments") + file_id + L".xml";
const std::wstring vml_fileName = std::wstring(L"vmlDrawing") + file_id + L".vml";
comments_.push_back(comment_elm(fileName,vml_fileName, content, vml_content, comments));
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(fileName, rId);
}
std::pair<std::wstring, std::wstring> get_vml_drawing_xml()
{
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(comments_.back().vml_filename, rId);
}

View File

@ -113,7 +113,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(L"xdr:cNvPicPr")
@ -158,7 +158,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
{

View File

@ -68,7 +68,7 @@ public:
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
{
const std::wstring id = boost::lexical_cast<std::wstring>(next_drawing_id_++);
const std::wstring id = std::to_wstring(next_drawing_id_++);
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
drawings_.push_back(drawing_elm(fileName, content, drawings));
const std::wstring rId = std::wstring(L"rId") + id;//rDrId
@ -173,6 +173,7 @@ void xlsx_drawing_context::clear()
impl_->object_description_.additional_.clear();
impl_->object_description_.hlinks_.clear();
impl_->object_description_.action_.clear();
impl_->object_description_.additional_.clear();
impl_->use_image_replacement_ = false;
@ -399,16 +400,17 @@ void xlsx_drawing_context::set_fill(_oox_fill & fill)
impl_->object_description_.fill_= fill;
}
std::wstring xlsx_drawing_context::add_hyperlink(std::wstring const & href,bool object)
std::wstring xlsx_drawing_context::add_hyperlink(std::wstring const & href)
{
++hlinks_size_;
std::wstring hId=std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_size_);
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
_hlink_desc desc = {hId, href_correct, object}; //корректность написания ссылки важна для ms office и не важна для open office ->
//todooo
//корректность написания ссылки важна для ms office и не важна для open office ->
//todooo
_hlink_desc desc = {hId, href_correct};
impl_->object_description_.hlinks_.push_back(desc);
return hId;
@ -464,6 +466,7 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
drawing.additional = obj.additional_;
drawing.hlinks = obj.hlinks_;
drawing.action = obj.action_;
}
void xlsx_drawing_context::process_position_properties(drawing_object_description & obj, xlsx_table_metrics & table_metrics,xlsx_table_position & from,xlsx_table_position & to)
{
@ -662,11 +665,33 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
impl_->serialize(strm);
}
xlsx_drawings_ptr xlsx_drawing_context::get_drawings()
{
return impl_->get_drawings();
}
void xlsx_drawing_context::start_action(std::wstring action)
{
impl_->object_description_.action_.enabled = true;
}
void xlsx_drawing_context::set_link(std::wstring link, RelsType typeRels)
{//hyprelinks only
++hlinks_size_;
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
link = xml::utils::replace_text_to_xml(link);
if (typeRels == typeHyperlink)
XmlUtils::replace_all( link, L" .", L"."); //1 (130).odt
impl_->object_description_.action_.hId = hId;
impl_->object_description_.action_.hRef = link;
impl_->object_description_.action_.typeRels = typeRels;
}
void xlsx_drawing_context::end_action()
{
}
}
}

View File

@ -111,7 +111,7 @@ public:
std::vector<odf_reader::_property> & get_properties();
std::wstring add_hyperlink(std::wstring const & ref, bool object);
std::wstring add_hyperlink(std::wstring const & ref);
void set_use_image_replacement();
@ -125,6 +125,10 @@ public:
void process_objects(xlsx_table_metrics & table_metrics);
void start_action(std::wstring action);
void set_link(std::wstring link, RelsType typeRels = typeHyperlink);
void end_action();
private:
class Impl;
_CP_PTR(Impl) impl_;

View File

@ -50,10 +50,12 @@ public:
add (isInternal, rid, ref, type, sheet_rel);
for (int i = 0 ; i < d.hlinks.size(); i++)
for (size_t i = 0; i < d.hlinks.size(); i++)
{
xlsx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
}
if (!d.action.hId.empty())
xlsx_drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
}
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel) //не объект
{

View File

@ -82,7 +82,7 @@ public:
record r;
r.ref = ref;
r.display = display;
r.id = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(records_.size()+1);
r.id = std::wstring(L"hId") + std::to_wstring(records_.size()+1);
int pos_target = target.find(L"#");
if (pos_target == 0)//ссыль на страницу или метку в текущем документе

View File

@ -191,6 +191,12 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
}
CP_XML_STREAM() << impl_->drawing_.str();
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}//props выше legacyDrawing !!
if (impl_->commentsId_.length()>0)
{
CP_XML_NODE(L"legacyDrawing")
@ -205,10 +211,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->ole_objects_.str();
}
}
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}
//CP_XML_NODE(L"headerFooter){}
//CP_XML_NODE(L"rowBreaks){}

View File

@ -128,7 +128,7 @@ void sheets_files::write(const std::wstring & RootPath)
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"sheet") + boost::lexical_cast<std::wstring>(count) + L".xml";
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
@ -136,7 +136,7 @@ void sheets_files::write(const std::wstring & RootPath)
if (rels_)
{
const std::wstring id = std::wstring(L"sId") + boost::lexical_cast<std::wstring>(count);
const std::wstring id = std::wstring(L"sId") + std::to_wstring(count);
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
rels_->add(id, kWSRel, fileRef);
@ -286,7 +286,7 @@ void xl_charts_files::write(const std::wstring & RootPath)
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml";
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";

View File

@ -66,7 +66,7 @@ std::wstring getColAddress(size_t col)
std::wstring getRowAddress(size_t row)
{
return boost::lexical_cast<std::wstring>(row + 1);
return std::to_wstring(row + 1);
}
std::wstring getCellAddress(size_t col, size_t row)

View File

@ -138,7 +138,7 @@ void xlsx_conversion_context::end_document()
{
xlsx_xml_worksheet_ptr& sheet = sheets_[i];
const std::wstring id = std::wstring(L"sId") + boost::lexical_cast<std::wstring>(i + 1);
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
package::sheet_content_ptr content = package::sheet_content::create();
////////////////////////////////////////////////////////////////////////////////////////////
@ -634,7 +634,7 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href)
}
else
{
std::wstring hId = get_drawing_context().add_hyperlink(href,false);
std::wstring hId = get_drawing_context().add_hyperlink(href);
xlsx_text_context_.end_hyperlink(hId);
xlsx_text_context_.end_span2();

View File

@ -58,6 +58,7 @@ const wchar_t * anim_par::name = L"par";
void anim_par::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
attlist_.add_attributes(Attributes);
}
void anim_par::pptx_convert(oox::pptx_conversion_context & Context)
@ -98,6 +99,7 @@ const wchar_t * anim_seq::name = L"seq";
void anim_seq::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
attlist_.add_attributes(Attributes);
}
void anim_seq::pptx_convert(oox::pptx_conversion_context & Context)
@ -115,22 +117,24 @@ void anim_seq::add_child_element( xml::sax * Reader, const std::wstring & Ns, co
////////////////////////////////////////////////////////////////
void anim_transition_filter_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"smil:direction", smil_direction_);
CP_APPLY_ATTR(L"smil:subtype", smil_subtype_);
CP_APPLY_ATTR(L"smil:type", smil_type_);
CP_APPLY_ATTR(L"smil:fadeColor", smil_fadeColor_);
CP_APPLY_ATTR(L"smil:mode", smil_mode_);
CP_APPLY_ATTR(L"smil:dur", smil_dur_);
}
void anim_audio_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"xlink:href", xlink_href_);
CP_APPLY_ATTR(L"anim:audio-level", anim_audio_level_);
}
const wchar_t * anim_transitionFilter::ns = L"anim";
const wchar_t * anim_transitionFilter::ns = L"anim";
const wchar_t * anim_transitionFilter::name = L"transitionFilter";
void anim_transitionFilter::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_anim_smil_attlist_.add_attributes(Attributes);
anim_transition_filter_attlist_.add_attributes(Attributes);
common_attlist_.add_attributes(Attributes);
filter_attlist_.add_attributes(Attributes);
}
void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
@ -142,20 +146,20 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
_CP_OPT(std::wstring) param;
if (anim_transition_filter_attlist_.smil_dur_)
if (common_attlist_.smil_dur_)
{
time = anim_transition_filter_attlist_.smil_dur_->get_value();
time = common_attlist_.smil_dur_->get_value();
}
if (anim_transition_filter_attlist_.smil_fadeColor_)
if (filter_attlist_.smil_fadeColor_)
{
color =anim_transition_filter_attlist_.smil_fadeColor_->get_hex_value();
color = filter_attlist_.smil_fadeColor_->get_hex_value();
}
smil_transition_type::type transition_type;
if (anim_transition_filter_attlist_.smil_type_)
if (filter_attlist_.smil_type_)
{
transition_type = anim_transition_filter_attlist_.smil_type_->get_type();
transition_type = filter_attlist_.smil_type_->get_type();
}
switch(transition_type)
@ -164,13 +168,13 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
type = L"split";
break;
case smil_transition_type::irisWipe:
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"diamond"))
if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"diamond"))
type = L"diamond";
else
type = L"zoom";
break;
case smil_transition_type::miscDiagonalWipe:
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"doubleDiamond"))
if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"doubleDiamond"))
type = L"diamond";
else
type = L"zoom";
@ -197,10 +201,10 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
case smil_transition_type::singleSweepWipe: //
case smil_transition_type::doubleFanWipe: //
type = L"wheel";
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"oneBlade")) param = L"1";
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"threeBlade"))param = L"3";
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"fourBlade")) param = L"4";
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"eightBlade"))param = L"8";
if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"oneBlade")) param = L"1";
else if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"threeBlade")) param = L"3";
else if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"fourBlade")) param = L"4";
else if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"eightBlade")) param = L"8";
break;
case smil_transition_type::fanWipe:
type = L"wedge";
@ -211,22 +215,22 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
break;
case smil_transition_type::checkerBoardWipe:
type = L"checker";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"across") dir = L"horz";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"down") dir = L"vert";
if (filter_attlist_.smil_subtype_.get()==L"across") dir = L"horz";
if (filter_attlist_.smil_subtype_.get()==L"down") dir = L"vert";
break;
case smil_transition_type::blindsWipe:
type = L"blinds";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
if (filter_attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
else if (filter_attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
break;
case smil_transition_type::diagonalWipe:
case smil_transition_type::waterfallWipe:
type = L"strips";
if (anim_transition_filter_attlist_.smil_subtype_)
if (filter_attlist_.smil_subtype_)
{
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontalLeft") dir = L"rd";
else if(anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontalRight")dir = L"lu";
else if(anim_transition_filter_attlist_.smil_subtype_.get()==L"verticalRight") dir = L"ld";
if (filter_attlist_.smil_subtype_.get() == L"horizontalLeft") dir = L"rd";
else if (filter_attlist_.smil_subtype_.get() == L"horizontalRight") dir = L"lu";
else if (filter_attlist_.smil_subtype_.get() == L"verticalRight") dir = L"ld";
else dir = L"ru";
}
break;
@ -235,13 +239,13 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
break;
case smil_transition_type::randomBarWipe:
type = L"randomBar";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
if (filter_attlist_.smil_subtype_.get() == L"vertical") dir = L"vert";
else if (filter_attlist_.smil_subtype_.get() == L"horizontal") dir = L"horz";
break;
case smil_transition_type::pushWipe:
type = L"push";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"combVertical") {type = L"comb"; dir = L"vert";};
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"combHorizontal") {type = L"comb"; dir = L"horz";};
if (filter_attlist_.smil_subtype_.get() == L"combVertical") {type = L"comb"; dir = L"vert";}
else if (filter_attlist_.smil_subtype_.get() == L"combHorizontal") {type = L"comb"; dir = L"horz";}
break;
case smil_transition_type::slideWipe:
type = L"pull";
@ -251,19 +255,19 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
break;
case smil_transition_type::barnDoorWipe:
type = L"split";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") param = L"vert";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") param = L"horz";
if (filter_attlist_.smil_subtype_.get() == L"vertical") param = L"vert";
if (filter_attlist_.smil_subtype_.get() == L"horizontal") param = L"horz";
break;
case smil_transition_type::barWipe:
type = L"wipe";
if (anim_transition_filter_attlist_.smil_subtype_)
if (filter_attlist_.smil_subtype_)
{
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopLeft") {type = L"strips"; dir = L"rd";}
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") {type = L"strips"; dir = L"ru";}
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopRight") {type = L"strips"; dir = L"ld";}
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomRight"){type = L"strips"; dir = L"lu";}
if (filter_attlist_.smil_subtype_.get()==L"fromTopLeft") {type = L"strips"; dir = L"rd";}
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") {type = L"strips"; dir = L"ru";}
else if (filter_attlist_.smil_subtype_.get()==L"fromTopRight") {type = L"strips"; dir = L"ld";}
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomRight") {type = L"strips"; dir = L"lu";}
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fadeOverColor") {type = L"fade"; param = L"0";}
else if (filter_attlist_.smil_subtype_.get()==L"fadeOverColor") {type = L"fade"; param = L"0";}
}
break;
///////////////////////////////////////////////////////
@ -281,44 +285,56 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
break;
//////////////////////////////////////////////////////
}
if (anim_transition_filter_attlist_.smil_subtype_)
if (filter_attlist_.smil_subtype_)
{
if (!dir)
{
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"leftToRight")
if (filter_attlist_.smil_subtype_.get()==L"leftToRight")
{
if ((anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse"))dir = L"l";
if ((common_attlist_.smil_direction_) && (common_attlist_.smil_direction_.get()==L"reverse"))dir = L"l";
else dir = L"r";
}
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topToBottom")
if (filter_attlist_.smil_subtype_.get()==L"topToBottom")
{
if ((anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse"))dir = L"u";
if ((common_attlist_.smil_direction_) && (common_attlist_.smil_direction_.get()==L"reverse"))dir = L"u";
else dir = L"d";
}
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
if (filter_attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
else if (filter_attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
else if (filter_attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
else if (filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
else if (filter_attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
else if (filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
else if (filter_attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
else if (filter_attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") dir = L"ru";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";
else if (filter_attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomLeft")dir = L"ru";
else if (filter_attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";
}
if (!dir && (anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse"))
if (!dir && (common_attlist_.smil_direction_) && (common_attlist_.smil_direction_.get()==L"reverse"))
dir = L"in";
}
Context.get_slide_context().set_transitionFilter(type , dir, param , time);
}
const wchar_t * anim_audio::ns = L"anim";
const wchar_t * anim_audio::name = L"audio";
void anim_audio::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_attlist_.add_attributes(Attributes);
audio_attlist_.add_attributes(Attributes);
}
void anim_audio::pptx_convert(oox::pptx_conversion_context & Context)
{
}
////////////////////////////////////////////////////////////////

View File

@ -45,7 +45,6 @@ namespace cpdoccore {
namespace odf_reader {
//anim:par
class anim_par : public office_element_impl<anim_par>//Параллельные анимации
{
@ -56,9 +55,11 @@ public:
static const ElementType type = typeAnimPar;
CPDOCCORE_DEFINE_VISITABLE();
office_element_ptr anim_par_;
office_element_ptr_array anim_seq_array_;
office_element_ptr_array content_;
odf_types::common_anim_smil_attlist attlist_;
office_element_ptr anim_par_;
office_element_ptr_array anim_seq_array_;
office_element_ptr_array content_;
virtual void pptx_convert(oox::pptx_conversion_context & Context);
@ -79,7 +80,8 @@ public:
static const ElementType type = typeAnimSeq;
CPDOCCORE_DEFINE_VISITABLE();
office_element_ptr_array anim_par_array_;
odf_types::common_anim_smil_attlist attlist_;
office_element_ptr_array anim_par_array_;
virtual void pptx_convert(oox::pptx_conversion_context & Context);
@ -92,26 +94,25 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(anim_seq);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim:iterate
//class anim_iterate : public office_element_impl<anim_iterate>//Итеративные анимации
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim-transition-filter-attlist
//-------------------------------------------------------------------------------
class anim_audio_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(std::wstring) xlink_href_;
_CP_OPT(std::wstring) anim_audio_level_;
};
class anim_transition_filter_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(std::wstring) smil_direction_;
_CP_OPT(std::wstring) smil_subtype_;
_CP_OPT(std::wstring) smil_subtype_;
_CP_OPT(odf_types::smil_transition_type) smil_type_;
_CP_OPT(std::wstring) smil_mode_;
_CP_OPT(odf_types::color) smil_fadeColor_;
_CP_OPT(odf_types::clockvalue) smil_dur_;
_CP_OPT(std::wstring) smil_mode_;
_CP_OPT(odf_types::color) smil_fadeColor_;
};
//anim:transitionFilter
class anim_transitionFilter : public office_element_impl<anim_transitionFilter>
{
public:
@ -122,11 +123,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
///////////////////////////////////////////////////////////
odf_types::common_anim_smil_attlist common_anim_smil_attlist_;
anim_transition_filter_attlist anim_transition_filter_attlist_;
odf_types::common_anim_smil_attlist common_attlist_;
anim_transition_filter_attlist filter_attlist_;
private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -135,7 +134,26 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(anim_transitionFilter);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim:audio
class anim_audio : public office_element_impl<anim_audio>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeAnimAudio;
CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
odf_types::common_anim_smil_attlist common_attlist_;
anim_audio_attlist audio_attlist_;
private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
};
CP_REGISTER_OFFICE_ELEMENT2(anim_audio);
//anim:command
}

View File

@ -41,27 +41,65 @@ namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
{
// 5ms = 5 milliseconds
_Wostream << _Val.get_value() << "ms"; // todoooo усложнить ..
// 5ms = 5 milliseconds
if (_Val.get_value() < 0)
_Wostream << L"indefinite";
else
{
int ms = _Val.get_value();
int sec = 0;
int min = 0;
int h = 0;
if (ms > 1000)
{
sec = ms / 1000;
ms -= sec * 1000;
if (sec > 60)
{
min = sec / 60;
sec -= min * 60;
if (min > 60)
{
h = min / 60;
min -= h * 60;
}
}
}
if ( h > 0)
_Wostream << h << "h";
if ( min > 0)
_Wostream << min << "min";
if ( sec > 0)
_Wostream << sec << "s";
if ( ms > 0)
_Wostream << ms << "ms";
if (h == 0 && min == 0 && ms == 0 && sec == 0)
_Wostream << "0s";
}
return _Wostream;
}
static bool parseTime(const std::wstring & Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
bool parseTime(std::wstring Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
{
try
{
boost::match_results<std::wstring::const_iterator> res;
//Full clock values:
// 02:30:03 = 2 hours, 30 minutes and 3 seconds
// 50:00:10.25 = 50 hours, 10 seconds and 250 milliseconds
boost::match_results<std::wstring::const_iterator> res1;
boost::wregex r1 (L"([\\d]+):([\\d]+):([\\d+(\\.\\d{0,})?]+)");
if (boost::regex_match(Time, res, r1))
if (boost::regex_match(Time, res1, r1))
{
Hours = boost::lexical_cast<int>(res[1].str());
Minutes = boost::lexical_cast<int>(res[2].str());
Seconds = boost::lexical_cast<double>(res[3].str());
Hours = boost::lexical_cast<int>(res1[1].str());
Minutes = boost::lexical_cast<int>(res1[2].str());
Seconds = boost::lexical_cast<double>(res1[3].str());
return true;
}
@ -69,11 +107,12 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
// 02:33 = 2 minutes and 33 seconds
// 00:10.5 = 10.5 seconds = 10 seconds and 500 milliseconds
std::wstring Time2 = L"00:10.5";
boost::match_results<std::wstring::const_iterator> res2;
boost::wregex r2 (L"([\\d]+):([\\d+(\\.\\d{0,})?]+)");
if (boost::regex_match(Time, res, r2))
if (boost::regex_match(Time, res2, r2))
{
Minutes = boost::lexical_cast<int>(res[1].str());
Seconds = boost::lexical_cast<double>(res[2].str());
Minutes = boost::lexical_cast<int>(res2[1].str());
Seconds = boost::lexical_cast<double>(res2[2].str());
return true;
}
@ -83,32 +122,51 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
// 30s = 30 seconds
// 5ms = 5 milliseconds
// 12.467 = 12 seconds and 467 milliseconds
boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]{0,})");
if (boost::regex_match(Time, res, r3))
{
if (!res[2].str().empty())
std::vector<std::wstring> values;
boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]+)");
if (boost::regex_split(std::back_inserter(values), Time, r3, boost::match_default | boost::format_all))
{
int val = -1;
for (size_t i = 0; i < values.size() ; i++ )
{
std::wstring n = res[2].str();
std::transform(n.begin(), n.end(), n.begin(), ::tolower);
if (n == L"h")
if (values[i].empty()) continue;
if (values[i] == L"h")
{
Hours = boost::lexical_cast<double>(res[1].str());
if (val >= 0)
Hours = val;
val = -1;
}
else if (n == L"min")
else if (values[i] == L"min")
{
Minutes = boost::lexical_cast<double>(res[1].str());
if (val >= 0)
Minutes = val;
val = -1;
}
else if (n == L"s")
else if (values[i] == L"s")
{
Seconds = boost::lexical_cast<double>(res[1].str());
if (val >= 0)
Seconds = val;
val = -1;
}
else if (n == L"ms")
else if (values[i] == L"ms")
{
Ms = boost::lexical_cast<int>(res[1].str());
if (val >= 0)
Ms = val;
val = -1;
}
else
{
try
{
val = boost::lexical_cast<double>(values[i]);
}
catch(...)
{
continue;
}
}
}
else
Seconds = boost::lexical_cast<double>(res[1].str());
return true;
}
@ -120,15 +178,20 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
}
clockvalue clockvalue::parse(const std::wstring & Str)
{
int v=0;
if (Str == L"indefinite")
return clockvalue(-1);
else
{
int v=0;
int ms=0;
double h=0,m=0,s =0;
bool res = parseTime(Str,h,m,s,ms);
int ms = 0;
double h = 0, m = 0, s = 0;
bool res = parseTime(Str, h, m, s, ms);
v = (((h*60)+m)*60+s)*1000+ms;
v = (((h * 60) + m) * 60 + s) * 1000 + ms;
return clockvalue(v);
return clockvalue(v);
}
}

View File

@ -804,18 +804,32 @@ void common_presentation_attlist::serialize(CP_ATTR_NODE)
void common_anim_smil_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
//CP_APPLY_ATTR(L"smil:direction", smil_direction_);
// CP_APPLY_ATTR(L"smil:subtype", smil_subtype_);
// CP_APPLY_ATTR(L"smil:type", smil_type_);
//CP_APPLY_ATTR(L"smil:dur", smil_dur_);
CP_APPLY_ATTR(L"presentation:node-type", presentation_node_type_);
CP_APPLY_ATTR(L"smil:direction", smil_direction_);
CP_APPLY_ATTR(L"smil:begin", smil_begin_);
CP_APPLY_ATTR(L"smil:end", smil_end_);
CP_APPLY_ATTR(L"smil:restart", smil_restart_);
CP_APPLY_ATTR(L"smil:dur", smil_dur_);
}
void common_anim_smil_attlist::apply_from(const common_anim_smil_attlist & Other)
{
//_CP_APPLY_PROP(smil_direction_, Other.smil_direction_);
//_CP_APPLY_PROP(smil_subtype_, Other.smil_subtype_);
//_CP_APPLY_PROP(smil_type_, Other.smil_type_);
// _CP_APPLY_PROP(smil_dur_, Other.smil_dur_);
_CP_APPLY_PROP(presentation_node_type_, Other.presentation_node_type_);
_CP_APPLY_PROP(smil_direction_, Other.smil_direction_);
_CP_APPLY_PROP(smil_begin_, Other.smil_begin_);
_CP_APPLY_PROP(smil_end_, Other.smil_end_);
_CP_APPLY_PROP(smil_restart_, Other.smil_restart_);
_CP_APPLY_PROP(smil_dur_, Other.smil_dur_);
}
void common_anim_smil_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"smil:direction", smil_direction_);
CP_XML_ATTR_OPT(L"smil:restart", smil_restart_);
CP_XML_ATTR_OPT(L"smil:dur", smil_dur_);
CP_XML_ATTR_OPT(L"presentation:node-type", presentation_node_type_);
CP_XML_ATTR_OPT(L"smil:begin", smil_begin_);
CP_XML_ATTR_OPT(L"smil:end", smil_end_);
}
void union_common_draw_attlists::serialize(CP_ATTR_NODE)
{

View File

@ -575,15 +575,16 @@ class common_anim_smil_attlist
public:
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_anim_smil_attlist & Other);
void serialize (CP_ATTR_NODE){}
void serialize (CP_ATTR_NODE);
//_CP_OPT(std::wstring) smil_direction_;
//_CP_OPT(std::wstring) smil_subtype_;
//_CP_OPT(std::wstring) smil_type_;
//_CP_OPT(std::wstring) smil_dur_;
_CP_OPT(std::wstring) presentation_node_type_;
//_CP_OPT(color) smil_fadeColor;
_CP_OPT(std::wstring) smil_direction_;
_CP_OPT(std::wstring) smil_restart_;
_CP_OPT(odf_types::clockvalue) smil_dur_;
_CP_OPT(std::wstring) smil_begin_;
_CP_OPT(std::wstring) smil_end_;
};
}

View File

@ -41,47 +41,47 @@ std::wostream & operator << (std::wostream & _Wostream, const smil_transition_ty
{
switch(_Val.get_type())
{
case smil_transition_type::barWipe : _Wostream << L"barwipe" ; break;
case smil_transition_type::boxWipe : _Wostream << L"boxwipe" ; break;
case smil_transition_type::fourBoxWipe : _Wostream << L"fourboxwipe" ; break;
case smil_transition_type::barnDoorWipe : _Wostream << L"barndoorwipe" ; break;
case smil_transition_type::diagonalWipe : _Wostream << L"diagonalwipe" ; break;
case smil_transition_type::bowTieWipe : _Wostream << L"bowtiewipe" ; break;
case smil_transition_type::miscDiagonalWipe : _Wostream << L"miscdiagonalwipe"; break;
case smil_transition_type::veeWipe : _Wostream << L"veewipe" ; break;
case smil_transition_type::barnVeeWipe : _Wostream << L"barnveewipe" ; break;
case smil_transition_type::zigZagWipe : _Wostream << L"zigzagwipe" ; break;
case smil_transition_type::barnZigZagWipe : _Wostream << L"barnzigzagwipe" ; break;
case smil_transition_type::irisWipe : _Wostream << L"iriswipe" ; break;
case smil_transition_type::triangleWipe : _Wostream << L"trianglewipe" ; break;
case smil_transition_type::arrowHeadWipe : _Wostream << L"arrowheadwipe" ; break;
case smil_transition_type::pentagonWipe : _Wostream << L"pentagonwipe" ; break;
case smil_transition_type::hexagonWipe : _Wostream << L"hexagonwipe" ; break;
case smil_transition_type::ellipseWipe : _Wostream << L"ellipsewipe" ; break;
case smil_transition_type::eyeWipe : _Wostream << L"eyewipe" ; break;
case smil_transition_type::roundRectWipe : _Wostream << L"roundrectwipe" ; break;
case smil_transition_type::starWipe : _Wostream << L"starwipe" ; break;
case smil_transition_type::miscShapeWipe : _Wostream << L"miscshapewipe" ; break;
case smil_transition_type::clockWipe : _Wostream << L"clockwipe" ; break;
case smil_transition_type::pinWheelWipe : _Wostream << L"pinwheelwipe" ; break;
case smil_transition_type::singleSweepWipe : _Wostream << L"singlesweepwipe" ; break;
case smil_transition_type::fanWipe : _Wostream << L"fanwipe" ; break;
case smil_transition_type::doubleFanWipe : _Wostream << L"doublefanwipe" ; break;
case smil_transition_type::doubleSweepWipe : _Wostream << L"doublesweepwipe" ; break;
case smil_transition_type::saloonDoorWipe : _Wostream << L"saloondoorwipe" ; break;
case smil_transition_type::windshieldWipe : _Wostream << L"windshieldwipe" ; break;
case smil_transition_type::snakeWipe : _Wostream << L"snakewipe" ; break;
case smil_transition_type::spiralWipe : _Wostream << L"spiralwipe" ; break;
case smil_transition_type::parallelSnakesWipe: _Wostream << L"parallelsnakeswipe"; break;
case smil_transition_type::boxSnakesWipe : _Wostream << L"boxsnakeswipe" ; break;
case smil_transition_type::waterfallWipe : _Wostream << L"waterfallwipe" ; break;
case smil_transition_type::pushWipe : _Wostream << L"pushwipe" ; break;
case smil_transition_type::slideWipe : _Wostream << L"slidewipe" ; break;
case smil_transition_type::barWipe : _Wostream << L"barWipe" ; break;
case smil_transition_type::boxWipe : _Wostream << L"boxWipe" ; break;
case smil_transition_type::fourBoxWipe : _Wostream << L"fourBoxWipe" ; break;
case smil_transition_type::barnDoorWipe : _Wostream << L"barnDoorWipe" ; break;
case smil_transition_type::diagonalWipe : _Wostream << L"diagonalWipe" ; break;
case smil_transition_type::bowTieWipe : _Wostream << L"bowTieWipe" ; break;
case smil_transition_type::miscDiagonalWipe : _Wostream << L"miscDiagonalWipe"; break;
case smil_transition_type::veeWipe : _Wostream << L"veeWipe" ; break;
case smil_transition_type::barnVeeWipe : _Wostream << L"barnVeeWipe" ; break;
case smil_transition_type::zigZagWipe : _Wostream << L"zigZagWipe" ; break;
case smil_transition_type::barnZigZagWipe : _Wostream << L"barnZigZagWipe" ; break;
case smil_transition_type::irisWipe : _Wostream << L"irisWipe" ; break;
case smil_transition_type::triangleWipe : _Wostream << L"triangleWipe" ; break;
case smil_transition_type::arrowHeadWipe : _Wostream << L"arrowHeadWipe" ; break;
case smil_transition_type::pentagonWipe : _Wostream << L"pentagonWipe" ; break;
case smil_transition_type::hexagonWipe : _Wostream << L"hexagonWipe" ; break;
case smil_transition_type::ellipseWipe : _Wostream << L"ellipseWipe" ; break;
case smil_transition_type::eyeWipe : _Wostream << L"eyeWipe" ; break;
case smil_transition_type::roundRectWipe : _Wostream << L"roundRectWipe" ; break;
case smil_transition_type::starWipe : _Wostream << L"starWipe" ; break;
case smil_transition_type::miscShapeWipe : _Wostream << L"miscShapeWipe" ; break;
case smil_transition_type::clockWipe : _Wostream << L"clockWipe" ; break;
case smil_transition_type::pinWheelWipe : _Wostream << L"pinWheelWipe" ; break;
case smil_transition_type::singleSweepWipe : _Wostream << L"singleSweepWipe" ; break;
case smil_transition_type::fanWipe : _Wostream << L"fanWipe" ; break;
case smil_transition_type::doubleFanWipe : _Wostream << L"doubleFanWipe" ; break;
case smil_transition_type::doubleSweepWipe : _Wostream << L"doubleSweepWipe" ; break;
case smil_transition_type::saloonDoorWipe : _Wostream << L"saloonDoorWipe" ; break;
case smil_transition_type::windshieldWipe : _Wostream << L"windshieldWipe" ; break;
case smil_transition_type::snakeWipe : _Wostream << L"snakeWipe" ; break;
case smil_transition_type::spiralWipe : _Wostream << L"spiralWipe" ; break;
case smil_transition_type::parallelSnakesWipe: _Wostream << L"parallelSnakesWipe"; break;
case smil_transition_type::boxSnakesWipe : _Wostream << L"boxSnakesWipe" ; break;
case smil_transition_type::waterfallWipe : _Wostream << L"waterfallWipe" ; break;
case smil_transition_type::pushWipe : _Wostream << L"pushWipe" ; break;
case smil_transition_type::slideWipe : _Wostream << L"slideWipe" ; break;
case smil_transition_type::fade : _Wostream << L"fade" ; break;
case smil_transition_type::checkerBoardWipe : _Wostream << L"checkerboardwipe"; break;
case smil_transition_type::blindsWipe : _Wostream << L"blindswipe" ; break;
case smil_transition_type::checkerBoardWipe : _Wostream << L"checkerboardWipe"; break;
case smil_transition_type::blindsWipe : _Wostream << L"blindsWipe" ; break;
case smil_transition_type::dissolve : _Wostream << L"dissolve" ; break;
case smil_transition_type::randomBarWipe : _Wostream << L"randombarwipe" ; break;
case smil_transition_type::randomBarWipe : _Wostream << L"randomBarWipe" ; break;
}
return _Wostream;
}
@ -91,47 +91,47 @@ smil_transition_type smil_transition_type::parse(const std::wstring & Str)
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if(tmp == L"barwipe") return smil_transition_type( barWipe );
else if(tmp == L"boxwipe") return smil_transition_type( boxWipe );
else if(tmp == L"fourboxwipe") return smil_transition_type( fourBoxWipe );
else if(tmp == L"barndoorwipe") return smil_transition_type( barnDoorWipe );
else if(tmp == L"diagonalwipe") return smil_transition_type( diagonalWipe );
else if(tmp == L"bowtiewipe") return smil_transition_type( bowTieWipe );
else if(tmp == L"miscdiagonalwipe") return smil_transition_type( miscDiagonalWipe );
else if(tmp == L"veewipe") return smil_transition_type( veeWipe );
else if(tmp == L"barnveewipe") return smil_transition_type( barnVeeWipe );
else if(tmp == L"zigzagwipe") return smil_transition_type( zigZagWipe );
else if(tmp == L"barnzigzagwipe") return smil_transition_type( barnZigZagWipe );
else if(tmp == L"iriswipe") return smil_transition_type( irisWipe);
else if(tmp == L"trianglewipe") return smil_transition_type( triangleWipe);
else if(tmp == L"arrowheadwipe") return smil_transition_type( arrowHeadWipe );
else if(tmp == L"pentagonwipe") return smil_transition_type( pentagonWipe );
else if(tmp == L"hexagonwipe") return smil_transition_type( hexagonWipe );
else if(tmp == L"ellipsewipe") return smil_transition_type( ellipseWipe );
else if(tmp == L"eyewipe") return smil_transition_type( eyeWipe );
else if(tmp == L"roundrectwipe") return smil_transition_type( roundRectWipe );
else if(tmp == L"starwipe") return smil_transition_type( starWipe );
else if(tmp == L"miscshapewipe") return smil_transition_type( miscShapeWipe );
else if(tmp == L"clockwipe") return smil_transition_type( clockWipe );
else if(tmp == L"pinwheelwipe") return smil_transition_type( pinWheelWipe );
else if(tmp == L"singlesweepwipe") return smil_transition_type( singleSweepWipe);
else if(tmp == L"fanwipe") return smil_transition_type( fanWipe );
else if(tmp == L"doublefanwipe") return smil_transition_type( doubleFanWipe );
else if(tmp == L"doublesweepwipe") return smil_transition_type( doubleSweepWipe );
else if(tmp == L"saloondoorwipe") return smil_transition_type( saloonDoorWipe );
else if(tmp == L"windshieldwipe") return smil_transition_type( windshieldWipe );
else if(tmp == L"snakewipe") return smil_transition_type( snakeWipe );
else if(tmp == L"spiralwipe") return smil_transition_type( spiralWipe );
else if(tmp == L"parallelsnakeswipe")return smil_transition_type( parallelSnakesWipe );
else if(tmp == L"boxsnakeswipe") return smil_transition_type( boxSnakesWipe );
else if(tmp == L"waterfallwipe") return smil_transition_type( waterfallWipe );
else if(tmp == L"pushwipe") return smil_transition_type( pushWipe );
else if(tmp == L"slidewipe") return smil_transition_type( slideWipe );
if(tmp == L"barWipe") return smil_transition_type( barWipe );
else if(tmp == L"boxWipe") return smil_transition_type( boxWipe );
else if(tmp == L"fourboxWipe") return smil_transition_type( fourBoxWipe );
else if(tmp == L"barndoorWipe") return smil_transition_type( barnDoorWipe );
else if(tmp == L"diagonalWipe") return smil_transition_type( diagonalWipe );
else if(tmp == L"bowtieWipe") return smil_transition_type( bowTieWipe );
else if(tmp == L"miscdiagonalWipe") return smil_transition_type( miscDiagonalWipe );
else if(tmp == L"veeWipe") return smil_transition_type( veeWipe );
else if(tmp == L"barnveeWipe") return smil_transition_type( barnVeeWipe );
else if(tmp == L"zigzagWipe") return smil_transition_type( zigZagWipe );
else if(tmp == L"barnzigzagWipe") return smil_transition_type( barnZigZagWipe );
else if(tmp == L"irisWipe") return smil_transition_type( irisWipe);
else if(tmp == L"triangleWipe") return smil_transition_type( triangleWipe);
else if(tmp == L"arrowheadWipe") return smil_transition_type( arrowHeadWipe );
else if(tmp == L"pentagonWipe") return smil_transition_type( pentagonWipe );
else if(tmp == L"hexagonWipe") return smil_transition_type( hexagonWipe );
else if(tmp == L"ellipseWipe") return smil_transition_type( ellipseWipe );
else if(tmp == L"eyeWipe") return smil_transition_type( eyeWipe );
else if(tmp == L"roundrectWipe") return smil_transition_type( roundRectWipe );
else if(tmp == L"starWipe") return smil_transition_type( starWipe );
else if(tmp == L"miscshapeWipe") return smil_transition_type( miscShapeWipe );
else if(tmp == L"clockWipe") return smil_transition_type( clockWipe );
else if(tmp == L"pinwheelWipe") return smil_transition_type( pinWheelWipe );
else if(tmp == L"singlesweepWipe") return smil_transition_type( singleSweepWipe);
else if(tmp == L"fanWipe") return smil_transition_type( fanWipe );
else if(tmp == L"doublefanWipe") return smil_transition_type( doubleFanWipe );
else if(tmp == L"doublesweepWipe") return smil_transition_type( doubleSweepWipe );
else if(tmp == L"saloondoorWipe") return smil_transition_type( saloonDoorWipe );
else if(tmp == L"windshieldWipe") return smil_transition_type( windshieldWipe );
else if(tmp == L"snakeWipe") return smil_transition_type( snakeWipe );
else if(tmp == L"spiralWipe") return smil_transition_type( spiralWipe );
else if(tmp == L"parallelsnakesWipe")return smil_transition_type( parallelSnakesWipe );
else if(tmp == L"boxsnakesWipe") return smil_transition_type( boxSnakesWipe );
else if(tmp == L"waterfallWipe") return smil_transition_type( waterfallWipe );
else if(tmp == L"pushWipe") return smil_transition_type( pushWipe );
else if(tmp == L"slideWipe") return smil_transition_type( slideWipe );
else if(tmp == L"fade") return smil_transition_type( fade );
else if(tmp == L"checkerboardwipe") return smil_transition_type( checkerBoardWipe);
else if(tmp == L"blindswipe") return smil_transition_type( blindsWipe);
else if(tmp == L"checkerboardWipe") return smil_transition_type( checkerBoardWipe);
else if(tmp == L"blindsWipe") return smil_transition_type( blindsWipe);
else if(tmp == L"dissolve") return smil_transition_type( dissolve);
else if(tmp == L"randombarwipe") return smil_transition_type( randomBarWipe);
else if(tmp == L"randombarWipe") return smil_transition_type( randomBarWipe);
else
{
return smil_transition_type( barWipe );

View File

@ -112,9 +112,10 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
std::vector<length> Points_pt;
boost::algorithm::split(Points,strClipping, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring const & p, Points)
for (size_t i = 0; i < Points.size(); i++)
{
Points_pt.push_back(length::parse(p) );
Points_pt.push_back(length::parse(Points[i]) );
if (Points_pt.back().get_value() > 0.00001) bEnableCrop = true;
}
@ -125,8 +126,6 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
if (!_image_file_::GetResolution(fileName.data(), fileWidth, fileHeight, appFonts) || fileWidth<1 || fileHeight<1) return false;
if (Points_pt.size() > 3)//если другое количество точек .. попозже
{
float dpi_ = 96.;
@ -561,30 +560,33 @@ 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().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""),true);
//стиль на текст не нужен ..текста то нет - ссылка с объекта
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().end_action();
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
}
void draw_a::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""),true);//стиль на текст не нужен ..текста то нет - ссылка с объекта
BOOST_FOREACH(const office_element_ptr & elm, content_)
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().end_action();
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(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);//гиперлинк с объекта, а не с текста ..
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->docx_convert(Context);
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
@ -596,9 +598,9 @@ void parse_string_to_points(std::wstring str, std::vector<length> & Points)
boost::algorithm::split(Points_s,str, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring const & p, Points_s)
for (size_t i = 0; i < Points_s.size(); i++)
{
Points.push_back(length::parse(p) );
Points.push_back(length::parse(Points_s[i]) );
}
}
@ -608,12 +610,12 @@ void oox_convert_transforms(std::wstring transformStr,std::vector<odf_reader::_p
boost::algorithm::split(transforms,transformStr, boost::algorithm::is_any_of(L")"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring const & t, transforms)
for (size_t i = 0; i < transforms.size(); i++)
{
//_CP_LOG << "[info] : transform = " << t << L"\n";
std::vector<std::wstring> transform;
boost::algorithm::split(transform,t, boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);
boost::algorithm::split(transform, transforms[i], boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);
if (transform.size() > 1)//тока с аргументами
{
@ -725,11 +727,11 @@ void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_con
boost::algorithm::split(transforms,transformStr, boost::algorithm::is_any_of(L")"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring const & t, transforms)
for (size_t i = 0; i < transforms.size(); i++)
{
//_CP_LOG << "[info] : transform = " << t << L"\n";
std::vector<std::wstring> transform;
boost::algorithm::split(transform,t, boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);
boost::algorithm::split(transform, transforms[i], boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);
if (transform.size()>1)//тока с аргументами
{

View File

@ -383,6 +383,38 @@ std::wstring draw_object::office_convert(odf_document * odfDocument, int type)
return href_result;
}
// draw:param
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_param::ns = L"draw";
const wchar_t * draw_param::name = L"param";
void draw_param::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:name", draw_name_);
CP_APPLY_ATTR(L"draw:value", draw_value_);
}
void draw_param::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
// draw:plugin
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_plugin::ns = L"draw";
const wchar_t * draw_plugin::name = L"plugin";
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);
}
void draw_plugin::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
}
}

View File

@ -332,5 +332,56 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole);
// draw:param
class draw_param : public office_element_impl<draw_param>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawParam;
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);
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_value_;
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_param);
// draw:plugin
class draw_plugin : public office_element_impl<draw_plugin>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawPlugin;
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::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) draw_mime_type_;
office_element_ptr_array 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);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_plugin);
}
}

View File

@ -831,7 +831,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
if (*zIndex < 0)
drawing->relativeHeight = L"0";
else
drawing->relativeHeight = boost::lexical_cast<std::wstring>( 2 + *zIndex );
drawing->relativeHeight = std::to_wstring( 2 + *zIndex );
}
if (drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough
@ -1111,10 +1111,13 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
oox::hyperlinks::_ref hyperlink = Context.last_hyperlink();
//нужно еще систему конроля - могут придте уже "использованные" линки с картинок - из колонтитулов (но на них уже использовали релсы)
//дыра осталась если картинка в картинке - линк продублируется с внутренней на внешнюю
if (hyperlink.drawing == true && hyperlink.used_rels == false)
{
oox::_hlink_desc desc = {hyperlink.id, hyperlink.href, true};
drawing->hlinks.push_back(desc);
{//link from object
drawing->action.enabled = true;
drawing->action.hId = hyperlink.id;
drawing->action.hRef = hyperlink.href;
drawing->action.typeRels= oox::typeHyperlink;
}
/////////
drawing->fill.bitmap = oox::oox_bitmap_fill::create();

View File

@ -92,6 +92,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L"");
Context.get_slide_context().set_name(name);
//////////////////////////////////////////////////////////////////////////
const _CP_OPT(length) svg_widthVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_;
const _CP_OPT(length) svg_heightVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_;
@ -248,9 +249,9 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
std::wstring text_content_ = Context.get_text_context().end_object();
if (text_content_.length()>0)
if (!text_content_.empty())
{
Context.get_slide_context().set_property(_property(L"text-content",text_content_));
Context.get_slide_context().set_property(_property(L"text-content", text_content_));
}
}
void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
@ -358,6 +359,28 @@ void draw_object_ole::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_ole_object(href, detectObject(objectPath));
}
void draw_param::pptx_convert(oox::pptx_conversion_context & Context)
{
if (!draw_name_ && !draw_value_) return;
Context.get_slide_context().set_media_param(*draw_name_, *draw_value_);
}
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 folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
Context.get_slide_context().set_media(href);
//params
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
}
}
}

View File

@ -239,7 +239,7 @@ std::pair<int,std::wstring> presentation_layouts_instance::add_or_find(const std
item.layout_name = layout_name;
item.master_name = master_name;
item.Id = content.size() +1;
item.rId = std::wstring(L"lrId") + boost::lexical_cast<std::wstring>(item.Id);
item.rId = std::wstring(L"lrId") + std::to_wstring(item.Id);
content.push_back(item);
index = content.size()-1;
@ -265,7 +265,7 @@ std::pair<int,std::wstring> presentation_masters_instance::add_or_find(const std
presentation_masters_instance::_master item;
item.master_name = master_name;
item.Id = content.size() +1;
item.rId = std::wstring(L"smId") + boost::lexical_cast<std::wstring>(item.Id);
item.rId = std::wstring(L"smId") + std::to_wstring(item.Id);
content.push_back(item);
index = content.size()-1;

View File

@ -164,6 +164,7 @@ enum ElementType
typeStyleFooterStyle,
typeStyleHeaderFooterProperties,
typeStylePresentationSound,
typeStylePresentationPageLayout,
typeStylePresentationPlaceholder,
typeStyleDrawingPageProperties,
@ -290,6 +291,8 @@ enum ElementType
typeDrawObject,
typeDrawObjectOle,
typeDrawChart,
typeDrawParam,
typeDrawPlugin,
typeDrawShape,
@ -321,6 +324,9 @@ enum ElementType
typeAnimPar,
typeAnimSeq,
typeAnimTransitionFilter,
typeAnimAudio,
typeAnimCommand,
typeAnimIterate,
typeStyleGraphicPropertis,
typeStyleDrawGradient,

View File

@ -47,8 +47,8 @@ namespace odf_reader {
// office:event_listeners
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_event_listeners::ns = L"office";
const wchar_t * office_event_listeners::name = L"event-listeners";
const wchar_t * office_event_listeners::ns = L"office";
const wchar_t * office_event_listeners::name = L"event-listeners";
void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
@ -56,18 +56,18 @@ void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attr
void office_event_listeners::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"presentation", L"event-listener")
CP_CREATE_ELEMENT(presentation_event_listeners_);
else if CP_CHECK_NAME(L"script", L"event-listener")
CP_CREATE_ELEMENT(script_event_listeners_);
else
if CP_CHECK_NAME (L"presentation", L"event-listener")
CP_CREATE_ELEMENT (presentation_event_listeners_);
else if CP_CHECK_NAME (L"script", L"event-listener")
CP_CREATE_ELEMENT (script_event_listeners_);
else
CP_NOT_APPLICABLE_ELM();
}
void office_event_listeners::pptx_convert(oox::pptx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, presentation_event_listeners_)
for (size_t i = 0; i < presentation_event_listeners_.size(); i++)
{
elm->pptx_convert(Context);
presentation_event_listeners_[i]->pptx_convert(Context);
}
}
// presentation:event-listener-attlist
@ -77,7 +77,7 @@ void presentation_event_listener_attlist::add_attributes( const xml::attributes_
{
common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"script:event_name", script_event_name_);
CP_APPLY_ATTR(L"script:event-name", script_event_name_);
CP_APPLY_ATTR(L"presentation:action", presentation_action_);
//...
@ -89,7 +89,7 @@ const wchar_t * presentation_event_listener::name = L"event-listener";
void presentation_event_listener::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
presentation_event_listener_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void presentation_event_listener::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -101,12 +101,16 @@ void presentation_event_listener::add_child_element( xml::sax * Reader, const st
}
void presentation_event_listener::pptx_convert(oox::pptx_conversion_context & Context)
{
common_xlink_attlist & xlink = presentation_event_listener_attlist_.common_xlink_attlist_;
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 (xlink.href_)
if (presentation_sound_)
{
Context.get_slide_context().add_hyperlink(*xlink.href_,true);
presentation_sound_->pptx_convert(Context);
}
Context.get_slide_context().end_action();
}
// script:event-listener

View File

@ -43,7 +43,6 @@
namespace cpdoccore {
namespace odf_reader {
// office:event-listeners
class office_event_listeners : public office_element_impl<office_event_listeners>
{
public:
@ -62,20 +61,17 @@ private:
private:
office_element_ptr_array presentation_event_listeners_;
office_element_ptr_array script_event_listeners_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// presentation-event-listener-attlist
//-------------------------------------------------------------------------------------
class presentation_event_listener_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) script_event_name_;
@ -87,7 +83,6 @@ public:
//presentation:effect
};
// presentation:event-listeners_
class presentation_event_listener : public office_element_impl<presentation_event_listener>
{
public:
@ -104,9 +99,9 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
private:
//office_element_ptr_array content_;
office_element_ptr presentation_sound_;
presentation_event_listener_attlist presentation_event_listener_attlist_;
//office_element_ptr_array content_;
office_element_ptr presentation_sound_;
presentation_event_listener_attlist attlist_;
};

View File

@ -34,8 +34,6 @@
#include "office_presentation.h"
#include "draw_page.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -76,9 +74,10 @@ void office_presentation::docx_convert(oox::docx_conversion_context & Context)
{
Context.start_office_text();
_CP_LOG << L"[info][docx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->docx_convert(Context);
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->docx_convert(Context);
}
Context.end_office_text();
}
@ -87,9 +86,10 @@ void office_presentation::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_office_spreadsheet(this);
_CP_LOG << L"[info][xlsx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->xlsx_convert(Context);
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->xlsx_convert(Context);
}
Context.end_office_spreadsheet();
}
@ -100,29 +100,29 @@ void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
_CP_LOG << L"[info][pptx] process pages(" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, footer_decls_)
for (size_t i = 0; i < footer_decls_.size(); i++)
{
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(elm.get());
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(footer_decls_[i].get());
if (!style)
continue;
std::wstring style_name_ = L"footer:" + style->presentation_name_.get_value_or(L"");
Context.root()->odf_context().drawStyles().add(style_name_, elm);
Context.root()->odf_context().drawStyles().add(style_name_, footer_decls_[i]);
}
BOOST_FOREACH(const office_element_ptr & elm, date_time_decls_)
{
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(elm.get());
for (size_t i = 0; i < date_time_decls_.size(); i++)
{
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(date_time_decls_[i].get());
if (!style)
continue;
std::wstring style_name_ = L"datetime:" + style->presentation_name_.get_value_or(L"");
Context.root()->odf_context().drawStyles().add(style_name_, elm);
Context.root()->odf_context().drawStyles().add(style_name_, date_time_decls_[i]);
}
BOOST_FOREACH(const office_element_ptr & elm, pages_)
for (size_t i = 0; i < pages_.size(); i++)
{
elm->pptx_convert(Context);
pages_[i]->pptx_convert(Context);
}
Context.end_office_presentation();
}

View File

@ -555,7 +555,7 @@ void a::pptx_convert(oox::pptx_conversion_context & Context)
elm->pptx_convert(Context);
}
std::wstring hId = Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""),false);
std::wstring hId = Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""));
Context.get_text_context().end_hyperlink(hId);
}

View File

@ -73,11 +73,11 @@ std::wstring process_border(const border_style & borderStyle,
if (szInt <= 0)
szInt = 1;
w_sz = boost::lexical_cast<std::wstring>( szInt );
w_sz = std::to_wstring( szInt );
w_color = borderStyle.get_color().get_hex_value();
if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
w_space = std::to_wstring((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
switch(borderStyle.get_style())
{
@ -118,7 +118,7 @@ std::wstring docx_process_margin(const _CP_OPT(length_or_percent) & margin, doub
if (margin->get_type() == length_or_percent::Length)
{
int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(length::pt));
return boost::lexical_cast<std::wstring>( val );
return std::to_wstring( val );
}
else
{
@ -298,7 +298,7 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
{
if (fo_line_height_->get_type() == line_width::Percent)
{
w_line = boost::lexical_cast<std::wstring>( (int)( 0.5 + fo_line_height_->get_percent().get_value() * 240.0 / 100.0 ) );
w_line = std::to_wstring( (int)( 0.5 + fo_line_height_->get_percent().get_value() * 240.0 / 100.0 ) );
w_lineRule = L"auto";
}
else if(fo_line_height_->get_type() == line_width::Normal)
@ -308,19 +308,19 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
}
else if (fo_line_height_->get_type() == line_width::PositiveLength)
{
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 20.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_line = std::to_wstring((int)(0.5 + 20.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_lineRule = L"exact";
}
}
else if (style_line_height_at_least_)
{
w_lineRule = L"atLeast";
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 20.0 * style_line_height_at_least_->get_value_unit(length::pt)));
w_line = std::to_wstring((int)(0.5 + 20.0 * style_line_height_at_least_->get_value_unit(length::pt)));
}
else if (style_line_spacing_)
{
w_lineRule = L"auto";
w_line = boost::lexical_cast<std::wstring>( (int)(0.5 + 240.0 + 20.0 * style_line_spacing_->get_value_unit(length::pt)) );
w_line = std::to_wstring( (int)(0.5 + 240.0 + 20.0 * style_line_spacing_->get_value_unit(length::pt)) );
}
CP_XML_NODE(L"w:spacing")
{

View File

@ -70,11 +70,11 @@ std::wstring process_border(border_style & borderStyle,
if (szInt <= 0) szInt = 1;
w_sz = boost::lexical_cast<std::wstring>( szInt );
w_sz = std::to_wstring( szInt );
w_color = borderStyle.get_color().get_hex_value();
if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt)) );
w_space = std::to_wstring((int)(borderPadding->get_value_unit(length::pt)) );
switch(borderStyle.get_style())
{
@ -113,7 +113,7 @@ std::wstring pptx_process_margin(const _CP_OPT(length_or_percent) & margin, leng
if (margin->get_type() == length_or_percent::Length)
{
int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(unit));
return boost::lexical_cast<std::wstring>( val );
return std::to_wstring( val );
}
else
{
@ -190,7 +190,7 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
if (fo_line_height_->get_type() == line_width::Percent)
{
double percent = fo_line_height_->get_percent().get_value();
w_line = boost::lexical_cast<std::wstring>( (int)( 0.5 + percent *1000. ) );
w_line = std::to_wstring( (int)( 0.5 + percent *1000. ) );
w_lineRule = L"a:spcPct";
}
//else if(fo_line_height_->get_type() == line_width::Normal)
@ -198,19 +198,19 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
//}
else if (fo_line_height_->get_type() == line_width::PositiveLength)
{
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 100.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_line = std::to_wstring((int)(0.5 + 100.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_lineRule = L"a:spcPts";
}
}
else if (style_line_height_at_least_)
{
w_lineRule = L"a:spcPts";
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 100.0 * style_line_height_at_least_->get_value_unit(length::pt)));
w_line = std::to_wstring((int)(0.5 + 100.0 * style_line_height_at_least_->get_value_unit(length::pt)));
}
else if (style_line_spacing_)
{
w_lineRule = L"a:spcPts";
w_line = boost::lexical_cast<std::wstring>( (int)(0.5 + 240.0 + 100.0 * style_line_spacing_->get_value_unit(length::pt)) );
w_line = std::to_wstring( (int)(0.5 + 240.0 + 100.0 * style_line_spacing_->get_value_unit(length::pt)) );
}
CP_XML_NODE(L"a:lnSpc")
@ -422,7 +422,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
if (fo_line_height_->get_type() == line_width::Percent)
{
double percent = fo_line_height_->get_percent().get_value();
w_line = boost::lexical_cast<std::wstring>( (int)( 0.5 + percent *1000. ) );
w_line = std::to_wstring( (int)( 0.5 + percent *1000. ) );
w_lineRule = L"a:spcPct";
}
//else if(fo_line_height_->get_type() == line_width::Normal)
@ -430,19 +430,19 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
//}
else if (fo_line_height_->get_type() == line_width::PositiveLength)
{
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 100.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_line = std::to_wstring((int)(0.5 + 100.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_lineRule = L"a:spcPts";
}
}
else if (style_line_height_at_least_)
{
w_lineRule = L"a:spcPts";
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 100.0 * style_line_height_at_least_->get_value_unit(length::pt)));
w_line = std::to_wstring((int)(0.5 + 100.0 * style_line_height_at_least_->get_value_unit(length::pt)));
}
else if (style_line_spacing_)
{
w_lineRule = L"a:spcPts";
w_line = boost::lexical_cast<std::wstring>( (int)(0.5 + 240.0 + 100.0 * style_line_spacing_->get_value_unit(length::pt)) );
w_line = std::to_wstring( (int)(0.5 + 240.0 + 100.0 * style_line_spacing_->get_value_unit(length::pt)) );
}
CP_XML_NODE(L"a:lnSpc")

View File

@ -42,12 +42,8 @@ namespace cpdoccore {
namespace odf_reader {
//
// style:chart-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_placeholder::ns = L"presentation";
const wchar_t * presentation_placeholder::name = L"placeholder";
const wchar_t * presentation_placeholder::ns = L"presentation";
const wchar_t * presentation_placeholder::name = L"placeholder";
void presentation_placeholder::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
@ -88,9 +84,26 @@ void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Conte
Context.get_slide_context().end_shape();
}
//-------------------------------------------------------------------------------------------------
const wchar_t * presentation_sound::ns = L"presentation";
const wchar_t * presentation_sound::name = L"sound";
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_drawing_page_properties::ns = L"style";
void presentation_sound::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
}
void presentation_sound::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
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);
}
//-------------------------------------------------------------------------------------------------
const wchar_t * style_drawing_page_properties::ns = L"style";
const wchar_t * style_drawing_page_properties::name = L"drawing-page-properties";
void style_drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
@ -99,7 +112,10 @@ void style_drawing_page_properties::add_attributes( const xml::attributes_wc_ptr
}
void style_drawing_page_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
if CP_CHECK_NAME(L"presentation", L"sound")
CP_CREATE_ELEMENT(drawing_page_properties_.presentation_sound_);
else
CP_NOT_APPLICABLE_ELM();
}
void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
@ -119,6 +135,7 @@ void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Att
CP_APPLY_ATTR(L"presentation:display-page-number", presentation_display_page_number_);
CP_APPLY_ATTR(L"presentation:display-date-time", presentation_display_date_time_);
CP_APPLY_ATTR(L"presentation:display-header", presentation_display_header_);
CP_APPLY_ATTR(L"presentation:page-duration", presentation_page_duration_);
}
void drawing_page_properties::apply_from(const drawing_page_properties & Other)
{
@ -137,6 +154,8 @@ void drawing_page_properties::apply_from(const drawing_page_properties & Other)
_CP_APPLY_PROP2(presentation_display_page_number_);
_CP_APPLY_PROP2(presentation_display_date_time_);
_CP_APPLY_PROP2(presentation_display_header_);
_CP_APPLY_PROP2(presentation_page_duration_);
}
}

View File

@ -49,7 +49,6 @@ namespace cpdoccore {
namespace odf_reader {
// presentation:placeholder
class presentation_placeholder : public office_element_impl<presentation_placeholder>
{
public:
@ -76,13 +75,34 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_placeholder);
//-------------------------------------------------------------------------------------------
//////////////////////////////////////////////
class presentation_sound : public office_element_impl<presentation_sound>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStylePresentationSound;
CPDOCCORE_DEFINE_VISITABLE();
odf_types::common_xlink_attlist common_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);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_sound);
//-------------------------------------------------------------------------------------------
class drawing_page_properties
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const drawing_page_properties & Other);
void apply_from(const drawing_page_properties & Other);
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
anim_transition_filter_attlist anim_transition_filter_attlist_;
@ -90,27 +110,28 @@ public:
_CP_OPT(odf_types::length_or_percent) draw_fill_image_height_;
_CP_OPT(odf_types::length_or_percent) draw_fill_image_width_;
_CP_OPT(std::wstring) draw_background_size_;//"border" or "full"
_CP_OPT(std::wstring) draw_background_size_; //"border" or "full"
_CP_OPT(std::wstring) presentation_transition_type_;//manual, automatic, semi-automatic (переход отделен от эффектов кликом)
_CP_OPT(std::wstring) presentation_transition_style_;//none, fade, move, uncover,clockwise, .... игнор если smil
_CP_OPT(std::wstring) presentation_transition_speed_;//slow, medium, fast
_CP_OPT(std::wstring) presentation_transition_type_; //manual, automatic, semi-automatic (переход отделен от эффектов кликом)
_CP_OPT(std::wstring) presentation_transition_style_; //none, fade, move, uncover,clockwise, .... игнор если smil
_CP_OPT(std::wstring) presentation_transition_speed_; //slow, medium, fast
_CP_OPT(bool) presentation_display_footer_;
_CP_OPT(bool) presentation_display_page_number_;
_CP_OPT(bool) presentation_display_date_time_;
_CP_OPT(bool) presentation_display_header_;
_CP_OPT(std::wstring) presentation_page_duration_;
office_element_ptr presentation_sound_;
//presentation:background-objects-visible
//presentation:background-visible
//style:repeat
//presentation:page-duration
//presentation:visibility.
//presentation:sound.
//draw:background-size
};
//style:drawing-page-properties
class style_drawing_page_properties : public office_element_impl<style_drawing_page_properties>
{
public:

View File

@ -131,7 +131,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
}
}
else //if (table_align_->get_type() == table_align::Center)
w_val = boost::lexical_cast<std::wstring>(*table_align_);
w_val = boost::lexical_cast<std::wstring>(*table_align_);
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
}
@ -432,7 +432,7 @@ void insert_cell_border(oox::docx_conversion_context & Context,
else if (w_sz_ > 96.0)
w_sz_ = 96.0;
w_sz = boost::lexical_cast<std::wstring>( w_sz_ );
w_sz = std::to_wstring( w_sz_ );
}
}
}
@ -510,7 +510,7 @@ void insert_cell_border(oox::pptx_conversion_context & Context,
else if (w_sz_ > 96.0)
w_sz_ = 96.0;
w_sz = boost::lexical_cast<std::wstring>( w_sz_ );
w_sz = std::to_wstring( w_sz_ );
}
while (0);

View File

@ -737,7 +737,7 @@ void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_
const double mul = style_text_position_->get_position().get_value() / 100.0;
if (fontSizeVal > 0)
{
const std::wstring position = boost::lexical_cast<std::wstring>( (int)(fontSizeVal * mul + 0.5));
const std::wstring position = std::to_wstring( (int)(fontSizeVal * mul + 0.5));
if (!position.empty())
{
_rPr << L"<w:position w:val=\"" << position << "\" />";
@ -750,7 +750,7 @@ void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_
const double mul = style_text_position_->font_size().get_value() / 100.0;
if (fontSizeVal > 0 && mul > 0)
{
const std::wstring fontSize = boost::lexical_cast<std::wstring>((int)(fontSizeVal * mul + 0.5));
const std::wstring fontSize = std::to_wstring((int)(fontSizeVal * mul + 0.5));
if (!fontSize.empty())
{
needProcessFontSize = false;
@ -1182,7 +1182,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
const double mul = style_text_position_->get_position().get_value() / 100.0;
if (fontSizeVal > 0)
{
const std::wstring position = boost::lexical_cast<std::wstring>( (int)(fontSizeVal * mul + 0.5));
const std::wstring position = std::to_wstring( (int)(fontSizeVal * mul + 0.5));
if (!position.empty())
{
_rPr << L"<w:position w:val=\"" << position << "\" />";
@ -1195,7 +1195,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
const double mul = style_text_position_->font_size().get_value() / 100.0;
if (fontSizeVal > 0 && mul > 0)
{
const std::wstring fontSize = boost::lexical_cast<std::wstring>((int)(fontSizeVal * mul + 0.5));
const std::wstring fontSize = std::to_wstring((int)(fontSizeVal * mul + 0.5));
if (!fontSize.empty())
{
needProcessFontSize = false;

View File

@ -91,11 +91,11 @@ std::wstring process_border(const border_style & borderStyle,
int szInt = (int)(0.5 + 8.0 * width); //eighths of a point (ST_EighthPointMeasure)
if (szInt <= 0) szInt = 1;
w_sz = boost::lexical_cast<std::wstring>( szInt );
w_sz = std::to_wstring( szInt );
w_color = borderStyle.get_color().get_hex_value() ;
if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
w_space = std::to_wstring((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
switch(borderStyle.get_style())
{
@ -135,7 +135,7 @@ std::wstring process_margin(const _CP_OPT(length_or_percent) & margin, double Mu
if (margin->get_type() == length_or_percent::Length)
{
int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(length::pt));
return boost::lexical_cast<std::wstring>( val );
return std::to_wstring( val );
}
else
{
@ -950,7 +950,7 @@ std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val,
double dAddVal = 20.0 * AddVal.get_value_or(length(0, length::pt)).get_value_unit(length::pt) + 0.5;
if (dAddVal < 0 ) dAddVal = 0;
return boost::lexical_cast<std::wstring>( (int)( v + dAddVal));
return std::to_wstring( (int)( v + dAddVal));
}
}
@ -979,7 +979,7 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
{
int val = 0.5 + 20.0 * fo_page_height_->get_value_unit(length::pt);
if (val > 31680) val =31680;//22"
w_h = boost::lexical_cast<std::wstring>(val);
w_h = std::to_wstring(val);
height_page = val;
}
@ -1153,7 +1153,7 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con
w = fo_page_width_->get_value_unit(length::emu);
if (w < 914400) w = 914400;
w_w = boost::lexical_cast<std::wstring>(w);
w_w = std::to_wstring(w);
}
if (fo_page_height_)
{
@ -1391,7 +1391,7 @@ void style_page_layout_properties::pptx_serialize(std::wostream & strm, oox::ppt
w = attlist_.fo_page_width_->get_value_unit(length::emu);
if (w < 914400) w = 914400;
w_w = boost::lexical_cast<std::wstring>(w);
w_w = std::to_wstring(w);
}
if (attlist_.fo_page_height_)
{

View File

@ -271,7 +271,7 @@ std::wstring GetLevelText(unsigned int displayLevels,
if (displayLevels > 1)
res += L".";
res += L"%";
res += boost::lexical_cast<std::wstring>(textLevel);
res += std::to_wstring(textLevel);
return res;
}

View File

@ -156,9 +156,9 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
if (Context.get_table_context().state()->group_row_.enabled)
{
//std::wstring str_spans = boost::lexical_cast<std::wstring>(Context.get_table_context().state()->group_row_.count);
//std::wstring str_spans = std::to_wstring(Context.get_table_context().state()->group_row_.count);
//str_spans = str_spans + L":";
std::wstring str_spans = L"1:" + boost::lexical_cast<std::wstring>(Context.get_table_context().columns_count());
std::wstring str_spans = L"1:" + std::to_wstring(Context.get_table_context().columns_count());
ht = L"";
CP_XML_ATTR(L"collapsed", Context.get_table_context().state()->group_row_.collapsed);

View File

@ -99,6 +99,8 @@ SOURCES += \
../source/OdfFormat/odf_settings_context.cpp \
../source/OdfFormat/office_settings.cpp \
../source/OdfFormat/mediaitems_utils.cpp \
../source/OdfFormat/office_scripts.cpp \
../source/OdfFormat/office_event_listeners.cpp \
../source/OdfFormat/anim_elements.cpp \
../source/OdfFormat/draw_page.cpp \
../source/OdfFormat/odp_conversion_context.cpp \
@ -208,4 +210,6 @@ HEADERS += \
../source/OdfFormat/style_presentation.h \
../source/Oox2OdfConverter/PptxConverter.h \
../source/OdfFormat/anim_elements.h \
../source/OdfFormat/office_event_listeners.h \
../source/OdfFormat/office_scripts.h \
../source/OdfFormat/style_presentation.h

View File

@ -91,3 +91,5 @@
#include "../source/OdfFormat/odp_slide_context.cpp"
#include "../source/OdfFormat/office_presentation.cpp"
#include "../source/OdfFormat/style_presentation.cpp"
#include "../source/OdfFormat/office_scripts.cpp"
#include "../source/OdfFormat/office_event_listeners.cpp"

View File

@ -59,6 +59,8 @@ void anim_par::create_child_element(const std::wstring & Ns, const std::wstring
}
void anim_par::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeAnimPar)
@ -74,6 +76,8 @@ void anim_par::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
attlist_.serialize(CP_GET_XML_NODE());
if (anim_par_)
anim_par_->serialize(CP_XML_STREAM());
@ -98,6 +102,8 @@ void anim_seq::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
attlist_.serialize(CP_GET_XML_NODE());
for (size_t i = 0; i < anim_par_array_.size(); i++)
{
anim_par_array_[i]->serialize(CP_XML_STREAM());
@ -118,16 +124,18 @@ void anim_seq::add_child_element( const office_element_ptr & child)
////////////////////////////////////////////////////////////////
void anim_transition_filter_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"smil:direction", smil_direction_);
CP_XML_ATTR_OPT(L"smil:subtype", smil_subtype_);
CP_XML_ATTR_OPT(L"smil:type", smil_type_);
CP_XML_ATTR_OPT(L"smil:fadeColor", smil_fadeColor_);
CP_XML_ATTR_OPT(L"smil:mode", smil_mode_);
CP_XML_ATTR_OPT(L"smil:dur", smil_dur_);
}
const wchar_t * anim_transitionFilter::ns = L"anim";
void anim_audio_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"xlink:href", xlink_href_);
CP_XML_ATTR_OPT(L"anim:audio-level",anim_audio_level_);
}
const wchar_t * anim_transitionFilter::ns = L"anim";
const wchar_t * anim_transitionFilter::name = L"transitionFilter";
void anim_transitionFilter::serialize(std::wostream & _Wostream)
@ -136,12 +144,26 @@ void anim_transitionFilter::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
common_anim_smil_attlist_.serialize(CP_GET_XML_NODE());
anim_transition_filter_attlist_.serialize(CP_GET_XML_NODE());
common_attlist_.serialize(CP_GET_XML_NODE());
filter_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
//------------------------------------------------------------------------------------------------
const wchar_t * anim_audio::ns = L"anim";
const wchar_t * anim_audio::name = L"audio";
void anim_audio::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
common_attlist_.serialize(CP_GET_XML_NODE());
audio_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
////////////////////////////////////////////////////////////////
}
}

View File

@ -53,9 +53,10 @@ public:
static const ElementType type = typeAnimPar;
CPDOCCORE_DEFINE_VISITABLE();
office_element_ptr anim_par_;
office_element_ptr_array anim_seq_array_;
office_element_ptr_array content_;
odf_types::common_anim_smil_attlist attlist_;
office_element_ptr anim_par_;
office_element_ptr_array anim_seq_array_;
office_element_ptr_array content_;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child);
@ -73,7 +74,8 @@ public:
static const ElementType type = typeAnimSeq;
CPDOCCORE_DEFINE_VISITABLE();
office_element_ptr_array anim_par_array_;
odf_types::common_anim_smil_attlist attlist_;
office_element_ptr_array anim_par_array_;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child);
@ -81,25 +83,27 @@ public:
virtual void serialize(std::wostream & strm);
};
CP_REGISTER_OFFICE_ELEMENT2(anim_seq);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim:iterate
//class anim_iterate : public office_element_impl<anim_iterate>//Итеративные анимации
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim:iterate
class anim_audio_attlist
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) xlink_href_;
_CP_OPT(std::wstring) anim_audio_level_;
};
class anim_transition_filter_attlist
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) smil_direction_;
_CP_OPT(std::wstring) smil_subtype_;
_CP_OPT(odf_types::smil_transition_type) smil_type_;
_CP_OPT(std::wstring) smil_mode_;
_CP_OPT(odf_types::color) smil_fadeColor_;
_CP_OPT(odf_types::clockvalue) smil_dur_;
};
@ -117,12 +121,29 @@ public:
virtual void serialize(std::wostream & strm);
///////////////////////////////////////////////////////////
odf_types::common_anim_smil_attlist common_anim_smil_attlist_;
anim_transition_filter_attlist anim_transition_filter_attlist_;
odf_types::common_anim_smil_attlist common_attlist_;
anim_transition_filter_attlist filter_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(anim_transitionFilter);
//anim:audio
class anim_audio : public office_element_impl<anim_audio>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeAnimAudio;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
///////////////////////////////////////////////////////////
odf_types::common_anim_smil_attlist common_attlist_;
anim_audio_attlist audio_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(anim_audio);
//anim:command
}

View File

@ -73,10 +73,9 @@ void draw_chart_attlist::serialize(CP_ATTR_NODE)
//CP_XML_ATTR_OPT(L"draw:filter-name", draw_filter_name_);
}
// draw:image
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_image::ns = L"draw";
const wchar_t * draw_image::name = L"image";
//-----------------------------------------------------------------------
const wchar_t * draw_image::ns = L"draw";
const wchar_t * draw_image::name = L"image";
void draw_image::serialize(std::wostream & _Wostream)
{
@ -111,6 +110,8 @@ void draw_image::create_child_element(const std::wstring & Ns, const std::wstrin
}
void draw_image::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeOfficeBinaryData)
@ -154,8 +155,7 @@ void draw_chart::add_child_element( const office_element_ptr & child_element)
content_.push_back(child_element);
}
// draw:g
//////////////////////////////////////////////////////////////////////////////////////////////////
///-----------------------------------------------------------------------
const wchar_t * draw_g::ns = L"draw";
const wchar_t * draw_g::name = L"g";
@ -207,12 +207,12 @@ void draw_frame::serialize(std::wostream & _Wostream)
void draw_frame::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
if (CP_CHECK_NAME(L"draw", L"text-box") ||
CP_CHECK_NAME(L"draw", L"image") ||//копия чарта в виде картинки ну.. или просто картинка
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение чарта
CP_CHECK_NAME(L"draw", L"image") ||//копия чарта в виде картинки ну.. или просто картинка
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение чарта
CP_CHECK_NAME(L"draw", L"object-ole") ||
CP_CHECK_NAME(L"draw", L"applet") ||
CP_CHECK_NAME(L"draw", L"applet") ||
CP_CHECK_NAME(L"draw", L"floating-frame") ||
CP_CHECK_NAME(L"draw", L"plugin") ||
CP_CHECK_NAME(L"draw", L"plugin") ||
CP_CHECK_NAME(L"table", L"table")
)
{
@ -242,9 +242,16 @@ void draw_frame::create_child_element( const std::wstring & Ns, const std::wstr
}
void draw_frame::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDrawImage || type == typeDrawTextBox || type == typeDrawObject || type == typeDrawObjectOle || type == typeTableTable)
if (type == typeDrawImage ||
type == typeDrawTextBox ||
type == typeDrawObject ||
type == typeDrawObjectOle ||
type == typeDrawPlugin ||
type == typeTableTable)
{
draw_base::add_child_element(child_element);
}
@ -259,8 +266,6 @@ void draw_frame::add_child_element( const office_element_ptr & child_element)
}
///////////////////////
void draw_text_box_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:chain-next-name", draw_chain_next_name_);
@ -271,9 +276,8 @@ void draw_text_box_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"fo:max-height", fo_max_height_);
}
// draw:text-box
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_text_box::ns = L"draw";
//-----------------------------------------------------------------------
const wchar_t * draw_text_box::ns = L"draw";
const wchar_t * draw_text_box::name = L"text-box";
@ -285,9 +289,9 @@ void draw_text_box::serialize(std::wostream & _Wostream)
{
draw_text_box_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -302,8 +306,7 @@ void draw_text_box::add_child_element( const office_element_ptr & child_element)
content_.push_back(child_element);
}
// draw:object
//////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------
const wchar_t * draw_object::ns = L"draw";
const wchar_t * draw_object::name = L"object";
@ -326,10 +329,9 @@ void draw_object::add_child_element( const office_element_ptr & child_element)
{
//CP_NOT_APPLICABLE_ELM();
}
// draw:object
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_object_ole::ns = L"draw";
const wchar_t * draw_object_ole::name = L"object-ole";
//-----------------------------------------------------------------------
const wchar_t * draw_object_ole::ns = L"draw";
const wchar_t * draw_object_ole::name = L"object-ole";
void draw_object_ole::serialize(std::wostream & _Wostream)
{
@ -351,5 +353,37 @@ void draw_object_ole::add_child_element( const office_element_ptr & child_elemen
{
//CP_NOT_APPLICABLE_ELM();
}
//-----------------------------------------------------------------------
const wchar_t * draw_plugin::ns = L"draw";
const wchar_t * draw_plugin::name = L"plugin";
void draw_plugin::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"draw:mime-type", draw_mime_type_);
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
void draw_plugin::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"draw", L"param")
{
CP_CREATE_ELEMENT(content_);
}
}
void draw_plugin::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
}
}

View File

@ -235,10 +235,33 @@ public:
virtual void serialize(std::wostream & _Wostream);
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) draw_class_id_;
_CP_OPT(std::wstring) draw_class_id_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole)
// draw:plugin
class draw_plugin : public office_element_impl<draw_plugin>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawPlugin;
CPDOCCORE_DEFINE_VISITABLE()
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) draw_mime_type_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_plugin)
}
}

View File

@ -72,6 +72,8 @@ void draw_page::create_child_element( const std::wstring & Ns, const std::wstrin
}
void draw_page::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if(type == typeAnimPar)
animation_ = child_element;

View File

@ -464,7 +464,9 @@ void draw_enhanced_geometry::create_child_element( const std::wstring & Ns, cons
}
void draw_enhanced_geometry::add_child_element( const office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDrawHandle)
{

View File

@ -102,6 +102,8 @@ void text_list_item::create_child_element(const std::wstring & Ns, const std::ws
}
void text_list_item::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextNumber)
@ -148,6 +150,8 @@ void text_list_header::create_child_element(const std::wstring & Ns, const std::
}
void text_list_header::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextNumber)

View File

@ -42,7 +42,7 @@ class rels;
class _mediaitems
{
public:
enum Type { typeUnknown = 0, typeImage, typeAudio, typeVideo};
enum Type { typeUnknown = 0, typeImage, typeMedia};
//oleObject ???
_mediaitems()

View File

@ -123,6 +123,8 @@ void number_style_base::create_child_element( const std::wstring & Ns, const std
}
void number_style_base::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeStyleTextProperties)

View File

@ -185,12 +185,12 @@ namespace odf_writer
{
if (mediaitems_.count_media < 1)return;
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Media";
NSDirectory::CreateDirectory(path);
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
{
if (item.type == _mediaitems::typeAudio || item.type == _mediaitems::typeVideo)
if (item.type == _mediaitems::typeMedia)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
@ -342,14 +342,17 @@ namespace odf_writer
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
CP_XML_ATTR(L"xmlns:drawooo", L"http://openoffice.org/2010/draw" );
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0" );
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf_writer-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
//CP_XML_NODE(L"office:scripts");
CP_XML_NODE(L"office:font-face-decls");
if (content_)
{
CP_XML_STREAM() << content_->styles_str();
@ -402,6 +405,8 @@ namespace odf_writer
CP_XML_ATTR(L"xmlns:of", L"urn:oasis:names:tc:opendocument:xmlns:of:1.2" );
CP_XML_ATTR(L"xmlns:xhtml", L"http://www.w3.org/1999/xhtml" );
CP_XML_ATTR(L"xmlns:grddl", L"http://www.w3.org/2003/g/data-view#" );
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0" );
CP_XML_ATTR(L"xmlns:officeooo", L"http://openoffice.org/2009/office" );
CP_XML_ATTR(L"xmlns:textooo", L"http://openoffice.org/2013/office" );
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
@ -409,7 +414,7 @@ namespace odf_writer
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf_writer-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");

View File

@ -35,6 +35,7 @@
#include <boost/lexical_cast.hpp>
#include "office_spreadsheet.h"
#include "office_scripts.h"
#include "office_chart.h"
#include "office_elements_create.h"
@ -128,6 +129,10 @@ void odf_conversion_context::end_document()
process_settings(object, isRoot);
package::content_content_ptr content_root_ = package::content_content::create();
if (objects_.back().scripts)
objects_.back().scripts->serialize(content_root_->styles());
object.content->serialize(content_root_->content());
BOOST_FOREACH(const office_element_ptr & elm, object.content_styles)
{
@ -193,6 +198,8 @@ void odf_conversion_context::start_presentation()
{
create_object();
create_element(L"office", L"presentation", objects_.back().content, this, true);
create_element(L"office", L"scripts", objects_.back().scripts, this);
}
void odf_conversion_context::create_object()
{
@ -298,6 +305,15 @@ std::wstring odf_conversion_context::add_image(const std::wstring & image_file_n
return odf_ref_name;
}
std::wstring odf_conversion_context::add_media(const std::wstring & file_name)
{
if (file_name.empty()) return L"";
std::wstring odf_ref_name ;
mediaitems()->add_or_find(file_name,_mediaitems::typeMedia, odf_ref_name);
return odf_ref_name;
}
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
{
if (!temporary_.elm) return;

View File

@ -65,6 +65,7 @@ class odf_conversion_context : boost::noncopyable
std::wstring name;
office_element_ptr content;
office_element_ptr scripts;
std::vector<office_element_ptr> content_styles;
std::vector<office_element_ptr> styles;
office_element_ptr settings;
@ -96,6 +97,7 @@ public:
virtual void end_text_context() = 0;
std::wstring add_image(const std::wstring & image_file_name);
std::wstring add_media(const std::wstring & file_name);
virtual odf_style_context * styles_context();

View File

@ -42,6 +42,7 @@
#include "odf_text_context.h"
#include "odf_style_context.h"
#include "odf_conversion_context.h"
#include "office_event_listeners.h"
#include "draw_frame.h"
#include "draw_shapes.h"
@ -160,10 +161,10 @@ struct anchor_settings
enum _drawing_part
{
Unknown=0,
Area,
Line,
Shadow
Unknown = 0,
Area = 1,
Line = 2,
Shadow = 3
};
struct odf_drawing_state
{
@ -191,6 +192,7 @@ struct odf_drawing_state
view_box_ = L"";
path_last_command_ = L"";
replacement_ = L"";
oox_shape_preset_ = -1;
oox_shape_.reset();
@ -221,12 +223,12 @@ struct odf_drawing_state
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) presentation_placeholder_;
std::wstring replacement_;
std::wstring path_;
std::wstring view_box_;
std::wstring path_last_command_;
oox_shape_ptr oox_shape_;
///////////////////////
//----------------------------------------------------------
int oox_shape_preset_;
bool in_group_;
bool text_box_tableframe_;
@ -235,7 +237,7 @@ struct odf_drawing_state
class odf_drawing_context::Impl
{
public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
Impl(odf_conversion_context *odf_context) : odf_context_(odf_context)
{
current_drawing_state_.clear();
styles_context_ = odf_context_->styles_context();
@ -249,7 +251,7 @@ public:
is_header_ = false;
is_footer_ = false;
is_background_ = false;
//некоторые свойства для объектов графики не поддерживаюися в редакторах Liber && OpenOffice.net
//некоторые свойства для объектов графики не поддерживаюися в редакторах Libre && OpenOffice.net
//в MS Office и в нашем - проблем таких нет.
}
@ -294,8 +296,7 @@ public:
};
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------------------------
odf_drawing_context::odf_drawing_context(odf_conversion_context *odf_context)
: impl_(new odf_drawing_context::Impl(odf_context))
{
@ -2276,9 +2277,7 @@ void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(d
if (right) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_right_ = length(*right,length::pt);
if (bottom) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_bottom_ = length(*bottom,length::pt);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//вложенные элементы
//------------------------------------------------------------------------------------------------------------------
void odf_drawing_context::start_image(std::wstring odf_path)
{
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
@ -2332,14 +2331,59 @@ void odf_drawing_context::start_object(std::wstring name)
draw_object* object = dynamic_cast<draw_object*>(object_elm.get());
if (object == NULL)return;
object->common_xlink_attlist_.href_= std::wstring(L"./") + name;
object->common_xlink_attlist_.type_= xlink_type::Simple;
object->common_xlink_attlist_.show_ = xlink_show::Embed;
object->common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
object->common_xlink_attlist_.href_ = std::wstring(L"./") + name;
object->common_xlink_attlist_.type_ = xlink_type::Simple;
object->common_xlink_attlist_.show_ = xlink_show::Embed;
object->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
start_element(object_elm);
}
void odf_drawing_context::start_media(std::wstring name)
{
start_frame();
office_element_ptr plugin_elm;
create_element(L"draw", L"plugin", plugin_elm, impl_->odf_context_);
draw_plugin* plugin = dynamic_cast<draw_plugin*>(plugin_elm.get());
if (plugin == NULL)return;
plugin->common_xlink_attlist_.href_ = name;
plugin->common_xlink_attlist_.type_ = xlink_type::Simple;
plugin->common_xlink_attlist_.show_ = xlink_show::Embed;
plugin->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
plugin->draw_mime_type_ = L"application/vnd.sun.star.media";
start_element(plugin_elm);
}
void odf_drawing_context::add_image_replacement()
{
if (impl_->current_drawing_state_.replacement_.empty()) return;
office_element_ptr image_elm;
create_element(L"draw", L"image", image_elm, impl_->odf_context_);
draw_image* image = dynamic_cast<draw_image*>(image_elm.get());
if (image == NULL)return;
image->common_xlink_attlist_.href_ = impl_->current_drawing_state_.replacement_;
image->common_xlink_attlist_.type_ = xlink_type::Simple;
image->common_xlink_attlist_.show_ = xlink_show::Embed;
image->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
start_element(image_elm);
set_image_style_repeat(1);//default
end_element();
}
void odf_drawing_context::end_media()
{
end_element();
add_image_replacement();
end_frame();
}
void odf_drawing_context::start_text_box()
{
impl_->current_drawing_state_.oox_shape_preset_ = 2000;
@ -2369,6 +2413,114 @@ void odf_drawing_context::set_text_box_min_size(bool val)
}
}
void odf_drawing_context::start_action(std::wstring value)
{
office_element_ptr elm_listeners;
create_element(L"office", L"event-listeners", elm_listeners, impl_->odf_context_);
start_element(elm_listeners);
office_element_ptr elm;
create_element(L"presentation", L"event-listener", elm, impl_->odf_context_);
start_element(elm);
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
if (event_)
{
event_->attlist_.script_event_name_ = L"dom:click";
if (std::wstring::npos != value.find(L"noaction") ||
std::wstring::npos != value.find(L"media"))
{
event_->attlist_.script_event_name_ = boost::none;
}
else if (std::wstring::npos != value.find(L"program"))
{
event_->attlist_.presentation_action_ = L"execute";
}
else if (std::wstring::npos != value.find(L"hlinkshowjump"))
{
if (std::wstring::npos != value.find(L"previousslide"))
event_->attlist_.presentation_action_ = L"previous-page";
else if (std::wstring::npos != value.find(L"nextslide"))
event_->attlist_.presentation_action_ = L"next-page";
else if (std::wstring::npos != value.find(L"firstslide"))
event_->attlist_.presentation_action_ = L"first-page";
else if (std::wstring::npos != value.find(L"lastslide"))
event_->attlist_.presentation_action_ = L"last-page";
else if (std::wstring::npos != value.find(L"endshow"))
event_->attlist_.presentation_action_ = L"end";
else if (std::wstring::npos != value.find(L"endshow"))
event_->attlist_.presentation_action_ = L"end";
}
else if (std::wstring::npos != value.find(L"hlinksldjump"))
{
event_->attlist_.presentation_action_ = L"previous-page";
}
else if (std::wstring::npos != value.find(L"macro"))
{
}
else if (std::wstring::npos != value.find(L"hlinkfile"))
{
}
else if (std::wstring::npos != value.find(L"hlinkpres"))
{
}
else
{//hyperlink
event_->attlist_.presentation_action_ = L"show";
}
}
}
void odf_drawing_context::add_link(std::wstring href)
{
if (href.empty()) return;
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
if (event_)
{
event_->attlist_.common_xlink_attlist_.href_ = href;
event_->attlist_.common_xlink_attlist_.type_ = xlink_type::Simple;
event_->attlist_.common_xlink_attlist_.show_ = xlink_show::Embed;
event_->attlist_.common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
}
}
void odf_drawing_context::add_sound(std::wstring href)
{
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
if (event_)
{
event_->attlist_.script_event_name_ = L"dom:click";
if (!event_->attlist_.presentation_action_)
event_->attlist_.presentation_action_ = L"sound";
}
office_element_ptr elm;
create_element(L"presentation", L"sound", elm, impl_->odf_context_);
start_element(elm);
presentation_sound *sound = dynamic_cast<presentation_sound*>(elm.get());
if (sound)
{
sound->common_xlink_attlist_.href_ = href;
sound->common_xlink_attlist_.type_ = xlink_type::Simple;
sound->common_xlink_attlist_.show_ = xlink_show::Embed;
sound->common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
}
end_element();
}
void odf_drawing_context::end_action()
{
end_element();
end_element();
}
void odf_drawing_context::set_text_box_min_size(double w_pt, double h_pt)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
@ -2489,6 +2641,36 @@ void odf_drawing_context::end_object()
end_frame();
}
void odf_drawing_context::start_object_ole(std::wstring ref)
{
start_frame();
office_element_ptr object_elm;
create_element(L"draw", L"object-ole", object_elm, impl_->odf_context_);
draw_object_ole* object = dynamic_cast<draw_object_ole*>(object_elm.get());
if (object == NULL)return;
object->common_xlink_attlist_.href_ = ref;
object->common_xlink_attlist_.type_ = xlink_type::Simple;
object->common_xlink_attlist_.show_ = xlink_show::Embed;
object->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
start_element(object_elm);
}
void odf_drawing_context::end_object_ole()
{
end_element();
add_image_replacement();
end_frame();
}
void odf_drawing_context::set_image_replacement(std::wstring ref)
{
impl_->current_drawing_state_.replacement_ = ref;
}
bool odf_drawing_context::is_exist_content()
{

View File

@ -141,9 +141,18 @@ public:
void set_text_box_tableframe (bool val);
void end_text_box ();
void start_object(std::wstring name);
void start_object(std::wstring ref); //формулы, диаграммы ...
void end_object();
void start_object_ole(std::wstring ref);
void end_object_ole();
void start_media(std::wstring ref);
void end_media();
void add_image_replacement();
void set_image_replacement(std::wstring ref);
bool isLineShape();
void corrected_line_fill();
@ -260,6 +269,11 @@ public:
void set_bitmap_tile_translate_y(double y);
void set_bitmap_tile_translate_x(double x);
void start_action(std::wstring value);
void add_sound (std::wstring href);
void add_link (std::wstring href);
void end_action();
std::map<std::wstring, OOX::Vml::CShapeType*> m_mapVmlShapeTypes;
private:

View File

@ -36,6 +36,7 @@
#include "odp_conversion_context.h"
#include "office_presentation.h"
#include "draw_page.h"
#include "styles.h"
@ -214,5 +215,6 @@ void odp_conversion_context::end_note()
current_slide().drawing_context()->end_drawing();
}
}
}

View File

@ -40,6 +40,7 @@
#include "odp_conversion_context.h"
#include "draw_page.h"
#include "anim_elements.h"
#include "office_annotation.h"
#include "styles.h"
@ -60,15 +61,18 @@ namespace odf_writer {
odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_ptr & elm)
: context_(Context), drawing_context_(Context), comment_context_(Context)
{
page_elm_ = elm;
page_elm_ = elm;
page_properties_ = NULL;
}
void odp_page_state::set_page_id(int id)
{
page_id_ = id;
}
void odp_page_state::set_page_name(std::wstring name)
{
if (name.empty()) return;
office_page_name_ = name;
page_name_ = name;
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page)
@ -80,6 +84,12 @@ void odp_page_state::set_page_name(std::wstring name)
// master_page->attlist_.style_display_name_ = name;
}
}
void odp_page_state::set_page_duration(int id)
{
if (!page_properties_) return;
page_properties_->content_.presentation_page_duration_ = id;
}
void odp_page_state::set_layout_page(std::wstring name)
{
@ -109,6 +119,8 @@ void odp_page_state::set_page_style(office_element_ptr & elm)
if (!office_page_style_)return;
page_properties_ = office_page_style_->content_.get_style_drawing_page_properties();
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page)
page->attlist_.draw_style_name_ = office_page_style_->style_name_;
@ -129,6 +141,224 @@ void odp_page_state::add_child_element( const office_element_ptr & child_element
{
page_elm_->add_child_element(child_element);
}
void odp_page_state::set_anim_id (int val)
{
if (anim_levels.empty()) return;
if (!anim_levels.back().attlist)return;
anim_levels.back().id = val;
//anim_levels.back().attlist->smil_begin_ = L"id" + std::to_wstring(val) + L".begin";
}
void odp_page_state::finalize_page()
{
if (transactions.empty() == false)
{
start_timing();
start_timing_par();
set_anim_duration(-1);
set_anim_restart(L"never");
set_anim_type(L"tmRoot");
end_timing_par();
end_timing();
}
}
void odp_page_state::set_anim_type(std::wstring val)
{
if (anim_levels.empty()) return;
if (!anim_levels.back().attlist)return;
if (val == L"tmRoot")
{
anim_levels.back().attlist->presentation_node_type_ = L"timing-root";
if (transactions.empty() == false)
{
std::wstring slide_id = L"slide" + std::to_wstring(page_id_) + L"id";
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page)
{
page->attlist_.draw_id_ = slide_id;
start_timing_par();
anim_levels.back().attlist->smil_begin_ = slide_id + L".begin";
while(!transactions.empty())
{
anim_levels.back().elm->add_child_element( transactions[0] );
transactions.erase(transactions.begin());
}
end_timing_par();
}
}
}
}
void odp_page_state::set_anim_duration(int val)
{
if (anim_levels.empty()) return;
if (!anim_levels.back().attlist)return;
anim_levels.back().attlist->smil_dur_ = odf_types::clockvalue(val);
}
void odp_page_state::set_anim_restart(std::wstring val)
{
if (anim_levels.empty()) return;
if (!anim_levels.back().attlist)return;
anim_levels.back().attlist->smil_restart_ = val;
}
void odp_page_state::start_transition()
{
office_element_ptr elm;
create_element(L"anim", L"transitionFilter", elm, context_);
transactions.push_back(elm);
}
void odp_page_state::set_transition_type(int val)
{
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
trans->filter_attlist_.smil_type_ = odf_types::smil_transition_type((odf_types::smil_transition_type::type)val);
}
void odp_page_state::set_transition_subtype(std::wstring val)
{
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
trans->filter_attlist_.smil_subtype_ = val;
}
void odp_page_state::set_transition_direction(std::wstring val)
{
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
trans->common_attlist_.smil_direction_ = val;
}
void odp_page_state::set_transition_speed(int val)
{
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
{
if (val == 0)
{
if (page_properties_)
page_properties_->content_.presentation_transition_speed_ = L"fast";
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(2000);
}
if (val == 1)
{
if (page_properties_)
page_properties_->content_.presentation_transition_speed_ = L"medium";
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(3000);
}
if (val == 2)
{
if (page_properties_)
page_properties_->content_.presentation_transition_speed_ = L"slow";
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(4000);
}
}
}
void odp_page_state::set_transition_duration(int val)
{
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(val);
}
void odp_page_state::set_transition_sound(std::wstring ref, bool loop)
{
if (transactions.empty()) return;
if (ref.empty()) return;
office_element_ptr elm;
create_element(L"anim", L"audio", elm, context_);
anim_audio *audio = dynamic_cast<anim_audio*>(elm.get());
if (audio)
{
audio->audio_attlist_.xlink_href_ = ref;
}
transactions.push_back(elm);
if (page_properties_)
{
create_element(L"presentation", L"sound", page_properties_->content_.presentation_sound_, context_);
presentation_sound *sound = dynamic_cast<presentation_sound*>(page_properties_->content_.presentation_sound_.get());
if (sound)
{
sound->common_xlink_attlist_.href_ = ref;
sound->common_xlink_attlist_.type_ = xlink_type::Simple;
sound->common_xlink_attlist_.show_ = xlink_show::Embed;
sound->common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
}
}
}
void odp_page_state::start_timing_seq()
{
if (anim_levels.empty()) return;
anim_state anim;
create_element(L"anim", L"seq", anim.elm, context_);
if (!anim.elm) return;
anim_seq *seq = dynamic_cast<anim_seq*>(anim.elm.get());
if (seq) anim.attlist = &seq->attlist_;
anim_levels.back().empty = false;
anim_levels.back().elm->add_child_element(anim.elm);
anim_levels.push_back(anim);
}
void odp_page_state::start_timing()
{
if (!anim_levels.empty()) return;
anim_state anim;
anim.elm = page_elm_;
anim_levels.push_back(anim);
}
void odp_page_state::end_timing()
{
if (anim_levels.empty()) return;
anim_levels.pop_back();
}
void odp_page_state::end_timing_seq()
{
if (anim_levels.empty()) return;
anim_levels.pop_back();
}
void odp_page_state::start_timing_par()
{
if (anim_levels.empty()) return;
anim_state anim;
create_element(L"anim", L"par", anim.elm, context_);
if (!anim.elm) return;
anim_par *par = dynamic_cast<anim_par*>(anim.elm.get());
if (par) anim.attlist = &par->attlist_;
anim_levels.back().empty = false;
anim_levels.back().elm->add_child_element(anim.elm);
anim_levels.push_back(anim);
}
void odp_page_state::end_timing_par()
{
if (anim_levels.empty()) return;
anim_levels.pop_back();
}
}
}

View File

@ -31,19 +31,13 @@
*/
#pragma once
#include <string>
#include <vector>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include"../../../Common/DocxFormat/Source/XML/Utils.h"
#include "odf_drawing_context.h"
#include "odf_comment_context.h"
#include "office_elements_create.h"
#include "style_presentation.h"
namespace cpdoccore {
@ -60,13 +54,15 @@ class odf_text_context;
class style;
struct odp_element_state
struct anim_state
{
office_element_ptr elm;
anim_state() : empty(true), attlist(NULL), id(-1) {}
short repeated;
std::wstring style_name;
office_element_ptr style_elm;
int id;
office_element_ptr elm;
odf_types::common_anim_smil_attlist* attlist;
bool empty;
};
@ -74,27 +70,57 @@ class odp_page_state
{
public:
odp_page_state(odf_conversion_context * Context, office_element_ptr & elm);
void set_page_name(std::wstring name);
void set_page_style(office_element_ptr & _style);
void set_page_name (std::wstring name);
void set_page_id (int id);
void set_page_style (office_element_ptr & _style);
void set_page_duration (int id);
void set_master_page(std::wstring name);
void set_layout_page(std::wstring name);
void add_child_element( const office_element_ptr & child_element);
void finalize_page();
///////////////////////////////
odf_drawing_context * drawing_context(){return &drawing_context_;}
odf_comment_context * comment_context(){return &comment_context_;}
std::wstring office_page_name_;
office_element_ptr page_elm_;
office_element_ptr page_style_elm_;
std::wstring page_name_;
int page_id_;
office_element_ptr page_elm_;
office_element_ptr page_style_elm_;
std::vector<anim_state> anim_levels;
std::vector<office_element_ptr> transactions;
void start_timing();
void start_timing_par();
void end_timing_par();
void start_timing_seq();
void end_timing_seq();
void set_anim_id (int val);
void set_anim_type (std::wstring val);
void set_anim_duration (int val);
void set_anim_restart (std::wstring val);
void end_timing();
void start_transition();
void set_transition_type (int val);
void set_transition_subtype (std::wstring val);
void set_transition_direction(std::wstring val);
void set_transition_speed (int val);
void set_transition_duration(int val);
void set_transition_sound (std::wstring ref, bool loop);
void end_transition(){}
private:
odf_conversion_context * context_;
odf_conversion_context * context_;
odf_drawing_context drawing_context_;
odf_comment_context comment_context_;
odf_drawing_context drawing_context_;
odf_comment_context comment_context_;
style_drawing_page_properties* page_properties_;
friend class odp_slide_context;

View File

@ -73,6 +73,7 @@ void odp_slide_context::start_page(office_element_ptr & elm)
office_element_ptr & style = styles_context_->add_or_find(style_name_new, style_family::DrawingPage, true);
style->create_child_element(L"style", L"drawing-page-properties");
state().set_page_id(count_slides_);
state().set_page_style(style);
state().drawing_context()->set_styles_context(styles_context_);
}
@ -80,6 +81,7 @@ void odp_slide_context::start_page(office_element_ptr & elm)
void odp_slide_context::end_page()
{
state().drawing_context()->finalize(state().page_elm_);
state().finalize_page();
}
void odp_slide_context::remove_page()

View File

@ -31,6 +31,7 @@
*/
#pragma once
#include <list>
#include "odp_page_state.h"
#include "odf_table_context.h"

View File

@ -124,6 +124,8 @@ void office_annotation::create_child_element(const std::wstring & Ns, const std:
}
void office_annotation::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDcCreator)
@ -186,6 +188,8 @@ void officeooo_annotation::create_child_element( const std::wstring & Ns, const
}
void officeooo_annotation::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDcCreator)

View File

@ -153,6 +153,7 @@ enum ElementType
typeStyleFooterStyle,
typeStyleHeaderFooterProperties,
typeStylePresentationSound,
typeStylePresentationPageLayout,
typeStylePresentationPlaceholder,
typeStyleDrawingPageProperties,
@ -235,6 +236,7 @@ enum ElementType
typeDrawObject,
typeDrawObjectOle,
typeDrawChart,
typeDrawPlugin,
typeDrawBase,
typeDrawShape,
@ -267,6 +269,9 @@ enum ElementType
typeAnimPar,
typeAnimSeq,
typeAnimTransitionFilter,
typeAnimAudio,
typeAnimCommand,
typeAnimIterator,
typeStyleGraphicPropertis,
typeStyleDrawGradient,

View File

@ -0,0 +1,158 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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_event_listeners.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
namespace odf_writer {
//---------------------------------------------------------------------------------------------------------------
const wchar_t * office_event_listeners::ns = L"office";
const wchar_t * office_event_listeners::name = L"event-listeners";
void office_event_listeners::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME (L"presentation", L"event-listener")
CP_CREATE_ELEMENT (presentation_event_listeners_);
else if CP_CHECK_NAME (L"script", L"event-listener")
CP_CREATE_ELEMENT (script_event_listeners_);
}
void office_event_listeners::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typePresentationEventListener)
{
presentation_event_listeners_.push_back(child_element);
}
else if (type == typeScriptEventListener)
{
script_event_listeners_.push_back(child_element);
}
}
void office_event_listeners::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (size_t i = 0; i < presentation_event_listeners_.size(); i++)
{
presentation_event_listeners_[i]->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < script_event_listeners_.size(); i++)
{
script_event_listeners_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------------------------------------------------------
void presentation_event_listener_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"script:event-name", script_event_name_);
CP_XML_ATTR_OPT(L"presentation:action", presentation_action_);
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
}
//---------------------------------------------------------------------------------------------------------------
const wchar_t * presentation_event_listener::ns = L"presentation";
const wchar_t * presentation_event_listener::name = L"event-listener";
void presentation_event_listener::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"presentation", L"sound")
CP_CREATE_ELEMENT(presentation_sound_);
else
CP_NOT_APPLICABLE_ELM();
}
void presentation_event_listener::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeStylePresentationSound)
{
presentation_sound_ = child_element;
}
}
void presentation_event_listener::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
attlist_.serialize(CP_GET_XML_NODE());
if (presentation_sound_)
presentation_sound_->serialize(CP_XML_STREAM());
}
}
}
// script:event-listener
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * script_event_listener::ns = L"script";
const wchar_t * script_event_listener::name = L"event-listener";
void script_event_listener::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void script_event_listener::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void script_event_listener::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
}
}
}
}
}

View File

@ -0,0 +1,125 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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 "common_attlists.h"
namespace cpdoccore {
namespace odf_writer {
class office_event_listeners : public office_element_impl<office_event_listeners>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeEventListeners;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array presentation_event_listeners_;
office_element_ptr_array script_event_listeners_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners);
//-------------------------------------------------------------------------------------
class presentation_event_listener_attlist
{
public:
void serialize(CP_ATTR_NODE);
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) script_event_name_;
_CP_OPT(std::wstring) presentation_action_;
//presentation:verb
//presentation:start-scale
//presentation:speed
//presentation:direction
//presentation:effect
};
class presentation_event_listener : public office_element_impl<presentation_event_listener>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationEventListener;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
//office_element_ptr_array content_;
office_element_ptr presentation_sound_;
presentation_event_listener_attlist attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_event_listener);
// script:event-listeners_
class script_event_listener : public office_element_impl<presentation_event_listener>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeScriptEventListener;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(script_event_listener);
}
}

View File

@ -61,6 +61,8 @@ void office_presentation::create_child_element(const std::wstring & Ns, const st
void office_presentation::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typePresentationDateTimeDecl)
@ -83,7 +85,7 @@ void office_presentation::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0; i < pages_.size(); i++)
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->serialize(CP_XML_STREAM());
}

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