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