Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
21 : #include <com/sun/star/chart2/data/XDataReceiver.hpp>
22 :
23 : #include <com/sun/star/embed/EmbedMisc.hpp>
24 : #include <com/sun/star/embed/EmbedStates.hpp>
25 : #include <sfx2/app.hxx>
26 : #include <toolkit/helper/vclunohelper.hxx>
27 : #include <svx/svxdlg.hxx>
28 : #include <svx/dataaccessdescriptor.hxx>
29 : #include <svx/pfiledlg.hxx>
30 : #include <svx/svditer.hxx>
31 : #include <svx/svdmark.hxx>
32 : #include <svx/svdograf.hxx>
33 : #include <svx/svdogrp.hxx>
34 : #include <svx/svdoole2.hxx>
35 : #include <svx/svdouno.hxx>
36 : #include <svx/svdview.hxx>
37 : #include <sfx2/linkmgr.hxx>
38 : #include <svx/fontworkbar.hxx>
39 : #include <sfx2/bindings.hxx>
40 : #include <sfx2/dispatch.hxx>
41 : #include <sfx2/viewfrm.hxx>
42 : #include <svtools/soerr.hxx>
43 : #include <svl/rectitem.hxx>
44 : #include <svl/slstitm.hxx>
45 : #include <svl/whiter.hxx>
46 : #include <unotools/moduleoptions.hxx>
47 : #include <sot/exchange.hxx>
48 : #include <tools/diagnose_ex.h>
49 :
50 : #include "tabvwsh.hxx"
51 : #include "globstr.hrc"
52 : #include "scmod.hxx"
53 : #include "document.hxx"
54 : #include "sc.hrc"
55 : #include "client.hxx"
56 : #include "fuinsert.hxx"
57 : #include "docsh.hxx"
58 : #include "chartarr.hxx"
59 : #include "drawview.hxx"
60 : #include "ChartRangeSelectionListener.hxx"
61 : #include <gridwin.hxx>
62 :
63 : #include <tools/urlobj.hxx>
64 : #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
65 :
66 : using namespace com::sun::star;
67 :
68 : // STATIC DATA -----------------------------------------------------------
69 :
70 0 : void ScTabViewShell::ConnectObject( SdrOle2Obj* pObj )
71 : {
72 : // wird aus dem Paint gerufen
73 :
74 0 : uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
75 0 : vcl::Window* pWin = GetActiveWin();
76 :
77 : // wenn schon connected ist, nicht nochmal SetObjArea/SetSizeScale
78 :
79 0 : SfxInPlaceClient* pClient = FindIPClient( xObj, pWin );
80 0 : if ( !pClient )
81 : {
82 0 : pClient = new ScClient( this, pWin, GetSdrView()->GetModel(), pObj );
83 0 : Rectangle aRect = pObj->GetLogicRect();
84 0 : Size aDrawSize = aRect.GetSize();
85 :
86 0 : Size aOleSize = pObj->GetOrigObjSize();
87 :
88 0 : Fraction aScaleWidth (aDrawSize.Width(), aOleSize.Width() );
89 0 : Fraction aScaleHeight(aDrawSize.Height(), aOleSize.Height() );
90 0 : aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj
91 0 : aScaleHeight.ReduceInaccurate(10);
92 0 : pClient->SetSizeScale(aScaleWidth,aScaleHeight);
93 :
94 : // sichtbarer Ausschnitt wird nur inplace veraendert!
95 : // the object area must be set after the scaling since it triggers the resizing
96 0 : aRect.SetSize( aOleSize );
97 0 : pClient->SetObjArea( aRect );
98 :
99 0 : static_cast<ScClient*>(pClient)->SetGrafEdit( NULL );
100 0 : }
101 0 : }
102 :
103 0 : bool ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb )
104 : {
105 : // Gueltigkeits-Hinweisfenster nicht ueber dem Objekt stehenlassen
106 0 : RemoveHintWindow();
107 :
108 0 : uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
109 0 : vcl::Window* pWin = GetActiveWin();
110 0 : ErrCode nErr = ERRCODE_NONE;
111 0 : bool bErrorShown = false;
112 :
113 : {
114 0 : SfxInPlaceClient* pClient = FindIPClient( xObj, pWin );
115 0 : if ( !pClient )
116 0 : pClient = new ScClient( this, pWin, GetSdrView()->GetModel(), pObj );
117 :
118 0 : if ( !(nErr & ERRCODE_ERROR_MASK) && xObj.is() )
119 : {
120 0 : Rectangle aRect = pObj->GetLogicRect();
121 :
122 : {
123 : // #i118485# center on BoundRect for activation,
124 : // OLE may be sheared/rotated now
125 0 : const Rectangle& rBoundRect = pObj->GetCurrentBoundRect();
126 0 : const Point aDelta(rBoundRect.Center() - aRect.Center());
127 0 : aRect.Move(aDelta.X(), aDelta.Y());
128 : }
129 :
130 0 : Size aDrawSize = aRect.GetSize();
131 :
132 0 : MapMode aMapMode( MAP_100TH_MM );
133 0 : Size aOleSize = pObj->GetOrigObjSize( &aMapMode );
134 :
135 0 : if ( pClient->GetAspect() != embed::Aspects::MSOLE_ICON
136 0 : && ( xObj->getStatus( pClient->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
137 : {
138 : // scale must always be 1 - change VisArea if different from client size
139 :
140 0 : if ( aDrawSize != aOleSize )
141 : {
142 0 : MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( pClient->GetAspect() ) );
143 : aOleSize = OutputDevice::LogicToLogic( aDrawSize,
144 0 : MAP_100TH_MM, aUnit );
145 0 : awt::Size aSz( aOleSize.Width(), aOleSize.Height() );
146 0 : xObj->setVisualAreaSize( pClient->GetAspect(), aSz );
147 : }
148 0 : Fraction aOne( 1, 1 );
149 0 : pClient->SetSizeScale( aOne, aOne );
150 : }
151 : else
152 : {
153 : // calculate scale from client and VisArea size
154 :
155 0 : Fraction aScaleWidth (aDrawSize.Width(), aOleSize.Width() );
156 0 : Fraction aScaleHeight(aDrawSize.Height(), aOleSize.Height() );
157 0 : aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj
158 0 : aScaleHeight.ReduceInaccurate(10);
159 0 : pClient->SetSizeScale(aScaleWidth,aScaleHeight);
160 : }
161 :
162 : // sichtbarer Ausschnitt wird nur inplace veraendert!
163 : // the object area must be set after the scaling since it triggers the resizing
164 0 : aRect.SetSize( aOleSize );
165 0 : pClient->SetObjArea( aRect );
166 :
167 0 : static_cast<ScClient*>(pClient)->SetGrafEdit( NULL );
168 :
169 0 : nErr = pClient->DoVerb( nVerb );
170 0 : bErrorShown = true;
171 : // SfxViewShell::DoVerb zeigt seine Fehlermeldungen selber an
172 :
173 : // attach listener to selection changes in chart that affect cell
174 : // ranges, so those can be highlighted
175 : // note: do that after DoVerb, so that the chart controller exists
176 0 : if ( SvtModuleOptions().IsChart() )
177 : {
178 0 : SvGlobalName aObjClsId ( xObj->getClassID() );
179 0 : if (SotExchange::IsChart( aObjClsId ))
180 : {
181 : try
182 : {
183 0 : uno::Reference < embed::XComponentSupplier > xSup( xObj, uno::UNO_QUERY_THROW );
184 : uno::Reference< chart2::data::XDataReceiver > xDataReceiver(
185 0 : xSup->getComponent(), uno::UNO_QUERY_THROW );
186 : uno::Reference< chart2::data::XRangeHighlighter > xRangeHightlighter(
187 0 : xDataReceiver->getRangeHighlighter());
188 0 : if( xRangeHightlighter.is())
189 : {
190 : uno::Reference< view::XSelectionChangeListener > xListener(
191 0 : new ScChartRangeSelectionListener( this ));
192 0 : xRangeHightlighter->addSelectionChangeListener( xListener );
193 0 : }
194 : }
195 0 : catch( const uno::Exception & )
196 : {
197 : OSL_FAIL( "Exception caught while querying chart" );
198 : }
199 0 : }
200 0 : }
201 : }
202 : }
203 0 : if (nErr != ERRCODE_NONE && !bErrorShown)
204 0 : ErrorHandler::HandleError(nErr);
205 :
206 : // #i118524# refresh handles to suppress for activated OLE
207 0 : if(GetSdrView())
208 : {
209 0 : GetSdrView()->AdjustMarkHdl();
210 : }
211 : //! SetDocumentName sollte schon im Sfx passieren ???
212 : //TODO/LATER: how "SetDocumentName"?
213 : //xIPObj->SetDocumentName( GetViewData().GetDocShell()->GetTitle() );
214 :
215 0 : return ( !(nErr & ERRCODE_ERROR_MASK) );
216 : }
217 :
218 0 : ErrCode ScTabViewShell::DoVerb(long nVerb)
219 : {
220 0 : SdrView* pView = GetSdrView();
221 0 : if (!pView)
222 0 : return ERRCODE_SO_NOTIMPL; // soll nicht sein
223 :
224 0 : SdrOle2Obj* pOle2Obj = NULL;
225 0 : ErrCode nErr = ERRCODE_NONE;
226 :
227 0 : const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
228 0 : if (rMarkList.GetMarkCount() == 1)
229 : {
230 0 : SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
231 0 : if (pObj->GetObjIdentifier() == OBJ_OLE2)
232 0 : pOle2Obj = static_cast<SdrOle2Obj*>(pObj);
233 : }
234 :
235 0 : if (pOle2Obj)
236 : {
237 0 : ActivateObject( pOle2Obj, nVerb );
238 : }
239 : else
240 : {
241 : OSL_FAIL("kein Objekt fuer Verb gefunden");
242 : }
243 :
244 0 : return nErr;
245 : }
246 :
247 0 : void ScTabViewShell::DeactivateOle()
248 : {
249 : // deactivate inplace editing if currently active
250 :
251 0 : ScModule* pScMod = SC_MOD();
252 0 : bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
253 :
254 0 : ScClient* pClient = static_cast<ScClient*>(GetIPClient());
255 0 : if ( pClient && pClient->IsObjectInPlaceActive() && !bUnoRefDialog )
256 0 : pClient->DeactivateObject();
257 0 : }
258 :
259 0 : void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
260 : {
261 0 : sal_uInt16 nSlot = rReq.GetSlot();
262 0 : if (nSlot != SID_OBJECTRESIZE )
263 : {
264 0 : SC_MOD()->InputEnterHandler();
265 0 : UpdateInputHandler();
266 : }
267 :
268 : // Rahmen fuer Chart einfuegen wird abgebrochen:
269 0 : FuPoor* pPoor = GetDrawFuncPtr();
270 0 : if ( pPoor && pPoor->GetSlotID() == SID_DRAW_CHART )
271 0 : GetViewData().GetDispatcher().Execute(SID_DRAW_CHART, SfxCallMode::SLOT | SfxCallMode::RECORD);
272 :
273 0 : MakeDrawLayer();
274 :
275 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
276 0 : ScTabView* pTabView = GetViewData().GetView();
277 0 : vcl::Window* pWin = pTabView->GetActiveWin();
278 0 : ScDrawView* pView = pTabView->GetScDrawView();
279 0 : ScDocShell* pDocSh = GetViewData().GetDocShell();
280 0 : ScDocument& rDoc = pDocSh->GetDocument();
281 0 : SdrModel* pDrModel = pView->GetModel();
282 :
283 0 : switch ( nSlot )
284 : {
285 : case SID_INSERT_GRAPHIC:
286 0 : FuInsertGraphic(this, pWin, pView, pDrModel, rReq);
287 : // shell is set in MarkListHasChanged
288 0 : break;
289 :
290 : case SID_INSERT_AVMEDIA:
291 0 : FuInsertMedia(this, pWin, pView, pDrModel, rReq);
292 : // shell is set in MarkListHasChanged
293 0 : break;
294 :
295 : case SID_INSERT_DIAGRAM:
296 0 : FuInsertChart(this, pWin, pView, pDrModel, rReq);
297 0 : break;
298 :
299 : case SID_INSERT_OBJECT:
300 : case SID_INSERT_PLUGIN:
301 : case SID_INSERT_SOUND:
302 : case SID_INSERT_VIDEO:
303 : case SID_INSERT_SMATH:
304 : case SID_INSERT_FLOATINGFRAME:
305 0 : FuInsertOLE(this, pWin, pView, pDrModel, rReq);
306 0 : break;
307 :
308 : case SID_INSERT_DIAGRAM_FROM_FILE:
309 : try
310 : {
311 : sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
312 0 : 0, OUString("com.sun.star.chart2.ChartDocument"));
313 0 : if(aDlg.Execute() == ERRCODE_NONE )
314 : {
315 0 : INetURLObject aURLObj( aDlg.GetPath() );
316 0 : OUString aURL = aURLObj.GetURLNoPass();
317 0 : FuInsertChartFromFile(this, pWin, pView, pDrModel, rReq, aURL);
318 0 : }
319 : }
320 0 : catch (const uno::Exception& e)
321 : {
322 : SAL_WARN( "sc", "Cannot Insert Chart: " << e.Message);
323 : }
324 0 : break;
325 :
326 : case SID_OBJECTRESIZE:
327 : {
328 : // Der Server moechte die Clientgrosse verandern
329 :
330 0 : SfxInPlaceClient* pClient = GetIPClient();
331 :
332 0 : if ( pClient && pClient->IsObjectInPlaceActive() )
333 : {
334 : const SfxRectangleItem& rRect =
335 0 : static_cast<const SfxRectangleItem&>(rReq.GetArgs()->Get(SID_OBJECTRESIZE));
336 0 : Rectangle aRect( pWin->PixelToLogic( rRect.GetValue() ) );
337 :
338 0 : if ( pView->AreObjectsMarked() )
339 : {
340 0 : const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
341 :
342 0 : if (rMarkList.GetMarkCount() == 1)
343 : {
344 0 : SdrMark* pMark = rMarkList.GetMark(0);
345 0 : SdrObject* pObj = pMark->GetMarkedSdrObj();
346 :
347 0 : sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
348 :
349 0 : if (nSdrObjKind == OBJ_OLE2)
350 : {
351 0 : if ( static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() )
352 : {
353 0 : pObj->SetLogicRect(aRect);
354 : }
355 : }
356 : }
357 : }
358 : }
359 : }
360 0 : break;
361 :
362 : case SID_LINKS:
363 : {
364 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
365 0 : SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( pWin, rDoc.GetLinkManager() );
366 0 : if ( pDlg )
367 : {
368 0 : pDlg->Execute();
369 0 : rBindings.Invalidate( nSlot );
370 0 : SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator
371 0 : rReq.Done();
372 : }
373 : }
374 0 : break;
375 :
376 : // #98721#
377 : case SID_FM_CREATE_FIELDCONTROL:
378 : {
379 0 : SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, false );
380 : OSL_ENSURE( pDescriptorItem, "SID_FM_CREATE_FIELDCONTROL: invalid request args!" );
381 :
382 0 : if(pDescriptorItem)
383 : {
384 : //! merge with ScViewFunc::PasteDataFormat (SotClipboardFormatId::SBA_FIELDDATAEXCHANGE)?
385 :
386 0 : ScDrawView* pDrView = GetScDrawView();
387 0 : SdrPageView* pPageView = pDrView ? pDrView->GetSdrPageView() : NULL;
388 0 : if(pPageView)
389 : {
390 0 : svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue());
391 0 : SdrObject* pNewDBField = pDrView->CreateFieldControl(aDescriptor);
392 :
393 0 : if(pNewDBField)
394 : {
395 0 : Rectangle aVisArea = pWin->PixelToLogic(Rectangle(Point(0,0), pWin->GetOutputSizePixel()));
396 0 : Point aObjPos(aVisArea.Center());
397 0 : Size aObjSize(pNewDBField->GetLogicRect().GetSize());
398 0 : aObjPos.X() -= aObjSize.Width() / 2;
399 0 : aObjPos.Y() -= aObjSize.Height() / 2;
400 0 : Rectangle aNewObjectRectangle(aObjPos, aObjSize);
401 :
402 0 : pNewDBField->SetLogicRect(aNewObjectRectangle);
403 :
404 : // controls must be on control layer, groups on front layer
405 0 : if ( pNewDBField->ISA(SdrUnoObj) )
406 0 : pNewDBField->NbcSetLayer(SC_LAYER_CONTROLS);
407 : else
408 0 : pNewDBField->NbcSetLayer(SC_LAYER_FRONT);
409 0 : if (pNewDBField->ISA(SdrObjGroup))
410 : {
411 0 : SdrObjListIter aIter( *pNewDBField, IM_DEEPWITHGROUPS );
412 0 : SdrObject* pSubObj = aIter.Next();
413 0 : while (pSubObj)
414 : {
415 0 : if ( pSubObj->ISA(SdrUnoObj) )
416 0 : pSubObj->NbcSetLayer(SC_LAYER_CONTROLS);
417 : else
418 0 : pSubObj->NbcSetLayer(SC_LAYER_FRONT);
419 0 : pSubObj = aIter.Next();
420 0 : }
421 : }
422 :
423 0 : pView->InsertObjectAtView(pNewDBField, *pPageView);
424 0 : }
425 : }
426 : }
427 0 : rReq.Done();
428 : }
429 0 : break;
430 :
431 : case SID_FONTWORK_GALLERY_FLOATER:
432 0 : svx::FontworkBar::execute( pView, rReq, GetViewFrame()->GetBindings() );
433 0 : rReq.Ignore();
434 0 : break;
435 : }
436 0 : }
437 :
438 493 : void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
439 : {
440 493 : bool bOle = GetViewFrame()->GetFrame().IsInPlace();
441 493 : bool bTabProt = GetViewData().GetDocument()->IsTabProtected(GetViewData().GetTabNo());
442 493 : ScDocShell* pDocShell = GetViewData().GetDocShell();
443 493 : bool bShared = pDocShell && pDocShell->IsDocShared();
444 :
445 493 : SfxWhichIter aIter(rSet);
446 493 : sal_uInt16 nWhich = aIter.FirstWhich();
447 1541 : while ( nWhich )
448 : {
449 555 : switch ( nWhich )
450 : {
451 : case SID_INSERT_DIAGRAM:
452 185 : if ( bOle || bTabProt || !SvtModuleOptions().IsChart() || bShared )
453 0 : rSet.DisableItem( nWhich );
454 185 : break;
455 :
456 : case SID_INSERT_SMATH:
457 185 : if ( bOle || bTabProt || !SvtModuleOptions().IsMath() || bShared )
458 0 : rSet.DisableItem( nWhich );
459 185 : break;
460 :
461 : case SID_INSERT_OBJECT:
462 : case SID_INSERT_PLUGIN:
463 : case SID_INSERT_FLOATINGFRAME:
464 0 : if ( bOle || bTabProt || bShared )
465 0 : rSet.DisableItem( nWhich );
466 0 : break;
467 :
468 : case SID_INSERT_SOUND:
469 : case SID_INSERT_VIDEO:
470 : /* #i102735# discussed with NN: removed for performance reasons
471 : || !SvxPluginFileDlg::IsAvailable(nWhich)
472 : */
473 0 : if ( bOle || bTabProt || bShared )
474 0 : rSet.DisableItem( nWhich );
475 0 : break;
476 :
477 : case SID_INSERT_GRAPHIC:
478 : case SID_INSERT_AVMEDIA:
479 : case SID_FONTWORK_GALLERY_FLOATER:
480 185 : if ( bTabProt || bShared )
481 0 : rSet.DisableItem( nWhich );
482 185 : break;
483 :
484 : case SID_LINKS:
485 : {
486 0 : if (GetViewData().GetDocument()->GetLinkManager()->GetLinks().empty())
487 0 : rSet.DisableItem( SID_LINKS );
488 : }
489 0 : break;
490 : }
491 555 : nWhich = aIter.NextWhich();
492 493 : }
493 493 : }
494 :
495 0 : void ScTabViewShell::ExecuteUndo(SfxRequest& rReq)
496 : {
497 0 : SfxShell* pSh = GetViewData().GetDispatcher().GetShell(0);
498 0 : ::svl::IUndoManager* pUndoManager = pSh->GetUndoManager();
499 :
500 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
501 0 : ScDocShell* pDocSh = GetViewData().GetDocShell();
502 :
503 0 : sal_uInt16 nSlot = rReq.GetSlot();
504 0 : switch ( nSlot )
505 : {
506 : case SID_UNDO:
507 : case SID_REDO:
508 0 : if ( pUndoManager )
509 : {
510 0 : bool bIsUndo = ( nSlot == SID_UNDO );
511 :
512 0 : sal_uInt16 nCount = 1;
513 : const SfxPoolItem* pItem;
514 0 : if ( pReqArgs && pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET )
515 0 : nCount = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
516 :
517 : // lock paint for more than one cell undo action (not for editing within a cell)
518 0 : bool bLockPaint = ( nCount > 1 && pUndoManager == GetUndoManager() );
519 0 : if ( bLockPaint )
520 0 : pDocSh->LockPaint();
521 :
522 : try
523 : {
524 0 : for (sal_uInt16 i=0; i<nCount; i++)
525 : {
526 0 : if ( bIsUndo )
527 0 : pUndoManager->Undo();
528 : else
529 0 : pUndoManager->Redo();
530 : }
531 : }
532 0 : catch ( const uno::Exception& )
533 : {
534 : // no need to handle. By definition, the UndoManager handled this by clearing the
535 : // Undo/Redo stacks
536 : }
537 :
538 0 : if ( bLockPaint )
539 0 : pDocSh->UnlockPaint();
540 :
541 0 : GetViewFrame()->GetBindings().InvalidateAll(false);
542 : }
543 0 : break;
544 : // default:
545 : // GetViewFrame()->ExecuteSlot( rReq );
546 : }
547 0 : }
548 :
549 432 : void ScTabViewShell::GetUndoState(SfxItemSet &rSet)
550 : {
551 432 : SfxShell* pSh = GetViewData().GetDispatcher().GetShell(0);
552 432 : ::svl::IUndoManager* pUndoManager = pSh->GetUndoManager();
553 :
554 432 : SfxWhichIter aIter(rSet);
555 432 : sal_uInt16 nWhich = aIter.FirstWhich();
556 1420 : while ( nWhich )
557 : {
558 556 : switch (nWhich)
559 : {
560 : case SID_GETUNDOSTRINGS:
561 : case SID_GETREDOSTRINGS:
562 : {
563 0 : SfxStringListItem aStrLst( nWhich );
564 0 : if ( pUndoManager )
565 : {
566 0 : std::vector<OUString> &aList = aStrLst.GetList();
567 0 : bool bIsUndo = ( nWhich == SID_GETUNDOSTRINGS );
568 0 : size_t nCount = bIsUndo ? pUndoManager->GetUndoActionCount() : pUndoManager->GetRedoActionCount();
569 0 : for (size_t i=0; i<nCount; ++i)
570 : {
571 0 : aList.push_back( bIsUndo ? pUndoManager->GetUndoActionComment(i) :
572 0 : pUndoManager->GetRedoActionComment(i) );
573 : }
574 : }
575 0 : rSet.Put( aStrLst );
576 : }
577 0 : break;
578 : default:
579 : // get state from sfx view frame
580 556 : GetViewFrame()->GetSlotState( nWhich, NULL, &rSet );
581 : }
582 :
583 556 : nWhich = aIter.NextWhich();
584 432 : }
585 588 : }
586 :
587 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|