LibreOffice Module sc (master) 1
preview.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 <scitems.hxx>
21#include <editeng/eeitem.hxx>
22
23#include <officecfg/Office/Common.hxx>
24#include <svtools/colorcfg.hxx>
25#include <svx/fmview.hxx>
26#include <editeng/sizeitem.hxx>
27#include <svx/svdpagv.hxx>
28#include <sfx2/bindings.hxx>
29#include <sfx2/viewfrm.hxx>
30#include <sfx2/dispatch.hxx>
31#include <svl/itemset.hxx>
32#include <tools/multisel.hxx>
33#include <vcl/commandevent.hxx>
34#include <vcl/settings.hxx>
35#include <o3tl/deleter.hxx>
37
38#include <preview.hxx>
39#include <prevwsh.hxx>
40#include <prevloc.hxx>
41#include <docsh.hxx>
42#include <docfunc.hxx>
43#include <printfun.hxx>
44#include <printopt.hxx>
45#include <stlpool.hxx>
46#include <undostyl.hxx>
47#include <drwlayer.hxx>
48#include <scmod.hxx>
49#include <markdata.hxx>
50#include <globstr.hrc>
51#include <scresid.hxx>
52#include <sc.hrc>
53#include <helpids.h>
55#include <editeng/lrspitem.hxx>
56#include <editeng/ulspitem.hxx>
57#include <editeng/colritem.hxx>
58#include <editeng/fhgtitem.hxx>
59#include <com/sun/star/accessibility/XAccessible.hpp>
61#include <vcl/svapp.hxx>
62#include <viewutil.hxx>
63#include <docpool.hxx>
64#include <patattr.hxx>
65#include <columnspanset.hxx>
66
67#include <memory>
68
69#define SC_PREVIEW_SHADOWSIZE 2
70
71static tools::Long lcl_GetDisplayStart( SCTAB nTab, const ScDocument* pDoc, std::vector<tools::Long>& nPages )
72{
73 tools::Long nDisplayStart = 0;
74 for (SCTAB i=0; i<nTab; i++)
75 {
76 if ( pDoc->NeedPageResetAfterTab(i) )
77 nDisplayStart = 0;
78 else
79 nDisplayStart += nPages[i];
80 }
81 return nDisplayStart;
82}
83
85 Window( pParent ),
86 nPageNo( 0 ),
87 nZoom( 100 ),
88 nTabCount( 0 ),
89 nTabsTested( 0 ),
90 nTab( 0 ),
91 nTabPage( 0 ),
92 nTabStart( 0 ),
93 nDisplayStart( 0 ),
94 aDateTime( DateTime::SYSTEM ),
95 nTotalPages( 0 ),
96 pDocShell( pDocSh ),
97 pViewShell( pViewSh ),
98 bInGetState( false ),
99 bValid( false ),
100 bStateValid( false ),
101 bLocationValid( false ),
102 bInPaint( false ),
103 bInSetZoom( false ),
104 bLeftRulerMove( false ),
105 bRightRulerMove( false ),
106 bTopRulerMove( false ),
107 bBottomRulerMove( false ),
108 bHeaderRulerMove( false ),
109 bFooterRulerMove( false ),
110 bLeftRulerChange( false ),
111 bRightRulerChange( false ),
112 bTopRulerChange( false ),
113 bBottomRulerChange( false ),
114 bHeaderRulerChange( false ),
115 bFooterRulerChange( false ),
116 bPageMargin ( false ),
117 bColRulerMove( false ),
118 mbHasEmptyRangeTable(false),
119 nLeftPosition( 0 ),
120 mnScale( 0 ),
121 nColNumberButtonDown( 0 ),
122 nHeaderHeight ( 0 ),
123 nFooterHeight ( 0 )
124{
125 GetOutDev()->SetOutDevViewType( OutDevViewType::PrintPreview );
127
129
131}
132
134{
135 disposeOnce();
136}
137
139{
140 pDrawView.reset();
141 pLocationData.reset();
143}
144
145void ScPreview::UpdateDrawView() // nTab must be right
146{
148 ScDrawLayer* pModel = rDoc.GetDrawLayer(); // is not 0
149
150 if ( pModel )
151 {
152 SdrPage* pPage = pModel->GetPage(nTab);
153 if ( pDrawView && ( !pDrawView->GetSdrPageView() || pDrawView->GetSdrPageView()->GetPage() != pPage ) )
154 {
155 // convert the displayed Page of drawView (see below) does not work?!?
156 pDrawView.reset();
157 }
158
159 if ( !pDrawView ) // New Drawing?
160 {
161 pDrawView.reset( new FmFormView( *pModel, GetOutDev()) );
162
163 // The DrawView takes over the Design-Mode from the Model
164 // (Settings "In opening Draftmode"), therefore to restore here
165 pDrawView->SetDesignMode();
166 pDrawView->SetPrintPreview();
167 pDrawView->ShowSdrPage(pPage);
168 }
169 }
170 else if ( pDrawView )
171 {
172 pDrawView.reset(); // for this Chart is not needed
173 }
174}
175
177{
178 if (nPageNo < nTotalPages)
179 return;
180
181 if (nTotalPages)
182 {
183 nPageNo = nTotalPages - 1;
184 nTab = static_cast<SCTAB>(nPages.size()) -1;
185 while (nTab > 0 && !nPages[nTab]) // not the last empty Table
186 --nTab;
187 OSL_ENSURE(0 < static_cast<SCTAB>(nPages.size()),"are all tables empty?");
188 nTabPage = nPages[nTab] - 1;
189 nTabStart = 0;
190 for (sal_uInt16 i=0; i<nTab; i++)
191 nTabStart += nPages[i];
192
195 }
196 else // empty Document
197 {
198 nTab = 0;
200 aState.nPrintTab = 0;
203 aState.nZoom = 0;
207 }
208}
209
211{
213
215 nTabCount = rDoc.GetTableCount();
216
217 if (maSelectedTabs.empty())
218 {
219 SCTAB nCurrentTab = ScDocShell::GetCurTab();
220 maSelectedTabs.insert(nCurrentTab);
221 }
222
223 SCTAB nStart = nTabsTested;
224 if (!bValid)
225 {
226 nStart = 0;
227 nTotalPages = 0;
228 nTabsTested = 0;
229 }
230
231 // update all pending row heights with a single progress bar,
232 // instead of a separate progress for each sheet from ScPrintFunc
234
235 // PrintOptions is passed to PrintFunc for SkipEmpty flag,
236 // but always all sheets are used (there is no selected sheet)
237 ScPrintOptions aOptions = SC_MOD()->GetPrintOptions();
238
239 while (nStart > static_cast<SCTAB>(nPages.size()))
240 nPages.push_back(0);
241 while (nStart > static_cast<SCTAB>(nFirstAttr.size()))
242 nFirstAttr.push_back(1);
243
244 for (SCTAB i=nStart; i<nTabCount; i++)
245 {
246 if ( i == static_cast<SCTAB>(nPages.size()))
247 nPages.push_back(0);
248 if ( i == static_cast<SCTAB>(nFirstAttr.size()))
249 nFirstAttr.push_back(1);
250 if (!aOptions.GetAllSheets() && maSelectedTabs.count(i) == 0)
251 {
252 nPages[i] = 0;
253 nFirstAttr[i] = 1;
254 continue;
255 }
256
257 tools::Long nAttrPage = i > 0 ? nFirstAttr[i-1] : 1;
258
259 tools::Long nThisStart = nTotalPages;
260 ScPrintFunc aPrintFunc( GetOutDev(), pDocShell, i, nAttrPage, 0, nullptr, &aOptions );
261 tools::Long nThisTab = aPrintFunc.GetTotalPages();
262 if (!aPrintFunc.HasPrintRange())
264
265 nPages[i] = nThisTab;
266 nTotalPages += nThisTab;
267 nFirstAttr[i] = aPrintFunc.GetFirstPageNo(); // to keep or from template
268
269 if (nPageNo>=nThisStart && nPageNo<nTotalPages)
270 {
271 nTab = i;
272 nTabPage = nPageNo - nThisStart;
273 nTabStart = nThisStart;
274
275 aPrintFunc.GetPrintState( aState );
276 }
277 }
278
280
283
284 TestLastPage();
285
287
288 bValid = true;
289 bStateValid = true;
290 DoInvalidate();
291}
292
293void ScPreview::RecalcPages() // only nPageNo is changed
294{
295 if (!bValid)
296 return; // then CalcPages is called
297
298 SCTAB nOldTab = nTab;
299
300 bool bDone = false;
302 {
303 CalcPages();
304 bDone = true;
305 }
306
307 if (!bDone)
308 {
309 tools::Long nPartPages = 0;
310 for (SCTAB i=0; i<nTabsTested && nTab < static_cast<SCTAB>(nPages.size()); i++)
311 {
312 tools::Long nThisStart = nPartPages;
313 nPartPages += nPages[i];
314
315 if (nPageNo>=nThisStart && nPageNo<nPartPages)
316 {
317 nTab = i;
318 nTabPage = nPageNo - nThisStart;
319 nTabStart = nThisStart;
320 }
321 }
322
325 }
326
327 TestLastPage(); // to test, if after last page
328
329 if ( nTab != nOldTab )
330 bStateValid = false;
331
332 DoInvalidate();
333}
334
336{
337 if (!bValid)
338 {
339 CalcPages();
340 RecalcPages();
341 UpdateDrawView(); // Spreadsheet eventually changes
342 }
343
344 Fraction aPreviewZoom( nZoom, 100 );
345 Fraction aHorPrevZoom( static_cast<tools::Long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
346 MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
347
348 bool bDoPrint = ( pFillLocation == nullptr );
349 bool bValidPage = ( nPageNo < nTotalPages );
350
351 ScModule* pScMod = SC_MOD();
352 const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig();
353 Color aBackColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor );
354
355 if ( bDoPrint && ( aOffset.X() < 0 || aOffset.Y() < 0 ) && bValidPage )
356 {
357 SetMapMode( aMMMode );
359 GetOutDev()->SetFillColor(aBackColor);
360
361 Size aWinSize = GetOutDev()->GetOutputSize();
362 if ( aOffset.X() < 0 )
363 GetOutDev()->DrawRect(tools::Rectangle( 0, 0, -aOffset.X(), aWinSize.Height() ));
364 if ( aOffset.Y() < 0 )
365 GetOutDev()->DrawRect(tools::Rectangle( 0, 0, aWinSize.Width(), -aOffset.Y() ));
366 }
367
372 bool bHeaderOn = false;
373 bool bFooterOn = false;
374
376 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
377
378 Size aLocalPageSize;
379 if ( bValidPage )
380 {
381 ScPrintOptions aOptions = pScMod->GetPrintOptions();
382
383 std::unique_ptr<ScPrintFunc, o3tl::default_delete<ScPrintFunc>> pPrintFunc;
384 if (bStateValid)
385 pPrintFunc.reset(new ScPrintFunc(GetOutDev(), pDocShell, aState, &aOptions));
386 else
387 pPrintFunc.reset(new ScPrintFunc(GetOutDev(), pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions));
388
389 pPrintFunc->SetOffset(aOffset);
390 pPrintFunc->SetManualZoom(nZoom);
391 pPrintFunc->SetDateTime(aDateTime);
392 pPrintFunc->SetClearFlag(true);
393 pPrintFunc->SetUseStyleColor( officecfg::Office::Common::Accessibility::IsForPagePreviews::get() );
394
395 pPrintFunc->SetDrawView( pDrawView.get() );
396
397 // MultiSelection for the one Page must produce something inconvenient
398 Range aPageRange( nPageNo+1, nPageNo+1 );
399 MultiSelection aPage( aPageRange );
400 aPage.SetTotalRange( Range(0,RANGE_MAX) );
401 aPage.Select( aPageRange );
402
403 tools::Long nPrinted = pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, bDoPrint, pFillLocation );
404 OSL_ENSURE(nPrinted<=1, "What is happening?");
405
406 SetMapMode(aMMMode);
407
408 //init nLeftMargin ... in the ScPrintFunc::InitParam!!!
409 nLeftMargin = pPrintFunc->GetLeftMargin();
410 nRightMargin = pPrintFunc->GetRightMargin();
411 nTopMargin = pPrintFunc->GetTopMargin();
412 nBottomMargin = pPrintFunc->GetBottomMargin();
413 nHeaderHeight = pPrintFunc->GetHeader().nHeight;
414 nFooterHeight = pPrintFunc->GetFooter().nHeight;
415 bHeaderOn = pPrintFunc->GetHeader().bEnable;
416 bFooterOn = pPrintFunc->GetFooter().bEnable;
417 mnScale = pPrintFunc->GetZoom();
418
419 if ( bDoPrint && bPageMargin && pLocationData ) // don't make use of pLocationData while filling it
420 {
421 tools::Rectangle aPixRect;
422 tools::Rectangle aRectCellPosition;
423 tools::Rectangle aRectPosition;
424 pLocationData->GetMainCellRange( aPageArea, aPixRect );
425 mvRight.resize(aPageArea.aEnd.Col()+1);
426 if( !bLayoutRTL )
427 {
428 pLocationData->GetCellPosition( aPageArea.aStart, aRectPosition );
429 nLeftPosition = aRectPosition.Left();
430 for( SCCOL i = aPageArea.aStart.Col(); i <= aPageArea.aEnd.Col(); i++ )
431 {
432 pLocationData->GetCellPosition( ScAddress( i,aPageArea.aStart.Row(),aPageArea.aStart.Tab()),aRectCellPosition );
433 mvRight[i] = aRectCellPosition.Right();
434 }
435 }
436 else
437 {
438 pLocationData->GetCellPosition( aPageArea.aEnd, aRectPosition );
439 nLeftPosition = aRectPosition.Right()+1;
440
441 pLocationData->GetCellPosition( aPageArea.aStart,aRectCellPosition );
442 mvRight[ aPageArea.aEnd.Col() ] = aRectCellPosition.Left();
443 for( SCCOL i = aPageArea.aEnd.Col(); i > aPageArea.aStart.Col(); i-- )
444 {
445 pLocationData->GetCellPosition( ScAddress( i,aPageArea.aEnd.Row(),aPageArea.aEnd.Tab()),aRectCellPosition );
446 mvRight[ i-1 ] = mvRight[ i ] + aRectCellPosition.Right() - aRectCellPosition.Left() + 1;
447 }
448 }
449 }
450
451 if (nPrinted) // if not, draw everything grey
452 {
453 aLocalPageSize = pPrintFunc->GetPageSize();
454 aLocalPageSize.setWidth(
456 aLocalPageSize.setHeight(
458
463 constexpr auto md = o3tl::getConversionMulDiv(o3tl::Length::twip, o3tl::Length::mm10);
464 const auto m = md.first * mnScale, d = md.second * 100;
467 }
468
469 if (!bStateValid)
470 {
471 pPrintFunc->GetPrintState( aState );
473 bStateValid = true;
474 }
475 }
476
477 if ( !bDoPrint )
478 return;
479
480 tools::Long nPageEndX = aLocalPageSize.Width() - aOffset.X();
481 tools::Long nPageEndY = aLocalPageSize.Height() - aOffset.Y();
482 if ( !bValidPage )
483 nPageEndX = nPageEndY = 0;
484
485 Size aWinSize = GetOutDev()->GetOutputSize();
486 Point aWinEnd( aWinSize.Width(), aWinSize.Height() );
487 bool bRight = nPageEndX <= aWinEnd.X();
488 bool bBottom = nPageEndY <= aWinEnd.Y();
489
490 if (!nTotalPages)
491 {
492 // There is no data to print. Print a friendly warning message and
493 // bail out.
494
495 SetMapMode(aMMMode);
496
497 // Draw background first.
499 GetOutDev()->SetFillColor(aBackColor);
500 GetOutDev()->DrawRect(tools::Rectangle(0, 0, aWinEnd.X(), aWinEnd.Y()));
501
502 const ScPatternAttr& rDefPattern =
504
505 std::unique_ptr<ScEditEngineDefaulter> pEditEng(
507
508 pEditEng->SetRefMapMode(aMMMode);
509 auto pEditDefaults = std::make_unique<SfxItemSet>( pEditEng->GetEmptyItemSet() );
510 rDefPattern.FillEditItemSet(pEditDefaults.get());
511 pEditDefaults->Put(SvxColorItem(COL_LIGHTGRAY, EE_CHAR_COLOR));
512 pEditEng->SetDefaults(std::move(pEditDefaults));
513
514 OUString aEmptyMsg;
516 aEmptyMsg = ScResId(STR_PRINT_PREVIEW_EMPTY_RANGE);
517 else
518 aEmptyMsg = ScResId(STR_PRINT_PREVIEW_NODATA);
519
520 tools::Long nHeight = 3000;
521 pEditEng->SetDefaultItem(SvxFontHeightItem(nHeight, 100, EE_CHAR_FONTHEIGHT));
522 pEditEng->SetDefaultItem(SvxFontHeightItem(nHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
523 pEditEng->SetDefaultItem(SvxFontHeightItem(nHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
524
525 pEditEng->SetTextCurrentDefaults(aEmptyMsg);
526
527 Point aCenter(
528 (aWinEnd.X() - pEditEng->CalcTextWidth())/2,
529 (aWinEnd.Y() - pEditEng->GetTextHeight())/2);
530
531 pEditEng->Draw(*GetOutDev(), aCenter);
532
533 return;
534 }
535
536 if( bPageMargin && bValidPage )
537 {
538 SetMapMode(aMMMode);
540 DrawInvert( static_cast<tools::Long>( nTopMargin - aOffset.Y() ), PointerStyle::VSizeBar );
541 DrawInvert( static_cast<tools::Long>(nPageEndY - nBottomMargin ), PointerStyle::VSizeBar );
542 DrawInvert( static_cast<tools::Long>( nLeftMargin - aOffset.X() ), PointerStyle::HSizeBar );
543 DrawInvert( static_cast<tools::Long>( nPageEndX - nRightMargin ) , PointerStyle::HSizeBar );
544 if( bHeaderOn )
545 {
546 DrawInvert( nHeaderHeight - aOffset.Y(), PointerStyle::VSizeBar );
547 }
548 if( bFooterOn )
549 {
550 DrawInvert( nPageEndY - nFooterHeight, PointerStyle::VSizeBar );
551 }
552
553 SetMapMode( MapMode( MapUnit::MapPixel ) );
554 for( int i= aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ )
555 {
556 Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode );
559 GetOutDev()->DrawRect( tools::Rectangle( Point( mvRight[i] - 2, aColumnTop.Y() ),Point( mvRight[i] + 2 , 4 + aColumnTop.Y()) ));
560 GetOutDev()->DrawLine( Point( mvRight[i], aColumnTop.Y() ), Point( mvRight[i], 10 + aColumnTop.Y()) );
561 }
562 SetMapMode( aMMMode );
563 }
564
565 if (bRight || bBottom)
566 {
567 SetMapMode(aMMMode);
569 GetOutDev()->SetFillColor(aBackColor);
570 if (bRight)
571 GetOutDev()->DrawRect(tools::Rectangle(nPageEndX,0, aWinEnd.X(),aWinEnd.Y()));
572 if (bBottom)
573 {
574 if (bRight)
575 GetOutDev()->DrawRect(tools::Rectangle(0,nPageEndY, nPageEndX,aWinEnd.Y())); // Corner not duplicated
576 else
577 GetOutDev()->DrawRect(tools::Rectangle(0,nPageEndY, aWinEnd.X(),aWinEnd.Y()));
578 }
579 }
580
581 if ( !bValidPage )
582 return;
583
584 Color aBorderColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
585
586 // draw border
587
588 if ( aOffset.X() <= 0 || aOffset.Y() <= 0 || bRight || bBottom )
589 {
590 GetOutDev()->SetLineColor( aBorderColor );
592
593 tools::Rectangle aPixel( LogicToPixel( tools::Rectangle( -aOffset.X(), -aOffset.Y(), nPageEndX, nPageEndY ) ) );
594 aPixel.AdjustRight( -1 );
595 aPixel.AdjustBottom( -1 );
596 GetOutDev()->DrawRect( PixelToLogic( aPixel ) );
597 }
598
599 // draw shadow
600
602 GetOutDev()->SetFillColor( aBorderColor );
603
604 tools::Rectangle aPixel;
605
606 aPixel = LogicToPixel( tools::Rectangle( nPageEndX, -aOffset.Y(), nPageEndX, nPageEndY ) );
610 GetOutDev()->DrawRect( PixelToLogic( aPixel ) );
611
612 aPixel = LogicToPixel( tools::Rectangle( -aOffset.X(), nPageEndY, nPageEndX, nPageEndY ) );
616 GetOutDev()->DrawRect( PixelToLogic( aPixel ) );
617}
618
619void ScPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& /* rRect */ )
620{
621 bool bWasInPaint = bInPaint; // nested calls shouldn't be necessary, but allow for now
622 bInPaint = true;
623
624 if (bPageMargin)
625 GetLocationData(); // fill location data for column positions
626 DoPrint( nullptr );
628
629 bInPaint = bWasInPaint;
630}
631
633{
634 CommandEventId nCmd = rCEvt.GetCommand();
635 if ( nCmd == CommandEventId::Wheel || nCmd == CommandEventId::StartAutoScroll || nCmd == CommandEventId::AutoScroll )
636 {
637 bool bDone = pViewShell->ScrollCommand( rCEvt );
638 if (!bDone)
639 Window::Command(rCEvt);
640 }
641 else if ( nCmd == CommandEventId::ContextMenu )
643 else
644 Window::Command( rCEvt );
645}
646
647void ScPreview::KeyInput( const KeyEvent& rKEvt )
648{
649 // The + and - keys can't be configured as accelerator entries, so they must be handled directly
650 // (in ScPreview, not ScPreviewShell -> only if the preview window has the focus)
651
652 const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
653 sal_uInt16 nKey = rKeyCode.GetCode();
654 bool bHandled = false;
655 if(!rKeyCode.GetModifier())
656 {
657 sal_uInt16 nSlot = 0;
658 switch(nKey)
659 {
660 case KEY_ADD: nSlot = SID_ZOOM_IN; break;
661 case KEY_ESCAPE: nSlot = ScViewUtil::IsFullScreen( *pViewShell ) ? SID_CANCEL : SID_PREVIEW_CLOSE; break;
662 case KEY_SUBTRACT: nSlot = SID_ZOOM_OUT; break;
663 }
664 if(nSlot)
665 {
666 bHandled = true;
667 pViewShell->GetViewFrame().GetDispatcher()->Execute( nSlot, SfxCallMode::ASYNCHRON );
668 }
669 }
670
671 if ( !bHandled && !pViewShell->KeyInput(rKEvt) )
672 Window::KeyInput(rKEvt);
673}
674
676{
677 if ( !pLocationData )
678 {
680 bLocationValid = false;
681 }
682 if ( !bLocationValid )
683 {
684 pLocationData->Clear();
685 DoPrint( pLocationData.get() );
686 bLocationValid = true;
687 }
688 return *pLocationData;
689}
690
691void ScPreview::DataChanged(bool bNewTime)
692{
693 if (bNewTime)
695
696 bValid = false;
697 InvalidateLocationData( SfxHintId::ScDataChanged );
698 Invalidate();
699}
700
702{
703 if (!bValid)
704 {
705 CalcPages();
706 UpdateDrawView(); // The table eventually changes
707 }
708
709 OUString aString = ScResId( STR_PAGE ) +
710 " " + OUString::number(nPageNo+1);
711
712 if (nTabsTested >= nTabCount)
713 aString += " / " + OUString::number(nTotalPages);
714
715 return aString;
716}
717
718void ScPreview::SetZoom(sal_uInt16 nNewZoom)
719{
720 if (nNewZoom < 20)
721 nNewZoom = 20;
722 if (nNewZoom > 400)
723 nNewZoom = 400;
724 if (nNewZoom == nZoom)
725 return;
726
727 nZoom = nNewZoom;
728
729 // apply new MapMode and call UpdateScrollBars to update aOffset
730
731 Fraction aPreviewZoom( nZoom, 100 );
732 Fraction aHorPrevZoom( static_cast<tools::Long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
733 MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
734 SetMapMode( aMMMode );
735
736 bInSetZoom = true; // don't scroll during SetYOffset in UpdateScrollBars
738 bInSetZoom = false;
739
740 bStateValid = false;
741 InvalidateLocationData( SfxHintId::ScAccVisAreaChanged );
742 DoInvalidate();
743 Invalidate();
744}
745
747{
748 nPageNo = nPage;
749 RecalcPages();
750 UpdateDrawView(); // The table eventually changes
751 InvalidateLocationData( SfxHintId::ScDataChanged );
752 Invalidate();
753}
754
756{
757 SCTAB nDocTabCount = pDocShell->GetDocument().GetTableCount();
758 if (nTabP >= nDocTabCount)
759 nTabP = nDocTabCount-1;
760
761 tools::Long nPage = 0;
762 if (nTabP>0)
763 {
764 CalcPages();
765 if (nTabP >= static_cast<SCTAB>(nPages.size()) )
766 OSL_FAIL("nPages out of bounds, FIX IT");
767 UpdateDrawView(); // The table eventually changes
768
769 for (SCTAB i=0; i<nTabP; i++)
770 nPage += nPages[i];
771
772 // An empty Table on the previous Page
773
774 if ( nPages[nTabP]==0 && nPage > 0 )
775 --nPage;
776 }
777
778 return nPage;
779}
780
781static Size lcl_GetDocPageSize( const ScDocument* pDoc, SCTAB nTab )
782{
783 OUString aName = pDoc->GetPageStyle( nTab );
784 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
785 SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aName, SfxStyleFamily::Page );
786 if ( pStyleSheet )
787 {
788 SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
789 return rStyleSet.Get(ATTR_PAGE_SIZE).GetSize();
790 }
791 else
792 {
793 OSL_FAIL( "PageStyle not found" );
794 return Size();
795 }
796}
797
798sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly)
799{
800 double nWinScaleX = ScGlobal::nScreenPPTX / pDocShell->GetOutputFactor();
801 double nWinScaleY = ScGlobal::nScreenPPTY;
802 Size aWinSize = GetOutputSizePixel();
803
804 // desired margin is 0.25cm in default MapMode (like Writer),
805 // but some additional margin is introduced by integer scale values
806 // -> add only 0.10cm, so there is some margin in all cases.
807 Size aMarginSize( LogicToPixel(Size(100, 100), MapMode(MapUnit::Map100thMM)) );
808 aWinSize.AdjustWidth( -(2 * aMarginSize.Width()) );
809 aWinSize.AdjustHeight( -(2 * aMarginSize.Height()) );
810
811 Size aLocalPageSize = lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab );
812 if ( aLocalPageSize.Width() && aLocalPageSize.Height() )
813 {
814 tools::Long nZoomX = static_cast<tools::Long>( aWinSize.Width() * 100 / ( aLocalPageSize.Width() * nWinScaleX ));
815 tools::Long nZoomY = static_cast<tools::Long>( aWinSize.Height() * 100 / ( aLocalPageSize.Height() * nWinScaleY ));
816
817 tools::Long nOptimal = nZoomX;
818 if (!bWidthOnly && nZoomY<nOptimal)
819 nOptimal = nZoomY;
820
821 if (nOptimal<20)
822 nOptimal = 20;
823 if (nOptimal>400)
824 nOptimal = 400;
825
826 return static_cast<sal_uInt16>(nOptimal);
827 }
828 else
829 return nZoom;
830}
831
833{
834 if ( aOffset.X() == nX )
835 return;
836
837 if (bValid)
838 {
839 tools::Long nDif = LogicToPixel(aOffset).X() - LogicToPixel(Point(nX,0)).X();
840 aOffset.setX( nX );
841 if (nDif && !bInSetZoom)
842 {
843 MapMode aOldMode = GetMapMode();
844 SetMapMode(MapMode(MapUnit::MapPixel));
845 Scroll( nDif, 0 );
846 SetMapMode(aOldMode);
847 }
848 }
849 else
850 {
851 aOffset.setX( nX );
852 if (!bInSetZoom)
853 Invalidate();
854 }
855 InvalidateLocationData( SfxHintId::ScAccVisAreaChanged );
856 Invalidate();
857}
858
860{
861 if ( aOffset.Y() == nY )
862 return;
863
864 if (bValid)
865 {
866 tools::Long nDif = LogicToPixel(aOffset).Y() - LogicToPixel(Point(0,nY)).Y();
867 aOffset.setY( nY );
868 if (nDif && !bInSetZoom)
869 {
870 MapMode aOldMode = GetMapMode();
871 SetMapMode(MapMode(MapUnit::MapPixel));
872 Scroll( 0, nDif );
873 SetMapMode(aOldMode);
874 }
875 }
876 else
877 {
878 aOffset.setY( nY );
879 if (!bInSetZoom)
880 Invalidate();
881 }
882 InvalidateLocationData( SfxHintId::ScAccVisAreaChanged );
883 Invalidate();
884}
885
887{
888 // If the whole GetState of the shell is called
889 // The Invalidate must come behind asynchronously
890
891 if (bInGetState)
892 Application::PostUserEvent( LINK( this, ScPreview, InvalidateHdl ), nullptr, true );
893 else
894 StaticInvalidate(); // Immediately
895}
896
898{
899 // static method, because it's called asynchronously
900 // -> must use current viewframe
901
903 if (!pViewFrm)
904 return;
905
906 SfxBindings& rBindings = pViewFrm->GetBindings();
907 rBindings.Invalidate(SID_STATUS_DOCPOS);
908 rBindings.Invalidate(SID_ROWCOL_SELCOUNT);
909 rBindings.Invalidate(SID_STATUS_PAGESTYLE);
910 rBindings.Invalidate(SID_PREVIEW_PREVIOUS);
911 rBindings.Invalidate(SID_PREVIEW_NEXT);
912 rBindings.Invalidate(SID_PREVIEW_FIRST);
913 rBindings.Invalidate(SID_PREVIEW_LAST);
914 rBindings.Invalidate(SID_ATTR_ZOOM);
915 rBindings.Invalidate(SID_ZOOM_IN);
916 rBindings.Invalidate(SID_ZOOM_OUT);
917 rBindings.Invalidate(SID_PREVIEW_SCALINGFACTOR);
918 rBindings.Invalidate(SID_ATTR_ZOOMSLIDER);
919}
920
921IMPL_STATIC_LINK_NOARG( ScPreview, InvalidateHdl, void*, void )
922{
923 StaticInvalidate();
924}
925
927{
928 Window::DataChanged(rDCEvt);
929
930 if ( !((rDCEvt.GetType() == DataChangedEventType::PRINTER) ||
931 (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
932 (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
933 (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
934 ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
935 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))) )
936 return;
937
938 if ( rDCEvt.GetType() == DataChangedEventType::FONTS )
940
941 // #i114518# Paint of form controls may modify the window's settings.
942 // Ignore the event if it is called from within Paint.
943 if ( !bInPaint )
944 {
945 if ( rDCEvt.GetType() == DataChangedEventType::SETTINGS &&
946 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
947 {
948 // scroll bar size may have changed
949 pViewShell->InvalidateBorder(); // calls OuterResizePixel
950 }
951 Invalidate();
952 InvalidateLocationData( SfxHintId::ScDataChanged );
953 }
954}
955
957{
958 Fraction aPreviewZoom( nZoom, 100 );
959 Fraction aHorPrevZoom( static_cast<tools::Long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
960 MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
961
963 aButtonDownPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
964
965 CaptureMouse();
966
967 if( rMEvt.IsLeft() && GetPointer() == PointerStyle::HSizeBar )
968 {
969 SetMapMode( aMMMode );
970 if( bLeftRulerChange )
971 {
972 DrawInvert( aButtonDownChangePoint.X(), PointerStyle::HSizeBar );
973 bLeftRulerMove = true;
974 bRightRulerMove = false;
975 }
976 else if( bRightRulerChange )
977 {
978 DrawInvert( aButtonDownChangePoint.X(), PointerStyle::HSizeBar );
979 bLeftRulerMove = false;
980 bRightRulerMove = true;
981 }
982 }
983
984 if( rMEvt.IsLeft() && GetPointer() == PointerStyle::VSizeBar )
985 {
986 SetMapMode( aMMMode );
987 if( bTopRulerChange )
988 {
989 DrawInvert( aButtonDownChangePoint.Y(), PointerStyle::VSizeBar );
990 bTopRulerMove = true;
991 bBottomRulerMove = false;
992 }
993 else if( bBottomRulerChange )
994 {
995 DrawInvert( aButtonDownChangePoint.Y(), PointerStyle::VSizeBar );
996 bTopRulerMove = false;
997 bBottomRulerMove = true;
998 }
999 else if( bHeaderRulerChange )
1000 {
1001 DrawInvert( aButtonDownChangePoint.Y(), PointerStyle::VSizeBar );
1002 bHeaderRulerMove = true;
1003 bFooterRulerMove = false;
1004 }
1005 else if( bFooterRulerChange )
1006 {
1007 DrawInvert( aButtonDownChangePoint.Y(), PointerStyle::VSizeBar );
1008 bHeaderRulerMove = false;
1009 bFooterRulerMove = true;
1010 }
1011 }
1012
1013 if( !(rMEvt.IsLeft() && GetPointer() == PointerStyle::HSplit) )
1014 return;
1015
1016 Point aNowPt = rMEvt.GetPosPixel();
1017 SCCOL i = 0;
1018 for( i = aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ )
1019 {
1020 if( aNowPt.X() < mvRight[i] + 2 && aNowPt.X() > mvRight[i] - 2 )
1021 {
1023 break;
1024 }
1025 }
1026 if( i == aPageArea.aEnd.Col()+1 )
1027 return;
1028
1029 SetMapMode( aMMMode );
1031 DrawInvert( PixelToLogic( Point( nLeftPosition, 0 ),aMMMode ).X() ,PointerStyle::HSplit );
1032 else
1033 DrawInvert( PixelToLogic( Point( mvRight[ nColNumberButtonDown-1 ], 0 ),aMMMode ).X() ,PointerStyle::HSplit );
1034
1035 DrawInvert( aButtonDownChangePoint.X(), PointerStyle::HSplit );
1036 bColRulerMove = true;
1037}
1038
1040{
1041 Fraction aPreviewZoom( nZoom, 100 );
1042 Fraction aHorPrevZoom( static_cast<tools::Long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
1043 MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
1044
1045 aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
1046
1049
1050 if( rMEvt.IsLeft() && GetPointer() == PointerStyle::HSizeBar )
1051 {
1052 SetPointer( PointerStyle::Arrow );
1053
1054 ScDocument& rDoc = pDocShell->GetDocument();
1055 OUString aOldName = rDoc.GetPageStyle( nTab );
1056 bool bUndo = rDoc.IsUndoEnabled();
1057 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
1058 SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SfxStyleFamily::Page );
1059
1060 if ( pStyleSheet )
1061 {
1062 bool bMoveRulerAction= true;
1063 ScStyleSaveData aOldData;
1064 if( bUndo )
1065 aOldData.InitFromStyle( pStyleSheet );
1066
1067 SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
1068
1069 SvxLRSpaceItem aLRItem = rStyleSet.Get( ATTR_LRSPACE );
1070
1072 {
1073 bMoveRulerAction = false;
1074 Invalidate(tools::Rectangle(0, 0, 10000, 10000));
1075 }
1077 {
1078 bMoveRulerAction = false;
1079 Invalidate(tools::Rectangle(0, 0, 10000, 10000));
1080 }
1082 {
1083 bMoveRulerAction = false;
1084 Invalidate(tools::Rectangle(0, 0, 10000, 10000));
1085 }
1086 else if( aButtonDownPt.X() == aButtonUpPt.X() )
1087 {
1088 bMoveRulerAction = false;
1089 DrawInvert( aButtonUpPt.X(), PointerStyle::HSizeBar );
1090 }
1091 if( bMoveRulerAction )
1092 {
1093 ScDocShellModificator aModificator( *pDocShell );
1095 {
1097 rStyleSet.Put( aLRItem );
1099 }
1101 {
1103 rStyleSet.Put( aLRItem );
1105 }
1106
1107 ScStyleSaveData aNewData;
1108 aNewData.InitFromStyle( pStyleSheet );
1109 if( bUndo )
1110 {
1112 std::make_unique<ScUndoModifyStyle>( pDocShell, SfxStyleFamily::Page,
1113 aOldData, aNewData ) );
1114 }
1115
1116 if ( ValidTab( nTab ) )
1117 {
1118 ScPrintFunc aPrintFunc( GetOutDev(), pDocShell, nTab );
1119 aPrintFunc.UpdatePages();
1120 }
1121
1122 tools::Rectangle aRect(0,0,10000,10000);
1123 Invalidate(aRect);
1124 aModificator.SetDocumentModified();
1125 bLeftRulerChange = false;
1126 bRightRulerChange = false;
1127 }
1128 }
1129 bLeftRulerMove = false;
1130 bRightRulerMove = false;
1131 }
1132
1133 if( rMEvt.IsLeft() && GetPointer() == PointerStyle::VSizeBar )
1134 {
1135 SetPointer( PointerStyle::Arrow );
1136
1137 bool bMoveRulerAction = true;
1139 {
1140 bMoveRulerAction = false;
1141 Invalidate(tools::Rectangle(0, 0, 10000, 10000));
1142 }
1143 else if( aButtonDownPt.Y() == aButtonUpPt.Y() )
1144 {
1145 bMoveRulerAction = false;
1146 DrawInvert( aButtonUpPt.Y(), PointerStyle::VSizeBar );
1147 }
1148 if( bMoveRulerAction )
1149 {
1150 ScDocument& rDoc = pDocShell->GetDocument();
1151 bool bUndo = rDoc.IsUndoEnabled();
1152 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
1153 SfxStyleSheetBase* pStyleSheet = pStylePool->Find( rDoc.GetPageStyle( nTab ), SfxStyleFamily::Page );
1154 OSL_ENSURE( pStyleSheet, "PageStyle not found" );
1155 if ( pStyleSheet )
1156 {
1157 ScDocShellModificator aModificator( *pDocShell );
1158 ScStyleSaveData aOldData;
1159 if( bUndo )
1160 aOldData.InitFromStyle( pStyleSheet );
1161
1162 SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
1163
1164 SvxULSpaceItem aULItem = rStyleSet.Get( ATTR_ULSPACE );
1165
1167 {
1169 rStyleSet.Put( aULItem );
1171 }
1173 {
1175 rStyleSet.Put( aULItem );
1177 }
1179 {
1180 if ( const SvxSetItem* pSetItem = rStyleSet.GetItemIfSet( ATTR_PAGE_HEADERSET, false ) )
1181 {
1182 const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
1183 Size aHeaderSize = rHeaderSet.Get(ATTR_PAGE_SIZE).GetSize();
1185 aHeaderSize.setHeight( aHeaderSize.Height() * 100 / mnScale );
1186 SvxSetItem aNewHeader( rStyleSet.Get(ATTR_PAGE_HEADERSET) );
1187 aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) );
1188 rStyleSet.Put( aNewHeader );
1190 }
1191 }
1193 {
1194 if( const SvxSetItem* pSetItem = rStyleSet.GetItemIfSet( ATTR_PAGE_FOOTERSET, false ) )
1195 {
1196 const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
1197 Size aFooterSize = rFooterSet.Get(ATTR_PAGE_SIZE).GetSize();
1199 aFooterSize.setHeight( aFooterSize.Height() * 100 / mnScale );
1200 SvxSetItem aNewFooter( rStyleSet.Get(ATTR_PAGE_FOOTERSET) );
1201 aNewFooter.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aFooterSize ) );
1202 rStyleSet.Put( aNewFooter );
1204 }
1205 }
1206
1207 ScStyleSaveData aNewData;
1208 aNewData.InitFromStyle( pStyleSheet );
1209 if( bUndo )
1210 {
1212 std::make_unique<ScUndoModifyStyle>( pDocShell, SfxStyleFamily::Page,
1213 aOldData, aNewData ) );
1214 }
1215
1216 if ( ValidTab( nTab ) )
1217 {
1218 ScPrintFunc aPrintFunc( GetOutDev(), pDocShell, nTab );
1219 aPrintFunc.UpdatePages();
1220 }
1221
1222 tools::Rectangle aRect(0, 0, 10000, 10000);
1223 Invalidate(aRect);
1224 aModificator.SetDocumentModified();
1225 bTopRulerChange = false;
1226 bBottomRulerChange = false;
1227 bHeaderRulerChange = false;
1228 bFooterRulerChange = false;
1229 }
1230 }
1231 bTopRulerMove = false;
1232 bBottomRulerMove = false;
1233 bHeaderRulerMove = false;
1234 bFooterRulerMove = false;
1235 }
1236 if( rMEvt.IsLeft() && GetPointer() == PointerStyle::HSplit )
1237 {
1238 SetPointer(PointerStyle::Arrow);
1239 ScDocument& rDoc = pDocShell->GetDocument();
1240 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
1241 bool bMoveRulerAction = true;
1242 if( aButtonDownPt.X() == aButtonUpPt.X() )
1243 {
1244 bMoveRulerAction = false;
1246 DrawInvert( PixelToLogic( Point( nLeftPosition, 0 ),aMMMode ).X() ,PointerStyle::HSplit );
1247 else
1248 DrawInvert( PixelToLogic( Point( mvRight[ nColNumberButtonDown-1 ], 0 ),aMMMode ).X() ,PointerStyle::HSplit );
1249 DrawInvert( aButtonUpPt.X(), PointerStyle::HSplit );
1250 }
1251 if( bMoveRulerAction )
1252 {
1253 tools::Long nNewColWidth = 0;
1254 std::vector<sc::ColRowSpan> aCols(1, sc::ColRowSpan(nColNumberButtonDown,nColNumberButtonDown));
1255
1256 constexpr auto md = o3tl::getConversionMulDiv(o3tl::Length::mm100, o3tl::Length::twip);
1257 const auto m = md.first * 100, d = md.second * mnScale;
1258 if( !bLayoutRTL )
1259 {
1260 nNewColWidth = o3tl::convert(PixelToLogic( Point( rMEvt.GetPosPixel().X() - mvRight[ nColNumberButtonDown ], 0), aMMMode ).X(), m, d);
1262 }
1263 else
1264 {
1265
1266 nNewColWidth = o3tl::convert(PixelToLogic( Point( mvRight[ nColNumberButtonDown ] - rMEvt.GetPosPixel().X(), 0), aMMMode ).X(), m, d);
1268 }
1269
1270 if( nNewColWidth >= 0 )
1271 {
1273 true, aCols, nTab, SC_SIZE_DIRECT, static_cast<sal_uInt16>(nNewColWidth), true, true);
1275 }
1276 if ( ValidTab( nTab ) )
1277 {
1278 ScPrintFunc aPrintFunc( GetOutDev(), pDocShell, nTab );
1279 aPrintFunc.UpdatePages();
1280 }
1281 tools::Rectangle aRect(0, 0, 10000, 10000);
1282 Invalidate(aRect);
1283 }
1284 bColRulerMove = false;
1285 }
1286 ReleaseMouse();
1287}
1288
1290{
1291 Fraction aPreviewZoom( nZoom, 100 );
1292 Fraction aHorPrevZoom( static_cast<tools::Long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
1293 MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
1294 Point aMouseMovePoint = PixelToLogic( rMEvt.GetPosPixel(), aMMMode );
1295
1300
1303
1304 if ( nPageNo < nTotalPages )
1305 {
1306 ScPrintOptions aOptions = SC_MOD()->GetPrintOptions();
1307
1308 std::unique_ptr<ScPrintFunc, o3tl::default_delete<ScPrintFunc>> pPrintFunc;
1309 if (bStateValid)
1310 pPrintFunc.reset(new ScPrintFunc( GetOutDev(), pDocShell, aState, &aOptions ));
1311 else
1312 pPrintFunc.reset(new ScPrintFunc( GetOutDev(), pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions ));
1313
1314 nLeftMargin = o3tl::convert(pPrintFunc->GetLeftMargin(), o3tl::Length::twip, o3tl::Length::mm100) - aOffset.X();
1315 nRightMargin = o3tl::convert(pPrintFunc->GetRightMargin(), o3tl::Length::twip, o3tl::Length::mm100);
1317 nTopMargin = o3tl::convert(pPrintFunc->GetTopMargin(), o3tl::Length::twip, o3tl::Length::mm100) - aOffset.Y();
1318 nBottomMargin = o3tl::convert(pPrintFunc->GetBottomMargin(), o3tl::Length::twip, o3tl::Length::mm100);
1320 if( mnScale > 0 )
1321 {
1322 constexpr auto md = o3tl::getConversionMulDiv(o3tl::Length::twip, o3tl::Length::mm100);
1323 const auto m = md.first * mnScale, d = md.second * 100;
1324 nHeaderHeight = nTopMargin + o3tl::convert(pPrintFunc->GetHeader().nHeight, m, d);
1325 nFooterHeight = nBottomMargin - o3tl::convert(pPrintFunc->GetFooter().nHeight, m, d);
1326 }
1327 else
1328 {
1329 nHeaderHeight = nTopMargin + o3tl::convert(pPrintFunc->GetHeader().nHeight, o3tl::Length::twip, o3tl::Length::mm100);
1331 }
1332 }
1333
1334 Point aPixPt( rMEvt.GetPosPixel() );
1335 Point aLeftTop = LogicToPixel( Point( nLeftMargin, -aOffset.Y() ) , aMMMode );
1337 Point aRightTop = LogicToPixel( Point( nRightMargin, -aOffset.Y() ), aMMMode );
1338 Point aTopLeft = LogicToPixel( Point( -aOffset.X(), nTopMargin ), aMMMode );
1340 Point aBottomLeft = LogicToPixel( Point( -aOffset.X(), nBottomMargin ), aMMMode );
1341 Point aHeaderLeft = LogicToPixel( Point( -aOffset.X(), nHeaderHeight ), aMMMode );
1342 Point aFooderLeft = LogicToPixel( Point( -aOffset.X(), nFooterHeight ), aMMMode );
1343
1344 bool bOnColRulerChange = false;
1345
1346 for( SCCOL i=aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ )
1347 {
1348 Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode );
1349 Point aColumnBottom = LogicToPixel( Point( 0, o3tl::convert(nHeight, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.Y()), aMMMode );
1350 tools::Long nRight = i < static_cast<SCCOL>(mvRight.size()) ? mvRight[i] : 0;
1351 if( aPixPt.X() < ( nRight + 2 ) && ( aPixPt.X() > ( nRight - 2 ) ) && ( aPixPt.X() < aRightTop.X() ) && ( aPixPt.X() > aLeftTop.X() )
1352 && ( aPixPt.Y() > aColumnTop.Y() ) && ( aPixPt.Y() < aColumnBottom.Y() ) && !bLeftRulerMove && !bRightRulerMove
1354 {
1355 bOnColRulerChange = true;
1356 if( !rMEvt.GetButtons() && GetPointer() == PointerStyle::HSplit )
1358 break;
1359 }
1360 }
1361
1362 if( aPixPt.X() < ( aLeftTop.X() + 2 ) && aPixPt.X() > ( aLeftTop.X() - 2 ) && !bRightRulerMove )
1363 {
1364 bLeftRulerChange = true;
1365 bRightRulerChange = false;
1366 }
1367 else if( aPixPt.X() < ( aRightTop.X() + 2 ) && aPixPt.X() > ( aRightTop.X() - 2 ) && !bLeftRulerMove )
1368 {
1369 bLeftRulerChange = false;
1370 bRightRulerChange = true;
1371 }
1372 else if( aPixPt.Y() < ( aTopLeft.Y() + 2 ) && aPixPt.Y() > ( aTopLeft.Y() - 2 ) && !bBottomRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
1373 {
1374 bTopRulerChange = true;
1375 bBottomRulerChange = false;
1376 bHeaderRulerChange = false;
1377 bFooterRulerChange = false;
1378 }
1379 else if( aPixPt.Y() < ( aBottomLeft.Y() + 2 ) && aPixPt.Y() > ( aBottomLeft.Y() - 2 ) && !bTopRulerMove && !bHeaderRulerMove && !bFooterRulerMove )
1380 {
1381 bTopRulerChange = false;
1382 bBottomRulerChange = true;
1383 bHeaderRulerChange = false;
1384 bFooterRulerChange = false;
1385 }
1386 else if( aPixPt.Y() < ( aHeaderLeft.Y() + 2 ) && aPixPt.Y() > ( aHeaderLeft.Y() - 2 ) && !bTopRulerMove && !bBottomRulerMove && !bFooterRulerMove )
1387 {
1388 bTopRulerChange = false;
1389 bBottomRulerChange = false;
1390 bHeaderRulerChange = true;
1391 bFooterRulerChange = false;
1392 }
1393 else if( aPixPt.Y() < ( aFooderLeft.Y() + 2 ) && aPixPt.Y() > ( aFooderLeft.Y() - 2 ) && !bTopRulerMove && !bBottomRulerMove && !bHeaderRulerMove )
1394 {
1395 bTopRulerChange = false;
1396 bBottomRulerChange = false;
1397 bHeaderRulerChange = false;
1398 bFooterRulerChange = true;
1399 }
1400
1401 if( !bPageMargin )
1402 return;
1403
1404 if(( (aPixPt.X() < ( aLeftTop.X() + 2 ) && aPixPt.X() > ( aLeftTop.X() - 2 )) || bLeftRulerMove ||
1405 ( aPixPt.X() < ( aRightTop.X() + 2 ) && aPixPt.X() > ( aRightTop.X() - 2 ) ) || bRightRulerMove || bOnColRulerChange || bColRulerMove )
1406 && aPixPt.Y() > aLeftTop.Y() && aPixPt.Y() < aLeftBottom.Y() )
1407 {
1408 if( bOnColRulerChange || bColRulerMove )
1409 {
1410 SetPointer( PointerStyle::HSplit );
1411 if( bColRulerMove )
1412 {
1413 if( aMouseMovePoint.X() > -aOffset.X() && aMouseMovePoint.X() < o3tl::convert(nWidth, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.X() )
1414 DragMove( aMouseMovePoint.X(), PointerStyle::HSplit );
1415 }
1416 }
1417 else
1418 {
1420 {
1421 SetPointer( PointerStyle::HSizeBar );
1422 if( bLeftRulerMove )
1423 {
1424 if( aMouseMovePoint.X() > -aOffset.X() && aMouseMovePoint.X() < o3tl::convert(nWidth, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.X() )
1425 DragMove( aMouseMovePoint.X(), PointerStyle::HSizeBar );
1426 }
1427 }
1429 {
1430 SetPointer( PointerStyle::HSizeBar );
1431 if( bRightRulerMove )
1432 {
1433 if( aMouseMovePoint.X() > -aOffset.X() && aMouseMovePoint.X() < o3tl::convert(nWidth, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.X() )
1434 DragMove( aMouseMovePoint.X(), PointerStyle::HSizeBar );
1435 }
1436 }
1437 }
1438 }
1439 else
1440 {
1441 if( ( ( aPixPt.Y() < ( aTopLeft.Y() + 2 ) && aPixPt.Y() > ( aTopLeft.Y() - 2 ) ) || bTopRulerMove ||
1442 ( aPixPt.Y() < ( aBottomLeft.Y() + 2 ) && aPixPt.Y() > ( aBottomLeft.Y() - 2 ) ) || bBottomRulerMove ||
1443 ( aPixPt.Y() < ( aHeaderLeft.Y() + 2 ) && aPixPt.Y() > ( aHeaderLeft.Y() - 2 ) ) || bHeaderRulerMove ||
1444 ( aPixPt.Y() < ( aFooderLeft.Y() + 2 ) && aPixPt.Y() > ( aFooderLeft.Y() - 2 ) ) || bFooterRulerMove )
1445 && aPixPt.X() > aTopLeft.X() && aPixPt.X() < aTopRight.X() )
1446 {
1447 if( bTopRulerChange )
1448 {
1449 SetPointer( PointerStyle::VSizeBar );
1450 if( bTopRulerMove )
1451 {
1452 if( aMouseMovePoint.Y() > -aOffset.Y() && aMouseMovePoint.Y() < o3tl::convert(nHeight, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.Y() )
1453 DragMove( aMouseMovePoint.Y(), PointerStyle::VSizeBar );
1454 }
1455 }
1456 else if( bBottomRulerChange )
1457 {
1458 SetPointer( PointerStyle::VSizeBar );
1459 if( bBottomRulerMove )
1460 {
1461 if( aMouseMovePoint.Y() > -aOffset.Y() && aMouseMovePoint.Y() < o3tl::convert(nHeight, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.Y() )
1462 DragMove( aMouseMovePoint.Y(), PointerStyle::VSizeBar );
1463 }
1464 }
1465 else if( bHeaderRulerChange )
1466 {
1467 SetPointer( PointerStyle::VSizeBar );
1468 if( bHeaderRulerMove )
1469 {
1470 if( aMouseMovePoint.Y() > -aOffset.Y() && aMouseMovePoint.Y() < o3tl::convert(nHeight, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.Y() )
1471 DragMove( aMouseMovePoint.Y(), PointerStyle::VSizeBar );
1472 }
1473 }
1474 else if( bFooterRulerChange )
1475 {
1476 SetPointer( PointerStyle::VSizeBar );
1477 if( bFooterRulerMove )
1478 {
1479 if( aMouseMovePoint.Y() > -aOffset.Y() && aMouseMovePoint.Y() < o3tl::convert(nHeight, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.Y() )
1480 DragMove( aMouseMovePoint.Y(), PointerStyle::VSizeBar );
1481 }
1482 }
1483 }
1484 else
1485 SetPointer( PointerStyle::Arrow );
1486 }
1487}
1488
1490{
1491 bLocationValid = false;
1494}
1495
1497{
1498 Window::GetFocus();
1501}
1502
1504{
1507 Window::LoseFocus();
1508}
1509
1510css::uno::Reference<css::accessibility::XAccessible> ScPreview::CreateAccessible()
1511{
1512 css::uno::Reference<css::accessibility::XAccessible> xAcc= GetAccessible(false);
1513 if (xAcc.is())
1514 {
1515 return xAcc;
1516 }
1517
1520
1521 xAcc = pAccessible;
1522 SetAccessible(xAcc);
1523 pAccessible->Init();
1524 return xAcc;
1525}
1526
1528{
1529 Fraction aPreviewZoom( nZoom, 100 );
1530 Fraction aHorPrevZoom( static_cast<tools::Long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
1531 MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom );
1532 SetMapMode( aMMMode );
1533 tools::Long nPos = nDragMovePos;
1534 if( nFlags == PointerStyle::HSizeBar || nFlags == PointerStyle::HSplit )
1535 {
1536 if( nDragMovePos != aButtonDownChangePoint.X() )
1537 {
1538 DrawInvert( aButtonDownChangePoint.X(), nFlags );
1540 DrawInvert( aButtonDownChangePoint.X(), nFlags );
1541 }
1542 }
1543 else if( nFlags == PointerStyle::VSizeBar )
1544 {
1545 if( nDragMovePos != aButtonDownChangePoint.Y() )
1546 {
1547 DrawInvert( aButtonDownChangePoint.Y(), nFlags );
1549 DrawInvert( aButtonDownChangePoint.Y(), nFlags );
1550 }
1551 }
1552}
1553
1555{
1558 if( nFlags == PointerStyle::HSizeBar || nFlags == PointerStyle::HSplit )
1559 {
1560 tools::Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1, o3tl::convert(nHeight, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.Y());
1561 GetOutDev()->Invert( aRect, InvertFlags::N50 );
1562 }
1563 else if( nFlags == PointerStyle::VSizeBar )
1564 {
1565 tools::Rectangle aRect( -aOffset.X(), nDragPos, o3tl::convert(nWidth, o3tl::Length::twip, o3tl::Length::mm100) - aOffset.X(), nDragPos + 1 );
1566 GetOutDev()->Invert( aRect, InvertFlags::N50 );
1567 }
1568}
1569
1571{
1573}
1574
1575/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool ValidTab(SCTAB nTab)
Definition: address.hxx:111
double mnScale
double d
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
CommandEventId GetCommand() const
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
static rtl::Reference< SfxItemPool > CreatePool()
const vcl::KeyCode & GetKeyCode() const
sal_uInt16 GetButtons() const
const Point & GetPosPixel() const
bool IsLeft() const
bool Select(sal_Int32 nIndex, bool bSelect=true)
void SetTotalRange(const Range &rTotRange)
Size GetOutputSize() const
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void Invert(const tools::Rectangle &rRect, InvertFlags nFlags=InvertFlags::NONE)
void SetLineColor()
void SetDigitLanguage(LanguageType)
void SetFillColor()
void SetOutDevViewType(OutDevViewType eOutDevViewType)
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
SC_DLLPUBLIC bool SetWidthOrHeight(bool bWidth, const std::vector< sc::ColRowSpan > &rRanges, SCTAB nTab, ScSizeMode eMode, sal_uInt16 nSizeTwips, bool bRecord, bool bApi)
Definition: docfunc.cxx:3652
Create before modifications of the document and destroy thereafter.
Definition: docsh.hxx:455
void SetDocumentModified()
Definition: docsh.cxx:3315
void UpdateFontList()
Definition: docsh3.cxx:456
virtual void SetModified(bool=true) override
Definition: docsh.cxx:2973
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
void UpdatePendingRowHeights(SCTAB nUpdateTab, bool bBefore=false)
Definition: docsh5.cxx:442
double GetOutputFactor() const
Definition: docsh.hxx:358
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2968
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:221
static SCTAB GetCurTab()
Definition: docsh4.cxx:2614
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4122
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6050
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6176
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1084
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6055
SC_DLLPUBLIC bool NeedPageResetAfterTab(SCTAB nTab) const
Definition: document.cxx:6340
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:974
bool IsUndoEnabled() const
Definition: document.hxx:1595
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
Definition: global.hxx:589
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:591
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
const MarkedTabsType & GetSelectedTabs() const
Definition: markdata.hxx:97
svtools::ColorConfig & GetColorConfig()
Definition: scmod.cxx:887
SC_DLLPUBLIC const ScPrintOptions & GetPrintOptions()
Definition: scmod.cxx:863
static LanguageType GetOptDigitLanguage()
Definition: scmod.cxx:907
void FillEditItemSet(SfxItemSet *pEditSet, const SfxItemSet *pCondSet=nullptr) const
Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSe...
Definition: patattr.cxx:868
void UpdateScrollBars()
Definition: prevwsh.cxx:319
bool HasAccessibilityObjects() const
Definition: prevwsh.cxx:1166
void UpdateNeededScrollBars(bool bFromZoom)
Definition: prevwsh.cxx:250
void BroadcastAccessibility(const SfxHint &rHint)
Definition: prevwsh.cxx:1160
bool ScrollCommand(const CommandEvent &rCEvt)
Definition: prevwsh.cxx:485
virtual ~ScPreview() override
Definition: preview.cxx:133
std::vector< tools::Long > nFirstAttr
Definition: preview.hxx:44
tools::Long nFooterHeight
Definition: preview.hxx:90
void SetZoom(sal_uInt16 nNewZoom)
Definition: preview.cxx:718
bool bStateValid
Definition: preview.hxx:61
tools::Long nTotalPages
Definition: preview.hxx:50
bool bInSetZoom
Definition: preview.hxx:64
void CalcPages()
Definition: preview.cxx:210
void InvalidateLocationData(SfxHintId nId)
Definition: preview.cxx:1489
bool bColRulerMove
Definition: preview.hxx:78
void DrawInvert(tools::Long nDragPos, PointerStyle nFlags)
Definition: preview.cxx:1554
ScPrintState aState
Definition: preview.hxx:51
SC_DLLPUBLIC void SetPageNo(tools::Long nPage)
Definition: preview.cxx:746
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition: preview.cxx:1510
void UpdateDrawView()
Definition: preview.cxx:145
std::vector< tools::Long > mvRight
Definition: preview.hxx:82
SC_DLLPUBLIC void SetSelectedTabs(const ScMarkData &rMark)
Definition: preview.cxx:1570
ScPreviewShell * pViewShell
Definition: preview.hxx:57
SCCOL nColNumberButtonDown
Definition: preview.hxx:85
bool bLocationValid
Definition: preview.hxx:62
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: preview.cxx:956
bool bRightRulerChange
Definition: preview.hxx:72
tools::Long nHeaderHeight
Definition: preview.hxx:89
void DoInvalidate()
Definition: preview.cxx:886
virtual void Command(const CommandEvent &rCEvt) override
Definition: preview.cxx:632
Point aButtonUpPt
Definition: preview.hxx:88
tools::Long mnScale
Definition: preview.hxx:84
sal_uInt16 GetOptimalZoom(bool bWidthOnly)
Definition: preview.cxx:798
bool bInPaint
Definition: preview.hxx:63
void TestLastPage()
Definition: preview.cxx:176
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: preview.cxx:619
bool bHeaderRulerChange
Definition: preview.hxx:75
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: preview.cxx:926
bool mbHasEmptyRangeTable
Definition: preview.hxx:79
virtual void GetFocus() override
Definition: preview.cxx:1496
bool bFooterRulerMove
Definition: preview.hxx:70
bool bLeftRulerChange
Definition: preview.hxx:71
std::unique_ptr< ScPreviewLocationData > pLocationData
Definition: preview.hxx:52
void DragMove(tools::Long nDragMovePos, PointerStyle nFlags)
Definition: preview.cxx:1527
ScPreview(vcl::Window *pParent, ScDocShell *pDocSh, ScPreviewShell *pViewSh)
Definition: preview.cxx:84
void DoPrint(ScPreviewLocationData *pFillLocation)
Definition: preview.cxx:335
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: preview.cxx:1289
std::vector< tools::Long > nPages
Definition: preview.hxx:43
const ScPreviewLocationData & GetLocationData()
Definition: preview.cxx:675
tools::Long nLeftPosition
Definition: preview.hxx:83
Point aButtonDownChangePoint
Definition: preview.hxx:86
bool bLeftRulerMove
Definition: preview.hxx:65
static void StaticInvalidate()
Definition: preview.cxx:897
ScDocShell * pDocShell
Definition: preview.hxx:56
bool bInGetState
Definition: preview.hxx:59
SC_DLLPUBLIC tools::Long GetFirstPage(SCTAB nTab)
Definition: preview.cxx:755
bool bRightRulerMove
Definition: preview.hxx:66
sal_uInt16 nZoom
Definition: preview.hxx:37
bool bHeaderRulerMove
Definition: preview.hxx:69
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: preview.cxx:1039
OUString GetPosString()
Definition: preview.cxx:701
std::unique_ptr< FmFormView > pDrawView
Definition: preview.hxx:53
Point aButtonDownPt
Definition: preview.hxx:87
Point aOffset
Definition: preview.hxx:38
SCTAB nTab
Definition: preview.hxx:45
bool bBottomRulerChange
Definition: preview.hxx:74
bool bBottomRulerMove
Definition: preview.hxx:68
bool bPageMargin
Definition: preview.hxx:77
bool bTopRulerChange
Definition: preview.hxx:73
DateTime aDateTime
Definition: preview.hxx:49
tools::Long nDisplayStart
Definition: preview.hxx:48
void RecalcPages()
Definition: preview.cxx:293
bool bValid
Definition: preview.hxx:60
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: preview.cxx:647
SCTAB nTabCount
Definition: preview.hxx:41
bool bTopRulerMove
Definition: preview.hxx:67
tools::Long nPageNo
Definition: preview.hxx:36
void SetXOffset(tools::Long nX)
Definition: preview.cxx:832
virtual void dispose() override
Definition: preview.cxx:138
tools::Long nTabStart
Definition: preview.hxx:47
virtual void LoseFocus() override
Definition: preview.cxx:1503
SCTAB nTabsTested
Definition: preview.hxx:42
ScMarkData::MarkedTabsType maSelectedTabs
Definition: preview.hxx:34
bool bFooterRulerChange
Definition: preview.hxx:76
tools::Long nTabPage
Definition: preview.hxx:46
void SetYOffset(tools::Long nY)
Definition: preview.cxx:859
ScRange aPageArea
we have at least one sheet with empty print range (print range set to '- none -').
Definition: preview.hxx:81
tools::Long GetFirstPageNo() const
Definition: printfun.hxx:365
bool HasPrintRange() const
Definition: printfun.hxx:381
bool UpdatePages()
Definition: printfun.cxx:2426
tools::Long GetTotalPages() const
Definition: printfun.hxx:367
void GetPrintState(ScPrintState &rState, bool bSavePageRanges=false)
Definition: printfun.cxx:353
bool GetAllSheets() const
Definition: printopt.hxx:38
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
void InitFromStyle(const SfxStyleSheetBase *pSource)
Definition: undostyl.cxx:63
static bool IsFullScreen(const SfxViewShell &rViewShell)
Returns true, if the passed view shell is in full screen mode.
Definition: viewutil.cxx:331
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void Invalidate(sal_uInt16 nId)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
void ExecutePopup(const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual SfxItemSet & GetItemSet()
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
void InvalidateBorder()
SfxViewFrame & GetViewFrame() const
virtual bool KeyInput(const KeyEvent &rKeyEvent)
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
tools::Long GetLeft() const
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
void SetUpperValue(const sal_uInt16 nU)
void SetLowerValue(const sal_uInt16 nL)
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
virtual void dispose() override
Point LogicToPixel(const Point &rLogicPt) const
void SetAccessible(const css::uno::Reference< css::accessibility::XAccessible > &)
vcl::Window * GetAccessibleParentWindow() const
void SetMapMode()
const MapMode & GetMapMode() const
::OutputDevice const * GetOutDev() const
void ReleaseMouse()
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Point PixelToLogic(const Point &rDevicePt) const
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
Size GetOutputSizePixel() const
virtual void SetPointer(PointerStyle)
void CaptureMouse()
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
weld::Window * GetFrameWeld() const
PointerStyle GetPointer() const
void SetHelpId(const OUString &)
void SetBackground()
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
CommandEventId
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
#define RANGE_MAX
@ SC_SIZE_DIRECT
Definition: global.hxx:352
constexpr OUStringLiteral HID_SC_WIN_PREVIEW
Definition: helpids.h:34
SfxHintId
OUString aName
constexpr sal_uInt16 KEY_ESCAPE
constexpr sal_uInt16 KEY_ADD
constexpr sal_uInt16 KEY_SUBTRACT
sal_uInt16 nPos
tools::Long const nRightMargin
tools::Long const nBottomMargin
tools::Long const nTopMargin
tools::Long const nLeftMargin
int i
m
constexpr sal_Int64 md(U i, U)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
sal_Int16 nId
static tools::Long lcl_GetDisplayStart(SCTAB nTab, const ScDocument *pDoc, std::vector< tools::Long > &nPages)
Definition: preview.cxx:71
static Size lcl_GetDocPageSize(const ScDocument *pDoc, SCTAB nTab)
Definition: preview.cxx:781
IMPL_STATIC_LINK_NOARG(ScPreview, InvalidateHdl, void *, void)
Definition: preview.cxx:921
#define SC_PREVIEW_SHADOWSIZE
Definition: preview.cxx:69
PointerStyle
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SvxSizeItem > ATTR_PAGE_SIZE(161)
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_HEADERSET(184)
constexpr TypedWhichId< SvxULSpaceItem > ATTR_ULSPACE(158)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_FOOTERSET(185)
constexpr TypedWhichId< SvxLRSpaceItem > ATTR_LRSPACE(157)
#define SC_MOD()
Definition: scmod.hxx:247
sal_uInt16 nZoom
Definition: printfun.hxx:192
tools::Long nTabPages
Definition: printfun.hxx:195
SCROW nEndRow
Definition: printfun.hxx:190
tools::Long nPageStart
Definition: printfun.hxx:197
size_t nPagesY
Definition: printfun.hxx:194
SCCOL nEndCol
Definition: printfun.hxx:189
size_t nPagesX
Definition: printfun.hxx:193
SCTAB nPrintTab
Definition: printfun.hxx:186
tools::Long nDocPages
Definition: printfun.hxx:198
SCROW nStartRow
Definition: printfun.hxx:188
tools::Long nTotalPages
Definition: printfun.hxx:196
SCCOL nStartCol
Definition: printfun.hxx:187
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21