Compare commits

...

31 Commits

Author SHA1 Message Date
bed884007c PptxFormat - slide sections 2017-07-23 16:38:57 +03:00
1aa0b03901 XlsFormat - fix pivots after testing 2017-07-21 19:41:26 +03:00
e2ada4ca61 Merge commit '08e97b4a68950d969dce001f8e1ead84086c0244' into develop 2017-07-21 18:40:26 +03:00
d87649f08e no message 2017-07-21 18:37:34 +03:00
08e97b4a68 Merge pull request #34 from ONLYOFFICE/feature/lenas-fixes
Feature/lenas fixes
2017-07-21 16:21:05 +03:00
c4447d7396 fix bug #35395 2017-07-21 16:12:28 +03:00
c55af15ccd . 2017-07-21 15:47:36 +03:00
333d2fdbf0 fix 2017-07-21 15:36:47 +03:00
a2bbb1640c project for mac debug 2017-07-20 17:46:38 +03:00
7388bf871f refactoring 2017-07-20 17:41:28 +03:00
493238d656 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-07-20 16:40:01 +03:00
ea8dc009c9 OdfFormatReader - pilot(pivot) tables 2017-07-20 16:39:23 +03:00
9ade820313 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  .
  fix unsize shape text rect
  XlsFormat - pivot charts
  fix bug #35396. version up.
  .
  OdfFormatWriter - data label position XlsFormatReader - fix pivots
2017-07-20 16:38:41 +03:00
358c1613ad fix bug #35395 2017-07-20 16:38:30 +03:00
b3a83ad699 . 2017-07-20 13:28:58 +03:00
8d4e78ed40 fix unsize shape text rect 2017-07-20 13:28:52 +03:00
bde2c73f64 XlsFormat - pivot charts 2017-07-20 11:14:47 +03:00
66fe9e6447 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-19 12:25:21 +03:00
f6d745cd25 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-20 11:21:03 +03:00
002d30454c fix bug #35396. version up. 2017-07-20 11:19:07 +03:00
ae2e9a5f26 . 2017-07-19 12:22:58 +03:00
c985d1e0a2 OdfFormatWriter - data label position
XlsFormatReader - fix pivots
2017-07-18 19:25:39 +03:00
5aaf90ebf2 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-17 19:43:41 +03:00
ebb9c89a0a fix bug #35389 2017-07-17 19:42:35 +03:00
c4765e9f2e fix bug #24236 2017-07-17 17:39:50 +03:00
3ff5233ea4 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-17 13:16:07 +03:00
4c7ab6e616 OdfFormatWriter - fix convert named range with formulas 2017-07-17 13:13:29 +03:00
a88ad0c279 XlsFormat - fix calculations in pivot tables 2017-07-14 11:43:16 +03:00
cf5458c761 XlsFormat - pivot tables 2017-07-13 18:09:17 +03:00
9115edbd78 fix bug #35382. 2017-07-13 17:51:32 +03:00
3f18f96171 codegen change Pivot constants format 2017-07-13 17:13:38 +03:00
236 changed files with 3331 additions and 1254 deletions

View File

@ -68,12 +68,12 @@ namespace DocFileFormat
int cp = m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr;
size_t count = m_document->AnnotationsReferencePlex->Elements.size();
for (unsigned int i = 0; i < count; ++i)
for (size_t i = 0; i < count; ++i)
{
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index ));
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
m_pXmlWriter->WriteAttribute( L"w:author",
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ) ));
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());

View File

@ -290,17 +290,15 @@ namespace DocFileFormat
std::vector<wchar_t>* chpxChars = m_document->GetChars(fcChpxStart, fcChpxEnd, cp);
//search for bookmarks in the chars
std::vector<int> bookmarks = searchBookmarks(chpxChars, cp);
//if there are bookmarks in this run, split the run into several runs
if (!bookmarks.empty())
std::vector<int> annot = searchAnnot(chpxChars, cp);
if (!annot.empty())
{
std::list<std::vector<wchar_t>>* runs = splitCharList(chpxChars, &bookmarks);
std::list<std::vector<wchar_t>>* runs = splitCharList(chpxChars, &annot);
if (runs)
{
for (std::list<std::vector<wchar_t> >::iterator iter = runs->begin(); iter != runs->end(); ++iter)
{
if (writeBookmarks(cp))
if (writeAnnotations(cp))
{
cp = writeRun(&(*iter), *cpeIter, cp);
}
@ -311,7 +309,30 @@ namespace DocFileFormat
}
else
{
cp = writeRun(chpxChars, *cpeIter, cp);
//search for bookmarks in the chars
std::vector<int> bookmarks = searchBookmarks(chpxChars, cp);
//if there are bookmarks in this run, split the run into several runs
if (!bookmarks.empty())
{
std::list<std::vector<wchar_t>>* runs = splitCharList(chpxChars, &bookmarks);
if (runs)
{
for (std::list<std::vector<wchar_t> >::iterator iter = runs->begin(); iter != runs->end(); ++iter)
{
if (writeBookmarks(cp))
{
cp = writeRun(&(*iter), *cpeIter, cp);
}
}
RELEASEOBJECT(runs);
}
}
else
{
cp = writeRun(chpxChars, *cpeIter, cp);
}
}
RELEASEOBJECT(chpxChars);
@ -948,19 +969,17 @@ namespace DocFileFormat
}
else if (TextMark::AnnotationReference == code)
{
if (typeid(*this) != typeid(CommentsMapping))
{
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr ));
m_pXmlWriter->WriteNodeEnd( L"", true );
}
else
if (typeid(*this) == typeid(CommentsMapping))
{
m_pXmlWriter->WriteNodeBegin( L"w:annotationRef", true );
m_pXmlWriter->WriteNodeEnd( L"", true );
}
else
{
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr ));
m_pXmlWriter->WriteNodeEnd( L"", true );
}
_commentNr++;
}
else if (!FormatUtils::IsControlSymbol(c) && ((int)c != 0xFFFF))
{
@ -1042,6 +1061,30 @@ namespace DocFileFormat
return ret;
}
// Searches for bookmarks in the list of characters.
std::vector<int> DocumentMapping::searchAnnot(std::vector<wchar_t>* chars, int initialCp)
{
std::vector<int> ret;
if (m_document->AnnotStartPlex->IsValid())
{
int cp = initialCp;
size_t count = chars->size();
for (size_t i = 0; i < count; ++i)
{
if ((m_document->AnnotStartPlex->IsCpExists(cp)) || (m_document->AnnotEndPlex->IsCpExists(cp)))
{
ret.push_back(i);
}
++cp;
}
}
return ret;
}
ParagraphPropertyExceptions* DocumentMapping::findValidPapx(int fc)
{
@ -1540,7 +1583,6 @@ namespace DocFileFormat
return cpCellEnd;
}
//
bool DocumentMapping::writeBookmarks(int cp)
{
bool result = true;
@ -1561,7 +1603,27 @@ namespace DocFileFormat
return result;
}
bool DocumentMapping::writeAnnotations(int cp)
{
bool result = true;
for (size_t i = 0; i < m_document->AnnotStartEndCPs.size(); i++)
{
if (m_document->AnnotStartEndCPs[i].first == cp)
{
result = writeAnnotationStart(i + 1);
_commentNr = i + 1;
}
if (m_document->AnnotStartEndCPs[i].second == cp)
{
result = writeAnnotationEnd(i + 1);
_commentNr = i + 1;
}
}
return result;
}
bool DocumentMapping::writeBookmarkStart(short id)
{
// write bookmark start
@ -1585,8 +1647,6 @@ namespace DocFileFormat
bool DocumentMapping::writeBookmarkEnd(short id)
{
// write bookmark end
WideString* bookmarkName = static_cast<WideString*>( m_document->BookmarkNames->operator [] ( id ) );
if ( ( bookmarkName != NULL ) && ( *bookmarkName != L"_PictureBullets" ) )
@ -1602,7 +1662,27 @@ namespace DocFileFormat
return false;
}
bool DocumentMapping::writeAnnotationStart(short id)
{
XMLTools::XMLElement bookmarkElem(L"w:commentRangeStart");
bookmarkElem.AppendAttribute(L"w:id", FormatUtils::IntToWideString(id));
m_pXmlWriter->WriteString(bookmarkElem.GetXMLString());
return true;
}
bool DocumentMapping::writeAnnotationEnd(short id)
{
XMLTools::XMLElement bookmarkElem( L"w:commentRangeEnd" );
bookmarkElem.AppendAttribute( L"w:id", FormatUtils::IntToWideString( id ));
m_pXmlWriter->WriteString( bookmarkElem.GetXMLString());
return true;
}
// Checks if the CHPX is special
bool DocumentMapping::isSpecial(CharacterPropertyExceptions* chpx)
{

View File

@ -99,8 +99,9 @@ namespace DocFileFormat
void writeTextStart ( const std::wstring& textType, bool preserve_space);
void writeTextEnd ( const std::wstring& textType );
// Searches for bookmarks in the list of characters.
std::vector<int> searchBookmarks( std::vector<wchar_t>* chars, int initialCp );
std::vector<int> searchAnnot(std::vector<wchar_t>* chars, int initialCp);
ParagraphPropertyExceptions* findValidPapx( int fc );
// Splits a list of characters into several lists
std::list<std::vector<wchar_t> >* splitCharList( std::vector<wchar_t>* chars, std::vector<int>* splitIndices );
@ -121,6 +122,10 @@ namespace DocFileFormat
bool writeBookmarks ( int cp );
bool writeBookmarkStart ( short id );
bool writeBookmarkEnd ( short id );
bool writeAnnotations ( int cp );
bool writeAnnotationStart( short id );
bool writeAnnotationEnd ( short id );
// Checks if the CHPX is special
bool isSpecial( CharacterPropertyExceptions* chpx );
// Finds the SEPX that is valid for the given CP.

View File

@ -2087,6 +2087,7 @@ namespace DocFileFormat
nElemSize = 4;
bTruncated = true;
}
else nElemSize = 2;
long dwSize = nElems * nElemSize;

View File

@ -52,7 +52,8 @@ namespace DocFileFormat
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL), encryptionHeader(NULL)
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL),
AnnotStartPlex(NULL), AnnotEndPlex(NULL), encryptionHeader(NULL)
{
m_pCallFunc = pCallFunc;
m_sTempFolder = sTempFolder;
@ -275,12 +276,17 @@ namespace DocFileFormat
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, bOlderVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, bOlderVersion);
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, bOlderVersion);
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, bOlderVersion);
TextboxBreakPlex = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxBkd, FIB->m_FibWord97.lcbPlcfTxbxBkd, bOlderVersion);
TextboxBreakPlexHeader = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxHdrBkd, FIB->m_FibWord97.lcbPlcfTxbxHdrBkd, bOlderVersion);
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, bOlderVersion);
AnnotEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkl, FIB->m_FibWord97.lcbPlcfAtnBkl, bOlderVersion);
for (size_t i = 0; i < BookmarkStartPlex->Elements.size(); ++i)
{
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(BookmarkStartPlex->Elements[i]);
@ -289,7 +295,14 @@ namespace DocFileFormat
BookmarkStartEndCPs.push_back(std::make_pair(BookmarkStartPlex->CharacterPositions[i], BookmarkEndPlex->CharacterPositions[pBookmark->GetIndex()]));
}
}
for (size_t i = 0; i < AnnotStartPlex->Elements.size(); ++i)
{
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
if (pBookmark)
{
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[pBookmark->GetIndex()]));
}
}
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, bOlderVersion);
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, bOlderVersion);
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, bOlderVersion);
@ -659,6 +672,8 @@ namespace DocFileFormat
RELEASEOBJECT(SectionPlex);
RELEASEOBJECT(BookmarkStartPlex);
RELEASEOBJECT(BookmarkEndPlex);
RELEASEOBJECT(AnnotStartPlex);
RELEASEOBJECT(AnnotEndPlex);
RELEASEOBJECT(AutoTextPlex);
RELEASEOBJECT(ListPlex);
RELEASEOBJECT(Styles);

View File

@ -162,7 +162,9 @@ namespace DocFileFormat
std::vector<int> * AllPapxVector;// A vector to quick find in AllPapx
std::map<int, int> PictureBulletsCPsMap;
std::vector<std::pair<int, int>> BookmarkStartEndCPs;
std::vector<std::pair<int, int>> AnnotStartEndCPs;
FileInformationBlock * FIB;
StyleSheet * Styles; // The style sheet of the document
@ -204,7 +206,10 @@ namespace DocFileFormat
Plex<SectionDescriptor> *SectionPlex; // A Plex containing all section descriptors
Plex<BookmarkFirst> *BookmarkStartPlex;
Plex<EmptyStructure> *BookmarkEndPlex;
Plex<EmptyStructure> *BookmarkEndPlex;
Plex<BookmarkFirst> *AnnotStartPlex;
Plex<EmptyStructure> *AnnotEndPlex;
Plex<ListNumCache> *ListPlex;
Plex<FieldCharacter> *FieldsPlex;

View File

@ -87,9 +87,10 @@ public:
std::wstring convert_conditional_formula(std::wstring const & expr);
// Лист1!$A$1 -> $Лист1.$A$1
std::wstring convert_named_ref(std::wstring const & expr);
std::wstring convert_named_ref (std::wstring const & expr);
std::wstring convert_named_formula(std::wstring const & expr);
std::wstring find_base_cell(std::wstring const & expr);
std::wstring get_base_cell_formula(std::wstring const & expr);
//Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19
std::wstring convert_chart_distance(std::wstring const & expr);

View File

@ -57,6 +57,7 @@ namespace formulasconvert {
static std::wstring replace_named_ref_formater1(boost::wsmatch const & what);
static std::wstring replace_cell_range_formater(boost::wsmatch const & what);
void replace_named_formula(std::wstring & expr, bool w = true);
void replace_named_ref(std::wstring & expr, bool w = true);
bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
@ -156,6 +157,13 @@ namespace formulasconvert {
if (convert_with_TableName)
{
if (std::wstring::npos != sheet1.find(L" "))
{
if (sheet1[0] != L'\'')
{
sheet1 = L"'" + sheet1 + L"'";
}
}
return (sheet1 + L"!") + c1 + (c2.empty() ? L"" : (L":" + c2) );
}
else
@ -209,7 +217,7 @@ namespace formulasconvert {
{
convert_with_TableName = withTableName;
//boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
/*
[ $ Sheet2 . A1 : . B5 ]
*/
@ -226,7 +234,7 @@ namespace formulasconvert {
convert_with_TableName = withTableName;
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
const std::wstring res = boost::regex_replace(
expr,
@ -263,15 +271,12 @@ namespace formulasconvert {
return what[2].str();
else if (what[3].matched)
return what[3].str();
//else if (what[4].matched)
// return what[4].str();
else
return L"";
}
// TODO
// заменить точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
// TODO: проверить как сохраняются кавычки в строке
void odf2oox_converter::Impl::replace_semicolons(std::wstring& expr)
{
const std::wstring res = boost::regex_replace(
@ -581,10 +586,14 @@ namespace formulasconvert {
}
std::wstring odf2oox_converter::convert_named_expr(const std::wstring& expr, bool withTableName)
{
std::wstring workstr = expr;
bool isFormula = impl_->check_formula(workstr);
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
std::wstring workstr = boost::regex_replace(
expr,
workstr = boost::regex_replace(
workstr,
complexRef,
&replace_point_space,
boost::match_default | boost::format_all);
@ -605,6 +614,11 @@ namespace formulasconvert {
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
if (!isFormula)
{
workstr = L"\"" + workstr + L"\"";
}
return workstr;
}

View File

@ -43,6 +43,7 @@ namespace formulasconvert {
class oox2odf_converter::Impl
{
public:
std::wstring convert(const std::wstring& expr);
std::wstring convert_formula(const std::wstring& expr);
std::wstring convert_conditional_formula(const std::wstring& expr);
@ -59,93 +60,17 @@ public:
static std::wstring replace_arguments(boost::wsmatch const & what);
static std::wstring convert_scobci(boost::wsmatch const & what);
std::wstring replace_arguments1(std::wstring & workstr);
void replace_named_ref(std::wstring & expr);
void replace_named_formula(std::wstring & expr);
std::wstring find_base_cell(const std::wstring & expr);
static bool isFindBaseCell_;
// bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
//bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
static std::wstring base_cell_formula_;
};
////Table!.$A$1:$A2 -> ref $A$1 -> ref $A$2
//bool oox2odf_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
//{
// std::vector< std::wstring > splitted;
//
// boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
//
// if (splitted.size()>2)
// {
// table = splitted[0];
// ref_first = splitted[1];
// ref_last = splitted[2];
// return true;
// }
// return false;
//}
// // =[.A1]+[.B1] -> table = ""; ref = "A1"
// // of:=['Sheet2 A'.B2] -> table= "Sheet2 A"; ref = "B2"
//
//bool oox2odf_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
//{
// boost::wregex re(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.([a-zA-Z\\$]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
// boost::wsmatch result;
// bool b = boost::regex_search(expr, result, re);
//
// size_t sz = result.size();
// if (sz == 4 && !result[1].matched)
// {
// table = L"";
// ref = result[2].str();
// return true;
// }
// else if (sz == 4 && result[1].matched)
// {
// table = result[1].str();
// XmlUtils::replace_all( table, L"$", L"");
// XmlUtils::replace_all( table, L"'", L"");
// ref = result[2].str();
// return true;
// }
// return false;
//}
//
//namespace
//{
//
//std::wstring replace_cell_range_formater(boost::wsmatch const & what)
//{
// const size_t sz = what.size();
// if (sz == 4 && !what[1].matched)
// {
// const std::wstring c1 = what[2].str();
// const std::wstring c2 = what[3].str();
// const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
// return s;
// }
// else if (sz == 4 && what[1].matched)
// {
// std::wstring sheet1 = what[1].str();
// XmlUtils::replace_all( sheet1, L"$", L"");
//
// const std::wstring c1 = what[2].str();
// const std::wstring c2 = what[3].str();
// const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
// return s;
// }
// return L"";
//}
//
//}
//
// заменяем формат адресации ячеек НАОБОРОТ
// [.A1] -> A1
// [.A1:.B5] -> A1:B5
// [Sheet2.A1:B5] -> Sheet2!A1:B5
// [Sheet2.A1] -> Sheet2!A1
// [$'Sheet2 A'.$B2] -> 'Sheet2 A'!$B2
bool oox2odf_converter::Impl::isFindBaseCell_ = false;
std::wstring oox2odf_converter::Impl::base_cell_formula_ = L"";
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
{
boost::wregex re(L"([:$!])+");
@ -155,8 +80,10 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
if (b)
{
boost::wregex re1(L"(\\$?\\w+\\!)?([a-zA-Z$]+\\d{1,})\\:?([a-zA-Z$]+\\d{1,})?");
// $ Sheet2 ! $ A1 : $ B5
boost::wregex re1(L"(\\$?\\w+\\!)?([a-zA-Z$]*\\d*)\\:?([a-zA-Z$]*\\d*)?");
// $ Sheet2 ! $ A1 : $ B5
// $ Sheet2 ! $ A : $ A
// $ Sheet2 ! $ 1 : $ 1
std::wstring workstr = expr;
std::wstring res = boost::regex_replace(
@ -178,19 +105,28 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
{
const size_t sz = what.size();
if (sz>3)
if (sz > 3)
{
std::wstring sheet1 = what[1].matched ? what[1].str() : L"";
XmlUtils::replace_all( sheet1, L"!", L"");
std::wstring s;
std::wstring sheet = what[1].matched ? what[1].str() : L"";
std::wstring c1 = what[2].str();
std::wstring c2 = what[3].str();
int res=0;
if (sheet1.length() > 0 && (res = c1.find(L"$")) >=0) sheet1 = L"$" + sheet1;
if (!c1.empty() || !c2.empty() || !sheet.empty())
{
XmlUtils::replace_all( sheet, L"!", L"");
const std::wstring s = std::wstring(L"[") + sheet1 + L"." +
c1 +
(c2.empty() ? L"" : (L":" + sheet1 + L"." + c2) ) + std::wstring(L"]");
if (isFindBaseCell_ && base_cell_formula_.empty() && !sheet.empty())
{
base_cell_formula_ = sheet + L".$A$1";
}
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
s = std::wstring(L"[") + sheet + L"." +
c1 +
(c2.empty() ? L"" : (L":" + sheet + L"." + c2) ) + std::wstring(L"]");
}
return s;
}
else
@ -209,7 +145,7 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
{
const size_t sz = what.size();
if (sz>2)
if (sz > 2)
{
const std::wstring c1 = what[1].str();
const std::wstring c2 = what[2].str();
@ -222,39 +158,22 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
return L"";
}
//namespace {
//
//std::wstring replace_named_ref_formater(boost::wsmatch const & what)
//{
// const size_t sz = what.size();
//
// if (sz == 4 && !what[1].matched)
// {
// const std::wstring c1 = what[2].str();
// const std::wstring c2 = what[3].str();
// const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
// return s;
// }
// else if (sz == 4 && what[1].matched)
// {
// std::wstring sheet1 = what[1].str();
// XmlUtils::replace_all( sheet1, L"$", L"");
//
// const std::wstring c1 = what[2].str();
// const std::wstring c2 = what[3].str();
// const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
// return s;
// }
// return L"";
//}
//
//}
void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
{
base_cell_formula_.clear();
isFindBaseCell_ = true;
expr = convert_formula(expr);
isFindBaseCell_ = false;
}
// Лист1!$A$1 -> $Лист1.$A$1
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
{
base_cell_formula_.clear();
isFindBaseCell_ = true;
std::wstring workstr = expr, out;
replace_vertical(workstr);
@ -264,8 +183,10 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d, distance)
for (size_t i = 0; i < distance.size(); i++)
{
std::wstring &d = distance[i];
XmlUtils::replace_all( d, L"(", L"SCOBCAIN");
XmlUtils::replace_all( d, L")", L"SCOBCAOUT");
XmlUtils::replace_all( d, L" ", L"PROBEL");
@ -283,21 +204,9 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
out = out + d + std::wstring(L";");
}
if (out.length()>0) expr = out.substr(0,out.length()-1);
if (!out.empty()) expr = out.substr(0, out.length() - 1);
}
std::wstring oox2odf_converter::Impl::find_base_cell(const std::wstring & expr)
{
std::vector< std::wstring > splitted;
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L"!"), boost::algorithm::token_compress_on);
if (splitted.size()>1)
{
return splitted[0] + L".$A$1";
}
else return L"";
isFindBaseCell_ = false;
}
@ -440,32 +349,6 @@ std::wstring replace_(boost::wsmatch const & what)
return L"";
}
std::wstring oox2odf_converter::Impl::replace_arguments1(std::wstring & workstr1)
{
std::wstring out;
std::wstring workstr = workstr1;
replace_vertical(workstr);
replace_semicolons(workstr);
std::vector<std::wstring> distance;
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d, distance)
{
replace_cells_range(d);
out = out + d + std::wstring(L";");
}
if (out.length()>0) out = out.substr(0,out.length()-1);
return out ;
}
std::wstring oox2odf_converter::Impl::convert_scobci(boost::wsmatch const & what)
{
if (what[1].matched)
@ -506,33 +389,31 @@ std::wstring oox2odf_converter::Impl::replace_arguments(boost::wsmatch const &
int sz = what.size();
std::wstring c1= what[1].str();
std::wstring c2= what[2].str();
std::wstring c3= what[3].str();
if (what[1].matched)
{
std::wstring workstr = what[1].str();
replace_vertical(workstr);
replace_semicolons(workstr);
out = what[1].str();
}
else if (what[2].matched)
{
out = what[2].str();
}
if (!out.empty())
{
std::vector<std::wstring> distance;
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
boost::algorithm::split(distance, out, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d, distance)
{
replace_cells_range(d);
out = L"";
for (size_t i = 0; i < distance.size(); i++)
{
replace_cells_range(distance[i]);
out = out + d + std::wstring(L";");
out = out + distance[i] + std::wstring(L";");
}
if (out.length()>0) out = out.substr(0,out.length()-1);
if (!out.empty()) out = out.substr(0, out.length() - 1);
}
else if (what[2].matched)
out = what[2].str();
else if (what[3].matched)
out = what[3].str();
return out ;
@ -560,7 +441,7 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
std::wstring res = boost::regex_replace(
res1,
boost::wregex(L"(?:(?=[()])(.*?)(?=[)]))"),
boost::wregex(L"(?!([a-zA-Z]+\\d*\\())(([a-zA-Z]+\\!)?\\$?[a-zA-Z]*\\$?\\d*(\\:\\$?[a-zA-Z]*\\$?\\d*){0,1})"),
&oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all);
if (res1 == res)
@ -572,10 +453,6 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
boost::wregex(L"(\\$?\\w+\\!)?([a-zA-Z$]+\\d{1,})\\:?([a-zA-Z$]+\\d{1,})?"),
&replace_cells_range_formater1,
boost::match_default | boost::format_all);
replace_vertical(res);
replace_semicolons(res);
}
XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
@ -584,12 +461,16 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
XmlUtils::replace_all( res, L"KVADRATIN", L"[");
XmlUtils::replace_all( res, L"KVADRATOUT", L"]");
XmlUtils::replace_all( res, L"PROBEL", L" ");
XmlUtils::replace_all( res, L"APOSTROF", L"'");
XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
replace_vertical(res);
replace_semicolons(res);
XmlUtils::replace_all( res, L"PROBEL", L" ");
return std::wstring(L"of:=") + res;
}
@ -600,12 +481,12 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst
std::wstring res1 = boost::regex_replace(
workstr,
boost::wregex(L"('.*?')|(\".*?\")"),
&oox2odf_converter::Impl::convert_scobci,boost::match_default | boost::format_all);
&oox2odf_converter::Impl::convert_scobci, boost::match_default | boost::format_all);
std::wstring res = boost::regex_replace(
res1,
boost::wregex(L"(?:(?=[()])(.*?)(?=[)]))"),
&oox2odf_converter::Impl::replace_arguments,boost::match_default | boost::format_all);
&oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all);
if (res1 == res)
{
@ -614,20 +495,21 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst
&replace_cells_range_formater1,
boost::match_default | boost::format_all);
replace_vertical(res);
replace_semicolons(res);
}
XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
XmlUtils::replace_all( res, L"SCOBCAOUT", L")");
XmlUtils::replace_all( res, L"PROBEL", L" ");
XmlUtils::replace_all( res, L"APOSTROF", L"'");
XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
return res;
replace_vertical(res);
replace_semicolons(res);
XmlUtils::replace_all( res, L"PROBEL", L" ");
return res;
}
//Sheet2!C3:C19,Sheet2!L27:L34
@ -726,9 +608,15 @@ std::wstring oox2odf_converter::convert_named_ref(const std::wstring& expr)
impl_->replace_named_ref(workstr);
return workstr;
}
std::wstring oox2odf_converter::find_base_cell(const std::wstring& expr)
std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
{
return impl_->find_base_cell(expr);
std::wstring workstr = expr;
impl_->replace_named_formula(workstr);
return workstr;
}
std::wstring oox2odf_converter::get_base_cell_formula(const std::wstring& expr)
{
return impl_->base_cell_formula_;
}
@ -840,14 +728,6 @@ int oox2odf_converter::get_count_value_points(std::wstring expr)
return count;
}
//bool oox2odf_converter::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
//{
// return impl_->find_first_ref(expr, table, ref);
//}
//bool oox2odf_converter::find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last)
//{
// return impl_->find_first_last_ref(expr, table, ref_first,ref_last);
//}
}
}

View File

@ -105,6 +105,7 @@ SOURCES += \
../src/odf/table_calculation_settings.cpp \
../src/odf/table_docx.cpp \
../src/odf/table_named_expressions.cpp \
../src/odf/table_data_pilot_tables.cpp \
../src/odf/table_pptx.cpp \
../src/odf/table_xlsx.cpp \
../src/odf/templates.cpp \
@ -209,6 +210,8 @@ SOURCES += \
../src/odf/datatypes/wrapoption.cpp \
../src/odf/datatypes/writingmode.cpp \
../src/odf/datatypes/xlink.cpp \
../src/odf/datatypes/chartlabelposition.cpp \
../src/odf/datatypes/grandtotal.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
../src/docx/docx_content_type.cpp \
@ -462,6 +465,8 @@ HEADERS += \
../src/odf/datatypes/wrapoption.h \
../src/odf/datatypes/writingmode.h \
../src/odf/datatypes/xlink.h \
../src/odf/datatypes/chartlabelposition.h \
../src/odf/datatypes/grandtotal.h \
../src/docx/docx_content_type.h \
../src/docx/docx_conversion_context.h \
../src/docx/docx_conversion_state.h \

View File

@ -88,6 +88,7 @@
#include "../src/odf/table_calculation_settings.cpp"
#include "../src/odf/table_docx.cpp"
#include "../src/odf/table_named_expressions.cpp"
#include "../src/odf/table_data_pilot_tables.cpp"
#include "../src/odf/table_pptx.cpp"
#include "../src/odf/table_xlsx.cpp"
#include "../src/odf/templates.cpp"

View File

@ -119,3 +119,5 @@
#include "../src/odf/datatypes/wrapoption.cpp"
#include "../src/odf/datatypes/writingmode.cpp"
#include "../src/odf/datatypes/xlink.cpp"
#include "../src/odf/datatypes/chartlabelposition.cpp"
#include "../src/odf/datatypes/grandtotal.cpp"

View File

@ -34,8 +34,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <boost/foreach.hpp>
#include "docx_content_type.h"
#include "namespaces.h"
@ -86,14 +84,14 @@ std::wostream & content_type_content::xml_to_stream(std::wostream & _Wostream) c
CP_XML_ATTR(L"xmlns", xmlns::types.value);
BOOST_FOREACH(const xml::element_wc & elm, default_)
for (size_t i = 0; i < default_.size(); i++)
{
elm.xml_to_stream(CP_XML_STREAM());
default_[i].xml_to_stream(CP_XML_STREAM());
}
BOOST_FOREACH(const xml::element_wc & elm, override_)
for (size_t i = 0; i < override_.size(); i++)
{
elm.xml_to_stream(CP_XML_STREAM());
override_[i].xml_to_stream(CP_XML_STREAM());
}
}
}

View File

@ -30,6 +30,7 @@
*
*/
#include <boost/foreach.hpp>
#include "docx_package.h"
#include "docx_conversion_context.h"
@ -218,26 +219,25 @@ void docx_charts_files::write(const std::wstring & RootPath)
size_t count = 0;
BOOST_FOREACH(const chart_content_ptr & item, charts_)
for (int i = 0 ; i < charts_.size(); i++)
{
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/word/charts/") + fileName, kWSConType);
if (!charts_[i]) continue;
count++;
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/word/charts/") + fileName, kWSConType);
package::simple_element(fileName, item->str()).write(path);
rels_files relFiles;
package::simple_element(fileName, charts_[i]->str()).write(path);
rels_files relFiles;
item->get_rel_file()->set_file_name(fileName + L".rels");
relFiles.add_rel_file(item->get_rel_file());
relFiles.write(path);
}
charts_[i]->get_rel_file()->set_file_name(fileName + L".rels");
relFiles.add_rel_file(charts_[i]->get_rel_file());
relFiles.write(path);
}
}
///////////////////////////

View File

@ -33,7 +33,6 @@
#include <string>
#include <vector>
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>

View File

@ -32,7 +32,6 @@
#include "docx_conversion_context.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include <cpdoccore/odf/odf_document.h>
#include "../odf/odfcontext.h"

View File

@ -33,9 +33,6 @@
#include "hyperlinks.h"
#include "oox_rels.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/xml/utils.h>
namespace cpdoccore {

View File

@ -235,7 +235,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
outputPath = outputPath.substr(0, n_svm) + L".png";
}
//------------------------------------------------
if (inputFileName.empty()) return L"";
//if (inputFileName.empty()) return L""; - Book 27.ods - пустые линки на картинки
id = std::wstring(L"picId") + std::to_wstring(count_image + 1);
count_image++;

View File

@ -31,10 +31,8 @@
*/
#include "oox_chart_axis.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <boost/foreach.hpp>
#include "oox_title.h"
#include "oox_chart_shape.h"
@ -181,18 +179,18 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
}
}
BOOST_FOREACH(odf_reader::chart::axis::grid & g, content_.grids_)
for (size_t i = 0; i < content_.grids_.size(); i++)
{
_oox_fill fill_null;
shape.set(g.graphic_properties_, fill_null);
shape.set(content_.grids_[i].graphic_properties_, fill_null);
if (g.type_ == odf_reader::chart::axis::grid::major)
if (content_.grids_[i].type_ == odf_reader::chart::axis::grid::major)
{
CP_XML_NODE(L"c:majorGridlines")
{
shape.oox_serialize(CP_XML_STREAM());
}
odf_reader::GetProperty(content_.properties_,L"display_label",boolVal);
odf_reader::GetProperty(content_.properties_, L"display_label", boolVal);
if ((boolVal == true) && (boolVal.get()==true))
{
CP_XML_NODE(L"c:majorTickMark")
@ -201,7 +199,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
}
}
}
if (g.type_ == odf_reader::chart::axis::grid::minor)
if (content_.grids_[i].type_ == odf_reader::chart::axis::grid::minor)
{
CP_XML_NODE(L"c:minorGridlines")
{
@ -234,11 +232,11 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
oox_serialize_default_text(_Wostream, content_.text_properties_);
BOOST_FOREACH(int const & ii, cross_id_)
for (size_t i = 0; i < cross_id_.size(); i++)
{
CP_XML_NODE(L"c:crossAx")
{
CP_XML_ATTR(L"val", ii);
CP_XML_ATTR(L"val", cross_id_[i]);
}
}

View File

@ -31,7 +31,6 @@
*/
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -124,6 +124,7 @@ void oox_chart_series::parse_properties()
data_labels_->set_showCatName(*boolVal);
}
odf_reader::GetProperty(content_.properties_, L"data-label-number", intVal);
if (intVal)
{
if (!data_labels_) data_labels_ = oox_data_labels();
@ -131,6 +132,13 @@ void oox_chart_series::parse_properties()
if (*intVal == 1) data_labels_->set_showVal(true);
if (*intVal == 2) data_labels_->set_showPercent(true);
}
odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
if (intVal)
{
if (!data_labels_) data_labels_ = oox_data_labels();
data_labels_->set_position(*intVal);
}
}
void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
{

View File

@ -29,7 +29,6 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -32,7 +32,6 @@
#include "oox_conversion_context.h"
#include <boost/foreach.hpp>
#include <iostream>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/odf/odf_document.h>

View File

@ -37,8 +37,6 @@
#include "oox_data_labels.h"
#include "oox_chart_shape.h"
#include <boost/foreach.hpp>
namespace cpdoccore {
namespace oox {
@ -51,6 +49,8 @@ oox_data_labels::oox_data_labels()//подписи на значениях
showPercent_ = false;
showSerName_ = false;
showVal_ = false;
position_ = -1; //not set
}
void oox_data_labels::set_common_dLbl ( std::vector<odf_reader::_property> & text_properties)
@ -107,6 +107,29 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
}
}
}
if (position_ >= 0 && position_ < 13)
{
CP_XML_NODE(L"c:dLblPos")
{
switch (position_)
{
case 0: CP_XML_ATTR(L"val", L"bestFit");break;
case 1: CP_XML_ATTR(L"val", L"b"); break;
case 2: CP_XML_ATTR(L"val", L"b"); break;
case 3: CP_XML_ATTR(L"val", L"b"); break;
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
case 5: CP_XML_ATTR(L"val", L"inEnd"); break;
case 6: CP_XML_ATTR(L"val", L"l"); break;
case 7: CP_XML_ATTR(L"val", L"inBase"); break;
case 8: CP_XML_ATTR(L"val", L"outEnd"); break;
case 9: CP_XML_ATTR(L"val", L"r"); break;
case 10: CP_XML_ATTR(L"val", L"t"); break;
case 11: CP_XML_ATTR(L"val", L"t"); break;
case 12: CP_XML_ATTR(L"val", L"t"); break;
}
}
}
CP_XML_NODE(L"c:showLegendKey")
{

View File

@ -59,8 +59,10 @@ public:
void set_showSerName (bool Val){showSerName_ = Val;}
void set_showVal (bool Val){showVal_ = Val;}
void add_dLbl(int ind, std::vector<odf_reader::_property> & text_properties);
void set_common_dLbl ( std::vector<odf_reader::_property> & text_properties);
void set_position (int Val){position_ = Val;}
void add_dLbl (int ind, std::vector<odf_reader::_property> & text_properties);
void set_common_dLbl ( std::vector<odf_reader::_property> & text_properties);
private:
@ -72,6 +74,8 @@ private:
bool showSerName_; // (Show Series Name) §21.2.2.188
bool showVal_; // (Show Value) §21.2.2.189
int position_;
std::vector<odf_reader::_property> textPr_;
std::map<int, std::vector<odf_reader::_property>> dLbls_;

View File

@ -31,7 +31,6 @@
*/
#include "oox_layout.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -32,7 +32,6 @@
#include "oox_package.h"
#include <boost/foreach.hpp>
#include <boost/ref.hpp>
#include <cpdoccore/utf8cpp/utf8.h>

View File

@ -32,7 +32,6 @@
#include "oox_rels.h"
#include <cpdoccore/xml/attributes.h>
#include <boost/foreach.hpp>
#include "namespaces.h"
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -31,7 +31,6 @@
*/
#include "oox_title.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -30,12 +30,8 @@
*
*/
#include "oox_types_chart.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "oox_types_chart.h"
#include "oox_chart_shape.h"
namespace cpdoccore {
@ -104,15 +100,15 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream)
CP_XML_ATTR(L"val", grouping_);
}
}
BOOST_FOREACH(oox_series_ptr const & s, series_)
for (size_t i = 0; i < series_.size(); i++)
{
s->oox_serialize(_Wostream);
series_[i]->oox_serialize(_Wostream);
}
BOOST_FOREACH(int const & i, axisId_)
for (size_t i = 0; i < axisId_.size(); i++)
{
CP_XML_NODE(L"c:axId")
{
CP_XML_ATTR(L"val", i);
CP_XML_ATTR(L"val", axisId_[i]);
}
}
data_labels_.oox_serialize(_Wostream);

View File

@ -31,7 +31,6 @@
*/
#include "pptx_comments.h"
#include <boost/foreach.hpp>
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "oox_rels.h"
@ -53,23 +52,23 @@ public:
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
BOOST_FOREACH(_pptx_comment const & c, pptx_comment_)
for (size_t i = 0; i < pptx_comment_.size(); i++)
{
CP_XML_NODE(L"p:cm")
{
CP_XML_ATTR(L"idx",c.idx_);
CP_XML_ATTR(L"idx", pptx_comment_[i].idx_);
CP_XML_ATTR(L"authorId", c.author_id_);
CP_XML_ATTR(L"dt", c.date_);
CP_XML_ATTR(L"authorId", pptx_comment_[i].author_id_);
CP_XML_ATTR(L"dt", pptx_comment_[i].date_);
CP_XML_NODE(L"p:pos")
{
CP_XML_ATTR(L"x", c.x_);
CP_XML_ATTR(L"y", c.y_);
CP_XML_ATTR(L"x", pptx_comment_[i].x_);
CP_XML_ATTR(L"y", pptx_comment_[i].y_);
}
CP_XML_NODE(L"p:text")
{
CP_XML_STREAM() << c.content_;
CP_XML_STREAM() << pptx_comment_[i].content_;
}
}
}

View File

@ -31,7 +31,6 @@
*/
#include "pptx_comments_context.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "../odf/datatypes/length.h"
#include "xlsx_utils.h"

View File

@ -30,7 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -30,7 +30,6 @@
*
*/
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -30,7 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <iostream>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/utils.h>

View File

@ -30,7 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <iostream>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -36,7 +36,6 @@
#include <iostream>
#include <list>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/odf/odf_document.h>

View File

@ -31,7 +31,6 @@
*/
#include "xlsx_border.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <cpdoccore/CPHash.h>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -32,8 +32,6 @@
#include "xlsx_cell_format.h"
#include <boost/foreach.hpp>
namespace cpdoccore {
namespace oox {

View File

@ -31,8 +31,6 @@
*/
#include <vector>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "xlsx_cell_styles.h"
@ -69,9 +67,9 @@ void xlsx_cell_styles::serialize(std::wostream & _Wostream) const
{
CP_XML_ATTR(L"count", impl_->cell_styles_.size());
BOOST_FOREACH(const xlsx_cell_style & s, impl_->cell_styles_)
{
oox::xlsx_serialize(CP_XML_STREAM(), s);
for (size_t i = 0; i < impl_->cell_styles_.size(); i++)
{
oox::xlsx_serialize(CP_XML_STREAM(), impl_->cell_styles_[i]);
}
}
}

View File

@ -32,7 +32,6 @@
#include <sstream>
#include <boost/foreach.hpp>
#include <boost/functional/hash/hash.hpp>
#include "xlsx_font.h"

View File

@ -32,7 +32,6 @@
#include "xlsx_comments_context.h"
#include "xlsx_table_metrics.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "../odf/datatypes/length.h"
#include "xlsx_utils.h"

View File

@ -29,7 +29,6 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <iostream>
@ -515,7 +514,7 @@ void xlsx_drawing_context::process_position_properties(drawing_object_descriptio
}
void xlsx_drawing_context::process_image(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
{
if (!drawing.fill.bitmap)
{

View File

@ -175,13 +175,6 @@ void xlsx_fills::serialize(std::wostream & _Wostream) const
}
}
}
//_Wostream << L"<fills count=\"" << inst_array.size() << L"\" >";
//BOOST_FOREACH(const xlsx_fill & f, inst_array)
//{
// ::cpdoccore::oox::xlsx_serialize(_Wostream, f);
//}
//_Wostream << L"</fills>";
}
}

View File

@ -30,9 +30,6 @@
*
*/
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "xlsx_hyperlinks.h"
@ -60,11 +57,12 @@ public:
void dump_rels(rels & Rels) const
{
BOOST_FOREACH(const record & rec, records_)
for (size_t i = 0; i < records_.size(); i++)
{
if (rec.type == L"External")
if (records_[i].type == L"External")
{
Rels.add( relationship(rec.id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", rec.location, rec.type) );
Rels.add( relationship(records_[i].id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
records_[i].location, records_[i].type) );
}
}
}
@ -109,23 +107,23 @@ public:
void xlsx_serialize(std::wostream & _Wostream) const
{
BOOST_FOREACH(record const & r, records_)
for (size_t i = 0; i < records_.size(); i++)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"hyperlink")
{
CP_XML_ATTR(L"ref", r.ref);
CP_XML_ATTR(L"display", r.display);
CP_XML_ATTR(L"ref", records_[i].ref);
CP_XML_ATTR(L"display", records_[i].display);
if (!r.location.empty() && r.type == L"Internal")
if (!records_[i].location.empty() && records_[i].type == L"Internal")
{
CP_XML_ATTR(L"location", r.location);
CP_XML_ATTR(L"location", records_[i].location);
}
if (!r.id.empty() && r.type == L"External")
if (!records_[i].id.empty() && records_[i].type == L"External")
{
CP_XML_ATTR(L"r:id", r.id);
CP_XML_ATTR(L"r:id", records_[i].id);
}
}
}

View File

@ -31,8 +31,6 @@
*/
#include <vector>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/utils.h>
#include "xlsx_sharedstrings.h"
@ -55,10 +53,10 @@ void xlsx_shared_strings::Impl::serialize(std::wostream & _Wostream) const
_Wostream << L"<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"" <<
strings_.size() << "\" uniqueCount=\"" << strings_.size() << "\">";
BOOST_FOREACH(const std::wstring & str, strings_)
for (size_t i = 0; i < strings_.size(); i++)
{
_Wostream << L"<si>";
_Wostream << str;
_Wostream << strings_[i];
_Wostream << L"</si>";
}

View File

@ -35,6 +35,7 @@
#include <iostream>
#include <iosfwd>
#include <cpdoccore/CPScopedPtr.h>
#include <boost/noncopyable.hpp>
namespace cpdoccore {
namespace oox {

View File

@ -232,9 +232,9 @@ void xlsx_style_manager::Impl::serialize_xf(std::wostream & _Wostream, const xls
std::sort(xfs_.begin(), xfs_.end(), compare_xlsx_xf());
_Wostream << L"<" << nodeName << L" count=\"" << xfs_.size() << L"\">";
BOOST_FOREACH(const xlsx_xf & xfRecord, xfs_)
for (size_t i = 0; i < xfs_.size(); i++)
{
cpdoccore::oox::xlsx_serialize(_Wostream, xfRecord);
cpdoccore::oox::xlsx_serialize(_Wostream, xfs_[i]);
}
_Wostream << L"</" << nodeName << L">";
}

View File

@ -32,7 +32,6 @@
#include "xlsx_table_metrics.h"
#include <vector>
#include <boost/foreach.hpp>
namespace cpdoccore {
namespace oox

View File

@ -40,7 +40,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include <cpdoccore/odf/odf_document.h>

View File

@ -36,7 +36,6 @@
#include "xlsx_sharedstrings.h"
#include <list>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <boost/foreach.hpp>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/utils.h>

View File

@ -35,7 +35,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <cpdoccore/xml/xmlchar.h>

View File

@ -29,6 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <boost/foreach.hpp>
#include "../docx/xlsx_textcontext.h"
#include "../docx/xlsx_num_format_context.h"
@ -275,12 +277,12 @@ void object_odf_context::calc_cache_series(std::wstring adress, std::vector<std:
oox::getCellAddressInv(ref_1, col_1,row_1);
oox::getCellAddressInv(ref_2, col_2,row_2);
BOOST_FOREACH(_cell & val,cash_values)
for (size_t i = 0; i < cash_values.size(); i++)
{
if (val.col>=col_1 && val.col<=col_2 &&
val.row>=row_1 && val.row<=row_2)
if (cash_values[i].col >= col_1 && cash_values[i].col <= col_2 &&
cash_values[i].row >= row_1 && cash_values[i].row <= row_2)
{
cash.push_back(val.val);
cash.push_back(cash_values[i].val);
}
}
}
@ -315,12 +317,12 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
chart_context.add_chart(class_);
}
BOOST_FOREACH(series & s, series_)
for (size_t i = 0; i < series_.size(); i++)
{
if (s.class_ != last_set_type) //разные типы серий в диаграмме - например бар и линия.
if (series_[i].class_ != last_set_type) //разные типы серий в диаграмме - например бар и линия.
{
chart_context.add_chart(s.class_);
last_set_type = s.class_;
chart_context.add_chart(series_[i].class_);
last_set_type = series_[i].class_;
}
oox::oox_chart_ptr current = chart_context.get_current_chart();
@ -331,11 +333,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
current->add_series(series_id++);
if (s.cell_range_address_.empty() )
s.cell_range_address_ = plot_area_.cell_range_address_; //SplitByColumn (ind_ser,range);
if (series_[i].cell_range_address_.empty() )
series_[i].cell_range_address_ = plot_area_.cell_range_address_; //SplitByColumn (ind_ser,range);
//SplitByRow (ind_ser,range);
if (s.cell_range_address_.empty())
s.cell_range_address_ = domain_cell_range_adress2_;
if (series_[i].cell_range_address_.empty())
series_[i].cell_range_address_ = domain_cell_range_adress2_;
//тут данные нужно поделить по столбцам или строкам - так как в плот-ареа общий диапазон
//первый столбец-строка МОЖЕт использоваться для подписей
@ -347,7 +349,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
std::vector<std::wstring> cat_cash;
calc_cache_series (domain_cell_range_adress_, domain_cash);
calc_cache_series (s.cell_range_address_, cell_cash);
calc_cache_series (series_[i].cell_range_address_, cell_cash);
if (categories_.size() >0)
calc_cache_series (categories_[0], cat_cash);
@ -356,8 +358,8 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
_CP_OPT(std::wstring) strVal;
_CP_OPT(bool) boolVal;
odf_reader::GetProperty(s.properties_, L"num_format", strVal);
odf_reader::GetProperty(s.properties_, L"link-data-style-to-source", boolVal);
odf_reader::GetProperty(series_[i].properties_, L"num_format", strVal);
odf_reader::GetProperty(series_[i].properties_, L"link-data-style-to-source", boolVal);
if ((strVal) && (strVal->length() > 1))
{
@ -371,7 +373,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
current->set_formula_series(4, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (4, domain_cash);
//y
current->set_formula_series(3, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series (3, cell_cash);
}
else
@ -379,13 +381,13 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (2, domain_cash);
//y
current->set_formula_series(3, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series (3, cell_cash);
}
}
else
{ //common
current->set_formula_series(1, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series(1, cell_cash);
}
@ -394,9 +396,9 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
current->set_formula_series(0, categories_[0], L"General", true);
current->set_values_series(0, cat_cash);
}
current->set_name(s.name_);
current->set_name(series_[i].name_);
current->set_content_series(s);
current->set_content_series(series_[i]);
}
std::sort(axises_.begin(), axises_.end(), axises_sort());//file_1_ (1).odp
@ -501,9 +503,9 @@ void process_build_object::ApplyChartProperties(std::wstring style, std::vector<
if (!properties)return;
BOOST_FOREACH(_property const & p, properties->content_)
for (size_t i = 0; i < properties->content_.size(); i++)
{
propertiesOut.push_back(p);
propertiesOut.push_back(properties->content_[i]);
}
}
}

View File

@ -86,10 +86,10 @@ static const class_type_pair class_type_str[] =
chart::class_type static get_series_class_type(std::wstring const & str)
{
BOOST_FOREACH(class_type_pair const & p, class_type_str)
for (size_t i = 0; i < 12/*class_type_str.size()*/; i++)
{
if (p.class_type_str_ == str)
return p.class_type_;
if (class_type_str[i].class_type_str_ == str)
return class_type_str[i].class_type_;
}
return chart::chart_bar; //лучше хоть какой назначить чем никакой !!
}

View File

@ -0,0 +1,85 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "chartlabelposition.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const chart_label_position & _Val)
{
switch(_Val.get_type())
{
case chart_label_position::avoid_overlap: _Wostream << L"avoid-overlap"; break;
case chart_label_position::bottom: _Wostream << L"bottom"; break;
case chart_label_position::bottom_left: _Wostream << L"bottom-left"; break;
case chart_label_position::bottom_right: _Wostream << L"bottom_right"; break;
case chart_label_position::center: _Wostream << L"center"; break;
case chart_label_position::inside: _Wostream << L"insidev"; break;
case chart_label_position::left: _Wostream << L"left"; break;
case chart_label_position::near_origin: _Wostream << L"near-origin"; break;
case chart_label_position::outside: _Wostream << L"outside"; break;
case chart_label_position::right: _Wostream << L"right"; break;
case chart_label_position::top: _Wostream << L"top"; break;
case chart_label_position::top_left: _Wostream << L"top-left"; break;
case chart_label_position::top_right: _Wostream << L"top-right"; break;
}
return _Wostream;
}
chart_label_position chart_label_position::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"avoid-overlap") return chart_label_position( avoid_overlap );
else if (tmp == L"bottom") return chart_label_position( bottom );
else if (tmp == L"bottom-left") return chart_label_position( bottom_left );
else if (tmp == L"bottom-right")return chart_label_position( bottom_right );
else if (tmp == L"center") return chart_label_position( center );
else if (tmp == L"inside") return chart_label_position( inside );
else if (tmp == L"left") return chart_label_position( left );
else if (tmp == L"near-origin") return chart_label_position( near_origin );
else if (tmp == L"outside") return chart_label_position( outside );
else if (tmp == L"right") return chart_label_position( right );
else if (tmp == L"top") return chart_label_position( top );
else if (tmp == L"top-left") return chart_label_position( top_left );
else if (tmp == L"top-right") return chart_label_position( top_right );
else
{
return chart_label_position( near_origin );
}
}
} }

View File

@ -0,0 +1,84 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
//
namespace cpdoccore { namespace odf_types {
class chart_label_position
{
public:
enum type
{
avoid_overlap,
bottom,
bottom_left,
bottom_right,
center,
inside,
left,
near_origin,
outside,
right,
top,
top_left,
top_right
};
chart_label_position() {}
chart_label_position(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static chart_label_position parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const chart_label_position & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_label_position);
}

View File

@ -62,7 +62,6 @@ chart_solid_type chart_solid_type::parse(const std::wstring & Str)
return chart_solid_type( pyramid );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_solid_type( cuboid );
}
}

View File

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

View File

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

View File

@ -36,7 +36,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <cpdoccore/odf/odf_document.h>
@ -67,9 +66,9 @@ namespace odf_reader {
namespace {
bool IsExistProperty(std::vector<_property> Heap,const std::wstring Name)
{
BOOST_FOREACH(_property const & p, Heap)
for (size_t i = 0; i < Heap.size(); i++)
{
int res = p.name_.find(Name);
int res = Heap[i].name_.find(Name);
if (res>=0)
{
return true;
@ -1166,10 +1165,10 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
bool drState = Context.get_drawing_state_content();
Context.set_drawing_state_content(true);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
ElementType type = elm->get_type();
elm->docx_convert(Context);
ElementType type = content_[i]->get_type();
content_[i]->docx_convert(Context);
}
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
@ -1284,10 +1283,10 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
Context.set_paragraph_state (false);
Context.set_run_state (false);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
ElementType type = elm->get_type();
elm->docx_convert(Context);
ElementType type = content_[i]->get_type();
content_[i]->docx_convert(Context);
}
drawing.content_group_ = temp_stream.str();

View File

@ -36,7 +36,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/regex.h>
#include <cpdoccore/xml/xmlchar.h>

View File

@ -80,13 +80,13 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
//сначала элементы графики потом все остальное
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
ElementType type = elm->get_type();
ElementType type = content_[i]->get_type();
if (type == typeDrawCustomShape) // || ....
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
}

View File

@ -136,9 +136,9 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
////////////////////////////////////////////////////////////////////////////////////
properties.apply_to(Context.get_slide_context().get_properties());
BOOST_FOREACH(odf_reader::_property const & p, additional_)
for (size_t i = 0; i < additional_.size(); i++)
{
Context.get_slide_context().set_property(p);
Context.get_slide_context().set_property(additional_[i]);
}
if (!textStyleName.empty())
{
@ -162,9 +162,9 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
}
////////////////////////////////////////////////////////////////////////////////////
Context.get_text_context().start_object();
BOOST_FOREACH(office_element_ptr const & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
std::wstring text_content_ = Context.get_text_context().end_object();

View File

@ -122,9 +122,9 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
////////////////////////////////////////////////////////////////////////////////////
properties.apply_to(Context.get_drawing_context().get_properties());
BOOST_FOREACH(odf_reader::_property const & p, additional_)
for (size_t i = 0; i < additional_.size(); i++)
{
Context.get_drawing_context().set_property(p);
Context.get_drawing_context().set_property(additional_[i]);
}
oox::_oox_fill fill;
@ -134,9 +134,9 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
//////////////////////////////////////////////////////////////////////////////////////
Context.get_text_context().start_drawing_content();
BOOST_FOREACH(office_element_ptr const & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
std::wstring text_content_ = Context.get_text_context().end_drawing_content();

View File

@ -244,9 +244,9 @@ xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
mc:Ignorable=\"w14\">";
BOOST_FOREACH(office_element_ptr elm, style_font_face_)
for (size_t i = 0; i < style_font_face_.size(); i++)
{
elm->docx_convert(Context);
style_font_face_[i]->docx_convert(Context);
}
strm << L"</w:fonts>";

View File

@ -32,8 +32,6 @@
#include "list.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -68,10 +66,9 @@ const wchar_t * list_item::name = L"list-item";
std::wostream & list_item::text_to_stream(std::wostream & _Wostream) const
{
// TODO!!!!
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -104,9 +101,9 @@ void list_item::docx_convert(oox::docx_conversion_context & Context)
Context.start_list_item(restart);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
Context.end_list_item();
@ -123,9 +120,9 @@ void list_item::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_text_context().start_list_item(restart);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
Context.get_text_context().end_list_item();
@ -143,9 +140,9 @@ void list_header::docx_convert(oox::docx_conversion_context & Context)
std::wstring s = Context.current_list_style();
Context.end_list();
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
Context.start_list(s, true);
@ -156,9 +153,9 @@ void list_header::pptx_convert(oox::pptx_conversion_context & Context)
//заголовок это не элемент списка
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
}
@ -166,10 +163,9 @@ void list_header::pptx_convert(oox::pptx_conversion_context & Context)
std::wostream & list_header::text_to_stream(std::wostream & _Wostream) const
{
// TODO!!!!
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}

View File

@ -32,8 +32,6 @@
#include "math_elementaries.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -32,8 +32,6 @@
#include "math_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -34,8 +34,6 @@
#include "math_token_elements.h"
#include "style_text_properties.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -342,7 +340,7 @@ void math_menclose::add_child_element( xml::sax * Reader, const std::wstring & N
void math_menclose::oox_convert(oox::math_context & Context)
{//0* elements
//BOOST_FOREACH(const office_element_ptr & elm, content_)
//for (size_t i = 0; i < content_.size(); i++)
//{
//office_math_element* math_element = dynamic_cast<office_math_element*>(elm.get());
//math_element->oox_convert(Context);
@ -368,7 +366,7 @@ void math_mfenced::add_child_element( xml::sax * Reader, const std::wstring & Ns
void math_mfenced::oox_convert(oox::math_context & Context)
{//0* elements
//BOOST_FOREACH(const office_element_ptr & elm, content_)
//for (size_t i = 0; i < content_.size(); i++)
//{
//office_math_element* math_element = dynamic_cast<office_math_element*>(elm.get());
//math_element->oox_convert(Context);

View File

@ -32,13 +32,10 @@
#include "math_limit_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
using namespace odf_types;

View File

@ -32,8 +32,6 @@
#include "math_table_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -33,8 +33,6 @@
#include "math_token_elements.h"
#include "style_text_properties.h"
#include <boost/foreach.hpp>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/xmlchar.h>

View File

@ -32,7 +32,6 @@
#include "note.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
@ -55,9 +54,9 @@ std::wostream & note_citation::text_to_stream(std::wostream & _Wostream) const
if (!text_label_.empty())
_Wostream << text_label_;
BOOST_FOREACH(const office_element_ptr & element, content_)
for (size_t i = 0; i < content_.size(); i++)
{
element->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -80,9 +79,9 @@ void note_citation::add_text(const std::wstring & Text)
void note_citation::docx_convert(oox::docx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
}
@ -93,9 +92,9 @@ const wchar_t * note_body::name = L"note-body";
std::wostream & note_body::text_to_stream(std::wostream & _Wostream) const
{
BOOST_FOREACH(const office_element_ptr & element, content_)
for (size_t i = 0; i < content_.size(); i++)
{
element->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -129,9 +128,9 @@ void note_body::docx_convert(oox::docx_conversion_context & Context)
Context.set_paragraph_state (false);
Context.set_run_state (false);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
Context.set_process_headers_footers (false);
Context.set_run_state (runState);

View File

@ -411,9 +411,9 @@ void number_text::oox_convert(oox::num_format_context & Context)
{
std::wstringstream strm;
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->text_to_stream(strm);
text_[i]->text_to_stream(strm);
}
std::wstring text_ = strm.str();

View File

@ -31,7 +31,6 @@
*/
#include "odfcontext.h"
#include <boost/foreach.hpp>
namespace cpdoccore {

View File

@ -32,8 +32,6 @@
#include "office_annotation.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -141,9 +139,9 @@ void office_annotation::docx_convert(oox::docx_conversion_context & Context)
bool pState = Context.get_paragraph_state();
Context.set_paragraph_state(false);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
Context.set_run_state(runState);
@ -191,9 +189,9 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
}
Context.get_text_context().start_comment_content();
BOOST_FOREACH(office_element_ptr const & elm, content_)//текст + текстовый стиль
for (size_t i = 0; i < content_.size(); i++)//текст + текстовый стиль
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
Context.get_comments_context().add_author(author);
Context.get_comments_context().add_content(Context.get_text_context().end_comment_content());
@ -268,9 +266,9 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_comments_context().start_comment(x, y,id_idx.first,id_idx.second);//author & idx (uniq number for author
Context.get_text_context().start_comment_content();
BOOST_FOREACH(office_element_ptr const & elm, content_)//текст + текстовый стиль
for (size_t i = 0; i < content_.size(); i++)//текст + текстовый стиль
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
Context.get_comments_context().add_date(date);

View File

@ -32,8 +32,6 @@
#include "office_binary_data.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -34,8 +34,6 @@
#include "serialize_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -32,8 +32,6 @@
#include "office_chart.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -32,8 +32,6 @@
#include "office_document.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -219,6 +219,15 @@ enum ElementType
typeTableTableRowGroup,
typeTableTableRowNoGroup,
typeTableTableSource,
typeTableDataPilotTables,
typeTableDataPilotTable,
typeTableDataPilotField,
typeTableDatabaseSourceTable,
typeTableDatabaseSourceQuery,
typeTableDatabaseSourceSql,
typeTableSourceCellRange,
typeTableSourceService,
typeOfficeBody,
typeOfficeText,

View File

@ -32,8 +32,6 @@
#include "office_event_listeners.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -32,8 +32,6 @@
#include "office_scripts.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -32,8 +32,6 @@
#include "office_settings.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -32,11 +32,8 @@
#include "office_spreadsheet.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
@ -54,6 +51,10 @@ void office_spreadsheet::add_child_element( xml::sax * Reader, const std::wstrin
{
CP_CREATE_ELEMENT(table_database_ranges_);
}
else if CP_CHECK_NAME(L"table", L"data-pilot-tables")
{
CP_CREATE_ELEMENT(table_data_pilot_tables_);
}
else
CP_CREATE_ELEMENT(content_);
}
@ -70,9 +71,9 @@ void office_spreadsheet::add_attributes( const xml::attributes_wc_ptr & Attribut
void office_spreadsheet::docx_convert(oox::docx_conversion_context & Context)
{
Context.start_office_text();
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
Context.end_office_text();
}
@ -82,13 +83,17 @@ void office_spreadsheet::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.start_office_spreadsheet(this);
_CP_LOG << L"[info][xlsx] process spreadsheet (" << content_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, table_database_ranges_)
{
elm->xlsx_convert(Context);
for (size_t i = 0; i < table_database_ranges_.size(); i++)
{
table_database_ranges_[i]->xlsx_convert(Context);
}
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
for (size_t i = 0; i < table_data_pilot_tables_.size(); i++)
{
table_data_pilot_tables_[i]->xlsx_convert(Context);
}
Context.end_office_spreadsheet();
}

View File

@ -66,6 +66,7 @@ public:
// TODO: table-decls
office_element_ptr_array table_database_ranges_;
office_element_ptr_array table_data_pilot_tables_;
office_element_ptr tracked_changes_;//??
office_element_ptr_array content_;

View File

@ -33,8 +33,6 @@
#include "office_text.h"
#include "office_annotation.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
@ -117,9 +115,9 @@ void office_text::docx_convert(oox::docx_conversion_context & Context)
tracked_changes_->docx_convert(Context);
Context.start_office_text();
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
Context.end_office_text();
}
@ -127,18 +125,18 @@ void office_text::docx_convert(oox::docx_conversion_context & Context)
void office_text::xlsx_convert(oox::xlsx_conversion_context & Context)
{
//Context.start_office_text();
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
//Context.end_office_text();
}
void office_text::pptx_convert(oox::pptx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
}

View File

@ -197,7 +197,7 @@ void tab::docx_convert(oox::docx_conversion_context & Context)
Context.add_element_to_run();
std::wostream & _Wostream = Context.output_stream();
_Wostream << L"<w:tab />";
_Wostream << L"<w:tab/>";
}
void tab::xlsx_convert(oox::xlsx_conversion_context & Context)
@ -222,7 +222,7 @@ std::wostream & line_break::text_to_stream(std::wostream & _Wostream) const
void line_break::docx_convert(oox::docx_conversion_context & Context)
{
Context.add_element_to_run();
Context.output_stream() << L"<w:br />";
Context.output_stream() << L"<w:br/>";
}
void line_break::xlsx_convert(oox::xlsx_conversion_context & Context)
@ -331,9 +331,9 @@ const wchar_t * span::name = L"span";
std::wostream & span::text_to_stream(std::wostream & _Wostream) const
{
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -349,9 +349,9 @@ void span::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
boost::algorithm::split(classNamesArray, classNames, boost::algorithm::is_any_of(L" "));
BOOST_FOREACH(const std::wstring & name, classNamesArray)
for (size_t i = 0; i < classNamesArray.size(); i++)
{
text_class_names_.push_back( name );
text_class_names_.push_back( classNamesArray[i] );
}
}
}
@ -405,9 +405,9 @@ void span::docx_convert(oox::docx_conversion_context & Context)
if (!addNewRun)Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->docx_convert(Context);
content_[i]->docx_convert(Context);
}
Context.finish_run();
@ -419,9 +419,9 @@ void span::docx_convert(oox::docx_conversion_context & Context)
void span::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_span(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
Context.end_span();
}
@ -431,9 +431,9 @@ void span::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_text_context().get_styles_context().start_process_style(styleInst);
Context.get_text_context().start_span(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
Context.get_text_context().end_span();
Context.get_text_context().get_styles_context().end_process_style();
@ -445,9 +445,9 @@ const wchar_t * a::name = L"a";
std::wostream & a::text_to_stream(std::wostream & _Wostream) const
{
BOOST_FOREACH(const office_element_ptr & element, content_)
for (size_t i = 0; i < content_.size(); i++)
{
element->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -526,9 +526,9 @@ void a::docx_convert(oox::docx_conversion_context & Context)
if (!addNewRun)
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->docx_convert(Context);
content_[i]->docx_convert(Context);
}
Context.finish_run();
@ -541,18 +541,18 @@ void a::docx_convert(oox::docx_conversion_context & Context)
void a::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_hyperlink(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
Context.end_hyperlink(common_xlink_attlist_.href_.get_value_or(L""));
}
void a::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_hyperlink();
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
std::wstring hId = Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""));
@ -710,9 +710,9 @@ const wchar_t * title::name = L"title";
std::wostream & title::text_to_stream(std::wostream & _Wostream) const
{
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -774,9 +774,9 @@ const wchar_t * subject::name = L"subject";
std::wostream & subject::text_to_stream(std::wostream & _Wostream) const
{
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -837,9 +837,9 @@ const wchar_t * chapter::name = L"chapter";
std::wostream & chapter::text_to_stream(std::wostream & _Wostream) const
{
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -901,9 +901,9 @@ const wchar_t * text_placeholder::name = L"placeholder";
std::wostream & text_placeholder::text_to_stream(std::wostream & _Wostream) const
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->text_to_stream(_Wostream);
content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
@ -925,17 +925,17 @@ void text_placeholder::add_text(const std::wstring & Text)
void text_placeholder::docx_convert(oox::docx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
}
void text_placeholder::pptx_convert(oox::pptx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
}
@ -981,9 +981,9 @@ void text_page_number::docx_convert(oox::docx_conversion_context & Context)
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>PAGE</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
@ -991,9 +991,9 @@ void text_page_number::docx_convert(oox::docx_conversion_context & Context)
void text_page_number::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_field(oox::page_number, L"");
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->pptx_convert(Context);
text_[i]->pptx_convert(Context);
}
Context.get_text_context().end_field();
}
@ -1032,9 +1032,9 @@ void text_page_count::docx_convert(oox::docx_conversion_context & Context)
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>NUMPAGES</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
@ -1042,9 +1042,9 @@ void text_page_count::docx_convert(oox::docx_conversion_context & Context)
void text_page_count::pptx_convert(oox::pptx_conversion_context & Context)
{
//поскольку такого поля в ms нет - конвертим как обычный текст
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->pptx_convert(Context);
text_[i]->pptx_convert(Context);
}
}
@ -1084,9 +1084,9 @@ void text_date::docx_convert(oox::docx_conversion_context & Context)
if (asText)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
}
@ -1117,9 +1117,9 @@ void text_date::docx_convert(oox::docx_conversion_context & Context)
void text_date::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_field(oox::date,style_data_style_name_.get_value_or(L""));
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->pptx_convert(Context);
text_[i]->pptx_convert(Context);
}
Context.get_text_context().end_field();
}
@ -1134,9 +1134,9 @@ void text_modification_date::docx_convert(oox::docx_conversion_context & Context
if (asText)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
}
@ -1147,9 +1147,9 @@ void text_modification_date::docx_convert(oox::docx_conversion_context & Context
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText xml:space=\"preserve\">SAVEDATE \\@ \"dd.MM.yy\"</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
@ -1197,9 +1197,9 @@ void text_time::docx_convert(oox::docx_conversion_context & Context)
if (asText)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
}
@ -1228,9 +1228,9 @@ void text_time::docx_convert(oox::docx_conversion_context & Context)
void text_time::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_field(oox::time, style_data_style_name_.get_value_or(L""));
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->pptx_convert(Context);
text_[i]->pptx_convert(Context);
}
Context.get_text_context().end_field();
}
@ -1245,9 +1245,9 @@ void text_modification_time::docx_convert(oox::docx_conversion_context & Context
if (asText)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
}
@ -1258,9 +1258,9 @@ void text_modification_time::docx_convert(oox::docx_conversion_context & Context
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>SAVEDATE \\@ \"h:mm:ss am/pm\"</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
@ -1301,18 +1301,18 @@ void text_file_name::add_text(const std::wstring & Text)
void text_file_name::docx_convert(oox::docx_conversion_context & Context)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
Context.finish_run();
}
void text_file_name::pptx_convert(oox::pptx_conversion_context & Context)
{
//Context.get_text_context().start_field(oox::file_name, style_data_style_name_.get_value_or(L""));
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->pptx_convert(Context);
text_[i]->pptx_convert(Context);
}
Context.get_text_context().end_field();
}
@ -1344,16 +1344,16 @@ void sequence::add_text(const std::wstring & Text)
void sequence::docx_convert(oox::docx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->docx_convert(Context);
text_[i]->docx_convert(Context);
}
}
void sequence::pptx_convert(oox::pptx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->pptx_convert(Context);
text_[i]->pptx_convert(Context);
}
}

View File

@ -37,8 +37,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/xmlchar.h>
#include <boost/foreach.hpp>
#include "paragraph_elements.h"
#include "serialize_elements.h"

View File

@ -32,7 +32,6 @@
#pragma once
#include "office_elements.h"
#include <boost/foreach.hpp>
namespace cpdoccore {
namespace odf_reader {
@ -46,9 +45,9 @@ inline std::wostream & serialize_elements(std::wostream & _Wostream, const offic
inline std::wostream & serialize_elements(std::wostream & _Wostream, const office_element_ptr_array & elms)
{
BOOST_FOREACH(const office_element_ptr & elm, elms)
for (size_t i = 0; i < elms.size(); i++)
{
serialize_elements(_Wostream, elm);
serialize_elements(_Wostream, elms[i]);
}
return _Wostream;
}
@ -62,9 +61,9 @@ inline std::wostream & serialize_elements_text(std::wostream & _Wostream, const
inline std::wostream & serialize_elements_text(std::wostream & _Wostream, const office_element_ptr_array & elms)
{
BOOST_FOREACH(const office_element_ptr & elm, elms)
for (size_t i = 0; i < elms.size(); i++)
{
serialize_elements_text(_Wostream, elm);
serialize_elements_text(_Wostream, elms[i]);
}
return _Wostream;
}

View File

@ -151,6 +151,9 @@ void style_chart_properties::add_attributes( const xml::attributes_wc_ptr & Attr
CP_APPLY_ATTR(L"chart:error-category", strVal);
if (strVal)content_.push_back(_property(L"error-category", chart_error_category(chart_error_category::parse(strVal.get())).get_type() ));
CP_APPLY_ATTR(L"chart:label-position", strVal);
if (strVal)content_.push_back(_property(L"label-position", chart_label_position(chart_label_position::parse(strVal.get())).get_type() ));
common_rotation_angle_attlist_.add_attributes(Attributes);
//CP_APPLY_ATTR(L"chart:scale-text", chart_scale_text_ );

View File

@ -49,6 +49,7 @@
#include "datatypes/charterrorcategory.h"
#include "datatypes/chartseriessource.h"
#include "datatypes/chartregressiontype.h"
#include "datatypes/chartlabelposition.h"
#include "datatypes/direction.h"
namespace cpdoccore {

View File

@ -32,9 +32,6 @@
#include "style_map.h"
#include <boost/foreach.hpp>
//#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -37,8 +37,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <boost/foreach.hpp>
#include "office_elements_create.h"
#include "datatypes/borderstyle.h"

View File

@ -34,7 +34,6 @@
#include "style_paragraph_properties.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
@ -423,9 +422,9 @@ void style_tab_stops::docx_convert(oox::docx_conversion_context & Context)
if (style_tab_stops_.size() > 0)
{
BOOST_FOREACH(const office_element_ptr & elm, style_tab_stops_)
for (size_t i = 0; i < style_tab_stops_.size(); i++)
{
elm->docx_convert(Context);
style_tab_stops_[i]->docx_convert(Context);
}
}
_pPr << L"</w:tabs>";

View File

@ -32,7 +32,6 @@
#include <iostream>
#include "style_paragraph_properties.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../docx/pptx_conversion_context.h"

View File

@ -32,8 +32,6 @@
#include "style_regions.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
@ -51,17 +49,17 @@ const wchar_t * style_region_left::name = L"region-left";
void style_region_left::docx_convert(oox::docx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->docx_convert(Context);
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
void style_region_left::xlsx_convert(oox::xlsx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
}
@ -85,17 +83,17 @@ const wchar_t * style_region_right::name = L"region-right";
void style_region_right::docx_convert(oox::docx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
}
void style_region_right::xlsx_convert(oox::xlsx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
}
@ -119,17 +117,17 @@ const wchar_t * style_region_center::name = L"region-center";
void style_region_center::docx_convert(oox::docx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
content_[i]->docx_convert(Context);
}
}
void style_region_center::xlsx_convert(oox::xlsx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->xlsx_convert(Context);
content_[i]->xlsx_convert(Context);
}
}

View File

@ -40,7 +40,6 @@
#include <cpdoccore/odf/odf_document.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements.h"
#include "office_elements_create.h"

View File

@ -36,7 +36,6 @@
#include <string>
#include <vector>
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include "../../include/cpdoccore/CPOptional.h"

View File

@ -35,11 +35,13 @@
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "table_named_expressions.h"
#include "table_database_ranges.h"
#include "table_data_pilot_tables.h"
#include "calcext_elements.h"
#include "datatypes/tablemode.h"

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