From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- sc/inc/sheetdata.hxx | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 sc/inc/sheetdata.hxx (limited to 'sc/inc/sheetdata.hxx') diff --git a/sc/inc/sheetdata.hxx b/sc/inc/sheetdata.hxx new file mode 100644 index 0000000000..5d27c55f90 --- /dev/null +++ b/sc/inc/sheetdata.hxx @@ -0,0 +1,180 @@ +/* -*- 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 . + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include "address.hxx" + +class SvXMLNamespaceMap; +enum class XmlStyleFamily; + +struct ScStreamEntry +{ + sal_Int64 mnStartOffset; + sal_Int64 mnEndOffset; + + ScStreamEntry() : + mnStartOffset(-1), + mnEndOffset(-1) + { + } + + ScStreamEntry( sal_Int64 nStart, sal_Int64 nEnd ) : + mnStartOffset(nStart), + mnEndOffset(nEnd) + { + } +}; + +struct ScCellStyleEntry +{ + OUString maName; + ScAddress maCellPos; + + ScCellStyleEntry( OUString aName, const ScAddress& rPos ) : + maName(std::move(aName)), + maCellPos(rPos) + { + } +}; + +struct ScNoteStyleEntry +{ + OUString maStyleName; + OUString maTextStyle; + ScAddress maCellPos; + + ScNoteStyleEntry( OUString aStyle, OUString aText, const ScAddress& rPos ) : + maStyleName(std::move(aStyle)), + maTextStyle(std::move(aText)), + maCellPos(rPos) + { + } +}; + +struct ScTextStyleEntry +{ + OUString maName; + ScAddress maCellPos; + ESelection maSelection; + + ScTextStyleEntry( OUString aName, const ScAddress& rPos, const ESelection& rSel ) : + maName(std::move(aName)), + maCellPos(rPos), + maSelection(rSel) + { + } +}; + +struct ScLoadedNamespaceEntry +{ + OUString maPrefix; + OUString maName; + sal_uInt16 mnKey; + + ScLoadedNamespaceEntry( OUString aPrefix, OUString aName, sal_uInt16 nKey ) : + maPrefix(std::move(aPrefix)), + maName(std::move(aName)), + mnKey(nKey) + { + } +}; + +class ScSheetSaveData +{ + std::unordered_set maInitialPrefixes; + std::vector maLoadedNamespaces; + + std::vector maCellStyles; + std::vector maColumnStyles; + std::vector maRowStyles; + std::vector maTableStyles; + std::vector maNoteStyles; + std::vector maNoteParaStyles; + std::vector maNoteTextStyles; + std::vector maTextStyles; + std::vector maBlocked; + std::vector maStreamEntries; + std::vector maSaveEntries; + SCTAB mnStartTab; + sal_Int64 mnStartOffset; + + ScNoteStyleEntry maPreviousNote; + + bool mbInSupportedSave; + +public: + ScSheetSaveData(); + ~ScSheetSaveData(); + + void AddCellStyle( const OUString& rName, const ScAddress& rCellPos ); + void AddColumnStyle( const OUString& rName, const ScAddress& rCellPos ); + void AddRowStyle( const OUString& rName, const ScAddress& rCellPos ); + void AddTableStyle( const OUString& rName, const ScAddress& rCellPos ); + + void HandleNoteStyles( const OUString& rStyleName, const OUString& rTextName, const ScAddress& rCellPos ); + void AddNoteContentStyle( XmlStyleFamily nFamily, const OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ); + + void AddTextStyle( const OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ); + + void BlockSheet( SCTAB nTab ); + bool IsSheetBlocked( SCTAB nTab ) const; + + void AddStreamPos( SCTAB nTab, sal_Int64 nStartOffset, sal_Int64 nEndOffset ); + void GetStreamPos( SCTAB nTab, sal_Int64& rStartOffset, sal_Int64& rEndOffset ) const; + bool HasStreamPos( SCTAB nTab ) const; + + void StartStreamPos( SCTAB nTab, sal_Int64 nStartOffset ); + void EndStreamPos( sal_Int64 nEndOffset ); + + bool HasStartPos() const { return mnStartTab >= 0; } + + void ResetSaveEntries(); + void AddSavePos( SCTAB nTab, sal_Int64 nStartOffset, sal_Int64 nEndOffset ); + void UseSaveEntries(); + + void StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces ); + void StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces ); + bool AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const; + + const std::vector& GetCellStyles() const { return maCellStyles; } + const std::vector& GetColumnStyles() const { return maColumnStyles; } + const std::vector& GetRowStyles() const { return maRowStyles; } + const std::vector& GetTableStyles() const { return maTableStyles; } + const std::vector& GetNoteStyles() const { return maNoteStyles; } + const std::vector& GetNoteParaStyles() const { return maNoteParaStyles; } + const std::vector& GetNoteTextStyles() const { return maNoteTextStyles; } + const std::vector& GetTextStyles() const { return maTextStyles; } + + bool IsInSupportedSave() const { return mbInSupportedSave;} + void SetInSupportedSave( bool bSet ); +}; + +struct ScFormatSaveData +{ + std::map maIDToName; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3