Compare commits

..

76 Commits

Author SHA1 Message Date
80d4e6057b .. 2017-03-03 13:35:37 +03:00
2dc5c2916a .. 2017-03-03 13:28:16 +03:00
5f9631a3c5 .. 2017-03-02 13:14:27 +03:00
ef7df69036 linux build fix 2017-03-01 20:06:37 +03:00
b3961994d2 Pptx .. 2017-03-01 19:40:40 +03:00
927a847607 . 2017-03-01 18:14:33 +03:00
674cc6c1a2 fix doct->docx background page settings 2017-03-01 14:18:35 +03:00
5d77cf9473 add ../ path for dll path 2017-03-01 13:23:11 +03:00
512dad1d24 fix double write attribute in background 2017-02-28 20:02:54 +03:00
3d684934f1 fix ppt background
fix bug 34177
read attributes (from line props, shape props , effects, 3D) without namespace
2017-02-28 19:03:04 +03:00
dd6ac185fb fix - remove tmp pptx folder 2017-02-28 18:27:00 +03:00
9825b6e32e Error writing xlsx (wrong ConditionalFormatting place) 2017-02-27 20:27:31 +03:00
653008ebfc XlsxFormat (graphicFrame) 2017-02-27 18:26:50 +03:00
236e93aa9c add GlobalVariable 2017-02-27 16:46:17 +03:00
164c7faf94 ..fix previus 2017-02-27 12:35:49 +03:00
4c07ddbcc7 . 2017-02-26 22:22:46 +03:00
7be543c3a6 pptx format .. extended reading xml 2017-02-26 18:57:48 +03:00
ccb47b0bda . 2017-02-23 15:20:20 +03:00
8aefacd411 new chart witout office_drawing(faster...) 2017-02-22 19:57:15 +03:00
6cd5fbcaca . 2017-02-21 23:38:23 +03:00
7c964b3f9c .. 2017-02-21 19:17:24 +03:00
8c43c781bd fix build 2017-02-21 18:00:39 +03:00
7496de06f0 . 2017-02-21 13:19:21 +03:00
fdd443a2d7 . 2017-02-21 13:18:29 +03:00
037c4046eb PptxFormat - extending reading xml; sppr, txpr in chart without DrawingConverter 2017-02-21 11:32:31 +03:00
4e5ac14ca9 errors for builder (open/save) 2017-02-18 14:17:42 +03:00
dedf74b366 fix for build 2017-02-18 11:02:42 +03:00
6f2eef1137 .. 2017-02-17 16:42:49 +03:00
9a8d3edbef . 2017-02-17 16:33:19 +03:00
305ebda78d OfficeUtils - add sort for compress 2017-02-17 16:28:00 +03:00
114050c23e fix bug #33849 2017-02-16 19:26:50 +03:00
7eee0755bf RtfFormatReader - generate replacement text hyperlink if absent 2017-02-16 16:23:21 +03:00
c329f29e9a RtfFormatReader - fix hyperlink text 2017-02-16 15:49:08 +03:00
0f3a02ca7c . 2017-02-16 15:20:53 +03:00
62d4860873 pptx - extending reading xml 2017-02-16 15:08:53 +03:00
21666ee309 x2t verion up 2.0.3.440 2017-02-16 11:38:20 +03:00
47ff766e4e . 2017-02-15 11:36:04 +03:00
50cbc671b3 RtfFormatWriter - text in drawing shapes, ... 2017-02-13 20:11:52 +03:00
f2d3390bd4 RtfFormatWriter - fix custom shape path 2017-02-13 14:23:38 +03:00
fb5af12d7a OdfFormat - refactroing svg; RtfFormatWriter - add custom shapes 2017-02-12 15:38:51 +03:00
63655a97e9 .. 2017-02-11 15:32:29 +03:00
fdf032d9f8 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  RtfFormat - add office digital signatures
  bug with some jpeg
  x2t version up 2.0.3.438
  RtfFormat - fix croping image, ...
  RtfFormat - extended drawing
  fix bug #34016
  fix bug #34018
  fix bug 34011
  fix bug #33752 after refactoring
  fix convert oox group shape to vml group shape
  RtfFormatWriter - fix table cell width (auto)
  OdfFormat - Reader/Writer - background page (image, pattern, gradient)
  fix bug #33918
2017-02-10 18:16:27 +03:00
3b85b58558 up 2017-02-10 18:16:18 +03:00
00f1f40a1e RtfFormat - add office digital signatures 2017-02-10 18:09:48 +03:00
46c05a4c27 bug with some jpeg 2017-02-10 17:14:53 +03:00
f3a510bd58 x2t version up 2.0.3.438 2017-02-10 15:49:17 +03:00
45231b822c RtfFormat - fix croping image, ... 2017-02-10 15:02:00 +03:00
e0591675d2 RtfFormat - extended drawing 2017-02-09 17:20:02 +03:00
67a849f110 fix bug #34016 2017-02-09 14:24:31 +03:00
15800296f7 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-02-08 20:04:33 +03:00
52fe741f9a fix bug #34018 2017-02-08 20:03:38 +03:00
b3ee693890 fix bug 34011 2017-02-08 19:35:45 +03:00
8c2e1738ea fix bug #33752 after refactoring 2017-02-07 12:42:46 +03:00
bf33aed853 fix convert oox group shape to vml group shape 2017-02-06 20:07:58 +03:00
5869c7a02e RtfFormatWriter - fix table cell width (auto) 2017-02-06 13:55:01 +03:00
bbd429a994 OdfFormat - Reader/Writer - background page (image, pattern, gradient) 2017-02-05 15:57:17 +03:00
f4d636539e Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-02-03 18:34:43 +03:00
92e02257d7 fix bug #33918 2017-02-03 18:33:50 +03:00
d2046d7ccb add missed include 2017-02-03 18:15:57 +03:00
7bc35a157a Implemented case when the size of the masked image doesn't match to the size of the mask. 2017-02-03 18:02:28 +03:00
903245e8a7 fixed converter for iOS 2017-02-03 17:33:48 +03:00
25ee9c3c1c Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  x2t vesion up  2.0.3.435
  PDFReader: text clip
  .
  fix...
  .
  x2t version up
  DocxFormat - fix vml single geom position RtfFormat - read/write background page (solid, pattern, gradient, image)
2017-02-03 16:28:47 +03:00
9ead40d279 up header 2017-02-03 16:28:42 +03:00
e097379c21 x2t vesion up 2.0.3.435 2017-02-03 15:27:12 +03:00
f86579d601 PDFReader: text clip 2017-02-03 13:02:26 +03:00
de7511f243 . 2017-02-03 12:42:06 +03:00
9a68a75f70 fix... 2017-02-02 18:43:38 +03:00
e04388aa32 . 2017-02-02 16:53:20 +03:00
cee61e7a92 x2t version up 2017-02-02 16:31:02 +03:00
48185ed4e9 DocxFormat - fix vml single geom position
RtfFormat - read/write background page (solid, pattern, gradient, image)
2017-02-02 15:44:03 +03:00
7bea086784 Fixed bugs with reading pdf files. 2017-02-02 14:53:01 +03:00
774f9c42cb PDF bugs 2017-02-01 19:20:12 +03:00
10964d32e6 ... 2017-02-01 17:10:19 +03:00
da2493ed3b OdfFormatReader - fix math matrix 2017-02-01 16:15:32 +03:00
0a183f3505 fix bug #33886 2017-02-01 15:59:28 +03:00
ac6cc1ec24 pptx file with wrong rels 2017-02-01 15:05:08 +03:00
469 changed files with 18927 additions and 14016 deletions

View File

@ -232,7 +232,8 @@ namespace DocFileFormat
case sprmOldCIss:
case sprmCIss:
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
break;
case sprmCRgLid0_80:

View File

@ -307,13 +307,11 @@ namespace DocFileFormat
if (!FormatUtils::IsControlSymbol(xchBullet))
{
ret.push_back(lvl.xst[0]);
ret.push_back(L'\0');
}
}
else
{
ret.push_back(L'\xF0B7');
ret.push_back(L'\0');
}
}
else

View File

@ -250,10 +250,6 @@ public:
{
pFile->WriteFile((BYTE*)m_pMetaHeader, m_lMetaHeaderSize);
}
if (NULL != m_pMetaFile)
{
pFile->WriteFile((BYTE*)m_pMetaFile, m_lMetaFileSize);
}
}
};

View File

@ -71,26 +71,26 @@ namespace DocFileFormat
{
struct __BITMAPINFOHEADER
{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
_UINT32 biSize;
_INT32 biWidth;
_INT32 biHeight;
_UINT16 biPlanes;
_UINT16 biBitCount;
_UINT32 biCompression;
_UINT32 biSizeImage;
_INT32 biXPelsPerMeter;
_INT32 biYPelsPerMeter;
_UINT32 biClrUsed;
_UINT32 biClrImportant;
};
struct __BITMAPCOREHEADER
{
DWORD bcSize; /* used to get to color table */
WORD bcWidth;
WORD bcHeight;
WORD bcPlanes;
WORD bcBitCount;
_UINT32 bcSize; /* used to get to color table */
_UINT16 bcWidth;
_UINT16 bcHeight;
_UINT16 bcPlanes;
_UINT16 bcBitCount;
};
Global::BlipType GetFormatPict(unsigned char* data, int size)
{

View File

@ -37,29 +37,29 @@
namespace ImageHelper
{
struct __BITMAPINFOHEADER
{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
};
struct __BITMAPINFOHEADER
{
_UINT32 biSize;
_INT32 biWidth;
_INT32 biHeight;
_UINT16 biPlanes;
_UINT16 biBitCount;
_UINT32 biCompression;
_UINT32 biSizeImage;
_INT32 biXPelsPerMeter;
_INT32 biYPelsPerMeter;
_UINT32 biClrUsed;
_UINT32 biClrImportant;
};
struct __BITMAPCOREHEADER
{
DWORD bcSize; /* used to get to color table */
WORD bcWidth;
WORD bcHeight;
WORD bcPlanes;
WORD bcBitCount;
};
struct __BITMAPCOREHEADER
{
_UINT32 bcSize; /* used to get to color table */
_UINT16 bcWidth;
_UINT16 bcHeight;
_UINT16 bcPlanes;
_UINT16 bcBitCount;
};
inline Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
{
@ -152,10 +152,10 @@ namespace ImageHelper
NSFile::CFileBinary file;
if (file.CreateFileW(file_name + L".bmp"))
{
WORD vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
DWORD dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
DWORD dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
DWORD dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
file.WriteFile((BYTE*)data, size);
file.CloseFile();

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@
//
#include "../DocFormatLib/DocFormatLib.h"
#include "../win32/ASCOfficeCriticalSection.h"
#include "../../OfficeUtils/src/ASCOfficeCriticalSection.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
@ -41,6 +41,7 @@
#include <string>
#include <windows.h>
#include <tchar.h>
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
@ -58,7 +59,6 @@ int _tmain(int argc, _TCHAR* argv[])
std::wstring outputDir = NSDirectory::GetFolderPath(sDstDocx);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
// doc->docx
COfficeDocFile docFile;
docFile.m_sTempFolder = outputDir;
@ -71,7 +71,7 @@ int _tmain(int argc, _TCHAR* argv[])
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstDocx, -1);
}
FileSystem::Directory::DeleteDirectory(dstTempPath);
NSDirectory::DeleteDirectory(dstTempPath);
return hRes;
}

View File

@ -338,6 +338,58 @@
<References>
</References>
<Files>
<Filter
Name="Common"
>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\ChartFromToBinary.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\ChartWriter.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Common\Common.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\CommonWriter.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\CSVReader.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Writer\CSVWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\DocxSerializer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj&#x0D;&#x0A;"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
</File>
</Filter>
<File
RelativePath=".\DocFormatTest.cpp"
>
@ -386,6 +438,14 @@
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -339,9 +339,9 @@ public:
if(ThemeColor.bColor)
sShd += L" w:themeFill=\"" + ThemeColor.ToStringColor() + L"\"";
if(ThemeColor.bTint)
sShd += L" w:themeFillTint=\"" + ThemeColor.ToStringColor() + L"\"";
sShd += L" w:themeFillTint=\"" + ThemeColor.ToStringTint() + L"\"";
if(ThemeColor.bShade)
sShd += L" w:themeFillShade=\"" + ThemeColor.ToStringColor() + L"\"";
sShd += L" w:themeFillShade=\"" + ThemeColor.ToStringShade() + L"\"";
}
sShd += L"/>";
}
@ -876,7 +876,7 @@ public:
pCStringWriter->WriteString(CellPr);
pCStringWriter->WriteString(L"</w:tcPr>");
}
for(int i = 0, length = TblStylePr.size(); i < length; ++i)
for(int i = 0, length = (int)TblStylePr.size(); i < length; ++i)
{
pCStringWriter->WriteString(TblStylePr[i]);
}
@ -1241,7 +1241,7 @@ public:
}
~docLvl()
{
for(int i = 0,length = Text.size(); i < length; i++)
for(int i = 0,length = (int)Text.size(); i < length; i++)
{
delete Text[i];
}
@ -1297,7 +1297,7 @@ public:
if(bText)
{
std::wstring sText;
for(int i = 0, length = Text.size(); i < length; ++i)
for(int i = 0, length = (int)Text.size(); i < length; ++i)
{
docLvlText* item = Text[i];
if(item->bText)
@ -1360,7 +1360,7 @@ public:
}
~docANum()
{
for(int i = 0, length = Lvls.size(); i < length; i++)
for(int i = 0, length = (int)Lvls.size(); i < length; i++)
{
delete Lvls[i];
}
@ -1380,7 +1380,7 @@ public:
std::wstring sCorrectNumStyleLink = XmlUtils::EncodeXmlString(NumStyleLink);
oWriterANum.WriteString(L"<w:numStyleLink w:val=\"" + sCorrectNumStyleLink + L"\"/>");
}
for(int i = 0, length = Lvls.size(); i < length; ++i)
for(int i = 0, length = (int)Lvls.size(); i < length; ++i)
{
Lvls[i]->Write(oWriterANum, i);
}
@ -1453,7 +1453,8 @@ public:
std::vector<std::wstring> aItems;
std::wstring sCurItem;
bool bDQuot = false;
for(int i = 0, length = fld.length(); i < length; ++i)
for(int i = 0, length = (int)fld.length(); i < length; ++i)
{
wchar_t sCurLetter = fld[i];
if('\"' == sCurLetter)
@ -1476,7 +1477,8 @@ public:
}
if(sCurItem.length() > 0)
aItems.push_back(sCurItem);
for(int i = 0, length = aItems.size(); i < length; ++i)
for(int i = 0, length = (int)aItems.size(); i < length; ++i)
{
std::wstring item = aItems[i];
if(bNextLink)
@ -1500,7 +1502,7 @@ public:
res = new WriteHyperlink();
boost::algorithm::trim(sLink);
int nAnchorIndex = sLink.find(L"#");
int nAnchorIndex = (int)sLink.find(L"#");
if(-1 != nAnchorIndex)
{
res->href = sLink.substr(0, nAnchorIndex);
@ -1589,7 +1591,7 @@ public:
}
~CComment()
{
for(int i = 0, length = replies.size(); i < length; ++i)
for(size_t i = 0; i <replies.size(); ++i)
{
delete replies[i];
}
@ -1597,32 +1599,37 @@ public:
}
int getCount()
{
return replies.size() + 1;
return (int)replies.size() + 1;
}
void setFormatStart(int IdFormatStart)
{
bIdFormat = true;
IdFormat = IdFormatStart;
for(int i = 0, length = replies.size(); i < length; ++i)
for(size_t i = 0; i < replies.size(); ++i)
{
CComment* pComment = replies[i];
CComment* pComment = replies[i];
pComment->bIdFormat = true;
pComment->IdFormat = IdFormatStart + i + 1;
pComment->IdFormat = (int)(IdFormatStart + i + 1);
}
}
std::wstring writeRef(const std::wstring& sBefore, const std::wstring& sRef, const std::wstring& sAfter)
{
std::wstring sRes;
sRes += (writeRef(this, sBefore, sRef, sAfter));
for(int i = 0, length = replies.size(); i < length; ++i)
for(size_t i = 0; i< replies.size(); ++i)
{
sRes += (writeRef(replies[i], sBefore, sRef, sAfter));
}
return sRes;
}
std::wstring writeTemplates(funcArg fReadFunction)
{
std::wstring sRes;
sRes += (fReadFunction(this));
for(int i = 0, length = replies.size(); i < length; ++i)
for(size_t i = 0; i < replies.size(); ++i)
sRes += (fReadFunction(replies[i]));
return sRes;
}
@ -1708,7 +1715,7 @@ public:
bool bFirst = true;
int nPrevIndex = 0;
for(int i = 0, length = sText.length(); i < length; i++)
for(size_t i = 0; i < sText.length(); i++)
{
wchar_t cToken = sText[i];
if('\n' == cToken)
@ -1717,7 +1724,7 @@ public:
nPrevIndex = i + 1;
}
}
writeContentWritePart(pComment, sText, nPrevIndex, sText.length(), bFirst, sRes);
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
}
sRes += L"</w:comment>";
return sRes;
@ -1736,7 +1743,7 @@ w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L
else
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->m_sParaId + L"\" w15:done=\"" + sDone + L"\"/>";
//расставляем paraIdParent
for(int i = 0, length = pComment->replies.size(); i < length; i++)
for(size_t i = 0; i < pComment->replies.size(); i++)
pComment->replies[i]->m_sParaIdParent = pComment->m_sParaId;
}
return sRes;
@ -1782,7 +1789,7 @@ public:
{
m_mapComments[pComment->IdOpen] = pComment;
addAuthor(pComment);
for(int i = 0, length = pComment->replies.size(); i < length; i++)
for(size_t i = 0; i < pComment->replies.size(); i++)
addAuthor(pComment->replies[i]);
}
}
@ -1866,7 +1873,7 @@ public:
}
~CDrawingPropertyWrap()
{
for(int i = 0, length = Points.size(); i < length; ++i)
for(size_t i = 0; i < Points.size(); ++i)
delete Points[i];
Points.clear();
}
@ -2211,7 +2218,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
sXml += L"<wp:start x=\"" + std::to_wstring(emuX) + L"\" y=\"" + std::to_wstring(emuY) + L"\"/>";
}
for(int i = 0, length = DrawingPropertyWrap.Points.size(); i < length; ++i)
for(size_t i = 0; i < DrawingPropertyWrap.Points.size(); ++i)
{
CDrawingPropertyWrapPoint* pWrapPoint = DrawingPropertyWrap.Points[i];
if(pWrapPoint->bX && pWrapPoint->bY)

View File

@ -760,11 +760,11 @@ public:
{
Tabs oTabs;
res = Read2(length, &Binary_pPrReader::ReadTabs, this, &oTabs);
int nLen = oTabs.m_aTabs.size();
size_t nLen = oTabs.m_aTabs.size();
if(nLen > 0)
{
pCStringWriter->WriteString(std::wstring(_T("<w:tabs>")));
for(int i = 0; i < nLen; ++i)
for(size_t i = 0; i < nLen; ++i)
{
Tab& oTab = oTabs.m_aTabs[i];
long nTab = SerializeCommon::Round( g_dKoef_mm_to_twips * oTab.Pos);
@ -1386,7 +1386,7 @@ public:
if( c_oSerProp_secPrType::hdrftrelem == type )
{
int nHdrFtrIndex = m_oBufferedStream.GetLong();
if(nHdrFtrIndex >= 0 && nHdrFtrIndex <= m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size())
if(nHdrFtrIndex >= 0 && nHdrFtrIndex <= (int)m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size())
{
Writers::HdrFtrItem* pHdrFtrItem = m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders[nHdrFtrIndex];
pHdrFtrItem->m_sFilename;
@ -1411,7 +1411,7 @@ public:
if( c_oSerProp_secPrType::hdrftrelem == type )
{
int nHdrFtrIndex = m_oBufferedStream.GetLong();
if(nHdrFtrIndex >= 0 && nHdrFtrIndex <= oBinary_HdrFtrTableReader.m_oHeaderFooterWriter.m_aFooters.size())
if(nHdrFtrIndex >= 0 && nHdrFtrIndex <= (int)oBinary_HdrFtrTableReader.m_oHeaderFooterWriter.m_aFooters.size())
{
Writers::HdrFtrItem* pHdrFtrItem = oBinary_HdrFtrTableReader.m_oHeaderFooterWriter.m_aFooters[nHdrFtrIndex];
pHdrFtrItem->m_sFilename;
@ -1979,7 +1979,7 @@ public:
if(true == orowPrAfterBefore.bGridAfter && orowPrAfterBefore.nGridAfter > 0 && false == orowPrAfterBefore.oAfterWidth.bW)
{
//ищем по tblGrid
long nGridLength = m_aCurTblGrid.size();
long nGridLength = (long)m_aCurTblGrid.size();
if(orowPrAfterBefore.nGridAfter < nGridLength)
{
double nSumW = 0;
@ -2396,14 +2396,14 @@ public:
int Read()
{
int res = ReadTable(&Binary_NumberingTableReader::ReadNumberingContent, this);
for(int i = 0, length = m_aDocANums.size(); i < length; ++i)
for(size_t i = 0; i < m_aDocANums.size(); ++i)
{
docANum* pdocANum = m_aDocANums[i];
pdocANum->Write(oNumberingWriters.m_oANum);
delete m_aDocANums[i];
}
m_aDocANums.clear();
for(int i = 0, length = m_aDocNums.size(); i < length; ++i)
for(size_t i = 0; i < m_aDocNums.size(); ++i)
{
m_aDocNums[i]->Write(oNumberingWriters.m_oNumList);
delete m_aDocNums[i];
@ -3366,7 +3366,7 @@ public:
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathBottomNodesValType::Val == type )
{
LONG lVal = Mm_To_Dx(m_oBufferedStream.GetDouble());
LONG lVal = (LONG)Mm_To_Dx(m_oBufferedStream.GetDouble());
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:interSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
@ -3398,7 +3398,7 @@ public:
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathBottomNodesValType::Val == type )
{
LONG lVal = Mm_To_Dx(m_oBufferedStream.GetDouble());
LONG lVal = (LONG)Mm_To_Dx(m_oBufferedStream.GetDouble());
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:intraSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
@ -3411,7 +3411,7 @@ public:
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathBottomNodesValType::Val == type )
{
LONG lVal = Mm_To_Dx(m_oBufferedStream.GetDouble());
LONG lVal = (LONG)Mm_To_Dx(m_oBufferedStream.GetDouble());
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:lMargin m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
@ -3462,7 +3462,7 @@ public:
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathBottomNodesValType::Val == type )
{
LONG lVal = Mm_To_Dx(m_oBufferedStream.GetDouble());
LONG lVal = (LONG)Mm_To_Dx(m_oBufferedStream.GetDouble());
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:postSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
@ -3475,7 +3475,7 @@ public:
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathBottomNodesValType::Val == type )
{
LONG lVal = Mm_To_Dx(m_oBufferedStream.GetDouble());
LONG lVal = (LONG)Mm_To_Dx(m_oBufferedStream.GetDouble());
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:preSp m:val=\"" + std::to_wstring(lVal)+ L"\"/>");
}
@ -3488,7 +3488,7 @@ public:
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathBottomNodesValType::Val == type )
{
LONG lVal = Mm_To_Dx(m_oBufferedStream.GetDouble());
LONG lVal = (LONG)Mm_To_Dx(m_oBufferedStream.GetDouble());
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:rMargin m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
@ -3518,7 +3518,7 @@ public:
int res = c_oSerConstants::ReadOk;
if ( c_oSer_OMathBottomNodesValType::Val == type )
{
LONG lVal = Mm_To_Dx(m_oBufferedStream.GetDouble());
LONG lVal = (LONG)Mm_To_Dx(m_oBufferedStream.GetDouble());
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:wrapIndent m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
@ -6526,7 +6526,9 @@ public:
}
int Read_Background(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:displayBackgroundShape/>");
int res = c_oSerConstants::ReadOk;
Background* pBackground = static_cast<Background*>(poResult);
if( c_oSerBackgroundType::Color == type )
@ -6590,7 +6592,7 @@ public:
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
std::wstring sThemeDir;
int nIndex = m_oFileWriter.m_sThemePath.rfind(FILE_SEPARATOR_CHAR);
int nIndex = (int)m_oFileWriter.m_sThemePath.rfind(FILE_SEPARATOR_CHAR);
if(-1 != nIndex)
sThemeDir = m_oFileWriter.m_sThemePath.substr(0, nIndex);
@ -7129,12 +7131,12 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes
if(nCurType == c_oSerHdrFtrTypes::Header)
{
m_oHeaderFooterWriter.m_aHeaders.push_back(poHdrFtrItem);
poHdrFtrItem->m_sFilename = L"header" + std::to_wstring(m_oHeaderFooterWriter.m_aHeaders.size()) + L".xml";
poHdrFtrItem->m_sFilename = L"header" + std::to_wstring((int)m_oHeaderFooterWriter.m_aHeaders.size()) + L".xml";
}
else
{
m_oHeaderFooterWriter.m_aFooters.push_back(poHdrFtrItem);
poHdrFtrItem->m_sFilename = L"footer" + std::to_wstring(m_oHeaderFooterWriter.m_aFooters.size()) + L".xml";
poHdrFtrItem->m_sFilename = L"footer" + std::to_wstring((int)m_oHeaderFooterWriter.m_aFooters.size()) + L".xml";
}
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
@ -7371,7 +7373,7 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
return res;
}
for(int i = 0, length = aTypes.size(); i < length; ++i)
for(size_t i = 0; i < aTypes.size(); ++i)
{
BYTE mtiType = aTypes[i];
long mtiOffBits = aOffBits[i];
@ -7437,7 +7439,7 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes")), std::wstring(_T("endnotes.xml")), std::wstring(), &rId);
}
for(int i = 0, length = m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size(); i < length; ++i)
for(size_t i = 0; i < m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size(); ++i)
{
Writers::HdrFtrItem* pHeader = m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders[i];
if(false == pHeader->IsEmpty())
@ -7447,7 +7449,7 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
pHeader->rId = L"rId" + std::to_wstring( rId );
}
}
for(int i = 0, length = m_oFileWriter.m_oHeaderFooterWriter.m_aFooters.size(); i < length; ++i)
for(size_t i = 0; i < m_oFileWriter.m_oHeaderFooterWriter.m_aFooters.size(); ++i)
{
Writers::HdrFtrItem* pFooter = m_oFileWriter.m_oHeaderFooterWriter.m_aFooters[i];
if(false == pFooter->IsEmpty())

View File

@ -121,7 +121,7 @@ namespace Writers
CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelectFormat);
if(NULL != pFontInfo)
{
for(int i = 0; i < 10; ++i)
for (size_t i = 0; i < 10; ++i)
{
BYTE cElem = pFontInfo->m_aPanose[i];
if(0 != cElem)

View File

@ -61,7 +61,7 @@ namespace BinDocxRW
void BinaryHeaderFooterTableWriter::WriteHdrFtrContent(std::vector<OOX::CHdrFtr*>& aHdrFtrs, std::vector<SimpleTypes::EHdrFtr>& aHdrFtrTypes, std::vector<OOX::Logic::CSectionProperty*>& aHdrSectPrs, bool bHdr)
{
int nCurPos = 0;
for(int i = 0, length = aHdrFtrs.size(); i < length; ++i)
for(size_t i = 0; i < aHdrFtrs.size(); ++i)
{
OOX::CHdrFtr* pHdrFtr = aHdrFtrs[i];
SimpleTypes::EHdrFtr eType = aHdrFtrTypes[i];

View File

@ -149,8 +149,8 @@ namespace BinDocxRW
switch(border.m_oVal.get().GetValue())
{
case SimpleTypes::bordervalueNone:
case SimpleTypes::bordervalueNil:m_oStream.WriteBYTE(border_None);break;
default:m_oStream.WriteBYTE(border_Single);break;
case SimpleTypes::bordervalueNil: m_oStream.WriteBYTE(border_None); break;
default: m_oStream.WriteBYTE(border_Single); break;
}
}
@ -306,8 +306,8 @@ namespace BinDocxRW
m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
switch(Shd.m_oVal.get().GetValue())
{
case SimpleTypes::shdNil: m_oStream.WriteBYTE(shd_Nil);break;
default: m_oStream.WriteBYTE(shd_Clear);break;
case SimpleTypes::shdNil: m_oStream.WriteBYTE(shd_Nil);break;
default: m_oStream.WriteBYTE(shd_Clear);break;
}
}
//Value
@ -538,7 +538,9 @@ namespace BinDocxRW
case SimpleTypes::themeMinorBidi:
case SimpleTypes::themeMinorEastAsia:
case SimpleTypes::themeMinorHAnsi:sFontAscii = m_poTheme->GetMinorFont();break;
}
default:
break;
}
}
else if(oFont.m_sAscii.IsInit())
sFontAscii = oFont.m_sAscii.get();
@ -556,7 +558,9 @@ namespace BinDocxRW
case SimpleTypes::themeMinorBidi:
case SimpleTypes::themeMinorEastAsia:
case SimpleTypes::themeMinorHAnsi:sFontHAnsi = m_poTheme->GetMinorFont();break;
}
default:
break;
}
}
else if(oFont.m_sHAnsi.IsInit())
sFontHAnsi = oFont.m_sHAnsi.get();
@ -573,7 +577,8 @@ namespace BinDocxRW
case SimpleTypes::themeMinorBidi:
case SimpleTypes::themeMinorEastAsia:
case SimpleTypes::themeMinorHAnsi:sFontCS = m_poTheme->GetMinorFont();break;
}
default: break;
}
}
else if(oFont.m_sCs.IsInit())
sFontCS = oFont.m_sCs.get();
@ -590,7 +595,8 @@ namespace BinDocxRW
case SimpleTypes::themeMinorBidi:
case SimpleTypes::themeMinorEastAsia:
case SimpleTypes::themeMinorHAnsi:sFontAE = m_poTheme->GetMinorFont();break;
}
default: break;
}
}
else if(oFont.m_sEastAsia.IsInit())
sFontAE = oFont.m_sEastAsia.get();
@ -774,28 +780,22 @@ namespace BinDocxRW
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBOOL(rPr.m_oVanish->m_oVal.ToBool());
}
if (false != rPr.m_sTextOutline.IsInit())
if (false != rPr.m_oTextOutline.IsInit())
{
std::wstring sTextOutline = rPr.m_sTextOutline.get2();
//делаем replace потому что читать имена node без namespace можем а атрибуты нет, потому что храним их в map
XmlUtils::replace_all(sTextOutline, L"w14:", L"");
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::TextOutline);
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::TextOutline);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
int nCurPos = m_oBcw.WriteItemWithLengthStart();
m_pOfficeDrawingConverter->GetRecordBinary(XMLWRITER_RECORD_TYPE_TEXT_OUTLINE, sTextOutline);
m_oBcw.m_oStream.WriteRecord2(0, rPr.m_oTextOutline);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (false != rPr.m_sTextFill.IsInit())
if (rPr.m_oTextFill.getType() != OOX::et_Unknown)
{
std::wstring sTextFill = rPr.m_sTextFill.get2();
//делаем replace потому что читать имена node без namespace можем а атрибуты нет, потому что храним их в map
XmlUtils::replace_all(sTextFill, L"w14:", L"");
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::TextFill);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
int nCurPos = m_oBcw.WriteItemWithLengthStart();
m_pOfficeDrawingConverter->GetRecordBinary(XMLWRITER_RECORD_TYPE_TEXT_FILL, sTextFill);
m_oBcw.m_oStream.WriteRecord1(0, rPr.m_oTextFill);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(rPr.m_oDel.IsInit())
@ -1394,7 +1394,8 @@ namespace BinDocxRW
{
case SimpleTypes::pageorientPortrait: Orientation = orientation_Portrait;break;
case SimpleTypes::pageorientLandscape: Orientation = orientation_Landscape;break;
}
default: break;
}
}
}
//W
@ -1480,14 +1481,14 @@ namespace BinDocxRW
OOX::CHdrFtr* pHdrFtr = (OOX::CHdrFtr*)oFile.operator->();
if(bHdr)
{
nIndex = m_oBinaryHeaderFooterTableWriter->m_aHeaders.size();
nIndex = (int)m_oBinaryHeaderFooterTableWriter->m_aHeaders.size();
m_oBinaryHeaderFooterTableWriter->m_aHeaders.push_back(pHdrFtr);
m_oBinaryHeaderFooterTableWriter->m_aHeaderTypes.push_back(oRef.m_oType->GetValue());
m_oBinaryHeaderFooterTableWriter->m_aHeaderSectPrs.push_back(pSectPr);
}
else
{
nIndex = m_oBinaryHeaderFooterTableWriter->m_aFooters.size();
nIndex = (int)m_oBinaryHeaderFooterTableWriter->m_aFooters.size();
m_oBinaryHeaderFooterTableWriter->m_aFooters.push_back(pHdrFtr);
m_oBinaryHeaderFooterTableWriter->m_aFooterTypes.push_back(oRef.m_oType->GetValue());
m_oBinaryHeaderFooterTableWriter->m_aFooterSectPrs.push_back(pSectPr);
@ -3049,6 +3050,8 @@ namespace BinDocxRW
OOX::Logic::CBdo* pBdo = static_cast<OOX::Logic::CBdo*>(item);
WriteDocumentContent(pBdo->m_arrItems);
}break;
default:
break;
}
}
//SectPr & Background
@ -3236,6 +3239,8 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
break;
}
default:
break;
}
}
}
@ -3268,7 +3273,9 @@ namespace BinDocxRW
case OOX::et_w_commentRangeEnd: nCurPos = m_oBcw.WriteItemStart(c_oSerParType::CommentEnd); break;
case OOX::et_w_commentReference: nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::CommentReference);break;
}
default:
break;
}
int nCurPos2 = m_oBcw.WriteItemStart(c_oSer_CommentsType::Id);
m_oBcw.m_oStream.WriteLONG(oId->GetValue());
@ -3738,6 +3745,8 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
break;
}
default:
break;
}
}
}
@ -4062,6 +4071,8 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
break;
}
default:
break;
}
}
}
@ -4179,7 +4190,9 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
break;
}
}
default:
break;
}
}
}
void WriteMathFName(const OOX::Logic::CFName &pFName)
@ -4414,7 +4427,9 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
break;
}
}
default:
break;
}
}
}
void WriteMathMaxDist(const OOX::Logic::CMaxDist &pMaxDist)
@ -5074,7 +5089,7 @@ namespace BinDocxRW
}
}
//Если первый элемент символ надо выставить в его настройки шрифт
if(nIndexStart < pRun->m_arrItems.size() && OOX::et_w_sym == pRun->m_arrItems[nIndexStart]->getType())
if(nIndexStart < (int)pRun->m_arrItems.size() && OOX::et_w_sym == pRun->m_arrItems[nIndexStart]->getType())
{
OOX::Logic::CSym* oSym = static_cast<OOX::Logic::CSym*>(pRun->m_arrItems[nIndexStart]);
if(oSym->m_oFont.IsInit())
@ -5123,7 +5138,9 @@ namespace BinDocxRW
case SimpleTypes::brtypeColumn: nBreakType = c_oSerRunType::columnbreak; break;
case SimpleTypes::brtypePage: nBreakType = c_oSerRunType::pagebreak; break;
case SimpleTypes::brtypeTextWrapping: nBreakType = c_oSerRunType::linebreak; break;
}
default:
break;
}
if(-1 != nBreakType)
{
m_oBcw.m_oStream.WriteBYTE(nBreakType);
@ -5159,7 +5176,7 @@ namespace BinDocxRW
m_eFldState = SimpleTypes::fldchartypeEnd;
if(m_aFldChars.size() > 0)
{
int nIndex = m_aFldChars.size() - 1;
int nIndex = (int)m_aFldChars.size() - 1;
FldStruct* pFldStruct = m_aFldChars[nIndex];
RELEASEOBJECT(pFldStruct);
m_aFldChars.erase(m_aFldChars.begin() + nIndex);
@ -5351,6 +5368,8 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
break;
}
default:
break;
}
}
}
@ -6913,7 +6932,9 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
break;
}
}
default:
break;
}
}
}
void WriteColorSchemeMapping(const OOX::Settings::CColorSchemeMapping& oColorSchemeMapping)

View File

@ -61,7 +61,7 @@ bool BinDocxRW::CDocxSerializer::ConvertDocxToDoct(const std::wstring& sSrcFileN
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
if(saveToFile(strEditorBin, strDirSrc, sXMLOptions))
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName, -1))
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName))
return true;
return false;
}
@ -88,7 +88,7 @@ bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const std::wstring& sSrcFileN
if(loadFromFile(sEditorBin, strDirDst, sXMLOptions, sThemePath, sMediaPath, sEmbedPath))
{
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName, -1))
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName, true))
return true;
}
}
@ -219,7 +219,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
//проверяем формат
bool bValidFormat = false;
std::wstring sSignature(g_sFormatSignature);
int nSigLength = sSignature.length();
int nSigLength = (int)sSignature.length();
if(nBase64DataSize > nSigLength)
{
std::string sCurSig((char*)pBase64Data, nSigLength);

View File

@ -58,7 +58,7 @@ namespace DocWrapper {
{
//подбор перенесен в js
return;
for (int i = 0; i < fontTable->m_arrFonts.size(); ++i)
for (size_t i = 0; i < fontTable->m_arrFonts.size(); ++i)
addToFontMap(*fontTable->m_arrFonts[i]);
}

View File

@ -275,7 +275,7 @@ namespace BinXlsxRW{
oXlsx.Write(oPath, sAdditionalContentTypes);
//zip
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(sTempDir, sDstFile, -1);
oOfficeUtils.CompressFileOrDirectory(sTempDir, sDstFile, true);
//clean
NSDirectory::DeleteDirectory(sTempDir);
}

View File

@ -378,6 +378,7 @@
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
@ -414,6 +415,7 @@
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (

View File

@ -2,6 +2,9 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml_wrapper", "..\win32\cpxml.vcproj", "{41BED424-4EAF-4053-8A5F-1E2A387D53D1}"
ProjectSection(ProjectDependencies) = postProject
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormatReaderLib", "..\win32\cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}"
ProjectSection(ProjectDependencies) = postProject
@ -21,7 +24,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormulasConvert", "..\wi
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
@ -30,7 +35,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFil
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"

View File

@ -31,18 +31,22 @@
*/
// OdfFileTest.cpp
#include "../../../OfficeUtils/src/OfficeUtils.h"
#include <stdio.h>
#include <tchar.h>
#include "../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../src/ConvertOO2OOX.h"
#include "../../src/ConvertOO2OOX.h"
#if defined(_WIN64)
#pragma comment(lib, "../../../build/bin/icu/win_64/icuuc.lib")
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#pragma comment(lib, "../../../build/bin/icu/win_32/icuuc.lib")
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 2) return 1;
@ -50,12 +54,12 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT hr = S_OK;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argc > 2 ? argv[2] : sSrcDoc + L"-my.docx"; //xlsx pptx
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.xlsx"; //xlsx pptx docx
std::wstring outputDir = FileSystem::Directory::GetFolderPath(dstPath);
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
std::wstring srcTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
std::wstring srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
// распаковываем исходник во временную директорию
COfficeUtils oCOfficeUtils(NULL);
@ -64,14 +68,14 @@ int _tmain(int argc, _TCHAR* argv[])
hr = ConvertOO2OOX(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", false, NULL);
FileSystem::Directory::DeleteDirectory(srcTempPath);
NSDirectory::DeleteDirectory(srcTempPath);
if (hr != S_OK) return hr;
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), -1))
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), true))
return hr;
FileSystem::Directory::DeleteDirectory(dstTempPath);
NSDirectory::DeleteDirectory(dstTempPath);
////////////////////////////////////////////////////////////////////////
return 0;

View File

@ -43,11 +43,11 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
@ -63,7 +63,9 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib"
AdditionalDependencies="gdi32.lib Rpcrt4.lib"
ShowProgress="0"
Version=""
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
@ -369,6 +371,30 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>

View File

@ -34,18 +34,15 @@
#include <boost/optional/optional_io.hpp>
#include <boost/optional.hpp>
namespace cpdoccore
/// внешнее объявление для Optional, используем boost::optional
template <class T>
struct optional
{
/// внешнее объявление для Optional, используем boost::optional
template <class T>
struct optional
{
typedef T Base;
typedef boost::optional<T> Type;
};
typedef T Base;
typedef boost::optional<T> Type;
};
#define _CP_OPT(V) optional<V>::Type
#define _CP_OPT(V) optional<V>::Type
}

View File

@ -24,7 +24,8 @@ DEFINES += UNICODE \
_USE_LIBXML2_READER_ \
_USE_XMLLITE_READER_ \
USE_LITE_READER \
LIBXML_READER_ENABLED
LIBXML_READER_ENABLED \
DONT_WRITE_EMBEDDED_FONTS
INCLUDEPATH += ../include
INCLUDEPATH += ../../DesktopEditor/freetype-2.5.2/include

View File

@ -569,7 +569,8 @@ mc:Ignorable=\"w14 wp14\">";
strm << L"<w:abstractNum w:abstractNumId=\"" << abstractNumId << "\">";
numIds.push_back(abstractNumId);
for (int i = 0; i < (std::min)( content.size(), (size_t)9); i++)
for (size_t i = 0; i < (std::min)( content.size(), (size_t)9); i++)
{
start_text_list_style(inst->get_text_list_style()->get_style_name());
content[i]->docx_convert(*this);
@ -1296,7 +1297,7 @@ void docx_conversion_context::start_text_changes (std::wstring id)
if (state.type == 2)
{
for (int i = 0 ; i < state.content.size(); i++)
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"\">";

View File

@ -531,8 +531,8 @@ mso-position-vertical-relative:text;";
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);
CP_XML_ATTR(L"id", L"Rect" + boost::lexical_cast<std::wstring>(val.id));
CP_XML_ATTR(L"o:spid", L"_x0000_s" + boost::lexical_cast<std::wstring>(1024 + 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));
CP_XML_ATTR(L"style", strStyle);
CP_XML_ATTR(L"fillcolor", L"#4f81bd [3204]");
CP_XML_ATTR(L"strokecolor", L"#243f60 [1604]");

View File

@ -47,12 +47,12 @@ docx_content_types_file::docx_content_types_file()
content()->add_default(L"jpg", L"image/jpeg");
content()->add_default(L"png", L"image/png");
//
content()->add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_override(L"/word/_rels/document.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_override(L"/word/document.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml");
content()->add_override(L"/word/settings.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml");
content()->add_override(L"/word/styles.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml");
content()->add_override(L"/word/fontTable.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml");
//content()->add_override(L"/word/_rels/document.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
//content()->add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content()->add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
}

View File

@ -58,7 +58,7 @@ bool is_internal(const std::wstring & uri, const std::wstring & packetRoot)
std::wstring resultPath = packetRoot + FILE_SEPARATOR_STR + mediaPath;
return NSDirectory::Exists(resultPath) || NSDirectory::Exists(mediaPath);
return NSFile::CFileBinary::Exists(resultPath) || NSDirectory::Exists(mediaPath);
}
mediaitems::item::item( std::wstring const & _href,

View File

@ -139,7 +139,7 @@ void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
if (ind == 0) values_[ind].strRef_.present = true;
else values_[ind].numRef_.present = true;
for (int i = 0; i < values.size(); i++)
for (size_t i = 0; i < values.size(); i++)
{
boost::algorithm::trim(values[i]);
if (ind == 0)
@ -240,7 +240,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_ATTR(L"val", values_[i].numRef_.num_cache_count);
}
for (int j = 0; j < values_[i].numRef_.num_cache.size(); j++)
for (size_t j = 0; j < values_[i].numRef_.num_cache.size(); j++)
{
std::wstring & v = values_[i].numRef_.num_cache[j];
@ -275,7 +275,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
CP_XML_ATTR(L"val", values_[i].numRef_.num_cache_count);
}
for (int j = 0; j < values_[i].numRef_.num_cache.size(); j++)
for (size_t j = 0; j < values_[i].numRef_.num_cache.size(); j++)
{
std::wstring & v = values_[i].numRef_.num_cache[j];
@ -312,7 +312,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_ATTR(L"val", values_[i].strRef_.str_cache_count);
}
for (int j = 0; j < values_[i].strRef_.str_cache.size(); j++)
for (size_t j = 0; j < values_[i].strRef_.str_cache.size(); j++)
{
std::wstring & v = values_[i].strRef_.str_cache[j];
@ -336,7 +336,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_ATTR(L"val", values_[i].strRef_.str_cache_count);
}
for (int j = 0; j < values_[i].strRef_.str_cache.size(); j++)
for (size_t j = 0; j < values_[i].strRef_.str_cache.size(); j++)
{
std::wstring & v = values_[i].strRef_.str_cache[j];
CP_XML_NODE(L"c:pt")
@ -405,7 +405,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
}
bool bEmpty_dPt = true;
for (int i = 0 ; i < content_.points_.size(); i++)
for (size_t i = 0 ; i < content_.points_.size(); i++)
{
if (content_.points_[i].bEnabled)
{
@ -415,9 +415,9 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
}
int indPoint = 0;
for (int i = 0 ; !bEmpty_dPt && i < content_.points_.size(); i++)
for (size_t i = 0 ; !bEmpty_dPt && i < content_.points_.size(); i++)
{
for (int j = 0 ; j < content_.points_[i].repeated_; j++)
for (size_t j = 0 ; j < content_.points_[i].repeated_; j++)
{
CP_XML_NODE(L"c:dPt")
{

View File

@ -35,9 +35,49 @@
#include "oox_drawing.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/svg_parser.h"
#include "../odf/datatypes/custom_shape_types_convert.h"
using namespace cpdoccore;
namespace svg_path
{
void oox_serialize(std::wostream & strm, std::vector<_polyline> & path)
{
CP_XML_WRITER(strm)
{
for (size_t i = 0; i < path.size(); i++)
{
oox_serialize(strm, path[i]);
}
}
}
void oox_serialize(std::wostream & strm, _polyline & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(val.command)
{
for (size_t i = 0; i < val.points.size(); i++)
{
oox_serialize(CP_XML_STREAM(), val.points[i]);
}
}
}
}
void oox_serialize(std::wostream & strm, _point & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:pt")
{
if (val.x)CP_XML_ATTR(L"x", (int)(val.x.get()));
if (val.y)CP_XML_ATTR(L"y", (int)(val.y.get()));
}
}
}
}
namespace cpdoccore {
static const std::wstring _ooxShapeType[]=
@ -53,41 +93,6 @@ static const std::wstring _ooxShapeType[]=
L"polygon",
};
void svg_path::oox_serialize(std::wostream & strm, std::vector<svg_path::_polyline> & path)
{
CP_XML_WRITER(strm)
{
BOOST_FOREACH(svg_path::_polyline & p, path)
{
oox_serialize(strm, p);
}
}
}
void svg_path::oox_serialize(std::wostream & strm, svg_path::_polyline const & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(val.command)
{
BOOST_FOREACH(svg_path::_point const & p, val.points)
{
oox_serialize(CP_XML_STREAM(), p);
}
}
}
}
void svg_path::oox_serialize(std::wostream & strm, svg_path::_point const & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:pt")
{
if (val.x)CP_XML_ATTR(L"x", (int)(val.x.get()));
if (val.y)CP_XML_ATTR(L"y", (int)(val.y.get()));
}
}
}
namespace oox {

View File

@ -40,6 +40,8 @@
#include "mediaitems.h"
#include "oox_drawing_fills.h"
#include "../odf/svg_parser.h"
#include "../../../Common/DocxFormat/Source/Base/Types_32.h"
namespace cpdoccore {
@ -83,13 +85,19 @@ namespace oox {
void serialize_shape (std::wostream & strm);
void serialize_xfrm (std::wostream & strm, const std::wstring & namespace_ = L"a", bool always_position = false);
void serialize_bodyPr (std::wostream & strm, const std::wstring & namespace_ = L"a");
};
};
typedef _CP_PTR(_oox_drawing) oox_drawing_ptr;
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val);
void oox_serialize_hlink (std::wostream & strm, const std::vector<_hlink_desc> & val);
}
}
}
namespace svg_path
{
void oox_serialize (std::wostream & strm, _point & val);
void oox_serialize (std::wostream & strm, _polyline & val);
void oox_serialize (std::wostream & strm, std::vector<_polyline> & path);
}

View File

@ -66,7 +66,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double)
{
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val",color);
CP_XML_ATTR(L"val", color);
if (opacity)
{
CP_XML_NODE(L"a:alpha")
@ -101,11 +101,56 @@ void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE(L"a:solidFill")
{
oox_serialize_srgb(CP_XML_STREAM(),val.solid->color,val.opacity);
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
}
}
}
void vml_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.solid)return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:fill")
{
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
CP_XML_ATTR(L"v:fill", val.solid->color);
if (val.opacity)
{
CP_XML_ATTR(L"v:opacity", *val.opacity);
}
}
}
}
void vml_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.bitmap) return;
if (!val.bitmap->isInternal) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:fill")
{
CP_XML_ATTR(L"r:id", val.bitmap->rId );
if (val.opacity)
{
CP_XML_ATTR(L"opacity",(int)(*val.opacity));
}
if (val.bitmap->bTile)
{
CP_XML_ATTR(L"type", L"pattern");
}
else
{
CP_XML_ATTR(L"type", L"frame");
}
CP_XML_ATTR(L"recolor", L"t");
}
}
}
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.bitmap) return;
@ -164,20 +209,69 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE(L"a:fillRect");
}
}
}
}
}
}
void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.gradient) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:fill")
{
if (!val.gradient->colors.empty())
{
CP_XML_ATTR(L"color2", val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
std::wstring colors_value;
for (size_t i = 0; i < val.gradient->colors.size(); i++)
{
colors_value += std::to_wstring(val.gradient->colors[i].pos) + L"% #" +
val.gradient->colors[i].color_ref + L",";
}
if (!colors_value.empty())
{
CP_XML_ATTR(L"colors", colors_value.substr(0, colors_value.length() - 1));
}
}
double angle =/*360 - */val.gradient->angle/* * 180./3.14159265358979323846*/;
CP_XML_ATTR(L"focus", L"100%");
switch(val.gradient->style)
{
case 0:
CP_XML_ATTR(L"type", L"gradient");
CP_XML_ATTR(L"method", L"linear");
CP_XML_ATTR(L"angle", angle);
break;
case 1:
//CP_XML_ATTR(L"type", L"gradientRadial");
//break;
case 2:
//CP_XML_ATTR(L"type", L"gradientCenter");
//break;
case 3:
//CP_XML_ATTR(L"type", L"gradientUnscaled");
//break;
CP_XML_ATTR(L"type", L"gradientRadial");
}
if (val.gradient->style > 0)
{
double focus_x = ((val.gradient->rect[2] - val.gradient->rect[0]) /2. + val.gradient->rect[0]) / 100.;
double focus_y = ((val.gradient->rect[3] - val.gradient->rect[1]) /2. + val.gradient->rect[1]) / 100.;
CP_XML_ATTR(L"focusposition", XmlUtils::DoubleToString(focus_x, L"%.2f") + L"," + XmlUtils::DoubleToString(focus_y, L"%.2f"));
}
}
}
}
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.gradient)
{
return;
}
if (!val.gradient) return;
CP_XML_WRITER(strm)
{
@ -233,6 +327,7 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.hatch)return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:pattFill")
@ -253,7 +348,38 @@ void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
}
}
}
void oox_serialize_fill(std::wostream & strm, const _oox_fill & val)
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id)
{
if (val.type == 0) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:background")
{
CP_XML_ATTR(L"id", L"_x0000_s" + std::to_wstring(1024 + id));
CP_XML_ATTR(L"o:bwmode", L"white");
CP_XML_ATTR(L"fillcolor", L"#" + color);
CP_XML_ATTR(L"o:targetscreensize", L"1024,768");
switch (val.type)
{
case 1:
vml_serialize_solid_fill(CP_XML_STREAM(), val);
break;
case 2:
vml_serialize_bitmap_fill(CP_XML_STREAM(), val);
break;
case 3:
vml_serialize_gradient_fill(CP_XML_STREAM(), val);
break;
case 4:
//vml_serialize_hatch_fill(CP_XML_STREAM(), val);
break;
}
}
}
}
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val)
{
switch (val.type)
{

View File

@ -143,9 +143,10 @@ namespace oox {
}
};
void oox_serialize_fill(std::wostream & strm, const _oox_fill & val);
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id);
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
}
}

View File

@ -99,7 +99,7 @@ void pptx_conversion_context::process_layouts()
get_text_context().set_process_layouts(true);
//актуальные
for (int layout_index =0; layout_index < layouts.content.size(); layout_index++)
for (size_t layout_index =0; layout_index < layouts.content.size(); layout_index++)
{
start_layout(layout_index);
@ -116,7 +116,7 @@ void pptx_conversion_context::process_layouts()
if (master)
{
for (int i = 0; i < master->content_.size(); i++)
for (size_t i = 0; i < master->content_.size(); i++)
{
odf_reader::office_element_ptr elm = master->content_[i];
if (elm->get_type() == odf_reader::typeDrawFrame)
@ -152,7 +152,7 @@ void pptx_conversion_context::process_master_pages()
get_text_context().set_process_layouts(true);
//берем только актуальные
for (int master_index =0; master_index < masters.content.size();master_index++)
for (size_t master_index =0; master_index < masters.content.size();master_index++)
{
start_master(master_index);
@ -210,7 +210,7 @@ void pptx_conversion_context::end_document()
{
unsigned int count = 1;
for (int i = 0; i < slideMasters_.size(); i++)
for (size_t i = 0; i < slideMasters_.size(); i++)
{
pptx_xml_slideMaster_ptr& slideM = slideMasters_[i];
@ -233,7 +233,7 @@ void pptx_conversion_context::end_document()
}
////////////////////////////////////////////////////////////////////////////////////////////////////
count=0;
for (int i = 0; i < slides_.size(); i++)
for (size_t i = 0; i < slides_.size(); i++)
{
pptx_xml_slide_ptr& slide = slides_[i];
@ -255,7 +255,7 @@ void pptx_conversion_context::end_document()
count++;
}
///////////////////////////////////////////////////////////////////////////////////////////
for (int i = 0; i < slideLayouts_.size(); i++)
for (size_t i = 0; i < slideLayouts_.size(); i++)
{
pptx_xml_slideLayout_ptr& slideL = slideLayouts_[i];
@ -287,7 +287,7 @@ void pptx_conversion_context::end_document()
//добавляем диаграммы
count = 0;
for (int i = 0; i < charts_.size(); i++)
for (size_t i = 0; i < charts_.size(); i++)
{
count++;
package::chart_content_ptr content = package::chart_content::create();
@ -300,7 +300,7 @@ void pptx_conversion_context::end_document()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//добавляем темы
for (int i=0; i < themes_.size();i++)
for (size_t i=0; i < themes_.size(); i++)
{
output_document_->get_ppt_files().add_theme(themes_[i]);
@ -500,7 +500,7 @@ bool pptx_conversion_context::start_master(int master_index)
process_theme(masters.content[master_index].master_name);//add default theme - одинаковые но под разными именами
current_master().add_theme(current_theme().id(), L"tId1");
for (long i=0;i<masters.content[master_index].layouts.size();i++)
for (size_t i = 0; i < masters.content[master_index].layouts.size(); i++)
{
current_master().add_layout(masters.content[master_index].layouts[i].Id, masters.content[master_index].layouts[i].rId, 0x80000000 + last_uniq_big_id++);
}

View File

@ -433,8 +433,6 @@ void pptx_slide_context::end_shape()
void pptx_slide_context::end_table()
{
impl_->objects_.push_back(impl_->object_description_);
default_set();
}
bool pptx_slide_context::empty() const

View File

@ -376,7 +376,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
if (fill.bitmap)
{
bool isMediaInternal = false;
bool isMediaInternal = true;
std::wstring ref;
fill.bitmap->rId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);

View File

@ -207,7 +207,7 @@ void xlsx_drawing_context::end_group()
group_rect.cy -= group_rect.y;
group_rect.cx -= group_rect.x;
for (int i = 0; i < impl_->groups_.back()->child_objects_.size(); i++)
for (size_t i = 0; i < impl_->groups_.back()->child_objects_.size(); i++)
{
_rect & r = impl_->groups_.back()->child_objects_[i].svg_rect_.get();
@ -615,7 +615,7 @@ void xlsx_drawing_context::process_objects(xlsx_table_metrics & table_metrics)
}
void xlsx_drawing_context::process_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
{
for (int i = 0 ; i < objects.size(); i++)
for (size_t i = 0 ; i < objects.size(); i++)
{
drawing_object_description & obj = objects[i];

View File

@ -75,7 +75,7 @@ void xlsx_data_range::serialize_sort (std::wostream & _Wostream)
if (!byRow)
CP_XML_ATTR(L"columnSort", true);
for (int i = 0 ; i < bySort.size(); i++)
for (size_t i = 0 ; i < bySort.size(); i++)
{
bool in_range = true;
std::wstring ref1, ref2;

View File

@ -134,7 +134,7 @@ void xlsx_conversion_context::end_document()
{
std::wstringstream workbook_content;
for (int i = 0; i < sheets_.size(); i++)
for (size_t i = 0; i < sheets_.size(); i++)
{
xlsx_xml_worksheet_ptr& sheet = sheets_[i];
@ -191,7 +191,7 @@ void xlsx_conversion_context::end_document()
}
//добавляем диаграммы
for (int i = 0; i < charts_.size(); i++)
for (size_t i = 0; i < charts_.size(); i++)
{
package::chart_content_ptr content = package::chart_content::create();
@ -271,7 +271,7 @@ void xlsx_conversion_context::serialize_bookViews(std::wostream & strm)
{
if (sActiveTable)
{
for (int i = 0; i < sheets_.size(); i++)
for (size_t i = 0; i < sheets_.size(); i++)
{
if (sheets_[i]->name() == *sActiveTable)
{

View File

@ -44,7 +44,7 @@ const wchar_t * abstract_xml::name = L"abstract-xml";
std::wostream & abstract_xml::text_to_stream(std::wostream & _Wostream) const
{
for (int i = 0; i < xml_content_.size(); i++)
for (size_t i = 0; i < xml_content_.size(); i++)
{
xml_content_[i]->text_to_stream(_Wostream);
}
@ -53,7 +53,7 @@ std::wostream & abstract_xml::text_to_stream(std::wostream & _Wostream) const
std::wostream & abstract_xml::xml_to_stream(std::wostream & _Wostream) const
{
for (int i = 0; i < xml_content_.size(); i++)
for (size_t i = 0; i < xml_content_.size(); i++)
{
xml_content_[i]->xml_to_stream(_Wostream);
}

View File

@ -91,7 +91,7 @@ void calcext_conditional_formats::add_child_element( xml::sax * Reader, const st
}
void calcext_conditional_formats::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -116,7 +116,7 @@ void calcext_conditional_format::xlsx_convert(oox::xlsx_conversion_context & Con
Context.start_conditional_format(*calcext_target_range_address_);
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -149,7 +149,7 @@ void calcext_data_bar::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.set_conditional_format_dataBar(calcext_data_bar_attr_.calcext_min_length_, calcext_data_bar_attr_.calcext_max_length_);
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -170,7 +170,7 @@ void calcext_color_scale::add_child_element( xml::sax * Reader, const std::wstri
void calcext_color_scale::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_conditional_format_rule(3);
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -196,7 +196,7 @@ void calcext_icon_set::xlsx_convert(oox::xlsx_conversion_context & Context)
if (calcext_show_value_)
Context.set_conditional_format_showval(*calcext_show_value_);
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}

View File

@ -109,11 +109,11 @@ void common_draw_fill_attlist::add_attributes( const xml::attributes_wc_ptr & At
}
void common_draw_fill_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:fill-color", draw_fill_color_);
CP_XML_ATTR_OPT(L"draw:fill", draw_fill_);
CP_XML_ATTR_OPT(L"draw:fill-color", draw_fill_color_);
CP_XML_ATTR_OPT(L"draw:fill", draw_fill_);
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
CP_XML_ATTR_OPT(L"draw:image-opacity", draw_image_opacity_);
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
CP_XML_ATTR_OPT(L"draw:image-opacity", draw_image_opacity_);
CP_XML_ATTR_OPT(L"draw:fill-image-name", draw_fill_image_name_);
CP_XML_ATTR_OPT(L"draw:fill-gradient-name", draw_fill_gradient_name_);

View File

@ -216,10 +216,10 @@ int Compute_BorderWidth(const graphic_format_properties & graphicProperties, Bor
switch(borderSide)
{
case sideTop: borderValue = graphicProperties.common_border_attlist_.fo_border_top_; break;
case sideBottom: borderValue = graphicProperties.common_border_attlist_.fo_border_bottom_; break;
case sideLeft: borderValue = graphicProperties.common_border_attlist_.fo_border_left_; break;
case sideRight: borderValue = graphicProperties.common_border_attlist_.fo_border_right_; break;
case sideTop: borderValue = graphicProperties.common_border_attlist_.fo_border_top_; break;
case sideBottom: borderValue = graphicProperties.common_border_attlist_.fo_border_bottom_; break;
case sideLeft: borderValue = graphicProperties.common_border_attlist_.fo_border_left_; break;
case sideRight: borderValue = graphicProperties.common_border_attlist_.fo_border_right_; break;
}
if (!borderValue)
@ -281,14 +281,14 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
fill->style = 0;
point.pos = 0;
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 100;
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
}break;
@ -297,20 +297,20 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
fill->style = 0;
point.pos = 0;
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 50;
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 100;
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
}break;
@ -319,41 +319,35 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
case gradient_style::square:
case gradient_style::rectangular:
{
if (style == gradient_style::radial || style == gradient_style::ellipsoid) fill->style = 2;
if (style == gradient_style::radial ||
style == gradient_style::ellipsoid) fill->style = 2;
if (style == gradient_style::square ) fill->style = 1;
if (style == gradient_style::rectangular) fill->style = 3;
point.pos = 0;
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 100;
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point);
if (image_style->draw_cx_)//хохма - у мс в конвертилке из open-office перепутаны l & r !!!
point.pos = 100;
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
fill->rect[0] = fill->rect[1] = 0;
fill->rect[2] = fill->rect[3] = 100;
if (image_style->draw_cx_)
{
fill->rect[0]=image_style->draw_cx_->get_value();
fill->rect[2]=100-image_style->draw_cx_->get_value();
}
else
{
fill->rect[0]=0;
fill->rect[2]=100;
fill->rect[0] = 100 - image_style->draw_cx_->get_value();
fill->rect[2] = image_style->draw_cx_->get_value();
}
if (image_style->draw_cy_)
{
fill->rect[1]=image_style->draw_cy_->get_value();
fill->rect[3]=100-image_style->draw_cy_->get_value();
}
else
{
fill->rect[1]=0;
fill->rect[3]=100;
fill->rect[1] = 100 - image_style->draw_cy_->get_value();
fill->rect[3] = image_style->draw_cy_->get_value();
}
}break;
}
@ -427,8 +421,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{
switch(image->style_repeat_->get_type())
{
case style_repeat::Repeat : fill.bitmap->bTile = true; break;
case style_repeat::Stretch : fill.bitmap->bStretch = true; break;
case style_repeat::Repeat :
fill.bitmap->bTile = true;
fill.bitmap->bStretch = false;
break;
case style_repeat::Stretch :
fill.bitmap->bStretch = true;
fill.bitmap->bTile = false; //?? для background точно выключать
break;
}
}
if (image->draw_opacity_)
@ -445,8 +445,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{
switch(props.style_repeat_->get_type())
{
case style_repeat::Repeat : fill.bitmap->bTile = true; break;
case style_repeat::Stretch : fill.bitmap->bStretch = true; break;
case style_repeat::Repeat :
fill.bitmap->bTile = true;
fill.bitmap->bStretch = false;
break;
case style_repeat::Stretch :
fill.bitmap->bStretch = true;
fill.bitmap->bTile = false;
break;
}
}
else
@ -660,7 +666,7 @@ void xlsx_convert_transforms(std::wstring transformStr, oox::xlsx_conversion_con
boost::algorithm::split(transforms,transformStr, boost::algorithm::is_any_of(L")"), boost::algorithm::token_compress_on);
for (int i = 0; i < transforms.size(); i++)
for (size_t i = 0; i < transforms.size(); i++)
{
std::vector<std::wstring> transform;
boost::algorithm::split(transform, transforms[i], boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);

View File

@ -381,7 +381,7 @@ std::wstring draw_object::office_convert(odf_document * odfDocument, int type)
std::wstring temp_file = folderPath + FILE_SEPARATOR_STR + href_result;
COfficeUtils oCOfficeUtils(NULL);
oCOfficeUtils.CompressFileOrDirectory(objectOutPath.c_str(), temp_file.c_str(), -1);
oCOfficeUtils.CompressFileOrDirectory(objectOutPath.c_str(), temp_file.c_str(), true);
}
NSDirectory::DeleteDirectory(objectOutPath);

View File

@ -592,7 +592,7 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
_CP_OPT(vertical_pos) styleVerticallPos = graphicProperties.common_vertical_pos_attlist_.style_vertical_pos_;
_CP_OPT(double) dVal;
if (GetProperty(additional, L"svg:translate_y", dVal));
GetProperty(additional, L"svg:translate_y", dVal);
const _CP_OPT(length) translation = length(dVal ? *dVal : 0, length::pt);
const _CP_OPT(length) pageHeight = pageProperties.fo_page_height_;
@ -893,17 +893,17 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles() ,drawing->fill, bTxbx);
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.length() < 1))
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
{
std::wstring href = drawing->fill.bitmap->xlink_href_;
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
}
////////////////////////////////////////////////////
drawing->additional.push_back(odf_reader::_property(L"border_width_left", Compute_BorderWidth(graphicProperties, sideLeft)));
drawing->additional.push_back(odf_reader::_property(L"border_width_left", Compute_BorderWidth(graphicProperties, sideLeft)));
drawing->additional.push_back(odf_reader::_property(L"border_width_top", Compute_BorderWidth(graphicProperties, sideTop)));
drawing->additional.push_back(odf_reader::_property(L"border_width_right", Compute_BorderWidth(graphicProperties, sideRight)));
drawing->additional.push_back(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(graphicProperties, sideBottom)));
drawing->additional.push_back(odf_reader::_property(L"border_width_right", Compute_BorderWidth(graphicProperties, sideRight)));
drawing->additional.push_back(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(graphicProperties, sideBottom)));
if (graphicProperties.common_border_attlist_.fo_border_)
{
@ -1111,7 +1111,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
Context.set_run_state (false);
Context.set_paragraph_state (false);
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
@ -1393,7 +1393,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
common_draw_docx_convert(Context, common_draw_attlists_, drawing);
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}

View File

@ -71,14 +71,9 @@ namespace odf_reader {
void draw_g::pptx_convert(oox::pptx_conversion_context & Context)
{
int i=0;
int size = content_.size();
while(true)
{
if (i>=size)break;
office_element_ptr const & elm = content_[i];
elm->pptx_convert(Context);
i++;
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
}
void draw_frame::pptx_convert_placeHolder(oox::pptx_conversion_context & Context)
@ -204,7 +199,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
////////////////////////////////////////////////
oox_drawing_ = oox_drawing_ptr(new oox::_pptx_drawing());
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
@ -222,7 +217,7 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
////////////////////////////////////в принципе достаточно общая часть ...
Context.get_text_context().start_object();
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
@ -238,7 +233,7 @@ void draw_chart::pptx_convert(oox::pptx_conversion_context & Context)
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
Context.get_slide_context().set_chart(href);
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
@ -249,7 +244,7 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_text_box(); //rect с наваротами
Context.get_text_context().start_object();
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}

View File

@ -104,7 +104,7 @@ void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context)
}
////////////////////////////////////////////////
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
office_element_ptr const & elm = content_[i];
elm->xlsx_convert(Context);
@ -178,10 +178,10 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
////////////////////////////////////////////////////////////////////
properties.apply_to(Context.get_drawing_context().get_properties());
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_right",Compute_BorderWidth(properties, sideRight)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
if (properties.fo_clip_)
{
@ -196,7 +196,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
oox_drawing_ = oox_drawing_ptr(new oox::_xlsx_drawing());
////////////////////////////////////////////////
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
office_element_ptr const & elm = content_[i];
elm->xlsx_convert(Context);
@ -215,7 +215,7 @@ void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
////////////////////////////////////в принципе достаточно общая часть ...
Context.get_text_context().start_drawing_content();//... если в объекте есть текст он привяжется к объекту - иначе к ячейке
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -232,7 +232,7 @@ void draw_chart::xlsx_convert(oox::xlsx_conversion_context & Context)
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
Context.get_drawing_context().set_chart(href);
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -243,7 +243,7 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_text_context().start_drawing_content();
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}

View File

@ -47,11 +47,12 @@
#include "serialize_elements.h"
#include "style_graphic_properties.h"
#include "odfcontext.h"
#include "datatypes/length.h"
#include "datatypes/borderstyle.h"
#include "odfcontext.h"
#include "../odf/svg_parser.h"
#include "../docx/oox_drawing.h"
namespace cpdoccore {
@ -235,14 +236,16 @@ void draw_path::reset_svg_path()
}
else
{
std::vector<svg_path::_polyline> o_Polyline_pt;
std::vector<svg_path::_polyline> o_Polyline_cm;
std::vector<::svg_path::_polyline> o_Polyline_pt;
std::vector<::svg_path::_polyline> o_Polyline_cm;
bool res = svg_path::parseSvgD(o_Polyline_cm,draw_path_attlist_.svg_d_.get(),false);
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_path_attlist_.svg_d_.get(), false);
BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
for (size_t i = 0; i < o_Polyline_cm.size(); i++)
{
for (long i=0;i<poly.points.size();i++)
::svg_path::_polyline & poly = o_Polyline_cm[i];
for (size_t i = 0; i < poly.points.size(); i++)
{
if (poly.points[i].x)
{
@ -259,7 +262,7 @@ void draw_path::reset_svg_path()
{
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
::svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf_reader::_property(L"custom_path",output_.str()));
}
}
@ -295,14 +298,16 @@ void draw_polygon::reset_polygon_path()
}
else
{
std::vector<svg_path::_polyline> o_Polyline_pt;
std::vector<svg_path::_polyline> o_Polyline_cm;
std::vector<::svg_path::_polyline> o_Polyline_pt;
std::vector<::svg_path::_polyline> o_Polyline_cm;
bool res = svg_path::parsePolygon(o_Polyline_cm,draw_polygon_attlist_.draw_points_.get(),false, true);
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polygon_attlist_.draw_points_.get(),false, true);
BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
for (size_t ind = 0 ; ind < o_Polyline_cm.size(); ind++)
{
for (long i=0;i<poly.points.size();i++)
::svg_path::_polyline & poly = o_Polyline_cm[ind];
for (size_t i = 0; i < poly.points.size(); i++)
{
if (poly.points[i].x)
{
@ -319,7 +324,7 @@ void draw_polygon::reset_polygon_path()
{
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
::svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf_reader::_property(L"custom_path",output_.str()));
}
}
@ -351,28 +356,30 @@ void draw_polyline::reset_polyline_path()
}
else
{
std::vector<svg_path::_polyline> o_Polyline_pt;
std::vector<svg_path::_polyline> o_Polyline_cm;
std::vector<::svg_path::_polyline> o_Polyline_pt;
std::vector<::svg_path::_polyline> o_Polyline_cm;
bool res = svg_path::parsePolygon(o_Polyline_cm, draw_polyline_attlist_.draw_points_.get(), false, true);
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polyline_attlist_.draw_points_.get(), false, true);
_CP_OPT(double) start_x, start_y;
BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
for (size_t ind = 0 ; ind < o_Polyline_cm.size(); ind++)
{
for (long i=0;i<poly.points.size();i++)
::svg_path::_polyline & poly = o_Polyline_cm[ind];
for (size_t i = 0; i < poly.points.size(); i++)
{
if (poly.points[i].x)
{
if (!start_x)//вообщето это не верно .. но из за разных точек осей поворота фигура может "улететь"
start_x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu);
poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu);// - *start_x;
start_x = length(poly.points[i].x.get()/1000., length::cm).get_value_unit(length::emu);
poly.points[i].x = length(poly.points[i].x.get()/1000., length::cm).get_value_unit(length::emu);// - *start_x;
}
if (poly.points[i].y)
{
if (!start_y)
start_y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu);
poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu);// - *start_y;
start_y = length(poly.points[i].y.get()/1000., length::cm).get_value_unit(length::emu);
poly.points[i].y = length(poly.points[i].y.get()/1000., length::cm).get_value_unit(length::emu);// - *start_y;
}
}
o_Polyline_pt.push_back(poly);
@ -381,8 +388,9 @@ void draw_polyline::reset_polyline_path()
{
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf_reader::_property(L"custom_path",output_.str()));
::svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf_reader::_property(L"custom_path", output_.str()));
}
}
}
@ -592,9 +600,9 @@ void draw_caption::add_attributes( const xml::attributes_wc_ptr & Attributes )
/// draw-connector-attlist
void draw_connector_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"svg:d", svg_d_);
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
CP_APPLY_ATTR(L"draw:type",draw_type_);
CP_APPLY_ATTR(L"svg:d", svg_d_);
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
CP_APPLY_ATTR(L"draw:type", draw_type_);
}
// draw:connector
@ -618,35 +626,37 @@ void draw_connector::reset_svg_path()
}
else
{
std::vector<svg_path::_polyline> o_Polyline_pt;
std::vector<svg_path::_polyline> o_Polyline_cm;
std::vector<::svg_path::_polyline> o_Polyline_pt;
std::vector<::svg_path::_polyline> o_Polyline_cm;
bool res = svg_path::parseSvgD(o_Polyline_cm,draw_connector_attlist_.svg_d_.get(),false);
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_connector_attlist_.svg_d_.get(), false);
double x1=common_draw_attlists_.position_.svg_x_.get_value_or(length(0)).get_value_unit(length::emu);
double y1=common_draw_attlists_.position_.svg_y_.get_value_or(length(0)).get_value_unit(length::emu);
BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
for (size_t ind = 0 ; ind < o_Polyline_cm.size(); ind++)
{
for (long i=0;i<poly.points.size();i++)
::svg_path::_polyline & poly = o_Polyline_cm[ind];
for (size_t i = 0; i < poly.points.size();i++)
{
if (poly.points[i].x)
{
poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu) - x1;
poly.points[i].x = length(poly.points[i].x.get()/1000., length::cm).get_value_unit(length::emu) - x1;
}
if (poly.points[i].y)
{
poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu) - y1;
poly.points[i].y = length(poly.points[i].y.get()/1000., length::cm).get_value_unit(length::emu) - y1;
}
}
o_Polyline_pt.push_back(poly);
}
if (o_Polyline_pt.size()>0)
if (o_Polyline_pt.size() > 0)
{
sub_type_ = 6;
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
::svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf_reader::_property(L"custom_path",output_.str()));
}
}

View File

@ -40,8 +40,6 @@
#include "datatypes/common_attlists.h"
#include "../docx/xlsxconversioncontext.h"
#include "svg_parser.h"
namespace cpdoccore
{

View File

@ -45,7 +45,6 @@
#include <cpdoccore/odf/odf_document.h>
#include "serialize_elements.h"
#include "../docx/xlsx_utils.h"
#include "style_graphic_properties.h"
#include "odfcontext.h"
@ -53,6 +52,9 @@
#include "datatypes/length.h"
#include "datatypes/borderstyle.h"
#include "../docx/xlsx_utils.h"
#include "../docx/oox_drawing.h"
namespace cpdoccore {
using namespace odf_types;
@ -260,13 +262,13 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
{
std::vector<svg_path::_polyline> o_Polyline;
std::vector<::svg_path::_polyline> o_Polyline;
bool res = false;
try
{
res = svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
res = ::svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
}
catch(...)
{
@ -277,7 +279,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
{
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline);
::svg_path::oox_serialize(output_, o_Polyline);
shape->additional_.push_back(odf_reader::_property(L"custom_path", output_.str()));
set_shape = true;

View File

@ -53,7 +53,8 @@
#include "odfcontext.h"
#include "calcs_styles.h"
#include "svg_parser.h"
#include "../docx/oox_drawing.h"
namespace cpdoccore {
@ -320,13 +321,13 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
{
std::vector<svg_path::_polyline> o_Polyline;
std::vector<::svg_path::_polyline> o_Polyline;
bool res = false;
try
{
res = svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
res = ::svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
}
catch(...)
{
@ -337,7 +338,7 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
{
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline);
::svg_path::oox_serialize(output_, o_Polyline);
Context.get_slide_context().set_property(odf_reader::_property(L"custom_path", output_.str()));
set_shape = true;

View File

@ -45,15 +45,16 @@
#include <cpdoccore/odf/odf_document.h>
#include "serialize_elements.h"
#include "../docx/xlsx_utils.h"
#include "style_graphic_properties.h"
#include "odfcontext.h"
#include "calcs_styles.h"
#include "svg_parser.h"
#include "datatypes/length.h"
#include "datatypes/borderstyle.h"
#include "../docx/xlsx_utils.h"
#include "../docx/oox_drawing.h"
namespace cpdoccore {
using namespace odf_types;
@ -274,13 +275,13 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
{
std::vector<svg_path::_polyline> o_Polyline;
std::vector<::svg_path::_polyline> o_Polyline;
bool res = false;
try
{
res = svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
res = ::svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
}
catch(...)
{
@ -291,7 +292,7 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
{
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline);
::svg_path::oox_serialize(output_, o_Polyline);
Context.get_drawing_context().set_property(odf_reader::_property(L"custom_path", output_.str()));
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)

View File

@ -99,7 +99,7 @@ void math_semantics::add_child_element( xml::sax * Reader, const std::wstring &
void math_semantics::oox_convert(oox::math_context & Context)
{
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);

View File

@ -193,7 +193,7 @@ void math_msqrt::oox_convert(oox::math_context & Context)
strm << L"<m:deg/>";
strm << L"<m:e>";
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);
@ -297,7 +297,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
}
}
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);

View File

@ -64,7 +64,7 @@ void math_mtable::oox_convert(oox::math_context & Context)
std::wostream & strm = Context.output_stream();
strm << L"<m:m>";
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);
@ -92,12 +92,12 @@ void math_mtr::oox_convert(oox::math_context & Context)
std::wostream & strm = Context.output_stream();
strm << L"<m:mr>";
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
strm << L"<m:e>";
//strm << L"<m:e>"; // EqArray записался в числитель вместо знаменателя.docx - дублирование
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);
strm << L"</m:e>";
//strm << L"</m:e>";
}
strm << L"</m:mr>";
}
@ -142,7 +142,7 @@ void math_mtd::oox_convert(oox::math_context & Context)
std::wostream & strm = Context.output_stream();
strm << L"<m:e>";
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);

View File

@ -187,8 +187,10 @@ void odf_document::Impl::parse_fonts()
break;
}
BOOST_FOREACH(office_element_ptr & elm, fontFaceDecls->style_font_face_)
{
for (size_t i = 0; i < fontFaceDecls->style_font_face_.size(); i++)
{
office_element_ptr & elm = fontFaceDecls->style_font_face_[i];
style_font_face* fontFace = dynamic_cast<style_font_face*>( elm.get() );
if (!fontFace)
{
@ -243,8 +245,10 @@ void odf_document::Impl::parse_manifests()
if (!document)return;
int res =-1;
BOOST_FOREACH(office_element_ptr & elm, document->manifests_)
{
for (size_t i = 0; i < document->manifests_.size(); i++)
{
office_element_ptr & elm = document->manifests_[i];
manifest_entry * entry = dynamic_cast<manifest_entry *>(elm.get());
if (!entry)continue;
@ -281,15 +285,18 @@ void odf_document::Impl::parse_settings()
office_settings * settings = dynamic_cast<office_settings*>(document->office_settings_.get());
if (!settings) return;
BOOST_FOREACH(office_element_ptr & elm, settings->content_)
{
for (size_t i = 0; i < settings->content_.size(); i++)
{
office_element_ptr & elm = settings->content_[i];
settings_config_item_set * item_set = dynamic_cast<settings_config_item_set *>(elm.get());
if (!item_set)continue;
if (item_set->config_name_ == L"ooo:configuration-settings")
{
BOOST_FOREACH(office_element_ptr & elm_sett, item_set->content_)
{
for (size_t j = 0; j < item_set->content_.size(); j++)
{
office_element_ptr & elm_sett = item_set->content_[j];
settings_config_item * sett = dynamic_cast<settings_config_item *>(elm_sett.get());
if (!sett)continue;
@ -298,8 +305,10 @@ void odf_document::Impl::parse_settings()
}
else if (item_set->config_name_ == L"ooo:view-settings")
{
BOOST_FOREACH(office_element_ptr & elm_sett, item_set->content_)
{
for (size_t j = 0; j < item_set->content_.size(); j++)
{
office_element_ptr & elm_sett = item_set->content_[j];
settings_config_item * sett = dynamic_cast<settings_config_item *>(elm_sett.get());
if (sett)
context_->Settings().add_view(sett->config_name_, sett->content_);
@ -308,13 +317,13 @@ void odf_document::Impl::parse_settings()
settings_config_item_map_indexed *map_sett = dynamic_cast<settings_config_item_map_indexed *>(elm_sett.get());
if ((map_sett) && (map_sett->config_name_ == L"Views"))
{
for (int i = 0; i < map_sett->content_.size(); i++)
for (size_t i = 0; i < map_sett->content_.size(); i++)
{
settings_config_item_map_entry *entry = dynamic_cast<settings_config_item_map_entry *>(map_sett->content_[i].get());
if (!entry) continue;
context_->Settings().start_view();
for (int j = 0; j < entry->content_.size(); j++)
for (size_t j = 0; j < entry->content_.size(); j++)
{
settings_config_item * sett = dynamic_cast<settings_config_item *>(entry->content_[j].get());
if (sett)
@ -323,14 +332,14 @@ void odf_document::Impl::parse_settings()
settings_config_item_map_named *map_v = dynamic_cast<settings_config_item_map_named *>(entry->content_[j].get());
if (map_v)
{
for (int n = 0; n < map_v->content_.size(); n++)
for (size_t n = 0; n < map_v->content_.size(); n++)
{
settings_config_item_map_entry *entry_v = dynamic_cast<settings_config_item_map_entry *>(map_v->content_[n].get());
if (!entry_v) continue;
context_->Settings().start_table_view(entry_v->config_name_);
for (int k = 0; k < entry_v->content_.size(); k++)
for (size_t k = 0; k < entry_v->content_.size(); k++)
{
sett = dynamic_cast<settings_config_item *>(entry_v->content_[k].get());
if (sett)
@ -378,9 +387,11 @@ void odf_document::Impl::parse_styles()
}
// parse page layout
BOOST_FOREACH(office_element_ptr & elm, automaticStyles->style_page_layout_)
{
style_page_layout * pageLayout = dynamic_cast<style_page_layout *>(elm.get());
for (size_t i = 0; i < automaticStyles->style_page_layout_.size(); i++)
{
office_element_ptr & elm = automaticStyles->style_page_layout_[i];
style_page_layout * pageLayout = dynamic_cast<style_page_layout *>(elm.get());
if (!pageLayout)
{
_CP_LOG << L"[warning] error reading page layout\n";
@ -390,9 +401,11 @@ void odf_document::Impl::parse_styles()
context_->pageLayoutContainer().add_page_layout(pageLayout);
} // end parse page layout
BOOST_FOREACH(office_element_ptr & elm, automaticStyles->styles_.style_style_)
{
style * styleInst = dynamic_cast<style*>(elm.get());
for (size_t i = 0; i < automaticStyles->styles_.style_style_.size(); i++)
{
office_element_ptr & elm = automaticStyles->styles_.style_style_[i];
style * styleInst = dynamic_cast<style*>(elm.get());
if (!styleInst)
{
_CP_LOG << L"[warning] error reading style\n";
@ -412,9 +425,11 @@ void odf_document::Impl::parse_styles()
);
}
// list styles
BOOST_FOREACH(office_element_ptr & elm, automaticStyles->styles_.text_list_style_)
{
text_list_style * listStyle = dynamic_cast<text_list_style *>(elm.get());
for (size_t i = 0; i < automaticStyles->styles_.text_list_style_.size(); i++)
{
office_element_ptr & elm = automaticStyles->styles_.text_list_style_[i];
text_list_style * listStyle = dynamic_cast<text_list_style *>(elm.get());
if (!listStyle)
{
_CP_LOG << L"[warning] error list style\n";
@ -436,9 +451,11 @@ void odf_document::Impl::parse_styles()
break;
}
BOOST_FOREACH(office_element_ptr & elm, masterStyles->style_master_page_)
{
style_master_page * masterPage = dynamic_cast<style_master_page *>(elm.get());
for (size_t i = 0; i < masterStyles->style_master_page_.size(); i++)
{
office_element_ptr & elm = masterStyles->style_master_page_[i];
style_master_page * masterPage = dynamic_cast<style_master_page *>(elm.get());
if (!masterPage)
{
_CP_LOG << L"[warning] error reading master page\n";
@ -464,9 +481,11 @@ void odf_document::Impl::parse_styles()
}
// default styles
BOOST_FOREACH(office_element_ptr & elm, docStyles->style_default_style_)
{
default_style * styleInst = dynamic_cast<default_style *>(elm.get());
for (size_t i = 0; i < docStyles->style_default_style_.size(); i++)
{
office_element_ptr & elm = docStyles->style_default_style_[i];
default_style * styleInst = dynamic_cast<default_style *>(elm.get());
if (!styleInst)
{
_CP_LOG << L"[warning] error reading default style\n";
@ -483,9 +502,11 @@ void odf_document::Impl::parse_styles()
L"",
L"");
}
BOOST_FOREACH(office_element_ptr & elm, docStyles->style_presentation_page_layout_)
{
style_presentation_page_layout * pageLayout = dynamic_cast<style_presentation_page_layout *>(elm.get());
for (size_t i = 0; i < docStyles->style_presentation_page_layout_.size(); i++)
{
office_element_ptr & elm = docStyles->style_presentation_page_layout_[i];
style_presentation_page_layout * pageLayout = dynamic_cast<style_presentation_page_layout *>(elm.get());
if (!pageLayout)
continue;
@ -494,9 +515,11 @@ void odf_document::Impl::parse_styles()
}
// common styles
BOOST_FOREACH(office_element_ptr & elm, docStyles->styles_.style_style_)
{
style * styleInst = dynamic_cast<style*>(elm.get());
for (size_t i = 0; i < docStyles->styles_.style_style_.size(); i++)
{
office_element_ptr & elm = docStyles->styles_.style_style_[i];
style * styleInst = dynamic_cast<style*>(elm.get());
if (!styleInst)
{
_CP_LOG << L"[warning] error reading style\n";
@ -519,8 +542,10 @@ void odf_document::Impl::parse_styles()
}
// list styles
BOOST_FOREACH(office_element_ptr & elm, docStyles->styles_.text_list_style_)
{
for (size_t i = 0; i < docStyles->styles_.text_list_style_.size(); i++)
{
office_element_ptr & elm = docStyles->styles_.text_list_style_[i];
text_list_style * listStyle = dynamic_cast<text_list_style *>(elm.get());
if (!listStyle)
{
@ -531,9 +556,11 @@ void odf_document::Impl::parse_styles()
context_->listStyleContainer().add_list_style(listStyle);
}
BOOST_FOREACH(const office_element_ptr & elm, docStyles->text_notes_configuration_)
{
const text_notes_configuration * conf = dynamic_cast<const text_notes_configuration *>(elm.get());
for (size_t i = 0; i < docStyles->text_notes_configuration_.size(); i++)
{
office_element_ptr & elm = docStyles->text_notes_configuration_[i];
const text_notes_configuration * conf = dynamic_cast<const text_notes_configuration *>(elm.get());
if (!conf)
continue;
@ -542,53 +569,65 @@ void odf_document::Impl::parse_styles()
}
BOOST_FOREACH(const office_element_ptr & elm, docStyles->styles_.number_styles_)
{
const number_style_base * style = dynamic_cast<const number_style_base *>(elm.get());
for (size_t i = 0; i < docStyles->styles_.number_styles_.size(); i++)
{
office_element_ptr & elm = docStyles->styles_.number_styles_[i];
const number_style_base * style = dynamic_cast<const number_style_base *>(elm.get());
if (!style)
continue;
context_->numberStyles().add(style->get_style_name(), elm);
}
BOOST_FOREACH(const office_element_ptr & elm, docStyles->draw_styles_.draw_gradient_)
{
draw_gradient * style = dynamic_cast<draw_gradient *>(elm.get());
for (size_t i = 0; i < docStyles->draw_styles_.draw_gradient_.size(); i++)
{
office_element_ptr & elm = docStyles->draw_styles_.draw_gradient_[i];
draw_gradient * style = dynamic_cast<draw_gradient *>(elm.get());
if (!style)
continue;
context_->drawStyles().add(L"gradient:" + style->get_style_name(), elm);
}
BOOST_FOREACH(const office_element_ptr & elm, docStyles->draw_styles_.draw_fill_image_)
{
draw_fill_image * style = dynamic_cast<draw_fill_image *>(elm.get());
for (size_t i = 0; i < docStyles->draw_styles_.draw_fill_image_.size(); i++)
{
office_element_ptr & elm = docStyles->draw_styles_.draw_fill_image_[i];
draw_fill_image * style = dynamic_cast<draw_fill_image *>(elm.get());
if (!style)
continue;
context_->drawStyles().add(L"bitmap:" + style->get_style_name(), elm);
}
BOOST_FOREACH(const office_element_ptr & elm, docStyles->draw_styles_.draw_opacity_)
{
draw_opacity * style = dynamic_cast<draw_opacity *>(elm.get());
for (size_t i = 0; i < docStyles->draw_styles_.draw_opacity_.size(); i++)
{
office_element_ptr & elm = docStyles->draw_styles_.draw_opacity_[i];
draw_opacity * style = dynamic_cast<draw_opacity *>(elm.get());
if (!style)
continue;
context_->drawStyles().add(L"opacity:" + style->get_style_name(), elm);
}
BOOST_FOREACH(const office_element_ptr & elm, docStyles->draw_styles_.draw_hatch_)
{
draw_hatch * style = dynamic_cast<draw_hatch *>(elm.get());
for (size_t i = 0; i < docStyles->draw_styles_.draw_hatch_.size(); i++)
{
office_element_ptr & elm = docStyles->draw_styles_.draw_hatch_[i];
draw_hatch * style = dynamic_cast<draw_hatch *>(elm.get());
if (!style)
continue;
context_->drawStyles().add(L"hatch:" + style->get_style_name(), elm);
}
BOOST_FOREACH(const office_element_ptr & elm, docStyles->templates_.table_templates_)
{
for (size_t i = 0; i < docStyles->templates_.table_templates_.size(); i++)
{
office_element_ptr & elm = docStyles->templates_.table_templates_[i];
table_table_template * style = dynamic_cast<table_table_template *>(elm.get());
if (!style)
@ -626,9 +665,11 @@ void odf_document::Impl::parse_styles()
break;
}
BOOST_FOREACH(office_element_ptr & elm, automaticStyles->styles_.style_style_)
{
style * styleInst = dynamic_cast<style*>(elm.get());
for (size_t i = 0; i < automaticStyles->styles_.style_style_.size(); i++)
{
office_element_ptr & elm = automaticStyles->styles_.style_style_[i];
style * styleInst = dynamic_cast<style*>(elm.get());
if (!styleInst)
{
_CP_LOG << L"[warning] error reading style\n";
@ -650,9 +691,11 @@ void odf_document::Impl::parse_styles()
);
}
BOOST_FOREACH(office_element_ptr & elm, automaticStyles->styles_.text_list_style_)
{
text_list_style * listStyle = dynamic_cast<text_list_style *>(elm.get());
for (size_t i = 0; i < automaticStyles->styles_.text_list_style_.size(); i++)
{
office_element_ptr & elm = automaticStyles->styles_.text_list_style_[i];
text_list_style * listStyle = dynamic_cast<text_list_style *>(elm.get());
if (!listStyle)
{
_CP_LOG << L"[warning] error reading list style\n";
@ -662,9 +705,11 @@ void odf_document::Impl::parse_styles()
context_->listStyleContainer().add_list_style(listStyle);
}
BOOST_FOREACH(const office_element_ptr & elm, automaticStyles->styles_.number_styles_)
{
const number_style_base * style = dynamic_cast<const number_style_base *>(elm.get());
for (size_t i = 0; i < automaticStyles->styles_.number_styles_.size(); i++)
{
office_element_ptr & elm = automaticStyles->styles_.number_styles_[i];
const number_style_base * style = dynamic_cast<const number_style_base *>(elm.get());
if (!style) continue;

View File

@ -223,8 +223,9 @@ void styles_container::add_master_page_name(const std::wstring & StyleName, cons
std::pair<int,std::wstring> presentation_layouts_instance::add_or_find(const std::wstring & layout_name,const std::wstring & master_name)
{
bool find = false;
int index =0;
for (index=0;index<content.size();index++)
size_t index =0;
for (index = 0; index < content.size(); index++)
{
if (content[index].layout_name == layout_name && content[index].master_name == master_name)
{
@ -250,8 +251,8 @@ std::pair<int,std::wstring> presentation_layouts_instance::add_or_find(const std
std::pair<int,std::wstring> presentation_masters_instance::add_or_find(const std::wstring & master_name)
{
bool find = false;
int index =0;
for (index=0;index<content.size();index++)
size_t index =0;
for (index = 0; index < content.size(); index++)
{
if (content[index].master_name == master_name)
{
@ -276,8 +277,8 @@ std::pair<int,std::wstring> presentation_masters_instance::add_or_find(const std
void presentation_masters_instance::add_layout_to(const std::wstring & master_name, presentation_layouts_instance::_layout & layout)
{
bool find = false;
int index =0;
for (index=0;index<content.size();index++)
size_t index = 0;
for (index = 0; index < content.size(); index++)
{
if (content[index].master_name == master_name)
{

View File

@ -41,7 +41,9 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h>
#include "odfcontext.h"
#include "draw_common.h"
namespace cpdoccore {
@ -111,14 +113,29 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
Context.add_page_properties(L""); //
Context.add_page_properties(L"");
}
//backcolor (for all pages)
//background (for all pages)
if (page_layout_instance * firtsPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{
if (style_page_layout_properties * prop = firtsPageLayout->properties())
{
if (prop->docx_back_serialize(Context.output_stream(), Context))
oox::_oox_fill fill;
Compute_GraphicFill(prop->style_page_layout_properties_attlist_.common_draw_fill_attlist_,
prop->style_page_layout_properties_elements_.style_background_image_,
Context.root()->odf_context().drawStyles(), fill);
if (prop->style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ || fill.type != 0)
{
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape",true));
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, fill.bitmap->isInternal, href);
}
int id = Context.get_drawing_context().get_current_shape_id();
if (prop->docx_background_serialize(Context.output_stream(), Context, fill, id))
{
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape", true));
}
}
}
}

View File

@ -57,7 +57,7 @@ class document_context;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
typedef weak_ptr<office_element>::Type office_element_weak_ptr;
typedef std::vector<office_element_ptr> office_element_ptr_array;
typedef std::vector<office_element_ptr> office_element_ptr_array;
class office_element : public xml::element<wchar_t>,
public common::read_doc_element,

View File

@ -73,11 +73,11 @@ public:
public:
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
_CP_OPT(odf_types::length_or_percent) fo_max_width_;
_CP_OPT(odf_types::length_or_percent) fo_max_height_;
_CP_OPT(odf_types::length_or_percent) fo_max_width_;
_CP_OPT(odf_types::length_or_percent) fo_max_height_;
///////////////////////////////
_CP_OPT(odf_types::color) svg_stroke_color_;

View File

@ -98,17 +98,17 @@ private:
virtual void add_text(const std::wstring & Text);
private:
odf_types::length style_position_;
_CP_OPT(odf_types::style_type) style_type_;
_CP_OPT(wchar_t) style_char_;
odf_types::length style_position_;
_CP_OPT(odf_types::style_type) style_type_;
_CP_OPT(wchar_t) style_char_;
_CP_OPT(odf_types::line_type) style_leader_type_;
_CP_OPT(odf_types::line_style) style_leader_style_;
_CP_OPT(odf_types::line_width) style_leader_width_;
_CP_OPT(odf_types::style_leader_color) style_leader_color_;
_CP_OPT(odf_types::line_type) style_leader_type_;
_CP_OPT(odf_types::line_style) style_leader_style_;
_CP_OPT(odf_types::line_width) style_leader_width_;
_CP_OPT(odf_types::style_leader_color) style_leader_color_;
_CP_OPT( std::wstring ) style_leader_text_;
_CP_OPT( odf_types::style_ref ) style_leader_text_style_;
_CP_OPT( std::wstring ) style_leader_text_;
_CP_OPT( odf_types::style_ref ) style_leader_text_style_;
};

View File

@ -54,7 +54,6 @@
#include "serialize_elements.h"
#include "odfcontext.h"
#include "draw_common.h"
namespace cpdoccore {
@ -904,12 +903,12 @@ void style_page_layout::add_child_element( xml::sax * Reader, const std::wstring
// style-page-layout-properties-attlist
void style_page_layout_properties_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"fo:page-width", fo_page_width_);
CP_APPLY_ATTR(L"fo:page-height", fo_page_height_);
CP_APPLY_ATTR(L"fo:page-width", fo_page_width_);
CP_APPLY_ATTR(L"fo:page-height", fo_page_height_);
common_num_format_attlist_.add_attributes(Attributes);
common_num_format_prefix_suffix_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"style:paper-tray-name", style_paper_tray_name_);
CP_APPLY_ATTR(L"style:print-orientation", style_print_orientation_);
CP_APPLY_ATTR(L"style:paper-tray-name", style_paper_tray_name_);
CP_APPLY_ATTR(L"style:print-orientation", style_print_orientation_);
common_horizontal_margin_attlist_.add_attributes(Attributes);
common_vertical_margin_attlist_.add_attributes(Attributes);
@ -919,7 +918,8 @@ void style_page_layout_properties_attlist::add_attributes( const xml::attributes
common_padding_attlist_.add_attributes(Attributes);
common_shadow_attlist_.add_attributes(Attributes);
common_background_color_attlist_.add_attributes(Attributes);
common_draw_fill_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
CP_APPLY_ATTR(L"style:print", style_print_);
CP_APPLY_ATTR(L"style:print-page-order", style_print_page_order_);
@ -1260,18 +1260,26 @@ void style_page_layout_properties::add_child_element( xml::sax * Reader, const s
{
style_page_layout_properties_elements_.add_child_element(Reader, Ns, Name, getContext());
}
bool style_page_layout_properties::docx_back_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
{
if (!style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_)return false;
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent) return true;
bool style_page_layout_properties::docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id)
{
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ &&
style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent)
return true; //??
//прозрачный фон
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"w:background")
{
std::wstring color = style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
CP_XML_ATTR(L"w:color",color);
std::wstring color = L"ffffff";
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_)
color = style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
CP_XML_ATTR(L"w:color", color);
oox::vml_serialize_background(CP_XML_STREAM(), fill, color, id);
}
}
return true;
@ -1556,7 +1564,7 @@ void header_footer_impl::docx_convert(oox::docx_conversion_context & Context)
if (content_.header_footer_content_.tracked_changes_)
content_.header_footer_content_.tracked_changes_->docx_convert(Context);
for (int i=0; i < content_.header_footer_content_.content_.size(); i++)
for (size_t i = 0; i < content_.header_footer_content_.content_.size(); i++)
{
content_.header_footer_content_.content_[i]->docx_convert(Context);
}

View File

@ -892,54 +892,26 @@ public:
odf_types::common_padding_attlist common_padding_attlist_;
odf_types::common_shadow_attlist common_shadow_attlist_;
// 15.2.10
odf_types::common_background_color_attlist common_background_color_attlist_;
// 15.2.12
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
// 15.2.13 TODO
_CP_OPT(std::wstring) style_print_;
// 15.2.14
_CP_OPT(odf_types::direction) style_print_page_order_;
// 15.2.15 TODO
_CP_OPT(std::wstring) style_first_page_number_;
// 15.2.16
_CP_OPT(odf_types::percent) style_scale_to_;
_CP_OPT(unsigned int) style_scale_to_pages_;
// 15.2.17
_CP_OPT(odf_types::table_centering) style_table_centering_;
// 15.2.18
_CP_OPT(odf_types::length) style_footnote_max_height_;
// 15.2.19
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
// 15.2.21
_CP_OPT(odf_types::layout_grid_mode) style_layout_grid_mode_;
// 15.2.22
_CP_OPT(odf_types::length) style_layout_grid_base_height_;
// 15.2.23
_CP_OPT(odf_types::length) style_layout_grid_ruby_height_;
// 15.2.24
_CP_OPT(unsigned int) style_layout_grid_lines_;
// 15.2.25
_CP_OPT(odf_types::color) style_layout_grid_color_;
// 15.2.26
_CP_OPT(bool) style_layout_grid_ruby_below_;
// 15.2.27
_CP_OPT(bool) style_layout_grid_print_;
// 15.2.28
_CP_OPT(bool) style_layout_grid_display_;
odf_types::common_background_color_attlist common_background_color_attlist_;
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
_CP_OPT(std::wstring) style_print_;
_CP_OPT(odf_types::direction) style_print_page_order_;
_CP_OPT(std::wstring) style_first_page_number_;
_CP_OPT(odf_types::percent) style_scale_to_;
_CP_OPT(unsigned int) style_scale_to_pages_;
_CP_OPT(odf_types::table_centering) style_table_centering_;
_CP_OPT(odf_types::length) style_footnote_max_height_;
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
_CP_OPT(odf_types::layout_grid_mode) style_layout_grid_mode_;
_CP_OPT(odf_types::length) style_layout_grid_base_height_;
_CP_OPT(odf_types::length) style_layout_grid_ruby_height_;
_CP_OPT(unsigned int) style_layout_grid_lines_;
_CP_OPT(odf_types::color) style_layout_grid_color_;
_CP_OPT(bool) style_layout_grid_ruby_below_;
_CP_OPT(bool) style_layout_grid_print_;
_CP_OPT(bool) style_layout_grid_display_;
};
@ -992,7 +964,7 @@ public:
};
// style:page-layout-properties
// style:page-layout-properties
class style_page_layout_properties : public office_element_impl<style_page_layout_properties>
{
public:
@ -1005,7 +977,7 @@ public:
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
bool docx_back_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
style_page_layout_properties() { }
@ -1020,7 +992,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(style_page_layout_properties);
// text:notes-configuration
// text:notes-configuration
class text_notes_configuration : public office_element_impl<text_notes_configuration>
{
public:

View File

@ -35,8 +35,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
namespace cpdoccore
{
namespace svg_path
{
void skipSpaces(int& io_rPos, const std::wstring& rStr, const int nLen)
@ -69,7 +67,7 @@ namespace svg_path
return isOnNumberChar(rStr[nPos],bSignAllowed);
}
bool getDoubleChar(double& o_fRetval,int & io_rPos, const std::wstring& rStr)
bool getDoubleChar(double& o_fRetval,int & io_rPos, const std::wstring& rStr)
{
wchar_t aChar( rStr[io_rPos] );
std::wstring sNumberString;
@ -121,7 +119,7 @@ namespace svg_path
return false;
}
bool importDoubleAndSpaces( double& o_fRetval, int& io_rPos, const std::wstring& rStr, const int nLen )
bool importDoubleAndSpaces( double& o_fRetval, int& io_rPos, const std::wstring& rStr, const int nLen )
{
if( !getDoubleChar(o_fRetval, io_rPos, rStr) )
return false;
@ -131,7 +129,7 @@ namespace svg_path
return true;
}
bool importFlagAndSpaces(int& o_nRetval, int& io_rPos, const std::wstring& rStr, const int nLen)
bool importFlagAndSpaces(int& o_nRetval, int& io_rPos, const std::wstring& rStr, const int nLen)
{
wchar_t aChar( rStr[io_rPos] );
@ -181,7 +179,6 @@ namespace svg_path
return bUseRelativeCoordinates ? cLowerCaseCommand : cUpperCaseCommand;
}
bool parseSvgD(std::vector<_polyline> & Polyline, const std::wstring & rSvgDStatement, bool bWrongPositionAfterZ)
{
Polyline.clear();
@ -808,6 +805,152 @@ namespace svg_path
}
}
bool parseVml(std::vector<_polyline> & Polyline, const std::wstring & rSvgDStatement)
{
Polyline.clear();
const int nLen(rSvgDStatement.length());
int nPos(0);
bool bIsClosed(false);
double nLastX( 0.0 );
double nLastY( 0.0 );
double nLastControlX( 0.0 );
double nLastControlY( 0.0 );
_polyline aCurrPoly;
skipSpaces(nPos, rSvgDStatement, nLen);
while(nPos < nLen)
{
bool bRelative (false);
bool bMoveTo (false);
const wchar_t aCurrChar(rSvgDStatement[nPos]);
aCurrPoly.command.clear();
switch(aCurrChar)
{
case 'x' :
{
nPos++;
bIsClosed = true;
} break;
case 'm' :
case 't' :
{
bMoveTo = true;
}
case 'l' :
case 'r' :
{
if('t' == aCurrChar || 'r' == aCurrChar)
{
bRelative = true;
}
if(aCurrPoly.points.size() > 0)
{
if(bIsClosed)
{
}
Polyline.push_back(aCurrPoly);
bIsClosed = false;
if(bMoveTo) aCurrPoly.command = L"m";
else aCurrPoly.command = L"l";
aCurrPoly.points.clear();
}
nPos++;
skipSpaces(nPos, rSvgDStatement, nLen);
aCurrPoly.command.clear();
while(nPos < nLen && isOnNumberChar(rSvgDStatement, nPos))
{
double nX, nY;
if(!importDoubleAndSpaces(nX, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nY, nPos, rSvgDStatement, nLen)) return false;
if(bRelative)
{
nX += nLastX;
nY += nLastY;
}
nLastX = nX;
nLastY = nY;
if(bMoveTo) aCurrPoly.command = L"m";
else aCurrPoly.command = L"l";
aCurrPoly.points.push_back(_point(nX, nY));
Polyline.push_back(aCurrPoly);
aCurrPoly.points.clear();
}
}break;
case 'v' :
bRelative = true;
case 'c' :
{
nPos++;
skipSpaces(nPos, rSvgDStatement, nLen);
while(nPos < nLen && isOnNumberChar(rSvgDStatement, nPos))
{
double nX, nY;
double nX1, nY1;
double nX2, nY2;
if(!importDoubleAndSpaces(nX1, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nY1, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nX2, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nY2, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nX, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nY, nPos, rSvgDStatement, nLen)) return false;
if(bRelative)
{
nX1 += nLastX;
nY1 += nLastY;
nX2 += nLastX;
nY2 += nLastY;
nX += nLastX;
nY += nLastY;
}
aCurrPoly.command = L"c";
aCurrPoly.points.push_back(_point(nX1, nY1));
aCurrPoly.points.push_back(_point(nX2, nY2));
aCurrPoly.points.push_back(_point(nX, nY));
Polyline.push_back(aCurrPoly);
aCurrPoly.points.clear();
nLastX = nX;
nLastY = nY;
nLastControlX = nX2;
nLastControlY = nY2;
}
}break;
default:
{
++nPos;
break;
}
}
}
return true;
}
}

View File

@ -39,10 +39,7 @@
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <cpdoccore/CPOptional.h>
namespace cpdoccore
{
#include "../../include/cpdoccore/CPOptional.h"
namespace svg_path
{
@ -60,23 +57,10 @@ namespace svg_path
std::vector<_point> points; //будем бить строку пути по количеству точек в буковках
};
//m - 1 point
//c - 3 point
//s - 2 point
//l - 1 point
//z - finish
//h - 0.5 point :)
//v - 0.5 point
//q - 2 point
//t - 1 point
//a - [[[[
void oox_serialize(std::wostream & _Wostream, _point const & val);
void oox_serialize(std::wostream & _Wostream, _polyline const & val);
void oox_serialize(std::wostream & _Wostream, std::vector<svg_path::_polyline> & path);
bool parseSvgD(std::vector<_polyline> & Polyline, const std::wstring & rSvgDStatement, bool bWrongPositionAfterZ);
bool parsePolygon(std::vector<_polyline> & Polyline, const std::wstring & rPolygonStatement, bool bWrongPositionAfterZ, bool closed);
}
bool parseVml(std::vector<_polyline> & Polyline, const std::wstring & path);
bool parseSvgD(std::vector<_polyline> & Polyline, const std::wstring & path, bool bWrongPositionAfterZ);
bool parsePolygon(std::vector<_polyline> & Polyline, const std::wstring & path, bool bWrongPositionAfterZ, bool closed);
}

View File

@ -640,14 +640,14 @@ const wchar_t * table_shapes::name = L"shapes";
void table_shapes::docx_convert(oox::docx_conversion_context & Context)
{
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
void table_shapes::pptx_convert(oox::pptx_conversion_context & Context)
{
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
@ -655,7 +655,7 @@ void table_shapes::pptx_convert(oox::pptx_conversion_context & Context)
void table_shapes::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}

View File

@ -60,7 +60,7 @@ void table_database_ranges::add_child_element( xml::sax * Reader, const std::wst
void table_database_ranges::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -101,7 +101,7 @@ void table_database_range::xlsx_convert(oox::xlsx_conversion_context & Context)
if (table_contains_header_)
Context.get_table_context().set_database_header(table_contains_header_->get());
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -124,7 +124,7 @@ void table_sort::add_child_element( xml::sax * Reader, const std::wstring & Ns,
void table_sort::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (int i = 0; i < table_sort_by_.size(); i++)
for (size_t i = 0; i < table_sort_by_.size(); i++)
{
table_sort_by * sort_by = dynamic_cast<table_sort_by*>(table_sort_by_[i].get());

View File

@ -67,7 +67,7 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
Context.get_table_context().start_cell_content();
Context.get_text_context().set_cell_text_properties(text_properties);
for (int i = 0 ; i < elements_.size(); i++)
for (size_t i = 0 ; i < elements_.size(); i++)
{
elements_[i]->xlsx_convert(Context);
}
@ -191,7 +191,7 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
CP_XML_STREAM();
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
office_element_ptr & elm = content_[i];
@ -233,7 +233,7 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
void table_table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (int i = 0; i < table_table_row_.size(); i++)
for (size_t i = 0; i < table_table_row_.size(); i++)
{
table_table_row_[i]->xlsx_convert(Context);
}
@ -241,7 +241,7 @@ void table_table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
void table_table_header_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (int i = 0; i < table_table_row_.size(); i++)
for (size_t i = 0; i < table_table_row_.size(); i++)
{
table_table_row_[i]->xlsx_convert(Context);
}
@ -274,7 +274,7 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
}
}
for (int i = 0; i < table_table_row_.size(); i++)
for (size_t i = 0; i < table_table_row_.size(); i++)
{
table_table_row_[i]->xlsx_convert(Context);
}
@ -293,7 +293,7 @@ void table_rows_no_group::xlsx_convert(oox::xlsx_conversion_context & Context)
void table_rows_and_groups::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
@ -336,7 +336,7 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
if (conditional_formats_)
conditional_formats_->xlsx_convert(Context);
for (int i = 0 ; i < table_named_.size(); i++)
for (size_t i = 0 ; i < table_named_.size(); i++)
{
table_named_[i]->xlsx_convert(Context);
}
@ -349,7 +349,7 @@ void table_columns::xlsx_convert(oox::xlsx_conversion_context & Context)
if (table_table_columns_)
table_table_columns_->xlsx_convert(Context);
for (int i = 0; i < table_table_column_.size(); i++)
for (size_t i = 0; i < table_table_column_.size(); i++)
{
table_table_column_[i]->xlsx_convert(Context);
}
@ -374,7 +374,7 @@ void table_columns_and_groups::xlsx_convert(oox::xlsx_conversion_context & Conte
table_columns_no_group_.xlsx_convert(Context);
*/
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
office_element_ptr & elm = content_[i];
elm->xlsx_convert(Context);
@ -383,7 +383,7 @@ void table_columns_and_groups::xlsx_convert(oox::xlsx_conversion_context & Conte
void table_table_header_columns::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (int i = 0; i < table_table_column_.size(); i++)
for (size_t i = 0; i < table_table_column_.size(); i++)
{
table_table_column_[i]->xlsx_convert(Context);
}

View File

@ -52,7 +52,7 @@ void paragraph_attrs::add_attributes( const xml::attributes_wc_ptr & Attributes
std::vector< std::wstring > classNamesArray;
boost::algorithm::split(classNamesArray, classNames, boost::algorithm::is_any_of(L" "));
for (int i = 0; i < classNamesArray.size(); i++)
for (size_t i = 0; i < classNamesArray.size(); i++)
{
text_class_names_.push_back( style_ref(classNamesArray[i]) );
}

View File

@ -387,7 +387,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
if (!Context.get_paragraph_keep())// например Appendix I_IPP.odt - tracked elements (
{
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
@ -1238,7 +1238,7 @@ void text_tracked_changes::add_child_element( xml::sax * Reader, const std::wstr
void text_tracked_changes::docx_convert(oox::docx_conversion_context & Context)
{
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
@ -1263,7 +1263,7 @@ void text_changed_region::docx_convert(oox::docx_conversion_context & Context)
Context.get_text_tracked_context().start_change (*text_id_);
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
@ -1296,7 +1296,7 @@ void text_unknown_base_change::docx_convert(oox::docx_conversion_context & Conte
//тут удаленный текст. не по стандарту сделать бы и форматы - стилями чтоли ....
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
Context.get_text_tracked_context().start_changes_content();
{
@ -1311,7 +1311,7 @@ void text_unknown_base_change::docx_convert(oox::docx_conversion_context & Conte
//if (para)
//{
// for (int j = 0; j < para->content_.size(); j++)
// for (size_t j = 0; j < para->content_.size(); j++)
// {
// para->content_[j]->docx_convert(Context);
// }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="OdfFormatReaderLib"
ProjectGUID="{50E20601-4A8D-4AFB-8870-63828D328429}"
RootNamespace="cpodf"

View File

@ -119,7 +119,7 @@ void header_footer_content::serialize(std::wostream & strm)
if (tracked_changes_)
tracked_changes_->serialize(strm);
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(strm);
}

View File

@ -296,8 +296,10 @@ void number_currency_symbol::serialize(std::wostream & strm)
CP_XML_ATTR_OPT(L"number:language", number_language_);
CP_XML_ATTR_OPT(L"number:country", number_country_);
for (long i=0; i < text_.size(); i++)
for (size_t i = 0; i < text_.size(); i++)
{
CP_XML_STREAM() << text_[i];
}
}
}
}

View File

@ -248,7 +248,7 @@ std::wstring odf_chart_context::Impl::convert_formula(std::wstring oox_formula)
chart_chart* odf_chart_context::Impl::get_current_chart()
{
for (long i=current_level_.size()-1; i>=0; i--)
for (long i = (long)current_level_.size() - 1; i >= 0; i--)
{
chart_chart * chart = dynamic_cast<chart_chart*>(current_level_[i].elm.get());
if (chart) return chart;
@ -257,7 +257,7 @@ chart_chart* odf_chart_context::Impl::get_current_chart()
}
chart_series* odf_chart_context::Impl::get_current_series()
{
for (long i=current_level_.size()-1; i>=0; i--)
for (long i = (long)current_level_.size() - 1; i >= 0; i--)
{
chart_series * chart = dynamic_cast<chart_series*>(current_level_[i].elm.get());
if (chart) return chart;
@ -706,7 +706,7 @@ void odf_chart_context::end_group_series()
bool presentZ = false;
long countX = 0;
long countY = 0;
for (long j = 0; j < impl_->axis_.size(); j++)
for (size_t j = 0; j < impl_->axis_.size(); j++)
{
if (impl_->axis_[j].dimension ==1) countX++;
else if (impl_->axis_[j].dimension ==3) presentZ = true;
@ -727,9 +727,9 @@ void odf_chart_context::end_group_series()
countY--;
}
for (long i=0; i < impl_->axis_group_series_.size(); i++)
for (size_t i=0; i < impl_->axis_group_series_.size(); i++)
{
for (long j = 0; j < impl_->axis_.size(); j++)
for (size_t j = 0; j < impl_->axis_.size(); j++)
{
if (impl_->axis_[j].oox_id == impl_->axis_group_series_[i] && impl_->axis_[j].dimension ==2)
{
@ -741,7 +741,7 @@ void odf_chart_context::end_group_series()
}
for (long i =0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
for (size_t i =0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
{
chart_series *series= dynamic_cast<chart_series*>(impl_->group_series_[i].get());
if (series)
@ -899,7 +899,7 @@ void odf_chart_context::end_plot_area()
if (plot_area)
{
std::wstring cell_range;
for (long i = 0; i < impl_->data_cell_ranges_.size(); i++)
for (size_t i = 0; i < impl_->data_cell_ranges_.size(); i++)
{
cell_range = cell_range + impl_->data_cell_ranges_[i].ref + L" ";
}
@ -928,7 +928,7 @@ void odf_chart_context::end_text()
odf_text_context * text_context_ = text_context();
if (text_context_ == NULL || impl_->current_level_.size() <1 )return;
for (long i=0; i< text_context_->text_elements_list_.size(); i++)
for (size_t i=0; i< text_context_->text_elements_list_.size(); i++)
{
if (text_context_->text_elements_list_[i].level ==0)
{
@ -1400,7 +1400,7 @@ void odf_chart_context::end_chart()
int cat = 0;
for (long i = 0; i < impl_->axis_.size() && impl_->categories_.size() > 0; i++)
for (size_t i = 0; i < impl_->axis_.size() && impl_->categories_.size() > 0; i++)
{
if (impl_->axis_[i].elm == NULL) continue;
@ -1626,7 +1626,7 @@ int odf_chart_context::Impl::create_local_table_rows(int curr_row, ods_table_sta
bool add = false;
for (long i = 0; i < cells.size(); i++)
for (size_t i = 0; i < cells.size(); i++)
{
if (cells[i].cash_only)
continue;
@ -1690,9 +1690,9 @@ void odf_chart_context::Impl::create_local_table()
int min_row = 0xffff;
//выкинем дублирующие ref
for (long i = 0; i < cash_.size(); i++)
for (size_t i = 0; i < cash_.size(); i++)
{
for (long j = i + 1; j < cash_.size(); j++)
for (size_t j = i + 1; j < cash_.size(); j++)
{
if (cash_[j].ref == cash_[i].ref && cash_[j].ref.length() > 1)
{
@ -1701,7 +1701,7 @@ void odf_chart_context::Impl::create_local_table()
}
}
for (long i = 0; i < cash_.size(); i++)
for (size_t i = 0; i < cash_.size(); i++)
{
std::vector<std::wstring> refs;
boost::algorithm::split(refs,cash_[i].ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
@ -1746,7 +1746,7 @@ void odf_chart_context::Impl::create_local_table()
row_header = true;
}
for (long j = 0; j < cash_[i].data_str.size(); j++)
for (size_t j = 0; j < cash_[i].data_str.size(); j++)
{
_cell_cash c = {0, 0, false, false, L""};
@ -1813,7 +1813,7 @@ void odf_chart_context::Impl::create_local_table()
table_elm->add_child_element(cols_elm);
for (long i=0; i < max_columns - (col_header ? 1 : 0); i++)
for (int i=0; i < max_columns - (col_header ? 1 : 0); i++)
cols_elm->add_child_element(col_elm);
office_element_ptr row_headers_elm;
@ -1840,12 +1840,12 @@ void odf_chart_context::Impl::create_local_table()
if ((std::min)(r1, r2) > min_row) min_row = (std::min)(r1, r2);
if ((std::min)(c1, c2) > min_col) min_col = (std::min)(c1, c2);
for (int i = 0 ; i < cells_cash_label.size(); i++)
for (size_t i = 0 ; i < cells_cash_label.size(); i++)
{
cells_cash_label[i].row -= min_row - 1;
cells_cash_label[i].col -= min_col - 1;
}
for (int i = 0 ; i < cells_cash.size(); i++)
for (size_t i = 0 ; i < cells_cash.size(); i++)
{
cells_cash[i].row -= min_row - 1;
cells_cash[i].col -= min_col - 1;

View File

@ -111,7 +111,7 @@ void odf_comment_context::start_comment(office_element_ptr &elm, int oox_id)
}
void odf_comment_context::end_comment(office_element_ptr &elm, int oox_id)
{
for(long i=0; i < impl_->comments_.size(); i++)
for (size_t i = 0; i < impl_->comments_.size(); i++)
{
if (impl_->comments_[i].oox_id == oox_id)
{
@ -138,7 +138,7 @@ void odf_comment_context::end_comment_content()
}
int odf_comment_context::find_by_id(int oox_id)
{
for(long i=0; i < impl_->comments_.size(); i++)
for (size_t i=0; i < impl_->comments_.size(); i++)
{
if (impl_->comments_[i].oox_id == oox_id)
{
@ -150,7 +150,7 @@ int odf_comment_context::find_by_id(int oox_id)
}
std::wstring odf_comment_context::find_name_by_id(int oox_id)
{
for(long i=0; i < impl_->comments_.size(); i++)
for (size_t i = 0; i < impl_->comments_.size(); i++)
{
if (impl_->comments_[i].oox_id == oox_id) return impl_->comments_[i].odf_name;
}

View File

@ -117,7 +117,7 @@ _mediaitems* odf_conversion_context::mediaitems()
void odf_conversion_context::end_document()
{
rels rels_;
for (long i=0; i< objects_.size(); i++)
for (size_t i = 0; i < objects_.size(); i++)
{
_object & object = objects_[i];
bool isRoot = (i == 0 ? true : false);

View File

@ -55,8 +55,7 @@
#include "style_text_properties.h"
#include "style_paragraph_properties.h"
#include "style_graphic_properties.h"
#include "style_page_layout_properties.h"
namespace cpdoccore
{
@ -175,6 +174,7 @@ struct odf_drawing_state
svg_y_ = boost::none;
svg_height_ = boost::none;
svg_width_ = boost::none;
fill_color_ = boost::none;
name_ = L"";
description_ = L"";
@ -208,7 +208,8 @@ struct odf_drawing_state
int z_order_;
bool hidden_;
_CP_OPT(double) rotateAngle;
_CP_OPT(double) rotateAngle;
_CP_OPT(unsigned int) fill_color_;
bool flipH;
bool flipV;
@ -238,8 +239,9 @@ public:
width = height = x = y = 0;
is_header_ = false;
is_footer_ = false;
is_header_ = false;
is_footer_ = false;
is_background_ = false;
//некоторые свойства для объектов графики не поддерживаюися в редакторах Liber && OpenOffice.net
//в MS Office и в нашем - проблем таких нет.
}
@ -254,6 +256,7 @@ public:
bool is_footer_;
bool is_header_;
bool is_background_;
void create_draw_base(int type);
office_element_ptr create_draw_element(int type);
@ -309,10 +312,18 @@ void odf_drawing_context::set_header_state(bool Val)
{
impl_->is_header_ = Val;
}
void odf_drawing_context::set_background_state(bool Val)
{
impl_->is_background_ = Val;
impl_->current_graphic_properties = new style_graphic_properties();
}
void odf_drawing_context::check_anchor()
{
return;
if ((impl_->is_footer_ || impl_->is_header_) && (impl_->anchor_settings_.run_through_) && (impl_->anchor_settings_.run_through_->get_type() == run_through::Background))
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) && (impl_->anchor_settings_.run_through_) && (impl_->anchor_settings_.run_through_->get_type() == run_through::Background))
{
set_anchor(anchor_type::Char);
//подозрительно на подложку страницы
@ -444,7 +455,18 @@ void odf_drawing_context::start_drawing()
}
void odf_drawing_context::end_drawing()
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (impl_->current_drawing_state_.elements_.empty())
{
if (impl_->is_background_ && impl_->current_graphic_properties)
{
style_page_layout_properties * current_layout_properties = impl_->odf_context_->page_layout_context()->last_layout()->get_properties();
current_layout_properties->style_page_layout_properties_attlist_.common_draw_fill_attlist_.apply_from(impl_->current_graphic_properties->content().common_draw_fill_attlist_);
delete impl_->current_graphic_properties;
impl_->current_graphic_properties = NULL;
impl_->current_drawing_state_.clear();
}
return;
}
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
@ -570,12 +592,13 @@ void odf_drawing_context::end_drawing()
{
impl_->tops_elements_.push_back(impl_->current_drawing_state_.elements_[0].elm);
}
///////////////
impl_->current_drawing_state_.clear();
impl_->current_graphic_properties = NULL;
impl_->current_paragraph_properties = NULL;
impl_->current_text_properties = NULL;
}
////////////////////////////////////////////////////////////////////////////
@ -629,7 +652,7 @@ void odf_drawing_context::Impl::create_draw_base(int type)
draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get());
if (draw == NULL)return;
//////////
styles_context_->create_style(L"",style_family::Graphic, true, false, -1);
styles_context_->create_style(L"", style_family::Graphic, true, false, -1);
office_element_ptr & style_shape_elm = styles_context_->last_state()->get_office_element();
std::wstring style_name;
@ -885,7 +908,7 @@ void odf_drawing_context::end_shape()
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
for (long i=0; i < shape_define->equations.size();i++)
for (size_t i = 0; i < shape_define->equations.size();i++)
{
office_element_ptr elm_eq;
create_element(L"draw", L"equation", elm_eq, impl_->odf_context_);
@ -899,7 +922,7 @@ void odf_drawing_context::end_shape()
end_element();
}
//-----------------------------
for (long i=0; i < shape_define->handles.size();i++)
for (size_t i = 0; i < shape_define->handles.size();i++)
{
office_element_ptr elm_h;
create_element(L"draw", L"handle", elm_h, impl_->odf_context_);
@ -1068,7 +1091,7 @@ void odf_drawing_context::set_no_fill()
switch(impl_->current_drawing_part_)
{
case Area:
if ((impl_->is_footer_ || impl_->is_header_) &&
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{
@ -1088,6 +1111,17 @@ void odf_drawing_context::set_type_fill(int type)
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = (draw_fill::type)type;
}
void odf_drawing_context::set_fill_color(unsigned int Color)
{
impl_->current_drawing_state_.fill_color_ = Color;
}
_CP_OPT(unsigned int) odf_drawing_context::get_fill_color()
{
return impl_->current_drawing_state_.fill_color_;
}
void odf_drawing_context::set_solid_fill(std::wstring hexColor)
{
if (!impl_->current_graphic_properties)return;
@ -1097,28 +1131,29 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = color(hexColor);
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
if ((impl_->is_footer_ || impl_->is_header_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{
}
else
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill::solid;
break;
case Line:
impl_->current_graphic_properties->content().svg_stroke_color_ = hexColor;
if (!impl_->current_graphic_properties->content().draw_stroke_)
impl_->current_graphic_properties->content().draw_stroke_=line_style(line_style::Solid);//default
if (!impl_->current_graphic_properties->content().svg_stroke_width_)
impl_->current_graphic_properties->content().svg_stroke_width_ = length(length(1,length::pt).get_value_unit(length::cm),length::cm);//default
break;
case Area:
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = color(hexColor);
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{
}
else
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill::solid;
break;
case Line:
impl_->current_graphic_properties->content().svg_stroke_color_ = hexColor;
if (!impl_->current_graphic_properties->content().draw_stroke_)
impl_->current_graphic_properties->content().draw_stroke_=line_style(line_style::Solid);//default
if (!impl_->current_graphic_properties->content().svg_stroke_width_)
impl_->current_graphic_properties->content().svg_stroke_width_ = length(length(1,length::pt).get_value_unit(length::cm),length::cm);//default
break;
}
}
void odf_drawing_context::set_z_order(int id)
{
if (id < 0)
@ -1243,7 +1278,7 @@ void odf_drawing_context::set_object_foreground(bool Val)
{
if (Val)
{
if (impl_->is_footer_|| impl_->is_header_)
if (impl_->is_footer_|| impl_->is_header_ || impl_->is_background_)
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
}
@ -1273,7 +1308,7 @@ void odf_drawing_context::set_margin_bottom (double valPt)
}
void odf_drawing_context::set_anchor(int type)
{
if ((impl_->is_footer_|| impl_->is_header_) && type == anchor_type::Page)
if ((impl_->is_footer_|| impl_->is_header_ || impl_->is_background_) && type == anchor_type::Page)
{
type = anchor_type::Paragraph;
}
@ -1369,7 +1404,7 @@ void odf_drawing_context::set_horizontal_pos(double offset_pt)
}
void odf_drawing_context::set_default_wrap_style()
{
if (impl_->is_header_ || impl_->is_footer_ )
if (impl_->is_header_ || impl_->is_footer_ || impl_->is_background_)
{
impl_->anchor_settings_.style_wrap_ = style_wrap::RunThrough;
}
@ -1879,7 +1914,7 @@ void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(d
//вложенные элементы
void odf_drawing_context::start_image(std::wstring odf_path)
{
if (impl_->is_footer_ || impl_->is_header_)
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
{
start_shape(142/*SimpleTypes::shapetypeRect*/);
start_bitmap_style();
@ -2011,7 +2046,7 @@ void odf_drawing_context::set_text_box_parent_style(std::wstring style_name)
void odf_drawing_context::end_image()
{
if (impl_->is_footer_ || impl_->is_header_)
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
{
end_bitmap_style();
end_shape();
@ -2093,7 +2128,7 @@ bool odf_drawing_context::is_exist_content()
void odf_drawing_context::finalize(office_element_ptr & root_elm)//для привязки
{
for (int i=0; i< impl_->tops_elements_.size(); i++)
for (size_t i=0; i< impl_->tops_elements_.size(); i++)
{
root_elm->add_child_element(impl_->tops_elements_[i]);
}
@ -2109,7 +2144,7 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
{
if (text_context == NULL || impl_->current_level_.size() <1 )return;
for (long i=0; i< text_context->text_elements_list_.size(); i++)
for (size_t i = 0; i < text_context->text_elements_list_.size(); i++)
{
if (text_context->text_elements_list_[i].level ==0)
{
@ -2179,9 +2214,11 @@ void odf_drawing_context::start_gradient_style()
gradient->draw_start_color_ = impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_;
if (gradient->draw_start_color_) gradient->draw_start_intensity_ = 100.;
gradient->draw_border_ = 0;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
}
void odf_drawing_context::set_gradient_type(gradient_style::type style)
{
@ -2198,7 +2235,7 @@ void odf_drawing_context::set_gradient_start(std::wstring hexColor, _CP_OPT(doub
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
gradient->draw_start_color_ = hexColor;
gradient->draw_start_color_ = hexColor;
gradient->draw_start_intensity_ = 100.;
}
void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(double) & intensiv)
@ -2209,15 +2246,15 @@ void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(doub
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
gradient->draw_end_color_ = hexColor;
gradient->draw_end_intensity_ = 100.;
gradient->draw_end_color_ = hexColor;
gradient->draw_end_intensity_ = 100.;
}
void odf_drawing_context::set_gradient_angle(double angle)
{
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
if (!gradient) return;
gradient->draw_angle_ = (270-angle)*10;//(int)((360 - angle)/180. * 3.14159265358979323846);
gradient->draw_angle_ = (270- angle) * 10;//(int)((360 - angle)/180. * 3.14159265358979323846);
}
void odf_drawing_context::set_gradient_rect(double l, double t, double r,double b)
{
@ -2721,7 +2758,7 @@ void odf_drawing_context::set_image_client_rect_inch(double l, double t, double
void odf_drawing_context::set_bitmap_link(std::wstring file_path)
{
std::wstring odf_ref_name ;
impl_->odf_context_->mediaitems()->add_or_find(file_path,_mediaitems::typeImage,odf_ref_name);
impl_->odf_context_->mediaitems()->add_or_find(file_path, _mediaitems::typeImage, odf_ref_name);
if (impl_->current_drawing_state_.oox_shape_preset == 3000)
{

View File

@ -64,8 +64,10 @@ public:
void clear ();
void set_styles_context (odf_style_context* styles_context);//для embedded
void set_header_state (bool Val);
void set_footer_state (bool Val);
void set_header_state (bool Val);
void set_footer_state (bool Val);
void set_background_state (bool Val);
void check_anchor ();
void set_margin_left (double valPt);
@ -173,6 +175,7 @@ public:
void set_type_fill (int type);//for area - temp for objects
void set_solid_fill (std::wstring hexColor);
void set_opacity (double percent);
//////////////////////////////////////////////////////////////
void start_area_properties();
void end_area_properties();
@ -187,6 +190,8 @@ public:
std::wstring add_marker_style(int type);
void end_line_properties ();
_CP_OPT(unsigned int) get_fill_color ();
void set_fill_color (unsigned int color);
//void start_shadow_properties();
//void end_shadow_properties();
// пока одной функией ..

View File

@ -56,7 +56,7 @@ void odf_lists_styles_context::set_odf_context(odf_conversion_context * Context)
void odf_lists_styles_context::process_styles(office_element_ptr root )
{
for (long i=0; i< lists_format_array_.size(); i++)
for (size_t i = 0; i < lists_format_array_.size(); i++)
{
if (lists_format_array_[i].elements.size() < 1) continue;
@ -70,7 +70,7 @@ void odf_lists_styles_context::add_style(int style_num, int based_num)
std::wstring style_name;
for (long i=0 ; i < lists_format_array_.size(); i++)
for (size_t i = 0 ; i < lists_format_array_.size(); i++)
{
if (lists_format_array_[i].oox_based_number == based_num)
{
@ -81,7 +81,7 @@ void odf_lists_styles_context::add_style(int style_num, int based_num)
}
std::wstring odf_lists_styles_context::get_style_name1(int oox_style_num)
{
for (long i=0 ; i < lists_format_array_.size(); i++)
for (size_t i=0 ; i < lists_format_array_.size(); i++)
{
if (lists_format_array_[i].oox_based_number == oox_style_num)
{

View File

@ -142,7 +142,7 @@ void odf_notes_context::end_note_content()
int odf_notes_context::find_by_id(int oox_id, int type)
{
for (int i=0; i < impl_->notes_.size(); i++)
for (size_t i=0; i < impl_->notes_.size(); i++)
{
if (impl_->notes_[i].oox_id == oox_id &&
impl_->notes_[i].type == type)
@ -155,7 +155,7 @@ int odf_notes_context::find_by_id(int oox_id, int type)
}
std::wstring odf_notes_context::find_name_by_id(int oox_id, int type)
{
for (int i=0; i < impl_->notes_.size(); i++)
for (size_t i=0; i < impl_->notes_.size(); i++)
{
if (impl_->notes_[i].oox_id == oox_id &&
impl_->notes_[i].type == type)

View File

@ -362,7 +362,7 @@ number_format_state & odf_number_styles_context::add_or_find(int oox_num_fmt, st
void odf_number_styles_context::process_styles(office_element_ptr root )
{
for (long i=0; i< number_format_array_.size(); i++)
for (size_t i=0; i< number_format_array_.size(); i++)
{
create_style(number_format_array_[i]);
@ -432,7 +432,7 @@ void odf_number_styles_context::create_numbers(number_format_state & state, offi
boost::algorithm::split(numbers, str1, boost::algorithm::is_any_of(L".,"), boost::algorithm::token_compress_on);
int ind=1;//
for (long i=0;i<numbers.size();i++)
for (size_t i = 0;i < numbers.size(); i++)
{
if (numbers[i].length()<1)continue;
if (ind==1)min_digit= numbers[i].length();

View File

@ -106,7 +106,7 @@ void odf_page_layout_context::add_master_page(std::wstring page_name)
void odf_page_layout_context::process_master_styles(office_element_ptr root )
{
for (long i =0; i < master_state_list_.size(); i++)
for (size_t i =0 ; i < master_state_list_.size(); i++)
{
try
{
@ -532,7 +532,7 @@ void odf_page_layout_context::set_pages_mirrored(bool val)
{
//for all
for (long i=0; i < layout_state_list_.size(); i++)
for (size_t i = 0; i < layout_state_list_.size(); i++)
{
layout_state_list_[i].set_pages_mirrored(val);
}

View File

@ -175,7 +175,7 @@ style_page_layout_properties *odf_layout_state::get_properties()
{
style_page_layout_properties *result=NULL;
for (long i= 1; i<elements_.size(); i++)//"0" - root
for (size_t i= 1; i<elements_.size(); i++)//"0" - root
{
result = dynamic_cast<style_page_layout_properties *>(elements_[i].elm.get());
if (result) return result;
@ -185,7 +185,7 @@ style_page_layout_properties *odf_layout_state::get_properties()
style_header_footer_properties *odf_layout_state::get_header_properties()
{
for (long i = 1; i < elements_.size(); i++)//"0" - root
for (size_t i = 1; i < elements_.size(); i++)//"0" - root
{
style_header_style *style_ = dynamic_cast<style_header_style *>(elements_[i].elm.get());
if (style_)
@ -197,7 +197,7 @@ style_header_footer_properties *odf_layout_state::get_header_properties()
}
style_header_footer_properties *odf_layout_state::get_footer_properties()
{
for (long i = 1; i < elements_.size(); i++)//"0" - root
for (size_t i = 1; i < elements_.size(); i++)//"0" - root
{
style_footer_style *style_ = dynamic_cast<style_footer_style *>(elements_[i].elm.get());
if (style_)

View File

@ -142,7 +142,7 @@ void odf_settings_context::process_office_settings(office_element_ptr root )
if (item_map_indexed) item_map_indexed->config_name_ = L"Views";
}
for (int v = 0 ; v < views_.size(); v++)
for (size_t v = 0 ; v < views_.size(); v++)
{
office_element_ptr views_entry_elm;
{
@ -150,7 +150,7 @@ void odf_settings_context::process_office_settings(office_element_ptr root )
views_elm->add_child_element(views_entry_elm);
}
for (int i = 0; i < views_[v].content.size(); i++)
for (size_t i = 0; i < views_[v].content.size(); i++)
{
views_entry_elm->add_child_element(views_[v].content[i]);
}
@ -164,7 +164,7 @@ void odf_settings_context::process_office_settings(office_element_ptr root )
item_map_named= dynamic_cast<settings_config_item_map_named*>(tables_elm.get());
if (item_map_named) item_map_named->config_name_ = L"Tables";
for (int t = 0 ; t < views_[v].tables.size(); t++)
for (size_t t = 0 ; t < views_[v].tables.size(); t++)
{
office_element_ptr table_elm;
create_element(L"config", L"config-item-map-entry", table_elm, odf_context_);
@ -173,7 +173,7 @@ void odf_settings_context::process_office_settings(office_element_ptr root )
item_map_entry= dynamic_cast<settings_config_item_map_entry*>(table_elm.get());
if (item_map_entry) item_map_entry->config_name_ = views_[v].tables[t].name;
for (int j = 0; j < views_[v].tables[t].content.size(); j++)
for (size_t j = 0; j < views_[v].tables[t].content.size(); j++)
{
table_elm->add_child_element(views_[v].tables[t].content[j]);
}
@ -190,7 +190,7 @@ void odf_settings_context::process_office_settings(office_element_ptr root )
item_set = dynamic_cast<settings_config_item_set*>(ooo_config_elm.get());
if (item_set) item_set->config_name_ = L"ooo:configuration-settings";
for (int j = 0; j < config_content_.size(); j++)
for (size_t j = 0; j < config_content_.size(); j++)
{
ooo_config_elm->add_child_element(config_content_[j]);
}

View File

@ -80,7 +80,7 @@ void odf_style_context::set_odf_context(odf_conversion_context * Context)
odf_style_state_ptr odf_style_context::last_state(style_family::type family)
{
for (long i = style_state_list_.size()-1; i>=0; i--)
for (size_t i = style_state_list_.size()-1; i>=0; i--)
{
if (style_state_list_[i]->get_family_type() == family || family == style_family::None )
{
@ -144,7 +144,7 @@ void odf_style_context::reset_defaults()
void odf_style_context::process_automatic_for_styles(office_element_ptr root )
{//автоматические стили для эементнов стилей
for (long i =0; i < style_state_list_.size(); i++)
for (size_t i =0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->writable_ == false) continue;
@ -154,7 +154,7 @@ void odf_style_context::process_automatic_for_styles(office_element_ptr root )
}
void odf_style_context::process_automatic_styles(office_element_ptr root )
{//автоматические стили для элементов
for (long i =0; i < style_state_list_.size(); i++)
for (size_t i =0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->writable_ == false) continue;
@ -167,7 +167,7 @@ void odf_style_context::process_office_styles(office_element_ptr root )
{
number_styles_context_.process_styles(root );
for (long i =0; i < style_state_list_.size(); i++)
for (size_t i =0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->writable_ == false) continue;
@ -179,7 +179,7 @@ void odf_style_context::process_office_styles(office_element_ptr root )
}
std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_family::type family, bool root, bool automatic)
{
for (long i =0; i < style_state_list_.size(); i++)
for (size_t i =0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
@ -199,7 +199,7 @@ std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_fami
//office_element_ptr odf_style_context::find_odf_style(int oox_id_style, style_family::type family, bool root, _CP_OPT(bool) automatic)
//{
// //for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
// for (int i=0;i<style_state_list_.size(); i++)
// for (size_t i=0;i<style_state_list_.size(); i++)
// {
// if (style_state_list_[i]->odf_style_)
// {
@ -218,7 +218,7 @@ std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_fami
//}
std::wstring odf_style_context::find_conditional_style_name(int oox_id_style, style_family::type family)
{
for (long i =0; i < style_state_list_.size(); i++)
for (size_t i =0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
@ -235,7 +235,7 @@ std::wstring odf_style_context::find_conditional_style_name(int oox_id_style, st
}
office_element_ptr odf_style_context::find_conditional_style(int oox_id_style, style_family::type family)
{
for (int i=0;i<style_state_list_.size(); i++)
for (size_t i = 0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
@ -252,7 +252,7 @@ office_element_ptr odf_style_context::find_conditional_style(int oox_id_style, s
}
bool odf_style_context::find_odf_style_state(int oox_id_style, style_family::type family, odf_style_state_ptr & state, bool root, bool automatic)
{
for (int i=0;i<style_state_list_.size(); i++)
for (size_t i = 0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
@ -275,7 +275,7 @@ bool odf_style_context::find_odf_style_state(int oox_id_style, style_family::typ
}
bool odf_style_context::find_odf_default_style_state(style_family::type family, odf_style_state_ptr & state)
{
for (int i=0;i<style_state_list_.size(); i++)
for (size_t i=0;i<style_state_list_.size(); i++)
{
if (style_state_list_[i]->default_ == false) continue;
@ -290,7 +290,7 @@ bool odf_style_context::find_odf_default_style_state(style_family::type family,
bool odf_style_context::find_odf_style_state(std::wstring style_name, style_family::type family, odf_style_state_ptr & state)
{
for (int i=0;i<style_state_list_.size(); i++)
for (size_t i = 0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
@ -308,7 +308,7 @@ bool odf_style_context::find_odf_style_state(std::wstring style_name, style_fami
bool odf_style_context::find_odf_style(std::wstring style_name, style_family::type family, style *& style_)
{
for (int i=0;i<style_state_list_.size(); i++)
for (size_t i = 0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
@ -325,7 +325,7 @@ bool odf_style_context::find_odf_style(std::wstring style_name, style_family::ty
}
office_element_ptr odf_style_context::find_odf_style_default(style_family::type family)
{
for (int i=0; i < current_default_styles_.size(); i++)
for (size_t i=0; i < current_default_styles_.size(); i++)
{
if (current_default_styles_[i]->odf_style_)
{
@ -336,7 +336,7 @@ office_element_ptr odf_style_context::find_odf_style_default(style_family::type
}
std::wstring odf_style_context::find_odf_style_name_default(style_family::type family)
{
for (int i = 0; i < current_default_styles_.size(); i++)
for (size_t i = 0; i < current_default_styles_.size(); i++)
{
if (current_default_styles_[i]->odf_style_)
{
@ -390,7 +390,7 @@ std::wstring odf_style_context::find_free_name(style_family::type family)
int count = style_family_counts_[(int)family];
//доооолго .. проще хранить
//for (int i=0;i<style_state_list_.size(); i++)
//for (size_t i=0;i<style_state_list_.size(); i++)
//{
// if ((style_state_list_[i]->odf_style_) && (style_state_list_[i]->get_family_type() == family))
// {
@ -402,7 +402,7 @@ std::wstring odf_style_context::find_free_name(style_family::type family)
}
office_element_ptr & odf_style_context::add_or_find(std::wstring name, style_family::type family, bool automatic , bool root, int oox_id)
{
for (int i=0;i<style_state_list_.size(); i++)
for (size_t i=0;i<style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{

View File

@ -172,7 +172,7 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled)
void odf_table_context::end_table()
{
//последние объединенные по вертикали ячейки ..
for (long i =0 ; i < impl_->current_table().columns.size(); i++)
for (size_t i =0 ; i < impl_->current_table().columns.size(); i++)
{
impl_->current_table().current_column = i+1;
set_cell_row_span_restart();

View File

@ -283,7 +283,7 @@ std::wstring ods_table_state::get_column_default_cell_style(int column)
{
int curr=0;
for (int i=0; i < columns_.size(); i++)
for (size_t i=0; i < columns_.size(); i++)
{
if (curr + columns_[i].repeated < column + 1)continue;
else
@ -400,7 +400,7 @@ bool ods_table_state::is_cell_comment()
int ods_table_state::is_cell_hyperlink(int col, int row)
{
for (long i=0; i< hyperlinks_.size();i++)
for (size_t i=0; i < hyperlinks_.size();i++)
{
if (hyperlinks_[i].col == col && hyperlinks_[i].row == row)
{
@ -411,7 +411,7 @@ int ods_table_state::is_cell_hyperlink(int col, int row)
}
int ods_table_state::is_cell_comment(int col, int row, short repeate_col)
{
for (long i=0; i< comments_.size();i++)
for (size_t i = 0; i < comments_.size(); i++)
{
if ((comments_[i].col < col+repeate_col && comments_[i].col >= col) && comments_[i].row == row)
{
@ -590,7 +590,7 @@ void ods_table_state::end_comment(odf_text_context *text_context)
{
if (text_context == NULL || comments_.size() <1 )return;
for (long i=0; i< text_context->text_elements_list_.size(); i++)
for (size_t i = 0; i < text_context->text_elements_list_.size(); i++)
{
if (text_context->text_elements_list_[i].level ==0 && comments_.back().elm)
{
@ -739,7 +739,7 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
}
else
{
for (int i=0; i<shared_formulas_.size() ;i++)
for (size_t i = 0; i < shared_formulas_.size() ;i++)
{
if (shared_formulas_[i].index == ind)
{
@ -825,7 +825,7 @@ void ods_table_state::add_child_element( const office_element_ptr & child_elemen
void ods_table_state::convert_position(oox_table_position & oox_pos, double & x, double & y)//c 0 отсчет
{
double sz_col=0;
int curr_col = 0,i;
size_t curr_col = 0, i;
for (i = 0; i < columns_.size(); i++)
{
@ -850,7 +850,8 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x,
x = sz_col + oox_pos.col_off;
double sz_row=0;
int curr_row =0;
size_t curr_row =0 ;
for (i = 0; i < rows_.size(); i++)
{
if (oox_pos.row > rows_[i].repeated + curr_row)
@ -880,7 +881,7 @@ void ods_table_state::set_cell_text(odf_text_context* text_context, bool cash_va
{
if (text_context == NULL)return;
for (long i=0; i< text_context->text_elements_list_.size(); i++)
for (size_t i = 0; i< text_context->text_elements_list_.size(); i++)
{
if (text_context->text_elements_list_[i].level ==0)
{

View File

@ -117,14 +117,14 @@ void odt_conversion_context::start_document()
void odt_conversion_context::end_document()
{
//add sections to root
for (long i=0; i< sections_.size(); i++)
for (size_t i = 0; i< sections_.size(); i++)
{
root_document_->add_child_element(sections_[i].elm);
}
sections_.clear();
//add last elements to root
for (long i=0; i< current_root_elements_.size(); i++)
for (size_t i = 0; i< current_root_elements_.size(); i++)
{
root_document_->add_child_element(current_root_elements_[i].elm);
}
@ -246,7 +246,7 @@ void odt_conversion_context::end_drawings()
bool bSet = false;
if (( anchor == anchor_type::Page || anchor == anchor_type::Paragraph) || (is_header_ || is_footer_))
{
for (long i = text_context()->current_level_.size()-1; i>=0; i--)
for (long i = (long)text_context()->current_level_.size() - 1 ; i>=0; i--)
{
text_p *p = dynamic_cast<text_p*>(text_context()->current_level_[i].elm.get());
text_h *h = dynamic_cast<text_h*>(text_context()->current_level_[i].elm.get());
@ -513,7 +513,7 @@ void odt_conversion_context::add_section_column(std::vector<std::pair<double,dou
if (!columns)return;
double width_all = 0;
for (int i = 0; i < width_space.size() ; i++)
for (size_t i = 0; i < width_space.size() ; i++)
{
if (width_space[i].first >= 0)
@ -527,7 +527,7 @@ void odt_conversion_context::add_section_column(std::vector<std::pair<double,dou
section_properties->style_editable_ = false;
for (int i = 0; i < width_space.size() && width_all > 0 ; i++)
for (size_t i = 0; i < width_space.size() && width_all > 0 ; i++)
{
office_element_ptr col_elm;
@ -634,7 +634,7 @@ void odt_conversion_context::flush_section()
{
if (sections_.size() > 0 && sections_.back().empty)
{
for (long i=0; i< current_root_elements_.size(); i++)
for (size_t i=0; i< current_root_elements_.size(); i++)
{
if ((sections_.back().continuous && i < 2) || !sections_.back().continuous)
// при вставлении параграфа возможен искусственный разрыв в параграфах - см add_page_break

View File

@ -170,6 +170,7 @@ private:
bool is_header_;
bool is_footer_;
bool is_background_;
std::vector<odf_drawing_context_ptr> drawing_context_;
std::vector<odf_text_context_ptr> text_context_; //for embedded

View File

@ -269,7 +269,7 @@ void text_span::add_child_element( const office_element_ptr & child_element)
void text_span::add_text(const std::wstring & Text)
{
int bSpace = true;
for (int i = 0 ; i < Text.size() ; i++)
for (size_t i = 0 ; i < Text.size() ; i++)
{
if (Text[i] != 0x20)
{
@ -306,7 +306,7 @@ void text_a::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
CP_XML_ATTR_OPT(L"text:visited-style-name", text_visited_style_name_);
for (int i = 0; i < paragraph_content_.size(); i++)
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
paragraph_content_[i]->serialize(CP_XML_STREAM());
}
@ -358,7 +358,7 @@ void text_note_citation::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT(L"text:label", text_label_);
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
@ -386,7 +386,7 @@ void text_note_body::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0; i < content_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}

View File

@ -122,42 +122,47 @@ void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE)
}
}
CP_XML_ATTR_OPT (L"fo:page-width", fo_page_width_);
CP_XML_ATTR_OPT (L"fo:page-height", fo_page_height_);
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_num_format_prefix_suffix_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:paper-tray-name", style_paper_tray_name_);
CP_XML_ATTR_OPT (L"style:print-orientation", style_print_orientation_);
CP_XML_ATTR_OPT (L"fo:page-width", fo_page_width_);
CP_XML_ATTR_OPT (L"fo:page-height", fo_page_height_);
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE());
common_vertical_margin_attlist_.serialize(CP_GET_XML_NODE());
common_margin_attlist_.serialize(CP_GET_XML_NODE());
common_border_attlist_.serialize(CP_GET_XML_NODE());
common_border_line_width_attlist_.serialize(CP_GET_XML_NODE());
common_padding_attlist_.serialize(CP_GET_XML_NODE());
common_shadow_attlist_.serialize(CP_GET_XML_NODE());
common_background_color_attlist_.serialize(CP_GET_XML_NODE());
common_num_format_attlist_.serialize (CP_GET_XML_NODE());
common_num_format_prefix_suffix_attlist_.serialize (CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
CP_XML_ATTR_OPT (L"style:print", style_print_);
CP_XML_ATTR_OPT (L"style:print-page-order", style_print_page_order_);
CP_XML_ATTR_OPT (L"style:first-page-number", style_first_page_number_);
CP_XML_ATTR_OPT (L"style:scale-to", style_scale_to_);
CP_XML_ATTR_OPT (L"style:scale-to_pages", style_scale_to_pages_);
CP_XML_ATTR_OPT (L"style:table-centering", style_table_centering_);
CP_XML_ATTR_OPT (L"style:footnote-max-height", style_footnote_max_height_);
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:layout-grid-mode", style_layout_grid_mode_);
CP_XML_ATTR_OPT (L"style:layout-grid-base-height", style_layout_grid_base_height_);
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-height", style_layout_grid_ruby_height_);
CP_XML_ATTR_OPT (L"style:layout-grid-lines", style_layout_grid_lines_);
CP_XML_ATTR_OPT (L"style:layout-grid-color", style_layout_grid_color_);
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-below", style_layout_grid_ruby_below_);
CP_XML_ATTR_OPT (L"style:layout-grid-print", style_layout_grid_print_);
CP_XML_ATTR_OPT (L"style:layout-grid-display", style_layout_grid_display_);
CP_XML_ATTR_OPT (L"style:paper-tray-name", style_paper_tray_name_);
CP_XML_ATTR_OPT (L"style:print-orientation", style_print_orientation_);
common_horizontal_margin_attlist_.serialize (CP_GET_XML_NODE());
common_vertical_margin_attlist_.serialize (CP_GET_XML_NODE());
common_margin_attlist_.serialize (CP_GET_XML_NODE());
common_border_attlist_.serialize (CP_GET_XML_NODE());
common_border_line_width_attlist_.serialize (CP_GET_XML_NODE());
common_padding_attlist_.serialize (CP_GET_XML_NODE());
common_shadow_attlist_.serialize (CP_GET_XML_NODE());
common_background_color_attlist_.serialize (CP_GET_XML_NODE());
common_draw_fill_attlist_.serialize (CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
CP_XML_ATTR_OPT (L"style:print", style_print_);
CP_XML_ATTR_OPT (L"style:print-page-order", style_print_page_order_);
CP_XML_ATTR_OPT (L"style:first-page-number", style_first_page_number_);
CP_XML_ATTR_OPT (L"style:scale-to", style_scale_to_);
CP_XML_ATTR_OPT (L"style:scale-to_pages", style_scale_to_pages_);
CP_XML_ATTR_OPT (L"style:table-centering", style_table_centering_);
CP_XML_ATTR_OPT (L"style:footnote-max-height", style_footnote_max_height_);
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:layout-grid-mode", style_layout_grid_mode_);
CP_XML_ATTR_OPT (L"style:layout-grid-base-height", style_layout_grid_base_height_);
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-height", style_layout_grid_ruby_height_);
CP_XML_ATTR_OPT (L"style:layout-grid-lines", style_layout_grid_lines_);
CP_XML_ATTR_OPT (L"style:layout-grid-color", style_layout_grid_color_);
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-below", style_layout_grid_ruby_below_);
CP_XML_ATTR_OPT (L"style:layout-grid-print", style_layout_grid_print_);
CP_XML_ATTR_OPT (L"style:layout-grid-display", style_layout_grid_display_);
}
const wchar_t * style_page_layout_properties::ns = L"style";
const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
const wchar_t * style_page_layout_properties::ns = L"style";
const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
void style_page_layout_properties::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{

View File

@ -62,6 +62,7 @@ public:
_CP_OPT(odf_types::length) fo_page_width_;
_CP_OPT(odf_types::length) fo_page_height_;
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
odf_types::common_num_format_attlist common_num_format_attlist_;
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;

View File

@ -159,8 +159,8 @@ public:
std::wstring get_style_name(){return draw_name_.get_value_or(L"");}
_CP_OPT(odf_types::color) draw_start_color_;
_CP_OPT(odf_types::color) draw_end_color_;
_CP_OPT(odf_types::color) draw_start_color_;
_CP_OPT(odf_types::color) draw_end_color_;
_CP_OPT(odf_types::percent) draw_end_intensity_;
_CP_OPT(odf_types::percent) draw_start_intensity_;
@ -169,11 +169,11 @@ public:
_CP_OPT(odf_types::percent) draw_cx_;
_CP_OPT(odf_types::percent) draw_border_;
_CP_OPT(int) draw_angle_;
_CP_OPT(odf_types::gradient_style) draw_style_;
_CP_OPT(int) draw_angle_;
_CP_OPT(odf_types::gradient_style) draw_style_;
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_display_name_;
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_display_name_;
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
virtual void serialize(std::wostream & strm);

View File

@ -106,7 +106,7 @@ void text_list_style::serialize(std::wostream & strm)
{
text_list_style_attr_.serialize(CP_GET_XML_NODE());
for (int i = 0; i < text_list_style_content_.size(); i++)
for (size_t i = 0; i < text_list_style_content_.size(); i++)
{
if (text_list_style_content_[i])
text_list_style_content_[i]->serialize(CP_XML_STREAM());

View File

@ -578,7 +578,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
int get_count(){return content_.size();}//временно .. для группировок
int get_count(){return (int)content_.size();}//временно .. для группировок
office_element_ptr_array content_;
//int type_;

View File

@ -80,7 +80,7 @@ void table_database_ranges::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0; i < database_ranges_.size(); i++)
for (size_t i = 0; i < database_ranges_.size(); i++)
{
database_ranges_[i]->serialize(CP_XML_STREAM());
}

View File

@ -88,11 +88,11 @@ void table_named_expressions::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0; i < named_expression_.size(); i++)
for (size_t i = 0; i < named_expression_.size(); i++)
{
named_expression_[i]->serialize(CP_XML_STREAM());
}
for (int i = 0; i < named_range_.size(); i++)
for (size_t i = 0; i < named_range_.size(); i++)
{
named_range_[i]->serialize(CP_XML_STREAM());
}

View File

@ -272,7 +272,7 @@ void text_section::serialize(std::wostream & _Wostream)
if (text_section_source_)
text_section_source_->serialize(CP_XML_STREAM());
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
@ -321,7 +321,7 @@ void text_index_body::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0 ; i < index_content_main_.size(); i++)
for (size_t i = 0 ; i < index_content_main_.size(); i++)
{
index_content_main_[i]->serialize(CP_XML_STREAM());
}
@ -350,7 +350,7 @@ void text_index_title::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0 ; i < index_content_main_.size(); i++)
for (size_t i = 0 ; i < index_content_main_.size(); i++)
{
index_content_main_[i]->serialize(CP_XML_STREAM());
}
@ -426,7 +426,7 @@ void text_tracked_changes::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->serialize (CP_XML_STREAM());
}
@ -446,7 +446,7 @@ void text_insertion::serialize(std::wostream & _Wostream)
if (office_change_info_)
office_change_info_->serialize(CP_XML_STREAM());
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
@ -466,7 +466,7 @@ void text_deletion::serialize(std::wostream & _Wostream)
if (office_change_info_)
office_change_info_->serialize(CP_XML_STREAM());
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
@ -489,7 +489,7 @@ void text_format_change::serialize(std::wostream & _Wostream)
if (office_change_info_)
office_change_info_->serialize(CP_XML_STREAM());
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
@ -525,7 +525,7 @@ void text_unknown_change::serialize(std::wostream & _Wostream)
if (office_change_info_)
office_change_info_->serialize(CP_XML_STREAM());
for (int i = 0 ; i < content_.size(); i++)
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}

View File

@ -33,8 +33,10 @@
#include "../utils.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h"
#include "../../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/PrstClr.h"
@ -48,8 +50,6 @@
#include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_properties.h"
#define ARGB(a, r, g, b) ((unsigned int)( ( (unsigned char)(a) )| ( ( (unsigned char)(r) ) << 8 ) | ( ( (unsigned char)(g) ) << 16 ) | ( (unsigned char)(b) << 24 ) ) )
using namespace cpdoccore;
namespace Oox2Odf
@ -58,6 +58,106 @@ namespace Oox2Odf
{
return (1.0 * emu / (635 * 20.0));
}
void OoxConverter::convert(PPTX::Logic::GraphicFrame *oox_graphic_frame)
{
if (!oox_graphic_frame)return;
////////////////////////////////////////////////////////////////////////////////
odf_context()->drawing_context()->start_drawing();
convert(&oox_graphic_frame->nvGraphicFramePr);
if ( oox_graphic_frame->chartRec.IsInit())
{
convert(oox_graphic_frame->chartRec.GetPointer());
}
else if ( oox_graphic_frame->smartArt.IsInit())
{
OoxConverter::convert(oox_graphic_frame->smartArt.GetPointer());
}
else if ( oox_graphic_frame->pic.IsInit())
{
OoxConverter::convert(oox_graphic_frame->pic.GetPointer());
}
else if ( oox_graphic_frame->table.IsInit())
{
OoxConverter::convert(oox_graphic_frame->table.GetPointer());
}
else if ( oox_graphic_frame->element.IsInit())
{
OoxConverter::convert(oox_graphic_frame->element->GetElem().operator->());
}
odf_context()->drawing_context()->end_drawing();
}
void OoxConverter::convert(PPTX::Logic::NvGraphicFramePr *oox_framePr)
{
if (oox_framePr == NULL) return;
}
void OoxConverter::convert(PPTX::Logic::Table *oox_table)
{
if (oox_table == NULL) return;
}
void OoxConverter::convert(PPTX::Logic::SmartArt *oox_smart_art)
{
if (oox_smart_art == NULL) return;
if (oox_smart_art->id_data.IsInit() == false) return;
oox_smart_art->LoadDrawing();
if (oox_smart_art->m_diag.IsInit())
{
_CP_OPT(double) x, y, width, height, cx, cy;
odf_context()->drawing_context()->get_size (width, height);
odf_context()->drawing_context()->get_position (x, y);
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(oox_smart_art->m_oCommonRels.operator->());
odf_context()->drawing_context()->start_group();
odf_context()->drawing_context()->set_group_size (width, height, width, height);
odf_context()->drawing_context()->set_group_position (x, y, cx, cy);
convert(oox_smart_art->m_diag.GetPointer());
odf_context()->drawing_context()->end_group();
oox_current_child_document = NULL;
}
}
void OoxConverter::convert(PPTX::Logic::ChartRec *oox_chart)
{
if (!oox_chart) return;
if( !oox_chart->id_data.IsInit()) return;
_CP_OPT(double) width, height;
odf_context()->drawing_context()->get_size (width, height);
smart_ptr<OOX::File> oFile = find_file_by_id (oox_chart->id_data->get());
if (oFile.IsInit())
{
OOX::Spreadsheet::CChartSpace* pChart = (OOX::Spreadsheet::CChartSpace*)oFile.operator->();
if (pChart)
{
oox_current_child_document_spreadsheet = dynamic_cast<OOX::Spreadsheet::IFileContainer*>(pChart);
odf_context()->drawing_context()->start_object(odf_context()->get_next_name_object());
{
odf_context()->start_chart();
odf_context()->chart_context()->set_chart_size(width, height);
OoxConverter::convert(pChart->m_oChartSpace.m_oSpPr.GetPointer());
OoxConverter::convert(&pChart->m_oChartSpace);
odf_context()->end_chart();
}
odf_context()->drawing_context()->end_object();
oox_current_child_document_spreadsheet = NULL;
}
}
}
void OoxConverter::convert(PPTX::Logic::SpTree *oox_shape_tree)
{
if (oox_shape_tree == NULL) return;
@ -87,9 +187,10 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
if (type == SimpleTypes::shapetypeRect && oox_shape->txBody.IsInit()) type = 2000;
if (type == 2000 && oox_shape->txBody->bodyPr.fromWordArt.get_value_or(false))
if (type == 2000 && oox_shape->txBody->bodyPr.IsInit()
&& oox_shape->txBody->bodyPr->fromWordArt.get_value_or(false))
{
int wordart_type = convert(oox_shape->txBody->bodyPr.prstTxWarp.GetPointer());
int wordart_type = convert(oox_shape->txBody->bodyPr->prstTxWarp.GetPointer());
if (wordart_type > 0) type = wordart_type;
}
@ -113,7 +214,7 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
odf_context()->drawing_context()->set_text( odf_context()->text_context());
//наложим внешние настройки для текста
convert(&oox_shape->txBody->bodyPr);
convert(oox_shape->txBody->bodyPr.GetPointer());
if (oox_shape->style.IsInit())
{
@ -283,15 +384,15 @@ void OoxConverter::convert(PPTX::Logic::PathBase *oox_path)
}
if (cubicBezTo)
{
std::wstring path_elm = cubicBezTo->x1 + L" " + cubicBezTo->y1 + L" " +
cubicBezTo->x2 + L" " + cubicBezTo->y2 + L" " +
cubicBezTo->x3 + L" " + cubicBezTo->y3;
std::wstring path_elm = cubicBezTo->x[0] + L" " + cubicBezTo->y[0] + L" " +
cubicBezTo->x[1] + L" " + cubicBezTo->y[1] + L" " +
cubicBezTo->x[2] + L" " + cubicBezTo->y[2];
odf_context()->drawing_context()->add_path_element(std::wstring(L"C"), path_elm);
}
if (quadBezTo)
{
std::wstring path_elm = quadBezTo->x1 + L" " + quadBezTo->y1 + L" " +
quadBezTo->x2 + L" " + quadBezTo->y2;
std::wstring path_elm = quadBezTo->x[0] + L" " + quadBezTo->y[0] + L" " +
quadBezTo->x[1] + L" " + quadBezTo->y[1];
odf_context()->drawing_context()->add_path_element(std::wstring(L"S"), path_elm);
}
if (arcTo)
@ -305,9 +406,80 @@ void OoxConverter::convert(PPTX::Logic::PathBase *oox_path)
}
void OoxConverter::convert(PPTX::Logic::BlipFill *oox_fill)
void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
{
if (!oox_fill) return;
if (oox_bitmap_fill == NULL)return;
odf_context()->drawing_context()->start_bitmap_style();
{
double Width=0, Height = 0;
if (oox_bitmap_fill->blip.IsInit())
{
std::wstring sID, pathImage;
if (oox_bitmap_fill->blip->embed.IsInit())
{
sID = oox_bitmap_fill->blip->embed->get();
pathImage = find_link_by_id(sID,1);
if (!pathImage.empty())
{
odf_context()->drawing_context()->set_bitmap_link(pathImage);
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
}
}
else if (oox_bitmap_fill->blip->link.IsInit())
{
sID = pathImage = oox_bitmap_fill->blip->link->get();
odf_context()->drawing_context()->set_bitmap_link(pathImage);
//...
}
//for (size_t i = 0 ; i < oox_bitmap_fill->blip->m_arrEffects.size(); i++)
//{
// convert(oox_bitmap_fill->blip->m_arrEffects[i]);
//}
}
if (oox_bitmap_fill->srcRect.IsInit() && Width >0 && Height >0)//часть изображения
{
odf_context()->drawing_context()->set_image_client_rect_inch(
(oox_bitmap_fill->srcRect->l.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->l.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->t.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->t.get()) : 0 ) /100. * Height/ currentSystemDPI,
(oox_bitmap_fill->srcRect->r.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->r.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->b.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->b.get()) : 0 ) /100. * Height/ currentSystemDPI);
}
if (oox_bitmap_fill->tile.IsInit())
{
odf_context()->drawing_context()->set_image_style_repeat(2);
if (oox_bitmap_fill->tile->algn.IsInit())
odf_context()->drawing_context()->set_bitmap_tile_align(oox_bitmap_fill->tile->algn->GetBYTECode());
if (oox_bitmap_fill->tile->flip.IsInit()) {}
if (oox_bitmap_fill->tile->sx.IsInit() && Width >0)
{
odf_context()->drawing_context()->set_bitmap_tile_scale_x(*oox_bitmap_fill->tile->sx / 100. * Width);
}
if (oox_bitmap_fill->tile->sy.IsInit()&& Height >0)
{
odf_context()->drawing_context()->set_bitmap_tile_scale_y(*oox_bitmap_fill->tile->sy / 100. * Height);
}
if (oox_bitmap_fill->tile->tx.IsInit() && Width >0)
{
odf_context()->drawing_context()->set_bitmap_tile_translate_x(*oox_bitmap_fill->tile->tx * 100. / Width );
}
if (oox_bitmap_fill->tile->ty.IsInit() && Height >0)
{
odf_context()->drawing_context()->set_bitmap_tile_translate_y(*oox_bitmap_fill->tile->ty * 100. / Height );
}
}
if (oox_bitmap_fill->stretch.IsInit())
{
odf_context()->drawing_context()->set_image_style_repeat(1);
if (oox_bitmap_fill->stretch->fillRect.IsInit()){} //заполнение неполного объема
}
}
odf_context()->drawing_context()->end_bitmap_style();
}
void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill)
{

View File

@ -44,6 +44,7 @@
#include "../OdfFormat/style_paragraph_properties.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
#include "../../../DesktopEditor/raster/BgraFrame.h"
#include "VmlShapeTypes2Oox.h"
@ -63,8 +64,7 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
if (odf_context()->drawing_context()->m_mapVmlShapeTypes.find( sId ) ==
odf_context()->drawing_context()->m_mapVmlShapeTypes.end())
{
odf_context()->drawing_context()->m_mapVmlShapeTypes.insert(odf_context()->drawing_context()->m_mapVmlShapeTypes.begin(),
std::pair<std::wstring, OOX::Vml::CShapeType*>(sId, vml_shape_type));
odf_context()->drawing_context()->m_mapVmlShapeTypes.insert(std::make_pair(sId, vml_shape_type));
}
}
@ -80,9 +80,9 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
}
//o:spt
//nullable<std::wstring> m_oAdj;
//nullable<SimpleTypes::Vml::CVmlPath> m_oPath;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oMaster;
//nullable<std::wstring> m_oAdj;
//nullable<SimpleTypes::Vml::CVmlPath> m_oPath;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oMaster;
//m_arrItems
//CVmlCommonElements
}
@ -387,6 +387,9 @@ void OoxConverter::convert(OOX::Vml::CArc *vml_arc)
void OoxConverter::convert(OOX::Vml::CBackground *vml_background)
{
if (vml_background == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_background);
convert(vml_common);
}
void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
@ -395,6 +398,28 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
odf_context()->drawing_context()->start_area_properties();
std::wstring sImagePath;
_CP_OPT(unsigned int) nRgbColor1, nRgbColor2;
_CP_OPT(std::wstring) sRgbColor1, sRgbColor2;
if (vml_fill->m_oColor.IsInit())
{
nRgbColor1 = ((unsigned int)(((BYTE)(vml_fill->m_oColor->Get_B())
| ((unsigned int)((BYTE)(vml_fill->m_oColor->Get_G()))<<8))
| (((unsigned int)(BYTE)(vml_fill->m_oColor->Get_R()))<<16)));
sRgbColor1 = XmlUtils::IntToString(*nRgbColor1, L"%06X");
}
if (vml_fill->m_oColor2.IsInit())
{
nRgbColor2 = ((unsigned int)(((BYTE)(vml_fill->m_oColor2->Get_B())
| ((unsigned int)((BYTE)(vml_fill->m_oColor2->Get_G()))<<8))
| (((unsigned int)(BYTE)(vml_fill->m_oColor2->Get_R()))<<16)));
sRgbColor2 = XmlUtils::IntToString(*nRgbColor2, L"%06X");
}
if (vml_fill->m_rId.IsInit())
{
//bitmap fill
@ -402,37 +427,37 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
{
double Width=0, Height = 0;
std::wstring sID = vml_fill->m_rId->GetValue();
std::wstring pathImage = find_link_by_id(sID,1);
sImagePath = find_link_by_id(sID, 1);
if (!pathImage.empty())
if (!sImagePath.empty())
{
odf_context()->drawing_context()->set_bitmap_link(pathImage);
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
odf_context()->drawing_context()->set_bitmap_link( sImagePath );
_graphics_utils_::GetResolution( sImagePath.c_str(), Width, Height );
}
odf_context()->drawing_context()->set_image_style_repeat(1);
}
odf_context()->drawing_context()->end_bitmap_style();
}
else
switch (vml_fill->m_oType.GetValue())
{
switch (vml_fill->m_oType.GetValue())
{
case SimpleTypes::filltypeGradient :
case SimpleTypes::filltypeGradientCenter :
case SimpleTypes::filltypeGradientRadial :
case SimpleTypes::filltypeGradientUnscaled:
{
odf_context()->drawing_context()->start_gradient_style();
if (SimpleTypes::filltypeGradient == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::linear);
if (SimpleTypes::filltypeGradientRadial == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::radial);
if (SimpleTypes::filltypeGradientCenter == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::axial);
if (SimpleTypes::filltypeGradientUnscaled == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::square);
if (SimpleTypes::filltypeGradient == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::linear);
if (SimpleTypes::filltypeGradientRadial == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::radial);
if (SimpleTypes::filltypeGradientCenter == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::axial);
if (SimpleTypes::filltypeGradientUnscaled == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::square);
_CP_OPT(double) no_set;
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_gradient_start(vml_fill->m_oColor->ToString(), no_set);
if (vml_fill->m_oColor2.IsInit())
odf_context()->drawing_context()->set_gradient_end(vml_fill->m_oColor2->ToString(), no_set);
if (sRgbColor1)
odf_context()->drawing_context()->set_gradient_start(*sRgbColor1, no_set);
if (sRgbColor2)
odf_context()->drawing_context()->set_gradient_end(*sRgbColor2, no_set);
if (vml_fill->m_oFocusPosition.IsInit())
odf_context()->drawing_context()->set_gradient_center(vml_fill->m_oFocusPosition->GetX(), vml_fill->m_oFocusPosition->GetY());
@ -441,23 +466,35 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
}break;
case SimpleTypes::filltypePattern:
{
if (!sImagePath.empty())
{
odf_context()->drawing_context()->set_image_style_repeat(2);
if (!nRgbColor1)
nRgbColor1 = odf_context()->drawing_context()->get_fill_color();
CBgraFrame bgraFrame;
bgraFrame.ReColorPatternImage(sImagePath, nRgbColor1.get_value_or(0xffffff), nRgbColor2.get_value_or(0x000000));
}
else
{
odf_context()->drawing_context()->start_hatch_style();
if (vml_fill->m_oColor2.IsInit())
odf_context()->drawing_context()->set_hatch_line_color(vml_fill->m_oColor2->ToString());
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_hatch_area_color(vml_fill->m_oColor->ToString());
if (sRgbColor2)
odf_context()->drawing_context()->set_hatch_line_color(*sRgbColor2);
if (sRgbColor1)
odf_context()->drawing_context()->set_hatch_area_color(*sRgbColor1);
else
odf_context()->drawing_context()->set_hatch_area_color(L"#ffffff");
odf_context()->drawing_context()->end_hatch_style();
}
}break;
case SimpleTypes::filltypeSolid:
default:
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_solid_fill(vml_fill->m_oColor->ToString());
if (sImagePath.empty() && sRgbColor1)
odf_context()->drawing_context()->set_solid_fill(*sRgbColor1);
break;
}
}
//--------------------------------------------------------------------------------------------------------------------
if (vml_fill->m_oOpacity.IsInit() && vml_fill->m_oOpacity2.IsInit() )
@ -589,7 +626,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
if (vml_stroke->m_oColor.IsInit())
{
std::wstring hexColor = vml_stroke->m_oColor->ToString();
if (hexColor.length() < 1)hexColor = L"000000";
if (hexColor.empty()) hexColor = L"000000";
odf_context()->drawing_context()->set_solid_fill(hexColor);
}
@ -819,9 +856,16 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
if (oRgbColor)
{
odf_context()->drawing_context()->start_area_properties();
unsigned int nRgbColor = ((unsigned int)(((BYTE)( oRgbColor->Get_B())
| ((unsigned int)((BYTE)( oRgbColor->Get_G()))<<8))
| (((unsigned int)(BYTE)( oRgbColor->Get_R()))<<16)));
odf_context()->drawing_context()->set_fill_color(nRgbColor);
odf_context()->drawing_context()->start_area_properties();
odf_context()->drawing_context()->set_solid_fill(oRgbColor->ToString().substr(2));//.Right(6));
odf_context()->drawing_context()->end_area_properties();
delete oRgbColor;
}
}
@ -881,8 +925,8 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
{
if (vml->m_oSpt.IsInit())
{
OOX::Vml::SptType sptType = static_cast<OOX::Vml::SptType>(vml->m_oSpt->GetValue());
odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType));
SimpleTypes::Vml::SptType sptType = static_cast<SimpleTypes::Vml::SptType>(vml->m_oSpt->GetValue());
odf_context()->drawing_context()->start_shape(OOX::VmlShapeType2PrstShape(sptType));
bSet = true;
}
else if ((vml->m_oConnectorType.IsInit()) && (vml->m_oConnectorType->GetValue() != SimpleTypes::connectortypeNone))
@ -909,9 +953,9 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
case OOX::et_v_shapetype:
{
OOX::Vml::CShapeType * vml = static_cast<OOX::Vml::CShapeType*>(vml_group->m_arrItems[i]);
OOX::Vml::SptType sptType = vml->m_oSpt.IsInit() ? static_cast<OOX::Vml::SptType>(vml->m_oSpt->GetValue()) : OOX::Vml::sptNotPrimitive;
SimpleTypes::Vml::SptType sptType = vml->m_oSpt.IsInit() ? static_cast<SimpleTypes::Vml::SptType>(vml->m_oSpt->GetValue()) : SimpleTypes::Vml::sptNotPrimitive;
odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType));
odf_context()->drawing_context()->start_shape(OOX::VmlShapeType2PrstShape(sptType));
OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape();
}break;

View File

@ -215,11 +215,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Vml::CTextbox *vml = static_cast<OOX::Vml::CTextbox*>(oox_unknown);
convert(vml);
}break;
//case OOX::et_v_background:
//{
// OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown);
// convert(vml);
//}break;
case OOX::et_v_background:
{
OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown);
convert(vml);
}break;
case OOX::et_v_path:
{
OOX::Vml::CPath *vml = static_cast<OOX::Vml::CPath*>(oox_unknown);
@ -395,7 +395,7 @@ void OoxConverter::convert(OOX::Drawing::CDiagrammParts *oox_diagramm)
if (oFile.is_init() && OOX::FileTypes::DiagDrawing == oFile->type())
{
_CP_OPT(double) x, y, width, height, cx = 0, cy = 0;
_CP_OPT(double) x, y, width, height, cx, cy;
odf_context()->drawing_context()->get_size (width, height);
odf_context()->drawing_context()->get_position (x, y);
@ -657,12 +657,12 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra
odf_context()->drawing_context()->start_line_properties();
{
if (oox_spPr->m_oLn.IsInit())
convert(oox_spPr->m_oLn.GetPointer()); //CLineProperties
else if ((oox_sp_style) && (oox_sp_style->m_oLnRef.getType() == OOX::et_a_lnRef))
if ((oox_sp_style) && (oox_sp_style->m_oLnRef.getType() == OOX::et_a_lnRef))
{
convert(&oox_sp_style->m_oLnRef);
}
if (oox_spPr->m_oLn.IsInit())
convert(oox_spPr->m_oLn.GetPointer()); //CLineProperties
}
odf_context()->drawing_context()->end_line_properties();
//-----------------------------------------------------------------------------------------------------------------------------
@ -899,7 +899,7 @@ void OoxConverter::convert(OOX::Drawing::CBlipFillProperties *oox_bitmap_fill, s
for (size_t i = 0 ; i < oox_bitmap_fill->m_oBlip->m_arrEffects.size(); i++)
convert(oox_bitmap_fill->m_oBlip->m_arrEffects[i]);
}
if (oox_bitmap_fill->m_oSrcRect.IsInit() && Width >0 && Height >0)//часть изображения
if (oox_bitmap_fill->m_oSrcRect.IsInit() && Width > 0 && Height > 0)//часть изображения
{
odf_context()->drawing_context()->set_image_client_rect_inch(
oox_bitmap_fill->m_oSrcRect->m_oL.GetValue() /100. * Width / currentSystemDPI,

View File

@ -270,7 +270,6 @@ namespace OOX
class CT_Style1;
class CT_Style;
class CT_TextLanguageID;
class CRichText;
class CTextProperties;
}
namespace Vml
@ -312,6 +311,7 @@ namespace PPTX
{
namespace Logic
{
class GraphicFrame;
class SpTree;
class Shape;
class SpPr;
@ -343,6 +343,10 @@ namespace PPTX
class Fld;
class Br;
class MathParaWrapper;
class NvGraphicFramePr;
class Table;
class ChartRec;
class SmartArt;
}
}
@ -380,7 +384,7 @@ public:
OOX::Spreadsheet::IFileContainer *oox_current_child_document_spreadsheet;
OOX::IFileContainer *oox_current_child_document;
void convert (double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size);
void convert (double oox_font_size, _CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size);
bool convert (int indexSchemeColor, BYTE& ucA, BYTE& ucG, BYTE& ucB, BYTE& ucR);
//.......................................................................................................................
void convert(OOX::WritingElement *oox_unknown);
@ -418,21 +422,22 @@ public:
void convert(OOX::Drawing::CPath2DQuadBezierTo *oox_geom_path);
void convert(OOX::Drawing::CPath2DCubicBezierTo *oox_geom_path);
void convert(OOX::Drawing::CPath2DClose *oox_geom_path);
void convert(OOX::Drawing::CColor *oox_color, std::wstring & hexColor , cpdoccore::_CP_OPT(double) &opacity);
void convert(OOX::Drawing::CSchemeColor *oox_ShemeClr, std::wstring & hexString, cpdoccore::_CP_OPT(double) &opacity);
void convert(OOX::Drawing::Colors::CColorTransform *oox_ScrgbClr, std::wstring & hexString, cpdoccore::_CP_OPT(double) &opacity);
void convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill,std::wstring & hexColor , cpdoccore::_CP_OPT(double) &opacity);
void convert(OOX::Drawing::CColor *oox_color, std::wstring & hexColor , _CP_OPT(double) &opacity);
void convert(OOX::Drawing::CSchemeColor *oox_ShemeClr, std::wstring & hexString, _CP_OPT(double) &opacity);
void convert(OOX::Drawing::Colors::CColorTransform *oox_ScrgbClr, std::wstring & hexString, _CP_OPT(double) &opacity);
void convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill,std::wstring & hexColor , _CP_OPT(double) &opacity);
void convert(OOX::Drawing::CParagraph *oox_paragraph);
void convert(OOX::Drawing::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
void convert(OOX::Drawing::CRun *oox_run);
void convert(OOX::Drawing::CRunProperty *oox_run_pr, cpdoccore::odf_writer::style_text_properties * text_properties);
void convert(OOX::Drawing::CLineSpacing *oox_spacing, cpdoccore::odf_types::length_or_percent & length_or_percent);
//.diagram & pptx................................................................................................................................
void convert(PPTX::Logic::TextSpacing *oox_spacing, cpdoccore::odf_types::length_or_percent & length_or_percent);
//drawingML & pptx................................................................................................................................
void convert(PPTX::Logic::GraphicFrame *oox_graphicFrame);
void convert(PPTX::Logic::SpTree *oox_shape_tree);
void convert(PPTX::Logic::Shape *oox_shape);
void convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::TextSpacing *oox_spacing, cpdoccore::odf_types::length_or_percent & length_or_percent);
int convert(PPTX::Logic::PrstTxWarp *oox_text_preset);
void convert(PPTX::Logic::PrstGeom *oox_geom);
void convert(PPTX::Logic::CustGeom *oox_geom);
@ -446,7 +451,7 @@ public:
void convert(PPTX::Logic::PathBase *oox_path);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::UniFill *oox_fill, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, cpdoccore::_CP_OPT(double) & opacity);
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity);
void convert(PPTX::Logic::NvSpPr *oox_nvSpPr);
void convert(PPTX::Logic::CNvPr *oox_cnvPr);
void convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr);
@ -458,6 +463,10 @@ public:
void convert(PPTX::Logic::Fld *oox_fld);
void convert(PPTX::Logic::Br *oox_br);
void convert(PPTX::Logic::MathParaWrapper *oox_math);
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
void convert(PPTX::Logic::ChartRec *oox_chart);
void convert(PPTX::Logic::SmartArt *oox_smart_art);
void convert(PPTX::Logic::Table *oox_table);
//.chart............................................................................................................................
void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart);
void convert(OOX::Spreadsheet::CT_Title *ct_title);
@ -495,8 +504,8 @@ public:
void convert(OOX::Spreadsheet::CT_LineSer *ser);
void convert(OOX::Spreadsheet::CT_AxDataSource *cat, int type);
void convert(OOX::Spreadsheet::CT_NumDataSource *val);
void convert(OOX::Spreadsheet::CRichText *rich);
void convert(OOX::Spreadsheet::CTextProperties *txPr);
//void convert(OOX::Spreadsheet::CRichText *rich);
//void convert(OOX::Spreadsheet::CTextProperties *txPr);
void convert(OOX::Spreadsheet::CT_Tx *ct_tx);
void convert(OOX::Spreadsheet::CT_Layout *ct_layout);
void convert(OOX::Spreadsheet::CT_ManualLayout *ct_layout);

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