Add method CCefViewEditor::IsSaveLocked

This commit is contained in:
Oleg Korshul
2025-01-15 13:54:05 +03:00
committed by Oleg Korshul
parent b6b8cad559
commit 19dbdf4729
3 changed files with 23 additions and 1 deletions

View File

@ -180,6 +180,7 @@ public:
bool CheckCloudCryptoNeedBuild();
bool IsBuilding();
bool IsSaveLocked();
std::wstring GetLocalFilePath();
std::wstring GetRecoveryDir();

View File

@ -860,6 +860,8 @@ public:
bool m_bIsCrashed;
// ошибка загрузки
bool m_bIsLoadingError;
// если документ не модифицирован, но закрывать без предупреждения нельзя
bool m_bIsLockedSave;
// поддерживается ли криптование
bool m_bIsOnlyPassSupport;
@ -999,6 +1001,7 @@ public:
m_bIsDestroy = false;
m_bIsCrashed = false;
m_bIsLoadingError = false;
m_bIsLockedSave = false;
m_strUrl = L"";
@ -4491,6 +4494,11 @@ public:
pListener->OnEvent(pEvent);
return true;
}
else if ("on_file_locked_close" == message_name)
{
m_pParent->m_pInternal->m_bIsLockedSave = args->GetBool(0);
return true;
}
CAscApplicationManager_Private* pInternalMan = m_pParent->GetAppManager()->m_pInternal;
if (pInternalMan->m_pAdditional && pInternalMan->m_pAdditional->OnProcessMessageReceived(browser, source_process, message, m_pParent))
@ -8273,6 +8281,10 @@ bool CCefViewEditor::IsBuilding()
return false;
}
bool CCefViewEditor::IsSaveLocked()
{
return m_pInternal->m_bIsLockedSave;
}
std::wstring CCefViewEditor::GetLocalFilePath()
{

View File

@ -4336,6 +4336,13 @@ window.AscDesktopEditor.CallInFrame(\"" +
SEND_MESSAGE_TO_BROWSER_PROCESS(message);
return true;
}
else if (name == "onFileLockedClose")
{
CefRefPtr<CefProcessMessage> message = CefProcessMessage::Create("on_file_locked_close");
message->GetArgumentList()->SetBool(0, arguments[0]->GetBoolValue());
SEND_MESSAGE_TO_BROWSER_PROCESS(message);
return true;
}
// Function does not exist.
return false;
@ -4911,7 +4918,7 @@ if (targetElem) { targetElem.dispatchEvent(event); }})();";
CefRefPtr<CefV8Handler> handler = pWrapper;
#define EXTEND_METHODS_COUNT 183
#define EXTEND_METHODS_COUNT 184
const char* methods[EXTEND_METHODS_COUNT] = {
"Copy",
"Paste",
@ -5165,6 +5172,8 @@ if (targetElem) { targetElem.dispatchEvent(event); }})();";
"OpenBinaryAsNewFile",
"OpenWorkbook",
"onFileLockedClose",
NULL};
ExtendObject(obj, handler, methods);