LCOV - code coverage report
Current view: top level - sw/source/ui/shells - drwtxtex.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 449 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1008 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      31                 :            : 
      32                 :            : #include <comphelper/processfactory.hxx>
      33                 :            : #include <comphelper/string.hxx>
      34                 :            : #include <i18npool/mslangid.hxx>
      35                 :            : #include <sfx2/bindings.hxx>
      36                 :            : #include <sfx2/dispatch.hxx>
      37                 :            : #include <sfx2/request.hxx>
      38                 :            : #include <tools/shl.hxx>
      39                 :            : #include <svx/svdview.hxx>
      40                 :            : #include <editeng/spltitem.hxx>
      41                 :            : #include <editeng/orphitem.hxx>
      42                 :            : #include <editeng/brkitem.hxx>
      43                 :            : #include <editeng/widwitem.hxx>
      44                 :            : #include <editeng/kernitem.hxx>
      45                 :            : #include <editeng/escpitem.hxx>
      46                 :            : #include <editeng/lspcitem.hxx>
      47                 :            : #include <editeng/adjitem.hxx>
      48                 :            : #include <editeng/crsditem.hxx>
      49                 :            : #include <editeng/shdditem.hxx>
      50                 :            : #include <editeng/udlnitem.hxx>
      51                 :            : #include <editeng/fontitem.hxx>
      52                 :            : #include <editeng/fhgtitem.hxx>
      53                 :            : #include <editeng/colritem.hxx>
      54                 :            : #include <editeng/wghtitem.hxx>
      55                 :            : #include <editeng/cntritem.hxx>
      56                 :            : #include <editeng/postitem.hxx>
      57                 :            : #include <editeng/frmdiritem.hxx>
      58                 :            : #include <svx/svdoutl.hxx>
      59                 :            : #include <sfx2/viewfrm.hxx>
      60                 :            : #include <svl/whiter.hxx>
      61                 :            : #include <svl/cjkoptions.hxx>
      62                 :            : #include <svl/ctloptions.hxx>
      63                 :            : #include <svtools/langtab.hxx>
      64                 :            : #include <svl/languageoptions.hxx>
      65                 :            : #include <vcl/msgbox.hxx>
      66                 :            : #include <editeng/flditem.hxx>
      67                 :            : #include <editeng/editstat.hxx>
      68                 :            : #include <svx/hlnkitem.hxx>
      69                 :            : #include <svx/htmlmode.hxx>
      70                 :            : #include <svl/slstitm.hxx>
      71                 :            : #include <editeng/langitem.hxx>
      72                 :            : #include <editeng/unolingu.hxx>
      73                 :            : #include <editeng/scripttypeitem.hxx>
      74                 :            : #include <editeng/writingmodeitem.hxx>
      75                 :            : #include <editeng/eeitem.hxx>
      76                 :            : #include <editeng/editeng.hxx>
      77                 :            : #include <editeng/editdata.hxx>
      78                 :            : #include <editeng/outliner.hxx>
      79                 :            : #include <vcl/window.hxx>
      80                 :            : #include <editeng/editview.hxx>
      81                 :            : #include <vcl/outdev.hxx>
      82                 :            : #include <editeng/hyznitem.hxx>
      83                 :            : 
      84                 :            : #include <cmdid.h>
      85                 :            : #include <doc.hxx>
      86                 :            : #include <docstat.hxx>
      87                 :            : #include <drwtxtsh.hxx>
      88                 :            : #include <edtwin.hxx>
      89                 :            : #include <globals.hrc>
      90                 :            : #include <hintids.hxx>
      91                 :            : #include <initui.hxx>               // fuer SpellPointer
      92                 :            : #include <langhelper.hxx>
      93                 :            : #include <pardlg.hxx>
      94                 :            : #include <shells.hrc>
      95                 :            : #include <string.h>
      96                 :            : #include <swdtflvr.hxx>
      97                 :            : #include <swmodule.hxx>
      98                 :            : #include <swwait.hxx>
      99                 :            : #include <uitool.hxx>
     100                 :            : #include <viewopt.hxx>
     101                 :            : #include <wrtsh.hxx>
     102                 :            : #include <wview.hxx>
     103                 :            : #include <wordcountdialog.hxx>
     104                 :            : 
     105                 :            : #include "swabstdlg.hxx"
     106                 :            : #include "chrdlg.hrc"
     107                 :            : #include "misc.hrc"
     108                 :            : 
     109                 :            : 
     110                 :            : using namespace ::com::sun::star;
     111                 :            : 
     112                 :          0 : void SwDrawTextShell::Execute( SfxRequest &rReq )
     113                 :            : {
     114         [ #  # ]:          0 :     SwWrtShell &rSh = GetShell();
     115                 :          0 :         OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
     116         [ #  # ]:          0 :         SfxItemSet aEditAttr(pOLV->GetAttribs());
     117         [ #  # ]:          0 :     SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
     118                 :            : 
     119                 :          0 :     sal_uInt16 nSlot = rReq.GetSlot();
     120                 :            : 
     121         [ #  # ]:          0 :     sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
     122                 :          0 :     const SfxItemSet *pNewAttrs = rReq.GetArgs();
     123                 :            : 
     124                 :          0 :     bool bRestoreSelection = false;
     125                 :          0 :     ESelection aOldSelection;
     126                 :            : 
     127                 :          0 :     sal_uInt16 nEEWhich = 0;
     128   [ #  #  #  #  :          0 :     switch (nSlot)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     129                 :            :     {
     130                 :            :         case SID_LANGUAGE_STATUS:
     131                 :            :         {
     132         [ #  # ]:          0 :             aOldSelection = pOLV->GetSelection();
     133 [ #  # ][ #  # ]:          0 :             if (!pOLV->GetEditView().HasSelection())
     134                 :            :             {
     135                 :          0 :                 bRestoreSelection   = true;
     136         [ #  # ]:          0 :                 pOLV->GetEditView().SelectCurrentWord();
     137                 :            :             }
     138                 :            : 
     139         [ #  # ]:          0 :             bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh);
     140                 :          0 :             break;
     141                 :            :         }
     142                 :            : 
     143                 :            :         case SID_THES:
     144                 :            :         {
     145         [ #  # ]:          0 :             String aReplaceText;
     146 [ #  # ][ #  # ]:          0 :             SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False );
     147         [ #  # ]:          0 :             if (pItem2)
     148         [ #  # ]:          0 :                 aReplaceText = pItem2->GetValue();
     149         [ #  # ]:          0 :             if (aReplaceText.Len() > 0)
     150         [ #  # ]:          0 :                 ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
     151         [ #  # ]:          0 :             break;
     152                 :            :         }
     153                 :            : 
     154                 :            :         case SID_ATTR_CHAR_FONT:
     155                 :            :         case SID_ATTR_CHAR_FONTHEIGHT:
     156                 :            :         case SID_ATTR_CHAR_WEIGHT:
     157                 :            :         case SID_ATTR_CHAR_POSTURE:
     158                 :            :         {
     159         [ #  # ]:          0 :             SfxItemPool* pPool2 = aEditAttr.GetPool()->GetSecondaryPool();
     160         [ #  # ]:          0 :             if( !pPool2 )
     161                 :          0 :                 pPool2 = aEditAttr.GetPool();
     162         [ #  # ]:          0 :             SvxScriptSetItem aSetItem( nSlot, *pPool2 );
     163                 :            : 
     164                 :            :             // #i78017 establish the same behaviour as in Writer
     165                 :          0 :             sal_uInt16 nScriptTypes = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
     166         [ #  # ]:          0 :             if (nSlot == SID_ATTR_CHAR_FONT)
     167         [ #  # ]:          0 :                 nScriptTypes = pOLV->GetSelectedScriptType();
     168                 :            : 
     169 [ #  # ][ #  # ]:          0 :             aSetItem.PutItemForScriptType( nScriptTypes, pNewAttrs->Get( nWhich ) );
     170 [ #  # ][ #  # ]:          0 :             aNewAttr.Put( aSetItem.GetItemSet() );
     171                 :            :         }
     172                 :          0 :         break;
     173                 :            : 
     174                 :          0 :         case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
     175                 :            : 
     176                 :            :         case SID_ATTR_CHAR_UNDERLINE:
     177                 :            :         {
     178         [ #  # ]:          0 :              FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle();
     179 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE));
                 [ #  # ]
     180                 :            :         }
     181                 :          0 :         break;
     182                 :            : 
     183                 :            :         case SID_ATTR_CHAR_OVERLINE:
     184                 :            :         {
     185         [ #  # ]:          0 :              FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle();
     186 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE));
                 [ #  # ]
     187                 :            :         }
     188                 :          0 :         break;
     189                 :            : 
     190                 :          0 :         case SID_ATTR_CHAR_CONTOUR:     nEEWhich = EE_CHAR_OUTLINE; break;
     191                 :          0 :         case SID_ATTR_CHAR_SHADOWED:    nEEWhich = EE_CHAR_SHADOW; break;
     192                 :          0 :         case SID_ATTR_CHAR_STRIKEOUT:   nEEWhich = EE_CHAR_STRIKEOUT; break;
     193                 :          0 :         case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
     194                 :          0 :         case SID_ATTR_CHAR_RELIEF      : nEEWhich = EE_CHAR_RELIEF;  break;
     195                 :          0 :         case SID_ATTR_CHAR_LANGUAGE    : nEEWhich = EE_CHAR_LANGUAGE;break;
     196                 :          0 :         case SID_ATTR_CHAR_KERNING     : nEEWhich = EE_CHAR_KERNING; break;
     197                 :          0 :         case SID_ATTR_CHAR_SCALEWIDTH:   nEEWhich = EE_CHAR_FONTWIDTH; break;
     198                 :          0 :         case SID_ATTR_CHAR_AUTOKERN  :   nEEWhich = EE_CHAR_PAIRKERNING; break;
     199                 :          0 :         case SID_ATTR_CHAR_ESCAPEMENT:   nEEWhich = EE_CHAR_ESCAPEMENT; break;
     200                 :            :         case SID_ATTR_PARA_ADJUST_LEFT:
     201 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST));
                 [ #  # ]
     202                 :          0 :         break;
     203                 :            :         case SID_ATTR_PARA_ADJUST_CENTER:
     204 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
                 [ #  # ]
     205                 :          0 :         break;
     206                 :            :         case SID_ATTR_PARA_ADJUST_RIGHT:
     207 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST));
                 [ #  # ]
     208                 :          0 :         break;
     209                 :            :         case SID_ATTR_PARA_ADJUST_BLOCK:
     210 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
                 [ #  # ]
     211                 :          0 :         break;
     212                 :            : 
     213                 :            :         case SID_ATTR_PARA_LINESPACE_10:
     214                 :            :         {
     215         [ #  # ]:          0 :             SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
     216                 :          0 :             aItem.SetPropLineSpace(100);
     217 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(aItem);
     218                 :            :         }
     219                 :          0 :         break;
     220                 :            :         case SID_ATTR_PARA_LINESPACE_15:
     221                 :            :         {
     222         [ #  # ]:          0 :             SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL);
     223                 :          0 :             aItem.SetPropLineSpace(150);
     224 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(aItem);
     225                 :            :         }
     226                 :          0 :         break;
     227                 :            :         case SID_ATTR_PARA_LINESPACE_20:
     228                 :            :         {
     229         [ #  # ]:          0 :             SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL);
     230                 :          0 :             aItem.SetPropLineSpace(200);
     231 [ #  # ][ #  # ]:          0 :             aNewAttr.Put(aItem);
     232                 :            :         }
     233                 :          0 :         break;
     234                 :            : 
     235                 :            :         case FN_SET_SUPER_SCRIPT:
     236                 :            :         {
     237         [ #  # ]:          0 :             SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
     238                 :            :             SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
     239 [ #  # ][ #  # ]:          0 :                             aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
     240                 :            : 
     241         [ #  # ]:          0 :             if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
     242                 :          0 :                 aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
     243                 :            :             else
     244                 :          0 :                 aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
     245 [ #  # ][ #  # ]:          0 :             aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
     246                 :            :         }
     247                 :          0 :         break;
     248                 :            :         case FN_SET_SUB_SCRIPT:
     249                 :            :         {
     250         [ #  # ]:          0 :             SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
     251                 :            :             SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
     252 [ #  # ][ #  # ]:          0 :                             aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
     253                 :            : 
     254         [ #  # ]:          0 :             if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
     255                 :          0 :                 aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
     256                 :            :             else
     257                 :          0 :                 aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
     258 [ #  # ][ #  # ]:          0 :             aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
     259                 :            :         }
     260                 :          0 :         break;
     261                 :            : 
     262                 :            :         case SID_CHAR_DLG:
     263                 :            :         case SID_CHAR_DLG_FOR_PARAGRAPH:
     264                 :            :         {
     265                 :          0 :             const SfxItemSet* pArgs = rReq.GetArgs();
     266                 :            : 
     267         [ #  # ]:          0 :             if( !pArgs )
     268                 :            :             {
     269         [ #  # ]:          0 :                 aOldSelection = pOLV->GetSelection();
     270         [ #  # ]:          0 :                 if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
     271                 :            :                 {
     272                 :            :                     // select current paragraph (and restore selection later on...)
     273                 :          0 :                     EditView & rEditView = pOLV->GetEditView();
     274 [ #  # ][ #  # ]:          0 :                     SwLangHelper::SelectPara( rEditView, rEditView.GetSelection() );
     275                 :          0 :                     bRestoreSelection = true;
     276                 :            :                 }
     277                 :            : 
     278                 :          0 :                 SwView* pView = &GetView();
     279 [ #  # ][ #  # ]:          0 :                 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     280 [ #  # ][ #  # ]:          0 :                 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
         [ #  # ][ #  # ]
     281         [ #  # ]:          0 :                 SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
     282                 :            : 
     283                 :            :                 // util::Language gibts an der EditEngine nicht! Daher nicht im Set.
     284                 :            : 
     285         [ #  # ]:          0 :                 aDlgAttr.Put( aEditAttr );
     286 [ #  # ][ #  # ]:          0 :                 aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
                 [ #  # ]
     287                 :            : 
     288         [ #  # ]:          0 :                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     289                 :            :                 OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     290                 :            : 
     291         [ #  # ]:          0 :                 SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR,0, sal_True );
     292                 :            :                 OSL_ENSURE(pDlg, "Dialogdiet fail!");
     293         [ #  # ]:          0 :                 sal_uInt16 nRet = pDlg->Execute();
     294         [ #  # ]:          0 :                 if(RET_OK == nRet )
     295                 :            :                 {
     296 [ #  # ][ #  # ]:          0 :                     rReq.Done( *( pDlg->GetOutputItemSet() ) );
     297 [ #  # ][ #  # ]:          0 :                     aNewAttr.Put(*pDlg->GetOutputItemSet());
     298                 :            :                 }
     299 [ #  # ][ #  # ]:          0 :                 delete( pDlg );
     300         [ #  # ]:          0 :                 if(RET_OK != nRet)
     301 [ #  # ][ #  # ]:          0 :                     return ;
     302                 :            :             }
     303                 :            :             else
     304         [ #  # ]:          0 :                 aNewAttr.Put(*pArgs);
     305                 :            :         }
     306                 :          0 :         break;
     307                 :            :         case FN_FORMAT_FOOTNOTE_DLG:
     308                 :            :         {
     309         [ #  # ]:          0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     310                 :            :             OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     311                 :            : 
     312         [ #  # ]:          0 :             VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rView.GetWrtShell(), DLG_DOC_FOOTNOTE );
     313                 :            :             OSL_ENSURE(pDlg, "Dialogdiet fail!");
     314         [ #  # ]:          0 :             pDlg->Execute();
     315 [ #  # ][ #  # ]:          0 :             delete pDlg;
     316                 :          0 :             break;
     317                 :            :         }
     318                 :            :         case FN_NUMBERING_OUTLINE_DLG:
     319                 :            :         {
     320         [ #  # ]:          0 :             SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
     321         [ #  # ]:          0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     322                 :            :             OSL_ENSURE(pFact, "Dialogdiet fail!");
     323                 :            :             SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
     324         [ #  # ]:          0 :                                                         GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
     325                 :            :             OSL_ENSURE(pDlg, "Dialogdiet fail!");
     326         [ #  # ]:          0 :             pDlg->Execute();
     327 [ #  # ][ #  # ]:          0 :             delete pDlg;
     328 [ #  # ][ #  # ]:          0 :             rReq.Done();
     329                 :            :         }
     330                 :          0 :         break;
     331                 :            :         case SID_OPEN_XML_FILTERSETTINGS:
     332                 :            :         {
     333                 :            :             try
     334                 :            :             {
     335 [ #  # ][ #  # ]:          0 :                 uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ui.XSLTFilterDialog"))), uno::UNO_QUERY);
         [ #  # ][ #  # ]
                 [ #  # ]
     336         [ #  # ]:          0 :                 if( xDialog.is() )
     337                 :            :                 {
     338 [ #  # ][ #  # ]:          0 :                     xDialog->execute();
     339         [ #  # ]:          0 :                 }
     340                 :            :             }
     341         [ #  # ]:          0 :             catch (const uno::Exception&)
     342                 :            :             {
     343                 :            :             }
     344         [ #  # ]:          0 :             rReq.Ignore ();
     345                 :            :         }
     346                 :          0 :         break;
     347                 :            :         case FN_WORDCOUNT_DIALOG:
     348                 :            :         {
     349                 :          0 :             SfxViewFrame* pVFrame = GetView().GetViewFrame();
     350         [ #  # ]:          0 :             if (pVFrame != NULL)
     351                 :            :             {
     352         [ #  # ]:          0 :                 pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
     353         [ #  # ]:          0 :                 Invalidate(rReq.GetSlot());
     354                 :            : 
     355 [ #  # ][ #  # ]:          0 :                 SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
     356         [ #  # ]:          0 :                 if (pWrdCnt)
     357         [ #  # ]:          0 :                     pWrdCnt->UpdateCounts();
     358                 :            :             }
     359                 :            :         }
     360                 :          0 :         break;
     361                 :            :         case SID_PARA_DLG:
     362                 :            :         {
     363                 :          0 :             const SfxItemSet* pArgs = rReq.GetArgs();
     364                 :            : 
     365         [ #  # ]:          0 :             if (!pArgs)
     366                 :            :             {
     367                 :          0 :                 SwView* pView = &GetView();
     368 [ #  # ][ #  # ]:          0 :                 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     369 [ #  # ][ #  # ]:          0 :                 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
         [ #  # ][ #  # ]
     370                 :          0 :                 SfxItemSet aDlgAttr(GetPool(),
     371                 :            :                                     EE_ITEMS_START, EE_ITEMS_END,
     372                 :            :                                     SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
     373                 :            :                                     SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
     374                 :            :                                     SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
     375                 :            :                                     SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
     376         [ #  # ]:          0 :                                     0);
     377                 :            : 
     378         [ #  # ]:          0 :                 aDlgAttr.Put(aEditAttr);
     379                 :            : 
     380 [ #  # ][ #  # ]:          0 :                 aDlgAttr.Put( SvxHyphenZoneItem( sal_False, RES_PARATR_HYPHENZONE) );
                 [ #  # ]
     381 [ #  # ][ #  # ]:          0 :                 aDlgAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
                 [ #  # ]
     382 [ #  # ][ #  # ]:          0 :                 aDlgAttr.Put( SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT ) );
                 [ #  # ]
     383 [ #  # ][ #  # ]:          0 :                 aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
                 [ #  # ]
     384 [ #  # ][ #  # ]:          0 :                 aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
                 [ #  # ]
     385                 :            : 
     386         [ #  # ]:          0 :                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     387                 :            :                 OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     388                 :            : 
     389         [ #  # ]:          0 :                 SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(), GetView(), aDlgAttr,DLG_STD, DLG_PARA, 0, sal_True );
     390                 :            :                 OSL_ENSURE(pDlg, "Dialogdiet fail!");
     391         [ #  # ]:          0 :                 sal_uInt16 nRet = pDlg->Execute();
     392         [ #  # ]:          0 :                 if(RET_OK == nRet)
     393                 :            :                 {
     394 [ #  # ][ #  # ]:          0 :                     rReq.Done( *( pDlg->GetOutputItemSet() ) );
     395 [ #  # ][ #  # ]:          0 :                     aNewAttr.Put(*pDlg->GetOutputItemSet());
     396                 :            :                 }
     397 [ #  # ][ #  # ]:          0 :                 delete( pDlg );
     398         [ #  # ]:          0 :                 if(RET_OK != nRet)
     399 [ #  # ][ #  # ]:          0 :                     return;
     400                 :            :             }
     401                 :            :             else
     402         [ #  # ]:          0 :                 aNewAttr.Put(*pArgs);
     403                 :            :         }
     404                 :          0 :         break;
     405                 :            :         case SID_AUTOSPELL_CHECK:
     406                 :            :         {
     407                 :            : //!! JP 16.03.2001: why??           pSdrView = rSh.GetDrawView();
     408                 :            : //!! JP 16.03.2001: why??           pOutliner = pSdrView->GetTextEditOutliner();
     409                 :          0 :             SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
     410         [ #  # ]:          0 :             sal_uInt32 nCtrl = pOutliner->GetControlWord();
     411                 :            : 
     412                 :          0 :             sal_Bool bSet = ((const SfxBoolItem&)rReq.GetArgs()->Get(
     413         [ #  # ]:          0 :                                                     nSlot)).GetValue();
     414         [ #  # ]:          0 :             if(bSet)
     415                 :          0 :                 nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
     416                 :            :             else
     417                 :          0 :                 nCtrl &= ~EE_CNTRL_ONLINESPELLING;
     418         [ #  # ]:          0 :             pOutliner->SetControlWord(nCtrl);
     419                 :            : 
     420         [ #  # ]:          0 :             rView.ExecuteSlot(rReq);
     421                 :            :         }
     422                 :          0 :         break;
     423                 :            :         case SID_HYPERLINK_SETLINK:
     424                 :            :         {
     425                 :          0 :             const SfxPoolItem* pItem = 0;
     426         [ #  # ]:          0 :             if(pNewAttrs)
     427         [ #  # ]:          0 :                 pNewAttrs->GetItemState(nSlot, sal_False, &pItem);
     428                 :            : 
     429         [ #  # ]:          0 :             if(pItem)
     430                 :            :             {
     431                 :          0 :                 const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
     432 [ #  # ][ #  # ]:          0 :                 SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT);
                 [ #  # ]
     433         [ #  # ]:          0 :                 aFld.SetTargetFrame(rHLinkItem.GetTargetFrame());
     434                 :            : 
     435         [ #  # ]:          0 :                 const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
     436                 :            : 
     437 [ #  # ][ #  # ]:          0 :                 if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField))
         [ #  # ][ #  # ]
                 [ #  # ]
     438                 :            :                 {
     439                 :            :                     // Feld selektieren, so dass es beim Insert geloescht wird
     440         [ #  # ]:          0 :                     ESelection aSel = pOLV->GetSelection();
     441                 :          0 :                     aSel.nEndPos++;
     442         [ #  # ]:          0 :                     pOLV->SetSelection(aSel);
     443                 :            :                 }
     444 [ #  # ][ #  # ]:          0 :                 pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
         [ #  # ][ #  # ]
     445                 :            :             }
     446                 :            :         }
     447                 :          0 :         break;
     448                 :            : 
     449                 :            :         case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
     450                 :            :         case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
     451                 :            :             // Shellwechsel!
     452                 :            :             {
     453 [ #  # ][ #  # ]:          0 :                 SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     454                 :          0 :                 SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
     455                 :          0 :                 SdrView* pTmpView = pSdrView;
     456                 :            : 
     457         [ #  # ]:          0 :                 pSdrView->SdrEndTextEdit(sal_True);
     458                 :            : 
     459                 :          0 :                 SfxItemSet aAttr( *aNewAttr.GetPool(),
     460                 :            :                             SDRATTR_TEXTDIRECTION,
     461         [ #  # ]:          0 :                             SDRATTR_TEXTDIRECTION );
     462                 :            : 
     463                 :            :                 aAttr.Put( SvxWritingModeItem(
     464                 :            :                     nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
     465                 :            :                         text::WritingMode_LR_TB
     466 [ #  # ][ #  # ]:          0 :                         : text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION ) );
         [ #  # ][ #  # ]
     467         [ #  # ]:          0 :                 pTmpView->SetAttributes( aAttr );
     468                 :            : 
     469         [ #  # ]:          0 :                 rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), sal_False);
     470 [ #  # ][ #  # ]:          0 :                 rSh.GetView().AttrChangedNotify( &rSh );
     471                 :            :             }
     472                 :            :             return;
     473                 :            : 
     474                 :            :         case SID_ATTR_PARA_LEFT_TO_RIGHT:
     475                 :            :         case SID_ATTR_PARA_RIGHT_TO_LEFT:
     476                 :            :         {
     477 [ #  # ][ #  # ]:          0 :             SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     478                 :          0 :             SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
     479                 :          0 :             SdrView* pTmpView = pSdrView;
     480                 :            : 
     481         [ #  # ]:          0 :             pSdrView->SdrEndTextEdit(sal_True);
     482                 :          0 :             sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
     483                 :            : 
     484                 :            :             const SfxPoolItem* pPoolItem;
     485 [ #  # ][ #  # ]:          0 :             if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, sal_True, &pPoolItem ) )
         [ #  # ][ #  # ]
     486                 :            :             {
     487         [ #  # ]:          0 :                 if( !( (SfxBoolItem*)pPoolItem)->GetValue() )
     488                 :          0 :                     bLeftToRight = !bLeftToRight;
     489                 :            :             }
     490                 :          0 :             SfxItemSet aAttr( *aNewAttr.GetPool(),
     491                 :            :                         EE_PARA_JUST, EE_PARA_JUST,
     492                 :            :                         EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
     493         [ #  # ]:          0 :                         0 );
     494                 :            : 
     495                 :          0 :             sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
     496 [ #  # ][ #  # ]:          0 :             if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) )
     497         [ #  # ]:          0 :                 nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
     498                 :            : 
     499         [ #  # ]:          0 :             if( bLeftToRight )
     500                 :            :             {
     501 [ #  # ][ #  # ]:          0 :                 aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
                 [ #  # ]
     502         [ #  # ]:          0 :                 if( nAdjust == SVX_ADJUST_RIGHT )
     503 [ #  # ][ #  # ]:          0 :                     aAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
                 [ #  # ]
     504                 :            :             }
     505                 :            :             else
     506                 :            :             {
     507 [ #  # ][ #  # ]:          0 :                 aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
                 [ #  # ]
     508         [ #  # ]:          0 :                 if( nAdjust == SVX_ADJUST_LEFT )
     509 [ #  # ][ #  # ]:          0 :                     aAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
                 [ #  # ]
     510                 :            :             }
     511         [ #  # ]:          0 :             pTmpView->SetAttributes( aAttr );
     512         [ #  # ]:          0 :             rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), sal_False );
     513 [ #  # ][ #  # ]:          0 :             rSh.GetView().AttrChangedNotify( &rSh );
     514                 :            :         }
     515                 :            :         return;
     516                 :            :         default:
     517                 :            :             OSL_ENSURE(!this, "wrong dispatcher");
     518                 :            :             return;
     519                 :            :     }
     520 [ #  # ][ #  # ]:          0 :     if(nEEWhich && pNewAttrs)
     521 [ #  # ][ #  # ]:          0 :         aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
     522                 :            : 
     523         [ #  # ]:          0 :     SetAttrToMarked(aNewAttr);
     524                 :            : 
     525         [ #  # ]:          0 :     GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
     526                 :            : 
     527 [ #  # ][ #  # ]:          0 :     if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
         [ #  # ][ #  # ]
                 [ #  # ]
     528         [ #  # ]:          0 :         rSh.SetModified();
     529                 :            : 
     530         [ #  # ]:          0 :     if (bRestoreSelection)
     531                 :            :     {
     532                 :            :         // restore selection
     533         [ #  # ]:          0 :         pOLV->GetEditView().SetSelection( aOldSelection );
     534 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
     535                 :            : }
     536                 :            : 
     537                 :          0 : void SwDrawTextShell::GetState(SfxItemSet& rSet)
     538                 :            : {
     539 [ #  # ][ #  # ]:          0 :     if (!IsTextEdit())  // Sonst manchmal Absturz!
     540                 :          0 :         return;
     541                 :            : 
     542                 :          0 :     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
     543         [ #  # ]:          0 :     SfxWhichIter aIter(rSet);
     544         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     545                 :            : 
     546         [ #  # ]:          0 :     SfxItemSet aEditAttr( pOLV->GetAttribs() );
     547                 :          0 :     const SfxPoolItem *pAdjust = 0, *pLSpace = 0, *pEscItem = 0;
     548                 :            :     int eAdjust, nLSpace, nEsc;
     549                 :            : 
     550         [ #  # ]:          0 :     while(nWhich)
     551                 :            :     {
     552         [ #  # ]:          0 :         sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
     553                 :          0 :         sal_Bool bFlag = sal_False;
     554   [ #  #  #  #  :          0 :         switch( nSlotId )
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     555                 :            :         {
     556                 :            :             case SID_LANGUAGE_STATUS://20412:
     557                 :            :             {
     558         [ #  # ]:          0 :                 nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);
     559                 :          0 :                 break;
     560                 :            :             }
     561                 :            : 
     562                 :            :             case SID_THES:
     563                 :            :             {
     564         [ #  # ]:          0 :                 String          aStatusVal;
     565                 :          0 :                 LanguageType    nLang = LANGUAGE_NONE;
     566         [ #  # ]:          0 :                 bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
     567 [ #  # ][ #  # ]:          0 :                 rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
                 [ #  # ]
     568                 :            : 
     569                 :            :                 // disable "Thesaurus" context menu entry if there is nothing to look up
     570         [ #  # ]:          0 :                 uno::Reference< linguistic2::XThesaurus >  xThes( ::GetThesaurus() );
     571         [ #  # ]:          0 :                 lang::Locale aLocale( SvxCreateLocale( nLang ) );
     572   [ #  #  #  # ]:          0 :                 if (!bIsLookUpWord ||
         [ #  # ][ #  # ]
                 [ #  # ]
     573 [ #  # ][ #  # ]:          0 :                     !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
     574         [ #  # ]:          0 :                     rSet.DisableItem( SID_THES );
     575                 :            : 
     576                 :            :                 //! avoid puting the same item as SfxBoolItem at the end of this function
     577                 :          0 :                 nSlotId = 0;
     578         [ #  # ]:          0 :                 break;
     579                 :            :             }
     580                 :            : 
     581                 :          0 :         case SID_ATTR_PARA_ADJUST_LEFT:     eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST;
     582                 :          0 :         case SID_ATTR_PARA_ADJUST_RIGHT:    eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST;
     583                 :          0 :         case SID_ATTR_PARA_ADJUST_CENTER:   eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST;
     584                 :          0 :         case SID_ATTR_PARA_ADJUST_BLOCK:    eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST;
     585                 :            : ASK_ADJUST:
     586                 :            :             {
     587         [ #  # ]:          0 :                 if( !pAdjust )
     588         [ #  # ]:          0 :                     aEditAttr.GetItemState( EE_PARA_JUST, sal_False, &pAdjust);
     589                 :            : 
     590 [ #  # ][ #  # ]:          0 :                 if( !pAdjust || IsInvalidItem( pAdjust ))
                 [ #  # ]
     591         [ #  # ]:          0 :                     rSet.InvalidateItem( nSlotId ), nSlotId = 0;
     592                 :            :                 else
     593                 :          0 :                     bFlag = eAdjust == ((SvxAdjustItem*)pAdjust)->GetAdjust();
     594                 :            :             }
     595                 :          0 :             break;
     596                 :            : 
     597                 :          0 :         case SID_ATTR_PARA_LINESPACE_10:    nLSpace = 100;  goto ASK_LINESPACE;
     598                 :          0 :         case SID_ATTR_PARA_LINESPACE_15:    nLSpace = 150;  goto ASK_LINESPACE;
     599                 :          0 :         case SID_ATTR_PARA_LINESPACE_20:    nLSpace = 200;  goto ASK_LINESPACE;
     600                 :            : ASK_LINESPACE:
     601                 :            :             {
     602         [ #  # ]:          0 :                 if( !pLSpace )
     603         [ #  # ]:          0 :                     aEditAttr.GetItemState( EE_PARA_SBL, sal_False, &pLSpace );
     604                 :            : 
     605 [ #  # ][ #  # ]:          0 :                 if( !pLSpace || IsInvalidItem( pLSpace ))
                 [ #  # ]
     606         [ #  # ]:          0 :                     rSet.InvalidateItem( nSlotId ), nSlotId = 0;
     607         [ #  # ]:          0 :                 else if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->
     608                 :          0 :                                                 GetPropLineSpace() )
     609                 :          0 :                     bFlag = sal_True;
     610                 :            :                 else
     611                 :          0 :                     nSlotId = 0;
     612                 :            :             }
     613                 :          0 :             break;
     614                 :            : 
     615                 :          0 :         case FN_SET_SUPER_SCRIPT:   nEsc = SVX_ESCAPEMENT_SUPERSCRIPT;
     616                 :          0 :                                     goto ASK_ESCAPE;
     617                 :          0 :         case FN_SET_SUB_SCRIPT:     nEsc = SVX_ESCAPEMENT_SUBSCRIPT;
     618                 :          0 :                                     goto ASK_ESCAPE;
     619                 :            : ASK_ESCAPE:
     620                 :            :             {
     621         [ #  # ]:          0 :                 if( !pEscItem )
     622         [ #  # ]:          0 :                     pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
     623                 :            : 
     624         [ #  # ]:          0 :                 if( nEsc == ((const SvxEscapementItem*)
     625         [ #  # ]:          0 :                                                 pEscItem)->GetEnumValue() )
     626                 :          0 :                     bFlag = sal_True;
     627                 :            :                 else
     628                 :          0 :                     nSlotId = 0;
     629                 :            :             }
     630                 :          0 :             break;
     631                 :            : 
     632                 :            :         case SID_THESAURUS:
     633                 :            :         {
     634                 :            :             // disable "Thesaurus" if the language is not supported
     635         [ #  # ]:          0 :             const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault(
     636                 :            :                             GetWhichOfScript( RES_CHRATR_LANGUAGE,
     637 [ #  # ][ #  # ]:          0 :                             GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) );
         [ #  # ][ #  # ]
     638                 :          0 :             LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage();
     639                 :            : 
     640         [ #  # ]:          0 :             uno::Reference< linguistic2::XThesaurus >  xThes( ::GetThesaurus() );
     641 [ #  # ][ #  # ]:          0 :             if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) ))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     642         [ #  # ]:          0 :                 rSet.DisableItem( SID_THESAURUS );
     643                 :          0 :             nSlotId = 0;
     644                 :            :         }
     645                 :          0 :         break;
     646                 :            :         case SID_HANGUL_HANJA_CONVERSION:
     647                 :            :         case SID_CHINESE_CONVERSION:
     648                 :            :         {
     649 [ #  # ][ #  # ]:          0 :             if (!SvtCJKOptions().IsAnyEnabled())
         [ #  # ][ #  # ]
     650                 :            :             {
     651         [ #  # ]:          0 :                 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
     652         [ #  # ]:          0 :                 rSet.DisableItem(nWhich);
     653                 :            :             }
     654                 :            :             else
     655         [ #  # ]:          0 :                 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
     656                 :            :         }
     657                 :          0 :         break;
     658                 :            : 
     659                 :            :         case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
     660                 :            :         case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
     661 [ #  # ][ #  # ]:          0 :             if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
         [ #  # ][ #  # ]
     662                 :            :             {
     663         [ #  # ]:          0 :                 rSet.DisableItem( nSlotId );
     664                 :          0 :                 nSlotId = 0;
     665                 :            :             }
     666                 :            :             else
     667                 :            :             {
     668                 :          0 :                 SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
     669         [ #  # ]:          0 :                 if( pOutliner )
     670         [ #  # ]:          0 :                     bFlag = pOutliner->IsVertical() ==
     671                 :          0 :                             (SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId);
     672                 :            :                 else
     673                 :            :                 {
     674                 :            :                     text::WritingMode eMode = (text::WritingMode)
     675         [ #  # ]:          0 :                                     ( (const SvxWritingModeItem&) aEditAttr.Get( SDRATTR_TEXTDIRECTION ) ).GetValue();
     676                 :            : 
     677         [ #  # ]:          0 :                     if( nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT )
     678                 :            :                     {
     679                 :          0 :                         bFlag = eMode == text::WritingMode_LR_TB;
     680                 :            :                     }
     681                 :            :                     else
     682                 :            :                     {
     683                 :          0 :                         bFlag = eMode != text::WritingMode_TB_RL;
     684                 :            :                     }
     685                 :            :                 }
     686                 :            :             }
     687                 :          0 :             break;
     688                 :            :         case SID_ATTR_PARA_LEFT_TO_RIGHT:
     689                 :            :         case SID_ATTR_PARA_RIGHT_TO_LEFT:
     690                 :            :         {
     691 [ #  # ][ #  # ]:          0 :             if ( !SvtLanguageOptions().IsCTLFontEnabled() )
         [ #  # ][ #  # ]
     692                 :            :             {
     693         [ #  # ]:          0 :                 rSet.DisableItem( nWhich );
     694                 :          0 :                 nSlotId = 0;
     695                 :            :             }
     696                 :            :             else
     697                 :            :             {
     698                 :          0 :                 SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
     699 [ #  # ][ #  # ]:          0 :                 if(pOutliner && pOutliner->IsVertical())
         [ #  # ][ #  # ]
     700                 :            :                 {
     701         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     702                 :          0 :                     nSlotId = 0;
     703                 :            :                 }
     704                 :            :                 else
     705                 :            :                 {
     706         [ #  # ]:          0 :                     switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
              [ #  #  # ]
     707                 :            :                     {
     708                 :            :                         case FRMDIR_HORI_LEFT_TOP:
     709                 :          0 :                             bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
     710                 :          0 :                         break;
     711                 :            : 
     712                 :            :                         case FRMDIR_HORI_RIGHT_TOP:
     713                 :          0 :                             bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
     714                 :          0 :                         break;
     715                 :            :                     }
     716                 :            :                 }
     717                 :            :             }
     718                 :            :         }
     719                 :          0 :         break;
     720                 :            :         case SID_TRANSLITERATE_HALFWIDTH:
     721                 :            :         case SID_TRANSLITERATE_FULLWIDTH:
     722                 :            :         case SID_TRANSLITERATE_HIRAGANA:
     723                 :            :         case SID_TRANSLITERATE_KATAGANA:
     724                 :            :         {
     725         [ #  # ]:          0 :             SvtCJKOptions aCJKOptions;
     726 [ #  # ][ #  # ]:          0 :             if(!aCJKOptions.IsChangeCaseMapEnabled())
     727                 :            :             {
     728         [ #  # ]:          0 :                 rSet.DisableItem(nWhich);
     729         [ #  # ]:          0 :                 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
     730                 :            :             }
     731                 :            :             else
     732 [ #  # ][ #  # ]:          0 :                 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
     733                 :            :         }
     734                 :          0 :         break;
     735                 :            :         case SID_INSERT_RLM :
     736                 :            :         case SID_INSERT_LRM :
     737                 :            :         case SID_INSERT_ZWNBSP :
     738                 :            :         case SID_INSERT_ZWSP:
     739                 :            :         {
     740         [ #  # ]:          0 :             SvtCTLOptions aCTLOptions;
     741         [ #  # ]:          0 :             sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
     742         [ #  # ]:          0 :             GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
     743         [ #  # ]:          0 :             if(!bEnabled)
     744 [ #  # ][ #  # ]:          0 :                 rSet.DisableItem(nWhich);
     745                 :            :         }
     746                 :          0 :         break;
     747                 :            :         default:
     748                 :          0 :             nSlotId = 0;                // don't know this slot
     749                 :          0 :             break;
     750                 :            :         }
     751                 :            : 
     752         [ #  # ]:          0 :         if( nSlotId )
     753 [ #  # ][ #  # ]:          0 :             rSet.Put( SfxBoolItem( nWhich, bFlag ));
                 [ #  # ]
     754                 :            : 
     755         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     756 [ #  # ][ #  # ]:          0 :     }
     757                 :            : }
     758                 :            : 
     759                 :          0 : void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet)
     760                 :            : {
     761 [ #  # ][ #  # ]:          0 :     if (!IsTextEdit())  // Sonst Absturz!
     762                 :          0 :         return;
     763                 :            : 
     764                 :          0 :     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
     765         [ #  # ]:          0 :     SfxItemSet aEditAttr(pOLV->GetAttribs());
     766                 :            : 
     767         [ #  # ]:          0 :     SfxWhichIter aIter(rSet);
     768         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     769         [ #  # ]:          0 :     sal_uInt16 nScriptType = pOLV->GetSelectedScriptType();
     770         [ #  # ]:          0 :     while(nWhich)
     771                 :            :     {
     772                 :          0 :         sal_uInt16 nEEWhich = 0;
     773         [ #  # ]:          0 :         sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
     774   [ #  #  #  #  :          0 :         switch( nSlotId )
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     775                 :            :         {
     776                 :            :             case SID_ATTR_CHAR_FONT:
     777                 :            :             case SID_ATTR_CHAR_FONTHEIGHT:
     778                 :            :             case SID_ATTR_CHAR_WEIGHT:
     779                 :            :             case SID_ATTR_CHAR_POSTURE:
     780                 :            :             {
     781         [ #  # ]:          0 :                 SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
     782         [ #  # ]:          0 :                 if( !pEditPool )
     783                 :          0 :                     pEditPool = aEditAttr.GetPool();
     784         [ #  # ]:          0 :                 SvxScriptSetItem aSetItem( nSlotId, *pEditPool );
     785         [ #  # ]:          0 :                 aSetItem.GetItemSet().Put( aEditAttr, sal_False );
     786         [ #  # ]:          0 :                 const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
     787         [ #  # ]:          0 :                 if( pI )
     788         [ #  # ]:          0 :                     rSet.Put( *pI, nWhich );
     789                 :            :                 else
     790 [ #  # ][ #  # ]:          0 :                     rSet.InvalidateItem( nWhich );
     791                 :            :             }
     792                 :          0 :             break;
     793                 :          0 :             case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
     794                 :          0 :             case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
     795                 :          0 :             case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
     796                 :          0 :             case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
     797                 :          0 :             case SID_ATTR_CHAR_SHADOWED:  nEEWhich = EE_CHAR_SHADOW;break;
     798                 :          0 :             case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
     799                 :            :             case SID_AUTOSPELL_CHECK:
     800                 :            :             {
     801         [ #  # ]:          0 :                 const SfxPoolItem* pState = rView.GetSlotState(nWhich);
     802         [ #  # ]:          0 :                 if (pState)
     803 [ #  # ][ #  # ]:          0 :                     rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue()));
                 [ #  # ]
     804                 :            :                 else
     805         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     806                 :          0 :                 break;
     807                 :            :             }
     808                 :          0 :             case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
     809                 :          0 :             case SID_ATTR_CHAR_RELIEF      : nEEWhich = EE_CHAR_RELIEF;  break;
     810                 :          0 :             case SID_ATTR_CHAR_LANGUAGE    : nEEWhich = EE_CHAR_LANGUAGE;break;
     811                 :          0 :             case SID_ATTR_CHAR_KERNING     : nEEWhich = EE_CHAR_KERNING; break;
     812                 :          0 :             case SID_ATTR_CHAR_SCALEWIDTH:   nEEWhich = EE_CHAR_FONTWIDTH;break;
     813                 :          0 :             case SID_ATTR_CHAR_AUTOKERN  :   nEEWhich = EE_CHAR_PAIRKERNING; break;
     814                 :          0 :             case SID_ATTR_CHAR_ESCAPEMENT:   nEEWhich = EE_CHAR_ESCAPEMENT; break;
     815                 :            :         }
     816         [ #  # ]:          0 :         if(nEEWhich)
     817 [ #  # ][ #  # ]:          0 :             rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
     818                 :            : 
     819         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     820 [ #  # ][ #  # ]:          0 :     }
     821                 :            : }
     822                 :            : 
     823                 :          0 : void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq)
     824                 :            : {
     825 [ #  # ][ #  # ]:          0 :     if (!IsTextEdit())  // Sonst Absturz!
     826                 :            :         return;
     827                 :            : 
     828                 :          0 :     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
     829                 :            : 
     830         [ #  # ]:          0 :     ESelection aSel(pOLV->GetSelection());
     831 [ #  # ][ #  # ]:          0 :     const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
     832                 :          0 :     sal_uInt16 nId = rReq.GetSlot();
     833   [ #  #  #  # ]:          0 :     switch( nId )
     834                 :            :     {
     835                 :            :         case SID_CUT:
     836         [ #  # ]:          0 :             if (bCopy)
     837         [ #  # ]:          0 :                 pOLV->Cut();
     838                 :            :             return;
     839                 :            : 
     840                 :            :         case SID_COPY:
     841         [ #  # ]:          0 :             if (bCopy)
     842         [ #  # ]:          0 :                 pOLV->Copy();
     843                 :            :             return;
     844                 :            : 
     845                 :            :         case SID_PASTE:
     846         [ #  # ]:          0 :             pOLV->PasteSpecial();
     847                 :          0 :             break;
     848                 :            : 
     849                 :            :         default:
     850                 :            :             OSL_FAIL("wrong dispatcher");
     851                 :            :             return;
     852                 :            :     }
     853                 :            : }
     854                 :            : 
     855                 :            : /*--------------------------------------------------------------------
     856                 :            :     Beschreibung:   ClipBoard-Status
     857                 :            :  --------------------------------------------------------------------*/
     858                 :          0 : void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
     859                 :            : {
     860 [ #  # ][ #  # ]:          0 :     if (!IsTextEdit())  // Sonst Absturz!
     861                 :          0 :         return;
     862                 :            : 
     863                 :          0 :     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
     864         [ #  # ]:          0 :     ESelection aSel(pOLV->GetSelection());
     865                 :            :     const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
     866 [ #  # ][ #  # ]:          0 :                            (aSel.nStartPos != aSel.nEndPos);
     867                 :            : 
     868                 :            : 
     869         [ #  # ]:          0 :     SfxWhichIter aIter(rSet);
     870         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     871                 :            : 
     872         [ #  # ]:          0 :     while(nWhich)
     873                 :            :     {
     874   [ #  #  #  #  :          0 :         switch(nWhich)
                      # ]
     875                 :            :         {
     876                 :            :             case SID_CUT:
     877                 :            :             case SID_COPY:
     878         [ #  # ]:          0 :                 if( !bCopy )
     879         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     880                 :          0 :                 break;
     881                 :            : 
     882                 :            :             case SID_PASTE:
     883                 :            :                 {
     884                 :            :                     TransferableDataHelper aDataHelper(
     885                 :            :                         TransferableDataHelper::CreateFromSystemClipboard(
     886         [ #  # ]:          0 :                                 &GetView().GetEditWin() ) );
     887                 :            : 
     888 [ #  # ][ #  # ]:          0 :                     if( !aDataHelper.GetXTransferable().is() ||
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     889 [ #  # ][ #  # ]:          0 :                         !SwTransferable::IsPaste( GetShell(), aDataHelper ))
     890 [ #  # ][ #  # ]:          0 :                         rSet.DisableItem( SID_PASTE );
     891                 :            :                 }
     892                 :          0 :                 break;
     893                 :            : 
     894                 :            :             case SID_PASTE_SPECIAL:
     895         [ #  # ]:          0 :                 rSet.DisableItem( SID_PASTE_SPECIAL );
     896                 :          0 :                 break;
     897                 :            :             // #151110#
     898                 :            :             case SID_CLIPBOARD_FORMAT_ITEMS:
     899         [ #  # ]:          0 :                 rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
     900                 :          0 :                 break;
     901                 :            :         }
     902         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     903         [ #  # ]:          0 :     }
     904                 :            : }
     905                 :            : 
     906                 :            : /*--------------------------------------------------------------------
     907                 :            :     Beschreibung:   Hyperlink-Status
     908                 :            :  --------------------------------------------------------------------*/
     909                 :          0 : void SwDrawTextShell::StateInsert(SfxItemSet &rSet)
     910                 :            : {
     911 [ #  # ][ #  # ]:          0 :     if (!IsTextEdit())  // Sonst Absturz!
     912                 :          0 :         return;
     913                 :            : 
     914                 :          0 :     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
     915         [ #  # ]:          0 :     SfxWhichIter aIter(rSet);
     916         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     917                 :            : 
     918         [ #  # ]:          0 :     while(nWhich)
     919                 :            :     {
     920         [ #  # ]:          0 :         switch(nWhich)
     921                 :            :         {
     922                 :            :             case SID_HYPERLINK_GETLINK:
     923                 :            :                 {
     924         [ #  # ]:          0 :                     SvxHyperlinkItem aHLinkItem;
     925                 :          0 :                     aHLinkItem.SetInsertMode(HLINK_FIELD);
     926                 :            : 
     927         [ #  # ]:          0 :                     const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
     928                 :            : 
     929         [ #  # ]:          0 :                     if (pFieldItem)
     930                 :            :                     {
     931                 :          0 :                         const SvxFieldData* pField = pFieldItem->GetField();
     932                 :            : 
     933 [ #  # ][ #  # ]:          0 :                         if (pField->ISA(SvxURLField))
                 [ #  # ]
     934                 :            :                         {
     935 [ #  # ][ #  # ]:          0 :                             aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
                 [ #  # ]
     936 [ #  # ][ #  # ]:          0 :                             aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
                 [ #  # ]
     937 [ #  # ][ #  # ]:          0 :                             aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
                 [ #  # ]
     938                 :            :                         }
     939                 :            :                     }
     940                 :            :                     else
     941                 :            :                     {
     942         [ #  # ]:          0 :                         String sSel(pOLV->GetSelected());
     943         [ #  # ]:          0 :                         sSel.Erase(255);
     944 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     945                 :            :                     }
     946                 :            : 
     947 [ #  # ][ #  # ]:          0 :                     sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
     948                 :          0 :                     aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
     949         [ #  # ]:          0 :                         ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
     950                 :            : 
     951 [ #  # ][ #  # ]:          0 :                     rSet.Put(aHLinkItem);
     952                 :            :                 }
     953                 :          0 :                 break;
     954                 :            :         }
     955         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     956         [ #  # ]:          0 :     }
     957                 :            : }
     958                 :            : 
     959                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10