LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/view - drtxtob.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 256 1.2 %
Date: 2013-07-09 Functions: 5 17 29.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "TextObjectBar.hxx"
      22             : 
      23             : #include <svx/svxids.hrc>
      24             : 
      25             : #include <i18nlangtag/mslangid.hxx>
      26             : #include <editeng/ulspitem.hxx>
      27             : #include <editeng/lspcitem.hxx>
      28             : #include <editeng/adjustitem.hxx>
      29             : #include <editeng/editview.hxx>
      30             : #include <editeng/editeng.hxx>
      31             : #include <editeng/outliner.hxx>
      32             : #include <editeng/unolingu.hxx>
      33             : #include <editeng/kernitem.hxx>
      34             : #include <vcl/vclenum.hxx>
      35             : #include <sfx2/app.hxx>
      36             : #include <svl/whiter.hxx>
      37             : #include <svl/itempool.hxx>
      38             : #include <svl/stritem.hxx>
      39             : #include <svl/style.hxx>
      40             : #include <svl/languageoptions.hxx>
      41             : #include <sfx2/tplpitem.hxx>
      42             : #include <editeng/escapementitem.hxx>
      43             : #include <svx/svdoutl.hxx>
      44             : #include <svl/intitem.hxx>
      45             : #include <editeng/scripttypeitem.hxx>
      46             : #include <editeng/outlobj.hxx>
      47             : #include <editeng/writingmodeitem.hxx>
      48             : #include <editeng/frmdiritem.hxx>
      49             : #include <editeng/fhgtitem.hxx>
      50             : 
      51             : 
      52             : #include <sfx2/objface.hxx>
      53             : 
      54             : #include "app.hrc"
      55             : #include "glob.hrc"
      56             : #include "res_bmp.hrc"
      57             : 
      58             : #include <editeng/outliner.hxx>
      59             : 
      60             : #include "drawdoc.hxx"
      61             : #include "DrawViewShell.hxx"
      62             : #include "OutlineViewShell.hxx"
      63             : #include "ViewShellBase.hxx"
      64             : #include "ToolBarManager.hxx"
      65             : #include "futempl.hxx"
      66             : #include "sdresid.hxx"
      67             : #include "Window.hxx"
      68             : #include "OutlineView.hxx"
      69             : 
      70             : 
      71             : using namespace sd;
      72             : using namespace ::com::sun::star;
      73             : 
      74             : #define TextObjectBar
      75             : #include "sdslots.hxx"
      76             : 
      77             : namespace sd {
      78             : 
      79             : /**
      80             :  * Declare default interface (Slotmap must not be empty, therefore enter
      81             :  * something that (hopefully) never occurs.
      82             :  */
      83             : 
      84          33 : SFX_IMPL_INTERFACE( TextObjectBar, SfxShell, SdResId(STR_TEXTOBJECTBARSHELL) )
      85             : {
      86          11 : }
      87             : 
      88           0 : TYPEINIT1( TextObjectBar, SfxShell );
      89             : 
      90             : 
      91           0 : TextObjectBar::TextObjectBar (
      92             :     ViewShell* pSdViewSh,
      93             :     SfxItemPool& rItemPool,
      94             :     ::sd::View* pSdView )
      95             :     : SfxShell(pSdViewSh->GetViewShell()),
      96             :       mpViewShell( pSdViewSh ),
      97           0 :       mpView( pSdView )
      98             : {
      99           0 :     SetPool(&rItemPool);
     100             : 
     101           0 :     if( mpView )
     102             :     {
     103           0 :         OutlineView* pOutlinerView = dynamic_cast< OutlineView* >( mpView );
     104           0 :         if( pOutlinerView )
     105             :         {
     106           0 :             SetUndoManager(&pOutlinerView->GetOutliner()->GetUndoManager());
     107             :         }
     108             :         else
     109             :         {
     110           0 :             DrawDocShell* pDocShell = mpView->GetDoc().GetDocSh();
     111           0 :             if( pDocShell )
     112             :             {
     113           0 :                 SetUndoManager(pDocShell->GetUndoManager());
     114           0 :                 DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( pSdViewSh );
     115           0 :                 if ( pDrawViewShell )
     116           0 :                     SetRepeatTarget(pSdView);
     117             :             }
     118             :         }
     119             :     }
     120             : 
     121           0 :     SetName( OUString( "TextObjectBar" ));
     122             : 
     123             :     // SetHelpId( SD_IF_SDDRAWTEXTOBJECTBAR );
     124           0 : }
     125             : 
     126             : 
     127           0 : TextObjectBar::~TextObjectBar()
     128             : {
     129           0 :     SetRepeatTarget(NULL);
     130           0 : }
     131             : 
     132           0 : void TextObjectBar::GetCharState( SfxItemSet& rSet )
     133             : {
     134           0 :     SfxItemSet  aCharAttrSet( mpView->GetDoc().GetPool() );
     135           0 :     mpView->GetAttributes( aCharAttrSet );
     136             : 
     137           0 :     SfxItemSet aNewAttr( mpViewShell->GetPool(),EE_ITEMS_START,EE_ITEMS_END);
     138             : 
     139           0 :     aNewAttr.Put(aCharAttrSet, sal_False);
     140           0 :     rSet.Put(aNewAttr, sal_False);
     141             : 
     142           0 :     SvxKerningItem aKern = ( (const SvxKerningItem&) aCharAttrSet.Get( EE_CHAR_KERNING ) );
     143             :     //aKern.SetWhich(SID_ATTR_CHAR_KERNING);
     144           0 :     rSet.Put(aKern);
     145             : 
     146           0 :     SfxItemState eState = aCharAttrSet.GetItemState( EE_CHAR_KERNING, sal_True );
     147           0 :     if ( eState == SFX_ITEM_DONTCARE )
     148             :     {
     149           0 :         rSet.InvalidateItem(EE_CHAR_KERNING);
     150           0 :     }
     151           0 : }
     152             : 
     153             : /**
     154             :  * Status of attribute items.
     155             :  */
     156           0 : void TextObjectBar::GetAttrState( SfxItemSet& rSet )
     157             : {
     158           0 :     SfxWhichIter        aIter( rSet );
     159           0 :     sal_uInt16              nWhich = aIter.FirstWhich();
     160           0 :     SfxItemSet          aAttrSet( mpView->GetDoc().GetPool() );
     161           0 :     SvtLanguageOptions  aLangOpt;
     162           0 :     sal_Bool            bDisableParagraphTextDirection = !aLangOpt.IsCTLFontEnabled();
     163           0 :     sal_Bool            bDisableVerticalText = !aLangOpt.IsVerticalTextEnabled();
     164             : 
     165           0 :     mpView->GetAttributes( aAttrSet );
     166             : 
     167           0 :     while ( nWhich )
     168             :     {
     169           0 :         sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
     170           0 :             ? GetPool().GetSlotId(nWhich)
     171           0 :             : nWhich;
     172             : 
     173           0 :         switch ( nSlotId )
     174             :         {
     175             :             case SID_ATTR_CHAR_FONT:
     176             :             case SID_ATTR_CHAR_FONTHEIGHT:
     177             :             case SID_ATTR_CHAR_WEIGHT:
     178             :             case SID_ATTR_CHAR_POSTURE:
     179             :         case SID_ATTR_CHAR_SHADOWED:
     180             :             case SID_ATTR_CHAR_STRIKEOUT:
     181             :             {
     182           0 :                 sal_uInt16 stretchX = 100;
     183           0 :                 sal_uInt16 stretchY = 100;
     184           0 :                 SvxScriptSetItem aSetItem( nSlotId, GetPool() );
     185           0 :                 aSetItem.GetItemSet().Put( aAttrSet, sal_False );
     186             : 
     187           0 :                 sal_uInt16 nScriptType = mpView->GetScriptType();
     188             : 
     189           0 :                 if( (nSlotId == SID_ATTR_CHAR_FONT) || (nSlotId == SID_ATTR_CHAR_FONTHEIGHT) )
     190             :                 {
     191             :                     // input language should be preferred over
     192             :                     // current cursor position to detect script type
     193           0 :                     OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
     194           0 :                     SdrOutliner *pOutliner = mpView->GetTextEditOutliner();
     195             : 
     196           0 :                     if (mpView->ISA(OutlineView))
     197             :                     {
     198             :                         pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
     199           0 :                             mpViewShell->GetActiveWindow());
     200             :                     }
     201             : 
     202           0 :                     if( pOutliner )
     203           0 :                         pOutliner->GetGlobalCharStretching( stretchX, stretchY );
     204             : 
     205           0 :                     if(pOLV && !pOLV->GetSelection().HasRange())
     206             :                     {
     207           0 :                         if( mpViewShell && mpViewShell->GetViewShell() && mpViewShell->GetViewShell()->GetWindow() )
     208             :                         {
     209           0 :                             LanguageType nInputLang = mpViewShell->GetViewShell()->GetWindow()->GetInputLanguage();
     210           0 :                             if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
     211           0 :                                 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
     212             :                         }
     213             :                     }
     214             :                 }
     215             : 
     216           0 :                 const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
     217           0 :                 if( pI )
     218             :                 {
     219           0 :                     if( nSlotId == SID_ATTR_CHAR_FONTHEIGHT )
     220             :                     {
     221           0 :                         SvxFontHeightItem aFontItem = *(dynamic_cast<const SvxFontHeightItem *>(pI));
     222           0 :                         aFontItem.SetHeight(aFontItem.GetHeight(), stretchX, aFontItem.GetPropUnit());
     223           0 :                         aAttrSet.Put( aFontItem, nWhich );
     224             :                     }
     225             :                     else
     226             :                     {
     227           0 :                         aAttrSet.Put( *pI, nWhich );
     228             :                     }
     229             :                 }
     230             :                 else
     231             :                 {
     232           0 :                     aAttrSet.InvalidateItem( nWhich );
     233           0 :                 }
     234             :             }
     235           0 :             break;
     236             : 
     237             : 
     238             :             case SID_STYLE_APPLY:
     239             :             case SID_STYLE_FAMILY2:
     240             :             {
     241           0 :                 SfxStyleSheet* pStyleSheet = mpView->GetStyleSheetFromMarked();
     242           0 :                 if( pStyleSheet )
     243           0 :                     rSet.Put( SfxTemplateItem( nWhich, pStyleSheet->GetName() ) );
     244             :                 else
     245             :                 {
     246           0 :                     rSet.Put( SfxTemplateItem( nWhich, String() ) );
     247             :                 }
     248             :             }
     249           0 :             break;
     250             : 
     251             :             case SID_OUTLINE_LEFT:
     252             :             case SID_OUTLINE_RIGHT:
     253             :             case SID_OUTLINE_UP:
     254             :             case SID_OUTLINE_DOWN:
     255             :             {
     256           0 :                 sal_Bool bDisableLeft     = sal_True;
     257           0 :                 sal_Bool bDisableRight    = sal_True;
     258           0 :                 sal_Bool bDisableUp       = sal_True;
     259           0 :                 sal_Bool bDisableDown     = sal_True;
     260           0 :                 OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
     261             : 
     262           0 :                 if (mpView->ISA(OutlineView))
     263             :                 {
     264             :                     pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
     265           0 :                         mpViewShell->GetActiveWindow());
     266             :                 }
     267             : 
     268           0 :                 sal_Bool bOutlineViewSh = mpViewShell->ISA(OutlineViewShell);
     269             : 
     270           0 :                 if (pOLV &&
     271           0 :                     ( pOLV->GetOutliner()->GetMode() == OUTLINERMODE_OUTLINEOBJECT || bOutlineViewSh ) )
     272             :                 {
     273             :                     // Outliner at outline-mode
     274           0 :                     ::Outliner* pOutl = pOLV->GetOutliner();
     275             : 
     276           0 :                     std::vector<Paragraph*> aSelList;
     277           0 :                     pOLV->CreateSelectionList(aSelList);
     278           0 :                     Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin());
     279             : 
     280             :                     // find out if we are a OutlineView
     281           0 :                     sal_Bool bIsOutlineView(OUTLINERMODE_OUTLINEVIEW == pOLV->GetOutliner()->GetMode());
     282             : 
     283             :                     // This is ONLY for OutlineViews
     284           0 :                     if(bIsOutlineView)
     285             :                     {
     286             :                         // allow move up if position is 2 or greater OR it
     287             :                         // is a title object (and thus depth==1)
     288           0 :                         if(pOutl->GetAbsPos(pPara) > 1 || ( pOutl->HasParaFlag(pPara,PARAFLAG_ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) )
     289             :                         {
     290             :                             // not at top
     291           0 :                             bDisableUp = sal_False;
     292             :                         }
     293             :                     }
     294             :                     else
     295             :                     {
     296             :                         // old behaviour for OUTLINERMODE_OUTLINEOBJECT
     297           0 :                         if(pOutl->GetAbsPos(pPara) > 0)
     298             :                         {
     299             :                             // not at top
     300           0 :                             bDisableUp = sal_False;
     301             :                         }
     302             :                     }
     303             : 
     304           0 :                     for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
     305             :                     {
     306           0 :                         pPara = *iter;
     307             : 
     308           0 :                         sal_Int16 nDepth = pOutl->GetDepth( pOutl->GetAbsPos( pPara ) );
     309             : 
     310           0 :                         if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) )
     311             :                         {
     312             :                             // not minimum depth
     313           0 :                             bDisableLeft = sal_False;
     314             :                         }
     315             : 
     316           0 :                         if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) ||
     317           0 :                             (bOutlineViewSh && (nDepth <= 0) && pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) )
     318             :                         {
     319             :                             // not maximum depth and not at top
     320           0 :                             bDisableRight = sal_False;
     321             :                         }
     322             :                     }
     323             : 
     324           0 :                     if ( ( pOutl->GetAbsPos(pPara) < pOutl->GetParagraphCount() - 1 ) &&
     325           0 :                          ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) )
     326             :                     {
     327             :                         // not last paragraph
     328           0 :                         bDisableDown = sal_False;
     329             :                     }
     330             : 
     331             :                     // disable when first para and 2nd is not a title
     332           0 :                     pPara = aSelList.empty() ? NULL : *(aSelList.begin());
     333             : 
     334           0 :                     if(!bDisableDown && bIsOutlineView
     335           0 :                         && pPara
     336           0 :                         && 0 == pOutl->GetAbsPos(pPara)
     337           0 :                         && pOutl->GetParagraphCount() > 1
     338           0 :                         && !pOutl->HasParaFlag( pOutl->GetParagraph(1), PARAFLAG_ISPAGE ) )
     339             :                     {
     340             :                         // Needs to be disabled
     341           0 :                         bDisableDown = sal_True;
     342           0 :                     }
     343             :                 }
     344             : 
     345           0 :                 if (bDisableLeft)
     346           0 :                     rSet.DisableItem(SID_OUTLINE_LEFT);
     347           0 :                 if (bDisableRight)
     348           0 :                     rSet.DisableItem(SID_OUTLINE_RIGHT);
     349           0 :                 if (bDisableUp)
     350           0 :                     rSet.DisableItem(SID_OUTLINE_UP);
     351           0 :                 if (bDisableDown)
     352           0 :                     rSet.DisableItem(SID_OUTLINE_DOWN);
     353             :             }
     354           0 :             break;
     355             : 
     356             :             case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
     357             :             case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
     358             :             {
     359           0 :                 if ( bDisableVerticalText )
     360             :                 {
     361           0 :                     rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
     362           0 :                     rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
     363             :                 }
     364             :                 else
     365             :                 {
     366           0 :                     sal_Bool bLeftToRight = sal_True;
     367             : 
     368           0 :                     SdrOutliner* pOutl = mpView->GetTextEditOutliner();
     369           0 :                     if( pOutl )
     370             :                     {
     371           0 :                         if( pOutl->IsVertical() )
     372           0 :                             bLeftToRight = sal_False;
     373             :                     }
     374             :                     else
     375           0 :                         bLeftToRight = ( (const SvxWritingModeItem&) aAttrSet.Get( SDRATTR_TEXTDIRECTION ) ).GetValue() == com::sun::star::text::WritingMode_LR_TB;
     376             : 
     377           0 :                     rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT, bLeftToRight ) );
     378           0 :                     rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM, !bLeftToRight ) );
     379             : 
     380           0 :                     if( !bLeftToRight )
     381           0 :                         bDisableParagraphTextDirection = sal_True;
     382             :                 }
     383             :             }
     384           0 :             break;
     385             : 
     386             :             case SID_GROW_FONT_SIZE:
     387             :             case SID_SHRINK_FONT_SIZE:
     388             :             {
     389             :                 // todo
     390             :             }
     391           0 :             break;
     392             : 
     393             :             case SID_THES:
     394             :             {
     395           0 :                 if( mpView && mpView->GetTextEditOutlinerView() )
     396             :                 {
     397           0 :                     EditView & rEditView = mpView->GetTextEditOutlinerView()->GetEditView();
     398           0 :                     String          aStatusVal;
     399           0 :                     LanguageType    nLang = LANGUAGE_NONE;
     400           0 :                     bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView );
     401           0 :                     rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
     402             : 
     403             :                     // disable "Thesaurus" context menu entry if there is nothing to look up
     404           0 :                     uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() );
     405           0 :                     if (!bIsLookUpWord ||
     406           0 :                         !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang). getLocale() ))
     407           0 :                         rSet.DisableItem( SID_THES );
     408             :                 }
     409             :                 else
     410             :                 {
     411           0 :                     rSet.DisableItem( SID_THES );
     412             :                 }
     413             :                 //! avoid putting the same item as SfxBoolItem at the end of this function
     414           0 :                 nSlotId = 0;
     415             :             }
     416           0 :             break;
     417             : 
     418             :             default:
     419           0 :             break;
     420             :         }
     421             : 
     422           0 :         nWhich = aIter.NextWhich();
     423             :     }
     424             : 
     425           0 :     rSet.Put( aAttrSet, sal_False ); // <- sal_False, so DontCare-Status gets aquired
     426             : 
     427             : 
     428             :     // these are disabled in outline-mode
     429           0 :     if (!mpViewShell->ISA(DrawViewShell))
     430             :     {
     431           0 :         rSet.DisableItem( SID_ATTR_PARA_ADJUST_LEFT );
     432           0 :         rSet.DisableItem( SID_ATTR_PARA_ADJUST_RIGHT );
     433           0 :         rSet.DisableItem( SID_ATTR_PARA_ADJUST_CENTER );
     434           0 :         rSet.DisableItem( SID_ATTR_PARA_ADJUST_BLOCK );
     435           0 :         rSet.DisableItem( SID_ATTR_PARA_LINESPACE_10 );
     436           0 :         rSet.DisableItem( SID_ATTR_PARA_LINESPACE_15 );
     437           0 :         rSet.DisableItem( SID_ATTR_PARA_LINESPACE_20 );
     438           0 :         rSet.DisableItem( SID_PARASPACE_INCREASE );
     439           0 :         rSet.DisableItem( SID_PARASPACE_DECREASE );
     440           0 :         rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
     441           0 :         rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
     442           0 :         rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
     443           0 :         rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
     444             :     }
     445             :     else
     446             :     {
     447             :         // paragraph spacing
     448           0 :         OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
     449           0 :         if( pOLV )
     450             :         {
     451           0 :             ESelection aSel = pOLV->GetSelection();
     452           0 :             aSel.Adjust();
     453           0 :             sal_Int32 nStartPara = aSel.nStartPara;
     454           0 :             sal_Int32 nEndPara = aSel.nEndPara;
     455           0 :             if( !aSel.HasRange() )
     456             :             {
     457           0 :                 nStartPara = 0;
     458           0 :                 nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
     459             :             }
     460           0 :             long nUpper = 0L;
     461           0 :             for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
     462             :             {
     463           0 :                 const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( nPara );
     464           0 :                 const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) rItems.Get( EE_PARA_ULSPACE );
     465           0 :                 nUpper = std::max( nUpper, (long)rItem.GetUpper() );
     466           0 :             }
     467           0 :             if( nUpper == 0L )
     468           0 :                 rSet.DisableItem( SID_PARASPACE_DECREASE );
     469             :         }
     470             :         else
     471             :         {
     472             :             // never disabled at the moment!
     473             :             //rSet.DisableItem( SID_PARASPACE_INCREASE );
     474             :             //rSet.DisableItem( SID_PARASPACE_DECREASE );
     475             :         }
     476             : 
     477             :         // paragraph justification
     478           0 :         SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) );
     479           0 :         rSet.Put(aLR);
     480           0 :         SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust();
     481           0 :         switch( eAdj )
     482             :         {
     483             :             case SVX_ADJUST_LEFT:
     484           0 :                 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) );
     485           0 :             break;
     486             :             case SVX_ADJUST_CENTER:
     487           0 :                 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) );
     488           0 :             break;
     489             :             case SVX_ADJUST_RIGHT:
     490           0 :                 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) );
     491           0 :             break;
     492             :             case SVX_ADJUST_BLOCK:
     493           0 :                 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) );
     494           0 :             break;
     495             :             default:
     496           0 :             break;
     497             :         }
     498             : 
     499           0 :         Invalidate(SID_ATTR_PARA_ADJUST_LEFT);
     500           0 :         Invalidate(SID_ATTR_PARA_ADJUST_CENTER);
     501           0 :         Invalidate(SID_ATTR_PARA_ADJUST_RIGHT);
     502           0 :         Invalidate(SID_ATTR_PARA_ADJUST_BLOCK);
     503           0 :         Invalidate(SID_ATTR_PARA_LINESPACE);
     504           0 :         Invalidate(SID_ATTR_PARA_ULSPACE);
     505             : 
     506             :         // paragraph text direction
     507           0 :         if( bDisableParagraphTextDirection )
     508             :         {
     509           0 :             rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
     510           0 :             rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
     511             :         }
     512             :         else
     513             :         {
     514           0 :             switch( ( ( (SvxFrameDirectionItem&) aAttrSet.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
     515             :             {
     516             :                 case FRMDIR_VERT_TOP_LEFT:
     517             :                 case FRMDIR_VERT_TOP_RIGHT:
     518             :                 {
     519           0 :                     rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
     520           0 :                     rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
     521             :                 }
     522           0 :                 break;
     523             : 
     524             :                 case FRMDIR_HORI_LEFT_TOP:
     525           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, sal_True ) );
     526           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, sal_False ) );
     527           0 :                 break;
     528             : 
     529             :                 case FRMDIR_HORI_RIGHT_TOP:
     530           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, sal_False ) );
     531           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, sal_True ) );
     532           0 :                 break;
     533             : 
     534             :                 // The case for the superordinate object is missing.
     535             :                 case FRMDIR_ENVIRONMENT:
     536             :                 {
     537           0 :                     SdDrawDocument& rDoc = mpView->GetDoc();
     538           0 :                     ::com::sun::star::text::WritingMode eMode = rDoc.GetDefaultWritingMode();
     539           0 :                     sal_Bool bIsLeftToRight(sal_False);
     540             : 
     541           0 :                     if(::com::sun::star::text::WritingMode_LR_TB == eMode
     542           0 :                         || ::com::sun::star::text::WritingMode_TB_RL == eMode)
     543             :                     {
     544           0 :                         bIsLeftToRight = sal_True;
     545             :                     }
     546             : 
     547           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, bIsLeftToRight ) );
     548           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, !bIsLeftToRight ) );
     549             :                 }
     550           0 :                 break;
     551             :             }
     552             :         }
     553             : 
     554           0 :         SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) );
     555           0 :         aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
     556           0 :         rSet.Put(aLRSpace);
     557           0 :         Invalidate(SID_ATTR_PARA_LRSPACE);
     558             :         //Added by xuxu
     559           0 :         SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
     560           0 :         if ( eState == SFX_ITEM_DONTCARE )
     561             :         {
     562           0 :             rSet.InvalidateItem(EE_PARA_LRSPACE);
     563           0 :             rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
     564             :         }
     565             :         sal_uInt16 nLineSpace = (sal_uInt16) ( (const SvxLineSpacingItem&) aAttrSet.
     566           0 :                             Get( EE_PARA_SBL ) ).GetPropLineSpace();
     567           0 :         switch( nLineSpace )
     568             :         {
     569             :             case 100:
     570           0 :                 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, sal_True ) );
     571           0 :             break;
     572             :             case 150:
     573           0 :                 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, sal_True ) );
     574           0 :             break;
     575             :             case 200:
     576           0 :                 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, sal_True ) );
     577           0 :             break;
     578           0 :         }
     579             :     }
     580             : 
     581             :     // justification (superscript, subscript) is also needed in outline-mode
     582             :     SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
     583           0 :                     aAttrSet.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
     584             : 
     585           0 :     if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
     586           0 :         rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
     587           0 :     else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
     588           0 :         rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
     589           0 : }
     590             : 
     591             : /**
     592             :  * Command event
     593             :  */
     594             : 
     595           0 : void TextObjectBar::Command( const CommandEvent& )
     596             : {
     597           0 : }
     598             : 
     599             : 
     600          33 : } // end of namespace sd
     601             : 
     602             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10