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