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