android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / inc / paratr.hxx
blob9b5f2b1564306c6ebca488ac670ddc79dca7c4f6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_INC_PARATR_HXX
20 #define INCLUDED_SW_INC_PARATR_HXX
21 #include <svl/eitem.hxx>
22 #include <svl/stritem.hxx>
23 #include "swdllapi.h"
24 #include "hintids.hxx"
25 #include "calbck.hxx"
26 #include "swatrset.hxx"
27 #include "format.hxx"
28 #include "charfmt.hxx"
29 #include <editeng/adjustitem.hxx>
30 #include <editeng/lspcitem.hxx>
31 #include <editeng/spltitem.hxx>
32 #include <editeng/widwitem.hxx>
33 #include <editeng/orphitem.hxx>
34 #include <editeng/tstpitem.hxx>
35 #include <editeng/hyphenzoneitem.hxx>
36 #include <editeng/scriptspaceitem.hxx>
37 #include <editeng/hngpnctitem.hxx>
38 #include <editeng/forbiddenruleitem.hxx>
39 #include <editeng/paravertalignitem.hxx>
40 #include <editeng/pgrditem.hxx>
41 #include <o3tl/typed_flags_set.hxx>
43 class SwTextNode;
44 class IntlWrapper;
46 #define DROP_WHOLEWORD ((sal_uInt16)0x0001)
48 class SwFormatDrop;
50 namespace sw {
52 enum class ListLevelIndents { No, FirstLine, LeftMargin };
54 class SW_DLLPUBLIC FormatDropDefiner {
55 protected:
56 virtual ~FormatDropDefiner() {};
57 public:
58 virtual void FormatDropNotify(const SwFormatDrop&) =0;
62 namespace o3tl
64 template<> struct typed_flags<sw::ListLevelIndents> : is_typed_flags<sw::ListLevelIndents, 0x03> {};
67 /** If SwFormatDrop is a Client, it is the CharFormat that describes the font for the
68 DropCaps. If it is not a Client, formatting uses the CharFormat of the paragraph.
69 If the CharFormat is modified, this change is propagated to the paragraphs
70 via the Modify of SwFormatDrop. */
71 class SW_DLLPUBLIC SwFormatDrop final : public SfxPoolItem, public SwClient
73 sw::FormatDropDefiner* m_pDefinedIn; ///< TextNode or FormatColl that contains the CapDrops.
74 sal_uInt16 m_nDistance; ///< Distance to beginning of text.
75 sal_uInt8 m_nLines; ///< Line count.
76 sal_uInt8 m_nChars; ///< Character count.
77 bool m_bWholeWord; ///< First word with initials.
78 public:
79 static SfxPoolItem* CreateDefault();
81 SwFormatDrop();
82 virtual ~SwFormatDrop() override;
84 // @@@ public copy ctor, but no copy assignment?
85 SwFormatDrop( const SwFormatDrop & );
86 private:
87 // @@@ public copy ctor, but no copy assignment?
88 SwFormatDrop & operator= (const SwFormatDrop &) = delete;
90 virtual void SwClientNotify(const SwModify&, const SfxHint&) override
92 if (!m_pDefinedIn)
93 return;
94 m_pDefinedIn->FormatDropNotify(*this);
97 public:
99 /// "pure virtual methods" of SfxPoolItem
100 virtual bool operator==( const SfxPoolItem& ) const override;
101 virtual SwFormatDrop* Clone( SfxItemPool* pPool = nullptr ) const override;
102 virtual bool GetPresentation( SfxItemPresentation ePres,
103 MapUnit eCoreMetric,
104 MapUnit ePresMetric,
105 OUString &rText,
106 const IntlWrapper& rIntl ) const override;
107 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
108 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
110 sal_uInt8 GetLines() const { return m_nLines; }
111 sal_uInt8 &GetLines() { return m_nLines; }
113 sal_uInt8 GetChars() const { return m_nChars; }
114 sal_uInt8 &GetChars() { return m_nChars; }
116 bool GetWholeWord() const { return m_bWholeWord; }
117 bool &GetWholeWord() { return m_bWholeWord; }
119 sal_uInt16 GetDistance() const { return m_nDistance; }
120 sal_uInt16 &GetDistance() { return m_nDistance; }
122 const SwCharFormat *GetCharFormat() const { return static_cast<const SwCharFormat*>(GetRegisteredIn()); }
123 SwCharFormat *GetCharFormat() { return static_cast<SwCharFormat*>(GetRegisteredIn()); }
124 void SetCharFormat( SwCharFormat *pNew );
125 /// Get information from Client.
126 virtual bool GetInfo( SfxPoolItem& ) const override;
128 /// Get and set Modify pointer.
129 void ChgDefinedIn( const sw::FormatDropDefiner* pDefiner )
130 { m_pDefinedIn = const_cast<sw::FormatDropDefiner*>(pDefiner); };
133 class SwRegisterItem final : public SfxBoolItem
135 public:
136 static SfxPoolItem* CreateDefault();
138 inline SwRegisterItem( const bool bRegister = false );
140 /// "pure virtual methods" of SfxPoolItem
141 virtual SwRegisterItem* Clone( SfxItemPool *pPool = nullptr ) const override;
142 virtual bool GetPresentation( SfxItemPresentation ePres,
143 MapUnit eCoreMetric,
144 MapUnit ePresMetric,
145 OUString &rText,
146 const IntlWrapper& rIntl ) const override;
149 inline SwRegisterItem::SwRegisterItem( const bool bRegister ) :
150 SfxBoolItem( RES_PARATR_REGISTER, bRegister )
153 class SW_DLLPUBLIC SwNumRuleItem final : public SfxStringItem
155 public:
156 static SfxPoolItem* CreateDefault();
158 SwNumRuleItem()
159 : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {}
161 SwNumRuleItem( const OUString& rRuleName )
162 : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
164 SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy
166 /// "pure virtual methods" of SfxPoolItem
167 virtual bool operator==( const SfxPoolItem& ) const override;
168 virtual SwNumRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override;
169 virtual bool GetPresentation( SfxItemPresentation ePres,
170 MapUnit eCoreMetric,
171 MapUnit ePresMetric,
172 OUString &rText,
173 const IntlWrapper& rIntl ) const override;
175 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
176 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
178 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
181 class SwParaConnectBorderItem final : public SfxBoolItem
183 public:
185 inline SwParaConnectBorderItem( const bool bConnect = true );
187 /// "pure virtual methods" of SfxPoolItem
188 virtual SwParaConnectBorderItem* Clone( SfxItemPool *pPool = nullptr ) const override;
189 virtual bool GetPresentation( SfxItemPresentation ePres,
190 MapUnit eCoreMetric,
191 MapUnit ePresMetric,
192 OUString &rText,
193 const IntlWrapper& rIntl ) const override;
196 inline SwParaConnectBorderItem::SwParaConnectBorderItem( const bool bConnect ) :
197 SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect )
200 // Implementation of paragraph-attributes methods of SwAttrSet
201 inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(bool bInP) const
202 { return Get( RES_PARATR_LINESPACING,bInP); }
203 inline const SvxAdjustItem &SwAttrSet::GetAdjust(bool bInP) const
204 { return Get( RES_PARATR_ADJUST,bInP); }
205 inline const SvxFormatSplitItem &SwAttrSet::GetSplit(bool bInP) const
206 { return Get( RES_PARATR_SPLIT,bInP); }
207 inline const SwRegisterItem &SwAttrSet::GetRegister(bool bInP) const
208 { return Get( RES_PARATR_REGISTER,bInP); }
209 inline const SvxWidowsItem &SwAttrSet::GetWidows(bool bInP) const
210 { return Get( RES_PARATR_WIDOWS,bInP); }
211 inline const SvxOrphansItem &SwAttrSet::GetOrphans(bool bInP) const
212 { return Get( RES_PARATR_ORPHANS,bInP); }
213 inline const SvxTabStopItem &SwAttrSet::GetTabStops(bool bInP) const
214 { return Get( RES_PARATR_TABSTOP,bInP); }
215 inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(bool bInP) const
216 { return Get(RES_PARATR_HYPHENZONE,bInP); }
217 inline const SwFormatDrop &SwAttrSet::GetDrop(bool bInP) const
218 { return Get(RES_PARATR_DROP,bInP); }
219 inline const SwNumRuleItem &SwAttrSet::GetNumRule(bool bInP) const
220 { return Get(RES_PARATR_NUMRULE,bInP); }
221 inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(bool bInP) const
222 { return Get(RES_PARATR_SCRIPTSPACE,bInP); }
223 inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(bool bInP) const
224 { return Get(RES_PARATR_HANGINGPUNCTUATION,bInP); }
225 inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(bool bInP) const
226 { return Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
227 inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(bool bInP) const
228 { return Get( RES_PARATR_VERTALIGN, bInP ); }
229 inline const SvxParaGridItem &SwAttrSet::GetParaGrid(bool bInP) const
230 { return Get( RES_PARATR_SNAPTOGRID, bInP ); }
231 inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(bool bInP) const
232 { return Get( RES_PARATR_CONNECT_BORDER, bInP ); }
234 // Implementation of paragraph-attributes methods of SwFormat
235 inline const SvxLineSpacingItem &SwFormat::GetLineSpacing(bool bInP) const
236 { return m_aSet.GetLineSpacing(bInP); }
237 inline const SvxTabStopItem &SwFormat::GetTabStops(bool bInP) const
238 { return m_aSet.GetTabStops(bInP); }
239 inline const SwFormatDrop &SwFormat::GetDrop(bool bInP) const
240 { return m_aSet.GetDrop(bInP); }
241 inline const SwNumRuleItem &SwFormat::GetNumRule(bool bInP) const
242 { return m_aSet.GetNumRule(bInP); }
244 #endif
246 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */