merged tag ooo/OOO330_m14
[LibreOffice.git] / sw / inc / docstyle.hxx
blob91c44278878d056e030c3ac638bdd179f01c9452
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _DOCSTYLE_HXX
28 #define _DOCSTYLE_HXX
30 #include <rtl/ref.hxx>
32 #ifndef _SVSTDARR_HXX
33 #define _SVSTDARR_STRINGSDTOR
34 #include <svl/svstdarr.hxx>
35 #endif
36 #include <svl/style.hxx>
37 #include <svl/itemset.hxx>
38 #include "swdllapi.h"
40 class SwDoc;
41 class SwDocStyleSheetPool;
42 class SwPageDesc;
43 class SwCharFmt;
44 class SwTxtFmtColl;
45 class SwFrmFmt;
46 class SwNumRule;
48 /*--------------------------------------------------------------------
49 Beschreibung: Lokale Hilfsklasse
50 --------------------------------------------------------------------*/
51 class SwPoolFmtList : public SvStringsDtor
53 public:
54 SwPoolFmtList() {}
55 void Append( char cChar, const String& rStr );
56 void Erase();
60 /*--------------------------------------------------------------------
61 Beschreibung: temp. StyleSheet
62 --------------------------------------------------------------------*/
63 class SW_DLLPUBLIC SwDocStyleSheet : public SfxStyleSheetBase
65 friend class SwDocStyleSheetPool;
66 friend class SwStyleSheetIterator;
68 SwCharFmt* pCharFmt;
69 SwTxtFmtColl* pColl;
70 SwFrmFmt* pFrmFmt;
71 const SwPageDesc* pDesc;
72 const SwNumRule* pNumRule;
74 SwDoc& rDoc;
75 SfxItemSet aCoreSet;
77 BOOL bPhysical;
80 // leere Huelse zum richtigen StyleSheet (Core) machen
81 SW_DLLPRIVATE void Create();
83 // den StyleSheet mit Daten fuellen
84 enum FillStyleType {
85 FillOnlyName,
86 FillAllInfo,
87 FillPhysical
90 SW_DLLPRIVATE BOOL FillStyleSheet( FillStyleType eFType );
92 protected:
93 virtual ~SwDocStyleSheet();
95 public:
96 SwDocStyleSheet( SwDoc& rDoc,
97 const String& rName,
98 SwDocStyleSheetPool& rPool,
99 SfxStyleFamily eFam,
100 USHORT nMask);
102 SwDocStyleSheet( const SwDocStyleSheet& );
104 void Reset();
106 void SetMask(USHORT nMsk) { nMask = nMsk; }
107 void SetFamily(SfxStyleFamily eFam) { nFamily = eFam; }
109 BOOL IsPhysical() const { return bPhysical; }
110 void SetPhysical(BOOL bPhys);
112 // --> OD 2008-02-11 #newlistlevelattrs#
113 // add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value FALSE,
114 // which indicates that the indent attributes at a paragraph style should
115 // be reset in case that a list style is applied to the paragraph style and
116 // no indent attributes are applied.
117 void SetItemSet( const SfxItemSet& rSet,
118 const bool bResetIndentAttrsAtParagraphStyle = false );
119 // <--
121 virtual SfxItemSet& GetItemSet();
122 // --> OD 2008-02-12 #newlistlevelattrs#
123 // new method for paragraph styles to merge indent attributes of applied list
124 // style into the given item set, if the list style indent attributes are applicable.
125 void MergeIndentAttrsOfListStyle( SfxItemSet& rSet );
126 // <--
127 virtual const String& GetParent() const;
128 virtual const String& GetFollow() const;
130 virtual ULONG GetHelpId( String& rFile );
131 virtual void SetHelpId( const String& r, ULONG nId );
133 // Vorbelegen der member ohne physikalischen Zugriff
134 // wird vom StyleSheetPool benutzt
136 void PresetName(const String& rName) { aName = rName; }
137 void PresetNameAndFamily(const String& rName);
138 void PresetParent(const String& rName){ aParent = rName; }
139 void PresetFollow(const String& rName){ aFollow = rName; }
141 virtual BOOL SetName( const String& rStr);
142 virtual BOOL SetParent( const String& rStr);
143 virtual BOOL SetFollow( const String& rStr);
145 virtual BOOL HasFollowSupport() const;
146 virtual BOOL HasParentSupport() const;
147 virtual BOOL HasClearParentSupport() const;
148 virtual String GetDescription();
149 virtual String GetDescription(SfxMapUnit eUnit);
151 SwCharFmt* GetCharFmt();
152 SwTxtFmtColl* GetCollection();
153 SwFrmFmt* GetFrmFmt();
154 const SwPageDesc* GetPageDesc();
155 const SwNumRule* GetNumRule();
156 void SetNumRule(const SwNumRule& rRule);
158 virtual BOOL IsUsed() const;
161 /*--------------------------------------------------------------------
162 Beschreibung: Iterator fuer den Pool
163 --------------------------------------------------------------------*/
165 class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
167 rtl::Reference< SwDocStyleSheet > mxIterSheet;
168 rtl::Reference< SwDocStyleSheet > mxStyleSheet;
169 SwPoolFmtList aLst;
170 USHORT nLastPos;
171 BOOL bFirstCalled;
173 void AppendStyleList(const SvStringsDtor& rLst,
174 BOOL bUsed,
175 USHORT nSection,
176 char cType);
178 public:
179 SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
180 SfxStyleFamily eFam, USHORT n=0xFFFF );
181 virtual ~SwStyleSheetIterator();
183 virtual USHORT Count();
184 virtual SfxStyleSheetBase *operator[](USHORT nIdx);
185 virtual SfxStyleSheetBase* First();
186 virtual SfxStyleSheetBase* Next();
187 virtual SfxStyleSheetBase* Find(const UniString& rStr);
189 virtual void Notify( SfxBroadcaster&, const SfxHint& );
192 /*--------------------------------------------------------------------
193 Beschreibung: Pool fuer
194 --------------------------------------------------------------------*/
196 class SwDocStyleSheetPool : public SfxStyleSheetBasePool
198 rtl::Reference< SwDocStyleSheet > mxStyleSheet;
199 SwDoc& rDoc;
200 BOOL bOrganizer : 1; // TRUE: fuer den Organizer
203 virtual SfxStyleSheetBase* Create( const String&, SfxStyleFamily, USHORT nMask);
204 virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& );
206 using SfxStyleSheetBasePool::Find;
208 public:
209 SwDocStyleSheetPool( SwDoc&, BOOL bOrganizer = FALSE );
211 virtual void Replace( SfxStyleSheetBase& rSource,
212 SfxStyleSheetBase& rTarget );
213 virtual SfxStyleSheetBase& Make(const String&, SfxStyleFamily, USHORT nMask, USHORT nPos = 0xffff);
215 virtual SfxStyleSheetBase* Find( const String&, SfxStyleFamily eFam,
216 USHORT n=0xFFFF );
218 virtual BOOL SetParent( SfxStyleFamily eFam, const String &rStyle,
219 const String &rParent );
221 virtual void Remove( SfxStyleSheetBase* pStyle);
223 void SetOrganizerMode( BOOL bMode ) { bOrganizer = bMode; }
224 BOOL IsOrganizerMode() const { return bOrganizer; }
226 virtual SfxStyleSheetIterator* CreateIterator( SfxStyleFamily,
227 USHORT nMask );
229 SwDoc& GetDoc() const { return rDoc; }
231 void dispose();
233 virtual void SAL_CALL acquire( ) throw ();
234 virtual void SAL_CALL release( ) throw ();
236 protected:
237 virtual ~SwDocStyleSheetPool();
239 //Fuer die daemlicheren Compiler
240 private:
241 SwDocStyleSheetPool( const SwDocStyleSheetPool& );
245 #endif