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 10cdf0e10cSrcweir * 115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 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 #include <svx/svxids.hrc> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 32cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 33cdf0e10cSrcweir #include <editeng/lspcitem.hxx> 34cdf0e10cSrcweir #include <editeng/adjitem.hxx> 35cdf0e10cSrcweir #include <editeng/editview.hxx> 36cdf0e10cSrcweir #include <editeng/editeng.hxx> 37cdf0e10cSrcweir #include <editeng/outliner.hxx> 38cdf0e10cSrcweir #include <editeng/unolingu.hxx> 39cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 40cdf0e10cSrcweir #include <editeng/lspcitem.hxx> 41cdf0e10cSrcweir #include <editeng/adjitem.hxx> 42cdf0e10cSrcweir #include <vcl/vclenum.hxx> 43cdf0e10cSrcweir #include <sfx2/app.hxx> 44cdf0e10cSrcweir #include <svl/whiter.hxx> 45cdf0e10cSrcweir #include <svl/itempool.hxx> 46cdf0e10cSrcweir #include <svl/stritem.hxx> 47cdf0e10cSrcweir #include <svl/style.hxx> 48cdf0e10cSrcweir #include <svl/languageoptions.hxx> 49cdf0e10cSrcweir #include <sfx2/tplpitem.hxx> 50cdf0e10cSrcweir #include <editeng/escpitem.hxx> 51cdf0e10cSrcweir #include <svx/svdoutl.hxx> 52cdf0e10cSrcweir #include <svl/intitem.hxx> 53cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 54cdf0e10cSrcweir #include <editeng/outlobj.hxx> 55cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx> 56cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 57cdf0e10cSrcweir 58cdf0e10cSrcweir 59cdf0e10cSrcweir #include <sfx2/objface.hxx> 60cdf0e10cSrcweir 61cdf0e10cSrcweir #include "app.hrc" 62cdf0e10cSrcweir #include "glob.hrc" 63cdf0e10cSrcweir #include "res_bmp.hrc" 64cdf0e10cSrcweir 65cdf0e10cSrcweir #include "eetext.hxx" 66cdf0e10cSrcweir 67cdf0e10cSrcweir #include "drawdoc.hxx" 68cdf0e10cSrcweir #include "DrawViewShell.hxx" 69cdf0e10cSrcweir #include "OutlineViewShell.hxx" 70cdf0e10cSrcweir #include "ViewShellBase.hxx" 71cdf0e10cSrcweir #include "ToolBarManager.hxx" 72cdf0e10cSrcweir #include "futempl.hxx" 73cdf0e10cSrcweir #include "sdresid.hxx" 74cdf0e10cSrcweir #include "Window.hxx" 75cdf0e10cSrcweir #include "OutlineView.hxx" 76cdf0e10cSrcweir 77cdf0e10cSrcweir 78cdf0e10cSrcweir using namespace sd; 79cdf0e10cSrcweir using namespace ::com::sun::star; 80cdf0e10cSrcweir 81cdf0e10cSrcweir #define TextObjectBar 82cdf0e10cSrcweir #include "sdslots.hxx" 83cdf0e10cSrcweir 84cdf0e10cSrcweir namespace sd { 85cdf0e10cSrcweir 86cdf0e10cSrcweir /************************************************************************* 87cdf0e10cSrcweir |* 88cdf0e10cSrcweir |* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also 89cdf0e10cSrcweir |* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt). 90cdf0e10cSrcweir |* 91cdf0e10cSrcweir \************************************************************************/ 92cdf0e10cSrcweir 93cdf0e10cSrcweir 94cdf0e10cSrcweir SFX_IMPL_INTERFACE( TextObjectBar, SfxShell, SdResId(STR_TEXTOBJECTBARSHELL) ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir } 97cdf0e10cSrcweir 98cdf0e10cSrcweir TYPEINIT1( TextObjectBar, SfxShell ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir /************************************************************************* 101cdf0e10cSrcweir |* 102cdf0e10cSrcweir |* Standard-Konstruktor 103cdf0e10cSrcweir |* 104cdf0e10cSrcweir \************************************************************************/ 105cdf0e10cSrcweir 106cdf0e10cSrcweir TextObjectBar::TextObjectBar ( 107cdf0e10cSrcweir ViewShell* pSdViewSh, 108cdf0e10cSrcweir SfxItemPool& rItemPool, 109cdf0e10cSrcweir ::sd::View* pSdView ) 110cdf0e10cSrcweir : SfxShell(pSdViewSh->GetViewShell()), 111cdf0e10cSrcweir mpViewShell( pSdViewSh ), 112cdf0e10cSrcweir mpView( pSdView ) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir SetPool(&rItemPool); 115cdf0e10cSrcweir 116cdf0e10cSrcweir if( mpView ) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir OutlineView* pOutlinerView = dynamic_cast< OutlineView* >( mpView ); 119cdf0e10cSrcweir if( pOutlinerView ) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir SetUndoManager(&pOutlinerView->GetOutliner()->GetUndoManager()); 122cdf0e10cSrcweir } 123cdf0e10cSrcweir else 124cdf0e10cSrcweir { 125cdf0e10cSrcweir SdDrawDocument* pDoc = mpView->GetDoc(); 126cdf0e10cSrcweir if( pDoc ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir DrawDocShell* pDocShell = pDoc->GetDocSh(); 129cdf0e10cSrcweir if( pDocShell ) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir SetUndoManager(pDocShell->GetUndoManager()); 132cdf0e10cSrcweir DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( pSdViewSh ); 133cdf0e10cSrcweir if ( pDrawViewShell ) 134cdf0e10cSrcweir SetRepeatTarget(pSdView); 135cdf0e10cSrcweir } 136cdf0e10cSrcweir } 137cdf0e10cSrcweir } 138cdf0e10cSrcweir } 139cdf0e10cSrcweir 140cdf0e10cSrcweir SetName( String( RTL_CONSTASCII_USTRINGPARAM( "TextObjectBar" ))); 141cdf0e10cSrcweir 142cdf0e10cSrcweir // SetHelpId( SD_IF_SDDRAWTEXTOBJECTBAR ); 143cdf0e10cSrcweir } 144cdf0e10cSrcweir 145cdf0e10cSrcweir /************************************************************************* 146cdf0e10cSrcweir |* 147cdf0e10cSrcweir |* Destruktor 148cdf0e10cSrcweir |* 149cdf0e10cSrcweir \************************************************************************/ 150cdf0e10cSrcweir 151cdf0e10cSrcweir TextObjectBar::~TextObjectBar() 152cdf0e10cSrcweir { 153cdf0e10cSrcweir SetRepeatTarget(NULL); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir 156cdf0e10cSrcweir /************************************************************************* 157cdf0e10cSrcweir |* 158cdf0e10cSrcweir |* Status der Attribut-Items 159cdf0e10cSrcweir |* 160cdf0e10cSrcweir \************************************************************************/ 161cdf0e10cSrcweir 162cdf0e10cSrcweir void TextObjectBar::GetAttrState( SfxItemSet& rSet ) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 165cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 166cdf0e10cSrcweir sal_Bool bTemplate = sal_False; 167cdf0e10cSrcweir SfxItemSet aAttrSet( mpView->GetDoc()->GetPool() ); 168cdf0e10cSrcweir SvtLanguageOptions aLangOpt; 169cdf0e10cSrcweir sal_Bool bDisableParagraphTextDirection = !aLangOpt.IsCTLFontEnabled(); 170cdf0e10cSrcweir sal_Bool bDisableVerticalText = !aLangOpt.IsVerticalTextEnabled(); 171cdf0e10cSrcweir 172cdf0e10cSrcweir mpView->GetAttributes( aAttrSet ); 173cdf0e10cSrcweir 174cdf0e10cSrcweir while ( nWhich ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) 177cdf0e10cSrcweir ? GetPool().GetSlotId(nWhich) 178cdf0e10cSrcweir : nWhich; 179cdf0e10cSrcweir 180cdf0e10cSrcweir switch ( nSlotId ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 183cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 184cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 185cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 186*766ce4d0SZheng Fan case SID_ATTR_CHAR_SHADOWED: 187*766ce4d0SZheng Fan case SID_ATTR_CHAR_STRIKEOUT: 188cdf0e10cSrcweir { 189cdf0e10cSrcweir SvxScriptSetItem aSetItem( nSlotId, GetPool() ); 190cdf0e10cSrcweir aSetItem.GetItemSet().Put( aAttrSet, sal_False ); 191cdf0e10cSrcweir 192cdf0e10cSrcweir sal_uInt16 nScriptType = mpView->GetScriptType(); 193cdf0e10cSrcweir 194cdf0e10cSrcweir if( (nSlotId == SID_ATTR_CHAR_FONT) || (nSlotId == SID_ATTR_CHAR_FONTHEIGHT) ) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir // #42732# input language should be preferred over 197cdf0e10cSrcweir // current cursor position to detect script type 198cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 199cdf0e10cSrcweir 200cdf0e10cSrcweir if (mpView->ISA(OutlineView)) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow( 203cdf0e10cSrcweir mpViewShell->GetActiveWindow()); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir 206cdf0e10cSrcweir if(pOLV && !pOLV->GetSelection().HasRange()) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir if( mpViewShell && mpViewShell->GetViewShell() && mpViewShell->GetViewShell()->GetWindow() ) 209cdf0e10cSrcweir { 210cdf0e10cSrcweir LanguageType nInputLang = mpViewShell->GetViewShell()->GetWindow()->GetInputLanguage(); 211cdf0e10cSrcweir if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM) 212cdf0e10cSrcweir nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang ); 213cdf0e10cSrcweir } 214cdf0e10cSrcweir } 215cdf0e10cSrcweir } 216cdf0e10cSrcweir 217cdf0e10cSrcweir const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType ); 218cdf0e10cSrcweir if( pI ) 219cdf0e10cSrcweir aAttrSet.Put( *pI, nWhich ); 220cdf0e10cSrcweir else 221cdf0e10cSrcweir aAttrSet.InvalidateItem( nWhich ); 222cdf0e10cSrcweir } 223cdf0e10cSrcweir break; 224cdf0e10cSrcweir 225cdf0e10cSrcweir 226cdf0e10cSrcweir case SID_STYLE_APPLY: 227cdf0e10cSrcweir case SID_STYLE_FAMILY2: 228cdf0e10cSrcweir { 229cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = mpView->GetStyleSheetFromMarked(); 230cdf0e10cSrcweir if( pStyleSheet ) 231cdf0e10cSrcweir rSet.Put( SfxTemplateItem( nWhich, pStyleSheet->GetName() ) ); 232cdf0e10cSrcweir else 233cdf0e10cSrcweir { 234cdf0e10cSrcweir rSet.Put( SfxTemplateItem( nWhich, String() ) ); 235cdf0e10cSrcweir } 236cdf0e10cSrcweir bTemplate = sal_True; 237cdf0e10cSrcweir } 238cdf0e10cSrcweir break; 239cdf0e10cSrcweir 240cdf0e10cSrcweir case SID_OUTLINE_LEFT: 241cdf0e10cSrcweir case SID_OUTLINE_RIGHT: 242cdf0e10cSrcweir case SID_OUTLINE_UP: 243cdf0e10cSrcweir case SID_OUTLINE_DOWN: 244cdf0e10cSrcweir { 245cdf0e10cSrcweir sal_Bool bDisableLeft = sal_True; 246cdf0e10cSrcweir sal_Bool bDisableRight = sal_True; 247cdf0e10cSrcweir sal_Bool bDisableUp = sal_True; 248cdf0e10cSrcweir sal_Bool bDisableDown = sal_True; 249cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 250cdf0e10cSrcweir 251cdf0e10cSrcweir if (mpView->ISA(OutlineView)) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow( 254cdf0e10cSrcweir mpViewShell->GetActiveWindow()); 255cdf0e10cSrcweir } 256cdf0e10cSrcweir 257cdf0e10cSrcweir sal_Bool bOutlineViewSh = mpViewShell->ISA(OutlineViewShell); 258cdf0e10cSrcweir 259cdf0e10cSrcweir if (pOLV && 260cdf0e10cSrcweir ( pOLV->GetOutliner()->GetMode() == OUTLINERMODE_OUTLINEOBJECT || bOutlineViewSh ) ) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir // Outliner im Gliederungsmodus 263cdf0e10cSrcweir ::Outliner* pOutl = pOLV->GetOutliner(); 264cdf0e10cSrcweir List* pList = pOLV->CreateSelectionList(); 265cdf0e10cSrcweir Paragraph* pPara = (Paragraph*) pList->First(); 266cdf0e10cSrcweir 267cdf0e10cSrcweir // #96539# find out if we are a OutlineView 268cdf0e10cSrcweir sal_Bool bIsOutlineView(OUTLINERMODE_OUTLINEVIEW == pOLV->GetOutliner()->GetMode()); 269cdf0e10cSrcweir 270cdf0e10cSrcweir // #96539# This is ONLY for OutlineViews 271cdf0e10cSrcweir if(bIsOutlineView) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir // #96250# and #78665# 274cdf0e10cSrcweir // allow move up if position is 2 or greater OR it 275cdf0e10cSrcweir // is a title object (and thus depth==1) 276cdf0e10cSrcweir if(pOutl->GetAbsPos(pPara) > 1 || ( pOutl->HasParaFlag(pPara,PARAFLAG_ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) ) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir // Nicht ganz oben 279cdf0e10cSrcweir bDisableUp = sal_False; 280cdf0e10cSrcweir } 281cdf0e10cSrcweir } 282cdf0e10cSrcweir else 283cdf0e10cSrcweir { 284cdf0e10cSrcweir // #96539# old behaviour for OUTLINERMODE_OUTLINEOBJECT 285cdf0e10cSrcweir if(pOutl->GetAbsPos(pPara) > 0) 286cdf0e10cSrcweir { 287cdf0e10cSrcweir // Nicht ganz oben 288cdf0e10cSrcweir bDisableUp = sal_False; 289cdf0e10cSrcweir } 290cdf0e10cSrcweir } 291cdf0e10cSrcweir 292cdf0e10cSrcweir while (pPara) 293cdf0e10cSrcweir { 294cdf0e10cSrcweir sal_Int16 nDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) ); 295cdf0e10cSrcweir 296cdf0e10cSrcweir if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir // Nicht minimale Tiefe 299cdf0e10cSrcweir bDisableLeft = sal_False; 300cdf0e10cSrcweir } 301cdf0e10cSrcweir 302cdf0e10cSrcweir if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) || 303cdf0e10cSrcweir (bOutlineViewSh && (nDepth <= 0) && pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir // Nicht maximale Tiefe und nicht ganz oben 306cdf0e10cSrcweir bDisableRight = sal_False; 307cdf0e10cSrcweir } 308cdf0e10cSrcweir 309cdf0e10cSrcweir pPara = static_cast<Paragraph*>( pList->Next() ); 310cdf0e10cSrcweir } 311cdf0e10cSrcweir 312cdf0e10cSrcweir if ( ( pOutl->GetAbsPos((Paragraph*) pList->Last()) < pOutl->GetParagraphCount() - 1 ) && 313cdf0e10cSrcweir ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir // Nicht letzter Absatz 316cdf0e10cSrcweir bDisableDown = sal_False; 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir // #96250# and #78665# 320cdf0e10cSrcweir // disable when first para and 2nd is not a title 321cdf0e10cSrcweir pPara = static_cast< Paragraph* >( pList->First() ); 322cdf0e10cSrcweir if(!bDisableDown && bIsOutlineView 323cdf0e10cSrcweir && pPara 324cdf0e10cSrcweir && 0 == pOutl->GetAbsPos(pPara) 325cdf0e10cSrcweir && pOutl->GetParagraphCount() > 1 326cdf0e10cSrcweir && !pOutl->HasParaFlag( pOutl->GetParagraph(1), PARAFLAG_ISPAGE ) ) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir // Needs to be disabled 329cdf0e10cSrcweir bDisableDown = sal_True; 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir delete pList; 333cdf0e10cSrcweir } 334cdf0e10cSrcweir 335cdf0e10cSrcweir if (bDisableLeft) 336cdf0e10cSrcweir rSet.DisableItem(SID_OUTLINE_LEFT); 337cdf0e10cSrcweir if (bDisableRight) 338cdf0e10cSrcweir rSet.DisableItem(SID_OUTLINE_RIGHT); 339cdf0e10cSrcweir if (bDisableUp) 340cdf0e10cSrcweir rSet.DisableItem(SID_OUTLINE_UP); 341cdf0e10cSrcweir if (bDisableDown) 342cdf0e10cSrcweir rSet.DisableItem(SID_OUTLINE_DOWN); 343cdf0e10cSrcweir } 344cdf0e10cSrcweir break; 345cdf0e10cSrcweir 346cdf0e10cSrcweir case SID_TEXTDIRECTION_LEFT_TO_RIGHT: 347cdf0e10cSrcweir case SID_TEXTDIRECTION_TOP_TO_BOTTOM: 348cdf0e10cSrcweir { 349cdf0e10cSrcweir if ( bDisableVerticalText ) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT ); 352cdf0e10cSrcweir rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM ); 353cdf0e10cSrcweir } 354cdf0e10cSrcweir else 355cdf0e10cSrcweir { 356cdf0e10cSrcweir sal_Bool bLeftToRight = sal_True; 357cdf0e10cSrcweir 358cdf0e10cSrcweir SdrOutliner* pOutl = mpView->GetTextEditOutliner(); 359cdf0e10cSrcweir if( pOutl ) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir if( pOutl->IsVertical() ) 362cdf0e10cSrcweir bLeftToRight = sal_False; 363cdf0e10cSrcweir } 364cdf0e10cSrcweir else 365cdf0e10cSrcweir bLeftToRight = ( (const SvxWritingModeItem&) aAttrSet.Get( SDRATTR_TEXTDIRECTION ) ).GetValue() == com::sun::star::text::WritingMode_LR_TB; 366cdf0e10cSrcweir 367cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT, bLeftToRight ) ); 368cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM, !bLeftToRight ) ); 369cdf0e10cSrcweir 370cdf0e10cSrcweir if( !bLeftToRight ) 371cdf0e10cSrcweir bDisableParagraphTextDirection = sal_True; 372cdf0e10cSrcweir } 373cdf0e10cSrcweir } 374cdf0e10cSrcweir break; 375cdf0e10cSrcweir 376cdf0e10cSrcweir case SID_GROW_FONT_SIZE: 377cdf0e10cSrcweir case SID_SHRINK_FONT_SIZE: 378cdf0e10cSrcweir { 379cdf0e10cSrcweir // todo 380cdf0e10cSrcweir } 381cdf0e10cSrcweir break; 382cdf0e10cSrcweir 383cdf0e10cSrcweir case SID_THES: 384cdf0e10cSrcweir { 385cdf0e10cSrcweir if( mpView && mpView->GetTextEditOutlinerView() ) 386cdf0e10cSrcweir { 387cdf0e10cSrcweir EditView & rEditView = mpView->GetTextEditOutlinerView()->GetEditView();; 388cdf0e10cSrcweir String aStatusVal; 389cdf0e10cSrcweir LanguageType nLang = LANGUAGE_NONE; 390cdf0e10cSrcweir bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); 391cdf0e10cSrcweir rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); 392cdf0e10cSrcweir 393cdf0e10cSrcweir // disable "Thesaurus" context menu entry if there is nothing to look up 394cdf0e10cSrcweir lang::Locale aLocale( SvxCreateLocale( nLang ) ); 395cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() ); 396cdf0e10cSrcweir if (!bIsLookUpWord || 397cdf0e10cSrcweir !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) 398cdf0e10cSrcweir rSet.DisableItem( SID_THES ); 399cdf0e10cSrcweir } 400cdf0e10cSrcweir else 401cdf0e10cSrcweir { 402cdf0e10cSrcweir rSet.DisableItem( SID_THES ); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir //! avoid puting the same item as SfxBoolItem at the end of this function 405cdf0e10cSrcweir nSlotId = 0; 406cdf0e10cSrcweir } 407cdf0e10cSrcweir break; 408cdf0e10cSrcweir 409cdf0e10cSrcweir default: 410cdf0e10cSrcweir break; 411cdf0e10cSrcweir } 412cdf0e10cSrcweir 413cdf0e10cSrcweir nWhich = aIter.NextWhich(); 414cdf0e10cSrcweir } 415cdf0e10cSrcweir 416cdf0e10cSrcweir rSet.Put( aAttrSet, sal_False ); // <- sal_False, damit DontCare-Status uebernommen wird 417cdf0e10cSrcweir 418cdf0e10cSrcweir 419cdf0e10cSrcweir // die sind im Gliederungsmodus disabled 420cdf0e10cSrcweir if (!mpViewShell->ISA(DrawViewShell)) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_ADJUST_LEFT ); 423cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_ADJUST_RIGHT ); 424cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_ADJUST_CENTER ); 425cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_ADJUST_BLOCK ); 426cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LINESPACE_10 ); 427cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LINESPACE_15 ); 428cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LINESPACE_20 ); 429cdf0e10cSrcweir rSet.DisableItem( SID_PARASPACE_INCREASE ); 430cdf0e10cSrcweir rSet.DisableItem( SID_PARASPACE_DECREASE ); 431cdf0e10cSrcweir rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM ); 432cdf0e10cSrcweir rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT ); 433cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT ); 434cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT ); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir else 437cdf0e10cSrcweir { 438cdf0e10cSrcweir // Absatzabstand 439cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 440cdf0e10cSrcweir if( pOLV ) 441cdf0e10cSrcweir { 442cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection(); 443cdf0e10cSrcweir aSel.Adjust(); 444cdf0e10cSrcweir sal_uLong nStartPara = aSel.nStartPara; 445cdf0e10cSrcweir sal_uLong nEndPara = aSel.nEndPara; 446cdf0e10cSrcweir if( !aSel.HasRange() ) 447cdf0e10cSrcweir { 448cdf0e10cSrcweir nStartPara = 0; 449cdf0e10cSrcweir nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1; 450cdf0e10cSrcweir } 451cdf0e10cSrcweir long nUpper = 0L; 452cdf0e10cSrcweir for( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ ) 453cdf0e10cSrcweir { 454cdf0e10cSrcweir const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( (sal_uInt16)nPara ); 455cdf0e10cSrcweir const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) rItems.Get( EE_PARA_ULSPACE ); 456cdf0e10cSrcweir nUpper = Max( nUpper, (long)rItem.GetUpper() ); 457cdf0e10cSrcweir } 458cdf0e10cSrcweir if( nUpper == 0L ) 459cdf0e10cSrcweir rSet.DisableItem( SID_PARASPACE_DECREASE ); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir else 462cdf0e10cSrcweir { 463cdf0e10cSrcweir // Wird zur Zeit nie disabled ! 464cdf0e10cSrcweir //rSet.DisableItem( SID_PARASPACE_INCREASE ); 465cdf0e10cSrcweir //rSet.DisableItem( SID_PARASPACE_DECREASE ); 466cdf0e10cSrcweir } 467cdf0e10cSrcweir 468cdf0e10cSrcweir // Absatzausrichtung 469cdf0e10cSrcweir SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust(); 470cdf0e10cSrcweir switch( eAdj ) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir case SVX_ADJUST_LEFT: 473cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) ); 474cdf0e10cSrcweir break; 475cdf0e10cSrcweir case SVX_ADJUST_CENTER: 476cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) ); 477cdf0e10cSrcweir break; 478cdf0e10cSrcweir case SVX_ADJUST_RIGHT: 479cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) ); 480cdf0e10cSrcweir break; 481cdf0e10cSrcweir case SVX_ADJUST_BLOCK: 482cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) ); 483cdf0e10cSrcweir break; 484cdf0e10cSrcweir default: 485cdf0e10cSrcweir break; 486cdf0e10cSrcweir } 487cdf0e10cSrcweir 488*766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ADJUST_LEFT); 489*766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ADJUST_CENTER); 490*766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ADJUST_RIGHT); 491*766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ADJUST_BLOCK); 492*766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_LINESPACE); 493*766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ULSPACE); 494*766ce4d0SZheng Fan 495cdf0e10cSrcweir // paragraph text direction 496cdf0e10cSrcweir if( bDisableParagraphTextDirection ) 497cdf0e10cSrcweir { 498cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT ); 499cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT ); 500cdf0e10cSrcweir } 501cdf0e10cSrcweir else 502cdf0e10cSrcweir { 503cdf0e10cSrcweir switch( ( ( (SvxFrameDirectionItem&) aAttrSet.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() ) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir case FRMDIR_VERT_TOP_LEFT: 506cdf0e10cSrcweir case FRMDIR_VERT_TOP_RIGHT: 507cdf0e10cSrcweir { 508cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT ); 509cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT ); 510cdf0e10cSrcweir } 511cdf0e10cSrcweir break; 512cdf0e10cSrcweir 513cdf0e10cSrcweir case FRMDIR_HORI_LEFT_TOP: 514cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, sal_True ) ); 515cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, sal_False ) ); 516cdf0e10cSrcweir break; 517cdf0e10cSrcweir 518cdf0e10cSrcweir case FRMDIR_HORI_RIGHT_TOP: 519cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, sal_False ) ); 520cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, sal_True ) ); 521cdf0e10cSrcweir break; 522cdf0e10cSrcweir 523cdf0e10cSrcweir // #107865# 524cdf0e10cSrcweir // The case for the superordinate object is missing. 525cdf0e10cSrcweir case FRMDIR_ENVIRONMENT: 526cdf0e10cSrcweir { 527cdf0e10cSrcweir SdDrawDocument* pDoc = mpView->GetDoc(); 528cdf0e10cSrcweir ::com::sun::star::text::WritingMode eMode = pDoc->GetDefaultWritingMode(); 529cdf0e10cSrcweir sal_Bool bIsLeftToRight(sal_False); 530cdf0e10cSrcweir 531cdf0e10cSrcweir if(::com::sun::star::text::WritingMode_LR_TB == eMode 532cdf0e10cSrcweir || ::com::sun::star::text::WritingMode_TB_RL == eMode) 533cdf0e10cSrcweir { 534cdf0e10cSrcweir bIsLeftToRight = sal_True; 535cdf0e10cSrcweir } 536cdf0e10cSrcweir 537cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, bIsLeftToRight ) ); 538cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, !bIsLeftToRight ) ); 539cdf0e10cSrcweir } 540cdf0e10cSrcweir break; 541cdf0e10cSrcweir } 542cdf0e10cSrcweir } 543cdf0e10cSrcweir 544cdf0e10cSrcweir /* #i35937# 545cdf0e10cSrcweir if (aAttrSet.GetItemState(EE_PARA_BULLETSTATE) == SFX_ITEM_ON) 546cdf0e10cSrcweir { 547cdf0e10cSrcweir SfxUInt16Item aBulletState((const SfxUInt16Item&) aAttrSet.Get(EE_PARA_BULLETSTATE)); 548cdf0e10cSrcweir 549cdf0e10cSrcweir if (aBulletState.GetValue() != 0) 550cdf0e10cSrcweir { 551cdf0e10cSrcweir rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_True)); 552cdf0e10cSrcweir } 553cdf0e10cSrcweir else 554cdf0e10cSrcweir { 555cdf0e10cSrcweir rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False)); 556cdf0e10cSrcweir } 557cdf0e10cSrcweir } 558cdf0e10cSrcweir */ 559*766ce4d0SZheng Fan SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) ); 560*766ce4d0SZheng Fan aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); 561*766ce4d0SZheng Fan rSet.Put(aLRSpace); 562*766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_LRSPACE); 563*766ce4d0SZheng Fan //Added by xuxu 564*766ce4d0SZheng Fan SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE ); 565*766ce4d0SZheng Fan if ( eState == SFX_ITEM_DONTCARE ) 566*766ce4d0SZheng Fan { 567*766ce4d0SZheng Fan rSet.InvalidateItem(EE_PARA_LRSPACE); 568*766ce4d0SZheng Fan rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); 569*766ce4d0SZheng Fan } 570cdf0e10cSrcweir sal_uInt16 nLineSpace = (sal_uInt16) ( (const SvxLineSpacingItem&) aAttrSet. 571cdf0e10cSrcweir Get( EE_PARA_SBL ) ).GetPropLineSpace(); 572cdf0e10cSrcweir switch( nLineSpace ) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir case 100: 575cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, sal_True ) ); 576cdf0e10cSrcweir break; 577cdf0e10cSrcweir case 150: 578cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, sal_True ) ); 579cdf0e10cSrcweir break; 580cdf0e10cSrcweir case 200: 581cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, sal_True ) ); 582cdf0e10cSrcweir break; 583cdf0e10cSrcweir } 584cdf0e10cSrcweir } 585cdf0e10cSrcweir 586cdf0e10cSrcweir // Ausrichtung (hoch/tief) wird auch im Gliederungsmodus gebraucht 587cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) 588cdf0e10cSrcweir aAttrSet.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 589cdf0e10cSrcweir 590cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) 591cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) ); 592cdf0e10cSrcweir else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) 593cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) ); 594cdf0e10cSrcweir } 595cdf0e10cSrcweir 596cdf0e10cSrcweir /************************************************************************* 597cdf0e10cSrcweir |* 598cdf0e10cSrcweir |* Command event 599cdf0e10cSrcweir |* 600cdf0e10cSrcweir \************************************************************************/ 601cdf0e10cSrcweir 602cdf0e10cSrcweir void TextObjectBar::Command( const CommandEvent& ) 603cdf0e10cSrcweir { 604cdf0e10cSrcweir } 605cdf0e10cSrcweir 606cdf0e10cSrcweir 607cdf0e10cSrcweir } // end of namespace sd 608