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