Compare commits

..

37 Commits

Author SHA1 Message Date
3cb727f8ac Merge pull request #566 from ONLYOFFICE/fix/v6.2.2-fix-bugs
fix bug #49434;...
2021-04-02 12:13:11 +03:00
7f7510b5b3 fix bug #49434
fix bug #49429
fix bug #49202
2021-04-02 12:06:47 +03:00
cd2a46a163 Merge pull request #561 from ONLYOFFICE/fix/v6.2.2-fix-bugs
fix bugs y
2021-03-31 17:42:51 +03:00
6f8c741d5e Merge branch hotfix/v6.2.1 into master 2021-03-31 11:12:47 +00:00
ce173dc575 fix bugs 2021-03-27 10:20:57 +03:00
ec1ef9b006 fix issues #1191 (#548) 2021-03-24 12:17:14 +03:00
31b196840b Merge remote-tracking branch 'origin/master' into hotfix/v6.2.1 2021-03-22 11:43:27 +03:00
ddbb99414f Merge branch release/v6.2.0 into master 2021-03-18 10:17:58 +00:00
af5329264e fix bug #49040 (#537) 2021-03-15 22:11:34 +03:00
fa9a2ed203 Merge branch release/v6.2.0 into master 2021-03-15 15:25:29 +00:00
8da8ad22d0 Merge pull request #526 from ONLYOFFICE/fix/v6.2.0-fix-bugs
fix bug #49015
2021-03-09 20:07:45 +03:00
140d86b7ec fix bug #49015 2021-03-09 20:02:16 +03:00
d57b9f975a Merge pull request #525 from ONLYOFFICE/fix/k620
Change interface of signer class
2021-03-09 17:41:26 +03:00
80f51fa151 . 2021-03-09 16:26:19 +03:00
ad1bf1def6 Merge pull request #523 from ONLYOFFICE/fix/k620
Fix/k620
2021-03-05 16:21:35 +03:00
d9c6ade2d9 Fix previous commit 2021-03-05 16:17:59 +03:00
448dc65550 Fix bugs with signing 2021-03-05 16:11:15 +03:00
d907d53a16 Merge pull request #516 from ONLYOFFICE/fix/v6.2.0-fix-bugs
Fix/v6.2.0 fix bugs
2021-03-03 11:45:56 +03:00
f8211f9aa6 x2t - fix vml shape 2021-03-03 11:40:27 +03:00
10dde7837b fix bug #47039 2021-03-03 11:18:43 +03:00
2a5a5df225 Merge branch release/v6.2.0 into master 2021-03-01 08:42:25 +00:00
7a4bb715cd Merge pull request #513 from ONLYOFFICE/fix/v6.2.0-fix-bugs
fix bug #48879
2021-02-25 15:13:53 +03:00
69e53d0b4c fix bug #48879 2021-02-25 15:08:54 +03:00
a76d6a4a3b Merge pull request #511 from ONLYOFFICE/fix/v6.2.0-fix-bugs
fix bug #48875
2021-02-24 15:16:28 +03:00
a11958760f fix bug #48875 2021-02-24 15:11:07 +03:00
cbc817f2c0 Merge pull request #509 from ONLYOFFICE/fix/v6.2.0-fix-bugs
fix bug #47869
2021-02-24 12:26:06 +03:00
9ae53d040b fix bug #47869 2021-02-24 12:14:19 +03:00
82fab889e5 Merge pull request #508 from ONLYOFFICE/fix/k620
Fix/k620
2021-02-23 21:36:33 +03:00
36358fced8 Fix spaces 2021-02-23 21:33:52 +03:00
9b08ff7b20 Fix bug with pptx saving 2021-02-23 21:28:24 +03:00
9bbe9137a7 Merge pull request #507 from ONLYOFFICE/fix/k620
Fix open files with special symbols
2021-02-20 16:09:04 +03:00
e7bfe36cea Fix open files with special symbols 2021-02-20 16:06:35 +03:00
a6ca030022 Merge pull request #506 from ONLYOFFICE/fix/v6.2.0-fix-bugs
Fix/v6.2.0 fix bugs
2021-02-20 15:13:18 +03:00
ac744cfdda fix bug #48751 2021-02-20 15:07:59 +03:00
b69eb36c6c fix bug #48751, #48751, #48746 2021-02-20 13:18:07 +03:00
91a03ad51c fix bug #48748 2021-02-19 14:06:36 +03:00
8e7deaa1bc Merge branch hotfix/v6.1.1 into master 2021-01-28 08:12:35 +00:00
32 changed files with 223 additions and 97 deletions

View File

@ -80,7 +80,7 @@ public:
}
void WriteUInt16(unsigned short val)
{
if (m_Data)
if (m_Data && (m_Position + sizeof(unsigned short) <= m_Size))
{
((unsigned short *)(m_Data + m_Position))[0] = val;
m_Position += sizeof(unsigned short);
@ -113,7 +113,7 @@ public:
}
void WriteInt32(_INT32 val)
{
if (m_Data)
if (m_Data && (m_Position + sizeof(_INT32) <= m_Size))
{
((_INT32 *)(m_Data + m_Position))[0] = val;
m_Position += sizeof(_INT32);
@ -133,7 +133,7 @@ public:
}
void WriteByte(unsigned char val)
{
if (m_Data)
if (m_Data && (m_Position + 1 <= m_Size))
{
m_Data[m_Position] = val;
m_Position += 1;
@ -141,7 +141,7 @@ public:
}
void WriteUInt32(_UINT32 val)
{
if (m_Data)
if (m_Data && (m_Position + sizeof(_UINT32) <= m_Size))
{
((_UINT32 *)(m_Data + m_Position))[0] = val;
m_Position += sizeof(_UINT32);
@ -190,7 +190,7 @@ public:
}
void WriteBytes(unsigned char* pData, int size)
{
if (m_Data)
if (m_Data && (m_Position + size <= m_Size))
{
memcpy(m_Data + m_Position, pData, size);
m_Position += size;

View File

@ -352,10 +352,10 @@ namespace DocFileFormat
case sprmOldSCcolumns:
case sprmSCcolumns:
{
m_nColumns = static_cast<int> (FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize) + 1);
m_nColumns = static_cast<int> (FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize) + 1);
RELEASEARRAYOBJECTS (m_arrSpace);
m_arrSpace = new short [m_nColumns];
m_arrSpace = new short [m_nColumns];
appendValueAttribute (&cols, L"w:num", FormatUtils::IntToWideString (m_nColumns));
}
@ -388,10 +388,13 @@ namespace DocFileFormat
if (m_nColumns)
{
if (NULL == m_arrSpace)
m_arrSpace = new short[m_nColumns];
m_arrSpace = new short[m_nColumns];
unsigned char nInd = iter->Arguments[0];
m_arrSpace [nInd] = FormatUtils::BytesToInt16 (iter->Arguments, 1, iter->argumentsSize);
unsigned char nInd = iter->Arguments[0];
if (nInd < m_nColumns)
{
m_arrSpace[nInd] = FormatUtils::BytesToInt16(iter->Arguments, 1, iter->argumentsSize);
}
}
}break;

View File

@ -41,12 +41,12 @@ namespace cpdoccore {
namespace oox {
_CP_PTR(oox_axis_content) oox_axis_content::create(int type)
_CP_PTR(oox_axis_content) oox_axis_content::create(int type, unsigned int id)
{
return boost::make_shared<oox_axis_content>(type);
return boost::make_shared<oox_axis_content>(type, id);
}
oox_axis_content::oox_axis_content(int type/*,std::wstring name*/)
oox_axis_content::oox_axis_content(int type/*,std::wstring name*/, unsigned int id)
{
if (type == 0)
{
@ -54,13 +54,13 @@ oox_axis_content::oox_axis_content(int type/*,std::wstring name*/)
}
else
{
id_ = abs((long)this);
id_ = id;
}
type_ = type;
}
void oox_axis_content::oox_serialize(std::wostream & _Wostream)
{
if (id_ < 1 )return; //not activate, blank axis
if (id_ < 1 ) return; //not activate, blank axis
CP_XML_WRITER(_Wostream)
{

View File

@ -50,10 +50,10 @@ class oox_axis_content
public:
odf_reader::chart::oox_typeconvert oox_typeconvert_;
oox_axis_content(int type/*,std::wstring name*/);
oox_axis_content(int type/*,std::wstring name*/, unsigned int id);
~oox_axis_content(){}
static oox_axis_content_ptr create(int type/*,std::wstring name*/);
static oox_axis_content_ptr create(int type/*,std::wstring name*/, unsigned int id);
void oox_serialize(std::wostream & _Wostream);
void oox_serialize_content(std::wostream & _Wostream);
@ -61,7 +61,7 @@ public:
int get_Id(){return id_;}
void add_CrossedId (int id){cross_id_.push_back( id);}
int id_;
unsigned int id_;
std::vector<int> cross_id_;
odf_reader::chart::axis content_;

View File

@ -193,7 +193,7 @@ void oox_serialize_effects(std::wostream & strm, const std::vector<odf_reader::_
{
CP_XML_NODE(L"a:alpha")
{
CP_XML_ATTR(L"val", *dShadowOpacity * 1000);
CP_XML_ATTR(L"val", (int)(*dShadowOpacity * 1000));
}
}
}

View File

@ -32,6 +32,7 @@
#include "oox_plot_area.h"
#include <random>
#include <CPOptional.h>
#include <xml/simple_xml_writer.h>
#include <boost/algorithm/string.hpp>
@ -43,6 +44,14 @@
namespace cpdoccore {
namespace oox {
oox_plot_area::oox_plot_area() : no_used_local_tables_(false)
{
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> distrib(1001, 9999);
axis_id_ += distrib(gen);
}
void oox_plot_area::add_chart(int type)
{
@ -92,7 +101,8 @@ namespace cpdoccore {
void oox_plot_area::add_axis(int type, odf_reader::chart::axis & content)
{
oox_axis_content_ptr ax = oox_axis_content::create(type);
unsigned int id = axis_id_++;
oox_axis_content_ptr ax = oox_axis_content::create(type, id);
ax->content_ = content;
axis_.push_back(ax);

View File

@ -45,7 +45,7 @@ namespace oox {
class oox_plot_area: boost::noncopyable
{
public:
oox_plot_area() : no_used_local_tables_(false) {}
oox_plot_area();
~oox_plot_area(){}
std::vector<oox_chart_ptr> charts_;
@ -72,6 +72,8 @@ private:
void reset_cross_axis(); //обязательно после всех добавлений
bool no_used_local_tables_;
unsigned int axis_id_ = 0xf2905;
};
}

View File

@ -255,7 +255,7 @@ namespace oox {
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val",L"000000");
CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val",38000);}
CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val", 38000);}
}
}
}
@ -273,7 +273,7 @@ namespace oox {
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val",L"000000");
CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val",35000);}
CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val", 35000);}
}
}
}
@ -291,7 +291,7 @@ namespace oox {
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val",L"000000");
CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val",35000);}
CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val", 35000);}
}
}
}

View File

@ -1330,11 +1330,16 @@ void odf_drawing_context::set_opacity(double percent_)
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_opacity_ = percent(percent_);
break;
{
if (impl_->current_drawing_state_.oox_shape_preset_ == 3000)
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_image_opacity_ = percent(percent_);
else
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_opacity_ = percent(percent_);
}break;
case Line:
{
impl_->current_graphic_properties->svg_stroke_opacity_ = percent(percent_);
break;
}break;
}
}
void odf_drawing_context::set_grayscale()
@ -2181,7 +2186,8 @@ void odf_drawing_context::set_size( _CP_OPT(double) & width_pt, _CP_OPT(double)
}
void odf_drawing_context::set_line_width(double pt)
{
if (!impl_->current_graphic_properties)return;
if (!impl_->current_graphic_properties) return;
impl_->current_graphic_properties->svg_stroke_width_ = length(length(pt,length::pt).get_value_unit(length::cm), length::cm);
}
@ -2457,9 +2463,9 @@ void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring &
if (!impl_->current_text_properties) return;
if (!ea.empty()) impl_->current_text_properties->content_.fo_font_family_ = ea;
if (!ea.empty()) impl_->current_text_properties->content_.fo_font_family_ = latin;
if (!cs.empty()) impl_->current_text_properties->content_.style_font_family_complex_ = cs;
if (!latin.empty()) impl_->current_text_properties->content_.style_font_family_asian_ = latin;
if (!latin.empty()) impl_->current_text_properties->content_.style_font_family_asian_ = ea;
}
void odf_drawing_context::set_textarea_fontcolor(std::wstring hexColor)

View File

@ -49,7 +49,7 @@ namespace cpdoccore {
namespace odf_writer {
static int style_family_counts_[26]={};//согласно количеству разных стилей
static int style_family_counts_[1024]={};//согласно количеству разных стилей
void calc_paragraph_properties_content(std::vector<style_paragraph_properties*> & parProps, paragraph_format_properties * result)

View File

@ -381,6 +381,8 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
odf_context()->drawing_context()->set_image_client_rect_inch( l * Width, t * Height, r * Width, b * Height );
}
odf_context()->drawing_context()->start_area_properties();
if (oox_picture->blipFill.blip.IsInit())
{
for (size_t i = 0 ; i < oox_picture->blipFill.blip->Effects.size(); i++)
@ -388,7 +390,9 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
convert(oox_picture->blipFill.blip->Effects[i].Effect.GetPointer());
}
}
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
odf_context()->drawing_context()->end_area_properties();
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
OoxConverter::convert(&oox_picture->spPr, oox_picture->style.GetPointer());
}
@ -1145,6 +1149,7 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
if (oox_bitmap_fill == NULL)return;
odf_context()->drawing_context()->start_bitmap_style();
odf_context()->drawing_context()->start_area_properties();
{
double Width=0, Height = 0;
if (oox_bitmap_fill->blip.IsInit())
@ -1217,6 +1222,7 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
if (oox_bitmap_fill->stretch->fillRect.IsInit()){} //заполнение неполного объема
}
}
odf_context()->drawing_context()->end_area_properties();
odf_context()->drawing_context()->end_bitmap_style();
}
void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB)
@ -1396,7 +1402,15 @@ void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB, PPTX::Log
}
if (oox_line_prop->w.IsInit())
{
odf_context()->drawing_context()->set_line_width(oox_line_prop->w.get() / 12700.); //pt
int width = oox_line_prop->w.get();
if (width == 12700 && false == oox_line_prop->Fill.is_init())
{
width = 0;
odf_context()->drawing_context()->set_no_fill();
}
odf_context()->drawing_context()->set_line_width(width / 12700.); //pt
}
if (oox_line_prop->headEnd.IsInit())
{

View File

@ -2167,6 +2167,7 @@ void DocxConverter::convert(OOX::Logic::CBgPict *oox_bg_pict, int type)
odf_writer::style_page_layout_properties *current_layout_properties = odt_context->page_layout_context()->last_layout()->get_properties();
odt_context->drawing_context()->end_drawing_background(current_layout_properties->attlist_.common_draw_fill_attlist_);
odt_context->drawing_context()->set_background_state(false);
odt_context->end_drawings();
}
void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
@ -2196,6 +2197,7 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
odf_writer::style_page_layout_properties * current_layout_properties = odt_context->page_layout_context()->last_layout()->get_properties();
odt_context->drawing_context()->end_drawing_background(current_layout_properties->attlist_.common_draw_fill_attlist_);
odt_context->drawing_context()->set_background_state(false);
odt_context->end_drawings();
}

View File

@ -88,7 +88,7 @@ PptxConverter::PptxConverter(const std::wstring & path, bool bTemplate)
pptx_document = new PPTX::Document();
if (!pptx_document->isValid(oox_path.GetPath())) // true ???
{
delete pptx_document;
delete pptx_document; pptx_document = NULL;
return;
}
@ -97,7 +97,7 @@ PptxConverter::PptxConverter(const std::wstring & path, bool bTemplate)
smart_ptr<PPTX::Presentation> presentation_ptr = pptx_document->Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (!presentation_ptr.is_init())
{
delete pptx_document;
delete pptx_document; pptx_document = NULL;
return;
}
presentation = presentation_ptr.GetPointer();
@ -1438,6 +1438,7 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
//}
odp_context->drawing_context()->end_drawing_background(page_props->content_.common_draw_fill_attlist_);
odp_context->drawing_context()->set_background_state(false);
odp_context->end_drawings();
}
@ -1498,24 +1499,24 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
if (pPic.IsInit()) pPic->FillLevelUp();
}
int ph_type = 0;
if (pNvPr->ph->type.IsInit())
{
int ph_type = pNvPr->ph->type->GetBYTECode();
ph_type = pNvPr->ph->type->GetBYTECode();
if (type == Layout && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type);
}
else
odf_context()->drawing_context()->set_placeholder_type(0);
if (pNvPr->ph->idx.IsInit())
odf_context()->drawing_context()->set_placeholder_id(pNvPr->ph->idx.get());
if (!bPlaceholders)
continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type);
if (pNvPr->ph->idx.IsInit())
odf_context()->drawing_context()->set_placeholder_id(pNvPr->ph->idx.get());
PPTX::Logic::TextListStyle * listMasterStyle = NULL;
if (txStyles)

View File

@ -68,14 +68,18 @@ void CRecordOfficeArtBlip::ReadFromStream(SRecordHeader & oHeader, POLE::Stream*
oMetaFile.SetHeader(NULL, 0);
BYTE* pData = new BYTE[oHeader.RecLen - lOffset];
pStream->read(pData, oHeader.RecLen - lOffset);
if (pDecryptor)
int nDataSize = oHeader.RecLen - lOffset;
BYTE* pData = (nDataSize > 0 && nDataSize < 0xffffff ) ? (new BYTE[nDataSize]) : NULL;
if (pData)
{
pDecryptor->Decrypt((char*)pData, oHeader.RecLen - lOffset, 0);
pStream->read(pData, oHeader.RecLen - lOffset);
if (pDecryptor)
{
pDecryptor->Decrypt((char*)pData, oHeader.RecLen - lOffset, 0);
}
oMetaFile.SetData(pData, oMetaHeader.cbSave, oMetaHeader.cbSize, (bool)(oMetaHeader.compression != 0xFE));
}
oMetaFile.SetData(pData, oMetaHeader.cbSave, oMetaHeader.cbSize, (bool)(oMetaHeader.compression != 0xFE) );
}break;
case RECORD_TYPE_ESCHER_BLIP_WMF:
{

View File

@ -104,6 +104,7 @@ public:
else
{
delete []pData;
pData = NULL;
}
}
//if (pDecryptor)

View File

@ -2068,6 +2068,9 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
oShapeElem.m_pShape->getBaseShape()->m_oPath.SetCoordsize(21600, 21600);
}
if (pPPTShape->m_oSignatureLine.IsInit())
pPPTShape->m_eType = PPTShapes::ShapeType::sptCFrame;
if (pPPTShape->m_eType == PPTShapes::sptCTextBox)
{
bTextBox = true;
@ -4599,8 +4602,8 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
}else
{
//stretch ??? bug 28238
pBlipFill->stretch = new PPTX::Logic::Stretch();
pBlipFill->stretch.Init();
pBlipFill->stretch->fillRect.Init();
}
std::wstring strCropT = oNodeFillID.GetAttribute(L"croptop");

View File

@ -228,9 +228,13 @@ namespace NSBinPptxRW
std::wstring strExts = _T(".jpg");
//use GetFileName to avoid defining '.' in the directory as extension
std::wstring strFileName = NSFile::GetFileName(strInput);
int nIndexExt = (int)strFileName.rfind(wchar_t('.'));
if (-1 != nIndexExt)
strExts = strFileName.substr(nIndexExt);
int sizeExt = (int)strFileName.rfind(wchar_t('.'));
if (-1 != sizeExt)
{
strExts = strFileName.substr(sizeExt);
sizeExt = (int)strFileName.length() - sizeExt;
}
else sizeExt = 0;
int typeAdditional = 0;
std::wstring strAdditional;
@ -238,14 +242,14 @@ namespace NSBinPptxRW
int nDisplayType = IsDisplayedImage(strInput);
size_t nFileNameLength = strFileName.length();
if (0 != nDisplayType && nFileNameLength > 4)
if (0 != nDisplayType && nFileNameLength > sizeExt)
{
OOX::CPath oPath = strInput;
std::wstring strFolder = oPath.GetDirectory();
std::wstring strFileName = oPath.GetFilename();
strFileName.erase(strFileName.length() - 4, 4);
strFileName.erase(strFileName.length() - sizeExt, sizeExt);
if(0 != (nDisplayType & 1))
{
@ -682,7 +686,13 @@ namespace NSBinPptxRW
{
while (nNewSize >= m_lSize)
{
m_lSize *= 2;
unsigned int lSize = m_lSize * 2;
if (lSize < m_lSize)
{
m_lSize = nNewSize;
break;
}
m_lSize = lSize;
}
BYTE* pNew = new BYTE[m_lSize];
@ -696,8 +706,8 @@ namespace NSBinPptxRW
}
else
{
m_lSize = 1024 * 1024; // 1Mb
m_pStreamData = new BYTE[m_lSize];
m_lSize = 1024 * 1024; // 1Mb
m_pStreamData = new BYTE[m_lSize];
m_lPosition = 0;
m_pStreamCur = m_pStreamData;

View File

@ -238,7 +238,7 @@ namespace PPTX
}
if (sectionLst.IsInit())
{
pWriter->StartNode(namespace_ext + L"ext");
pWriter->StartNode(namespace_ext + L":ext");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"uri", std::wstring(L"{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"));
pWriter->EndAttributes();

View File

@ -325,8 +325,7 @@ namespace PPTX
if (false == detectImageExtension.empty())
{
if (sImageExtension.empty())
sImageExtension = detectImageExtension;
sImageExtension = detectImageExtension;
//папки media может не быть в случае, когда все картинки base64(поскольку файл временный, папку media не создаем)
std::wstring tempFilePath = pReader->m_strFolder + FILE_SEPARATOR_STR;

View File

@ -1395,7 +1395,8 @@ namespace PPTX
{
std::wstring strPenAttr = _T("");
nullable<ShapeStyle> pShapeStyle;
CalculateLine(spPr, pShapeStyle, oTheme, oClrMap, strPenAttr, strNodeVal, bOle);
CalculateLine(pWriter->m_lDocType, spPr, pShapeStyle, oTheme, oClrMap, strPenAttr, strNodeVal, bOle);
pWriter->WriteString(strPenAttr);
}

View File

@ -607,7 +607,8 @@ namespace PPTX
SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get());
vmlPrst = OOX::PrstGeom2VmlShapeType( ooxPrst.GetValue());
}
else if (bSignature) vmlPrst = SimpleTypes::Vml::sptPictureFrame;
if (spPr.xfrm.is_init())
{
if (spPr.xfrm->offX.is_init()) dL = *spPr.xfrm->offX;
@ -619,7 +620,7 @@ namespace PPTX
lH = spPr.xfrm->extY.get_value_or(43200);
}
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH);
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH );
std::wstring strId = L"shape " + std::to_wstring(pWriter->m_lObjectIdVML);
std::wstring strSpid = L"_x0000_s" + std::to_wstring(pWriter->m_lObjectIdVML);
@ -631,8 +632,8 @@ namespace PPTX
std::wstring strFillNode;
std::wstring strStrokeNode;;
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false, bSignature);
CalculateLine(spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, false, bSignature);
CalculateFill(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false, bSignature);
CalculateLine(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, false);
pWriter->StartNode(L"v:shape");
@ -763,7 +764,7 @@ namespace PPTX
pWriter->WriteString(*strTextBoxShape); //??? todooo -> oTextBoxShape
pWriter->EndNode(L"v:textbox");
}
if (spPr.Fill.m_type == UniFill::blipFill)
if (strFillNode.empty() && spPr.Fill.m_type == UniFill::blipFill)
{
BlipFill& blipFill = spPr.Fill.as<BlipFill>();
@ -796,7 +797,7 @@ namespace PPTX
void Shape::toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::Theme>& oTheme, NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap)
{
std::wstring strFillAttr, strFillNode;
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false);
CalculateFill(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false);
pWriter->StartNode(L"v:background");

View File

@ -61,7 +61,7 @@ namespace PPTX
return L"#" + sstream.str();
}
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
void CalculateFill(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature)
{
PPTX::Logic::UniFill fill;
@ -115,18 +115,25 @@ namespace PPTX
}
std::wstring strId = oBlip.blip->embed->ToString();
if (XMLWRITER_DOC_TYPE_XLSX == lDocType)
{
strId = L"o:relid=\"" + strId + L"\"";
}
else
{
strId = L"r:id=\"" + strId + L"\"";
}
if (bOle || bSignature)
{
strAttr = L" filled=\"f\"";
strNode = L"<v:imagedata r:id=\"" + strId + L"\" o:title=\"\" />";
strNode = L"<v:imagedata " + strId + L" o:title=\"\" />";
}
else
{
if (oBlip.tile.is_init())
strNode = L"<v:fill r:id=\"" + strId + L"\" o:title=\"\" type=\"tile\"" + fopacity + L" />";
strNode = L"<v:fill " + strId + L" o:title=\"\" type=\"tile\"" + fopacity + L"/>";
else
strNode = L"<v:fill r:id=\"" + strId + L"\" o:title=\"\" type=\"frame\"" + fopacity + L" />";
strNode = L"<v:fill " + strId + L" o:title=\"\" type=\"frame\"" + fopacity + L"/>";
}
}
}
@ -183,8 +190,8 @@ namespace PPTX
}
*/
}
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature)
void CalculateLine(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
{
PPTX::Logic::Ln line;
DWORD ARGB = 0;
@ -202,7 +209,7 @@ namespace PPTX
ARGB = line.Fill.as<SolidFill>().Color.GetRGBColor(oTheme, oClrMap, ARGB);
strAttr = L" strokecolor=\"" + GetHexColor(ARGB) + L"\"";
}
else if (bOle || bSignature)
else if (line.Fill.is<NoFill>() || bOle)
strAttr = L" stroked=\"f\"";
if (line.w.is_init())

View File

@ -43,11 +43,11 @@ namespace PPTX
{
namespace Logic
{
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, smart_ptr<PPTX::Theme>& oTheme,
void CalculateFill(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, smart_ptr<PPTX::Theme>& oTheme,
smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle,
smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
void CalculateLine(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle,
smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false);
class SpTreeElem : public WrapperWritingElement
{

View File

@ -232,7 +232,7 @@ namespace PPTX
pWriter->StartNode(m_name);
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("typeface"), typeface);
pWriter->WriteAttribute(_T("typeface"), XmlUtils::EncodeXmlString(typeface));
pWriter->WriteAttribute(_T("pitchFamily"), pitchFamily);
pWriter->WriteAttribute(_T("charset"), charset);
pWriter->WriteAttribute(_T("panose"), panose);

View File

@ -338,8 +338,7 @@ namespace PPTX
if (false == detectImageExtension.empty())
{
if (sImageExtension.empty())
sImageExtension = detectImageExtension;
sImageExtension = detectImageExtension;
//папки media может не быть в случае, когда все картинки base64(поскольку файл временный, папку media не создаем)
std::wstring tempFilePath = pReader->m_strFolder + FILE_SEPARATOR_STR;

View File

@ -1657,7 +1657,11 @@ namespace NSFile
}
std::wstring GetFileName(const std::wstring& sPath)
{
#ifdef _WIN32
std::wstring::size_type nPos1 = sPath.rfind('\\');
#else
std::wstring::size_type nPos1 = std::wstring::npos;
#endif
std::wstring::size_type nPos2 = sPath.rfind('/');
std::wstring::size_type nPos = std::wstring::npos;
@ -1676,7 +1680,11 @@ namespace NSFile
}
std::wstring GetDirectoryName(const std::wstring& sPath)
{
#ifdef _WIN32
std::wstring::size_type nPos1 = sPath.rfind('\\');
#else
std::wstring::size_type nPos1 = std::wstring::npos;
#endif
std::wstring::size_type nPos2 = sPath.rfind('/');
std::wstring::size_type nPos = std::wstring::npos;

View File

@ -145,7 +145,11 @@ namespace NSCommon
}
static std::wstring GetFileName(const std::wstring& sPath)
{
#ifdef _WIN32
std::wstring::size_type nPos1 = sPath.rfind('\\');
#else
std::wstring::size_type nPos1 = std::wstring::npos;
#endif
std::wstring::size_type nPos2 = sPath.rfind('/');
std::wstring::size_type nPos = std::wstring::npos;
@ -164,7 +168,11 @@ namespace NSCommon
}
static std::wstring GetDirectoryName(const std::wstring& sPath)
{
#ifdef _WIN32
std::wstring::size_type nPos1 = sPath.rfind('\\');
#else
std::wstring::size_type nPos1 = std::wstring::npos;
#endif
std::wstring::size_type nPos2 = sPath.rfind('/');
std::wstring::size_type nPos = std::wstring::npos;

View File

@ -14,7 +14,7 @@ public:
void SetImageValid(const std::wstring& file);
void SetImageInvalid(const std::wstring& file);
void Sign();
int Sign();
private:
COOXMLSigner_private* m_internal;

View File

@ -615,7 +615,7 @@ public:
return nSignNum;
}
void Sign()
int Sign()
{
Parse();
@ -650,6 +650,8 @@ public:
int nSignNum = AddSignatureReference();
NSFile::CFileBinary::SaveToFile(m_sFolder + L"/_xmlsignatures/sig" + std::to_wstring(nSignNum + 1) + L".xml", builderResult.GetData(), false);
return (sSignedXml.empty()) ? 1 : 0;
}
};
@ -678,7 +680,7 @@ void COOXMLSigner::SetImageInvalid(const std::wstring& file)
m_internal->SetImageInvalid(file);
}
void COOXMLSigner::Sign()
int COOXMLSigner::Sign()
{
m_internal->Sign();
return m_internal->Sign();
}

View File

@ -94,6 +94,7 @@ public:
m_pBase = NULL;
m_separator = ";;;;;;;ONLYOFFICE;;;;;;;";
m_alg = OOXML_HASH_ALG_INVALID;
}
virtual ~CCertificate_openssl_private()
{
@ -131,10 +132,22 @@ public:
return "";
}
if (asn1_serial->type == V_ASN1_NEG_INTEGER)
{
std::string sPositive = "1";
for (int i = 0; i < asn1_serial->length; ++i)
sPositive += "00";
BIGNUM* pn = NULL;
int res = BN_hex2bn(&pn, sPositive.c_str());
BN_add(bn, bn, pn);
BN_free(pn);
}
char *tmp = BN_bn2dec(bn);
std::string sReturn(tmp);
BN_free(bn);
OPENSSL_free(tmp);
return sReturn;
}
@ -271,7 +284,7 @@ public:
return GetNumber();
}
public:
public:
std::string Sign(const std::string& sXml)
{
EVP_MD_CTX* pCtx = EVP_MD_CTX_create();
@ -385,7 +398,7 @@ public:
bool Verify(const std::string& sXml, std::string& sXmlSignature, int nAlg)
{
EVP_MD_CTX* pCtx = EVP_MD_CTX_create();
const EVP_MD* pDigest = Get_EVP_MD(this->GetHashAlg());
const EVP_MD* pDigest = Get_EVP_MD(nAlg);
int n1 = EVP_VerifyInit(pCtx, pDigest);
n1 = n1;
@ -442,8 +455,36 @@ public:
if (!m_cert)
return algs;
// TODO:
// Check algs in cert
//const X509_ALGOR* pAlgr = X509_get0_tbs_sigalg(m_cert);
//int nAlg = OBJ_obj2nid(pAlgr);
int nAlg = X509_get_signature_nid(m_cert);
switch (nAlg)
{
case NID_sha1:
case NID_sha1WithRSA:
case NID_sha1WithRSAEncryption:
algs.push_back(OOXML_HASH_ALG_SHA1);
break;
case NID_sha256:
case NID_sha256WithRSAEncryption:
algs.push_back(OOXML_HASH_ALG_SHA256);
break;
case NID_sha224:
case NID_sha224WithRSAEncryption:
algs.push_back(OOXML_HASH_ALG_SHA224);
break;
case NID_sha384:
case NID_sha384WithRSAEncryption:
algs.push_back(OOXML_HASH_ALG_SHA384);
break;
case NID_sha512:
case NID_sha512WithRSAEncryption:
algs.push_back(OOXML_HASH_ALG_SHA512);
break;
default:
break;
}
if (algs.empty())
m_alg = OOXML_HASH_ALG_SHA1;

View File

@ -3518,11 +3518,15 @@ namespace NExtractTools
{
nRes = html_zip2docx_dir(sFrom, sDocxDir, sTemp, params);
}
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT == nFormatFrom)
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_PACKAGE == nFormatFrom)
{
nRes = mht2docx_dir(sFrom, sDocxDir, sTemp, params);
nRes = package2docx_dir(sFrom, sDocxDir, sTemp, params);
}
else
else if (AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT == nFormatFrom)
{
nRes = mht2docx_dir(sFrom, sDocxDir, sTemp, params);
}
else
nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS;
if(SUCCEEDED_X2T(nRes))
{

View File

@ -4971,7 +4971,6 @@ int BinaryWorksheetsTableReader::ReadDrawings(BYTE type, long length, void* poRe
}
}
}
pDrawing->m_arrItems.push_back(pCellAnchor);
}
else if (pCellAnchor->m_oElement.is_init() && pCellAnchor->m_oElement->is<PPTX::Logic::Shape>())
{
@ -4996,7 +4995,7 @@ int BinaryWorksheetsTableReader::ReadDrawings(BYTE type, long length, void* poRe
oWriter.m_lObjectIdVML = m_pCurVmlDrawing->m_lObjectIdVML;
NSCommon::smart_ptr<PPTX::Logic::ClrMap> oClrMap;
oShape.toXmlWriterVML(&oWriter, m_oSaveParams.pTheme, oClrMap);
oShape.toXmlWriterVML(&oWriter, m_oSaveParams.pTheme, oClrMap, NULL, false, true);
std::wstring strXml = oWriter.GetXmlString();
@ -6871,7 +6870,8 @@ int BinaryFileReader::ReadFile(const std::wstring& sSrcFileName, std::wstring sD
int nType = 0;
std::string version = "";
std::string dst_len = "";
while (true)
while (nIndex < nBase64DataSize)
{
nIndex++;
BYTE _c = pBase64Data[nIndex];