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 <hintids.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp> 30cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModulesExtra.hpp> 31cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionOption.hpp> 32cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <tools/shl.hxx> 36cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 37cdf0e10cSrcweir #include <sfx2/objface.hxx> 38cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 39cdf0e10cSrcweir #include <sfx2/bindings.hxx> 40cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 41cdf0e10cSrcweir #include <sfx2/request.hxx> 42cdf0e10cSrcweir #include <editeng/spltitem.hxx> 43766ce4d0SZheng Fan #include <editeng/lrspitem.hxx> 44766ce4d0SZheng Fan #include <editeng/ulspitem.hxx> 45cdf0e10cSrcweir #include <editeng/orphitem.hxx> 46cdf0e10cSrcweir #include <editeng/brkitem.hxx> 47cdf0e10cSrcweir #include <editeng/widwitem.hxx> 48cdf0e10cSrcweir #include <editeng/kernitem.hxx> 49cdf0e10cSrcweir #include <editeng/escpitem.hxx> 50cdf0e10cSrcweir #include <editeng/lspcitem.hxx> 51cdf0e10cSrcweir #include <editeng/adjitem.hxx> 52cdf0e10cSrcweir #include <editeng/crsditem.hxx> 53cdf0e10cSrcweir #include <editeng/shdditem.hxx> 54cdf0e10cSrcweir #include <editeng/hyznitem.hxx> 55cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 56cdf0e10cSrcweir #include <editeng/fontitem.hxx> 57cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 58cdf0e10cSrcweir #include <svx/clipfmtitem.hxx> 59cdf0e10cSrcweir #include <svl/stritem.hxx> 60cdf0e10cSrcweir #include <svl/slstitm.hxx> 61cdf0e10cSrcweir #include <editeng/colritem.hxx> 62cdf0e10cSrcweir #include <editeng/wghtitem.hxx> 63cdf0e10cSrcweir #include <editeng/cntritem.hxx> 64cdf0e10cSrcweir #include <editeng/postitem.hxx> 65cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 66cdf0e10cSrcweir #include <svx/svdoutl.hxx> 67cdf0e10cSrcweir #include <svl/whiter.hxx> 68cdf0e10cSrcweir #include <svl/cjkoptions.hxx> 69cdf0e10cSrcweir #include <svl/ctloptions.hxx> 70cdf0e10cSrcweir #include <unotools/useroptions.hxx> 71cdf0e10cSrcweir #include <vcl/msgbox.hxx> 72cdf0e10cSrcweir #include <editeng/flditem.hxx> 73cdf0e10cSrcweir #include <editeng/editstat.hxx> 74cdf0e10cSrcweir #include <svx/hlnkitem.hxx> 75cdf0e10cSrcweir #include <svx/htmlmode.hxx> 76cdf0e10cSrcweir #include <editeng/langitem.hxx> 77cdf0e10cSrcweir #include <editeng/unolingu.hxx> 78cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 79cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx> 80cdf0e10cSrcweir #include <swundo.hxx> 81cdf0e10cSrcweir #include <doc.hxx> 82cdf0e10cSrcweir #include <viewopt.hxx> 83cdf0e10cSrcweir #include <wrtsh.hxx> 84cdf0e10cSrcweir #include <uitool.hxx> 85cdf0e10cSrcweir #include <popup.hrc> 86cdf0e10cSrcweir #include <pardlg.hxx> 87cdf0e10cSrcweir #include <swdtflvr.hxx> 88cdf0e10cSrcweir #include <drwtxtsh.hxx> 89cdf0e10cSrcweir #include <swmodule.hxx> 90cdf0e10cSrcweir #include <initui.hxx> 91cdf0e10cSrcweir #include <edtwin.hxx> 92cdf0e10cSrcweir #include <swwait.hxx> 93cdf0e10cSrcweir #include <docstat.hxx> 94cdf0e10cSrcweir 95cdf0e10cSrcweir #include <cmdid.h> 96cdf0e10cSrcweir #include <globals.hrc> 97cdf0e10cSrcweir #include <shells.hrc> 98cdf0e10cSrcweir #include <breakit.hxx> 99cdf0e10cSrcweir #include "annotsh.hxx" 100cdf0e10cSrcweir #include "view.hxx" 101cdf0e10cSrcweir #include <PostItMgr.hxx> 102cdf0e10cSrcweir #include <SidebarWin.hxx> 103cdf0e10cSrcweir 104cdf0e10cSrcweir #include "swtypes.hxx" 105cdf0e10cSrcweir 106cdf0e10cSrcweir #include <svx/svxdlg.hxx> 107cdf0e10cSrcweir #include <svx/dialogs.hrc> 108cdf0e10cSrcweir 109cdf0e10cSrcweir #include <svx/svxids.hrc> 110f120fe41SAndre Fischer #include <sfx2/sidebar/EnumContext.hxx> 111cdf0e10cSrcweir #include <svl/itempool.hxx> 112cdf0e10cSrcweir #include <editeng/outliner.hxx> 113cdf0e10cSrcweir #include <editeng/editeng.hxx> 114cdf0e10cSrcweir #include <editeng/editview.hxx> 115cdf0e10cSrcweir 116cdf0e10cSrcweir #include <svl/languageoptions.hxx> 117cdf0e10cSrcweir #include <editeng/langitem.hxx> 118cdf0e10cSrcweir #include <svtools/langtab.hxx> 119cdf0e10cSrcweir #include <svl/slstitm.hxx> 120cdf0e10cSrcweir 121cdf0e10cSrcweir #include <docsh.hxx> 122cdf0e10cSrcweir #include <svl/undo.hxx> 123cdf0e10cSrcweir #include "swabstdlg.hxx" 124cdf0e10cSrcweir #include "chrdlg.hrc" 125cdf0e10cSrcweir #include "misc.hrc" 126cdf0e10cSrcweir #include <app.hrc> 127cdf0e10cSrcweir 128cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 129cdf0e10cSrcweir 130cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx> 131cdf0e10cSrcweir 132cdf0e10cSrcweir #include <langhelper.hxx> 133cdf0e10cSrcweir 134cdf0e10cSrcweir using namespace ::com::sun::star; 135cdf0e10cSrcweir using namespace ::com::sun::star::uno; 136cdf0e10cSrcweir using namespace ::com::sun::star::beans; 137cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 138cdf0e10cSrcweir 139cdf0e10cSrcweir #define SwAnnotationShell 140cdf0e10cSrcweir 141cdf0e10cSrcweir #include <sfx2/msg.hxx> 142cdf0e10cSrcweir #include <swslots.hxx> 143cdf0e10cSrcweir 144cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwAnnotationShell, SfxShell, SW_RES(STR_SHELLNAME_DRAW_TEXT)) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX)); 147cdf0e10cSrcweir SFX_POPUPMENU_REGISTRATION(SW_RES(MN_ANNOTATION_POPUPMENU)); 148cdf0e10cSrcweir } 149cdf0e10cSrcweir 150cdf0e10cSrcweir TYPEINIT1(SwAnnotationShell,SfxShell) 151cdf0e10cSrcweir 152cdf0e10cSrcweir SwAnnotationShell::SwAnnotationShell( SwView& r ) 153cdf0e10cSrcweir : rView(r) 154cdf0e10cSrcweir { 155cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 156cdf0e10cSrcweir SetPool(rSh.GetAttrPool().GetSecondaryPool()); 157f120fe41SAndre Fischer SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Annotation)); 158cdf0e10cSrcweir } 159cdf0e10cSrcweir 160cdf0e10cSrcweir SwAnnotationShell::~SwAnnotationShell() 161cdf0e10cSrcweir { 162cdf0e10cSrcweir } 163cdf0e10cSrcweir 164cdf0e10cSrcweir ::svl::IUndoManager* SwAnnotationShell::GetUndoManager() 165cdf0e10cSrcweir { 166cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 167cdf0e10cSrcweir if ( !pPostItMgr || 168cdf0e10cSrcweir !pPostItMgr->HasActiveSidebarWin() ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir DBG_ASSERT(pPostItMgr,"PostItMgr::Layout(): We are looping forever"); 171cdf0e10cSrcweir return 0; 172cdf0e10cSrcweir } 173cdf0e10cSrcweir return &pPostItMgr->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner()->GetUndoManager(); 174cdf0e10cSrcweir } 175cdf0e10cSrcweir 176cdf0e10cSrcweir void SwAnnotationShell::Exec( SfxRequest &rReq ) 177cdf0e10cSrcweir { 178cdf0e10cSrcweir //TODO: clean this up!!!! 179cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 180cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 181cdf0e10cSrcweir return; 182cdf0e10cSrcweir 183cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 184cdf0e10cSrcweir SfxItemSet aEditAttr(pOLV->GetAttribs()); 185cdf0e10cSrcweir SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges()); 186cdf0e10cSrcweir 187cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 188cdf0e10cSrcweir sal_uInt16 nWhich = GetPool().GetWhich(nSlot); 189cdf0e10cSrcweir const SfxItemSet *pNewAttrs = rReq.GetArgs(); 190cdf0e10cSrcweir sal_uInt16 nEEWhich = 0; 191cdf0e10cSrcweir switch (nSlot) 192cdf0e10cSrcweir { 193766ce4d0SZheng Fan case SID_ATTR_PARA_LRSPACE: 194766ce4d0SZheng Fan { 195766ce4d0SZheng Fan SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. 196766ce4d0SZheng Fan GetArgs()->Get(nSlot)); 197766ce4d0SZheng Fan aParaMargin.SetWhich( EE_PARA_LRSPACE ); 198766ce4d0SZheng Fan 199766ce4d0SZheng Fan aNewAttr.Put(aParaMargin); 200766ce4d0SZheng Fan rReq.Done(); 201766ce4d0SZheng Fan break; 202766ce4d0SZheng Fan } 203766ce4d0SZheng Fan case SID_ATTR_PARA_LINESPACE: 204766ce4d0SZheng Fan { 205766ce4d0SZheng Fan SvxLineSpacingItem aParaMargin = (const SvxLineSpacingItem&)pNewAttrs->Get( 206766ce4d0SZheng Fan GetPool().GetWhich(nSlot)); 207766ce4d0SZheng Fan aParaMargin.SetWhich( EE_PARA_SBL ); 208766ce4d0SZheng Fan 209766ce4d0SZheng Fan aNewAttr.Put(aParaMargin); 210766ce4d0SZheng Fan rReq.Done(); 211766ce4d0SZheng Fan break; 212766ce4d0SZheng Fan } 213766ce4d0SZheng Fan case SID_ATTR_PARA_ULSPACE: 214766ce4d0SZheng Fan { 215766ce4d0SZheng Fan SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get( 216766ce4d0SZheng Fan GetPool().GetWhich(nSlot)); 217766ce4d0SZheng Fan aULSpace.SetWhich( EE_PARA_ULSPACE ); 218766ce4d0SZheng Fan aNewAttr.Put( aULSpace ); 219766ce4d0SZheng Fan rReq.Done(); 220766ce4d0SZheng Fan } 221766ce4d0SZheng Fan break; 222cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 223cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 224cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 225cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 226cdf0e10cSrcweir { 227cdf0e10cSrcweir SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool(); 228cdf0e10cSrcweir if( !pSecondPool ) 229cdf0e10cSrcweir pSecondPool = aEditAttr.GetPool(); 230cdf0e10cSrcweir SvxScriptSetItem aSetItem( nSlot, *pSecondPool ); 231cdf0e10cSrcweir aSetItem.PutItemForScriptType( pOLV->GetSelectedScriptType(), pNewAttrs->Get( nWhich )); 232cdf0e10cSrcweir aNewAttr.Put( aSetItem.GetItemSet() ); 233cdf0e10cSrcweir rReq.Done(); 234cdf0e10cSrcweir break; 235cdf0e10cSrcweir } 236cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break; 237cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE: 238cdf0e10cSrcweir { 239*512ec161SZheng Fan if( rReq.GetArgs() ) 240*512ec161SZheng Fan { 241*512ec161SZheng Fan SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); 242*512ec161SZheng Fan if (pItem) 243*512ec161SZheng Fan { 244*512ec161SZheng Fan aNewAttr.Put(*pItem); 245*512ec161SZheng Fan } 246*512ec161SZheng Fan else 247*512ec161SZheng Fan { 248cdf0e10cSrcweir FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); 249*512ec161SZheng Fan aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) ); 250*512ec161SZheng Fan } 251*512ec161SZheng Fan } 252cdf0e10cSrcweir break; 253cdf0e10cSrcweir } 254cdf0e10cSrcweir case SID_ATTR_CHAR_OVERLINE: 255cdf0e10cSrcweir { 256cdf0e10cSrcweir FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle(); 257cdf0e10cSrcweir aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE)); 258cdf0e10cSrcweir break; 259cdf0e10cSrcweir } 260cdf0e10cSrcweir case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break; 261cdf0e10cSrcweir case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break; 262cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break; 263cdf0e10cSrcweir case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break; 264cdf0e10cSrcweir case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break; 265cdf0e10cSrcweir case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break; 266cdf0e10cSrcweir case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break; 267cdf0e10cSrcweir case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break; 268cdf0e10cSrcweir case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break; 269cdf0e10cSrcweir case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break; 270cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_LEFT: 271cdf0e10cSrcweir aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST)); 272cdf0e10cSrcweir break; 273cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_CENTER: 274cdf0e10cSrcweir aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST)); 275cdf0e10cSrcweir break; 276cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_RIGHT: 277cdf0e10cSrcweir aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST)); 278cdf0e10cSrcweir break; 279cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK: 280cdf0e10cSrcweir aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST)); 281cdf0e10cSrcweir break; 282cdf0e10cSrcweir 283cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_10: 284cdf0e10cSrcweir { 285cdf0e10cSrcweir SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL); 286cdf0e10cSrcweir aItem.SetPropLineSpace(100); 287cdf0e10cSrcweir aNewAttr.Put(aItem); 288cdf0e10cSrcweir } 289cdf0e10cSrcweir break; 290cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_15: 291cdf0e10cSrcweir { 292cdf0e10cSrcweir SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL); 293cdf0e10cSrcweir aItem.SetPropLineSpace(150); 294cdf0e10cSrcweir aNewAttr.Put(aItem); 295cdf0e10cSrcweir } 296cdf0e10cSrcweir break; 297cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_20: 298cdf0e10cSrcweir { 299cdf0e10cSrcweir SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL); 300cdf0e10cSrcweir aItem.SetPropLineSpace(200); 301cdf0e10cSrcweir aNewAttr.Put(aItem); 302cdf0e10cSrcweir } 303cdf0e10cSrcweir break; 304cdf0e10cSrcweir case SID_SELECTALL: 305cdf0e10cSrcweir { 306cdf0e10cSrcweir Outliner * pOutliner = pOLV->GetOutliner(); 307cdf0e10cSrcweir if(pOutliner) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir sal_uLong nParaCount = pOutliner->GetParagraphCount(); 310cdf0e10cSrcweir if (nParaCount > 0) 311cdf0e10cSrcweir pOLV->SelectRange(0L, sal_uInt16(nParaCount) ); 312cdf0e10cSrcweir } 313cdf0e10cSrcweir break; 314cdf0e10cSrcweir } 315cdf0e10cSrcweir case FN_FORMAT_RESET: 316cdf0e10cSrcweir { 317cdf0e10cSrcweir pPostItMgr->GetActiveSidebarWin()->ResetAttributes(); 318cdf0e10cSrcweir rReq.Done(); 319cdf0e10cSrcweir break; 320cdf0e10cSrcweir } 321cdf0e10cSrcweir case FN_SET_SUPER_SCRIPT: 322cdf0e10cSrcweir { 323cdf0e10cSrcweir SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); 324cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) 325cdf0e10cSrcweir aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 326cdf0e10cSrcweir 327cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) 328cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); 329cdf0e10cSrcweir else 330cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); 331cdf0e10cSrcweir aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT ); 332cdf0e10cSrcweir } 333cdf0e10cSrcweir break; 334cdf0e10cSrcweir case FN_SET_SUB_SCRIPT: 335cdf0e10cSrcweir { 336cdf0e10cSrcweir SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); 337cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) 338cdf0e10cSrcweir aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 339cdf0e10cSrcweir 340cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) 341cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); 342cdf0e10cSrcweir else 343cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); 344cdf0e10cSrcweir aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT ); 345cdf0e10cSrcweir } 346cdf0e10cSrcweir break; 347cdf0e10cSrcweir case SID_HYPERLINK_SETLINK: 348cdf0e10cSrcweir { 349cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 350cdf0e10cSrcweir if(pNewAttrs) 351cdf0e10cSrcweir pNewAttrs->GetItemState(nSlot, sal_False, &pItem); 352cdf0e10cSrcweir 353cdf0e10cSrcweir if(pItem) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem; 356cdf0e10cSrcweir SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT); 357cdf0e10cSrcweir aFld.SetTargetFrame(rHLinkItem.GetTargetFrame()); 358cdf0e10cSrcweir 359cdf0e10cSrcweir const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); 360cdf0e10cSrcweir 361cdf0e10cSrcweir if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField)) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir // Feld selektieren, so dass es beim Insert geloescht wird 364cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection(); 365cdf0e10cSrcweir aSel.nEndPos++; 366cdf0e10cSrcweir pOLV->SetSelection(aSel); 367cdf0e10cSrcweir } 368cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) 369cdf0e10cSrcweir pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD)); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir break; 372cdf0e10cSrcweir } 373cdf0e10cSrcweir case FN_INSERT_SOFT_HYPHEN: 374cdf0e10cSrcweir case FN_INSERT_HARDHYPHEN: 375cdf0e10cSrcweir case FN_INSERT_HARD_SPACE: 376cdf0e10cSrcweir case SID_INSERT_RLM : 377cdf0e10cSrcweir case SID_INSERT_LRM : 378cdf0e10cSrcweir case SID_INSERT_ZWNBSP : 379cdf0e10cSrcweir case SID_INSERT_ZWSP: 380cdf0e10cSrcweir { 381cdf0e10cSrcweir sal_Unicode cIns = 0; 382cdf0e10cSrcweir switch(rReq.GetSlot()) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break; 385cdf0e10cSrcweir case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break; 386cdf0e10cSrcweir case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break; 387cdf0e10cSrcweir case SID_INSERT_RLM : cIns = CHAR_RLM ; break; 388cdf0e10cSrcweir case SID_INSERT_LRM : cIns = CHAR_LRM ; break; 389cdf0e10cSrcweir case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break; 390cdf0e10cSrcweir case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir pOLV->InsertText( String(cIns)); 393cdf0e10cSrcweir rReq.Done(); 394cdf0e10cSrcweir break; 395cdf0e10cSrcweir } 396cdf0e10cSrcweir case SID_CHARMAP: 397cdf0e10cSrcweir { 398cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) 399cdf0e10cSrcweir InsertSymbol(rReq); 400cdf0e10cSrcweir break; 401cdf0e10cSrcweir } 402cdf0e10cSrcweir case FN_INSERT_STRING: 403cdf0e10cSrcweir { 404cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 405cdf0e10cSrcweir if(pNewAttrs) 406cdf0e10cSrcweir pNewAttrs->GetItemState(nSlot, sal_False, &pItem ); 407cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) 408cdf0e10cSrcweir pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue()); 409cdf0e10cSrcweir break; 410cdf0e10cSrcweir } 411cdf0e10cSrcweir 412cdf0e10cSrcweir case FN_FORMAT_FOOTNOTE_DLG: 413cdf0e10cSrcweir { 414cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 415cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 416cdf0e10cSrcweir 417cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( rView.GetWindow(), rView.GetWrtShell(), DLG_DOC_FOOTNOTE ); 418cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 419cdf0e10cSrcweir pDlg->Execute(); 420cdf0e10cSrcweir delete pDlg; 421cdf0e10cSrcweir break; 422cdf0e10cSrcweir } 423cdf0e10cSrcweir case FN_NUMBERING_OUTLINE_DLG: 424cdf0e10cSrcweir { 425cdf0e10cSrcweir SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); 426cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 427cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 428cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, 429cdf0e10cSrcweir rView.GetWindow(), &aTmp, rView.GetWrtShell()); 430cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 431cdf0e10cSrcweir pDlg->Execute(); 432cdf0e10cSrcweir delete pDlg; 433cdf0e10cSrcweir rReq.Done(); 434cdf0e10cSrcweir } 435cdf0e10cSrcweir break; 436cdf0e10cSrcweir case SID_OPEN_XML_FILTERSETTINGS: 437cdf0e10cSrcweir { 438cdf0e10cSrcweir try 439cdf0e10cSrcweir { 440cdf0e10cSrcweir uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY); 441cdf0e10cSrcweir if( xDialog.is() ) 442cdf0e10cSrcweir { 443cdf0e10cSrcweir xDialog->execute(); 444cdf0e10cSrcweir } 445cdf0e10cSrcweir } 446cdf0e10cSrcweir catch( uno::Exception& ) 447cdf0e10cSrcweir { 448cdf0e10cSrcweir } 449cdf0e10cSrcweir rReq.Ignore (); 450cdf0e10cSrcweir } 451cdf0e10cSrcweir break; 452cdf0e10cSrcweir case FN_WORDCOUNT_DIALOG: 453cdf0e10cSrcweir { 454cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 455cdf0e10cSrcweir SwDocStat aCurr; 456cdf0e10cSrcweir SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); 457cdf0e10cSrcweir { 458cdf0e10cSrcweir SwWait aWait( *rView.GetDocShell(), sal_True ); 459cdf0e10cSrcweir rSh.StartAction(); 460cdf0e10cSrcweir rSh.CountWords( aCurr ); 461cdf0e10cSrcweir rSh.UpdateDocStat( aDocStat ); 462cdf0e10cSrcweir rSh.EndAction(); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 466cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 467cdf0e10cSrcweir AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( rView.GetWindow() ); 468cdf0e10cSrcweir pDialog->SetValues(aCurr, aDocStat ); 469cdf0e10cSrcweir pDialog->Execute(); 470cdf0e10cSrcweir delete pDialog; 471cdf0e10cSrcweir } 472cdf0e10cSrcweir break; 473eb39ad03SZheng Fan case SID_CHAR_DLG_EFFECT: 474cdf0e10cSrcweir case SID_CHAR_DLG: 475cdf0e10cSrcweir { 476cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 477cdf0e10cSrcweir 478cdf0e10cSrcweir if( !pArgs ) 479cdf0e10cSrcweir { 480cdf0e10cSrcweir /* mod 481cdf0e10cSrcweir SwView* pView = &GetView(); 482cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView)); 483cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric)); 484cdf0e10cSrcweir */ 485cdf0e10cSrcweir SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END); 486cdf0e10cSrcweir 487cdf0e10cSrcweir // util::Language gibts an der EditEngine nicht! Daher nicht im Set. 488cdf0e10cSrcweir 489cdf0e10cSrcweir aDlgAttr.Put( aEditAttr ); 490cdf0e10cSrcweir aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) ); 491cdf0e10cSrcweir 492cdf0e10cSrcweir //CHINA001 SwCharDlg* pDlg = new SwCharDlg(pView->GetWindow(), *pView, aDlgAttr, 0, sal_True); 493cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();//CHINA001 494cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");//CHINA001 495cdf0e10cSrcweir 496cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, DLG_CHAR,0, sal_True ); 497cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 498eb39ad03SZheng Fan if (nSlot == SID_CHAR_DLG_EFFECT) 499eb39ad03SZheng Fan { 500eb39ad03SZheng Fan pDlg->SetCurPageId(TP_CHAR_EXT); 501eb39ad03SZheng Fan } 502cdf0e10cSrcweir sal_uInt16 nRet = pDlg->Execute(); 503cdf0e10cSrcweir if(RET_OK == nRet ) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir rReq.Done( *( pDlg->GetOutputItemSet() ) ); 506cdf0e10cSrcweir aNewAttr.Put(*pDlg->GetOutputItemSet()); 507cdf0e10cSrcweir } 508cdf0e10cSrcweir delete( pDlg ); 509cdf0e10cSrcweir if(RET_OK != nRet) 510cdf0e10cSrcweir return ; 511cdf0e10cSrcweir } 512cdf0e10cSrcweir else 513cdf0e10cSrcweir aNewAttr.Put(*pArgs); 514cdf0e10cSrcweir break; 515cdf0e10cSrcweir } 516cdf0e10cSrcweir case SID_PARA_DLG: 517cdf0e10cSrcweir { 518cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 519cdf0e10cSrcweir 520cdf0e10cSrcweir if (!pArgs) 521cdf0e10cSrcweir { 522cdf0e10cSrcweir /* mod todo ??? 523cdf0e10cSrcweir SwView* pView = &GetView(); 524cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView)); 525cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric)); 526cdf0e10cSrcweir */ 527cdf0e10cSrcweir SfxItemSet aDlgAttr(GetPool(), 528cdf0e10cSrcweir EE_ITEMS_START, EE_ITEMS_END, 529cdf0e10cSrcweir SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE, 530cdf0e10cSrcweir SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT, 531cdf0e10cSrcweir SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS, 532cdf0e10cSrcweir SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS, 533cdf0e10cSrcweir 0); 534cdf0e10cSrcweir 535cdf0e10cSrcweir aDlgAttr.Put(aEditAttr); 536cdf0e10cSrcweir 537cdf0e10cSrcweir 538cdf0e10cSrcweir aDlgAttr.Put( SvxHyphenZoneItem( sal_False, RES_PARATR_HYPHENZONE) ); 539cdf0e10cSrcweir aDlgAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) ); 540cdf0e10cSrcweir aDlgAttr.Put( SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT ) ); 541cdf0e10cSrcweir aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) ); 542cdf0e10cSrcweir aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) ); 543cdf0e10cSrcweir 544cdf0e10cSrcweir //CHINA001 SwParaDlg* pDlg = new SwParaDlg(GetView().GetWindow(), GetView(), aDlgAttr, DLG_STD, 0, sal_True); 545cdf0e10cSrcweir 546cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();//CHINA001 547cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");//CHINA001 548cdf0e10cSrcweir 549cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( rView.GetWindow(), rView, aDlgAttr,DLG_STD, DLG_PARA, 0, sal_True ); 550cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 551cdf0e10cSrcweir sal_uInt16 nRet = pDlg->Execute(); 552cdf0e10cSrcweir if(RET_OK == nRet) 553cdf0e10cSrcweir { 554cdf0e10cSrcweir rReq.Done( *( pDlg->GetOutputItemSet() ) ); 555cdf0e10cSrcweir aNewAttr.Put(*pDlg->GetOutputItemSet()); 556cdf0e10cSrcweir } 557cdf0e10cSrcweir delete( pDlg ); 558cdf0e10cSrcweir if(RET_OK != nRet) 559cdf0e10cSrcweir return; 560cdf0e10cSrcweir } 561cdf0e10cSrcweir else 562cdf0e10cSrcweir aNewAttr.Put(*pArgs); 563cdf0e10cSrcweir break; 564cdf0e10cSrcweir } 565cdf0e10cSrcweir 566cdf0e10cSrcweir case SID_AUTOSPELL_CHECK: 567cdf0e10cSrcweir { 568cdf0e10cSrcweir rView.ExecuteSlot(rReq); 569cdf0e10cSrcweir break; 570cdf0e10cSrcweir } 571cdf0e10cSrcweir case SID_ATTR_PARA_LEFT_TO_RIGHT: 572cdf0e10cSrcweir case SID_ATTR_PARA_RIGHT_TO_LEFT: 573cdf0e10cSrcweir { 574cdf0e10cSrcweir sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT; 575cdf0e10cSrcweir 576cdf0e10cSrcweir const SfxPoolItem* pPoolItem; 577cdf0e10cSrcweir if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, sal_True, &pPoolItem ) ) 578cdf0e10cSrcweir { 579cdf0e10cSrcweir if( !( (SfxBoolItem*)pPoolItem)->GetValue() ) 580cdf0e10cSrcweir bLeftToRight = !bLeftToRight; 581cdf0e10cSrcweir } 582cdf0e10cSrcweir SfxItemSet aAttr( *aNewAttr.GetPool(), 583cdf0e10cSrcweir EE_PARA_JUST, EE_PARA_JUST, 584cdf0e10cSrcweir EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR, 585cdf0e10cSrcweir 0 ); 586cdf0e10cSrcweir 587cdf0e10cSrcweir sal_uInt16 nAdjust = SVX_ADJUST_LEFT; 588cdf0e10cSrcweir if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) ) 589cdf0e10cSrcweir nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue(); 590cdf0e10cSrcweir 591cdf0e10cSrcweir if( bLeftToRight ) 592cdf0e10cSrcweir { 593cdf0e10cSrcweir aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) ); 594cdf0e10cSrcweir if( nAdjust == SVX_ADJUST_RIGHT ) 595cdf0e10cSrcweir aAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); 596cdf0e10cSrcweir } 597cdf0e10cSrcweir else 598cdf0e10cSrcweir { 599cdf0e10cSrcweir aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) ); 600cdf0e10cSrcweir if( nAdjust == SVX_ADJUST_LEFT ) 601cdf0e10cSrcweir aAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); 602cdf0e10cSrcweir } 603cdf0e10cSrcweir pOLV->SetAttribs(aAttr); 604cdf0e10cSrcweir break; 605cdf0e10cSrcweir } 606cdf0e10cSrcweir } 607cdf0e10cSrcweir 608cdf0e10cSrcweir if(nEEWhich && pNewAttrs) 609cdf0e10cSrcweir aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich); 610cdf0e10cSrcweir 611cdf0e10cSrcweir Rectangle aNullRect; 612cdf0e10cSrcweir Rectangle aOutRect = pOLV->GetOutputArea(); 613cdf0e10cSrcweir if (aNullRect != aOutRect) 614cdf0e10cSrcweir pOLV->SetAttribs(aNewAttr); 615cdf0e10cSrcweir 616cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False); 617cdf0e10cSrcweir if ( pOLV->GetOutliner()->IsModified() ) 618cdf0e10cSrcweir rView.GetWrtShell().SetModified(); 619cdf0e10cSrcweir 620cdf0e10cSrcweir } 621cdf0e10cSrcweir 622cdf0e10cSrcweir void SwAnnotationShell::GetState(SfxItemSet& rSet) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir //TODO: clean this up!!! 625cdf0e10cSrcweir // FN_SET_SUPER_SCRIPT 626cdf0e10cSrcweir //SID_ATTR_PARA_ADJUST 627cdf0e10cSrcweir //SID_ATTR_PARA_ADJUST_BLOCK 628cdf0e10cSrcweir 629cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 630cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 631cdf0e10cSrcweir return; 632cdf0e10cSrcweir 633cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 634cdf0e10cSrcweir SfxItemSet aEditAttr(pOLV->GetAttribs()); 635cdf0e10cSrcweir 636cdf0e10cSrcweir SfxWhichIter aIter(rSet); 637cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 638cdf0e10cSrcweir while(nWhich) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir sal_uInt16 nEEWhich = 0; 641cdf0e10cSrcweir sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich ); 642cdf0e10cSrcweir switch( nSlotId ) 643cdf0e10cSrcweir { 644766ce4d0SZheng Fan case SID_ATTR_PARA_LRSPACE: 645766ce4d0SZheng Fan { 646766ce4d0SZheng Fan SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE ); 647766ce4d0SZheng Fan if( eState >= SFX_ITEM_DEFAULT ) 648766ce4d0SZheng Fan { 649766ce4d0SZheng Fan SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ) ); 650766ce4d0SZheng Fan aLR.SetWhich(SID_ATTR_PARA_LRSPACE); 651766ce4d0SZheng Fan rSet.Put(aLR); 652766ce4d0SZheng Fan } 653766ce4d0SZheng Fan else 654766ce4d0SZheng Fan rSet.InvalidateItem(nSlotId); 655766ce4d0SZheng Fan } 656766ce4d0SZheng Fan break; 657766ce4d0SZheng Fan case SID_ATTR_PARA_LINESPACE: 658766ce4d0SZheng Fan { 659766ce4d0SZheng Fan SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL ); 660766ce4d0SZheng Fan if( eState >= SFX_ITEM_DEFAULT ) 661766ce4d0SZheng Fan { 662766ce4d0SZheng Fan SvxLineSpacingItem aLR = ( (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ) ); 663766ce4d0SZheng Fan rSet.Put(aLR); 664766ce4d0SZheng Fan } 665766ce4d0SZheng Fan else 666766ce4d0SZheng Fan rSet.InvalidateItem(nSlotId); 667766ce4d0SZheng Fan } 668766ce4d0SZheng Fan break; 669766ce4d0SZheng Fan case SID_ATTR_PARA_ULSPACE: 670766ce4d0SZheng Fan { 671766ce4d0SZheng Fan SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE ); 672766ce4d0SZheng Fan if( eState >= SFX_ITEM_DEFAULT ) 673766ce4d0SZheng Fan { 674766ce4d0SZheng Fan SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE ); 675766ce4d0SZheng Fan aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE); 676766ce4d0SZheng Fan rSet.Put(aULSpace); 677766ce4d0SZheng Fan } 678766ce4d0SZheng Fan else 679766ce4d0SZheng Fan rSet.InvalidateItem(nSlotId); 680766ce4d0SZheng Fan } 681766ce4d0SZheng Fan break; 682cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 683cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 684cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 685cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 686cdf0e10cSrcweir { 687cdf0e10cSrcweir if ( pOLV ) 688cdf0e10cSrcweir { 689cdf0e10cSrcweir sal_uInt16 nScriptType = pOLV->GetSelectedScriptType(); 690cdf0e10cSrcweir SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool(); 691cdf0e10cSrcweir if( !pSecondPool ) 692cdf0e10cSrcweir pSecondPool = aEditAttr.GetPool(); 693cdf0e10cSrcweir SvxScriptSetItem aSetItem( nSlotId, *pSecondPool ); 694cdf0e10cSrcweir aSetItem.GetItemSet().Put( aEditAttr, sal_False ); 695cdf0e10cSrcweir const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType ); 696cdf0e10cSrcweir if( pI ) 697cdf0e10cSrcweir rSet.Put( *pI, nWhich ); 698cdf0e10cSrcweir else 699cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 700cdf0e10cSrcweir } 701cdf0e10cSrcweir else 702cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 703cdf0e10cSrcweir } 704cdf0e10cSrcweir break; 705cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break; 706cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break; 707cdf0e10cSrcweir case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break; 708cdf0e10cSrcweir case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break; 709cdf0e10cSrcweir case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break; 710cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break; 711cdf0e10cSrcweir case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break; 712*512ec161SZheng Fan case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT;break; 713*512ec161SZheng Fan case SID_ATTR_CHAR_KERNING: nEEWhich = EE_CHAR_KERNING;break; 714cdf0e10cSrcweir case FN_SET_SUPER_SCRIPT: 715cdf0e10cSrcweir case FN_SET_SUB_SCRIPT: 716cdf0e10cSrcweir { 717cdf0e10cSrcweir sal_uInt16 nEsc = 0; 718cdf0e10cSrcweir const SfxPoolItem *pEscItem = 0; 719cdf0e10cSrcweir if (nWhich==FN_SET_SUPER_SCRIPT) 720cdf0e10cSrcweir nEsc = SVX_ESCAPEMENT_SUPERSCRIPT; 721cdf0e10cSrcweir else 722cdf0e10cSrcweir nEsc = SVX_ESCAPEMENT_SUBSCRIPT; 723cdf0e10cSrcweir 724cdf0e10cSrcweir if( !pEscItem ) 725cdf0e10cSrcweir pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT ); 726cdf0e10cSrcweir 727cdf0e10cSrcweir if( nEsc == ((const SvxEscapementItem*)pEscItem)->GetEnumValue() ) 728cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, sal_True )); 729cdf0e10cSrcweir else 730cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 731cdf0e10cSrcweir break; 732cdf0e10cSrcweir } 733cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_LEFT: 734cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_RIGHT: 735cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_CENTER: 736cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK: 737cdf0e10cSrcweir { 738cdf0e10cSrcweir const SfxPoolItem *pAdjust = 0; 739cdf0e10cSrcweir int eAdjust = 0; 740cdf0e10cSrcweir 741cdf0e10cSrcweir if (nWhich==SID_ATTR_PARA_ADJUST_LEFT) 742cdf0e10cSrcweir eAdjust = SVX_ADJUST_LEFT; 743cdf0e10cSrcweir else 744cdf0e10cSrcweir if (nWhich==SID_ATTR_PARA_ADJUST_RIGHT) 745cdf0e10cSrcweir eAdjust = SVX_ADJUST_RIGHT; 746cdf0e10cSrcweir else 747cdf0e10cSrcweir if (nWhich==SID_ATTR_PARA_ADJUST_CENTER) 748cdf0e10cSrcweir eAdjust = SVX_ADJUST_CENTER; 749cdf0e10cSrcweir else 750cdf0e10cSrcweir if (nWhich==SID_ATTR_PARA_ADJUST_BLOCK) 751cdf0e10cSrcweir eAdjust = SVX_ADJUST_BLOCK; 752cdf0e10cSrcweir 753cdf0e10cSrcweir if( !pAdjust ) 754cdf0e10cSrcweir aEditAttr.GetItemState( EE_PARA_JUST, sal_False, &pAdjust); 755cdf0e10cSrcweir 756cdf0e10cSrcweir if( !pAdjust || IsInvalidItem( pAdjust )) 757cdf0e10cSrcweir rSet.InvalidateItem( nSlotId ), nSlotId = 0; 758cdf0e10cSrcweir else 759cdf0e10cSrcweir { 760cdf0e10cSrcweir if ( eAdjust == ((const SvxAdjustItem*)pAdjust)->GetAdjust()) 761cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, sal_True )); 762cdf0e10cSrcweir else 763cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 764cdf0e10cSrcweir } 765cdf0e10cSrcweir break; 766cdf0e10cSrcweir } 767cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_10: 768cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_15: 769cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_20: 770cdf0e10cSrcweir { 771cdf0e10cSrcweir const SfxPoolItem *pLSpace = 0; 772cdf0e10cSrcweir int nLSpace = 0; 773cdf0e10cSrcweir 774cdf0e10cSrcweir if (nWhich==SID_ATTR_PARA_LINESPACE_10) 775cdf0e10cSrcweir nLSpace = 100; 776cdf0e10cSrcweir else 777cdf0e10cSrcweir if (nWhich==SID_ATTR_PARA_LINESPACE_15) 778cdf0e10cSrcweir nLSpace = 150; 779cdf0e10cSrcweir else 780cdf0e10cSrcweir if (nWhich==SID_ATTR_PARA_LINESPACE_20) 781cdf0e10cSrcweir nLSpace = 200; 782cdf0e10cSrcweir 783cdf0e10cSrcweir if( !pLSpace ) 784cdf0e10cSrcweir aEditAttr.GetItemState( EE_PARA_SBL, sal_False, &pLSpace ); 785cdf0e10cSrcweir 786cdf0e10cSrcweir if( !pLSpace || IsInvalidItem( pLSpace )) 787cdf0e10cSrcweir rSet.InvalidateItem( nSlotId ), nSlotId = 0; 788cdf0e10cSrcweir else 789cdf0e10cSrcweir { 790cdf0e10cSrcweir if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->GetPropLineSpace() ) 791cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, sal_True )); 792cdf0e10cSrcweir else 793cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 794cdf0e10cSrcweir } 795cdf0e10cSrcweir break; 796cdf0e10cSrcweir } 797cdf0e10cSrcweir case SID_AUTOSPELL_CHECK: 798cdf0e10cSrcweir { 799cdf0e10cSrcweir const SfxPoolItem* pState = rView.GetSlotState(nWhich); 800cdf0e10cSrcweir if (pState) 801cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue())); 802cdf0e10cSrcweir else 803cdf0e10cSrcweir rSet.DisableItem( nWhich ); 804cdf0e10cSrcweir break; 805cdf0e10cSrcweir } 806cdf0e10cSrcweir case SID_ATTR_PARA_LEFT_TO_RIGHT: 807cdf0e10cSrcweir case SID_ATTR_PARA_RIGHT_TO_LEFT: 808cdf0e10cSrcweir { 809cdf0e10cSrcweir if ( !SvtLanguageOptions().IsCTLFontEnabled() ) 810cdf0e10cSrcweir rSet.DisableItem( nWhich ); 811cdf0e10cSrcweir else 812cdf0e10cSrcweir { 813cdf0e10cSrcweir if(pOLV->GetOutliner() && pOLV->GetOutliner()->IsVertical()) 814cdf0e10cSrcweir rSet.DisableItem( nWhich ); 815cdf0e10cSrcweir else 816cdf0e10cSrcweir { 817cdf0e10cSrcweir sal_Bool bFlag = sal_False; 818cdf0e10cSrcweir switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() ) 819cdf0e10cSrcweir { 820cdf0e10cSrcweir case FRMDIR_HORI_LEFT_TOP: 821cdf0e10cSrcweir { 822cdf0e10cSrcweir bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT; 823cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bFlag )); 824cdf0e10cSrcweir break; 825cdf0e10cSrcweir } 826cdf0e10cSrcweir case FRMDIR_HORI_RIGHT_TOP: 827cdf0e10cSrcweir { 828cdf0e10cSrcweir bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT; 829cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bFlag )); 830cdf0e10cSrcweir break; 831cdf0e10cSrcweir } 832cdf0e10cSrcweir } 833cdf0e10cSrcweir } 834cdf0e10cSrcweir } 835cdf0e10cSrcweir } 836cdf0e10cSrcweir break; 837cdf0e10cSrcweir case SID_INSERT_RLM : 838cdf0e10cSrcweir case SID_INSERT_LRM : 839cdf0e10cSrcweir case SID_INSERT_ZWNBSP : 840cdf0e10cSrcweir case SID_INSERT_ZWSP: 841cdf0e10cSrcweir { 842cdf0e10cSrcweir SvtCTLOptions aCTLOptions; 843cdf0e10cSrcweir sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled(); 844cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled ); 845cdf0e10cSrcweir if(!bEnabled) 846cdf0e10cSrcweir rSet.DisableItem(nWhich); 847cdf0e10cSrcweir } 848cdf0e10cSrcweir break; 849cdf0e10cSrcweir default: 850cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 851cdf0e10cSrcweir break; 852cdf0e10cSrcweir } 853cdf0e10cSrcweir 854cdf0e10cSrcweir if(nEEWhich) 855*512ec161SZheng Fan { 856cdf0e10cSrcweir rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich); 857*512ec161SZheng Fan if(nEEWhich == EE_CHAR_KERNING) 858*512ec161SZheng Fan { 859*512ec161SZheng Fan SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING, sal_True ); 860*512ec161SZheng Fan if ( eState == SFX_ITEM_DONTCARE ) 861*512ec161SZheng Fan { 862*512ec161SZheng Fan rSet.InvalidateItem(EE_CHAR_KERNING); 863*512ec161SZheng Fan } 864*512ec161SZheng Fan } 865*512ec161SZheng Fan } 866cdf0e10cSrcweir 867cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) 868cdf0e10cSrcweir rSet.DisableItem( nWhich ); 869cdf0e10cSrcweir 870cdf0e10cSrcweir nWhich = aIter.NextWhich(); 871cdf0e10cSrcweir } 872cdf0e10cSrcweir } 873cdf0e10cSrcweir 874cdf0e10cSrcweir void SwAnnotationShell::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage) 875cdf0e10cSrcweir { 876cdf0e10cSrcweir rView.ExecSearch(rReq,bNoMessage); 877cdf0e10cSrcweir } 878cdf0e10cSrcweir 879cdf0e10cSrcweir void SwAnnotationShell::StateSearch(SfxItemSet &rSet) 880cdf0e10cSrcweir { 881cdf0e10cSrcweir rView.StateSearch(rSet); 882cdf0e10cSrcweir } 883cdf0e10cSrcweir 884cdf0e10cSrcweir void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq) 885cdf0e10cSrcweir { 886cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 887cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 888cdf0e10cSrcweir return; 889cdf0e10cSrcweir 890cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 891cdf0e10cSrcweir SfxItemSet aEditAttr(pOLV->GetAttribs()); 892cdf0e10cSrcweir SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges()); 893cdf0e10cSrcweir 894cdf0e10cSrcweir long aOldHeight = pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight(); 895cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 896cdf0e10cSrcweir switch (nSlot) 897cdf0e10cSrcweir { 898cdf0e10cSrcweir case SID_CUT: 899cdf0e10cSrcweir if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() ) 900cdf0e10cSrcweir pOLV->Cut(); 901cdf0e10cSrcweir break; 902cdf0e10cSrcweir case SID_COPY: 903cdf0e10cSrcweir if( pOLV->HasSelection() ) 904cdf0e10cSrcweir pOLV->Copy(); 905cdf0e10cSrcweir break; 906cdf0e10cSrcweir case SID_PASTE: 907cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) 908cdf0e10cSrcweir pOLV->Paste(); 909cdf0e10cSrcweir break; 910cdf0e10cSrcweir case SID_PASTE_SPECIAL: 911cdf0e10cSrcweir { 912cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) 913cdf0e10cSrcweir { 914cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 915cdf0e10cSrcweir SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( &rView.GetEditWin() ); 916cdf0e10cSrcweir 917cdf0e10cSrcweir pDlg->Insert( SOT_FORMAT_STRING, aEmptyStr ); 918cdf0e10cSrcweir pDlg->Insert( SOT_FORMAT_RTF, aEmptyStr ); 919cdf0e10cSrcweir 920cdf0e10cSrcweir TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) ); 921cdf0e10cSrcweir 922cdf0e10cSrcweir sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() ); 923cdf0e10cSrcweir 924cdf0e10cSrcweir if (nFormat > 0) 925cdf0e10cSrcweir { 926cdf0e10cSrcweir if (nFormat == SOT_FORMAT_STRING) 927cdf0e10cSrcweir pOLV->Paste(); 928cdf0e10cSrcweir else 929cdf0e10cSrcweir pOLV->PasteSpecial(); 930cdf0e10cSrcweir } 931cdf0e10cSrcweir delete pDlg; 932cdf0e10cSrcweir } 933cdf0e10cSrcweir break; 934cdf0e10cSrcweir } 935cdf0e10cSrcweir case SID_CLIPBOARD_FORMAT_ITEMS: 936cdf0e10cSrcweir { 937cdf0e10cSrcweir sal_uLong nFormat = 0; 938cdf0e10cSrcweir const SfxPoolItem* pItem; 939cdf0e10cSrcweir if ( rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET && 940cdf0e10cSrcweir pItem->ISA(SfxUInt32Item) ) 941cdf0e10cSrcweir { 942cdf0e10cSrcweir nFormat = ((const SfxUInt32Item*)pItem)->GetValue(); 943cdf0e10cSrcweir } 944cdf0e10cSrcweir 945cdf0e10cSrcweir if ( nFormat ) 946cdf0e10cSrcweir { 947cdf0e10cSrcweir if (SOT_FORMAT_STRING == nFormat) 948cdf0e10cSrcweir pOLV->Paste(); 949cdf0e10cSrcweir else 950cdf0e10cSrcweir pOLV->PasteSpecial(); 951cdf0e10cSrcweir } 952cdf0e10cSrcweir break; 953cdf0e10cSrcweir } 954cdf0e10cSrcweir } 955cdf0e10cSrcweir pPostItMgr->GetActiveSidebarWin()->ResizeIfNeccessary(aOldHeight,pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight()); 956cdf0e10cSrcweir } 957cdf0e10cSrcweir 958cdf0e10cSrcweir void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet) 959cdf0e10cSrcweir { 960cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 961cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 962cdf0e10cSrcweir return; 963cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 964cdf0e10cSrcweir 965cdf0e10cSrcweir TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) ); 966cdf0e10cSrcweir bool bPastePossible = ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) || aDataHelper.HasFormat( SOT_FORMAT_RTF ) ); 967cdf0e10cSrcweir bPastePossible = bPastePossible && (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED); 968cdf0e10cSrcweir 969cdf0e10cSrcweir SfxWhichIter aIter(rSet); 970cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 971cdf0e10cSrcweir 972cdf0e10cSrcweir while(nWhich) 973cdf0e10cSrcweir { 974cdf0e10cSrcweir switch(nWhich) 975cdf0e10cSrcweir { 976cdf0e10cSrcweir case SID_CUT: 977cdf0e10cSrcweir { 978cdf0e10cSrcweir if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) || !pOLV->HasSelection() ) 979cdf0e10cSrcweir rSet.DisableItem( nWhich ); 980cdf0e10cSrcweir } 981cdf0e10cSrcweir case SID_COPY: 982cdf0e10cSrcweir { 983cdf0e10cSrcweir if( !pOLV->HasSelection() ) 984cdf0e10cSrcweir rSet.DisableItem( nWhich ); 985cdf0e10cSrcweir break; 986cdf0e10cSrcweir } 987cdf0e10cSrcweir case SID_PASTE: 988cdf0e10cSrcweir case SID_PASTE_SPECIAL: 989cdf0e10cSrcweir { 990cdf0e10cSrcweir if( !bPastePossible ) 991cdf0e10cSrcweir rSet.DisableItem( nWhich ); 992cdf0e10cSrcweir break; 993cdf0e10cSrcweir } 994cdf0e10cSrcweir case SID_CLIPBOARD_FORMAT_ITEMS: 995cdf0e10cSrcweir { 996cdf0e10cSrcweir if ( bPastePossible ) 997cdf0e10cSrcweir { 998cdf0e10cSrcweir SvxClipboardFmtItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS ); 999cdf0e10cSrcweir if ( aDataHelper.HasFormat( SOT_FORMAT_RTF ) ) 1000cdf0e10cSrcweir aFormats.AddClipbrdFormat( SOT_FORMAT_RTF ); 1001cdf0e10cSrcweir //if ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) ) 1002cdf0e10cSrcweir aFormats.AddClipbrdFormat( SOT_FORMAT_STRING ); 1003cdf0e10cSrcweir rSet.Put( aFormats ); 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir else 1006cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1007cdf0e10cSrcweir break; 1008cdf0e10cSrcweir } 1009cdf0e10cSrcweir } 1010cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir } 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir void SwAnnotationShell::StateStatusLine(SfxItemSet &rSet) 1015cdf0e10cSrcweir { 1016cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 1017cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir while( nWhich ) 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir switch( nWhich ) 1022cdf0e10cSrcweir { 1023cdf0e10cSrcweir case FN_STAT_SELMODE: 1024cdf0e10cSrcweir { 1025cdf0e10cSrcweir rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0)); 1026cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1027cdf0e10cSrcweir break; 1028cdf0e10cSrcweir } 1029cdf0e10cSrcweir case FN_STAT_TEMPLATE: 1030cdf0e10cSrcweir { 1031cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1032cdf0e10cSrcweir break; 1033cdf0e10cSrcweir } 1034cdf0e10cSrcweir } 1035cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1036cdf0e10cSrcweir } 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir void SwAnnotationShell::StateInsert(SfxItemSet &rSet) 1040cdf0e10cSrcweir { 1041cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 1042cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 1043cdf0e10cSrcweir return; 1044cdf0e10cSrcweir 1045cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 1046cdf0e10cSrcweir SfxWhichIter aIter(rSet); 1047cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1048cdf0e10cSrcweir 1049cdf0e10cSrcweir while(nWhich) 1050cdf0e10cSrcweir { 1051cdf0e10cSrcweir switch(nWhich) 1052cdf0e10cSrcweir { 1053cdf0e10cSrcweir case SID_HYPERLINK_GETLINK: 1054cdf0e10cSrcweir { 1055cdf0e10cSrcweir SvxHyperlinkItem aHLinkItem; 1056cdf0e10cSrcweir aHLinkItem.SetInsertMode(HLINK_FIELD); 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir if (pFieldItem) 1061cdf0e10cSrcweir { 1062cdf0e10cSrcweir const SvxFieldData* pField = pFieldItem->GetField(); 1063cdf0e10cSrcweir 1064cdf0e10cSrcweir if (pField->ISA(SvxURLField)) 1065cdf0e10cSrcweir { 1066cdf0e10cSrcweir aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation()); 1067cdf0e10cSrcweir aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL()); 1068cdf0e10cSrcweir aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame()); 1069cdf0e10cSrcweir } 1070cdf0e10cSrcweir } 1071cdf0e10cSrcweir else 1072cdf0e10cSrcweir { 1073cdf0e10cSrcweir String sSel(pOLV->GetSelected()); 1074cdf0e10cSrcweir sSel.Erase(255); 1075cdf0e10cSrcweir sSel.EraseTrailingChars(); 1076cdf0e10cSrcweir aHLinkItem.SetName(sSel); 1077cdf0e10cSrcweir } 1078cdf0e10cSrcweir 1079cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(rView.GetDocShell()); 1080cdf0e10cSrcweir aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | 1081cdf0e10cSrcweir ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0))); 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir rSet.Put(aHLinkItem); 1084cdf0e10cSrcweir } 1085cdf0e10cSrcweir break; 1086cdf0e10cSrcweir } 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) 1089cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1090cdf0e10cSrcweir 1091cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1092cdf0e10cSrcweir } 1093cdf0e10cSrcweir } 1094cdf0e10cSrcweir 1095cdf0e10cSrcweir 1096cdf0e10cSrcweir void SwAnnotationShell::NoteExec(SfxRequest &rReq) 1097cdf0e10cSrcweir { 1098cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 1099cdf0e10cSrcweir if ( !pPostItMgr ) 1100cdf0e10cSrcweir return; 1101cdf0e10cSrcweir 1102cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 1103cdf0e10cSrcweir switch (nSlot) 1104cdf0e10cSrcweir { 1105cdf0e10cSrcweir case FN_REPLY: 1106cdf0e10cSrcweir case FN_POSTIT: 1107cdf0e10cSrcweir case FN_DELETE_COMMENT: 1108cdf0e10cSrcweir if ( pPostItMgr->HasActiveSidebarWin() ) 1109cdf0e10cSrcweir pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot); 1110cdf0e10cSrcweir break; 1111cdf0e10cSrcweir case FN_DELETE_ALL_NOTES: 1112cdf0e10cSrcweir pPostItMgr->Delete(); 1113cdf0e10cSrcweir break; 1114cdf0e10cSrcweir case FN_DELETE_NOTE_AUTHOR: 1115cdf0e10cSrcweir { 1116cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, sal_False); 1117cdf0e10cSrcweir if ( pItem ) 1118cdf0e10cSrcweir pPostItMgr->Delete( pItem->GetValue() ); 1119cdf0e10cSrcweir break; 1120cdf0e10cSrcweir } 1121cdf0e10cSrcweir case FN_HIDE_NOTE: 1122cdf0e10cSrcweir /* 1123cdf0e10cSrcweir if ( Mgr()->GetActiveSidebarWin() == this ) 1124cdf0e10cSrcweir { 1125cdf0e10cSrcweir Mgr()->SetActivePostIt(0); 1126cdf0e10cSrcweir // put the cursor back into the document 1127cdf0e10cSrcweir SwitchToFieldPos(); 1128cdf0e10cSrcweir } 1129cdf0e10cSrcweir Mgr()->Hide(mpFld); 1130cdf0e10cSrcweir */ 1131cdf0e10cSrcweir break; 1132cdf0e10cSrcweir case FN_HIDE_ALL_NOTES: 1133cdf0e10cSrcweir pPostItMgr->Hide(); 1134cdf0e10cSrcweir break; 1135cdf0e10cSrcweir case FN_HIDE_NOTE_AUTHOR: 1136cdf0e10cSrcweir { 1137cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, sal_False); 1138cdf0e10cSrcweir if ( pItem ) 1139cdf0e10cSrcweir pPostItMgr->Hide( pItem->GetValue() ); 1140cdf0e10cSrcweir } 1141cdf0e10cSrcweir } 1142cdf0e10cSrcweir } 1143cdf0e10cSrcweir 1144cdf0e10cSrcweir void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) 1145cdf0e10cSrcweir { 1146cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 1147cdf0e10cSrcweir SfxWhichIter aIter(rSet); 1148cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1149cdf0e10cSrcweir while(nWhich) 1150cdf0e10cSrcweir { 1151cdf0e10cSrcweir sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich ); 1152cdf0e10cSrcweir switch( nSlotId ) 1153cdf0e10cSrcweir { 1154cdf0e10cSrcweir case FN_POSTIT: 1155cdf0e10cSrcweir case FN_DELETE_NOTE_AUTHOR: 1156cdf0e10cSrcweir case FN_DELETE_ALL_NOTES: 1157cdf0e10cSrcweir case FN_HIDE_NOTE: 1158cdf0e10cSrcweir case FN_HIDE_NOTE_AUTHOR: 1159cdf0e10cSrcweir case FN_HIDE_ALL_NOTES: 1160cdf0e10cSrcweir case FN_DELETE_COMMENT: 1161cdf0e10cSrcweir { 1162cdf0e10cSrcweir if ( !pPostItMgr || 1163cdf0e10cSrcweir !pPostItMgr->HasActiveAnnotationWin() ) 1164cdf0e10cSrcweir { 1165cdf0e10cSrcweir rSet.DisableItem(nWhich); 1166cdf0e10cSrcweir } 1167cdf0e10cSrcweir break; 1168cdf0e10cSrcweir } 1169cdf0e10cSrcweir case FN_REPLY: 1170cdf0e10cSrcweir { 1171cdf0e10cSrcweir if ( !pPostItMgr || 1172cdf0e10cSrcweir !pPostItMgr->HasActiveAnnotationWin() ) 1173cdf0e10cSrcweir { 1174cdf0e10cSrcweir rSet.DisableItem(nWhich); 1175cdf0e10cSrcweir } 1176cdf0e10cSrcweir else 1177cdf0e10cSrcweir { 1178cdf0e10cSrcweir SvtUserOptions aUserOpt; 1179cdf0e10cSrcweir String sAuthor; 1180cdf0e10cSrcweir if( !(sAuthor = aUserOpt.GetFullName()).Len()) 1181cdf0e10cSrcweir if( !(sAuthor = aUserOpt.GetID()).Len() ) 1182cdf0e10cSrcweir sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR )); 1183cdf0e10cSrcweir if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor()) 1184cdf0e10cSrcweir rSet.DisableItem(nWhich); 1185cdf0e10cSrcweir } 1186cdf0e10cSrcweir break; 1187cdf0e10cSrcweir } 1188cdf0e10cSrcweir default: 1189cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 1190cdf0e10cSrcweir break; 1191cdf0e10cSrcweir } 1192cdf0e10cSrcweir 1193cdf0e10cSrcweir if (pPostItMgr->HasActiveSidebarWin()) 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) && 1196cdf0e10cSrcweir ( (nSlotId==FN_DELETE_COMMENT) || (nSlotId==FN_REPLY) ) ) 1197cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir } 1202cdf0e10cSrcweir 1203cdf0e10cSrcweir void SwAnnotationShell::ExecLingu(SfxRequest &rReq) 1204cdf0e10cSrcweir { 1205cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 1206cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 1207cdf0e10cSrcweir return; 1208cdf0e10cSrcweir 1209cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 1210cdf0e10cSrcweir SfxItemSet aEditAttr(pOLV->GetAttribs()); 1211cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 1212cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 1213cdf0e10cSrcweir bool bRestoreSelection = false; 1214cdf0e10cSrcweir ESelection aOldSelection; 1215cdf0e10cSrcweir 1216cdf0e10cSrcweir switch (nSlot) 1217cdf0e10cSrcweir { 1218cdf0e10cSrcweir case SID_LANGUAGE_STATUS: 1219cdf0e10cSrcweir { 1220cdf0e10cSrcweir aOldSelection = pOLV->GetSelection(); 1221cdf0e10cSrcweir if (!pOLV->GetEditView().HasSelection()) 1222cdf0e10cSrcweir { 1223cdf0e10cSrcweir bRestoreSelection = true; 1224cdf0e10cSrcweir pOLV->GetEditView().SelectCurrentWord(); 1225cdf0e10cSrcweir } 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,rView,rSh); 1228cdf0e10cSrcweir break; 1229cdf0e10cSrcweir } 1230cdf0e10cSrcweir case SID_THES: 1231cdf0e10cSrcweir { 1232cdf0e10cSrcweir String aReplaceText; 1233cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); 1234cdf0e10cSrcweir if (pItem2) 1235cdf0e10cSrcweir aReplaceText = pItem2->GetValue(); 1236cdf0e10cSrcweir if (aReplaceText.Len() > 0) 1237cdf0e10cSrcweir ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); 1238cdf0e10cSrcweir break; 1239cdf0e10cSrcweir } 1240cdf0e10cSrcweir case SID_THESAURUS: 1241cdf0e10cSrcweir { 1242cdf0e10cSrcweir pOLV->StartThesaurus(); 1243cdf0e10cSrcweir break; 1244cdf0e10cSrcweir } 1245cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION: 1246cdf0e10cSrcweir pOLV->StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL, 1247cdf0e10cSrcweir i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True, sal_False ); 1248cdf0e10cSrcweir break; 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir case SID_CHINESE_CONVERSION: 1251cdf0e10cSrcweir { 1252cdf0e10cSrcweir //open ChineseTranslationDialog 1253cdf0e10cSrcweir Reference< XComponentContext > xContext( 1254cdf0e10cSrcweir ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one 1255cdf0e10cSrcweir if(xContext.is()) 1256cdf0e10cSrcweir { 1257cdf0e10cSrcweir Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() ); 1258cdf0e10cSrcweir if(xMCF.is()) 1259cdf0e10cSrcweir { 1260cdf0e10cSrcweir Reference< ui::dialogs::XExecutableDialog > xDialog( 1261cdf0e10cSrcweir xMCF->createInstanceWithContext( 1262cdf0e10cSrcweir rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog") 1263cdf0e10cSrcweir , xContext), UNO_QUERY); 1264cdf0e10cSrcweir Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY ); 1265cdf0e10cSrcweir if( xInit.is() ) 1266cdf0e10cSrcweir { 1267cdf0e10cSrcweir // initialize dialog 1268cdf0e10cSrcweir Reference< awt::XWindow > xDialogParentWindow(0); 1269cdf0e10cSrcweir Sequence<Any> aSeq(1); 1270cdf0e10cSrcweir Any* pArray = aSeq.getArray(); 1271cdf0e10cSrcweir PropertyValue aParam; 1272cdf0e10cSrcweir aParam.Name = rtl::OUString::createFromAscii("ParentWindow"); 1273cdf0e10cSrcweir aParam.Value <<= makeAny(xDialogParentWindow); 1274cdf0e10cSrcweir pArray[0] <<= makeAny(aParam); 1275cdf0e10cSrcweir xInit->initialize( aSeq ); 1276cdf0e10cSrcweir 1277cdf0e10cSrcweir //execute dialog 1278cdf0e10cSrcweir sal_Int16 nDialogRet = xDialog->execute(); 1279cdf0e10cSrcweir if( RET_OK == nDialogRet ) 1280cdf0e10cSrcweir { 1281cdf0e10cSrcweir //get some parameters from the dialog 1282cdf0e10cSrcweir sal_Bool bToSimplified = sal_True; 1283cdf0e10cSrcweir sal_Bool bUseVariants = sal_True; 1284cdf0e10cSrcweir sal_Bool bCommonTerms = sal_True; 1285cdf0e10cSrcweir Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY ); 1286cdf0e10cSrcweir if( xProp.is() ) 1287cdf0e10cSrcweir { 1288cdf0e10cSrcweir try 1289cdf0e10cSrcweir { 1290cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified; 1291cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants; 1292cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms; 1293cdf0e10cSrcweir } 1294cdf0e10cSrcweir catch( Exception& ) 1295cdf0e10cSrcweir { 1296cdf0e10cSrcweir } 1297cdf0e10cSrcweir } 1298cdf0e10cSrcweir 1299cdf0e10cSrcweir //execute translation 1300cdf0e10cSrcweir sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED; 1301cdf0e10cSrcweir sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL; 1302cdf0e10cSrcweir sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0; 1303cdf0e10cSrcweir if( !bCommonTerms ) 1304cdf0e10cSrcweir nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER; 1305cdf0e10cSrcweir 1306cdf0e10cSrcweir Font aTargetFont = pOLV->GetWindow()->GetDefaultFont( DEFAULTFONT_CJK_TEXT, 1307cdf0e10cSrcweir nTargetLang, DEFAULTFONT_FLAGS_ONLYONE ); 1308cdf0e10cSrcweir 1309cdf0e10cSrcweir pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, sal_False, sal_False ); 1310cdf0e10cSrcweir } 1311cdf0e10cSrcweir } 1312cdf0e10cSrcweir Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY ); 1313cdf0e10cSrcweir if( xComponent.is() ) 1314cdf0e10cSrcweir xComponent->dispose(); 1315cdf0e10cSrcweir } 1316cdf0e10cSrcweir } 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir break; 1319cdf0e10cSrcweir } 1320cdf0e10cSrcweir 1321cdf0e10cSrcweir if (bRestoreSelection) 1322cdf0e10cSrcweir { 1323cdf0e10cSrcweir // restore selection 1324cdf0e10cSrcweir pOLV->GetEditView().SetSelection( aOldSelection ); 1325cdf0e10cSrcweir } 1326cdf0e10cSrcweir } 1327cdf0e10cSrcweir 1328cdf0e10cSrcweir void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) 1329cdf0e10cSrcweir { 1330cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 1331cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 1332cdf0e10cSrcweir return; 1333cdf0e10cSrcweir 1334cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 1335cdf0e10cSrcweir SfxItemSet aEditAttr(pOLV->GetAttribs()); 1336cdf0e10cSrcweir 1337cdf0e10cSrcweir SfxWhichIter aIter(rSet); 1338cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1339cdf0e10cSrcweir while(nWhich) 1340cdf0e10cSrcweir { 1341cdf0e10cSrcweir switch (nWhich) 1342cdf0e10cSrcweir { 1343cdf0e10cSrcweir case SID_LANGUAGE_STATUS: 1344cdf0e10cSrcweir { 1345cdf0e10cSrcweir SwLangHelper::GetLanguageStatus(pOLV,rSet); 1346cdf0e10cSrcweir break; 1347cdf0e10cSrcweir } 1348cdf0e10cSrcweir 1349cdf0e10cSrcweir case SID_THES: 1350cdf0e10cSrcweir { 1351cdf0e10cSrcweir String aStatusVal; 1352cdf0e10cSrcweir LanguageType nLang = LANGUAGE_NONE; 1353cdf0e10cSrcweir bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); 1354cdf0e10cSrcweir rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); 1355cdf0e10cSrcweir 1356cdf0e10cSrcweir // disable "Thesaurus" context menu entry if there is nothing to look up 1357cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); 1358cdf0e10cSrcweir lang::Locale aLocale( SvxCreateLocale( nLang ) ); 1359cdf0e10cSrcweir if (!bIsLookUpWord || 1360cdf0e10cSrcweir !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) 1361cdf0e10cSrcweir rSet.DisableItem( SID_THES ); 1362cdf0e10cSrcweir break; 1363cdf0e10cSrcweir } 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir // disable "Thesaurus" if the language is not supported 1366cdf0e10cSrcweir case SID_THESAURUS: 1367cdf0e10cSrcweir { 1368cdf0e10cSrcweir const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault( 1369cdf0e10cSrcweir GetWhichOfScript( RES_CHRATR_LANGUAGE, 1370cdf0e10cSrcweir GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) ); 1371cdf0e10cSrcweir LanguageType nLang = ((const SvxLanguageItem &) 1372cdf0e10cSrcweir rItem).GetLanguage(); 1373cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); 1374cdf0e10cSrcweir if (!xThes.is() || nLang == LANGUAGE_NONE || 1375cdf0e10cSrcweir !xThes->hasLocale( SvxCreateLocale( nLang ) )) 1376cdf0e10cSrcweir rSet.DisableItem( SID_THESAURUS ); 1377cdf0e10cSrcweir } 1378cdf0e10cSrcweir break; 1379cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION: 1380cdf0e10cSrcweir case SID_CHINESE_CONVERSION: 1381cdf0e10cSrcweir { 1382cdf0e10cSrcweir if (!SvtCJKOptions().IsAnyEnabled()) 1383cdf0e10cSrcweir { 1384cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False ); 1385cdf0e10cSrcweir rSet.DisableItem(nWhich); 1386cdf0e10cSrcweir } 1387cdf0e10cSrcweir else 1388cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True ); 1389cdf0e10cSrcweir } 1390cdf0e10cSrcweir break; 1391cdf0e10cSrcweir } 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) 1394cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1397cdf0e10cSrcweir } 1398cdf0e10cSrcweir } 1399cdf0e10cSrcweir 1400cdf0e10cSrcweir void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq) 1401cdf0e10cSrcweir { 1402cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 1403cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 1404cdf0e10cSrcweir return; 1405cdf0e10cSrcweir 1406cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 1409cdf0e10cSrcweir { 1410cdf0e10cSrcweir sal_uInt32 nMode = 0; 1411cdf0e10cSrcweir 1412cdf0e10cSrcweir switch( rReq.GetSlot() ) 1413cdf0e10cSrcweir { 1414cdf0e10cSrcweir case SID_TRANSLITERATE_SENTENCE_CASE: 1415cdf0e10cSrcweir nMode = TransliterationModulesExtra::SENTENCE_CASE; 1416cdf0e10cSrcweir break; 1417cdf0e10cSrcweir case SID_TRANSLITERATE_TITLE_CASE: 1418cdf0e10cSrcweir nMode = TransliterationModulesExtra::TITLE_CASE; 1419cdf0e10cSrcweir break; 1420cdf0e10cSrcweir case SID_TRANSLITERATE_TOGGLE_CASE: 1421cdf0e10cSrcweir nMode = TransliterationModulesExtra::TOGGLE_CASE; 1422cdf0e10cSrcweir break; 1423cdf0e10cSrcweir case SID_TRANSLITERATE_UPPER: 1424cdf0e10cSrcweir nMode = TransliterationModules_LOWERCASE_UPPERCASE; 1425cdf0e10cSrcweir break; 1426cdf0e10cSrcweir case SID_TRANSLITERATE_LOWER: 1427cdf0e10cSrcweir nMode = TransliterationModules_UPPERCASE_LOWERCASE; 1428cdf0e10cSrcweir break; 1429cdf0e10cSrcweir case SID_TRANSLITERATE_HALFWIDTH: 1430cdf0e10cSrcweir nMode = TransliterationModules_FULLWIDTH_HALFWIDTH; 1431cdf0e10cSrcweir break; 1432cdf0e10cSrcweir case SID_TRANSLITERATE_FULLWIDTH: 1433cdf0e10cSrcweir nMode = TransliterationModules_HALFWIDTH_FULLWIDTH; 1434cdf0e10cSrcweir break; 1435cdf0e10cSrcweir case SID_TRANSLITERATE_HIRAGANA: 1436cdf0e10cSrcweir nMode = TransliterationModules_KATAKANA_HIRAGANA; 1437cdf0e10cSrcweir break; 1438cdf0e10cSrcweir case SID_TRANSLITERATE_KATAGANA: 1439cdf0e10cSrcweir nMode = TransliterationModules_HIRAGANA_KATAKANA; 1440cdf0e10cSrcweir break; 1441cdf0e10cSrcweir 1442cdf0e10cSrcweir default: 1443cdf0e10cSrcweir ASSERT(!this, "falscher Dispatcher"); 1444cdf0e10cSrcweir } 1445cdf0e10cSrcweir 1446cdf0e10cSrcweir if( nMode ) 1447cdf0e10cSrcweir { 1448cdf0e10cSrcweir pOLV->TransliterateText( nMode ); 1449cdf0e10cSrcweir } 1450cdf0e10cSrcweir } 1451cdf0e10cSrcweir } 1452cdf0e10cSrcweir 1453cdf0e10cSrcweir void SwAnnotationShell::ExecUndo(SfxRequest &rReq) 1454cdf0e10cSrcweir { 1455cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 1456cdf0e10cSrcweir ::svl::IUndoManager* pUndoManager = GetUndoManager(); 1457cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 1458cdf0e10cSrcweir 1459cdf0e10cSrcweir long aOldHeight = rView.GetPostItMgr()->HasActiveSidebarWin() 1460cdf0e10cSrcweir ? rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight() 1461cdf0e10cSrcweir : 0; 1462cdf0e10cSrcweir 1463cdf0e10cSrcweir sal_uInt16 nId = rReq.GetSlot(); 1464cdf0e10cSrcweir sal_uInt16 nCnt = 1; 1465cdf0e10cSrcweir const SfxPoolItem* pItem=0; 1466cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pItem ) ) 1467cdf0e10cSrcweir nCnt = ((SfxUInt16Item*)pItem)->GetValue(); 1468cdf0e10cSrcweir switch( nId ) 1469cdf0e10cSrcweir { 1470cdf0e10cSrcweir case SID_UNDO: 1471cdf0e10cSrcweir { 1472cdf0e10cSrcweir if ( pUndoManager ) 1473cdf0e10cSrcweir { 1474cdf0e10cSrcweir sal_uInt16 nCount = pUndoManager->GetUndoActionCount(); 1475cdf0e10cSrcweir sal_uInt16 nSteps = nCnt; 1476cdf0e10cSrcweir if ( nCount < nCnt ) 1477cdf0e10cSrcweir { 1478cdf0e10cSrcweir nCnt = nCnt - nCount; 1479cdf0e10cSrcweir nSteps = nCount; 1480cdf0e10cSrcweir } 1481cdf0e10cSrcweir else 1482cdf0e10cSrcweir nCnt = 0; 1483cdf0e10cSrcweir 1484cdf0e10cSrcweir while( nSteps-- ) 1485cdf0e10cSrcweir pUndoManager->Undo(); 1486cdf0e10cSrcweir } 1487cdf0e10cSrcweir 1488cdf0e10cSrcweir if ( nCnt ) 1489cdf0e10cSrcweir rSh.Do( SwWrtShell::UNDO, nCnt ); 1490cdf0e10cSrcweir 1491cdf0e10cSrcweir break; 1492cdf0e10cSrcweir } 1493cdf0e10cSrcweir 1494cdf0e10cSrcweir case SID_REDO: 1495cdf0e10cSrcweir { 1496cdf0e10cSrcweir if ( pUndoManager ) 1497cdf0e10cSrcweir { 1498cdf0e10cSrcweir sal_uInt16 nCount = pUndoManager->GetRedoActionCount(); 1499cdf0e10cSrcweir sal_uInt16 nSteps = nCnt; 1500cdf0e10cSrcweir if ( nCount < nCnt ) 1501cdf0e10cSrcweir { 1502cdf0e10cSrcweir nCnt = nCnt - nCount; 1503cdf0e10cSrcweir nSteps = nCount; 1504cdf0e10cSrcweir } 1505cdf0e10cSrcweir else 1506cdf0e10cSrcweir nCnt = 0; 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir while( nSteps-- ) 1509cdf0e10cSrcweir pUndoManager->Redo(); 1510cdf0e10cSrcweir } 1511cdf0e10cSrcweir 1512cdf0e10cSrcweir if ( nCnt ) 1513cdf0e10cSrcweir rSh.Do( SwWrtShell::REDO, nCnt ); 1514cdf0e10cSrcweir 1515cdf0e10cSrcweir break; 1516cdf0e10cSrcweir } 1517cdf0e10cSrcweir } 1518cdf0e10cSrcweir 1519cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False); 1520cdf0e10cSrcweir 1521cdf0e10cSrcweir if (rView.GetPostItMgr()->HasActiveSidebarWin()) 1522cdf0e10cSrcweir rView.GetPostItMgr()->GetActiveSidebarWin()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight()); 1523cdf0e10cSrcweir } 1524cdf0e10cSrcweir 1525cdf0e10cSrcweir void SwAnnotationShell::StateUndo(SfxItemSet &rSet) 1526cdf0e10cSrcweir { 1527cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 1528cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 1529cdf0e10cSrcweir return; 1530cdf0e10cSrcweir 1531cdf0e10cSrcweir SfxWhichIter aIter(rSet); 1532cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1533cdf0e10cSrcweir ::svl::IUndoManager* pUndoManager = GetUndoManager(); 1534cdf0e10cSrcweir SfxViewFrame *pSfxViewFrame = rView.GetViewFrame(); 1535cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 1536cdf0e10cSrcweir 1537cdf0e10cSrcweir while( nWhich ) 1538cdf0e10cSrcweir { 1539cdf0e10cSrcweir switch ( nWhich ) 1540cdf0e10cSrcweir { 1541cdf0e10cSrcweir case SID_UNDO: 1542cdf0e10cSrcweir { 1543cdf0e10cSrcweir sal_uInt16 nCount = pUndoManager->GetUndoActionCount(); 1544cdf0e10cSrcweir if ( nCount ) 1545cdf0e10cSrcweir pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); 1546cdf0e10cSrcweir else if (rSh.GetLastUndoInfo(0, 0)) 1547cdf0e10cSrcweir { 1548cdf0e10cSrcweir rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) ); 1549cdf0e10cSrcweir } 1550cdf0e10cSrcweir else 1551cdf0e10cSrcweir rSet.DisableItem(nWhich); 1552cdf0e10cSrcweir break; 1553cdf0e10cSrcweir } 1554cdf0e10cSrcweir case SID_REDO: 1555cdf0e10cSrcweir { 1556cdf0e10cSrcweir sal_uInt16 nCount = pUndoManager->GetRedoActionCount(); 1557cdf0e10cSrcweir if ( nCount ) 1558cdf0e10cSrcweir pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); 1559cdf0e10cSrcweir else if (rSh.GetFirstRedoInfo(0)) 1560cdf0e10cSrcweir { 1561cdf0e10cSrcweir rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) ); 1562cdf0e10cSrcweir } 1563cdf0e10cSrcweir else 1564cdf0e10cSrcweir rSet.DisableItem(nWhich); 1565cdf0e10cSrcweir break; 1566cdf0e10cSrcweir } 1567cdf0e10cSrcweir case SID_GETUNDOSTRINGS: 1568cdf0e10cSrcweir case SID_GETREDOSTRINGS: 1569cdf0e10cSrcweir { 1570cdf0e10cSrcweir if( pUndoManager ) 1571cdf0e10cSrcweir { 1572cdf0e10cSrcweir UniString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const; 1573cdf0e10cSrcweir 1574cdf0e10cSrcweir sal_uInt16 nCount; 1575cdf0e10cSrcweir if( SID_GETUNDOSTRINGS == nWhich ) 1576cdf0e10cSrcweir { 1577cdf0e10cSrcweir nCount = pUndoManager->GetUndoActionCount(); 1578cdf0e10cSrcweir fnGetComment = &::svl::IUndoManager::GetUndoActionComment; 1579cdf0e10cSrcweir } 1580cdf0e10cSrcweir else 1581cdf0e10cSrcweir { 1582cdf0e10cSrcweir nCount = pUndoManager->GetRedoActionCount(); 1583cdf0e10cSrcweir fnGetComment = &::svl::IUndoManager::GetRedoActionComment; 1584cdf0e10cSrcweir } 1585cdf0e10cSrcweir 1586cdf0e10cSrcweir String sList; 1587cdf0e10cSrcweir if( nCount ) 1588cdf0e10cSrcweir { 1589cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nCount; ++n ) 1590cdf0e10cSrcweir ( sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) ) 1591cdf0e10cSrcweir += '\n'; 1592cdf0e10cSrcweir } 1593cdf0e10cSrcweir 1594cdf0e10cSrcweir SfxStringListItem aItem( nWhich ); 1595cdf0e10cSrcweir if ((nWhich == SID_GETUNDOSTRINGS) && 1596cdf0e10cSrcweir rSh.GetLastUndoInfo(0, 0)) 1597cdf0e10cSrcweir { 1598cdf0e10cSrcweir rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); 1599cdf0e10cSrcweir } 1600cdf0e10cSrcweir else if ((nWhich == SID_GETREDOSTRINGS) && 1601cdf0e10cSrcweir (rSh.GetFirstRedoInfo(0))) 1602cdf0e10cSrcweir { 1603cdf0e10cSrcweir rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); 1604cdf0e10cSrcweir } 1605cdf0e10cSrcweir 1606cdf0e10cSrcweir sList += aItem.GetString(); 1607cdf0e10cSrcweir aItem.SetString( sList ); 1608cdf0e10cSrcweir rSet.Put( aItem ); 1609cdf0e10cSrcweir } 1610cdf0e10cSrcweir else 1611cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1612cdf0e10cSrcweir } 1613cdf0e10cSrcweir break; 1614cdf0e10cSrcweir 1615cdf0e10cSrcweir default: 1616cdf0e10cSrcweir { 1617cdf0e10cSrcweir pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); 1618cdf0e10cSrcweir break; 1619cdf0e10cSrcweir } 1620cdf0e10cSrcweir 1621cdf0e10cSrcweir } 1622cdf0e10cSrcweir 1623cdf0e10cSrcweir if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) 1624cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1627cdf0e10cSrcweir } 1628cdf0e10cSrcweir } 1629cdf0e10cSrcweir 1630cdf0e10cSrcweir void SwAnnotationShell::StateDisableItems( SfxItemSet &rSet ) 1631cdf0e10cSrcweir { 1632cdf0e10cSrcweir SfxWhichIter aIter(rSet); 1633cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1634cdf0e10cSrcweir while (nWhich) 1635cdf0e10cSrcweir { 1636cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1637cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1638cdf0e10cSrcweir } 1639cdf0e10cSrcweir } 1640cdf0e10cSrcweir 1641cdf0e10cSrcweir void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) 1642cdf0e10cSrcweir { 1643cdf0e10cSrcweir SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); 1644cdf0e10cSrcweir if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() ) 1645cdf0e10cSrcweir return; 1646cdf0e10cSrcweir 1647cdf0e10cSrcweir OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); 1648cdf0e10cSrcweir 1649cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 1650cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 1651cdf0e10cSrcweir if( pArgs ) 1652cdf0e10cSrcweir pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem); 1653cdf0e10cSrcweir 1654cdf0e10cSrcweir String sSym; 1655cdf0e10cSrcweir String sFontName; 1656cdf0e10cSrcweir if ( pItem ) 1657cdf0e10cSrcweir { 1658cdf0e10cSrcweir sSym = ((const SfxStringItem*)pItem)->GetValue(); 1659cdf0e10cSrcweir const SfxPoolItem* pFtItem = NULL; 1660cdf0e10cSrcweir pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem); 1661cdf0e10cSrcweir const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); 1662cdf0e10cSrcweir if ( pFontItem ) 1663cdf0e10cSrcweir sFontName = pFontItem->GetValue(); 1664cdf0e10cSrcweir } 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir SfxItemSet aSet(pOLV->GetAttribs()); 1667cdf0e10cSrcweir sal_uInt16 nScript = pOLV->GetSelectedScriptType(); 1668cdf0e10cSrcweir SvxFontItem aSetDlgFont( RES_CHRATR_FONT ); 1669cdf0e10cSrcweir { 1670cdf0e10cSrcweir SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); 1671cdf0e10cSrcweir aSetItem.GetItemSet().Put( aSet, sal_False ); 1672cdf0e10cSrcweir const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); 1673cdf0e10cSrcweir if( pI ) 1674cdf0e10cSrcweir aSetDlgFont = *(SvxFontItem*)pI; 1675cdf0e10cSrcweir else 1676cdf0e10cSrcweir aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( 1677cdf0e10cSrcweir SID_ATTR_CHAR_FONT, 1678cdf0e10cSrcweir GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); 1679cdf0e10cSrcweir if (!sFontName.Len()) 1680cdf0e10cSrcweir sFontName = aSetDlgFont.GetFamilyName(); 1681cdf0e10cSrcweir } 1682cdf0e10cSrcweir 1683cdf0e10cSrcweir Font aFont(sFontName, Size(1,1)); 1684cdf0e10cSrcweir if( !sSym.Len() ) 1685cdf0e10cSrcweir { 1686cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir SfxAllItemSet aAllSet( GetPool() ); 1689cdf0e10cSrcweir aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); 1690cdf0e10cSrcweir 1691cdf0e10cSrcweir SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions()); 1692cdf0e10cSrcweir String sSymbolFont = aOpt.GetSymbolFont(); 1693cdf0e10cSrcweir if( sSymbolFont.Len() ) 1694cdf0e10cSrcweir aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); 1695cdf0e10cSrcweir else 1696cdf0e10cSrcweir aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) ); 1697cdf0e10cSrcweir 1698cdf0e10cSrcweir // Wenn Zeichen selektiert ist kann es angezeigt werden 1699cdf0e10cSrcweir SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, 1700cdf0e10cSrcweir rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); 1701cdf0e10cSrcweir 1702cdf0e10cSrcweir sal_uInt16 nResult = pDlg->Execute(); 1703cdf0e10cSrcweir if( nResult == RET_OK ) 1704cdf0e10cSrcweir { 1705cdf0e10cSrcweir SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, sal_False ); 1706cdf0e10cSrcweir SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False ); 1707cdf0e10cSrcweir if ( pFontItem ) 1708cdf0e10cSrcweir { 1709cdf0e10cSrcweir aFont.SetName( pFontItem->GetFamilyName() ); 1710cdf0e10cSrcweir aFont.SetStyleName( pFontItem->GetStyleName() ); 1711cdf0e10cSrcweir aFont.SetCharSet( pFontItem->GetCharSet() ); 1712cdf0e10cSrcweir aFont.SetPitch( pFontItem->GetPitch() ); 1713cdf0e10cSrcweir } 1714cdf0e10cSrcweir 1715cdf0e10cSrcweir if ( pCItem ) 1716cdf0e10cSrcweir { 1717cdf0e10cSrcweir sSym = pCItem->GetValue(); 1718cdf0e10cSrcweir aOpt.SetSymbolFont(aFont.GetName()); 1719cdf0e10cSrcweir SW_MOD()->ApplyUsrPref(aOpt, &rView); 1720cdf0e10cSrcweir } 1721cdf0e10cSrcweir } 1722cdf0e10cSrcweir 1723cdf0e10cSrcweir delete( pDlg ); 1724cdf0e10cSrcweir } 1725cdf0e10cSrcweir 1726cdf0e10cSrcweir if( sSym.Len() ) 1727cdf0e10cSrcweir { 1728cdf0e10cSrcweir // nicht flackern 1729cdf0e10cSrcweir pOLV->HideCursor(); 1730cdf0e10cSrcweir Outliner * pOutliner = pOLV->GetOutliner(); 1731cdf0e10cSrcweir pOutliner->SetUpdateMode(sal_False); 1732cdf0e10cSrcweir 1733cdf0e10cSrcweir SfxItemSet aOldSet( pOLV->GetAttribs() ); 1734cdf0e10cSrcweir SfxItemSet aFontSet( *aOldSet.GetPool(), 1735cdf0e10cSrcweir EE_CHAR_FONTINFO, EE_CHAR_FONTINFO, 1736cdf0e10cSrcweir EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CJK, 1737cdf0e10cSrcweir EE_CHAR_FONTINFO_CTL, EE_CHAR_FONTINFO_CTL, 1738cdf0e10cSrcweir 0 ); 1739cdf0e10cSrcweir aFontSet.Set( aOldSet ); 1740cdf0e10cSrcweir 1741cdf0e10cSrcweir // String einfuegen 1742cdf0e10cSrcweir pOLV->InsertText( sSym); 1743cdf0e10cSrcweir 1744cdf0e10cSrcweir // attributieren (Font setzen) 1745cdf0e10cSrcweir SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() ); 1746cdf0e10cSrcweir SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(), 1747cdf0e10cSrcweir aFont.GetStyleName(), aFont.GetPitch(), 1748cdf0e10cSrcweir aFont.GetCharSet(), 1749cdf0e10cSrcweir EE_CHAR_FONTINFO ); 1750cdf0e10cSrcweir sal_uInt16 nScriptBreak = pBreakIt->GetAllScriptsOfText( sSym ); 1751cdf0e10cSrcweir if( SCRIPTTYPE_LATIN & nScriptBreak ) 1752cdf0e10cSrcweir aSetFont.Put( aFontItem, EE_CHAR_FONTINFO ); 1753cdf0e10cSrcweir if( SCRIPTTYPE_ASIAN & nScriptBreak ) 1754cdf0e10cSrcweir aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CJK ); 1755cdf0e10cSrcweir if( SCRIPTTYPE_COMPLEX & nScriptBreak ) 1756cdf0e10cSrcweir aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CTL ); 1757cdf0e10cSrcweir pOLV->SetAttribs(aSetFont); 1758cdf0e10cSrcweir 1759cdf0e10cSrcweir // Selektion loeschen 1760cdf0e10cSrcweir ESelection aSel(pOLV->GetSelection()); 1761cdf0e10cSrcweir aSel.nStartPara = aSel.nEndPara; 1762cdf0e10cSrcweir aSel.nStartPos = aSel.nEndPos; 1763cdf0e10cSrcweir pOLV->SetSelection(aSel); 1764cdf0e10cSrcweir 1765cdf0e10cSrcweir // Alten Font restaurieren 1766cdf0e10cSrcweir pOLV->SetAttribs( aFontSet ); 1767cdf0e10cSrcweir 1768cdf0e10cSrcweir // ab jetzt wieder anzeigen 1769cdf0e10cSrcweir pOutliner->SetUpdateMode(sal_True); 1770cdf0e10cSrcweir pOLV->ShowCursor(); 1771cdf0e10cSrcweir 1772cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) ); 1773cdf0e10cSrcweir if(aFont.GetName().Len()) 1774cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) ); 1775cdf0e10cSrcweir rReq.Done(); 1776cdf0e10cSrcweir } 1777cdf0e10cSrcweir } 1778