office-gobmx/svx/inc/textchain.hxx
Noel Grandin 77fca82aab clang:optin.performance.Padding in svx,editeng
Excessive padding in 'struct svx::SpellPortion' (18 padding bytes, where
2 is optimal).
Excessive padding in 'class SvxNumRule' (11 padding bytes, where 3 is
optimal).
Excessive padding in 'struct SpellInfo' (10 padding bytes, where 2 is
optimal).
Excessive padding in 'struct ImpEditEngine::LineAreaInfo' (14 padding
bytes, where 6 is optimal).
Excessive padding in 'class ImpChainLinkProperties' (5 padding bytes,
where 1 is optimal).
Excessive padding in 'class TextChainFlow' (20 padding bytes, where 4 is
optimal).
Excessive padding in 'class SdrObjList' (13 padding bytes, where 5 is
optimal).
Excessive padding in 'class SdrLayer' (12 padding bytes, where 4 is
optimal).

Change-Id: I17b1c40bfe553c7635dc6177845dc92956cd0fae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121942
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-11 17:24:16 +02:00

106 lines
3.2 KiB
C++

/* -*- 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 <editeng/editdata.hxx>
#include <map>
class ImpChainLinkProperties;
class SdrTextObj;
class SdrModel;
namespace rtl
{
class OUString;
}
typedef OUString ChainLinkId;
enum class CursorChainingEvent : sal_uInt8
{
TO_NEXT_LINK,
TO_PREV_LINK,
UNCHANGED,
NULL_EVENT
};
class ImpChainLinkProperties
{
protected:
friend class TextChain;
ImpChainLinkProperties()
{
aNilChainingEvent = false;
aCursorEvent = CursorChainingEvent::NULL_EVENT;
aPreChainingSel = ESelection(0, 0, 0, 0);
aPostChainingSel = ESelection(0, 0, 0, 0);
aIsPartOfLastParaInNextLink = false; // XXX: Should come from file
aSwitchingToNextBox = false;
}
private:
// NOTE: Remember to set default value in constructor when adding field
ESelection aPreChainingSel;
ESelection aPostChainingSel;
CursorChainingEvent aCursorEvent;
bool aNilChainingEvent;
bool aIsPartOfLastParaInNextLink;
bool aSwitchingToNextBox;
};
class TextChain
{
public:
~TextChain();
ImpChainLinkProperties* GetLinkProperties(const SdrTextObj*);
// Specific Link Properties
CursorChainingEvent const& GetCursorEvent(const SdrTextObj*);
void SetCursorEvent(const SdrTextObj*, CursorChainingEvent const&);
bool GetNilChainingEvent(const SdrTextObj*);
void SetNilChainingEvent(const SdrTextObj*, bool);
ESelection const& GetPreChainingSel(const SdrTextObj*);
void SetPreChainingSel(const SdrTextObj*, ESelection const&);
ESelection const& GetPostChainingSel(const SdrTextObj*);
void SetPostChainingSel(const SdrTextObj*, ESelection const&);
// return whether a paragraph is split between this box and the next
bool GetIsPartOfLastParaInNextLink(const SdrTextObj*);
void SetIsPartOfLastParaInNextLink(const SdrTextObj*, bool);
// return whether we are currently moving the cursor to the next box (useful to know whether we should prevent SetOutlinerParaObject invocations in SdrTextObj::EndTextEdit)
bool GetSwitchingToNextBox(const SdrTextObj*);
void SetSwitchingToNextBox(const SdrTextObj*, bool);
protected:
TextChain();
private:
std::map<ChainLinkId, ImpChainLinkProperties*> maLinkPropertiesMap;
friend class SdrModel;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */