diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sw/inc/paratr.hxx | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/inc/paratr.hxx')
-rw-r--r-- | sw/inc/paratr.hxx | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx new file mode 100644 index 000000000..c6848491f --- /dev/null +++ b/sw/inc/paratr.hxx @@ -0,0 +1,237 @@ +/* -*- 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_SW_INC_PARATR_HXX +#define INCLUDED_SW_INC_PARATR_HXX +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include "swdllapi.h" +#include "hintids.hxx" +#include "calbck.hxx" +#include "swatrset.hxx" +#include "format.hxx" +#include "charfmt.hxx" +#include <editeng/adjustitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/spltitem.hxx> +#include <editeng/widwitem.hxx> +#include <editeng/orphitem.hxx> +#include <editeng/tstpitem.hxx> +#include <editeng/hyphenzoneitem.hxx> +#include <editeng/scriptspaceitem.hxx> +#include <editeng/hngpnctitem.hxx> +#include <editeng/forbiddenruleitem.hxx> +#include <editeng/paravertalignitem.hxx> +#include <editeng/pgrditem.hxx> + +class SwTextNode; +class IntlWrapper; + +#define DROP_WHOLEWORD ((sal_uInt16)0x0001) + +class SwFormatDrop; + +namespace sw { + class SW_DLLPUBLIC FormatDropDefiner { + protected: + virtual ~FormatDropDefiner() {}; + public: + virtual void FormatDropNotify(const SwFormatDrop&) =0; + }; +} + +/** If SwFormatDrop is a Client, it is the CharFormat that describes the font for the + DropCaps. If it is not a Client, formatting uses the CharFormat of the paragraph. + If the CharFormat is modified, this change is propagated to the paragraphs + via the Modify of SwFormatDrop. */ +class SW_DLLPUBLIC SwFormatDrop final : public SfxPoolItem, public SwClient +{ + sw::FormatDropDefiner* m_pDefinedIn; ///< TextNode or FormatColl that contains the CapDrops. + sal_uInt16 m_nDistance; ///< Distance to beginning of text. + sal_uInt8 m_nLines; ///< Line count. + sal_uInt8 m_nChars; ///< Character count. + bool m_bWholeWord; ///< First word with initials. +public: + static SfxPoolItem* CreateDefault(); + + SwFormatDrop(); + virtual ~SwFormatDrop() override; + + // @@@ public copy ctor, but no copy assignment? + SwFormatDrop( const SwFormatDrop & ); +private: + // @@@ public copy ctor, but no copy assignment? + SwFormatDrop & operator= (const SwFormatDrop &) = delete; + + virtual void SwClientNotify(const SwModify&, const SfxHint&) override + { + if (!m_pDefinedIn) + return; + m_pDefinedIn->FormatDropNotify(*this); + } + +public: + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatDrop* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + sal_uInt8 GetLines() const { return m_nLines; } + sal_uInt8 &GetLines() { return m_nLines; } + + sal_uInt8 GetChars() const { return m_nChars; } + sal_uInt8 &GetChars() { return m_nChars; } + + bool GetWholeWord() const { return m_bWholeWord; } + bool &GetWholeWord() { return m_bWholeWord; } + + sal_uInt16 GetDistance() const { return m_nDistance; } + sal_uInt16 &GetDistance() { return m_nDistance; } + + const SwCharFormat *GetCharFormat() const { return static_cast<const SwCharFormat*>(GetRegisteredIn()); } + SwCharFormat *GetCharFormat() { return static_cast<SwCharFormat*>(GetRegisteredIn()); } + void SetCharFormat( SwCharFormat *pNew ); + /// Get information from Client. + virtual bool GetInfo( SfxPoolItem& ) const override; + + /// Get and set Modify pointer. + void ChgDefinedIn( const sw::FormatDropDefiner* pDefiner ) + { m_pDefinedIn = const_cast<sw::FormatDropDefiner*>(pDefiner); }; +}; + +class SwRegisterItem final : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + inline SwRegisterItem( const bool bRegister = false ); + + /// "pure virtual methods" of SfxPoolItem + virtual SwRegisterItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +inline SwRegisterItem::SwRegisterItem( const bool bRegister ) : + SfxBoolItem( RES_PARATR_REGISTER, bRegister ) +{} + +class SW_DLLPUBLIC SwNumRuleItem final : public SfxStringItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SwNumRuleItem() + : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {} + + SwNumRuleItem( const OUString& rRuleName ) + : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {} + + SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwNumRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +class SwParaConnectBorderItem final : public SfxBoolItem +{ +public: + + inline SwParaConnectBorderItem( const bool bConnect = true ); + + /// "pure virtual methods" of SfxPoolItem + virtual SwParaConnectBorderItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +inline SwParaConnectBorderItem::SwParaConnectBorderItem( const bool bConnect ) : + SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect ) +{} + +// Implementation of paragraph-attributes methods of SwAttrSet +inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(bool bInP) const + { return Get( RES_PARATR_LINESPACING,bInP); } +inline const SvxAdjustItem &SwAttrSet::GetAdjust(bool bInP) const + { return Get( RES_PARATR_ADJUST,bInP); } +inline const SvxFormatSplitItem &SwAttrSet::GetSplit(bool bInP) const + { return Get( RES_PARATR_SPLIT,bInP); } +inline const SwRegisterItem &SwAttrSet::GetRegister(bool bInP) const + { return Get( RES_PARATR_REGISTER,bInP); } +inline const SvxWidowsItem &SwAttrSet::GetWidows(bool bInP) const + { return Get( RES_PARATR_WIDOWS,bInP); } +inline const SvxOrphansItem &SwAttrSet::GetOrphans(bool bInP) const + { return Get( RES_PARATR_ORPHANS,bInP); } +inline const SvxTabStopItem &SwAttrSet::GetTabStops(bool bInP) const + { return Get( RES_PARATR_TABSTOP,bInP); } +inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(bool bInP) const + { return Get(RES_PARATR_HYPHENZONE,bInP); } +inline const SwFormatDrop &SwAttrSet::GetDrop(bool bInP) const + { return Get(RES_PARATR_DROP,bInP); } +inline const SwNumRuleItem &SwAttrSet::GetNumRule(bool bInP) const + { return Get(RES_PARATR_NUMRULE,bInP); } +inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(bool bInP) const + { return Get(RES_PARATR_SCRIPTSPACE,bInP); } +inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(bool bInP) const + { return Get(RES_PARATR_HANGINGPUNCTUATION,bInP); } +inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(bool bInP) const + { return Get(RES_PARATR_FORBIDDEN_RULES, bInP); } +inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(bool bInP) const + { return Get( RES_PARATR_VERTALIGN, bInP ); } +inline const SvxParaGridItem &SwAttrSet::GetParaGrid(bool bInP) const + { return Get( RES_PARATR_SNAPTOGRID, bInP ); } +inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(bool bInP) const + { return Get( RES_PARATR_CONNECT_BORDER, bInP ); } + +// Implementation of paragraph-attributes methods of SwFormat +inline const SvxLineSpacingItem &SwFormat::GetLineSpacing(bool bInP) const + { return m_aSet.GetLineSpacing(bInP); } +inline const SvxTabStopItem &SwFormat::GetTabStops(bool bInP) const + { return m_aSet.GetTabStops(bInP); } +inline const SwFormatDrop &SwFormat::GetDrop(bool bInP) const + { return m_aSet.GetDrop(bInP); } +inline const SwNumRuleItem &SwFormat::GetNumRule(bool bInP) const + { return m_aSet.GetNumRule(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |