xref: /trunk/main/sd/source/ui/func/fubullet.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_sd.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include "fubullet.hxx"
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #ifndef _BINDING_HXX //autogen
35*cdf0e10cSrcweir #include <sfx2/bindings.hxx>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #include <editeng/eeitem.hxx>
38*cdf0e10cSrcweir #include <svl/poolitem.hxx>
39*cdf0e10cSrcweir #include <editeng/fontitem.hxx>
40*cdf0e10cSrcweir #include "OutlineViewShell.hxx"
41*cdf0e10cSrcweir #include "DrawViewShell.hxx"
42*cdf0e10cSrcweir #include "Window.hxx"
43*cdf0e10cSrcweir #include "drawdoc.hxx"
44*cdf0e10cSrcweir #include "strings.hrc"
45*cdf0e10cSrcweir #include "sdresid.hxx"
46*cdf0e10cSrcweir #include <svx/svdoutl.hxx>
47*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
48*cdf0e10cSrcweir #include <sfx2/request.hxx>
49*cdf0e10cSrcweir #include <svl/ctloptions.hxx>
50*cdf0e10cSrcweir #include <svl/itempool.hxx>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #include <svx/svxdlg.hxx>
53*cdf0e10cSrcweir #include <svx/dialogs.hrc>
54*cdf0e10cSrcweir #include "drawview.hxx"
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir #include "app.hrc"
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir namespace sd {
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir const sal_Unicode CHAR_HARDBLANK    =   ((sal_Unicode)0x00A0);
61*cdf0e10cSrcweir const sal_Unicode CHAR_HARDHYPHEN   =   ((sal_Unicode)0x2011);
62*cdf0e10cSrcweir const sal_Unicode CHAR_SOFTHYPHEN   =   ((sal_Unicode)0x00AD);
63*cdf0e10cSrcweir const sal_Unicode CHAR_RLM          =   ((sal_Unicode)0x200F);
64*cdf0e10cSrcweir const sal_Unicode CHAR_LRM          =   ((sal_Unicode)0x200E);
65*cdf0e10cSrcweir const sal_Unicode CHAR_ZWSP         =   ((sal_Unicode)0x200B);
66*cdf0e10cSrcweir const sal_Unicode CHAR_ZWNBSP       =   ((sal_Unicode)0x2060);
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir TYPEINIT1( FuBullet, FuPoor );
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir /*************************************************************************
71*cdf0e10cSrcweir |*
72*cdf0e10cSrcweir |* Konstruktor
73*cdf0e10cSrcweir |*
74*cdf0e10cSrcweir \************************************************************************/
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir FuBullet::FuBullet (
77*cdf0e10cSrcweir     ViewShell* pViewSh,
78*cdf0e10cSrcweir     ::sd::Window* pWin,
79*cdf0e10cSrcweir     ::sd::View* _pView,
80*cdf0e10cSrcweir     SdDrawDocument* pDoc,
81*cdf0e10cSrcweir     SfxRequest& rReq)
82*cdf0e10cSrcweir     : FuPoor(pViewSh, pWin, _pView, pDoc, rReq)
83*cdf0e10cSrcweir {
84*cdf0e10cSrcweir }
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir FunctionReference FuBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir     FunctionReference xFunc( new FuBullet( pViewSh, pWin, pView, pDoc, rReq ) );
89*cdf0e10cSrcweir     xFunc->DoExecute(rReq);
90*cdf0e10cSrcweir     return xFunc;
91*cdf0e10cSrcweir }
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir void FuBullet::DoExecute( SfxRequest& rReq )
94*cdf0e10cSrcweir {
95*cdf0e10cSrcweir     if( rReq.GetSlot() == SID_CHARMAP )
96*cdf0e10cSrcweir         InsertSpecialCharacter(rReq);
97*cdf0e10cSrcweir     else
98*cdf0e10cSrcweir     {
99*cdf0e10cSrcweir         sal_Unicode cMark = 0;
100*cdf0e10cSrcweir         switch( rReq.GetSlot() )
101*cdf0e10cSrcweir         {
102*cdf0e10cSrcweir             case FN_INSERT_SOFT_HYPHEN: cMark = CHAR_SOFTHYPHEN ; break;
103*cdf0e10cSrcweir             case FN_INSERT_HARDHYPHEN:  cMark = CHAR_HARDHYPHEN ; break;
104*cdf0e10cSrcweir             case FN_INSERT_HARD_SPACE:  cMark = CHAR_HARDBLANK ; break;
105*cdf0e10cSrcweir             case SID_INSERT_RLM : cMark = CHAR_RLM ; break;
106*cdf0e10cSrcweir             case SID_INSERT_LRM : cMark = CHAR_LRM ; break;
107*cdf0e10cSrcweir             case SID_INSERT_ZWSP : cMark = CHAR_ZWSP ; break;
108*cdf0e10cSrcweir             case SID_INSERT_ZWNBSP: cMark = CHAR_ZWNBSP; break;
109*cdf0e10cSrcweir         }
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir         DBG_ASSERT( cMark != 0, "FuBullet::FuBullet(), illegal slot used!" );
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir         if( cMark )
114*cdf0e10cSrcweir             InsertFormattingMark( cMark );
115*cdf0e10cSrcweir     }
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir }
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir void FuBullet::InsertFormattingMark( sal_Unicode cMark )
120*cdf0e10cSrcweir {
121*cdf0e10cSrcweir     OutlinerView* pOV = NULL;
122*cdf0e10cSrcweir     ::Outliner*   pOL = NULL;
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     // depending on ViewShell set Outliner and OutlinerView
125*cdf0e10cSrcweir     if (mpViewShell->ISA(DrawViewShell))
126*cdf0e10cSrcweir     {
127*cdf0e10cSrcweir         pOV = mpView->GetTextEditOutlinerView();
128*cdf0e10cSrcweir         if (pOV)
129*cdf0e10cSrcweir             pOL = mpView->GetTextEditOutliner();
130*cdf0e10cSrcweir     }
131*cdf0e10cSrcweir     else if (mpViewShell->ISA(OutlineViewShell))
132*cdf0e10cSrcweir     {
133*cdf0e10cSrcweir         pOL = static_cast<OutlineView*>(mpView)->GetOutliner();
134*cdf0e10cSrcweir         pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
135*cdf0e10cSrcweir             mpViewShell->GetActiveWindow());
136*cdf0e10cSrcweir     }
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir     // insert string
139*cdf0e10cSrcweir     if(pOV && pOL)
140*cdf0e10cSrcweir     {
141*cdf0e10cSrcweir         // prevent flickering
142*cdf0e10cSrcweir         pOV->HideCursor();
143*cdf0e10cSrcweir         pOL->SetUpdateMode(sal_False);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         // remove old selected text
146*cdf0e10cSrcweir         pOV->InsertText( aEmptyStr );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir         // prepare undo
149*cdf0e10cSrcweir         ::svl::IUndoManager& rUndoMgr =  pOL->GetUndoManager();
150*cdf0e10cSrcweir         rUndoMgr.EnterListAction(String(SdResId(STR_UNDO_INSERT_SPECCHAR)),
151*cdf0e10cSrcweir                                     aEmptyStr );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir         // insert given text
154*cdf0e10cSrcweir         String aStr( cMark );
155*cdf0e10cSrcweir         pOV->InsertText( cMark, sal_True);
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir         ESelection aSel = pOV->GetSelection();
158*cdf0e10cSrcweir         aSel.nStartPara = aSel.nEndPara;
159*cdf0e10cSrcweir         aSel.nStartPos = aSel.nEndPos;
160*cdf0e10cSrcweir         pOV->SetSelection(aSel);
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir         rUndoMgr.LeaveListAction();
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir         // restart repainting
165*cdf0e10cSrcweir         pOL->SetUpdateMode(sal_True);
166*cdf0e10cSrcweir         pOV->ShowCursor();
167*cdf0e10cSrcweir     }
168*cdf0e10cSrcweir }
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir void FuBullet::InsertSpecialCharacter( SfxRequest& rReq )
171*cdf0e10cSrcweir {
172*cdf0e10cSrcweir     const SfxItemSet *pArgs = rReq.GetArgs();
173*cdf0e10cSrcweir     const SfxPoolItem* pItem = 0;
174*cdf0e10cSrcweir     if( pArgs )
175*cdf0e10cSrcweir         pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem);
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir     String aChars, aFontName;
178*cdf0e10cSrcweir     Font aFont;
179*cdf0e10cSrcweir     if ( pItem )
180*cdf0e10cSrcweir     {
181*cdf0e10cSrcweir         aChars = ((const SfxStringItem*)pItem)->GetValue();
182*cdf0e10cSrcweir         const SfxPoolItem* pFtItem = NULL;
183*cdf0e10cSrcweir         pArgs->GetItemState( mpDoc->GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem);
184*cdf0e10cSrcweir         const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
185*cdf0e10cSrcweir         if ( pFontItem )
186*cdf0e10cSrcweir         {
187*cdf0e10cSrcweir             aFontName = pFontItem->GetValue();
188*cdf0e10cSrcweir             aFont = Font( aFontName, Size(1,1) );
189*cdf0e10cSrcweir         }
190*cdf0e10cSrcweir         else
191*cdf0e10cSrcweir         {
192*cdf0e10cSrcweir             SfxItemSet aFontAttr( mpDoc->GetPool() );
193*cdf0e10cSrcweir             mpView->GetAttributes( aFontAttr );
194*cdf0e10cSrcweir             const SvxFontItem* pFItem = (const SvxFontItem*)aFontAttr.GetItem( SID_ATTR_CHAR_FONT );
195*cdf0e10cSrcweir             if( pFItem )
196*cdf0e10cSrcweir                 aFont = Font( pFItem->GetFamilyName(), pFItem->GetStyleName(), Size( 1, 1 ) );
197*cdf0e10cSrcweir         }
198*cdf0e10cSrcweir     }
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     if (!aChars.Len() )
201*cdf0e10cSrcweir     {
202*cdf0e10cSrcweir         SfxAllItemSet aSet( mpDoc->GetPool() );
203*cdf0e10cSrcweir         aSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) );
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir         SfxItemSet aFontAttr( mpDoc->GetPool() );
206*cdf0e10cSrcweir         mpView->GetAttributes( aFontAttr );
207*cdf0e10cSrcweir         const SvxFontItem* pFontItem = (const SvxFontItem*)aFontAttr.GetItem( SID_ATTR_CHAR_FONT );
208*cdf0e10cSrcweir         if( pFontItem )
209*cdf0e10cSrcweir             aSet.Put( *pFontItem );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
212*cdf0e10cSrcweir         SfxAbstractDialog* pDlg = pFact ? pFact->CreateSfxDialog( &mpView->GetViewShell()->GetViewFrame()->GetWindow(), aSet,
213*cdf0e10cSrcweir             mpView->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(),
214*cdf0e10cSrcweir             RID_SVXDLG_CHARMAP ) : 0;
215*cdf0e10cSrcweir         if( !pDlg )
216*cdf0e10cSrcweir             return;
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir         // Wenn Zeichen selektiert ist kann es angezeigt werden
219*cdf0e10cSrcweir         // pDLg->SetFont( );
220*cdf0e10cSrcweir         // pDlg->SetChar( );
221*cdf0e10cSrcweir         sal_uInt16 nResult = pDlg->Execute();
222*cdf0e10cSrcweir         if( nResult == RET_OK )
223*cdf0e10cSrcweir         {
224*cdf0e10cSrcweir             SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, sal_False );
225*cdf0e10cSrcweir             SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False );
226*cdf0e10cSrcweir             if ( pFItem )
227*cdf0e10cSrcweir             {
228*cdf0e10cSrcweir                 aFont.SetName( pFItem->GetFamilyName() );
229*cdf0e10cSrcweir                 aFont.SetStyleName( pFItem->GetStyleName() );
230*cdf0e10cSrcweir                 aFont.SetCharSet( pFItem->GetCharSet() );
231*cdf0e10cSrcweir                 aFont.SetPitch( pFItem->GetPitch() );
232*cdf0e10cSrcweir             }
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir             if ( pCItem )
235*cdf0e10cSrcweir                 aChars  = pCItem->GetValue();
236*cdf0e10cSrcweir         }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir         delete( pDlg );
239*cdf0e10cSrcweir     }
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir     if( aChars.Len() )
242*cdf0e10cSrcweir     {
243*cdf0e10cSrcweir         OutlinerView* pOV = NULL;
244*cdf0e10cSrcweir         ::Outliner*   pOL = NULL;
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir         // je nach ViewShell Outliner und OutlinerView bestimmen
247*cdf0e10cSrcweir         if(mpViewShell && mpViewShell->ISA(DrawViewShell))
248*cdf0e10cSrcweir         {
249*cdf0e10cSrcweir             pOV = mpView->GetTextEditOutlinerView();
250*cdf0e10cSrcweir             if (pOV)
251*cdf0e10cSrcweir             {
252*cdf0e10cSrcweir                 pOL = mpView->GetTextEditOutliner();
253*cdf0e10cSrcweir             }
254*cdf0e10cSrcweir         }
255*cdf0e10cSrcweir         else if(mpViewShell && mpViewShell->ISA(OutlineViewShell))
256*cdf0e10cSrcweir         {
257*cdf0e10cSrcweir             pOL = static_cast<OutlineView*>(mpView)->GetOutliner();
258*cdf0e10cSrcweir             pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
259*cdf0e10cSrcweir                 mpViewShell->GetActiveWindow());
260*cdf0e10cSrcweir         }
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir         // Sonderzeichen einfuegen
263*cdf0e10cSrcweir         if (pOV)
264*cdf0e10cSrcweir         {
265*cdf0e10cSrcweir             // nicht flackern
266*cdf0e10cSrcweir             pOV->HideCursor();
267*cdf0e10cSrcweir             pOL->SetUpdateMode(sal_False);
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir             // alte Attributierung merken;
270*cdf0e10cSrcweir             // dazu vorher selektierten Bereich loeschen, denn der muss eh weg
271*cdf0e10cSrcweir             // und so gibt es immer eine eindeutige Attributierung (und da es
272*cdf0e10cSrcweir             // kein DeleteSelected() an der OutlinerView gibt, wird durch
273*cdf0e10cSrcweir             // Einfuegen eines Leerstrings geloescht)
274*cdf0e10cSrcweir             pOV->InsertText( aEmptyStr );
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir             SfxItemSet aOldSet( mpDoc->GetPool(), EE_CHAR_FONTINFO, EE_CHAR_FONTINFO, 0 );
277*cdf0e10cSrcweir             aOldSet.Put( pOV->GetAttribs() );
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir             ::svl::IUndoManager& rUndoMgr =  pOL->GetUndoManager();
280*cdf0e10cSrcweir             rUndoMgr.EnterListAction(String(SdResId(STR_UNDO_INSERT_SPECCHAR)),
281*cdf0e10cSrcweir                                      aEmptyStr );
282*cdf0e10cSrcweir             pOV->InsertText(aChars, sal_True);
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir             // attributieren (Font setzen)
285*cdf0e10cSrcweir             SfxItemSet aSet(pOL->GetEmptyItemSet());
286*cdf0e10cSrcweir             SvxFontItem aFontItem (aFont.GetFamily(),    aFont.GetName(),
287*cdf0e10cSrcweir                                    aFont.GetStyleName(), aFont.GetPitch(),
288*cdf0e10cSrcweir                                    aFont.GetCharSet(),
289*cdf0e10cSrcweir                                    EE_CHAR_FONTINFO);
290*cdf0e10cSrcweir             aSet.Put(aFontItem);
291*cdf0e10cSrcweir             aSet.Put(aFontItem, EE_CHAR_FONTINFO_CJK);
292*cdf0e10cSrcweir             aSet.Put(aFontItem, EE_CHAR_FONTINFO_CTL);
293*cdf0e10cSrcweir             pOV->SetAttribs(aSet);
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir             ESelection aSel = pOV->GetSelection();
296*cdf0e10cSrcweir             aSel.nStartPara = aSel.nEndPara;
297*cdf0e10cSrcweir             aSel.nStartPos = aSel.nEndPos;
298*cdf0e10cSrcweir             pOV->SetSelection(aSel);
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir             // nicht mit Sonderzeichenattributierung weiterschreiben
301*cdf0e10cSrcweir             pOV->GetOutliner()->QuickSetAttribs(aOldSet, aSel);
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir             rUndoMgr.LeaveListAction();
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir             // ab jetzt wieder anzeigen
306*cdf0e10cSrcweir             pOL->SetUpdateMode(sal_True);
307*cdf0e10cSrcweir             pOV->ShowCursor();
308*cdf0e10cSrcweir         }
309*cdf0e10cSrcweir     }
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir void FuBullet::GetSlotState( SfxItemSet& rSet, ViewShell* pViewShell, SfxViewFrame* pViewFrame )
313*cdf0e10cSrcweir {
314*cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHARMAP ) ||
315*cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_SOFT_HYPHEN ) ||
316*cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_HARDHYPHEN ) ||
317*cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_HARD_SPACE ) ||
318*cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_RLM ) ||
319*cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_LRM ) ||
320*cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_ZWNBSP ) ||
321*cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_ZWSP ))
322*cdf0e10cSrcweir     {
323*cdf0e10cSrcweir         ::sd::View* pView = pViewShell ? pViewShell->GetView() : 0;
324*cdf0e10cSrcweir         OutlinerView* pOLV = pView ? pView->GetTextEditOutlinerView() : 0;
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir         const bool bTextEdit = pOLV;
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir         SvtCTLOptions aCTLOptions;
329*cdf0e10cSrcweir         const sal_Bool bCtlEnabled = aCTLOptions.IsCTLFontEnabled();
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir         if(!bTextEdit )
332*cdf0e10cSrcweir         {
333*cdf0e10cSrcweir             rSet.DisableItem(FN_INSERT_SOFT_HYPHEN);
334*cdf0e10cSrcweir             rSet.DisableItem(FN_INSERT_HARDHYPHEN);
335*cdf0e10cSrcweir             rSet.DisableItem(FN_INSERT_HARD_SPACE);
336*cdf0e10cSrcweir         }
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir         if( !bTextEdit && (dynamic_cast<OutlineViewShell*>( pViewShell ) == 0) )
339*cdf0e10cSrcweir             rSet.DisableItem(SID_CHARMAP);
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir         if(!bTextEdit || !bCtlEnabled )
342*cdf0e10cSrcweir         {
343*cdf0e10cSrcweir             rSet.DisableItem(SID_INSERT_RLM);
344*cdf0e10cSrcweir             rSet.DisableItem(SID_INSERT_LRM);
345*cdf0e10cSrcweir             rSet.DisableItem(SID_INSERT_ZWNBSP);
346*cdf0e10cSrcweir             rSet.DisableItem(SID_INSERT_ZWSP);
347*cdf0e10cSrcweir         }
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir         if( pViewFrame )
350*cdf0e10cSrcweir         {
351*cdf0e10cSrcweir             SfxBindings& rBindings = pViewFrame->GetBindings();
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir             rBindings.SetVisibleState( SID_INSERT_RLM, bCtlEnabled );
354*cdf0e10cSrcweir             rBindings.SetVisibleState( SID_INSERT_LRM, bCtlEnabled );
355*cdf0e10cSrcweir             rBindings.SetVisibleState( SID_INSERT_ZWNBSP, bCtlEnabled );
356*cdf0e10cSrcweir             rBindings.SetVisibleState( SID_INSERT_ZWSP, bCtlEnabled );
357*cdf0e10cSrcweir         }
358*cdf0e10cSrcweir     }
359*cdf0e10cSrcweir }
360*cdf0e10cSrcweir } // end of namespace sd
361