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