Compare commits

...

11 Commits

27 changed files with 1688 additions and 572 deletions

View File

@ -1877,25 +1877,22 @@ public:
sRes += L"\"";
}
sRes += L">";
if(false == pComment->Text.empty())
std::wstring sText = pComment->Text;
XmlUtils::replace_all(sText, L"\r", L"");
bool bFirst = true;
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
{
std::wstring sText = pComment->Text;
XmlUtils::replace_all(sText, L"\r", L"");
bool bFirst = true;
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
wchar_t cToken = sText[i];
if('\n' == cToken)
{
wchar_t cToken = sText[i];
if('\n' == cToken)
{
bFirst = writeContentWritePart(pComment, sText, nPrevIndex, i, bFirst, sRes);
nPrevIndex = i + 1;
}
bFirst = writeContentWritePart(pComment, sText, nPrevIndex, i, bFirst, sRes);
nPrevIndex = i + 1;
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
sRes += L"</w:comment>";
return sRes;
}

View File

@ -39,10 +39,9 @@
namespace cpdoccore {
namespace oox {
/**/
docx_table_state::docx_table_state(docx_conversion_context & Context,
const std::wstring & StyleName) : context_(Context),
docx_table_state::docx_table_state(docx_conversion_context & Context, const std::wstring & StyleName) :
context_(Context),
table_style_(StyleName),
current_table_column_(-1),
columns_spanned_num_(0),
@ -93,6 +92,19 @@ std::wstring docx_table_state::current_row_style() const
return L"";
}
double docx_table_state::get_current_cell_width()
{
if (current_table_column_ < columns_width_.size())
return columns_width_[current_table_column_];
else
return 0;
}
void docx_table_state::add_column_width(double width)
{
columns_width_.push_back(width);
}
void docx_table_state::start_cell()
{
current_table_column_++;
@ -102,7 +114,6 @@ void docx_table_state::start_cell()
void docx_table_state::end_cell()
{}
bool docx_table_state::start_covered_cell(docx_conversion_context & Context)
{
std::wostream & _Wostream = context_.output_stream();

View File

@ -70,6 +70,8 @@ public:
void set_rows_spanned(unsigned int Column, unsigned int Val, unsigned int ColumnsSpanned, const std::wstring & Style);
unsigned int current_rows_spanned(unsigned int Column) const;
double get_current_cell_width();
void add_column_width(double width);
private:
docx_conversion_context & context_;
std::wstring table_style_;
@ -81,7 +83,8 @@ private:
std::vector<table_row_spanned> rows_spanned_;
bool close_table_covered_cell_;
std::vector<unsigned int> columns_;
std::vector<std::wstring> columnsDefaultCellStyleName_;
std::vector<double> columns_width_;
std::vector<std::wstring> columnsDefaultCellStyleName_;
};
@ -135,6 +138,14 @@ public:
{
return table_states_.back().start_cell();
}
double get_current_cell_width()
{
return table_states_.back().get_current_cell_width();
}
void add_column_width(double width)
{
table_states_.back().add_column_width(width);
}
void end_cell()
{

View File

@ -56,6 +56,39 @@ std::wostream & operator << (std::wostream & _Wostream, const style_numformat &
case style_numformat::alphaLc:
_Wostream << L"a";
break;
case style_numformat::aiueo:
_Wostream << L"ア, イ, ウ, ...";
break;
case style_numformat::chineseCounting:
_Wostream << L"イ, ロ, ハ, ...";
break;
case style_numformat::chineseLegal:
_Wostream << L"一, 二, 三, ...";
break;
case style_numformat::ideographLegal:
_Wostream << L"壹, 貳, 參, ...";
break;
case style_numformat::ideographTraditional:
_Wostream << L"甲, 乙, 丙, ...";
break;
case style_numformat::ideographZodiac:
_Wostream << L"子, 丑, 寅, ...";
break;
case style_numformat::ideographZodiacTraditional:
_Wostream << L"甲子, 乙丑, 丙寅, ...";
break;
case style_numformat::iroha:
_Wostream << L"イ, ロ, ハ, ...";
break;
case style_numformat::koreanDigital:
_Wostream << L"일, 이, 삼, ...";
break;
case style_numformat::russianLo:
_Wostream << L"А, Б, .., Аа, Аб, ... (ru)";
break;
case style_numformat::russianUp:
_Wostream << L"А, Б, .., Аа, Аб, ... (ru)";
break;
default:
break;
}
@ -77,7 +110,28 @@ style_numformat style_numformat::parse(const std::wstring & Str)
return style_numformat( alphaUc );
else if (tmp == L"a")
return style_numformat( alphaLc );
else
else if (tmp == L"А, Б, .., Аа, Аб, ... (ru)")
return style_numformat( russianUp );
else if (tmp == L"일, 이, 삼, ...")
return style_numformat( koreanDigital );
else if (tmp == L"イ, ロ, ハ, ...")
return style_numformat( iroha );
else if (tmp == L"甲, 乙, 丙, ...")
return style_numformat( ideographTraditional );
else if (tmp == L"甲子, 乙丑, 丙寅, ...")
return style_numformat( ideographZodiacTraditional );
else if (tmp == L"子, 丑, 寅, ...")
return style_numformat( ideographZodiac );
else if (tmp == L"壹, 貳, 參, ...")
return style_numformat( ideographLegal );
else if (tmp == L"一, 二, 三, ...")
return style_numformat( chineseLegal );
else if (tmp == L"イ, ロ, ハ, ...")
return style_numformat( chineseCounting );
else if (tmp == L"ア, イ, ウ, ...")
return style_numformat( aiueo );
else
{
return style_numformat( arabic );
}

View File

@ -52,7 +52,18 @@ public:
romanUc,
romanLc,
alphaUc,
alphaLc
alphaLc,
aiueo,
chineseCounting,
chineseLegal,
ideographLegal,
ideographTraditional,
ideographZodiac,
ideographZodiacTraditional,
iroha,
koreanDigital,
russianLo,
russianUp
};
style_numformat() {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -567,6 +567,10 @@
<Filter
Name="___"
>
<File
RelativePath="..\source\Writer\OOXCommentsWriter.h"
>
</File>
<File
RelativePath="..\source\Writer\OOXContentTypesWriter.h"
>

View File

@ -1007,32 +1007,32 @@ bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRea
//COMMAND_RTF_BOOL( "ul", charProps->m_bUnderline, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "ulc", charProps->m_nUnderlineColor, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "uld", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dotted)
COMMAND_RTF_INT ( "uld", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dotted)
COMMAND_RTF_INT ( "uldash", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dashed)
COMMAND_RTF_INT ( "uldashd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dotted)
COMMAND_RTF_INT ( "uldashdd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dot_dotted)
COMMAND_RTF_INT ( "uldb", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Double)
COMMAND_RTF_INT ( "ulhwave", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Heavy_wave)
COMMAND_RTF_INT ( "ulldash", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Long_dashe)
COMMAND_RTF_INT ( "uldashd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dotted)
COMMAND_RTF_INT ( "uldashdd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dot_dotted)
COMMAND_RTF_INT ( "uldb", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Double)
COMMAND_RTF_INT ( "ulhwave", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Heavy_wave)
COMMAND_RTF_INT ( "ulldash", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Long_dashe)
COMMAND_RTF_INT ( "ulnone", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_none)
COMMAND_RTF_INT ( "ulth", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick)
COMMAND_RTF_INT ( "ulthd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dotted)
COMMAND_RTF_INT ( "ulthdash", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dashed)
COMMAND_RTF_INT ( "ulthdashd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dash_dotted)
COMMAND_RTF_INT ( "ulth", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick)
COMMAND_RTF_INT ( "ulthd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dotted)
COMMAND_RTF_INT ( "ulthdash", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dashed)
COMMAND_RTF_INT ( "ulthdashd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dash_dotted)
COMMAND_RTF_INT ( "ulthdashdd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dash_dot_dotted)
COMMAND_RTF_INT ( "ulthldash", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_long_dashed)
COMMAND_RTF_INT ( "ulthldash", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_long_dashed)
COMMAND_RTF_INT ( "ululdbwave", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Double_wave)
COMMAND_RTF_INT ( "ulw", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Word)
COMMAND_RTF_INT ( "ulw", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Word)
COMMAND_RTF_INT ( "ulwave", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Wave)
COMMAND_RTF_INT ( "up", charProps->m_nUp, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "crauth", charProps->m_nCrAuth, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "crdate", charProps->m_nCrDate, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "insrsid", charProps->m_nInsrsid, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "insrsid", charProps->m_nInsrsid, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "revauth", charProps->m_nRevauth, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "revdttm", charProps->m_nRevdttm, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "revauth", charProps->m_nRevauth, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "revdttm", charProps->m_nRevdttm, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "revauthdel", charProps->m_nRevauthDel, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "revdttmdel", charProps->m_nRevdttmDel, sCommand, hasParameter, parameter)
@ -2814,7 +2814,69 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
if ( pNewBookmarkEnd->IsValid() )
m_oCurParagraph->AddItem( pNewBookmarkEnd );
}
else if ( "footnote" == sCommand )
else if ( "atrfstart" == sCommand )
{
RtfAnnotElemPtr pNewAnnotElem ( new RtfAnnotElem(1) );
RtfAnnotElemReader oAnnotElemReader ( *pNewAnnotElem );
oAbstrReader.StartSubReader( oAnnotElemReader, oDocument, oReader );
if ( pNewAnnotElem->IsValid() )
m_oCurParagraph->AddItem( pNewAnnotElem );
}
else if ( "atrfend" == sCommand )
{
RtfAnnotElemPtr pNewAnnotElem ( new RtfAnnotElem(2) );
RtfAnnotElemReader oAnnotElemReader ( *pNewAnnotElem );
oAbstrReader.StartSubReader( oAnnotElemReader, oDocument, oReader );
if ( pNewAnnotElem->IsValid() )
m_oCurParagraph->AddItem( pNewAnnotElem );
}
else if ( "annotation" == sCommand )
{
RtfAnnotationPtr pNewAnnot ( new RtfAnnotation() );
RtfAnnotationReader oAnnotReader ( *pNewAnnot );
oAbstrReader.StartSubReader( oAnnotReader, oDocument, oReader );
if ( pNewAnnot->IsValid() )
m_oCurParagraph->AddItem( pNewAnnot );
}
else if ( "atnid" == sCommand )
{
RtfAnnotElemPtr pNewAnnotElem ( new RtfAnnotElem(5) );
RtfAnnotElemReader oAnnotElemReader( *pNewAnnotElem );
oAbstrReader.StartSubReader( oAnnotElemReader, oDocument, oReader );
//if ( pNewAnnotElem->IsValid() )
// m_oCurParagraph->AddItem( pNewAnnotElem );
}
else if ( "atnauthor" == sCommand )
{
RtfAnnotElemPtr pNewAnnotElem ( new RtfAnnotElem(4) );
RtfAnnotElemReader oAnnotElemReader( *pNewAnnotElem );
oAbstrReader.StartSubReader( oAnnotElemReader, oDocument, oReader );
//if ( pNewAnnotElem->IsValid() )
// m_oCurParagraph->AddItem( pNewAnnotElem );
}
else if ( "atnref" == sCommand )
{
RtfAnnotElemPtr pNewAnnotElem ( new RtfAnnotElem(3) );
RtfAnnotElemReader oAnnotElemReader ( *pNewAnnotElem );
oAbstrReader.StartSubReader( oAnnotElemReader, oDocument, oReader );
if ( pNewAnnotElem->IsValid() )
m_oCurParagraph->AddItem( pNewAnnotElem );
}
else if ( "footnote" == sCommand )
{
RtfFootnotePtr pNewFootnote ( new RtfFootnote() );
pNewFootnote->m_oCharProp = oReader.m_oState->m_oCharProp;
@ -2825,6 +2887,14 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
if ( pNewFootnote->IsValid() )
m_oCurParagraph->AddItem( pNewFootnote );
}
//else if ( "chatn" == sCommand )
//{
// RtfCharSpecialPtr pNewChar ( new RtfCharSpecial() );
//
// pNewChar->m_oProperty = oReader.m_oState->m_oCharProp;
// pNewChar->m_eType = RtfCharSpecial::rsc_chatn;
// m_oCurParagraph->AddItem( pNewChar );
//}
else if ( "chftn" == sCommand )
{
if ( 1 == oReader.m_nFootnote )

View File

@ -1513,6 +1513,40 @@ private:
m_oField.m_bTextOnly = true;
}
};
class RtfAnnotElemReader: public RtfAbstractReader
{
public:
RtfAnnotElem& m_oAnnot;
RtfAnnotElemReader( RtfAnnotElem& oAnnot ) : m_oAnnot(oAnnot)
{
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
{
if( "atrfstart" == sCommand )
;
else if( "atrfend" == sCommand )
;
else if( "atnref" == sCommand )
;
else if( "atndate" == sCommand )
;
else if( "atnid" == sCommand )
;
else if( "atnauthor" == sCommand )
;
else if ( "atnparent" == sCommand )
;
else
return false;
return true;
}
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, std::wstring sText)
{
m_oAnnot.m_sValue += sText ;
}
};
class RtfBookmarkStartReader: public RtfAbstractReader
{
@ -1679,6 +1713,60 @@ public:
oReader.m_nFootnote = PROP_DEF;
}
};
class RtfAnnotationReader: public RtfAbstractReader
{
private:
RtfParagraphPropDestination m_oParPropDest;
public:
RtfAnnotation& m_oRtfAnnotation;
RtfAnnotationReader( RtfAnnotation& oRtfAnnotation ) : m_oRtfAnnotation(oRtfAnnotation)
{
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
{
if( "annotation" == sCommand )
{
return true;
}
else if( "atnref" == sCommand )
{
m_oRtfAnnotation.m_oRef = RtfAnnotElemPtr ( new RtfAnnotElem(3) );
RtfAnnotElemReader oAnnotReader ( *m_oRtfAnnotation.m_oRef );
StartSubReader( oAnnotReader, oDocument, oReader );
}
else if( "atndate" == sCommand )
{
m_oRtfAnnotation.m_oDate = RtfAnnotElemPtr ( new RtfAnnotElem(6) );
RtfAnnotElemReader oAnnotReader ( *m_oRtfAnnotation.m_oDate );
StartSubReader( oAnnotReader, oDocument, oReader );
}
else if( "atnparent" == sCommand )
{
m_oRtfAnnotation.m_oParent = RtfAnnotElemPtr ( new RtfAnnotElem(7) );
RtfAnnotElemReader oAnnotReader ( *m_oRtfAnnotation.m_oParent );
StartSubReader( oAnnotReader, oDocument, oReader );
}
else
return m_oParPropDest.ExecuteCommand( oDocument, oReader, (*this), sCommand, hasParameter, parameter );
return true;
}
void ExecuteText( RtfDocument& oDocument, RtfReader& oReader, std::wstring sText )
{
m_oParPropDest.ExecuteText( oDocument, oReader, sText );
}
void ExitReader( RtfDocument& oDocument, RtfReader& oReader )
{
m_oParPropDest.Finalize( oReader );
m_oRtfAnnotation.m_oContent = m_oParPropDest.m_oTextItems;
}
};
class RtfDefParPropReader: public RtfAbstractReader
{
private:

View File

@ -34,6 +34,7 @@
#include "Writer/OOXWriter.h"
#include "Writer/OOXFootnoteWriter.h"
#include "Writer/OOXCommentsWriter.h"
#include "Utils.h"
@ -56,11 +57,10 @@ std::wstring RtfBookmarkStart::RenderToRtf(RenderParameter oRenderParameter)
std::wstring RtfBookmarkStart::RenderToOOX(RenderParameter oRenderParameter)
{
std::wstring sResult;
//ATLASSERT( false == m_sName.empty() );
sResult += L"<w:bookmarkStart";
OOXWriter * poOOXWriter = static_cast<OOXWriter*> ( oRenderParameter.poWriter );
RtfDocument * poDocument = static_cast<RtfDocument*> (oRenderParameter.poDocument);
RtfDocument * poDocument = static_cast<RtfDocument*> ( oRenderParameter.poDocument );
std::map<std::wstring, int>::iterator pPair = poOOXWriter->m_aBookmarksId.find( m_sName );
@ -118,6 +118,112 @@ std::wstring RtfBookmarkEnd::RenderToOOX(RenderParameter oRenderParameter)
sResult += L"/>";
return sResult;
}
std::wstring RtfAnnotElem::RenderToRtf(RenderParameter oRenderParameter)
{
std::wstring sResult;
if (m_nType == 1) sResult += L"{\\*\\atrfstart " + m_sValue + L"}";
else if (m_nType = 2) sResult += L"{\\*\\atrfend " + m_sValue + L"}";
else if (m_nType = 3) sResult += L"{\\*\\atnref " + m_sValue + L"}";
return sResult;
}
std::wstring RtfAnnotElem::RenderToOOX(RenderParameter oRenderParameter)
{
if (m_nType > 3 || m_nType < 1) return L"";
std::wstring sResult;
OOXWriter* poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
OOXCommentsWriter* poCommentsWriter = static_cast<OOXCommentsWriter*>( poOOXWriter->m_poCommentsWriter );
std::map<std::wstring, int>::iterator pFind = poCommentsWriter->m_mapRefs.find(m_sValue);
int id = -1;
if (pFind == poCommentsWriter->m_mapRefs.end())
{
id = poCommentsWriter->m_mapRefs.size() ;//+ 1;
poCommentsWriter->m_mapRefs.insert(std::make_pair(m_sValue, id));
}
else
{
id = pFind->second;
}
if (m_nType == 1) sResult += L"<w:commentRangeStart w:id=\"" + std::to_wstring(id) + L"\"/>";
else if (m_nType == 3) sResult += L"<w:commentReference w:id=\"" + std::to_wstring(id) + L"\"/>";
else if (m_nType == 2)
{
sResult += L"<w:commentRangeEnd w:id=\"" + std::to_wstring(id) + L"\"/>";
sResult += L"<w:r><w:commentReference w:id=\"" + std::to_wstring(id) + L"\"/></w:r>";
}
return sResult;
}
std::wstring RtfAnnotation::RenderToRtf(RenderParameter oRenderParameter)
{
std::wstring sResult;
if (m_oRef)
{
if (m_oRef->m_nType == 1) sResult += L"{\\*\\atrfstart " + m_oRef->m_sValue + L"}";
else if (m_oRef->m_nType = 2) sResult += L"{\\*\\atrfend " + m_oRef->m_sValue + L"}";
else if (m_oRef->m_nType = 3) sResult += L"{\\*\\atnref " + m_oRef->m_sValue + L"}";
}
return sResult;
}
std::wstring RtfAnnotation::RenderToOOX(RenderParameter oRenderParameter)
{
OOXWriter* poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
OOXCommentsWriter* poCommentsWriter = static_cast<OOXCommentsWriter*>( poOOXWriter->m_poCommentsWriter );
std::wstring sResult;
sResult += L"<w:comment";
int id = -1;
if (m_oRef)
{
std::map<std::wstring, int>::iterator pFind = poCommentsWriter->m_mapRefs.find(m_oRef->m_sValue);
if (pFind == poCommentsWriter->m_mapRefs.end())
{
id = poCommentsWriter->m_mapRefs.size();// + 1;
poCommentsWriter->m_mapRefs.insert(std::make_pair(m_oRef->m_sValue, id));
}
else
{
id = pFind->second;
}
sResult += L" w:id=\"" + std::to_wstring(id) + L"\"";
}
sResult += L" w:author=\"Elena S\"";
if (m_oDate)
{
int nValue = boost::lexical_cast<int>(m_oDate->m_sValue);
sResult += L" w:date=\"" + RtfUtility::convertDateTime(nValue) + L"\"";
}
sResult += L" w:initials=\"ES\"";
sResult += L">";
if (m_oContent)
{
RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_OOX_PARAM_COMMENT;
oNewParameter.poRels = poCommentsWriter->m_oRelsWriter.get();
sResult += m_oContent->RenderToOOX(oNewParameter);
}
sResult += L"</w:comment>";
std::wstring sParaId = XmlUtils::IntToString(poOOXWriter->m_nextParaId, L"%08X");//last para id in comment
poCommentsWriter->AddComment(id, sResult, sParaId, m_oParent ? boost::lexical_cast<int>(m_oParent->m_sValue) : 0);
return L"";
}
std::wstring RtfFootnote::RenderToRtf(RenderParameter oRenderParameter)
{
std::wstring sResult;
@ -147,9 +253,11 @@ std::wstring RtfFootnote::RenderToOOX(RenderParameter oRenderParameter)
{
int nID = poDocument->m_oIdGenerator.Generate_EndnoteNumber();
OOXEndnoteWriter* poEndnoteWriter = static_cast<OOXEndnoteWriter*>( poOOXWriter->m_poEndnoteWriter );
RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
oNewParameter.poRels = poEndnoteWriter->m_oRelsWriter.get();
poEndnoteWriter->AddEndnote( L"", nID, m_oContent->RenderToOOX(oNewParameter) );
sResult += L"<w:r>";

View File

@ -64,6 +64,48 @@ public:
std::wstring RenderToRtf(RenderParameter oRenderParameter);
std::wstring RenderToOOX(RenderParameter oRenderParameter);
};
class RtfAnnotElem : public IDocumentElement
{
public:
std::wstring m_sValue;
int m_nType;
RtfAnnotElem(int type = 0) : m_nType (type)
{
}
int GetType()
{
return TYPE_RTF_ANNOTVALUE;
}
std::wstring RenderToRtf(RenderParameter oRenderParameter);
std::wstring RenderToOOX(RenderParameter oRenderParameter);
};
typedef boost::shared_ptr<RtfAnnotElem> RtfAnnotElemPtr;
class RtfAnnotation : public IDocumentElement
{
public:
RtfAnnotElemPtr m_oRef;
RtfAnnotElemPtr m_oDate;
RtfAnnotElemPtr m_oParent;
TextItemContainerPtr m_oContent;
RtfCharProperty m_oCharProp;
RtfAnnotation()
{
m_oContent = TextItemContainerPtr( new TextItemContainer() );
}
int GetType()
{
return TYPE_RTF_ANNOTATION;
}
std::wstring RenderToRtf(RenderParameter oRenderParameter);
std::wstring RenderToOOX(RenderParameter oRenderParameter);
};
typedef boost::shared_ptr<RtfAnnotation> RtfAnnotationPtr;
class RtfFootnote : public IDocumentElement
{
public:

View File

@ -40,7 +40,7 @@ std::wstring RtfChar::RenderToOOX(RenderParameter oRenderParameter)
OOXWriter* poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
std::wstring sResult;
if (RENDER_TO_OOX_PARAM_RUN == oRenderParameter.nType)
if (RENDER_TO_OOX_PARAM_RUN == oRenderParameter.nType)
{
bool bInsert = false;
bool bDelete = false;
@ -69,6 +69,7 @@ std::wstring RtfChar::RenderToOOX(RenderParameter oRenderParameter)
sResult += L"<w:rPr>";
sResult += m_oProperty.RenderToOOX(oRenderParameter);
sResult += L"</w:rPr>";
sResult += renderTextToXML(L"Text", bDelete );
sResult += L"</w:r>";

View File

@ -82,6 +82,11 @@ const long g_cdMaxPercent = 1000000;
#define TYPE_RTF_FOOTNOTE 30
#define TYPE_RTF_ANNOTSTART 31
#define TYPE_RTF_ANNOTEND 32
#define TYPE_RTF_ANNOTVALUE 33
#define TYPE_RTF_ANNOTATION 34
#define RENDER_TO_OOX_PARAM_UNKNOWN 0
#define RENDER_TO_OOX_PARAM_LAST 1
#define RENDER_TO_OOX_PARAM_RUN 2
@ -107,6 +112,7 @@ const long g_cdMaxPercent = 1000000;
#define RENDER_TO_OOX_PARAM_OLE_ONLY 25
#define RENDER_TO_OOX_PARAM_OLDLIST_ABS 26
#define RENDER_TO_OOX_PARAM_OLDLIST_OVR 27
#define RENDER_TO_OOX_PARAM_COMMENT 28
#define RENDER_TO_RTF_PARAM_UNKNOWN 0
#define RENDER_TO_RTF_PARAM_CHAR 1

View File

@ -32,6 +32,8 @@
#include "RtfParagraph.h"
#include "RtfWriter.h"
#include "Writer/OOXWriter.h"
int RtfParagraph::AddItem( IDocumentElementPtr piRend )
{
if( TYPE_RTF_CHAR == piRend->GetType() )
@ -85,7 +87,10 @@ std::wstring RtfParagraph::RenderToRtf(RenderParameter oRenderParameter)
std::wstring RtfParagraph::RenderToOOX(RenderParameter oRenderParameter)
{
std::wstring sResult ;
OOXWriter* poOOXWriter = static_cast<OOXWriter*>(oRenderParameter.poWriter);
std::wstring sResult ;
if( RENDER_TO_OOX_PARAM_PLAIN == oRenderParameter.nType )
{
for (size_t i = 0; i < m_aArray.size(); i++ )
@ -125,7 +130,8 @@ std::wstring RtfParagraph::RenderToOOX(RenderParameter oRenderParameter)
if( NULL != m_oOldList )
bCanConvertToNumbering = m_oOldList->CanConvertToNumbering();
sResult += L"<w:p>";
std::wstring sParaId = XmlUtils::IntToString(++poOOXWriter->m_nextParaId, L"%08X");
sResult += L"<w:p w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\">";
sResult += L"<w:pPr>";
m_oProperty.m_bOldList = (NULL != m_oOldList);
@ -162,7 +168,15 @@ std::wstring RtfParagraph::RenderToOOX(RenderParameter oRenderParameter)
}
}
}
if (oRenderParameter.nType == RENDER_TO_OOX_PARAM_COMMENT)
{
sResult += L"<w:r>";
sResult += L"<w:rPr>";
sResult += m_oProperty.m_oCharProperty.RenderToOOX(oRenderParameter);
sResult += L"</w:rPr>";
sResult += L"<w:annotationRef/>";
sResult += L"</w:r>";
}
oNewParam.nType = RENDER_TO_OOX_PARAM_RUN;
std::wstring ParagraphContent;

View File

@ -0,0 +1,166 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "OOXWriter.h"
class OOXCommentsWriter
{
public:
OOXRelsWriterPtr m_oRelsWriter;
OOXCommentsWriter( OOXWriter& oWriter, RtfDocument& oDocument ) : m_oWriter(oWriter), m_oDocument(oDocument)
{
m_oRelsWriter = OOXRelsWriterPtr( new OOXRelsWriter( _T("comments.xml"), oDocument ) );
oWriter.m_oCustomRelsWriter.push_back( m_oRelsWriter );
}
void AddComment( int nID, std::wstring sText, const std::wstring & paraId, int nParentID)
{
m_sComments += sText;
m_mapCommentsParent.insert(std::make_pair(nID, paraId));
m_sCommentsExtended += L"<w15:commentEx w15:paraId=\"" + paraId + L"\"";
if (nParentID != 0)
{
nParentID = nID + nParentID;
std::map<int, std::wstring>::iterator pFind = m_mapCommentsParent.find(nParentID);
if (pFind != m_mapCommentsParent.end())
{
m_sCommentsExtended += L" w15:paraIdParent=\"" + pFind->second + L"\"";
}
}
m_sCommentsExtended += L" w15:done=\"0\"/>";
}
bool Save( std::wstring sFolder )
{
if( m_sComments.empty() ) return false;
CFile file;
if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + _T("comments.xml"))) return false;
m_oWriter.m_oDocRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"), _T("comments.xml") );
m_oWriter.m_oContentTypes.AddContent( _T("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"), _T("/word/comments.xml") );
std::wstring sXml = CreateXml();
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml);
file.WriteFile((void*)sXmlUTF.c_str(), (DWORD)sXmlUTF.length());
file.CloseFile();
//-------------------------------------------------------------------------------------------------------------------------
if( m_sCommentsExtended.empty() ) return true;
if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + L"commentsExtended.xml")) return false;
m_oWriter.m_oDocRels.AddRelationship( L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended", L"commentsExtended.xml" );
m_oWriter.m_oContentTypes.AddContent( L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word/commentsExtended.xml" );
sXml = CreateXmlExtended();
sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml);
file.WriteFile((void*)sXmlUTF.c_str(), (DWORD)sXmlUTF.length());
file.CloseFile();
return true;
}
std::map<std::wstring, int> m_mapRefs;
std::map<int, std::wstring> m_mapCommentsParent;
private:
RtfDocument& m_oDocument;
OOXWriter& m_oWriter;
std::wstring m_sComments;
std::wstring m_sCommentsExtended;
std::wstring CreateXml()
{
std::wstring sResult;
sResult += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
sResult += _T("<w:comments \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2008/9/16/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2009/2/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingShape\">");
sResult += m_sComments;
sResult += _T("</w:comments>");
return sResult;
}
std::wstring CreateXmlExtended()
{
std::wstring sResult;
sResult += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
sResult += _T("<w15:commentsEx \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" \
xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 w15 w16se wp14\">");
sResult += m_sCommentsExtended;
sResult += _T("</w15:commentsEx>");
return sResult;
}
};

View File

@ -51,27 +51,28 @@ std::wstring OOXDocumentWriter::CreateXmlStart()
//пишем document.xml
std::wstring sResult = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";
sResult += L"<w:document ";
sResult += L"xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
sResult += L"<w:document \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" \
xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
mc:Ignorable=\"w14 wp14\"";
sResult += L">";
mc:Ignorable=\"w14 w15 w16se wp14\">";
if (m_oDocument.m_pBackground)
{

View File

@ -41,6 +41,7 @@
#include "OOXSettingsWriter.h"
#include "OOXThemeWriter.h"
#include "OOXFootnoteWriter.h"
#include "OOXCommentsWriter.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/App.h"
@ -53,11 +54,13 @@ OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
m_sTargetFolder ( sPath.c_str() ),
m_oRels ( L"", oDocument ),
m_nCurTrackChangesId( 0),
m_nextParaId ( 0x77000000),
m_oDocRels ( L"document.xml", oDocument )
{
m_nCurFitWidth = PROP_DEF;
m_poFootnoteWriter = NULL;
m_poEndnoteWriter = NULL;
m_poCommentsWriter = NULL;
m_poDocumentWriter = new OOXDocumentWriter ( *this, m_oDocument );
m_poFootnoteWriter = new OOXFootnoteWriter ( *this, m_oDocument );
@ -66,6 +69,7 @@ OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
m_poNumberingWriter = new OOXNumberingWriter( *this, m_oDocument );
m_poSettingsWriter = new OOXSettingsWriter ( *this, m_oDocument );
m_poStylesWriter = new OOXStylesWriter ( *this, m_oDocument );
m_poCommentsWriter = new OOXCommentsWriter ( *this, m_oDocument );
m_poDocPropsApp = new OOX::CApp(NULL);
m_poDocPropsCore = new OOX::CCore(NULL);
@ -88,6 +92,7 @@ OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
}
OOXWriter::~OOXWriter()
{
delete ((OOXCommentsWriter*) m_poCommentsWriter);
delete ((OOXDocumentWriter*) m_poDocumentWriter);
delete ((OOXFootnoteWriter*) m_poFootnoteWriter);
delete ((OOXEndnoteWriter*) m_poEndnoteWriter);
@ -142,10 +147,11 @@ bool OOXWriter::SaveByItemEnd()
((OOXFootnoteWriter*) m_poFootnoteWriter)->Save (pathWord.GetPath());
((OOXEndnoteWriter*) m_poEndnoteWriter)->Save (pathWord.GetPath());
((OOXCommentsWriter*) m_poCommentsWriter)->Save (pathWord.GetPath());
((OOXNumberingWriter*) m_poNumberingWriter)->Save (m_sTargetFolder);
((OOXStylesWriter*) m_poStylesWriter)->Save (m_sTargetFolder);
((OOXFontTableWriter*) m_poFontTableWriter)->Save (m_sTargetFolder);
((OOXSettingsWriter*) m_poSettingsWriter)->Save (m_sTargetFolder); //setting в последнюю очередь
//-------------------------------------------------------------------------------------

View File

@ -44,6 +44,8 @@ public:
int m_nCurFitWidth;
int m_nCurTrackChangesId;
long int m_nextParaId;
OOXRelsWriter m_oDocRels;
OOXRelsWriter m_oRels;
@ -57,6 +59,7 @@ public:
void* m_poNumberingWriter;
void* m_poSettingsWriter;
void* m_poStylesWriter;
void* m_poCommentsWriter;
void* m_poDocPropsApp;
void* m_poDocPropsCore;

View File

@ -48,7 +48,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_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"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -708,7 +708,7 @@ NAMESPACE_END
// ***************** Miscellaneous ********************
// Nearly all Intel's and AMD's have SSE. Enable it independent of SSE ASM and intrinscs
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM)
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM) && !defined(_IOS)
#define CRYPTOPP_BOOL_ALIGN16 1
#else
#define CRYPTOPP_BOOL_ALIGN16 0

View File

@ -95,10 +95,19 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
if (self.password) {
oInputParams.m_sPassword = new std::wstring(nsstring_to_wstring(self.password));
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.docx";
if ((int)AVS_FILEUTILS_ERROR_CONVERT != NExtractTools::doct_bin2docx(from, sResultDecryptFile, temp, bFromChanges, themeDir, oInputParams)) {
return oox2mscrypt(sResultDecryptFile, to, temp, oInputParams);
}
return AVS_FILEUTILS_ERROR_CONVERT;
} else {
return NExtractTools::doct_bin2docx(from, to, temp, bFromChanges, themeDir, oInputParams);
}
return NExtractTools::doct_bin2docx(from, to, temp, bFromChanges, themeDir, oInputParams);
}
- (int)sdk_doct2docx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir {
std::wstring from = nsstring_to_wstring(nsFrom);
@ -160,7 +169,20 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
return NExtractTools::xlst_bin2xlsx(from, to, temp, bFromChanges, themeDir, oInputParams);
if (self.password) {
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.xlsx";
if ((int)AVS_FILEUTILS_ERROR_CONVERT != NExtractTools::xlst_bin2xlsx(from, sResultDecryptFile, temp, bFromChanges, themeDir, oInputParams)) {
return oox2mscrypt(sResultDecryptFile, to, temp, oInputParams);
}
return AVS_FILEUTILS_ERROR_CONVERT;
} else {
return NExtractTools::xlst_bin2xlsx(from, to, temp, bFromChanges, themeDir, oInputParams);
}
}
- (int)sdk_xlst2xlsx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir {
std::wstring from = nsstring_to_wstring(nsFrom);
@ -206,7 +228,7 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
return NExtractTools::pptx2pptt(from, to, temp, oInputParams);
}
- (int)sdk_pptt_bin2pptx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir{
- (int)sdk_pptt_bin2pptx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir {
std::wstring from = nsstring_to_wstring(nsFrom);
std::wstring to = nsstring_to_wstring(nsTo);
std::wstring temp = nsstring_to_wstring(nsTemp);
@ -216,7 +238,20 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
NExtractTools::InputParams oInputParams;
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
return NExtractTools::pptt_bin2pptx(from, to, temp, bFromChanges, themeDir, oInputParams);
if (self.password) {
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.pptx";
if ((int)AVS_FILEUTILS_ERROR_CONVERT != NExtractTools::pptt_bin2pptx(from, sResultDecryptFile, temp, bFromChanges, themeDir, oInputParams)) {
return oox2mscrypt(sResultDecryptFile, to, temp, oInputParams);
}
return AVS_FILEUTILS_ERROR_CONVERT;
} else {
return NExtractTools::pptt_bin2pptx(from, to, temp, bFromChanges, themeDir, oInputParams);
}
}
- (int)sdk_pptt2pptx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir{
std::wstring from = nsstring_to_wstring(nsFrom);

File diff suppressed because it is too large Load Diff

View File

@ -203,7 +203,7 @@
TargetAttributes = {
17DAB6771ACC371E005AF479 = {
CreatedOnToolsVersion = 6.2;
DevelopmentTeam = N7BSMD6B3N;
DevelopmentTeam = 2WH24U26GJ;
ProvisioningStyle = Automatic;
};
};
@ -422,7 +422,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_CXX_LIBRARY = "compiler-default";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = N7BSMD6B3N;
DEVELOPMENT_TEAM = 2WH24U26GJ;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = TestIOSX2tConverter/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
@ -447,7 +447,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_CXX_LIBRARY = "compiler-default";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = N7BSMD6B3N;
DEVELOPMENT_TEAM = 2WH24U26GJ;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = TestIOSX2tConverter/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;