mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
47 Commits
core-win-6
...
v5.2.0.73
| Author | SHA1 | Date | |
|---|---|---|---|
| a965b30d72 | |||
| dd3dd1e42a | |||
| d2f1460f1b | |||
| bf02eec8ef | |||
| 8513ec5ae7 | |||
| 35b43e0683 | |||
| 421e58fe34 | |||
| 048cac74b6 | |||
| c23ff4c8cd | |||
| ccc27a2e1b | |||
| 3843f52601 | |||
| c3ec17c132 | |||
| 72cb63b9f5 | |||
| dd04f5cf12 | |||
| dde6621d10 | |||
| 7c3b060794 | |||
| a8e4ccdf80 | |||
| 9601d90671 | |||
| f59d7ff845 | |||
| adf2399368 | |||
| 5da57d65c1 | |||
| feddb37222 | |||
| 81db8d1776 | |||
| 2a809ab970 | |||
| b6a0614f00 | |||
| 96202979ea | |||
| 4ca2126abc | |||
| 89235ca12a | |||
| 08d551752e | |||
| 77b1303d62 | |||
| 93e56e2b8a | |||
| e032fc8294 | |||
| 5ae2ac2385 | |||
| 6b8cb6cae4 | |||
| e66ea7c628 | |||
| 2447925fd6 | |||
| 9991195d56 | |||
| 51f579a682 | |||
| 45e0459434 | |||
| 2f194ebd97 | |||
| 5e4ce83dc1 | |||
| 50d4f451b9 | |||
| d464aa659a | |||
| db2d001110 | |||
| b883cfcbd4 | |||
| bb8add215a | |||
| 5e126e28ff |
2
.gitignore
vendored
2
.gitignore
vendored
@ -35,6 +35,7 @@ Common/3dParty/openssl/openssl
|
||||
.idea
|
||||
.svn
|
||||
.DS_Store
|
||||
.qmake.stash
|
||||
Thumbs.db
|
||||
*.xcuserstate
|
||||
*.xcuserdatad
|
||||
@ -55,3 +56,4 @@ X2tConverter/**/Makefile.*
|
||||
*.zip
|
||||
*.tar.gz
|
||||
**/*.build/
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ OleObject::OleObject( const CharacterPropertyExceptions* chpx, WordDocument* doc
|
||||
szData = szData >> 16;
|
||||
}
|
||||
unsigned char* bytes = reader.ReadBytes( szData, true );
|
||||
if (bytes)
|
||||
if (bytes && szData < 0xffff)
|
||||
{
|
||||
emeddedData = std::string((char*)bytes, szData);
|
||||
delete []bytes;
|
||||
|
||||
@ -320,6 +320,18 @@ namespace DocFileFormat
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_gridSpan <= 1 && nComputedCellWidth > _width && _width > 1)
|
||||
{
|
||||
int width_current = 0;
|
||||
for (int i = _gridIndex; i < _grid->size(); i++)
|
||||
{
|
||||
width_current += _grid->at(i);
|
||||
if (width_current >= nComputedCellWidth)
|
||||
break;
|
||||
_gridSpan++;
|
||||
}
|
||||
_width = nComputedCellWidth;
|
||||
}
|
||||
|
||||
XMLTools::XMLElement tcW ( L"w:tcW" );
|
||||
|
||||
|
||||
@ -338,7 +338,7 @@ namespace DocFileFormat
|
||||
HeaderStoriesPlex = new Plex<EmptyStructure>( EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfHdd, FIB->m_FibWord97.lcbPlcfHdd, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_RgLw97.ccpAtn > 0)
|
||||
if (FIB->m_RgLw97.ccpAtn > 0)
|
||||
{
|
||||
AnnotationsReferencePlex = new Plex<AnnotationReferenceDescriptor>(AnnotationReferenceDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfandRef, FIB->m_FibWord97.lcbPlcfandRef, nWordVersion);
|
||||
IndividualCommentsPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfandTxt, FIB->m_FibWord97.lcbPlcfandTxt, nWordVersion);
|
||||
@ -417,7 +417,7 @@ namespace DocFileFormat
|
||||
AnnotationOwners = new AnnotationOwnerList (FIB, TableStream);
|
||||
}
|
||||
|
||||
if (m_pCallFunc)
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
m_pCallFunc->OnProgress(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 300000 );
|
||||
|
||||
@ -435,24 +435,24 @@ namespace DocFileFormat
|
||||
std::unordered_map<int, int> fonts_charsets;
|
||||
bool bFontsCodePage = false;
|
||||
|
||||
for ( std::vector<ByteStructure*>::iterator iter = FontTable->Data.begin(); !bFontsCodePage && iter != FontTable->Data.end(); iter++ )
|
||||
for ( size_t i = 0; !bFontsCodePage && i < FontTable->Data.size(); ++i)
|
||||
{
|
||||
FontFamilyName* font = dynamic_cast<FontFamilyName*>( *iter );
|
||||
FontFamilyName* font = dynamic_cast<FontFamilyName*>( FontTable->Data[i]);
|
||||
if (!font) continue;
|
||||
|
||||
if (fonts_charsets.find(font->chs) == fonts_charsets.end())
|
||||
{
|
||||
fonts_charsets.insert(std::make_pair(font->chs, font->ff));
|
||||
|
||||
for (int i = 0 ; i < sizeof(aCodePages) / 2; i++)
|
||||
{
|
||||
if (aCodePages[i][0] == font->chs && font->chs != 0)
|
||||
{
|
||||
nFontsCodePage = aCodePages[i][1];
|
||||
bFontsCodePage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (size_t j = 0 ; j < 32; j++)
|
||||
{
|
||||
if (aCodePages[j][0] == font->chs && font->chs != 0)
|
||||
{
|
||||
nFontsCodePage = aCodePages[j][1];
|
||||
bFontsCodePage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -465,7 +465,7 @@ namespace DocFileFormat
|
||||
Text = m_PieceTable->GetAllEncodingText (WordDocumentStream);
|
||||
}
|
||||
|
||||
if (FIB->m_FibWord97.lcbClx < 1 || ((Text) && (Text->empty())))
|
||||
if (FIB->m_FibWord97.lcbClx < 1 || ((Text) && (Text->empty())))
|
||||
{
|
||||
int cb = FIB->m_FibBase.fcMac - FIB->m_FibBase.fcMin;
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;USE_ATL_CSTRINGS;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include;../../DesktopEditor/freetype-2.5.2/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@ -205,7 +205,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\..\..\Common\OfficeDrawing;"..\..\..\..\..\DesktopEditor\freetype-2.5.2\include";..\..\..\..\..\Common\OfficeDrawing\Shapes"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
|
||||
@ -2800,30 +2800,51 @@ public:
|
||||
}
|
||||
void Write(NSStringUtils::CStringBuilder& wr)
|
||||
{
|
||||
if(false == rId.empty())
|
||||
wr.WriteString(L"<w:hyperlink");
|
||||
if(!rId.empty())
|
||||
{
|
||||
std::wstring sCorrect_rId = XmlUtils::EncodeXmlString(rId);
|
||||
std::wstring sCorrect_tooltip = XmlUtils::EncodeXmlString(sTooltip);
|
||||
std::wstring sCorrect_anchor = XmlUtils::EncodeXmlString(sAnchor);
|
||||
|
||||
std::wstring sStart = L"<w:hyperlink r:id=\"" + sCorrect_rId + L"\"";
|
||||
if(false == sTooltip.empty())
|
||||
{
|
||||
sStart += L" w:tooltip=\"";
|
||||
sStart += sCorrect_tooltip;
|
||||
sStart += L"\"";
|
||||
}
|
||||
if(false == sAnchor.empty())
|
||||
{
|
||||
sStart += L" w:anchor=\"";
|
||||
sStart += sCorrect_anchor;
|
||||
sStart += L"\"";
|
||||
}
|
||||
sStart += L" w:history=\"1\">";
|
||||
wr.WriteString(sStart);
|
||||
wr.Write(writer);
|
||||
wr.WriteString(L"</w:hyperlink>");
|
||||
wr.WriteString(L" r:id=\"");
|
||||
wr.WriteEncodeXmlString(rId);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
if(!sTooltip.empty())
|
||||
{
|
||||
wr.WriteString(L" w:tooltip=\"");
|
||||
wr.WriteEncodeXmlString(sTooltip);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
if(!sAnchor.empty())
|
||||
{
|
||||
wr.WriteString(L" w:anchor=\"");
|
||||
wr.WriteEncodeXmlString(sAnchor);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
if (bHistory)
|
||||
{
|
||||
if (History)
|
||||
{
|
||||
wr.WriteString(L" w:history=\"1\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
wr.WriteString(L" w:history=\"0\"");
|
||||
}
|
||||
}
|
||||
if (!sDocLocation.empty())
|
||||
{
|
||||
wr.WriteString(L" w:docLocation=\"");
|
||||
wr.WriteEncodeXmlString(sDocLocation);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
if (!sTgtFrame.empty())
|
||||
{
|
||||
wr.WriteString(L" w:tgtFrame=\"");
|
||||
wr.WriteEncodeXmlString(sTgtFrame);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
wr.WriteString(L">");
|
||||
wr.Write(writer);
|
||||
wr.WriteString(L"</w:hyperlink>");
|
||||
}
|
||||
};
|
||||
class CFldSimple{
|
||||
|
||||
@ -4493,11 +4493,13 @@ public:
|
||||
NSStringUtils::CStringBuilder* pPrevWriter = m_pCurWriter;
|
||||
m_pCurWriter = &pHyperlink->writer;
|
||||
READ1_DEF(length, res, this->ReadParagraphContent, NULL);
|
||||
long rId;
|
||||
std::wstring sHref = XmlUtils::EncodeXmlString(pHyperlink->sLink);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, std::wstring(_T("External")), &rId);
|
||||
|
||||
pHyperlink->rId = L"rId" + std::to_wstring(rId);
|
||||
if (!pHyperlink->sLink.empty())
|
||||
{
|
||||
long rId;
|
||||
std::wstring sHref = XmlUtils::EncodeXmlString(pHyperlink->sLink);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, std::wstring(_T("External")), &rId);
|
||||
pHyperlink->rId = L"rId" + std::to_wstring(rId);
|
||||
}
|
||||
m_pCurWriter = pPrevWriter;
|
||||
}
|
||||
else
|
||||
|
||||
@ -51,6 +51,7 @@ namespace formulasconvert {
|
||||
void replace_cells_range(std::wstring& expr, bool withTableName);
|
||||
bool check_formula(std::wstring& expr);
|
||||
void replace_semicolons(std::wstring& expr);
|
||||
void replace_tilda(std::wstring& expr);
|
||||
void replace_vertical(std::wstring& expr);
|
||||
void replace_space(std::wstring& expr);
|
||||
|
||||
@ -291,7 +292,17 @@ namespace formulasconvert {
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
// TODO
|
||||
// заменить точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
|
||||
void odf2oox_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
@ -302,9 +313,20 @@ namespace formulasconvert {
|
||||
boost::wregex(L"(;)|(\".*?\")|('.*?')"),
|
||||
&replace_semicolons_formater,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
expr = res;
|
||||
}
|
||||
void odf2oox_converter::Impl::replace_tilda(std::wstring& expr)
|
||||
{
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
//boost::wregex(L"(;)|(?:\".*?\")|(?:'.*?')"),
|
||||
boost::wregex(L"(~)|(\".*?\")|('.*?')"),
|
||||
&replace_semicolons_formater,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
expr = res;
|
||||
}
|
||||
std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
@ -462,6 +484,7 @@ namespace formulasconvert {
|
||||
|
||||
replace_cells_range (workstr, true);
|
||||
replace_semicolons (workstr);
|
||||
replace_tilda (workstr);
|
||||
replace_vertical (workstr);
|
||||
|
||||
if (isFormula)
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#include "formulasconvert.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include"../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
@ -221,6 +220,20 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
|
||||
namespace
|
||||
{
|
||||
std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
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"";
|
||||
}
|
||||
|
||||
|
||||
std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
@ -251,7 +264,6 @@ void oox2odf_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
boost::match_default | boost::format_all);
|
||||
expr = res;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -306,9 +318,9 @@ std::wstring forbidden_formulas1[] =
|
||||
|
||||
bool is_forbidden1(const std::wstring & formula)
|
||||
{
|
||||
BOOST_FOREACH(const std::wstring & s, forbidden_formulas1)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, s))
|
||||
for (size_t i = 0; i < 1; i++)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, forbidden_formulas1[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -669,9 +681,10 @@ size_t getColAddressInv(const std::wstring & a_)
|
||||
size_t mul = 1;
|
||||
bool f = true;
|
||||
size_t res = 0;
|
||||
BOOST_REVERSE_FOREACH(const wchar_t c, a)
|
||||
|
||||
for (int i = a.length() - 1; i >= 0; i--)
|
||||
{
|
||||
size_t v = c - L'A';
|
||||
size_t v = a[i] - L'A';
|
||||
if (f)
|
||||
f = false;
|
||||
else
|
||||
@ -700,14 +713,13 @@ void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring
|
||||
::XmlUtils::replace_all( a, L"$", L"");
|
||||
//::XmlUtils::replace_all( a, L"'", L"");
|
||||
::boost::algorithm::to_upper(a);
|
||||
|
||||
|
||||
BOOST_FOREACH(wchar_t c, a)
|
||||
for (size_t i = 0; i < a.length(); i++)
|
||||
{
|
||||
if (c >= L'0' && c <= L'9')
|
||||
row +=c;
|
||||
if (a[i] >= L'0' && a[i] <= L'9')
|
||||
row += a[i];
|
||||
else
|
||||
col += c;
|
||||
col += a[i];
|
||||
}
|
||||
std::reverse(col.begin(), col.end());
|
||||
std::reverse(row.begin(), row.end());
|
||||
|
||||
@ -52,8 +52,10 @@ enum ElementType
|
||||
typeTextReferenceMarkEnd,
|
||||
typeTextReferenceRef,
|
||||
|
||||
typeTextFieldFieldmarkStart,
|
||||
typeTextFieldFieldmarkEnd,
|
||||
typeFieldFieldmarkStart,
|
||||
typeFieldFieldmarkEnd,
|
||||
typeFieldFieldmark,
|
||||
typeFieldParam,
|
||||
|
||||
typeTextSpan,
|
||||
typeTextA,
|
||||
@ -501,6 +503,7 @@ enum ElementType
|
||||
typeFormTextarea,
|
||||
typeFormTime,
|
||||
typeFormValueRange,
|
||||
typeFormItem,
|
||||
|
||||
typeDrawPage,
|
||||
typePresentationFooterDecl,
|
||||
|
||||
@ -45,7 +45,7 @@ namespace utils {
|
||||
std::wstring replace_xml_to_text_ImplRegEx(const std::wstring & Text);
|
||||
std::string replace_xml_to_text_ImplRegEx(const std::string & Text);
|
||||
|
||||
std::wstring replace_text_to_xml_ImplReplace(const std::wstring & Text);
|
||||
std::wstring replace_text_to_xml_ImplReplace(const std::wstring & Text, bool dDeleteUnicode = false);
|
||||
std::string replace_text_to_xml_ImplReplace(const std::string & Text);
|
||||
|
||||
std::wstring replace_amp_text_to_xml_ImplReplace(const std::wstring & Text);
|
||||
@ -55,7 +55,7 @@ namespace utils {
|
||||
std::string replace_xml_to_text_ImplReplace(const std::string & Text);
|
||||
}
|
||||
|
||||
std::wstring replace_text_to_xml(const std::wstring & Text);
|
||||
std::wstring replace_text_to_xml(const std::wstring & Text, bool dDeleteUnicode = false);
|
||||
std::string replace_text_to_xml(const std::string & Text);
|
||||
|
||||
std::wstring replace_amp_text_to_xml(const std::wstring & Text);
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <cmath>
|
||||
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
@ -78,14 +77,13 @@ std::wstring RGBToString(int r, int g, int b)
|
||||
color v(r, g, b);
|
||||
double minDist = (std::numeric_limits<double>::max)();
|
||||
|
||||
|
||||
BOOST_FOREACH(color const & c, colors)
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
{
|
||||
double dist = color_dist(v, c);
|
||||
double dist = color_dist(v, colors[i]);
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
result = c.name_;
|
||||
result = colors[i].name_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,9 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <xml/utils.h>
|
||||
@ -306,10 +303,15 @@ void docx_conversion_context::finish_run()
|
||||
{
|
||||
if (false == in_run_) return;
|
||||
|
||||
if (get_comments_context().state() == 4)
|
||||
{
|
||||
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().current_id() << L"\"/>";
|
||||
get_comments_context().state(0);
|
||||
}
|
||||
output_stream() << L"</w:r>";
|
||||
in_run_ = false;
|
||||
|
||||
if (get_comments_context().state()==2)
|
||||
if (get_comments_context().state() == 2)
|
||||
{
|
||||
output_stream()<< L"<w:commentRangeEnd w:id=\"" << get_comments_context().current_id() << L"\"/>";
|
||||
|
||||
@ -318,7 +320,6 @@ void docx_conversion_context::finish_run()
|
||||
get_comments_context().state(0);
|
||||
finish_run();
|
||||
}
|
||||
|
||||
}
|
||||
void docx_conversion_context::start_math_formula()
|
||||
{
|
||||
@ -369,57 +370,77 @@ void docx_conversion_context::start_index_content()
|
||||
|
||||
std::wstring sInstrText;
|
||||
|
||||
switch(table_content_context_.type_table_content)
|
||||
if (table_content_context_.type_table_content == 3)
|
||||
{
|
||||
case 1: sInstrText += L" TOC \\f \\h \\u"; break;
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7: sInstrText += L" TOC \\h \\z"; break;
|
||||
case 5: sInstrText += L" INDEX \\z"; break;
|
||||
case 3: sInstrText += L" BIBLIOGRAPHY"; break;
|
||||
sInstrText = L" BIBLIOGRAPHY ";
|
||||
}
|
||||
if (table_content_context_.min_outline_level > 0)
|
||||
else if (table_content_context_.type_table_content == 5)
|
||||
{
|
||||
if (table_content_context_.max_outline_level > 9)
|
||||
table_content_context_.max_outline_level = 9;
|
||||
|
||||
sInstrText += L" \\o \"" + std::to_wstring(table_content_context_.min_outline_level) + L"-" +
|
||||
std::to_wstring(table_content_context_.max_outline_level) + L"\"";
|
||||
sInstrText = L" INDEX";
|
||||
if (table_content_context_.bSeparators)
|
||||
sInstrText += L" \\h \"A\"";
|
||||
}
|
||||
if (false == table_content_context_.outline_level_styles.empty())
|
||||
else
|
||||
{
|
||||
sInstrText += L"\\t \"";
|
||||
sInstrText += L" TOC";
|
||||
|
||||
bool bLink = false, bPages = false;
|
||||
|
||||
for (std::map<int, std::wstring>::iterator it = table_content_context_.outline_level_styles.begin();
|
||||
it != table_content_context_.outline_level_styles.end(); ++it)
|
||||
if (table_content_context_.current_template.empty())
|
||||
{
|
||||
sInstrText += it->second + L";" + std::to_wstring(it->first) + L";";
|
||||
bLink = true;
|
||||
bPages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < table_content_context_.current_template.size(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < table_content_context_.current_template[i].content.size(); j++)
|
||||
{
|
||||
if (table_content_context_.current_template[i].content[j] == 3) bLink = true;
|
||||
if (table_content_context_.current_template[i].content[j] == 6) bPages = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sInstrText += L"\"";
|
||||
}
|
||||
if (bLink)
|
||||
sInstrText += L" \\h";
|
||||
|
||||
if (!table_content_context_.caption_sequence_name.empty())
|
||||
{
|
||||
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\"";
|
||||
}
|
||||
if (table_content_context_.type_table_content == 1)
|
||||
sInstrText += L" \\f \\u";
|
||||
else
|
||||
sInstrText += L" \\z";
|
||||
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"begin\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:instrText xml:space=\"preserve\">" << sInstrText << L" </w:instrText>";
|
||||
output_stream() << L"</w:r>";
|
||||
output_stream() << L"<w:r>";
|
||||
//output_stream() << L"<w:rPr>
|
||||
//output_stream() << L"<w:rFonts w:ascii="Minion Pro" w:eastAsia="DejaVuSans" w:hAnsi="Minion Pro"/>
|
||||
//output_stream() << L"<w:bCs w:val="0"/>
|
||||
//output_stream() << L"<w:sz w:val="21"/>
|
||||
//output_stream() << L"<w:szCs w:val="24"/>
|
||||
//output_stream() << L"</w:rPr>
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"separate\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
if (table_content_context_.min_outline_level > 0)
|
||||
{
|
||||
if (table_content_context_.max_outline_level > 9)
|
||||
table_content_context_.max_outline_level = 9;
|
||||
|
||||
sInstrText += L" \\o \"" + std::to_wstring(table_content_context_.min_outline_level) + L"-" +
|
||||
std::to_wstring(table_content_context_.max_outline_level) + L"\"";
|
||||
if (!bPages)
|
||||
sInstrText += L" \\n "+ std::to_wstring(table_content_context_.min_outline_level) + L"-" +
|
||||
std::to_wstring(table_content_context_.max_outline_level);
|
||||
}
|
||||
if (false == table_content_context_.outline_level_styles.empty())
|
||||
{
|
||||
sInstrText += L" \\t \"";
|
||||
|
||||
for (std::map<int, std::wstring>::iterator it = table_content_context_.outline_level_styles.begin();
|
||||
it != table_content_context_.outline_level_styles.end(); ++it)
|
||||
{
|
||||
sInstrText += it->second + L";" + std::to_wstring(it->first) + L";";
|
||||
}
|
||||
|
||||
sInstrText += L"\"";
|
||||
}
|
||||
|
||||
if (!table_content_context_.caption_sequence_name.empty())
|
||||
{
|
||||
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\"";
|
||||
}
|
||||
}
|
||||
start_field(sInstrText, L"");
|
||||
|
||||
finish_paragraph();
|
||||
}
|
||||
@ -428,15 +449,38 @@ void docx_conversion_context::end_index_content()
|
||||
if (!in_table_content_) return;
|
||||
|
||||
start_paragraph(false);
|
||||
end_field();
|
||||
|
||||
finish_paragraph();
|
||||
}
|
||||
void docx_conversion_context::start_field(const std::wstring & sInstrText, const std::wstring & sName)
|
||||
{
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"begin\">";
|
||||
|
||||
if (!sName.empty())
|
||||
{
|
||||
output_stream() << L"<w:ffData><w:name w:val=\"" << sName << L"\"/><w:enabled/><w:calcOnExit w:val=\"0\"/></w:ffData>";
|
||||
}
|
||||
output_stream() << L"</w:fldChar>";
|
||||
output_stream() << L"</w:r>";
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:instrText xml:space=\"preserve\">" << sInstrText << L" </w:instrText>";
|
||||
output_stream() << L"</w:r>";
|
||||
output_stream() << L"<w:r>";
|
||||
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"separate\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
}
|
||||
void docx_conversion_context::end_field()
|
||||
{
|
||||
output_stream() << L"<w:r>";
|
||||
//output_stream() << L"<w:rPr>";
|
||||
//output_stream() << L"<w:rFonts w:ascii="Minion Pro" w:hAnsi="Minion Pro"/>";
|
||||
//output_stream() << L"<w:sz w:val="20"/>
|
||||
//output_stream() << L"</w:rPr>";
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"end\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
|
||||
finish_paragraph();
|
||||
output_stream() << L"</w:r>";
|
||||
}
|
||||
void docx_conversion_context::end_sdt()
|
||||
{
|
||||
@ -477,7 +521,7 @@ void docx_conversion_context::start_bookmark (const std::wstring &name)
|
||||
}
|
||||
|
||||
finish_run();
|
||||
output_stream() << L"<w:bookmarkStart w:id=\"" << std::to_wstring(id) << L"\" w:name=\"" << name << L"\"/>";
|
||||
output_stream() << L"<w:bookmarkStart w:id=\"" << std::to_wstring(id) << L"\" w:name=\"" << XmlUtils::EncodeXmlString(name) << L"\"/>";
|
||||
}
|
||||
|
||||
void docx_conversion_context::end_bookmark (const std::wstring &name)
|
||||
@ -578,7 +622,8 @@ oox_chart_context & docx_conversion_context::current_chart()
|
||||
void docx_conversion_context::add_new_run(std::wstring parentStyleId)
|
||||
{
|
||||
finish_run();
|
||||
if (get_comments_context().state()==1)
|
||||
if (get_comments_context().state() == 1 ||
|
||||
get_comments_context().state() == 4)//??? comment in run
|
||||
{
|
||||
output_stream() << L"<w:commentRangeStart w:id=\"" << get_comments_context().current_id() << L"\" />";
|
||||
get_comments_context().state(2);//active
|
||||
@ -878,21 +923,23 @@ xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\"
|
||||
mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
std::vector<int> numIds;
|
||||
BOOST_FOREACH(odf_reader::list_style_instance_ptr & inst, list_styles.instances())
|
||||
{
|
||||
odf_reader::office_element_ptr_array & content = inst->get_text_list_style()->get_content();
|
||||
|
||||
odf_reader::list_style_container::instances_array & arListStyles = list_styles.instances();
|
||||
for (size_t i = 0; i < arListStyles.size(); i++)
|
||||
{
|
||||
odf_reader::office_element_ptr_array & content = arListStyles[i]->get_text_list_style()->get_content();
|
||||
|
||||
if (content.size() < 1)
|
||||
continue;
|
||||
|
||||
const int abstractNumId = list_styles.id_by_name(inst->get_style_name());
|
||||
const int abstractNumId = list_styles.id_by_name(arListStyles[i]->get_style_name());
|
||||
|
||||
strm << L"<w:abstractNum w:abstractNumId=\"" << abstractNumId << "\">";
|
||||
numIds.push_back(abstractNumId);
|
||||
|
||||
for (size_t i = 0; i < (std::min)( content.size(), (size_t)9); i++)
|
||||
{
|
||||
start_text_list_style(inst->get_text_list_style()->get_style_name());
|
||||
start_text_list_style(arListStyles[i]->get_text_list_style()->get_style_name());
|
||||
content[i]->docx_convert(*this);
|
||||
// TODO
|
||||
end_text_list_style();
|
||||
@ -924,21 +971,25 @@ void docx_conversion_context::process_fonts()
|
||||
odf_reader::odf_read_context & context = doc->odf_context();
|
||||
odf_reader::fonts_container & fonts = context.fontContainer();
|
||||
|
||||
BOOST_FOREACH(odf_reader::font_instance_ptr & inst, fonts.instances())
|
||||
odf_reader::fonts_container::instances_array &arFonts = fonts.instances();
|
||||
for (size_t i = 0; i < arFonts.size(); i++)
|
||||
{
|
||||
strm << L"<w:font w:name=\"" << inst->name() << L"\" >";
|
||||
if (!arFonts[i]) continue;
|
||||
if (arFonts[i]->name().empty()) continue;
|
||||
|
||||
if (!inst->charset().empty())
|
||||
strm << L"<w:charset w:val=\"" << inst->charset() <<"\" />";
|
||||
strm << L"<w:font w:name=\"" << arFonts[i]->name() << L"\" >";
|
||||
|
||||
if (!inst->family().empty())
|
||||
strm << L"<w:family w:val=\"" << inst->family() << "\" />";
|
||||
if (!arFonts[i]->charset().empty())
|
||||
strm << L"<w:charset w:val=\"" << arFonts[i]->charset() <<"\" />";
|
||||
|
||||
if (!inst->pitch().empty())
|
||||
strm << L"<w:pitch w:val=\"" << inst->pitch() << "\" />";
|
||||
if (!arFonts[i]->family().empty())
|
||||
strm << L"<w:family w:val=\"" << arFonts[i]->family() << "\" />";
|
||||
|
||||
if (!inst->alt_name().empty())
|
||||
strm << L"<w:altName w:val=\"" << inst->alt_name() << "\" />";
|
||||
if (!arFonts[i]->pitch().empty())
|
||||
strm << L"<w:pitch w:val=\"" << arFonts[i]->pitch() << "\" />";
|
||||
|
||||
if (!arFonts[i]->alt_name().empty())
|
||||
strm << L"<w:altName w:val=\"" << arFonts[i]->alt_name() << "\" />";
|
||||
|
||||
strm << L"</w:font>";
|
||||
}
|
||||
@ -969,9 +1020,11 @@ void docx_conversion_context::process_styles()
|
||||
odf_reader::styles_container & styles = context.styleContainer();
|
||||
|
||||
// add all styles to the map
|
||||
BOOST_FOREACH(odf_reader::style_instance_ptr & inst, styles.instances())
|
||||
odf_reader::styles_container::instances_array &arStyles = styles.instances();
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
{
|
||||
styles_map_.get(inst->name(), inst->type());
|
||||
if (!arStyles[i]) continue;
|
||||
styles_map_.get(arStyles[i]->name(), arStyles[i]->type());
|
||||
}
|
||||
|
||||
_Wostream << L"<w:docDefaults>";
|
||||
@ -990,51 +1043,51 @@ void docx_conversion_context::process_styles()
|
||||
|
||||
_Wostream << L"</w:docDefaults>";
|
||||
|
||||
BOOST_FOREACH(odf_reader::style_instance_ptr & inst, styles.instances())
|
||||
{
|
||||
if (!inst->is_automatic() &&
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
{
|
||||
if (!arStyles[i]->is_automatic() &&
|
||||
(
|
||||
inst->type() == odf_types::style_family::Paragraph ||
|
||||
inst->type() == odf_types::style_family::Text
|
||||
arStyles[i]->type() == odf_types::style_family::Paragraph ||
|
||||
arStyles[i]->type() == odf_types::style_family::Text
|
||||
))
|
||||
{
|
||||
const std::wstring id = styles_map_.get(inst->name(), inst->type());
|
||||
_Wostream << L"<w:style w:styleId=\"" << id << L"\" w:type=\"" << StyleTypeOdf2Docx(inst->type()) << L"\"";
|
||||
if (!inst->is_default())
|
||||
const std::wstring id = styles_map_.get(arStyles[i]->name(), arStyles[i]->type());
|
||||
_Wostream << L"<w:style w:styleId=\"" << id << L"\" w:type=\"" << StyleTypeOdf2Docx(arStyles[i]->type()) << L"\"";
|
||||
if (!arStyles[i]->is_default())
|
||||
{
|
||||
_Wostream << L" w:customStyle=\"1\"";
|
||||
}
|
||||
_Wostream << L">";
|
||||
|
||||
const std::wstring displayName = StyleDisplayName(inst->name(), inst->type());
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->type());
|
||||
|
||||
_Wostream << L"<w:name w:val=\"" << displayName << L"\" />";
|
||||
|
||||
if (odf_reader::style_instance * baseOn = inst->parent())
|
||||
if (odf_reader::style_instance * baseOn = arStyles[i]->parent())
|
||||
{
|
||||
const std::wstring basedOnId = styles_map_.get(baseOn->name(), baseOn->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\" />";
|
||||
}
|
||||
else if (!inst->is_default() && styles_map_.check(L"", inst->type()))
|
||||
else if (!arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
|
||||
{
|
||||
const std::wstring basedOnId = styles_map_.get(L"", inst->type());
|
||||
const std::wstring basedOnId = styles_map_.get(L"", arStyles[i]->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\" />";
|
||||
}
|
||||
|
||||
if (odf_reader::style_instance * next = inst->next())
|
||||
if (odf_reader::style_instance * next = arStyles[i]->next())
|
||||
{
|
||||
const std::wstring nextId = styles_map_.get(next->name(), next->type());
|
||||
_Wostream << L"<w:next w:val=\"" << nextId << "\" />";
|
||||
}
|
||||
else if (inst->is_default())
|
||||
else if (arStyles[i]->is_default())
|
||||
{
|
||||
// self
|
||||
_Wostream << L"<w:next w:val=\"" << id << "\" />";
|
||||
}
|
||||
|
||||
if (odf_reader::style_content * content = inst->content())
|
||||
if (odf_reader::style_content * content = arStyles[i]->content())
|
||||
{
|
||||
get_styles_context().start_process_style(inst.get());
|
||||
get_styles_context().start_process_style(arStyles[i].get());
|
||||
content->docx_convert(*this, true);
|
||||
get_styles_context().end_process_style();
|
||||
}
|
||||
@ -1295,10 +1348,11 @@ void docx_conversion_context::pop_text_properties()
|
||||
odf_reader::style_text_properties_ptr docx_conversion_context::current_text_properties()
|
||||
{
|
||||
odf_reader::style_text_properties_ptr cur = boost::make_shared<odf_reader::style_text_properties>();
|
||||
BOOST_FOREACH(const odf_reader::style_text_properties * prop, text_properties_stack_)
|
||||
|
||||
for (size_t i = 0; i < text_properties_stack_.size(); i++)
|
||||
{
|
||||
if (prop)
|
||||
cur->content().apply_from( prop->content() );
|
||||
if (text_properties_stack_[i])
|
||||
cur->content().apply_from( text_properties_stack_[i]->content() );
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
@ -1715,10 +1769,7 @@ namespace
|
||||
{
|
||||
// обработка Header/Footer
|
||||
// конвертируем содержимое header/footer и сохраняем результат в виде строки
|
||||
void process_one_header_footer(docx_conversion_context & Context,
|
||||
const std::wstring & styleName,
|
||||
odf_reader::office_element * elm,
|
||||
headers_footers::Type type)
|
||||
void process_one_header_footer(docx_conversion_context & Context, const std::wstring & styleName, odf_reader::office_element *elm, headers_footers::Type type)
|
||||
{
|
||||
if (!elm) return;
|
||||
|
||||
@ -1736,13 +1787,7 @@ namespace
|
||||
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
|
||||
|
||||
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);
|
||||
|
||||
if (type == headers_footers::headerLeft || type == headers_footers::footerLeft)
|
||||
{
|
||||
Context.set_settings_property(odf_reader::_property(L"evenAndOddHeaders",true));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void docx_conversion_context::set_settings_property(const odf_reader::_property & prop)
|
||||
{
|
||||
@ -1764,21 +1809,39 @@ void docx_conversion_context::process_headers_footers()
|
||||
odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer();
|
||||
|
||||
// проходим по всем page layout
|
||||
BOOST_FOREACH(const odf_reader::style_master_page* page, pageLayouts.master_pages())
|
||||
{
|
||||
const std::wstring & styleName = page->attlist_.style_name_.get_value_or( L"" );
|
||||
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
|
||||
add_page_properties(masterPageNameLayout);
|
||||
|
||||
process_one_header_footer(*this, styleName, page->style_header_.get(), headers_footers::header);
|
||||
process_one_header_footer(*this, styleName, page->style_footer_.get(), headers_footers::footer );
|
||||
process_one_header_footer(*this, styleName, page->style_header_first_.get(), headers_footers::headerFirst);
|
||||
process_one_header_footer(*this, styleName, page->style_footer_first_.get(), headers_footers::footerFirst );
|
||||
process_one_header_footer(*this, styleName, page->style_header_left_.get(), headers_footers::headerLeft );
|
||||
process_one_header_footer(*this, styleName, page->style_footer_left_.get(), headers_footers::footerLeft );
|
||||
std::vector<odf_reader::style_master_page*> & master_pages = pageLayouts.master_pages();
|
||||
|
||||
if (!page->style_header_ && !page->style_footer_ && !page->style_header_first_ && !page->style_footer_first_
|
||||
&& !page->style_header_left_ && !page->style_footer_left_)
|
||||
bool bOddEvenPages = false;
|
||||
for (size_t i = 0; i < master_pages.size(); i++)
|
||||
{
|
||||
if (master_pages[i]->style_header_left_ || master_pages[i]->style_footer_left_)
|
||||
bOddEvenPages = true;
|
||||
}
|
||||
if (bOddEvenPages)
|
||||
{
|
||||
set_settings_property(odf_reader::_property(L"evenAndOddHeaders", true));
|
||||
}
|
||||
for (size_t i = 0; i < master_pages.size(); i++)
|
||||
{
|
||||
const std::wstring & styleName = master_pages[i]->attlist_.style_name_.get_value_or( L"" );
|
||||
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
|
||||
|
||||
add_page_properties(masterPageNameLayout);
|
||||
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_header_.get(), headers_footers::header);
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_footer_.get(), headers_footers::footer );
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_header_first_.get(), headers_footers::headerFirst);
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_footer_first_.get(), headers_footers::footerFirst );
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_header_left_.get(), headers_footers::headerLeft );
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_footer_left_.get(), headers_footers::footerLeft );
|
||||
|
||||
if (bOddEvenPages && !master_pages[i]->style_header_left_)
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_header_.get(), headers_footers::headerLeft);
|
||||
if (bOddEvenPages && !master_pages[i]->style_footer_left_)
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_footer_.get(), headers_footers::footerLeft );
|
||||
|
||||
if (!master_pages[i]->style_header_ && !master_pages[i]->style_footer_ && !master_pages[i]->style_header_first_ && !master_pages[i]->style_footer_first_
|
||||
&& !master_pages[i]->style_header_left_ && !master_pages[i]->style_footer_left_)
|
||||
{
|
||||
//отключенные колонтитулы
|
||||
rels rels_;
|
||||
@ -2041,5 +2104,13 @@ std::wstring docx_conversion_context::get_user_field(const std::wstring & name)
|
||||
return pFind != map_user_fields.end() ? pFind->second : L"";
|
||||
}
|
||||
|
||||
void docx_conversion_context::add_jsaProject(const std::string &content)
|
||||
{
|
||||
if (content.empty()) return;
|
||||
|
||||
output_document_->get_word_files().add_jsaProject(content);
|
||||
output_document_->get_content_types_file().add_or_find_default(L"bin");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,14 +486,14 @@ public:
|
||||
std::wstring author;
|
||||
std::wstring initials;
|
||||
};
|
||||
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date)
|
||||
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date, bool inRun = false)
|
||||
{
|
||||
int id = comments_.size()+1;
|
||||
_comment_desc new_comment={content,id,date,author};
|
||||
int id = comments_.size() + 1;
|
||||
_comment_desc new_comment={content, id, date, author};
|
||||
|
||||
comments_.push_back(new_comment);
|
||||
|
||||
state_ = 1;
|
||||
state_ = inRun ? 4 : 1;
|
||||
}
|
||||
int current_id()
|
||||
{
|
||||
@ -683,17 +683,20 @@ public:
|
||||
}
|
||||
void end_level()
|
||||
{
|
||||
current_template.insert(std::make_pair(current_state.name, current_state));
|
||||
current_template.push_back(current_state);
|
||||
|
||||
map_current_template.insert(std::make_pair(current_state.name, current_state));
|
||||
current_state.clear();
|
||||
}
|
||||
void set_current_level(const std::wstring &name)
|
||||
{
|
||||
std::map<std::wstring, _state>::iterator pFind = current_template.find(name);
|
||||
if (pFind == current_template.end())
|
||||
std::map<std::wstring, _state>::iterator pFind = map_current_template.find(name);
|
||||
if (pFind == map_current_template.end())
|
||||
{
|
||||
current_content_template_.clear();
|
||||
}
|
||||
current_content_template_ = pFind->second.content;
|
||||
else
|
||||
current_content_template_ = pFind->second.content;
|
||||
current_content_template_index_ = 0;
|
||||
}
|
||||
|
||||
@ -725,11 +728,13 @@ public:
|
||||
current_content_template_index_ = 0;
|
||||
current_content_template_.clear();
|
||||
current_template.clear();
|
||||
map_current_template.clear();
|
||||
current_state.clear();
|
||||
caption_sequence_name.clear();
|
||||
min_outline_level = -1;
|
||||
max_outline_level = -1;
|
||||
outline_level_styles.clear();
|
||||
bSeparators = false;
|
||||
}
|
||||
void add_sequence(const std::wstring & name, int outline_level)
|
||||
{
|
||||
@ -754,12 +759,14 @@ public:
|
||||
int min_outline_level;
|
||||
int max_outline_level;
|
||||
std::map<int, std::wstring> outline_level_styles;
|
||||
bool bSeparators;
|
||||
std::vector<_state> current_template;
|
||||
|
||||
private:
|
||||
std::vector<int> current_content_template_;
|
||||
int current_content_template_index_;
|
||||
|
||||
std::map<std::wstring, _state> current_template;
|
||||
std::map<std::wstring, _state> map_current_template;
|
||||
_state current_state;
|
||||
//std::map<std::wstring, int> sequences;
|
||||
std::vector<std::wstring> sequences;
|
||||
@ -835,8 +842,8 @@ public:
|
||||
void start_body ();
|
||||
void end_body ();
|
||||
|
||||
void start_office_text ();
|
||||
void end_office_text ();
|
||||
void start_office_text ();
|
||||
void end_office_text ();
|
||||
|
||||
void start_sdt (int type);
|
||||
void end_sdt ();
|
||||
@ -847,6 +854,9 @@ public:
|
||||
void start_index_element();
|
||||
void end_index_element();
|
||||
|
||||
void start_field(const std::wstring & sInstrText, const std::wstring & sName);
|
||||
void end_field();
|
||||
|
||||
void process_styles ();
|
||||
void process_fonts ();
|
||||
|
||||
@ -970,14 +980,15 @@ public:
|
||||
|
||||
drop_cap_context & get_drop_cap_context(){return drop_cap_context_;}
|
||||
|
||||
styles_map styles_map_;
|
||||
bool process_headers_footers_;
|
||||
bool delayed_converting_;
|
||||
bool convert_delayed_enabled_;
|
||||
styles_map styles_map_;
|
||||
bool process_headers_footers_;
|
||||
bool delayed_converting_;
|
||||
bool convert_delayed_enabled_;
|
||||
|
||||
void start_changes();
|
||||
void end_changes();
|
||||
void start_changes();
|
||||
void end_changes();
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
private:
|
||||
std::wstringstream document_xml_;
|
||||
std::wstringstream styles_xml_;
|
||||
|
||||
@ -124,6 +124,12 @@ void word_files::write(const std::wstring & RootPath)
|
||||
charts_files_.set_main_document(get_main_document());
|
||||
charts_files_.write(path);
|
||||
}
|
||||
|
||||
if (jsaProject_)
|
||||
{
|
||||
rels_files_.add( relationship(L"jsaId", L"http://schemas.onlyoffice.com/jsaProject", L"jsaProject.bin" ) );
|
||||
jsaProject_->write( path );
|
||||
}
|
||||
|
||||
if (notes_)
|
||||
{
|
||||
@ -185,7 +191,10 @@ bool word_files::has_numbering()
|
||||
{
|
||||
return numbering_ ? true : false;
|
||||
}
|
||||
|
||||
void word_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
void word_files::set_headers_footers(headers_footers & HeadersFooters)
|
||||
{
|
||||
headers_footers_elements * elm = new headers_footers_elements(HeadersFooters);
|
||||
|
||||
@ -145,6 +145,7 @@ public:
|
||||
void set_comments (comments_context & commentsContext);
|
||||
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_jsaProject(const std::string &content);
|
||||
|
||||
void add_rels(relationship const & r);
|
||||
|
||||
@ -163,6 +164,7 @@ private:
|
||||
element_ptr notes_;
|
||||
element_ptr settings_;
|
||||
element_ptr comments_;
|
||||
element_ptr jsaProject_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -94,8 +94,16 @@ std::wstring docx_table_state::current_row_style() const
|
||||
|
||||
double docx_table_state::get_current_cell_width()
|
||||
{
|
||||
if (current_table_column_ < columns_width_.size())
|
||||
return columns_width_[current_table_column_];
|
||||
if (current_table_column_ + columns_spanned_num_ < columns_width_.size())
|
||||
{
|
||||
//return columns_width_[current_table_column_];
|
||||
double res = 0;
|
||||
for (int i = 0; i < columns_spanned_num_ + 1; i++)
|
||||
{
|
||||
res += columns_width_[current_table_column_ + i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "headers_footers.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -88,12 +87,12 @@ std::wstring get_rel_type(headers_footers::Type _Type)
|
||||
|
||||
void headers_footers::dump_rels(rels & Rels) const//внешние релсы
|
||||
{
|
||||
BOOST_FOREACH(const instances_map::value_type & instAr, instances_)
|
||||
for (boost::unordered_map<std::wstring, instances_array>::const_iterator it = instances_.begin(); it != instances_.end(); ++it)
|
||||
{
|
||||
BOOST_FOREACH(const instance_ptr & inst, instAr.second)
|
||||
for (size_t i = 0; i < it->second.size(); i++)
|
||||
{
|
||||
if (inst->type_ == none) continue;
|
||||
Rels.add( relationship( inst->id_, get_rel_type(inst->type_), inst->name_, L"" ) );
|
||||
if (it->second[i]->type_ == none) continue;
|
||||
Rels.add( relationship( it->second[i]->id_, get_rel_type(it->second[i]->type_), it->second[i]->name_, L"" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,9 +106,13 @@ bool headers_footers::write_sectPr(const std::wstring & StyleName, bool next_pag
|
||||
|
||||
bool first = false, left = false;
|
||||
bool res = false;
|
||||
|
||||
instances_array & pFind = instances_.at(StyleName);
|
||||
|
||||
BOOST_FOREACH(const instance_ptr & inst, instances_.at(StyleName))
|
||||
for (size_t i = 0; i < pFind.size(); i++)
|
||||
{
|
||||
instance_ptr & inst = pFind[i];
|
||||
|
||||
std::wstring type = L"default";
|
||||
|
||||
if ( inst->type_ == headerFirst || inst->type_ == footerFirst )
|
||||
|
||||
@ -317,8 +317,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
if ((iWrap) && (*iWrap == 0)) CP_XML_ATTR(L"wrap", L"none");
|
||||
}
|
||||
|
||||
_CP_OPT(int) iAlign;
|
||||
odf_reader::GetProperty(prop,L"textarea-vertical_align",iAlign);
|
||||
_CP_OPT(int) iAlign, iVert;
|
||||
odf_reader::GetProperty(prop, L"textarea-vertical_align", iAlign);
|
||||
if (iAlign)
|
||||
{
|
||||
switch (iAlign.get())
|
||||
@ -336,6 +336,16 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
CP_XML_ATTR(L"anchor", L"just");break;
|
||||
}
|
||||
}
|
||||
odf_reader::GetProperty(prop, L"text_vert", iVert);
|
||||
if (iVert)
|
||||
{
|
||||
switch (iVert.get())
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"vert", L"vert"); break;
|
||||
case 2: CP_XML_ATTR(L"vert", L"vert270"); break;
|
||||
|
||||
}
|
||||
}
|
||||
_CP_OPT(bool) bAutoGrowHeight;
|
||||
_CP_OPT(bool) bFitToSize;
|
||||
odf_reader::GetProperty(prop,L"fit-to-size", bFitToSize);
|
||||
@ -357,7 +367,7 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
if (bWordArt)
|
||||
{
|
||||
_CP_OPT(int) iVal;
|
||||
odf_reader::GetProperty(prop, L"odf-custom-draw-index",iVal);
|
||||
odf_reader::GetProperty(prop, L"oox-geom-index", iVal);
|
||||
if (iVal)
|
||||
{
|
||||
std::wstring shapeType = _OO_OOX_wordart[*iVal].oox;
|
||||
|
||||
@ -193,20 +193,25 @@ void content_types_file::set_media(mediaitems & _Mediaitems)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
simple_element::simple_element(const std::wstring & FileName, const std::wstring & Content) : file_name_(FileName)
|
||||
simple_element::simple_element(const std::wstring & FileName, const std::wstring & Content) : file_name_(FileName), bXml(true)
|
||||
{
|
||||
utf8::utf16to8(Content.begin(), Content.end(), std::back_inserter(content_utf8_));
|
||||
}
|
||||
|
||||
simple_element::simple_element(const std::wstring & FileName, const std::string & Content) : file_name_(FileName), content_utf8_(Content), bXml(false)
|
||||
{
|
||||
}
|
||||
void simple_element::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring name_ = RootPath + FILE_SEPARATOR_STR + file_name_;
|
||||
std::wstring name_ = RootPath + FILE_SEPARATOR_STR + file_name_;
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
if ( file.CreateFileW(name_) == true)
|
||||
{
|
||||
std::string root = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
||||
file.WriteFile((BYTE*)root.c_str(), root.length());
|
||||
if (bXml)
|
||||
{
|
||||
std::string root = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
||||
file.WriteFile((BYTE*)root.c_str(), root.length());
|
||||
}
|
||||
file.WriteFile((BYTE*)content_utf8_.c_str(), content_utf8_.length());
|
||||
file.CloseFile();
|
||||
}
|
||||
@ -277,7 +282,10 @@ element_ptr simple_element::create(const std::wstring & FileName, const std::wst
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
}
|
||||
|
||||
element_ptr simple_element::create(const std::wstring & FileName, const std::string & Content)
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
|
||||
void core_file::write(const std::wstring & RootPath)
|
||||
|
||||
@ -99,13 +99,17 @@ public:
|
||||
simple_element(const std::wstring & FileName, const std::wstring & Content);
|
||||
static element_ptr create(const std::wstring & FileName, const std::wstring & Content);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
simple_element(const std::wstring & FileName, const std::string & Content);
|
||||
static element_ptr create(const std::wstring & FileName, const std::string & Content);
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
std::wstring file_name_;
|
||||
std::string content_utf8_;
|
||||
|
||||
bool bXml;
|
||||
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
@ -694,12 +694,17 @@ void pptx_conversion_context::start_chart(std::wstring name)
|
||||
//этот контекст нужно передавать в файл
|
||||
|
||||
}
|
||||
|
||||
void pptx_conversion_context::end_chart()
|
||||
{
|
||||
//current_chart().set_drawing_link(current_sheet().get_drawing_link());
|
||||
//излишняя инфа
|
||||
}
|
||||
|
||||
void pptx_conversion_context::add_jsaProject(const std::string &content)
|
||||
{
|
||||
if (content.empty()) return;
|
||||
|
||||
output_document_->get_ppt_files().add_jsaProject(content);
|
||||
output_document_->get_content_types_file().add_or_find_default(L"bin");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +106,8 @@ public:
|
||||
void start_theme(std::wstring & name);
|
||||
void end_theme();
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
|
||||
std::pair<int,int> add_author_comments(std::wstring author);
|
||||
|
||||
pptx_slide_context & get_slide_context() { return pptx_slide_context_; }
|
||||
|
||||
@ -455,13 +455,18 @@ void ppt_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
{
|
||||
comments_->set_main_document(get_main_document());
|
||||
comments_->write(path);
|
||||
comments_->write( path );
|
||||
}
|
||||
if (authors_comments_)
|
||||
{
|
||||
rels_files_.add( relationship( L"auId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors", L"commentAuthors.xml" ) );
|
||||
authors_comments_->write(path);
|
||||
authors_comments_->write( path );
|
||||
}
|
||||
if (jsaProject_)
|
||||
{
|
||||
rels_files_.add( relationship(L"jsaId", L"http://schemas.onlyoffice.com/jsaProject", L"jsaProject.bin" ) );
|
||||
jsaProject_->write( path );
|
||||
}
|
||||
rels_files_.write(path);
|
||||
}
|
||||
|
||||
@ -532,6 +537,10 @@ void ppt_files::add_theme(pptx_xml_theme_ptr theme)
|
||||
{
|
||||
themes_files_.add_theme(theme);
|
||||
}
|
||||
void ppt_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +222,8 @@ public:
|
||||
void add_theme (pptx_xml_theme_ptr theme);
|
||||
|
||||
void set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments);
|
||||
|
||||
|
||||
void add_jsaProject (const std::string &content);
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
|
||||
@ -242,6 +243,7 @@ private:
|
||||
element_ptr comments_;
|
||||
element_ptr media_;
|
||||
element_ptr embeddings_;
|
||||
element_ptr jsaProject_;
|
||||
};
|
||||
|
||||
// xlsx_document
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "xlsx_borders.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include <xml/simple_xml_writer.h>
|
||||
@ -203,9 +202,9 @@ public:
|
||||
{
|
||||
std::vector<xlsx_border> inst_array;
|
||||
|
||||
BOOST_FOREACH(const xlsx_border & inst, borders_)
|
||||
for (boost::unordered_set<xlsx_border, boost::hash<xlsx_border>>::iterator it = borders_.begin(); it != borders_.end(); ++it)
|
||||
{
|
||||
inst_array.push_back(inst);
|
||||
inst_array.push_back(*it);
|
||||
}
|
||||
|
||||
std::sort(inst_array.begin(), inst_array.end(), compare_());
|
||||
@ -215,9 +214,10 @@ public:
|
||||
CP_XML_NODE(L"borders")
|
||||
{
|
||||
CP_XML_ATTR(L"count", inst_array.size());
|
||||
BOOST_FOREACH( xlsx_border & border, inst_array)
|
||||
|
||||
for (size_t i = 0; i < inst_array.size(); i++)
|
||||
{
|
||||
cpdoccore::oox::xlsx_serialize(CP_XML_STREAM(), border);
|
||||
cpdoccore::oox::xlsx_serialize(CP_XML_STREAM(), inst_array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,9 @@ namespace oox {
|
||||
case 3: CP_XML_ATTR(L"type", L"min"); break;
|
||||
case 4: CP_XML_ATTR(L"type", L"max"); break; //todooo ext - autoMax
|
||||
case 5: CP_XML_ATTR(L"type", L"min"); break;
|
||||
case 6: CP_XML_ATTR(L"type", L"formula"); break;
|
||||
case 6: CP_XML_ATTR(L"type", L"formula"); break;
|
||||
case 7: CP_XML_ATTR(L"type", L"percentile");break;//BOA PARA ESTUDAR - JOGAR LOTOFACIL minha predileta 1.ods
|
||||
|
||||
}
|
||||
if (val)
|
||||
{
|
||||
|
||||
@ -45,21 +45,20 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class xlsx_dataValidation
|
||||
struct xlsx_dataValidation
|
||||
{
|
||||
public:
|
||||
xlsx_dataValidation() : showErrorMessage(false), showInputMessage(false), showDropDown(false), allowBlank(false) {}
|
||||
|
||||
std::wstring ref;
|
||||
std::wstring activate_ref;
|
||||
//std::wstring activate_ref;
|
||||
std::map<int, std::vector<int>> mapCells;
|
||||
|
||||
std::wstring type;
|
||||
std::wstring formula1;
|
||||
std::wstring formula2;
|
||||
std::wstring operator_;
|
||||
bool showErrorMessage;
|
||||
bool showInputMessage;
|
||||
bool showDropDown;
|
||||
bool allowBlank;
|
||||
bool showErrorMessage = false;
|
||||
bool showInputMessage = false;
|
||||
bool showDropDown = false;
|
||||
bool allowBlank = false;
|
||||
};
|
||||
typedef shared_ptr<xlsx_dataValidation>::Type xlsx_dataValidation_ptr;
|
||||
|
||||
@ -80,9 +79,61 @@ public:
|
||||
for (std::map<std::wstring, xlsx_dataValidation_ptr>::iterator it = mapActivateDataValidations.begin();
|
||||
it != mapActivateDataValidations.end(); ++it)
|
||||
{
|
||||
//prepare
|
||||
std::map<int, std::vector<std::pair<int, int>>> mapCells;
|
||||
for (std::map<int, std::vector<int>>::iterator jt = it->second->mapCells.begin(); jt != it->second->mapCells.end(); ++jt)
|
||||
{
|
||||
std::sort(jt->second.begin(), jt->second.end());
|
||||
std::vector<std::pair<int, int>> arr;
|
||||
MakePairVector(jt->second, arr);
|
||||
|
||||
mapCells.insert(std::make_pair(jt->first, arr));
|
||||
}
|
||||
std::wstring activate_ref;
|
||||
|
||||
std::map<int, std::vector<std::pair<int, int>>>::iterator jt1 = mapCells.begin();
|
||||
while ( jt1 != mapCells.end() )
|
||||
{
|
||||
for (size_t i = 0; i < jt1->second.size(); i++)
|
||||
{
|
||||
std::map<int, std::vector<std::pair<int, int>>>::iterator jt2 = jt1;
|
||||
while(jt2 != mapCells.end())
|
||||
{
|
||||
std::map<int, std::vector<std::pair<int, int>>>::iterator jt2_next = jt2; ++jt2_next;
|
||||
if (jt2_next == mapCells.end() || jt2->first + 1 != jt2_next->first)
|
||||
break;
|
||||
|
||||
size_t j = 0; bool bFound = false;
|
||||
for (size_t j = 0; j < jt2_next->second.size(); j++)
|
||||
{
|
||||
if (jt1->second[i].first == jt2_next->second[j].first ||
|
||||
jt1->second[i].second == jt2_next->second[j].second)
|
||||
{
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFound)
|
||||
{
|
||||
jt2_next->second.erase(jt2_next->second.begin() + j, jt2_next->second.begin() + j + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
jt2 = jt2_next;
|
||||
}
|
||||
if (!activate_ref.empty()) activate_ref += L" ";
|
||||
activate_ref += oox::getCellAddress(jt1->first, jt1->second[i].first);
|
||||
|
||||
if (jt1->first != jt2->first || jt1->second[i].first != jt1->second[i].second)
|
||||
activate_ref += L":" + oox::getCellAddress(jt2->first, jt1->second[i].second);
|
||||
}
|
||||
++jt1;
|
||||
}
|
||||
CP_XML_NODE(L"dataValidation")
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", it->second->activate_ref);
|
||||
CP_XML_ATTR(L"sqref", activate_ref);
|
||||
CP_XML_ATTR(L"allowBlank", it->second->allowBlank);
|
||||
CP_XML_ATTR(L"operator", it->second->operator_);
|
||||
CP_XML_ATTR(L"showDropDown", it->second->showDropDown);
|
||||
@ -115,6 +166,21 @@ public:
|
||||
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr> mapDataValidations; //for all tables
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr> mapActivateDataValidations; //in current table
|
||||
|
||||
private:
|
||||
void MakePairVector(std::vector<int> & arInput, std::vector<std::pair<int, int>> &arOutput)
|
||||
{
|
||||
int pos = arInput[0];
|
||||
for (size_t i = 1; i < arInput.size(); i++)
|
||||
{
|
||||
if (arInput[i-1] + 1 != arInput[i])
|
||||
{
|
||||
arOutput.push_back(std::make_pair(pos, arInput[i - 1]));
|
||||
pos = arInput[i];
|
||||
}
|
||||
}
|
||||
arOutput.push_back(std::make_pair(pos, arInput[arInput.size() - 1]));
|
||||
}
|
||||
};
|
||||
|
||||
xlsx_dataValidations_context::xlsx_dataValidations_context() :
|
||||
@ -128,24 +194,48 @@ void xlsx_dataValidations_context::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
return impl_->serialize(_Wostream);
|
||||
}
|
||||
void xlsx_dataValidations_context::activate(const std::wstring & name, const std::wstring & ref)
|
||||
void xlsx_dataValidations_context::activate(const std::wstring & name, int col, int row/*const std::wstring & ref*/)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFindActivate = impl_->mapActivateDataValidations.find(name);
|
||||
|
||||
if (pFindActivate != impl_->mapActivateDataValidations.end())
|
||||
{
|
||||
pFindActivate->second->activate_ref += L" " + ref;
|
||||
}
|
||||
else
|
||||
|
||||
if (pFindActivate == impl_->mapActivateDataValidations.end())
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
xlsx_dataValidation_ptr _new;
|
||||
if (pFind != impl_->mapDataValidations.end())
|
||||
{
|
||||
pFind->second->activate_ref = ref;
|
||||
impl_->mapActivateDataValidations.insert(std::make_pair(name, pFind->second));
|
||||
_new = pFind->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
_new = xlsx_dataValidation_ptr(new xlsx_dataValidation);
|
||||
}
|
||||
impl_->mapActivateDataValidations.insert(std::make_pair(name, _new));
|
||||
|
||||
pFindActivate = impl_->mapActivateDataValidations.find(name);
|
||||
}
|
||||
|
||||
std::map<int, std::vector<int>>::iterator pFindCol = pFindActivate->second->mapCells.find(col);
|
||||
|
||||
if (pFindCol == pFindActivate->second->mapCells.end())
|
||||
{
|
||||
std::vector<int> rows; rows.push_back(row);
|
||||
pFindActivate->second->mapCells.insert(std::make_pair(col, rows));
|
||||
}
|
||||
else
|
||||
{
|
||||
pFindCol->second.push_back(row);
|
||||
}
|
||||
}
|
||||
void xlsx_dataValidations_context::add(const std::wstring & name, const std::wstring &ref)
|
||||
{
|
||||
xlsx_dataValidation_ptr _new = xlsx_dataValidation_ptr(new xlsx_dataValidation);
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
_new->ref = converter.convert_named_ref(ref, false, L";");
|
||||
|
||||
impl_->mapDataValidations.insert(std::make_pair(name, _new));
|
||||
}
|
||||
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, bool val)
|
||||
{
|
||||
@ -164,17 +254,6 @@ void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, bool
|
||||
|
||||
pFind->second->showErrorMessage = val;
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add(const std::wstring & name, const std::wstring &ref)
|
||||
{
|
||||
xlsx_dataValidation_ptr _new = xlsx_dataValidation_ptr(new xlsx_dataValidation());
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
_new->ref = converter.convert_named_ref(ref, false, L";");
|
||||
|
||||
impl_->mapDataValidations.insert(std::make_pair(name, _new));
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add_formula(const std::wstring & name, const std::wstring & f) // todooo пооптимальней
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
@ -192,11 +271,13 @@ void xlsx_dataValidations_context::add_formula(const std::wstring & name, const
|
||||
|
||||
if ( val.substr(0, 1) == L"\"")
|
||||
{
|
||||
std::wstring keep = val;
|
||||
XmlUtils::replace_all(val, L"\"", L"");
|
||||
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
|
||||
if ( std::wstring::npos != val.find(L";") )//convert formula replacing ; on ,
|
||||
if ( (std::wstring::npos != val.find(L";")) || //convert formula replacing ; on ,
|
||||
L"\"" + pFind->second->formula1 + L"\"" == keep)
|
||||
{
|
||||
pFind->second->formula1 = L"\"" + pFind->second->formula1 + L"\"";
|
||||
}
|
||||
|
||||
@ -44,12 +44,12 @@ public:
|
||||
xlsx_dataValidations_context();
|
||||
~xlsx_dataValidations_context();
|
||||
|
||||
void add(const std::wstring & name, const std::wstring & ref);
|
||||
void add(const std::wstring & name, /*int col, int row*/const std::wstring & ref);
|
||||
void add_formula(const std::wstring & name, const std::wstring & f);
|
||||
void add_help_msg(const std::wstring & name, bool val);
|
||||
void add_error_msg(const std::wstring & name, bool val);
|
||||
|
||||
void activate(const std::wstring & name, const std::wstring & ref);
|
||||
void activate(const std::wstring & name, int col, int row/*const std::wstring & ref*/);
|
||||
|
||||
void serialize(std::wostream & _Wostream);
|
||||
private:
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
|
||||
#include <xml/simple_xml_writer.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
@ -155,10 +154,10 @@ struct compare_xlsx_fills
|
||||
void xlsx_fills::serialize(std::wostream & _Wostream) const
|
||||
{
|
||||
std::vector<xlsx_fill> inst_array;
|
||||
|
||||
BOOST_FOREACH(const xlsx_fill & inst, impl_->fills_)
|
||||
{
|
||||
inst_array.push_back(inst);
|
||||
|
||||
for (boost::unordered_set<xlsx_fill, boost::hash<xlsx_fill>>::iterator it = impl_->fills_.begin(); it != impl_->fills_.end(); ++it)
|
||||
{
|
||||
inst_array.push_back(*it);
|
||||
}
|
||||
|
||||
std::sort(inst_array.begin(), inst_array.end(), compare_xlsx_fills());
|
||||
@ -169,7 +168,7 @@ void xlsx_fills::serialize(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_XML_ATTR(L"count", inst_array.size());
|
||||
|
||||
for (int i = 0; i < inst_array.size(); i++)
|
||||
for (size_t i = 0; i < inst_array.size(); i++)
|
||||
{
|
||||
xlsx_serialize(CP_XML_STREAM(), inst_array[i]);
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
|
||||
#include <xml/simple_xml_writer.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
@ -79,9 +78,9 @@ void xlsx_fonts::Impl::serialize(std::wostream & _Wostream) const
|
||||
{
|
||||
std::vector<xlsx_font> fonts;
|
||||
|
||||
BOOST_FOREACH(const xlsx_font & fnt, fonts_)
|
||||
for (boost::unordered_set<xlsx_font, boost::hash<xlsx_font>>::iterator it = fonts_.begin(); it != fonts_.end(); ++it)
|
||||
{
|
||||
fonts.push_back(fnt);
|
||||
fonts.push_back(*it);
|
||||
}
|
||||
|
||||
std::sort(fonts.begin(), fonts.end(), compare_xlsx_fonts());
|
||||
@ -91,6 +90,7 @@ void xlsx_fonts::Impl::serialize(std::wostream & _Wostream) const
|
||||
CP_XML_NODE(L"fonts")
|
||||
{
|
||||
CP_XML_ATTR(L"count", fonts.size());
|
||||
|
||||
for (size_t i = 0; i < fonts.size(); ++i)
|
||||
{
|
||||
xlsx_serialize(CP_XML_STREAM(), fonts[i]);
|
||||
|
||||
@ -251,6 +251,11 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
comments_->set_main_document(get_main_document());
|
||||
comments_->write(path);
|
||||
}
|
||||
if (jsaProject_)
|
||||
{
|
||||
rels_files_.add( relationship(L"jsaId", L"http://schemas.onlyoffice.com/jsaProject", L"jsaProject.bin" ) );
|
||||
jsaProject_->write( path );
|
||||
}
|
||||
rels_files_.write(path);
|
||||
}
|
||||
|
||||
@ -313,6 +318,10 @@ void xl_files::add_pivot_table(pivot_table_content_ptr pivot_table)
|
||||
{
|
||||
pivot_table_files_.add_pivot_table(pivot_table);
|
||||
}
|
||||
void xl_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
|
||||
{
|
||||
|
||||
@ -232,6 +232,7 @@ public:
|
||||
void add_charts (chart_content_ptr chart);
|
||||
void add_pivot_cache (pivot_cache_content_ptr cache);
|
||||
void add_pivot_table (pivot_table_content_ptr table);
|
||||
void add_jsaProject (const std::string &content);
|
||||
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
@ -251,6 +252,7 @@ private:
|
||||
element_ptr vml_drawings_;
|
||||
element_ptr comments_;
|
||||
element_ptr connections_;
|
||||
element_ptr jsaProject_;
|
||||
};
|
||||
|
||||
class xlsx_document : public document
|
||||
|
||||
@ -86,6 +86,7 @@ public:
|
||||
struct _field
|
||||
{
|
||||
std::wstring name;
|
||||
bool name_enabled = false;
|
||||
std::wstring display_name;
|
||||
int type = -1;
|
||||
int hierarchy = -1;
|
||||
@ -422,6 +423,8 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
|
||||
bool bAddRepeateRow = false;
|
||||
bool bAddRepeateCol = false;
|
||||
bool bShowEmptyCol = true;
|
||||
bool bShowEmptyRow = true;
|
||||
|
||||
int count_items_col = -1, count_items_row = -1;
|
||||
|
||||
@ -479,25 +482,15 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
if (count_items_col != current_.fields[i].caches.size())
|
||||
bAddRepeateCol = true;
|
||||
}
|
||||
if (!current_.fields[i].show_empty || !current_.fields[i].repeat_item_labels )
|
||||
bShowEmptyCol = false;
|
||||
|
||||
}
|
||||
else if (current_.fields[i].name_enabled)
|
||||
{
|
||||
count_items_col = 0;
|
||||
bAddRepeateCol = true; //add col axis
|
||||
}
|
||||
//if (current_.fields[i].data_layout)
|
||||
//{
|
||||
// bAddRepeateCol = false;
|
||||
|
||||
// if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
// current_.fields[i].used_in_referenes )
|
||||
// {
|
||||
// if ((current_.col_fields.empty()) || (current_.col_fields.back() != -2))
|
||||
// {
|
||||
// bAddRepeateCol = true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (current_.fields[i].caches.empty())
|
||||
// bEmptyColCache = true;
|
||||
|
||||
|
||||
}break;
|
||||
case 1: // data
|
||||
{
|
||||
@ -547,10 +540,20 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count_items_row != current_.fields[i].caches.size())
|
||||
if (count_items_row < current_.fields[i].caches.size())
|
||||
bAddRepeateRow = true;
|
||||
}
|
||||
}
|
||||
else if (current_.fields[i].name_enabled)
|
||||
{
|
||||
count_items_row = 0;
|
||||
bAddRepeateRow = true; //add row axis
|
||||
}
|
||||
if (!current_.fields[i].show_empty)
|
||||
bShowEmptyRow = false;
|
||||
|
||||
if (!current_.fields[i].repeat_item_labels)
|
||||
bAddRepeateCol = false;
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
@ -575,10 +578,10 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol)) ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
|
||||
if ((bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol))/* && bShowEmptyCol*/) ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
|
||||
current_.col_fields.push_back(-2);
|
||||
|
||||
if (bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow))
|
||||
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow))/* && bShowEmptyRow*/)
|
||||
current_.row_fields.push_back(-2);
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
@ -1296,6 +1299,7 @@ void xlsx_pivots_context::start_field()
|
||||
void xlsx_pivots_context::set_field_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().name = name;
|
||||
impl_->current_.fields.back().name_enabled = true;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_display(std::wstring name)
|
||||
{
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include "../odf/style_text_properties.h"
|
||||
#include "../odf/style_paragraph_properties.h"
|
||||
|
||||
@ -223,11 +222,11 @@ namespace
|
||||
void xlsx_style_manager::Impl::serialize_xf(std::wostream & _Wostream, const xlsx_xf_array & xfArray, const std::wstring & nodeName)
|
||||
{
|
||||
std::vector<xlsx_xf> xfs_;
|
||||
|
||||
BOOST_FOREACH(const xlsx_xf & xfRecord, xfArray)
|
||||
{
|
||||
xfs_.push_back(xfRecord);
|
||||
}
|
||||
|
||||
for (boost::unordered_set<xlsx_xf, boost::hash<xlsx_xf>>::iterator it = xfArray.begin(); it != xfArray.end(); ++it)
|
||||
{
|
||||
xfs_.push_back(*it);
|
||||
}
|
||||
|
||||
std::sort(xfs_.begin(), xfs_.end(), compare_xlsx_xf());
|
||||
|
||||
|
||||
@ -220,7 +220,9 @@ void xlsx_table_state::start_cell(size_t columnsSpanned, size_t rowsSpanned)
|
||||
|
||||
// в случае если объединение имеет место добавляем запись о нем
|
||||
if (columnsSpanned != 0 || rowsSpanned != 0)
|
||||
xlsx_merge_cells_.add_merge(current_table_column_, current_table_row_, columnsSpanned, rowsSpanned);
|
||||
{
|
||||
xlsx_merge_cells_.add_merge(current_table_column_, current_table_row_, columnsSpanned, rowsSpanned);
|
||||
}
|
||||
|
||||
if ( current_columns_spaned() > 0 )
|
||||
{
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
#include "xlsx_utils.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||
@ -90,14 +89,15 @@ std::wstring getCellAddress(size_t col, size_t row)
|
||||
size_t getColAddressInv(const std::wstring & a_)
|
||||
{
|
||||
std::wstring a = a_;
|
||||
::boost::algorithm::to_upper(a);
|
||||
boost::algorithm::to_upper(a);
|
||||
static const size_t r = (L'Z' - L'A' + 1);
|
||||
size_t mul = 1;
|
||||
bool f = true;
|
||||
size_t res = 0;
|
||||
BOOST_REVERSE_FOREACH(const wchar_t c, a)
|
||||
{
|
||||
size_t v = c - L'A';
|
||||
|
||||
for (int i = a.length() - 1; i >= 0; i--)
|
||||
{
|
||||
size_t v = a[i] - L'A';
|
||||
if (f)
|
||||
f = false;
|
||||
else
|
||||
@ -129,13 +129,12 @@ void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring
|
||||
|
||||
boost::algorithm::to_upper(a);
|
||||
|
||||
|
||||
BOOST_FOREACH(wchar_t c, a)
|
||||
{
|
||||
if (c >= L'0' && c <= L'9')
|
||||
row +=c;
|
||||
for (size_t i = 0; i < a.length(); i++)
|
||||
{
|
||||
if (a[i] >= L'0' && a[i] <= L'9')
|
||||
row += a[i];
|
||||
else
|
||||
col += c;
|
||||
col += a[i];
|
||||
}
|
||||
std::reverse(col.begin(), col.end());
|
||||
std::reverse(row.begin(), row.end());
|
||||
|
||||
@ -755,7 +755,13 @@ void xlsx_conversion_context::set_conditional_format_dataBar (_CP_OPT(int) min,
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().set_dataBar(min, max);
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::add_jsaProject(const std::string &content)
|
||||
{
|
||||
if (content.empty()) return;
|
||||
|
||||
output_document_->get_xl_files().add_jsaProject(content);
|
||||
output_document_->get_content_types_file().add_or_find_default(L"bin");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,6 +156,8 @@ public:
|
||||
void add_conditional_format_color (std::wstring col);
|
||||
void add_conditional_format_entry (int type, std::wstring value);
|
||||
void set_conditional_format_dataBar (_CP_OPT(int) min, _CP_OPT(int) max);
|
||||
|
||||
void add_jsaProject (const std::string &content);
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
odf_reader::odf_document * root()
|
||||
|
||||
@ -201,8 +201,8 @@ style_table_cell_properties_attlist calc_table_cell_properties(const style_insta
|
||||
std::vector<const style_table_cell_properties*> props;
|
||||
while (styleInstance)
|
||||
{
|
||||
if (const style_content * content = styleInstance->content())
|
||||
if (const style_table_cell_properties * prop = content->get_style_table_cell_properties())
|
||||
if (style_content * content = styleInstance->content())
|
||||
if (style_table_cell_properties * prop = content->get_style_table_cell_properties())
|
||||
{
|
||||
props.insert(props.begin(), prop);
|
||||
}
|
||||
|
||||
@ -29,8 +29,6 @@
|
||||
* 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"
|
||||
|
||||
@ -61,17 +59,17 @@ class office_element;
|
||||
typedef shared_ptr<const office_element>::Type office_element_ptr_const;
|
||||
|
||||
#define ACCEPT_ALL_CONTENT(VAL) \
|
||||
BOOST_FOREACH(office_element_ptr & elm, (VAL)) \
|
||||
for (size_t ii = 0; ii < VAL.size(); ++ii) \
|
||||
{ \
|
||||
if (elm) \
|
||||
elm->accept(*this); \
|
||||
if (VAL[ii]) \
|
||||
VAL[ii]->accept(*this); \
|
||||
}
|
||||
|
||||
#define ACCEPT_ALL_CONTENT_CONST(VAL) \
|
||||
BOOST_FOREACH(const office_element_ptr_const & elm, (VAL)) \
|
||||
for (size_t ii = 0; ii < VAL.size(); ++ii) \
|
||||
{ \
|
||||
if (elm) \
|
||||
elm->accept(*this); \
|
||||
if (VAL[ii]) \
|
||||
VAL[ii]->accept(*this); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ std::wostream & operator << (std::wostream & _Wostream, const style_repeat & _Va
|
||||
case style_repeat::Stretch:
|
||||
_Wostream << L"stretch";
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _Wostream;
|
||||
@ -67,9 +67,10 @@ style_repeat style_repeat::parse(const std::wstring & Str)
|
||||
return style_repeat( Repeat );
|
||||
else if (tmp == L"stretch")
|
||||
return style_repeat( Stretch );
|
||||
else
|
||||
else if (tmp == L"scale")//LOWriter-form-controls modded.odt
|
||||
return style_repeat( Stretch );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return style_repeat( NoRepeat );
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,9 @@ text_transform text_transform::parse(const std::wstring & Str)
|
||||
return text_transform(Uppercase);
|
||||
else if (tmp == L"capitalize")
|
||||
return text_transform(Capitalize);
|
||||
else
|
||||
else if (tmp == L"underline")
|
||||
return text_transform(Underline);
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return None;
|
||||
|
||||
@ -52,7 +52,8 @@ public:
|
||||
None,
|
||||
Lowercase,
|
||||
Uppercase,
|
||||
Capitalize
|
||||
Capitalize,
|
||||
Underline
|
||||
};
|
||||
|
||||
text_transform()
|
||||
|
||||
@ -39,21 +39,22 @@ namespace odf_reader {
|
||||
class document_context::Impl
|
||||
{
|
||||
public:
|
||||
Impl() : last_paragraph_(NULL) {}
|
||||
Impl() : last_element_(NULL) {}
|
||||
|
||||
public:
|
||||
void set_last_paragraph(text::paragraph * Paragraph)
|
||||
void set_last_element(office_element* elem)
|
||||
{
|
||||
last_paragraph_ = Paragraph;
|
||||
last_element_ = elem;
|
||||
}
|
||||
|
||||
text::paragraph * get_last_paragraph()
|
||||
office_element* get_last_element()
|
||||
{
|
||||
return last_paragraph_;
|
||||
return last_element_;
|
||||
}
|
||||
|
||||
private:
|
||||
text::paragraph * last_paragraph_;
|
||||
office_element * last_element_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -68,18 +69,15 @@ document_context::~document_context()
|
||||
{
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
void document_context::set_last_paragraph(text::paragraph * Paragraph)
|
||||
void document_context::set_last_element(office_element* elem)
|
||||
{
|
||||
return impl_->set_last_paragraph(Paragraph);
|
||||
return impl_->set_last_element(elem);
|
||||
}
|
||||
|
||||
text::paragraph * document_context::get_last_paragraph()
|
||||
office_element* document_context::get_last_element()
|
||||
{
|
||||
return impl_->get_last_paragraph();
|
||||
return impl_->get_last_element();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,18 +36,14 @@ namespace odf_reader {
|
||||
|
||||
class office_element;
|
||||
|
||||
namespace text {
|
||||
class paragraph;
|
||||
}
|
||||
|
||||
class document_context
|
||||
{
|
||||
public:
|
||||
document_context();
|
||||
virtual ~document_context();
|
||||
|
||||
void set_last_paragraph(text::paragraph * Paragraph);
|
||||
text::paragraph * get_last_paragraph();
|
||||
void set_last_element(office_element* elem);
|
||||
office_element* get_last_element();
|
||||
|
||||
int level;
|
||||
|
||||
|
||||
@ -774,6 +774,20 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
}
|
||||
else if (styleInst->content())
|
||||
{
|
||||
style_paragraph_properties *para_props = styleInst->content()->get_style_paragraph_properties();
|
||||
if ((para_props) && (para_props->content_.style_writing_mode_))
|
||||
{
|
||||
switch(para_props->content_.style_writing_mode_->get_type())
|
||||
{
|
||||
case writing_mode::TbLr:
|
||||
drawing->additional.push_back(odf_reader::_property(L"text_vert", 2)); break;
|
||||
case writing_mode::TbRl:
|
||||
drawing->additional.push_back(odf_reader::_property(L"text_vert", 1)); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
instances.push_back(styleInst);
|
||||
}
|
||||
@ -870,7 +884,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
}
|
||||
|
||||
}
|
||||
drawing->number_wrapped_paragraphs=graphicProperties.style_number_wrapped_paragraphs_.
|
||||
drawing->number_wrapped_paragraphs = graphicProperties.style_number_wrapped_paragraphs_.
|
||||
get_value_or( integer_or_nolimit( integer_or_nolimit::NoLimit) ).get_value();
|
||||
if (anchor && anchor->get_type() == anchor_type::AsChar && drawing->posOffsetV< 0)
|
||||
{
|
||||
@ -1232,7 +1246,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
const std::wstring & content = Context.get_drawing_context().get_text_stream_frame();
|
||||
|
||||
drawing->additional.push_back(_property(L"text-content",content));
|
||||
drawing->additional.push_back(_property(L"text-content", content));
|
||||
Context.get_drawing_context().clear_stream_frame();
|
||||
|
||||
/////////
|
||||
@ -1255,7 +1269,19 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
//}
|
||||
auto_fit_shape = true;
|
||||
}
|
||||
|
||||
else if ((frame->draw_frame_attlist_.fo_min_height_) && (draw_text_box_attlist_.fo_min_height_->get_type()==length_or_percent::Length))
|
||||
{
|
||||
size_t min_y = get_value_emu(frame->draw_frame_attlist_.fo_min_height_->get_length());
|
||||
if (drawing->cy < min_y)
|
||||
{
|
||||
drawing->cy = min_y;
|
||||
}
|
||||
auto_fit_shape = true;
|
||||
}
|
||||
else if ((frame->common_draw_attlists_.rel_size_.style_rel_height_) && (frame->common_draw_attlists_.rel_size_.style_rel_height_->get_type() == percent_or_scale::ScaleMin))
|
||||
{
|
||||
auto_fit_shape = true;
|
||||
}
|
||||
|
||||
if ((draw_text_box_attlist_.fo_min_width_) && (draw_text_box_attlist_.fo_min_width_->get_type()==length_or_percent::Length))
|
||||
{
|
||||
@ -1290,6 +1316,12 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
else if (auto_fit_text)
|
||||
drawing->additional.push_back(_property(L"fit-to-size", auto_fit_text));
|
||||
|
||||
if (drawing->cx < 1 && drawing->cy < 1)
|
||||
{
|
||||
drawing->cx = 10;
|
||||
drawing->cy = 10;
|
||||
}
|
||||
}
|
||||
void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1413,8 +1445,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_drawing_context().start_frame(this);
|
||||
|
||||
const _CP_OPT(std::wstring) name =
|
||||
common_draw_attlists_.shape_with_text_and_styles_.
|
||||
common_shape_draw_attlist_.draw_name_;
|
||||
common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_;
|
||||
|
||||
Context.get_drawing_context().add_name_object(name.get_value_or(L"Object"));
|
||||
|
||||
@ -1642,6 +1673,11 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
oox::text_forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
|
||||
if (state.id.empty()) return;
|
||||
|
||||
if ((state.type == 6 || state.type == 4) && state.element)
|
||||
{
|
||||
return state.element->docx_convert_sdt(Context, this);
|
||||
}
|
||||
|
||||
Context.get_drawing_context().start_shape(NULL);
|
||||
Context.get_drawing_context().add_name_object(state.name.empty() ? L"Control" : state.name);
|
||||
|
||||
@ -1694,7 +1730,7 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml( text );
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml( text, true );
|
||||
Context.output_stream() << L"</w:t>";
|
||||
Context.finish_run();
|
||||
}
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/regex.h>
|
||||
|
||||
#include <xml/xmlchar.h>
|
||||
@ -438,9 +437,9 @@ int draw_enhanced_geometry::parsing(_CP_OPT(std::wstring) val)
|
||||
int pos = 0, res = -1;
|
||||
if (!val) return res;
|
||||
|
||||
BOOST_FOREACH(wchar_t c, val.get())
|
||||
for (size_t i = 0; i < val->length(); i++)
|
||||
{
|
||||
if (c < L'0' && c > L'9')
|
||||
if (val->at(i) < L'0' && val->at(i) > L'9')
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "number_style.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <odf/odf_document.h>
|
||||
|
||||
#include <xml/xmlchar.h>
|
||||
@ -78,10 +77,10 @@ void number_style_base::oox_convert_impl(oox::num_format_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
number_style_base *number_style_ = dynamic_cast<number_style_base *> (elm.get());
|
||||
number_element *number_element_ = dynamic_cast<number_element *> (elm.get());
|
||||
number_style_base *number_style_ = dynamic_cast<number_style_base *> (content_[i].get());
|
||||
number_element *number_element_ = dynamic_cast<number_element *> (content_[i].get());
|
||||
|
||||
if (number_style_) number_style_->oox_convert(Context);
|
||||
if (number_element_) number_element_->oox_convert(Context);
|
||||
@ -93,9 +92,9 @@ void number_style_base::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
if (!style_map_.empty())
|
||||
{
|
||||
BOOST_FOREACH(const office_element_ptr & elm, style_map_)
|
||||
{
|
||||
if (const style_map * styleMap = dynamic_cast<const style_map *>(elm.get()))
|
||||
for (size_t i = 0; i < style_map_.size(); i++)
|
||||
{
|
||||
if (const style_map * styleMap = dynamic_cast<const style_map *>(style_map_[i].get()))
|
||||
{
|
||||
const std::wstring applyStyleName = styleMap->style_apply_style_name_;
|
||||
const std::wstring condition = styleMap->style_condition_;
|
||||
@ -309,12 +308,13 @@ void number_currency_symbol::add_text(const std::wstring & Text)
|
||||
void number_currency_symbol::oox_convert(oox::num_format_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
strm << L"[$";//xml::utils::replace_text_to_xml(L"\"");
|
||||
BOOST_FOREACH(const std::wstring & t, text_)
|
||||
strm << L"[$";
|
||||
|
||||
for (size_t i = 0; i < text_.size(); i++)
|
||||
{
|
||||
strm << xml::utils::replace_text_to_xml(t);
|
||||
strm << xml::utils::replace_text_to_xml(text_[i]);
|
||||
}
|
||||
strm << L"]";;//xml::utils::replace_text_to_xml(L"\"");
|
||||
strm << L"]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -110,6 +110,23 @@ content_xml_t_ptr odf_document::Impl::read_file_content(xml::sax * reader_owner)
|
||||
|
||||
return result;
|
||||
}
|
||||
std::string odf_document::Impl::read_binary(const std::wstring & Path)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
if (file.OpenFile(Path))
|
||||
{
|
||||
DWORD size = file.GetFileSize();
|
||||
result.resize(size);
|
||||
|
||||
file.ReadFile((BYTE*)result.c_str(), size, size);
|
||||
file.CloseFile();
|
||||
|
||||
result[size] = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
content_xml_t_ptr odf_document::Impl::read_file_content(const std::wstring & Path)
|
||||
{
|
||||
@ -200,6 +217,8 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
|
||||
std::wstring styles_xml = base_folder_ + FILE_SEPARATOR_STR + L"styles.xml";
|
||||
std::wstring meta_xml = base_folder_ + FILE_SEPARATOR_STR + L"meta.xml";
|
||||
std::wstring settings_xml = base_folder_ + FILE_SEPARATOR_STR + L"settings.xml";
|
||||
|
||||
std::wstring jsaProject_bin = base_folder_ + FILE_SEPARATOR_STR + L"jsaProject.bin";
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
_CP_LOG << L"[info] read settings.xml" << std::endl;
|
||||
@ -208,11 +227,13 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
|
||||
_CP_LOG << L"[info] read content.xml" << std::endl;
|
||||
content_xml_ = read_file_content(content_xml);
|
||||
|
||||
_CP_LOG << L"[info] read styles.xml" << std::endl;
|
||||
_CP_LOG << L"[info] read styles.xml" << std::endl;
|
||||
styles_xml_ = read_file_content(styles_xml);
|
||||
|
||||
_CP_LOG << L"[info] read meta.xml" << std::endl;
|
||||
_CP_LOG << L"[info] read meta.xml" << std::endl;
|
||||
meta_xml_ = read_file_content(meta_xml);
|
||||
|
||||
jsaProject_bin_ = read_binary(jsaProject_bin);
|
||||
//----------------------------------------------------------------------------------------
|
||||
_CP_LOG << L"[info] parse fonts" << std::endl;
|
||||
parse_fonts(content_xml_ ? content_xml_->get_content() : NULL);
|
||||
@ -275,9 +296,20 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
|
||||
pFind = map_encryptions_extra_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
{
|
||||
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
|
||||
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; result && i < arDirectories.size(); ++i)
|
||||
@ -552,7 +584,14 @@ void odf_document::Impl::parse_manifests(office_element *element)
|
||||
XmlUtils::replace_all( file_path, L"/", FILE_SEPARATOR_STR);
|
||||
file_path = base_folder_ + FILE_SEPARATOR_STR + file_path;
|
||||
|
||||
map_encryptions_.insert(std::make_pair(file_path, std::make_pair(entry->encryption_data_, entry->size)));
|
||||
if (0 == entry->full_path_.find(L"Basic/")) //Cuaderno de notas 1.2.ods
|
||||
{
|
||||
map_encryptions_extra_.insert(std::make_pair(file_path, std::make_pair(entry->encryption_data_, entry->size)));
|
||||
}
|
||||
else
|
||||
{
|
||||
map_encryptions_.insert(std::make_pair(file_path, std::make_pair(entry->encryption_data_, entry->size)));
|
||||
}
|
||||
}
|
||||
|
||||
if (entry->full_path_ == L"/")
|
||||
@ -1054,6 +1093,8 @@ bool odf_document::Impl::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.process_list_styles();
|
||||
if (UpdateProgress(850000)) return false;
|
||||
|
||||
Context.add_jsaProject(jsaProject_bin_);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool odf_document::Impl::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
@ -1078,6 +1119,7 @@ bool odf_document::Impl::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
Context.process_styles();
|
||||
if (UpdateProgress(800000)) return false;
|
||||
|
||||
Context.add_jsaProject(jsaProject_bin_);
|
||||
}
|
||||
catch(boost::exception & ex)
|
||||
{
|
||||
@ -1123,6 +1165,8 @@ bool odf_document::Impl::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
Context.end_document();
|
||||
if (UpdateProgress(850000)) return false;
|
||||
|
||||
Context.add_jsaProject(jsaProject_bin_);
|
||||
}
|
||||
catch(boost::exception & ex)
|
||||
{
|
||||
|
||||
@ -80,7 +80,9 @@ public:
|
||||
|
||||
int get_office_mime_type() {return office_mime_type_;}
|
||||
|
||||
bool get_encrypted() {return (false == map_encryptions_.empty());}
|
||||
bool get_encrypted() {return (false == map_encryptions_.empty());}
|
||||
bool get_encrypted_extra() {return (false == map_encryptions_extra_.empty());}
|
||||
|
||||
bool get_error() {return bError;}
|
||||
|
||||
bool UpdateProgress(long Complete);
|
||||
@ -101,11 +103,15 @@ private:
|
||||
bool decrypt_folder (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath);
|
||||
bool decrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, office_element_ptr data, int size );
|
||||
|
||||
content_xml_t_ptr content_xml_;
|
||||
content_xml_t_ptr styles_xml_;
|
||||
content_xml_t_ptr meta_xml_;
|
||||
content_xml_t_ptr settings_xml_;
|
||||
content_xml_t_ptr manifest_xml_;
|
||||
std::string read_binary(const std::wstring & Path);
|
||||
|
||||
content_xml_t_ptr content_xml_;
|
||||
content_xml_t_ptr styles_xml_;
|
||||
content_xml_t_ptr meta_xml_;
|
||||
content_xml_t_ptr settings_xml_;
|
||||
content_xml_t_ptr manifest_xml_;
|
||||
|
||||
std::string jsaProject_bin_;
|
||||
|
||||
std::wstring mimetype_content_file_;
|
||||
|
||||
@ -118,7 +124,8 @@ private:
|
||||
int GetMimetype(std::wstring value);
|
||||
|
||||
std::map<std::wstring, std::pair<office_element_ptr, int>> map_encryptions_;
|
||||
|
||||
std::map<std::wstring, std::pair<office_element_ptr, int>> map_encryptions_extra_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ style_instance::style_instance(
|
||||
|
||||
style_instance * styles_container::hyperlink_style()
|
||||
{
|
||||
if (hyperlink_style_pos_ > 0)
|
||||
if (hyperlink_style_pos_ > 0 && hyperlink_style_pos_ < instances_.size())
|
||||
return instances_[hyperlink_style_pos_].get();
|
||||
else
|
||||
return NULL;
|
||||
@ -450,7 +450,7 @@ const page_layout_instance * page_layout_container::page_layout_first() const
|
||||
bool page_layout_container::compare_page_properties(const std::wstring & master1, const std::wstring & master2)
|
||||
{
|
||||
const page_layout_instance *page_layout1 = page_layout_by_style(master1);
|
||||
const page_layout_instance *page_layout2 = page_layout_by_style(master1);
|
||||
const page_layout_instance *page_layout2 = page_layout_by_style(master2);
|
||||
|
||||
if (!page_layout1 || !page_layout2) return true;
|
||||
if (!page_layout1->style_page_layout_ || !page_layout1->style_page_layout_) return true;
|
||||
@ -458,7 +458,9 @@ bool page_layout_container::compare_page_properties(const std::wstring & master1
|
||||
style_page_layout_properties *props1 = dynamic_cast<style_page_layout_properties*>(page_layout1->style_page_layout_->style_page_layout_properties_.get());
|
||||
style_page_layout_properties *props2 = dynamic_cast<style_page_layout_properties*>(page_layout2->style_page_layout_->style_page_layout_properties_.get());
|
||||
|
||||
if (!props1 || !props1) return true;
|
||||
if (!props1 || !props2) return true;
|
||||
|
||||
if (props1 == props2) return true;
|
||||
|
||||
return props1->attlist_.compare(props2->attlist_);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ void office_annotation::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.set_run_state(runState);
|
||||
Context.set_paragraph_state(pState);
|
||||
|
||||
Context.get_comments_context().start_comment(temp_stream.str(), author,date);//content, date, author
|
||||
Context.get_comments_context().start_comment(temp_stream.str(), author, date, runState);//content, date, author
|
||||
|
||||
Context.dump_hyperlinks(Context.get_comments_context().get_rels(), oox::hyperlinks::comment_place);
|
||||
|
||||
|
||||
@ -142,14 +142,14 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (content_)
|
||||
content_->docx_convert(Context);
|
||||
|
||||
if (!Context.get_section_context().dump_.empty() && !Context.get_table_context().in_table())
|
||||
if (false == Context.get_section_context().dump_.empty() && false == Context.get_table_context().in_table())
|
||||
{
|
||||
Context.output_stream() << Context.get_section_context().dump_;
|
||||
Context.get_section_context().dump_.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
|
||||
if (page_layout_instance *lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
|
||||
{
|
||||
Context.next_dump_page_properties(true);
|
||||
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include <CPSharedPtr.h>
|
||||
#include <CPWeakPtr.h>
|
||||
#include <xml/xmlelement.h>
|
||||
#include <common/readdocelement.h>
|
||||
|
||||
@ -47,16 +46,17 @@
|
||||
#include "visitor.h"
|
||||
#include "../conversionelement.h"
|
||||
|
||||
#include "documentcontext.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class document_context;
|
||||
|
||||
class office_element;
|
||||
|
||||
typedef shared_ptr<office_element>::Type office_element_ptr;
|
||||
typedef weak_ptr<office_element>::Type office_element_weak_ptr;
|
||||
typedef std::vector<office_element_ptr> office_element_ptr_array;
|
||||
|
||||
class office_element : public xml::element<wchar_t>,
|
||||
@ -69,17 +69,49 @@ public:
|
||||
|
||||
virtual ElementType get_type() const = 0;
|
||||
virtual ~office_element() = 0;
|
||||
|
||||
void set_root(bool isRoot) { is_root_ = isRoot; }
|
||||
bool is_root() const { return is_root_; }
|
||||
|
||||
virtual void afterCreate() {};
|
||||
virtual void afterReadContent() {};
|
||||
virtual void afterCreate()
|
||||
{
|
||||
if (!context_) return;
|
||||
|
||||
ElementType type_ = this->get_type();
|
||||
|
||||
if (type_ != typeTextSection)
|
||||
{
|
||||
context_->level++;
|
||||
}
|
||||
}
|
||||
virtual void afterReadContent()
|
||||
{
|
||||
if (!context_) return;
|
||||
|
||||
ElementType type_ = this->get_type();
|
||||
|
||||
if (type_ != typeTextSection)
|
||||
{
|
||||
if (context_->level == 4)
|
||||
{
|
||||
if (office_element * prev= context_->get_last_element())
|
||||
{
|
||||
prev->next_element_style_name = element_style_name;
|
||||
}
|
||||
|
||||
context_->set_last_element(this);
|
||||
}
|
||||
context_->level--;
|
||||
}
|
||||
}
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
void setContext(document_context * Context) { context_ = Context; }
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) element_style_name;
|
||||
_CP_OPT(std::wstring) next_element_style_name; //for master page
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
_CP_LOG << L"[warning] use base text_to_stream\n";
|
||||
@ -92,8 +124,7 @@ public:
|
||||
return _Wostream;
|
||||
}
|
||||
document_context * getContext() { return context_; }
|
||||
//
|
||||
//protected:
|
||||
|
||||
const document_context * getContext() const { return context_; }
|
||||
|
||||
private:
|
||||
|
||||
@ -406,12 +406,76 @@ void form_combobox::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
form_element::add_attributes(Attributes);
|
||||
}
|
||||
void form_combobox::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"form", L"item")
|
||||
{
|
||||
CP_CREATE_ELEMENT(items_);
|
||||
}
|
||||
else
|
||||
{
|
||||
form_element::add_child_element(Reader, Ns, Name);
|
||||
}
|
||||
}
|
||||
void form_combobox::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(4);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_combobox::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
Context.finish_run();
|
||||
Context.output_stream() << L"<w:sdt>";
|
||||
Context.output_stream() << L"<w:sdtPr>";
|
||||
{
|
||||
if (name_)
|
||||
{
|
||||
Context.output_stream() << L"<w:alias w:val=\"" + xml::utils::replace_text_to_xml(*name_) + L"\"/>";
|
||||
}
|
||||
Context.output_stream() << L"<w:id w:val=\"" + std::to_wstring(Context.get_drawing_context().get_current_shape_id()) + L"\"/>";
|
||||
|
||||
Context.output_stream() << L"<w:dropDownList>";
|
||||
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
form_item* item = dynamic_cast<form_item*>(items_[i].get());
|
||||
if (!item) continue;
|
||||
|
||||
Context.output_stream() << L"<w:listItem w:displayText=\"" << (item->text_.empty() ? item->label_ : item->text_);
|
||||
Context.output_stream() << L"\" w:value=\"" << item->label_ << L"\"/>";
|
||||
}
|
||||
|
||||
Context.output_stream() << L"</w:dropDownList>";
|
||||
}
|
||||
Context.output_stream() << L"</w:sdtPr>";
|
||||
Context.output_stream() << L"<w:sdtContent>";
|
||||
{
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
|
||||
if (current_value_)
|
||||
{
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml(*current_value_ );
|
||||
}
|
||||
Context.output_stream() << L"</w:t>";
|
||||
Context.finish_run();
|
||||
}
|
||||
Context.output_stream() << L"</w:sdtContent>";
|
||||
Context.output_stream() << L"</w:sdt>";
|
||||
|
||||
if (label_)
|
||||
{
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml(*label_ );
|
||||
Context.output_stream() << L"</w:t>";
|
||||
Context.finish_run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// form:listbox
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_listbox::ns = L"form";
|
||||
@ -427,5 +491,83 @@ void form_listbox::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
// form:button
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_date::ns = L"form";
|
||||
const wchar_t * form_date::name = L"date";
|
||||
|
||||
void form_date::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
form_element::add_attributes(Attributes);
|
||||
}
|
||||
void form_date::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(6);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_date::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
Context.finish_run();
|
||||
|
||||
Context.output_stream() << L"<w:sdt>";
|
||||
Context.output_stream() << L"<w:sdtPr>";
|
||||
{
|
||||
if (name_)
|
||||
{
|
||||
Context.output_stream() << L"<w:alias w:val=\"" + xml::utils::replace_text_to_xml(*name_) + L"\"/>";
|
||||
}
|
||||
Context.output_stream() << L"<w:id w:val=\"" + std::to_wstring(Context.get_drawing_context().get_current_shape_id()) + L"\"/>";
|
||||
|
||||
Context.output_stream() << L"<w:date>";
|
||||
Context.output_stream() << L"<w:dateFormat w:val=\"\"/>";
|
||||
Context.output_stream() << L"<w:lid w:val=\"en-US\"/>";
|
||||
Context.output_stream() << L"<w:storeMappedDataAs w:val=\"dateTime\"/>";
|
||||
Context.output_stream() << L"<w:calendar w:val=\"gregorian\"/>";
|
||||
Context.output_stream() << L"</w:date>";
|
||||
}
|
||||
Context.output_stream() << L"</w:sdtPr>";
|
||||
Context.output_stream() << L"<w:sdtContent>";
|
||||
{
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
|
||||
if (current_value_)
|
||||
{
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml(*current_value_ );
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.output_stream() << L"[Insert date]";
|
||||
}
|
||||
Context.output_stream() << L"</w:t>";
|
||||
Context.finish_run();
|
||||
}
|
||||
Context.output_stream() << L"</w:sdtContent>";
|
||||
Context.output_stream() << L"</w:sdt>";
|
||||
|
||||
if (label_)
|
||||
{
|
||||
Context.add_new_run(L"");
|
||||
Context.output_stream() << L"<w:t xml:space=\"preserve\">";
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml(*label_ );
|
||||
Context.output_stream() << L"</w:t>";
|
||||
Context.finish_run();
|
||||
}
|
||||
}
|
||||
// form:item
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_item::ns = L"form";
|
||||
const wchar_t * form_item::name = L"item";
|
||||
|
||||
void form_item::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"form:label", label_, std::wstring(L""));
|
||||
}
|
||||
void form_item::add_text(const std::wstring & Text)
|
||||
{
|
||||
text_ = Text;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -337,10 +337,16 @@ public:
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::Bool) dropdown_;
|
||||
office_element_ptr_array items_;
|
||||
_CP_OPT(int ) size_;
|
||||
|
||||
//form:list-source-type
|
||||
//form:size
|
||||
//form:auto-complete
|
||||
@ -367,10 +373,9 @@ private:
|
||||
|
||||
public:
|
||||
//form:list-source-type
|
||||
//form:size
|
||||
//form:list-source
|
||||
//form:source-cell-range
|
||||
//form:dropdown
|
||||
|
||||
//form:bound-column
|
||||
//form:xforms-list-source
|
||||
//form:multiple
|
||||
@ -380,10 +385,50 @@ public:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_listbox);
|
||||
|
||||
// form:date
|
||||
class form_date : public form_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFormDate;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_date);
|
||||
|
||||
// form:item
|
||||
class form_item : public office_element_impl<form_item>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFormItem;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
public:
|
||||
std::wstring label_;
|
||||
std::wstring text_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_item);
|
||||
}
|
||||
}
|
||||
//<form:connection-resource>7.6.2,
|
||||
//<form:date> 13.5.8,
|
||||
//<form:connection-resource>7.6.2,
|
||||
//<form:file> 13.5.5,
|
||||
//<form:fixed-text> 13.5.10,
|
||||
//<form:form> 13.3,
|
||||
|
||||
@ -36,8 +36,10 @@
|
||||
#include <xml/xmlchar.h>
|
||||
#include <xml/attributes.h>
|
||||
#include <xml/utils.h>
|
||||
#include <odf/odf_document.h>
|
||||
|
||||
#include "serialize_elements.h"
|
||||
#include "odfcontext.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
@ -94,17 +96,17 @@ bool is_text_content(const std::wstring & ns, const std::wstring & name)
|
||||
{
|
||||
return true; // all shapes //
|
||||
}
|
||||
else if (ns == L"office" && name == L"forms")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void office_text::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"office", L"forms")
|
||||
{
|
||||
CP_CREATE_ELEMENT(forms_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"text", L"tracked-changes")
|
||||
if CP_CHECK_NAME(L"text", L"tracked-changes")
|
||||
{
|
||||
CP_CREATE_ELEMENT(tracked_changes_);
|
||||
}
|
||||
@ -149,13 +151,50 @@ void office_text::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (tracked_changes_)
|
||||
tracked_changes_->docx_convert(Context);
|
||||
|
||||
if (forms_)
|
||||
forms_->docx_convert(Context);
|
||||
//if (forms_)
|
||||
//forms_->docx_convert(Context);
|
||||
|
||||
Context.start_office_text();
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
if (content_[i]->element_style_name)
|
||||
{
|
||||
std::wstring text___ = *content_[i]->element_style_name;
|
||||
|
||||
const _CP_OPT(std::wstring) masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(*content_[i]->element_style_name);
|
||||
|
||||
if (masterPageName)
|
||||
{
|
||||
std::wstring masterPageNameLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_name_by_style(*masterPageName);
|
||||
|
||||
if (false == masterPageNameLayout.empty())
|
||||
{
|
||||
Context.set_master_page_name(*masterPageName); //проверка на то что тема действительно существует????
|
||||
|
||||
Context.remove_page_properties();
|
||||
Context.add_page_properties(masterPageNameLayout);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (content_[i]->next_element_style_name)
|
||||
{
|
||||
std::wstring text___ = *content_[i]->next_element_style_name;
|
||||
// проверяем не сменится ли свойства страницы.
|
||||
// если да — устанавливаем контексту флаг на то что необходимо в текущем параграфе
|
||||
// распечатать свойства раздела/секции
|
||||
//проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(*content_[i]->next_element_style_name);
|
||||
|
||||
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
|
||||
{
|
||||
if (false == Context.root()->odf_context().pageLayoutContainer().compare_page_properties(Context.get_master_page_name(), *next_masterPageName))
|
||||
{
|
||||
Context.next_dump_page_properties(true);
|
||||
//is_empty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
Context.end_office_text();
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ private:
|
||||
office_element_ptr user_fields_;
|
||||
office_element_ptr variables_;
|
||||
office_element_ptr sequences_;
|
||||
office_element_ptr forms_;
|
||||
//office_element_ptr forms_; -> content
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
@ -122,15 +122,23 @@ const wchar_t * text::name = L"";
|
||||
|
||||
std::wostream & text::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
_Wostream << xml::utils::replace_text_to_xml( text_ );
|
||||
_Wostream << xml::utils::replace_text_to_xml( text_, true );
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
void text::add_text(const std::wstring & Text)
|
||||
{
|
||||
text_ = Text;
|
||||
text_.reserve(Text.length());
|
||||
for (size_t i =0; i < Text.length(); i++)
|
||||
{
|
||||
if (Text[i] < 0x20) continue;
|
||||
text_ += Text[i];
|
||||
}
|
||||
}
|
||||
text::text(const std::wstring & Text)
|
||||
{
|
||||
add_text(Text);
|
||||
}
|
||||
|
||||
void text::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (Context.get_process_note() != oox::docx_conversion_context::noNote &&
|
||||
@ -166,7 +174,7 @@ void text::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.output_stream() << L" xml:space=\"preserve\"";
|
||||
Context.output_stream() << L">";
|
||||
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml( text_ );
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml( text_, true );
|
||||
Context.output_stream() << L"</" << textNode << L">";
|
||||
|
||||
if (add_del_run)
|
||||
@ -1209,10 +1217,21 @@ void sequence_ref::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
}
|
||||
void sequence_ref::add_text(const std::wstring & Text)
|
||||
{
|
||||
content_ = Text;
|
||||
text_ = text::create(Text) ;
|
||||
}
|
||||
void sequence_ref::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
std::wstring ref, sequence;
|
||||
if (!ref_name_) return;
|
||||
|
||||
Context.finish_run();
|
||||
Context.output_stream() << L"<w:fldSimple w:instr=\" REF " << *ref_name_ << L" \\h\">";
|
||||
Context.add_new_run();
|
||||
if (text_)
|
||||
text_->docx_convert(Context);
|
||||
Context.finish_run();
|
||||
|
||||
Context.output_stream() << L"</w:fldSimple>";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * sequence::ns = L"text";
|
||||
@ -1277,8 +1296,8 @@ void sequence::docx_convert(oox::docx_conversion_context & Context)
|
||||
num_format= L"ARABIC"; break;
|
||||
}
|
||||
}
|
||||
|
||||
Context.output_stream() << L"<w:fldSimple w:instr=\" SEQ " << sequence << L" \\* " << num_format << L" \">";
|
||||
Context.start_bookmark(*ref_name_);
|
||||
Context.output_stream() << L"<w:fldSimple w:instr=\" SEQ " << XmlUtils::EncodeXmlString(sequence) << L" \\* " << num_format << L" \">";
|
||||
Context.add_new_run();
|
||||
for (size_t i = 0; i < text_.size(); i++)
|
||||
{
|
||||
@ -1291,6 +1310,8 @@ void sequence::docx_convert(oox::docx_conversion_context & Context)
|
||||
// Context.end_bookmark(ref);
|
||||
//}
|
||||
Context.output_stream() << L"</w:fldSimple>";
|
||||
|
||||
Context.end_bookmark(*ref_name_);
|
||||
}
|
||||
void sequence::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
@ -1626,17 +1647,23 @@ void bibliography_mark::add_attributes( const xml::attributes_wc_ptr & Attribute
|
||||
CP_APPLY_ATTR(L"text:school", school_);
|
||||
CP_APPLY_ATTR(L"text:series", series_);
|
||||
CP_APPLY_ATTR(L"text:volume", volume_);
|
||||
|
||||
if (std::wstring::npos != identifier_.find(L"CITATION "))
|
||||
{
|
||||
XmlUtils::replace_all(identifier_, L"CITATION ", L"");
|
||||
}
|
||||
XmlUtils::replace_all(identifier_, L" ", L"");
|
||||
XmlUtils::replace_all(identifier_, L"\\", L"");
|
||||
}
|
||||
|
||||
void bibliography_mark::add_text(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
content_ = elm;
|
||||
text_ = text::create(Text) ;
|
||||
}
|
||||
|
||||
std::wostream & bibliography_mark::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_SERIALIZE_TEXT(content_);
|
||||
CP_SERIALIZE_TEXT(text_);
|
||||
return _Wostream;
|
||||
}
|
||||
void bibliography_mark::serialize(std::wostream & strm)
|
||||
@ -1805,6 +1832,20 @@ void bibliography_mark::docx_convert(oox::docx_conversion_context & Context)
|
||||
serialize(strm);
|
||||
|
||||
Context.add_bibliography_item(strm.str());
|
||||
|
||||
if (text_)
|
||||
{
|
||||
docx_serialize_field(L"CITATION " + XmlUtils::EncodeXmlString(identifier_), text_, Context, false);
|
||||
//Context.finish_run();
|
||||
//Context.output_stream() << L"<w:fldSimple w:instr=\" CITATION " << content_ << L" \\h\"/>";
|
||||
|
||||
//Context.add_new_run();
|
||||
// content_->docx_convert(Context);
|
||||
//Context.finish_run();
|
||||
|
||||
//Context.output_stream() << L"</w:fldSimple>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void bibliography_mark::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
@ -1846,12 +1887,22 @@ void alphabetical_index_mark::add_attributes( const xml::attributes_wc_ptr & Att
|
||||
}
|
||||
void alphabetical_index_mark::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!string_value_) return;
|
||||
std::wstring value;
|
||||
if (string_value_ && false == string_value_->empty())
|
||||
{
|
||||
if (*string_value_ != L" ")
|
||||
value = *string_value_;
|
||||
}
|
||||
if (value.empty() && key1_)
|
||||
{
|
||||
value = *key1_;
|
||||
}
|
||||
if (value.empty()) return;
|
||||
|
||||
Context.finish_run();
|
||||
|
||||
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
|
||||
Context.output_stream() << L"<w:r><w:instrText> XE \"" << *string_value_ << L"\"</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
|
||||
Context.output_stream() << L"<w:r><w:instrText> XE \"" << XmlUtils::EncodeXmlString(value) << L"\"</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// text:alphabetical-index-mark-start
|
||||
@ -1999,8 +2050,103 @@ void field_fieldmark_start::add_attributes( const xml::attributes_wc_ptr & Attri
|
||||
CP_APPLY_ATTR(L"text:name", text_name_);
|
||||
CP_APPLY_ATTR(L"field:type", field_type_);
|
||||
}
|
||||
void field_fieldmark_start::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!field_type_) return;
|
||||
if (!text_name_) return;
|
||||
|
||||
if (std::wstring::npos != field_type_->find(L"vnd.oasis.opendocument.field."))
|
||||
{
|
||||
Context.start_field(field_type_->substr(29), *text_name_);
|
||||
}
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * field_fieldmark_end::ns = L"field";
|
||||
const wchar_t * field_fieldmark_end::name = L"fieldmark-end";
|
||||
|
||||
void field_fieldmark_end::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.end_field();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * field_fieldmark::ns = L"field";
|
||||
const wchar_t * field_fieldmark::name = L"fieldmark";
|
||||
|
||||
void field_fieldmark::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"text:name", text_name_);
|
||||
CP_APPLY_ATTR(L"field:type", field_type_);
|
||||
}
|
||||
void field_fieldmark::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(field_params_);
|
||||
}
|
||||
void field_fieldmark::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!field_type_) return;
|
||||
if (!text_name_) return;
|
||||
|
||||
if (std::wstring::npos != field_type_->find(L"FORMCHECKBOX"))
|
||||
{
|
||||
XmlUtils::replace_all( *text_name_, L" ", L"_");
|
||||
|
||||
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"begin\"><w:ffData><w:name w:val=\"" << *text_name_ << L"\"/><w:enabled/>";
|
||||
Context.output_stream() << L"<w:checkBox>";
|
||||
//Context.output_stream() << L"<w:default w:val=\"" << std::to_wstring(current_state_) << L"\"/>
|
||||
Context.output_stream() << L"<w:sizeAuto/>";
|
||||
for (size_t i = 0; i < field_params_.size(); i++)
|
||||
{
|
||||
field_param *param = dynamic_cast<field_param*>(field_params_[i].get());
|
||||
if ((param) && (param->field_name_) && (std::wstring::npos != param->field_name_->find(L"Checkbox_Checked")))
|
||||
{
|
||||
odf_types::Bool value = Bool::parse(*param->field_value_);
|
||||
if (value.get())
|
||||
Context.output_stream() << L"<w:checked/>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
Context.output_stream() << L"</w:checkBox></w:ffData>";
|
||||
Context.output_stream() << L"</w:fldChar></w:r>";
|
||||
Context.output_stream() << L"<w:r><w:instrText>FORMCHECKBOX</w:instrText></w:r>";
|
||||
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
|
||||
Context.output_stream() << L"<w:r><w:t>" << L"" << L"</w:t></w:r>";
|
||||
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
|
||||
}
|
||||
else if (std::wstring::npos != field_type_->find(L"FORMDROPDOWN"))
|
||||
{
|
||||
std::wostream & strm = Context.output_stream();
|
||||
Context.finish_run();
|
||||
|
||||
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"><w:ffData><w:name w:val=\"" << text_name_.get_value_or(L"") << L"\"/><w:enabled/>";
|
||||
|
||||
strm << L"<w:ddList><w:result w:val=\"0\"/>";
|
||||
for (size_t i = 0; i < field_params_.size(); i++)
|
||||
{
|
||||
field_params_[i]->docx_convert(Context);
|
||||
}
|
||||
strm << L"</w:ddList></w:ffData>";
|
||||
|
||||
strm << L"</w:fldChar></w:r>";
|
||||
strm << L"<w:r><w:instrText>FORMDROPDOWN</w:instrText></w:r>";
|
||||
strm << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
|
||||
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
|
||||
}
|
||||
else if (std::wstring::npos != field_type_->find(L"FORMTEXT"))
|
||||
{
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * field_param::ns = L"field";
|
||||
const wchar_t * field_param::name = L"param";
|
||||
|
||||
void field_param::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"field:name", field_name_);
|
||||
CP_APPLY_ATTR(L"field:value", field_value_);
|
||||
}
|
||||
void field_param::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public:
|
||||
|
||||
bool preserve_;
|
||||
|
||||
text(const std::wstring & Text) : text_(Text) {preserve_ = true;};
|
||||
text(const std::wstring & Text);
|
||||
text() {preserve_ = true;};
|
||||
|
||||
std::wstring text_;
|
||||
@ -891,7 +891,7 @@ public:
|
||||
_CP_OPT(std::wstring) reference_format_;//caption, category-and-value, value, chapter, direction, page, text, number, number-all-superior, number-no-superior
|
||||
_CP_OPT(std::wstring) ref_name_;
|
||||
|
||||
std::wstring content_;
|
||||
office_element_ptr text_;
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
@ -1295,7 +1295,7 @@ public:
|
||||
_CP_OPT(std::wstring) series_;
|
||||
_CP_OPT(std::wstring) volume_;
|
||||
|
||||
office_element_ptr content_;
|
||||
office_element_ptr text_;
|
||||
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
@ -1585,11 +1585,13 @@ public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTextFieldFieldmarkStart;
|
||||
static const ElementType type = typeFieldFieldmarkStart;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
_CP_OPT(std::wstring) text_name_;
|
||||
_CP_OPT(std::wstring) field_type_;
|
||||
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
|
||||
@ -1605,14 +1607,60 @@ public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTextFieldFieldmarkStart;
|
||||
static const ElementType type = typeFieldFieldmarkStart;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(field_fieldmark_end);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// field:fieldmark
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class field_fieldmark : public text::paragraph_content_element<field_fieldmark>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFieldFieldmark;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
_CP_OPT(std::wstring) text_name_;
|
||||
_CP_OPT(std::wstring) field_type_;
|
||||
|
||||
office_element_ptr_array field_params_;
|
||||
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(field_fieldmark);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// field:param
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class field_param : public text::paragraph_content_element<field_param>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFieldParam;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
_CP_OPT(std::wstring) field_name_;
|
||||
_CP_OPT(std::wstring) field_value_;
|
||||
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(field_param);
|
||||
} // namespace odf_reader
|
||||
} // namespace cpdoccore
|
||||
|
||||
@ -207,29 +207,45 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
|
||||
{
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
double page_width = 0;
|
||||
|
||||
const page_layout_instance * pp = Context.root()->odf_context().pageLayoutContainer().page_layout_first();
|
||||
if ((pp) && (pp->properties()))
|
||||
{
|
||||
style_page_layout_properties_attlist & attr_page = pp->properties()->attlist_;
|
||||
if (attr_page.fo_page_width_)
|
||||
{
|
||||
page_width = attr_page.fo_page_width_->get_value_unit(odf_types::length::pt);
|
||||
}
|
||||
if (attr_page.common_horizontal_margin_attlist_.fo_margin_left_)
|
||||
{
|
||||
page_width -= attr_page.common_horizontal_margin_attlist_.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt);
|
||||
}
|
||||
if (attr_page.common_horizontal_margin_attlist_.fo_margin_right_)
|
||||
{
|
||||
page_width -= attr_page.common_horizontal_margin_attlist_.fo_margin_right_->get_length().get_value_unit(odf_types::length::pt);
|
||||
}
|
||||
}
|
||||
if (attlist_.style_column_width_)
|
||||
{
|
||||
double kf_max_width_ms = 1.;
|
||||
|
||||
const page_layout_instance * pp = Context.root()->odf_context().pageLayoutContainer().page_layout_first();//
|
||||
if ((pp) && (pp->properties()))
|
||||
{
|
||||
style_page_layout_properties_attlist & attr_page = pp->properties()->attlist_;
|
||||
if (attr_page.fo_page_width_)
|
||||
{
|
||||
int val = 0.5 + 20.0 * attr_page.fo_page_width_->get_value_unit(length::pt);
|
||||
if (val > 31680.)
|
||||
kf_max_width_ms = 31680./val;
|
||||
}
|
||||
}
|
||||
int val = 0.5 + 20.0 * page_width;
|
||||
if (val > 31680.)
|
||||
kf_max_width_ms = 31680./val;
|
||||
|
||||
int val = attlist_.style_column_width_->get_value_unit(length::pt);
|
||||
|
||||
double width = 0.5 + 20.0 * val * kf_max_width_ms;
|
||||
double width = 0.5 + 20.0 * attlist_.style_column_width_->get_value_unit(length::pt) * kf_max_width_ms;
|
||||
|
||||
Context.get_table_context().add_column_width(width);
|
||||
strm << L"<w:gridCol w:w=\"" << (int)(width) << "\"/>";
|
||||
}
|
||||
else if ((attlist_.style_rel_column_width_) && (attlist_.style_rel_column_width_->get_unit() == length::rel))
|
||||
{
|
||||
double width = 0.5 + 20.0 * page_width * attlist_.style_rel_column_width_->get_value() / 65534.;
|
||||
|
||||
Context.get_table_context().add_column_width(width);
|
||||
strm << L"<w:gridCol w:w=\"" << (int)(width) << "\"/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.get_table_context().add_column_width(0);
|
||||
|
||||
@ -244,6 +244,8 @@ public:
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
style_table_cell_properties() {}
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
private:
|
||||
|
||||
@ -365,6 +365,7 @@ void text_format_properties_content::drawing_serialize(std::wostream & strm, std
|
||||
CP_XML_ATTR(L"cap", "small");
|
||||
}
|
||||
}
|
||||
std::wstring underline = L"";
|
||||
if (fo_text_transform_)
|
||||
{
|
||||
if (fo_text_transform_->get_type() == text_transform::Uppercase)
|
||||
@ -375,6 +376,10 @@ void text_format_properties_content::drawing_serialize(std::wostream & strm, std
|
||||
{
|
||||
CP_XML_ATTR(L"cap", "small");
|
||||
}
|
||||
else if (fo_text_transform_->get_type() == text_transform::Underline)
|
||||
{
|
||||
underline = L"sng";
|
||||
}
|
||||
}
|
||||
const int W = process_font_weight(fo_font_weight_);
|
||||
if (W > 0) CP_XML_ATTR(L"b", true);
|
||||
@ -382,9 +387,7 @@ void text_format_properties_content::drawing_serialize(std::wostream & strm, std
|
||||
// underline
|
||||
line_width under = style_text_underline_width_.get_value_or(line_width::Auto);
|
||||
bool underlineBold = under.get_type() == line_width::Bold ||
|
||||
under.get_type() == line_width::Thick;
|
||||
|
||||
std::wstring underline = L"";
|
||||
under.get_type() == line_width::Thick;
|
||||
|
||||
if ((style_text_underline_type_ && style_text_underline_type_->get_type() == line_type::None) ||
|
||||
(style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::None))
|
||||
|
||||
@ -176,9 +176,12 @@ style_section_properties * style_content::get_style_section_properties() const
|
||||
return dynamic_cast<style_section_properties *>(style_section_properties_.get());
|
||||
}
|
||||
|
||||
style_table_cell_properties * style_content::get_style_table_cell_properties() const
|
||||
style_table_cell_properties * style_content::get_style_table_cell_properties(bool always)
|
||||
{
|
||||
return dynamic_cast<style_table_cell_properties *>(style_table_cell_properties_.get());
|
||||
if (!style_table_cell_properties_ && always)
|
||||
style_table_cell_properties_ = boost::make_shared<style_table_cell_properties>();
|
||||
|
||||
return dynamic_cast<style_table_cell_properties *>(style_table_cell_properties_.get());
|
||||
}
|
||||
|
||||
style_table_row_properties * style_content::get_style_table_row_properties() const
|
||||
|
||||
@ -96,11 +96,11 @@ public:
|
||||
style_paragraph_properties * get_style_paragraph_properties() const;
|
||||
style_table_properties * get_style_table_properties() const;
|
||||
style_section_properties * get_style_section_properties() const;
|
||||
style_table_cell_properties * get_style_table_cell_properties() const;
|
||||
style_table_row_properties * get_style_table_row_properties() const;
|
||||
style_table_column_properties * get_style_table_column_properties() const;
|
||||
style_chart_properties * get_style_chart_properties() const;
|
||||
style_drawing_page_properties* get_style_drawing_page_properties() const;
|
||||
style_table_cell_properties * get_style_table_cell_properties (bool always =false);
|
||||
|
||||
private:
|
||||
odf_types::style_family style_family_;
|
||||
|
||||
@ -142,7 +142,9 @@ const wchar_t * table_table::name = L"table";
|
||||
|
||||
void table_table::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
table_table_attlist_.add_attributes(Attributes);
|
||||
CP_APPLY_ATTR(L"table:style-name", element_style_name);
|
||||
|
||||
table_table_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -379,6 +381,9 @@ bool table_table_cell::empty()
|
||||
{
|
||||
if (!content_.elements_.empty()) return false;
|
||||
if (attlist_.table_formula_) return false;
|
||||
|
||||
if (attlist_extra_.table_number_columns_spanned_ > 1) return false;
|
||||
if (attlist_extra_.table_number_rows_spanned_ > 1) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -69,15 +69,32 @@ void table_table_row::docx_convert(oox::docx_conversion_context & Context)
|
||||
const std::wstring styleName = attlist_.table_style_name_.get_value_or(L"");
|
||||
const std::wstring defaultCellStyle = attlist_.table_default_cell_style_name_.get_value_or(L"");
|
||||
|
||||
const style_instance * inst =
|
||||
Context.root()->odf_context().styleContainer().style_by_name( styleName , style_family::TableRow,Context.process_headers_footers_);
|
||||
|
||||
style_table_cell_properties* cell_props = NULL;
|
||||
style_table_row_properties* row_props = NULL;
|
||||
if (inst && inst->content())
|
||||
{
|
||||
cell_props = inst->content()->get_style_table_cell_properties(true);
|
||||
row_props = inst->content()->get_style_table_row_properties();
|
||||
|
||||
if ((row_props) && (row_props->attlist_.common_background_color_attlist_.fo_background_color_))
|
||||
{
|
||||
if (!cell_props->attlist_.common_background_color_attlist_.fo_background_color_)
|
||||
cell_props->attlist_.common_background_color_attlist_.fo_background_color_ = row_props->attlist_.common_background_color_attlist_.fo_background_color_;
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < attlist_.table_number_rows_repeated_; ++i)
|
||||
{
|
||||
_Wostream << L"<w:tr>";
|
||||
const style_instance * inst =
|
||||
Context.root()->odf_context().styleContainer().style_by_name( styleName , style_family::TableRow,Context.process_headers_footers_);
|
||||
|
||||
_Wostream << L"<w:trPr>";
|
||||
_Wostream << L"<w:cantSplit w:val=\"false\" />";
|
||||
if (inst && inst->content())inst->content()->docx_convert(Context);
|
||||
|
||||
if (cell_props)
|
||||
cell_props->docx_convert(Context);
|
||||
|
||||
_Wostream << L"</w:trPr>";
|
||||
|
||||
Context.get_table_context().start_row(styleName, defaultCellStyle);
|
||||
@ -144,6 +161,16 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
std::wostream & _Wostream = Context.output_stream();
|
||||
|
||||
std::wstring sDumpPageProperties;
|
||||
if (false == Context.get_paragraph_state())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
if (Context.process_page_properties(strm))
|
||||
{
|
||||
sDumpPageProperties = strm.str();
|
||||
}
|
||||
}
|
||||
|
||||
bool sub_table = table_table_attlist_.table_is_sub_table_.get_value_or(false);
|
||||
//todooo придумать как сделать внешние границы sub-таблицы границами внешней ячейки (чтоб слияние произошло)
|
||||
|
||||
@ -173,6 +200,15 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.get_table_context().end_table();
|
||||
_Wostream << L"</w:tbl>";
|
||||
|
||||
if (false == sDumpPageProperties.empty())
|
||||
{
|
||||
Context.output_stream() << L"<w:p>";
|
||||
Context.output_stream() << L"<w:pPr>";
|
||||
Context.output_stream() << sDumpPageProperties;
|
||||
Context.output_stream() << L"</w:pPr>";
|
||||
Context.output_stream() << L"</w:p>";
|
||||
}
|
||||
}
|
||||
|
||||
void table_columns::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -285,28 +321,45 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
|
||||
);
|
||||
}
|
||||
|
||||
if (attlist_extra_.table_number_columns_spanned_ > 1)
|
||||
{
|
||||
_Wostream << L"<w:gridSpan w:val=\"" << attlist_extra_.table_number_columns_spanned_ << "\"/>";
|
||||
Context.get_table_context().set_columns_spanned(attlist_extra_.table_number_columns_spanned_ - 1);
|
||||
}
|
||||
double width = Context.get_table_context().get_current_cell_width();
|
||||
|
||||
|
||||
if (width > 0.01)
|
||||
{
|
||||
_Wostream << L"<w:tcW w:w=\"" << (int)width << L"\" w:type=\"dxa\"/>";
|
||||
}
|
||||
|
||||
if (attlist_extra_.table_number_columns_spanned_ > 1)
|
||||
{
|
||||
_Wostream << L"<w:gridSpan w:val=\"" << attlist_extra_.table_number_columns_spanned_ << "\"/>";
|
||||
Context.get_table_context().set_columns_spanned(attlist_extra_.table_number_columns_spanned_ - 1);
|
||||
}
|
||||
|
||||
|
||||
const style_instance * inst =
|
||||
Context.root()->odf_context().styleContainer().style_by_name( styleName , style_family::TableCell,Context.process_headers_footers_);
|
||||
Context.root()->odf_context().styleContainer().style_by_name( styleName , style_family::TableCell, Context.process_headers_footers_);
|
||||
|
||||
if (inst && inst->content())
|
||||
{
|
||||
if (inst->content()->get_style_table_cell_properties())
|
||||
{
|
||||
inst->content()->get_style_table_cell_properties()->docx_convert(Context);
|
||||
}
|
||||
const std::wstring & currentRowStyle = Context.get_table_context().current_row_style();
|
||||
|
||||
const style_instance * inst_row =
|
||||
Context.root()->odf_context().styleContainer().style_by_name(currentRowStyle, style_family::TableRow, Context.process_headers_footers_);
|
||||
|
||||
style_table_cell_properties *row_cell_props = NULL;
|
||||
if (inst_row && inst_row->content())
|
||||
{
|
||||
row_cell_props = inst_row->content()->get_style_table_cell_properties();
|
||||
}
|
||||
if (inst && inst->content())
|
||||
{
|
||||
style_table_cell_properties merge_cell_props;
|
||||
|
||||
style_table_cell_properties * cell_props = inst->content()->get_style_table_cell_properties();
|
||||
|
||||
if (row_cell_props)
|
||||
merge_cell_props.attlist_.apply_from(row_cell_props->attlist_);
|
||||
if (cell_props)
|
||||
merge_cell_props.attlist_.apply_from(cell_props->attlist_);
|
||||
|
||||
merge_cell_props.docx_convert(Context);
|
||||
|
||||
if (inst->content()->get_style_text_properties())
|
||||
{
|
||||
@ -322,7 +375,7 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_table_context().get_default_cell_style_col(Context.get_table_context().current_column());
|
||||
|
||||
if (const style_instance * inst =
|
||||
Context.root()->odf_context().styleContainer().style_by_name(defaultCellStyle, style_family::TableCell,Context.process_headers_footers_))
|
||||
Context.root()->odf_context().styleContainer().style_by_name(defaultCellStyle, style_family::TableCell, Context.process_headers_footers_))
|
||||
{
|
||||
if (const style_content * content = inst->content())
|
||||
{
|
||||
@ -340,7 +393,7 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
|
||||
const std::wstring & defaultCellStyle = Context.get_table_context().get_default_cell_style_row();
|
||||
|
||||
if (const style_instance * inst =
|
||||
Context.root()->odf_context().styleContainer().style_by_name(defaultCellStyle, style_family::TableCell,Context.process_headers_footers_))
|
||||
Context.root()->odf_context().styleContainer().style_by_name(defaultCellStyle, style_family::TableCell, Context.process_headers_footers_))
|
||||
{
|
||||
if (const style_content * content = inst->content())
|
||||
{
|
||||
|
||||
@ -835,7 +835,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
const int sharedStringId = content_.xlsx_convert(Context, &textFormatProperties);
|
||||
|
||||
if (t_val == oox::XlsxCellType::str && sharedStringId >=0)
|
||||
if (t_val == oox::XlsxCellType::str && sharedStringId >= 0)
|
||||
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
|
||||
|
||||
if (skip_next_cell)break;
|
||||
@ -846,7 +846,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
std::wstring ref = oox::getCellAddress(Context.current_table_column(), Context.current_table_row());
|
||||
if (attlist_.table_content_validation_name_)
|
||||
{
|
||||
Context.get_dataValidations_context().activate(*attlist_.table_content_validation_name_, ref);
|
||||
Context.get_dataValidations_context().activate(*attlist_.table_content_validation_name_, /*ref*/Context.current_table_column(), Context.current_table_row());
|
||||
}
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -1087,7 +1087,7 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
|
||||
is_style_visible = (!cellStyleName.empty() || defaultColumnCellStyle) ? true : false;
|
||||
|
||||
if ( content_.elements_.size() > 0 ||
|
||||
if ( content_.elements_.size() > 0 || attlist_.table_content_validation_name_ ||
|
||||
!formula.empty() ||
|
||||
( t_val == oox::XlsxCellType::n && !number_val.empty()) ||
|
||||
( t_val == oox::XlsxCellType::b && bool_val) ||
|
||||
@ -1111,6 +1111,10 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
{
|
||||
Context.start_table_covered_cell ();
|
||||
|
||||
if (attlist_.table_content_validation_name_)
|
||||
{
|
||||
Context.get_dataValidations_context().activate(*attlist_.table_content_validation_name_, /*ref*/Context.current_table_column(), Context.current_table_row());
|
||||
}
|
||||
if (is_style_visible)
|
||||
Context.set_current_cell_style_id(xfId_last_set);
|
||||
|
||||
|
||||
@ -71,12 +71,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
template <class ElementT>
|
||||
class text_content_impl : public office_element_impl<ElementT>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,35 +161,6 @@ void paragraph::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
void paragraph::afterCreate(document_context * Context)
|
||||
{
|
||||
// вызывается сразу после создания объекта
|
||||
if (Context)
|
||||
{
|
||||
Context->level++;
|
||||
// выставляем у предыдущего параграфа указатель на следующий (т.е. на вновь созданный)
|
||||
|
||||
if (Context->level == 1)
|
||||
{
|
||||
if (paragraph * prevPar = Context->get_last_paragraph())
|
||||
{
|
||||
prevPar->set_next(this);
|
||||
}
|
||||
|
||||
// запоминаем в контексте вновь созданный параграф
|
||||
Context->set_last_paragraph(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
void paragraph::afterReadContent(document_context * Context)
|
||||
{
|
||||
if (Context)
|
||||
{
|
||||
Context->level--;
|
||||
}
|
||||
}
|
||||
|
||||
const wchar_t * emptyParagraphContent = L"<w:pPr></w:pPr><w:r><w:rPr></w:rPr></w:r>";
|
||||
|
||||
const wchar_t * emptyParagraphDrawing = L"<w:p><w:pPr></w:pPr></w:p>";
|
||||
@ -315,30 +286,22 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
if (masterPageName)
|
||||
{
|
||||
Context.set_master_page_name(*masterPageName);
|
||||
|
||||
const std::wstring masterPageNameLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_name_by_style(*masterPageName);
|
||||
|
||||
Context.remove_page_properties();
|
||||
Context.add_page_properties(masterPageNameLayout);
|
||||
|
||||
is_empty = false;
|
||||
}
|
||||
|
||||
if (next_par_)
|
||||
if (next_element_style_name)
|
||||
{
|
||||
// проверяем не сменит ли следующий параграф свойства страницы.
|
||||
// если да — устанавливаем контексту флаг на то что необходимо в текущем параграфе
|
||||
// распечатать свойства раздела/секции
|
||||
//проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_;
|
||||
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(next_styleName);
|
||||
// проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
// dump был выше уровнем
|
||||
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(*next_element_style_name);
|
||||
|
||||
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
|
||||
{
|
||||
if (false == Context.root()->odf_context().pageLayoutContainer().compare_page_properties(Context.get_master_page_name(), *next_masterPageName))
|
||||
{
|
||||
Context.next_dump_page_properties(true);
|
||||
is_empty = false;
|
||||
}
|
||||
}
|
||||
@ -473,7 +436,9 @@ std::wostream & h::text_to_stream(std::wostream & _Wostream) const
|
||||
|
||||
void h::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"text:outline-level" , outline_level_);
|
||||
CP_APPLY_ATTR(L"text:style-name", element_style_name);
|
||||
|
||||
CP_APPLY_ATTR(L"text:outline-level" , outline_level_);
|
||||
CP_APPLY_ATTR(L"text:restart-numbering" , restart_numbering_);
|
||||
CP_APPLY_ATTR(L"text:start-value" , start_value_);
|
||||
CP_APPLY_ATTR(L"text:is-list-header" , is_list_header_);
|
||||
@ -494,14 +459,12 @@ void h::add_text(const std::wstring & Text)
|
||||
paragraph_.add_text(Text);
|
||||
}
|
||||
|
||||
void h::afterCreate()
|
||||
{
|
||||
paragraph_.afterCreate( getContext() );
|
||||
}
|
||||
void h::afterReadContent()
|
||||
{
|
||||
paragraph_.afterReadContent( getContext() );
|
||||
office_element::afterReadContent();
|
||||
paragraph_.next_element_style_name = next_element_style_name;
|
||||
}
|
||||
|
||||
void h::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
paragraph_.docx_convert(Context);
|
||||
@ -520,14 +483,6 @@ void h::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
const wchar_t * p::ns = L"text";
|
||||
const wchar_t * p::name = L"p";
|
||||
|
||||
void p::afterCreate()
|
||||
{
|
||||
paragraph_.afterCreate( getContext() );
|
||||
}
|
||||
void p::afterReadContent()
|
||||
{
|
||||
paragraph_.afterReadContent( getContext() );
|
||||
}
|
||||
std::wostream & p::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
return paragraph_.text_to_stream(_Wostream);
|
||||
@ -535,6 +490,8 @@ std::wostream & p::text_to_stream(std::wostream & _Wostream) const
|
||||
|
||||
void p::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"text:style-name", element_style_name);
|
||||
|
||||
paragraph_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
@ -562,6 +519,11 @@ void p::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
paragraph_.pptx_convert(Context);
|
||||
}
|
||||
void p::afterReadContent()
|
||||
{
|
||||
office_element::afterReadContent();
|
||||
paragraph_.next_element_style_name = next_element_style_name;
|
||||
}
|
||||
// text:list
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * list::ns = L"text";
|
||||
@ -661,24 +623,35 @@ std::wostream & section::text_to_stream(std::wostream & _Wostream) const
|
||||
|
||||
void section::afterCreate()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
office_element::afterCreate();
|
||||
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_section(true);
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void section::afterReadContent()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_end_section(true);
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
}
|
||||
office_element::afterReadContent();
|
||||
}
|
||||
|
||||
void section::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
@ -715,7 +688,44 @@ void section::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
if (content_[i]->element_style_name)
|
||||
{
|
||||
std::wstring text___ = *content_[i]->element_style_name;
|
||||
|
||||
const _CP_OPT(std::wstring) masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(*content_[i]->element_style_name);
|
||||
|
||||
if (masterPageName)
|
||||
{
|
||||
std::wstring masterPageNameLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_name_by_style(*masterPageName);
|
||||
|
||||
if (false == masterPageNameLayout.empty())
|
||||
{
|
||||
Context.set_master_page_name(*masterPageName); //проверка на то что тема действительно существует????
|
||||
|
||||
Context.remove_page_properties();
|
||||
Context.add_page_properties(masterPageNameLayout);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (content_[i]->next_element_style_name)
|
||||
{
|
||||
std::wstring text___ = *content_[i]->next_element_style_name;
|
||||
// проверяем не сменится ли свойства страницы.
|
||||
// если да — устанавливаем контексту флаг на то что необходимо в текущем параграфе
|
||||
// распечатать свойства раздела/секции
|
||||
//проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(*content_[i]->next_element_style_name);
|
||||
|
||||
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
|
||||
{
|
||||
if (false == Context.root()->odf_context().pageLayoutContainer().compare_page_properties(Context.get_master_page_name(), *next_masterPageName))
|
||||
{
|
||||
Context.next_dump_page_properties(true);
|
||||
//is_empty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -870,6 +880,11 @@ void table_of_content::add_child_element( xml::sax * Reader, const std::wstring
|
||||
}
|
||||
void table_of_content::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
std::wstring current_page_properties = Context.get_page_properties();
|
||||
|
||||
Context.get_section_context().add_section (section_attr_.name_, section_attr_.style_name_.get_value_or(L""), current_page_properties);
|
||||
|
||||
Context.add_page_properties(current_page_properties);
|
||||
if (index_body_)
|
||||
{
|
||||
Context.start_sdt(1);
|
||||
@ -1076,11 +1091,17 @@ const wchar_t * illustration_index::name = L"illustration-index";
|
||||
|
||||
void illustration_index::afterCreate()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
office_element::afterCreate();
|
||||
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_section(true);
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1089,11 +1110,16 @@ void illustration_index::afterReadContent()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_end_section(true);
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
}
|
||||
office_element::afterReadContent();
|
||||
}
|
||||
void illustration_index::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1219,11 +1245,17 @@ void alphabetical_index::add_child_element( xml::sax * Reader, const std::wstrin
|
||||
}
|
||||
void alphabetical_index::afterCreate()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
office_element::afterCreate();
|
||||
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_section(true);
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1231,11 +1263,16 @@ void alphabetical_index::afterReadContent()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_end_section(true);
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
}
|
||||
office_element::afterReadContent();
|
||||
}
|
||||
void alphabetical_index::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1273,7 +1310,9 @@ const wchar_t * alphabetical_index_source::name = L"alphabetical-index-source";
|
||||
|
||||
void alphabetical_index_source::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"text:index-scope", index_scope_); // chapter or document
|
||||
CP_APPLY_ATTR(L"text:index-scope", index_scope_); // chapter or document
|
||||
CP_APPLY_ATTR(L"text:alphabetical-separators", alphabetical_separators_);
|
||||
CP_APPLY_ATTR(L"text:ignore-case", ignore_case_);
|
||||
|
||||
}
|
||||
void alphabetical_index_source::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -1286,6 +1325,11 @@ void alphabetical_index_source::add_child_element( xml::sax * Reader, const std:
|
||||
}
|
||||
void alphabetical_index_source::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (alphabetical_separators_)
|
||||
{
|
||||
Context.get_table_content_context().bSeparators = alphabetical_separators_->get();
|
||||
}
|
||||
|
||||
Context.get_table_content_context().start_template(5);
|
||||
for (size_t i = 0; i < entry_templates_.size(); i++)
|
||||
{
|
||||
@ -1317,11 +1361,17 @@ const wchar_t * object_index::name = L"object-index";
|
||||
|
||||
void object_index::afterCreate()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
office_element::afterCreate();
|
||||
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_section(true);
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1329,11 +1379,16 @@ void object_index::afterReadContent()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_end_section(true);
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
}
|
||||
office_element::afterReadContent();
|
||||
}
|
||||
void object_index::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1419,11 +1474,17 @@ const wchar_t * user_index::name = L"user-index";
|
||||
|
||||
void user_index::afterCreate()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
office_element::afterCreate();
|
||||
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_section(true);
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1431,11 +1492,16 @@ void user_index::afterReadContent()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_end_section(true);
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
}
|
||||
office_element::afterReadContent();
|
||||
}
|
||||
void user_index::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1560,11 +1626,17 @@ const wchar_t * bibliography::name = L"bibliography";
|
||||
|
||||
void bibliography::afterCreate()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
office_element::afterCreate();
|
||||
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_section(true);
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_section(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1573,11 +1645,16 @@ void bibliography::afterReadContent()
|
||||
{
|
||||
if (document_context * context = getContext())
|
||||
{
|
||||
if (paragraph * lastPar = context->get_last_paragraph())
|
||||
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->set_next_end_section(true);
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
|
||||
{
|
||||
lastPar->paragraph_.set_next_end_section(true);
|
||||
}
|
||||
}
|
||||
office_element::afterReadContent();
|
||||
}
|
||||
void bibliography::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -51,7 +51,7 @@ namespace text {
|
||||
class paragraph
|
||||
{
|
||||
public:
|
||||
paragraph() : next_par_(NULL), next_section_(false), next_end_section_(false), is_header_(false) {}
|
||||
paragraph() : next_section_(false), next_end_section_(false), is_header_(false) {}
|
||||
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
@ -59,9 +59,8 @@ public:
|
||||
void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
|
||||
void add_text (const std::wstring & Text);
|
||||
|
||||
paragraph * get_next() { return next_par_; }
|
||||
void set_next(paragraph * next) {next_par_ = next;}
|
||||
|
||||
_CP_OPT(std::wstring) next_element_style_name; //for master page
|
||||
|
||||
void set_next_section(bool Val)
|
||||
{
|
||||
next_section_ = Val;
|
||||
@ -71,9 +70,6 @@ public:
|
||||
{
|
||||
next_end_section_ = Val;
|
||||
}
|
||||
|
||||
void afterCreate(document_context * ctx);
|
||||
void afterReadContent(document_context * ctx);
|
||||
|
||||
void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
void xlsx_convert (oox::xlsx_conversion_context & Context) ;
|
||||
@ -88,21 +84,18 @@ private:
|
||||
|
||||
paragraph_attrs attrs_;
|
||||
|
||||
paragraph *next_par_;
|
||||
|
||||
bool next_section_;
|
||||
bool next_end_section_;
|
||||
|
||||
bool is_header_;
|
||||
|
||||
friend class par_docx_convert_class;
|
||||
friend class p;
|
||||
friend class h;
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class h : public text_content_impl<h>
|
||||
class h : public office_element_impl<h>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -115,9 +108,8 @@ public:
|
||||
void xlsx_convert(oox::xlsx_conversion_context & Context) ;
|
||||
void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
virtual void afterCreate();
|
||||
virtual void afterReadContent();
|
||||
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
paragraph paragraph_;
|
||||
@ -134,14 +126,12 @@ private:
|
||||
_CP_OPT(bool) is_list_header_;
|
||||
_CP_OPT(std::wstring) number_;
|
||||
|
||||
friend class par_docx_convert_class;
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(h);
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class p : public text_content_impl<p>
|
||||
class p : public office_element_impl<p>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -154,7 +144,6 @@ public:
|
||||
void xlsx_convert(oox::xlsx_conversion_context & Context) ;
|
||||
void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
virtual void afterCreate();
|
||||
virtual void afterReadContent();
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
@ -167,12 +156,11 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
friend class par_docx_convert_class;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(p);
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class list : public text_content_impl<list>
|
||||
class list : public office_element_impl<list>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -203,7 +191,7 @@ private:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(list);
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class soft_page_break : public text_content_impl<soft_page_break>
|
||||
class soft_page_break : public office_element_impl<soft_page_break>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -223,7 +211,7 @@ private:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(soft_page_break);
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class section : public text_content_impl<section>
|
||||
class section : public office_element_impl<section>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -265,7 +253,7 @@ private:
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class section_source : public text_content_impl<section_source>
|
||||
class section_source : public office_element_impl<section_source>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -305,7 +293,7 @@ public:
|
||||
};
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
|
||||
class table_of_content : public text_content_impl<table_of_content>
|
||||
class table_of_content : public office_element_impl<table_of_content>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -335,7 +323,7 @@ CP_REGISTER_OFFICE_ELEMENT2(table_of_content);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
// text:table-index
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class table_index : public text_content_impl<table_index>
|
||||
class table_index : public office_element_impl<table_index>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -364,7 +352,7 @@ CP_REGISTER_OFFICE_ELEMENT2(table_index);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
// text:illustration-index
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class illustration_index : public text_content_impl<illustration_index>
|
||||
class illustration_index : public office_element_impl<illustration_index>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -396,7 +384,7 @@ CP_REGISTER_OFFICE_ELEMENT2(illustration_index);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
// text:alphabetical-index
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class alphabetical_index : public text_content_impl<alphabetical_index>
|
||||
class alphabetical_index : public office_element_impl<alphabetical_index>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -428,7 +416,7 @@ CP_REGISTER_OFFICE_ELEMENT2(alphabetical_index);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
// text:object-index
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class object_index : public text_content_impl<object_index>
|
||||
class object_index : public office_element_impl<object_index>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -460,7 +448,7 @@ CP_REGISTER_OFFICE_ELEMENT2(object_index);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
// text:user-index
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class user_index : public text_content_impl<user_index>
|
||||
class user_index : public office_element_impl<user_index>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -492,7 +480,7 @@ CP_REGISTER_OFFICE_ELEMENT2(user_index);
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
// text:bibliography
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
class bibliography : public text_content_impl<bibliography>
|
||||
class bibliography : public office_element_impl<bibliography>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -565,7 +553,7 @@ CP_REGISTER_OFFICE_ELEMENT2(bibliography_entry_template);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:index-body
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class index_body : public text_content_impl<index_body>
|
||||
class index_body : public office_element_impl<index_body>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -588,7 +576,7 @@ private:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(index_body);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class index_title : public text_content_impl<index_title>
|
||||
class index_title : public office_element_impl<index_title>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -613,7 +601,7 @@ public:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(index_title);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class index_title_template : public text_content_impl<index_title_template>
|
||||
class index_title_template : public office_element_impl<index_title_template>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1283,7 +1271,9 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
_CP_OPT(std::wstring) index_scope_; // chapter or document:
|
||||
_CP_OPT(std::wstring) index_scope_; // chapter or document:
|
||||
_CP_OPT(odf_types::Bool) alphabetical_separators_;
|
||||
_CP_OPT(odf_types::Bool) ignore_case_;
|
||||
|
||||
//fo:country
|
||||
//fo:language
|
||||
@ -1295,7 +1285,6 @@ private:
|
||||
//text:combine-entries-with-dash
|
||||
//text:combine-entries-with-pp
|
||||
//text:comma-separated
|
||||
//text:ignore-case
|
||||
//text:main-entry-style-name
|
||||
//text:relative-tab-stop-position
|
||||
//text:sort-algorithm
|
||||
|
||||
@ -34,8 +34,6 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "../../include/xml/attributes.h"
|
||||
#include "../../include/xml/sax.h"
|
||||
|
||||
|
||||
@ -96,9 +96,9 @@ std::string replace_xml_to_text_ImplRegEx(const std::string & Text)
|
||||
return boost::regex_replace(Text, replace_xml_to_text_expr, replace_xml_to_text_fmt, boost::match_default | boost::format_all);
|
||||
}
|
||||
|
||||
std::wstring replace_text_to_xml_ImplReplace(const std::wstring & Text)
|
||||
std::wstring replace_text_to_xml_ImplReplace(const std::wstring & Text, bool dDeleteUnicode)
|
||||
{
|
||||
return XmlUtils::EncodeXmlString(Text);
|
||||
return XmlUtils::EncodeXmlString(Text, dDeleteUnicode);
|
||||
}
|
||||
|
||||
std::string replace_text_to_xml_ImplReplace(const std::string & Text)
|
||||
@ -164,9 +164,9 @@ std::wstring replace_amp_text_to_xml(const std::wstring & Text)
|
||||
{
|
||||
return details::replace_amp_text_to_xml_ImplReplace(Text);
|
||||
}
|
||||
std::wstring replace_text_to_xml(const std::wstring & Text)
|
||||
std::wstring replace_text_to_xml(const std::wstring & Text, bool dDeleteUnicode)
|
||||
{
|
||||
return details::replace_text_to_xml_ImplReplace(Text);
|
||||
return details::replace_text_to_xml_ImplReplace(Text, dDeleteUnicode);
|
||||
}
|
||||
|
||||
std::string replace_text_to_xml(const std::string & Text)
|
||||
|
||||
@ -1519,6 +1519,10 @@
|
||||
RelativePath="..\src\odf\odf_document_impl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\odf\odf_elements_type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\odfcontext.cpp"
|
||||
>
|
||||
@ -1571,10 +1575,6 @@
|
||||
RelativePath="..\src\odf\office_elements.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\office_elements_type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\office_event_listeners.cpp"
|
||||
>
|
||||
|
||||
@ -52,11 +52,13 @@ namespace odf_writer
|
||||
{
|
||||
if (utf8_)
|
||||
{
|
||||
utf8::utf16to8(Content.begin(), Content.end(), std::back_inserter(content_utf8_));
|
||||
content_utf8_ = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(Content);
|
||||
}else
|
||||
content_utf8_ = std::string( Content.begin(), Content.end());
|
||||
}
|
||||
|
||||
simple_element::simple_element(const std::wstring & FileName, const std::string & Content) : file_name_(FileName), utf8_(false), content_utf8_(Content)
|
||||
{
|
||||
}
|
||||
void simple_element::write(const std::wstring & RootPath, bool add_padding)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
@ -124,13 +126,14 @@ namespace odf_writer
|
||||
{
|
||||
type_ = t;
|
||||
}
|
||||
documentID_file::documentID_file(std::wstring v)
|
||||
binary_file::binary_file(const std::wstring &file_name, const std::string &value)
|
||||
{
|
||||
value_ = v;
|
||||
file_name_ = file_name;
|
||||
value_ = value;
|
||||
}
|
||||
void documentID_file::write(const std::wstring & RootPath, bool add_padding)
|
||||
void binary_file::write(const std::wstring & RootPath, bool add_padding)
|
||||
{
|
||||
simple_element elm(L"documentID", value_, false);
|
||||
simple_element elm(file_name_, value_);
|
||||
elm.write(RootPath, false);
|
||||
}
|
||||
mimetype_file::mimetype_file(std::wstring t)
|
||||
@ -300,12 +303,12 @@ namespace odf_writer
|
||||
{
|
||||
dynamic_cast<manifect_file*>(manifest_.get())->add_rels(r);
|
||||
}
|
||||
void odf_document::set_documentID(const std::wstring &value)
|
||||
void odf_document::add_binary(const std::wstring &file_name, const std::string &value)
|
||||
{
|
||||
add_object(element_ptr(new documentID_file(value)));
|
||||
objects_.push_back(element_ptr(new binary_file(file_name, value)));
|
||||
|
||||
rels rels_;
|
||||
rels_.add(relationship(std::wstring(L"application/binary"), L"documentID"));
|
||||
rels_.add(relationship(std::wstring(L"application/binary"), file_name));
|
||||
set_rels(rels_);
|
||||
}
|
||||
|
||||
|
||||
@ -102,8 +102,11 @@ namespace odf_writer
|
||||
class simple_element : public element
|
||||
{
|
||||
public:
|
||||
simple_element(const std::wstring & FileName, const std::string & Content);
|
||||
simple_element(const std::wstring & FileName, const std::wstring & Content, bool utf8 = true);
|
||||
|
||||
static element_ptr create(const std::wstring & FileName, const std::wstring & Content, bool utf8 = true);
|
||||
static element_ptr create(const std::wstring & FileName, const std::string & Content);
|
||||
|
||||
virtual void write(const std::wstring & RootPath, bool add_padding = false);
|
||||
|
||||
@ -160,15 +163,16 @@ namespace odf_writer
|
||||
std::wstring type_;
|
||||
|
||||
};
|
||||
class documentID_file : public element
|
||||
class binary_file : public element
|
||||
{
|
||||
public:
|
||||
documentID_file(std::wstring value);
|
||||
binary_file(const std::wstring &file_name, const std::string &value);
|
||||
|
||||
virtual void write(const std::wstring & RootPath, bool add_padding = false);
|
||||
|
||||
private:
|
||||
std::wstring value_;
|
||||
std::string value_;
|
||||
std::wstring file_name_;
|
||||
|
||||
};
|
||||
class mimetype_file : public element
|
||||
@ -226,6 +230,7 @@ namespace odf_writer
|
||||
odf_document(std::wstring type);
|
||||
|
||||
void add_object(element_ptr _object,bool root = false);
|
||||
void add_binary(const std::wstring &file_name, const std::string &value);
|
||||
|
||||
void set_rels(rels & r);
|
||||
|
||||
@ -233,9 +238,6 @@ namespace odf_writer
|
||||
void write_manifest(const std::wstring & RootPath);
|
||||
|
||||
manifect_file* get_manifest() {return dynamic_cast<manifect_file*>(manifest_.get());}
|
||||
|
||||
void set_documentID(const std::wstring &value);
|
||||
|
||||
private:
|
||||
element_ptr base_;
|
||||
std::vector<element_ptr> objects_;
|
||||
|
||||
@ -165,7 +165,7 @@ void odf_conversion_context::end_document()
|
||||
if (isRoot)object_files->local_path = L"/";
|
||||
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.") + object.content->get_name(), object_files->local_path));
|
||||
|
||||
output_document_->add_object(package::element_ptr(object_files),isRoot);
|
||||
output_document_->add_object(package::element_ptr(object_files), isRoot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -284,8 +284,8 @@ private:
|
||||
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
};
|
||||
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
|
||||
|
||||
}
|
||||
}
|
||||
@ -464,35 +464,49 @@ void odf_text_context::end_list()
|
||||
}
|
||||
//------------------------------------------------------------------------------------------ LIST
|
||||
|
||||
bool odf_text_context::start_field(int type)
|
||||
bool odf_text_context::start_field(int type, const std::wstring& value)
|
||||
{
|
||||
if (single_paragraph_ == true) return false;
|
||||
|
||||
office_element_ptr elm;
|
||||
if (type == 2)
|
||||
|
||||
switch(type)
|
||||
{
|
||||
create_element(L"text", L"page-number", elm, odf_context_);
|
||||
text_page_number *page_numb = dynamic_cast<text_page_number*>(elm.get());
|
||||
if (page_numb)
|
||||
case fieldXE:
|
||||
{
|
||||
page_numb->text_select_page_ = L"current";
|
||||
create_element(L"text", L"alphabetical-index-mark", elm, odf_context_);
|
||||
text_alphabetical_index_mark *index = dynamic_cast<text_alphabetical_index_mark*>(elm.get());
|
||||
if (index)
|
||||
{
|
||||
index->key1_ = value;
|
||||
index->string_value_ = value;
|
||||
}
|
||||
}break;
|
||||
case fieldPage:
|
||||
{
|
||||
create_element(L"text", L"page-number", elm, odf_context_);
|
||||
text_page_number *page_numb = dynamic_cast<text_page_number*>(elm.get());
|
||||
if (page_numb)
|
||||
{
|
||||
page_numb->text_select_page_ = L"current";
|
||||
|
||||
if ( (odf_context_->page_layout_context()) &&
|
||||
(odf_context_->page_layout_context()->last_layout()) &&
|
||||
(odf_context_->page_layout_context()->last_layout()->page_number_format))
|
||||
{
|
||||
if ( (odf_context_->page_layout_context()) &&
|
||||
(odf_context_->page_layout_context()->last_layout()) &&
|
||||
(odf_context_->page_layout_context()->last_layout()->page_number_format))
|
||||
{
|
||||
|
||||
page_numb->common_num_format_attlist_.style_num_format_ = odf_context_->page_layout_context()->last_layout()->page_number_format;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type == 3)
|
||||
{
|
||||
create_element(L"text", L"page-count", elm, odf_context_);
|
||||
}
|
||||
if (type == 4)
|
||||
{
|
||||
create_element(L"text", L"date", elm, odf_context_);
|
||||
page_numb->common_num_format_attlist_.style_num_format_ = odf_context_->page_layout_context()->last_layout()->page_number_format;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case fieldNumPages:
|
||||
{
|
||||
create_element(L"text", L"page-count", elm, odf_context_);
|
||||
}break;
|
||||
case fieldTime:
|
||||
{
|
||||
create_element(L"text", L"date", elm, odf_context_);
|
||||
}break;
|
||||
}
|
||||
|
||||
if (elm)
|
||||
|
||||
@ -43,7 +43,23 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer
|
||||
{
|
||||
enum _typeField
|
||||
{
|
||||
fieldUnknown = 0,
|
||||
fieldHyperlink,
|
||||
fieldPage,
|
||||
fieldNumPages,
|
||||
fieldTime,
|
||||
fieldPageRef,
|
||||
fieldSeq,
|
||||
fieldXE,
|
||||
|
||||
fieldBibliography = 0xff + 1,
|
||||
fieldIndex,
|
||||
fieldIllustration,
|
||||
fieldTable,
|
||||
fieldToc
|
||||
};
|
||||
class odf_conversion_context;
|
||||
class odf_style_context;
|
||||
class paragraph;
|
||||
@ -80,7 +96,7 @@ public:
|
||||
void start_element (office_element_ptr & elm, office_element_ptr style_elm = office_element_ptr(),std::wstring style_name = L"");
|
||||
void end_element ();
|
||||
|
||||
bool start_field (int type);
|
||||
bool start_field (int type, const std::wstring& value);
|
||||
void end_field ();
|
||||
|
||||
void start_span (bool styled = false);
|
||||
@ -139,6 +155,7 @@ private:
|
||||
std::wstring parent_span_style_;
|
||||
std::wstring parent_paragraph_style_;
|
||||
};
|
||||
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
#include "../utils.h"
|
||||
|
||||
#include "odt_conversion_context.h"
|
||||
#include "odf_text_context.h"
|
||||
|
||||
#include "styles.h"
|
||||
|
||||
@ -114,6 +113,27 @@ void odt_conversion_context::start_document()
|
||||
|
||||
void odt_conversion_context::end_document()
|
||||
{
|
||||
if (false == mapSequenceDecls.empty())
|
||||
{
|
||||
office_element_ptr seq_decls;
|
||||
create_element(L"text", L"sequence-decls", seq_decls, this);
|
||||
|
||||
for (std::map<std::wstring, int>::iterator it = mapSequenceDecls.begin(); it != mapSequenceDecls.end(); ++it)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"sequence-decl", elm, this);
|
||||
|
||||
text_sequence_decl* decl = dynamic_cast<text_sequence_decl*>(elm.get());
|
||||
if (decl)
|
||||
{
|
||||
decl->name_ = it->first;
|
||||
decl->display_outline_level_ = 0;
|
||||
}
|
||||
seq_decls->add_child_element(elm);
|
||||
}
|
||||
root_document_->add_child_element(seq_decls);
|
||||
}
|
||||
|
||||
//add sections to root
|
||||
for (size_t i = 0; i < sections_.size(); i++)
|
||||
{
|
||||
@ -283,16 +303,17 @@ void odt_conversion_context::end_drawings()
|
||||
}
|
||||
void odt_conversion_context::start_paragraph(bool styled)
|
||||
{
|
||||
if (!current_fields.empty() && current_fields.back().started == false && !current_fields.back().in_span)
|
||||
if (!current_fields.empty() && current_fields.back().status == 1 && !current_fields.back().in_span)
|
||||
{
|
||||
current_fields.back().status = 2;
|
||||
//if (!current_fields.empty() && !current_fields.back().result) return; //Стандартное_составное_письмо.docx
|
||||
switch (current_fields.back().type)
|
||||
{
|
||||
case 6: current_fields.back().started = start_bibliography(); break;
|
||||
case 7: current_fields.back().started = start_alphabetical_index(); break;
|
||||
case 8: //current_fields.back().started = start_table_index(); break;
|
||||
case 9: current_fields.back().started = start_illustration_index(); break;
|
||||
case 10:current_fields.back().started = start_table_of_content(); break;
|
||||
case fieldBibliography: start_bibliography(); break;
|
||||
case fieldIndex: start_alphabetical_index(); break;
|
||||
case fieldIllustration: start_illustration_index(); break;
|
||||
case fieldTable: start_table_index(); break;
|
||||
case fieldToc: start_table_of_content(); break;
|
||||
}
|
||||
}
|
||||
if (is_paragraph_in_current_section_ && !styled)
|
||||
@ -352,56 +373,100 @@ void odt_conversion_context::add_paragraph_break(int type)
|
||||
//}
|
||||
}
|
||||
}
|
||||
bool odt_conversion_context::start_table_of_content()
|
||||
void odt_conversion_context::start_table_of_content()
|
||||
{
|
||||
office_element_ptr elm1, elm2;
|
||||
office_element_ptr elm;
|
||||
|
||||
create_element(L"text", L"table-of-content", elm1, this);
|
||||
text_context()->start_element(elm1);
|
||||
create_element(L"text", L"table-of-content", elm, this);
|
||||
text_context()->start_element(elm);
|
||||
|
||||
add_to_root();
|
||||
|
||||
start_index_field();
|
||||
}
|
||||
|
||||
void odt_conversion_context::end_table_of_content()
|
||||
{
|
||||
text_context()->end_element();
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"table-of-content-source", elm, this);
|
||||
text_table_of_content_source* source = dynamic_cast<text_table_of_content_source*>(elm.get());
|
||||
|
||||
if (source)
|
||||
{
|
||||
if (false == current_fields.back().arStyleLevels.empty())
|
||||
{
|
||||
source->outline_level_ = (int) current_fields.back().arStyleLevels.size();
|
||||
source->use_index_source_styles_ = true;
|
||||
}
|
||||
else if (current_fields.back().outline_levels > 0)
|
||||
{
|
||||
source->outline_level_ = current_fields.back().outline_levels;
|
||||
}
|
||||
}
|
||||
|
||||
text_context()->start_element(elm);
|
||||
//template
|
||||
text_context()->end_element();
|
||||
text_context()->end_element();
|
||||
}
|
||||
|
||||
void odt_conversion_context::start_alphabetical_index()
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"alphabetical-index", elm, this);
|
||||
text_context()->start_element(elm);
|
||||
|
||||
add_to_root();
|
||||
|
||||
create_element(L"text", L"table-of-content-source", elm2, this);
|
||||
text_context()->start_element(elm2);
|
||||
text_context()->end_element();
|
||||
|
||||
start_index_field();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool odt_conversion_context::start_alphabetical_index()
|
||||
void odt_conversion_context::end_alphabetical_index()
|
||||
{
|
||||
office_element_ptr elm1, elm2;
|
||||
create_element(L"text", L"alphabetical-index", elm1, this);
|
||||
text_context()->start_element(elm1);
|
||||
|
||||
add_to_root();
|
||||
|
||||
create_element(L"text", L"alphabetical-index-source", elm2, this);
|
||||
text_context()->start_element(elm2);
|
||||
text_context()->end_element();
|
||||
|
||||
start_index_field();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool odt_conversion_context::start_illustration_index()
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"alphabetical-index-source", elm, this);
|
||||
|
||||
text_context()->start_element(elm);
|
||||
//tempalte
|
||||
text_context()->end_element();
|
||||
text_context()->end_element();
|
||||
}
|
||||
void odt_conversion_context::start_illustration_index()
|
||||
{
|
||||
office_element_ptr elm1, elm2;
|
||||
create_element(L"text", L"illustration-index", elm1, this);
|
||||
text_context()->start_element(elm1);
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"illustration-index", elm, this);
|
||||
text_context()->start_element(elm);
|
||||
|
||||
add_to_root();
|
||||
|
||||
create_element(L"text", L"illustration-index-source", elm2, this);
|
||||
text_context()->start_element(elm2);
|
||||
text_context()->end_element();
|
||||
|
||||
start_index_field();
|
||||
return true;
|
||||
}
|
||||
void odt_conversion_context::end_illustration_index()
|
||||
{
|
||||
text_context()->end_element();
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"illustration-index-source", elm, this);
|
||||
text_illustration_index_source* index_source = dynamic_cast<text_illustration_index_source*>(elm.get());
|
||||
if (index_source)
|
||||
{
|
||||
if (false == current_fields.back().captionSEQ.empty())
|
||||
{
|
||||
index_source->caption_sequence_name_ = current_fields.back().captionSEQ;
|
||||
index_source->caption_sequence_format_ = L"text";
|
||||
}
|
||||
}
|
||||
|
||||
text_context()->start_element(elm);
|
||||
//template
|
||||
text_context()->end_element();
|
||||
text_context()->end_element();
|
||||
}
|
||||
|
||||
bool odt_conversion_context::start_bibliography()
|
||||
void odt_conversion_context::start_bibliography()
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"bibliography", elm, this);
|
||||
@ -409,34 +474,42 @@ bool odt_conversion_context::start_bibliography()
|
||||
|
||||
add_to_root();
|
||||
|
||||
create_element(L"text", L"bibliography-source", elm, this);
|
||||
text_context()->start_element(elm);
|
||||
text_context()->end_element();
|
||||
|
||||
start_index_field();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool odt_conversion_context::start_table_index()
|
||||
void odt_conversion_context::end_bibliography()
|
||||
{
|
||||
text_context()->end_element();
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"bibliography-source", elm, this);
|
||||
|
||||
text_context()->start_element(elm);
|
||||
//template
|
||||
text_context()->end_element();
|
||||
text_context()->end_element();
|
||||
}
|
||||
void odt_conversion_context::start_table_index()
|
||||
{
|
||||
end_paragraph();
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"table-index", elm, this);
|
||||
text_context()->start_element(elm);
|
||||
|
||||
add_to_root();
|
||||
|
||||
create_element(L"text", L"table-index-source", elm, this);
|
||||
text_context()->start_element(elm);
|
||||
text_context()->end_element();
|
||||
|
||||
start_index_field();
|
||||
|
||||
start_paragraph();
|
||||
return true;
|
||||
}
|
||||
void odt_conversion_context::end_table_index()
|
||||
{
|
||||
text_context()->end_element();
|
||||
|
||||
office_element_ptr elm;
|
||||
create_element(L"text", L"table-index-source", elm, this);
|
||||
|
||||
text_context()->start_element(elm);
|
||||
//template
|
||||
text_context()->end_element();
|
||||
text_context()->end_element();
|
||||
}
|
||||
void odt_conversion_context::start_index_field()
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
@ -458,26 +531,21 @@ void odt_conversion_context::end_index_field()
|
||||
text_context()->end_element();
|
||||
}
|
||||
|
||||
bool odt_conversion_context::start_hyperlink(std::wstring ref)
|
||||
void odt_conversion_context::start_hyperlink(std::wstring ref)
|
||||
{
|
||||
office_element_ptr hyperlink_elm;
|
||||
create_element(L"text", L"a", hyperlink_elm, this);
|
||||
|
||||
text_a* hyperlink = dynamic_cast<text_a*>(hyperlink_elm.get());
|
||||
if (!hyperlink)return false;
|
||||
if (hyperlink)
|
||||
{
|
||||
hyperlink->common_xlink_attlist_.href_ = ref;
|
||||
hyperlink->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
|
||||
text_context()->start_element(hyperlink_elm);
|
||||
|
||||
////////////////////////////
|
||||
|
||||
hyperlink->common_xlink_attlist_.href_ = ref;
|
||||
hyperlink->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
|
||||
//current_level_.back()->add_child_element(hyperlink_elm);
|
||||
//current_level_.push_back(hyperlink_elm);
|
||||
|
||||
text_context()->start_element(hyperlink_elm);
|
||||
|
||||
is_hyperlink_ = true;
|
||||
return true;
|
||||
is_hyperlink_ = true;
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::end_hyperlink()
|
||||
{
|
||||
@ -487,7 +555,37 @@ void odt_conversion_context::end_hyperlink()
|
||||
|
||||
is_hyperlink_ = false; //метка .. для гиперлинков в объектах - там не будет span
|
||||
}
|
||||
void odt_conversion_context::start_sequence()
|
||||
{
|
||||
std::map<std::wstring, int>::iterator pFind = mapSequenceDecls.find(current_fields.back().value);
|
||||
|
||||
int index = 0;
|
||||
if (pFind == mapSequenceDecls.end())
|
||||
{
|
||||
mapSequenceDecls.insert(std::make_pair(current_fields.back().value, index));
|
||||
}
|
||||
else
|
||||
{
|
||||
index = ++pFind->second;
|
||||
}
|
||||
office_element_ptr seq_elm;
|
||||
create_element(L"text", L"sequence", seq_elm, this);
|
||||
|
||||
text_sequence* sequence = dynamic_cast<text_sequence*>(seq_elm.get());
|
||||
if (sequence)
|
||||
{
|
||||
sequence->name_ = current_fields.back().value;
|
||||
sequence->ref_name_ = L"ref" + current_fields.back().value + std::to_wstring(index);
|
||||
sequence->formula_ = L"ooow:" + current_fields.back().value + L"+1";
|
||||
sequence->style_num_format_ = style_numformat(style_numformat::arabic);
|
||||
|
||||
text_context()->start_element(seq_elm);
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::end_sequence()
|
||||
{
|
||||
text_context()->end_element();
|
||||
}
|
||||
std::map<std::wstring, std::wstring> odt_conversion_context::parse_instr_options(const std::wstring& value)
|
||||
{
|
||||
std::map<std::wstring, std::wstring> result;
|
||||
@ -499,9 +597,23 @@ std::map<std::wstring, std::wstring> odt_conversion_context::parse_instr_options
|
||||
{
|
||||
std::wstring key = arOptions[i].substr(0, 1);
|
||||
std::wstring value;
|
||||
if (arOptions[i].length() > 1)
|
||||
if (arOptions[i].length() > 2)
|
||||
{
|
||||
value = arOptions[i].substr(1);
|
||||
size_t pos = arOptions[i].find(L"\"");
|
||||
if (std::wstring::npos != pos)
|
||||
{
|
||||
value = arOptions[i].substr(pos + 1, arOptions[i].length() - pos - 1);
|
||||
|
||||
pos = value.rfind(L"\"");
|
||||
if (std::wstring::npos != pos)
|
||||
{
|
||||
value = value.substr(0, pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value = arOptions[i].substr(1);
|
||||
}
|
||||
}
|
||||
result.insert(std::make_pair(key, value));
|
||||
}
|
||||
@ -514,10 +626,12 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
|
||||
current_fields.back().status = 1; //prepare
|
||||
|
||||
size_t res1 = instr.find(L"HYPERLINK");
|
||||
if (std::wstring::npos != res1)
|
||||
{
|
||||
current_fields.back().type = 1;
|
||||
current_fields.back().type = fieldHyperlink;
|
||||
current_fields.back().in_span = false;
|
||||
|
||||
std::wstring ref;
|
||||
@ -533,41 +647,73 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
res1 = instr.find(L"NUMPAGES");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0)
|
||||
{
|
||||
current_fields.back().type = 3;
|
||||
current_fields.back().type = fieldNumPages;
|
||||
}
|
||||
res1 = instr.find(L"PAGEREF");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0 )
|
||||
{
|
||||
current_fields.back().type = 5;
|
||||
current_fields.back().type = fieldPageRef;
|
||||
if (instr.length() > 9)
|
||||
current_fields.back().value = instr.substr(9, instr.length() - 5);
|
||||
}
|
||||
res1 = instr.find(L"PAGE");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0)
|
||||
{
|
||||
current_fields.back().type = 2;
|
||||
current_fields.back().type = fieldPage;
|
||||
}
|
||||
res1 = instr.find(L"TIME");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0)
|
||||
{
|
||||
current_fields.back().type = 4;
|
||||
current_fields.back().type = fieldTime;
|
||||
}
|
||||
res1 = instr.find(L"SEQ");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0)
|
||||
{
|
||||
current_fields.back().type = fieldSeq;
|
||||
std::map<std::wstring, std::wstring> options = parse_instr_options(instr.substr(4));
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = options.begin(); it != options.end(); ++it)
|
||||
{
|
||||
if (it->first == L" ")//field-argument
|
||||
{
|
||||
current_fields.back().value = it->second.substr(0, it->second.length() - 1);
|
||||
}
|
||||
else if (it->first == L"*")
|
||||
{
|
||||
current_fields.back().format = it->second.substr(0, it->second.length() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
res1 = instr.find(L"XE");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0)
|
||||
{
|
||||
current_fields.back().type = fieldXE;
|
||||
std::map<std::wstring, std::wstring> options = parse_instr_options(instr.substr(3));
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = options.begin(); it != options.end(); ++it)
|
||||
{
|
||||
if (it->first == L" ")//field-argument
|
||||
{
|
||||
current_fields.back().value = it->second.substr(0, it->second.length() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
res1 = instr.find(L"BIBLIOGRAPHY");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0)
|
||||
{
|
||||
current_fields.back().type = 6;
|
||||
current_fields.back().type = fieldBibliography;
|
||||
current_fields.back().in_span = false;
|
||||
}
|
||||
res1 = instr.find(L"INDEX");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0)
|
||||
{
|
||||
current_fields.back().type = 7;
|
||||
current_fields.back().type = fieldIndex;
|
||||
current_fields.back().in_span = false;
|
||||
}
|
||||
res1 = instr.find(L"TOC");
|
||||
if (std::wstring::npos != res1 && current_fields.back().type == 0)
|
||||
{
|
||||
current_fields.back().type = 8;
|
||||
current_fields.back().type = fieldIllustration;
|
||||
current_fields.back().in_span = false;
|
||||
std::map<std::wstring, std::wstring> options = parse_instr_options(instr.substr(res1 + 3));
|
||||
|
||||
@ -584,12 +730,36 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
pFind = options.find(L"u"); //paragraph outline level
|
||||
if ( pFind != options.end())
|
||||
{
|
||||
current_fields.back().type = 10; //table of content
|
||||
current_fields.back().type = fieldToc; //table of content
|
||||
}
|
||||
pFind = options.find(L"o");
|
||||
if ( pFind != options.end())//table of content outline levels style
|
||||
{
|
||||
current_fields.back().type = 10;
|
||||
std::vector<std::wstring> arLevels;
|
||||
boost::algorithm::split(arLevels, pFind->second, boost::algorithm::is_any_of(L"-"), boost::algorithm::token_compress_on);
|
||||
if (arLevels.size() > 1)
|
||||
{
|
||||
current_fields.back().type = fieldToc;
|
||||
current_fields.back().outline_levels = XmlUtils::GetInteger(arLevels[1]);
|
||||
}
|
||||
}
|
||||
pFind = options.find(L"t");
|
||||
if ( pFind != options.end())//content styles name
|
||||
{
|
||||
std::vector<std::wstring> arStyles;
|
||||
boost::algorithm::split(arStyles, pFind->second, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < arStyles.size() - 1; i += 2)
|
||||
{
|
||||
int level = XmlUtils::GetInteger(arStyles[i + 1]);
|
||||
if (level < 1) continue;
|
||||
|
||||
while(current_fields.back().arStyleLevels.size() + 1 < level )
|
||||
{
|
||||
current_fields.back().arStyleLevels.push_back(L"");
|
||||
}
|
||||
current_fields.back().arStyleLevels.push_back(arStyles[i]);
|
||||
}
|
||||
}
|
||||
pFind = options.find(L"z");
|
||||
if ( pFind != options.end())//table of content outline levels style
|
||||
@ -615,6 +785,9 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
}
|
||||
void odt_conversion_context::start_field(bool in_span)
|
||||
{
|
||||
if (false == current_fields.empty() && current_fields.back().status == 0)
|
||||
return; //start_field из sdt
|
||||
|
||||
_field_state field;
|
||||
current_fields.push_back(field);
|
||||
}
|
||||
@ -761,28 +934,42 @@ void odt_conversion_context::end_field()
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
|
||||
if (current_fields.back().started)
|
||||
if (current_fields.back().status == 2)
|
||||
{
|
||||
switch(current_fields.back().type)
|
||||
current_fields.back().status = 3;//prepare for delete
|
||||
|
||||
if (current_fields.back().type < 0xff)
|
||||
{
|
||||
case 1: end_hyperlink(); break;
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10: end_index_field(); break;
|
||||
default:
|
||||
text_context()->end_field();
|
||||
if (current_fields.back().type == fieldHyperlink) end_hyperlink();
|
||||
else if (current_fields.back().type == fieldSeq) end_sequence();
|
||||
else text_context()->end_field();
|
||||
|
||||
current_fields.pop_back();
|
||||
}
|
||||
}
|
||||
current_fields.pop_back();
|
||||
else if (current_fields.back().status == 0)
|
||||
{
|
||||
current_fields.pop_back();
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::end_paragraph()
|
||||
{
|
||||
if (!current_fields.empty() && !current_fields.back().result) return; //Стандартное_составное_письмо.docx
|
||||
|
||||
//if (!current_fields.empty() && !current_fields.back().result) return; //Стандартное_составное_письмо.docx
|
||||
text_context()->end_paragraph();
|
||||
|
||||
if (false == current_fields.empty() && current_fields.back().status == 3) //prepare for delete
|
||||
{
|
||||
switch(current_fields.back().type)
|
||||
{
|
||||
case fieldBibliography: end_bibliography(); break;
|
||||
case fieldIndex: end_alphabetical_index(); break;
|
||||
case fieldIllustration: end_illustration_index(); break;
|
||||
case fieldTable: end_table_index(); break;
|
||||
case fieldToc: end_table_of_content(); break;
|
||||
}
|
||||
current_fields.pop_back();
|
||||
}
|
||||
|
||||
flush_section();
|
||||
}
|
||||
|
||||
@ -882,10 +1069,13 @@ void odt_conversion_context::start_run(bool styled)
|
||||
{
|
||||
if (is_hyperlink_ && text_context_.size() > 0) return;
|
||||
|
||||
if (!current_fields.empty() && current_fields.back().started == false && !current_fields.back().in_span)
|
||||
if (!current_fields.empty() && current_fields.back().status == 1 && !current_fields.back().in_span && current_fields.back().type < 0xff)
|
||||
{
|
||||
if (current_fields.back().type == 1) current_fields.back().started = start_hyperlink(current_fields.back().value);
|
||||
else if (current_fields.back().type < 6) current_fields.back().started = text_context()->start_field(current_fields.back().type);
|
||||
current_fields.back().status = 2;
|
||||
|
||||
if (current_fields.back().type == fieldHyperlink) start_hyperlink(current_fields.back().value);
|
||||
else if (current_fields.back().type == fieldSeq) start_sequence();
|
||||
else text_context()->start_field(current_fields.back().type, current_fields.back().value);
|
||||
}
|
||||
|
||||
text_context()->start_span(styled);
|
||||
@ -897,16 +1087,17 @@ void odt_conversion_context::start_run(bool styled)
|
||||
props->apply_from(dynamic_cast<style_text_properties*>(drop_cap_state_.text_properties.get()));
|
||||
|
||||
}
|
||||
if (!current_fields.empty() && current_fields.back().started == false && current_fields.back().in_span)//поле стартуется в span - нужно для сохранения стиля
|
||||
if (!current_fields.empty() && current_fields.back().status == 1 && current_fields.back().in_span)//поле стартуется в span - нужно для сохранения стиля
|
||||
{
|
||||
current_fields.back().started = text_context()->start_field(current_fields.back().type);
|
||||
current_fields.back().status = 2;
|
||||
text_context()->start_field(current_fields.back().type, current_fields.back().value);
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::end_run()
|
||||
{
|
||||
if (is_hyperlink_ && text_context_.size() > 0) return;
|
||||
|
||||
if (!current_fields.empty() && current_fields.back().started == true && current_fields.back().in_span)
|
||||
if (!current_fields.empty() && current_fields.back().status == 1 && current_fields.back().in_span)
|
||||
{
|
||||
end_field();
|
||||
}
|
||||
|
||||
@ -36,17 +36,14 @@
|
||||
#include "odf_comment_context.h"
|
||||
#include "odf_notes_context.h"
|
||||
#include "odf_table_context.h"
|
||||
#include "odf_text_context.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
namespace odf_writer
|
||||
{
|
||||
class office_text;
|
||||
|
||||
class odf_text_context;
|
||||
|
||||
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
|
||||
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
|
||||
|
||||
struct odt_section_state
|
||||
{
|
||||
office_element_ptr elm;
|
||||
@ -90,14 +87,26 @@ public:
|
||||
|
||||
void add_paragraph_break(int type);
|
||||
|
||||
bool start_hyperlink (std::wstring ref);
|
||||
void start_hyperlink (std::wstring ref);
|
||||
void end_hyperlink ();
|
||||
|
||||
bool start_table_of_content ();
|
||||
bool start_bibliography ();
|
||||
bool start_alphabetical_index ();
|
||||
bool start_illustration_index ();
|
||||
bool start_table_index ();
|
||||
void start_sequence ();
|
||||
void end_sequence ();
|
||||
|
||||
void start_table_of_content ();
|
||||
void end_table_of_content ();
|
||||
|
||||
void start_bibliography ();
|
||||
void end_bibliography ();
|
||||
|
||||
void start_alphabetical_index ();
|
||||
void end_alphabetical_index ();
|
||||
|
||||
void start_illustration_index ();
|
||||
void end_illustration_index ();
|
||||
|
||||
void start_table_index ();
|
||||
void end_table_index ();
|
||||
|
||||
void start_index_field();
|
||||
void end_index_field();
|
||||
@ -192,23 +201,29 @@ private:
|
||||
std::vector<odf_element_state> current_root_elements_; // for section, if needed
|
||||
std::vector<odt_section_state> sections_;
|
||||
|
||||
std::map<std::wstring, int> mapSequenceDecls;
|
||||
|
||||
void add_to_root();
|
||||
|
||||
struct _field_state
|
||||
{
|
||||
int type = 0;
|
||||
_typeField type = fieldUnknown;
|
||||
|
||||
std::wstring name;
|
||||
std::wstring value;
|
||||
|
||||
std::wstring format;
|
||||
bool started = false;
|
||||
short status = 0;//0, 1, 2, 3 - init, prapare, start, finish
|
||||
bool in_span = false;
|
||||
bool result;
|
||||
bool result = false; //after separate
|
||||
bool bHyperlinks = false;
|
||||
bool bHidePageNumbers = false;
|
||||
std::wstring captionSEQ;
|
||||
std::wstring title;
|
||||
std::vector<std::wstring> arStyleLevels;
|
||||
int outline_levels = 0;
|
||||
std::vector<int> arTemplateTypes;//text, link, tab ....
|
||||
int tabLeader = 0;//dot
|
||||
};
|
||||
|
||||
std::vector<_field_state> current_fields;
|
||||
|
||||
@ -89,14 +89,34 @@ void office_text_attlist::serialize(CP_ATTR_NODE)
|
||||
}
|
||||
void office_text::create_child_element( const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if (is_text_content(Ns, Name))
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
if CP_CHECK_NAME(L"office", L"forms")
|
||||
{
|
||||
CP_CREATE_ELEMENT(forms_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"text", L"tracked-changes")
|
||||
{
|
||||
CP_CREATE_ELEMENT(tracked_changes_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"table", L"content-validations")
|
||||
{
|
||||
CP_CREATE_ELEMENT(table_content_validations_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"text", L"user-field-decls")
|
||||
{
|
||||
CP_CREATE_ELEMENT(user_fields_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"text", L"sequence-decls")
|
||||
{
|
||||
CP_CREATE_ELEMENT(sequences_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"text", L"variable-decls")
|
||||
{
|
||||
CP_CREATE_ELEMENT(variables_);
|
||||
}
|
||||
else if (is_text_content(Ns, Name))
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
else
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
@ -107,6 +127,10 @@ void office_text::add_child_element( const office_element_ptr & child_element)
|
||||
|
||||
switch(child_element->get_type())
|
||||
{
|
||||
case typeTextSequenceDecls:
|
||||
{
|
||||
sequences_ = child_element;
|
||||
}break;
|
||||
case typeTextTrackedChanges:
|
||||
{
|
||||
tracked_changes_ = child_element;
|
||||
@ -130,6 +154,9 @@ void office_text::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
office_text_attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
if (sequences_)
|
||||
sequences_->serialize(CP_XML_STREAM());
|
||||
|
||||
if (tracked_changes_)
|
||||
tracked_changes_->serialize(CP_XML_STREAM());
|
||||
|
||||
|
||||
@ -71,7 +71,13 @@ public:
|
||||
|
||||
private:
|
||||
office_element_ptr tracked_changes_;
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr table_content_validations_;
|
||||
office_element_ptr user_fields_;
|
||||
office_element_ptr variables_;
|
||||
office_element_ptr sequences_;
|
||||
office_element_ptr forms_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
// TODO: office-text-content-prelude:
|
||||
// TODO: office-forms
|
||||
|
||||
@ -71,6 +71,13 @@ using xml::xml_char_wc;
|
||||
const wchar_t * text_text::ns = L"";
|
||||
const wchar_t * text_text::name = L"";
|
||||
|
||||
std::wostream & text_text::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
_Wostream << xml::utils::replace_text_to_xml( text_ );
|
||||
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
void text_text::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
_Wostream << xml::utils::replace_text_to_xml( text_ );
|
||||
@ -236,6 +243,14 @@ void text_reference_mark_end::serialize(std::wostream & _Wostream)
|
||||
const wchar_t * text_span::ns = L"text";
|
||||
const wchar_t * text_span::name = L"span";
|
||||
|
||||
std::wostream & text_span::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
for (size_t i = 0; i < paragraph_content_.size(); i++)
|
||||
{
|
||||
paragraph_content_[i]->text_to_stream(_Wostream);
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
void text_span::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
@ -772,9 +787,15 @@ void text_sequence::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"text:name", name_);
|
||||
CP_XML_ATTR_OPT(L"text:ref-name", ref_name_);
|
||||
CP_XML_ATTR_OPT(L"style:num-format", style_num_format_);
|
||||
CP_XML_ATTR_OPT(L"style:num-letter-syn", style_num_letter_sync_);
|
||||
CP_XML_ATTR_OPT(L"text:formula", formula_);
|
||||
|
||||
for (size_t i = 0; i < text_.size(); i++)
|
||||
{
|
||||
text_[i]->serialize(CP_XML_STREAM());
|
||||
text_[i]->text_to_stream(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,8 @@ public:
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_child_element( const office_element_ptr & child_element){}
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
text_text(const std::wstring & Text) : text_(Text) {}
|
||||
text_text() {}
|
||||
@ -316,6 +317,7 @@ public:
|
||||
virtual void add_child_element( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
text_span() {}
|
||||
|
||||
@ -678,7 +680,14 @@ public:
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
office_element_ptr_array text_;
|
||||
_CP_OPT(odf_types::style_numformat) style_num_format_;
|
||||
_CP_OPT(std::wstring) style_num_letter_sync_;
|
||||
_CP_OPT(std::wstring) formula_;
|
||||
_CP_OPT(std::wstring) name_;
|
||||
_CP_OPT(std::wstring) ref_name_;
|
||||
|
||||
_CP_OPT(std::wstring) template_;
|
||||
office_element_ptr_array text_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(text_sequence);
|
||||
|
||||
@ -1255,5 +1255,46 @@ void text_index_entry_text::serialize(std::wostream & _Wostream)
|
||||
CP_XML_NODE_SIMPLE();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * text_sequence_decl::ns = L"text";
|
||||
const wchar_t * text_sequence_decl::name = L"sequence-decl";
|
||||
|
||||
void text_sequence_decl::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"text:name", name_);
|
||||
CP_XML_ATTR_OPT(L"text:separation-character", separation_character_);
|
||||
CP_XML_ATTR_OPT(L"text:display-outline-level", display_outline_level_);
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * text_sequence_decls::ns = L"text";
|
||||
const wchar_t * text_sequence_decls::name = L"sequence-decls";
|
||||
|
||||
void text_sequence_decls::create_child_element(const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
void text_sequence_decls::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
content_.push_back(child_element);
|
||||
}
|
||||
void text_sequence_decls::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -678,48 +678,48 @@ public:
|
||||
_CP_OPT(std::wstring) content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(text_index_title_template);
|
||||
////---------------------------------------------------------------------------------------------------
|
||||
////text:sequence-decl
|
||||
////---------------------------------------------------------------------------------------------------
|
||||
//class text_sequence_decl : public office_element_impl<text_sequence_decl>
|
||||
//{
|
||||
//public:
|
||||
// static const wchar_t * ns;
|
||||
// static const wchar_t * name;
|
||||
// static const xml::NodeType xml_type = xml::typeElement;
|
||||
// static const ElementType type = typeTextSequenceDecl;
|
||||
// CPDOCCORE_DEFINE_VISITABLE()
|
||||
//
|
||||
// virtual void create_child_element (const std::wstring & Ns, const std::wstring & Name);
|
||||
// virtual void add_child_element ( const office_element_ptr & child_element);
|
||||
//
|
||||
// virtual void serialize(std::wostream & _Wostream);
|
||||
//
|
||||
// _CP_OPT(std::wstring) separation_character_; //one char
|
||||
// _CP_OPT(unsigned int) display_outline_level_;
|
||||
// _CP_OPT(std::wstring) name_;
|
||||
//};
|
||||
//CP_REGISTER_OFFICE_ELEMENT2(text_sequence_decl);
|
||||
////---------------------------------------------------------------------------------------------------
|
||||
////text:sequence-decls
|
||||
////---------------------------------------------------------------------------------------------------
|
||||
//class text_sequence_decls : public office_element_impl<text_sequence_decls>
|
||||
//{
|
||||
//public:
|
||||
// static const wchar_t * ns;
|
||||
// static const wchar_t * name;
|
||||
// static const xml::NodeType xml_type = xml::typeElement;
|
||||
// static const ElementType type = typeTextSequenceDecls;
|
||||
// CPDOCCORE_DEFINE_VISITABLE()
|
||||
//
|
||||
// virtual void create_child_element (const std::wstring & Ns, const std::wstring & Name);
|
||||
// virtual void add_child_element ( const office_element_ptr & child_element);
|
||||
//
|
||||
// virtual void serialize(std::wostream & _Wostream);
|
||||
//
|
||||
// office_element_ptr_array content_;
|
||||
//};
|
||||
//CP_REGISTER_OFFICE_ELEMENT2(text_sequence_decls);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:sequence-decl
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class text_sequence_decl : public office_element_impl<text_sequence_decl>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTextSequenceDecl;
|
||||
CPDOCCORE_DEFINE_VISITABLE()
|
||||
|
||||
virtual void create_child_element (const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_child_element ( const office_element_ptr & child_element){}
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
_CP_OPT(std::wstring) separation_character_; //one char
|
||||
_CP_OPT(unsigned int) display_outline_level_;
|
||||
_CP_OPT(std::wstring) name_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(text_sequence_decl);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:sequence-decls
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class text_sequence_decls : public office_element_impl<text_sequence_decls>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTextSequenceDecls;
|
||||
CPDOCCORE_DEFINE_VISITABLE()
|
||||
|
||||
virtual void create_child_element (const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element ( const office_element_ptr & child_element);
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(text_sequence_decls);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:table-of-content-source
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -623,9 +623,9 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
|
||||
|
||||
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_shape->oTextBoxShape->m_arrItems.begin(); it != oox_shape->oTextBoxShape->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_shape->oTextBoxShape->m_arrItems.size(); i++)
|
||||
{
|
||||
docx_converter->convert(*it);
|
||||
docx_converter->convert(oox_shape->oTextBoxShape->m_arrItems[i]);
|
||||
|
||||
convert(oox_shape->oTextBoxBodyPr.GetPointer());
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ void OoxConverter::write(const std::wstring & out_path, const std::wstring & tem
|
||||
|
||||
if (false == documentID.empty())
|
||||
{
|
||||
output_document->set_documentID(documentID);
|
||||
output_document->add_binary(L"documentID", NSFile::CUtf8Converter::GetUtf8StringFromUnicode(documentID));
|
||||
}
|
||||
|
||||
if (password.empty())
|
||||
@ -197,6 +197,7 @@ bool OoxConverter::encrypt_document (const std::wstring &password, const std::ws
|
||||
|
||||
encrypt_file(password, inp_file_name, out_file_name, rels->relationships_[i].encryption_, rels->relationships_[i].size_);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool OoxConverter::encrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, std::wstring &encrypt_info, int &size)
|
||||
{
|
||||
@ -572,5 +573,23 @@ void OoxConverter::convert(double oox_font_size, _CP_OPT(odf_types::font_size)
|
||||
if (odf_length)
|
||||
odf_font_size = odf_types::font_size(odf_length.get());
|
||||
}
|
||||
void OoxConverter::convert(OOX::JsaProject *jsaProject)
|
||||
{
|
||||
if (!jsaProject) return;
|
||||
|
||||
std::string content;
|
||||
NSFile::CFileBinary file;
|
||||
|
||||
file.OpenFile(jsaProject->filename().GetPath());
|
||||
|
||||
DWORD size = file.GetFileSize();
|
||||
content.resize(size);
|
||||
|
||||
file.ReadFile((BYTE*)content.c_str(), size, size);
|
||||
file.CloseFile();
|
||||
|
||||
content[size] = 0;
|
||||
|
||||
output_document->add_binary(L"jsaProject.bin", content);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,6 +76,7 @@ namespace OOX
|
||||
class WritingElement;
|
||||
class IFileContainer;
|
||||
class File;
|
||||
class JsaProject;
|
||||
|
||||
namespace Drawing
|
||||
{
|
||||
@ -375,6 +376,7 @@ public:
|
||||
|
||||
OOX::IFileContainer *oox_current_child_document;
|
||||
|
||||
void convert (OOX::JsaProject *jsaProject);
|
||||
void convert (double oox_font_size, _CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size);
|
||||
bool convert (std::wstring sSchemeColor, DWORD & argb);
|
||||
void convert_font(PPTX::Theme *theme, std::wstring & font);
|
||||
|
||||
@ -267,6 +267,8 @@ void DocxConverter::convert_document()
|
||||
convert(docx_document->m_pDocument->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
OoxConverter::convert (docx_document->m_pJsaProject);
|
||||
}
|
||||
void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
@ -403,18 +405,47 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
void DocxConverter::convert(OOX::Logic::CSdt *oox_sdt)
|
||||
{
|
||||
if (oox_sdt == NULL) return;
|
||||
//nullable<OOX::Logic::CSdtEndPr > m_oSdtEndPr;
|
||||
//nullable<OOX::Logic::CSdtPr > m_oSdtPr;
|
||||
|
||||
bool bField = false;
|
||||
if (oox_sdt->m_oSdtPr.IsInit())
|
||||
{
|
||||
if (oox_sdt->m_oSdtPr->m_oAlias.IsInit())//friendly name
|
||||
{
|
||||
}
|
||||
if (oox_sdt->m_oSdtPr->m_oDocPartObj.IsInit())
|
||||
{
|
||||
if (oox_sdt->m_oSdtPr->m_oDocPartObj->m_oDocPartGallery.IsInit() &&
|
||||
oox_sdt->m_oSdtPr->m_oDocPartObj->m_oDocPartGallery->m_sVal.IsInit())
|
||||
{
|
||||
if (*oox_sdt->m_oSdtPr->m_oDocPartObj->m_oDocPartGallery->m_sVal == L"List od Illustrations" ||
|
||||
*oox_sdt->m_oSdtPr->m_oDocPartObj->m_oDocPartGallery->m_sVal == L"Table of Contents")
|
||||
{
|
||||
odt_context->start_field(false);
|
||||
bField = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oox_sdt->m_oSdtPr->m_eType == OOX::Logic::sdttypeBibliography)
|
||||
{
|
||||
odt_context->start_field(false);
|
||||
bField = true;
|
||||
}
|
||||
}
|
||||
|
||||
convert(oox_sdt->m_oSdtContent.GetPointer());
|
||||
|
||||
if (bField)
|
||||
{
|
||||
odt_context->end_field();
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CSdtContent *oox_sdt)
|
||||
{
|
||||
if (oox_sdt == NULL) return;
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_sdt->m_arrItems.begin(); it != oox_sdt->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_sdt->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_sdt->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
@ -607,9 +638,9 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
{//rapcomnat12.docx - стр 185
|
||||
bool empty_para = true;
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_paragraph->m_arrItems.size(); ++i)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
switch(oox_paragraph->m_arrItems[i]->getType())
|
||||
{
|
||||
case OOX::et_w_pPr: break;
|
||||
default:
|
||||
@ -631,17 +662,17 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_paragraph->m_arrItems.size(); ++i)
|
||||
{
|
||||
//те элементы которые тока для Paragraph - здесь - остальные в общей куче
|
||||
switch((*it)->getType())
|
||||
switch(oox_paragraph->m_arrItems[i]->getType())
|
||||
{
|
||||
case OOX::et_w_pPr:
|
||||
{
|
||||
// пропускаем ..
|
||||
}break;
|
||||
default:
|
||||
convert(*it);
|
||||
convert(oox_paragraph->m_arrItems[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -691,24 +722,24 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
|
||||
|
||||
odt_context->start_run(styled);
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_run->m_arrItems.begin(); it != oox_run->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_run->m_arrItems.size(); ++i)
|
||||
{
|
||||
//те элементы которые тока для Run - здесь - остальные в общей куче
|
||||
switch((*it)->getType())
|
||||
switch(oox_run->m_arrItems[i]->getType())
|
||||
{
|
||||
case OOX::et_w_fldChar:
|
||||
{
|
||||
OOX::Logic::CFldChar* pFldChar= dynamic_cast<OOX::Logic::CFldChar*>(*it);
|
||||
OOX::Logic::CFldChar* pFldChar= dynamic_cast<OOX::Logic::CFldChar*>(oox_run->m_arrItems[i]);
|
||||
convert(pFldChar);
|
||||
}break;
|
||||
case OOX::et_w_instrText:
|
||||
{
|
||||
OOX::Logic::CInstrText* pInstrText= dynamic_cast<OOX::Logic::CInstrText*>(*it);
|
||||
OOX::Logic::CInstrText* pInstrText= dynamic_cast<OOX::Logic::CInstrText*>(oox_run->m_arrItems[i]);
|
||||
convert(pInstrText);
|
||||
}break;
|
||||
case OOX::et_w_delText:
|
||||
{
|
||||
OOX::Logic::CDelText* pDelText= dynamic_cast<OOX::Logic::CDelText*>(*it);
|
||||
OOX::Logic::CDelText* pDelText= dynamic_cast<OOX::Logic::CDelText*>(oox_run->m_arrItems[i]);
|
||||
convert(pDelText);
|
||||
}break;
|
||||
case OOX::et_w_rPr: // пропускаем ..
|
||||
@ -719,7 +750,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
|
||||
}break;
|
||||
case OOX::et_w_br:
|
||||
{
|
||||
OOX::Logic::CBr* pBr= dynamic_cast<OOX::Logic::CBr*>(*it);
|
||||
OOX::Logic::CBr* pBr= dynamic_cast<OOX::Logic::CBr*>(oox_run->m_arrItems[i]);
|
||||
if (pBr)
|
||||
{
|
||||
int type = pBr->m_oType.GetValue();
|
||||
@ -732,17 +763,17 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
|
||||
}break;
|
||||
case OOX::et_w_t:
|
||||
{
|
||||
OOX::Logic::CText* pText= dynamic_cast<OOX::Logic::CText*>(*it);
|
||||
OOX::Logic::CText* pText= dynamic_cast<OOX::Logic::CText*>(oox_run->m_arrItems[i]);
|
||||
convert(pText);
|
||||
}break;
|
||||
case OOX::et_w_sym:
|
||||
{
|
||||
OOX::Logic::CSym* pSym= dynamic_cast<OOX::Logic::CSym*>(*it);
|
||||
OOX::Logic::CSym* pSym= dynamic_cast<OOX::Logic::CSym*>(oox_run->m_arrItems[i]);
|
||||
convert(pSym);
|
||||
}break;
|
||||
case OOX::et_w_tab:
|
||||
{
|
||||
OOX::Logic::CTab* pTab= dynamic_cast<OOX::Logic::CTab*>(*it);
|
||||
OOX::Logic::CTab* pTab= dynamic_cast<OOX::Logic::CTab*>(oox_run->m_arrItems[i]);
|
||||
odt_context->text_context()->add_tab();
|
||||
}break;
|
||||
|
||||
@ -759,7 +790,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
|
||||
//softHyphen
|
||||
//delInstrText
|
||||
default:
|
||||
convert(*it);
|
||||
convert(oox_run->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
odt_context->end_run();
|
||||
@ -898,9 +929,9 @@ void DocxConverter::convert(OOX::Logic::CIns *oox_ins)
|
||||
|
||||
bool start_change = odt_context->start_change(id, 1, author, userId, date);
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_ins->m_arrItems.begin(); it != oox_ins->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_ins->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_ins->m_arrItems[i]);
|
||||
}
|
||||
|
||||
if (start_change)
|
||||
@ -1103,9 +1134,9 @@ void DocxConverter::convert(OOX::Logic::CDel *oox_del)
|
||||
|
||||
bool res_change = odt_context->start_change(id, 2, author, userId, date);
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_del->m_arrItems.begin(); it != oox_del->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_del->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_del->m_arrItems[i]);
|
||||
}
|
||||
if (res_change)
|
||||
odt_context->end_change(id, 2);
|
||||
@ -1114,9 +1145,9 @@ void DocxConverter::convert(OOX::Logic::CSmartTag *oox_tag)
|
||||
{
|
||||
if (oox_tag == NULL) return;
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_tag->m_arrItems.begin(); it != oox_tag->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_tag->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_tag->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties)
|
||||
@ -3036,27 +3067,34 @@ void DocxConverter::convert_styles()
|
||||
void DocxConverter::convert(OOX::Logic::CHyperlink *oox_hyperlink)
|
||||
{
|
||||
if (oox_hyperlink == NULL)return;
|
||||
|
||||
std::wstring ref;
|
||||
|
||||
if (oox_hyperlink->m_oId.IsInit()) //гиперлинк
|
||||
{
|
||||
std::wstring ref = find_link_by_id(oox_hyperlink->m_oId->GetValue(),2);
|
||||
|
||||
ref = find_link_by_id(oox_hyperlink->m_oId->GetValue(),2);
|
||||
}
|
||||
else if (oox_hyperlink->m_sAnchor.IsInit())
|
||||
{
|
||||
ref = L"#" + *oox_hyperlink->m_sAnchor;
|
||||
}
|
||||
if (false == ref.empty())
|
||||
{
|
||||
odt_context->start_hyperlink(ref);
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_hyperlink->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_hyperlink->m_arrItems[i]);
|
||||
}
|
||||
odt_context->end_hyperlink();
|
||||
}
|
||||
else
|
||||
{//ссылка внутри дока
|
||||
//anchor todooo
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); ++it)
|
||||
{
|
||||
for (size_t i = 0; i < oox_hyperlink->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_hyperlink->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
//nullable<std::wstring > m_sAnchor;
|
||||
//nullable<std::wstring > m_sDocLocation;
|
||||
//nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse> > m_oHistory;
|
||||
//nullable<std::wstring > m_sTgtFrame;
|
||||
@ -3606,9 +3644,9 @@ void DocxConverter::convert_comment(int oox_comm_id)
|
||||
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (oox_comment->m_oDate->GetValue());
|
||||
if (oox_comment->m_oInitials.IsInit()) {}
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_comment->m_arrItems.begin(); it != oox_comment->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_comment->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_comment->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
odt_context->end_comment_content();
|
||||
@ -3631,9 +3669,9 @@ void DocxConverter::convert_footnote(int oox_ref_id)
|
||||
{
|
||||
odt_context->start_note_content();
|
||||
{
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_note->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_note->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
odt_context->end_note_content();
|
||||
@ -3658,9 +3696,9 @@ void DocxConverter::convert_endnote(int oox_ref_id)
|
||||
{
|
||||
odt_context->start_note_content();
|
||||
{
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_note->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_note->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
odt_context->end_note_content();
|
||||
@ -3675,9 +3713,9 @@ void DocxConverter::convert_hdr_ftr (std::wstring sId)
|
||||
|
||||
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(oox_hdr_ftr);
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_hdr_ftr->m_arrItems.begin(); it != oox_hdr_ftr->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_hdr_ftr->m_arrItems.size(); ++i)
|
||||
{
|
||||
convert(*it);
|
||||
convert(oox_hdr_ftr->m_arrItems[i]);
|
||||
}
|
||||
oox_current_child_document = NULL;
|
||||
}
|
||||
@ -3854,16 +3892,16 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
convert(oox_table->m_oTblGrid.GetPointer());
|
||||
|
||||
//------ строки
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_table->m_arrItems.begin(); it != oox_table->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_table->m_arrItems.size(); ++i)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
switch(oox_table->m_arrItems[i]->getType())
|
||||
{
|
||||
case OOX::et_w_tblPr:
|
||||
{
|
||||
//skip
|
||||
}break;
|
||||
default:
|
||||
convert(*it);
|
||||
convert(oox_table->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
if (in_frame)
|
||||
@ -3970,16 +4008,16 @@ void DocxConverter::convert(OOX::Logic::CTr *oox_table_row)
|
||||
|
||||
convert(oox_table_row->m_pTableRowProperties);
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_table_row->m_arrItems.begin(); it != oox_table_row->m_arrItems.end(); ++it)
|
||||
for (size_t i =0; i < oox_table_row->m_arrItems.size(); ++i)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
switch(oox_table_row->m_arrItems[i]->getType())
|
||||
{
|
||||
case OOX::et_w_trPr:
|
||||
{
|
||||
//skip
|
||||
}break;
|
||||
default:
|
||||
convert(*it);
|
||||
convert(oox_table_row->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
odt_context->end_table_row();
|
||||
@ -4030,16 +4068,16 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
|
||||
odt_context->table_context()->set_cell_column_span(oox_table_cell->m_pTableCellProperties->m_oGridSpan->m_oVal->GetValue());
|
||||
}
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_table_cell->m_arrItems.begin(); it != oox_table_cell->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < oox_table_cell->m_arrItems.size(); ++i)
|
||||
{
|
||||
switch((*it)->getType())
|
||||
switch(oox_table_cell->m_arrItems[i]->getType())
|
||||
{
|
||||
case OOX::et_w_tcPr:
|
||||
{
|
||||
//skip
|
||||
}break;
|
||||
default:
|
||||
convert(*it);
|
||||
convert(oox_table_cell->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
odt_context->end_table_cell();
|
||||
|
||||
@ -259,7 +259,7 @@ void PptxConverter::convert_styles()
|
||||
|
||||
void PptxConverter::convert_settings()
|
||||
{
|
||||
|
||||
OoxConverter::convert(presentation->m_pJsaProject.operator ->());
|
||||
}
|
||||
|
||||
void PptxConverter::convert_common()
|
||||
|
||||
@ -205,6 +205,9 @@ void XlsxConverter::convert_sheets()
|
||||
convert(Workbook->m_oDefinedNames->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
OoxConverter::convert(xlsx_document->m_pJsaProject);
|
||||
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CDefinedName *oox_defined)
|
||||
{
|
||||
|
||||
@ -523,7 +523,8 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo()
|
||||
|
||||
if (false == m_pDocument->m_arThemes.empty())
|
||||
{
|
||||
strDefaultTextStyle += CStylesWriter::ConvertStyles(m_pDocument->m_arThemes[0]->m_pStyles[0], 9);
|
||||
CStylesWriter styleWriter(m_pDocument->m_arThemes[0].get());
|
||||
strDefaultTextStyle += styleWriter.ConvertStyles(m_pDocument->m_arThemes[0]->m_pStyles[0], 9);
|
||||
}
|
||||
strDefaultTextStyle += _T("</p:defaultTextStyle>");
|
||||
|
||||
@ -587,7 +588,9 @@ void NSPresentationEditor::CPPTXWriter::WriteThemes()
|
||||
|
||||
for (size_t i = 0; i < m_pDocument->m_arThemes.size(); i++)
|
||||
{
|
||||
WriteTheme(m_pDocument->m_arThemes[i], nIndexTheme, nStartLayout);
|
||||
m_pShapeWriter->m_pTheme = m_pDocument->m_arThemes[i].get();
|
||||
WriteTheme(m_pDocument->m_arThemes[i], nIndexTheme, nStartLayout);
|
||||
m_pShapeWriter->m_pTheme = NULL;
|
||||
}
|
||||
|
||||
WriteTheme(m_pDocument->m_pNotesMaster, nIndexTheme, nStartLayout);
|
||||
@ -776,20 +779,23 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CThemePtr pTheme, int & nInde
|
||||
if (!pTheme->m_bHasFooter) oWriter.WriteString(std::wstring(L" ftr=\"0\""));
|
||||
oWriter.WriteString(std::wstring(L"/>"));
|
||||
}
|
||||
CStylesWriter styleWriter;
|
||||
styleWriter.m_pTheme = pTheme.get();
|
||||
|
||||
if (pTheme->m_eType == typeMaster)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:txStyles>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:titleStyle>"));
|
||||
CStylesWriter::ConvertStyles(pTheme->m_pStyles[1], oWriter, 9);
|
||||
styleWriter.ConvertStyles(pTheme->m_pStyles[1], oWriter, 9);
|
||||
oWriter.WriteString(std::wstring(L"</p:titleStyle>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:bodyStyle>"));
|
||||
CStylesWriter::ConvertStyles(pTheme->m_pStyles[2], oWriter, 9);
|
||||
styleWriter.ConvertStyles(pTheme->m_pStyles[2], oWriter, 9);
|
||||
oWriter.WriteString(std::wstring(L"</p:bodyStyle>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:otherStyle>"));
|
||||
CStylesWriter::ConvertStyles(pTheme->m_pStyles[3], oWriter, 9);
|
||||
styleWriter.ConvertStyles(pTheme->m_pStyles[3], oWriter, 9);
|
||||
oWriter.WriteString(std::wstring(L"</p:otherStyle>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"</p:txStyles>"));
|
||||
@ -797,7 +803,7 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CThemePtr pTheme, int & nInde
|
||||
else if (pTheme->m_eType == typeNotesMaster)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:notesStyle>"));
|
||||
CStylesWriter::ConvertStyles(pTheme->m_pStyles[1], oWriter, 9);
|
||||
styleWriter.ConvertStyles(pTheme->m_pStyles[1], oWriter, 9);
|
||||
oWriter.WriteString(std::wstring(L"</p:notesStyle>"));
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
*/
|
||||
#include "ShapeWriter.h"
|
||||
#include "StylesWriter.h"
|
||||
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Theme.h"
|
||||
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsXlsxConverter/ShapeType.h"
|
||||
#include "../../../Common/MS-LCID.h"
|
||||
@ -39,6 +40,9 @@
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h"
|
||||
|
||||
CStylesWriter::CStylesWriter() : m_pTheme(NULL) {}
|
||||
CStylesWriter::CStylesWriter(NSPresentationEditor::CTheme* pTheme) : m_pTheme(pTheme) {}
|
||||
|
||||
void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel, NSPresentationEditor::CStringWriter& oWriter, const int& nLevel)
|
||||
{//дублирование CTextPFRun и CTextCFRun с ShapeWriter - todooo - вынести отдельно
|
||||
std::wstring str1;
|
||||
@ -243,24 +247,31 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe
|
||||
oWriter.WriteString(L"<a:solidFill><a:srgbClr val=\"" + strColor + L"\"/></a:solidFill>");
|
||||
}
|
||||
}
|
||||
if (pCF->Typeface.is_init())
|
||||
if ((pCF->FontProperties.is_init()) && (!pCF->FontProperties->strFontName.empty()))
|
||||
{
|
||||
if (0 == pCF->Typeface.get())
|
||||
oWriter.WriteString(L"<a:latin typeface=\"" + pCF->FontProperties->strFontName + L"\"/>");
|
||||
}
|
||||
else if (pCF->fontRef.is_init())
|
||||
{
|
||||
if ((m_pTheme) && (pCF->fontRef.get() < m_pTheme->m_arFonts.size()))
|
||||
{
|
||||
oWriter.WriteString(L"<a:latin typeface=\"+mj-lt\"/>");
|
||||
oWriter.WriteString(L"<a:latin typeface=\"" + m_pTheme->m_arFonts[pCF->fontRef.get()].Name + L"\"/>");
|
||||
}
|
||||
else
|
||||
{
|
||||
oWriter.WriteString(L"<a:latin typeface=\"+mn-lt\"/>");
|
||||
if (0 == pCF->fontRef.get())
|
||||
{
|
||||
oWriter.WriteString(L"<a:latin typeface=\"+mj-lt\"/>");
|
||||
}
|
||||
else
|
||||
{
|
||||
oWriter.WriteString(L"<a:latin typeface=\"+mn-lt\"/>");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((pCF->FontProperties.is_init()) && (!pCF->FontProperties->strFontName.empty()))
|
||||
{
|
||||
oWriter.WriteString(L"<a:latin typeface=\"" + pCF->FontProperties->strFontName + L"\"/>");
|
||||
}
|
||||
if (pCF->FontPropertiesEA.is_init())
|
||||
{
|
||||
oWriter.WriteString(L"<a:ea typeface=\"" + pCF->FontPropertiesEA->strFontName + L"\"/>");
|
||||
oWriter.WriteString(L"<a:cs typeface=\"" + pCF->FontPropertiesEA->strFontName + L"\"/>");
|
||||
}
|
||||
if (pCF->FontPropertiesSym.is_init())
|
||||
{
|
||||
@ -278,6 +289,7 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe
|
||||
}
|
||||
NSPresentationEditor::CShapeWriter::CShapeWriter()
|
||||
{
|
||||
m_pTheme = NULL;
|
||||
m_pRels = NULL;
|
||||
m_lNextShapeID = 1000;
|
||||
|
||||
@ -979,7 +991,8 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
|
||||
|
||||
if (!m_bWordArt)
|
||||
{
|
||||
CStylesWriter::ConvertStyles(pShapeElement->m_pShape->m_oText.m_oStyles, m_oWriter);
|
||||
CStylesWriter styleWriter(m_pTheme);
|
||||
styleWriter.ConvertStyles(pShapeElement->m_pShape->m_oText.m_oStyles, m_oWriter);
|
||||
}
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"</a:lstStyle>"));
|
||||
@ -1267,24 +1280,32 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
|
||||
}
|
||||
}
|
||||
|
||||
if (pCF->Typeface.is_init())
|
||||
{
|
||||
if (0 == pCF->Typeface.get())
|
||||
{
|
||||
m_oWriter.WriteString(L"<a:latin typeface=\"+mj-lt\"/>");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oWriter.WriteString(L"<a:latin typeface=\"+mn-lt\"/>");
|
||||
}
|
||||
}
|
||||
else if (pCF->FontProperties.is_init())
|
||||
if (pCF->FontProperties.is_init())
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L"<a:latin typeface=\"") + pCF->FontProperties->strFontName + _T("\"/>"));
|
||||
}
|
||||
else if (pCF->fontRef.is_init())
|
||||
{
|
||||
if ((m_pTheme) && (pCF->fontRef.get() < m_pTheme->m_arFonts.size()))
|
||||
{
|
||||
m_oWriter.WriteString(L"<a:latin typeface=\"" + m_pTheme->m_arFonts[pCF->fontRef.get()].Name + L"\"/>");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 == pCF->fontRef.get())
|
||||
{
|
||||
m_oWriter.WriteString(L"<a:latin typeface=\"+mj-lt\"/>");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oWriter.WriteString(L"<a:latin typeface=\"+mn-lt\"/>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pCF->FontPropertiesEA.is_init())
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L"<a:ea typeface=\"") + pCF->FontPropertiesEA->strFontName + _T("\"/>"));
|
||||
m_oWriter.WriteString(std::wstring(L"<a:cs typeface=\"") + pCF->FontPropertiesEA->strFontName + L"\"/>");
|
||||
}
|
||||
if (pCF->FontPropertiesSym.is_init())
|
||||
{
|
||||
|
||||
@ -146,6 +146,8 @@ namespace NSPresentationEditor
|
||||
|
||||
NSPresentationEditor::CRelsGenerator* m_pRels;
|
||||
|
||||
NSPresentationEditor::CTheme* m_pTheme;
|
||||
|
||||
LONG m_lNextShapeID;
|
||||
|
||||
bool m_bWordArt;
|
||||
|
||||
@ -31,9 +31,42 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace NSPresentationEditor
|
||||
{
|
||||
class CTheme;
|
||||
}
|
||||
class CStylesWriter
|
||||
{
|
||||
public:
|
||||
CStylesWriter(NSPresentationEditor::CTheme* m_pTheme);
|
||||
CStylesWriter();
|
||||
|
||||
NSPresentationEditor::CTheme* m_pTheme;
|
||||
|
||||
void ConvertStyles(NSPresentationEditor::CTextStyles& oStyles, NSPresentationEditor::CStringWriter& oWriter, int nCount = 10)
|
||||
{
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
if (oStyles.m_pLevels[i].is_init())
|
||||
ConvertStyleLevel(oStyles.m_pLevels[i].get(), oWriter, i);
|
||||
}
|
||||
}
|
||||
std::wstring ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel, const int& nLevel)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter oWriter;
|
||||
ConvertStyleLevel(oLevel, oWriter, nLevel);
|
||||
return oWriter.GetData();
|
||||
}
|
||||
|
||||
void ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel,
|
||||
NSPresentationEditor::CStringWriter& oWriter, const int& nLevel);
|
||||
|
||||
std::wstring ConvertStyles(NSPresentationEditor::CTextStyles& oStyles, int nCount = 10)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter oWriter;
|
||||
ConvertStyles(oStyles, oWriter, nCount);
|
||||
return oWriter.GetData();
|
||||
}
|
||||
AVSINLINE static std::wstring GetTextAnchor(const WORD& value)
|
||||
{
|
||||
if (0 == value) return L"t";
|
||||
@ -88,27 +121,5 @@ public:
|
||||
return L"auto";
|
||||
}
|
||||
|
||||
static std::wstring ConvertStyles(NSPresentationEditor::CTextStyles& oStyles, int nCount = 10)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter oWriter;
|
||||
ConvertStyles(oStyles, oWriter, nCount);
|
||||
return oWriter.GetData();
|
||||
}
|
||||
static void ConvertStyles(NSPresentationEditor::CTextStyles& oStyles, NSPresentationEditor::CStringWriter& oWriter, int nCount = 10)
|
||||
{
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
if (oStyles.m_pLevels[i].is_init())
|
||||
ConvertStyleLevel(oStyles.m_pLevels[i].get(), oWriter, i);
|
||||
}
|
||||
}
|
||||
static std::wstring ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel, const int& nLevel)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter oWriter;
|
||||
ConvertStyleLevel(oLevel, oWriter, nLevel);
|
||||
return oWriter.GetData();
|
||||
}
|
||||
|
||||
static void ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel,
|
||||
NSPresentationEditor::CStringWriter& oWriter, const int& nLevel);
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user