mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Add SetEditType
This commit is contained in:
@ -152,6 +152,7 @@ namespace NSOnlineOfficeBinToPdf
|
|||||||
WidgetInfo = 3,
|
WidgetInfo = 3,
|
||||||
MovePage = 4,
|
MovePage = 4,
|
||||||
MergePages = 5,
|
MergePages = 5,
|
||||||
|
SetType = 6,
|
||||||
Undefined = 255
|
Undefined = 255
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,7 +177,7 @@ namespace NSOnlineOfficeBinToPdf
|
|||||||
int nLen = oReader.ReadInt();
|
int nLen = oReader.ReadInt();
|
||||||
AddCommandType CommandType = (AddCommandType)oReader.ReadByte();
|
AddCommandType CommandType = (AddCommandType)oReader.ReadByte();
|
||||||
int nPageNum = 0;
|
int nPageNum = 0;
|
||||||
if (CommandType != AddCommandType::WidgetInfo && CommandType != AddCommandType::MergePages)
|
if (CommandType != AddCommandType::WidgetInfo && CommandType != AddCommandType::MergePages && CommandType != AddCommandType::SetType)
|
||||||
nPageNum = oReader.ReadInt();
|
nPageNum = oReader.ReadInt();
|
||||||
|
|
||||||
if (nPageNum < 0)
|
if (nPageNum < 0)
|
||||||
@ -244,6 +245,12 @@ namespace NSOnlineOfficeBinToPdf
|
|||||||
oReader.Skip(nLen - 5);
|
oReader.Skip(nLen - 5);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AddCommandType::SetType:
|
||||||
|
{
|
||||||
|
int nType = oReader.ReadInt();
|
||||||
|
pPdf->SetEditType(nType);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,9 +115,16 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
|
|||||||
m_pInternal->pWriter = new CPdfWriter(m_pInternal->pAppFonts, false, this, true, m_pInternal->wsTempFolder);
|
m_pInternal->pWriter = new CPdfWriter(m_pInternal->pAppFonts, false, this, true, m_pInternal->wsTempFolder);
|
||||||
|
|
||||||
RELEASEOBJECT(m_pInternal->pEditor);
|
RELEASEOBJECT(m_pInternal->pEditor);
|
||||||
m_pInternal->pEditor = new CPdfEditor(m_pInternal->wsSrcFile, m_pInternal->wsPassword, wsDstFile, m_pInternal->pReader, m_pInternal->pWriter, CPdfEditor::Mode::WriteNew);
|
m_pInternal->pEditor = new CPdfEditor(m_pInternal->wsSrcFile, m_pInternal->wsPassword, wsDstFile, m_pInternal->pReader, m_pInternal->pWriter);
|
||||||
return m_pInternal->pEditor->GetError() == 0;
|
return m_pInternal->pEditor->GetError() == 0;
|
||||||
}
|
}
|
||||||
|
void CPdfFile::SetEditType(int nType)
|
||||||
|
{
|
||||||
|
if (!m_pInternal->pEditor)
|
||||||
|
return;
|
||||||
|
if (nType == 1)
|
||||||
|
m_pInternal->pEditor->SetMode(CPdfEditor::Mode::WriteNew);
|
||||||
|
}
|
||||||
bool CPdfFile::EditPage(int nPageIndex)
|
bool CPdfFile::EditPage(int nPageIndex)
|
||||||
{
|
{
|
||||||
if (!m_pInternal->pEditor)
|
if (!m_pInternal->pEditor)
|
||||||
|
|||||||
@ -92,6 +92,7 @@ public:
|
|||||||
// --- EDIT ---
|
// --- EDIT ---
|
||||||
// Переходит в режим редактирования. Pdf уже должен быть открыт на чтение - LoadFromFile/LoadFromMemory
|
// Переходит в режим редактирования. Pdf уже должен быть открыт на чтение - LoadFromFile/LoadFromMemory
|
||||||
bool EditPdf(const std::wstring& wsDstFile = L"");
|
bool EditPdf(const std::wstring& wsDstFile = L"");
|
||||||
|
void SetEditType(int nType);
|
||||||
// Манипуляции со страницами возможны в режиме редактирования
|
// Манипуляции со страницами возможны в режиме редактирования
|
||||||
bool EditPage (int nPageIndex);
|
bool EditPage (int nPageIndex);
|
||||||
bool DeletePage(int nPageIndex);
|
bool DeletePage(int nPageIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user