2020-04-24 02:46:54 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
|
|
/*
|
2023-11-09 12:23:00 -06:00
|
|
|
* Copyright the Collabora Online contributors.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*
|
2020-04-24 02:46:54 -05:00
|
|
|
* 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>
|
|
|
|
|
2024-03-24 08:03:11 -05:00
|
|
|
#include <Storage.hpp>
|
|
|
|
|
2020-04-24 02:46:54 -05:00
|
|
|
#ifdef IOS
|
|
|
|
#import "CODocument.h"
|
2021-09-01 03:11:55 -05:00
|
|
|
#import <set>
|
|
|
|
#import <string>
|
2020-04-24 02:46:54 -05:00
|
|
|
#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.
|
|
|
|
|
2021-09-01 03:11:55 -05:00
|
|
|
// We pass around a numeric ever-increasing document identifier that gets bumped for each document
|
2020-04-24 02:46:54 -05:00
|
|
|
// 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.
|
|
|
|
|
2021-09-01 03:11:55 -05:00
|
|
|
class DocumentData
|
2020-04-24 02:46:54 -05:00
|
|
|
{
|
2021-09-01 03:11:55 -05:00
|
|
|
private:
|
|
|
|
public:
|
2020-04-24 02:46:54 -05:00
|
|
|
DocumentData() :
|
|
|
|
loKitDocument(nullptr)
|
|
|
|
#ifdef IOS
|
|
|
|
, coDocument(nil)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-09-01 03:11:55 -05:00
|
|
|
lok::Document *loKitDocument;
|
|
|
|
|
|
|
|
static DocumentData &allocate(unsigned docId);
|
|
|
|
static DocumentData &get(unsigned docId);
|
|
|
|
static void deallocate(unsigned docId);
|
|
|
|
|
|
|
|
#ifdef IOS
|
|
|
|
CODocument *coDocument;
|
|
|
|
#endif
|
|
|
|
};
|
2020-04-24 02:46:54 -05:00
|
|
|
|
2024-03-24 08:03:11 -05:00
|
|
|
/// 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; }
|
|
|
|
|
|
|
|
TriState getDisableChangeTrackingShow() const { return TriState::Unset; }
|
|
|
|
TriState getDisableChangeTrackingRecord() const { return TriState::Unset; }
|
|
|
|
TriState getHideChangeTrackingControls() const { return TriState::Unset; }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-04-24 02:46:54 -05:00
|
|
|
#endif
|