LibreOffice Module sc (master)  1
prevwsh.cxx
Go to the documentation of this file.
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 <sal/config.h>
21 
22 #include <scitems.hxx>
23 
25 #include <sfx2/app.hxx>
26 #include <editeng/sizeitem.hxx>
27 #include <svx/zoomslideritem.hxx>
28 #include <svx/svdview.hxx>
29 #include <sfx2/dispatch.hxx>
30 #include <sfx2/objface.hxx>
31 #include <sfx2/request.hxx>
32 #include <svl/stritem.hxx>
33 #include <svl/whiter.hxx>
34 #include <vcl/commandevent.hxx>
35 #include <vcl/help.hxx>
36 #include <vcl/settings.hxx>
37 #include <vcl/svapp.hxx>
38 #include <tools/urlobj.hxx>
39 #include <sfx2/docfile.hxx>
40 #include <sfx2/printer.hxx>
41 #include <sfx2/viewfrm.hxx>
42 #include <sfx2/viewfac.hxx>
43 
44 #include <drwlayer.hxx>
45 #include <prevwsh.hxx>
46 #include <preview.hxx>
47 #include <printfun.hxx>
48 #include <scmod.hxx>
49 #include <inputhdl.hxx>
50 #include <docsh.hxx>
51 #include <tabvwsh.hxx>
52 #include <stlpool.hxx>
53 #include <editutil.hxx>
54 #include <globstr.hrc>
55 #include <scresid.hxx>
56 #include <sc.hrc>
58 #include <viewuno.hxx>
59 
60 #include <svx/svxdlg.hxx>
61 #include <svx/dialogs.hrc>
62 
64 #include <svx/zoom_def.hxx>
65 #include <com/sun/star/document/XDocumentProperties.hpp>
66 
67 #include <scabstdlg.hxx>
68 #include <vcl/EnumContext.hxx>
69 #include <vcl/notebookbar.hxx>
70 
71 // for mouse wheel
72 #define MINZOOM_SLIDER 10
73 #define MAXZOOM_SLIDER 400
74 
75 #define SC_USERDATA_SEP ';'
76 
77 using namespace com::sun::star;
78 
79 #define ShellClass_ScPreviewShell
80 #include <scslots.hxx>
81 
82 #include <memory>
83 
84 
86 
87 void ScPreviewShell::InitInterface_Impl()
88 {
89  GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT,
90  SfxVisibilityFlags::Standard|SfxVisibilityFlags::Server|SfxVisibilityFlags::ReadonlyDoc,
91  ToolbarId::Objectbar_Preview);
92 
93  GetStaticInterface()->RegisterPopupMenu("preview");
94 }
95 
97 {
99 }
100 
102 {
103  // Find the top-most window, and set the close window handler to intercept
104  // the window close event.
105  vcl::Window* pWin = pParent;
106  while (!pWin->IsSystemWindow())
107  {
108  if (pWin->GetParent())
109  pWin = pWin->GetParent();
110  else
111  break;
112  }
113 
114  mpFrameWindow = dynamic_cast<SystemWindow*>(pWin);
115  if (mpFrameWindow)
116  mpFrameWindow->SetCloseHdl(LINK(this, ScPreviewShell, CloseHdl));
117 
118  eZoom = SvxZoomType::WHOLEPAGE;
119 
120  pCorner = VclPtr<ScrollBarBox>::Create( pParent, WB_SIZEABLE );
121 
122  pHorScroll = VclPtr<ScrollBar>::Create(pParent, WB_HSCROLL );
123  pVerScroll = VclPtr<ScrollBar>::Create(pParent, WB_VSCROLL);
124 
125  // RTL: no mirroring for horizontal scrollbars
126  pHorScroll->EnableRTL( false );
127 
128  pHorScroll->SetEndScrollHdl( LINK( this, ScPreviewShell, ScrollHandler ) );
129  pVerScroll->SetEndScrollHdl( LINK( this, ScPreviewShell, ScrollHandler ) );
130 
131  pPreview = VclPtr<ScPreview>::Create( pParent, pDocShell, this );
132 
133  SetPool( &SC_MOD()->GetPool() );
134  SetWindow( pPreview );
135  StartListening(*pDocShell, DuplicateHandling::Prevent);
136  StartListening(*SfxGetpApp(), DuplicateHandling::Prevent); // #i62045# #i62046# application is needed for Calc's own hints
137  SfxBroadcaster* pDrawBC = pDocShell->GetDocument().GetDrawBroadcaster();
138  if (pDrawBC)
139  StartListening(*pDrawBC);
140 
141  pHorScroll->Show( false );
142  pVerScroll->Show( false );
143  pCorner->Show();
144  SetName("Preview");
145 }
146 
148  SfxViewShell* pOldSh ) :
150  pDocShell( static_cast<ScDocShell*>(pViewFrame->GetObjectShell()) ),
151  mpFrameWindow(nullptr),
152  nSourceDesignMode( TRISTATE_INDET ),
153  nMaxVertPos(0)
154 {
155  Construct( &pViewFrame->GetWindow() );
156 
157  try
158  {
163  }
164  catch (const css::uno::RuntimeException& e)
165  {
166  // tdf#130559: allow BackingComp to fail adding listener when opening document
167  css::uno::Reference<css::lang::XServiceInfo> xServiceInfo(e.Context, css::uno::UNO_QUERY);
168  if (!xServiceInfo || !xServiceInfo->supportsService("com.sun.star.frame.StartModule"))
169  throw;
170  SAL_WARN("sc.ui", "Opening file from StartModule straight into print preview");
171  }
172 
173  auto& pNotebookBar = pViewFrame->GetWindow().GetSystemWindow()->GetNotebookBar();
174  if (pNotebookBar)
175  pNotebookBar->ControlListenerForCurrentController(false); // stop listening
176 
177  if ( auto pTabViewShell = dynamic_cast<ScTabViewShell*>( pOldSh) )
178  {
179  // store view settings, show table from TabView
182 
183  const ScViewData& rData = pTabViewShell->GetViewData();
185  InitStartTable( rData.GetTabNo() );
186 
187  // also have to store the TabView's DesignMode state
188  // (only if draw view exists)
189  SdrView* pDrawView = pTabViewShell->GetScDrawView();
190  if ( pDrawView )
192  = pDrawView->IsDesignMode() ? TRISTATE_TRUE : TRISTATE_FALSE;
193  }
194 
195  new ScPreviewObj(this);
196 }
197 
199 {
200  if (mpFrameWindow)
201  mpFrameWindow->SetCloseHdl(Link<SystemWindow&,void>()); // Remove close handler.
202 
203  if (auto& pBar = GetViewFrame()->GetWindow().GetSystemWindow()->GetNotebookBar())
204  pBar->ControlListenerForCurrentController(true); // let it start listening now
205 
206  // #108333#; notify Accessibility that Shell is dying and before destroy all
207  BroadcastAccessibility( SfxHint( SfxHintId::Dying ) );
209 
211  if (pDrawBC)
212  EndListening(*pDrawBC);
213  EndListening(*SfxGetpApp());
214  EndListening(*pDocShell);
215 
216  SetWindow(nullptr);
221 
222  // normal mode of operation is switching back to default view in the same frame,
223  // so there's no need to activate any other window here anymore
224 }
225 
227 {
229 }
230 
231 void ScPreviewShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
232 {
233  Size aOutSize( rSize );
234  pPreview->SetPosSizePixel( rPos, aOutSize );
235 
236  if ( SvxZoomType::WHOLEPAGE == eZoom )
238  else if ( SvxZoomType::PAGEWIDTH == eZoom )
240 
241  UpdateNeededScrollBars(false);
242 }
243 
244 void ScPreviewShell::InnerResizePixel( const Point &rOfs, const Size &rSize, bool )
245 {
246  AdjustPosSizePixel( rOfs,rSize );
247 }
248 
249 void ScPreviewShell::OuterResizePixel( const Point &rOfs, const Size &rSize )
250 {
251  AdjustPosSizePixel( rOfs,rSize );
252 }
253 
255 {
256  ScDocument& rDoc = pDocShell->GetDocument();
257  SCTAB nTab = pPreview->GetTab();
258 
259  ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
260  SfxStyleSheetBase* pStyleSheet = pStylePool->Find( rDoc.GetPageStyle( nTab ),
261  SfxStyleFamily::Page );
262  OSL_ENSURE(pStyleSheet,"No style sheet");
263  if (!pStyleSheet) return false;
264  const SfxItemSet* pParamSet = &pStyleSheet->GetItemSet();
265 
266  aPageSize = pParamSet->Get(ATTR_PAGE_SIZE).GetSize();
267  aPageSize.setWidth( static_cast<long>(aPageSize.Width() * HMM_PER_TWIPS ) );
268  aPageSize.setHeight( static_cast<long>(aPageSize.Height() * HMM_PER_TWIPS ) );
269  return true;
270 }
271 
273 {
274  Size aPageSize;
276 
278  long nBarH = nBarW;
279 
280  long aHeightOffSet = pDevice ? pDevice->PixelToLogic( Size( nBarW, nBarH ), pPreview->GetMapMode() ).Height() : 0;
281  long aWidthOffSet = aHeightOffSet;
282 
283  if (!GetPageSize( aPageSize ))
284  return;
285 
286  // for centering, page size without the shadow is used
287  bool bVert = pVerScroll->IsVisible();
288  bool bHori = pHorScroll->IsVisible();
289  Size aWindowSize = pPreview->GetOutputSize();
290  Point aPos = pPreview->GetPosPixel();
291  Size aWindowPixelSize = pPreview->GetOutputSizePixel();
292 
293  // if we are called from Zoom then we need to compensate for whatever
294  // scrollbars were displayed before the zoom was called
295  if ( bFromZoom )
296  {
297  if ( bVert )
298  {
299  aWindowPixelSize.AdjustWidth(nBarH );
300  aWindowSize.AdjustWidth(aHeightOffSet );
301  }
302  if ( bHori )
303  {
304  aWindowPixelSize.AdjustHeight(nBarW );
305  aWindowSize.AdjustHeight(aWidthOffSet );
306  }
307  }
308 
309  // recalculate any needed scrollbars
310  long nMaxWidthPos = aPageSize.Width() - aWindowSize.Width();
311  bHori = nMaxWidthPos >= 0;
312  long nMaxHeightPos = aPageSize.Height() - aWindowSize.Height();
313  bVert = nMaxHeightPos >= 0;
314 
315  // see if having a scroll bar requires the other
316  if ( bVert != bHori && ( bVert || bHori ) )
317  {
318  if ( bVert && ( (nMaxWidthPos + aWidthOffSet ) > 0 ) )
319  bHori = true;
320  else if ( (nMaxHeightPos + aHeightOffSet ) > 0 )
321  bVert = true;
322  }
323  pHorScroll->Show( bHori );
324  pVerScroll->Show( bVert );
325 
326  // make room for needed scrollbars ( and reduce the size
327  // of the preview appropriately )
328  if ( bHori )
329  aWindowPixelSize.AdjustHeight( -nBarW );
330  if ( bVert )
331  aWindowPixelSize.AdjustWidth( -nBarH );
332 
333  pPreview->SetSizePixel( aWindowPixelSize );
334  pHorScroll->SetPosSizePixel( Point( aPos.X(), aPos.Y() + aWindowPixelSize.Height() ),
335  Size( aWindowPixelSize.Width(), nBarH ) );
336  pVerScroll->SetPosSizePixel( Point( aPos.X() + aWindowPixelSize.Width(), aPos.Y() ),
337  Size( nBarW, aWindowPixelSize.Height() ) );
338  pCorner->SetPosSizePixel( Point( aPos.X() + aWindowPixelSize.Width(), aPos.Y() + aWindowPixelSize.Height() ),
339  Size( nBarW, nBarH ) );
341 }
342 
344 {
345  Size aPageSize;
346  if ( !GetPageSize( aPageSize ) )
347  return;
348 
349  // for centering, page size without the shadow is used
350 
351  Size aWindowSize = pPreview->GetOutputSize();
352 
353  Point aOfs = pPreview->GetOffset();
354 
355  if( pHorScroll )
356  {
357  pHorScroll->SetRange( Range( 0, aPageSize.Width() ) );
358  pHorScroll->SetLineSize( aWindowSize.Width() / 16 );
359  pHorScroll->SetPageSize( aWindowSize.Width() );
360  pHorScroll->SetVisibleSize( aWindowSize.Width() );
361  long nMaxPos = aPageSize.Width() - aWindowSize.Width();
362  if ( nMaxPos<0 )
363  {
364  // page smaller than window -> center (but put scrollbar to 0)
365  aOfs.setX( 0 );
366  pPreview->SetXOffset( nMaxPos / 2 );
367  }
368  else if (aOfs.X() < 0)
369  {
370  // page larger than window -> never use negative offset
371  aOfs.setX( 0 );
372  pPreview->SetXOffset( 0 );
373  }
374  else if (aOfs.X() > nMaxPos)
375  {
376  // limit offset to align with right edge of window
377  aOfs.setX( nMaxPos );
378  pPreview->SetXOffset(nMaxPos);
379  }
380  pHorScroll->SetThumbPos( aOfs.X() );
381  }
382 
383  if( pVerScroll )
384  {
385  long nPageNo = pPreview->GetPageNo();
386  long nTotalPages = pPreview->GetTotalPages();
387 
388  nMaxVertPos = aPageSize.Height() - aWindowSize.Height();
389  pVerScroll->SetLineSize( aWindowSize.Height() / 16 );
390  pVerScroll->SetPageSize( aWindowSize.Height() );
391  pVerScroll->SetVisibleSize( aWindowSize.Height() );
392  if ( nMaxVertPos < 0 )
393  {
394  // page smaller than window -> center (but put scrollbar to 0)
395  aOfs.setY( 0 );
397  pVerScroll->SetThumbPos( nPageNo * aWindowSize.Height() );
398  pVerScroll->SetRange( Range( 0, aWindowSize.Height() * nTotalPages ));
399  }
400  else if (aOfs.Y() < 0)
401  {
402  // page larger than window -> never use negative offset
403  pVerScroll->SetRange( Range( 0, aPageSize.Height() ) );
404  aOfs.setY( 0 );
405  pPreview->SetYOffset( 0 );
406  pVerScroll->SetThumbPos( aOfs.Y() );
407  }
408  else if (aOfs.Y() > nMaxVertPos )
409  {
410  // limit offset to align with window bottom
411  pVerScroll->SetRange( Range( 0, aPageSize.Height() ) );
412  aOfs.setY( nMaxVertPos );
414  pVerScroll->SetThumbPos( aOfs.Y() );
415  }
416  }
417 }
418 
419 IMPL_LINK( ScPreviewShell, ScrollHandler, ScrollBar*, pScroll, void )
420 {
421  long nPos = pScroll->GetThumbPos();
422  long nDelta = pScroll->GetDelta();
423  long nMaxRange = pScroll->GetRangeMax();
424  long nTotalPages = pPreview->GetTotalPages();
425  long nPageNo = 0;
426  long nPerPageLength = 0;
427  bool bIsDivide = true;
428 
429  if( nTotalPages )
430  nPerPageLength = nMaxRange / nTotalPages;
431 
432  if( nPerPageLength )
433  {
434  nPageNo = nPos / nPerPageLength;
435  if( nPos % nPerPageLength )
436  {
437  bIsDivide = false;
438  nPageNo ++;
439  }
440  }
441 
442  bool bHoriz = ( pScroll == pHorScroll );
443 
444  if( bHoriz )
445  pPreview->SetXOffset( nPos );
446  else
447  {
448  if( nMaxVertPos > 0 )
449  pPreview->SetYOffset( nPos );
450  else
451  {
452  Point aMousePos = pScroll->OutputToNormalizedScreenPixel( pScroll->GetPointerPosPixel() );
453  Point aPos = pScroll->GetParent()->OutputToNormalizedScreenPixel( pScroll->GetPosPixel() );
454  OUString aHelpStr;
455  tools::Rectangle aRect;
456  QuickHelpFlags nAlign;
457 
458  if( nDelta < 0 )
459  {
460  if ( nTotalPages && nPageNo > 0 && !bIsDivide )
461  pPreview->SetPageNo( nPageNo-1 );
462  if( bIsDivide )
463  pPreview->SetPageNo( nPageNo );
464 
465  aHelpStr = ScResId( STR_PAGE ) +
466  " " + OUString::number( nPageNo ) +
467  " / " + OUString::number( nTotalPages );
468  }
469  else if( nDelta > 0 )
470  {
471  bool bAllTested = pPreview->AllTested();
472  if ( nTotalPages && ( nPageNo < nTotalPages || !bAllTested ) )
473  pPreview->SetPageNo( nPageNo );
474 
475  aHelpStr = ScResId( STR_PAGE ) +
476  " " + OUString::number( nPageNo+1 ) +
477  " / " + OUString::number( nTotalPages );
478  }
479 
480  aRect.SetLeft( aPos.X() - 8 );
481  aRect.SetTop( aMousePos.Y() );
482  aRect.SetRight( aRect.Left() );
483  aRect.SetBottom( aRect.Top() );
484  nAlign = QuickHelpFlags::Bottom|QuickHelpFlags::Center;
485  Help::ShowQuickHelp( pScroll->GetParent(), aRect, aHelpStr, nAlign );
486  }
487  }
488 }
489 
491 {
492  ExitPreview();
493 }
494 
496 {
497  bool bDone = false;
498  const CommandWheelData* pData = rCEvt.GetWheelData();
499  if ( pData && pData->GetMode() == CommandWheelMode::ZOOM )
500  {
501  long nOld = pPreview->GetZoom();
502  long nNew;
503  if ( pData->GetDelta() < 0 )
504  nNew = std::max( long(MINZOOM), basegfx::zoomtools::zoomOut( nOld ));
505  else
506  nNew = std::min( long(MAXZOOM), basegfx::zoomtools::zoomIn( nOld ));
507 
508  if ( nNew != nOld )
509  {
510  eZoom = SvxZoomType::PERCENT;
511  pPreview->SetZoom( static_cast<sal_uInt16>(nNew) );
512  }
513 
514  bDone = true;
515  }
516  else
517  {
519  }
520 
521  return bDone;
522 }
523 
525 {
526  return pDocShell->GetPrinter(bCreate);
527 }
528 
529 sal_uInt16 ScPreviewShell::SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags )
530 {
531  return pDocShell->SetPrinter( pNewPrinter, nDiffFlags );
532 }
533 
535 {
536  return true;
537 }
538 
539 std::unique_ptr<SfxTabPage> ScPreviewShell::CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rOptions)
540 {
542  ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc(RID_SC_TP_PRINT);
543  if ( ScTpPrintOptionsCreate )
544  return ScTpPrintOptionsCreate(pPage, pController, &rOptions);
545  return nullptr;
546 }
547 
549 {
551 
553 
554  if (bMDI)
555  {
556  // InputHdl is now mostly Null, no more assertion!
557  ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
558  if ( pInputHdl )
559  pInputHdl->NotifyChange( nullptr );
560  }
561 }
562 
564 {
565  sal_uInt16 nSlot = rReq.GetSlot();
566  const SfxItemSet* pReqArgs = rReq.GetArgs();
567 
568  switch ( nSlot )
569  {
570  case SID_FORMATPAGE:
571  case SID_STATUS_PAGESTYLE:
572  case SID_HFEDIT:
573  pDocShell->ExecutePageStyle( *this, rReq, pPreview->GetTab() );
574  break;
575  case SID_REPAINT:
576  pPreview->Invalidate();
577  rReq.Done();
578  break;
579  case SID_PREV_TABLE: // Accelerator
580  case SID_PREVIEW_PREVIOUS:
581  {
582  long nPage = pPreview->GetPageNo();
583  long nTotal = pPreview->GetTotalPages();
584  if (nTotal && nPage > 0)
585  pPreview->SetPageNo( nPage-1 );
586  }
587  break;
588  case SID_NEXT_TABLE: // Accelerator
589  case SID_PREVIEW_NEXT:
590  {
591  bool bAllTested = pPreview->AllTested();
592  long nPage = pPreview->GetPageNo();
593  long nTotal = pPreview->GetTotalPages();
594  if (nTotal && (nPage+1 < nTotal || !bAllTested))
595  pPreview->SetPageNo( nPage+1 );
596  }
597  break;
598  case SID_CURSORTOPOFFILE: // Accelerator
599  case SID_PREVIEW_FIRST:
600  {
601  long nPage = pPreview->GetPageNo();
602  long nTotal = pPreview->GetTotalPages();
603  if (nTotal && nPage != 0)
604  pPreview->SetPageNo( 0 );
605  }
606  break;
607  case SID_CURSORENDOFFILE: // Accelerator
608  case SID_PREVIEW_LAST:
609  {
610  if (!pPreview->AllTested())
611  pPreview->CalcAll();
612 
613  long nPage = pPreview->GetPageNo();
614  long nTotal = pPreview->GetTotalPages();
615  if (nTotal && nPage+1 != nTotal)
616  pPreview->SetPageNo( nTotal-1 );
617  }
618  break;
619  case SID_ATTR_ZOOM:
620  case FID_SCALE:
621  {
622  sal_uInt16 nZoom = 100;
623  bool bCancel = false;
624 
625  eZoom = SvxZoomType::PERCENT;
626 
627  if ( pReqArgs )
628  {
629 
630  const SvxZoomItem& rZoomItem = pReqArgs->Get(SID_ATTR_ZOOM);
631 
632  eZoom = rZoomItem.GetType();
633  nZoom = rZoomItem.GetValue();
634  }
635  else
636  {
638  SvxZoomItem aZoomItem( SvxZoomType::PERCENT, pPreview->GetZoom(), SID_ATTR_ZOOM );
639 
640  aSet.Put( aZoomItem );
642  ScopedVclPtr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(nullptr, aSet));
643  pDlg->SetLimits( 20, 400 );
644  pDlg->HideButton( ZoomButtonId::OPTIMAL );
645  bCancel = ( RET_CANCEL == pDlg->Execute() );
646 
647  if ( !bCancel )
648  {
649  const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->
650  Get( SID_ATTR_ZOOM );
651 
652  eZoom = rZoomItem.GetType();
653  nZoom = rZoomItem.GetValue();
654  }
655  }
656 
657  if ( !bCancel )
658  {
659  switch ( eZoom )
660  {
661  case SvxZoomType::OPTIMAL:
662  case SvxZoomType::WHOLEPAGE:
663  nZoom = pPreview->GetOptimalZoom(false);
664  break;
665  case SvxZoomType::PAGEWIDTH:
666  nZoom = pPreview->GetOptimalZoom(true);
667  break;
668  default:
669  {
670  // added to avoid warnings
671  }
672  }
673 
674  pPreview->SetZoom( nZoom );
675  rReq.Done();
676  }
677  }
678  break;
679  case SID_PREVIEW_ZOOMIN:
680  {
681  sal_uInt16 nNew = pPreview->GetZoom() + 20 ;
682  nNew -= nNew % 20;
683  pPreview->SetZoom( nNew );
684  eZoom = SvxZoomType::PERCENT;
685  rReq.Done();
686  }
687  break;
688  case SID_PREVIEW_ZOOMOUT:
689  {
690  sal_uInt16 nNew = pPreview->GetZoom() - 1;
691  nNew -= nNew % 20;
692  pPreview->SetZoom( nNew );
693  eZoom = SvxZoomType::PERCENT;
694  rReq.Done();
695  }
696  break;
697  case SID_PREVIEW_MARGIN:
698  {
699  bool bMargin = pPreview->GetPageMargins();
700  pPreview->SetPageMargins( !bMargin );
701  pPreview->Invalidate();
702  rReq.Done();
703  }
704  break;
705  case SID_ATTR_ZOOMSLIDER:
706  {
707  const SfxPoolItem* pItem;
708  eZoom = SvxZoomType::PERCENT;
709  if( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( SID_ATTR_ZOOMSLIDER, true, &pItem ) )
710  {
711  const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem*>(pItem)->GetValue();
712  if( nCurrentZoom )
713  {
714  pPreview->SetZoom( nCurrentZoom );
715  rReq.Done();
716  }
717  }
718  }
719  break;
720  case SID_PREVIEW_SCALINGFACTOR:
721  {
722  const SfxPoolItem* pItem;
723  SCTAB nTab = pPreview->GetTab();
724  OUString aOldName = pDocShell->GetDocument().GetPageStyle( pPreview->GetTab() );
726  SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SfxStyleFamily::Page );
727  OSL_ENSURE( pStyleSheet, "PageStyle not found! :-/" );
728 
729  if ( pReqArgs && pStyleSheet && SfxItemState::SET == pReqArgs->GetItemState( SID_PREVIEW_SCALINGFACTOR, true, &pItem ) )
730  {
731  const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue();
732  SfxItemSet& rSet = pStyleSheet->GetItemSet();
733  rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALE, nCurrentZoom ) );
734  ScPrintFunc aPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab );
735  aPrintFunc.UpdatePages();
736  rReq.Done();
737  }
738  GetViewFrame()->GetBindings().Invalidate( nSlot );
739  }
740  break;
741  case SID_PRINTPREVIEW:
742  case SID_PREVIEW_CLOSE:
743  // print preview is now always in the same frame as the tab view
744  // -> always switch this frame back to normal view
745  // (ScTabViewShell ctor reads stored view data)
746 
747  ExitPreview();
748  break;
749  case SID_CURSORPAGEUP:
750  case SID_CURSORPAGEDOWN:
751  case SID_CURSORHOME:
752  case SID_CURSOREND:
753  case SID_CURSORUP:
754  case SID_CURSORDOWN:
755  case SID_CURSORLEFT:
756  case SID_CURSORRIGHT:
757  DoScroll( nSlot );
758  break;
759  case SID_CANCEL:
760  if( ScViewUtil::IsFullScreen( *this ) )
761  ScViewUtil::SetFullScreen( *this, false );
762  break;
763 
764  default:
765  break;
766  }
767 }
768 
770 {
771  pPreview->SetInGetState(true);
772 
773  SCTAB nTab = pPreview->GetTab();
774  long nPage = pPreview->GetPageNo();
775  long nTotal = pPreview->GetTotalPages();
776  sal_uInt16 nZoom = pPreview->GetZoom();
777  bool bAllTested = pPreview->AllTested();
778 
779  SfxWhichIter aIter(rSet);
780  sal_uInt16 nWhich = aIter.FirstWhich();
781  while ( nWhich )
782  {
783  switch (nWhich)
784  {
785  case SID_STATUS_PAGESTYLE:
786  case SID_HFEDIT:
787  pDocShell->GetStatePageStyle( rSet, nTab );
788  break;
789  case SID_UNDO:
790  case SID_REDO:
791  case SID_REPEAT:
792  case SID_SAVEDOC:
793  case SID_SAVEASDOC:
794  case SID_MAIL_SENDDOC:
795  case SID_VIEW_DATA_SOURCE_BROWSER:
796  case SID_QUITAPP:
797  rSet.DisableItem(nWhich);
798  break;
799  case SID_PREVIEW_PREVIOUS:
800  case SID_PREVIEW_FIRST:
801  if (!nTotal || nPage==0)
802  rSet.DisableItem(nWhich);
803  break;
804  case SID_PREVIEW_NEXT:
805  case SID_PREVIEW_LAST:
806  if (bAllTested)
807  if (!nTotal || nPage==nTotal-1)
808  rSet.DisableItem(nWhich);
809  break;
810  case SID_PREVIEW_ZOOMIN:
811  if (nZoom >= 400)
812  rSet.DisableItem(nWhich);
813  break;
814  case SID_PREVIEW_ZOOMOUT:
815  if (nZoom <= 20)
816  rSet.DisableItem(nWhich);
817  break;
818  case SID_ATTR_ZOOM:
819  {
820  SvxZoomItem aZoom( eZoom, nZoom, nWhich );
821  aZoom.SetValueSet( SvxZoomEnableFlags::ALL & ~SvxZoomEnableFlags::OPTIMAL );
822  rSet.Put( aZoom );
823  }
824  break;
825  case SID_ATTR_ZOOMSLIDER:
826  {
827  SvxZoomSliderItem aZoomSliderItem( nZoom, MINZOOM, MAXZOOM, SID_ATTR_ZOOMSLIDER );
828  aZoomSliderItem.AddSnappingPoint( 100 );
829  rSet.Put( aZoomSliderItem );
830  }
831  break;
832  case SID_PREVIEW_SCALINGFACTOR:
833  {
834  if( pDocShell->IsReadOnly() )
835  rSet.DisableItem( nWhich );
836  else
837  {
838  OUString aOldName = pDocShell->GetDocument().GetPageStyle( pPreview->GetTab() );
840  SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SfxStyleFamily::Page );
841  OSL_ENSURE( pStyleSheet, "PageStyle not found! :-/" );
842 
843  if ( pStyleSheet )
844  {
845  SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
846  sal_uInt16 nCurrentZoom = rStyleSet.Get(ATTR_PAGE_SCALE).GetValue();
847  if( nCurrentZoom )
848  {
849  SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM_SLIDER, MAXZOOM_SLIDER, SID_PREVIEW_SCALINGFACTOR );
850  aZoomSliderItem.AddSnappingPoint( 100 );
851  rSet.Put( aZoomSliderItem );
852  }
853  else
854  rSet.DisableItem( nWhich );
855  }
856  }
857  }
858  break;
859  case SID_STATUS_DOCPOS:
860  rSet.Put( SfxStringItem( nWhich, pPreview->GetPosString() ) );
861  break;
862  case SID_PRINTPREVIEW:
863  rSet.Put( SfxBoolItem( nWhich, true ) );
864  break;
865  case SID_FORMATPAGE:
866  case SID_PREVIEW_MARGIN:
867  if( pDocShell->IsReadOnly() )
868  rSet.DisableItem( nWhich );
869  break;
870  }
871 
872  nWhich = aIter.NextWhich();
873  }
874 
875  pPreview->SetInGetState(false);
876 }
877 
879 {
880  ScDocument& rDoc = pDocShell->GetDocument();
881  SCTAB nTab = pPreview->GetTab();
882  OUString aTmp;
883  rDoc.GetName(nTab, aTmp);
884  rData.aTabName = aTmp;
885 
886  if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
887  rData.aTitle = pDocShell->getDocProperties()->getTitle();
888  else
889  rData.aTitle = pDocShell->GetTitle();
890 
891  const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
893  if ( !rData.aLongDocName.isEmpty() )
895  else
896  rData.aShortDocName = rData.aLongDocName = rData.aTitle;
897  rData.nPageNo = pPreview->GetPageNo() + 1;
898 
899  bool bAllTested = pPreview->AllTested();
900  if (bAllTested)
902  else
903  rData.nTotalPages = 99;
904 
905  // the dialog knows eNumType
906 }
907 
908 void ScPreviewShell::WriteUserData(OUString& rData, bool /* bBrowse */)
909 {
910  // nZoom
911  // nPageNo
912 
913  rData = OUString::number(pPreview->GetZoom())
914  + OUStringChar(SC_USERDATA_SEP)
915  + OUString::number(pPreview->GetPageNo());
916 }
917 
918 void ScPreviewShell::ReadUserData(const OUString& rData, bool /* bBrowse */)
919 {
920  if (!rData.isEmpty())
921  {
922  sal_Int32 nIndex = 0;
923  pPreview->SetZoom(static_cast<sal_uInt16>(rData.getToken(0, SC_USERDATA_SEP, nIndex).toInt32()));
924  pPreview->SetPageNo(rData.getToken(0, SC_USERDATA_SEP, nIndex).toInt32());
925  eZoom = SvxZoomType::PERCENT;
926  }
927 }
928 
929 void ScPreviewShell::WriteUserDataSequence(uno::Sequence < beans::PropertyValue >& rSeq)
930 {
931  // tdf#130559: don't export preview view data if active
932  if (comphelper::IsContextFlagActive("NoPreviewData"))
933  return;
934 
935  rSeq.realloc(3);
936  beans::PropertyValue* pSeq = rSeq.getArray();
937  sal_uInt16 nViewID(GetViewFrame()->GetCurViewId());
938  pSeq[0].Name = SC_VIEWID;
939  pSeq[0].Value <<= SC_VIEW + OUString::number(nViewID);
940  pSeq[1].Name = SC_ZOOMVALUE;
941  pSeq[1].Value <<= sal_Int32 (pPreview->GetZoom());
942  pSeq[2].Name = "PageNumber";
943  pSeq[2].Value <<= pPreview->GetPageNo();
944 
945  // Common SdrModel processing
946  if (ScDrawLayer* pDrawLayer = GetDocument().GetDrawLayer())
947  pDrawLayer->WriteUserDataSequence(rSeq);
948 }
949 
950 void ScPreviewShell::ReadUserDataSequence(const uno::Sequence < beans::PropertyValue >& rSeq)
951 {
952  for (const auto& propval : rSeq)
953  {
954  if (propval.Name == SC_ZOOMVALUE)
955  {
956  sal_Int32 nTemp = 0;
957  if (propval.Value >>= nTemp)
958  pPreview->SetZoom(sal_uInt16(nTemp));
959  }
960  else if (propval.Name == "PageNumber")
961  {
962  sal_Int32 nTemp = 0;
963  if (propval.Value >>= nTemp)
964  pPreview->SetPageNo(nTemp);
965  }
966  // Fallback to common SdrModel processing
967  else
969  }
970 }
971 
972 void ScPreviewShell::DoScroll( sal_uInt16 nMode )
973 {
974  Point aCurPos, aPrevPos;
975 
976  long nHRange = pHorScroll->GetRange().Max();
977  long nHLine = pHorScroll->GetLineSize();
978  long nHPage = pHorScroll->GetPageSize();
979  long nVRange = pVerScroll->GetRange().Max();
980  long nVLine = pVerScroll->GetLineSize();
981  long nVPage = pVerScroll->GetPageSize();
982 
983  aCurPos.setX( pHorScroll->GetThumbPos() );
984  aCurPos.setY( pVerScroll->GetThumbPos() );
985  aPrevPos = aCurPos;
986 
987  long nThumbPos = pVerScroll->GetThumbPos();
988  long nRangeMax = pVerScroll->GetRangeMax();
989 
990  switch( nMode )
991  {
992  case SID_CURSORUP:
993  if( nMaxVertPos<0 )
994  {
995  long nPage = pPreview->GetPageNo();
996 
997  if( nPage>0 )
998  {
999  SfxViewFrame* pSfxViewFrame = GetViewFrame();
1000  SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_PREVIOUS );
1001  Execute( aSfxRequest );
1002  }
1003  }
1004  else
1005  aCurPos.AdjustY( -nVLine );
1006  break;
1007  case SID_CURSORDOWN:
1008  if( nMaxVertPos<0 )
1009  {
1010  long nPage = pPreview->GetPageNo();
1011  long nTotal = pPreview->GetTotalPages();
1012 
1013  // before testing for last page, make sure all page counts are calculated
1014  if ( nPage+1 == nTotal && !pPreview->AllTested() )
1015  {
1016  pPreview->CalcAll();
1017  nTotal = pPreview->GetTotalPages();
1018  }
1019 
1020  if( nPage<nTotal-1 )
1021  {
1022  SfxViewFrame* pSfxViewFrame = GetViewFrame();
1023  SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_NEXT );
1024  Execute( aSfxRequest );
1025  }
1026  }
1027  else
1028  aCurPos.AdjustY(nVLine );
1029  break;
1030  case SID_CURSORLEFT:
1031  aCurPos.AdjustX( -nHLine );
1032  break;
1033  case SID_CURSORRIGHT:
1034  aCurPos.AdjustX(nHLine );
1035  break;
1036  case SID_CURSORPAGEUP:
1037  if( nThumbPos==0 || nMaxVertPos<0 )
1038  {
1039  long nPage = pPreview->GetPageNo();
1040 
1041  if( nPage>0 )
1042  {
1043  SfxViewFrame* pSfxViewFrame = GetViewFrame();
1044  SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_PREVIOUS );
1045  Execute( aSfxRequest );
1046  aCurPos.setY( nVRange );
1047  }
1048  }
1049  else
1050  aCurPos.AdjustY( -nVPage );
1051  break;
1052  case SID_CURSORPAGEDOWN:
1053  if( (std::abs(nVPage+nThumbPos-nRangeMax)<10) || nMaxVertPos<0 )
1054  {
1055  long nPage = pPreview->GetPageNo();
1056  long nTotal = pPreview->GetTotalPages();
1057 
1058  // before testing for last page, make sure all page counts are calculated
1059  if ( nPage+1 == nTotal && !pPreview->AllTested() )
1060  {
1061  pPreview->CalcAll();
1062  nTotal = pPreview->GetTotalPages();
1063  }
1064  if( nPage<nTotal-1 )
1065  {
1066  SfxViewFrame* pSfxViewFrame = GetViewFrame();
1067  SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_NEXT );
1068  Execute( aSfxRequest );
1069  aCurPos.setY( 0 );
1070  }
1071  }
1072  else
1073  aCurPos.AdjustY(nVPage );
1074  break;
1075  case SID_CURSORHOME:
1076  if( nMaxVertPos<0 )
1077  {
1078  long nPage = pPreview->GetPageNo();
1079  long nTotal = pPreview->GetTotalPages();
1080  if( nTotal && nPage != 0 )
1081  {
1082  SfxViewFrame* pSfxViewFrame = GetViewFrame();
1083  SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_FIRST );
1084  Execute( aSfxRequest );
1085  }
1086  }
1087  else
1088  {
1089  aCurPos.setY( 0 );
1090  aCurPos.setX( 0 );
1091  }
1092  break;
1093  case SID_CURSOREND:
1094  if( nMaxVertPos<0 )
1095  {
1096  if( !pPreview->AllTested() )
1097  pPreview->CalcAll();
1098  long nPage = pPreview->GetPageNo();
1099  long nTotal = pPreview->GetTotalPages();
1100  if( nTotal && nPage+1 != nTotal )
1101  {
1102  SfxViewFrame* pSfxViewFrame = GetViewFrame();
1103  SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_LAST );
1104  Execute( aSfxRequest );
1105  }
1106  }
1107  else
1108  {
1109  aCurPos.setY( nVRange );
1110  aCurPos.setX( nHRange );
1111  }
1112  break;
1113  }
1114 
1115  // nHRange-nHPage might be negative, that's why we check for < 0 afterwards
1116 
1117  if( aCurPos.Y() > (nVRange-nVPage) )
1118  aCurPos.setY( nVRange-nVPage );
1119  if( aCurPos.Y() < 0 )
1120  aCurPos.setY( 0 );
1121  if( aCurPos.X() > (nHRange-nHPage) )
1122  aCurPos.setX( nHRange-nHPage );
1123  if( aCurPos.X() < 0 )
1124  aCurPos.setX( 0 );
1125 
1126  if( nMaxVertPos>=0 )
1127  {
1128  if( aCurPos.Y() != aPrevPos.Y() )
1129  {
1130  pVerScroll->SetThumbPos( aCurPos.Y() );
1131  pPreview->SetYOffset( aCurPos.Y() );
1132  }
1133  }
1134 
1135  if( aCurPos.X() != aPrevPos.X() )
1136  {
1137  pHorScroll->SetThumbPos( aCurPos.X() );
1138  pPreview->SetXOffset( aCurPos.X() );
1139  }
1140 
1141 }
1142 
1144 {
1145  GetViewFrame()->GetDispatcher()->Execute(SID_VIEWSHELL0, SfxCallMode::ASYNCHRON);
1146 }
1147 
1149 {
1152 
1154 }
1155 
1157 {
1160  else
1161  {
1162  OSL_FAIL("no accessibility broadcaster?");
1163  }
1164 }
1165 
1167 {
1169  pAccessibilityBroadcaster->Broadcast( rHint );
1170 }
1171 
1173 {
1174  return pAccessibilityBroadcaster && pAccessibilityBroadcaster->HasListeners();
1175 }
1176 
1178 {
1179  return pPreview->GetLocationData();
1180 }
1181 
1183 {
1184  return pDocShell->GetDocument();
1185 }
1186 
1187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
If set, cloned formula cells will start to listen to the document.
#define MAXZOOM
Definition: global.hxx:76
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3053
virtual Point GetPosPixel() const
bool GetPageSize(Size &aPageSize)
Definition: prevwsh.cxx:254
SfxViewFrame * GetViewFrame() const
SC_DLLPUBLIC long GetFirstPage(SCTAB nTab)
Definition: preview.cxx:752
long Width() const
OUString aLongDocName
Definition: editutil.hxx:207
const ScPreviewLocationData & GetLocationData()
Definition: prevwsh.cxx:1177
long GetTotalPages()
Definition: preview.hxx:145
void AddAccessibilityObject(SfxListener &rObject)
Definition: prevwsh.cxx:1148
sal_Int32 nIndex
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: docsh3.cxx:450
SystemWindow * GetSystemWindow() const
constexpr TypedWhichId< SvxSizeItem > ATTR_PAGE_SIZE(161)
Range GetRange() const
#define SFX_IMPL_INTERFACE(Class, SuperClass)
OUString GetPosString()
Definition: preview.cxx:698
void ExecutePageStyle(const SfxViewShell &rCaller, SfxRequest &rReq, SCTAB nCurTab)
Definition: docsh4.cxx:1755
SCTAB GetTab()
Definition: preview.hxx:144
long AdjustWidth(long n)
OUString GetTitle(sal_uInt16 nMaxLen=0) const
long zoomIn(long nCurrent)
virtual void WriteUserData(OUString &, bool bBrowse=false) override
Definition: prevwsh.cxx:908
std::unique_ptr< ContentProperties > pData
std::string GetValue
long Height() const
void SetZoom(sal_uInt16 nNewZoom)
Definition: preview.cxx:715
sal_uInt16 GetOptimalZoom(bool bWidthOnly)
Definition: preview.cxx:795
virtual std::unique_ptr< SfxTabPage > CreatePrintOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rOptions) override
Definition: prevwsh.cxx:539
SfxDispatcher * GetDispatcher()
static SvxAbstractDialogFactory * Create()
virtual ~ScPreviewShell() override
Definition: prevwsh.cxx:198
void disposeAndClear()
void SetPageMargins(bool bVal)
Definition: preview.hxx:132
const StyleSettings & GetStyleSettings() const
virtual void SetSizePixel(const Size &rNewSize)
virtual bool HasPrintOptionsPage() const override
Definition: prevwsh.cxx:534
sal_uInt16 FirstWhich()
VclPtr< ScrollBar > pVerScroll
Definition: prevwsh.hxx:47
const ContentProperties & rData
long GetThumbPos() const
const MapMode & GetMapMode() const
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
void Done(bool bRemove=false)
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static bool IsFullScreen(const SfxViewShell &rViewShell)
Returns true, if the passed view shell is in full screen mode.
Definition: viewutil.cxx:332
WinBits const WB_VSCROLL
virtual SfxItemSet & GetItemSet()
const CommandWheelData * GetWheelData() const
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
void SetXOffset(long nX)
Definition: preview.cxx:829
bool HandleScrollCommand(const CommandEvent &rCmd, ScrollBar *pHScrl, ScrollBar *pVScrl)
TRISTATE_TRUE
long AdjustHeight(long n)
RET_CANCEL
virtual void ReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &) override
Definition: prevwsh.cxx:950
void Execute(SfxRequest &rReq)
Definition: prevwsh.cxx:563
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
sal_uInt16 NextWhich()
virtual void ReadUserData(const OUString &, bool bBrowse=false) override
Definition: prevwsh.cxx:918
SfxApplication * SfxGetpApp()
static OutputDevice * GetDefaultDevice()
static void SetFullScreen(const SfxViewShell &rViewShell, bool bSet)
Enters or leaves full screen mode at the passed view shell.
Definition: viewutil.cxx:344
IMPL_LINK(ScPreviewShell, ScrollHandler, ScrollBar *, pScroll, void)
Definition: prevwsh.cxx:419
void AddSnappingPoint(sal_Int32 nNew)
vcl::Window & GetWindow() const
SfxPrinterChangeFlags
VclPtr< vcl::Window > pCorner
Definition: prevwsh.hxx:48
#define SC_VIEWID
WinBits const WB_HSCROLL
SfxViewShellFlags
void DoScroll(sal_uInt16 nMode)
Definition: prevwsh.cxx:972
VclPtr< ScrollBar > pHorScroll
Definition: prevwsh.hxx:46
#define HMM_PER_TWIPS
Definition: global.hxx:91
void SetCloseHdl(const Link< SystemWindow &, void > &rLink)
OUString aShortDocName
Definition: editutil.hxx:208
bool ScrollCommand(const CommandEvent &rCEvt)
Definition: prevwsh.cxx:495
long Top() const
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize) override
Definition: prevwsh.cxx:249
void CalcAll()
Definition: preview.hxx:152
VclPtr< NotebookBar > const & GetNotebookBar() const
sal_uInt16 SetPrinter(VclPtr< SfxPrinter > const &pNewPrinter, SfxPrinterChangeFlags nDiffFlags=SFX_PRINTER_ALL)
Definition: docsh3.cxx:470
SC_DLLPUBLIC void SetSelectedTabs(const ScMarkData &rMark)
Definition: preview.cxx:1565
TRISTATE_INDET
VclPtr< ScPreview > pPreview
Definition: prevwsh.hxx:45
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:166
bool SetContextBroadcasterEnabled(const bool bIsEnabled)
SvxZoomType eZoom
Definition: prevwsh.hxx:51
SfxItemPool & GetPool() const
void BroadcastAccessibility(const SfxHint &rHint)
Definition: prevwsh.cxx:1166
bool UpdatePages()
Definition: printfun.cxx:2397
void SetTop(long v)
long GetLineSize() const
void SetWindow(vcl::Window *pViewPort)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
bool IsSystemWindow() const
void SetVisibleSize(long nNewSize)
#define SC_MOD()
Definition: scmod.hxx:253
SfxBindings & GetBindings()
CommandWheelMode GetMode() const
void SetRange(const Range &rRange)
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
TRISTATE_FALSE
Size GetOutputSize() const
OUString aTabName
Definition: editutil.hxx:209
QuickHelpFlags
void ControlListenerForCurrentController(bool bListen)
void SetRight(long v)
SFX_IMPL_NAMED_VIEWFACTORY(ScPreviewShell,"PrintPreview")
Definition: prevwsh.cxx:96
IMPL_LINK_NOARG(ScPreviewShell, CloseHdl, SystemWindow &, void)
Definition: prevwsh.cxx:490
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
void UpdateScrollBars()
Definition: prevwsh.cxx:343
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6188
#define MINZOOM_SLIDER
Definition: prevwsh.cxx:72
void GetState(SfxItemSet &rSet)
Definition: prevwsh.cxx:769
void SetPageSize(long nNewSize)
#define SC_USERDATA_SEP
Definition: prevwsh.cxx:75
virtual void Activate(bool IsMDIActivate) override
const AllSettings & GetSettings() const
Size GetOutputSizePixel() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
long GetPageSize() const
TriState nSourceDesignMode
Definition: prevwsh.hxx:50
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
#define SFX_VIEW_REGISTRATION(DocClass)
long nMaxVertPos
Definition: prevwsh.hxx:52
vcl::Window * GetParent() const
const ScPreviewLocationData & GetLocationData()
Definition: preview.cxx:672
void GetStatePageStyle(SfxItemSet &rSet, SCTAB nCurTab)
Definition: docsh4.cxx:1974
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize, bool inplaceEditModeChange) override
Definition: prevwsh.cxx:244
bool IsReadOnly() const
#define SFX_OBJECTBAR_OBJECT
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
ScDocShell * pDocShell
Definition: prevwsh.hxx:42
void SetLineSize(long nNewSize)
Point PixelToLogic(const Point &rDevicePt) const
void SetInGetState(bool bSet)
Definition: preview.hxx:153
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
VclPtr< SystemWindow > mpFrameWindow
Definition: prevwsh.hxx:44
WinBits const WB_SIZEABLE
void AdjustPosSizePixel(const Point &rPos, const Size &rSize)
Definition: prevwsh.cxx:231
ScPreviewShell(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh)
Definition: prevwsh.cxx:147
#define SC_ZOOMVALUE
long Max() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
static const OUString & GetContextName(const Context eContext)
sal_uInt16 GetZoom() const
Definition: preview.hxx:141
#define MAXZOOM_SLIDER
Definition: prevwsh.cxx:73
void DisableItem(sal_uInt16 nWhich)
long GetDelta() const
void RemoveAccessibilityObject(SfxListener &rObject)
Definition: prevwsh.cxx:1156
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
long GetRangeMax() const
void SetValueSet(SvxZoomEnableFlags nValues)
long zoomOut(long nCurrent)
bool IsContextFlagActive(const OUString &sName)
SvxZoomType GetType() const
static SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
bool IsVisible() const
void Construct(vcl::Window *pParent)
Definition: prevwsh.cxx:101
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:38
void InitStartTable(SCTAB nTab)
Definition: prevwsh.cxx:226
static VclPtr< reference_type > Create(Arg &&...arg)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
void SetBottom(long v)
SfxBroadcaster * GetDrawBroadcaster()
Definition: documen9.cxx:53
void NotifyChange(const ScInputHdlState *pState, bool bForce=false, ScTabViewShell *pSourceSh=nullptr, bool bStopEditing=true)
Definition: inputhdl.cxx:3937
const INetURLObject & GetURLObject() const
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
bool AllTested() const
Definition: preview.hxx:147
ScDocument & GetDocument()
Definition: prevwsh.cxx:1182
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
vcl::Window * GetWindow() const
long Left() const
virtual void Activate(bool bMDI) override
Definition: prevwsh.cxx:548
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6068
bool HasAccessibilityObjects() const
Definition: prevwsh.cxx:1172
bool GetPageMargins() const
Definition: preview.hxx:131
void SetLeft(long v)
#define SAL_WARN(area, stream)
void FillFieldData(ScHeaderFieldData &rData)
Definition: prevwsh.cxx:878
#define MINZOOM
Definition: global.hxx:75
SC_DLLPUBLIC void SetPageNo(long nPage)
Definition: preview.cxx:743
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
void ExitPreview()
Definition: prevwsh.cxx:1143
long GetScrollBarSize() const
virtual SfxPrinter * GetPrinter(bool bCreate=false) override
Definition: prevwsh.cxx:524
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(174)
void BroadcastContextForActivation(const bool bIsActivated)
void UpdateNeededScrollBars(bool bFromZoom)
Definition: prevwsh.cxx:272
virtual sal_uInt16 SetPrinter(SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags=SFX_PRINTER_ALL) override
Definition: prevwsh.cxx:529
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
void setWidth(long nWidth)
void SetContextName(const OUString &rsContextName)
void SetYOffset(long nY)
Definition: preview.cxx:856
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:212
void ReadUserDataSequenceValue(const css::beans::PropertyValue *pValue)
const Point & GetOffset() const
Definition: preview.hxx:142
void SetThumbPos(long nThumbPos)
virtual VclPtr< AbstractSvxZoomDialog > CreateSvxZoomDialog(weld::Window *pParent, const SfxItemSet &rCoreSet)=0
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
std::unique_ptr< SfxBroadcaster > pAccessibilityBroadcaster
Definition: prevwsh.hxx:54
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &) override
Definition: prevwsh.cxx:929
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
long GetPageNo() const
Definition: preview.hxx:140
void setHeight(long nHeight)
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
SfxMedium * GetMedium() const