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