Files
core/OOXML/DocxFormat/Logic/ParagraphProperty.h
Alexander Trofimov 76ee07f61c [copyright] Update copyright header
Co-authored-by: Alexander Trofimov <alexander.trofimov@onlyoffice.com>
Co-committed-by: Alexander Trofimov <alexander.trofimov@onlyoffice.com>
2026-05-14 08:23:56 +00:00

272 lines
9.2 KiB
C++

/*
* Copyright (C) Ascensio System SIA, 2009-2026
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation, together with the
* additional terms provided in the LICENSE file.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA by email at info@onlyoffice.com
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
* LV-1050, Latvia, European Union.
*
* The interactive user interfaces in modified versions of the Program
* are required to display Appropriate Legal Notices in accordance with
* Section 5 of the GNU AGPL version 3.
*
* No trademark rights are granted under this License.
*
* All non-code elements of the Product, including illustrations,
* icon sets, and technical writing content, are licensed under the
* Creative Commons Attribution-ShareAlike 4.0 International License:
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
*
* This license applies only to such non-code elements and does not
* modify or replace the licensing terms applicable to the Program's
* source code, which remains licensed under the GNU Affero General
* Public License v3.
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
#pragma once
#include "../../Base/Nullable.h"
#include "./../WritingElement.h"
namespace SimpleTypes
{
class CDateTime;
class CDecimalNumber;
}
namespace ComplexTypes
{
namespace Word
{
class CJc;
class CInd;
class CCnf;
class COnOff2;
class CFramePr;
class CBorder;
class String;
class CSpacing;
class CShading;
class CTabStop;
class CTrackChange;
class CTextAlignment;
class CDecimalNumber;
class CTextDirection;
class CTextboxTightWrap;
}
}
namespace OOX
{
namespace Logic
{
class CRunProperty;
class CSectionProperty;
//--------------------------------------------------------------------------------
// NumPr 17.13.1.19 (Part 1)
//--------------------------------------------------------------------------------
class CNumPr : public WritingElement
{
public:
WritingElement_AdditionMethods(CNumPr)
CNumPr();
virtual ~CNumPr();
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const;
public:
nullable<ComplexTypes::Word::CDecimalNumber> m_oIlvl;
nullable<ComplexTypes::Word::CTrackChange> m_oIns;
nullable<ComplexTypes::Word::CDecimalNumber> m_oNumID;
};
//--------------------------------------------------------------------------------
// PBdr 17.13.1.24 (Part 1)
//--------------------------------------------------------------------------------
class CPBdr : public WritingElement
{
public:
WritingElement_AdditionMethods(CPBdr)
CPBdr();
virtual ~CPBdr();
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const;
static const CPBdr Merge(const CPBdr& oPrev, const CPBdr& oCurrent);
template<typename Type>
static nullable<Type> Merge(const nullable<Type> &oPrev, const nullable<Type> &oCurrent)
{
nullable<Type> oResult;
if ( oCurrent.IsInit() )
oResult = oCurrent;
else if ( oPrev.IsInit() )
oResult = oPrev;
return oResult;
}
nullable<ComplexTypes::Word::CBorder > m_oBar;
nullable<ComplexTypes::Word::CBorder > m_oBetween;
nullable<ComplexTypes::Word::CBorder > m_oBottom;
nullable<ComplexTypes::Word::CBorder > m_oLeft;
nullable<ComplexTypes::Word::CBorder > m_oRight;
nullable<ComplexTypes::Word::CBorder > m_oTop;
};
//--------------------------------------------------------------------------------
// PPrChange 17.13.5.29 (Part 1)
//--------------------------------------------------------------------------------
class CParagraphProperty;
class CPPrChange : public WritingElement
{
public:
CPPrChange();
CPPrChange(XmlUtils::CXmlNode& oNode);
CPPrChange(XmlUtils::CXmlLiteReader& oReader);
const CPPrChange& operator =(const XmlUtils::CXmlNode &oNode);
const CPPrChange& operator =(const XmlUtils::CXmlLiteReader& oReader);
virtual ~CPPrChange();
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const;
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:
nullable<std::wstring> m_sAuthor;
nullable<SimpleTypes::CDateTime> m_oDate;
nullable<SimpleTypes::CDecimalNumber> m_oId;
nullable<std::wstring> m_sUserId;
nullable<OOX::Logic::CParagraphProperty> m_pParPr;
};
//--------------------------------------------------------------------------------
// Tabs 17.3.1.38 (Part 1)
//--------------------------------------------------------------------------------
class CTabs : public WritingElement
{
public:
WritingElement_AdditionMethods(CTabs)
CTabs(OOX::Document *pMain = NULL);
virtual ~CTabs();
CTabs(const CTabs& oSrc);
const CTabs& operator =(const CTabs &oTabs);
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const;
std::vector<ComplexTypes::Word::CTabStop*> m_arrTabs;
};
//--------------------------------------------------------------------------------
// CParagraphProperty
//--------------------------------------------------------------------------------
class CParagraphProperty : public WritingElement
{
public:
CParagraphProperty(OOX::Document *pMain = NULL);
CParagraphProperty(XmlUtils::CXmlNode& oNode);
CParagraphProperty(XmlUtils::CXmlLiteReader& oReader);
virtual ~CParagraphProperty();
bool IsNoEmpty();
void Clear();
const CParagraphProperty& operator =(const XmlUtils::CXmlNode &oNode);
const CParagraphProperty& operator =(const XmlUtils::CXmlLiteReader &oReader);
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const;
static const CParagraphProperty Merge(const CParagraphProperty& oPrev, const CParagraphProperty& oCurrent);
template<typename Type>
static nullable<Type> Merge(const nullable<Type> &oPrev, const nullable<Type> &oCurrent)
{
nullable<Type> oResult;
if ( oCurrent.IsInit() )
oResult = oCurrent;
else if ( oPrev.IsInit() )
oResult = oPrev;
return oResult;
}
//--------------------------------------------------------------------------------------------------------
bool m_bPPrChange = false;
nullable<ComplexTypes::Word::COnOff2> m_oAdjustRightInd;
nullable<ComplexTypes::Word::COnOff2> m_oAutoSpaceDE;
nullable<ComplexTypes::Word::COnOff2> m_oAutoSpaceDN;
nullable<ComplexTypes::Word::COnOff2> m_oBidi;
nullable<ComplexTypes::Word::CCnf> m_oCnfStyle;
nullable<ComplexTypes::Word::COnOff2> m_oContextualSpacing;
nullable<ComplexTypes::Word::CDecimalNumber> m_oDivID;
nullable<ComplexTypes::Word::CFramePr> m_oFramePr;
nullable<ComplexTypes::Word::CInd> m_oInd;
nullable<ComplexTypes::Word::CJc> m_oJc;
nullable<ComplexTypes::Word::COnOff2> m_oKeepLines;
nullable<ComplexTypes::Word::COnOff2> m_oKeepNext;
nullable<ComplexTypes::Word::COnOff2> m_oKinsoku;
nullable<ComplexTypes::Word::COnOff2> m_oMirrorIndents;
nullable<OOX::Logic::CNumPr> m_oNumPr;
nullable<ComplexTypes::Word::CDecimalNumber> m_oOutlineLvl;
nullable<ComplexTypes::Word::COnOff2> m_oOverflowPunct;
nullable<ComplexTypes::Word::COnOff2> m_oPageBreakBefore;
nullable<OOX::Logic::CPBdr> m_oPBdr;
nullable<OOX::Logic::CPPrChange> m_oPPrChange;
nullable<ComplexTypes::Word::String> m_oPStyle;
nullable<OOX::Logic::CRunProperty> m_oRPr;
nullable<OOX::Logic::CSectionProperty> m_oSectPr;
nullable<ComplexTypes::Word::CShading> m_oShd;
nullable<ComplexTypes::Word::COnOff2> m_oSnapToGrid;
nullable<ComplexTypes::Word::CSpacing> m_oSpacing;
nullable<ComplexTypes::Word::COnOff2> m_oSuppressAutoHyphens;
nullable<ComplexTypes::Word::COnOff2> m_oSuppressLineNumbers;
nullable<ComplexTypes::Word::COnOff2> m_oSuppressOverlap;
nullable<OOX::Logic::CTabs> m_oTabs;
nullable<ComplexTypes::Word::CTextAlignment> m_oTextAlignment;
nullable<ComplexTypes::Word::CTextboxTightWrap> m_oTextboxTightWrap;
nullable<ComplexTypes::Word::CTextDirection> m_oTextDirection;
nullable<ComplexTypes::Word::COnOff2> m_oTopLinePunct;
nullable<ComplexTypes::Word::COnOff2> m_oWidowControl;
nullable<ComplexTypes::Word::COnOff2> m_oWordWrap;
};
} // namespace Logic
} // namespace OOX