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