Compare commits

..

18 Commits

Author SHA1 Message Date
c9100737e0 fix prev 2025-12-17 14:38:52 +03:00
bcdcfa8bf7 fix bug #74265 2025-12-08 16:36:25 +03:00
f11beb659f Merge pull request 'Fix html bugs' (#547) from fix/html into release/v9.2.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/547
2025-11-26 16:37:47 +00:00
9a9182a1e9 Fix bug #71375 2025-11-26 19:22:01 +03:00
c7cce459bc Fix bug #78770 2025-11-26 19:21:27 +03:00
05660e8c31 Merge pull request 'Fix libVLC build for win_arm64' (#545) from fix/libvlc-winarm64 into release/v9.2.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/545
2025-11-26 10:05:40 +00:00
b9ff6ba943 Fix libVLC build for win_arm64 2025-11-26 01:59:44 -08:00
d603e4f5dd Merge pull request 'Fix bug 78733' (#544) from fix/bug-78733 into release/v9.2.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/544
2025-11-26 07:25:21 +00:00
207dd32a5d Fix bug 78733 2025-11-26 10:22:54 +03:00
f2d0d7ac4c Fix bug 74149 2025-11-25 23:08:21 +03:00
7b995bb45f Merge pull request 'fix bug #78714' (#542) from fix/bug78714 into release/v9.2.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/542
2025-11-24 19:24:33 +00:00
08502f0b24 fix bug #78714 2025-11-25 00:50:38 +06:00
aeca319710 Merge pull request 'fix bug #78713' (#541) from fix/fix-bugs into release/v9.2.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/541
2025-11-24 18:24:15 +00:00
7425d53eb3 fix bug #78713 2025-11-24 20:58:34 +03:00
bd76b2add0 Merge pull request 'Fix bug 78624' (#539) from fix/bug-78624 into release/v9.2.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/539
2025-11-21 11:18:36 +00:00
0436e39722 Fix bug 78624 2025-11-21 13:52:20 +03:00
07be806ae3 Merge pull request 'Fix bug 74748' (#536) from fix/bug-74748 into release/v9.2.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/536
2025-11-21 09:47:22 +00:00
4bc78e7bb4 Fix bug 74748 2025-10-28 11:16:53 +03:00
17 changed files with 290 additions and 126 deletions

View File

@ -246,6 +246,11 @@ namespace NSSystemPath
wsNewPath.pop_back();
#if !defined(_WIN32) && !defined(_WIN64)
if (L'/' == strPath[0] || L'\\' == strPath[0])
return L'/' + wsNewPath;
#endif
return wsNewPath;
}

View File

@ -16,7 +16,15 @@
static tsize_t
_tiffReadProcEx(thandle_t fd, tdata_t buf, tsize_t size)
{
return (tsize_t)((CxFile*)fd)->Read(buf, 1, size);
tsize_t nReadCount = (tsize_t)((CxFile*)fd)->Read(buf, 1, size);
if (nReadCount < size)
{
memset(static_cast<char*>(buf) + nReadCount, 0, size - nReadCount);
return size;
}
return nReadCount;
}
static tsize_t

View File

@ -837,53 +837,63 @@ public:
CSymbolSimpleChecker2 oAllChecker(arSymbolsAll, nMaxSymbol);
std::map<std::wstring, int> mapFontsPriorityStandard;
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"ASCW3", 1));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Arial", 2));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Times New Roman", 3));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Tahoma", 4));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Cambria", 5));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Calibri", 6));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Verdana", 7));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Georgia", 8));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Open Sans", 9));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Liberation Sans", 10));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Helvetica", 11));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Nimbus Sans L", 12));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"DejaVu Sans", 13));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Liberation Serif", 14));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Trebuchet MS", 15));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Courier New", 16));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Carlito", 17));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Segoe UI", 18));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"SimSun", 19));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"MS Gothic", 20));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Nirmala UI", 21));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Batang", 22));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"MS Mincho", 23));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Wingdings", 24));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Microsoft JhengHei", 25));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Microsoft JhengHei UI", 26));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Microsoft YaHei", 27));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PMingLiU", 28));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"MingLiU", 29));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"DFKai-SB", 30));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"FangSong", 31));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"KaiTi", 32));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"SimKai", 33));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"SimHei", 34));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Meiryo", 35));
int nCurrentPriority = 1;
#define SET_FONT_PRIORITY(fontName) mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(fontName, nCurrentPriority++))
SET_FONT_PRIORITY(L"ASCW3");
SET_FONT_PRIORITY(L"Arial");
SET_FONT_PRIORITY(L"Times New Roman");
SET_FONT_PRIORITY(L"Tahoma");
SET_FONT_PRIORITY(L"Cambria");
SET_FONT_PRIORITY(L"Calibri");
SET_FONT_PRIORITY(L"Verdana");
SET_FONT_PRIORITY(L"Georgia");
SET_FONT_PRIORITY(L"Open Sans");
SET_FONT_PRIORITY(L"Liberation Sans");
SET_FONT_PRIORITY(L"Helvetica");
SET_FONT_PRIORITY(L"Nimbus Sans L");
SET_FONT_PRIORITY(L"DejaVu Sans");
SET_FONT_PRIORITY(L"Liberation Serif");
SET_FONT_PRIORITY(L"Trebuchet MS");
SET_FONT_PRIORITY(L"Courier New");
SET_FONT_PRIORITY(L"Carlito");
SET_FONT_PRIORITY(L"Segoe UI");
SET_FONT_PRIORITY(L"SimSun");
SET_FONT_PRIORITY(L"MS Gothic");
SET_FONT_PRIORITY(L"Nirmala UI");
SET_FONT_PRIORITY(L"Batang");
SET_FONT_PRIORITY(L"MS Mincho");
SET_FONT_PRIORITY(L"Wingdings");
SET_FONT_PRIORITY(L"Microsoft JhengHei");
SET_FONT_PRIORITY(L"Microsoft JhengHei UI");
SET_FONT_PRIORITY(L"Microsoft YaHei");
SET_FONT_PRIORITY(L"PMingLiU");
SET_FONT_PRIORITY(L"MingLiU");
SET_FONT_PRIORITY(L"DFKai-SB");
SET_FONT_PRIORITY(L"FangSong");
SET_FONT_PRIORITY(L"KaiTi");
SET_FONT_PRIORITY(L"SimKai");
SET_FONT_PRIORITY(L"SimHei");
SET_FONT_PRIORITY(L"Meiryo");
#ifdef _MAC
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang SC", 36));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang TC", 37));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang HK", 38));
SET_FONT_PRIORITY(L"PingFang SC");
SET_FONT_PRIORITY(L"PingFang TC");
SET_FONT_PRIORITY(L"PingFang HK");
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Heiti SC", 39));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Heiti TC", 40));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Songti SC", 41));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Songti TC", 42));
SET_FONT_PRIORITY(L"Heiti SC");
SET_FONT_PRIORITY(L"Heiti TC");
SET_FONT_PRIORITY(L"Songti SC");
SET_FONT_PRIORITY(L"Songti TC");
#endif
SET_FONT_PRIORITY(L"Malgun Gothic");
SET_FONT_PRIORITY(L"Nanum Gothic");
SET_FONT_PRIORITY(L"NanumGothic");
SET_FONT_PRIORITY(L"Noto Sans KR");
SET_FONT_PRIORITY(L"TakaoGothic");
NSFonts::CApplicationFontsSymbols oApplicationChecker;
// приоритеты шрифтов. по имени (все стили)

View File

@ -36,7 +36,7 @@
#include <vector>
#include "../graphics/pro/Fonts.h"
#define ONLYOFFICE_FONTS_VERSION 14
#define ONLYOFFICE_FONTS_VERSION 15
#define ONLYOFFICE_ALL_FONTS_VERSION 2
class CApplicationFontsWorkerBreaker

View File

@ -4396,41 +4396,42 @@ private:
}
}
if (sSrcM.empty())
{
ImageAlternative(oXml, sSelectors, oTS, wsAlt, sSrcM, oImageData);
return true;
}
std::wstring sExtention;
// Предполагаем картинку в Base64
if (sSrcM.length() > 4 && sSrcM.substr(0, 4) == L"data" && sSrcM.find(L"/", 4) != std::wstring::npos)
bRes = readBase64(sSrcM, sExtention);
const bool bIsAllowExternalLocalFiles = GetStatusUsingExternalLocalFiles();
bool bIsBase64 = false;
if (sSrcM.length() > 4 && sSrcM.substr(0, 4) == L"data" && sSrcM.find(L"/", 4) != std::wstring::npos)
bIsBase64 = true;
if (!bIsBase64 && (sSrcM.length() <= 7 || L"http" != sSrcM.substr(0, 4)))
if (!bRes && (sSrcM.length() <= 7 || L"http" != sSrcM.substr(0, 4)))
{
sSrcM = NSSystemPath::ShortenPath(sSrcM);
if (!CanUseThisPath(sSrcM, m_sSrc, m_sCore, bIsAllowExternalLocalFiles))
{
ImageAlternative(oXml, sSelectors, oTS, wsAlt, sSrcM, oImageData);
return true;
}
}
int nImageId = -1;
std::wstring sExtention;
// Предполагаем картинку в Base64
if (bIsBase64)
bRes = readBase64(sSrcM, sExtention);
// Проверка расширения
sExtention = NSFile::GetFileExtention(sSrcM);
std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower);
if (!bRes)
{
sExtention = NSFile::GetFileExtention(sSrcM);
std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower);
std::wstring::const_iterator itFound = std::find_if(sExtention.cbegin(), sExtention.cend(), [](wchar_t wChar){ return !iswalpha(wChar) && L'+' != wChar; });
std::wstring::const_iterator itFound = std::find_if(sExtention.cbegin(), sExtention.cend(), [](wchar_t wChar){ return !iswalpha(wChar) && L'+' != wChar; });
if (sExtention.cend() != itFound)
sExtention.erase(itFound, sExtention.cend());
if (sExtention.cend() != itFound)
sExtention.erase(itFound, sExtention.cend());
}
// Предполагаем картинку в сети
if (!bRes &&
@ -4467,6 +4468,8 @@ private:
}
}
int nImageId = -1;
if (!bRes)
{
if (NotValidExtension(sExtention))

View File

@ -77,6 +77,8 @@ void PtgExtraArray::load(CFRecord& record)
record >> cols >> rows;
tempcols = cols;
temprows = rows;
--cols;
--rows;
}
for(int i = 0; i < (tempcols) * (temprows); ++i)
{
@ -153,10 +155,10 @@ const std::wstring PtgExtraArray::toString() const
if(tempVal.empty())
tempVal = L"#N/A";
ret_val += tempVal;
if (col_cnt > 1)
if (col_cnt)
{
ret_val += L',';
--col_cnt;
col_cnt--;
}
else
{

View File

@ -94,8 +94,6 @@ namespace StarMath
if(pReader->GetAttribute() != nullptr && !CheckForLeftArgument(pReader->GetGlobalType()))
pElement->SetBaseAttribute(pReader->GetAttribute());
else if(pReader->GetAttribute() != nullptr && pElement->GetBaseType() == TypeElement::Index && dynamic_cast<CElementIndex*>(pElement)->GetType() == TypeElement::sqrt)
pElement->SetBaseAttribute(pReader->GetAttribute());
else if(pReader->GetAttribute() != nullptr && (pReader->GetLocalType() == TypeElement::plus || TypeElement::minus == pReader->GetLocalType() || TypeElement::frac == pReader->GetLocalType() || TypeElement::neg == pReader->GetLocalType()))
pElement->SetBaseAttribute(pReader->GetAttribute());
pReader->ClearReader();
@ -2612,8 +2610,6 @@ namespace StarMath
m_pLeftArg->SetBaseAttribute(pAttribute);
this->SetBaseAttribute(m_pLeftArg->GetAttribute());
}
if(m_enTypeIndex == TypeElement::sqrt)
this->SetBaseAttribute(pAttribute);
if(m_pValueIndex != nullptr)
m_pValueIndex->SetAttribute(pAttribute);
if(m_pLeftArg != nullptr)

View File

@ -785,7 +785,44 @@ void odf_document::Impl::parse_styles(office_element *element)
_CP_LOG << L"[warning] empty styles\n";
break;
}
if(document)
{
office_master_styles * master_style = dynamic_cast<office_master_styles *>( document->office_master_styles_.get() );
if (!master_style)
break;
unsigned int elements_master_page = master_style->style_master_page_.size();
if(master_style->style_master_page_.size() > 1)
{
for (size_t i = 1; i < master_style->style_master_page_.size(); i++)
{
office_element_ptr & elm = master_style->style_master_page_[i];
style_master_page * master_page = dynamic_cast<style_master_page *>(elm.get());
if (!master_page)
continue;
std::wstring ws_style_name = master_page->attlist_.style_name_.get_value_or(L"");
for(unsigned int t = 0; t < i;t++)
{
office_element_ptr& elm_prev = master_style->style_master_page_[t];
style_master_page* master_page_prev = dynamic_cast<style_master_page*>(elm_prev.get());
if(!master_page_prev)
continue;
if(ws_style_name == master_page_prev->attlist_.style_name_.get_value_or(L""))
{
master_page->attlist_.style_name_ = ws_style_name + L"_" + std::to_wstring(elements_master_page++);
context_->styleContainer().set_new_name_master_page(L"",master_page->attlist_.style_name_.get_value_or(L""));
break;
}
}
}
}
}
// parse automatic styles - эти стили используют объекты которые в оазис находятся в этом же документе
//переопределяем имя - иначе при поиске может возникнуть коллизия.
do
@ -876,7 +913,6 @@ void odf_document::Impl::parse_styles(office_element *element)
_CP_LOG << L"[warning] error reading master page\n";
continue;
}
const std::wstring styleName = masterPage->attlist_.style_name_.get_value_or(L"");
const std::wstring pageLayoutName = masterPage->attlist_.style_page_layout_name_.get_value_or(L"");

View File

@ -350,6 +350,16 @@ namespace cpdoccore {
master_page = res->second;
return master_page;
}
void styles_container::set_new_name_master_page(std::wstring ws_name_layout, std::wstring ws_new_name)
{
vec_new_name_master_page.push_back({ws_name_layout,ws_new_name});
}
std::vector<std::pair<std::wstring, std::wstring> >& styles_container::get_vec_new_name()
{
return vec_new_name_master_page;
}
style_instance* styles_container::style_default_by_type(style_family::type Type) const
{

View File

@ -190,6 +190,9 @@ public:
presentation_layouts_instance & presentation_layouts() { return presentation_layouts_; }
presentation_masters_instance & presentation_masters() { return presentation_masters_; }
void set_new_name_master_page(std::wstring ws_name_layout, std::wstring ws_new_name);
std::vector<std::pair<std::wstring,std::wstring>>& get_vec_new_name();
private:
presentation_layouts_instance presentation_layouts_;
@ -209,6 +212,8 @@ private:
map_style_family_int default_map_;
int hyperlink_style_pos_;
std::vector<std::pair<std::wstring,std::wstring>> vec_new_name_master_page;
};
class page_layout_instance;

View File

@ -999,38 +999,77 @@ void form_listbox::pptx_convert(oox::pptx_conversion_context& Context)
void form_listbox::serialize_control_props(std::wostream & strm)
{
formulasconvert::odf2oox_converter converter;
CP_XML_WRITER(strm)
if (dropdown_ && dropdown_->get())
{
CP_XML_NODE(L"formControlPr")
CP_XML_WRITER(strm)
{
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
CP_XML_ATTR(L"objectType", L"List");
if ((dropdown_) && (dropdown_->get()))
CP_XML_NODE(L"formControlPr")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
CP_XML_ATTR(L"objectType", L"Drop");
CP_XML_ATTR(L"dropStyle", L"combo");
}
if (size_)
CP_XML_ATTR(L"dx", 3 * (*size_));
else
CP_XML_ATTR(L"dx", L"20");
CP_XML_ATTR(L"noThreeD", L"1");
if (linked_cell_)
{
std::wstring fmla = converter.convert_named_ref(*linked_cell_, true, L" ", true);
CP_XML_ATTR(L"fmlaLink", fmla);
}
if (source_cell_range_)
{
std::wstring fmla = converter./*convert_named_expr*/convert_named_ref(*source_cell_range_, true, L" ", true);
CP_XML_ATTR(L"fmlaRange", fmla);
}
//CP_XML_ATTR(L"sel", L"3");
if (n_value_)
CP_XML_ATTR(L"val", *n_value_);
if (size_)
CP_XML_ATTR(L"dx", 3 * (*size_));
else
CP_XML_ATTR(L"dx", L"20");
CP_XML_ATTR(L"noThreeD", L"1");
if (linked_cell_)
{
std::wstring fmla = converter.convert_named_ref(*linked_cell_, true, L" ", true);
CP_XML_ATTR(L"fmlaLink", fmla);
}
if (source_cell_range_)
{
std::wstring fmla = converter.convert_named_ref(*source_cell_range_, true, L" ", true);
CP_XML_ATTR(L"fmlaRange", fmla);
}
CP_XML_ATTR(L"sel", L"3");
if (n_value_)
CP_XML_ATTR(L"val", *n_value_);
else
CP_XML_ATTR(L"val", 0);
}
}
}
else
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"formControlPr")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
CP_XML_ATTR(L"objectType", L"List");
if ((dropdown_) && (dropdown_->get()))
{
CP_XML_ATTR(L"dropStyle", L"combo");
}
if (size_)
CP_XML_ATTR(L"dx", 3 * (*size_));
else
CP_XML_ATTR(L"dx", L"20");
CP_XML_ATTR(L"noThreeD", L"1");
if (linked_cell_)
{
std::wstring fmla = converter.convert_named_ref(*linked_cell_, true, L" ", true);
CP_XML_ATTR(L"fmlaLink", fmla);
}
if (source_cell_range_)
{
std::wstring fmla = converter./*convert_named_expr*/convert_named_ref(*source_cell_range_, true, L" ", true);
CP_XML_ATTR(L"fmlaRange", fmla);
}
//CP_XML_ATTR(L"sel", L"3");
if (n_value_)
CP_XML_ATTR(L"val", *n_value_);
}
}
}
}

View File

@ -128,6 +128,22 @@ void office_presentation::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.end_office_spreadsheet();
}
bool CheckPageLayout(std::vector<std::pair<std::wstring,std::wstring>>* vec_name_layout, draw_page* page, bool new_name)
{
if(vec_name_layout->empty() || !page)
return true;
for(size_t i = 0; i < vec_name_layout->size();i++)
{
if((*vec_name_layout)[i].first == page->attlist_.page_layout_name_.get_value_or(L""))
{
if(new_name)
page->attlist_.master_page_name_ = (*vec_name_layout)[i].second;
return true;
}
}
return false;
}
void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.start_office_presentation();
@ -165,8 +181,43 @@ void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
collect_page_names(Context);
std::vector<std::pair<std::wstring,std::wstring>>* vec_name_master_page = &(Context.root()->odf_context().styleContainer().get_vec_new_name());
unsigned int pos_in_vec = 0;
if(!vec_name_master_page->empty())
{
for (size_t i = 0; i < pages_.size(); i++)
{
if(i >= 1)
{
office_element_ptr & elm = pages_[i];
draw_page* page = dynamic_cast<draw_page*>(elm.get());
if(CheckPageLayout(vec_name_master_page,page,true))
continue;
for(size_t t = 0 ; t < i ; t++)
{
office_element_ptr & elm_prev_page = pages_[t];
draw_page* prev_page = dynamic_cast<draw_page*>(elm_prev_page.get());
if(!prev_page)
break;
if(page->attlist_.master_page_name_.get_value_or(L"") == prev_page->attlist_.master_page_name_.get_value_or(L"") && page->attlist_.page_layout_name_.get_value_or(L"") != prev_page->attlist_.page_layout_name_.get_value_or(L""))
{
page->attlist_.master_page_name_ = (*vec_name_master_page)[pos_in_vec].second;
(*vec_name_master_page)[pos_in_vec].first = page->attlist_.page_layout_name_.get_value_or(L"");
pos_in_vec++;
break;
}
}
}
if(pos_in_vec == vec_name_master_page->size())
break;
}
}
for (size_t i = 0; i < pages_.size(); i++)
{
{
office_element_ptr & elm = pages_[i];
draw_page* page = dynamic_cast<draw_page*>(elm.get());
CheckPageLayout(vec_name_master_page,page,true);
pages_[i]->pptx_convert(Context);
}
Context.end_office_presentation();

View File

@ -3662,24 +3662,12 @@ std::vector<double> CPdfEditor::WriteRedact(const std::vector<std::wstring>& arr
arrRes.insert(arrRes.end(), m_arrRedact[j].arrQuads.begin(), m_arrRedact[j].arrQuads.end());
return arrRes;
}
CRedactData oRedact = m_arrRedact[i];
if (oRedact.bDraw || !oRedact.pRender)
if (oRedact.bDraw || !oRedact.pRender || oRedact.nLenRender != oRedact.arrQuads.size() / 8 * 12)
continue;
LONG nLenRender = oRedact.nLenRender;
BYTE* pRender = oRedact.pRender;
BYTE* pMemory = pRender;
int ret = *((int*)pMemory);
pMemory += 4;
LONG R = ret;
ret = *((int*)pMemory);
pMemory += 4;
LONG G = ret;
ret = *((int*)pMemory);
LONG B = ret;
LONG lColor = (LONG)(R | (G << 8) | (B << 16) | ((LONG)255 << 24));
BYTE* pMemory = oRedact.pRender;
m_pWriter->AddRedact({});
double dM1, dM2, dM3, dM4, dM5, dM6;
m_pWriter->GetTransform(&dM1, &dM2, &dM3, &dM4, &dM5, &dM6);
@ -3692,22 +3680,32 @@ std::vector<double> CPdfEditor::WriteRedact(const std::vector<std::wstring>& arr
m_pWriter->SetTransform(1, 0, 0, 1, 0, 0);
m_pWriter->PathCommandEnd();
m_pWriter->put_BrushType(c_BrushTypeSolid);
m_pWriter->put_BrushColor1(lColor);
m_pWriter->put_BrushAlpha1(255);
m_pWriter->put_BrushAlpha2(255);
for (int i = 0; i < oRedact.arrQuads.size(); i += 8)
{
int ret = *((int*)pMemory);
pMemory += 4;
LONG R = ret;
ret = *((int*)pMemory);
pMemory += 4;
LONG G = ret;
ret = *((int*)pMemory);
pMemory += 4;
LONG B = ret;
LONG lColor = (LONG)(R | (G << 8) | (B << 16) | ((LONG)255 << 24));
m_pWriter->put_BrushColor1(lColor);
m_pWriter->PathCommandMoveTo(PdfReader::PDFCoordsToMM(oRedact.arrQuads[i + 0]), PdfReader::PDFCoordsToMM(oRedact.arrQuads[i + 1]));
m_pWriter->PathCommandLineTo(PdfReader::PDFCoordsToMM(oRedact.arrQuads[i + 2]), PdfReader::PDFCoordsToMM(oRedact.arrQuads[i + 3]));
m_pWriter->PathCommandLineTo(PdfReader::PDFCoordsToMM(oRedact.arrQuads[i + 4]), PdfReader::PDFCoordsToMM(oRedact.arrQuads[i + 5]));
m_pWriter->PathCommandLineTo(PdfReader::PDFCoordsToMM(oRedact.arrQuads[i + 6]), PdfReader::PDFCoordsToMM(oRedact.arrQuads[i + 7]));
m_pWriter->PathCommandClose();
m_pWriter->DrawPath(NULL, L"", c_nWindingFillMode);
m_pWriter->PathCommandEnd();
}
m_pWriter->DrawPath(NULL, L"", c_nWindingFillMode);
m_pWriter->PathCommandEnd();
m_pWriter->SetTransform(dM1, dM2, dM3, dM4, dM5, dM6);
m_pWriter->put_BrushType(lType);
m_pWriter->put_BrushColor1(lColorB);

View File

@ -1362,7 +1362,7 @@ HRESULT CPdfFile::AdvancedCommand(IAdvancedCommand* command)
}
case IAdvancedCommand::AdvancedCommandType::Redact:
{
if (m_pInternal->pEditor && m_pInternal->pEditor->IsEditPage())
if (m_pInternal->pEditor)
m_pInternal->pEditor->Redact((CRedact*)command);
return S_OK;
}

View File

@ -844,18 +844,19 @@ void CPdfReader::DrawPageOnRenderer(IRenderer* pRenderer, int _nPageIndex, bool*
if (m_vRedact[i]->m_nPageIndex == _nPageIndex)
{
BYTE* pMemory = m_vRedact[i]->m_pChanges;
int ret = *((int*)pMemory);
pMemory += 4;
LONG R = ret;
ret = *((int*)pMemory);
pMemory += 4;
LONG G = ret;
ret = *((int*)pMemory);
LONG B = ret;
LONG lColor = (LONG)(R | (G << 8) | (B << 16) | ((LONG)255 << 24));
for (int j = 0; j < m_vRedact[i]->m_arrRedactBox.size(); j += 8)
{
int ret = *((int*)pMemory);
pMemory += 4;
LONG R = ret;
ret = *((int*)pMemory);
pMemory += 4;
LONG G = ret;
ret = *((int*)pMemory);
pMemory += 4;
LONG B = ret;
LONG lColor = (LONG)(R | (G << 8) | (B << 16) | ((LONG)255 << 24));
pRenderer->PathCommandEnd();
pRenderer->put_BrushColor1(lColor);
pRenderer->PathCommandMoveTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[j + 0] - cropBox->x1), PdfReader::PDFCoordsToMM(cropBox->y2 - m_vRedact[i]->m_arrRedactBox[j + 1]));