1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #define _SVSTDARR_USHORTS
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <svl/smplhint.hxx>
30cdf0e10cSrcweir #include <hintids.hxx>
31cdf0e10cSrcweir #include <svl/itemiter.hxx>
32cdf0e10cSrcweir #include <svl/eitem.hxx>
33cdf0e10cSrcweir #include <unotools/syslocale.hxx>
34cdf0e10cSrcweir #include <editeng/boxitem.hxx>
35cdf0e10cSrcweir #include <editeng/numitem.hxx>
36cdf0e10cSrcweir // --> OD 2008-02-13 #newlistlevelattrs#
37cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
38cdf0e10cSrcweir // <--
39cdf0e10cSrcweir #include <fmtcol.hxx>
40cdf0e10cSrcweir #include <uitool.hxx>
41cdf0e10cSrcweir #include <swmodule.hxx>
42cdf0e10cSrcweir #include <wrtsh.hxx>
43cdf0e10cSrcweir #include <docsh.hxx>
44cdf0e10cSrcweir #include <errhdl.hxx>
45cdf0e10cSrcweir #include <frmfmt.hxx>
46cdf0e10cSrcweir #include <charfmt.hxx>
47cdf0e10cSrcweir #include <poolfmt.hxx>
48cdf0e10cSrcweir #include <pagedesc.hxx>
49cdf0e10cSrcweir #include <docstyle.hxx>
50cdf0e10cSrcweir #include <docary.hxx>
51cdf0e10cSrcweir #include <ccoll.hxx>
52cdf0e10cSrcweir #include <doc.hxx>
53cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx>
54cdf0e10cSrcweir #include <cmdid.h>
55cdf0e10cSrcweir #include <swstyle.h>
56cdf0e10cSrcweir #include <app.hrc>
57cdf0e10cSrcweir #include <paratr.hxx>
58cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
59cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
60cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
61cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx>
62cdf0e10cSrcweir #include <unotools/intlwrapper.hxx>
63cdf0e10cSrcweir #include <numrule.hxx>
64cdf0e10cSrcweir #include <fmthdft.hxx>
65cdf0e10cSrcweir #include <svx/svxids.hrc>
66cdf0e10cSrcweir // --> OD 2008-02-12 #newlistlevelattrs#
67cdf0e10cSrcweir #include <SwRewriter.hxx>
68cdf0e10cSrcweir // <--
69cdf0e10cSrcweir
70cdf0e10cSrcweir // MD 06.02.95: Die Formatnamen in der Liste aller Namen haben als
71cdf0e10cSrcweir // erstes Zeichen die Familie:
72cdf0e10cSrcweir
73cdf0e10cSrcweir #define cCHAR (sal_Unicode)'c'
74cdf0e10cSrcweir #define cPARA (sal_Unicode)'p'
75cdf0e10cSrcweir #define cFRAME (sal_Unicode)'f'
76cdf0e10cSrcweir #define cPAGE (sal_Unicode)'g'
77cdf0e10cSrcweir #define cNUMRULE (sal_Unicode)'n'
78cdf0e10cSrcweir
79cdf0e10cSrcweir // Dieses Zeichen wird bei der Herausgabe der Namen wieder entfernt und
80cdf0e10cSrcweir // die Familie wird neu generiert.
81cdf0e10cSrcweir
82cdf0e10cSrcweir // Ausserdem gibt es jetzt zusaetzlich das Bit bPhysical. Ist dieses Bit
83cdf0e10cSrcweir // sal_True, werden die Pool-Formatnamen NICHT mit eingetragen.
84cdf0e10cSrcweir
85cdf0e10cSrcweir class SwImplShellAction
86cdf0e10cSrcweir {
87cdf0e10cSrcweir SwWrtShell* pSh;
88cdf0e10cSrcweir CurrShell* pCurrSh;
89cdf0e10cSrcweir public:
90cdf0e10cSrcweir SwImplShellAction( SwDoc& rDoc );
91cdf0e10cSrcweir ~SwImplShellAction();
92cdf0e10cSrcweir
GetSh()93cdf0e10cSrcweir SwWrtShell* GetSh() { return pSh; }
94cdf0e10cSrcweir };
95cdf0e10cSrcweir
SwImplShellAction(SwDoc & rDoc)96cdf0e10cSrcweir SwImplShellAction::SwImplShellAction( SwDoc& rDoc )
97cdf0e10cSrcweir : pCurrSh( 0 )
98cdf0e10cSrcweir {
99cdf0e10cSrcweir if( rDoc.GetDocShell() )
100cdf0e10cSrcweir pSh = rDoc.GetDocShell()->GetWrtShell();
101cdf0e10cSrcweir else
102cdf0e10cSrcweir pSh = 0;
103cdf0e10cSrcweir
104cdf0e10cSrcweir if( pSh )
105cdf0e10cSrcweir {
106cdf0e10cSrcweir pCurrSh = new CurrShell( pSh );
107cdf0e10cSrcweir pSh->StartAllAction();
108cdf0e10cSrcweir }
109cdf0e10cSrcweir }
110cdf0e10cSrcweir
~SwImplShellAction()111cdf0e10cSrcweir SwImplShellAction::~SwImplShellAction()
112cdf0e10cSrcweir {
113cdf0e10cSrcweir if( pCurrSh )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir pSh->EndAllAction();
116cdf0e10cSrcweir delete pCurrSh;
117cdf0e10cSrcweir }
118cdf0e10cSrcweir }
119cdf0e10cSrcweir
120cdf0e10cSrcweir /*--------------------------------------------------------------------
121cdf0e10cSrcweir Beschreibung: SwCharFormate finden/anlegen
122cdf0e10cSrcweir evtl. Style fuellen
123cdf0e10cSrcweir --------------------------------------------------------------------*/
124cdf0e10cSrcweir
lcl_FindCharFmt(SwDoc & rDoc,const String & rName,SwDocStyleSheet * pStyle=0,sal_Bool bCreate=sal_True)125cdf0e10cSrcweir SwCharFmt* lcl_FindCharFmt( SwDoc& rDoc,
126cdf0e10cSrcweir const String& rName,
127cdf0e10cSrcweir SwDocStyleSheet* pStyle = 0,
128cdf0e10cSrcweir sal_Bool bCreate = sal_True )
129cdf0e10cSrcweir {
130cdf0e10cSrcweir SwCharFmt* pFmt = 0;
131cdf0e10cSrcweir if( rName.Len() )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir pFmt = rDoc.FindCharFmtByName( rName );
134cdf0e10cSrcweir if( !pFmt && rName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
135cdf0e10cSrcweir RES_POOLCOLL_TEXT_BEGIN ] )
136cdf0e10cSrcweir {
137cdf0e10cSrcweir // Standard-Zeichenvorlage
138cdf0e10cSrcweir pFmt = (SwCharFmt*)rDoc.GetDfltCharFmt();
139cdf0e10cSrcweir }
140cdf0e10cSrcweir
141cdf0e10cSrcweir if( !pFmt && bCreate )
142cdf0e10cSrcweir { // Pool abklappern
143cdf0e10cSrcweir const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
144cdf0e10cSrcweir if(nId != USHRT_MAX)
145cdf0e10cSrcweir pFmt = rDoc.GetCharFmtFromPool(nId);
146cdf0e10cSrcweir }
147cdf0e10cSrcweir }
148cdf0e10cSrcweir if(pStyle)
149cdf0e10cSrcweir {
150cdf0e10cSrcweir if(pFmt)
151cdf0e10cSrcweir {
152cdf0e10cSrcweir pStyle->SetPhysical(sal_True);
153cdf0e10cSrcweir SwFmt* p = pFmt->DerivedFrom();
154cdf0e10cSrcweir if( p && !p->IsDefault() )
155cdf0e10cSrcweir pStyle->PresetParent( p->GetName() );
156cdf0e10cSrcweir else
157cdf0e10cSrcweir pStyle->PresetParent( aEmptyStr );
158cdf0e10cSrcweir }
159cdf0e10cSrcweir else
160cdf0e10cSrcweir pStyle->SetPhysical(sal_False);
161cdf0e10cSrcweir }
162cdf0e10cSrcweir return pFmt;
163cdf0e10cSrcweir }
164cdf0e10cSrcweir
165cdf0e10cSrcweir
166cdf0e10cSrcweir /*--------------------------------------------------------------------
167cdf0e10cSrcweir Beschreibung: ParaFormate finden/erzeugen
168cdf0e10cSrcweir Style fuellen
169cdf0e10cSrcweir --------------------------------------------------------------------*/
170cdf0e10cSrcweir
lcl_FindParaFmt(SwDoc & rDoc,const String & rName,SwDocStyleSheet * pStyle=0,sal_Bool bCreate=sal_True)171cdf0e10cSrcweir SwTxtFmtColl* lcl_FindParaFmt( SwDoc& rDoc,
172cdf0e10cSrcweir const String& rName,
173cdf0e10cSrcweir SwDocStyleSheet* pStyle = 0,
174cdf0e10cSrcweir sal_Bool bCreate = sal_True )
175cdf0e10cSrcweir {
176cdf0e10cSrcweir SwTxtFmtColl* pColl = 0;
177cdf0e10cSrcweir
178cdf0e10cSrcweir if( rName.Len() )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir pColl = rDoc.FindTxtFmtCollByName( rName );
181cdf0e10cSrcweir if( !pColl && bCreate )
182cdf0e10cSrcweir { // Pool abklappern
183cdf0e10cSrcweir const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
184cdf0e10cSrcweir if(nId != USHRT_MAX)
185cdf0e10cSrcweir pColl = rDoc.GetTxtCollFromPool(nId);
186cdf0e10cSrcweir }
187cdf0e10cSrcweir }
188cdf0e10cSrcweir
189cdf0e10cSrcweir if(pStyle)
190cdf0e10cSrcweir {
191cdf0e10cSrcweir if(pColl)
192cdf0e10cSrcweir {
193cdf0e10cSrcweir pStyle->SetPhysical(sal_True);
194cdf0e10cSrcweir if( pColl->DerivedFrom() && !pColl->DerivedFrom()->IsDefault() )
195cdf0e10cSrcweir pStyle->PresetParent( pColl->DerivedFrom()->GetName() );
196cdf0e10cSrcweir else
197cdf0e10cSrcweir pStyle->PresetParent( aEmptyStr );
198cdf0e10cSrcweir
199cdf0e10cSrcweir SwTxtFmtColl& rNext = pColl->GetNextTxtFmtColl();
200cdf0e10cSrcweir pStyle->PresetFollow(rNext.GetName());
201cdf0e10cSrcweir }
202cdf0e10cSrcweir else
203cdf0e10cSrcweir pStyle->SetPhysical(sal_False);
204cdf0e10cSrcweir }
205cdf0e10cSrcweir return pColl;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir
208cdf0e10cSrcweir
209cdf0e10cSrcweir /*--------------------------------------------------------------------
210cdf0e10cSrcweir Beschreibung: Rahmenformate
211cdf0e10cSrcweir --------------------------------------------------------------------*/
212cdf0e10cSrcweir
213cdf0e10cSrcweir
lcl_FindFrmFmt(SwDoc & rDoc,const String & rName,SwDocStyleSheet * pStyle=0,sal_Bool bCreate=sal_True)214cdf0e10cSrcweir SwFrmFmt* lcl_FindFrmFmt( SwDoc& rDoc,
215cdf0e10cSrcweir const String& rName,
216cdf0e10cSrcweir SwDocStyleSheet* pStyle = 0,
217cdf0e10cSrcweir sal_Bool bCreate = sal_True )
218cdf0e10cSrcweir {
219cdf0e10cSrcweir SwFrmFmt* pFmt = 0;
220cdf0e10cSrcweir if( rName.Len() )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir pFmt = rDoc.FindFrmFmtByName( rName );
223cdf0e10cSrcweir if( !pFmt && bCreate )
224cdf0e10cSrcweir { // Pool abklappern
225cdf0e10cSrcweir const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT);
226cdf0e10cSrcweir if(nId != USHRT_MAX)
227cdf0e10cSrcweir pFmt = rDoc.GetFrmFmtFromPool(nId);
228cdf0e10cSrcweir }
229cdf0e10cSrcweir }
230cdf0e10cSrcweir
231cdf0e10cSrcweir if(pStyle)
232cdf0e10cSrcweir {
233cdf0e10cSrcweir if(pFmt)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir pStyle->SetPhysical(sal_True);
236cdf0e10cSrcweir if( pFmt->DerivedFrom() && !pFmt->DerivedFrom()->IsDefault() )
237cdf0e10cSrcweir pStyle->PresetParent( pFmt->DerivedFrom()->GetName() );
238cdf0e10cSrcweir else
239cdf0e10cSrcweir pStyle->PresetParent( aEmptyStr );
240cdf0e10cSrcweir }
241cdf0e10cSrcweir else
242cdf0e10cSrcweir pStyle->SetPhysical(sal_False);
243cdf0e10cSrcweir }
244cdf0e10cSrcweir return pFmt;
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
247cdf0e10cSrcweir /*--------------------------------------------------------------------
248cdf0e10cSrcweir Beschreibung: Seitendescriptoren
249cdf0e10cSrcweir --------------------------------------------------------------------*/
250cdf0e10cSrcweir
251cdf0e10cSrcweir
lcl_FindPageDesc(SwDoc & rDoc,const String & rName,SwDocStyleSheet * pStyle=0,sal_Bool bCreate=sal_True)252cdf0e10cSrcweir const SwPageDesc* lcl_FindPageDesc( SwDoc& rDoc,
253cdf0e10cSrcweir const String& rName,
254cdf0e10cSrcweir SwDocStyleSheet* pStyle = 0,
255cdf0e10cSrcweir sal_Bool bCreate = sal_True )
256cdf0e10cSrcweir {
257cdf0e10cSrcweir const SwPageDesc* pDesc = 0;
258cdf0e10cSrcweir
259cdf0e10cSrcweir if( rName.Len() )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir pDesc = rDoc.FindPageDescByName( rName );
262cdf0e10cSrcweir if( !pDesc && bCreate )
263cdf0e10cSrcweir {
264cdf0e10cSrcweir sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
265cdf0e10cSrcweir if(nId != USHRT_MAX)
266cdf0e10cSrcweir pDesc = rDoc.GetPageDescFromPool(nId);
267cdf0e10cSrcweir }
268cdf0e10cSrcweir }
269cdf0e10cSrcweir
270cdf0e10cSrcweir if(pStyle)
271cdf0e10cSrcweir {
272cdf0e10cSrcweir if(pDesc)
273cdf0e10cSrcweir {
274cdf0e10cSrcweir pStyle->SetPhysical(sal_True);
275cdf0e10cSrcweir if(pDesc->GetFollow())
276cdf0e10cSrcweir pStyle->PresetFollow(pDesc->GetFollow()->GetName());
277cdf0e10cSrcweir else
278cdf0e10cSrcweir pStyle->PresetParent( aEmptyStr );
279cdf0e10cSrcweir }
280cdf0e10cSrcweir else
281cdf0e10cSrcweir pStyle->SetPhysical(sal_False);
282cdf0e10cSrcweir }
283cdf0e10cSrcweir return pDesc;
284cdf0e10cSrcweir }
285cdf0e10cSrcweir
lcl_FindNumRule(SwDoc & rDoc,const String & rName,SwDocStyleSheet * pStyle=0,sal_Bool bCreate=sal_True)286cdf0e10cSrcweir const SwNumRule* lcl_FindNumRule( SwDoc& rDoc,
287cdf0e10cSrcweir const String& rName,
288cdf0e10cSrcweir SwDocStyleSheet* pStyle = 0,
289cdf0e10cSrcweir sal_Bool bCreate = sal_True )
290cdf0e10cSrcweir {
291cdf0e10cSrcweir const SwNumRule* pRule = 0;
292cdf0e10cSrcweir
293cdf0e10cSrcweir if( rName.Len() )
294cdf0e10cSrcweir {
295cdf0e10cSrcweir pRule = rDoc.FindNumRulePtr( rName );
296cdf0e10cSrcweir if( !pRule && bCreate )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE);
299cdf0e10cSrcweir if(nId != USHRT_MAX)
300cdf0e10cSrcweir pRule = rDoc.GetNumRuleFromPool(nId);
301cdf0e10cSrcweir }
302cdf0e10cSrcweir }
303cdf0e10cSrcweir
304cdf0e10cSrcweir if(pStyle)
305cdf0e10cSrcweir {
306cdf0e10cSrcweir if(pRule)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir pStyle->SetPhysical(sal_True);
309cdf0e10cSrcweir pStyle->PresetParent( aEmptyStr );
310cdf0e10cSrcweir }
311cdf0e10cSrcweir else
312cdf0e10cSrcweir pStyle->SetPhysical(sal_False);
313cdf0e10cSrcweir }
314cdf0e10cSrcweir return pRule;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir
317cdf0e10cSrcweir
lcl_FindName(const SwPoolFmtList & rLst,SfxStyleFamily eFam,const String & rName)318cdf0e10cSrcweir sal_uInt16 lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam,
319cdf0e10cSrcweir const String& rName )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir if( rLst.Count() )
322cdf0e10cSrcweir {
323cdf0e10cSrcweir // suchen
324cdf0e10cSrcweir String sSrch( ' ' );
325cdf0e10cSrcweir switch( eFam )
326cdf0e10cSrcweir {
327cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR: sSrch = cCHAR; break;
328cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA: sSrch = cPARA; break;
329cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME: sSrch = cFRAME; break;
330cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE: sSrch = cPAGE; break;
331cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO: sSrch = cNUMRULE; break;
332cdf0e10cSrcweir default:; //prevent warning
333cdf0e10cSrcweir }
334cdf0e10cSrcweir sSrch += rName;
335cdf0e10cSrcweir for( sal_uInt16 i=0; i < rLst.Count(); ++i )
336cdf0e10cSrcweir if( *rLst[i] == sSrch )
337cdf0e10cSrcweir return i;
338cdf0e10cSrcweir }
339cdf0e10cSrcweir return USHRT_MAX;
340cdf0e10cSrcweir }
341cdf0e10cSrcweir
FindPhyStyle(SwDoc & rDoc,const String & rName,SfxStyleFamily eFam)342cdf0e10cSrcweir sal_Bool FindPhyStyle( SwDoc& rDoc, const String& rName, SfxStyleFamily eFam )
343cdf0e10cSrcweir {
344cdf0e10cSrcweir switch( eFam )
345cdf0e10cSrcweir {
346cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
347cdf0e10cSrcweir return 0 != lcl_FindCharFmt( rDoc, rName, 0, sal_False );
348cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
349cdf0e10cSrcweir return 0 != lcl_FindParaFmt( rDoc, rName, 0, sal_False );
350cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
351cdf0e10cSrcweir return 0 != lcl_FindFrmFmt( rDoc, rName, 0, sal_False );
352cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE :
353cdf0e10cSrcweir return 0 != lcl_FindPageDesc( rDoc, rName, 0, sal_False );
354cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
355cdf0e10cSrcweir return 0 != lcl_FindNumRule( rDoc, rName, 0, sal_False );
356cdf0e10cSrcweir default:; //prevent warning
357cdf0e10cSrcweir }
358cdf0e10cSrcweir return sal_False;
359cdf0e10cSrcweir }
360cdf0e10cSrcweir
361cdf0e10cSrcweir
362cdf0e10cSrcweir /*--------------------------------------------------------------------
363cdf0e10cSrcweir Beschreibung: Einfuegen von Strings in die Liste der Vorlagen
364cdf0e10cSrcweir --------------------------------------------------------------------*/
365cdf0e10cSrcweir
366cdf0e10cSrcweir
Append(char cChar,const String & rStr)367cdf0e10cSrcweir void SwPoolFmtList::Append( char cChar, const String& rStr )
368cdf0e10cSrcweir {
369cdf0e10cSrcweir String* pStr = new String( cChar );
370cdf0e10cSrcweir *pStr += rStr;
371cdf0e10cSrcweir for ( sal_uInt16 i=0; i < Count(); ++i )
372cdf0e10cSrcweir {
373cdf0e10cSrcweir if( *operator[](i) == *pStr )
374cdf0e10cSrcweir {
375cdf0e10cSrcweir delete pStr;
376cdf0e10cSrcweir return;
377cdf0e10cSrcweir }
378cdf0e10cSrcweir }
379cdf0e10cSrcweir Insert( pStr, Count() );
380cdf0e10cSrcweir }
381cdf0e10cSrcweir
382cdf0e10cSrcweir /*--------------------------------------------------------------------
383cdf0e10cSrcweir Beschreibung: Liste kompletti loeschen
384cdf0e10cSrcweir --------------------------------------------------------------------*/
385cdf0e10cSrcweir
386cdf0e10cSrcweir
Erase()387cdf0e10cSrcweir void SwPoolFmtList::Erase()
388cdf0e10cSrcweir {
389cdf0e10cSrcweir DeleteAndDestroy( 0, Count() );
390cdf0e10cSrcweir }
391cdf0e10cSrcweir
392cdf0e10cSrcweir /* */
393cdf0e10cSrcweir
394cdf0e10cSrcweir /*--------------------------------------------------------------------
395cdf0e10cSrcweir Beschreibung: UI-seitige implementierung von StyleSheets
396cdf0e10cSrcweir greift auf die Core-Engine zu
397cdf0e10cSrcweir --------------------------------------------------------------------*/
398cdf0e10cSrcweir
SwDocStyleSheet(SwDoc & rDocument,const String & rName,SwDocStyleSheetPool & _rPool,SfxStyleFamily eFam,sal_uInt16 _nMask)399cdf0e10cSrcweir SwDocStyleSheet::SwDocStyleSheet( SwDoc& rDocument,
400cdf0e10cSrcweir const String& rName,
401cdf0e10cSrcweir SwDocStyleSheetPool& _rPool,
402cdf0e10cSrcweir SfxStyleFamily eFam,
403cdf0e10cSrcweir sal_uInt16 _nMask) :
404cdf0e10cSrcweir
405cdf0e10cSrcweir SfxStyleSheetBase( rName, _rPool, eFam, _nMask ),
406cdf0e10cSrcweir pCharFmt(0),
407cdf0e10cSrcweir pColl(0),
408cdf0e10cSrcweir pFrmFmt(0),
409cdf0e10cSrcweir pDesc(0),
410cdf0e10cSrcweir pNumRule(0),
411cdf0e10cSrcweir
412cdf0e10cSrcweir rDoc(rDocument),
413cdf0e10cSrcweir aCoreSet(GetPool().GetPool(),
414cdf0e10cSrcweir RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
415cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END - 1,
416cdf0e10cSrcweir // --> OD 2008-02-25 #refactorlists#
417cdf0e10cSrcweir RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
418cdf0e10cSrcweir // <--
419cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
420cdf0e10cSrcweir RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
421cdf0e10cSrcweir SID_ATTR_PAGE, SID_ATTR_PAGE_EXT1,
422cdf0e10cSrcweir SID_ATTR_PAGE_HEADERSET,SID_ATTR_PAGE_FOOTERSET,
423cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
424cdf0e10cSrcweir FN_PARAM_FTN_INFO, FN_PARAM_FTN_INFO,
425cdf0e10cSrcweir SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL,
426cdf0e10cSrcweir SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
427cdf0e10cSrcweir SID_SWREGISTER_MODE, SID_SWREGISTER_MODE,
428cdf0e10cSrcweir SID_SWREGISTER_COLLECTION, SID_SWREGISTER_COLLECTION,
429cdf0e10cSrcweir FN_COND_COLL, FN_COND_COLL,
430cdf0e10cSrcweir SID_ATTR_AUTO_STYLE_UPDATE, SID_ATTR_AUTO_STYLE_UPDATE,
431cdf0e10cSrcweir SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE,
432cdf0e10cSrcweir SID_PARA_BACKGRND_DESTINATION, SID_ATTR_BRUSH_CHAR,
433cdf0e10cSrcweir SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE,
434cdf0e10cSrcweir 0),
435cdf0e10cSrcweir bPhysical(sal_False)
436cdf0e10cSrcweir {
437cdf0e10cSrcweir nHelpId = UCHAR_MAX;
438cdf0e10cSrcweir }
439cdf0e10cSrcweir
440cdf0e10cSrcweir
SwDocStyleSheet(const SwDocStyleSheet & rOrg)441cdf0e10cSrcweir SwDocStyleSheet::SwDocStyleSheet( const SwDocStyleSheet& rOrg) :
442cdf0e10cSrcweir SfxStyleSheetBase(rOrg),
443cdf0e10cSrcweir pCharFmt(rOrg.pCharFmt),
444cdf0e10cSrcweir pColl(rOrg.pColl),
445cdf0e10cSrcweir pFrmFmt(rOrg.pFrmFmt),
446cdf0e10cSrcweir pDesc(rOrg.pDesc),
447cdf0e10cSrcweir pNumRule(rOrg.pNumRule),
448cdf0e10cSrcweir rDoc(rOrg.rDoc),
449cdf0e10cSrcweir aCoreSet(rOrg.aCoreSet),
450cdf0e10cSrcweir bPhysical(rOrg.bPhysical)
451cdf0e10cSrcweir {
452cdf0e10cSrcweir }
453cdf0e10cSrcweir
454cdf0e10cSrcweir
~SwDocStyleSheet()455cdf0e10cSrcweir SwDocStyleSheet::~SwDocStyleSheet()
456cdf0e10cSrcweir {
457cdf0e10cSrcweir }
458cdf0e10cSrcweir
459cdf0e10cSrcweir /*--------------------------------------------------------------------
460cdf0e10cSrcweir Beschreibung: Zuruecksetzen
461cdf0e10cSrcweir --------------------------------------------------------------------*/
462cdf0e10cSrcweir
463cdf0e10cSrcweir
Reset()464cdf0e10cSrcweir void SwDocStyleSheet::Reset()
465cdf0e10cSrcweir {
466cdf0e10cSrcweir aName.Erase();
467cdf0e10cSrcweir aFollow.Erase();
468cdf0e10cSrcweir aParent.Erase();
469cdf0e10cSrcweir SetPhysical(sal_False);
470cdf0e10cSrcweir }
471cdf0e10cSrcweir
472cdf0e10cSrcweir /*--------------------------------------------------------------------
473cdf0e10cSrcweir Beschreibung: virtuelle Methoden
474cdf0e10cSrcweir --------------------------------------------------------------------*/
475cdf0e10cSrcweir
476cdf0e10cSrcweir
GetParent() const477cdf0e10cSrcweir const String& SwDocStyleSheet::GetParent() const
478cdf0e10cSrcweir {
479cdf0e10cSrcweir if( !bPhysical )
480cdf0e10cSrcweir {
481cdf0e10cSrcweir // dann pruefe, ob schon im Doc vorhanden
482cdf0e10cSrcweir SwFmt* pFmt = 0;
483cdf0e10cSrcweir SwGetPoolIdFromName eGetType;
484cdf0e10cSrcweir switch(nFamily)
485cdf0e10cSrcweir {
486cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR:
487cdf0e10cSrcweir pFmt = rDoc.FindCharFmtByName( aName );
488cdf0e10cSrcweir eGetType = nsSwGetPoolIdFromName::GET_POOLID_CHRFMT;
489cdf0e10cSrcweir break;
490cdf0e10cSrcweir
491cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA:
492cdf0e10cSrcweir pFmt = rDoc.FindTxtFmtCollByName( aName );
493cdf0e10cSrcweir eGetType = nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL;
494cdf0e10cSrcweir break;
495cdf0e10cSrcweir
496cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
497cdf0e10cSrcweir pFmt = rDoc.FindFrmFmtByName( aName );
498cdf0e10cSrcweir eGetType = nsSwGetPoolIdFromName::GET_POOLID_FRMFMT;
499cdf0e10cSrcweir break;
500cdf0e10cSrcweir
501cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
502cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
503cdf0e10cSrcweir default:
504cdf0e10cSrcweir return aEmptyStr; // es gibt keinen Parent
505cdf0e10cSrcweir }
506cdf0e10cSrcweir
507cdf0e10cSrcweir String sTmp;
508cdf0e10cSrcweir if( !pFmt ) // noch nicht vorhanden, also dflt. Parent
509cdf0e10cSrcweir {
510cdf0e10cSrcweir sal_uInt16 i = SwStyleNameMapper::GetPoolIdFromUIName( aName, eGetType );
511cdf0e10cSrcweir i = ::GetPoolParent( i );
512cdf0e10cSrcweir if( i && USHRT_MAX != i )
513cdf0e10cSrcweir SwStyleNameMapper::FillUIName( i, sTmp );
514cdf0e10cSrcweir }
515cdf0e10cSrcweir else
516cdf0e10cSrcweir {
517cdf0e10cSrcweir SwFmt* p = pFmt->DerivedFrom();
518cdf0e10cSrcweir if( p && !p->IsDefault() )
519cdf0e10cSrcweir sTmp = p->GetName();
520cdf0e10cSrcweir }
521cdf0e10cSrcweir SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
522cdf0e10cSrcweir pThis->aParent = sTmp;
523cdf0e10cSrcweir }
524cdf0e10cSrcweir return aParent;
525cdf0e10cSrcweir }
526cdf0e10cSrcweir
527cdf0e10cSrcweir /*--------------------------------------------------------------------
528cdf0e10cSrcweir Beschreibung: Nachfolger
529cdf0e10cSrcweir --------------------------------------------------------------------*/
530cdf0e10cSrcweir
531cdf0e10cSrcweir
GetFollow() const532cdf0e10cSrcweir const String& SwDocStyleSheet::GetFollow() const
533cdf0e10cSrcweir {
534cdf0e10cSrcweir if( !bPhysical )
535cdf0e10cSrcweir {
536cdf0e10cSrcweir SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
537cdf0e10cSrcweir pThis->FillStyleSheet( FillAllInfo );
538cdf0e10cSrcweir }
539cdf0e10cSrcweir return aFollow;
540cdf0e10cSrcweir }
541cdf0e10cSrcweir
542cdf0e10cSrcweir /*--------------------------------------------------------------------
543cdf0e10cSrcweir Beschreibung: Welche Verkettung ist moeglich
544cdf0e10cSrcweir --------------------------------------------------------------------*/
545cdf0e10cSrcweir
546cdf0e10cSrcweir
HasFollowSupport() const547cdf0e10cSrcweir sal_Bool SwDocStyleSheet::HasFollowSupport() const
548cdf0e10cSrcweir {
549cdf0e10cSrcweir switch(nFamily)
550cdf0e10cSrcweir {
551cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
552cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE : return sal_True;
553cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
554cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
555cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO: return sal_False;
556cdf0e10cSrcweir default:
557cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
558cdf0e10cSrcweir }
559cdf0e10cSrcweir return sal_False;
560cdf0e10cSrcweir }
561cdf0e10cSrcweir
562cdf0e10cSrcweir /*--------------------------------------------------------------------
563cdf0e10cSrcweir Beschreibung: Parent ?
564cdf0e10cSrcweir --------------------------------------------------------------------*/
565cdf0e10cSrcweir
566cdf0e10cSrcweir
HasParentSupport() const567cdf0e10cSrcweir sal_Bool SwDocStyleSheet::HasParentSupport() const
568cdf0e10cSrcweir {
569cdf0e10cSrcweir sal_Bool bRet = sal_False;
570cdf0e10cSrcweir switch(nFamily)
571cdf0e10cSrcweir {
572cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
573cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
574cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME: bRet = sal_True;
575cdf0e10cSrcweir default:; //prevent warning
576cdf0e10cSrcweir }
577cdf0e10cSrcweir return bRet;
578cdf0e10cSrcweir }
579cdf0e10cSrcweir
580cdf0e10cSrcweir
HasClearParentSupport() const581cdf0e10cSrcweir sal_Bool SwDocStyleSheet::HasClearParentSupport() const
582cdf0e10cSrcweir {
583cdf0e10cSrcweir sal_Bool bRet = sal_False;
584cdf0e10cSrcweir switch(nFamily)
585cdf0e10cSrcweir {
586cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
587cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
588cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME: bRet = sal_True;
589cdf0e10cSrcweir default:; //prevent warning
590cdf0e10cSrcweir }
591cdf0e10cSrcweir return bRet;
592cdf0e10cSrcweir }
593cdf0e10cSrcweir
594cdf0e10cSrcweir /*--------------------------------------------------------------------
595cdf0e10cSrcweir Beschreibung: textuelle Beschreibung ermitteln
596cdf0e10cSrcweir --------------------------------------------------------------------*/
GetDescription(SfxMapUnit eUnit)597cdf0e10cSrcweir String SwDocStyleSheet::GetDescription(SfxMapUnit eUnit)
598cdf0e10cSrcweir {
599cdf0e10cSrcweir IntlWrapper aIntlWrapper(
600cdf0e10cSrcweir ::comphelper::getProcessServiceFactory(),
601cdf0e10cSrcweir SvtSysLocale().GetLocaleData().getLocale());
602cdf0e10cSrcweir
603cdf0e10cSrcweir String sPlus(String::CreateFromAscii(" + "));
604cdf0e10cSrcweir if ( SFX_STYLE_FAMILY_PAGE == nFamily )
605cdf0e10cSrcweir {
606cdf0e10cSrcweir if( !pSet )
607cdf0e10cSrcweir GetItemSet();
608cdf0e10cSrcweir
609cdf0e10cSrcweir SfxItemIter aIter( *pSet );
610cdf0e10cSrcweir String aDesc;
611cdf0e10cSrcweir const SfxPoolItem* pItem = aIter.FirstItem();
612cdf0e10cSrcweir
613cdf0e10cSrcweir while ( pItem )
614cdf0e10cSrcweir {
615cdf0e10cSrcweir if(!IsInvalidItem(pItem))
616cdf0e10cSrcweir switch ( pItem->Which() )
617cdf0e10cSrcweir {
618cdf0e10cSrcweir case RES_LR_SPACE:
619cdf0e10cSrcweir case SID_ATTR_PAGE_SIZE:
620cdf0e10cSrcweir case SID_ATTR_PAGE_MAXSIZE:
621cdf0e10cSrcweir case SID_ATTR_PAGE_PAPERBIN:
622cdf0e10cSrcweir case SID_ATTR_PAGE_APP:
623cdf0e10cSrcweir case SID_ATTR_BORDER_INNER:
624cdf0e10cSrcweir break;
625cdf0e10cSrcweir default:
626cdf0e10cSrcweir {
627cdf0e10cSrcweir String aItemPresentation;
628cdf0e10cSrcweir if ( !IsInvalidItem( pItem ) &&
629cdf0e10cSrcweir rPool.GetPool().GetPresentation(
630cdf0e10cSrcweir *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
631cdf0e10cSrcweir eUnit, aItemPresentation, &aIntlWrapper ) )
632cdf0e10cSrcweir {
633cdf0e10cSrcweir if ( aDesc.Len() && aItemPresentation.Len() )
634cdf0e10cSrcweir aDesc += sPlus;
635cdf0e10cSrcweir aDesc += aItemPresentation;
636cdf0e10cSrcweir }
637cdf0e10cSrcweir }
638cdf0e10cSrcweir }
639cdf0e10cSrcweir pItem = aIter.NextItem();
640cdf0e10cSrcweir }
641cdf0e10cSrcweir return aDesc;
642cdf0e10cSrcweir }
643cdf0e10cSrcweir else if ( SFX_STYLE_FAMILY_FRAME == nFamily ||
644cdf0e10cSrcweir SFX_STYLE_FAMILY_PARA == nFamily)
645cdf0e10cSrcweir {
646cdf0e10cSrcweir if( !pSet )
647cdf0e10cSrcweir GetItemSet();
648cdf0e10cSrcweir
649cdf0e10cSrcweir SfxItemIter aIter( *pSet );
650cdf0e10cSrcweir String aDesc;
651cdf0e10cSrcweir const SfxPoolItem* pItem = aIter.FirstItem();
652cdf0e10cSrcweir
653cdf0e10cSrcweir String sPageNum, sModel, sBreak;
654cdf0e10cSrcweir sal_Bool bHasWesternFontPrefix = sal_False;
655cdf0e10cSrcweir sal_Bool bHasCJKFontPrefix = sal_False;
656cdf0e10cSrcweir SvtCJKOptions aCJKOptions;
657cdf0e10cSrcweir
658cdf0e10cSrcweir while ( pItem )
659cdf0e10cSrcweir {
660cdf0e10cSrcweir if(!IsInvalidItem(pItem))
661cdf0e10cSrcweir switch ( pItem->Which() )
662cdf0e10cSrcweir {
663cdf0e10cSrcweir case SID_ATTR_AUTO_STYLE_UPDATE:
664cdf0e10cSrcweir case SID_PARA_BACKGRND_DESTINATION:
665cdf0e10cSrcweir case RES_PAGEDESC:
666cdf0e10cSrcweir //CTL no yet supported
667cdf0e10cSrcweir case RES_CHRATR_CTL_FONT:
668cdf0e10cSrcweir case RES_CHRATR_CTL_FONTSIZE:
669cdf0e10cSrcweir case RES_CHRATR_CTL_LANGUAGE:
670cdf0e10cSrcweir case RES_CHRATR_CTL_POSTURE:
671cdf0e10cSrcweir case RES_CHRATR_CTL_WEIGHT:
672cdf0e10cSrcweir break;
673cdf0e10cSrcweir default:
674cdf0e10cSrcweir {
675cdf0e10cSrcweir String aItemPresentation;
676cdf0e10cSrcweir if ( !IsInvalidItem( pItem ) &&
677cdf0e10cSrcweir rPool.GetPool().GetPresentation(
678cdf0e10cSrcweir *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
679cdf0e10cSrcweir eUnit, aItemPresentation, &aIntlWrapper ) )
680cdf0e10cSrcweir {
681cdf0e10cSrcweir sal_Bool bIsDefault = sal_False;
682cdf0e10cSrcweir switch ( pItem->Which() )
683cdf0e10cSrcweir {
684cdf0e10cSrcweir case SID_ATTR_PARA_PAGENUM:
685cdf0e10cSrcweir sPageNum = aItemPresentation;
686cdf0e10cSrcweir break;
687cdf0e10cSrcweir case SID_ATTR_PARA_MODEL:
688cdf0e10cSrcweir sModel = aItemPresentation;
689cdf0e10cSrcweir break;
690cdf0e10cSrcweir case RES_BREAK:
691cdf0e10cSrcweir sBreak = aItemPresentation;
692cdf0e10cSrcweir break;
693cdf0e10cSrcweir case RES_CHRATR_CJK_FONT:
694cdf0e10cSrcweir case RES_CHRATR_CJK_FONTSIZE:
695cdf0e10cSrcweir case RES_CHRATR_CJK_LANGUAGE:
696cdf0e10cSrcweir case RES_CHRATR_CJK_POSTURE:
697cdf0e10cSrcweir case RES_CHRATR_CJK_WEIGHT:
698cdf0e10cSrcweir if(aCJKOptions.IsCJKFontEnabled())
699cdf0e10cSrcweir bIsDefault = sal_True;
700cdf0e10cSrcweir if(!bHasCJKFontPrefix)
701cdf0e10cSrcweir {
702cdf0e10cSrcweir aItemPresentation.Insert(SW_RESSTR(STR_CJK_FONT), 0);
703cdf0e10cSrcweir bHasCJKFontPrefix = sal_True;
704cdf0e10cSrcweir }
705cdf0e10cSrcweir break;
706cdf0e10cSrcweir case RES_CHRATR_FONT:
707cdf0e10cSrcweir case RES_CHRATR_FONTSIZE:
708cdf0e10cSrcweir case RES_CHRATR_LANGUAGE:
709cdf0e10cSrcweir case RES_CHRATR_POSTURE:
710cdf0e10cSrcweir case RES_CHRATR_WEIGHT:
711cdf0e10cSrcweir if(!bHasWesternFontPrefix)
712cdf0e10cSrcweir {
713cdf0e10cSrcweir aItemPresentation.Insert(SW_RESSTR(STR_WESTERN_FONT), 0);
714cdf0e10cSrcweir bHasWesternFontPrefix = sal_True;
715cdf0e10cSrcweir bIsDefault = sal_True;
716cdf0e10cSrcweir }
717cdf0e10cSrcweir // no break;
718cdf0e10cSrcweir default:
719cdf0e10cSrcweir bIsDefault = sal_True;
720cdf0e10cSrcweir }
721cdf0e10cSrcweir if(bIsDefault)
722cdf0e10cSrcweir {
723cdf0e10cSrcweir if ( aDesc.Len() && aItemPresentation.Len() )
724cdf0e10cSrcweir aDesc += sPlus;
725cdf0e10cSrcweir aDesc += aItemPresentation;
726cdf0e10cSrcweir }
727cdf0e10cSrcweir }
728cdf0e10cSrcweir }
729cdf0e10cSrcweir }
730cdf0e10cSrcweir pItem = aIter.NextItem();
731cdf0e10cSrcweir }
732cdf0e10cSrcweir //Sonderbehandlung fuer Umburch, Seitenvorlage und Seitenoffset
733cdf0e10cSrcweir if(sBreak.Len() && !sModel.Len()) // wemm Model. dann ist Break ungueltig
734cdf0e10cSrcweir {
735cdf0e10cSrcweir if(aDesc.Len())
736cdf0e10cSrcweir aDesc += sPlus;
737cdf0e10cSrcweir aDesc += sBreak;
738cdf0e10cSrcweir }
739cdf0e10cSrcweir if(sModel.Len())
740cdf0e10cSrcweir {
741cdf0e10cSrcweir if(aDesc.Len())
742cdf0e10cSrcweir aDesc += sPlus;
743cdf0e10cSrcweir aDesc += SW_RESSTR(STR_PAGEBREAK);
744cdf0e10cSrcweir aDesc += sPlus;
745cdf0e10cSrcweir aDesc += sModel;
746cdf0e10cSrcweir if(sPageNum != String(UniString::CreateFromInt32(0)))
747cdf0e10cSrcweir {
748cdf0e10cSrcweir aDesc += sPlus;
749cdf0e10cSrcweir aDesc += SW_RESSTR(STR_PAGEOFFSET);
750cdf0e10cSrcweir aDesc += sPageNum;
751cdf0e10cSrcweir }
752cdf0e10cSrcweir }
753cdf0e10cSrcweir return aDesc;
754cdf0e10cSrcweir }
755cdf0e10cSrcweir else if( SFX_STYLE_FAMILY_PSEUDO == nFamily )
756cdf0e10cSrcweir {
757cdf0e10cSrcweir // if( pNumRule )
758cdf0e10cSrcweir // return pNumRule->GetName();
759cdf0e10cSrcweir //os: was sollte man bei Numerierungen schon anzeigen?
760cdf0e10cSrcweir return aEmptyStr;
761cdf0e10cSrcweir }
762cdf0e10cSrcweir
763cdf0e10cSrcweir return SfxStyleSheetBase::GetDescription(eUnit);
764cdf0e10cSrcweir }
765cdf0e10cSrcweir
766cdf0e10cSrcweir
GetDescription()767cdf0e10cSrcweir String SwDocStyleSheet::GetDescription()
768cdf0e10cSrcweir {
769cdf0e10cSrcweir return GetDescription(SFX_MAPUNIT_CM);
770cdf0e10cSrcweir }
771cdf0e10cSrcweir
772cdf0e10cSrcweir /*--------------------------------------------------------------------
773cdf0e10cSrcweir Beschreibung: Namen setzen
774cdf0e10cSrcweir --------------------------------------------------------------------*/
775cdf0e10cSrcweir
776cdf0e10cSrcweir
SetName(const String & rStr)777cdf0e10cSrcweir sal_Bool SwDocStyleSheet::SetName( const String& rStr)
778cdf0e10cSrcweir {
779cdf0e10cSrcweir if( !rStr.Len() )
780cdf0e10cSrcweir return sal_False;
781cdf0e10cSrcweir
782cdf0e10cSrcweir if( aName != rStr )
783cdf0e10cSrcweir {
784cdf0e10cSrcweir if( !SfxStyleSheetBase::SetName( rStr ))
785cdf0e10cSrcweir return sal_False;
786cdf0e10cSrcweir }
787cdf0e10cSrcweir else if(!bPhysical)
788cdf0e10cSrcweir FillStyleSheet( FillPhysical );
789cdf0e10cSrcweir
790cdf0e10cSrcweir int bChg = sal_False;
791cdf0e10cSrcweir switch(nFamily)
792cdf0e10cSrcweir {
793cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
794cdf0e10cSrcweir {
795cdf0e10cSrcweir ASSERT(pCharFmt, "SwCharFormat fehlt!");
796cdf0e10cSrcweir if( pCharFmt && pCharFmt->GetName() != rStr )
797cdf0e10cSrcweir {
798cdf0e10cSrcweir pCharFmt->SetName( rStr );
799cdf0e10cSrcweir bChg = sal_True;
800cdf0e10cSrcweir }
801cdf0e10cSrcweir break;
802cdf0e10cSrcweir }
803cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
804cdf0e10cSrcweir {
805cdf0e10cSrcweir ASSERT(pColl, "Collektion fehlt!");
806cdf0e10cSrcweir if( pColl && pColl->GetName() != rStr )
807cdf0e10cSrcweir {
808cdf0e10cSrcweir if (pColl->GetName().Len() > 0)
809cdf0e10cSrcweir rDoc.RenameFmt(*pColl, rStr);
810cdf0e10cSrcweir else
811cdf0e10cSrcweir pColl->SetName(rStr);
812cdf0e10cSrcweir
813cdf0e10cSrcweir bChg = sal_True;
814cdf0e10cSrcweir }
815cdf0e10cSrcweir break;
816cdf0e10cSrcweir }
817cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
818cdf0e10cSrcweir {
819cdf0e10cSrcweir ASSERT(pFrmFmt, "FrmFmt fehlt!");
820cdf0e10cSrcweir if( pFrmFmt && pFrmFmt->GetName() != rStr )
821cdf0e10cSrcweir {
822cdf0e10cSrcweir if (pFrmFmt->GetName().Len() > 0)
823cdf0e10cSrcweir rDoc.RenameFmt(*pFrmFmt, rStr);
824cdf0e10cSrcweir else
825cdf0e10cSrcweir pFrmFmt->SetName( rStr );
826cdf0e10cSrcweir
827cdf0e10cSrcweir bChg = sal_True;
828cdf0e10cSrcweir }
829cdf0e10cSrcweir break;
830cdf0e10cSrcweir }
831cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE :
832cdf0e10cSrcweir ASSERT(pDesc, "PageDesc fehlt!");
833cdf0e10cSrcweir if( pDesc && pDesc->GetName() != rStr )
834cdf0e10cSrcweir {
835cdf0e10cSrcweir //PageDesc setzen - mit vorherigem kopieren - ist fuer das
836cdf0e10cSrcweir //setzen des Namens wohl nicht notwendig. Deshalb erlauben
837cdf0e10cSrcweir //wir hier mal einen cast.
838cdf0e10cSrcweir // -> #116530#
839cdf0e10cSrcweir SwPageDesc aPageDesc(*((SwPageDesc*)pDesc));
840cdf0e10cSrcweir String aOldName(aPageDesc.GetName());
841cdf0e10cSrcweir
842cdf0e10cSrcweir aPageDesc.SetName( rStr );
843cdf0e10cSrcweir bool const bDoesUndo = rDoc.GetIDocumentUndoRedo().DoesUndo();
844cdf0e10cSrcweir
845cdf0e10cSrcweir rDoc.GetIDocumentUndoRedo().DoUndo(aOldName.Len() > 0);
846cdf0e10cSrcweir rDoc.ChgPageDesc(aOldName, aPageDesc);
847cdf0e10cSrcweir rDoc.GetIDocumentUndoRedo().DoUndo(bDoesUndo);
848cdf0e10cSrcweir // <- #116530#
849cdf0e10cSrcweir
850cdf0e10cSrcweir rDoc.SetModified();
851cdf0e10cSrcweir bChg = sal_True;
852cdf0e10cSrcweir }
853cdf0e10cSrcweir break;
854cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
855cdf0e10cSrcweir ASSERT(pNumRule, "NumRule fehlt!");
856cdf0e10cSrcweir
857cdf0e10cSrcweir // -> #106897#
858cdf0e10cSrcweir if (pNumRule)
859cdf0e10cSrcweir {
860cdf0e10cSrcweir String aOldName = pNumRule->GetName();
861cdf0e10cSrcweir
862cdf0e10cSrcweir if (aOldName.Len() > 0)
863cdf0e10cSrcweir {
864cdf0e10cSrcweir if ( aOldName != rStr &&
865cdf0e10cSrcweir rDoc.RenameNumRule(aOldName, rStr))
866cdf0e10cSrcweir {
867cdf0e10cSrcweir pNumRule = rDoc.FindNumRulePtr(rStr);
868cdf0e10cSrcweir rDoc.SetModified();
869cdf0e10cSrcweir
870cdf0e10cSrcweir bChg = sal_True;
871cdf0e10cSrcweir }
872cdf0e10cSrcweir }
873cdf0e10cSrcweir else
874cdf0e10cSrcweir {
875cdf0e10cSrcweir // --> OD 2008-07-08 #i91400#
876cdf0e10cSrcweir ((SwNumRule*)pNumRule)->SetName( rStr, rDoc );
877cdf0e10cSrcweir // <--
878cdf0e10cSrcweir rDoc.SetModified();
879cdf0e10cSrcweir
880cdf0e10cSrcweir bChg = sal_True;
881cdf0e10cSrcweir }
882cdf0e10cSrcweir }
883cdf0e10cSrcweir // <- #106897#
884cdf0e10cSrcweir
885cdf0e10cSrcweir break;
886cdf0e10cSrcweir
887cdf0e10cSrcweir default:
888cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
889cdf0e10cSrcweir }
890cdf0e10cSrcweir
891cdf0e10cSrcweir if( bChg )
892cdf0e10cSrcweir {
893cdf0e10cSrcweir rPool.First(); // interne Liste muss geupdatet werden
894cdf0e10cSrcweir rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
895cdf0e10cSrcweir SwEditShell* pSh = rDoc.GetEditShell();
896cdf0e10cSrcweir if( pSh )
897cdf0e10cSrcweir pSh->CallChgLnk();
898cdf0e10cSrcweir }
899cdf0e10cSrcweir return sal_True;
900cdf0e10cSrcweir }
901cdf0e10cSrcweir
902cdf0e10cSrcweir /*--------------------------------------------------------------------
903cdf0e10cSrcweir Beschreibung: Ableitungshirachie
904cdf0e10cSrcweir --------------------------------------------------------------------*/
905cdf0e10cSrcweir
906cdf0e10cSrcweir
SetParent(const String & rStr)907cdf0e10cSrcweir sal_Bool SwDocStyleSheet::SetParent( const String& rStr)
908cdf0e10cSrcweir {
909cdf0e10cSrcweir SwFmt* pFmt = 0, *pParent = 0;
910cdf0e10cSrcweir switch(nFamily)
911cdf0e10cSrcweir {
912cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
913cdf0e10cSrcweir ASSERT( pCharFmt, "SwCharFormat fehlt!" )
914cdf0e10cSrcweir if( 0 != ( pFmt = pCharFmt ) && rStr.Len() )
915cdf0e10cSrcweir pParent = lcl_FindCharFmt(rDoc, rStr);
916cdf0e10cSrcweir break;
917cdf0e10cSrcweir
918cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
919cdf0e10cSrcweir ASSERT( pColl, "Collektion fehlt!")
920cdf0e10cSrcweir if( 0 != ( pFmt = pColl ) && rStr.Len() )
921cdf0e10cSrcweir pParent = lcl_FindParaFmt( rDoc, rStr );
922cdf0e10cSrcweir break;
923cdf0e10cSrcweir
924cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
925cdf0e10cSrcweir ASSERT(pFrmFmt, "FrameFormat fehlt!");
926cdf0e10cSrcweir if( 0 != ( pFmt = pFrmFmt ) && rStr.Len() )
927cdf0e10cSrcweir pParent = lcl_FindFrmFmt( rDoc, rStr );
928cdf0e10cSrcweir break;
929cdf0e10cSrcweir
930cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
931cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
932cdf0e10cSrcweir break;
933cdf0e10cSrcweir default:
934cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
935cdf0e10cSrcweir }
936cdf0e10cSrcweir
937cdf0e10cSrcweir sal_Bool bRet = sal_False;
938cdf0e10cSrcweir if( pFmt && pFmt->DerivedFrom() &&
939cdf0e10cSrcweir pFmt->DerivedFrom()->GetName() != rStr )
940cdf0e10cSrcweir {
941cdf0e10cSrcweir {
942cdf0e10cSrcweir SwImplShellAction aTmp( rDoc );
943cdf0e10cSrcweir bRet = pFmt->SetDerivedFrom( pParent );
944cdf0e10cSrcweir }
945cdf0e10cSrcweir
946cdf0e10cSrcweir if( bRet )
947cdf0e10cSrcweir {
948cdf0e10cSrcweir aParent = rStr;
949cdf0e10cSrcweir rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED,
950cdf0e10cSrcweir *this ) );
951cdf0e10cSrcweir }
952cdf0e10cSrcweir }
953cdf0e10cSrcweir
954cdf0e10cSrcweir return bRet;
955cdf0e10cSrcweir }
956cdf0e10cSrcweir
957cdf0e10cSrcweir /*--------------------------------------------------------------------
958cdf0e10cSrcweir Beschreibung: Nachfolger detzen
959cdf0e10cSrcweir --------------------------------------------------------------------*/
960cdf0e10cSrcweir
961cdf0e10cSrcweir
SetFollow(const String & rStr)962cdf0e10cSrcweir sal_Bool SwDocStyleSheet::SetFollow( const String& rStr)
963cdf0e10cSrcweir {
964cdf0e10cSrcweir if( rStr.Len() && !SfxStyleSheetBase::SetFollow( rStr ))
965cdf0e10cSrcweir return sal_False;
966cdf0e10cSrcweir
967cdf0e10cSrcweir SwImplShellAction aTmpSh( rDoc );
968cdf0e10cSrcweir switch(nFamily)
969cdf0e10cSrcweir {
970cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
971cdf0e10cSrcweir {
972cdf0e10cSrcweir ASSERT(pColl, "Collection fehlt!");
973cdf0e10cSrcweir if( pColl )
974cdf0e10cSrcweir {
975cdf0e10cSrcweir SwTxtFmtColl* pFollow = pColl;
976cdf0e10cSrcweir if( rStr.Len() && 0 == (pFollow = lcl_FindParaFmt(rDoc, rStr) ))
977cdf0e10cSrcweir pFollow = pColl;
978cdf0e10cSrcweir
979cdf0e10cSrcweir pColl->SetNextTxtFmtColl(*pFollow);
980cdf0e10cSrcweir }
981cdf0e10cSrcweir break;
982cdf0e10cSrcweir }
983cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE :
984cdf0e10cSrcweir {
985cdf0e10cSrcweir ASSERT(pDesc, "PageDesc fehlt!");
986cdf0e10cSrcweir if( pDesc )
987cdf0e10cSrcweir {
988cdf0e10cSrcweir const SwPageDesc* pFollowDesc = rStr.Len()
989cdf0e10cSrcweir ? lcl_FindPageDesc(rDoc, rStr)
990cdf0e10cSrcweir : 0;
991cdf0e10cSrcweir sal_uInt16 nId;
992cdf0e10cSrcweir if( pFollowDesc != pDesc->GetFollow() &&
993cdf0e10cSrcweir rDoc.FindPageDescByName( pDesc->GetName(), &nId ) )
994cdf0e10cSrcweir {
995cdf0e10cSrcweir SwPageDesc aDesc( *pDesc );
996cdf0e10cSrcweir aDesc.SetFollow( pFollowDesc );
997cdf0e10cSrcweir rDoc.ChgPageDesc( nId, aDesc );
998cdf0e10cSrcweir pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc( nId );
999cdf0e10cSrcweir }
1000cdf0e10cSrcweir }
1001cdf0e10cSrcweir break;
1002cdf0e10cSrcweir }
1003cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR:
1004cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
1005cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1006cdf0e10cSrcweir break;
1007cdf0e10cSrcweir default:
1008cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
1009cdf0e10cSrcweir }
1010cdf0e10cSrcweir
1011cdf0e10cSrcweir return sal_True;
1012cdf0e10cSrcweir }
1013cdf0e10cSrcweir
1014cdf0e10cSrcweir /*--------------------------------------------------------------------
1015cdf0e10cSrcweir Beschreibung: ueber Name und Family, Mask den ItemSet rausholen
1016cdf0e10cSrcweir --------------------------------------------------------------------*/
1017cdf0e10cSrcweir
GetItemSet()1018cdf0e10cSrcweir SfxItemSet& SwDocStyleSheet::GetItemSet()
1019cdf0e10cSrcweir {
1020cdf0e10cSrcweir if(!bPhysical)
1021cdf0e10cSrcweir FillStyleSheet( FillPhysical );
1022cdf0e10cSrcweir
1023cdf0e10cSrcweir switch(nFamily)
1024cdf0e10cSrcweir {
1025cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR:
1026cdf0e10cSrcweir {
1027cdf0e10cSrcweir ASSERT(pCharFmt, "Wo ist das SwCharFmt");
1028cdf0e10cSrcweir aCoreSet.Put(pCharFmt->GetAttrSet());
1029cdf0e10cSrcweir if(pCharFmt->DerivedFrom())
1030cdf0e10cSrcweir aCoreSet.SetParent(&pCharFmt->DerivedFrom()->GetAttrSet());
1031cdf0e10cSrcweir }
1032cdf0e10cSrcweir break;
1033cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
1034cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
1035cdf0e10cSrcweir {
1036cdf0e10cSrcweir SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1037cdf0e10cSrcweir aBoxInfo.SetTable( sal_False );
1038cdf0e10cSrcweir aBoxInfo.SetDist( sal_True); // Abstandsfeld immer anzeigen
1039cdf0e10cSrcweir aBoxInfo.SetMinDist( sal_True );// Minimalgroesse in Tabellen und Absaetzen setzen
1040cdf0e10cSrcweir aBoxInfo.SetDefDist( MIN_BORDER_DIST );// Default-Abstand immer setzen
1041cdf0e10cSrcweir // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
1042cdf0e10cSrcweir aBoxInfo.SetValid( VALID_DISABLE, sal_True );
1043cdf0e10cSrcweir if ( nFamily == SFX_STYLE_FAMILY_PARA )
1044cdf0e10cSrcweir {
1045cdf0e10cSrcweir ASSERT(pColl, "Wo ist die Collektion");
1046cdf0e10cSrcweir aCoreSet.Put(pColl->GetAttrSet());
1047cdf0e10cSrcweir aCoreSet.Put( aBoxInfo );
1048cdf0e10cSrcweir aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pColl->IsAutoUpdateFmt()));
1049cdf0e10cSrcweir if(pColl->DerivedFrom())
1050cdf0e10cSrcweir aCoreSet.SetParent(&pColl->DerivedFrom()->GetAttrSet());
1051cdf0e10cSrcweir }
1052cdf0e10cSrcweir else
1053cdf0e10cSrcweir {
1054cdf0e10cSrcweir ASSERT(pFrmFmt, "Wo ist das FrmFmt");
1055cdf0e10cSrcweir aCoreSet.Put(pFrmFmt->GetAttrSet());
1056cdf0e10cSrcweir aCoreSet.Put( aBoxInfo );
1057cdf0e10cSrcweir aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pFrmFmt->IsAutoUpdateFmt()));
1058cdf0e10cSrcweir if(pFrmFmt->DerivedFrom())
1059cdf0e10cSrcweir aCoreSet.SetParent(&pFrmFmt->DerivedFrom()->GetAttrSet());
1060cdf0e10cSrcweir }
1061cdf0e10cSrcweir }
1062cdf0e10cSrcweir break;
1063cdf0e10cSrcweir
1064cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE :
1065cdf0e10cSrcweir {
1066cdf0e10cSrcweir ASSERT(pDesc, "Kein PageDescriptor");
1067cdf0e10cSrcweir ::PageDescToItemSet(*((SwPageDesc*)pDesc), aCoreSet);
1068cdf0e10cSrcweir }
1069cdf0e10cSrcweir break;
1070cdf0e10cSrcweir
1071cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1072cdf0e10cSrcweir {
1073cdf0e10cSrcweir ASSERT(pNumRule, "Keine NumRule");
1074cdf0e10cSrcweir SvxNumRule aRule = pNumRule->MakeSvxNumRule();
1075cdf0e10cSrcweir aCoreSet.Put(SvxNumBulletItem(aRule));
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir break;
1078cdf0e10cSrcweir
1079cdf0e10cSrcweir default:
1080cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
1081cdf0e10cSrcweir }
1082cdf0e10cSrcweir // Member der Basisklasse
1083cdf0e10cSrcweir pSet = &aCoreSet;
1084cdf0e10cSrcweir
1085cdf0e10cSrcweir return aCoreSet;
1086cdf0e10cSrcweir }
1087cdf0e10cSrcweir
1088cdf0e10cSrcweir // --> OD 2008-02-13 #newlistlevelattrs#
MergeIndentAttrsOfListStyle(SfxItemSet & rSet)1089cdf0e10cSrcweir void SwDocStyleSheet::MergeIndentAttrsOfListStyle( SfxItemSet& rSet )
1090cdf0e10cSrcweir {
1091cdf0e10cSrcweir if ( nFamily != SFX_STYLE_FAMILY_PARA )
1092cdf0e10cSrcweir {
1093cdf0e10cSrcweir return;
1094cdf0e10cSrcweir }
1095cdf0e10cSrcweir
1096cdf0e10cSrcweir ASSERT( pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
1097cdf0e10cSrcweir if ( pColl->AreListLevelIndentsApplicable() )
1098cdf0e10cSrcweir {
1099cdf0e10cSrcweir ASSERT( pColl->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET,
1100cdf0e10cSrcweir "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect -> please inform OD." );
1101cdf0e10cSrcweir const String sNumRule = pColl->GetNumRule().GetValue();
1102cdf0e10cSrcweir if( sNumRule.Len() )
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir const SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1105cdf0e10cSrcweir if( pRule )
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir const SwNumFmt& rFmt = pRule->Get( 0 );
1108cdf0e10cSrcweir if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1109cdf0e10cSrcweir {
1110cdf0e10cSrcweir SvxLRSpaceItem aLR( RES_LR_SPACE );
1111cdf0e10cSrcweir aLR.SetTxtLeft( rFmt.GetIndentAt() );
1112cdf0e10cSrcweir aLR.SetTxtFirstLineOfst( static_cast<short>(rFmt.GetFirstLineIndent()) );
1113cdf0e10cSrcweir rSet.Put( aLR );
1114cdf0e10cSrcweir }
1115cdf0e10cSrcweir }
1116cdf0e10cSrcweir }
1117cdf0e10cSrcweir }
1118cdf0e10cSrcweir }
1119cdf0e10cSrcweir // <--
1120cdf0e10cSrcweir
1121cdf0e10cSrcweir /*--------------------------------------------------------------------
1122cdf0e10cSrcweir Beschreibung: ItemSet setzen
1123cdf0e10cSrcweir --------------------------------------------------------------------*/
1124cdf0e10cSrcweir
1125cdf0e10cSrcweir // --> OD 2008-02-12 #newlistlevelattrs#
1126cdf0e10cSrcweir // handling of parameter <bResetIndentAttrsAtParagraphStyle>
SetItemSet(const SfxItemSet & rSet,const bool bResetIndentAttrsAtParagraphStyle)1127cdf0e10cSrcweir void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
1128cdf0e10cSrcweir const bool bResetIndentAttrsAtParagraphStyle )
1129cdf0e10cSrcweir {
1130cdf0e10cSrcweir // gegebenenfalls Format erst ermitteln
1131cdf0e10cSrcweir if(!bPhysical)
1132cdf0e10cSrcweir FillStyleSheet( FillPhysical );
1133cdf0e10cSrcweir
1134cdf0e10cSrcweir SwImplShellAction aTmpSh( rDoc );
1135cdf0e10cSrcweir
1136cdf0e10cSrcweir ASSERT( &rSet != &aCoreSet, "SetItemSet mit eigenem Set ist nicht erlaubt" );
1137cdf0e10cSrcweir
1138cdf0e10cSrcweir // --> OD 2008-02-12 #newlistlevelattrs#
1139cdf0e10cSrcweir if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1140cdf0e10cSrcweir {
1141cdf0e10cSrcweir SwRewriter aRewriter;
1142cdf0e10cSrcweir aRewriter.AddRule( UNDO_ARG1, GetName() );
1143cdf0e10cSrcweir rDoc.GetIDocumentUndoRedo().StartUndo( UNDO_INSFMTATTR, &aRewriter );
1144cdf0e10cSrcweir }
1145cdf0e10cSrcweir // <--
1146cdf0e10cSrcweir
1147cdf0e10cSrcweir SwFmt* pFmt = 0;
1148cdf0e10cSrcweir SwPageDesc* pNewDsc = 0;
1149cdf0e10cSrcweir sal_uInt16 nPgDscPos = 0;
1150cdf0e10cSrcweir
1151cdf0e10cSrcweir switch(nFamily)
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
1154cdf0e10cSrcweir {
1155cdf0e10cSrcweir ASSERT(pCharFmt, "Wo ist das CharFormat");
1156cdf0e10cSrcweir pFmt = pCharFmt;
1157cdf0e10cSrcweir }
1158cdf0e10cSrcweir break;
1159cdf0e10cSrcweir
1160cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
1161cdf0e10cSrcweir {
1162cdf0e10cSrcweir ASSERT(pColl, "Wo ist die Collection");
1163cdf0e10cSrcweir const SfxPoolItem* pAutoUpdate;
1164cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,sal_False, &pAutoUpdate ))
1165cdf0e10cSrcweir {
1166cdf0e10cSrcweir pColl->SetAutoUpdateFmt(((const SfxBoolItem*)pAutoUpdate)->GetValue());
1167cdf0e10cSrcweir }
1168cdf0e10cSrcweir
1169cdf0e10cSrcweir const SwCondCollItem* pCondItem;
1170cdf0e10cSrcweir if( SFX_ITEM_SET != rSet.GetItemState( FN_COND_COLL, sal_False,
1171cdf0e10cSrcweir (const SfxPoolItem**)&pCondItem ))
1172cdf0e10cSrcweir pCondItem = 0;
1173cdf0e10cSrcweir
1174cdf0e10cSrcweir if( RES_CONDTXTFMTCOLL == pColl->Which() && pCondItem )
1175cdf0e10cSrcweir {
1176cdf0e10cSrcweir SwFmt* pFindFmt;
1177cdf0e10cSrcweir const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1178cdf0e10cSrcweir for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
1179cdf0e10cSrcweir {
1180cdf0e10cSrcweir SwCollCondition aCond( 0, pCmds[ i ].nCnd, pCmds[ i ].nSubCond );
1181cdf0e10cSrcweir ((SwConditionTxtFmtColl*)pColl)->RemoveCondition( aCond );
1182cdf0e10cSrcweir const String& rStyle = pCondItem->GetStyle( i );
1183cdf0e10cSrcweir if( rStyle.Len() &&
1184cdf0e10cSrcweir 0 != ( pFindFmt = lcl_FindParaFmt( rDoc, rStyle, 0, sal_True )))
1185cdf0e10cSrcweir {
1186cdf0e10cSrcweir aCond.RegisterToFormat( *pFindFmt );
1187cdf0e10cSrcweir ((SwConditionTxtFmtColl*)pColl)->InsertCondition( aCond );
1188cdf0e10cSrcweir }
1189cdf0e10cSrcweir }
1190cdf0e10cSrcweir
1191cdf0e10cSrcweir // Document auf die neue Bedingungen updaten
1192cdf0e10cSrcweir SwCondCollCondChg aMsg( pColl );
1193cdf0e10cSrcweir pColl->ModifyNotification( &aMsg, &aMsg );
1194cdf0e10cSrcweir }
1195cdf0e10cSrcweir else if( pCondItem && !pColl->GetDepends() )
1196cdf0e10cSrcweir {
1197cdf0e10cSrcweir // keine bedingte Vorlage, dann erstmal erzeugen und
1198cdf0e10cSrcweir // alle wichtigen Werte uebernehmen
1199cdf0e10cSrcweir SwConditionTxtFmtColl* pCColl = rDoc.MakeCondTxtFmtColl(
1200cdf0e10cSrcweir pColl->GetName(), (SwTxtFmtColl*)pColl->DerivedFrom() );
1201cdf0e10cSrcweir if( pColl != &pColl->GetNextTxtFmtColl() )
1202cdf0e10cSrcweir pCColl->SetNextTxtFmtColl( pColl->GetNextTxtFmtColl() );
1203cdf0e10cSrcweir
1204cdf0e10cSrcweir if( pColl->IsAssignedToListLevelOfOutlineStyle())
1205cdf0e10cSrcweir pCColl->AssignToListLevelOfOutlineStyle(pColl->GetAssignedOutlineStyleLevel());
1206cdf0e10cSrcweir else
1207*86104fa7SOliver-Rainer Wittmann pCColl->DeleteAssignmentToListLevelOfOutlineStyle();
1208cdf0e10cSrcweir
1209cdf0e10cSrcweir
1210cdf0e10cSrcweir
1211cdf0e10cSrcweir SwTxtFmtColl* pFindFmt;
1212cdf0e10cSrcweir const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1213cdf0e10cSrcweir for( sal_uInt16 i = 0; i < COND_COMMAND_COUNT; ++i )
1214cdf0e10cSrcweir {
1215cdf0e10cSrcweir const String& rStyle = pCondItem->GetStyle( i );
1216cdf0e10cSrcweir if( rStyle.Len() &&
1217cdf0e10cSrcweir 0 != ( pFindFmt = lcl_FindParaFmt( rDoc, rStyle, 0, sal_True )))
1218cdf0e10cSrcweir {
1219cdf0e10cSrcweir pCColl->InsertCondition( SwCollCondition( pFindFmt,
1220cdf0e10cSrcweir pCmds[ i ].nCnd, pCmds[ i ].nSubCond ) );
1221cdf0e10cSrcweir }
1222cdf0e10cSrcweir }
1223cdf0e10cSrcweir
1224cdf0e10cSrcweir rDoc.DelTxtFmtColl( pColl );
1225cdf0e10cSrcweir pColl = pCColl;
1226cdf0e10cSrcweir }
1227cdf0e10cSrcweir // --> OD 2008-02-12 #newlistlevelattrs#
1228cdf0e10cSrcweir if ( bResetIndentAttrsAtParagraphStyle &&
1229cdf0e10cSrcweir rSet.GetItemState( RES_PARATR_NUMRULE, sal_False, 0 ) == SFX_ITEM_SET &&
1230cdf0e10cSrcweir rSet.GetItemState( RES_LR_SPACE, sal_False, 0 ) != SFX_ITEM_SET &&
1231cdf0e10cSrcweir pColl->GetItemState( RES_LR_SPACE, sal_False, 0 ) == SFX_ITEM_SET )
1232cdf0e10cSrcweir {
1233cdf0e10cSrcweir rDoc.ResetAttrAtFormat( RES_LR_SPACE, *pColl );
1234cdf0e10cSrcweir }
1235cdf0e10cSrcweir // <--
1236cdf0e10cSrcweir
1237cdf0e10cSrcweir // #i56252: If a standard numbering style is assigned to a standard paragraph style
1238cdf0e10cSrcweir // we have to create a physical instance of the numbering style. If we do not and
1239cdf0e10cSrcweir // neither the paragraph style nor the numbering style is used in the document
1240cdf0e10cSrcweir // the numbering style will not be saved with the document and the assignment got lost.
1241cdf0e10cSrcweir const SfxPoolItem* pNumRuleItem = 0;
1242cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE, sal_False, &pNumRuleItem ) )
1243cdf0e10cSrcweir { // Setting a numbering rule?
1244cdf0e10cSrcweir String sNumRule = ((SwNumRuleItem*)pNumRuleItem)->GetValue();
1245cdf0e10cSrcweir if( sNumRule.Len() )
1246cdf0e10cSrcweir {
1247cdf0e10cSrcweir SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1248cdf0e10cSrcweir if( !pRule )
1249cdf0e10cSrcweir { // Numbering rule not in use yet.
1250cdf0e10cSrcweir sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
1251cdf0e10cSrcweir if( USHRT_MAX != nPoolId ) // It's a standard numbering rule
1252cdf0e10cSrcweir {
1253cdf0e10cSrcweir pRule = rDoc.GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical)
1254cdf0e10cSrcweir }
1255cdf0e10cSrcweir }
1256cdf0e10cSrcweir }
1257cdf0e10cSrcweir }
1258cdf0e10cSrcweir
1259cdf0e10cSrcweir pFmt = pColl;
1260cdf0e10cSrcweir
1261cdf0e10cSrcweir sal_uInt16 nId = pColl->GetPoolFmtId() &
1262cdf0e10cSrcweir ~ ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID );
1263cdf0e10cSrcweir switch( GetMask() & ( 0x0fff & ~SWSTYLEBIT_CONDCOLL ) )
1264cdf0e10cSrcweir {
1265cdf0e10cSrcweir case SWSTYLEBIT_TEXT:
1266cdf0e10cSrcweir nId |= COLL_TEXT_BITS;
1267cdf0e10cSrcweir break;
1268cdf0e10cSrcweir case SWSTYLEBIT_CHAPTER:
1269cdf0e10cSrcweir nId |= COLL_DOC_BITS;
1270cdf0e10cSrcweir break;
1271cdf0e10cSrcweir case SWSTYLEBIT_LIST:
1272cdf0e10cSrcweir nId |= COLL_LISTS_BITS;
1273cdf0e10cSrcweir break;
1274cdf0e10cSrcweir case SWSTYLEBIT_IDX:
1275cdf0e10cSrcweir nId |= COLL_REGISTER_BITS;
1276cdf0e10cSrcweir break;
1277cdf0e10cSrcweir case SWSTYLEBIT_EXTRA:
1278cdf0e10cSrcweir nId |= COLL_EXTRA_BITS;
1279cdf0e10cSrcweir break;
1280cdf0e10cSrcweir case SWSTYLEBIT_HTML:
1281cdf0e10cSrcweir nId |= COLL_HTML_BITS;
1282cdf0e10cSrcweir break;
1283cdf0e10cSrcweir }
1284cdf0e10cSrcweir pColl->SetPoolFmtId( nId );
1285cdf0e10cSrcweir break;
1286cdf0e10cSrcweir }
1287cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
1288cdf0e10cSrcweir {
1289cdf0e10cSrcweir ASSERT(pFrmFmt, "Wo ist das FrmFmt");
1290cdf0e10cSrcweir const SfxPoolItem* pAutoUpdate;
1291cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,sal_False, &pAutoUpdate ))
1292cdf0e10cSrcweir {
1293cdf0e10cSrcweir pFrmFmt->SetAutoUpdateFmt(((const SfxBoolItem*)pAutoUpdate)->GetValue());
1294cdf0e10cSrcweir }
1295cdf0e10cSrcweir pFmt = pFrmFmt;
1296cdf0e10cSrcweir }
1297cdf0e10cSrcweir break;
1298cdf0e10cSrcweir
1299cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE :
1300cdf0e10cSrcweir {
1301cdf0e10cSrcweir ASSERT(pDesc, "Wo ist der PageDescriptor");
1302cdf0e10cSrcweir
1303cdf0e10cSrcweir if( rDoc.FindPageDescByName( pDesc->GetName(), &nPgDscPos ))
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir pNewDsc = new SwPageDesc( *pDesc );
1306cdf0e10cSrcweir // --> OD 2005-05-09 #i48949# - no undo actions for the
1307cdf0e10cSrcweir // copy of the page style
1308cdf0e10cSrcweir ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1309cdf0e10cSrcweir rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983#
1310cdf0e10cSrcweir // <--
1311cdf0e10cSrcweir
1312cdf0e10cSrcweir pFmt = &pNewDsc->GetMaster();
1313cdf0e10cSrcweir }
1314cdf0e10cSrcweir }
1315cdf0e10cSrcweir break;
1316cdf0e10cSrcweir
1317cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1318cdf0e10cSrcweir {
1319cdf0e10cSrcweir ASSERT(pNumRule, "Wo ist die NumRule");
1320cdf0e10cSrcweir
1321cdf0e10cSrcweir if (!pNumRule)
1322cdf0e10cSrcweir break;
1323cdf0e10cSrcweir
1324cdf0e10cSrcweir const SfxPoolItem* pItem;
1325cdf0e10cSrcweir switch( rSet.GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem ))
1326cdf0e10cSrcweir {
1327cdf0e10cSrcweir case SFX_ITEM_SET:
1328cdf0e10cSrcweir {
1329cdf0e10cSrcweir SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
1330cdf0e10cSrcweir pSetRule->UnLinkGraphics();
1331cdf0e10cSrcweir //SwNumRule aSetRule(rDoc.GetUniqueNumRuleName());
1332cdf0e10cSrcweir SwNumRule aSetRule(*pNumRule);
1333cdf0e10cSrcweir aSetRule.SetSvxRule(*pSetRule, &rDoc);
1334cdf0e10cSrcweir rDoc.ChgNumRuleFmts( aSetRule );
1335cdf0e10cSrcweir }
1336cdf0e10cSrcweir break;
1337cdf0e10cSrcweir case SFX_ITEM_DONTCARE:
1338cdf0e10cSrcweir // NumRule auf default Werte
1339cdf0e10cSrcweir // was sind die default Werte?
1340cdf0e10cSrcweir {
1341cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs#
1342cdf0e10cSrcweir SwNumRule aRule( pNumRule->GetName(),
1343cdf0e10cSrcweir // --> OD 2008-06-06 #i89178#
1344cdf0e10cSrcweir numfunc::GetDefaultPositionAndSpaceMode() );
1345cdf0e10cSrcweir // <--
1346cdf0e10cSrcweir // <--
1347cdf0e10cSrcweir rDoc.ChgNumRuleFmts( aRule );
1348cdf0e10cSrcweir }
1349cdf0e10cSrcweir break;
1350cdf0e10cSrcweir }
1351cdf0e10cSrcweir }
1352cdf0e10cSrcweir break;
1353cdf0e10cSrcweir
1354cdf0e10cSrcweir default:
1355cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
1356cdf0e10cSrcweir }
1357cdf0e10cSrcweir
1358cdf0e10cSrcweir if( pFmt && rSet.Count())
1359cdf0e10cSrcweir {
1360cdf0e10cSrcweir SfxItemIter aIter( rSet );
1361cdf0e10cSrcweir const SfxPoolItem* pItem = aIter.GetCurItem();
1362cdf0e10cSrcweir while( sal_True )
1363cdf0e10cSrcweir {
1364cdf0e10cSrcweir if( IsInvalidItem( pItem ) ) // Clearen
1365cdf0e10cSrcweir {
1366cdf0e10cSrcweir // --> OD 2008-02-12 #newlistlevelattrs#
1367cdf0e10cSrcweir // use method <SwDoc::ResetAttrAtFormat(..)> in order to
1368cdf0e10cSrcweir // create an Undo object for the attribute reset.
1369cdf0e10cSrcweir // pFmt->ResetAttr( rSet.GetWhichByPos(aIter.GetCurPos()));
1370cdf0e10cSrcweir rDoc.ResetAttrAtFormat( rSet.GetWhichByPos(aIter.GetCurPos()),
1371cdf0e10cSrcweir *pFmt );
1372cdf0e10cSrcweir }
1373cdf0e10cSrcweir
1374cdf0e10cSrcweir if( aIter.IsAtEnd() )
1375cdf0e10cSrcweir break;
1376cdf0e10cSrcweir pItem = aIter.NextItem();
1377cdf0e10cSrcweir }
1378cdf0e10cSrcweir SfxItemSet aSet(rSet);
1379cdf0e10cSrcweir aSet.ClearInvalidItems();
1380cdf0e10cSrcweir
1381cdf0e10cSrcweir aCoreSet.ClearItem();
1382cdf0e10cSrcweir
1383cdf0e10cSrcweir if( pNewDsc )
1384cdf0e10cSrcweir {
1385cdf0e10cSrcweir ::ItemSetToPageDesc( aSet, *pNewDsc );
1386cdf0e10cSrcweir rDoc.ChgPageDesc( nPgDscPos, *pNewDsc );
1387cdf0e10cSrcweir pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc( nPgDscPos );
1388cdf0e10cSrcweir rDoc.PreDelPageDesc(pNewDsc); // #i7983#
1389cdf0e10cSrcweir delete pNewDsc;
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir else
1392cdf0e10cSrcweir rDoc.ChgFmt(*pFmt, aSet); // alles gesetzten Putten
1393cdf0e10cSrcweir }
1394cdf0e10cSrcweir else
1395cdf0e10cSrcweir {
1396cdf0e10cSrcweir aCoreSet.ClearItem();
1397cdf0e10cSrcweir if( pNewDsc ) // den muessen wir noch vernichten!!
1398cdf0e10cSrcweir {
1399cdf0e10cSrcweir rDoc.PreDelPageDesc(pNewDsc); // #i7983#
1400cdf0e10cSrcweir delete pNewDsc;
1401cdf0e10cSrcweir }
1402cdf0e10cSrcweir }
1403cdf0e10cSrcweir
1404cdf0e10cSrcweir // --> OD 2008-02-12 #newlistlevelattrs#
1405cdf0e10cSrcweir if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1406cdf0e10cSrcweir {
1407cdf0e10cSrcweir rDoc.GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
1408cdf0e10cSrcweir }
1409cdf0e10cSrcweir // <--
1410cdf0e10cSrcweir }
1411cdf0e10cSrcweir
lcl_SaveStyles(sal_uInt16 nFamily,SvPtrarr & rArr,SwDoc & rDoc)1412cdf0e10cSrcweir void lcl_SaveStyles( sal_uInt16 nFamily, SvPtrarr& rArr, SwDoc& rDoc )
1413cdf0e10cSrcweir {
1414cdf0e10cSrcweir switch( nFamily )
1415cdf0e10cSrcweir {
1416cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR:
1417cdf0e10cSrcweir {
1418cdf0e10cSrcweir const SwCharFmts& rTbl = *rDoc.GetCharFmts();
1419cdf0e10cSrcweir for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir void* p = (void*)rTbl[ n ];
1422cdf0e10cSrcweir rArr.Insert( p, n );
1423cdf0e10cSrcweir }
1424cdf0e10cSrcweir }
1425cdf0e10cSrcweir break;
1426cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA:
1427cdf0e10cSrcweir {
1428cdf0e10cSrcweir const SwTxtFmtColls& rTbl = *rDoc.GetTxtFmtColls();
1429cdf0e10cSrcweir for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
1430cdf0e10cSrcweir {
1431cdf0e10cSrcweir void* p = (void*)rTbl[ n ];
1432cdf0e10cSrcweir rArr.Insert( p, n );
1433cdf0e10cSrcweir }
1434cdf0e10cSrcweir }
1435cdf0e10cSrcweir break;
1436cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
1437cdf0e10cSrcweir {
1438cdf0e10cSrcweir const SwFrmFmts& rTbl = *rDoc.GetFrmFmts();
1439cdf0e10cSrcweir for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
1440cdf0e10cSrcweir {
1441cdf0e10cSrcweir void* p = (void*)rTbl[ n ];
1442cdf0e10cSrcweir rArr.Insert( p, n );
1443cdf0e10cSrcweir }
1444cdf0e10cSrcweir }
1445cdf0e10cSrcweir break;
1446cdf0e10cSrcweir
1447cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
1448cdf0e10cSrcweir {
1449cdf0e10cSrcweir for( sal_uInt16 n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1450cdf0e10cSrcweir {
1451cdf0e10cSrcweir void* p =
1452cdf0e10cSrcweir (void*)&const_cast<const SwDoc &>(rDoc).GetPageDesc( n );
1453cdf0e10cSrcweir rArr.Insert( p, n );
1454cdf0e10cSrcweir }
1455cdf0e10cSrcweir }
1456cdf0e10cSrcweir break;
1457cdf0e10cSrcweir
1458cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1459cdf0e10cSrcweir {
1460cdf0e10cSrcweir const SwNumRuleTbl& rTbl = rDoc.GetNumRuleTbl();
1461cdf0e10cSrcweir for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
1462cdf0e10cSrcweir {
1463cdf0e10cSrcweir void* p = (void*)rTbl[ n ];
1464cdf0e10cSrcweir rArr.Insert( p, n );
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir }
1467cdf0e10cSrcweir break;
1468cdf0e10cSrcweir }
1469cdf0e10cSrcweir }
1470cdf0e10cSrcweir
lcl_DeleteInfoStyles(sal_uInt16 nFamily,SvPtrarr & rArr,SwDoc & rDoc)1471cdf0e10cSrcweir void lcl_DeleteInfoStyles( sal_uInt16 nFamily, SvPtrarr& rArr, SwDoc& rDoc )
1472cdf0e10cSrcweir {
1473cdf0e10cSrcweir sal_uInt16 n, nCnt;
1474cdf0e10cSrcweir switch( nFamily )
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR:
1477cdf0e10cSrcweir {
1478cdf0e10cSrcweir SvUShorts aDelArr;
1479cdf0e10cSrcweir const SwCharFmts& rTbl = *rDoc.GetCharFmts();
1480cdf0e10cSrcweir for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
1481cdf0e10cSrcweir {
1482cdf0e10cSrcweir void* p = (void*)rTbl[ n ];
1483cdf0e10cSrcweir if( USHRT_MAX == rArr.GetPos( p ))
1484cdf0e10cSrcweir aDelArr.Insert( n, 0 );
1485cdf0e10cSrcweir }
1486cdf0e10cSrcweir for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
1487cdf0e10cSrcweir rDoc.DelCharFmt( aDelArr[ n ] );
1488cdf0e10cSrcweir }
1489cdf0e10cSrcweir break;
1490cdf0e10cSrcweir
1491cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
1492cdf0e10cSrcweir {
1493cdf0e10cSrcweir SvUShorts aDelArr;
1494cdf0e10cSrcweir const SwTxtFmtColls& rTbl = *rDoc.GetTxtFmtColls();
1495cdf0e10cSrcweir for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
1496cdf0e10cSrcweir {
1497cdf0e10cSrcweir void* p = (void*)rTbl[ n ];
1498cdf0e10cSrcweir if( USHRT_MAX == rArr.GetPos( p ))
1499cdf0e10cSrcweir aDelArr.Insert( n, 0 );
1500cdf0e10cSrcweir }
1501cdf0e10cSrcweir for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
1502cdf0e10cSrcweir rDoc.DelTxtFmtColl( aDelArr[ n ] );
1503cdf0e10cSrcweir }
1504cdf0e10cSrcweir break;
1505cdf0e10cSrcweir
1506cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
1507cdf0e10cSrcweir {
1508cdf0e10cSrcweir SvPtrarr aDelArr;
1509cdf0e10cSrcweir const SwFrmFmts& rTbl = *rDoc.GetFrmFmts();
1510cdf0e10cSrcweir for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
1511cdf0e10cSrcweir {
1512cdf0e10cSrcweir void* p = (void*)rTbl[ n ];
1513cdf0e10cSrcweir if( USHRT_MAX == rArr.GetPos( p ))
1514cdf0e10cSrcweir aDelArr.Insert( p, 0 );
1515cdf0e10cSrcweir }
1516cdf0e10cSrcweir for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
1517cdf0e10cSrcweir rDoc.DelFrmFmt( (SwFrmFmt*)aDelArr[ n ] );
1518cdf0e10cSrcweir }
1519cdf0e10cSrcweir break;
1520cdf0e10cSrcweir
1521cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
1522cdf0e10cSrcweir {
1523cdf0e10cSrcweir SvUShorts aDelArr;
1524cdf0e10cSrcweir for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1525cdf0e10cSrcweir {
1526cdf0e10cSrcweir void* p =
1527cdf0e10cSrcweir (void*)&const_cast<const SwDoc &>(rDoc).GetPageDesc( n );
1528cdf0e10cSrcweir if( USHRT_MAX == rArr.GetPos( p ))
1529cdf0e10cSrcweir aDelArr.Insert( n, 0 );
1530cdf0e10cSrcweir }
1531cdf0e10cSrcweir for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
1532cdf0e10cSrcweir rDoc.DelPageDesc( aDelArr[ n ] );
1533cdf0e10cSrcweir }
1534cdf0e10cSrcweir break;
1535cdf0e10cSrcweir
1536cdf0e10cSrcweir
1537cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1538cdf0e10cSrcweir {
1539cdf0e10cSrcweir SvPtrarr aDelArr;
1540cdf0e10cSrcweir const SwNumRuleTbl& rTbl = rDoc.GetNumRuleTbl();
1541cdf0e10cSrcweir for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
1542cdf0e10cSrcweir {
1543cdf0e10cSrcweir void* p = (void*)rTbl[ n ];
1544cdf0e10cSrcweir if( USHRT_MAX == rArr.GetPos( p ))
1545cdf0e10cSrcweir aDelArr.Insert( p, 0 );
1546cdf0e10cSrcweir }
1547cdf0e10cSrcweir for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
1548cdf0e10cSrcweir rDoc.DelNumRule( ((SwNumRule*)aDelArr[ n ])->GetName() );
1549cdf0e10cSrcweir }
1550cdf0e10cSrcweir break;
1551cdf0e10cSrcweir }
1552cdf0e10cSrcweir }
1553cdf0e10cSrcweir
1554cdf0e10cSrcweir /*--------------------------------------------------------------------
1555cdf0e10cSrcweir Beschreibung: Das Format ermitteln
1556cdf0e10cSrcweir --------------------------------------------------------------------*/
1557cdf0e10cSrcweir
FillStyleSheet(FillStyleType eFType)1558cdf0e10cSrcweir sal_Bool SwDocStyleSheet::FillStyleSheet( FillStyleType eFType )
1559cdf0e10cSrcweir {
1560cdf0e10cSrcweir sal_Bool bRet = sal_False;
1561cdf0e10cSrcweir sal_uInt16 nPoolId = USHRT_MAX;
1562cdf0e10cSrcweir SwFmt* pFmt = 0;
1563cdf0e10cSrcweir
1564cdf0e10cSrcweir sal_Bool bCreate = FillPhysical == eFType;
1565cdf0e10cSrcweir sal_Bool bDeleteInfo = sal_False;
1566cdf0e10cSrcweir sal_Bool bFillOnlyInfo = FillAllInfo == eFType;
1567cdf0e10cSrcweir SvPtrarr aDelArr;
1568cdf0e10cSrcweir
1569cdf0e10cSrcweir switch(nFamily)
1570cdf0e10cSrcweir {
1571cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR:
1572cdf0e10cSrcweir pCharFmt = lcl_FindCharFmt(rDoc, aName, this, bCreate );
1573cdf0e10cSrcweir bPhysical = 0 != pCharFmt;
1574cdf0e10cSrcweir if( bFillOnlyInfo && !bPhysical )
1575cdf0e10cSrcweir {
1576cdf0e10cSrcweir bDeleteInfo = sal_True;
1577cdf0e10cSrcweir ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, rDoc );
1578cdf0e10cSrcweir pCharFmt = lcl_FindCharFmt(rDoc, aName, this, sal_True );
1579cdf0e10cSrcweir }
1580cdf0e10cSrcweir
1581cdf0e10cSrcweir pFmt = pCharFmt;
1582cdf0e10cSrcweir if( !bCreate && !pFmt )
1583cdf0e10cSrcweir {
1584cdf0e10cSrcweir if( aName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
1585cdf0e10cSrcweir RES_POOLCOLL_TEXT_BEGIN ] )
1586cdf0e10cSrcweir nPoolId = 0;
1587cdf0e10cSrcweir else
1588cdf0e10cSrcweir nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
1589cdf0e10cSrcweir }
1590cdf0e10cSrcweir
1591cdf0e10cSrcweir bRet = 0 != pCharFmt || USHRT_MAX != nPoolId;
1592cdf0e10cSrcweir
1593cdf0e10cSrcweir if( bDeleteInfo )
1594cdf0e10cSrcweir pCharFmt = 0;
1595cdf0e10cSrcweir break;
1596cdf0e10cSrcweir
1597cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA:
1598cdf0e10cSrcweir {
1599cdf0e10cSrcweir pColl = lcl_FindParaFmt(rDoc, aName, this, bCreate);
1600cdf0e10cSrcweir bPhysical = 0 != pColl;
1601cdf0e10cSrcweir if( bFillOnlyInfo && !bPhysical )
1602cdf0e10cSrcweir {
1603cdf0e10cSrcweir bDeleteInfo = sal_True;
1604cdf0e10cSrcweir ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, rDoc );
1605cdf0e10cSrcweir pColl = lcl_FindParaFmt(rDoc, aName, this, sal_True );
1606cdf0e10cSrcweir }
1607cdf0e10cSrcweir
1608cdf0e10cSrcweir pFmt = pColl;
1609cdf0e10cSrcweir if( pColl )
1610cdf0e10cSrcweir PresetFollow( pColl->GetNextTxtFmtColl().GetName() );
1611cdf0e10cSrcweir else if( !bCreate )
1612cdf0e10cSrcweir nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
1613cdf0e10cSrcweir
1614cdf0e10cSrcweir bRet = 0 != pColl || USHRT_MAX != nPoolId;
1615cdf0e10cSrcweir
1616cdf0e10cSrcweir if( bDeleteInfo )
1617cdf0e10cSrcweir pColl = 0;
1618cdf0e10cSrcweir }
1619cdf0e10cSrcweir break;
1620cdf0e10cSrcweir
1621cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
1622cdf0e10cSrcweir pFrmFmt = lcl_FindFrmFmt(rDoc, aName, this, bCreate);
1623cdf0e10cSrcweir bPhysical = 0 != pFrmFmt;
1624cdf0e10cSrcweir if( bFillOnlyInfo && bPhysical )
1625cdf0e10cSrcweir {
1626cdf0e10cSrcweir bDeleteInfo = sal_True;
1627cdf0e10cSrcweir ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, rDoc );
1628cdf0e10cSrcweir pFrmFmt = lcl_FindFrmFmt(rDoc, aName, this, sal_True );
1629cdf0e10cSrcweir }
1630cdf0e10cSrcweir pFmt = pFrmFmt;
1631cdf0e10cSrcweir if( !bCreate && !pFmt )
1632cdf0e10cSrcweir nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT );
1633cdf0e10cSrcweir
1634cdf0e10cSrcweir bRet = 0 != pFrmFmt || USHRT_MAX != nPoolId;
1635cdf0e10cSrcweir
1636cdf0e10cSrcweir if( bDeleteInfo )
1637cdf0e10cSrcweir pFrmFmt = 0;
1638cdf0e10cSrcweir break;
1639cdf0e10cSrcweir
1640cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
1641cdf0e10cSrcweir pDesc = lcl_FindPageDesc(rDoc, aName, this, bCreate);
1642cdf0e10cSrcweir bPhysical = 0 != pDesc;
1643cdf0e10cSrcweir if( bFillOnlyInfo && !pDesc )
1644cdf0e10cSrcweir {
1645cdf0e10cSrcweir bDeleteInfo = sal_True;
1646cdf0e10cSrcweir ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, rDoc );
1647cdf0e10cSrcweir pDesc = lcl_FindPageDesc( rDoc, aName, this, sal_True );
1648cdf0e10cSrcweir }
1649cdf0e10cSrcweir
1650cdf0e10cSrcweir if( pDesc )
1651cdf0e10cSrcweir {
1652cdf0e10cSrcweir nPoolId = pDesc->GetPoolFmtId();
1653cdf0e10cSrcweir nHelpId = pDesc->GetPoolHelpId();
1654cdf0e10cSrcweir if( pDesc->GetPoolHlpFileId() != UCHAR_MAX )
1655cdf0e10cSrcweir aHelpFile = *rDoc.GetDocPattern( pDesc->GetPoolHlpFileId() );
1656cdf0e10cSrcweir else
1657cdf0e10cSrcweir aHelpFile.Erase();
1658cdf0e10cSrcweir }
1659cdf0e10cSrcweir else if( !bCreate )
1660cdf0e10cSrcweir nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
1661cdf0e10cSrcweir SetMask( USER_FMT & nPoolId ? SFXSTYLEBIT_USERDEF : 0 );
1662cdf0e10cSrcweir
1663cdf0e10cSrcweir bRet = 0 != pDesc || USHRT_MAX != nPoolId;
1664cdf0e10cSrcweir if( bDeleteInfo )
1665cdf0e10cSrcweir pDesc = 0;
1666cdf0e10cSrcweir break;
1667cdf0e10cSrcweir
1668cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1669cdf0e10cSrcweir pNumRule = lcl_FindNumRule(rDoc, aName, this, bCreate);
1670cdf0e10cSrcweir bPhysical = 0 != pNumRule;
1671cdf0e10cSrcweir if( bFillOnlyInfo && !pNumRule )
1672cdf0e10cSrcweir {
1673cdf0e10cSrcweir bDeleteInfo = sal_True;
1674cdf0e10cSrcweir ::lcl_SaveStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, rDoc );
1675cdf0e10cSrcweir pNumRule = lcl_FindNumRule( rDoc, aName, this, sal_True );
1676cdf0e10cSrcweir }
1677cdf0e10cSrcweir
1678cdf0e10cSrcweir if( pNumRule )
1679cdf0e10cSrcweir {
1680cdf0e10cSrcweir nPoolId = pNumRule->GetPoolFmtId();
1681cdf0e10cSrcweir nHelpId = pNumRule->GetPoolHelpId();
1682cdf0e10cSrcweir if( pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
1683cdf0e10cSrcweir aHelpFile = *rDoc.GetDocPattern( pNumRule->GetPoolHlpFileId() );
1684cdf0e10cSrcweir else
1685cdf0e10cSrcweir aHelpFile.Erase();
1686cdf0e10cSrcweir }
1687cdf0e10cSrcweir else if( !bCreate )
1688cdf0e10cSrcweir nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
1689cdf0e10cSrcweir SetMask( USER_FMT & nPoolId ? SFXSTYLEBIT_USERDEF : 0 );
1690cdf0e10cSrcweir
1691cdf0e10cSrcweir bRet = 0 != pNumRule || USHRT_MAX != nPoolId;
1692cdf0e10cSrcweir
1693cdf0e10cSrcweir if( bDeleteInfo )
1694cdf0e10cSrcweir pNumRule = 0;
1695cdf0e10cSrcweir break;
1696cdf0e10cSrcweir default:; //prevent warning
1697cdf0e10cSrcweir }
1698cdf0e10cSrcweir
1699cdf0e10cSrcweir if( SFX_STYLE_FAMILY_CHAR == nFamily ||
1700cdf0e10cSrcweir SFX_STYLE_FAMILY_PARA == nFamily ||
1701cdf0e10cSrcweir SFX_STYLE_FAMILY_FRAME == nFamily )
1702cdf0e10cSrcweir {
1703cdf0e10cSrcweir if( pFmt )
1704cdf0e10cSrcweir nPoolId = pFmt->GetPoolFmtId();
1705cdf0e10cSrcweir
1706cdf0e10cSrcweir sal_uInt16 _nMask = 0;
1707cdf0e10cSrcweir if( pFmt == rDoc.GetDfltCharFmt() )
1708cdf0e10cSrcweir _nMask |= SFXSTYLEBIT_READONLY;
1709cdf0e10cSrcweir else if( USER_FMT & nPoolId )
1710cdf0e10cSrcweir _nMask |= SFXSTYLEBIT_USERDEF;
1711cdf0e10cSrcweir
1712cdf0e10cSrcweir switch ( COLL_GET_RANGE_BITS & nPoolId )
1713cdf0e10cSrcweir {
1714cdf0e10cSrcweir case COLL_TEXT_BITS: _nMask |= SWSTYLEBIT_TEXT; break;
1715cdf0e10cSrcweir case COLL_DOC_BITS : _nMask |= SWSTYLEBIT_CHAPTER; break;
1716cdf0e10cSrcweir case COLL_LISTS_BITS: _nMask |= SWSTYLEBIT_LIST; break;
1717cdf0e10cSrcweir case COLL_REGISTER_BITS: _nMask |= SWSTYLEBIT_IDX; break;
1718cdf0e10cSrcweir case COLL_EXTRA_BITS: _nMask |= SWSTYLEBIT_EXTRA; break;
1719cdf0e10cSrcweir case COLL_HTML_BITS: _nMask |= SWSTYLEBIT_HTML; break;
1720cdf0e10cSrcweir }
1721cdf0e10cSrcweir
1722cdf0e10cSrcweir if( pFmt )
1723cdf0e10cSrcweir {
1724cdf0e10cSrcweir ASSERT( bPhysical, "Format nicht gefunden" );
1725cdf0e10cSrcweir
1726cdf0e10cSrcweir nHelpId = pFmt->GetPoolHelpId();
1727cdf0e10cSrcweir if( pFmt->GetPoolHlpFileId() != UCHAR_MAX )
1728cdf0e10cSrcweir aHelpFile = *rDoc.GetDocPattern( pFmt->GetPoolHlpFileId() );
1729cdf0e10cSrcweir else
1730cdf0e10cSrcweir aHelpFile.Erase();
1731cdf0e10cSrcweir
1732cdf0e10cSrcweir if( RES_CONDTXTFMTCOLL == pFmt->Which() )
1733cdf0e10cSrcweir _nMask |= SWSTYLEBIT_CONDCOLL;
1734cdf0e10cSrcweir }
1735cdf0e10cSrcweir
1736cdf0e10cSrcweir SetMask( _nMask );
1737cdf0e10cSrcweir }
1738cdf0e10cSrcweir if( bDeleteInfo && bFillOnlyInfo )
1739cdf0e10cSrcweir ::lcl_DeleteInfoStyles( static_cast< sal_uInt16 >(nFamily), aDelArr, rDoc );
1740cdf0e10cSrcweir return bRet;
1741cdf0e10cSrcweir }
1742cdf0e10cSrcweir
1743cdf0e10cSrcweir /*--------------------------------------------------------------------
1744cdf0e10cSrcweir Beschreibung: Neues Format in der Core anlegen
1745cdf0e10cSrcweir --------------------------------------------------------------------*/
1746cdf0e10cSrcweir
1747cdf0e10cSrcweir
Create()1748cdf0e10cSrcweir void SwDocStyleSheet::Create()
1749cdf0e10cSrcweir {
1750cdf0e10cSrcweir switch(nFamily)
1751cdf0e10cSrcweir {
1752cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
1753cdf0e10cSrcweir pCharFmt = lcl_FindCharFmt( rDoc, aName );
1754cdf0e10cSrcweir if( !pCharFmt )
1755cdf0e10cSrcweir pCharFmt = rDoc.MakeCharFmt(aName,
1756cdf0e10cSrcweir rDoc.GetDfltCharFmt());
1757cdf0e10cSrcweir pCharFmt->SetAuto( sal_False );
1758cdf0e10cSrcweir break;
1759cdf0e10cSrcweir
1760cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
1761cdf0e10cSrcweir pColl = lcl_FindParaFmt( rDoc, aName );
1762cdf0e10cSrcweir if( !pColl )
1763cdf0e10cSrcweir {
1764cdf0e10cSrcweir SwTxtFmtColl *pPar = (*rDoc.GetTxtFmtColls())[0];
1765cdf0e10cSrcweir if( nMask & SWSTYLEBIT_CONDCOLL )
1766cdf0e10cSrcweir pColl = rDoc.MakeCondTxtFmtColl( aName, pPar );
1767cdf0e10cSrcweir else
1768cdf0e10cSrcweir pColl = rDoc.MakeTxtFmtColl( aName, pPar );
1769cdf0e10cSrcweir }
1770cdf0e10cSrcweir break;
1771cdf0e10cSrcweir
1772cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
1773cdf0e10cSrcweir pFrmFmt = lcl_FindFrmFmt( rDoc, aName );
1774cdf0e10cSrcweir if( !pFrmFmt )
1775cdf0e10cSrcweir pFrmFmt = rDoc.MakeFrmFmt(aName, rDoc.GetDfltFrmFmt(), sal_False, sal_False);
1776cdf0e10cSrcweir
1777cdf0e10cSrcweir break;
1778cdf0e10cSrcweir
1779cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE :
1780cdf0e10cSrcweir pDesc = lcl_FindPageDesc( rDoc, aName );
1781cdf0e10cSrcweir if( !pDesc )
1782cdf0e10cSrcweir {
1783cdf0e10cSrcweir sal_uInt16 nId = rDoc.MakePageDesc(aName);
1784cdf0e10cSrcweir pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc(nId);
1785cdf0e10cSrcweir }
1786cdf0e10cSrcweir break;
1787cdf0e10cSrcweir
1788cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1789cdf0e10cSrcweir pNumRule = lcl_FindNumRule( rDoc, aName );
1790cdf0e10cSrcweir if( !pNumRule )
1791cdf0e10cSrcweir {
1792cdf0e10cSrcweir //JP 05.02.99: temp Namen erzeugen, damit kein ASSERT kommt
1793cdf0e10cSrcweir String sTmpNm( aName );
1794cdf0e10cSrcweir if( !aName.Len() )
1795cdf0e10cSrcweir sTmpNm = rDoc.GetUniqueNumRuleName();
1796cdf0e10cSrcweir
1797cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs#
1798cdf0e10cSrcweir SwNumRule* pRule = rDoc.GetNumRuleTbl()[
1799cdf0e10cSrcweir rDoc.MakeNumRule( sTmpNm, 0, sal_False,
1800cdf0e10cSrcweir // --> OD 2008-06-06 #i89178#
1801cdf0e10cSrcweir numfunc::GetDefaultPositionAndSpaceMode() ) ];
1802cdf0e10cSrcweir // <--
1803cdf0e10cSrcweir // <--
1804cdf0e10cSrcweir pRule->SetAutoRule( sal_False );
1805cdf0e10cSrcweir if( !aName.Len() )
1806cdf0e10cSrcweir {
1807cdf0e10cSrcweir // --> OD 2008-07-08 #i91400#
1808cdf0e10cSrcweir pRule->SetName( aName, rDoc );
1809cdf0e10cSrcweir // <--
1810cdf0e10cSrcweir }
1811cdf0e10cSrcweir pNumRule = pRule;
1812cdf0e10cSrcweir }
1813cdf0e10cSrcweir break;
1814cdf0e10cSrcweir default:; //prevent warning
1815cdf0e10cSrcweir }
1816cdf0e10cSrcweir bPhysical = sal_True;
1817cdf0e10cSrcweir aCoreSet.ClearItem();
1818cdf0e10cSrcweir }
1819cdf0e10cSrcweir
1820cdf0e10cSrcweir /*--------------------------------------------------------------------
1821cdf0e10cSrcweir Beschreibung: Konkrete Formate rausholen
1822cdf0e10cSrcweir --------------------------------------------------------------------*/
1823cdf0e10cSrcweir
1824cdf0e10cSrcweir
1825cdf0e10cSrcweir
GetCharFmt()1826cdf0e10cSrcweir SwCharFmt* SwDocStyleSheet::GetCharFmt()
1827cdf0e10cSrcweir {
1828cdf0e10cSrcweir if(!bPhysical)
1829cdf0e10cSrcweir FillStyleSheet( FillPhysical );
1830cdf0e10cSrcweir return pCharFmt;
1831cdf0e10cSrcweir }
1832cdf0e10cSrcweir
1833cdf0e10cSrcweir
GetCollection()1834cdf0e10cSrcweir SwTxtFmtColl* SwDocStyleSheet::GetCollection()
1835cdf0e10cSrcweir {
1836cdf0e10cSrcweir if(!bPhysical)
1837cdf0e10cSrcweir FillStyleSheet( FillPhysical );
1838cdf0e10cSrcweir return pColl;
1839cdf0e10cSrcweir }
1840cdf0e10cSrcweir
1841cdf0e10cSrcweir
GetPageDesc()1842cdf0e10cSrcweir const SwPageDesc* SwDocStyleSheet::GetPageDesc()
1843cdf0e10cSrcweir {
1844cdf0e10cSrcweir if(!bPhysical)
1845cdf0e10cSrcweir FillStyleSheet( FillPhysical );
1846cdf0e10cSrcweir return pDesc;
1847cdf0e10cSrcweir }
1848cdf0e10cSrcweir
GetNumRule()1849cdf0e10cSrcweir const SwNumRule * SwDocStyleSheet::GetNumRule()
1850cdf0e10cSrcweir {
1851cdf0e10cSrcweir if(!bPhysical)
1852cdf0e10cSrcweir FillStyleSheet( FillPhysical );
1853cdf0e10cSrcweir return pNumRule;
1854cdf0e10cSrcweir }
1855cdf0e10cSrcweir
SetNumRule(const SwNumRule & rRule)1856cdf0e10cSrcweir void SwDocStyleSheet::SetNumRule(const SwNumRule& rRule)
1857cdf0e10cSrcweir {
1858cdf0e10cSrcweir DBG_ASSERT(pNumRule, "Wo ist die NumRule");
1859cdf0e10cSrcweir rDoc.ChgNumRuleFmts( rRule );
1860cdf0e10cSrcweir }
1861cdf0e10cSrcweir
1862cdf0e10cSrcweir // Namen UND Familie aus String re-generieren
1863cdf0e10cSrcweir // First() und Next() (s.u.) fuegen einen Kennbuchstaben an Pos.1 ein
1864cdf0e10cSrcweir
PresetNameAndFamily(const String & rName)1865cdf0e10cSrcweir void SwDocStyleSheet::PresetNameAndFamily(const String& rName)
1866cdf0e10cSrcweir {
1867cdf0e10cSrcweir switch( rName.GetChar(0) )
1868cdf0e10cSrcweir {
1869cdf0e10cSrcweir case cPARA: nFamily = SFX_STYLE_FAMILY_PARA; break;
1870cdf0e10cSrcweir case cFRAME: nFamily = SFX_STYLE_FAMILY_FRAME; break;
1871cdf0e10cSrcweir case cPAGE: nFamily = SFX_STYLE_FAMILY_PAGE; break;
1872cdf0e10cSrcweir case cNUMRULE: nFamily = SFX_STYLE_FAMILY_PSEUDO; break;
1873cdf0e10cSrcweir default: nFamily = SFX_STYLE_FAMILY_CHAR; break;
1874cdf0e10cSrcweir }
1875cdf0e10cSrcweir aName = rName;
1876cdf0e10cSrcweir aName.Erase( 0, 1 );
1877cdf0e10cSrcweir }
1878cdf0e10cSrcweir
1879cdf0e10cSrcweir /*--------------------------------------------------------------------
1880cdf0e10cSrcweir Beschreibung: Ist das Format physikalisch schon vorhanden
1881cdf0e10cSrcweir --------------------------------------------------------------------*/
1882cdf0e10cSrcweir
1883cdf0e10cSrcweir
SetPhysical(sal_Bool bPhys)1884cdf0e10cSrcweir void SwDocStyleSheet::SetPhysical(sal_Bool bPhys)
1885cdf0e10cSrcweir {
1886cdf0e10cSrcweir bPhysical = bPhys;
1887cdf0e10cSrcweir
1888cdf0e10cSrcweir if(!bPhys)
1889cdf0e10cSrcweir {
1890cdf0e10cSrcweir pCharFmt = 0;
1891cdf0e10cSrcweir pColl = 0;
1892cdf0e10cSrcweir pFrmFmt = 0;
1893cdf0e10cSrcweir pDesc = 0;
1894cdf0e10cSrcweir }
1895cdf0e10cSrcweir }
1896cdf0e10cSrcweir
GetFrmFmt()1897cdf0e10cSrcweir SwFrmFmt* SwDocStyleSheet::GetFrmFmt()
1898cdf0e10cSrcweir {
1899cdf0e10cSrcweir if(!bPhysical)
1900cdf0e10cSrcweir FillStyleSheet( FillPhysical );
1901cdf0e10cSrcweir return pFrmFmt;
1902cdf0e10cSrcweir }
1903cdf0e10cSrcweir
1904cdf0e10cSrcweir
IsUsed() const1905cdf0e10cSrcweir sal_Bool SwDocStyleSheet::IsUsed() const
1906cdf0e10cSrcweir {
1907cdf0e10cSrcweir if( !bPhysical )
1908cdf0e10cSrcweir {
1909cdf0e10cSrcweir SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
1910cdf0e10cSrcweir pThis->FillStyleSheet( FillOnlyName );
1911cdf0e10cSrcweir }
1912cdf0e10cSrcweir
1913cdf0e10cSrcweir // immer noch nicht ?
1914cdf0e10cSrcweir if( !bPhysical )
1915cdf0e10cSrcweir return sal_False;
1916cdf0e10cSrcweir
1917cdf0e10cSrcweir const SwModify* pMod;
1918cdf0e10cSrcweir switch( nFamily )
1919cdf0e10cSrcweir {
1920cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR : pMod = pCharFmt; break;
1921cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA : pMod = pColl; break;
1922cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME: pMod = pFrmFmt; break;
1923cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE : pMod = pDesc; break;
1924cdf0e10cSrcweir
1925cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1926cdf0e10cSrcweir return pNumRule ? rDoc.IsUsed( *pNumRule ) : sal_False;
1927cdf0e10cSrcweir
1928cdf0e10cSrcweir default:
1929cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
1930cdf0e10cSrcweir return sal_False;
1931cdf0e10cSrcweir }
1932cdf0e10cSrcweir return rDoc.IsUsed( *pMod );
1933cdf0e10cSrcweir }
1934cdf0e10cSrcweir
1935cdf0e10cSrcweir
GetHelpId(String & rFile)1936cdf0e10cSrcweir sal_uLong SwDocStyleSheet::GetHelpId( String& rFile )
1937cdf0e10cSrcweir {
1938cdf0e10cSrcweir static String sTemplateHelpFile = String::CreateFromAscii("swrhlppi.hlp");
1939cdf0e10cSrcweir
1940cdf0e10cSrcweir sal_uInt16 nId = 0;
1941cdf0e10cSrcweir sal_uInt16 nPoolId = 0;
1942cdf0e10cSrcweir unsigned char nFileId = UCHAR_MAX;
1943cdf0e10cSrcweir
1944cdf0e10cSrcweir rFile = sTemplateHelpFile;
1945cdf0e10cSrcweir
1946cdf0e10cSrcweir const SwFmt* pTmpFmt = 0;
1947cdf0e10cSrcweir switch( nFamily )
1948cdf0e10cSrcweir {
1949cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
1950cdf0e10cSrcweir if( !pCharFmt &&
1951cdf0e10cSrcweir 0 == (pCharFmt = lcl_FindCharFmt( rDoc, aName, 0, sal_False )) )
1952cdf0e10cSrcweir {
1953cdf0e10cSrcweir nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
1954cdf0e10cSrcweir return USHRT_MAX == nId ? 0 : nId;
1955cdf0e10cSrcweir }
1956cdf0e10cSrcweir pTmpFmt = pCharFmt;
1957cdf0e10cSrcweir break;
1958cdf0e10cSrcweir
1959cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA:
1960cdf0e10cSrcweir if( !pColl &&
1961cdf0e10cSrcweir 0 == ( pColl = lcl_FindParaFmt( rDoc, aName, 0, sal_False )) )
1962cdf0e10cSrcweir {
1963cdf0e10cSrcweir nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
1964cdf0e10cSrcweir return USHRT_MAX == nId ? 0 : nId;
1965cdf0e10cSrcweir }
1966cdf0e10cSrcweir pTmpFmt = pColl;
1967cdf0e10cSrcweir break;
1968cdf0e10cSrcweir
1969cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
1970cdf0e10cSrcweir if( !pFrmFmt &&
1971cdf0e10cSrcweir 0 == ( pFrmFmt = lcl_FindFrmFmt( rDoc, aName, 0, sal_False ) ) )
1972cdf0e10cSrcweir {
1973cdf0e10cSrcweir nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT );
1974cdf0e10cSrcweir return USHRT_MAX == nId ? 0 : nId;
1975cdf0e10cSrcweir }
1976cdf0e10cSrcweir pTmpFmt = pFrmFmt;
1977cdf0e10cSrcweir break;
1978cdf0e10cSrcweir
1979cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
1980cdf0e10cSrcweir if( !pDesc &&
1981cdf0e10cSrcweir 0 == ( pDesc = lcl_FindPageDesc( rDoc, aName, 0, sal_False ) ) )
1982cdf0e10cSrcweir {
1983cdf0e10cSrcweir nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
1984cdf0e10cSrcweir return USHRT_MAX == nId ? 0 : nId;
1985cdf0e10cSrcweir }
1986cdf0e10cSrcweir
1987cdf0e10cSrcweir nId = pDesc->GetPoolHelpId();
1988cdf0e10cSrcweir nFileId = pDesc->GetPoolHlpFileId();
1989cdf0e10cSrcweir nPoolId = pDesc->GetPoolFmtId();
1990cdf0e10cSrcweir break;
1991cdf0e10cSrcweir
1992cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
1993cdf0e10cSrcweir if( !pNumRule &&
1994cdf0e10cSrcweir 0 == ( pNumRule = lcl_FindNumRule( rDoc, aName, 0, sal_False ) ) )
1995cdf0e10cSrcweir {
1996cdf0e10cSrcweir nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
1997cdf0e10cSrcweir return USHRT_MAX == nId ? 0 : nId;
1998cdf0e10cSrcweir }
1999cdf0e10cSrcweir
2000cdf0e10cSrcweir nId = pNumRule->GetPoolHelpId();
2001cdf0e10cSrcweir nFileId = pNumRule->GetPoolHlpFileId();
2002cdf0e10cSrcweir nPoolId = pNumRule->GetPoolFmtId();
2003cdf0e10cSrcweir break;
2004cdf0e10cSrcweir
2005cdf0e10cSrcweir default:
2006cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
2007cdf0e10cSrcweir return 0;
2008cdf0e10cSrcweir }
2009cdf0e10cSrcweir
2010cdf0e10cSrcweir if( pTmpFmt )
2011cdf0e10cSrcweir {
2012cdf0e10cSrcweir nId = pTmpFmt->GetPoolHelpId();
2013cdf0e10cSrcweir nFileId = pTmpFmt->GetPoolHlpFileId();
2014cdf0e10cSrcweir nPoolId = pTmpFmt->GetPoolFmtId();
2015cdf0e10cSrcweir }
2016cdf0e10cSrcweir
2017cdf0e10cSrcweir if( UCHAR_MAX != nFileId )
2018cdf0e10cSrcweir {
2019cdf0e10cSrcweir const String *pTemplate = rDoc.GetDocPattern( nFileId );
2020cdf0e10cSrcweir if( pTemplate )
2021cdf0e10cSrcweir {
2022cdf0e10cSrcweir // const String aHelpPath(MakeHelpPath(*pTemplate));
2023cdf0e10cSrcweir rFile = *pTemplate;
2024cdf0e10cSrcweir }
2025cdf0e10cSrcweir }
2026cdf0e10cSrcweir else if( !IsPoolUserFmt( nPoolId ) )
2027cdf0e10cSrcweir {
2028cdf0e10cSrcweir nId = nPoolId;
2029cdf0e10cSrcweir }
2030cdf0e10cSrcweir
2031cdf0e10cSrcweir // weil sich der SFX so anstellt mit der HilfeId:
2032cdf0e10cSrcweir if( USHRT_MAX == nId )
2033cdf0e10cSrcweir nId = 0; // entsp. keine Hilfe anzeigen
2034cdf0e10cSrcweir
2035cdf0e10cSrcweir return nId;
2036cdf0e10cSrcweir }
2037cdf0e10cSrcweir
2038cdf0e10cSrcweir
SetHelpId(const String & r,sal_uLong nId)2039cdf0e10cSrcweir void SwDocStyleSheet::SetHelpId( const String& r, sal_uLong nId )
2040cdf0e10cSrcweir {
2041cdf0e10cSrcweir sal_uInt8 nFileId = static_cast< sal_uInt8 >(rDoc.SetDocPattern( r ));
2042cdf0e10cSrcweir sal_uInt16 nHId = static_cast< sal_uInt16 >(nId); //!! SFX hat eigenmaechtig auf sal_uLong umgestellt!
2043cdf0e10cSrcweir
2044cdf0e10cSrcweir SwFmt* pTmpFmt = 0;
2045cdf0e10cSrcweir switch( nFamily )
2046cdf0e10cSrcweir {
2047cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR : pTmpFmt = pCharFmt; break;
2048cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA : pTmpFmt = pColl; break;
2049cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME: pTmpFmt = pFrmFmt; break;
2050cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE :
2051cdf0e10cSrcweir ((SwPageDesc*)pDesc)->SetPoolHelpId( nHId );
2052cdf0e10cSrcweir ((SwPageDesc*)pDesc)->SetPoolHlpFileId( nFileId );
2053cdf0e10cSrcweir break;
2054cdf0e10cSrcweir
2055cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
2056cdf0e10cSrcweir ((SwNumRule*)pNumRule)->SetPoolHelpId( nHId );
2057cdf0e10cSrcweir ((SwNumRule*)pNumRule)->SetPoolHlpFileId( nFileId );
2058cdf0e10cSrcweir break;
2059cdf0e10cSrcweir
2060cdf0e10cSrcweir default:
2061cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
2062cdf0e10cSrcweir return ;
2063cdf0e10cSrcweir }
2064cdf0e10cSrcweir if( pTmpFmt )
2065cdf0e10cSrcweir {
2066cdf0e10cSrcweir pTmpFmt->SetPoolHelpId( nHId );
2067cdf0e10cSrcweir pTmpFmt->SetPoolHlpFileId( nFileId );
2068cdf0e10cSrcweir }
2069cdf0e10cSrcweir }
2070cdf0e10cSrcweir
2071cdf0e10cSrcweir
2072cdf0e10cSrcweir /* */
2073cdf0e10cSrcweir
2074cdf0e10cSrcweir /*--------------------------------------------------------------------
2075cdf0e10cSrcweir Beschreibung: Methoden fuer den DocStyleSheetPool
2076cdf0e10cSrcweir --------------------------------------------------------------------*/
2077cdf0e10cSrcweir
SwDocStyleSheetPool(SwDoc & rDocument,sal_Bool bOrg)2078cdf0e10cSrcweir SwDocStyleSheetPool::SwDocStyleSheetPool( SwDoc& rDocument, sal_Bool bOrg )
2079cdf0e10cSrcweir : SfxStyleSheetBasePool( rDocument.GetAttrPool() )
2080cdf0e10cSrcweir , mxStyleSheet( new SwDocStyleSheet( rDocument, aEmptyStr, *this, SFX_STYLE_FAMILY_CHAR, 0 ) )
2081cdf0e10cSrcweir , rDoc( rDocument )
2082cdf0e10cSrcweir {
2083cdf0e10cSrcweir bOrganizer = bOrg;
2084cdf0e10cSrcweir }
2085cdf0e10cSrcweir
~SwDocStyleSheetPool()2086cdf0e10cSrcweir SwDocStyleSheetPool::~SwDocStyleSheetPool()
2087cdf0e10cSrcweir {
2088cdf0e10cSrcweir }
2089cdf0e10cSrcweir
acquire()2090cdf0e10cSrcweir void SAL_CALL SwDocStyleSheetPool::acquire( ) throw ()
2091cdf0e10cSrcweir {
2092cdf0e10cSrcweir comphelper::OWeakTypeObject::acquire();
2093cdf0e10cSrcweir }
2094cdf0e10cSrcweir
release()2095cdf0e10cSrcweir void SAL_CALL SwDocStyleSheetPool::release( ) throw ()
2096cdf0e10cSrcweir {
2097cdf0e10cSrcweir comphelper::OWeakTypeObject::release();
2098cdf0e10cSrcweir }
2099cdf0e10cSrcweir
Make(const String & rName,SfxStyleFamily eFam,sal_uInt16 _nMask,sal_uInt16)2100cdf0e10cSrcweir SfxStyleSheetBase& SwDocStyleSheetPool::Make(
2101cdf0e10cSrcweir const String& rName,
2102cdf0e10cSrcweir SfxStyleFamily eFam,
2103cdf0e10cSrcweir sal_uInt16 _nMask,
2104cdf0e10cSrcweir sal_uInt16 /*nPos*/ )
2105cdf0e10cSrcweir {
2106cdf0e10cSrcweir mxStyleSheet->PresetName(rName);
2107cdf0e10cSrcweir mxStyleSheet->PresetParent(aEmptyStr);
2108cdf0e10cSrcweir mxStyleSheet->PresetFollow(aEmptyStr);
2109cdf0e10cSrcweir mxStyleSheet->SetMask(_nMask) ;
2110cdf0e10cSrcweir mxStyleSheet->SetFamily(eFam);
2111cdf0e10cSrcweir mxStyleSheet->SetPhysical(sal_True);
2112cdf0e10cSrcweir mxStyleSheet->Create();
2113cdf0e10cSrcweir
2114cdf0e10cSrcweir return *mxStyleSheet.get();
2115cdf0e10cSrcweir }
2116cdf0e10cSrcweir
2117cdf0e10cSrcweir
Create(const SfxStyleSheetBase &)2118cdf0e10cSrcweir SfxStyleSheetBase* SwDocStyleSheetPool::Create( const SfxStyleSheetBase& /*rOrg*/)
2119cdf0e10cSrcweir {
2120cdf0e10cSrcweir ASSERT(!this , "Create im SW-Stylesheet-Pool geht nicht" );
2121cdf0e10cSrcweir return NULL;
2122cdf0e10cSrcweir }
2123cdf0e10cSrcweir
2124cdf0e10cSrcweir
Create(const String &,SfxStyleFamily,sal_uInt16)2125cdf0e10cSrcweir SfxStyleSheetBase* SwDocStyleSheetPool::Create( const String &,
2126cdf0e10cSrcweir SfxStyleFamily, sal_uInt16 )
2127cdf0e10cSrcweir {
2128cdf0e10cSrcweir ASSERT( !this, "Create im SW-Stylesheet-Pool geht nicht" );
2129cdf0e10cSrcweir return NULL;
2130cdf0e10cSrcweir }
2131cdf0e10cSrcweir
Replace(SfxStyleSheetBase & rSource,SfxStyleSheetBase & rTarget)2132cdf0e10cSrcweir void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
2133cdf0e10cSrcweir SfxStyleSheetBase& rTarget )
2134cdf0e10cSrcweir {
2135cdf0e10cSrcweir SfxStyleFamily eFamily( rSource.GetFamily() );
2136cdf0e10cSrcweir if( rSource.HasParentSupport())
2137cdf0e10cSrcweir {
2138cdf0e10cSrcweir const String& rParentName = rSource.GetParent();
2139cdf0e10cSrcweir if( 0 != rParentName.Len() )
2140cdf0e10cSrcweir {
2141cdf0e10cSrcweir SfxStyleSheetBase* pParentOfNew = Find( rParentName, eFamily );
2142cdf0e10cSrcweir if( pParentOfNew )
2143cdf0e10cSrcweir rTarget.SetParent( rParentName );
2144cdf0e10cSrcweir }
2145cdf0e10cSrcweir }
2146cdf0e10cSrcweir if( rSource.HasFollowSupport())
2147cdf0e10cSrcweir {
2148cdf0e10cSrcweir const String& rFollowName = rSource.GetFollow();
2149cdf0e10cSrcweir if( 0 != rFollowName.Len() )
2150cdf0e10cSrcweir {
2151cdf0e10cSrcweir SfxStyleSheetBase* pFollowOfNew = Find( rFollowName, eFamily );
2152cdf0e10cSrcweir if( pFollowOfNew )
2153cdf0e10cSrcweir rTarget.SetFollow( rFollowName );
2154cdf0e10cSrcweir }
2155cdf0e10cSrcweir }
2156cdf0e10cSrcweir
2157cdf0e10cSrcweir SwImplShellAction aTmpSh( rDoc );
2158cdf0e10cSrcweir
2159cdf0e10cSrcweir sal_Bool bSwSrcPool = GetAppName() == rSource.GetPool().GetAppName();
2160cdf0e10cSrcweir if( SFX_STYLE_FAMILY_PAGE == eFamily && bSwSrcPool )
2161cdf0e10cSrcweir {
2162cdf0e10cSrcweir // gesondert behandeln!!
2163cdf0e10cSrcweir SwPageDesc* pDestDsc =
2164cdf0e10cSrcweir (SwPageDesc*)((SwDocStyleSheet&)rTarget).GetPageDesc();
2165cdf0e10cSrcweir SwPageDesc* pCpyDsc =
2166cdf0e10cSrcweir (SwPageDesc*)((SwDocStyleSheet&)rSource).GetPageDesc();
2167cdf0e10cSrcweir rDoc.CopyPageDesc( *pCpyDsc, *pDestDsc );
2168cdf0e10cSrcweir }
2169cdf0e10cSrcweir else
2170cdf0e10cSrcweir {
2171cdf0e10cSrcweir const SwFmt *pSourceFmt = 0;
2172cdf0e10cSrcweir SwFmt *pTargetFmt = 0;
2173cdf0e10cSrcweir sal_uInt16 nPgDscPos = USHRT_MAX;
2174cdf0e10cSrcweir switch( eFamily )
2175cdf0e10cSrcweir {
2176cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
2177cdf0e10cSrcweir if( bSwSrcPool )
2178cdf0e10cSrcweir pSourceFmt = ((SwDocStyleSheet&)rSource).GetCharFmt();
2179cdf0e10cSrcweir pTargetFmt = ((SwDocStyleSheet&)rTarget).GetCharFmt();
2180cdf0e10cSrcweir break;
2181cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
2182cdf0e10cSrcweir if( bSwSrcPool )
2183cdf0e10cSrcweir pSourceFmt = ((SwDocStyleSheet&)rSource).GetCollection();
2184cdf0e10cSrcweir pTargetFmt = ((SwDocStyleSheet&)rTarget).GetCollection();
2185cdf0e10cSrcweir break;
2186cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
2187cdf0e10cSrcweir if( bSwSrcPool )
2188cdf0e10cSrcweir pSourceFmt = ((SwDocStyleSheet&)rSource).GetFrmFmt();
2189cdf0e10cSrcweir pTargetFmt = ((SwDocStyleSheet&)rTarget).GetFrmFmt();
2190cdf0e10cSrcweir break;
2191cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
2192cdf0e10cSrcweir if( bSwSrcPool )
2193cdf0e10cSrcweir pSourceFmt = &((SwDocStyleSheet&)rSource).GetPageDesc()
2194cdf0e10cSrcweir ->GetMaster();
2195cdf0e10cSrcweir {
2196cdf0e10cSrcweir SwPageDesc *pDesc = rDoc.FindPageDescByName(
2197cdf0e10cSrcweir ((SwDocStyleSheet&)rTarget).GetPageDesc()->GetName(),
2198cdf0e10cSrcweir &nPgDscPos );
2199cdf0e10cSrcweir
2200cdf0e10cSrcweir if( pDesc )
2201cdf0e10cSrcweir pTargetFmt = &pDesc->GetMaster();
2202cdf0e10cSrcweir }
2203cdf0e10cSrcweir break;
2204cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
2205cdf0e10cSrcweir // Eine NumRule besteht nur aus einem Item, also muss man
2206cdf0e10cSrcweir // hier nichts loeschen.
2207cdf0e10cSrcweir break;
2208cdf0e10cSrcweir default:; //prevent warning
2209cdf0e10cSrcweir }
2210cdf0e10cSrcweir if( pTargetFmt )
2211cdf0e10cSrcweir {
2212cdf0e10cSrcweir if( pSourceFmt )
2213cdf0e10cSrcweir pTargetFmt->DelDiffs( *pSourceFmt );
2214cdf0e10cSrcweir else if( USHRT_MAX != nPgDscPos )
2215cdf0e10cSrcweir pTargetFmt->ResetFmtAttr( RES_PAGEDESC, RES_FRMATR_END-1 );
2216cdf0e10cSrcweir else
2217cdf0e10cSrcweir {
2218cdf0e10cSrcweir // --> OD 2007-01-25 #i73790# - method renamed
2219cdf0e10cSrcweir pTargetFmt->ResetAllFmtAttr();
2220cdf0e10cSrcweir // <--
2221cdf0e10cSrcweir }
2222cdf0e10cSrcweir
2223cdf0e10cSrcweir if( USHRT_MAX != nPgDscPos )
2224cdf0e10cSrcweir rDoc.ChgPageDesc( nPgDscPos,
2225cdf0e10cSrcweir const_cast<const SwDoc &>(rDoc).
2226cdf0e10cSrcweir GetPageDesc(nPgDscPos) );
2227cdf0e10cSrcweir }
2228cdf0e10cSrcweir ((SwDocStyleSheet&)rTarget).SetItemSet( rSource.GetItemSet() );
2229cdf0e10cSrcweir }
2230cdf0e10cSrcweir }
2231cdf0e10cSrcweir
CreateIterator(SfxStyleFamily eFam,sal_uInt16 _nMask)223249bd4d4bSArmin Le Grand SfxStyleSheetIteratorPtr SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, sal_uInt16 _nMask )
223349bd4d4bSArmin Le Grand {
223449bd4d4bSArmin Le Grand return SfxStyleSheetIteratorPtr(new SwStyleSheetIterator( this, eFam, _nMask ));
223549bd4d4bSArmin Le Grand }
223649bd4d4bSArmin Le Grand
dispose()2237cdf0e10cSrcweir void SwDocStyleSheetPool::dispose()
2238cdf0e10cSrcweir {
2239cdf0e10cSrcweir mxStyleSheet.clear();
2240cdf0e10cSrcweir }
2241cdf0e10cSrcweir
Remove(SfxStyleSheetBase * pStyle)2242cdf0e10cSrcweir void SwDocStyleSheetPool::Remove( SfxStyleSheetBase* pStyle)
2243cdf0e10cSrcweir {
2244cdf0e10cSrcweir if( !pStyle )
2245cdf0e10cSrcweir return;
2246cdf0e10cSrcweir
2247cdf0e10cSrcweir sal_Bool bBroadcast = sal_True;
2248cdf0e10cSrcweir SwImplShellAction aTmpSh( rDoc );
2249cdf0e10cSrcweir const String& rName = pStyle->GetName();
2250cdf0e10cSrcweir switch( pStyle->GetFamily() )
2251cdf0e10cSrcweir {
2252cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR:
2253cdf0e10cSrcweir {
2254cdf0e10cSrcweir SwCharFmt* pFmt = lcl_FindCharFmt(rDoc, rName, 0, sal_False );
2255cdf0e10cSrcweir if(pFmt)
2256cdf0e10cSrcweir rDoc.DelCharFmt(pFmt);
2257cdf0e10cSrcweir }
2258cdf0e10cSrcweir break;
2259cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA:
2260cdf0e10cSrcweir {
2261cdf0e10cSrcweir SwTxtFmtColl* pColl = lcl_FindParaFmt(rDoc, rName, 0, sal_False );
2262cdf0e10cSrcweir if(pColl)
2263cdf0e10cSrcweir rDoc.DelTxtFmtColl(pColl);
2264cdf0e10cSrcweir }
2265cdf0e10cSrcweir break;
2266cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
2267cdf0e10cSrcweir {
2268cdf0e10cSrcweir SwFrmFmt* pFmt = lcl_FindFrmFmt(rDoc, rName, 0, sal_False );
2269cdf0e10cSrcweir if(pFmt)
2270cdf0e10cSrcweir rDoc.DelFrmFmt(pFmt);
2271cdf0e10cSrcweir }
2272cdf0e10cSrcweir break;
2273cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE :
2274cdf0e10cSrcweir {
2275cdf0e10cSrcweir sal_uInt16 nPos;
2276cdf0e10cSrcweir if( rDoc.FindPageDescByName( rName, &nPos ))
2277cdf0e10cSrcweir rDoc.DelPageDesc( nPos );
2278cdf0e10cSrcweir }
2279cdf0e10cSrcweir break;
2280cdf0e10cSrcweir
2281cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
2282cdf0e10cSrcweir {
2283cdf0e10cSrcweir if( !rDoc.DelNumRule( rName ) )
2284cdf0e10cSrcweir // Broadcast nur versenden, wenn etwas geloescht wurde
2285cdf0e10cSrcweir bBroadcast = sal_False;
2286cdf0e10cSrcweir }
2287cdf0e10cSrcweir break;
2288cdf0e10cSrcweir
2289cdf0e10cSrcweir default:
2290cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
2291cdf0e10cSrcweir bBroadcast = sal_False;
2292cdf0e10cSrcweir }
2293cdf0e10cSrcweir
2294cdf0e10cSrcweir if( bBroadcast )
2295cdf0e10cSrcweir Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *pStyle ) );
2296cdf0e10cSrcweir }
2297cdf0e10cSrcweir
2298cdf0e10cSrcweir
2299cdf0e10cSrcweir
SetParent(SfxStyleFamily eFam,const String & rStyle,const String & rParent)2300cdf0e10cSrcweir sal_Bool SwDocStyleSheetPool::SetParent( SfxStyleFamily eFam,
2301cdf0e10cSrcweir const String &rStyle, const String &rParent )
2302cdf0e10cSrcweir {
2303cdf0e10cSrcweir SwFmt* pFmt = 0, *pParent = 0;
2304cdf0e10cSrcweir switch( eFam )
2305cdf0e10cSrcweir {
2306cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR :
2307cdf0e10cSrcweir if( 0 != ( pFmt = lcl_FindCharFmt( rDoc, rStyle ) ) && rParent.Len() )
2308cdf0e10cSrcweir pParent = lcl_FindCharFmt(rDoc, rParent );
2309cdf0e10cSrcweir break;
2310cdf0e10cSrcweir
2311cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA :
2312cdf0e10cSrcweir if( 0 != ( pFmt = lcl_FindParaFmt( rDoc, rStyle ) ) && rParent.Len() )
2313cdf0e10cSrcweir pParent = lcl_FindParaFmt( rDoc, rParent );
2314cdf0e10cSrcweir break;
2315cdf0e10cSrcweir
2316cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
2317cdf0e10cSrcweir if( 0 != ( pFmt = lcl_FindFrmFmt( rDoc, rStyle ) ) && rParent.Len() )
2318cdf0e10cSrcweir pParent = lcl_FindFrmFmt( rDoc, rParent );
2319cdf0e10cSrcweir break;
2320cdf0e10cSrcweir
2321cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
2322cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
2323cdf0e10cSrcweir break;
2324cdf0e10cSrcweir
2325cdf0e10cSrcweir default:
2326cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
2327cdf0e10cSrcweir }
2328cdf0e10cSrcweir
2329cdf0e10cSrcweir sal_Bool bRet = sal_False;
2330cdf0e10cSrcweir if( pFmt && pFmt->DerivedFrom() &&
2331cdf0e10cSrcweir pFmt->DerivedFrom()->GetName() != rParent )
2332cdf0e10cSrcweir {
2333cdf0e10cSrcweir {
2334cdf0e10cSrcweir SwImplShellAction aTmpSh( rDoc );
2335cdf0e10cSrcweir bRet = pFmt->SetDerivedFrom( pParent );
2336cdf0e10cSrcweir }
2337cdf0e10cSrcweir
2338cdf0e10cSrcweir if( bRet )
2339cdf0e10cSrcweir {
2340cdf0e10cSrcweir // nur fuer das Broadcasting
2341cdf0e10cSrcweir mxStyleSheet->PresetName( rStyle );
2342cdf0e10cSrcweir mxStyleSheet->PresetParent( rParent );
2343cdf0e10cSrcweir if( SFX_STYLE_FAMILY_PARA == eFam )
2344cdf0e10cSrcweir mxStyleSheet->PresetFollow( ((SwTxtFmtColl*)pFmt)->
2345cdf0e10cSrcweir GetNextTxtFmtColl().GetName() );
2346cdf0e10cSrcweir else
2347cdf0e10cSrcweir mxStyleSheet->PresetFollow( aEmptyStr );
2348cdf0e10cSrcweir
2349cdf0e10cSrcweir Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED,
2350cdf0e10cSrcweir *(mxStyleSheet.get()) ) );
2351cdf0e10cSrcweir }
2352cdf0e10cSrcweir }
2353cdf0e10cSrcweir
2354cdf0e10cSrcweir return bRet;
2355cdf0e10cSrcweir }
2356cdf0e10cSrcweir
Find(const String & rName,SfxStyleFamily eFam,sal_uInt16 n)2357cdf0e10cSrcweir SfxStyleSheetBase* SwDocStyleSheetPool::Find( const String& rName,
2358cdf0e10cSrcweir SfxStyleFamily eFam, sal_uInt16 n )
2359cdf0e10cSrcweir {
2360cdf0e10cSrcweir sal_uInt16 nSMask = n;
2361cdf0e10cSrcweir if( SFX_STYLE_FAMILY_PARA == eFam && rDoc.get(IDocumentSettingAccess::HTML_MODE) )
2362cdf0e10cSrcweir {
2363cdf0e10cSrcweir // dann sind nur HTML-Vorlagen von Interesse
2364cdf0e10cSrcweir if( USHRT_MAX == nSMask )
2365cdf0e10cSrcweir nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED;
2366cdf0e10cSrcweir else
2367cdf0e10cSrcweir nSMask &= SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF |
2368cdf0e10cSrcweir SWSTYLEBIT_CONDCOLL | SWSTYLEBIT_HTML;
2369cdf0e10cSrcweir if( !nSMask )
2370cdf0e10cSrcweir nSMask = SWSTYLEBIT_HTML;
2371cdf0e10cSrcweir }
2372cdf0e10cSrcweir
2373cdf0e10cSrcweir const sal_Bool bSearchUsed = ( n != SFXSTYLEBIT_ALL &&
2374cdf0e10cSrcweir n & SFXSTYLEBIT_USED ) ? sal_True : sal_False;
2375cdf0e10cSrcweir const SwModify* pMod = 0;
2376cdf0e10cSrcweir
2377cdf0e10cSrcweir mxStyleSheet->SetPhysical( sal_False );
2378cdf0e10cSrcweir mxStyleSheet->PresetName( rName );
2379cdf0e10cSrcweir mxStyleSheet->SetFamily( eFam );
2380cdf0e10cSrcweir sal_Bool bFnd = mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2381cdf0e10cSrcweir
2382cdf0e10cSrcweir if( mxStyleSheet->IsPhysical() )
2383cdf0e10cSrcweir {
2384cdf0e10cSrcweir switch( eFam )
2385cdf0e10cSrcweir {
2386cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR:
2387cdf0e10cSrcweir pMod = mxStyleSheet->GetCharFmt();
2388cdf0e10cSrcweir break;
2389cdf0e10cSrcweir
2390cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA:
2391cdf0e10cSrcweir pMod = mxStyleSheet->GetCollection();
2392cdf0e10cSrcweir break;
2393cdf0e10cSrcweir
2394cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME:
2395cdf0e10cSrcweir pMod = mxStyleSheet->GetFrmFmt();
2396cdf0e10cSrcweir break;
2397cdf0e10cSrcweir
2398cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE:
2399cdf0e10cSrcweir pMod = mxStyleSheet->GetPageDesc();
2400cdf0e10cSrcweir break;
2401cdf0e10cSrcweir
2402cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO:
2403cdf0e10cSrcweir {
2404cdf0e10cSrcweir const SwNumRule* pRule = mxStyleSheet->GetNumRule();
2405cdf0e10cSrcweir if( pRule &&
2406cdf0e10cSrcweir !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pRule)) ) &&
2407cdf0e10cSrcweir (( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
2408cdf0e10cSrcweir ? !(pRule->GetPoolFmtId() & USER_FMT)
2409cdf0e10cSrcweir // benutzte gesucht und keine gefunden
2410cdf0e10cSrcweir : bSearchUsed ))
2411cdf0e10cSrcweir bFnd = sal_False;
2412cdf0e10cSrcweir }
2413cdf0e10cSrcweir break;
2414cdf0e10cSrcweir
2415cdf0e10cSrcweir default:
2416cdf0e10cSrcweir ASSERT(!this, "unbekannte Style-Familie");
2417cdf0e10cSrcweir }
2418cdf0e10cSrcweir }
2419cdf0e10cSrcweir
2420cdf0e10cSrcweir // dann noch die Maske auswerten:
2421cdf0e10cSrcweir if( pMod && !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pMod)) ) )
2422cdf0e10cSrcweir {
2423cdf0e10cSrcweir const sal_uInt16 nId = SFX_STYLE_FAMILY_PAGE == eFam
2424cdf0e10cSrcweir ? ((SwPageDesc*)pMod)->GetPoolFmtId()
2425cdf0e10cSrcweir : ((SwFmt*)pMod)->GetPoolFmtId();
2426cdf0e10cSrcweir
2427cdf0e10cSrcweir if( ( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
2428cdf0e10cSrcweir ? !(nId & USER_FMT)
2429cdf0e10cSrcweir // benutzte gesucht und keine gefunden
2430cdf0e10cSrcweir : bSearchUsed )
2431cdf0e10cSrcweir bFnd = sal_False;
2432cdf0e10cSrcweir }
2433cdf0e10cSrcweir return bFnd ? mxStyleSheet.get() : 0;
2434cdf0e10cSrcweir }
2435cdf0e10cSrcweir
2436cdf0e10cSrcweir /* */
2437cdf0e10cSrcweir
SwStyleSheetIterator(SwDocStyleSheetPool * pBase,SfxStyleFamily eFam,sal_uInt16 n)2438cdf0e10cSrcweir SwStyleSheetIterator::SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
2439cdf0e10cSrcweir SfxStyleFamily eFam, sal_uInt16 n )
2440cdf0e10cSrcweir : SfxStyleSheetIterator( pBase, eFam, n ),
2441cdf0e10cSrcweir mxIterSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, *pBase, SFX_STYLE_FAMILY_CHAR, 0 ) ),
2442cdf0e10cSrcweir mxStyleSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, *pBase, SFX_STYLE_FAMILY_CHAR, 0 ) )
2443cdf0e10cSrcweir {
2444cdf0e10cSrcweir bFirstCalled = sal_False;
2445cdf0e10cSrcweir nLastPos = 0;
2446cdf0e10cSrcweir StartListening( *pBase );
2447cdf0e10cSrcweir }
2448cdf0e10cSrcweir
~SwStyleSheetIterator()2449cdf0e10cSrcweir SwStyleSheetIterator::~SwStyleSheetIterator()
2450cdf0e10cSrcweir {
2451cdf0e10cSrcweir EndListening( mxIterSheet->GetPool() );
2452cdf0e10cSrcweir }
2453cdf0e10cSrcweir
Count()2454cdf0e10cSrcweir sal_uInt16 SwStyleSheetIterator::Count()
2455cdf0e10cSrcweir {
2456cdf0e10cSrcweir // Liste richtig fuellen lassen !!
2457cdf0e10cSrcweir if( !bFirstCalled )
2458cdf0e10cSrcweir First();
2459cdf0e10cSrcweir return aLst.Count();
2460cdf0e10cSrcweir }
2461cdf0e10cSrcweir
operator [](sal_uInt16 nIdx)2462cdf0e10cSrcweir SfxStyleSheetBase* SwStyleSheetIterator::operator[]( sal_uInt16 nIdx )
2463cdf0e10cSrcweir {
2464cdf0e10cSrcweir // gefunden
2465cdf0e10cSrcweir if( !bFirstCalled )
2466cdf0e10cSrcweir First();
2467cdf0e10cSrcweir mxStyleSheet->PresetNameAndFamily( *aLst[ nIdx ] );
2468cdf0e10cSrcweir mxStyleSheet->SetPhysical( sal_False );
2469cdf0e10cSrcweir mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2470cdf0e10cSrcweir
2471cdf0e10cSrcweir return mxStyleSheet.get();
2472cdf0e10cSrcweir }
2473cdf0e10cSrcweir
First()2474cdf0e10cSrcweir SfxStyleSheetBase* SwStyleSheetIterator::First()
2475cdf0e10cSrcweir {
2476cdf0e10cSrcweir // Alte Liste loeschen
2477cdf0e10cSrcweir bFirstCalled = sal_True;
2478cdf0e10cSrcweir nLastPos = 0;
2479cdf0e10cSrcweir aLst.Erase();
2480cdf0e10cSrcweir
2481cdf0e10cSrcweir // aktuellen loeschen
2482cdf0e10cSrcweir mxIterSheet->Reset();
2483cdf0e10cSrcweir
2484cdf0e10cSrcweir SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
2485cdf0e10cSrcweir const sal_uInt16 nSrchMask = nMask;
2486cdf0e10cSrcweir const sal_Bool bIsSearchUsed = SearchUsed();
2487cdf0e10cSrcweir
2488cdf0e10cSrcweir const sal_Bool bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode();
2489cdf0e10cSrcweir
2490cdf0e10cSrcweir if( nSearchFamily == SFX_STYLE_FAMILY_CHAR
2491cdf0e10cSrcweir || nSearchFamily == SFX_STYLE_FAMILY_ALL )
2492cdf0e10cSrcweir {
2493cdf0e10cSrcweir const sal_uInt16 nArrLen = rDoc.GetCharFmts()->Count();
2494cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nArrLen; i++ )
2495cdf0e10cSrcweir {
2496cdf0e10cSrcweir SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
2497cdf0e10cSrcweir if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
2498cdf0e10cSrcweir continue;
2499cdf0e10cSrcweir
2500cdf0e10cSrcweir const sal_Bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFmt));
2501cdf0e10cSrcweir if( !bUsed )
2502cdf0e10cSrcweir {
2503cdf0e10cSrcweir // Standard ist keine Benutzervorlage #46181#
2504cdf0e10cSrcweir const sal_uInt16 nId = rDoc.GetDfltCharFmt() == pFmt ?
2505cdf0e10cSrcweir sal_uInt16( RES_POOLCHR_INET_NORMAL ):
2506cdf0e10cSrcweir pFmt->GetPoolFmtId();
2507cdf0e10cSrcweir if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
2508cdf0e10cSrcweir ? !(nId & USER_FMT)
2509cdf0e10cSrcweir // benutzte gesucht und keine gefunden
2510cdf0e10cSrcweir : bIsSearchUsed )
2511cdf0e10cSrcweir continue;
2512cdf0e10cSrcweir
2513cdf0e10cSrcweir if( rDoc.get(IDocumentSettingAccess::HTML_MODE) && !(nId & USER_FMT) &&
2514cdf0e10cSrcweir !( RES_POOLCHR_HTML_BEGIN <= nId &&
2515cdf0e10cSrcweir nId < RES_POOLCHR_HTML_END ) &&
2516cdf0e10cSrcweir RES_POOLCHR_INET_NORMAL != nId &&
2517cdf0e10cSrcweir RES_POOLCHR_INET_VISIT != nId &&
2518cdf0e10cSrcweir RES_POOLCHR_FOOTNOTE != nId &&
2519cdf0e10cSrcweir RES_POOLCHR_ENDNOTE != nId )
2520cdf0e10cSrcweir continue;
2521cdf0e10cSrcweir }
2522cdf0e10cSrcweir
2523cdf0e10cSrcweir aLst.Append( cCHAR, pFmt == rDoc.GetDfltCharFmt()
2524cdf0e10cSrcweir ? (const String&) *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
2525cdf0e10cSrcweir RES_POOLCOLL_TEXT_BEGIN ]
2526cdf0e10cSrcweir : pFmt->GetName() );
2527cdf0e10cSrcweir }
2528cdf0e10cSrcweir
2529cdf0e10cSrcweir // PoolFormate
2530cdf0e10cSrcweir //
2531cdf0e10cSrcweir if( nSrchMask == SFXSTYLEBIT_ALL )
2532cdf0e10cSrcweir {
2533cdf0e10cSrcweir if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) )
2534cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetChrFmtUINameArray(),
2535cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
2536cdf0e10cSrcweir else
2537cdf0e10cSrcweir {
2538cdf0e10cSrcweir aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
2539cdf0e10cSrcweir RES_POOLCHR_INET_NORMAL - RES_POOLCHR_BEGIN ] );
2540cdf0e10cSrcweir aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
2541cdf0e10cSrcweir RES_POOLCHR_INET_VISIT - RES_POOLCHR_BEGIN ] );
2542cdf0e10cSrcweir aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
2543cdf0e10cSrcweir RES_POOLCHR_ENDNOTE - RES_POOLCHR_BEGIN ] );
2544cdf0e10cSrcweir aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
2545cdf0e10cSrcweir RES_POOLCHR_FOOTNOTE - RES_POOLCHR_BEGIN ] );
2546cdf0e10cSrcweir }
2547cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetHTMLChrFmtUINameArray(),
2548cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
2549cdf0e10cSrcweir }
2550cdf0e10cSrcweir }
2551cdf0e10cSrcweir
2552cdf0e10cSrcweir if( nSearchFamily == SFX_STYLE_FAMILY_PARA ||
2553cdf0e10cSrcweir nSearchFamily == SFX_STYLE_FAMILY_ALL )
2554cdf0e10cSrcweir {
2555cdf0e10cSrcweir sal_uInt16 nSMask = nSrchMask;
2556cdf0e10cSrcweir if( rDoc.get(IDocumentSettingAccess::HTML_MODE) )
2557cdf0e10cSrcweir {
2558cdf0e10cSrcweir // dann sind nur HTML-Vorlagen von Interesse
2559cdf0e10cSrcweir if( USHRT_MAX == nSMask )
2560cdf0e10cSrcweir nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF |
2561cdf0e10cSrcweir SFXSTYLEBIT_USED;
2562cdf0e10cSrcweir else
2563cdf0e10cSrcweir nSMask &= SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF |
2564cdf0e10cSrcweir SWSTYLEBIT_CONDCOLL | SWSTYLEBIT_HTML;
2565cdf0e10cSrcweir if( !nSMask )
2566cdf0e10cSrcweir nSMask = SWSTYLEBIT_HTML;
2567cdf0e10cSrcweir }
2568cdf0e10cSrcweir
2569cdf0e10cSrcweir const sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->Count();
2570cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nArrLen; i++ )
2571cdf0e10cSrcweir {
2572cdf0e10cSrcweir SwTxtFmtColl* pColl = (*rDoc.GetTxtFmtColls())[ i ];
2573cdf0e10cSrcweir
2574cdf0e10cSrcweir if(pColl->IsDefault())
2575cdf0e10cSrcweir continue;
2576cdf0e10cSrcweir
2577cdf0e10cSrcweir const sal_Bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
2578cdf0e10cSrcweir if( !(bIsSearchUsed && bUsed ))
2579cdf0e10cSrcweir {
2580cdf0e10cSrcweir const sal_uInt16 nId = pColl->GetPoolFmtId();
2581cdf0e10cSrcweir switch ( (nSMask & ~SFXSTYLEBIT_USED) )
2582cdf0e10cSrcweir {
2583cdf0e10cSrcweir case SFXSTYLEBIT_USERDEF:
2584cdf0e10cSrcweir if(!IsPoolUserFmt(nId)) continue;
2585cdf0e10cSrcweir break;
2586cdf0e10cSrcweir case SWSTYLEBIT_TEXT:
2587cdf0e10cSrcweir if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue;
2588cdf0e10cSrcweir break;
2589cdf0e10cSrcweir case SWSTYLEBIT_CHAPTER:
2590cdf0e10cSrcweir if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue;
2591cdf0e10cSrcweir break;
2592cdf0e10cSrcweir case SWSTYLEBIT_LIST:
2593cdf0e10cSrcweir if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue;
2594cdf0e10cSrcweir break;
2595cdf0e10cSrcweir case SWSTYLEBIT_IDX:
2596cdf0e10cSrcweir if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue;
2597cdf0e10cSrcweir break;
2598cdf0e10cSrcweir case SWSTYLEBIT_EXTRA:
2599cdf0e10cSrcweir if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue;
2600cdf0e10cSrcweir break;
2601cdf0e10cSrcweir
2602cdf0e10cSrcweir case SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF:
2603cdf0e10cSrcweir if(IsPoolUserFmt(nId))
2604cdf0e10cSrcweir break;
2605cdf0e10cSrcweir // ansonten weiter
2606cdf0e10cSrcweir case SWSTYLEBIT_HTML:
2607cdf0e10cSrcweir if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS)
2608cdf0e10cSrcweir {
2609cdf0e10cSrcweir // einige wollen wir aber auch in dieser Section sehen
2610cdf0e10cSrcweir sal_Bool bWeiter = sal_True;
2611cdf0e10cSrcweir switch( nId )
2612cdf0e10cSrcweir {
2613cdf0e10cSrcweir case RES_POOLCOLL_SENDADRESS: // --> ADDRESS
2614cdf0e10cSrcweir case RES_POOLCOLL_TABLE_HDLN: // --> TH
2615cdf0e10cSrcweir case RES_POOLCOLL_TABLE: // --> TD
2616cdf0e10cSrcweir case RES_POOLCOLL_TEXT: // --> P
2617cdf0e10cSrcweir case RES_POOLCOLL_HEADLINE_BASE:// --> H
2618cdf0e10cSrcweir case RES_POOLCOLL_HEADLINE1: // --> H1
2619cdf0e10cSrcweir case RES_POOLCOLL_HEADLINE2: // --> H2
2620cdf0e10cSrcweir case RES_POOLCOLL_HEADLINE3: // --> H3
2621cdf0e10cSrcweir case RES_POOLCOLL_HEADLINE4: // --> H4
2622cdf0e10cSrcweir case RES_POOLCOLL_HEADLINE5: // --> H5
2623cdf0e10cSrcweir case RES_POOLCOLL_HEADLINE6: // --> H6
2624cdf0e10cSrcweir case RES_POOLCOLL_STANDARD: // --> P
2625cdf0e10cSrcweir case RES_POOLCOLL_FOOTNOTE:
2626cdf0e10cSrcweir case RES_POOLCOLL_ENDNOTE:
2627cdf0e10cSrcweir bWeiter = sal_False;
2628cdf0e10cSrcweir break;
2629cdf0e10cSrcweir }
2630cdf0e10cSrcweir if( bWeiter )
2631cdf0e10cSrcweir continue;
2632cdf0e10cSrcweir }
2633cdf0e10cSrcweir break;
2634cdf0e10cSrcweir case SWSTYLEBIT_CONDCOLL:
2635cdf0e10cSrcweir if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue;
2636cdf0e10cSrcweir break;
2637cdf0e10cSrcweir default:
2638cdf0e10cSrcweir // benutzte gesucht und keine gefunden
2639cdf0e10cSrcweir if( bIsSearchUsed )
2640cdf0e10cSrcweir continue;
2641cdf0e10cSrcweir }
2642cdf0e10cSrcweir }
2643cdf0e10cSrcweir aLst.Append( cPARA, pColl->GetName() );
2644cdf0e10cSrcweir }
2645cdf0e10cSrcweir
2646cdf0e10cSrcweir const sal_Bool bAll = nSMask == SFXSTYLEBIT_ALL;
2647cdf0e10cSrcweir if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT )
2648cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetTextUINameArray(),
2649cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
2650cdf0e10cSrcweir if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CHAPTER )
2651cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetDocUINameArray(),
2652cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
2653cdf0e10cSrcweir if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_LIST )
2654cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetListsUINameArray(),
2655cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
2656cdf0e10cSrcweir if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_IDX )
2657cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetRegisterUINameArray(),
2658cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
2659cdf0e10cSrcweir if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_EXTRA )
2660cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetExtraUINameArray(),
2661cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
2662cdf0e10cSrcweir if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CONDCOLL )
2663cdf0e10cSrcweir {
2664cdf0e10cSrcweir if( !bIsSearchUsed ||
2665cdf0e10cSrcweir rDoc.IsPoolTxtCollUsed( RES_POOLCOLL_TEXT ))
2666cdf0e10cSrcweir aLst.Append( cPARA, *SwStyleNameMapper::GetTextUINameArray()[
2667cdf0e10cSrcweir RES_POOLCOLL_TEXT - RES_POOLCOLL_TEXT_BEGIN ] );
2668cdf0e10cSrcweir }
2669cdf0e10cSrcweir if ( bAll ||
2670cdf0e10cSrcweir (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_HTML ||
2671cdf0e10cSrcweir (nSMask & ~SFXSTYLEBIT_USED) ==
2672cdf0e10cSrcweir (SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF) )
2673cdf0e10cSrcweir {
2674cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetHTMLUINameArray(),
2675cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
2676cdf0e10cSrcweir if( !bAll )
2677cdf0e10cSrcweir {
2678cdf0e10cSrcweir // dann auch die, die wir mappen:
2679cdf0e10cSrcweir static sal_uInt16 aPoolIds[] = {
2680cdf0e10cSrcweir RES_POOLCOLL_SENDADRESS, // --> ADDRESS
2681cdf0e10cSrcweir RES_POOLCOLL_TABLE_HDLN, // --> TH
2682cdf0e10cSrcweir RES_POOLCOLL_TABLE, // --> TD
2683cdf0e10cSrcweir RES_POOLCOLL_STANDARD, // --> P
2684cdf0e10cSrcweir RES_POOLCOLL_TEXT, // --> P
2685cdf0e10cSrcweir RES_POOLCOLL_HEADLINE_BASE, // --> H
2686cdf0e10cSrcweir RES_POOLCOLL_HEADLINE1, // --> H1
2687cdf0e10cSrcweir RES_POOLCOLL_HEADLINE2, // --> H2
2688cdf0e10cSrcweir RES_POOLCOLL_HEADLINE3, // --> H3
2689cdf0e10cSrcweir RES_POOLCOLL_HEADLINE4, // --> H4
2690cdf0e10cSrcweir RES_POOLCOLL_HEADLINE5, // --> H5
2691cdf0e10cSrcweir RES_POOLCOLL_HEADLINE6, // --> H6
2692cdf0e10cSrcweir RES_POOLCOLL_FOOTNOTE,
2693cdf0e10cSrcweir RES_POOLCOLL_ENDNOTE,
2694cdf0e10cSrcweir 0
2695cdf0e10cSrcweir };
2696cdf0e10cSrcweir
2697cdf0e10cSrcweir sal_uInt16* pPoolIds = aPoolIds;
2698cdf0e10cSrcweir String s;
2699cdf0e10cSrcweir while( *pPoolIds )
2700cdf0e10cSrcweir {
2701cdf0e10cSrcweir if( !bIsSearchUsed || rDoc.IsPoolTxtCollUsed( *pPoolIds ) )
2702cdf0e10cSrcweir aLst.Append( cPARA,
2703cdf0e10cSrcweir s = SwStyleNameMapper::GetUIName( *pPoolIds, s ));
2704cdf0e10cSrcweir ++pPoolIds;
2705cdf0e10cSrcweir }
2706cdf0e10cSrcweir }
2707cdf0e10cSrcweir }
2708cdf0e10cSrcweir }
2709cdf0e10cSrcweir
2710cdf0e10cSrcweir if( nSearchFamily == SFX_STYLE_FAMILY_FRAME ||
2711cdf0e10cSrcweir nSearchFamily == SFX_STYLE_FAMILY_ALL )
2712cdf0e10cSrcweir {
2713cdf0e10cSrcweir const sal_uInt16 nArrLen = rDoc.GetFrmFmts()->Count();
2714cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nArrLen; i++ )
2715cdf0e10cSrcweir {
2716cdf0e10cSrcweir SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
2717cdf0e10cSrcweir
2718cdf0e10cSrcweir if(pFmt->IsDefault() || pFmt->IsAuto())
2719cdf0e10cSrcweir {
2720cdf0e10cSrcweir continue;
2721cdf0e10cSrcweir }
2722cdf0e10cSrcweir
2723cdf0e10cSrcweir const sal_uInt16 nId = pFmt->GetPoolFmtId();
2724cdf0e10cSrcweir sal_Bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt));
2725cdf0e10cSrcweir if( !bUsed )
2726cdf0e10cSrcweir {
2727cdf0e10cSrcweir if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
2728cdf0e10cSrcweir ? !(nId & USER_FMT)
2729cdf0e10cSrcweir // benutzte gesucht und keine gefunden
2730cdf0e10cSrcweir : bIsSearchUsed )
2731cdf0e10cSrcweir {
2732cdf0e10cSrcweir continue;
2733cdf0e10cSrcweir }
2734cdf0e10cSrcweir }
2735cdf0e10cSrcweir
2736cdf0e10cSrcweir aLst.Append( cFRAME, pFmt->GetName() );
2737cdf0e10cSrcweir }
2738cdf0e10cSrcweir
2739cdf0e10cSrcweir // PoolFormate
2740cdf0e10cSrcweir //
2741cdf0e10cSrcweir if ( nSrchMask == SFXSTYLEBIT_ALL )
2742cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetFrmFmtUINameArray(),
2743cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
2744cdf0e10cSrcweir }
2745cdf0e10cSrcweir
2746cdf0e10cSrcweir if( nSearchFamily == SFX_STYLE_FAMILY_PAGE ||
2747cdf0e10cSrcweir nSearchFamily == SFX_STYLE_FAMILY_ALL )
2748cdf0e10cSrcweir {
2749cdf0e10cSrcweir const sal_uInt16 nCount = rDoc.GetPageDescCnt();
2750cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nCount; ++i)
2751cdf0e10cSrcweir {
2752cdf0e10cSrcweir const SwPageDesc& rDesc =
2753cdf0e10cSrcweir const_cast<const SwDoc &>(rDoc).GetPageDesc(i);
2754cdf0e10cSrcweir const sal_uInt16 nId = rDesc.GetPoolFmtId();
2755cdf0e10cSrcweir sal_Bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
2756cdf0e10cSrcweir if( !bUsed )
2757cdf0e10cSrcweir {
2758cdf0e10cSrcweir if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
2759cdf0e10cSrcweir ? !(nId & USER_FMT)
2760cdf0e10cSrcweir // benutzte gesucht und keine gefunden
2761cdf0e10cSrcweir : bIsSearchUsed )
2762cdf0e10cSrcweir continue;
2763cdf0e10cSrcweir }
2764cdf0e10cSrcweir
2765cdf0e10cSrcweir aLst.Append( cPAGE, rDesc.GetName() );
2766cdf0e10cSrcweir }
2767cdf0e10cSrcweir if ( nSrchMask == SFXSTYLEBIT_ALL )
2768cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetPageDescUINameArray(),
2769cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
2770cdf0e10cSrcweir }
2771cdf0e10cSrcweir
2772cdf0e10cSrcweir if( nSearchFamily == SFX_STYLE_FAMILY_PSEUDO ||
2773cdf0e10cSrcweir nSearchFamily == SFX_STYLE_FAMILY_ALL )
2774cdf0e10cSrcweir {
2775cdf0e10cSrcweir const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
2776cdf0e10cSrcweir for(sal_uInt16 i = 0; i < rNumTbl.Count(); ++i)
2777cdf0e10cSrcweir {
2778cdf0e10cSrcweir const SwNumRule& rRule = *rNumTbl[ i ];
2779cdf0e10cSrcweir if( !rRule.IsAutoRule() )
2780cdf0e10cSrcweir {
2781cdf0e10cSrcweir sal_Bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rRule) );
2782cdf0e10cSrcweir if( !bUsed )
2783cdf0e10cSrcweir {
2784cdf0e10cSrcweir if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
2785cdf0e10cSrcweir ? !(rRule.GetPoolFmtId() & USER_FMT)
2786cdf0e10cSrcweir // benutzte gesucht und keine gefunden
2787cdf0e10cSrcweir : bIsSearchUsed )
2788cdf0e10cSrcweir continue;
2789cdf0e10cSrcweir }
2790cdf0e10cSrcweir
2791cdf0e10cSrcweir aLst.Append( cNUMRULE, rRule.GetName() );
2792cdf0e10cSrcweir }
2793cdf0e10cSrcweir }
2794cdf0e10cSrcweir if ( nSrchMask == SFXSTYLEBIT_ALL )
2795cdf0e10cSrcweir AppendStyleList(SwStyleNameMapper::GetNumRuleUINameArray(),
2796cdf0e10cSrcweir bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
2797cdf0e10cSrcweir }
2798cdf0e10cSrcweir
2799cdf0e10cSrcweir if(aLst.Count() > 0)
2800cdf0e10cSrcweir {
2801cdf0e10cSrcweir nLastPos = USHRT_MAX;
2802cdf0e10cSrcweir return Next();
2803cdf0e10cSrcweir }
2804cdf0e10cSrcweir return 0;
2805cdf0e10cSrcweir }
2806cdf0e10cSrcweir
Next()2807cdf0e10cSrcweir SfxStyleSheetBase* SwStyleSheetIterator::Next()
2808cdf0e10cSrcweir {
2809cdf0e10cSrcweir nLastPos++;
2810cdf0e10cSrcweir if(aLst.Count() > 0 && nLastPos < aLst.Count())
2811cdf0e10cSrcweir {
2812cdf0e10cSrcweir mxIterSheet->PresetNameAndFamily(*aLst[nLastPos]);
2813cdf0e10cSrcweir mxIterSheet->SetPhysical( sal_False );
2814cdf0e10cSrcweir mxIterSheet->SetMask( nMask );
2815cdf0e10cSrcweir if(mxIterSheet->pSet)
2816cdf0e10cSrcweir {
2817cdf0e10cSrcweir mxIterSheet->pSet->ClearItem(0);
2818cdf0e10cSrcweir mxIterSheet->pSet= 0;
2819cdf0e10cSrcweir }
2820cdf0e10cSrcweir return mxIterSheet.get();
2821cdf0e10cSrcweir }
2822cdf0e10cSrcweir return 0;
2823cdf0e10cSrcweir }
2824cdf0e10cSrcweir
Find(const UniString & rName)2825cdf0e10cSrcweir SfxStyleSheetBase* SwStyleSheetIterator::Find( const UniString& rName )
2826cdf0e10cSrcweir {
2827cdf0e10cSrcweir // suchen
2828cdf0e10cSrcweir if( !bFirstCalled )
2829cdf0e10cSrcweir First();
2830cdf0e10cSrcweir
2831cdf0e10cSrcweir nLastPos = lcl_FindName( aLst, nSearchFamily, rName );
2832cdf0e10cSrcweir if( USHRT_MAX != nLastPos )
2833cdf0e10cSrcweir {
2834cdf0e10cSrcweir // gefunden
2835cdf0e10cSrcweir mxStyleSheet->PresetNameAndFamily(*aLst[nLastPos]);
2836cdf0e10cSrcweir // neuer Name gesetzt, also bestimme seine Daten
2837cdf0e10cSrcweir mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2838cdf0e10cSrcweir if( !mxStyleSheet->IsPhysical() )
2839cdf0e10cSrcweir mxStyleSheet->SetPhysical( sal_False );
2840cdf0e10cSrcweir
2841cdf0e10cSrcweir return mxStyleSheet.get();
2842cdf0e10cSrcweir }
2843cdf0e10cSrcweir return 0;
2844cdf0e10cSrcweir }
2845cdf0e10cSrcweir
AppendStyleList(const SvStringsDtor & rList,sal_Bool bTestUsed,sal_uInt16 nSection,char cType)2846cdf0e10cSrcweir void SwStyleSheetIterator::AppendStyleList(const SvStringsDtor& rList,
2847cdf0e10cSrcweir sal_Bool bTestUsed,
2848cdf0e10cSrcweir sal_uInt16 nSection, char cType )
2849cdf0e10cSrcweir {
2850cdf0e10cSrcweir if( bTestUsed )
2851cdf0e10cSrcweir {
2852cdf0e10cSrcweir SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
2853cdf0e10cSrcweir for ( sal_uInt16 i=0; i < rList.Count(); ++i )
2854cdf0e10cSrcweir {
2855cdf0e10cSrcweir sal_Bool bUsed = sal_False;
2856cdf0e10cSrcweir sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(*rList[i], (SwGetPoolIdFromName)nSection);
2857cdf0e10cSrcweir switch ( nSection )
2858cdf0e10cSrcweir {
2859cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
2860cdf0e10cSrcweir bUsed = rDoc.IsPoolTxtCollUsed( nId );
2861cdf0e10cSrcweir break;
2862cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
2863cdf0e10cSrcweir bUsed = rDoc.IsPoolFmtUsed( nId );
2864cdf0e10cSrcweir break;
2865cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
2866cdf0e10cSrcweir bUsed = rDoc.IsPoolFmtUsed( nId );
2867cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
2868cdf0e10cSrcweir bUsed = rDoc.IsPoolPageDescUsed( nId );
2869cdf0e10cSrcweir break;
2870cdf0e10cSrcweir default:
2871cdf0e10cSrcweir ASSERT( !this, "unknown PoolFmt-Id" );
2872cdf0e10cSrcweir }
2873cdf0e10cSrcweir if ( bUsed )
2874cdf0e10cSrcweir aLst.Append( cType, *rList[i] );
2875cdf0e10cSrcweir }
2876cdf0e10cSrcweir }
2877cdf0e10cSrcweir else
2878cdf0e10cSrcweir for ( sal_uInt16 i=0; i < rList.Count(); ++i )
2879cdf0e10cSrcweir aLst.Append( cType, *rList[i] );
2880cdf0e10cSrcweir }
2881cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)2882cdf0e10cSrcweir void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )
2883cdf0e10cSrcweir {
2884cdf0e10cSrcweir // suchen und aus der Anzeige-Liste entfernen !!
2885cdf0e10cSrcweir if( rHint.ISA( SfxStyleSheetHint ) &&
2886cdf0e10cSrcweir SFX_STYLESHEET_ERASED == ((SfxStyleSheetHint&) rHint).GetHint() )
2887cdf0e10cSrcweir {
2888cdf0e10cSrcweir SfxStyleSheetBase* pStyle = ((SfxStyleSheetHint&)rHint).GetStyleSheet();
2889cdf0e10cSrcweir
2890cdf0e10cSrcweir if (pStyle)
2891cdf0e10cSrcweir {
2892cdf0e10cSrcweir sal_uInt16 nTmpPos = lcl_FindName( aLst, pStyle->GetFamily(),
2893cdf0e10cSrcweir pStyle->GetName() );
2894cdf0e10cSrcweir if( nTmpPos < aLst.Count() )
2895cdf0e10cSrcweir aLst.DeleteAndDestroy( nTmpPos );
2896cdf0e10cSrcweir }
2897cdf0e10cSrcweir }
2898cdf0e10cSrcweir }
2899cdf0e10cSrcweir
2900cdf0e10cSrcweir
2901