LibreOffice Module sw (master)  1
fmtcol.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SW_INC_FMTCOL_HXX
20 #define INCLUDED_SW_INC_FMTCOL_HXX
21 
22 #include "swdllapi.h"
23 #include "format.hxx"
24 #include "hintids.hxx"
25 #include <rtl/ustring.hxx>
26 #include <tools/solar.h>
27 
28 #include <vector>
29 #include <memory>
30 
31 class SwAttrPool;
32 namespace sw{ class DocumentStylePoolManager; }
33 
34 class SAL_DLLPUBLIC_RTTI SwFormatColl : public SwFormat
35 {
36 protected:
37  SwFormatColl( SwAttrPool& rPool, const sal_Char* pFormatName,
38  const sal_uInt16* pWhichRanges, SwFormatColl* pDerFrom,
39  sal_uInt16 nFormatWhich )
40  : SwFormat( rPool, pFormatName, pWhichRanges, pDerFrom, nFormatWhich )
41  { SetAuto(false); }
42 
43  SwFormatColl( SwAttrPool& rPool, const OUString &rFormatName,
44  const sal_uInt16* pWhichRanges, SwFormatColl* pDerFrom,
45  sal_uInt16 nFormatWhich )
46  : SwFormat( rPool, rFormatName, pWhichRanges, pDerFrom, nFormatWhich )
47  { SetAuto(false); }
48 
49 private:
50  SwFormatColl(const SwFormatColl & ) = delete;
51  const SwFormatColl &operator=(const SwFormatColl &) = delete;
52 };
53 
56 {
57  friend class SwDoc;
58  friend class ::sw::DocumentStylePoolManager;
59 
60  SwTextFormatColl(const SwTextFormatColl & rRef) = delete;
61 
63 
65 
67 
68 protected:
69 
70  SwTextFormatColl( SwAttrPool& rPool, const sal_Char* pFormatCollName,
71  SwTextFormatColl* pDerFrom = nullptr,
72  sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
73  : SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
74  , mbStayAssignedToListLevelOfOutlineStyle(false)
75  , mbAssignedToOutlineStyle(false)
76  {
77  mpNextTextFormatColl = this;
78  }
79 
80  SwTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
81  SwTextFormatColl* pDerFrom,
82  sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
83  : SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
84  , mbStayAssignedToListLevelOfOutlineStyle(false)
85  , mbAssignedToOutlineStyle(false)
86  {
87  mpNextTextFormatColl = this;
88  }
89 
91  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
92 
93 public:
94 
95 
96  inline void SetNextTextFormatColl(SwTextFormatColl& rNext);
97  SwTextFormatColl& GetNextTextFormatColl() const { return *mpNextTextFormatColl; }
98 
99  bool IsAtDocNodeSet() const;
100 
101  void SetAttrOutlineLevel( int );
102  int GetAttrOutlineLevel() const;
103 
104  // Return the list level of the Outline Style - the List Style for the
105  // outline numbering -
106  // to which the Paragraph Style is assigned.
107  int GetAssignedOutlineStyleLevel() const;
108 
110  {
111  return mbAssignedToOutlineStyle;
112  }
113 
114  // If a Paragraph Style is assigned to list level N of the Outline Style,
115  // then its outline level - AttrOutlineLevel - is set to N+1
116  void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
117  void DeleteAssignmentToListLevelOfOutlineStyle();
118 
121  virtual bool SetFormatAttr( const SfxPoolItem& rAttr ) override;
122  virtual bool SetFormatAttr( const SfxItemSet& rSet ) override;
123  virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) override;
124 
126  virtual sal_uInt16 ResetAllFormatAttr() override;
127 
129  {
130  return mbStayAssignedToListLevelOfOutlineStyle;
131  }
132 
133  bool AreListLevelIndentsApplicable() const;
134 
135  void dumpAsXml(xmlTextWriterPtr pWriter) const;
136 };
137 
138 class SwGrfFormatColl final : public SwFormatColl
139 {
140  friend class SwDoc;
141 
142  SwGrfFormatColl( SwAttrPool& rPool, const sal_Char* pFormatCollName,
143  SwGrfFormatColl* pDerFrom = nullptr )
144  : SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange,
145  pDerFrom, RES_GRFFMTCOLL )
146  {}
147 
148  SwGrfFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
149  SwGrfFormatColl* pDerFrom )
150  : SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange,
151  pDerFrom, RES_GRFFMTCOLL )
152  {}
153 };
154 
155 // FEATURE::CONDCOLL
158 {
159  NONE,
160  PARA_IN_LIST,
170 };
171 
173 {
176 
177 public:
178 
180  sal_uLong nSubCond );
181  virtual ~SwCollCondition() override;
182 
184  SwCollCondition( const SwCollCondition& rCpy );
185 private:
187  SwCollCondition & operator= (const SwCollCondition &) = delete;
188 public:
189 
190  bool operator==( const SwCollCondition& rCmp ) const;
191 
192  Master_CollCondition GetCondition() const { return m_nCondition; }
193  sal_uLong GetSubCondition() const { return m_nSubCondition; }
194 
195  void SetCondition( Master_CollCondition nCond, sal_uLong nSubCond );
196  SwTextFormatColl* GetTextFormatColl() const { return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn())); }
197  void RegisterToFormat( SwFormat& );
198 };
199 
200 using SwFormatCollConditions = std::vector<std::unique_ptr<SwCollCondition>>;
201 
203 {
204  friend class SwDoc;
205  friend class ::sw::DocumentStylePoolManager;
206 
208 
209  SwConditionTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
210  SwTextFormatColl* pDerFrom )
211  : SwTextFormatColl( rPool, rFormatCollName, pDerFrom, RES_CONDTXTFMTCOLL )
212  {}
213 
214 public:
215 
216  virtual ~SwConditionTextFormatColl() override;
217 
218  const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
219  const SwFormatCollConditions& GetCondColls() const { return m_CondColls; }
220  void InsertCondition( const SwCollCondition& rCond );
221  void RemoveCondition( const SwCollCondition& rCond );
222 
223  void SetConditions( const SwFormatCollConditions& );
224 };
225 
226 // FEATURE::CONDCOLL
229 {
230  mpNextTextFormatColl = &rNext;
231 }
232 #endif
233 
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define RES_GRFFMTCOLL
Definition: hintids.hxx:276
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
#define RES_CONDTXTFMTCOLL
Definition: hintids.hxx:278
SwGrfFormatColl(SwAttrPool &rPool, const sal_Char *pFormatCollName, SwGrfFormatColl *pDerFrom=nullptr)
Definition: fmtcol.hxx:142
sal_uLong GetSubCondition() const
Definition: fmtcol.hxx:193
sal_uIntPtr sal_uLong
SwFormatCollConditions m_CondColls
Definition: fmtcol.hxx:207
Definition: doc.hxx:185
Master_CollCondition GetCondition() const
Definition: fmtcol.hxx:192
Master_CollCondition
Conditional styles.
Definition: fmtcol.hxx:157
SwFormatColl(SwAttrPool &rPool, const OUString &rFormatName, const sal_uInt16 *pWhichRanges, SwFormatColl *pDerFrom, sal_uInt16 nFormatWhich)
Definition: fmtcol.hxx:43
bool mbStayAssignedToListLevelOfOutlineStyle
Definition: fmtcol.hxx:62
Dialog to specify the properties of drop-down form field.
Definition: accfrmobj.cxx:40
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:196
sal_uInt16 const aTextFormatCollSetRange[]
Definition: init.cxx:145
SwGrfFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwGrfFormatColl *pDerFrom)
Definition: fmtcol.hxx:148
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
bool mbAssignedToOutlineStyle
Definition: fmtcol.hxx:64
char sal_Char
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:228
#define RES_TXTFMTCOLL
Definition: hintids.hxx:275
SwFormat & operator=(const SwFormat &)
Definition: format.cxx:105
SwTextFormatColl * mpNextTextFormatColl
Definition: fmtcol.hxx:66
virtual sal_uInt16 ResetAllFormatAttr()
Takes all hints from Delta-Array,.
Definition: format.cxx:685
Base class for various Writer styles.
Definition: format.hxx:43
struct _xmlTextWriter * xmlTextWriterPtr
sal_uInt16 const aGrfFormatCollSetRange[]
Definition: init.cxx:158
void dumpAsXml(xmlTextWriterPtr=nullptr) const
Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by...
Definition: docfmt.cxx:1950
void SetAuto(bool bNew)
Definition: format.hxx:159
sal_uLong m_nSubCondition
Definition: fmtcol.hxx:175
SwConditionTextFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwTextFormatColl *pDerFrom)
Definition: fmtcol.hxx:209
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
std::vector< std::unique_ptr< SwCollCondition >> SwFormatCollConditions
Definition: fmtcol.hxx:200
Master_CollCondition m_nCondition
Definition: fmtcol.hxx:174
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:460
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:652
bool StayAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:128
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNewValue) override
Definition: format.cxx:246
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
WriterListener & operator=(WriterListener const &)=delete
SwTextFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwTextFormatColl *pDerFrom, sal_uInt16 nFormatWh=RES_TXTFMTCOLL)
Definition: fmtcol.hxx:80
SwTextFormatColl(SwAttrPool &rPool, const sal_Char *pFormatCollName, SwTextFormatColl *pDerFrom=nullptr, sal_uInt16 nFormatWh=RES_TXTFMTCOLL)
Definition: fmtcol.hxx:70
const SwFormatCollConditions & GetCondColls() const
Definition: fmtcol.hxx:219
bool operator==(const ScCsvLayoutData &rData1, const ScCsvLayoutData &rData2)
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:97
SwFormatColl(SwAttrPool &rPool, const sal_Char *pFormatName, const sal_uInt16 *pWhichRanges, SwFormatColl *pDerFrom, sal_uInt16 nFormatWhich)
Definition: fmtcol.hxx:37