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