Compare commits

...

5 Commits

Author SHA1 Message Date
b88726beaf fix bug #36514 2018-01-23 14:09:55 +03:00
b2d3e5e194 . 2018-01-22 19:21:57 +03:00
a8315efae0 . 2018-01-22 18:26:40 +03:00
3781cf6774 . 2018-01-22 17:45:21 +03:00
7e36d47991 fix bug #8010
OdfFormatReader - dropdown & user fields
2018-01-22 15:09:23 +03:00
31 changed files with 648 additions and 205 deletions

View File

@ -69,6 +69,7 @@ namespace OpenXmlContentTypes
static const wchar_t* Tiff = L"image/tiff";
static const wchar_t* Wmf = L"image/x-wmf";
static const wchar_t* Bmp = L"image/bmp";
static const wchar_t* Pcz = L"image/x-pcz";
}
namespace WordprocessingMLContentTypes

View File

@ -110,6 +110,11 @@ namespace DocFileFormat
unused2 = Reader->ReadByte();
unused3 = Reader->ReadByte();
if (btMacOS != btWin32)
{
btWin32 = btMacOS = (Global::BlipType)this->Instance;
}
if (BodySize > 0x24)
{
Blip = RecordFactory::ReadRecord(Reader, 0);

View File

@ -192,14 +192,14 @@ public:
{
if (!bIsCompressed)
{
m_pMetaFile = pCompress;
m_lMetaFileSize = lUncompressSize;
m_pMetaFile = new BYTE[lCompressSize];
m_lMetaFileSize = lCompressSize;
memcpy(m_pMetaFile, pCompress, lCompressSize);
}
else
{
ULONG lSize = lUncompressSize;
m_pMetaFile = new BYTE[lUncompressSize];
//bool bRes = NSZLib::Decompress(pCompress, (ULONG)lCompressSize, m_pMetaFile, lSize);
HRESULT res = S_OK;
COfficeUtils* pOfficeUtils = new COfficeUtils(NULL);
@ -340,6 +340,8 @@ typedef enum _BlipCompression
if (typeCode == 0xf01b)
{
oMetaFile.m_sExtension = L".wmf";
WmfPlaceableFileHeader oWmfHeader = {};
oMetaHeader.ToWMFHeader(&oWmfHeader);
@ -349,24 +351,12 @@ typedef enum _BlipCompression
oMetaFile.SetHeader(pMetaHeader, lLenHeader);
}
if (typeCode == 0xf01c)
{
oMetaFile.m_sExtension = L".pcz";
//decompress???
}
oMetaFile.SetData(m_pvBits, oMetaHeader.cbSave, oMetaHeader.cbSize, 0 == oMetaHeader.compression);
//if (pos < sz)
//{
// NSFile::CFileBinary oFile;
// if (oFile.CreateFile(L"d:\\blop.dat"))
// {
// BYTE * d = Reader->ReadBytes( sz - pos, true );
// if (d)
// {
// oFile.WriteFile (d, sz - pos);
// delete []d;
// oFile.CloseFile();
// }
// }
//}
}
virtual ~MetafilePictBlip()

View File

@ -500,6 +500,7 @@ namespace DocFileFormat
{
case Global::msoblipEMF:
case Global::msoblipWMF:
case Global::msoblipPICT:
{
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(oBlipEntry->Blip);
if (metaBlip)
@ -567,6 +568,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring(L".wmf");
case Global::msoblipPICT:
return std::wstring(L".pcz");
default:
return std::wstring(L".png");
}
@ -601,6 +605,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring(OpenXmlContentTypes::Wmf);
case Global::msoblipPICT:
return std::wstring(OpenXmlContentTypes::Pcz);
case Global::msoblipDIB:
return std::wstring(OpenXmlContentTypes::Bmp);

View File

@ -1287,6 +1287,7 @@ namespace DocFileFormat
{
case Global::msoblipEMF:
case Global::msoblipWMF:
case Global::msoblipPICT:
{
//it's a meta image
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(RecordFactory::ReadRecord(&reader, 0));
@ -1373,6 +1374,9 @@ namespace DocFileFormat
case Global::msoblipWMF:
return std::wstring( L".wmf" );
case Global::msoblipPICT:
return std::wstring( L".pcz" );
default:
return std::wstring( L".png" );
}

View File

@ -144,7 +144,6 @@ 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);
};
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_name);
// svg:definition-src
@ -164,10 +163,8 @@ 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(svg_definition_src);
// style:font-face
class style_font_face : public office_element_impl<style_font_face>
{
@ -233,7 +230,6 @@ public:
friend class odf_document;
};
CP_REGISTER_OFFICE_ELEMENT2(style_font_face);
// office-font-face-decls
@ -257,7 +253,6 @@ 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(office_font_face_decls);
}

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "paragraph_elements.h"

View File

@ -38,7 +38,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/CPColorUtils.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
namespace odf_reader {

View File

@ -36,7 +36,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h>

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -69,8 +69,14 @@ enum ElementType
typeTextTime,
typeTextModificationTime,
typeTextFileName,
typeTextSequence,
typeTextSheetName,
typeTextTemplateName,
typeTextDropDown,
typeTextLabel,
typeTextSequenceDecls,
typeTextSequenceDecl,
typeTextSequence,
typePresentationFooter,
typePresentationDateTime,
@ -78,6 +84,8 @@ enum ElementType
typeDcCreator,
typeDcDate,
typeDrawA,
typeTextH,
typeTextP,
@ -90,28 +98,42 @@ enum ElementType
typeTextSectionSource,
typeTextIndexTitle,
typeTextIndexBody,
typeTextNumberedParagraph,
typeDrawA,
typeTextNumberedParagraph,
typeTextExpression,
typeTextTableOfContent,
typeTextIllustrationIndex,
typeTextTableIndex,
typeTextObjectIndex,
typeTextUserIndex,
typeTextAlphabeticalIndex,
typeTextBibliography,
typeTextBibliographyMark,
typeTextTableOfContentSource,
typeTextIllustrationIndex,
typeTextIllustrationIndexSource,
typeTextTableIndex,
typeTextTableIndexSource,
typeTextObjectIndex,
typeTextObjectIndexSource,
typeTextUserIndex,
typeTextUserIndexSource,
typeTextAlphabeticalIndex,
typeTextAlphabeticalIndexSource,
typeTextBibliographySource,
typeTextBibliography,
typeTextBibliographyMark,
typeTextBibliographySource,
typeTextVariableInput,
typeTextVariableGet,
typeTextVariableSet,
typeTextVariableDecl,
typeTextVariableDecls,
typeTextUserFieldDecls,
typeTextUserFieldDecl,
typeTextUserFieldGet,
typeTextUserFieldSet,
typeTextUserFieldInput,
typeTextTrackedChanges,
typeTextChangedRegion,
@ -125,6 +147,11 @@ enum ElementType
typeTextFormatChange,
typeTextInsertion,
typeTextMeta,
typeTextMetaField,
typeTextTextInput,
typeShape,
typeChangeMarks,

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -39,7 +39,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/common/readstring.h>
#include <cpdoccore/odf/odf_document.h>
@ -742,7 +741,7 @@ std::wostream & title::text_to_stream(std::wostream & _Wostream) const
void title::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void title::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -806,7 +805,7 @@ std::wostream & subject::text_to_stream(std::wostream & _Wostream) const
void subject::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void subject::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -823,8 +822,8 @@ void subject::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>SUBJECT</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
strm << L"<w:r><w:instrText>SUBJECT</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
Context.add_new_run();
std::wstring textNode = L"w:t";
@ -838,7 +837,7 @@ void subject::docx_convert(oox::docx_conversion_context & Context)
strm << L"</" << textNode << L">";
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
void subject::xlsx_convert(oox::xlsx_conversion_context & Context)
@ -869,7 +868,7 @@ std::wostream & chapter::text_to_stream(std::wostream & _Wostream) const
void chapter::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_field_fixed_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void chapter::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -1379,9 +1378,77 @@ void sequence::pptx_convert(oox::pptx_conversion_context & Context)
text_[i]->pptx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------------------------
// text:drop-down
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * text_drop_down::ns = L"text";
const wchar_t * text_drop_down::name = L"drop-down";
// text:sequesheet-namence
//////////////////////////////////////////////////////////////////////////////////////////////////
void text_drop_down::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_drop_down::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"label")
{
CP_CREATE_ELEMENT(content_);
}
else
{
}
}
void text_drop_down::add_text(const std::wstring & Text)
{
text_ = Text;
}
std::wostream & text_drop_down::text_to_stream(std::wostream & _Wostream) const
{
_Wostream << xml::utils::replace_text_to_xml( text_ );
return _Wostream;
}
void text_drop_down::docx_convert(oox::docx_conversion_context & Context)
{
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 < content_.size(); i++)
{
content_[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:t>" << text_ << L"</w:t></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
//-------------------------------------------------------------------------------------------------------------------
// text:label
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * text_label::ns = L"text";
const wchar_t * text_label::name = L"label";
void text_label::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:value", text_value_);
}
void text_label::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
strm << L"<w:listEntry w:val=\"" << text_value_.get_value_or(L"") << L"\"/>";
}
//-------------------------------------------------------------------------------------------------------------------
// text:sheet-name
//-------------------------------------------------------------------------------------------------------------------
const wchar_t * sheet_name::ns = L"text";
const wchar_t * sheet_name::name = L"sheet-name";

View File

@ -122,7 +122,6 @@ private:
_CP_OPT(unsigned int) text_c_;
_CP_OPT(std::wstring) content_;
};
CP_REGISTER_OFFICE_ELEMENT2(s);
// text:tab
@ -431,7 +430,6 @@ CP_REGISTER_OFFICE_ELEMENT2(a);
// text:note
//////////////////////////////////////////////////////////////////////////////////////////////////
class note : public paragraph_content_element<note>
{
public:
@ -452,18 +450,16 @@ 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);
std::wstring text_id_;
odf_types::noteclass text_note_class_;
office_element_ptr text_note_citation_;
office_element_ptr text_note_body_;
std::wstring text_id_;
odf_types::noteclass text_note_class_;
office_element_ptr text_note_citation_;
office_element_ptr text_note_body_;
};
CP_REGISTER_OFFICE_ELEMENT2(note);
// text:ruby
//////////////////////////////////////////////////////////////////////////////////////////////////
class ruby : public paragraph_content_element<ruby>
{
public:
@ -485,7 +481,6 @@ private:
office_element_ptr text_ruby_text_;
};
CP_REGISTER_OFFICE_ELEMENT2(ruby);
class common_field_fixed_attlist
@ -521,8 +516,8 @@ 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);
common_field_fixed_attlist common_field_fixed_attlist_;
office_element_ptr_array content_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -549,7 +544,7 @@ 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);
common_field_fixed_attlist common_field_fixed_attlist_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -577,7 +572,7 @@ 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);
common_field_fixed_attlist common_field_fixed_attlist_;
common_field_fixed_attlist attlist_;
office_element_ptr_array content_;
};
@ -687,7 +682,7 @@ public:
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_date_value_;//with format
office_element_ptr_array text_;
office_element_ptr_array text_;
private:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -715,8 +710,9 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(text_modification_date);
//-------------------------------------------------------------------------------------------------------------------
// text:time
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_time : public paragraph_content_element<text_time>
{
public:
@ -745,8 +741,9 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(text_time);
//-------------------------------------------------------------------------------------------------------------------
// text:modification-date
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_modification_time : public text_time
{
public:
@ -762,8 +759,9 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(text_modification_time);
//-------------------------------------------------------------------------------------------------------------------
// text:file-name
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class text_file_name : public paragraph_content_element<text_file_name>
{
public:
@ -787,11 +785,11 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_file_name);
//-------------------------------------------------------------------------------------------------------------------
// text:sequence
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class sequence : public paragraph_content_element<sequence>
{
public:
@ -815,11 +813,58 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(sequence);
//-------------------------------------------------------------------------------------------------------------------
//text:drop-down
//-------------------------------------------------------------------------------------------------------------------
class text_drop_down : public paragraph_content_element<text_drop_down>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextDropDown;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
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);
_CP_OPT(std::wstring) text_name_;
office_element_ptr_array content_;
std::wstring text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_drop_down);
//-------------------------------------------------------------------------------------------------------------------
//text:drop-down
//-------------------------------------------------------------------------------------------------------------------
class text_label : public paragraph_content_element<text_label>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextLabel;
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_OPT(std::wstring) text_value_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_label);
//-------------------------------------------------------------------------------------------------------------------
// text:sheet-name
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
class sheet_name : public paragraph_content_element<sheet_name>
{
public:
@ -837,11 +882,11 @@ private:
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(sheet_name);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
//presentation:footer
//-------------------------------------------------------------------------------------------------------------------
class presentation_footer : public paragraph_content_element<presentation_footer>
{
public:
@ -861,8 +906,9 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_footer);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------------
//presentation:date-time
//-------------------------------------------------------------------------------------------------------------------
class presentation_date_time: public paragraph_content_element<presentation_date_time>
{
public:

View File

@ -33,7 +33,6 @@
#include "ruby.h"
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/xmlchar.h>

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include "styles.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/odf/odf_document.h>

View File

@ -35,7 +35,6 @@
#include <boost/make_shared.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
#include "odfcontext.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "serialize_elements.h"

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/simple_xml_writer.h>

View File

@ -34,7 +34,7 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include "paragraph_elements.h"
#include "serialize_elements.h"
@ -341,13 +341,13 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
int textStyle = process_paragraph_attr(attrs_, Context);
first_text_paragraph->docx_convert(Context);
int str_start = Context.get_drop_cap_context().Length;
int str_size = store_str.length()-Context.get_drop_cap_context().Length;
size_t str_start = Context.get_drop_cap_context().Length;
size_t str_size = store_str.length() - Context.get_drop_cap_context().Length;
if (str_size < 0) str_size = 0; // это если на буквы в буквице разные стили
if (str_start > store_str.length()) str_start = store_str.length(); // это если на буквы в буквице разные стили
str=store_str.substr(str_start, str_size);
str = store_str.substr(str_start, str_size);
}
size_t paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
@ -1424,7 +1424,119 @@ void text_change_end::docx_convert(oox::docx_conversion_context & Context)
{
Context.end_text_changes (*text_change_id_);
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_input::ns = L"text";
const wchar_t * text_variable_input::name = L"variable-input";
void text_variable_input::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"office:value-type", office_value_type_);
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:description", text_description_);
CP_APPLY_ATTR(L"text:display", text_display_);
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_variable_input::add_text(const std::wstring & Text)
{
text_ = Text;
}
std::wostream & text_variable_input::text_to_stream(std::wostream & _Wostream) const
{
_Wostream << xml::utils::replace_text_to_xml( text_ );
return _Wostream;
}
void text_variable_input::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
strm << L"<w:r><w:instrText>ASK &quot;" << text_name_.get_value_or(L"") << L"&quot; " << text_description_.get_value_or(L"") << L" \\d ";
strm << text_;
strm << L"</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>";
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
strm << L"<w:r><w:instrText>REF &quot;" << text_name_.get_value_or(L"") << L"&quot; </w:instrText></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>";
strm << L"<w:r><w:t>" << text_ << L"</w:t></w:r>";
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_get::ns = L"text";
const wchar_t * text_variable_get::name = L"variable-get";
void text_variable_get::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:display", text_display_);
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_variable_get::docx_convert(oox::docx_conversion_context & Context)
{
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_set::ns = L"text";
const wchar_t * text_variable_set::name = L"variable-set";
void text_variable_set::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"office:value-type", office_value_type_);
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:display", text_display_);
CP_APPLY_ATTR(L"text:name", text_name_);
CP_APPLY_ATTR(L"office:value", office_value_);
CP_APPLY_ATTR(L"office:boolean-value", office_boolean_value_);
CP_APPLY_ATTR(L"office:date-value", office_date_value_);
CP_APPLY_ATTR(L"office:time-value", office_time_value_);
CP_APPLY_ATTR(L"office:string-value", office_string_value_);
CP_APPLY_ATTR(L"office:currency", office_currency_);
CP_APPLY_ATTR(L"office:formula", office_formula_);
}
void text_variable_set::docx_convert(oox::docx_conversion_context & Context)
{
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_decl::ns = L"text";
const wchar_t * text_variable_decl::name = L"variable-decl";
void text_variable_decl::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"office:value-type", office_value_type_);
CP_APPLY_ATTR(L"text:display", text_display_);
CP_APPLY_ATTR(L"text:name", text_name_);
}
void text_variable_decl::docx_convert(oox::docx_conversion_context & Context)
{
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_variable_decls::ns = L"text";
const wchar_t * text_variable_decls::name = L"variable-decls";
void text_variable_decls::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"variable-decl")
{
CP_CREATE_ELEMENT(content_);
}
else
{
}
}
void text_variable_decls::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
}
}
}

View File

@ -535,8 +535,6 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(text_index_title);
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
class text_unknown_base_change : public office_element_impl<text_unknown_base_change>
{
@ -717,8 +715,137 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context);
};
CP_REGISTER_OFFICE_ELEMENT2(text_change_end);
//-------------------------------------------------------------------------------------------------------------------
//text:variable-input
//---------------------------------------------------------------------------------------------------
class text_variable_input : public office_element_impl<text_variable_input>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableInput;
CPDOCCORE_DEFINE_VISITABLE()
void docx_convert(oox::docx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
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);
_CP_OPT(odf_types::office_value_type) office_value_type_;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) text_description_;
_CP_OPT(std::wstring) text_display_;
_CP_OPT(std::wstring) text_name_;
std::wstring text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_input);
//-------------------------------------------------------------------------------------------------------------------
//text:variable-get
//---------------------------------------------------------------------------------------------------
class text_variable_get : public office_element_impl<text_variable_get>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableGet;
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_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) text_display_;
_CP_OPT(std::wstring) text_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_get);
//-------------------------------------------------------------------------------------------------------------------
//text:variable-set
//---------------------------------------------------------------------------------------------------
class text_variable_set : public office_element_impl<text_variable_set>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableSet;
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_OPT(odf_types::office_value_type) office_value_type_;
_CP_OPT(std::wstring) office_boolean_value_;
_CP_OPT(std::wstring) office_date_value_;
_CP_OPT(std::wstring) office_time_value_;
_CP_OPT(std::wstring) office_string_value_;
_CP_OPT(std::wstring) office_value_;
_CP_OPT(std::wstring) office_currency_;
_CP_OPT(std::wstring) office_formula_;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) text_display_;
_CP_OPT(std::wstring) text_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_set);
//---------------------------------------------------------------------------------------------------
//text:variable-decl
//---------------------------------------------------------------------------------------------------
class text_variable_decl : public office_element_impl<text_variable_decl>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableDecl;
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_OPT(odf_types::office_value_type) office_value_type_;
_CP_OPT(std::wstring) text_display_;
_CP_OPT(std::wstring) text_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_decl);
//---------------------------------------------------------------------------------------------------
//text:variable-decls
//---------------------------------------------------------------------------------------------------
class text_variable_decls : public office_element_impl<text_variable_decls>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextVariableDecls;
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);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_variable_decls);
}
}
}

View File

@ -965,7 +965,7 @@ HRESULT CDrawingConverter::AddShapeType(const std::wstring& bsXml)
strXml += L">";
strXml += (std::wstring)bsXml;
strXml += bsXml;
strXml += L"</main>";
@ -1540,9 +1540,10 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
pPicture->oleObject.reset(pOle);
pOle = NULL;
}
if (pElem)
m_pBinaryWriter->WriteRecord1(1, *pElem);
}
if (pElem)
m_pBinaryWriter->WriteRecord1(1, *pElem);
RELEASEOBJECT(pElem)
RELEASEOBJECT(pOle)
}
@ -3229,7 +3230,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.StartNode(L"wp:inline");
oWriter.StartAttributes();
oWriter.WriteAttribute(L"xmlns:wp", (std::wstring)L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
oWriter.WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
oWriter.WriteAttribute(L"distT", margT);
oWriter.WriteAttribute(L"distB", margB);
oWriter.WriteAttribute(L"distL", margL);
@ -3267,27 +3268,25 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.StartAttributes();
oWriter.WriteAttribute(L"xmlns:wp", (std::wstring)L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
oWriter.WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
oWriter.WriteAttribute(L"distT", margT);
oWriter.WriteAttribute(L"distB", margB);
oWriter.WriteAttribute(L"distL", margL);
oWriter.WriteAttribute(L"distR", margR);
pPair = oCssStyles.m_mapSettings.find(L"z-index");
nullable_int zIndex;
nullable_int64 zIndex;
if (oCssStyles.m_mapSettings.end() != pPair)
{
zIndex = (int)parserPoint.FromString(pPair->second);
if (*zIndex >= 0)
{
oWriter.WriteAttribute(L"relativeHeight", *zIndex);
}
else
{
// DWORD dwIndex = (DWORD)(*zIndex);
oWriter.WriteAttribute(L"relativeHeight", -(*zIndex));
}
zIndex = parserPoint.FromString(pPair->second);
INT64 zIndex_ = *zIndex >= 0 ? *zIndex : -*zIndex;
if (zIndex_ < 0xF000000 && zIndex_ > 0x80000 )
zIndex_ = 0xF000000 - 0x80000 + zIndex_;
oWriter.WriteAttribute(L"relativeHeight", std::to_wstring(zIndex_));
}
XmlUtils::CXmlNode oNodeWrap = oNode.ReadNode(L"w10:wrap");
@ -3311,6 +3310,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
nullable_bool isAllowInCell;
nullable_string sAllowInCell;
oNode.ReadAttributeBase(L"o:allowincell", sAllowInCell);
if (sAllowInCell.is_init())
{
@ -3319,7 +3319,17 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if ((L"t" == *sAllowInCell) || (L"true"== *sAllowInCell))
isAllowInCell = true;
}
nullable_bool isAllowOverlap;
nullable_string sAllowOverlap;
oNode.ReadAttributeBase(L"o:allowoverlap", sAllowOverlap);
if (sAllowOverlap.is_init())
{
if ((L"f" == *sAllowOverlap) || (L"false"== *sAllowOverlap))
isAllowOverlap = false;
if ((L"t" == *sAllowOverlap) || (L"true"== *sAllowOverlap))
isAllowOverlap = true;
}
std::wstring strWrapPoints = oNode.GetAttribute(L"wrapcoords");
std::wstring strWrapPointsResult;
if (!strWrapPoints.empty())
@ -3352,20 +3362,26 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
{
if (*zIndex > 0)
{
oWriter.WriteAttribute(L"allowOverlap", (std::wstring)L"1");
oWriter.WriteAttribute(L"behindDoc", L"0");
}
else if (*zIndex < 0)
{
oWriter.WriteAttribute(L"behindDoc", (std::wstring)L"1");
oWriter.WriteAttribute(L"behindDoc", L"1");
}
}
if (isAllowOverlap.is_init())
{
if (*isAllowOverlap)
oWriter.WriteAttribute(L"allowOverlap", L"1");
else
oWriter.WriteAttribute(L"allowOverlap", L"0");
}
if (isAllowInCell.is_init())
{
if (*isAllowInCell)
oWriter.WriteAttribute(L"layoutInCell", (std::wstring)L"1");
oWriter.WriteAttribute(L"layoutInCell", L"1");
else
oWriter.WriteAttribute(L"layoutInCell", (std::wstring)L"0");
oWriter.WriteAttribute(L"layoutInCell", L"0");
}
oWriter.EndAttributes();
@ -3378,25 +3394,25 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (pPair != oCssStyles.m_mapSettings.end())
{
if (L"char" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"character");
oWriter.WriteAttribute(L"relativeFrom", L"character");
else if (L"page" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"page");
oWriter.WriteAttribute(L"relativeFrom", L"page");
else if (L"margin" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"margin");
oWriter.WriteAttribute(L"relativeFrom", L"margin");
else if (L"left-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"leftMargin");
oWriter.WriteAttribute(L"relativeFrom", L"leftMargin");
else if (L"right-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"rightMargin");
oWriter.WriteAttribute(L"relativeFrom", L"rightMargin");
else if (L"inner-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"insideMargin");
oWriter.WriteAttribute(L"relativeFrom", L"insideMargin");
else if (L"outer-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"outsideMargin");
oWriter.WriteAttribute(L"relativeFrom", L"outsideMargin");
else
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"column");
oWriter.WriteAttribute(L"relativeFrom", L"column");
}
else
{
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"column");
oWriter.WriteAttribute(L"relativeFrom", L"column");
}
oWriter.EndAttributes();
@ -3429,25 +3445,25 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (pPair != oCssStyles.m_mapSettings.end())
{
if (L"margin" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"margin");
oWriter.WriteAttribute(L"relativeFrom", L"margin");
else if (L"text" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"paragraph");
oWriter.WriteAttribute(L"relativeFrom", L"paragraph");
else if (L"page" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"page");
oWriter.WriteAttribute(L"relativeFrom", L"page");
else if (L"top-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"topMargin");
oWriter.WriteAttribute(L"relativeFrom", L"topMargin");
else if (L"bottom-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"bottomMargin");
oWriter.WriteAttribute(L"relativeFrom", L"bottomMargin");
else if (L"inner-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"insideMargin");
oWriter.WriteAttribute(L"relativeFrom", L"insideMargin");
else if (L"outer-margin-area" == pPair->second)
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"outsideMargin");
oWriter.WriteAttribute(L"relativeFrom", L"outsideMargin");
else
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"line");
oWriter.WriteAttribute(L"relativeFrom", L"line");
}
else
{
oWriter.WriteAttribute(L"relativeFrom", (std::wstring)L"paragraph");
oWriter.WriteAttribute(L"relativeFrom", L"paragraph");
}
oWriter.EndAttributes();
@ -4390,7 +4406,7 @@ HRESULT CDrawingConverter::LoadClrMap(const std::wstring& bsXml)
{
smart_ptr<PPTX::Logic::ClrMap> pClrMap = new PPTX::Logic::ClrMap();
std::wstring strXml = L"<main xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">" + (std::wstring)bsXml + L"</main>";
std::wstring strXml = L"<main xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">" + bsXml + L"</main>";
XmlUtils::CXmlNode oNode;
oNode.FromXmlString(strXml);
@ -4845,6 +4861,10 @@ void CDrawingConverter::ConvertMainPropsToVML(const std::wstring& bsMainProps, N
nullable_int margL; oNode.ReadAttributeBase(L"distL", margL);
nullable_int margR; oNode.ReadAttributeBase(L"distR", margR);
nullable_bool behindDoc; oNode.ReadAttributeBase(L"behindDoc", behindDoc);
nullable_bool allowOverlap; oNode.ReadAttributeBase(L"allowOverlap", allowOverlap);
nullable_bool layoutInCell; oNode.ReadAttributeBase(L"layoutInCell", layoutInCell);
if (margL.is_init())
oWriter.WriteAttributeCSS_double1_pt(L"mso-wrap-distance-left", dKoef * (*margL));
if (margT.is_init())
@ -4854,9 +4874,27 @@ void CDrawingConverter::ConvertMainPropsToVML(const std::wstring& bsMainProps, N
if (margB.is_init())
oWriter.WriteAttributeCSS_double1_pt(L"mso-wrap-distance-bottom", dKoef * (*margB));
nullable_int zIndex; oNode.ReadAttributeBase(L"relativeHeight", zIndex);
nullable_int64 zIndex; oNode.ReadAttributeBase(L"relativeHeight", zIndex);
if (zIndex.is_init())
oWriter.WriteAttributeCSS_int(L"z-index", *zIndex);
{
INT64 z_index = *zIndex;
if ((behindDoc.IsInit()) && (*behindDoc == true))
{
z_index = -z_index;
}
oWriter.WriteAttributeCSS(L"z-index", std::to_wstring(z_index));
}
if (allowOverlap.is_init())
{
oWriter.WriteAttributeCSS(L"o:allowoverlap", *allowOverlap ? L"true" : L"false");
}
if (layoutInCell.is_init())
{
oWriter.WriteAttributeCSS(L"o:allowincell", *layoutInCell ? L"true" : L"false");
}
XmlUtils::CXmlNode oNodeHorP;
if (oNode.GetNode(L"wp:positionH", oNodeHorP))
@ -5077,7 +5115,7 @@ void CDrawingConverter::ConvertMainPropsToVML(const std::wstring& bsMainProps, N
HRESULT CDrawingConverter::SetFontDir(const std::wstring& bsFontDir)
{
m_strFontDirectory = (std::wstring)bsFontDir;
m_strFontDirectory = bsFontDir;
return S_OK;
}
@ -5273,7 +5311,7 @@ HRESULT CDrawingConverter::SetDstContentRels()
HRESULT CDrawingConverter::SaveDstContentRels(const std::wstring& bsRelsPath)
{
m_pReader->m_pRels->CloseRels();
m_pReader->m_pRels->SaveRels((std::wstring)bsRelsPath);
m_pReader->m_pRels->SaveRels(bsRelsPath);
--m_pReader->m_nCurrentRelsStack;
if (-1 > m_pReader->m_nCurrentRelsStack)
@ -5318,7 +5356,7 @@ HRESULT CDrawingConverter::SetFontPicker(COfficeFontPicker* pFontPicker)
HRESULT CDrawingConverter::SetAdditionalParam(const std::wstring& ParamName, BYTE *pArray, size_t szCount)
{
std::wstring name = (std::wstring)ParamName;
std::wstring name = ParamName;
if (name == L"xfrm_override" && pArray)
{
PPTX::Logic::Xfrm *pXfrm = (PPTX::Logic::Xfrm*)pArray;
@ -5330,7 +5368,7 @@ HRESULT CDrawingConverter::SetAdditionalParam(const std::wstring& ParamName, BYT
}
HRESULT CDrawingConverter::GetAdditionalParam(const std::wstring& ParamName, BYTE **pArray, size_t& szCount)
{
//std::wstring name = (std::wstring)ParamName;
//std::wstring name = ParamName;
//if (name == L"SerializeImageManager")
//{
// NSBinPptxRW::CBinaryFileWriter oWriter;

View File

@ -356,7 +356,15 @@ namespace NSBinPptxRW
m_oWriter.WriteString(val);
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttributeCSS_int(const std::wstring& strAttributeName, const int& val)
AVSINLINE void WriteAttributeCSS(const std::wstring& strAttributeName, const wchar_t* val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(15);
m_oWriter.AddCharNoCheck(WCHAR(':'));
m_oWriter.WriteString(val);
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttributeCSS_int(const std::wstring& strAttributeName, const int& val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(15);
@ -404,7 +412,16 @@ namespace NSBinPptxRW
m_oWriter.WriteString(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute2(const std::wstring& strAttributeName, const std::wstring& val)
AVSINLINE void WriteAttribute(const std::wstring& strAttributeName, const wchar_t* val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
m_oWriter.WriteString(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute2(const std::wstring& strAttributeName, const std::wstring& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);

View File

@ -149,6 +149,7 @@ void OfficeArtBStoreContainerFileBlock::load(XLS::CFRecord& record)
break;
case OfficeArtRecord::BlipPICT:
{
pict_type = L".pcz";
if (rc_header.recInstance == 0x542)
rgbUid1 = ReadMD4Digest(record);
else
@ -165,7 +166,6 @@ void OfficeArtBStoreContainerFileBlock::load(XLS::CFRecord& record)
isCompressed = true;
readCompressedData(record, metafileHeader);
}
pict_type = L".pic";///???? todooo
}
break;
case OfficeArtRecord::BlipJPEG:

View File

@ -62,8 +62,6 @@ namespace NSCommon
{
RELEASEOBJECT(m_pPointer);
}
public:
Type& operator*() { return *m_pPointer; }
Type* operator->() { return m_pPointer; }
@ -73,7 +71,6 @@ namespace NSCommon
const Type& get()const { return *m_pPointer; }
Type& get() { return *m_pPointer; }
public:
nullable_base<Type>& operator=(const nullable_base<Type> &oOther)
{
RELEASEOBJECT(m_pPointer);
@ -95,8 +92,6 @@ namespace NSCommon
m_pPointer = new Type(oSrc);
return *this;
}
public:
bool IsInit() const
{
return (NULL != m_pPointer);
@ -167,20 +162,6 @@ namespace NSCommon
return *this;
}
//nullable<Type>& operator=(std::wstring& cwsValue)
//{
// RELEASEOBJECT(this->m_pPointer);
// this->m_pPointer = new Type( cwsValue.c_str() );
// return *this;
//}
//nullable<Type>& operator=(const std::wstring& cwsValue)
//{
// RELEASEOBJECT(this->m_pPointer);
// this->m_pPointer = new Type( cwsValue.c_str() );
// return *this;
//}
nullable<Type>& operator=(const nullable<Type> &oOther)
{
RELEASEOBJECT(this->m_pPointer);
@ -283,8 +264,6 @@ namespace NSCommon
{
}
public:
void operator=(const std::wstring& value)
{
RELEASEOBJECT(this->m_pPointer);
@ -296,17 +275,6 @@ namespace NSCommon
RELEASEOBJECT(this->m_pPointer);
this->m_pPointer = pType;
}
//#if defined(_WIN32) || defined (_WIN64)
// void operator=(const BSTR& value)
// {
// RELEASEOBJECT(this->m_pPointer);
// if (NULL != value)
// {
// this->m_pPointer = new Type();
// this->m_pPointer->_set((std::wstring)value);
// }
// }
//#endif
void operator=(const BYTE& value)
{
RELEASEOBJECT(this->m_pPointer);
@ -343,7 +311,6 @@ namespace NSCommon
return this->m_pPointer->get();
}
public:
Type& operator*() { return *this->m_pPointer; }
Type* operator->() { return this->m_pPointer; }
@ -387,15 +354,6 @@ namespace NSCommon
return *this;
}
//#if defined(_WIN32) || defined (_WIN64)
// void operator=(const BSTR& value)
// {
// RELEASEOBJECT(this->m_pPointer);
//
// if (NULL != value)
// this->m_pPointer = new int(XmlUtils::GetInteger(value));
// }
//#endif
void operator=(const std::wstring& value)
{
RELEASEOBJECT(this->m_pPointer);
@ -425,8 +383,6 @@ namespace NSCommon
}
return *m_pPointer;
}
public:
int& operator*() { return *m_pPointer; }
int* operator->() { return m_pPointer; }
@ -434,15 +390,77 @@ namespace NSCommon
int* operator->() const { return m_pPointer; }
const int& get()const { return *m_pPointer; }
};
class nullable_int64 : public nullable_base<INT64>
{
public:
std::wstring toString() const
nullable_int64() : nullable_base<INT64>()
{
std::wstring result;
//if (IsInit())
// result = std::to_wstring( get());
return result;
}
void normalize(const INT64& min, const INT64& max)
{
if (IsInit())
{
if (*m_pPointer < min)
*m_pPointer = min;
else if (*m_pPointer > max)
*m_pPointer = max;
}
}
void normalize_positive()
{
if (IsInit())
{
if (*m_pPointer < 0)
*m_pPointer = 0;
}
}
nullable_int64& operator=(const wchar_t* cwsValue)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != cwsValue )
m_pPointer = new INT64(XmlUtils::GetInteger64(cwsValue));
return *this;
}
void operator=(const std::wstring& value)
{
RELEASEOBJECT(this->m_pPointer);
this->m_pPointer = new INT64(XmlUtils::GetInteger64(value));
}
void operator=(const INT64& value)
{
RELEASEOBJECT(this->m_pPointer);
this->m_pPointer = new INT64(value);
}
nullable_int64& operator=(const nullable_int64& oSrc)
{
RELEASEOBJECT(m_pPointer);
if (NULL != oSrc.m_pPointer )
m_pPointer = new INT64(*oSrc);
return *this;
}
INT64 get_value_or(const INT64& value) const
{
if (NULL == m_pPointer)
{
int ret = value;
return ret;
}
return *m_pPointer;
}
INT64& operator*() { return *m_pPointer; }
INT64* operator->() { return m_pPointer; }
INT64& operator*() const { return *m_pPointer; }
INT64* operator->() const { return m_pPointer; }
const INT64& get()const { return *m_pPointer; }
};
class nullable_sizet : public nullable_base<size_t>
{
@ -494,7 +512,6 @@ namespace NSCommon
}
return *m_pPointer;
}
public:
size_t& operator*() { return *m_pPointer; }
size_t* operator->() { return m_pPointer; }
@ -630,12 +647,6 @@ namespace NSCommon
const bool& get()const { return *m_pPointer; }
std::wstring toString() const
{
std::wstring result;
return result;
}
};
class nullable_string : public nullable_base<std::wstring>
{
@ -679,8 +690,6 @@ namespace NSCommon
}
return *m_pPointer;
}
public:
std::wstring& operator*() { return *m_pPointer; }
std::wstring* operator->() { return m_pPointer; }

View File

@ -169,7 +169,20 @@ namespace XmlUtils
return ( L"true" == sTemp || L"1" == sTemp || L"t" == sTemp || L"on" == sTemp );
}
AVSINLINE static int GetInteger (const std::wstring& string)
AVSINLINE static INT64 GetInteger64 (const std::wstring& string)
{
if (string.empty()) return 0;
try
{
return _wtoi64(string.c_str());
}
catch(...)
{
return 0;
}
}
AVSINLINE static int GetInteger (const std::wstring& string)
{
if (string.empty()) return 0;