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

Generated by: LCOV version 1.10