Commit 99d99006 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

Переделки кода OdfFileReader под компилятор gcc

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62885 954022d7-b5bf-4e40-9824-e11837661b57
parent ec6dc4a0
......@@ -2,17 +2,18 @@
#include <boost/optional.hpp>
namespace cpdoccore {
namespace cpdoccore
{
/// Optional, boost::optional
/// Optional, boost::optional
template <class T>
struct optional
{
typedef T Base;
typedef boost::optional<T> Type;
};
template <class T>
struct optional
{
typedef T Base;
typedef ::boost::optional<T> Type;
};
#define _CP_OPT(T) optional< T >::Type
#define _CP_OPT(V) optional<V>::Type
}
#ifndef _CPDOCCORE_READDOCELEMENT_H_
#define _CPDOCCORE_READDOCELEMENT_H_
#pragma once
#include <string>
......@@ -11,10 +10,9 @@ namespace xml {
class sax;
template <class StringT>
class attributes;
typedef attributes< ::std::wstring > attributes_wc;
typedef attributes attributes_wc;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
......@@ -45,5 +43,3 @@ inline read_doc_element::~read_doc_element()
}
}
#endif // #ifndef _CPDOCCORE_READDOCELEMENT_H_
......@@ -12,6 +12,7 @@
#include <boost/variant.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
namespace cpdoccore
{
......@@ -29,8 +30,10 @@ namespace cpdoccore
};
template <class T>
bool GetProperty(std::vector<_property> Heap,const std::wstring Name, T & Val)
bool GetProperty(std::vector<_property> Heap, const std::wstring Name, T & Val)
{
typedef typename T::value_type T_value_type;
Val.reset();
BOOST_FOREACH(_property const & p, Heap)
{
......@@ -38,7 +41,7 @@ namespace cpdoccore
{
try
{
Val = boost::get<T::value_type>(p.val_);
Val = boost::get<T_value_type>(p.val_);
}
catch(...)
{
......@@ -51,26 +54,24 @@ namespace cpdoccore
}
return false;
}
};
}
namespace xml
{
class sax;
template <class StringT>
class attributes;
template <class StringT>
class attributes
{
public:
typedef typename _CP_OPT(StringT) value_type;
typedef typename ::std::pair< StringT, StringT> key_value;
typedef typename optional<std::wstring>::Type value_type;
typedef typename ::std::pair< std::wstring, std::wstring> key_value;
public:
virtual value_type get(const StringT & QualifiedName) const = 0;
template <class V> typename _CP_OPT(V) get_val(const StringT & QualifiedName);
virtual const key_value & at(size_t _Pos) const = 0;
virtual value_type get(const std::wstring & QualifiedName) const = 0;
template <class V> typename optional<V>::Type get_val(const std::wstring & QualifiedName);
virtual const key_value & at(size_t _Pos) const = 0;
virtual size_t size() const = 0;
size_t length() const ;
bool empty() const;
......@@ -82,18 +83,23 @@ namespace cpdoccore
};
template <class StringT, class V>
template <class V>
class attributes_get_val_impl
{
public:
static typename _CP_OPT(V) get_val(attributes<StringT> & attr, const StringT & QualifiedName)
typedef typename optional<V>::Type optional_V_type;
static typename optional<V>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes<StringT>::value_type val = attr.get(QualifiedName);
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
try
{
return optional<V>::Type ( ::boost::lexical_cast<V>( *val ) );
return optional_V_type (::boost::lexical_cast<V>( *val ) );
//return common::read_string<V>( *val );
}
catch(...)
......@@ -104,110 +110,107 @@ namespace cpdoccore
}
}
return _CP_OPT(V)();
return optional_V_type();
}
};
template <class StringT>
class attributes_get_val_impl<StringT, bool>
template<>
class attributes_get_val_impl<bool>
{
public:
static typename _CP_OPT(bool) get_val(attributes<StringT> & attr, const StringT & QualifiedName)
typedef xml::xml_char<wchar_t> xml_char_value_type;
static typename optional<bool>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes<StringT>::value_type val = attr.get(QualifiedName);
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
StringT tmp = *val;
::boost::algorithm::to_lower(tmp);
return _CP_OPT(bool)((tmp == xml::xml_char< StringT::value_type >::trueVal));
std::wstring tmp = *val;
::boost::algorithm::to_lower(tmp);
return optional<bool>::Type((tmp == xml_char_value_type::trueVal));
}
else
return _CP_OPT(bool)();
return optional<bool>::Type();
}
};
template <class StringT>
class attributes_get_val_impl<StringT, char>
template<>
class attributes_get_val_impl<char>
{
public:
static typename _CP_OPT(char) get_val(attributes<StringT> & attr, const StringT & QualifiedName)
static typename optional<char>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes<StringT>::value_type val = attr.get(QualifiedName);
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
StringT tmp = *val;
return _CP_OPT(char)( (tmp.size() > 0) ? tmp[0] : ' ');
std::wstring tmp = *val;
return optional<char>::Type( (tmp.size() > 0) ? tmp[0] : ' ');
}
else
return _CP_OPT(char)();
return optional<char>::Type();
}
};
template <class StringT>
class attributes_get_val_impl<StringT, wchar_t>
template<>
class attributes_get_val_impl<wchar_t>
{
public:
static typename _CP_OPT(wchar_t) get_val(attributes<StringT> & attr, const StringT & QualifiedName)
static typename optional<wchar_t>::Type get_val(attributes & attr, const std::wstring & QualifiedName)
{
attributes<StringT>::value_type val = attr.get(QualifiedName);
attributes::value_type val = attr.get(QualifiedName);
if (val)
{
StringT tmp = *val;
return _CP_OPT(wchar_t)( (tmp.size() > 0) ? tmp[0] : L' ');
std::wstring tmp = *val;
return optional<wchar_t>::Type( (tmp.size() > 0) ? tmp[0] : L' ');
}
else
return _CP_OPT(wchar_t)();
return optional<wchar_t>::Type();
}
};
template <class StringT>
template <class V>
inline typename _CP_OPT(V) attributes<StringT>::get_val(const StringT & QualifiedName)
inline typename optional<V>::Type attributes::get_val(const std::wstring & QualifiedName)
{
return attributes_get_val_impl<StringT, V>::get_val(*this, QualifiedName);
return attributes_get_val_impl<V>::get_val(*this, QualifiedName);
}
template <class StringT>
inline attributes<StringT>::~attributes()
inline attributes::~attributes()
{}
template <class StringT>
inline size_t attributes<StringT>::length() const
inline size_t attributes::length() const
{
return this->size();
}
template <class StringT>
inline bool attributes<StringT>::empty() const
inline bool attributes::empty() const
{
return (this->size() == 0);
}
template <class T>
struct attributes_ptr
{
typedef typename shared_ptr< attributes<T> >::Type Type;
typedef typename shared_ptr< attributes >::Type Type;
};
typedef attributes< ::std::string > attributes_c;
typedef attributes< ::std::wstring > attributes_wc;
typedef attributes attributes_wc;
typedef shared_ptr< attributes_c >::Type attributes_c_ptr;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
template <class StringT, class T>
static bool _cp_apply_attribute(xml::attributes_wc_ptr attr, const StringT & QualifiedName, T & Val)
template <class T>
static bool _cp_apply_attribute(xml::attributes_wc_ptr attr, const std::wstring & QualifiedName, T & Val)
{
Val = attr->get_val<typename T::value_type>(QualifiedName);
return (!!Val);
}
template <class StringT, class T>
static bool _cp_apply_attribute(xml::attributes_wc_ptr attr, const StringT & QualifiedName, T & Val, const T & Default)
template <class T>
static bool _cp_apply_attribute(xml::attributes_wc_ptr attr, const std::wstring & QualifiedName, T & Val, const T & Default)
{
_CP_OPT(T) tmp;
typedef typename optional<T>::Type type_opt_t;
type_opt_t tmp;
try
{
tmp = attr->get_val<T>(QualifiedName);
......@@ -218,8 +221,11 @@ namespace cpdoccore
return (!!tmp);
}
#define CP_APPLY_ATTR(NAME, VAL, ...) _cp_apply_attribute(Attributes, (NAME), (VAL), __VA_ARGS__)
#if defined(_WIN32) || defined(_WIN64)
#define CP_APPLY_ATTR(NAME, VAL, ...) _cp_apply_attribute(Attributes, (NAME), (VAL), __VA_ARGS__)
#else
#define CP_APPLY_ATTR(NAME, VAL, ...) _cp_apply_attribute(Attributes, (NAME), (VAL), ##__VA_ARGS__)
#endif
attributes_wc_ptr read_attributes(sax * SaxReader);
}
......
......@@ -65,7 +65,7 @@ namespace writer
static const wchar_t * quote_str() { return L"&quot;"; }
};
template <class T>
template <class V>
class element;
//
......@@ -111,7 +111,8 @@ namespace writer
return *this;
}
template <class T> friend class element;
template <class V>
friend class element;
};
//
......@@ -299,4 +300,4 @@ typedef xml::writer::element<wchar_t> xml_element;
}
#endif
\ No newline at end of file
#endif
......@@ -10,7 +10,6 @@
namespace cpdoccore {
namespace xml {
template <class StringT>
class attributes;
template <class CharT>
......
......@@ -9,7 +9,7 @@ template <class Ostream>
class logging
{
public:
logging(Ostream & Ostream) : ostream_(Ostream)
logging(Ostream &stream) : ostream_(stream)
{}
template <class T>
......
#-------------------------------------------------
#
# Project created by QtCreator 2015-06-03T10:54:04
#
#-------------------------------------------------
QT -= core gui
TARGET = OdfFileReader
TEMPLATE = lib
CONFIG += staticlib
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wno-ignored-qualifiers
DEFINES += UNICODE \
_UNICODE \
_LINUX_QT \
LINUX \
_USE_LIBXML2_READER_ \
_USE_XMLLITE_READER_ \
USE_LITE_READER
INCLUDEPATH += /usr/include/libxml2
INCLUDEPATH += ../include
SOURCES += \
../formulasconvert/formulasconvert_odf.cpp \
../formulasconvert/formulasconvert_oox.cpp \
../src/conversionelement.cpp \
../src/xml/attributes.cpp \
../src/xml/sax.cpp \
../src/xml/sax_xmllite.cpp \
../src/xml/utils.cpp \
../src/xml/xmlchar.cpp \
../src/odf/abstract_xml.cpp \
../src/odf/anim_elements.cpp \
../src/odf/calcs_styles.cpp \
../src/odf/chart_build_oox.cpp \
../src/odf/createandread.cpp \
../src/odf/documentcontext.cpp \
../src/odf/draw_common.cpp \
../src/odf/draw_frame.cpp \
../src/odf/draw_frame_docx.cpp \
../src/odf/draw_frame_pptx.cpp \
../src/odf/draw_frame_xlsx.cpp \
../src/odf/draw_page.cpp \
../src/odf/draw_page_pptx.cpp \
../src/odf/draw_shapes.cpp \
../src/odf/draw_shapes_docx.cpp \
../src/odf/draw_shapes_pptx.cpp \
../src/odf/draw_shapes_xlsx.cpp \
../src/odf/font_face.cpp \
../src/odf/header_footer.cpp \
../src/odf/list.cpp \
../src/odf/logging.cpp \
../src/odf/note.cpp \
../src/odf/number_style.cpp \
../src/odf/odf_content_xml.cpp \
../src/odf/odfcontext.cpp \
../src/odf/odf_document.cpp \
../src/odf/odf_document_impl.cpp \
../src/odf/office_annotation.cpp \
../src/odf/office_binary_data.cpp \
../src/odf/office_body.cpp \
../src/odf/office_chart.cpp \
../src/odf/office_document.cpp \
../src/odf/office_elements_create.cpp \
../src/odf/office_event_listeners.cpp \
../src/odf/office_presentation.cpp \
../src/odf/office_scripts.cpp \
../src/odf/office_settings.cpp \
../src/odf/office_spreadsheet.cpp \
../src/odf/office_text.cpp \
../src/odf/paragraph_elements.cpp \
../src/odf/ruby.cpp \
../src/odf/search_table_cell.cpp \
../src/odf/skipelement.cpp \
../src/odf/style_chart_properties.cpp \
../src/odf/style_graphic_properties.cpp \
../src/odf/style_map.cpp \
../src/odf/style_paragraph_properties.cpp \
../src/odf/style_paragraph_properties_docx.cpp \
../src/odf/style_paragraph_properties_pptx.cpp \
../src/odf/style_presentation.cpp \
../src/odf/style_regions.cpp \
../src/odf/styles.cpp \
../src/odf/styles_list.cpp \
../src/odf/styles_lite_container.cpp \
../src/odf/style_table_properties.cpp \
../src/odf/style_text_properties.cpp \
../src/odf/svg_parser.cpp \
../src/odf/table.cpp \
../src/odf/table_calculation_settings.cpp \
../src/odf/table_docx.cpp \
../src/odf/table_named_expressions.cpp \
../src/odf/table_pptx.cpp \
../src/odf/table_xlsx.cpp \
../src/odf/templates.cpp \
../src/odf/text_content.cpp \
../src/odf/text_elements.cpp \
../src/odf/datatypes/anchortype.cpp \
../src/odf/datatypes/backgroundcolor.cpp \
../src/odf/datatypes/bool.cpp \
../src/odf/datatypes/bordermodel.cpp \
../src/odf/datatypes/borderstyle.cpp \
../src/odf/datatypes/borderwidths.cpp \
../src/odf/datatypes/calcext_type.cpp \
../src/odf/datatypes/chartdatalabelnumber.cpp \
../src/odf/datatypes/charterrorcategory.cpp \
../src/odf/datatypes/chartinterpolation.cpp \
../src/odf/datatypes/chartlabelarrangement.cpp \
../src/odf/datatypes/chartregressiontype.cpp \
../src/odf/datatypes/chartseriessource.cpp \
../src/odf/datatypes/chartsolidtype.cpp \
../src/odf/datatypes/chartsymbol.cpp \
../src/odf/datatypes/clockvalue.cpp \
../src/odf/datatypes/color.cpp \
../src/odf/datatypes/common_attlists.cpp \
../src/odf/datatypes/direction.cpp \
../src/odf/datatypes/drawfill.cpp \
../src/odf/datatypes/dropcaplength.cpp \
../src/odf/datatypes/fillimagerefpoint.cpp \
../src/odf/datatypes/fobreak.cpp \
../src/odf/datatypes/fontfamilygeneric.cpp \
../src/odf/datatypes/fontpitch.cpp \
../src/odf/datatypes/fontrelief.cpp \
../src/odf/datatypes/fontsize.cpp \
../src/odf/datatypes/fontstretch.cpp \
../src/odf/datatypes/fontstyle.cpp \
../src/odf/datatypes/fontvariant.cpp \
../src/odf/datatypes/fontweight.cpp \
../src/odf/datatypes/gradientstyle.cpp \
../src/odf/datatypes/hatchstyle.cpp \
../src/odf/datatypes/hyphenationkeep.cpp \
../src/odf/datatypes/hyphenationladdercount.cpp \
../src/odf/datatypes/iconset_type.cpp \
../src/odf/datatypes/keeptogether.cpp \
../src/odf/datatypes/layoutgridmode.cpp \
../src/odf/datatypes/length.cpp \
../src/odf/datatypes/lengthorpercent.cpp \
../src/odf/datatypes/letterspacing.cpp \
../src/odf/datatypes/linebreak.cpp \
../src/odf/datatypes/linemode.cpp \
../src/odf/datatypes/linestyle.cpp \
../src/odf/datatypes/linetype.cpp \
../src/odf/datatypes/linewidth.cpp \
../src/odf/datatypes/markerstyle.cpp \
../src/odf/datatypes/noteclass.cpp \
../src/odf/datatypes/officevaluetype.cpp \
../src/odf/datatypes/pageusage.cpp \
../src/odf/datatypes/percent.cpp \
../src/odf/datatypes/percentorscale.cpp \
../src/odf/datatypes/presentationclass.cpp \
../src/odf/datatypes/punctuationwrap.cpp \
../src/odf/datatypes/rotationalign.cpp \
../src/odf/datatypes/runthrough.cpp \
../src/odf/datatypes/scripttype.cpp \
../src/odf/datatypes/shadowtype.cpp \
../src/odf/datatypes/smil_transitiontype.cpp \
../src/odf/datatypes/stylefamily.cpp \
../src/odf/datatypes/stylehorizontalpos.cpp \
../src/odf/datatypes/stylehorizontalrel.cpp \
../src/odf/datatypes/styleleadercolor.cpp \
../src/odf/datatypes/styleposition.cpp \
../src/odf/datatypes/style_ref.cpp \
../src/odf/datatypes/stylerepeat.cpp \
../src/odf/datatypes/styletype.cpp \
../src/odf/datatypes/styleverticalpos.cpp \
../src/odf/datatypes/styleverticalrel.cpp \
../src/odf/datatypes/stylewrap.cpp \
../src/odf/datatypes/stylewrapcontourmode.cpp \
../src/odf/datatypes/tablealign.cpp \
../src/odf/datatypes/tablecentering.cpp \
../src/odf/datatypes/tablemode.cpp \
../src/odf/datatypes/tablevisibility.cpp \
../src/odf/datatypes/targetframename.cpp \
../src/odf/datatypes/textalign.cpp \
../src/odf/datatypes/textalignsource.cpp \
../src/odf/datatypes/textautospace.cpp \
../src/odf/datatypes/textcombine.cpp \
../src/odf/datatypes/textdisplay.cpp \
../src/odf/datatypes/textemphasize.cpp \
../src/odf/datatypes/textposition.cpp \
../src/odf/datatypes/textrotationscale.cpp \
../src/odf/datatypes/texttransform.cpp \
../src/odf/datatypes/underlinecolor.cpp \
../src/odf/datatypes/verticalalign.cpp \
../src/odf/datatypes/wrapoption.cpp \
../src/odf/datatypes/writingmode.cpp \
../src/odf/datatypes/xlink.cpp \
../src/docx/docx_content_type.cpp \
../src/docx/docx_conversion_context.cpp \
../src/docx/docx_drawing.cpp \
../src/docx/docx_package.cpp \
../src/docx/docx_rels.cpp \
../src/docx/docx_table_context.cpp \
../src/docx/headers_footers.cpp \
../src/docx/hyperlinks.cpp \
../src/docx/measuredigits.cpp \
../src/docx/mediaitems.cpp \
../src/docx/mediaitems_utils.cpp \
../src/docx/namespaces.cpp \
../src/docx/oox_chart_axis.cpp \
../src/docx/oox_chart_context.cpp \
../src/docx/oox_chart_legend.cpp \
../src/docx/oox_chart_series.cpp \
../src/docx/oox_chart_shape.cpp \
../src/docx/oox_conversion_context.cpp \
../src/docx/oox_data_labels.cpp \
../src/docx/oox_drawing.cpp \
../src/docx/oox_drawing_fills.cpp \
../src/docx/oox_layout.cpp \
../src/docx/oox_package.cpp \
../src/docx/oox_plot_area.cpp \
../src/docx/oox_title.cpp \
../src/docx/oox_types_chart.cpp \
../src/docx/pptx_comments.cpp \
../src/docx/pptx_comments_context.cpp \
../src/docx/pptx_conversion_context.cpp \
../src/docx/pptx_drawing.cpp \
../src/docx/pptx_drawings.cpp \
../src/docx/pptx_output_xml.cpp \
../src/docx/pptx_package.cpp \
../src/docx/pptx_slide_context.cpp \
../src/docx/pptx_table_context.cpp \
../src/docx/pptx_text_context.cpp \
../src/docx/xlsx_alignment.cpp \
../src/docx/xlsx_border.cpp \
../src/docx/xlsx_borders.cpp \
../src/docx/xlsx_cell_format.cpp \
../src/docx/xlsx_cell_style.cpp \
../src/docx/xlsx_cell_styles.cpp \
../src/docx/xlsx_color.cpp \
../src/docx/xlsx_comments.cpp \
../src/docx/xlsx_comments_context.cpp \
../src/docx/xlsx_complex_number_format.cpp \
../src/docx/xlsxconversioncontext.cpp \
../src/docx/xlsx_defined_names.cpp \
../src/docx/xlsx_drawing.cpp \
../src/docx/xlsx_drawing_context.cpp \
../src/docx/xlsx_drawings.cpp \
../src/docx/xlsx_fill.cpp \
../src/docx/xlsx_fills.cpp \
../src/docx/xlsx_font.cpp \
../src/docx/xlsx_fonts.cpp \
../src/docx/xlsx_hyperlinks.cpp \
../src/docx/xlsx_merge_cells.cpp \
../src/docx/xlsx_numFmts.cpp \
../src/docx/xlsx_num_format_context.cpp \
../src/docx/xlsx_output_xml.cpp \
../src/docx/xlsx_package.cpp \
../src/docx/xlsx_protection.cpp \
../src/docx/xlsx_sharedstrings.cpp \
../src/docx/xlsx_styles.cpp \
../src/docx/xlsx_tablecontext.cpp \
../src/docx/xlsx_table_metrics.cpp \
../src/docx/xlsx_table_state.cpp \
../src/docx/xlsx_textcontext.cpp \
../src/docx/xlsx_utils.cpp \
../src/docx/xlsx_xf.cpp \
../src/common/CPColorUtils.cpp \
../src/common/CPString.cpp \
../src/common/readdocelement.cpp \
../src/ConvertOO2OOX.cpp
HEADERS += \
../formulasconvert/formulasconvert.h \
../src/conversionelement.h \
../src/progressCallback.h \
../src/xml/sax_xmllite.h \
../src/odf/abstract_xml.h \
../src/odf/all_elements.h \
../src/odf/anim_elements.h \
../src/odf/calcs_styles.h \
../src/odf/chart_build_oox.h \
../src/odf/chart_objects.h \
../src/odf/documentcontext.h \
../src/odf/draw_common.h \
../src/odf/draw_frame.h \
../src/odf/draw_page.h \
../src/odf/draw_shapes.h \
../src/odf/font_face.h \
../src/odf/header_footer.h \
../src/odf/list.h \
../src/odf/note.h \
../src/odf/number_style.h \
../src/odf/odf_content_xml.h \
../src/odf/odfcontext.h \
../src/odf/odf_document_impl.h \
../src/odf/office_annotation.h \
../src/odf/office_binary_data.h \
../src/odf/office_body.h \
../src/odf/office_chart.h \
../src/odf/office_document.h \
../src/odf/office_elements.h \
../src/odf/office_elements_create.h \
../src/odf/office_elements_type.h \
../src/odf/office_event_listeners.h \
../src/odf/office_presentation.h \
../src/odf/office_scripts.h \
../src/odf/office_settings.h \
../src/odf/office_spreadsheet.h \
../src/odf/office_text.h \
../src/odf/paragraph_content.h \
../src/odf/paragraph_elements.h \
../src/odf/ruby.h \
../src/odf/search_table_cell.h \
../src/odf/serialize_elements.h \
../src/odf/skipelement.h \
../src/odf/style_chart_properties.h \
../src/odf/style_graphic_properties.h \
../src/odf/style_map.h \
../src/odf/style_paragraph_properties.h \
../src/odf/style_presentation.h \
../src/odf/style_regions.h \
../src/odf/styles.h \
../src/odf/styles_list.h \
../src/odf/styles_lite_container.h \
../src/odf/style_table_properties.h \
../src/odf/style_text_properties.h \
../src/odf/svg_parser.h \
../src/odf/table.h \
../src/odf/table_calculation_settings.h \
../src/odf/table_named_expressions.h \
../src/odf/templates.h \
../src/odf/text_content.h \
../src/odf/text_elements.h \
../src/odf/visitor.h \
../src/odf/datatypes/anchortype.h \
../src/odf/datatypes/backgroundcolor.h \
../src/odf/datatypes/bool.h \
../src/odf/datatypes/bordermodel.h \
../src/odf/datatypes/borderstyle.h \
../src/odf/datatypes/borderwidths.h \
../src/odf/datatypes/calcext_type.h \
../src/odf/datatypes/chartdatalabelnumber.h \
../src/odf/datatypes/charterrorcategory.h \
../src/odf/datatypes/chartinterpolation.h \
../src/odf/datatypes/chartlabelarrangement.h \
../src/odf/datatypes/chartregressiontype.h \
../src/odf/datatypes/chartseriessource.h \
../src/odf/datatypes/chartsolidtype.h \
../src/odf/datatypes/chartsymbol.h \
../src/odf/datatypes/clockvalue.h \
../src/odf/datatypes/color.h \
../src/odf/datatypes/common_attlists.h \
../src/odf/datatypes/custom_shape_types_convert.h \
../src/odf/datatypes/direction.h \
../src/odf/datatypes/drawfill.h \
../src/odf/datatypes/dropcaplength.h \
../src/odf/datatypes/errors.h \
../src/odf/datatypes/fillimagerefpoint.h \
../src/odf/datatypes/fobreak.h \
../src/odf/datatypes/fontfamilygeneric.h \
../src/odf/datatypes/fontpitch.h \
../src/odf/datatypes/fontrelief.h \
../src/odf/datatypes/fontsize.h \
../src/odf/datatypes/fontstretch.h \
../src/odf/datatypes/fontstyle.h \
../src/odf/datatypes/fontvariant.h \
../src/odf/datatypes/fontweight.h \
../src/odf/datatypes/gradientstyle.h \
../src/odf/datatypes/hatchstyle.h \
../src/odf/datatypes/hyphenationkeep.h \
../src/odf/datatypes/hyphenationladdercount.h \
../src/odf/datatypes/iconset_type.h \
../src/odf/datatypes/keeptogether.h \
../src/odf/datatypes/layoutgridmode.h \
../src/odf/datatypes/length.h \
../src/odf/datatypes/lengthorpercent.h \
../src/odf/datatypes/letterspacing.h \
../src/odf/datatypes/linebreak.h \
../src/odf/datatypes/linemode.h \
../src/odf/datatypes/linestyle.h \
../src/odf/datatypes/linetype.h \
../src/odf/datatypes/linewidth.h \
../src/odf/datatypes/markerstyle.h \
../src/odf/datatypes/noteclass.h \
../src/odf/datatypes/odfattributes.h \
../src/odf/datatypes/officevaluetype.h \
../src/odf/datatypes/pageusage.h \
../src/odf/datatypes/percent.h \
../src/odf/datatypes/percentorscale.h \
../src/odf/datatypes/presentationclass.h \
../src/odf/datatypes/punctuationwrap.h \
../src/odf/datatypes/rotationalign.h \
../src/odf/datatypes/runthrough.h \
../src/odf/datatypes/scripttype.h \
../src/odf/datatypes/shadowtype.h \
../src/odf/datatypes/smil_transitiontype.h \
../src/odf/datatypes/stylefamily.h \
../src/odf/datatypes/stylehorizontalpos.h \
../src/odf/datatypes/stylehorizontalrel.h \
../src/odf/datatypes/styleleadercolor.h \
../src/odf/datatypes/styleposition.h \
../src/odf/datatypes/style_ref.h \
../src/odf/datatypes/stylerepeat.h \
../src/odf/datatypes/styletype.h \
../src/odf/datatypes/styleverticalpos.h \
../src/odf/datatypes/styleverticalrel.h \
../src/odf/datatypes/stylewrap.h \
../src/odf/datatypes/stylewrapcontourmode.h \
../src/odf/datatypes/tablealign.h \
../src/odf/datatypes/tablecentering.h \
../src/odf/datatypes/tablemode.h \
../src/odf/datatypes/tablevisibility.h \
../src/odf/datatypes/targetframename.h \
../src/odf/datatypes/textalign.h \
../src/odf/datatypes/textalignsource.h \
../src/odf/datatypes/textautospace.h \
../src/odf/datatypes/textcombine.h \
../src/odf/datatypes/textdisplay.h \
../src/odf/datatypes/textemphasize.h \
../src/odf/datatypes/textposition.h \
../src/odf/datatypes/textrotationscale.h \
../src/odf/datatypes/texttransform.h \
../src/odf/datatypes/underlinecolor.h \
../src/odf/datatypes/verticalalign.h \
../src/odf/datatypes/wrapoption.h \
../src/odf/datatypes/writingmode.h \
../src/odf/datatypes/xlink.h \
../src/docx/docx_content_type.h \
../src/docx/docx_conversion_context.h \
../src/docx/docx_conversion_state.h \
../src/docx/docx_drawing.h \
../src/docx/docx_package.h \
../src/docx/docx_rels.h \
../src/docx/docx_table_context.h \
../src/docx/drawing_object_description.h \
../src/docx/headers_footers.h \
../src/docx/hyperlinks.h \
../src/docx/measuredigits.h \
../src/docx/mediaitems.h \
../src/docx/mediaitems_utils.h \
../src/docx/namespaces.h \
../src/docx/oox_chart_axis.h \
../src/docx/oox_chart_context.h \
../src/docx/oox_chart_legend.h \
../src/docx/oox_chart_series.h \
../src/docx/oox_chart_shape.h \
../src/docx/oox_chart_values.h \
../src/docx/oox_conversion_context.h \
../src/docx/oox_data_labels.h \
../src/docx/oox_drawing.h \
../src/docx/oox_drawing_fills.h \
../src/docx/oox_layout.h \
../src/docx/oox_package.h \
../src/docx/oox_plot_area.h \
../src/docx/ooxtablerowspanned.h \
../src/docx/oox_title.h \
../src/docx/oox_types_chart.h \
../src/docx/pptx_comments.h \
../src/docx/pptx_comments_context.h \
../src/docx/pptx_conversion_context.h \
../src/docx/pptx_default_serializes.h \
../src/docx/pptx_drawing.h \
../src/docx/pptx_drawings.h \
../src/docx/pptx_output_xml.h \
../src/docx/pptx_package.h \
../src/docx/pptx_slide_context.h \
../src/docx/pptx_table_context.h \
../src/docx/pptx_text_context.h \
../src/docx/xlsx_alignment.h \
../src/docx/xlsx_border.h \
../src/docx/xlsx_borders.h \
../src/docx/xlsx_cell_format.h \
../src/docx/xlsx_cell_style.h \
../src/docx/xlsx_cell_styles.h \
../src/docx/xlsx_color.h \
../src/docx/xlsx_comments.h \
../src/docx/xlsx_comments_context.h \
../src/docx/xlsx_complex_number_format.h \
../src/docx/xlsxconversioncontext.h \
../src/docx/xlsx_defined_names.h \
../src/docx/xlsx_drawing.h \
../src/docx/xlsx_drawing_context.h \
../src/docx/xlsx_drawings.h \
../src/docx/xlsx_fill.h \
../src/docx/xlsx_fills.h \
../src/docx/xlsx_font.h \
../src/docx/xlsx_fonts.h \
../src/docx/xlsx_formula.h \
../src/docx/xlsx_hyperlinks.h \
../src/docx/xlsx_merge_cells.h \
../src/docx/xlsx_numFmts.h \
../src/docx/xlsx_num_format_context.h \
../src/docx/xlsx_output_xml.h \
../src/docx/xlsx_package.h \
../src/docx/xlsx_protection.h \
../src/docx/xlsx_row_spanned.h \
../src/docx/xlsx_sharedstrings.h \
../src/docx/xlsx_styles.h \
../src/docx/xlsx_tablecontext.h \
../src/docx/xlsx_table_metrics.h \
../src/docx/xlsx_table_position.h \
../src/docx/xlsx_table_state.h \
../src/docx/xlsx_textcontext.h \
../src/docx/xlsx_utils.h \
../src/docx/xlsx_xf.h \
../include/logging.h \
../include/cpdoccore/CPColorUtils.h \
../include/cpdoccore/CPHash.h \
../include/cpdoccore/CPNoncopyable.h \
../include/cpdoccore/CPOptional.h \
../include/cpdoccore/CPScopedPtr.h \
../include/cpdoccore/CPSharedPtr.h \
../include/cpdoccore/CPString.h \
../include/cpdoccore/CPWeakPtr.h \
../include/cpdoccore/common/readdocelement.h \
../include/cpdoccore/common/readstring.h \
../include/cpdoccore/common/writedocelement.h \
../include/cpdoccore/odf/odf_document.h \
../include/cpdoccore/odf/odfformat.h \
../include/cpdoccore/utf8cpp/utf8/checked.h \
../include/cpdoccore/utf8cpp/utf8/core.h \
../include/cpdoccore/utf8cpp/utf8/unchecked.h \
../include/cpdoccore/utf8cpp/utf8.h \
../include/cpdoccore/xml/attributes.h \
../include/cpdoccore/xml/nodetype.h \
../include/cpdoccore/xml/sax.h \
../include/cpdoccore/xml/simple_xml_writer.h \
../include/cpdoccore/xml/utils.h \
../include/cpdoccore/xml/xmlchar.h \
../include/cpdoccore/xml/xmlelement.h \
../src/ConvertOO2OOX.h
unix {
target.path = /usr/lib
INSTALLS += target
}
......@@ -264,9 +264,9 @@ std::wstring docx_conversion_context::dump_settings_document()
CP_XML_ATTR(L"xmlns:sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main");
CP_XML_ATTR(L"mc:Ignorable", L"w14");
_CP_OPT(bool) boolVal;
_CP_OPT(std::wstring) strVal;
_CP_OPT(int) intVal;
_CP_OPT(bool) boolVal;
_CP_OPT(std::wstring) strVal;
_CP_OPT(int) intVal;
if (odf::GetProperty(settings_properties_,L"evenAndOddHeaders",boolVal))
{
......@@ -833,7 +833,7 @@ namespace
}
}
void docx_conversion_context::set_settings_property(odf::_property & prop)
void docx_conversion_context::set_settings_property(const odf::_property & prop)
{
settings_properties_.push_back(prop);
}
......
......@@ -322,7 +322,7 @@ public:
std::wstring author;
std::wstring initials;
};
void start_comment(std::wstring & content,std::wstring const & author, std::wstring const & date)
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date)
{
int id = comments_.size()+1;
_comment_desc new_comment={content,id,date,author};
......@@ -404,7 +404,7 @@ public:
void process_headers_footers();
void process_comments();
void set_settings_property(odf::_property & prop);
void set_settings_property(const odf::_property & prop);
std::vector<odf::_property> & get_settings_properties();
void start_process_style_content();
......
......@@ -5,7 +5,7 @@
#include <cpdoccore/CPSharedPtr.h>
#include "oox_chart_shape.h"
namespace cpdoccore {
namespace oox {
......@@ -19,7 +19,7 @@ public:
oox_axis_content(int type/*,std::wstring name*/)
{
id_ = abs((int)(this));
id_ = abs(*((int*)(this)));
type_=type; //dimension
}
~oox_axis_content(){}
......@@ -40,4 +40,4 @@ public:
};
}
}
\ No newline at end of file
}
......@@ -262,7 +262,7 @@ std::vector<odf::_property> & pptx_slide_context::get_properties()
return impl_->object_description_.additional_;
}
void pptx_slide_context::set_clipping(std::wstring & str)
void pptx_slide_context::set_clipping(const std::wstring & str)
{
impl_->object_description_.clipping_string_= str;
}
......
......@@ -38,7 +38,7 @@ public:
void set_anchor(std::wstring anchor, double x_pt, double y_pt);
void set_property(odf::_property p);
std::vector<odf::_property> & get_properties();
void set_clipping(std::wstring & str );
void set_clipping(const std::wstring & str );
void set_fill(_oox_fill & fill);
void set_placeHolder_type(std::wstring typeHolder);
......
......@@ -226,7 +226,7 @@ std::vector<odf::_property> & xlsx_drawing_context::get_properties()
{
return impl_->object_description_.additional_;
}
void xlsx_drawing_context::set_clipping(std::wstring & str)
void xlsx_drawing_context::set_clipping(const std::wstring & str)
{
impl_->object_description_.clipping_string_= str;
}
......
#pragma once
#include <string>
//#include <boost/noncopyable.hpp>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPSharedPtr.h>
......@@ -63,7 +62,7 @@ public:
void set_anchor(std::wstring anchor, double x_pt, double y_pt);
void set_property(odf::_property p);
std::vector<odf::_property> & get_properties();
void set_clipping(std::wstring & str );
void set_clipping(const std::wstring & str );
void set_fill(_oox_fill & fill);
void end_drawing();
......
......@@ -5,7 +5,7 @@
#include "serialize_elements.h"
#include <cpdoccore/odf/odf_document.h>
#include "../formulasconvert/include/cpdoccore/formulasconvert.h"
#include "../formulasconvert/formulasconvert.h"
#include "style_graphic_properties.h"
#include "style_chart_properties.h"
......
......@@ -107,7 +107,7 @@ public:
void add_point(unsigned int rep, std::wstring const & styleName);
void chart_build::calc_cash_series(std::wstring adress, std::vector<std::wstring> & cash);
void calc_cash_series(std::wstring adress, std::vector<std::wstring> & cash);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void docx_convert(oox::docx_conversion_context & Context);
......@@ -300,4 +300,4 @@ private:
}
}
\ No newline at end of file
}
......@@ -9,37 +9,42 @@
namespace cpdoccore {
namespace xml {
template <class StringT, class V>
template <class V>
class attributes_get_val_impl_parse
{
public:
static typename optional<V>::Type get_val(attributes<StringT> & attr, const StringT & QualifiedName)
typedef typename optional<V>::Type optional_v_type;
static optional_v_type get_val(attributes & attr, const std::wstring & QualifiedName)
{
try
{
if (attributes<StringT>::value_type val = attr.get(QualifiedName))
return optional<V>::Type( V::parse(*val) );
if (attributes::value_type val = attr.get(QualifiedName))
{
return optional_v_type( V::parse(*val) );
}
}
catch(odf::errors::invalid_attribute &)
{
attributes<StringT>::value_type val = attr.get(QualifiedName);
attributes::value_type val = attr.get(QualifiedName);
#ifdef _DEBUG
_CP_LOG(error) << L"[warning] : invalud attribute value [" << QualifiedName << L":" << ( (val) ? (*val) : (L"?")) << L"]\n";
#endif
}
return optional<V>::Type();
return optional_v_type();
}
};
#define APPLY_PARSE_XML_ATTRIBUTES(V) \
namespace xml { \
template <class StringT> \
class attributes_get_val_impl<StringT, V >\
template<> \
class attributes_get_val_impl<V >\
{\
public:\
static typename optional< V >::Type get_val(attributes<StringT> & attr, const StringT & QualifiedName)\
typedef typename optional<V>::Type optional_v_type; \
static optional_v_type get_val(attributes & attr, const std::wstring & QualifiedName)\
{\
return attributes_get_val_impl_parse<StringT, V>::get_val(attr, QualifiedName);\
return attributes_get_val_impl_parse<V>::get_val(attr, QualifiedName);\
}\
};\
}
......
......@@ -28,7 +28,7 @@
#endif
namespace _image_file_
{
bool GetResolution(const WCHAR* fileName, int & Width, int &Height)
bool GetResolution(const wchar_t* fileName, int & Width, int &Height)
{
bool result =false;
#if defined(_WIN32) || defined(_WIN64)
......@@ -68,7 +68,8 @@ int get_value_emu(double pt)
}
bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & clip_rect)
{
ZeroMemory(clip_rect,4*sizeof(double));
memset(clip_rect, 0, 4*sizeof(double));
if (strClipping.length() <1 || fileName.length()<1)return false;
int fileWidth=0,fileHeight=0;
......@@ -655,4 +656,4 @@ void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_con
}
}
}
\ No newline at end of file
}
#include "precompiled_cpodf.h"
#include "draw_page.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/formulasconvert.h>
#include "../formulasconvert/formulasconvert.h"
#include <boost/lexical_cast.hpp>
......@@ -57,4 +55,4 @@ void draw_page::pptx_convert(oox::pptx_conversion_context & Context)
}
}
}
\ No newline at end of file
}
......@@ -28,7 +28,6 @@ namespace odf {
const wchar_t * draw_shape::ns = L"draw";
const wchar_t * draw_shape::name = L"shape";
/////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -225,7 +224,7 @@ void draw_path::reset_svg_path()
{
// xml-oox ... drawing .. ..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf::_property(L"custom_path",output_.str()));
}
}
......@@ -277,7 +276,7 @@ void draw_polygon::reset_polygon_path()
{
// xml-oox ... drawing .. ..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf::_property(L"custom_path",output_.str()));
}
}
......@@ -494,7 +493,7 @@ void draw_connector::reset_svg_path()
sub_type_ = 6;
// xml-oox ... drawing .. ..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf::_property(L"custom_path",output_.str()));
}
}
......@@ -502,4 +501,4 @@ void draw_connector::reset_svg_path()
///////////////////////////////////////
}
}
\ No newline at end of file
}
......@@ -39,7 +39,7 @@ public:
office_element_ptr create(const ::std::wstring & ns, const ::std::wstring & name, document_context * Context = NULL, bool isRoot = false) const;
private:
typedef std::map<::std::wstring, CreateFuncImpl> MapType;
typedef std::map<std::wstring, CreateFuncImpl> MapType;
MapType map_;
public:
......@@ -56,17 +56,18 @@ template <class T>
class RegisterElement
{
private:
template <class T>
template <class V>
class CreateImpl_
{
public:
static typename shared_ptr<T>::Type create()
static typename shared_ptr<V>::Type create()
{
//return shared_ptr<T>::Type( new T() );
return boost::make_shared<T>();
return boost::make_shared<V>();
}
};
static int class_registered_;
public:
RegisterElement()
{
......@@ -75,13 +76,11 @@ public:
// Jerry Schwarz counter
office_element_creator::get()->register_element(T::ns, T::name, &CreateImpl_<T>::create);
}
};
}
~RegisterElement()
{
};
private:
static int class_registered_;
}
};
template<class T> int RegisterElement<T>::class_registered_ = 0;
......
#pragma once
#include <ostream>
#include <sstream>
#include <string>
#include <vector>
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <boost/algorithm/string.hpp>
#include <cpdoccore/CPOptional.h>
namespace cpdoccore
{
#include <ostream>
#include <sstream>
#include <string>
#include <vector>
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <boost/algorithm/string.hpp>
#include <cpdoccore/CPOptional.h>
namespace cpdoccore
{
namespace svg_path
{
......@@ -23,15 +23,12 @@ namespace svg_path
_CP_OPT(double) x;
_CP_OPT(double) y;
friend void oox_serialize(std::wostream & _Wostream, _point const & val);
};
struct _polyline
{
std::wstring command;
std::vector<_point> points; //
friend void oox_serialize(std::wostream & _Wostream, _polyline const & val);
friend void oox_serialize(std::wostream & _Wostream, std::vector<svg_path::_polyline> & path);
};
//m - 1 point
//c - 3 point
......@@ -43,6 +40,9 @@ namespace svg_path
//q - 2 point
//t - 1 point
//a - [[[[
void oox_serialize(std::wostream & _Wostream, _point const & val);
void oox_serialize(std::wostream & _Wostream, _polyline const & val);
void oox_serialize(std::wostream & _Wostream, std::vector<svg_path::_polyline> & path);
bool parseSvgD(std::vector<_polyline> & Polyline, const std::wstring & rSvgDStatement, bool bWrongPositionAfterZ);
bool parsePolygon(std::vector<_polyline> & Polyline, const std::wstring & rPolygonStatement, bool bWrongPositionAfterZ);
......
......@@ -15,10 +15,9 @@
namespace cpdoccore {
namespace xml {
template <class StringT>
class attributes;
typedef attributes< ::std::wstring > attributes_wc;
typedef attributes attributes_wc;
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
......
/// \file attributes.cpp
/// \author nikolay.pogorskiy@gmail.com
#include <map>
#include <vector>
#include <string>
......@@ -58,12 +55,11 @@ private:
internal_vector vector_;
};
template <class StringT>
class attributes_impl : public attributes<StringT>
class attributes_impl : public attributes
{
public:
typedef typename attributes<StringT>::value_type value_type;
typedef typename attributes<StringT>::key_value key_value;
typedef typename attributes::value_type value_type;
typedef typename attributes::key_value key_value;
public:
attributes_impl() : check_(true){};
......@@ -74,10 +70,10 @@ public:
}
public:
void add(const StringT & QualifiedName, const StringT & Value);
void add(const std::wstring & QualifiedName, const std::wstring & Value);
public:
virtual value_type get(const StringT & QualifiedName) const ;
virtual value_type get(const std::wstring & QualifiedName) const ;
virtual const key_value & at(size_t _Pos) const;
virtual size_t size() const;
......@@ -113,45 +109,47 @@ private:
typedef std::vector< key_value > VectorVal;
#endif
typedef std::map<StringT, size_t> AttribMap;
typedef std::map<std::wstring, size_t> AttribMap;
AttribMap attrib_;
VectorVal values_;
mutable bool check_;
};
template <class StringT>
void attributes_impl<StringT>::add(const StringT & QualifiedName, const StringT & Value)
void attributes_impl::add(const std::wstring & QualifiedName, const std::wstring & Value)
{
typedef typename AttribMap::value_type attr_map_value_type;
values_.push_back( key_value(QualifiedName, Value) );
attrib_.insert( AttribMap::value_type(QualifiedName, values_.size() - 1) );
attrib_.insert( attr_map_value_type(QualifiedName, values_.size() - 1) );
}
template <class StringT>
typename attributes_impl<StringT>::value_type attributes_impl<StringT>::get(const StringT & QualifiedName) const
typename attributes_impl::value_type attributes_impl::get(const std::wstring & QualifiedName) const
{
AttribMap::const_iterator i = attrib_.find( QualifiedName );
typedef typename AttribMap::const_iterator attr_map_iterator;
typedef typename attributes::value_type attr_str_type;
attr_map_iterator i = attrib_.find( QualifiedName );
if ( i != attrib_.end() )
return attributes<StringT>::value_type( values_[i->second].second );
return attr_str_type( values_[i->second].second );
else
return attributes<StringT>::value_type();
return attr_str_type();
}
template <class StringT>
typename const attributes_impl<StringT>::key_value & attributes_impl<StringT>::at(size_t _Pos) const
const typename attributes_impl::key_value & attributes_impl::at(size_t _Pos) const
{
return values_[_Pos];
}
template <class StringT>
size_t attributes_impl<StringT>::size() const
size_t attributes_impl::size() const
{
return attrib_.size();
}
attributes_wc_ptr read_attributes(sax * SaxReader)
{
typedef attributes_impl< ::std::wstring > attributes_impl_wc;
typedef attributes_impl attributes_impl_wc;
_CP_PTR(attributes_impl_wc) attributes = boost::make_shared<attributes_impl_wc>();
if (SaxReader->attrCount() > 0)
......
......@@ -4,7 +4,7 @@
#include <string>
#include "../../../Common/DocxFormat/Source/Base/Nullable.h"
#include "../../../common/docxformat/source/xml/libxml2/libxml2.h"
#include "../../../Common/DocxFormat/Source/XML/libxml2/libxml2.h"
#include "../../include/cpdoccore/xml/sax.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment