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