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