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