/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ #ifndef INCLUDED_SFX2_OBJSH_HXX #define INCLUDED_SFX2_OBJSH_HXX
namespace weld {class Button; } namespace model {class ColorSet; } struct NamedColor; class SbxValue; class SbxArray; class BasicManager; class SfxMedium; class SfxObjectFactory; class SfxDocumentInfoDialog; class SfxStyleSheetBasePool; class StarBASIC; class Printer; class SvKeyValueIterator; class SfxBaseModel; class SfxModule; class SfxProgress; class GDIMetaFile; class INetURLObject; class IndexBitSet; class JobSetup; class OutputDevice; class Color; class Fraction; class SvGlobalName; class InfobarData; class VirtualDevice;
// These values presumably must match exactly the corresponding // css::embed::Aspects ones (in offapi/com/sun/star/embed/Aspects.idl) // and the DVASPECT_* ones in the Win32 API.
/* The class SfxObjectShell is the base class for SFx-objects, ie documents and parts of documents that can be integrated as separate objects into foreign objects. There can be multiple edit windows (SfxViewShell) for one SfxObjectShell.
*/
class SFX2_DLLPUBLIC SfxObjectShell : public SfxShell, public SotObject, public ::comphelper::IEmbeddedHelper
{ friendstruct ModifyBlocker_Impl; friendclass SfxObjectShellLock;
private:
std::unique_ptr<struct SfxObjectShell_Impl> pImpl; // internal data
SfxMedium * pMedium; // Description of the file for example // storage that contains the object
SfxObjectCreateMode eCreateMode; // Purpose of the object bool bHasName :1; // sal_True := existing object, // sal_False := new object bool bIsInGenerateThumbnail; //optimize thumbnail generate and store procedure to improve odt saving performance, i120030 bool mbAvoidRecentDocs; ///< Avoid adding to the recent documents list, if not necessary. bool bRememberSignature; // Do we want to remember the signature.
enum TriState {undefined, yes, no};
TriState mbContinueImportOnFilterExceptions = undefined; // try to import as much as possible
/** * Initialize bare minimum just enough for unit test runs. * * @return true if the initialization is successful, false otherwise.
*/ void DoInitUnitTest(); bool DoInitNew(); bool DoLoad( SfxMedium* pMedium ); bool DoLoadExternal( SfxMedium* pMed ); bool DoSave(); bool DoSaveAs( SfxMedium &rNewStor ); bool DoSaveObjectAs( SfxMedium &rNewStor, bool bCommit );
// TODO/LATER: currently only overridden in Calc, should be made non-virtual virtualbool DoSaveCompleted( SfxMedium* pNewStor=nullptr, bool bRegisterRecent=true ); /// Terminate any in-flight editing. Used before saving, primarily by Calc to commit cell changes. virtualvoid TerminateEditing() {}
// called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action virtualbool QuerySlotExecutable( sal_uInt16 nSlotId );
/** a very special case to insert at a position in Writer from UNO,
via OwnSubFilterService */ virtualbool InsertGeneratedStream(SfxMedium& rMedium,
css::uno::Reference<css::text::XTextRange> const& xInsertPosition); virtualbool ImportFrom( SfxMedium &rMedium,
css::uno::Reference<css::text::XTextRange> const& xInsertPosition); bool ExportTo( SfxMedium &rMedium );
bool IsQueryLoadTemplate() const; bool IsBasedOnTemplate() const; // Whether the document is based on a template bool IsUseUserData() const; bool IsUseThumbnailSave() const; bool IsLoadReadonly() const; bool IsSaveVersionOnClose() const; void SetQueryLoadTemplate( bool b ); void SetUseUserData( bool bNew ); void SetUseThumbnailSave( bool _bNew ); void SetLoadReadonly( bool _bReadonly ); void SetSaveVersionOnClose( bool bSet ); void ResetFromTemplate( const OUString& rTemplateName, std::u16string_view rFileName );
// TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future
sal_uInt32 GetModifyPasswordHash() const; bool SetModifyPasswordHash( sal_uInt32 nHash );
// true if this type of link, from a document, is allowed by the user to be passed to uno:OpenDoc staticbool AllowedLinkProtocolFromDocument(const OUString& rUrl, SfxObjectShell* pObjShell, weld::Window* pDialogParent);
bool IsInGenerateAndStoreThumbnail() const {return bIsInGenerateThumbnail;}//optimize thumbnail generate and store procedure to improve odt saving performance, i120030
/// Don't add to the recent documents - it's an expensive operation, sometimes it is not wanted. bool IsAvoidRecentDocs() const { return mbAvoidRecentDocs; }
/// Don't add to the recent documents - it's an expensive operation, sometimes it is not wanted. void AvoidRecentDocs(bool bAvoid) { mbAvoidRecentDocs = bAvoid; }
/// On first error ask user if import should continue; return saved answer. bool IsContinueImportOnFilterExceptions();
// Naming Interface void SetTitle( const OUString& rTitle ); /* Small non-zero values of nMaxLen don't mean length, but have a magic meaning: 0 (default) the title itself, as it is
1 (==SFX_TITLE_FILENAME) provides the logical file name without path (under WNT depending on the system settings without extension)
2 (==SFX_TITLE_FULLNAME) provides the logical file names with full path (remote =>:: com:: sun:: star:: util:: URL)
3 (==SFX_TITLE_APINAME) provides the logical filename without path and extension
4 (==SFX_TITLE_DETECT) provides the complete title, if not set yet it will be created from DocInfo or the name of the medium.
5 (==SFX_TITLE_CAPTION) provides the Title just like MB now in the CaptionBar view
6 (==SFX_TITLE_PICKLIST) returns the Title, just like MB now would display it in the PickList
7 (==SFX_TITLE_HISTORY) returns the Title just like MB now would display it in the History
10 bis USHRT_MAX provides the 'nMaxLength' of the logical file name including the path (remote => css::util::URL)
*/
OUString GetTitle( sal_uInt16 nMaxLen = 0 ) const; void InvalidateName(); // Re-set to unnamed
css::uno::Reference< css::frame::XModel3 >
GetModel() const; // Only temporarily for the applications! void SetBaseModel( SfxBaseModel* pModel );
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const; // Only temporarily for the applications!
/** * @param bChart true if the file is a chart doc and FillClass should not be called
*/ void SetupStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
sal_Int32 nVersion, bool bTemplate ) const;
// change recording and respective passwword protection for Writer and Calc // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT virtualbool IsChangeRecording(SfxViewShell* pViewShell = nullptr, bool bRecordAllViews = true) const; virtualbool HasChangeRecordProtection() const; virtualvoid SetChangeRecording( bool bActivate, bool bLockAllViews = false, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic ); virtualvoid SetProtectionPassword( const OUString &rPassword ); virtualbool GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash );
staticbool IsOwnStorageFormat(const SfxMedium &);
/** Append Infobar once the frame is ready.
Useful when you want to register an Infobar before the doc/frame is fully loaded. */ void AppendInfoBarWhenReady(const OUString& sId, const OUString& sPrimaryMessage, const OUString& sSecondaryMessage, InfobarType aInfobarType, bool bShowCloseButton = true);
std::vector<InfobarData>& getPendingInfobars();
// Destruction of storages and streams void InternalCloseAndRemoveFiles();
/** override this if you have a XmlIdRegistry. */ virtualconst sfx2::IXmlIdRegistry* GetXmlIdRegistry() const { return nullptr; }
/// Is this read-only object shell opened via .uno:SignPDF? bool IsSignPDF() const;
/// Gets grab-bagged password info to unprotect change tracking with verification
css::uno::Sequence< css::beans::PropertyValue > GetDocumentProtectionFromGrabBag() const;
// Lock all unlocked views, and returns a guard object which unlocks those views when destructed virtual std::unique_ptr<LockAllViewsGuard> LockAllViews()
{ return std::make_unique<LockAllViewsGuard>();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.