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
22cdf0e10cSrcweir #include "precompiled_sw.hxx"
23cdf0e10cSrcweir
24cdf0e10cSrcweir #include <SidebarTxtControl.hxx>
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include <SidebarTxtControlAcc.hxx>
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <SidebarWin.hxx>
29cdf0e10cSrcweir #include <PostItMgr.hxx>
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <cmdid.h>
32cdf0e10cSrcweir #include <docvw.hrc>
33cdf0e10cSrcweir
34cdf0e10cSrcweir #include <unotools/securityoptions.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
37cdf0e10cSrcweir #include <sfx2/bindings.hxx>
38cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
39cdf0e10cSrcweir #include <sfx2/mnumgr.hxx>
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include <vcl/svapp.hxx>
42cdf0e10cSrcweir #include <vcl/help.hxx>
43cdf0e10cSrcweir #include <vcl/msgbox.hxx>
44cdf0e10cSrcweir #include <vcl/gradient.hxx>
45cdf0e10cSrcweir #include <vcl/scrbar.hxx>
46cdf0e10cSrcweir
47cdf0e10cSrcweir #include <editeng/outliner.hxx>
48cdf0e10cSrcweir #include <editeng/editeng.hxx>
49cdf0e10cSrcweir #include <editeng/editview.hxx>
50cdf0e10cSrcweir #include <editeng/flditem.hxx>
51cdf0e10cSrcweir
52cdf0e10cSrcweir #include <uitool.hxx>
53cdf0e10cSrcweir #include <view.hxx>
54cdf0e10cSrcweir #include <wrtsh.hxx>
55cdf0e10cSrcweir #include <shellres.hxx>
56cdf0e10cSrcweir #include <SwRewriter.hxx>
57cdf0e10cSrcweir
58cdf0e10cSrcweir namespace css = ::com::sun::star;
59cdf0e10cSrcweir
60cdf0e10cSrcweir namespace sw { namespace sidebarwindows {
61cdf0e10cSrcweir
SidebarTxtControl(SwSidebarWin & rSidebarWin,WinBits nBits,SwView & rDocView,SwPostItMgr & rPostItMgr)62cdf0e10cSrcweir SidebarTxtControl::SidebarTxtControl( SwSidebarWin& rSidebarWin,
63cdf0e10cSrcweir WinBits nBits,
64cdf0e10cSrcweir SwView& rDocView,
65cdf0e10cSrcweir SwPostItMgr& rPostItMgr )
66cdf0e10cSrcweir : Control( &rSidebarWin, nBits )
67cdf0e10cSrcweir , mrSidebarWin( rSidebarWin )
68cdf0e10cSrcweir , mrDocView( rDocView )
69cdf0e10cSrcweir , mrPostItMgr( rPostItMgr )
70cdf0e10cSrcweir , mbMouseOver( false )
71cdf0e10cSrcweir {
72cdf0e10cSrcweir AddEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
~SidebarTxtControl()75cdf0e10cSrcweir SidebarTxtControl::~SidebarTxtControl()
76cdf0e10cSrcweir {
77cdf0e10cSrcweir RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
78cdf0e10cSrcweir }
79cdf0e10cSrcweir
GetTextView() const80cdf0e10cSrcweir OutlinerView* SidebarTxtControl::GetTextView() const
81cdf0e10cSrcweir {
82cdf0e10cSrcweir return mrSidebarWin.GetOutlinerView();
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
GetFocus()85cdf0e10cSrcweir void SidebarTxtControl::GetFocus()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir Window::GetFocus();
88cdf0e10cSrcweir if ( !mrSidebarWin.IsMouseOver() )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir Invalidate();
91cdf0e10cSrcweir }
92cdf0e10cSrcweir }
93cdf0e10cSrcweir
LoseFocus()94cdf0e10cSrcweir void SidebarTxtControl::LoseFocus()
95cdf0e10cSrcweir {
96cdf0e10cSrcweir // write the visible text back into the SwField
97cdf0e10cSrcweir mrSidebarWin.UpdateData();
98cdf0e10cSrcweir
99cdf0e10cSrcweir Window::LoseFocus();
100cdf0e10cSrcweir if ( !mrSidebarWin.IsMouseOver() )
101cdf0e10cSrcweir {
102cdf0e10cSrcweir Invalidate();
103cdf0e10cSrcweir }
104cdf0e10cSrcweir }
105cdf0e10cSrcweir
RequestHelp(const HelpEvent & rEvt)106cdf0e10cSrcweir void SidebarTxtControl::RequestHelp(const HelpEvent &rEvt)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir sal_uInt16 nResId = 0;
109cdf0e10cSrcweir switch( mrSidebarWin.GetLayoutStatus() )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir case SwPostItHelper::INSERTED: nResId = STR_REDLINE_INSERT; break;
112cdf0e10cSrcweir case SwPostItHelper::DELETED: nResId = STR_REDLINE_DELETE; break;
113cdf0e10cSrcweir default: nResId = 0;
114cdf0e10cSrcweir }
115cdf0e10cSrcweir
116cdf0e10cSrcweir SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
117cdf0e10cSrcweir if ( nResId &&
118cdf0e10cSrcweir mrDocView.GetWrtShell().GetContentAtPos( mrSidebarWin.GetAnchorPos(), aCntntAtPos ) )
119cdf0e10cSrcweir {
120cdf0e10cSrcweir String sTxt;
121cdf0e10cSrcweir sTxt = SW_RESSTR( nResId );
122cdf0e10cSrcweir sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " ));
123cdf0e10cSrcweir sTxt += aCntntAtPos.aFnd.pRedl->GetAuthorString();
124cdf0e10cSrcweir sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ));
125cdf0e10cSrcweir sTxt += GetAppLangDateTimeString( aCntntAtPos.aFnd.pRedl->GetTimeStamp() );
126cdf0e10cSrcweir Help::ShowQuickHelp( this,PixelToLogic(Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sTxt);
127cdf0e10cSrcweir }
128cdf0e10cSrcweir }
129cdf0e10cSrcweir
Paint(const Rectangle & rRect)130cdf0e10cSrcweir void SidebarTxtControl::Paint( const Rectangle& rRect)
131cdf0e10cSrcweir {
132cdf0e10cSrcweir if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir if ( mrSidebarWin.IsMouseOverSidebarWin() ||
135cdf0e10cSrcweir HasFocus() )
136cdf0e10cSrcweir {
137cdf0e10cSrcweir DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ),
138cdf0e10cSrcweir Gradient( GRADIENT_LINEAR,
139cdf0e10cSrcweir mrSidebarWin.ColorDark(),
140cdf0e10cSrcweir mrSidebarWin.ColorDark() ) );
141cdf0e10cSrcweir }
142cdf0e10cSrcweir else
143cdf0e10cSrcweir {
144cdf0e10cSrcweir DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ),
145cdf0e10cSrcweir Gradient( GRADIENT_LINEAR,
146cdf0e10cSrcweir mrSidebarWin.ColorLight(),
147cdf0e10cSrcweir mrSidebarWin.ColorDark()));
148cdf0e10cSrcweir }
149cdf0e10cSrcweir }
150cdf0e10cSrcweir
151cdf0e10cSrcweir if ( GetTextView() )
152cdf0e10cSrcweir {
153cdf0e10cSrcweir GetTextView()->Paint( rRect );
154cdf0e10cSrcweir }
155cdf0e10cSrcweir
156cdf0e10cSrcweir if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED )
157cdf0e10cSrcweir {
158cdf0e10cSrcweir SetLineColor(mrSidebarWin.GetChangeColor());
159cdf0e10cSrcweir DrawLine( PixelToLogic( GetPosPixel() ),
160cdf0e10cSrcweir PixelToLogic( GetPosPixel() +
161cdf0e10cSrcweir Point( GetSizePixel().Width(),
162cdf0e10cSrcweir GetSizePixel().Height() ) ) );
163cdf0e10cSrcweir DrawLine( PixelToLogic( GetPosPixel() +
164cdf0e10cSrcweir Point( GetSizePixel().Width(),0) ),
165cdf0e10cSrcweir PixelToLogic( GetPosPixel() +
166cdf0e10cSrcweir Point( 0, GetSizePixel().Height() ) ) );
167cdf0e10cSrcweir }
168cdf0e10cSrcweir }
169cdf0e10cSrcweir
KeyInput(const KeyEvent & rKeyEvt)170cdf0e10cSrcweir void SidebarTxtControl::KeyInput( const KeyEvent& rKeyEvt )
171cdf0e10cSrcweir {
172cdf0e10cSrcweir const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
173cdf0e10cSrcweir sal_uInt16 nKey = rKeyCode.GetCode();
174cdf0e10cSrcweir if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) &&
175cdf0e10cSrcweir ( (nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN) ) )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir mrSidebarWin.SwitchToPostIt(nKey);
178cdf0e10cSrcweir }
179cdf0e10cSrcweir else if ( nKey == KEY_ESCAPE ||
180cdf0e10cSrcweir ( rKeyCode.IsMod1() &&
181cdf0e10cSrcweir ( nKey == KEY_PAGEUP ||
182cdf0e10cSrcweir nKey == KEY_PAGEDOWN ) ) )
183cdf0e10cSrcweir {
184cdf0e10cSrcweir mrSidebarWin.SwitchToFieldPos();
185cdf0e10cSrcweir }
186cdf0e10cSrcweir else if ( nKey == KEY_INSERT )
187cdf0e10cSrcweir {
188cdf0e10cSrcweir if ( !rKeyCode.IsMod1() && !rKeyCode.IsMod2() )
189cdf0e10cSrcweir {
190cdf0e10cSrcweir mrSidebarWin.ToggleInsMode();
191cdf0e10cSrcweir }
192cdf0e10cSrcweir }
193cdf0e10cSrcweir else
194cdf0e10cSrcweir {
195cdf0e10cSrcweir // let's make sure we see our note
196cdf0e10cSrcweir mrPostItMgr.MakeVisible(&mrSidebarWin);
197cdf0e10cSrcweir
198cdf0e10cSrcweir long aOldHeight = mrSidebarWin.GetPostItTextHeight();
199cdf0e10cSrcweir bool bDone = false;
200cdf0e10cSrcweir
201*f3eb8045Smseidel // HACK: need to switch off processing of Undo/Redo in Outliner
202cdf0e10cSrcweir if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir bool bIsProtected = mrSidebarWin.IsProtected();
205cdf0e10cSrcweir if ( !bIsProtected ||
206cdf0e10cSrcweir ( bIsProtected &&
207cdf0e10cSrcweir !mrSidebarWin.GetOutlinerView()->GetOutliner()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir bDone = GetTextView() && GetTextView()->PostKeyEvent( rKeyEvt );
210cdf0e10cSrcweir }
211cdf0e10cSrcweir else
212cdf0e10cSrcweir {
213cdf0e10cSrcweir InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
214cdf0e10cSrcweir }
215cdf0e10cSrcweir }
216cdf0e10cSrcweir if (bDone)
217cdf0e10cSrcweir mrSidebarWin.ResizeIfNeccessary( aOldHeight, mrSidebarWin.GetPostItTextHeight() );
218cdf0e10cSrcweir else
219cdf0e10cSrcweir {
220cdf0e10cSrcweir // write back data first when showing navigator
221cdf0e10cSrcweir if ( nKey==KEY_F5 )
222cdf0e10cSrcweir mrSidebarWin.UpdateData();
223cdf0e10cSrcweir if (!mrDocView.KeyInput(rKeyEvt))
224cdf0e10cSrcweir Window::KeyInput(rKeyEvt);
225cdf0e10cSrcweir }
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
228cdf0e10cSrcweir mrDocView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
229cdf0e10cSrcweir }
230cdf0e10cSrcweir
MouseMove(const MouseEvent & rMEvt)231cdf0e10cSrcweir void SidebarTxtControl::MouseMove( const MouseEvent& rMEvt )
232cdf0e10cSrcweir {
233cdf0e10cSrcweir if ( GetTextView() )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir OutlinerView* pOutlinerView( GetTextView() );
236cdf0e10cSrcweir pOutlinerView->MouseMove( rMEvt );
237cdf0e10cSrcweir // mba: why does OutlinerView not handle the modifier setting?!
238cdf0e10cSrcweir // this forces the postit to handle *all* pointer types
239cdf0e10cSrcweir SetPointer( pOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
240cdf0e10cSrcweir
241cdf0e10cSrcweir const EditView& aEV = pOutlinerView->GetEditView();
242cdf0e10cSrcweir const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
243cdf0e10cSrcweir if ( pItem )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir const SvxFieldData* pFld = pItem->GetField();
246cdf0e10cSrcweir const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
247cdf0e10cSrcweir if ( pURL )
248cdf0e10cSrcweir {
249cdf0e10cSrcweir String sURL( pURL->GetURL() );
250cdf0e10cSrcweir SvtSecurityOptions aSecOpts;
251cdf0e10cSrcweir if ( aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK) )
252cdf0e10cSrcweir {
253cdf0e10cSrcweir sURL.InsertAscii( ": ", 0 );
254cdf0e10cSrcweir sURL.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
255cdf0e10cSrcweir }
256cdf0e10cSrcweir Help::ShowQuickHelp( this,PixelToLogic(Rectangle(GetPosPixel(),Size(50,10))),sURL);
257cdf0e10cSrcweir }
258cdf0e10cSrcweir }
259cdf0e10cSrcweir }
260cdf0e10cSrcweir }
261cdf0e10cSrcweir
MouseButtonDown(const MouseEvent & rMEvt)262cdf0e10cSrcweir void SidebarTxtControl::MouseButtonDown( const MouseEvent& rMEvt )
263cdf0e10cSrcweir {
264cdf0e10cSrcweir if ( GetTextView() )
265cdf0e10cSrcweir {
266cdf0e10cSrcweir SvtSecurityOptions aSecOpts;
267cdf0e10cSrcweir bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK);
268cdf0e10cSrcweir
269cdf0e10cSrcweir if ( !bExecuteMod || (bExecuteMod && rMEvt.GetModifier() == KEY_MOD1))
270cdf0e10cSrcweir {
271cdf0e10cSrcweir const EditView& aEV = GetTextView()->GetEditView();
272cdf0e10cSrcweir const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
273cdf0e10cSrcweir if ( pItem )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir const SvxFieldData* pFld = pItem->GetField();
276cdf0e10cSrcweir const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
277cdf0e10cSrcweir if ( pURL )
278cdf0e10cSrcweir {
279cdf0e10cSrcweir GetTextView()->MouseButtonDown( rMEvt );
280cdf0e10cSrcweir SwWrtShell &rSh = mrDocView.GetWrtShell();
281cdf0e10cSrcweir String sURL( pURL->GetURL() );
282cdf0e10cSrcweir String sTarget( pURL->GetTargetFrame() );
283cdf0e10cSrcweir ::LoadURL( sURL, &rSh, URLLOAD_NOFILTER, &sTarget);
284cdf0e10cSrcweir return;
285cdf0e10cSrcweir }
286cdf0e10cSrcweir }
287cdf0e10cSrcweir }
288cdf0e10cSrcweir }
289cdf0e10cSrcweir
290cdf0e10cSrcweir GrabFocus();
291cdf0e10cSrcweir if ( GetTextView() )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir GetTextView()->MouseButtonDown( rMEvt );
294cdf0e10cSrcweir }
295cdf0e10cSrcweir mrDocView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
296cdf0e10cSrcweir }
297cdf0e10cSrcweir
MouseButtonUp(const MouseEvent & rMEvt)298cdf0e10cSrcweir void SidebarTxtControl::MouseButtonUp( const MouseEvent& rMEvt )
299cdf0e10cSrcweir {
300cdf0e10cSrcweir if ( GetTextView() )
301cdf0e10cSrcweir GetTextView()->MouseButtonUp( rMEvt );
302cdf0e10cSrcweir }
303cdf0e10cSrcweir
IMPL_LINK(SidebarTxtControl,OnlineSpellCallback,SpellCallbackInfo *,pInfo)304cdf0e10cSrcweir IMPL_LINK( SidebarTxtControl, OnlineSpellCallback, SpellCallbackInfo*, pInfo )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir if ( pInfo->nCommand == SPELLCMD_STARTSPELLDLG )
307cdf0e10cSrcweir {
308cdf0e10cSrcweir mrDocView.GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
309cdf0e10cSrcweir }
310cdf0e10cSrcweir return 0;
311cdf0e10cSrcweir }
312cdf0e10cSrcweir
IMPL_LINK(SidebarTxtControl,Select,Menu *,pSelMenu)313cdf0e10cSrcweir IMPL_LINK( SidebarTxtControl, Select, Menu*, pSelMenu )
314cdf0e10cSrcweir {
315cdf0e10cSrcweir mrSidebarWin.ExecuteCommand( pSelMenu->GetCurItemId() );
316cdf0e10cSrcweir return 0;
317cdf0e10cSrcweir }
318cdf0e10cSrcweir
Command(const CommandEvent & rCEvt)319cdf0e10cSrcweir void SidebarTxtControl::Command( const CommandEvent& rCEvt )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
322cdf0e10cSrcweir {
323cdf0e10cSrcweir if ( !mrSidebarWin.IsProtected() &&
324cdf0e10cSrcweir GetTextView() &&
325cdf0e10cSrcweir GetTextView()->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(),sal_True ))
326cdf0e10cSrcweir {
327cdf0e10cSrcweir Link aLink = LINK(this, SidebarTxtControl, OnlineSpellCallback);
328cdf0e10cSrcweir GetTextView()->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
329cdf0e10cSrcweir }
330cdf0e10cSrcweir else
331cdf0e10cSrcweir {
332cdf0e10cSrcweir SfxPopupMenuManager* pMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel());
333cdf0e10cSrcweir ((PopupMenu*)pMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) );
334cdf0e10cSrcweir
335cdf0e10cSrcweir {
336cdf0e10cSrcweir XubString aText = ((PopupMenu*)pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR );
337cdf0e10cSrcweir SwRewriter aRewriter;
338cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, mrSidebarWin.GetAuthor());
339cdf0e10cSrcweir aText = aRewriter.Apply(aText);
340cdf0e10cSrcweir ((PopupMenu*)pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
341cdf0e10cSrcweir }
342cdf0e10cSrcweir
343cdf0e10cSrcweir Point aPos;
344cdf0e10cSrcweir if (rCEvt.IsMouseEvent())
345cdf0e10cSrcweir aPos = rCEvt.GetMousePosPixel();
346cdf0e10cSrcweir else
347cdf0e10cSrcweir {
348cdf0e10cSrcweir const Size aSize = GetSizePixel();
349cdf0e10cSrcweir aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
350cdf0e10cSrcweir }
351cdf0e10cSrcweir
352cdf0e10cSrcweir //!! call different Execute function to get rid of the new thesaurus sub menu
353cdf0e10cSrcweir //!! pointer created in the call to Popup.
354cdf0e10cSrcweir //!! Otherwise we would have a memory leak (see also #i107205#)
355cdf0e10cSrcweir //((PopupMenu*)pMgr->GetSVMenu())->Execute( this, aPos );
356cdf0e10cSrcweir pMgr->Execute( aPos, this );
357cdf0e10cSrcweir delete pMgr;
358cdf0e10cSrcweir }
359cdf0e10cSrcweir }
360cdf0e10cSrcweir else
361cdf0e10cSrcweir if (rCEvt.GetCommand() == COMMAND_WHEEL)
362cdf0e10cSrcweir {
363cdf0e10cSrcweir if (mrSidebarWin.IsScrollbarVisible())
364cdf0e10cSrcweir {
365cdf0e10cSrcweir const CommandWheelData* pData = rCEvt.GetWheelData();
366cdf0e10cSrcweir if (pData->IsShift() || pData->IsMod1() || pData->IsMod2())
367cdf0e10cSrcweir {
368cdf0e10cSrcweir mrDocView.HandleWheelCommands(rCEvt);
369cdf0e10cSrcweir }
370cdf0e10cSrcweir else
371cdf0e10cSrcweir {
372cdf0e10cSrcweir HandleScrollCommand( rCEvt, 0 , mrSidebarWin.Scrollbar());
373cdf0e10cSrcweir }
374cdf0e10cSrcweir }
375cdf0e10cSrcweir else
376cdf0e10cSrcweir {
377cdf0e10cSrcweir mrDocView.HandleWheelCommands(rCEvt);
378cdf0e10cSrcweir }
379cdf0e10cSrcweir }
380cdf0e10cSrcweir else
381cdf0e10cSrcweir {
382cdf0e10cSrcweir if ( GetTextView() )
383cdf0e10cSrcweir GetTextView()->Command( rCEvt );
384cdf0e10cSrcweir else
385cdf0e10cSrcweir Window::Command(rCEvt);
386cdf0e10cSrcweir }
387cdf0e10cSrcweir }
388cdf0e10cSrcweir
GetSurroundingText() const389cdf0e10cSrcweir XubString SidebarTxtControl::GetSurroundingText() const
390cdf0e10cSrcweir {
391cdf0e10cSrcweir if( GetTextView() )
392cdf0e10cSrcweir return GetTextView()->GetSurroundingText();
393cdf0e10cSrcweir else
394cdf0e10cSrcweir return XubString::EmptyString();
395cdf0e10cSrcweir }
396cdf0e10cSrcweir
GetSurroundingTextSelection() const397cdf0e10cSrcweir Selection SidebarTxtControl::GetSurroundingTextSelection() const
398cdf0e10cSrcweir {
399cdf0e10cSrcweir if( GetTextView() )
400cdf0e10cSrcweir return GetTextView()->GetSurroundingTextSelection();
401cdf0e10cSrcweir else
402cdf0e10cSrcweir return Selection( 0, 0 );
403cdf0e10cSrcweir }
404cdf0e10cSrcweir
CreateAccessible()405cdf0e10cSrcweir css::uno::Reference< css::accessibility::XAccessible > SidebarTxtControl::CreateAccessible()
406cdf0e10cSrcweir {
407cdf0e10cSrcweir
408cdf0e10cSrcweir SidebarTxtControlAccessible* pAcc( new SidebarTxtControlAccessible( *this ) );
409cdf0e10cSrcweir css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
410cdf0e10cSrcweir SetWindowPeer( xWinPeer, pAcc );
411cdf0e10cSrcweir
412cdf0e10cSrcweir css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
413cdf0e10cSrcweir return xAcc;
414cdf0e10cSrcweir }
415cdf0e10cSrcweir
416cdf0e10cSrcweir } } // end of namespace sw::sidebarwindows
417*f3eb8045Smseidel
418*f3eb8045Smseidel /* vim: set noet sw=4 ts=4: */
419