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