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

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63349 954022d7-b5bf-4e40-9824-e11837661b57
parent 70634aa0
......@@ -265,7 +265,8 @@ SOURCES += \
../src/common/CPColorUtils.cpp \
../src/common/CPString.cpp \
../src/common/readdocelement.cpp \
../src/ConvertOO2OOX.cpp
../src/ConvertOO2OOX.cpp \
../src/odf/math_elements.cpp
HEADERS += \
../formulasconvert/formulasconvert.h \
......@@ -526,7 +527,8 @@ HEADERS += \
../include/cpdoccore/xml/utils.h \
../include/cpdoccore/xml/xmlchar.h \
../include/cpdoccore/xml/xmlelement.h \
../src/ConvertOO2OOX.h
../src/ConvertOO2OOX.h \
../src/odf/math_elements.h
unix {
target.path = /usr/lib
INSTALLS += target
......
......@@ -202,34 +202,18 @@ void convert_border_style(const odf_types::border_style& borderStyle, pptx_borde
if (borderStyle.initialized())
{
if (borderStyle.get_style() == L"none" || borderStyle.get_style().empty())
{
border.present = false;
}
else if (borderStyle.get_style() == L"double")
{
border.cmpd = L"dbl";
}
else if (borderStyle.get_style() == L"dotted")
{
border.prstDash = L"dot";
}
else if (borderStyle.get_style() == L"dashed")
{
border.prstDash = L"dash";
}
else if (borderStyle.get_style() == L"long-dash")
{
border.prstDash = L"lgDash";
}
else if (borderStyle.get_style() == L"dot-dash")
{
border.prstDash = L"dashDot";
}
else if (borderStyle.get_style() == L"dot-dot-dash")
{
border.prstDash = L"lgDashDotDot";
}
if (borderStyle.is_none()) border.present = false;
switch(borderStyle.get_style())
{
case odf_types::border_style::none: border.present = false; break;
case odf_types::border_style::double_: border.cmpd = L"dbl"; break;
case odf_types::border_style::dotted: border.prstDash = L"dot"; break;
case odf_types::border_style::dashed: border.prstDash = L"dash"; break;
case odf_types::border_style::long_dash: border.prstDash = L"lgDash"; break;
case odf_types::border_style::dot_dash: border.prstDash = L"dashDot"; break;
case odf_types::border_style::dot_dot_dash: border.prstDash = L"lgDashDotDot"; break;
}
}
}
//dbl (Double Lines) Double lines of equal width
......
......@@ -27,13 +27,13 @@ std::wstring convert_border_style(const odf_types::border_style& borderStyle)
if (borderStyle.initialized())
{
if (borderStyle.get_style() == L"none" || borderStyle.get_style().empty())
if (borderStyle.get_style() == odf_types::border_style::none || borderStyle.is_none())
retVal = L"none";
else if (borderStyle.get_style() == L"double")
else if (borderStyle.get_style() == odf_types::border_style::double_)
retVal = L"double";
else if (borderStyle.get_style() == L"dotted")
else if (borderStyle.get_style() == odf_types::border_style::dotted)
retVal = L"dotted";
else if (borderStyle.get_style() == L"dashed")
else if (borderStyle.get_style() == odf_types::border_style::dashed)
retVal = L"dashed";
else
......
......@@ -6,15 +6,40 @@ namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const border_style & borderStyle)
{
_Wostream << borderStyle.set_border_style_;
if (borderStyle.is_none())
{
_Wostream << std::wstring(L"none");
return _Wostream;
}
return _Wostream;
_Wostream << borderStyle.get_length();
switch (borderStyle.get_style())
{
case border_style::none: _Wostream << L" none "; break;
case border_style::double_: _Wostream << L" double "; break;
case border_style::dotted: _Wostream << L" dotted "; break;
case border_style::dashed: _Wostream << L" dashed "; break;
case border_style::dot_dashed: _Wostream << L" dot-dashed "; break;
case border_style::solid:
default:
_Wostream << L" solid "; break;
}
_Wostream << borderStyle.get_color();
return _Wostream;
}
border_style::border_style(const std::wstring & Value) : initialized_(false), none_(false)
border_style::border_style(const border_style & Value)
{
set_border_style_ = Value;
color_ = Value.get_color();
length_ = Value.get_length();
style_ = Value.get_style();
initialized_ = true;
}
border_style::border_style(const std::wstring & Value) : initialized_(false), none_(false)
{
std::wstring tmp = boost::algorithm::trim_copy(Value);
boost::algorithm::to_lower(tmp);
......@@ -34,7 +59,13 @@ border_style::border_style(const std::wstring & Value) : initialized_(false), no
length_ = length::parse(splitted[0]);
if (splitted.size() > 1)
style_ = splitted[1];
{
if (splitted[1] == L"solid") style_ = solid;
if (splitted[1] == L"double") style_ = double_;
if (splitted[1] == L"dotted") style_ = dotted;
if (splitted[1] == L"dashed") style_ = dashed;
if (splitted[1] == L"dot-dashed") style_ = dot_dashed;
}
if (splitted.size() > 2)
color_ = color::parse(splitted[2]);
......@@ -49,24 +80,20 @@ border_style::border_style(const std::wstring & Value) : initialized_(false), no
border_style border_style::parse( const std::wstring & Value)
{
return border_style(Value);
return border_style(Value);
}
border_style::border_style(const color & color_, const std::wstring & style_, const length & length_)
border_style::border_style(const color & color_, const type & style_, const length & length_)
{
this->color_ = color_;
this->style_ = style_;
this->length_ = length_;
std::wstringstream s;
s << length_;
s << std::wstring(L" ");
s << style_;
s << std::wstring(L" ");
s << color_;
set_border_style_ = s.str();
if (this->style_ == none)
none_ = true;
initialized_ = true;
}
......
......@@ -3,37 +3,60 @@
#include <string>
#include "length.h"
#include "color.h"
#include <cpdoccore/CPOptional.h>
namespace cpdoccore { namespace odf_types {
class border_style
{
public:
border_style(){}
border_style(const std::wstring & Value);
border_style(const color & color_, const std::wstring & style_, const length & length_);
enum type
{
none,
solid,
double_,
dotted,
dashed,
dot_dashed,
long_dash,
dot_dash,
dot_dot_dash,
single,
groove,
ridge,
inset,
outset,
hidden
};
border_style(){none_ = true;}
border_style(const std::wstring & Value);
border_style(const border_style & Value);
border_style(const color & color_, const type & style_, const length & length_);
static border_style parse(const std::wstring & Str);
public:
bool initialized() const { return initialized_; }
const length & get_length() const { return length_; }
const std::wstring & get_style() const { return style_; }
const color & get_color() const { return color_; }
bool is_none() const { return none_; }
bool initialized() const { return initialized_; }
bool is_none() const { return none_; }
const length & get_length()const { return length_; }
const type & get_style() const { return style_; }
const color & get_color() const { return color_; }
std::wstring set_border_style_;
private:
bool none_;
bool initialized_;
length length_;
std::wstring style_;
color color_;
bool none_;
bool initialized_;
length length_;
type style_;
color color_;
};
std::wostream & operator << (std::wostream & _Wostream, const border_style & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::border_style);
APPLY_PARSE_XML_ATTRIBUTES(odf_types::border_style);
}
......@@ -148,7 +148,7 @@ _CP_OPT(border_widths) GetBorderLineWidths(const graphic_format_properties & gra
}
_CP_OPT(length) GetConsistentBorderValue(const graphic_format_properties & graphicProperties, const border_style & borderStyle, BorderSide borderSide)
{
if (boost::algorithm::contains(borderStyle.get_style(), L"double"))
if ((borderStyle.get_style() == border_style::double_))
{
_CP_OPT(border_widths) borderWidths = GetBorderLineWidths(graphicProperties, borderSide);
if (borderWidths)
......
......@@ -47,28 +47,21 @@ std::wstring process_border(const border_style & borderStyle,
if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
const std::wstring borderStyleStr = borderStyle.get_style();
if (szInt == 0)
w_val = L"none";
else if (borderStyleStr == L"solid"
|| borderStyleStr == L"single")
w_val = L"single";
else if (borderStyleStr == L"double")
w_val = L"double";
else if (borderStyleStr == L"dotted")
w_val = borderStyleStr;
else if (borderStyleStr == L"dashed")
w_val = borderStyleStr;
else if (borderStyleStr == L"groove")
w_val = L"thinThickMediumGap";
else if (borderStyleStr == L"ridge")
w_val = L"thickThinMediumGap";
else if (borderStyleStr == L"inset")
w_val = L"inset";
else if (borderStyleStr == L"outset")
w_val = L"outset";
else if (borderStyleStr == L"hidden")
w_val = L"nil";
switch(borderStyle.get_style())
{
case border_style::none: w_val = L"none"; break;
case border_style::solid:
case border_style::single:
w_val = L"single"; break;
case border_style::double_: w_val = L"double"; break;
case border_style::dotted: w_val = L"dotted"; break;
case border_style::dashed: w_val = L"dashed"; break;
case border_style::groove: w_val = L"thinThickMediumGap"; break;
case border_style::ridge: w_val = L"thickThinMediumGap"; break;
case border_style::inset: w_val = L"inset"; break;
case border_style::outset: w_val = L"outset"; break;
case border_style::hidden: w_val = L"nil"; break;
}
}
std::wstring res;
......
......@@ -43,29 +43,21 @@ std::wstring process_border(border_style & borderStyle,
if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
const std::wstring borderStyleStr = borderStyle.get_style();
if (szInt == 0)
w_val = L"none";
else if (borderStyleStr == L"solid"
|| borderStyleStr == L"single")
w_val = L"single";
else if (borderStyleStr == L"double")
w_val = L"double";
else if (borderStyleStr == L"dotted")
w_val = borderStyleStr;
else if (borderStyleStr == L"dashed")
w_val = borderStyleStr;
else if (borderStyleStr == L"groove")
w_val = L"thinThickMediumGap";
else if (borderStyleStr == L"ridge")
w_val = L"thickThinMediumGap";
else if (borderStyleStr == L"inset")
w_val = L"inset";
else if (borderStyleStr == L"outset")
w_val = L"outset";
else if (borderStyleStr == L"hidden")
w_val = L"nil";
switch(borderStyle.get_style())
{
case border_style::none: w_val = L"none"; break;
case border_style::solid:
case border_style::single:
w_val = L"single"; break;
case border_style::double_: w_val = L"double"; break;
case border_style::dotted: w_val = L"dotted"; break;
case border_style::dashed: w_val = L"dashed"; break;
case border_style::groove: w_val = L"thinThickMediumGap"; break;
case border_style::ridge: w_val = L"thickThinMediumGap"; break;
case border_style::inset: w_val = L"inset"; break;
case border_style::outset: w_val = L"outset"; break;
case border_style::hidden: w_val = L"nil"; break;
}
}
std::wstring res;
if (!w_val.empty())
......
......@@ -390,7 +390,7 @@ void insert_cell_border(oox::docx_conversion_context & Context,
{
w_color = BorderStyle->get_color().get_hex_value();
if (BorderStyle->get_style() == L"double")
if (BorderStyle->get_style() == border_style::double_)
{
w_val = L"double";
if (BorderWidths)
......@@ -468,7 +468,7 @@ void insert_cell_border(oox::pptx_conversion_context & Context,
w_color = borderStyle.get_color().get_hex_value();
if (borderStyle.get_style() == L"double")
if (borderStyle.get_style() == border_style::double_)
{
w_val = L"double";
if (BorderWidths)
......
......@@ -65,29 +65,21 @@ std::wstring process_border(const border_style & borderStyle,
if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
const std::wstring borderStyleStr = borderStyle.get_style();
if (szInt == 0)
w_val = L"none";
else if (borderStyleStr == L"solid"
|| borderStyleStr == L"single")
w_val = L"single";
else if (borderStyleStr == L"double")
w_val = L"double";
else if (borderStyleStr == L"dotted")
w_val = borderStyleStr;
else if (borderStyleStr == L"dashed")
w_val = borderStyleStr;
else if (borderStyleStr == L"groove")
w_val = L"thinThickMediumGap";
else if (borderStyleStr == L"ridge")
w_val = L"thickThinMediumGap";
else if (borderStyleStr == L"inset")
w_val = L"inset";
else if (borderStyleStr == L"outset")
w_val = L"outset";
else if (borderStyleStr == L"hidden")
w_val = L"nil";
switch(borderStyle.get_style())
{
case border_style::none: w_val = L"none"; break;
case border_style::solid:
case border_style::single:
w_val = L"single"; break;
case border_style::double_: w_val = L"double"; break;
case border_style::dotted: w_val = L"dotted"; break;
case border_style::dashed: w_val = L"dashed"; break;
case border_style::groove: w_val = L"thinThickMediumGap"; break;
case border_style::ridge: w_val = L"thickThinMediumGap"; break;
case border_style::inset: w_val = L"inset"; break;
case border_style::outset: w_val = L"outset"; break;
case border_style::hidden: w_val = L"nil"; break;
}
}
std::wstring res;
if (!w_val.empty())
......
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