mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Redact Do&Undo
This commit is contained in:
@ -327,6 +327,12 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool UndoRedact()
|
||||
{
|
||||
if (m_nType == 0)
|
||||
return ((CPdfFile*)m_pFile)->UndoRedact();
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE* GetGlyphs(int nPageIndex)
|
||||
{
|
||||
|
||||
@ -207,6 +207,40 @@ JSSmart<CJSValue> CDrawingFileEmbed::UnmergePages()
|
||||
return CJSContext::createBool(m_pFile->UnmergePages());
|
||||
return CJSContext::createBool(false);
|
||||
}
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::RedactPage(JSSmart<CJSValue> nPageIndex, JSSmart<CJSValue> arrRedactBox, JSSmart<CJSValue> dataFiller)
|
||||
{
|
||||
bool result = false;
|
||||
if (m_pFile)
|
||||
{
|
||||
int pageIndex = nPageIndex->toInt32();
|
||||
|
||||
JSSmart<CJSArray> arrBox = arrRedactBox->toArray();
|
||||
int nCountBox = arrBox->getCount();
|
||||
double* pBox = NULL;
|
||||
if (0 < nCountBox)
|
||||
pBox = new double[nCountBox];
|
||||
|
||||
for (int i = 0; i < nCountBox; i++)
|
||||
pBox[i] = arrBox->get(i)->toDouble();
|
||||
|
||||
JSSmart<CJSTypedArray> dataPtr = dataFiller->toTypedArray();
|
||||
CJSDataBuffer buffer = dataPtr->getData();
|
||||
|
||||
result = m_pFile->RedactPage(pageIndex, pBox, nCountBox / 4, buffer.Data, (int)buffer.Len);
|
||||
|
||||
if (pBox)
|
||||
delete[] pBox;
|
||||
if (buffer.IsExternalize)
|
||||
buffer.Free();
|
||||
}
|
||||
return CJSContext::createBool(result);
|
||||
}
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::UndoRedact()
|
||||
{
|
||||
if (m_pFile)
|
||||
return CJSContext::createBool(m_pFile->UndoRedact());
|
||||
return CJSContext::createBool(false);
|
||||
}
|
||||
|
||||
bool EmbedDrawingFile(JSSmart<NSJSBase::CJSContext>& context, IOfficeDrawingFile* pFile)
|
||||
{
|
||||
|
||||
@ -54,6 +54,8 @@ public:
|
||||
JSSmart<CJSValue> SplitPages(JSSmart<CJSValue> arrPageIndexes, JSSmart<CJSValue> data);
|
||||
JSSmart<CJSValue> MergePages(JSSmart<CJSValue> data, JSSmart<CJSValue> nMaxID, JSSmart<CJSValue> sPrefixForm);
|
||||
JSSmart<CJSValue> UnmergePages();
|
||||
JSSmart<CJSValue> RedactPage(JSSmart<CJSValue> nPageIndex, JSSmart<CJSValue> arrRedactBox, JSSmart<CJSValue> dataFiller);
|
||||
JSSmart<CJSValue> UndoRedact();
|
||||
|
||||
DECLARE_EMBED_METHODS
|
||||
};
|
||||
|
||||
@ -33,6 +33,8 @@ namespace NSDrawingFileEmbed
|
||||
FUNCTION_WRAPPER_V8_2(_SplitPages, SplitPages)
|
||||
FUNCTION_WRAPPER_V8_3(_MergePages, MergePages)
|
||||
FUNCTION_WRAPPER_V8_0(_UnmergePages, UnmergePages)
|
||||
FUNCTION_WRAPPER_V8_3(_RedactPage, RedactPage)
|
||||
FUNCTION_WRAPPER_V8_0(_UndoRedact, UndoRedact)
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> CreateTemplate(v8::Isolate* isolate)
|
||||
{
|
||||
@ -65,6 +67,8 @@ 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, "UndoRedact", _UndoRedact);
|
||||
|
||||
return handle_scope.Escape(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user