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