Compare commits

..

1 Commits

Author SHA1 Message Date
2a4d97c7b4 fix loss of an attribute in sqrt 2025-11-20 16:18:28 +03:00
25 changed files with 137 additions and 222 deletions

View File

@ -33,7 +33,8 @@ OO_BUILD_BRANDING = $$(OO_BRANDING)
OO_DESTDIR_BUILD_OVERRIDE = $$(DESTDIR_BUILD_OVERRIDE)
win32 {
CURRENT_YEAR = $$system(powershell -NoLogo -NoProfile -Command "(Get-Date).Year")
CURRENT_YEAR = $$system(wmic PATH Win32_LocalTime GET ^Year /FORMAT:VALUE | find \"=\")
CURRENT_YEAR = $$replace(CURRENT_YEAR, "Year=", "")
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\r", "")
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\n", "")
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\t", "")

View File

@ -246,11 +246,6 @@ 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,15 +16,7 @@
static tsize_t
_tiffReadProcEx(thandle_t fd, tdata_t buf, tsize_t 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;
return (tsize_t)((CxFile*)fd)->Read(buf, 1, size);
}
static tsize_t

View File

@ -194,9 +194,6 @@ JSSmart<CJSValue> CNativeControlEmbed::ZipOpenBase64(JSSmart<CJSValue> name)
JSSmart<CJSValue> CNativeControlEmbed::ZipFileAsString(JSSmart<CJSValue> name)
{
if (m_pInternal->m_oZipWorker.m_sTmpFolder.empty())
return CJSContext::createUndefined();
BYTE* pData = NULL;
DWORD len = 0;
m_pInternal->m_oZipWorker.GetFileData(name->toStringW(), pData, len);
@ -205,9 +202,6 @@ JSSmart<CJSValue> CNativeControlEmbed::ZipFileAsString(JSSmart<CJSValue> name)
JSSmart<CJSValue> CNativeControlEmbed::ZipFileAsBinary(JSSmart<CJSValue> name)
{
if (m_pInternal->m_oZipWorker.m_sTmpFolder.empty())
return CJSContext::createUndefined();
return CJSContext::createUint8Array(m_pInternal->m_oZipWorker.m_sTmpFolder + L"/" + name->toStringW());
}

View File

@ -30,8 +30,6 @@
-(JSValue*) SplitPages : (JSValue*)arrPageIndexes : (JSValue*)data;
-(JSValue*) MergePages : (JSValue*)data : (JSValue*)nMaxID : (JSValue*)sPrefixForm;
-(JSValue*) UnmergePages;
-(JSValue*) RedactPage : (JSValue*)nPageIndex : (JSValue*)arrRedactBox : (JSValue*)dataFiller;
-(JSValue*) UndoRedact;
@end
@interface CJSCDrawingFileEmbed : NSObject<IJSCDrawingFileEmbed, JSEmbedObjectProtocol>
@ -69,8 +67,6 @@ FUNCTION_WRAPPER_JS_1(FreeWasmData, FreeWasmData)
FUNCTION_WRAPPER_JS_2(SplitPages, SplitPages)
FUNCTION_WRAPPER_JS_3(MergePages, MergePages)
FUNCTION_WRAPPER_JS_0(UnmergePages, UnmergePages)
FUNCTION_WRAPPER_JS_3(RedactPage, RedactPage)
FUNCTION_WRAPPER_JS_0(UndoRedact, UndoRedact)
@end
class CDrawingFileEmbedAdapter : public CJSEmbedObjectAdapterJSC

View File

@ -67,7 +67,7 @@ namespace NSDrawingFileEmbed
NSV8Objects::Template_Set(result, "SplitPages", _SplitPages);
NSV8Objects::Template_Set(result, "MergePages", _MergePages);
NSV8Objects::Template_Set(result, "UnmergePages", _UnmergePages);
NSV8Objects::Template_Set(result, "RedactPage", _RedactPage);
NSV8Objects::Template_Set(result, "RedactPage", _RedactPage);
NSV8Objects::Template_Set(result, "UndoRedact", _UndoRedact);
return handle_scope.Escape(result);

View File

@ -837,63 +837,53 @@ public:
CSymbolSimpleChecker2 oAllChecker(arSymbolsAll, nMaxSymbol);
std::map<std::wstring, int> mapFontsPriorityStandard;
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");
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));
#ifdef _MAC
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"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"Heiti SC");
SET_FONT_PRIORITY(L"Heiti TC");
SET_FONT_PRIORITY(L"Songti SC");
SET_FONT_PRIORITY(L"Songti TC");
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));
#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 15
#define ONLYOFFICE_FONTS_VERSION 14
#define ONLYOFFICE_ALL_FONTS_VERSION 2
class CApplicationFontsWorkerBreaker

View File

@ -4396,42 +4396,41 @@ 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();
if (!bRes && (sSrcM.length() <= 7 || L"http" != sSrcM.substr(0, 4)))
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)))
{
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);
// Проверка расширения
if (!bRes)
{
sExtention = NSFile::GetFileExtention(sSrcM);
std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower);
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 &&
@ -4468,8 +4467,6 @@ private:
}
}
int nImageId = -1;
if (!bRes)
{
if (NotValidExtension(sExtention))

View File

@ -72,14 +72,7 @@ void AutoFilter::readFields(CFRecord& record)
{
size_t pos_record = record.getRdPtr();
if (size == 0xffffffff)
size = record.getDataSize() - pos_record;
else if(record.getDataSize() < pos_record + size)
{
//size error
return;
}
if (size == 0xffffffff) size = record.getDataSize() - pos_record;
if (size > 0)
{

View File

@ -55,8 +55,6 @@ void DataFormat::readFields(CFRecord& record)
unsigned short flags;
record >> xi >> yi >> iss >> flags;
fUnknown = GETBIT(flags, 0);
if(iss > 1000)
iss = 0;
}
void DataFormat::writeFields(CFRecord& record)

View File

@ -148,7 +148,7 @@ int MarkerFormat::serialize(std::wostream & _stream, int index, BaseObjectPtr _G
{
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val", (false == fAuto || index < 0 || index > default_marker_color->size()) ? rgbBack.strRGB : default_marker_color[index]);
CP_XML_ATTR(L"val", (false == fAuto || index < 0) ? rgbBack.strRGB : default_marker_color[index]);
}
}
}
@ -158,7 +158,7 @@ int MarkerFormat::serialize(std::wostream & _stream, int index, BaseObjectPtr _G
{
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val", (false == fAuto || index < 0 || index > default_marker_color->size()) ? rgbFore.strRGB : default_marker_color[index]);
CP_XML_ATTR(L"val", (false == fAuto || index < 0) ? rgbFore.strRGB : default_marker_color[index]);
}
}
CP_XML_NODE(L"a:prstDash") { CP_XML_ATTR(L"val", L"solid"); }

View File

@ -53,7 +53,7 @@ void Feat11FdaAutoFilter::load(CFRecord& record)
}
record.skipNunBytes(2);
if (cbAutoFilter > 0 && cbAutoFilter < 2080 && (record.getDataSize() - record.getRdPtr()) >= cbAutoFilter)
if (cbAutoFilter > 0 && cbAutoFilter < 2080)
{
recAutoFilter.size = cbAutoFilter;
recAutoFilter.readFields(record);

View File

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

View File

@ -153,8 +153,7 @@ const bool ATTACHEDLABEL::loadContent(BinProcessor& proc)
proc.optional<CRTMLFRT>();
if(proc.mandatory<End>())
elements_.pop_back();
proc.mandatory<End>(); elements_.pop_back();
return true;
}

View File

@ -80,11 +80,10 @@ const bool LD::loadContent(BinProcessor& proc)
elements_.pop_back();
}
if(proc.mandatory<ATTACHEDLABEL>())
{
m_ATTACHEDLABEL = elements_.back();
elements_.pop_back();
}
proc.mandatory<ATTACHEDLABEL>();
m_ATTACHEDLABEL = elements_.back();
elements_.pop_back();
if (proc.optional<FRAME>())
{
@ -103,8 +102,7 @@ const bool LD::loadContent(BinProcessor& proc)
elements_.pop_back();
}
proc.optional<CRTMLFRT>();
if(proc.mandatory<End>())
elements_.pop_back();
proc.mandatory<End>(); elements_.pop_back();
return true;
}

View File

@ -305,7 +305,7 @@ int SS::serialize_default(std::wostream & _stream, int series_type, int ind )
if ((line) && (line->lns == (_UINT16)5)) ind = -1;
}
if (ind >= 0 && default_series_line_color->size() > ind && m_isAutoLine)
if (ind >= 0 && m_isAutoLine)
{
CP_XML_NODE(L"a:ln")
{
@ -444,8 +444,7 @@ int SS::serialize(std::wostream & _stream, int series_type, int indPt)
{
CP_XML_NODE(L"a:srgbClr")
{
if(default_series_line_color->size() > ind)
CP_XML_ATTR(L"val", default_series_line_color[ind]);
CP_XML_ATTR(L"val", default_series_line_color[ind]);
}
}
CP_XML_NODE(L"a:prstDash")

View File

@ -577,7 +577,6 @@ namespace OOX
m_oType.SetValue(SimpleTypes::Spreadsheet::celltypeNumber);
m_oShowPhonetic.FromBool(false);
m_oValueMetadata.reset();
m_oCellMetadata.reset();
m_oValue.Clean();
m_oFormula.Clean();

View File

@ -94,6 +94,8 @@ 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();
@ -2610,6 +2612,8 @@ 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

@ -999,77 +999,38 @@ void form_listbox::pptx_convert(oox::pptx_conversion_context& Context)
void form_listbox::serialize_control_props(std::wostream & strm)
{
formulasconvert::odf2oox_converter converter;
if (dropdown_ && dropdown_->get())
CP_XML_WRITER(strm)
{
CP_XML_WRITER(strm)
CP_XML_NODE(L"formControlPr")
{
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"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_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")
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_)
{
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_);
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

@ -3662,12 +3662,24 @@ 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 || oRedact.nLenRender != oRedact.arrQuads.size() / 8 * 12)
if (oRedact.bDraw || !oRedact.pRender)
continue;
BYTE* pMemory = oRedact.pRender;
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));
m_pWriter->AddRedact({});
double dM1, dM2, dM3, dM4, dM5, dM6;
m_pWriter->GetTransform(&dM1, &dM2, &dM3, &dM4, &dM5, &dM6);
@ -3680,32 +3692,22 @@ 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)
if (m_pInternal->pEditor && m_pInternal->pEditor->IsEditPage())
m_pInternal->pEditor->Redact((CRedact*)command);
return S_OK;
}

View File

@ -844,19 +844,18 @@ 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]));