1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <hintids.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen 31cdf0e10cSrcweir #include <vcl/msgbox.hxx> 32cdf0e10cSrcweir #endif 33cdf0e10cSrcweir #include <svl/whiter.hxx> 34cdf0e10cSrcweir #include <svl/stritem.hxx> 35cdf0e10cSrcweir #include <svl/itemiter.hxx> 36cdf0e10cSrcweir #include <svl/ctloptions.hxx> 37cdf0e10cSrcweir #include <swmodule.hxx> 38cdf0e10cSrcweir #include <sfx2/bindings.hxx> 39cdf0e10cSrcweir #include <sfx2/request.hxx> 40cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 41cdf0e10cSrcweir #include <editeng/adjitem.hxx> 42cdf0e10cSrcweir #include <editeng/lspcitem.hxx> 43512ec161SZheng Fan #include <editeng/lrspitem.hxx> 44cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 45cdf0e10cSrcweir #include <editeng/escpitem.hxx> 46cdf0e10cSrcweir #include <svx/htmlmode.hxx> 47cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 48cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 49cdf0e10cSrcweir #include "paratr.hxx" 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <fmtinfmt.hxx> 52cdf0e10cSrcweir #ifndef _DOCSH_HXX 53cdf0e10cSrcweir #include <docsh.hxx> 54cdf0e10cSrcweir #endif 55cdf0e10cSrcweir #include <wrtsh.hxx> 56cdf0e10cSrcweir #ifndef _VIEW_HXX 57cdf0e10cSrcweir #include <view.hxx> 58cdf0e10cSrcweir #endif 59cdf0e10cSrcweir #include <viewopt.hxx> 60cdf0e10cSrcweir #include <uitool.hxx> 61cdf0e10cSrcweir #ifndef _TEXTSH_HXX 62cdf0e10cSrcweir #include <textsh.hxx> 63cdf0e10cSrcweir #endif 64cdf0e10cSrcweir #include <num.hxx> 65cdf0e10cSrcweir #include <swundo.hxx> 66cdf0e10cSrcweir #include <fmtcol.hxx> 67cdf0e10cSrcweir 68cdf0e10cSrcweir #ifndef _CMDID_H 69cdf0e10cSrcweir #include <cmdid.h> 70cdf0e10cSrcweir #endif 71cdf0e10cSrcweir #include <globals.h> 72cdf0e10cSrcweir #ifndef _SHELLS_HRC 73cdf0e10cSrcweir #include <shells.hrc> 74cdf0e10cSrcweir #endif 75cdf0e10cSrcweir #include <SwStyleNameMapper.hxx> 76cdf0e10cSrcweir #include "swabstdlg.hxx" 77cdf0e10cSrcweir #include "chrdlg.hrc" 78cdf0e10cSrcweir const SwTwips lFontInc = 2 * 20; // ==> PointToTwips(2) 79cdf0e10cSrcweir const SwTwips lFontMaxSz = 72 * 20; // ==> PointToTwips(72) 80cdf0e10cSrcweir 81cdf0e10cSrcweir 82cdf0e10cSrcweir 83cdf0e10cSrcweir 84cdf0e10cSrcweir void SwTextShell::ExecCharAttr(SfxRequest &rReq) 85cdf0e10cSrcweir { 86cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 87cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 88cdf0e10cSrcweir int eState = STATE_TOGGLE; 89cdf0e10cSrcweir sal_uInt16 nWhich = rReq.GetSlot(); 90cdf0e10cSrcweir 91cdf0e10cSrcweir if(pArgs ) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir const SfxPoolItem* pItem; 94cdf0e10cSrcweir pArgs->GetItemState(nWhich, sal_False, &pItem); 95cdf0e10cSrcweir eState = ((const SfxBoolItem &) pArgs-> 96cdf0e10cSrcweir Get( nWhich )).GetValue() ? STATE_ON : STATE_OFF; 97cdf0e10cSrcweir } 98cdf0e10cSrcweir 99cdf0e10cSrcweir 100cdf0e10cSrcweir SfxItemSet aSet( GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1 ); 101cdf0e10cSrcweir if (STATE_TOGGLE == eState) 102cdf0e10cSrcweir rSh.GetCurAttr( aSet ); 103cdf0e10cSrcweir 104cdf0e10cSrcweir switch ( nWhich ) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir case FN_SET_SUB_SCRIPT: 107cdf0e10cSrcweir case FN_SET_SUPER_SCRIPT: 108cdf0e10cSrcweir { 109cdf0e10cSrcweir SvxEscapement eEscape = SVX_ESCAPEMENT_SUBSCRIPT; 110cdf0e10cSrcweir switch (eState) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir case STATE_TOGGLE: 113cdf0e10cSrcweir { 114cdf0e10cSrcweir short nTmpEsc = ((const SvxEscapementItem&) 115cdf0e10cSrcweir aSet.Get( RES_CHRATR_ESCAPEMENT )).GetEsc(); 116cdf0e10cSrcweir eEscape = nWhich == FN_SET_SUPER_SCRIPT ? 117cdf0e10cSrcweir SVX_ESCAPEMENT_SUPERSCRIPT: 118cdf0e10cSrcweir SVX_ESCAPEMENT_SUBSCRIPT; 119cdf0e10cSrcweir if( (nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0) || 120cdf0e10cSrcweir (nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0) ) 121cdf0e10cSrcweir eEscape = SVX_ESCAPEMENT_OFF; 122cdf0e10cSrcweir 123cdf0e10cSrcweir SfxBindings& rBind = GetView().GetViewFrame()->GetBindings(); 124cdf0e10cSrcweir if( nWhich == FN_SET_SUB_SCRIPT ) 125cdf0e10cSrcweir rBind.SetState( SfxBoolItem( FN_SET_SUPER_SCRIPT, 126cdf0e10cSrcweir sal_False ) ); 127cdf0e10cSrcweir else 128cdf0e10cSrcweir rBind.SetState( SfxBoolItem( FN_SET_SUB_SCRIPT, 129cdf0e10cSrcweir sal_False ) ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir } 132cdf0e10cSrcweir break; 133cdf0e10cSrcweir case STATE_ON: 134cdf0e10cSrcweir eEscape = nWhich == FN_SET_SUPER_SCRIPT ? 135cdf0e10cSrcweir SVX_ESCAPEMENT_SUPERSCRIPT: 136cdf0e10cSrcweir SVX_ESCAPEMENT_SUBSCRIPT; 137cdf0e10cSrcweir break; 138cdf0e10cSrcweir case STATE_OFF: 139cdf0e10cSrcweir eEscape = SVX_ESCAPEMENT_OFF; 140cdf0e10cSrcweir break; 141cdf0e10cSrcweir } 142cdf0e10cSrcweir SvxEscapementItem aEscape( eEscape, RES_CHRATR_ESCAPEMENT ); 143cdf0e10cSrcweir if(eEscape == SVX_ESCAPEMENT_SUPERSCRIPT) 144cdf0e10cSrcweir aEscape.GetEsc() = DFLT_ESC_AUTO_SUPER; 145cdf0e10cSrcweir else if(eEscape == SVX_ESCAPEMENT_SUBSCRIPT) 146cdf0e10cSrcweir aEscape.GetEsc() = DFLT_ESC_AUTO_SUB; 147cdf0e10cSrcweir if(eState != STATE_OFF ) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir if(eEscape == FN_SET_SUPER_SCRIPT) 150cdf0e10cSrcweir aEscape.GetEsc() *= -1; 151cdf0e10cSrcweir } 15269a74367SOliver-Rainer Wittmann rSh.SetAttrItem( aEscape ); 153cdf0e10cSrcweir rReq.AppendItem( aEscape ); 154cdf0e10cSrcweir rReq.Done(); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir break; 157cdf0e10cSrcweir 158cdf0e10cSrcweir case FN_UPDATE_STYLE_BY_EXAMPLE: 159cdf0e10cSrcweir rSh.QuickUpdateStyle(); 160cdf0e10cSrcweir rReq.Done(); 161cdf0e10cSrcweir break; 162cdf0e10cSrcweir case FN_UNDERLINE_DOUBLE: 163cdf0e10cSrcweir { 164cdf0e10cSrcweir FontUnderline eUnderline = ((const SvxUnderlineItem&) 165cdf0e10cSrcweir aSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle(); 166cdf0e10cSrcweir switch( eState ) 167cdf0e10cSrcweir { 168cdf0e10cSrcweir case STATE_TOGGLE: 169cdf0e10cSrcweir eUnderline = eUnderline == UNDERLINE_DOUBLE ? 170cdf0e10cSrcweir UNDERLINE_NONE : 171cdf0e10cSrcweir UNDERLINE_DOUBLE; 172cdf0e10cSrcweir break; 173cdf0e10cSrcweir case STATE_ON: 174cdf0e10cSrcweir eUnderline = UNDERLINE_DOUBLE; 175cdf0e10cSrcweir break; 176cdf0e10cSrcweir case STATE_OFF: 177cdf0e10cSrcweir eUnderline = UNDERLINE_NONE; 178cdf0e10cSrcweir break; 179cdf0e10cSrcweir } 180cdf0e10cSrcweir SvxUnderlineItem aUnderline(eUnderline, RES_CHRATR_UNDERLINE ); 18169a74367SOliver-Rainer Wittmann rSh.SetAttrItem( aUnderline ); 182cdf0e10cSrcweir rReq.AppendItem( aUnderline ); 183cdf0e10cSrcweir rReq.Done(); 184cdf0e10cSrcweir } 185cdf0e10cSrcweir break; 186cdf0e10cSrcweir case FN_REMOVE_DIRECT_CHAR_FORMATS: 187cdf0e10cSrcweir if( !rSh.HasReadonlySel() && rSh.IsEndPara()) 188cdf0e10cSrcweir rSh.DontExpandFmt(); 189cdf0e10cSrcweir break; 190cdf0e10cSrcweir default: 191cdf0e10cSrcweir ASSERT(sal_False, falscher Dispatcher); 192cdf0e10cSrcweir return; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir 197cdf0e10cSrcweir void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq) 198cdf0e10cSrcweir { 199cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 200cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 201cdf0e10cSrcweir sal_Bool bArgs = pArgs != 0 && pArgs->Count() > 0; 202cdf0e10cSrcweir int bGrow = sal_False; 203cdf0e10cSrcweir SwWrtShell& rWrtSh = GetShell(); 204cdf0e10cSrcweir SwTxtFmtColl* pColl = 0; 205cdf0e10cSrcweir 206cdf0e10cSrcweir // nur gesetzt, wenn gesamter Absatz selektiert ist und AutoUpdateFmt gesetzt ist 207cdf0e10cSrcweir if ( rWrtSh.HasSelection() && rWrtSh.IsSelFullPara() ) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir pColl = rWrtSh.GetCurTxtFmtColl(); 210cdf0e10cSrcweir if ( pColl && !pColl->IsAutoUpdateFmt() ) 211cdf0e10cSrcweir pColl = 0; 212cdf0e10cSrcweir } 213cdf0e10cSrcweir SfxItemPool& rPool = GetPool(); 214cdf0e10cSrcweir sal_uInt16 nWhich = rPool.GetWhich( nSlot ); 215cdf0e10cSrcweir switch (nSlot) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir case FN_TXTATR_INET: 218cdf0e10cSrcweir // Sonderbehandlung der PoolId des SwFmtInetFmt 219cdf0e10cSrcweir if ( bArgs ) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir const SfxPoolItem& rItem = pArgs->Get( nWhich ); 222cdf0e10cSrcweir 223cdf0e10cSrcweir SwFmtINetFmt aINetFmt( (const SwFmtINetFmt&) rItem ); 224cdf0e10cSrcweir if ( USHRT_MAX == aINetFmt.GetVisitedFmtId() ) 225cdf0e10cSrcweir { 226*782a276cSOliver-Rainer Wittmann ASSERT( false, "<SwTextShell::ExecCharAttrArgs(..)> - unexpected visited character format ID at hyperlink attribute" ); 227*782a276cSOliver-Rainer Wittmann aINetFmt.SetVisitedFmtAndId( 228*782a276cSOliver-Rainer Wittmann aINetFmt.GetVisitedFmt(), 229cdf0e10cSrcweir SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetVisitedFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ) ); 230cdf0e10cSrcweir } 231cdf0e10cSrcweir if ( USHRT_MAX == aINetFmt.GetINetFmtId() ) 232cdf0e10cSrcweir { 233*782a276cSOliver-Rainer Wittmann ASSERT( false, "<SwTextShell::ExecCharAttrArgs(..)> - unexpected unvisited character format ID at hyperlink attribute" ); 234*782a276cSOliver-Rainer Wittmann aINetFmt.SetINetFmtAndId( 235*782a276cSOliver-Rainer Wittmann aINetFmt.GetINetFmt(), 236cdf0e10cSrcweir SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetINetFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ) ); 237cdf0e10cSrcweir } 238cdf0e10cSrcweir 239cdf0e10cSrcweir if ( pColl ) 240cdf0e10cSrcweir pColl->SetFmtAttr( aINetFmt ); 241*782a276cSOliver-Rainer Wittmann else 242*782a276cSOliver-Rainer Wittmann rWrtSh.SetAttrItem( aINetFmt ); 243cdf0e10cSrcweir rReq.Done(); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir break; 246cdf0e10cSrcweir 247cdf0e10cSrcweir case FN_GROW_FONT_SIZE: 248cdf0e10cSrcweir bGrow = sal_True; 249cdf0e10cSrcweir // kein break !! 250cdf0e10cSrcweir case FN_SHRINK_FONT_SIZE: 251cdf0e10cSrcweir { 252cdf0e10cSrcweir SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, rPool ); 253cdf0e10cSrcweir rWrtSh.GetCurAttr( aSetItem.GetItemSet() ); 254cdf0e10cSrcweir SfxItemSet aAttrSet( rPool, aSetItem.GetItemSet().GetRanges() ); 255cdf0e10cSrcweir 256cdf0e10cSrcweir const SfxPoolItem* pI; 257cdf0e10cSrcweir static const sal_uInt16 aScrTypes[] = { 258cdf0e10cSrcweir SCRIPTTYPE_LATIN, SCRIPTTYPE_ASIAN, SCRIPTTYPE_COMPLEX, 0 }; 259cdf0e10cSrcweir sal_uInt16 nScriptType = rWrtSh.GetScriptType(); 260cdf0e10cSrcweir for( const sal_uInt16* pScrpTyp = aScrTypes; *pScrpTyp; ++pScrpTyp ) 261cdf0e10cSrcweir if( ( nScriptType & *pScrpTyp ) && 262cdf0e10cSrcweir 0 != ( pI = aSetItem.GetItemOfScript( *pScrpTyp ))) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir SvxFontHeightItem aSize( *(const SvxFontHeightItem*)pI ); 265cdf0e10cSrcweir SwTwips lSize = (SwTwips) aSize.GetHeight(); 266cdf0e10cSrcweir 267cdf0e10cSrcweir if (bGrow) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir if( lSize == lFontMaxSz ) 270cdf0e10cSrcweir break; // das wars, hoeher gehts nicht 271cdf0e10cSrcweir if( ( lSize += lFontInc ) > lFontMaxSz ) 272cdf0e10cSrcweir lSize = lFontMaxSz; 273cdf0e10cSrcweir } 274cdf0e10cSrcweir else 275cdf0e10cSrcweir { 276cdf0e10cSrcweir if( 4 == lSize ) 277cdf0e10cSrcweir break; 278cdf0e10cSrcweir if( ( lSize -= lFontInc ) < 4 ) 279cdf0e10cSrcweir lSize = 4; 280cdf0e10cSrcweir } 281cdf0e10cSrcweir aSize.SetHeight( lSize ); 282cdf0e10cSrcweir aAttrSet.Put( aSize ); 283cdf0e10cSrcweir } 284cdf0e10cSrcweir if( aAttrSet.Count() ) 285cdf0e10cSrcweir { 286cdf0e10cSrcweir if( pColl ) 287cdf0e10cSrcweir pColl->SetFmtAttr( aAttrSet ); 288cdf0e10cSrcweir else 28969a74367SOliver-Rainer Wittmann rWrtSh.SetAttrSet( aAttrSet ); 290cdf0e10cSrcweir } 291cdf0e10cSrcweir rReq.Done(); 292cdf0e10cSrcweir } 293cdf0e10cSrcweir break; 294cdf0e10cSrcweir 295cdf0e10cSrcweir default: 296cdf0e10cSrcweir ASSERT(sal_False, falscher Dispatcher); 297cdf0e10cSrcweir return; 298cdf0e10cSrcweir } 299cdf0e10cSrcweir } 300cdf0e10cSrcweir 301cdf0e10cSrcweir 302cdf0e10cSrcweir 303cdf0e10cSrcweir #ifdef CFRONT 304cdf0e10cSrcweir 305cdf0e10cSrcweir void lcl_SetAdjust(SvxAdjust eAdjst, SfxItemSet& rSet) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir rSet.Put(SvxAdjustItem(eAdjst,RES_PARATR_ADJUST )); 308cdf0e10cSrcweir } 309cdf0e10cSrcweir 310cdf0e10cSrcweir 311cdf0e10cSrcweir 312cdf0e10cSrcweir void lcl_SetLineSpace(sal_uInt8 ePropL,SfxItemSet& rSet) 313cdf0e10cSrcweir { 314cdf0e10cSrcweir SvxLineSpacingItem aLineSpacing(ePropL, RES_PARATR_LINESPACING ); 315cdf0e10cSrcweir aLineSpacing.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 316cdf0e10cSrcweir if( 100 == ePropL ) 317cdf0e10cSrcweir aLineSpacing.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; 318cdf0e10cSrcweir else 319cdf0e10cSrcweir aLineSpacing.SetPropLineSpace(ePropL); 320cdf0e10cSrcweir rSet.Put( aLineSpacing ); 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir 324cdf0e10cSrcweir 325cdf0e10cSrcweir void SwTextShell::ExecParaAttr(SfxRequest &rReq) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir // gleiche beide Attribute holen, ist nicht teuerer !! 328cdf0e10cSrcweir SfxItemSet aSet( GetPool(), RES_PARATR_LINESPACING, RES_PARATR_ADJUST ); 329cdf0e10cSrcweir 330cdf0e10cSrcweir switch (rReq.GetSlot()) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir case FN_SET_LEFT_PARA: lcl_SetAdjust(ADJLEFT,aSet); break; 333cdf0e10cSrcweir case FN_SET_RIGHT_PARA: lcl_SetAdjust(ADJRIGHT,aSet); break; 334cdf0e10cSrcweir case FN_SET_CENTER_PARA: lcl_SetAdjust(ADJCENTER,aSet); break; 335cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK:lcl_SetAdjust(ADJBLOCK,aSet); break; 336cdf0e10cSrcweir 337cdf0e10cSrcweir case FN_SET_LINE_SPACE_1: lcl_SetLineSpace(100,aSet); break; 338cdf0e10cSrcweir case FN_SET_LINE_SPACE_15: lcl_SetLineSpace(150,aSet); break; 339cdf0e10cSrcweir case FN_SET_LINE_SPACE_2: lcl_SetLineSpace(200,aSet); break; 340cdf0e10cSrcweir 341cdf0e10cSrcweir default: 342cdf0e10cSrcweir DBG_ERROR("SwTextShell::ExecParaAttr falscher Dispatcher"); 343cdf0e10cSrcweir return; 344cdf0e10cSrcweir } 345cdf0e10cSrcweir SwWrtShell& rWrtSh = GetShell(); 346cdf0e10cSrcweir SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl(); 347cdf0e10cSrcweir if(pColl && pColl->IsAutoUpdateFmt()) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir rWrtSh.AutoUpdatePara(pColl, *pSet); 350cdf0e10cSrcweir } 351cdf0e10cSrcweir else 352cdf0e10cSrcweir { 35369a74367SOliver-Rainer Wittmann rWrtSh.SetAttrSet( aSet ); 354cdf0e10cSrcweir rReq.Done( aSet ); 355cdf0e10cSrcweir } 356cdf0e10cSrcweir } 357cdf0e10cSrcweir 358cdf0e10cSrcweir #else 359cdf0e10cSrcweir 360cdf0e10cSrcweir 361cdf0e10cSrcweir 362cdf0e10cSrcweir void SwTextShell::ExecParaAttr(SfxRequest &rReq) 363cdf0e10cSrcweir { 364cdf0e10cSrcweir SvxAdjust eAdjst; 365cdf0e10cSrcweir sal_uInt8 ePropL; 366cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 367cdf0e10cSrcweir 368cdf0e10cSrcweir // gleich beide Attribute holen, ist nicht teuerer !! 369cdf0e10cSrcweir SfxItemSet aSet( GetPool(), 370cdf0e10cSrcweir RES_PARATR_LINESPACING, RES_PARATR_ADJUST, 371cdf0e10cSrcweir RES_FRAMEDIR, RES_FRAMEDIR, 372cdf0e10cSrcweir 0 ); 373cdf0e10cSrcweir 374cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 375cdf0e10cSrcweir switch (nSlot) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST: 378cdf0e10cSrcweir { 379cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_PARATR_ADJUST) ) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir const SvxAdjustItem& rAdj = (const SvxAdjustItem&) pArgs->Get(RES_PARATR_ADJUST); 382cdf0e10cSrcweir SvxAdjustItem aAdj( rAdj.GetAdjust(), RES_PARATR_ADJUST ); 383cdf0e10cSrcweir if ( rAdj.GetAdjust() == SVX_ADJUST_BLOCK ) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir aAdj.SetLastBlock( rAdj.GetLastBlock() ); 386cdf0e10cSrcweir aAdj.SetOneWord( rAdj.GetOneWord() ); 387cdf0e10cSrcweir } 388cdf0e10cSrcweir 389cdf0e10cSrcweir aSet.Put(aAdj); 390cdf0e10cSrcweir } 391cdf0e10cSrcweir } 392cdf0e10cSrcweir break; 393cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_LEFT: eAdjst = SVX_ADJUST_LEFT; goto SET_ADJUST; 394cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_RIGHT: eAdjst = SVX_ADJUST_RIGHT; goto SET_ADJUST; 395cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_CENTER: eAdjst = SVX_ADJUST_CENTER; goto SET_ADJUST; 396cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK: eAdjst = SVX_ADJUST_BLOCK; goto SET_ADJUST; 397cdf0e10cSrcweir SET_ADJUST: 398cdf0e10cSrcweir { 399cdf0e10cSrcweir aSet.Put(SvxAdjustItem(eAdjst,RES_PARATR_ADJUST)); 400cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), sal_True ) ); 401cdf0e10cSrcweir } 402cdf0e10cSrcweir break; 403cdf0e10cSrcweir 404cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE: 405cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( GetPool().GetWhich(nSlot) )) 406cdf0e10cSrcweir { 407cdf0e10cSrcweir SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pArgs->Get( 408cdf0e10cSrcweir GetPool().GetWhich(nSlot)); 409cdf0e10cSrcweir aSet.Put( aLineSpace ); 410cdf0e10cSrcweir } 411cdf0e10cSrcweir break; 412cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_10: ePropL = 100; goto SET_LINESPACE; 413cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_15: ePropL = 150; goto SET_LINESPACE; 414cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_20: ePropL = 200; goto SET_LINESPACE; 415cdf0e10cSrcweir 416cdf0e10cSrcweir SET_LINESPACE: 417cdf0e10cSrcweir { 418cdf0e10cSrcweir 419cdf0e10cSrcweir SvxLineSpacingItem aLineSpacing(ePropL, RES_PARATR_LINESPACING ); 420cdf0e10cSrcweir aLineSpacing.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 421cdf0e10cSrcweir if( 100 == ePropL ) 422cdf0e10cSrcweir aLineSpacing.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; 423cdf0e10cSrcweir else 424cdf0e10cSrcweir aLineSpacing.SetPropLineSpace(ePropL); 425cdf0e10cSrcweir aSet.Put( aLineSpacing ); 426cdf0e10cSrcweir } 427cdf0e10cSrcweir break; 428cdf0e10cSrcweir 429cdf0e10cSrcweir case SID_ATTR_PARA_LEFT_TO_RIGHT : 430cdf0e10cSrcweir case SID_ATTR_PARA_RIGHT_TO_LEFT : 431cdf0e10cSrcweir { 432cdf0e10cSrcweir sal_Bool bSet = sal_True; 433cdf0e10cSrcweir int eState = pArgs ? pArgs->GetItemState(nSlot) : SFX_ITEM_DISABLED; 434cdf0e10cSrcweir if (pArgs && SFX_ITEM_SET == eState) 435cdf0e10cSrcweir bSet = ((const SfxBoolItem&)pArgs->Get(nSlot)).GetValue(); 436cdf0e10cSrcweir /* 437cdf0e10cSrcweir // toggling of the slots not used anymore 438cdf0e10cSrcweir 439cdf0e10cSrcweir if(!bSet) 440cdf0e10cSrcweir nSlot = SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot ? 441cdf0e10cSrcweir SID_ATTR_PARA_RIGHT_TO_LEFT : 442cdf0e10cSrcweir SID_ATTR_PARA_LEFT_TO_RIGHT; 443cdf0e10cSrcweir */ 444cdf0e10cSrcweir SfxItemSet aAdjustSet( GetPool(), 445cdf0e10cSrcweir RES_PARATR_ADJUST, RES_PARATR_ADJUST ); 446cdf0e10cSrcweir GetShell().GetCurAttr(aAdjustSet); 447cdf0e10cSrcweir sal_Bool bChgAdjust = sal_False; 448cdf0e10cSrcweir SfxItemState eAdjustState = aAdjustSet.GetItemState(RES_PARATR_ADJUST, sal_False); 449cdf0e10cSrcweir if(eAdjustState >= SFX_ITEM_DEFAULT) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir int eAdjust = (int)(( const SvxAdjustItem& ) 452cdf0e10cSrcweir aAdjustSet.Get(RES_PARATR_ADJUST)).GetAdjust(); 453cdf0e10cSrcweir // bChgAdjust = SVX_ADJUST_CENTER != eAdjust && SVX_ADJUST_BLOCK != eAdjust; 454cdf0e10cSrcweir bChgAdjust = (SVX_ADJUST_LEFT == eAdjust && SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot) || 455cdf0e10cSrcweir (SVX_ADJUST_RIGHT == eAdjust && SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot); 456cdf0e10cSrcweir } 457cdf0e10cSrcweir else 458cdf0e10cSrcweir bChgAdjust = sal_True; 459cdf0e10cSrcweir 460cdf0e10cSrcweir SvxFrameDirection eFrmDirection = 461cdf0e10cSrcweir (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot) ? 462cdf0e10cSrcweir FRMDIR_HORI_LEFT_TOP : FRMDIR_HORI_RIGHT_TOP; 463cdf0e10cSrcweir aSet.Put( SvxFrameDirectionItem( eFrmDirection, RES_FRAMEDIR ) ); 464cdf0e10cSrcweir 465cdf0e10cSrcweir if (bChgAdjust) 466cdf0e10cSrcweir { 467cdf0e10cSrcweir SvxAdjust eAdjust = (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot) ? 468cdf0e10cSrcweir SVX_ADJUST_LEFT : SVX_ADJUST_RIGHT; 469cdf0e10cSrcweir SvxAdjustItem aAdjust( eAdjust, RES_PARATR_ADJUST ); 470cdf0e10cSrcweir aSet.Put( aAdjust ); 471cdf0e10cSrcweir aAdjust.SetWhich(SID_ATTR_PARA_ADJUST); 472cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetState( aAdjust ); 473cdf0e10cSrcweir // Toggle numbering alignment 474cdf0e10cSrcweir const SwNumRule* pCurRule = GetShell().GetCurNumRule(); 475cdf0e10cSrcweir if( pCurRule ) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir SvxNumRule aRule = pCurRule->MakeSvxNumRule(); 478cdf0e10cSrcweir 479cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aRule.GetLevelCount(); i++) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir SvxNumberFormat aFmt(aRule.GetLevel(i)); 482cdf0e10cSrcweir if(SVX_ADJUST_LEFT == aFmt.GetNumAdjust()) 483cdf0e10cSrcweir aFmt.SetNumAdjust( SVX_ADJUST_RIGHT ); 484cdf0e10cSrcweir 485cdf0e10cSrcweir else if(SVX_ADJUST_RIGHT == aFmt.GetNumAdjust()) 486cdf0e10cSrcweir aFmt.SetNumAdjust( SVX_ADJUST_LEFT ); 487cdf0e10cSrcweir 488cdf0e10cSrcweir aRule.SetLevel(i, aFmt, aRule.Get(i) != 0); 489cdf0e10cSrcweir } 490cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs# 491cdf0e10cSrcweir SwNumRule aSetRule( pCurRule->GetName(), 492cdf0e10cSrcweir pCurRule->Get( 0 ).GetPositionAndSpaceMode() ); 493cdf0e10cSrcweir // <-- 494cdf0e10cSrcweir aSetRule.SetSvxRule( aRule, GetShell().GetDoc()); 495cdf0e10cSrcweir aSetRule.SetAutoRule( sal_True ); 496cdf0e10cSrcweir // --> OD 2008-03-17 #refactorlists# 497cdf0e10cSrcweir // no start or continuation of a list - list style is only changed 498cdf0e10cSrcweir GetShell().SetCurNumRule( aSetRule, false ); 499cdf0e10cSrcweir // <-- 500cdf0e10cSrcweir } 501cdf0e10cSrcweir } 502cdf0e10cSrcweir } 503cdf0e10cSrcweir break; 504cdf0e10cSrcweir 505cdf0e10cSrcweir default: 506cdf0e10cSrcweir ASSERT(sal_False, falscher Dispatcher); 507cdf0e10cSrcweir return; 508cdf0e10cSrcweir } 509cdf0e10cSrcweir SwWrtShell& rWrtSh = GetShell(); 510cdf0e10cSrcweir SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl(); 511cdf0e10cSrcweir if(pColl && pColl->IsAutoUpdateFmt()) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir rWrtSh.AutoUpdatePara(pColl, aSet); 514cdf0e10cSrcweir } 515cdf0e10cSrcweir else 51669a74367SOliver-Rainer Wittmann rWrtSh.SetAttrSet( aSet ); 517cdf0e10cSrcweir rReq.Done(); 518cdf0e10cSrcweir } 519cdf0e10cSrcweir 520cdf0e10cSrcweir #endif 521cdf0e10cSrcweir 522cdf0e10cSrcweir 523cdf0e10cSrcweir 524cdf0e10cSrcweir void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) 525cdf0e10cSrcweir { 526cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 527cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 528cdf0e10cSrcweir const SfxPoolItem *pItem = 0; 529cdf0e10cSrcweir 530cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 531cdf0e10cSrcweir if(pArgs) 532cdf0e10cSrcweir pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem); 533cdf0e10cSrcweir switch ( nSlot ) 534cdf0e10cSrcweir { 535cdf0e10cSrcweir case FN_DROP_CHAR_STYLE_NAME: 536cdf0e10cSrcweir if( pItem ) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir String sCharStyleName = ((const SfxStringItem*)pItem)->GetValue(); 539cdf0e10cSrcweir SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP, 0L); 540cdf0e10cSrcweir rSh.GetCurAttr(aSet); 541cdf0e10cSrcweir SwFmtDrop aDropItem((const SwFmtDrop&)aSet.Get(RES_PARATR_DROP)); 542cdf0e10cSrcweir SwCharFmt* pFmt = 0; 543cdf0e10cSrcweir if(sCharStyleName.Len()) 544cdf0e10cSrcweir pFmt = rSh.FindCharFmtByName( sCharStyleName ); 545cdf0e10cSrcweir aDropItem.SetCharFmt( pFmt ); 546cdf0e10cSrcweir aSet.Put(aDropItem); 54769a74367SOliver-Rainer Wittmann rSh.SetAttrSet(aSet); 548cdf0e10cSrcweir } 549cdf0e10cSrcweir break; 550cdf0e10cSrcweir case FN_FORMAT_DROPCAPS: 551cdf0e10cSrcweir { 552cdf0e10cSrcweir if(pItem) 553cdf0e10cSrcweir { 55469a74367SOliver-Rainer Wittmann rSh.SetAttrItem(*pItem); 555cdf0e10cSrcweir rReq.Done(); 556cdf0e10cSrcweir } 557cdf0e10cSrcweir else 558cdf0e10cSrcweir { 559cdf0e10cSrcweir SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP, 560cdf0e10cSrcweir HINT_END, HINT_END, 0); 561cdf0e10cSrcweir rSh.GetCurAttr(aSet); 562cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 563cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 564cdf0e10cSrcweir 565cdf0e10cSrcweir SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aSet, 566cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), DLG_SWDROPCAPS ); 567cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 568cdf0e10cSrcweir if (pDlg->Execute() == RET_OK) 569cdf0e10cSrcweir { 570cdf0e10cSrcweir rSh.StartAction(); 571cdf0e10cSrcweir rSh.StartUndo( UNDO_START ); 572cdf0e10cSrcweir if ( SFX_ITEM_SET == aSet.GetItemState(HINT_END,sal_False,&pItem) ) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir if ( ((SfxStringItem*)pItem)->GetValue().Len() ) 575cdf0e10cSrcweir rSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue()); 576cdf0e10cSrcweir } 57769a74367SOliver-Rainer Wittmann rSh.SetAttrSet(*pDlg->GetOutputItemSet()); 578cdf0e10cSrcweir rSh.StartUndo( UNDO_END ); 579cdf0e10cSrcweir rSh.EndAction(); 580cdf0e10cSrcweir rReq.Done(*pDlg->GetOutputItemSet()); 581cdf0e10cSrcweir } 582cdf0e10cSrcweir delete pDlg; 583cdf0e10cSrcweir } 584cdf0e10cSrcweir } 585cdf0e10cSrcweir break; 586cdf0e10cSrcweir case SID_ATTR_PARA_PAGEBREAK: 587cdf0e10cSrcweir if(pItem) 588cdf0e10cSrcweir { 58969a74367SOliver-Rainer Wittmann rSh.SetAttrItem( *pItem ); 590cdf0e10cSrcweir rReq.Done(); 591cdf0e10cSrcweir } 592cdf0e10cSrcweir break; 593cdf0e10cSrcweir case SID_ATTR_PARA_MODEL: 594cdf0e10cSrcweir { 595cdf0e10cSrcweir if(pItem) 596cdf0e10cSrcweir { 597cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), 598cdf0e10cSrcweir RES_PAGEDESC, RES_PAGEDESC, 599cdf0e10cSrcweir SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL, 0); 600cdf0e10cSrcweir aCoreSet.Put(*pItem); 601cdf0e10cSrcweir SfxToSwPageDescAttr( rSh, aCoreSet); 60269a74367SOliver-Rainer Wittmann rSh.SetAttrSet(aCoreSet); 603cdf0e10cSrcweir rReq.Done(); 604cdf0e10cSrcweir } 605cdf0e10cSrcweir } 606cdf0e10cSrcweir break; 607cdf0e10cSrcweir 608cdf0e10cSrcweir default: 609cdf0e10cSrcweir ASSERT(sal_False, falscher Dispatcher); 610cdf0e10cSrcweir return; 611cdf0e10cSrcweir } 612cdf0e10cSrcweir } 613cdf0e10cSrcweir 614cdf0e10cSrcweir 615cdf0e10cSrcweir 616cdf0e10cSrcweir void SwTextShell::GetAttrState(SfxItemSet &rSet) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 619cdf0e10cSrcweir SfxItemPool& rPool = GetPool(); 620cdf0e10cSrcweir SfxItemSet aCoreSet(rPool, aTxtFmtCollSetRange); 621cdf0e10cSrcweir rSh.GetCurAttr(aCoreSet); // *alle* Textattribute von der Core erfragen 622cdf0e10cSrcweir 623cdf0e10cSrcweir SfxWhichIter aIter(rSet); 624cdf0e10cSrcweir sal_uInt16 nSlot = aIter.FirstWhich(); 625cdf0e10cSrcweir sal_Bool bFlag = sal_False; 626cdf0e10cSrcweir SfxBoolItem aFlagItem; 627cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 628cdf0e10cSrcweir int eAdjust = -1; // Illegaler Wert, um DONTCARE zu erkennen 629cdf0e10cSrcweir SfxItemState eState = aCoreSet.GetItemState(RES_PARATR_ADJUST, sal_False, &pItem); 630cdf0e10cSrcweir 631cdf0e10cSrcweir if( SFX_ITEM_DEFAULT == eState ) 632cdf0e10cSrcweir pItem = &rPool.GetDefaultItem(RES_PARATR_ADJUST); 633cdf0e10cSrcweir if( SFX_ITEM_DEFAULT <= eState ) 634cdf0e10cSrcweir eAdjust = (int)(( SvxAdjustItem* ) pItem)->GetAdjust(); 635cdf0e10cSrcweir 636cdf0e10cSrcweir short nEsc = 0; 637cdf0e10cSrcweir eState = aCoreSet.GetItemState(RES_CHRATR_ESCAPEMENT, sal_False, &pItem); 638cdf0e10cSrcweir if( SFX_ITEM_DEFAULT == eState ) 639cdf0e10cSrcweir pItem = &rPool.GetDefaultItem(RES_CHRATR_ESCAPEMENT); 640cdf0e10cSrcweir if( eState >= SFX_ITEM_DEFAULT ) 641cdf0e10cSrcweir nEsc = ((SvxEscapementItem* )pItem)->GetEsc(); 642cdf0e10cSrcweir 643cdf0e10cSrcweir sal_uInt16 nLineSpace = 0; 644cdf0e10cSrcweir eState = aCoreSet.GetItemState(RES_PARATR_LINESPACING, sal_False, &pItem); 645cdf0e10cSrcweir if( SFX_ITEM_DEFAULT == eState ) 646cdf0e10cSrcweir pItem = &rPool.GetDefaultItem(RES_PARATR_LINESPACING); 647cdf0e10cSrcweir if( SFX_ITEM_DEFAULT <= eState && 648cdf0e10cSrcweir ((SvxLineSpacingItem* )pItem)->GetLineSpaceRule() == SVX_LINE_SPACE_AUTO ) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir if(SVX_INTER_LINE_SPACE_OFF == 651cdf0e10cSrcweir ((SvxLineSpacingItem* )pItem)->GetInterLineSpaceRule()) 652cdf0e10cSrcweir nLineSpace = 100; 653cdf0e10cSrcweir else 654cdf0e10cSrcweir nLineSpace = ((SvxLineSpacingItem* )pItem)->GetPropLineSpace(); 655cdf0e10cSrcweir } 656cdf0e10cSrcweir 657cdf0e10cSrcweir while (nSlot) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir switch(nSlot) 660cdf0e10cSrcweir { 661cdf0e10cSrcweir case FN_SET_SUPER_SCRIPT: 662cdf0e10cSrcweir bFlag = 0 < nEsc; 663cdf0e10cSrcweir break; 664cdf0e10cSrcweir case FN_SET_SUB_SCRIPT: 665cdf0e10cSrcweir bFlag = 0 > nEsc; 666cdf0e10cSrcweir break; 667cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_LEFT: 668cdf0e10cSrcweir if (eAdjust == -1) 669cdf0e10cSrcweir { 670cdf0e10cSrcweir rSet.InvalidateItem( nSlot ); 671cdf0e10cSrcweir nSlot = 0; 672cdf0e10cSrcweir } 673cdf0e10cSrcweir else 674cdf0e10cSrcweir bFlag = SVX_ADJUST_LEFT == eAdjust; 675cdf0e10cSrcweir break; 676cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_RIGHT: 677cdf0e10cSrcweir if (eAdjust == -1) 678cdf0e10cSrcweir { 679cdf0e10cSrcweir rSet.InvalidateItem( nSlot ); 680cdf0e10cSrcweir nSlot = 0; 681cdf0e10cSrcweir } 682cdf0e10cSrcweir else 683cdf0e10cSrcweir bFlag = SVX_ADJUST_RIGHT == eAdjust; 684cdf0e10cSrcweir break; 685cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_CENTER: 686cdf0e10cSrcweir if (eAdjust == -1) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir rSet.InvalidateItem( nSlot ); 689cdf0e10cSrcweir nSlot = 0; 690cdf0e10cSrcweir } 691cdf0e10cSrcweir else 692cdf0e10cSrcweir bFlag = SVX_ADJUST_CENTER == eAdjust; 693cdf0e10cSrcweir break; 694cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK: 695cdf0e10cSrcweir { 696cdf0e10cSrcweir if (eAdjust == -1) 697cdf0e10cSrcweir { 698cdf0e10cSrcweir rSet.InvalidateItem( nSlot ); 699cdf0e10cSrcweir nSlot = 0; 700cdf0e10cSrcweir } 701cdf0e10cSrcweir else 702cdf0e10cSrcweir { 703cdf0e10cSrcweir bFlag = SVX_ADJUST_BLOCK == eAdjust; 704cdf0e10cSrcweir sal_uInt16 nHtmlMode = GetHtmlMode(rSh.GetView().GetDocShell()); 705cdf0e10cSrcweir if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & (HTMLMODE_FULL_STYLES|HTMLMODE_FIRSTLINE) )) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir rSet.DisableItem( nSlot ); 708cdf0e10cSrcweir nSlot = 0; 709cdf0e10cSrcweir } 710cdf0e10cSrcweir } 711cdf0e10cSrcweir } 712cdf0e10cSrcweir break; 713cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_10: 714cdf0e10cSrcweir bFlag = nLineSpace == 100; 715cdf0e10cSrcweir break; 716cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_15: 717cdf0e10cSrcweir bFlag = nLineSpace == 150; 718cdf0e10cSrcweir break; 719cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_20: 720cdf0e10cSrcweir bFlag = nLineSpace == 200; 721cdf0e10cSrcweir break; 722cdf0e10cSrcweir case FN_GROW_FONT_SIZE: 723cdf0e10cSrcweir case FN_SHRINK_FONT_SIZE: 724cdf0e10cSrcweir { 725cdf0e10cSrcweir SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, 726cdf0e10cSrcweir *rSet.GetPool() ); 727cdf0e10cSrcweir aSetItem.GetItemSet().Put( aCoreSet, sal_False ); 728cdf0e10cSrcweir if( !aSetItem.GetItemOfScript( rSh.GetScriptType() )) 729cdf0e10cSrcweir rSet.DisableItem( nSlot ); 730cdf0e10cSrcweir nSlot = 0; 731cdf0e10cSrcweir } 732cdf0e10cSrcweir break; 733cdf0e10cSrcweir case FN_UNDERLINE_DOUBLE: 734cdf0e10cSrcweir { 735cdf0e10cSrcweir eState = aCoreSet.GetItemState(RES_CHRATR_UNDERLINE); 736cdf0e10cSrcweir if( eState >= SFX_ITEM_DEFAULT ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir FontUnderline eUnderline = ((const SvxUnderlineItem&) 739cdf0e10cSrcweir aCoreSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle(); 740cdf0e10cSrcweir rSet.Put(SfxBoolItem(nSlot, eUnderline == UNDERLINE_DOUBLE)); 741cdf0e10cSrcweir } 742cdf0e10cSrcweir else 743cdf0e10cSrcweir rSet.InvalidateItem(nSlot); 744cdf0e10cSrcweir nSlot = 0; 745cdf0e10cSrcweir } 746cdf0e10cSrcweir break; 747cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST: 748cdf0e10cSrcweir if (eAdjust == -1) 749cdf0e10cSrcweir rSet.InvalidateItem( nSlot ); 750cdf0e10cSrcweir else 751cdf0e10cSrcweir rSet.Put(SvxAdjustItem((SvxAdjust)eAdjust, SID_ATTR_PARA_ADJUST )); 752cdf0e10cSrcweir nSlot = 0; 753cdf0e10cSrcweir break; 754512ec161SZheng Fan case SID_ATTR_PARA_LRSPACE: 755512ec161SZheng Fan { 756512ec161SZheng Fan eState = aCoreSet.GetItemState(RES_LR_SPACE); 757512ec161SZheng Fan if( eState >= SFX_ITEM_DEFAULT ) 758512ec161SZheng Fan { 759512ec161SZheng Fan SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aCoreSet.Get( RES_LR_SPACE ) ); 760512ec161SZheng Fan aLR.SetWhich(SID_ATTR_PARA_LRSPACE); 761512ec161SZheng Fan rSet.Put(aLR); 762512ec161SZheng Fan } 763512ec161SZheng Fan else 764512ec161SZheng Fan rSet.InvalidateItem(nSlot); 765512ec161SZheng Fan nSlot = 0; 766512ec161SZheng Fan } 767cdf0e10cSrcweir 768cdf0e10cSrcweir case SID_ATTR_PARA_LEFT_TO_RIGHT : 769cdf0e10cSrcweir case SID_ATTR_PARA_RIGHT_TO_LEFT : 770cdf0e10cSrcweir { 771cdf0e10cSrcweir if ( !SW_MOD()->GetCTLOptions().IsCTLFontEnabled() ) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir rSet.DisableItem( nSlot ); 774cdf0e10cSrcweir nSlot = 0; 775cdf0e10cSrcweir } 776cdf0e10cSrcweir else 777cdf0e10cSrcweir { 778cdf0e10cSrcweir // is the item set? 779cdf0e10cSrcweir sal_uInt16 nHtmlMode = GetHtmlMode(rSh.GetView().GetDocShell()); 780cdf0e10cSrcweir if((!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES))) && 781cdf0e10cSrcweir aCoreSet.GetItemState( RES_FRAMEDIR, sal_False ) >= SFX_ITEM_DEFAULT) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir SvxFrameDirection eFrmDir = (SvxFrameDirection) 784cdf0e10cSrcweir ((const SvxFrameDirectionItem& )aCoreSet.Get(RES_FRAMEDIR)).GetValue(); 785cdf0e10cSrcweir if (FRMDIR_ENVIRONMENT == eFrmDir) 786cdf0e10cSrcweir { 787cdf0e10cSrcweir eFrmDir = rSh.IsInRightToLeftText() ? 788cdf0e10cSrcweir FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP; 789cdf0e10cSrcweir } 790cdf0e10cSrcweir bFlag = (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot && 791cdf0e10cSrcweir FRMDIR_HORI_LEFT_TOP == eFrmDir) || 792cdf0e10cSrcweir (SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot && 793cdf0e10cSrcweir FRMDIR_HORI_RIGHT_TOP == eFrmDir); 794cdf0e10cSrcweir } 795cdf0e10cSrcweir else 796cdf0e10cSrcweir { 797cdf0e10cSrcweir rSet.InvalidateItem(nSlot); 798cdf0e10cSrcweir nSlot = 0; 799cdf0e10cSrcweir } 800cdf0e10cSrcweir } 801cdf0e10cSrcweir } 802cdf0e10cSrcweir break; 803cdf0e10cSrcweir 804cdf0e10cSrcweir case SID_ATTR_CHAR_LANGUAGE: 805cdf0e10cSrcweir case SID_ATTR_CHAR_KERNING: 806cdf0e10cSrcweir case RES_PARATR_DROP: 807cdf0e10cSrcweir { 808cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 809cdf0e10cSrcweir const SfxPoolItem& rItem = aCoreSet.Get(GetPool().GetWhich(nSlot), sal_True); 810cdf0e10cSrcweir rSet.Put(rItem); 811cdf0e10cSrcweir #else 812cdf0e10cSrcweir rSet.Put(aCoreSet.Get( GetPool().GetWhich(nSlot), sal_True)); 813cdf0e10cSrcweir #endif 814cdf0e10cSrcweir nSlot = 0; 815cdf0e10cSrcweir } 816cdf0e10cSrcweir break; 817cdf0e10cSrcweir case SID_ATTR_PARA_MODEL: 818cdf0e10cSrcweir { 819cdf0e10cSrcweir SfxItemSet aTemp(GetPool(), 820cdf0e10cSrcweir RES_PAGEDESC,RES_PAGEDESC, 821cdf0e10cSrcweir SID_ATTR_PARA_MODEL,SID_ATTR_PARA_MODEL, 822cdf0e10cSrcweir 0L); 823cdf0e10cSrcweir aTemp.Put(aCoreSet); 824cdf0e10cSrcweir ::SwToSfxPageDescAttr(aTemp); 825cdf0e10cSrcweir rSet.Put(aTemp.Get(SID_ATTR_PARA_MODEL)); 826cdf0e10cSrcweir nSlot = 0; 827cdf0e10cSrcweir } 828cdf0e10cSrcweir break; 829cdf0e10cSrcweir case RES_TXTATR_INETFMT: 830cdf0e10cSrcweir { 831cdf0e10cSrcweir SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT); 832cdf0e10cSrcweir rSh.GetCurAttr(aSet); 833cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 834cdf0e10cSrcweir const SfxPoolItem& rItem = aSet.Get(RES_TXTATR_INETFMT, sal_True); 835cdf0e10cSrcweir rSet.Put(rItem); 836cdf0e10cSrcweir #else 837cdf0e10cSrcweir rSet.Put(aSet.Get( RES_TXTATR_INETFMT, sal_True)); 838cdf0e10cSrcweir #endif 839cdf0e10cSrcweir nSlot = 0; 840cdf0e10cSrcweir } 841cdf0e10cSrcweir break; 842cdf0e10cSrcweir 843cdf0e10cSrcweir default: 844cdf0e10cSrcweir // Nichts tun 845cdf0e10cSrcweir nSlot = 0; 846cdf0e10cSrcweir break; 847cdf0e10cSrcweir 848cdf0e10cSrcweir } 849cdf0e10cSrcweir if( nSlot ) 850cdf0e10cSrcweir { 851cdf0e10cSrcweir aFlagItem.SetWhich( nSlot ); 852cdf0e10cSrcweir aFlagItem.SetValue( bFlag ); 853cdf0e10cSrcweir rSet.Put( aFlagItem ); 854cdf0e10cSrcweir } 855cdf0e10cSrcweir nSlot = aIter.NextWhich(); 856cdf0e10cSrcweir } 857cdf0e10cSrcweir 858cdf0e10cSrcweir rSet.Put(aCoreSet,sal_False); 859cdf0e10cSrcweir } 860cdf0e10cSrcweir 861cdf0e10cSrcweir 862cdf0e10cSrcweir 863