mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Add SetEditType
This commit is contained in:
@ -152,6 +152,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
WidgetInfo = 3,
|
||||
MovePage = 4,
|
||||
MergePages = 5,
|
||||
SetType = 6,
|
||||
Undefined = 255
|
||||
};
|
||||
|
||||
@ -176,7 +177,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
int nLen = oReader.ReadInt();
|
||||
AddCommandType CommandType = (AddCommandType)oReader.ReadByte();
|
||||
int nPageNum = 0;
|
||||
if (CommandType != AddCommandType::WidgetInfo && CommandType != AddCommandType::MergePages)
|
||||
if (CommandType != AddCommandType::WidgetInfo && CommandType != AddCommandType::MergePages && CommandType != AddCommandType::SetType)
|
||||
nPageNum = oReader.ReadInt();
|
||||
|
||||
if (nPageNum < 0)
|
||||
@ -244,6 +245,12 @@ namespace NSOnlineOfficeBinToPdf
|
||||
oReader.Skip(nLen - 5);
|
||||
break;
|
||||
}
|
||||
case AddCommandType::SetType:
|
||||
{
|
||||
int nType = oReader.ReadInt();
|
||||
pPdf->SetEditType(nType);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (!m_pInternal->pEditor)
|
||||
|
||||
@ -92,6 +92,7 @@ public:
|
||||
// --- EDIT ---
|
||||
// Переходит в режим редактирования. Pdf уже должен быть открыт на чтение - LoadFromFile/LoadFromMemory
|
||||
bool EditPdf(const std::wstring& wsDstFile = L"");
|
||||
void SetEditType(int nType);
|
||||
// Манипуляции со страницами возможны в режиме редактирования
|
||||
bool EditPage (int nPageIndex);
|
||||
bool DeletePage(int nPageIndex);
|
||||
|
||||
Reference in New Issue
Block a user