1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docstyle.hxx,v $
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 ************************************************************************/
33 #include <rtl/ref.hxx>
36 #define _SVSTDARR_STRINGSDTOR
37 #include <svtools/svstdarr.hxx>
39 #include <svtools/style.hxx>
40 #include <svtools/itemset.hxx>
44 class SwDocStyleSheetPool
;
51 /*--------------------------------------------------------------------
52 Beschreibung: Lokale Hilfsklasse
53 --------------------------------------------------------------------*/
54 class SwPoolFmtList
: public SvStringsDtor
58 void Append( char cChar
, const String
& rStr
);
63 /*--------------------------------------------------------------------
64 Beschreibung: temp. StyleSheet
65 --------------------------------------------------------------------*/
66 class SW_DLLPUBLIC SwDocStyleSheet
: public SfxStyleSheetBase
68 friend class SwDocStyleSheetPool
;
69 friend class SwStyleSheetIterator
;
74 const SwPageDesc
* pDesc
;
75 const SwNumRule
* pNumRule
;
83 // leere Huelse zum richtigen StyleSheet (Core) machen
84 SW_DLLPRIVATE
void Create();
86 // den StyleSheet mit Daten fuellen
93 SW_DLLPRIVATE BOOL
FillStyleSheet( FillStyleType eFType
);
96 virtual ~SwDocStyleSheet();
99 SwDocStyleSheet( SwDoc
& rDoc
,
101 SwDocStyleSheetPool
& rPool
,
105 SwDocStyleSheet( const SwDocStyleSheet
& );
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 );
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
);
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
;
176 void AppendStyleList(const SvStringsDtor
& rLst
,
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
;
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
;
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
,
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
,
232 SwDoc
& GetDoc() const { return rDoc
; }
236 virtual void SAL_CALL
acquire( ) throw ();
237 virtual void SAL_CALL
release( ) throw ();
240 virtual ~SwDocStyleSheetPool();
242 //Fuer die daemlicheren Compiler
244 SwDocStyleSheetPool( const SwDocStyleSheetPool
& );