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