15b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 55b190011SAndrew Rist * distributed with this work for additional information 65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 85b190011SAndrew Rist * "License"); you may not use this file except in compliance 95b190011SAndrew Rist * with the License. You may obtain a copy of the License at 105b190011SAndrew Rist * 115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 125b190011SAndrew Rist * 135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 145b190011SAndrew Rist * software distributed under the License is distributed on an 155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165b190011SAndrew Rist * KIND, either express or implied. See the License for the 175b190011SAndrew Rist * specific language governing permissions and limitations 185b190011SAndrew Rist * under the License. 195b190011SAndrew Rist * 205b190011SAndrew Rist *************************************************************/ 215b190011SAndrew Rist 225b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "TextObjectBar.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <svx/svxids.hrc> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <editeng/editview.hxx> 33cdf0e10cSrcweir #include <editeng/editeng.hxx> 34cdf0e10cSrcweir #include <editeng/unolingu.hxx> 35cdf0e10cSrcweir #include <editeng/outliner.hxx> 36cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 37cdf0e10cSrcweir #include <editeng/lspcitem.hxx> 38cdf0e10cSrcweir #include <editeng/adjitem.hxx> 39cdf0e10cSrcweir #include <vcl/vclenum.hxx> 40cdf0e10cSrcweir #include <sfx2/app.hxx> 41cdf0e10cSrcweir #include <svl/whiter.hxx> 42cdf0e10cSrcweir #include <svl/itempool.hxx> 43cdf0e10cSrcweir #include <svl/style.hxx> 44cdf0e10cSrcweir #include <sfx2/tplpitem.hxx> 45cdf0e10cSrcweir #include <sfx2/request.hxx> 46cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 47cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 48cdf0e10cSrcweir #include <editeng/escpitem.hxx> 49cdf0e10cSrcweir #include <editeng/wghtitem.hxx> 50cdf0e10cSrcweir #include <editeng/postitem.hxx> 51cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 52cdf0e10cSrcweir #include <editeng/crsditem.hxx> 53cdf0e10cSrcweir #include <editeng/cntritem.hxx> 54cdf0e10cSrcweir #include <editeng/shdditem.hxx> 55cdf0e10cSrcweir #include <svx/xtable.hxx> 56cdf0e10cSrcweir #include <svx/svdobj.hxx> 57cdf0e10cSrcweir #include <editeng/outlobj.hxx> 58cdf0e10cSrcweir #include <editeng/flstitem.hxx> 59cdf0e10cSrcweir #include <editeng/editeng.hxx> 60cdf0e10cSrcweir #include <svl/intitem.hxx> 61cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 62cdf0e10cSrcweir #include <svx/svdoutl.hxx> 63cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx> 64cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 65cdf0e10cSrcweir #include <svl/itemiter.hxx> 66cdf0e10cSrcweir 67cdf0e10cSrcweir 68cdf0e10cSrcweir #include "app.hrc" 69cdf0e10cSrcweir 70cdf0e10cSrcweir #include "eetext.hxx" 71cdf0e10cSrcweir #include "ViewShell.hxx" 72cdf0e10cSrcweir #include "drawview.hxx" 73cdf0e10cSrcweir #include "drawdoc.hxx" 74cdf0e10cSrcweir #include "OutlineView.hxx" 75cdf0e10cSrcweir #include "Window.hxx" 76cdf0e10cSrcweir #include "futempl.hxx" 77cdf0e10cSrcweir #include "DrawDocShell.hxx" 78cdf0e10cSrcweir #include "Outliner.hxx" 79cdf0e10cSrcweir #include "futext.hxx" 80cdf0e10cSrcweir 81cdf0e10cSrcweir namespace sd { 82cdf0e10cSrcweir 83cdf0e10cSrcweir /************************************************************************* 84cdf0e10cSrcweir |* 85cdf0e10cSrcweir |* Bearbeitung der SfxRequests 86cdf0e10cSrcweir |* 87cdf0e10cSrcweir \************************************************************************/ 88cdf0e10cSrcweir 89cdf0e10cSrcweir void TextObjectBar::Execute( SfxRequest &rReq ) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 92cdf0e10cSrcweir const SfxPoolItem* pPoolItem = NULL; 93cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 94cdf0e10cSrcweir sal_Bool bOutlineMode = sal_False; 95cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 96cdf0e10cSrcweir 97cdf0e10cSrcweir std::auto_ptr< OutlineViewModelChangeGuard > aGuard; 98cdf0e10cSrcweir 99cdf0e10cSrcweir if (mpView->ISA(OutlineView)) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir bOutlineMode = sal_True; 102cdf0e10cSrcweir pOLV = static_cast<OutlineView*>(mpView) 103cdf0e10cSrcweir ->GetViewByWindow(mpViewShell->GetActiveWindow()); 104cdf0e10cSrcweir 105cdf0e10cSrcweir aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) ); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir switch (nSlot) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir case SID_STYLE_APPLY: 111cdf0e10cSrcweir { 112cdf0e10cSrcweir if( pArgs ) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir SdDrawDocument* pDoc = mpView->GetDoc(); 115cdf0e10cSrcweir OSL_ASSERT (mpViewShell->GetViewShell()!=NULL); 116cdf0e10cSrcweir FunctionReference xFunc( FuTemplate::Create( mpViewShell, static_cast< ::sd::Window*>( mpViewShell->GetViewShell()->GetWindow()), mpView, pDoc, rReq ) ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir if(xFunc.is()) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir xFunc->Activate(); 121cdf0e10cSrcweir xFunc->Deactivate(); 122cdf0e10cSrcweir 123cdf0e10cSrcweir if( rReq.GetSlot() == SID_STYLE_APPLY ) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir if( mpViewShell && mpViewShell->GetViewFrame() ) 126cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY ); 127cdf0e10cSrcweir } 128cdf0e10cSrcweir } 129cdf0e10cSrcweir } 130cdf0e10cSrcweir else 131cdf0e10cSrcweir { 132cdf0e10cSrcweir if( mpViewShell && mpViewShell->GetViewFrame() ) 133cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON ); 134cdf0e10cSrcweir } 135cdf0e10cSrcweir 136cdf0e10cSrcweir rReq.Done(); 137cdf0e10cSrcweir } 138cdf0e10cSrcweir break; 139cdf0e10cSrcweir 140cdf0e10cSrcweir case SID_PARASPACE_INCREASE: 141cdf0e10cSrcweir case SID_PARASPACE_DECREASE: 142cdf0e10cSrcweir { 143cdf0e10cSrcweir if( pOLV ) 144cdf0e10cSrcweir { 145cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection(); 146cdf0e10cSrcweir aSel.Adjust(); 147cdf0e10cSrcweir sal_uLong nStartPara = aSel.nStartPara; 148cdf0e10cSrcweir sal_uLong nEndPara = aSel.nEndPara; 149cdf0e10cSrcweir if( !aSel.HasRange() ) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir nStartPara = 0; 152cdf0e10cSrcweir nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir for( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ ) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = NULL; 157cdf0e10cSrcweir if (pOLV->GetOutliner() != NULL) 158cdf0e10cSrcweir pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara); 159cdf0e10cSrcweir if (pStyleSheet != NULL) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir SfxItemSet aAttr( pStyleSheet->GetItemSet() ); 162cdf0e10cSrcweir SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( (sal_uInt16) nPara ) ); 163cdf0e10cSrcweir aAttr.Put( aTmpSet, sal_False ); // sal_False= InvalidItems nicht als Default, sondern als "Loecher" betrachten 164cdf0e10cSrcweir const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aAttr.Get( EE_PARA_ULSPACE ); 165cdf0e10cSrcweir SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone(); 166cdf0e10cSrcweir 167cdf0e10cSrcweir long nUpper = pNewItem->GetUpper(); 168cdf0e10cSrcweir if( nSlot == SID_PARASPACE_INCREASE ) 169cdf0e10cSrcweir nUpper += 100; 170cdf0e10cSrcweir else 171cdf0e10cSrcweir { 172cdf0e10cSrcweir nUpper -= 100; 173cdf0e10cSrcweir nUpper = Max( (long) nUpper, 0L ); 174cdf0e10cSrcweir } 175cdf0e10cSrcweir pNewItem->SetUpper( (sal_uInt16) nUpper ); 176cdf0e10cSrcweir 177cdf0e10cSrcweir long nLower = pNewItem->GetLower(); 178cdf0e10cSrcweir if( nSlot == SID_PARASPACE_INCREASE ) 179cdf0e10cSrcweir nLower += 100; 180cdf0e10cSrcweir else 181cdf0e10cSrcweir { 182cdf0e10cSrcweir nLower -= 100; 183cdf0e10cSrcweir nLower = Max( (long) nLower, 0L ); 184cdf0e10cSrcweir } 185cdf0e10cSrcweir pNewItem->SetLower( (sal_uInt16) nLower ); 186cdf0e10cSrcweir 187cdf0e10cSrcweir SfxItemSet aNewAttrs( aAttr ); 188cdf0e10cSrcweir aNewAttrs.Put( *pNewItem ); 189cdf0e10cSrcweir delete pNewItem; 190cdf0e10cSrcweir pOLV->GetOutliner()->SetParaAttribs( (sal_uInt16)nPara, aNewAttrs ); 191cdf0e10cSrcweir } 192cdf0e10cSrcweir } 193cdf0e10cSrcweir } 194cdf0e10cSrcweir else 195cdf0e10cSrcweir { 196cdf0e10cSrcweir // Der folgende Code kann enabled werden, wenn ich von 197cdf0e10cSrcweir // JOE einen richtigen Status (DontCare) bekomme; 198cdf0e10cSrcweir 199cdf0e10cSrcweir // Wird enabled, obwohl es nicht richtig funktioniert (s.o.) 200cdf0e10cSrcweir SfxItemSet aEditAttr( mpView->GetDoc()->GetPool() ); 201cdf0e10cSrcweir mpView->GetAttributes( aEditAttr ); 202cdf0e10cSrcweir if( aEditAttr.GetItemState( EE_PARA_ULSPACE ) >= SFX_ITEM_AVAILABLE ) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir SfxItemSet aNewAttrs(*(aEditAttr.GetPool()), aEditAttr.GetRanges()); 205cdf0e10cSrcweir const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE ); 206cdf0e10cSrcweir SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone(); 207cdf0e10cSrcweir long nUpper = pNewItem->GetUpper(); 208cdf0e10cSrcweir 209cdf0e10cSrcweir if( nSlot == SID_PARASPACE_INCREASE ) 210cdf0e10cSrcweir nUpper += 100; 211cdf0e10cSrcweir else 212cdf0e10cSrcweir { 213cdf0e10cSrcweir nUpper -= 100; 214cdf0e10cSrcweir nUpper = Max( (long) nUpper, 0L ); 215cdf0e10cSrcweir } 216cdf0e10cSrcweir pNewItem->SetUpper( (sal_uInt16) nUpper ); 217cdf0e10cSrcweir 218cdf0e10cSrcweir long nLower = pNewItem->GetLower(); 219cdf0e10cSrcweir if( nSlot == SID_PARASPACE_INCREASE ) 220cdf0e10cSrcweir nLower += 100; 221cdf0e10cSrcweir else 222cdf0e10cSrcweir { 223cdf0e10cSrcweir nLower -= 100; 224cdf0e10cSrcweir nLower = Max( (long) nLower, 0L ); 225cdf0e10cSrcweir } 226cdf0e10cSrcweir pNewItem->SetLower( (sal_uInt16) nLower ); 227cdf0e10cSrcweir 228cdf0e10cSrcweir aNewAttrs.Put( *pNewItem ); 229cdf0e10cSrcweir delete pNewItem; 230cdf0e10cSrcweir 231cdf0e10cSrcweir mpView->SetAttributes( aNewAttrs ); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir rReq.Done(); 235cdf0e10cSrcweir 236cdf0e10cSrcweir Invalidate(); 237cdf0e10cSrcweir // Um die Preview (im Gliederungsmodus) zu aktualisieren muss 238cdf0e10cSrcweir // der Slot invalidiert werden: 239cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False ); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir break; 242cdf0e10cSrcweir 243cdf0e10cSrcweir case SID_OUTLINE_LEFT: 244*766ce4d0SZheng Fan case SID_ATTR_PARA_LEFT: 245cdf0e10cSrcweir { 246cdf0e10cSrcweir if (pOLV) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir pOLV->AdjustDepth( -1 ); 249cdf0e10cSrcweir 250cdf0e10cSrcweir // Ensure bold/italic etc. icon state updates 251cdf0e10cSrcweir Invalidate(); 252cdf0e10cSrcweir // #96551# trigger preview refresh 253cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False ); 254cdf0e10cSrcweir } 255cdf0e10cSrcweir rReq.Done(); 256cdf0e10cSrcweir } 257cdf0e10cSrcweir break; 258cdf0e10cSrcweir 259cdf0e10cSrcweir case SID_OUTLINE_RIGHT: 260*766ce4d0SZheng Fan case SID_ATTR_PARA_RIGHT: 261cdf0e10cSrcweir { 262cdf0e10cSrcweir if (pOLV) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir pOLV->AdjustDepth( 1 ); 265cdf0e10cSrcweir 266cdf0e10cSrcweir // Ensure bold/italic etc. icon state updates 267cdf0e10cSrcweir Invalidate(); 268cdf0e10cSrcweir // #96551# trigger preview refresh 269cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False ); 270cdf0e10cSrcweir } 271cdf0e10cSrcweir rReq.Done(); 272cdf0e10cSrcweir } 273cdf0e10cSrcweir break; 274cdf0e10cSrcweir 275*766ce4d0SZheng Fan case SID_ATTR_PARA_LRSPACE: 276*766ce4d0SZheng Fan { 277*766ce4d0SZheng Fan sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE; 278*766ce4d0SZheng Fan SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get( 279*766ce4d0SZheng Fan GetPool().GetWhich(nSlot)); 280*766ce4d0SZheng Fan 281*766ce4d0SZheng Fan SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); 282*766ce4d0SZheng Fan aLRSpace.SetWhich( EE_PARA_LRSPACE ); 283*766ce4d0SZheng Fan 284*766ce4d0SZheng Fan aEditAttr.Put( aLRSpace ); 285*766ce4d0SZheng Fan mpView->SetAttributes( aEditAttr ); 286*766ce4d0SZheng Fan 287*766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_LRSPACE); 288*766ce4d0SZheng Fan } 289*766ce4d0SZheng Fan break; 290*766ce4d0SZheng Fan 291cdf0e10cSrcweir case SID_OUTLINE_UP: 292cdf0e10cSrcweir { 293cdf0e10cSrcweir if (pOLV) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir pOLV->AdjustHeight( -1 ); 296cdf0e10cSrcweir 297cdf0e10cSrcweir // #96551# trigger preview refresh 298cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False ); 299cdf0e10cSrcweir } 300cdf0e10cSrcweir rReq.Done(); 301cdf0e10cSrcweir } 302cdf0e10cSrcweir break; 303cdf0e10cSrcweir 304cdf0e10cSrcweir case SID_OUTLINE_DOWN: 305cdf0e10cSrcweir { 306cdf0e10cSrcweir if (pOLV) 307cdf0e10cSrcweir { 308cdf0e10cSrcweir pOLV->AdjustHeight( 1 ); 309cdf0e10cSrcweir 310cdf0e10cSrcweir // #96551# trigger preview refresh 311cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False ); 312cdf0e10cSrcweir } 313cdf0e10cSrcweir rReq.Done(); 314cdf0e10cSrcweir } 315cdf0e10cSrcweir break; 316cdf0e10cSrcweir 317cdf0e10cSrcweir case SID_TEXTDIRECTION_LEFT_TO_RIGHT: 318cdf0e10cSrcweir case SID_TEXTDIRECTION_TOP_TO_BOTTOM: 319cdf0e10cSrcweir { 320cdf0e10cSrcweir mpView->SdrEndTextEdit(); 321cdf0e10cSrcweir SfxItemSet aAttr( mpView->GetDoc()->GetPool(), SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, 0 ); 322cdf0e10cSrcweir aAttr.Put( SvxWritingModeItem( 323cdf0e10cSrcweir nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ? 324cdf0e10cSrcweir com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL, 325cdf0e10cSrcweir SDRATTR_TEXTDIRECTION ) ); 326cdf0e10cSrcweir rReq.Done( aAttr ); 327cdf0e10cSrcweir mpView->SetAttributes( aAttr ); 328cdf0e10cSrcweir Invalidate(); 329cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False ); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir break; 332cdf0e10cSrcweir 333cdf0e10cSrcweir case FN_NUM_BULLET_ON: 334cdf0e10cSrcweir if( pOLV ) 335cdf0e10cSrcweir pOLV->ToggleBullets(); 336cdf0e10cSrcweir break; 337cdf0e10cSrcweir 338cdf0e10cSrcweir case SID_GROW_FONT_SIZE: 339cdf0e10cSrcweir case SID_SHRINK_FONT_SIZE: 340cdf0e10cSrcweir { 341cdf0e10cSrcweir const SvxFontListItem* pFonts = (const SvxFontListItem*)mpViewShell->GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ); 342cdf0e10cSrcweir const FontList* pFontList = pFonts ? pFonts->GetFontList(): 0; 343cdf0e10cSrcweir if( pFontList ) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir FuText::ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pOLV, pFontList, mpView ); 346cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); 347cdf0e10cSrcweir } 348cdf0e10cSrcweir rReq.Done(); 349cdf0e10cSrcweir } 350cdf0e10cSrcweir break; 351cdf0e10cSrcweir 352cdf0e10cSrcweir case SID_THES: 353cdf0e10cSrcweir { 354cdf0e10cSrcweir String aReplaceText; 355cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); 356cdf0e10cSrcweir if (pItem2) 357cdf0e10cSrcweir aReplaceText = pItem2->GetValue(); 358cdf0e10cSrcweir if (aReplaceText.Len() > 0) 359cdf0e10cSrcweir ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); 360cdf0e10cSrcweir } 361cdf0e10cSrcweir break; 362cdf0e10cSrcweir 363cdf0e10cSrcweir default: 364cdf0e10cSrcweir { 365cdf0e10cSrcweir SfxItemSet aEditAttr( mpView->GetDoc()->GetPool() ); 366cdf0e10cSrcweir mpView->GetAttributes( aEditAttr ); 367cdf0e10cSrcweir SfxItemSet aNewAttr(*(aEditAttr.GetPool()), aEditAttr.GetRanges()); 368cdf0e10cSrcweir 369cdf0e10cSrcweir if( !pArgs ) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir //aNewAttr.InvalidateAllItems(); <- Macht Probleme (#35465#) 372cdf0e10cSrcweir 373cdf0e10cSrcweir switch ( nSlot ) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 376cdf0e10cSrcweir { 377cdf0e10cSrcweir FontWeight eFW = ( (const SvxWeightItem&) aEditAttr. 378cdf0e10cSrcweir Get( EE_CHAR_WEIGHT ) ).GetWeight(); 379cdf0e10cSrcweir aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ? 380cdf0e10cSrcweir WEIGHT_BOLD : WEIGHT_NORMAL, 381cdf0e10cSrcweir EE_CHAR_WEIGHT ) ); 382cdf0e10cSrcweir } 383cdf0e10cSrcweir break; 384cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 385cdf0e10cSrcweir { 386cdf0e10cSrcweir FontItalic eFI = ( (const SvxPostureItem&) aEditAttr. 387cdf0e10cSrcweir Get( EE_CHAR_ITALIC ) ).GetPosture(); 388cdf0e10cSrcweir aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ? 389cdf0e10cSrcweir ITALIC_NONE : ITALIC_NORMAL, 390cdf0e10cSrcweir EE_CHAR_ITALIC ) ); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir break; 393cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE: 394cdf0e10cSrcweir { 395cdf0e10cSrcweir FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr. 396cdf0e10cSrcweir Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); 397cdf0e10cSrcweir aNewAttr.Put( SvxUnderlineItem( eFU == UNDERLINE_SINGLE ? 398cdf0e10cSrcweir UNDERLINE_NONE : UNDERLINE_SINGLE, 399cdf0e10cSrcweir EE_CHAR_UNDERLINE ) ); 400cdf0e10cSrcweir } 401cdf0e10cSrcweir break; 402cdf0e10cSrcweir case SID_ATTR_CHAR_OVERLINE: 403cdf0e10cSrcweir { 404cdf0e10cSrcweir FontUnderline eFO = ( (const SvxOverlineItem&) aEditAttr. 405cdf0e10cSrcweir Get( EE_CHAR_OVERLINE ) ).GetLineStyle(); 406cdf0e10cSrcweir aNewAttr.Put( SvxOverlineItem( eFO == UNDERLINE_SINGLE ? 407cdf0e10cSrcweir UNDERLINE_NONE : UNDERLINE_SINGLE, 408cdf0e10cSrcweir EE_CHAR_OVERLINE ) ); 409cdf0e10cSrcweir } 410cdf0e10cSrcweir break; 411cdf0e10cSrcweir case SID_ATTR_CHAR_CONTOUR: 412cdf0e10cSrcweir { 413cdf0e10cSrcweir aNewAttr.Put( SvxContourItem( !( (const SvxContourItem&) aEditAttr. 414cdf0e10cSrcweir Get( EE_CHAR_OUTLINE ) ).GetValue(), EE_CHAR_OUTLINE ) ); 415cdf0e10cSrcweir } 416cdf0e10cSrcweir break; 417cdf0e10cSrcweir case SID_ATTR_CHAR_SHADOWED: 418cdf0e10cSrcweir { 419cdf0e10cSrcweir aNewAttr.Put( SvxShadowedItem( !( (const SvxShadowedItem&) aEditAttr. 420cdf0e10cSrcweir Get( EE_CHAR_SHADOW ) ).GetValue(), EE_CHAR_SHADOW ) ); 421cdf0e10cSrcweir } 422cdf0e10cSrcweir break; 423cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT: 424cdf0e10cSrcweir { 425cdf0e10cSrcweir FontStrikeout eFSO = ( ( (const SvxCrossedOutItem&) aEditAttr. 426cdf0e10cSrcweir Get( EE_CHAR_STRIKEOUT ) ).GetStrikeout() ); 427cdf0e10cSrcweir aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ? 428cdf0e10cSrcweir STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) ); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir break; 431cdf0e10cSrcweir 432cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_LEFT: 433cdf0e10cSrcweir { 434cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir break; 437cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_CENTER: 438cdf0e10cSrcweir { 439cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) ); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir break; 442cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_RIGHT: 443cdf0e10cSrcweir { 444cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); 445cdf0e10cSrcweir } 446cdf0e10cSrcweir break; 447cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK: 448cdf0e10cSrcweir { 449cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) ); 450cdf0e10cSrcweir } 451cdf0e10cSrcweir break; 452cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_10: 453cdf0e10cSrcweir { 454cdf0e10cSrcweir SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_LINE, EE_PARA_SBL ); 455cdf0e10cSrcweir aItem.SetPropLineSpace( 100 ); 456cdf0e10cSrcweir aNewAttr.Put( aItem ); 457cdf0e10cSrcweir } 458cdf0e10cSrcweir break; 459cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_15: 460cdf0e10cSrcweir { 461cdf0e10cSrcweir SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL ); 462cdf0e10cSrcweir aItem.SetPropLineSpace( 150 ); 463cdf0e10cSrcweir aNewAttr.Put( aItem ); 464cdf0e10cSrcweir } 465cdf0e10cSrcweir break; 466cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_20: 467cdf0e10cSrcweir { 468cdf0e10cSrcweir SvxLineSpacingItem aItem( SVX_LINESPACE_TWO_LINES, EE_PARA_SBL ); 469cdf0e10cSrcweir aItem.SetPropLineSpace( 200 ); 470cdf0e10cSrcweir aNewAttr.Put( aItem ); 471cdf0e10cSrcweir } 472cdf0e10cSrcweir break; 473cdf0e10cSrcweir case SID_SET_SUPER_SCRIPT: 474cdf0e10cSrcweir { 475cdf0e10cSrcweir SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); 476cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) 477cdf0e10cSrcweir aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 478cdf0e10cSrcweir 479cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) 480cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); 481cdf0e10cSrcweir else 482cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); 483cdf0e10cSrcweir aNewAttr.Put( aItem ); 484cdf0e10cSrcweir } 485cdf0e10cSrcweir break; 486cdf0e10cSrcweir case SID_SET_SUB_SCRIPT: 487cdf0e10cSrcweir { 488cdf0e10cSrcweir SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); 489cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) 490cdf0e10cSrcweir aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 491cdf0e10cSrcweir 492cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) 493cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); 494cdf0e10cSrcweir else 495cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); 496cdf0e10cSrcweir aNewAttr.Put( aItem ); 497cdf0e10cSrcweir } 498cdf0e10cSrcweir break; 499cdf0e10cSrcweir 500cdf0e10cSrcweir // Attribute fuer die TextObjectBar 501cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 502cdf0e10cSrcweir { 503cdf0e10cSrcweir if( pArgs ) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_FONTINFO, sal_True, &pPoolItem ) ) 506cdf0e10cSrcweir aNewAttr.Put( *pPoolItem ); 507cdf0e10cSrcweir } 508cdf0e10cSrcweir else 509cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 510cdf0e10cSrcweir Execute( SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON ); 511cdf0e10cSrcweir } 512cdf0e10cSrcweir break; 513cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 514cdf0e10cSrcweir { 515cdf0e10cSrcweir if( pArgs ) 516cdf0e10cSrcweir { 517cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_FONTHEIGHT, sal_True, &pPoolItem ) ) 518cdf0e10cSrcweir aNewAttr.Put( *pPoolItem ); 519cdf0e10cSrcweir } 520cdf0e10cSrcweir else 521cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()-> 522cdf0e10cSrcweir Execute( SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON ); 523cdf0e10cSrcweir } 524cdf0e10cSrcweir break; 525cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR: 526cdf0e10cSrcweir { 527cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_COLOR, sal_True, &pPoolItem ) ) 528cdf0e10cSrcweir aNewAttr.Put( *pPoolItem ); 529cdf0e10cSrcweir } 530cdf0e10cSrcweir break; 531cdf0e10cSrcweir /* #i35937# 532cdf0e10cSrcweir case FN_NUM_BULLET_ON: 533cdf0e10cSrcweir { 534cdf0e10cSrcweir if (aEditAttr.GetItemState(EE_PARA_BULLETSTATE) == SFX_ITEM_ON) 535cdf0e10cSrcweir { 536cdf0e10cSrcweir SfxUInt16Item aBulletState((const SfxUInt16Item&) aEditAttr.Get(EE_PARA_BULLETSTATE)); 537cdf0e10cSrcweir 538cdf0e10cSrcweir if (aBulletState.GetValue() != 0) 539cdf0e10cSrcweir { 540cdf0e10cSrcweir // Ausschalten 541cdf0e10cSrcweir aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 0)); 542cdf0e10cSrcweir } 543cdf0e10cSrcweir else 544cdf0e10cSrcweir { 545cdf0e10cSrcweir // Einschalten 546cdf0e10cSrcweir aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 1)); 547cdf0e10cSrcweir } 548cdf0e10cSrcweir } 549cdf0e10cSrcweir else 550cdf0e10cSrcweir { 551cdf0e10cSrcweir // Einschalten 552cdf0e10cSrcweir aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 1)); 553cdf0e10cSrcweir } 554cdf0e10cSrcweir } 555cdf0e10cSrcweir break; 556cdf0e10cSrcweir */ 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir rReq.Done( aNewAttr ); 560cdf0e10cSrcweir pArgs = rReq.GetArgs(); 561cdf0e10cSrcweir } 562cdf0e10cSrcweir else if ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT || 563cdf0e10cSrcweir nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT ) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT; 566cdf0e10cSrcweir 567cdf0e10cSrcweir sal_uInt16 nAdjust = SVX_ADJUST_LEFT; 568cdf0e10cSrcweir if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) ) 569cdf0e10cSrcweir nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue(); 570cdf0e10cSrcweir 571cdf0e10cSrcweir if( bLeftToRight ) 572cdf0e10cSrcweir { 573cdf0e10cSrcweir aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) ); 574cdf0e10cSrcweir if( nAdjust == SVX_ADJUST_RIGHT ) 575cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); 576cdf0e10cSrcweir } 577cdf0e10cSrcweir else 578cdf0e10cSrcweir { 579cdf0e10cSrcweir aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) ); 580cdf0e10cSrcweir if( nAdjust == SVX_ADJUST_LEFT ) 581cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); 582cdf0e10cSrcweir } 583cdf0e10cSrcweir 584cdf0e10cSrcweir rReq.Done( aNewAttr ); 585cdf0e10cSrcweir pArgs = rReq.GetArgs(); 586cdf0e10cSrcweir 587cdf0e10cSrcweir Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT ); 588cdf0e10cSrcweir } 589cdf0e10cSrcweir else if ( nSlot == SID_ATTR_CHAR_FONT || 590cdf0e10cSrcweir nSlot == SID_ATTR_CHAR_FONTHEIGHT || 591cdf0e10cSrcweir nSlot == SID_ATTR_CHAR_POSTURE || 592cdf0e10cSrcweir nSlot == SID_ATTR_CHAR_WEIGHT ) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir // #i78017 establish the same behaviour as in Writer 595cdf0e10cSrcweir sal_uInt16 nScriptType = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX; 596cdf0e10cSrcweir if (nSlot == SID_ATTR_CHAR_FONT) 597cdf0e10cSrcweir nScriptType = mpView->GetScriptType(); 598cdf0e10cSrcweir 599cdf0e10cSrcweir SfxItemPool& rPool = mpView->GetDoc()->GetPool(); 600cdf0e10cSrcweir SvxScriptSetItem aSvxScriptSetItem( nSlot, rPool ); 601cdf0e10cSrcweir aSvxScriptSetItem.PutItemForScriptType( nScriptType, pArgs->Get( rPool.GetWhich( nSlot ) ) ); 602cdf0e10cSrcweir aNewAttr.Put( aSvxScriptSetItem.GetItemSet() ); 603cdf0e10cSrcweir rReq.Done( aNewAttr ); 604cdf0e10cSrcweir pArgs = rReq.GetArgs(); 605cdf0e10cSrcweir } 606*766ce4d0SZheng Fan else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT || 607*766ce4d0SZheng Fan nSlot == SID_ATTR_PARA_ADJUST_CENTER || 608*766ce4d0SZheng Fan nSlot == SID_ATTR_PARA_ADJUST_RIGHT || 609*766ce4d0SZheng Fan nSlot == SID_ATTR_PARA_ADJUST_BLOCK) 610*766ce4d0SZheng Fan { 611*766ce4d0SZheng Fan switch( nSlot ) 612*766ce4d0SZheng Fan { 613*766ce4d0SZheng Fan case SID_ATTR_PARA_ADJUST_LEFT: 614*766ce4d0SZheng Fan { 615*766ce4d0SZheng Fan aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); 616*766ce4d0SZheng Fan } 617*766ce4d0SZheng Fan break; 618*766ce4d0SZheng Fan case SID_ATTR_PARA_ADJUST_CENTER: 619*766ce4d0SZheng Fan { 620*766ce4d0SZheng Fan aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) ); 621*766ce4d0SZheng Fan } 622*766ce4d0SZheng Fan break; 623*766ce4d0SZheng Fan case SID_ATTR_PARA_ADJUST_RIGHT: 624*766ce4d0SZheng Fan { 625*766ce4d0SZheng Fan aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); 626*766ce4d0SZheng Fan } 627*766ce4d0SZheng Fan break; 628*766ce4d0SZheng Fan case SID_ATTR_PARA_ADJUST_BLOCK: 629*766ce4d0SZheng Fan { 630*766ce4d0SZheng Fan aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) ); 631*766ce4d0SZheng Fan } 632*766ce4d0SZheng Fan break; 633*766ce4d0SZheng Fan } 634*766ce4d0SZheng Fan rReq.Done( aNewAttr ); 635*766ce4d0SZheng Fan pArgs = rReq.GetArgs(); 636*766ce4d0SZheng Fan } 637*766ce4d0SZheng Fan else if(nSlot == SID_ATTR_CHAR_KERNING) 638*766ce4d0SZheng Fan { 639*766ce4d0SZheng Fan aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot))); 640*766ce4d0SZheng Fan rReq.Done( aNewAttr ); 641*766ce4d0SZheng Fan pArgs = rReq.GetArgs(); 642*766ce4d0SZheng Fan } 643*766ce4d0SZheng Fan else if(nSlot == SID_SET_SUPER_SCRIPT ) 644*766ce4d0SZheng Fan { 645*766ce4d0SZheng Fan SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); 646*766ce4d0SZheng Fan SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) 647*766ce4d0SZheng Fan aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 648*766ce4d0SZheng Fan 649*766ce4d0SZheng Fan if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) 650*766ce4d0SZheng Fan aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); 651*766ce4d0SZheng Fan else 652*766ce4d0SZheng Fan aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); 653*766ce4d0SZheng Fan aNewAttr.Put( aItem ); 654*766ce4d0SZheng Fan rReq.Done( aNewAttr ); 655*766ce4d0SZheng Fan pArgs = rReq.GetArgs(); 656*766ce4d0SZheng Fan } 657*766ce4d0SZheng Fan else if( nSlot == SID_SET_SUB_SCRIPT ) 658*766ce4d0SZheng Fan { 659*766ce4d0SZheng Fan SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); 660*766ce4d0SZheng Fan SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) 661*766ce4d0SZheng Fan aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 662*766ce4d0SZheng Fan 663*766ce4d0SZheng Fan if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) 664*766ce4d0SZheng Fan aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); 665*766ce4d0SZheng Fan else 666*766ce4d0SZheng Fan aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); 667*766ce4d0SZheng Fan aNewAttr.Put( aItem ); 668*766ce4d0SZheng Fan rReq.Done( aNewAttr ); 669*766ce4d0SZheng Fan pArgs = rReq.GetArgs(); 670*766ce4d0SZheng Fan } 671cdf0e10cSrcweir 672cdf0e10cSrcweir mpView->SetAttributes(*pArgs); 673cdf0e10cSrcweir 674cdf0e10cSrcweir // Aus Performance- und Erweiterungsgruenden wird 675cdf0e10cSrcweir // jetzt die komplette Shell invalidiert 676cdf0e10cSrcweir Invalidate(); 677cdf0e10cSrcweir 678cdf0e10cSrcweir // Um die Preview (im Gliederungsmodus) zu aktualisieren muss 679cdf0e10cSrcweir // der Slot invalidiert werden: 680cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False ); 681cdf0e10cSrcweir } 682cdf0e10cSrcweir break; 683cdf0e10cSrcweir } 684cdf0e10cSrcweir 685cdf0e10cSrcweir Invalidate( SID_OUTLINE_LEFT ); 686cdf0e10cSrcweir Invalidate( SID_OUTLINE_RIGHT ); 687cdf0e10cSrcweir Invalidate( SID_OUTLINE_UP ); 688cdf0e10cSrcweir Invalidate( SID_OUTLINE_DOWN ); 689cdf0e10cSrcweir } 690cdf0e10cSrcweir 691cdf0e10cSrcweir } // end of namespace sd 692