libreoffice-online/common/MobileApp.hpp
Hubert Figuière 22e789a420 impress: restrict presentation in readonly mode
When export is disabled or watermarks are enabled, presentation in readonly mode
is disabled.
This is checked in the frontend by the WOPI property `DisablePresentation`
that is synthesized in the wsd. Also check when calling the presentation
command.
WOPIFileInfo::getWatermarkText() is stubbed on mobile.

Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: I4f7aff9f670f7523dfcf396f6009a272df9d5af8
2024-05-07 13:21:04 +01:00

92 lines
2.7 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* Copyright the Collabora Online contributors.
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#if MOBILEAPP
#include <LibreOfficeKit/LibreOfficeKit.hxx>
#include <Storage.hpp>
#ifdef IOS
#import "CODocument.h"
#import <set>
#import <string>
#endif
// On iOS at least we want to be able to have several documents open in the same app process.
// It is somewhat complicated to make sure we access the same LibreOfficeKit object for the document
// in both the iOS-specific Objective-C++ code and in the mostly generic Online C++ code.
// We pass around a numeric ever-increasing document identifier that gets bumped for each document
// the system asks the app to open.
// For iOS, it is the static std::atomic<unsigned> appDocIdCounter in CODocument.mm.
// In practice it will probably be equivalent to the DocumentBroker::DocBrokerId or the number that
// the core SfxViewShell::GetDocId() returns, but there might be situations where multi-threading
// and opening of several documents in sequence very quickly might cause discrepancies, so it is
// better to usea different counter to be sure. Patches to use just one counter welcome.
class DocumentData
{
private:
public:
DocumentData() :
loKitDocument(nullptr)
#ifdef IOS
, coDocument(nil)
#endif
{
}
lok::Document *loKitDocument;
static DocumentData &allocate(unsigned docId);
static DocumentData &get(unsigned docId);
static void deallocate(unsigned docId);
#ifdef IOS
CODocument *coDocument;
#endif
};
/// Stub/Dummy WOPI types/interface.
class WopiStorage : public StorageBase
{
public:
class WOPIFileInfo : public FileInfo
{
public:
enum class TriState
{
False,
True,
Unset
};
std::string getTemplateSource() const { return std::string(); }
bool getDisablePrint() const { return false; }
bool getDisableExport() const { return false; }
bool getDisableCopy() const { return false; }
bool getEnableOwnerTermination() const { return false; }
std::string getWatermarkText() const { return std::string(); }
TriState getDisableChangeTrackingShow() const { return TriState::Unset; }
TriState getDisableChangeTrackingRecord() const { return TriState::Unset; }
TriState getHideChangeTrackingControls() const { return TriState::Unset; }
};
};
#endif