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 ************************************************************************/
30 #include <rtl/ref.hxx>
33 #define _SVSTDARR_STRINGSDTOR
34 #include <svl/svstdarr.hxx>
36 #include <svl/style.hxx>
37 #include <svl/itemset.hxx>
41 class SwDocStyleSheetPool
;
48 /*--------------------------------------------------------------------
49 Beschreibung: Lokale Hilfsklasse
50 --------------------------------------------------------------------*/
51 class SwPoolFmtList
: public SvStringsDtor
55 void Append( char cChar
, const String
& rStr
);
60 /*--------------------------------------------------------------------
61 Beschreibung: temp. StyleSheet
62 --------------------------------------------------------------------*/
63 class SW_DLLPUBLIC SwDocStyleSheet
: public SfxStyleSheetBase
65 friend class SwDocStyleSheetPool
;
66 friend class SwStyleSheetIterator
;
71 const SwPageDesc
* pDesc
;
72 const SwNumRule
* pNumRule
;
80 // leere Huelse zum richtigen StyleSheet (Core) machen
81 SW_DLLPRIVATE
void Create();
83 // den StyleSheet mit Daten fuellen
90 SW_DLLPRIVATE BOOL
FillStyleSheet( FillStyleType eFType
);
93 virtual ~SwDocStyleSheet();
96 SwDocStyleSheet( SwDoc
& rDoc
,
98 SwDocStyleSheetPool
& rPool
,
102 SwDocStyleSheet( const SwDocStyleSheet
& );
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 );
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
);
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
;
173 void AppendStyleList(const SvStringsDtor
& rLst
,
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
;
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
;
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
,
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
,
229 SwDoc
& GetDoc() const { return rDoc
; }
233 virtual void SAL_CALL
acquire( ) throw ();
234 virtual void SAL_CALL
release( ) throw ();
237 virtual ~SwDocStyleSheetPool();
239 //Fuer die daemlicheren Compiler
241 SwDocStyleSheetPool( const SwDocStyleSheetPool
& );