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