LibreOffice Module sc (master)  1
printfun.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 <printfun.hxx>
24 
25 #include <editeng/adjustitem.hxx>
26 #include <editeng/borderline.hxx>
27 #include <editeng/boxitem.hxx>
28 #include <editeng/brushitem.hxx>
29 #include <svtools/colorcfg.hxx>
30 #include <editeng/editstat.hxx>
31 #include <svx/fmview.hxx>
32 #include <editeng/frmdiritem.hxx>
33 #include <editeng/lrspitem.hxx>
34 #include <editeng/paperinf.hxx>
35 #include <editeng/pbinitem.hxx>
36 #include <editeng/shaditem.hxx>
37 #include <editeng/sizeitem.hxx>
38 #include <editeng/fhgtitem.hxx>
39 #include <editeng/ulspitem.hxx>
40 #include <sfx2/printer.hxx>
41 #include <tools/multisel.hxx>
42 #include <sfx2/docfile.hxx>
43 #include <tools/urlobj.hxx>
44 #include <osl/diagnose.h>
45 
46 #include <editutil.hxx>
47 #include <docsh.hxx>
48 #include <output.hxx>
49 #include <viewdata.hxx>
50 #include <viewopti.hxx>
51 #include <stlpool.hxx>
52 #include <pagepar.hxx>
53 #include <attrib.hxx>
54 #include <patattr.hxx>
55 #include <docpool.hxx>
56 #include <dociter.hxx>
57 #include <globstr.hrc>
58 #include <scresid.hxx>
59 #include <pagedata.hxx>
60 #include <printopt.hxx>
61 #include <prevloc.hxx>
62 #include <scmod.hxx>
63 #include <drwlayer.hxx>
64 #include <fillinfo.hxx>
65 #include <postit.hxx>
66 
67 #include <memory>
68 #include <com/sun/star/document/XDocumentProperties.hpp>
69 
70 #define ZOOM_MIN 10
71 
72 namespace{
73 
74 bool lcl_GetBool(const SfxItemSet* pSet, sal_uInt16 nWhich)
75 {
76  return static_cast<const SfxBoolItem&>(pSet->Get(nWhich)).GetValue();
77 }
78 
79 sal_uInt16 lcl_GetUShort(const SfxItemSet* pSet, sal_uInt16 nWhich)
80 {
81  return static_cast<const SfxUInt16Item&>(pSet->Get(nWhich)).GetValue();
82 }
83 
84 bool lcl_GetShow(const SfxItemSet* pSet, sal_uInt16 nWhich)
85 {
86  return ScVObjMode::VOBJ_MODE_SHOW == static_cast<const ScViewObjectModeItem&>(pSet->Get(nWhich)).GetValue();
87 }
88 
89 
90 } // namespace
91 
93 {
94  nStartRow = r.nStartRow;
95  nEndRow = r.nEndRow;
96  nPagesX = r.nPagesX;
97  aHidden = r.aHidden;
98  aHidden.resize(nPagesX, false);
99 }
100 
102 {
103  nStartRow = r.nStartRow;
104  nEndRow = r.nEndRow;
105  nPagesX = r.nPagesX;
106  aHidden = r.aHidden;
107  aHidden.resize(nPagesX, false);
108  return *this;
109 }
110 
111 void ScPageRowEntry::SetPagesX(size_t nNew)
112 {
113  nPagesX = nNew;
114  aHidden.resize(nPagesX, false);
115 }
116 
118 {
119  if ( nX < nPagesX )
120  {
121  if ( nX+1 == nPagesX ) // last page?
122  --nPagesX;
123  else
124  {
125  aHidden.resize(nPagesX, false);
126  aHidden[nX] = true;
127  }
128  }
129 }
130 
131 bool ScPageRowEntry::IsHidden(size_t nX) const
132 {
133  return nX >= nPagesX || aHidden[nX];
134 }
135 
137 {
138  if (!aHidden.empty())
139  {
140  size_t nVis = 0;
141  for (size_t i=0; i<nPagesX; i++)
142  if (!aHidden[i])
143  ++nVis;
144  return nVis;
145  }
146  else
147  return nPagesX;
148 }
149 
150 static tools::Long lcl_LineTotal(const ::editeng::SvxBorderLine* pLine)
151 {
152  return pLine ? ( pLine->GetScaledWidth() ) : 0;
153 }
154 
155 void ScPrintFunc::Construct( const ScPrintOptions* pOptions )
156 {
158 
159  SfxPrinter* pDocPrinter = rDoc.GetPrinter(); // use the printer, even for preview
160  if (pDocPrinter)
161  aOldPrinterMode = pDocPrinter->GetMapMode();
162 
163  // unified MapMode for all calls (e.g. Repaint!!!)
164  // else, EditEngine outputs different text heights
165  pDev->SetMapMode(MapMode(MapUnit::MapPixel));
166 
167  pBorderItem = nullptr;
168  pBackgroundItem = nullptr;
169  pShadowItem = nullptr;
170 
171  pEditEngine = nullptr;
172  pEditDefaults = nullptr;
173 
174  ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
175  SfxStyleSheetBase* pStyleSheet = pStylePool->Find(
177  SfxStyleFamily::Page );
178  if (pStyleSheet)
179  pParamSet = &pStyleSheet->GetItemSet();
180  else
181  {
182  OSL_FAIL("Template not found" );
183  pParamSet = nullptr;
184  }
185 
186  if (!bFromPrintState)
187  nZoom = 100;
188  nManualZoom = 100;
189  bClearWin = false;
190  bUseStyleColor = false;
191  bIsRender = false;
192 
193  InitParam(pOptions);
194 
195  pPageData = nullptr; // is only needed for initialisation
196 }
197 
199  tools::Long nPage, tools::Long nDocP, const ScRange* pArea,
200  const ScPrintOptions* pOptions,
201  ScPageBreakData* pData )
202  : pDocShell ( pShell ),
203  rDoc(pDocShell->GetDocument()),
204  pPrinter ( pNewPrinter ),
205  pDrawView ( nullptr ),
206  nPrintTab ( nTab ),
207  nPageStart ( nPage ),
208  nDocPages ( nDocP ),
209  pUserArea ( pArea ),
210  bFromPrintState ( false ),
211  bSourceRangeValid ( false ),
212  bPrintCurrentTable ( false ),
213  bMultiArea ( false ),
214  mbHasPrintRange(true),
215  nTabPages ( 0 ),
216  nTotalPages ( 0 ),
217  bPrintAreaValid ( false ),
218  pPageData ( pData )
219 {
220  pDev = pPrinter.get();
221  aSrcOffset = pPrinter->PixelToLogic(pPrinter->GetPageOffsetPixel(), MapMode(MapUnit::Map100thMM));
222  Construct( pOptions );
223 }
224 
226  const ScPrintState& rState, const ScPrintOptions* pOptions)
227  : pDocShell ( pShell ),
228  rDoc(pDocShell->GetDocument()),
229  pPrinter ( pNewPrinter ),
230  pDrawView ( nullptr ),
231  pUserArea ( nullptr ),
232  bSourceRangeValid ( false ),
233  bPrintCurrentTable ( false ),
234  bMultiArea ( false ),
235  mbHasPrintRange(true),
236  pPageData ( nullptr )
237 {
238  pDev = pPrinter.get();
239 
240  nPrintTab = rState.nPrintTab;
241  nStartCol = rState.nStartCol;
242  nStartRow = rState.nStartRow;
243  nEndCol = rState.nEndCol;
244  nEndRow = rState.nEndRow;
246  nZoom = rState.nZoom;
247  m_aRanges.m_nPagesX = rState.nPagesX;
248  m_aRanges.m_nPagesY = rState.nPagesY;
249  nTabPages = rState.nTabPages;
250  nTotalPages = rState.nTotalPages;
251  nPageStart = rState.nPageStart;
252  nDocPages = rState.nDocPages;
253  bFromPrintState = true;
254 
255  if (rState.bSavedStateRanges)
256  {
257  m_aRanges.m_nTotalY = rState.nTotalY;
262  }
263 
264  aSrcOffset = pPrinter->PixelToLogic(pPrinter->GetPageOffsetPixel(), MapMode(MapUnit::Map100thMM));
265  Construct( pOptions );
266 }
267 
269  tools::Long nPage, tools::Long nDocP, const ScRange* pArea,
270  const ScPrintOptions* pOptions )
271  : pDocShell ( pShell ),
272  rDoc(pDocShell->GetDocument()),
273  pPrinter ( nullptr ),
274  pDrawView ( nullptr ),
275  nPrintTab ( nTab ),
276  nPageStart ( nPage ),
277  nDocPages ( nDocP ),
278  pUserArea ( pArea ),
279  bFromPrintState ( false ),
280  bSourceRangeValid ( false ),
281  bPrintCurrentTable ( false ),
282  bMultiArea ( false ),
283  mbHasPrintRange(true),
284  nTabPages ( 0 ),
285  nTotalPages ( 0 ),
286  bPrintAreaValid ( false ),
287  pPageData ( nullptr )
288 {
289  pDev = pOutDev;
290  Construct( pOptions );
291 }
292 
294  const ScPrintState& rState, const ScPrintOptions* pOptions )
295  : pDocShell ( pShell ),
296  rDoc(pDocShell->GetDocument()),
297  pPrinter ( nullptr ),
298  pDrawView ( nullptr ),
299  pUserArea ( nullptr ),
300  bSourceRangeValid ( false ),
301  bPrintCurrentTable ( false ),
302  bMultiArea ( false ),
303  mbHasPrintRange(true),
304  pPageData ( nullptr )
305 {
306  pDev = pOutDev;
307 
308  nPrintTab = rState.nPrintTab;
309  nStartCol = rState.nStartCol;
310  nStartRow = rState.nStartRow;
311  nEndCol = rState.nEndCol;
312  nEndRow = rState.nEndRow;
314  nZoom = rState.nZoom;
315  m_aRanges.m_nPagesX = rState.nPagesX;
316  m_aRanges.m_nPagesY = rState.nPagesY;
317  nTabPages = rState.nTabPages;
318  nTotalPages = rState.nTotalPages;
319  nPageStart = rState.nPageStart;
320  nDocPages = rState.nDocPages;
321  bFromPrintState = true;
322 
323  if (rState.bSavedStateRanges)
324  {
325  m_aRanges.m_nTotalY = rState.nTotalY;
330  }
331 
332  Construct( pOptions );
333 }
334 
335 void ScPrintFunc::GetPrintState(ScPrintState& rState, bool bSavePageRanges)
336 {
337  rState.nPrintTab = nPrintTab;
338  rState.nStartCol = nStartCol;
339  rState.nStartRow = nStartRow;
340  rState.nEndCol = nEndCol;
341  rState.nEndRow = nEndRow;
343  rState.nZoom = nZoom;
344  rState.nPagesX = m_aRanges.m_nPagesX;
345  rState.nPagesY = m_aRanges.m_nPagesY;
346  rState.nTabPages = nTabPages;
347  rState.nTotalPages = nTotalPages;
348  rState.nPageStart = nPageStart;
349  rState.nDocPages = nDocPages;
350  if (bSavePageRanges)
351  {
352  rState.bSavedStateRanges = true;
353  rState.nTotalY = m_aRanges.m_nTotalY;
358  }
359 }
360 
362 {
363  rRange = aLastSourceRange;
364  return bSourceRangeValid;
365 }
366 
368 {
369  if (!pPageData)
370  return;
371 
372  sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() );
373  ScPrintRangeData& rData = pPageData->GetData(nCount); // count up
374 
376  rData.SetPrintRange( ScRange( nStartCol, nStartRow, nPrintTab,
377  nEndCol, nEndRow, nPrintTab ) );
378  // #i123672#
379  if(m_aRanges.m_aPageEndX.empty())
380  {
381  OSL_ENSURE(false, "vector access error for maPageEndX (!)");
382  }
383  else
384  {
385  rData.SetPagesX( m_aRanges.m_nPagesX, m_aRanges.m_aPageEndX.data());
386  }
387 
388  // #i123672#
389  if(m_aRanges.m_aPageEndY.empty())
390  {
391  OSL_ENSURE(false, "vector access error for maPageEndY (!)");
392  }
393  else
394  {
395  rData.SetPagesY( m_aRanges.m_nTotalY, m_aRanges.m_aPageEndY.data());
396  }
397 
398  // Settings
399  rData.SetTopDown( aTableParam.bTopDown );
400  rData.SetAutomatic( !aAreaParam.bPrintArea );
401 }
402 
404 {
405  pEditDefaults.reset();
406  pEditEngine.reset();
407 
408  // Printer settings are now restored from outside
409 
410  // For DrawingLayer/Charts, the MapMode of the printer (RefDevice) must always be correct
411  SfxPrinter* pDocPrinter = rDoc.GetPrinter(); // use Preview also for the printer
412  if (pDocPrinter)
413  pDocPrinter->SetMapMode(aOldPrinterMode);
414 }
415 
417 {
418  pDrawView = pNew;
419 }
420 
421 static void lcl_HidePrint( const ScTableInfo& rTabInfo, SCCOL nX1, SCCOL nX2 )
422 {
423  for (SCSIZE nArrY=1; nArrY+1<rTabInfo.mnArrCount; nArrY++)
424  {
425  RowInfo* pThisRowInfo = &rTabInfo.mpRowInfo[nArrY];
426  for (SCCOL nX=nX1; nX<=nX2; nX++)
427  {
428  CellInfo& rCellInfo = pThisRowInfo->pCellInfo[nX+1];
429  if (!rCellInfo.bEmptyCellText)
430  if (rCellInfo.pPatternAttr->
431  GetItem(ATTR_PROTECTION, rCellInfo.pConditionSet).GetHidePrint())
432  {
433  rCellInfo.maCell.clear();
434  rCellInfo.bEmptyCellText = true;
435  }
436  }
437  }
438 }
439 
440 // output to Device (static)
441 //
442 // us used for:
443 // - Clipboard/Bitmap
444 // - Ole-Object (DocShell::Draw)
445 // - Preview of templates
446 
447 void ScPrintFunc::DrawToDev(ScDocument& rDoc, OutputDevice* pDev, double /* nPrintFactor */,
448  const tools::Rectangle& rBound, ScViewData* pViewData, bool bMetaFile)
449 {
451 
452  SCTAB nTab = 0;
453  if (pViewData)
454  nTab = pViewData->GetTabNo();
455 
456  bool bDoGrid, bNullVal, bFormula;
457  ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
458  SfxStyleSheetBase* pStyleSheet = pStylePool->Find( rDoc.GetPageStyle( nTab ), SfxStyleFamily::Page );
459  if (pStyleSheet)
460  {
461  SfxItemSet& rSet = pStyleSheet->GetItemSet();
462  bDoGrid = rSet.Get(ATTR_PAGE_GRID).GetValue();
463  bNullVal = rSet.Get(ATTR_PAGE_NULLVALS).GetValue();
464  bFormula = rSet.Get(ATTR_PAGE_FORMULAS).GetValue();
465  }
466  else
467  {
468  const ScViewOptions& rOpt = rDoc.GetViewOptions();
469  bDoGrid = rOpt.GetOption(VOPT_GRID);
470  bNullVal = rOpt.GetOption(VOPT_NULLVALS);
471  bFormula = rOpt.GetOption(VOPT_FORMULAS);
472  }
473 
474  MapMode aMode = pDev->GetMapMode();
475 
476  tools::Rectangle aRect = rBound;
477 
478  if (aRect.Right() < aRect.Left() || aRect.Bottom() < aRect.Top())
479  aRect = tools::Rectangle( Point(), pDev->GetOutputSize() );
480 
481  SCCOL nX1 = 0;
482  SCROW nY1 = 0;
483  SCCOL nX2 = OLE_STD_CELLS_X - 1;
484  SCROW nY2 = OLE_STD_CELLS_Y - 1;
485  if (bMetaFile)
486  {
487  ScRange aRange = rDoc.GetRange( nTab, rBound );
488  nX1 = aRange.aStart.Col();
489  nY1 = aRange.aStart.Row();
490  nX2 = aRange.aEnd.Col();
491  nY2 = aRange.aEnd.Row();
492  }
493  else if (pViewData)
494  {
495  ScSplitPos eWhich = pViewData->GetActivePart();
496  ScHSplitPos eHWhich = WhichH(eWhich);
497  ScVSplitPos eVWhich = WhichV(eWhich);
498  nX1 = pViewData->GetPosX(eHWhich);
499  nY1 = pViewData->GetPosY(eVWhich);
500  nX2 = nX1 + pViewData->VisibleCellsX(eHWhich);
501  if (nX2>nX1) --nX2;
502  nY2 = nY1 + pViewData->VisibleCellsY(eVWhich);
503  if (nY2>nY1) --nY2;
504  }
505 
506  if (nX1 > rDoc.MaxCol()) nX1 = rDoc.MaxCol();
507  if (nX2 > rDoc.MaxCol()) nX2 = rDoc.MaxCol();
508  if (nY1 > rDoc.MaxRow()) nY1 = rDoc.MaxRow();
509  if (nY2 > rDoc.MaxRow()) nY2 = rDoc.MaxRow();
510 
511  tools::Long nDevSizeX = aRect.Right()-aRect.Left()+1;
512  tools::Long nDevSizeY = aRect.Bottom()-aRect.Top()+1;
513 
514  tools::Long nTwipsSizeX = 0;
515  for (SCCOL i=nX1; i<=nX2; i++)
516  nTwipsSizeX += rDoc.GetColWidth( i, nTab );
517  tools::Long nTwipsSizeY = static_cast<tools::Long>(rDoc.GetRowHeight( nY1, nY2, nTab ));
518 
519  // if no lines, still space for the outline frame (20 Twips = 1pt)
520  // (HasLines initializes aLines to 0,0,0,0)
521  nTwipsSizeX += 20;
522  nTwipsSizeY += 20;
523 
524  double nScaleX = static_cast<double>(nDevSizeX) / nTwipsSizeX;
525  double nScaleY = static_cast<double>(nDevSizeY) / nTwipsSizeY;
526 
528  ScRange aERange;
529  bool bEmbed = rDoc.IsEmbedded();
530  if (bEmbed)
531  {
532  rDoc.GetEmbedded(aERange);
533  rDoc.ResetEmbedded();
534  }
535 
536  // Assemble data
537 
538  ScTableInfo aTabInfo;
539  rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab,
540  nScaleX, nScaleY, false, bFormula );
541  lcl_HidePrint( aTabInfo, nX1, nX2 );
542 
543  if (bEmbed)
544  rDoc.SetEmbedded(aERange);
545 
546  tools::Long nScrX = aRect.Left();
547  tools::Long nScrY = aRect.Top();
548 
549  // If no lines, still leave space for grid lines
550  // (would be elseways cut away)
551  nScrX += 1;
552  nScrY += 1;
553 
554  ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, &rDoc, nTab,
555  nScrX, nScrY, nX1, nY1, nX2, nY2, nScaleX, nScaleY );
556  aOutputData.SetMetaFileMode(bMetaFile);
557  aOutputData.SetShowNullValues(bNullVal);
558  aOutputData.SetShowFormulas(bFormula);
559 
560  ScDrawLayer* pModel = rDoc.GetDrawLayer();
561  std::unique_ptr<FmFormView> pDrawView;
562 
563  if( pModel )
564  {
565  pDrawView.reset(
566  new FmFormView(
567  *pModel,
568  pDev));
569  pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
570  pDrawView->SetPrintPreview();
571  aOutputData.SetDrawView( pDrawView.get() );
572  }
573 
575 
576  if ( bMetaFile && pDev->IsVirtual() )
577  aOutputData.SetSnapPixel();
578 
579  Point aLogStart = pDev->PixelToLogic(Point(nScrX, nScrY), MapMode(MapUnit::Map100thMM));
580  tools::Long nLogStX = aLogStart.X();
581  tools::Long nLogStY = aLogStart.Y();
582 
584 
585  if (!bMetaFile && pViewData)
586  pDev->SetMapMode(pViewData->GetLogicMode(pViewData->GetActivePart()));
587 
588  // #i72502#
589  const Point aMMOffset(aOutputData.PrePrintDrawingLayer(nLogStX, nLogStY));
590  aOutputData.PrintDrawingLayer(SC_LAYER_BACK, aMMOffset);
591 
592  if (!bMetaFile && pViewData)
593  pDev->SetMapMode(aMode);
594 
595  aOutputData.DrawBackground(*pDev);
596 
597  aOutputData.DrawShadow();
598  aOutputData.DrawFrame(*pDev);
599  aOutputData.DrawStrings();
600 
601  if (!bMetaFile && pViewData)
602  pDev->SetMapMode(pViewData->GetLogicMode(pViewData->GetActivePart()));
603 
604  aOutputData.DrawEdit(!bMetaFile);
605 
606  if (bDoGrid)
607  {
608  if (!bMetaFile && pViewData)
609  pDev->SetMapMode(aMode);
610 
611  aOutputData.DrawGrid(*pDev, true, false); // no page breaks
612 
613  pDev->SetLineColor( COL_BLACK );
614 
615  Size aOne = pDev->PixelToLogic( Size(1,1) );
616  if (bMetaFile)
617  aOne = Size(1,1); // compatible with DrawGrid
618  tools::Long nRight = nScrX + aOutputData.GetScrW() - aOne.Width();
619  tools::Long nBottom = nScrY + aOutputData.GetScrH() - aOne.Height();
620 
621  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
622 
623  // extra line at the left edge for left-to-right, right for right-to-left
624  if ( bLayoutRTL )
625  pDev->DrawLine( Point(nRight,nScrY), Point(nRight,nBottom) );
626  else
627  pDev->DrawLine( Point(nScrX,nScrY), Point(nScrX,nBottom) );
628  // extra line at the top in both cases
629  pDev->DrawLine( Point(nScrX,nScrY), Point(nRight,nScrY) );
630  }
631 
632  // #i72502#
633  aOutputData.PrintDrawingLayer(SC_LAYER_FRONT, aMMOffset);
634  aOutputData.PrintDrawingLayer(SC_LAYER_INTERN, aMMOffset);
635  aOutputData.PostPrintDrawingLayer(aMMOffset); // #i74768#
636 }
637 
638 // Printing
639 
640 static void lcl_FillHFParam( ScPrintHFParam& rParam, const SfxItemSet* pHFSet )
641 {
642  // nDistance must be initialized differently before
643 
644  if ( pHFSet == nullptr )
645  {
646  rParam.bEnable = false;
647  rParam.pBorder = nullptr;
648  rParam.pBack = nullptr;
649  rParam.pShadow = nullptr;
650  }
651  else
652  {
653  rParam.bEnable = pHFSet->Get(ATTR_PAGE_ON).GetValue();
654  rParam.bDynamic = pHFSet->Get(ATTR_PAGE_DYNAMIC).GetValue();
655  rParam.bShared = pHFSet->Get(ATTR_PAGE_SHARED).GetValue();
656  rParam.nHeight = pHFSet->Get(ATTR_PAGE_SIZE).GetSize().Height();
657  const SvxLRSpaceItem* pHFLR = &pHFSet->Get(ATTR_LRSPACE);
658  tools::Long nTmp;
659  nTmp = pHFLR->GetLeft();
660  rParam.nLeft = nTmp < 0 ? 0 : sal_uInt16(nTmp);
661  nTmp = pHFLR->GetRight();
662  rParam.nRight = nTmp < 0 ? 0 : sal_uInt16(nTmp);
663  rParam.pBorder = &pHFSet->Get(ATTR_BORDER);
664  rParam.pBack = &pHFSet->Get(ATTR_BACKGROUND);
665  rParam.pShadow = &pHFSet->Get(ATTR_SHADOW);
666 
667 // now back in the dialog:
668 // rParam.nHeight += rParam.nDistance; // not in the dialog any more ???
669 
670  rParam.nHeight += lcl_LineTotal( rParam.pBorder->GetTop() ) +
671  lcl_LineTotal( rParam.pBorder->GetBottom() );
672 
673  rParam.nManHeight = rParam.nHeight;
674  }
675 
676  if (!rParam.bEnable)
677  rParam.nHeight = 0;
678 }
679 
680 // bNew = TRUE: search for used part of the document
681 // bNew = FALSE: only limit whole lines/columns
682 
684 {
685  SCCOL nOldEndCol = nEndCol; // only important for !bNew
686  SCROW nOldEndRow = nEndRow;
687  bool bChangeCol = true; // at bNew both are being adjusted
688  bool bChangeRow = true;
689 
690  bool bNotes = aTableParam.bNotes;
691  if ( bNew )
692  {
693  nStartCol = 0;
694  nStartRow = 0;
695  if (!rDoc.GetPrintArea( nPrintTab, nEndCol, nEndRow, bNotes ))
696  return false; // nothing
697  bPrintAreaValid = true;
698  }
699  else
700  {
701  bool bFound = true;
702  bChangeCol = ( nStartCol == 0 && nEndCol == rDoc.MaxCol() );
703  bChangeRow = ( nStartRow == 0 && nEndRow == rDoc.MaxRow() );
704  bool bForcedChangeRow = false;
705 
706  // #i53558# Crop entire column of old row limit to real print area with
707  // some fuzzyness.
708  if (!bChangeRow && nStartRow == 0)
709  {
710  SCROW nPAEndRow;
711  bFound = rDoc.GetPrintAreaVer( nPrintTab, nStartCol, nEndCol, nPAEndRow, bNotes );
712  // Say we don't want to print more than ~1000 empty rows, which are
713  // about 14 pages intentionally left blank...
714  const SCROW nFuzzy = 23*42;
715  if (nPAEndRow + nFuzzy < nEndRow)
716  {
717  bForcedChangeRow = true;
718  nEndRow = nPAEndRow;
719  }
720  else
721  bFound = true; // user seems to _want_ to print some empty rows
722  }
723  // TODO: in case we extend the number of columns we may have to do the
724  // same for horizontal cropping.
725 
726  if ( bChangeCol && bChangeRow )
727  bFound = rDoc.GetPrintArea( nPrintTab, nEndCol, nEndRow, bNotes );
728  else if ( bChangeCol )
730  else if ( bChangeRow )
731  bFound = rDoc.GetPrintAreaVer( nPrintTab, nStartCol, nEndCol, nEndRow, bNotes );
732 
733  if (!bFound)
734  return false; // empty
735 
736  bPrintAreaValid = true;
737  if (bForcedChangeRow)
738  bChangeRow = true;
739  }
740 
742  rDoc.ExtendMerge( nStartCol,nStartRow, nEndCol,nEndRow, nPrintTab ); // no Refresh, incl. Attrs
743 
744  if ( bChangeCol )
745  {
746  OutputDevice* pRefDev = rDoc.GetPrinter(); // use the printer also for Preview
747  pRefDev->SetMapMode(MapMode(MapUnit::MapPixel)); // important for GetNeededSize
748 
749  rDoc.ExtendPrintArea( pRefDev,
751  // changing nEndCol
752  }
753 
754  if ( nEndCol < rDoc.MaxCol() && rDoc.HasAttrib(
756  ++nEndCol;
757  if ( nEndRow < rDoc.MaxRow() && rDoc.HasAttrib(
759  ++nEndRow;
760 
761  if (!bChangeCol) nEndCol = nOldEndCol;
762  if (!bChangeRow) nEndRow = nOldEndRow;
763 
764  return true;
765 }
766 
768 {
769  if (!pObject)
770  return 0;
771 
772  pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false );
773 
774  return static_cast<tools::Long>(pEditEngine->GetTextHeight());
775 }
776 
777 // nZoom must be set !!!
778 // and the respective Twip-MapMode configured
779 
781 {
782  OSL_ENSURE( aPageSize.Width(), "UpdateHFHeight without aPageSize");
783 
784  if (!(rParam.bEnable && rParam.bDynamic))
785  return;
786 
787  // calculate nHeight from content
788 
789  MakeEditEngine();
790  tools::Long nPaperWidth = ( aPageSize.Width() - nLeftMargin - nRightMargin -
791  rParam.nLeft - rParam.nRight ) * 100 / nZoom;
792  if (rParam.pBorder)
793  nPaperWidth -= ( rParam.pBorder->GetDistance(SvxBoxItemLine::LEFT) +
794  rParam.pBorder->GetDistance(SvxBoxItemLine::RIGHT) +
795  lcl_LineTotal(rParam.pBorder->GetLeft()) +
796  lcl_LineTotal(rParam.pBorder->GetRight()) ) * 100 / nZoom;
797 
798  if (rParam.pShadow && rParam.pShadow->GetLocation() != SvxShadowLocation::NONE)
799  nPaperWidth -= ( rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT) +
800  rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT) ) * 100 / nZoom;
801 
802  pEditEngine->SetPaperSize( Size( nPaperWidth, 10000 ) );
803 
804  tools::Long nMaxHeight = 0;
805  if ( rParam.pLeft )
806  {
807  nMaxHeight = std::max( nMaxHeight, TextHeight( rParam.pLeft->GetLeftArea() ) );
808  nMaxHeight = std::max( nMaxHeight, TextHeight( rParam.pLeft->GetCenterArea() ) );
809  nMaxHeight = std::max( nMaxHeight, TextHeight( rParam.pLeft->GetRightArea() ) );
810  }
811  if ( rParam.pRight )
812  {
813  nMaxHeight = std::max( nMaxHeight, TextHeight( rParam.pRight->GetLeftArea() ) );
814  nMaxHeight = std::max( nMaxHeight, TextHeight( rParam.pRight->GetCenterArea() ) );
815  nMaxHeight = std::max( nMaxHeight, TextHeight( rParam.pRight->GetRightArea() ) );
816  }
817 
818  rParam.nHeight = nMaxHeight + rParam.nDistance;
819  if (rParam.pBorder)
820  rParam.nHeight += rParam.pBorder->GetDistance(SvxBoxItemLine::TOP) +
821  rParam.pBorder->GetDistance(SvxBoxItemLine::BOTTOM) +
822  lcl_LineTotal( rParam.pBorder->GetTop() ) +
823  lcl_LineTotal( rParam.pBorder->GetBottom() );
824  if (rParam.pShadow && rParam.pShadow->GetLocation() != SvxShadowLocation::NONE)
825  rParam.nHeight += rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) +
826  rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM);
827 
828  if (rParam.nHeight < rParam.nManHeight)
829  rParam.nHeight = rParam.nManHeight; // configured minimum
830 }
831 
832 void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
833 {
834  if (!pParamSet)
835  return;
836 
837  // TabPage "Page"
838  const SvxLRSpaceItem* pLRItem = &pParamSet->Get( ATTR_LRSPACE );
839  tools::Long nTmp;
840  nTmp = pLRItem->GetLeft();
841  nLeftMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
842  nTmp = pLRItem->GetRight();
843  nRightMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
844  const SvxULSpaceItem* pULItem = &pParamSet->Get( ATTR_ULSPACE );
845  nTopMargin = pULItem->GetUpper();
846  nBottomMargin = pULItem->GetLower();
847 
848  const SvxPageItem* pPageItem = &pParamSet->Get( ATTR_PAGE );
849  nPageUsage = pPageItem->GetPageUsage();
850  bLandscape = pPageItem->IsLandscape();
851  aFieldData.eNumType = pPageItem->GetNumType();
852 
855 
856  aPageSize = pParamSet->Get(ATTR_PAGE_SIZE).GetSize();
857  if ( !aPageSize.Width() || !aPageSize.Height() )
858  {
859  OSL_FAIL("PageSize Null ?!?!?");
861  }
862 
866 
867  // TabPage "Headline"
868 
869  aHdr.pLeft = &pParamSet->Get(ATTR_PAGE_HEADERLEFT); // Content
871 
872  const SvxSetItem* pHeaderSetItem;
873  const SfxItemSet* pHeaderSet = nullptr;
875  reinterpret_cast<const SfxPoolItem**>(&pHeaderSetItem) ) == SfxItemState::SET )
876  {
877  pHeaderSet = &pHeaderSetItem->GetItemSet();
878  // Headline has space below
879  aHdr.nDistance = pHeaderSet->Get(ATTR_ULSPACE).GetLower();
880  }
881  lcl_FillHFParam( aHdr, pHeaderSet );
882 
883  // TabPage "Footline"
884 
885  aFtr.pLeft = &pParamSet->Get(ATTR_PAGE_FOOTERLEFT); // Content
887 
888  const SvxSetItem* pFooterSetItem;
889  const SfxItemSet* pFooterSet = nullptr;
891  reinterpret_cast<const SfxPoolItem**>(&pFooterSetItem) ) == SfxItemState::SET )
892  {
893  pFooterSet = &pFooterSetItem->GetItemSet();
894  // Footline has space above
895  aFtr.nDistance = pFooterSet->Get(ATTR_ULSPACE).GetUpper();
896  }
897  lcl_FillHFParam( aFtr, pFooterSet );
898 
899  // Compile Table-/Area-Params from single Items
900 
901  // TabPage "Table"
902 
903  const SfxUInt16Item* pScaleItem = nullptr;
904  const ScPageScaleToItem* pScaleToItem = nullptr;
905  const SfxUInt16Item* pScaleToPagesItem = nullptr;
906  SfxItemState eState;
907 
908  eState = pParamSet->GetItemState( ATTR_PAGE_SCALE, false,
909  reinterpret_cast<const SfxPoolItem**>(&pScaleItem) );
910  if ( SfxItemState::DEFAULT == eState )
911  pScaleItem = &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALE );
912 
913  eState = pParamSet->GetItemState( ATTR_PAGE_SCALETO, false,
914  reinterpret_cast<const SfxPoolItem**>(&pScaleToItem) );
915  if ( SfxItemState::DEFAULT == eState )
916  pScaleToItem = &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETO );
917 
919  reinterpret_cast<const SfxPoolItem**>(&pScaleToPagesItem) );
920  if ( SfxItemState::DEFAULT == eState )
921  pScaleToPagesItem = &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETOPAGES );
922 
923  OSL_ENSURE( pScaleItem && pScaleToItem && pScaleToPagesItem, "Missing ScaleItem! :-/" );
924 
925  aTableParam.bCellContent = true;
927  aTableParam.bGrid = lcl_GetBool(pParamSet,ATTR_PAGE_GRID);
938  aTableParam.nFirstPageNo = static_cast<sal_uInt16>(nPageStart); // from previous table
939 
940  if ( pScaleItem && pScaleToItem && pScaleToPagesItem )
941  {
942  sal_uInt16 nScaleAll = pScaleItem->GetValue();
943  sal_uInt16 nScaleToPages = pScaleToPagesItem->GetValue();
944 
945  aTableParam.bScaleNone = (nScaleAll == 100);
946  aTableParam.bScaleAll = (nScaleAll > 0 );
947  aTableParam.bScaleTo = pScaleToItem->IsValid();
948  aTableParam.bScalePageNum = (nScaleToPages > 0 );
949  aTableParam.nScaleAll = nScaleAll;
950  aTableParam.nScaleWidth = pScaleToItem->GetWidth();
951  aTableParam.nScaleHeight = pScaleToItem->GetHeight();
952  aTableParam.nScalePageNum = nScaleToPages;
953  }
954  else
955  {
956  aTableParam.bScaleNone = true;
957  aTableParam.bScaleAll = false;
958  aTableParam.bScaleTo = false;
959  aTableParam.bScalePageNum = false;
964  }
965 
966  // skip empty pages only if options with that flag are passed
967  aTableParam.bSkipEmpty = pOptions && pOptions->GetSkipEmpty();
968  if ( pPageData )
969  aTableParam.bSkipEmpty = false;
970  // If pPageData is set, only the breaks are interesting for the
971  // pagebreak preview, empty pages are not addressed separately.
972 
973  aTableParam.bForceBreaks = pOptions && pOptions->GetForceBreaks();
974 
975  // TabPage "Parts":
976 
978  const ScRange* pPrintArea = rDoc.GetPrintRange( nPrintTab, 0 );
979  const ScRange* pRepeatCol = rDoc.GetRepeatColRange( nPrintTab );
980  const ScRange* pRepeatRow = rDoc.GetRepeatRowRange( nPrintTab );
981 
982  // ignoring ATTR_PAGE_PRINTTABLES
983 
984  bool bHasPrintRange = rDoc.HasPrintRange();
985  sal_uInt16 nPrintRangeCount = rDoc.GetPrintRangeCount(nPrintTab);
986  bool bPrintEntireSheet = rDoc.IsPrintEntireSheet(nPrintTab);
987 
988  if (!bPrintEntireSheet && !nPrintRangeCount)
989  mbHasPrintRange = false;
990 
991  if ( pUserArea ) // UserArea (selection) has priority
992  {
994  aAreaParam.bPrintArea = true; // Selection
996 
997  // The table-query is already in DocShell::Print, here always
1000  }
1001  else if (bHasPrintRange)
1002  {
1003  if ( pPrintArea ) // at least one set?
1004  {
1006  aAreaParam.bPrintArea = true;
1007  aAreaParam.aPrintArea = *pPrintArea;
1008 
1009  bMultiArea = nPrintRangeCount > 1;
1010  }
1011  else
1012  {
1013  // do not print hidden sheets with "Print entire sheet" flag
1015  aAreaParam.bPrintArea = !bPrintCurrentTable; // otherwise the table is always counted
1016  }
1017  }
1018  else
1019  {
1020  // don't print hidden tables if there's no print range defined there
1021  if ( rDoc.IsVisible( nPrintTab ) )
1022  {
1023  aAreaParam.bPrintArea = false;
1024  bPrintCurrentTable = true;
1025  }
1026  else
1027  {
1028  aAreaParam.bPrintArea = true; // otherwise the table is always counted
1029  bPrintCurrentTable = false;
1030  }
1031  }
1032 
1033  if ( pRepeatCol )
1034  {
1035  aAreaParam.bRepeatCol = true;
1036  nRepeatStartCol = pRepeatCol->aStart.Col();
1037  nRepeatEndCol = pRepeatCol->aEnd .Col();
1038  }
1039  else
1040  {
1041  aAreaParam.bRepeatCol = false;
1043  }
1044 
1045  if ( pRepeatRow )
1046  {
1047  aAreaParam.bRepeatRow = true;
1048  nRepeatStartRow = pRepeatRow->aStart.Row();
1049  nRepeatEndRow = pRepeatRow->aEnd .Row();
1050  }
1051  else
1052  {
1053  aAreaParam.bRepeatRow = false;
1055  }
1056 
1057  // Split pages
1058 
1059  if (!bPrintAreaValid)
1060  {
1061  nTabPages = CountPages(); // also calculates zoom
1064  }
1065  else
1066  {
1067  CalcPages(); // search breaks only
1068  CountNotePages(); // Count notes, even if number of pages is already known
1069  }
1070 
1071  if (nDocPages)
1073  else
1075 
1077 
1078  if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
1079  aFieldData.aTitle = pDocShell->getDocProperties()->getTitle();
1080  else
1082 
1083  const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
1085  if ( !aFieldData.aLongDocName.isEmpty() )
1087  else
1089 
1090  // Printer settings (Orientation, Paper) at DoPrint
1091 }
1092 
1094 {
1095  Size aSize = aPageSize;
1096  aSize.AdjustWidth( -(nLeftMargin + nRightMargin) );
1097  aSize.AdjustHeight( -(nTopMargin + nBottomMargin) );
1098  aSize.AdjustHeight( -(aHdr.nHeight + aFtr.nHeight) );
1099  return aSize;
1100 }
1101 
1102 void ScPrintFunc::GetScaleData( Size& rPhysSize, tools::Long& rDocHdr, tools::Long& rDocFtr )
1103 {
1104  rPhysSize = aPageSize;
1105  rPhysSize.AdjustWidth( -(nLeftMargin + nRightMargin) );
1106  rPhysSize.AdjustHeight( -(nTopMargin + nBottomMargin) );
1107 
1108  rDocHdr = aHdr.nHeight;
1109  rDocFtr = aFtr.nHeight;
1110 }
1111 
1112 void ScPrintFunc::SetDateTime( const DateTime& rDateTime )
1113 {
1114  aFieldData.aDateTime = rDateTime;
1115 }
1116 
1117 static void lcl_DrawGraphic( const Graphic &rGraphic, vcl::RenderContext& rOutDev,
1118  const tools::Rectangle &rGrf, const tools::Rectangle &rOut )
1119 {
1120  const bool bNotInside = !rOut.IsInside( rGrf );
1121  if ( bNotInside )
1122  {
1123  rOutDev.Push();
1124  rOutDev.IntersectClipRegion( rOut );
1125  }
1126 
1127  rGraphic.Draw(rOutDev, rGrf.TopLeft(), rGrf.GetSize());
1128 
1129  if ( bNotInside )
1130  rOutDev.Pop();
1131 }
1132 
1133 static void lcl_DrawGraphic( const SvxBrushItem &rBrush, vcl::RenderContext& rOutDev, const OutputDevice* pRefDev,
1134  const tools::Rectangle &rOrg, const tools::Rectangle &rOut,
1135  OUString const & referer )
1136 {
1137  Size aGrfSize(0,0);
1138  const Graphic *pGraphic = rBrush.GetGraphic(referer);
1140  if ( pGraphic && pGraphic->IsSupportedGraphic() )
1141  {
1142  const MapMode aMapMM( MapUnit::Map100thMM );
1143  if ( pGraphic->GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
1144  aGrfSize = pRefDev->PixelToLogic( pGraphic->GetPrefSize(), aMapMM );
1145  else
1146  aGrfSize = OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
1147  pGraphic->GetPrefMapMode(), aMapMM );
1148  ePos = rBrush.GetGraphicPos();
1149  }
1150  else
1151  ePos = GPOS_NONE;
1152 
1153  Point aPos;
1154  Size aDrawSize = aGrfSize;
1155 
1156  bool bDraw = true;
1157  switch ( ePos )
1158  {
1159  case GPOS_LT: aPos = rOrg.TopLeft();
1160  break;
1161  case GPOS_MT: aPos.setY( rOrg.Top() );
1162  aPos.setX( rOrg.Left() + rOrg.GetSize().Width()/2 - aGrfSize.Width()/2 );
1163  break;
1164  case GPOS_RT: aPos.setY( rOrg.Top() );
1165  aPos.setX( rOrg.Right() - aGrfSize.Width() );
1166  break;
1167 
1168  case GPOS_LM: aPos.setY( rOrg.Top() + rOrg.GetSize().Height()/2 - aGrfSize.Height()/2 );
1169  aPos.setX( rOrg.Left() );
1170  break;
1171  case GPOS_MM: aPos.setY( rOrg.Top() + rOrg.GetSize().Height()/2 - aGrfSize.Height()/2 );
1172  aPos.setX( rOrg.Left() + rOrg.GetSize().Width()/2 - aGrfSize.Width()/2 );
1173  break;
1174  case GPOS_RM: aPos.setY( rOrg.Top() + rOrg.GetSize().Height()/2 - aGrfSize.Height()/2 );
1175  aPos.setX( rOrg.Right() - aGrfSize.Width() );
1176  break;
1177 
1178  case GPOS_LB: aPos.setY( rOrg.Bottom() - aGrfSize.Height() );
1179  aPos.setX( rOrg.Left() );
1180  break;
1181  case GPOS_MB: aPos.setY( rOrg.Bottom() - aGrfSize.Height() );
1182  aPos.setX( rOrg.Left() + rOrg.GetSize().Width()/2 - aGrfSize.Width()/2 );
1183  break;
1184  case GPOS_RB: aPos.setY( rOrg.Bottom() - aGrfSize.Height() );
1185  aPos.setX( rOrg.Right() - aGrfSize.Width() );
1186  break;
1187 
1188  case GPOS_AREA:
1189  aPos = rOrg.TopLeft();
1190  aDrawSize = rOrg.GetSize();
1191  break;
1192  case GPOS_TILED:
1193  {
1194  // use GraphicObject::DrawTiled instead of an own loop
1195  // (pixel rounding is handled correctly, and a very small bitmap
1196  // is duplicated into a bigger one for better performance)
1197 
1198  GraphicObject aObject( *pGraphic );
1199 
1200  if( rOutDev.GetOutDevType() == OUTDEV_PDF &&
1201  (aObject.GetType() == GraphicType::Bitmap || aObject.GetType() == GraphicType::Default) )
1202  {
1203  // For PDF export, every draw
1204  // operation for bitmaps takes a noticeable
1205  // amount of place (~50 characters). Thus,
1206  // optimize between tile bitmap size and
1207  // number of drawing operations here.
1208  //
1209  // A_out
1210  // n_chars = k1 * ---------- + k2 * A_bitmap
1211  // A_bitmap
1212  //
1213  // minimum n_chars is obtained for (derive for
1214  // A_bitmap, set to 0, take positive
1215  // solution):
1216  // k1
1217  // A_bitmap = Sqrt( ---- A_out )
1218  // k2
1219  //
1220  // where k1 is the number of chars per draw
1221  // operation, and k2 is the number of chars
1222  // per bitmap pixel. This is approximately 50
1223  // and 7 for current PDF writer, respectively.
1224 
1225  const double k1( 50 );
1226  const double k2( 7 );
1227  const Size aSize( rOrg.GetSize() );
1228  const double Abitmap( k1/k2 * aSize.Width()*aSize.Height() );
1229 
1230  aObject.DrawTiled( rOutDev, rOrg, aGrfSize, Size(0,0),
1231  ::std::max( 128, static_cast<int>( sqrt(sqrt( Abitmap)) + .5 ) ) );
1232  }
1233  else
1234  {
1235  aObject.DrawTiled( rOutDev, rOrg, aGrfSize, Size(0,0) );
1236  }
1237 
1238  bDraw = false;
1239  }
1240  break;
1241 
1242  case GPOS_NONE:
1243  bDraw = false;
1244  break;
1245 
1246  default: OSL_ENSURE( false, "new Graphic position?" );
1247  }
1248  tools::Rectangle aGrf( aPos,aDrawSize );
1249  if ( bDraw && aGrf.IsOver( rOut ) )
1250  {
1251  lcl_DrawGraphic( *pGraphic, rOutDev, aGrf, rOut );
1252  }
1253 }
1254 
1255 // The frame is drawn inwards
1256 
1258  const SvxBoxItem* pBorderData, const SvxBrushItem* pBackground,
1259  const SvxShadowItem* pShadow )
1260 {
1262 
1263  if (pBorderData)
1264  if ( !pBorderData->GetTop() && !pBorderData->GetBottom() && !pBorderData->GetLeft() &&
1265  !pBorderData->GetRight() )
1266  pBorderData = nullptr;
1267 
1268  if (!pBorderData && !pBackground && !pShadow)
1269  return; // nothing to do
1270 
1271  tools::Long nLeft = 0;
1272  tools::Long nRight = 0;
1273  tools::Long nTop = 0;
1274  tools::Long nBottom = 0;
1275 
1276  // aFrameRect - outside around frame, without shadow
1277  if ( pShadow && pShadow->GetLocation() != SvxShadowLocation::NONE )
1278  {
1279  nLeft += static_cast<tools::Long>( pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX );
1280  nRight += static_cast<tools::Long>( pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX );
1281  nTop += static_cast<tools::Long>( pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY );
1282  nBottom += static_cast<tools::Long>( pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY );
1283  }
1284  tools::Rectangle aFrameRect( Point(nScrX+nLeft, nScrY+nTop),
1285  Size(nScrW-nLeft-nRight, nScrH-nTop-nBottom) );
1286 
1287  // center of frame, to paint lines through OutputData
1288  if (pBorderData)
1289  {
1290  nLeft += static_cast<tools::Long>( lcl_LineTotal(pBorderData->GetLeft()) * nScaleX / 2 );
1291  nRight += static_cast<tools::Long>( lcl_LineTotal(pBorderData->GetRight()) * nScaleX / 2 );
1292  nTop += static_cast<tools::Long>( lcl_LineTotal(pBorderData->GetTop()) * nScaleY / 2 );
1293  nBottom += static_cast<tools::Long>( lcl_LineTotal(pBorderData->GetBottom()) * nScaleY / 2 );
1294  }
1295  tools::Long nEffHeight = nScrH - nTop - nBottom;
1296  tools::Long nEffWidth = nScrW - nLeft - nRight;
1297  if (nEffHeight<=0 || nEffWidth<=0)
1298  return; // empty
1299 
1300  if ( pBackground )
1301  {
1302  if (pBackground->GetGraphicPos() != GPOS_NONE)
1303  {
1304  OutputDevice* pRefDev;
1305  if ( bIsRender )
1306  pRefDev = pDev; // don't use printer for PDF
1307  else
1308  pRefDev = rDoc.GetPrinter(); // use printer also for preview
1309  OUString referer;
1310  if (pDocShell->HasName()) {
1311  referer = pDocShell->GetMedium()->GetName();
1312  }
1313  lcl_DrawGraphic(*pBackground, *pDev, pRefDev, aFrameRect, aFrameRect, referer);
1314  }
1315  else
1316  {
1317  pDev->SetFillColor(pBackground->GetColor());
1318  pDev->SetLineColor();
1319  pDev->DrawRect(aFrameRect);
1320  }
1321  }
1322 
1323  if ( pShadow && pShadow->GetLocation() != SvxShadowLocation::NONE )
1324  {
1325  pDev->SetFillColor(pShadow->GetColor());
1326  pDev->SetLineColor();
1327  tools::Long nShadowX = static_cast<tools::Long>( pShadow->GetWidth() * nScaleX );
1328  tools::Long nShadowY = static_cast<tools::Long>( pShadow->GetWidth() * nScaleY );
1329  switch (pShadow->GetLocation())
1330  {
1331  case SvxShadowLocation::TopLeft:
1333  aFrameRect.Left()-nShadowX, aFrameRect.Top()-nShadowY,
1334  aFrameRect.Right()-nShadowX, aFrameRect.Top() ) );
1336  aFrameRect.Left()-nShadowX, aFrameRect.Top()-nShadowY,
1337  aFrameRect.Left(), aFrameRect.Bottom()-nShadowY ) );
1338  break;
1339  case SvxShadowLocation::TopRight:
1341  aFrameRect.Left()+nShadowX, aFrameRect.Top()-nShadowY,
1342  aFrameRect.Right()+nShadowX, aFrameRect.Top() ) );
1344  aFrameRect.Right(), aFrameRect.Top()-nShadowY,
1345  aFrameRect.Right()+nShadowX, aFrameRect.Bottom()-nShadowY ) );
1346  break;
1347  case SvxShadowLocation::BottomLeft:
1349  aFrameRect.Left()-nShadowX, aFrameRect.Bottom(),
1350  aFrameRect.Right()-nShadowX, aFrameRect.Bottom()+nShadowY ) );
1352  aFrameRect.Left()-nShadowX, aFrameRect.Top()+nShadowY,
1353  aFrameRect.Left(), aFrameRect.Bottom()+nShadowY ) );
1354  break;
1355  case SvxShadowLocation::BottomRight:
1357  aFrameRect.Left()+nShadowX, aFrameRect.Bottom(),
1358  aFrameRect.Right()+nShadowX, aFrameRect.Bottom()+nShadowY ) );
1360  aFrameRect.Right(), aFrameRect.Top()+nShadowY,
1361  aFrameRect.Right()+nShadowX, aFrameRect.Bottom()+nShadowY ) );
1362  break;
1363  default:
1364  {
1365  // added to avoid warnings
1366  }
1367  }
1368  }
1369 
1370  if (!pBorderData)
1371  return;
1372 
1373  ScDocumentUniquePtr pBorderDoc(new ScDocument( SCDOCMODE_UNDO ));
1374  pBorderDoc->InitUndo( rDoc, 0,0, true,true );
1375  pBorderDoc->ApplyAttr( 0,0,0, *pBorderData );
1376 
1377  ScTableInfo aTabInfo;
1378  pBorderDoc->FillInfo( aTabInfo, 0,0, 0,0, 0,
1379  nScaleX, nScaleY, false, false );
1380  OSL_ENSURE(aTabInfo.mnArrCount,"nArrCount == 0");
1381 
1382  aTabInfo.mpRowInfo[1].nHeight = static_cast<sal_uInt16>(nEffHeight);
1383  aTabInfo.mpRowInfo[0].pCellInfo[1].nWidth =
1384  aTabInfo.mpRowInfo[1].pCellInfo[1].nWidth = static_cast<sal_uInt16>(nEffWidth);
1385 
1386  ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pBorderDoc.get(), 0,
1387  nScrX+nLeft, nScrY+nTop, 0,0, 0,0, nScaleX, nScaleY );
1388  aOutputData.SetUseStyleColor( bUseStyleColor );
1389 
1390  aOutputData.DrawFrame(*pDev);
1391 }
1392 
1394 {
1395  bool bLayoutRTL = rDoc.IsLayoutRTL( nPrintTab );
1396  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
1397 
1398  Size aOnePixel = pDev->PixelToLogic(Size(1,1));
1399  tools::Long nOneX = aOnePixel.Width();
1400  tools::Long nOneY = aOnePixel.Height();
1401  SCCOL nCol;
1402 
1403  tools::Long nHeight = static_cast<tools::Long>(PRINT_HEADER_HEIGHT * nScaleY);
1404  tools::Long nEndY = nScrY + nHeight - nOneY;
1405 
1406  tools::Long nPosX = nScrX;
1407  if ( bLayoutRTL )
1408  {
1409  for (nCol=nX1; nCol<=nX2; nCol++)
1410  nPosX += static_cast<tools::Long>( rDoc.GetColWidth( nCol, nPrintTab ) * nScaleX );
1411  }
1412  else
1413  nPosX -= nOneX;
1414  tools::Long nPosY = nScrY - nOneY;
1415  OUString aText;
1416 
1417  for (nCol=nX1; nCol<=nX2; nCol++)
1418  {
1419  sal_uInt16 nDocW = rDoc.GetColWidth( nCol, nPrintTab );
1420  if (nDocW)
1421  {
1422  tools::Long nWidth = static_cast<tools::Long>(nDocW * nScaleX);
1423  tools::Long nEndX = nPosX + nWidth * nLayoutSign;
1424 
1425  pDev->DrawRect( tools::Rectangle( nPosX,nPosY,nEndX,nEndY ) );
1426 
1427  aText = ::ScColToAlpha( nCol);
1428  tools::Long nTextWidth = pDev->GetTextWidth(aText);
1429  tools::Long nTextHeight = pDev->GetTextHeight();
1430  tools::Long nAddX = ( nWidth - nTextWidth ) / 2;
1431  tools::Long nAddY = ( nHeight - nTextHeight ) / 2;
1432  tools::Long nTextPosX = nPosX+nAddX;
1433  if ( bLayoutRTL )
1434  nTextPosX -= nWidth;
1435  pDev->DrawText( Point( nTextPosX,nPosY+nAddY ), aText );
1436 
1437  nPosX = nEndX;
1438  }
1439  }
1440 }
1441 
1443 {
1444  Size aOnePixel = pDev->PixelToLogic(Size(1,1));
1445  tools::Long nOneX = aOnePixel.Width();
1446  tools::Long nOneY = aOnePixel.Height();
1447 
1448  bool bLayoutRTL = rDoc.IsLayoutRTL( nPrintTab );
1449 
1450  tools::Long nWidth = static_cast<tools::Long>(PRINT_HEADER_WIDTH * nScaleX);
1451  tools::Long nEndX = nScrX + nWidth;
1452  tools::Long nPosX = nScrX;
1453  if ( !bLayoutRTL )
1454  {
1455  nEndX -= nOneX;
1456  nPosX -= nOneX;
1457  }
1458  tools::Long nPosY = nScrY - nOneY;
1459  OUString aText;
1460 
1461  for (SCROW nRow=nY1; nRow<=nY2; nRow++)
1462  {
1463  sal_uInt16 nDocH = rDoc.GetRowHeight( nRow, nPrintTab );
1464  if (nDocH)
1465  {
1466  tools::Long nHeight = static_cast<tools::Long>(nDocH * nScaleY);
1467  tools::Long nEndY = nPosY + nHeight;
1468 
1469  pDev->DrawRect( tools::Rectangle( nPosX,nPosY,nEndX,nEndY ) );
1470 
1471  aText = OUString::number( nRow+1 );
1472  tools::Long nTextWidth = pDev->GetTextWidth(aText);
1473  tools::Long nTextHeight = pDev->GetTextHeight();
1474  tools::Long nAddX = ( nWidth - nTextWidth ) / 2;
1475  tools::Long nAddY = ( nHeight - nTextHeight ) / 2;
1476  pDev->DrawText( Point( nPosX+nAddX,nPosY+nAddY ), aText );
1477 
1478  nPosY = nEndY;
1479  }
1480  }
1481 }
1482 
1484  bool bRepCol, ScPreviewLocationData& rLocationData )
1485 {
1486  Size aOnePixel = pDev->PixelToLogic(Size(1,1));
1487  tools::Long nOneX = aOnePixel.Width();
1488  tools::Long nOneY = aOnePixel.Height();
1489 
1490  tools::Long nHeight = static_cast<tools::Long>(PRINT_HEADER_HEIGHT * nScaleY);
1491  tools::Long nEndY = nScrY + nHeight - nOneY;
1492 
1493  tools::Long nPosX = nScrX - nOneX;
1494  for (SCCOL nCol=nX1; nCol<=nX2; nCol++)
1495  {
1496  sal_uInt16 nDocW = rDoc.GetColWidth( nCol, nPrintTab );
1497  if (nDocW)
1498  nPosX += static_cast<tools::Long>(nDocW * nScaleX);
1499  }
1500  tools::Rectangle aCellRect( nScrX, nScrY, nPosX, nEndY );
1501  rLocationData.AddColHeaders( aCellRect, nX1, nX2, bRepCol );
1502 }
1503 
1505  bool bRepRow, ScPreviewLocationData& rLocationData )
1506 {
1507  Size aOnePixel = pDev->PixelToLogic(Size(1,1));
1508  tools::Long nOneX = aOnePixel.Width();
1509  tools::Long nOneY = aOnePixel.Height();
1510 
1511  bool bLayoutRTL = rDoc.IsLayoutRTL( nPrintTab );
1512 
1513  tools::Long nWidth = static_cast<tools::Long>(PRINT_HEADER_WIDTH * nScaleX);
1514  tools::Long nEndX = nScrX + nWidth;
1515  if ( !bLayoutRTL )
1516  nEndX -= nOneX;
1517 
1518  tools::Long nPosY = nScrY - nOneY;
1519  nPosY += rDoc.GetScaledRowHeight( nY1, nY2, nPrintTab, nScaleY);
1520  tools::Rectangle aCellRect( nScrX, nScrY, nEndX, nPosY );
1521  rLocationData.AddRowHeaders( aCellRect, nY1, nY2, bRepRow );
1522 }
1523 
1524 void ScPrintFunc::LocateArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
1525  tools::Long nScrX, tools::Long nScrY, bool bRepCol, bool bRepRow,
1526  ScPreviewLocationData& rLocationData )
1527 {
1528  // get MapMode for drawing objects (same MapMode as in ScOutputData::PrintDrawingLayer)
1529 
1530  Point aLogPos = OutputDevice::LogicToLogic(Point(nScrX,nScrY), aOffsetMode, aLogicMode);
1531  tools::Long nLogStX = aLogPos.X();
1532  tools::Long nLogStY = aLogPos.Y();
1533 
1534  SCCOL nCol;
1535  Point aTwipOffset;
1536  for (nCol=0; nCol<nX1; nCol++)
1537  aTwipOffset.AdjustX( -(rDoc.GetColWidth( nCol, nPrintTab )) );
1538  aTwipOffset.AdjustY( -sal_Int32(rDoc.GetRowHeight( 0, nY1-1, nPrintTab )) );
1539 
1540  Point aMMOffset( aTwipOffset );
1541  aMMOffset.setX( static_cast<tools::Long>(aMMOffset.X() * HMM_PER_TWIPS) );
1542  aMMOffset.setY( static_cast<tools::Long>(aMMOffset.Y() * HMM_PER_TWIPS) );
1543  aMMOffset += Point( nLogStX, nLogStY );
1544  MapMode aDrawMapMode( MapUnit::Map100thMM, aMMOffset, aLogicMode.GetScaleX(), aLogicMode.GetScaleY() );
1545 
1546  // get pixel rectangle
1547 
1548  Size aOnePixel = pDev->PixelToLogic(Size(1,1));
1549  tools::Long nOneX = aOnePixel.Width();
1550  tools::Long nOneY = aOnePixel.Height();
1551 
1552  tools::Long nPosX = nScrX - nOneX;
1553  for (nCol=nX1; nCol<=nX2; nCol++)
1554  {
1555  sal_uInt16 nDocW = rDoc.GetColWidth( nCol, nPrintTab );
1556  if (nDocW)
1557  nPosX += static_cast<tools::Long>(nDocW * nScaleX);
1558  }
1559 
1560  tools::Long nPosY = nScrY - nOneY;
1561  nPosY += rDoc.GetScaledRowHeight( nY1, nY2, nPrintTab, nScaleY);
1562  tools::Rectangle aCellRect( nScrX, nScrY, nPosX, nPosY );
1563  rLocationData.AddCellRange( aCellRect, ScRange( nX1,nY1,nPrintTab, nX2,nY2,nPrintTab ),
1564  bRepCol, bRepRow, aDrawMapMode );
1565 }
1566 
1567 void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
1568  tools::Long nScrX, tools::Long nScrY,
1569  bool bShLeft, bool bShTop, bool bShRight, bool bShBottom )
1570 {
1571  // #i47547# nothing to do if the end of the print area is before the end of
1572  // the repeat columns/rows (don't use negative size for ScOutputData)
1573  if ( nX2 < nX1 || nY2 < nY1 )
1574  return;
1575 
1577  ScRange aERange;
1578  bool bEmbed = rDoc.IsEmbedded();
1579  if (bEmbed)
1580  {
1581  rDoc.GetEmbedded(aERange);
1582  rDoc.ResetEmbedded();
1583  }
1584 
1586  tools::Long nLogStX = aPos.X();
1587  tools::Long nLogStY = aPos.Y();
1588 
1589  // Assemble data
1590 
1591  ScTableInfo aTabInfo;
1592  rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nPrintTab,
1594  lcl_HidePrint( aTabInfo, nX1, nX2 );
1595 
1596  if (bEmbed)
1597  rDoc.SetEmbedded(aERange);
1598 
1599  ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, &rDoc, nPrintTab,
1600  nScrX, nScrY, nX1, nY1, nX2, nY2, nScaleX, nScaleY );
1601 
1602  aOutputData.SetDrawView( pDrawView );
1603 
1604  // test if all paint parts are hidden, then a paint is not necessary at all
1605  const Point aMMOffset(aOutputData.PrePrintDrawingLayer(nLogStX, nLogStY));
1606  const bool bHideAllDrawingLayer( pDrawView && pDrawView->getHideOle() && pDrawView->getHideChart()
1608 
1609  if(!bHideAllDrawingLayer)
1610  {
1612  // don's set Clipping here (Mapmode is being moved)
1613 
1614  // #i72502#
1615  aOutputData.PrintDrawingLayer(SC_LAYER_BACK, aMMOffset);
1616  }
1617 
1619 
1620  aOutputData.SetShowFormulas( aTableParam.bFormulas );
1621  aOutputData.SetShowNullValues( aTableParam.bNullVals );
1622  aOutputData.SetUseStyleColor( bUseStyleColor );
1623 
1624  Color aGridColor( COL_BLACK );
1625  if ( bUseStyleColor )
1626  aGridColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
1627  aOutputData.SetGridColor( aGridColor );
1628 
1629  if ( !pPrinter )
1630  {
1631  OutputDevice* pRefDev = rDoc.GetPrinter(); // use the printer also for Preview
1632  Fraction aPrintFrac( nZoom, 100 ); // without nManualZoom
1633  // MapMode, as it would arrive at the printer:
1634  pRefDev->SetMapMode( MapMode( MapUnit::Map100thMM, Point(), aPrintFrac, aPrintFrac ) );
1635 
1636  // when rendering (PDF), don't use printer as ref device, but printer's MapMode
1637  // has to be set anyway, as charts still use it (#106409#)
1638  if ( !bIsRender )
1639  aOutputData.SetRefDevice( pRefDev );
1640  }
1641 
1643  aOutputData.DrawBackground(*pDev);
1644 
1646  aPos, Size(aOutputData.GetScrW(), aOutputData.GetScrH()))));
1647  pDev->SetClipRegion();
1648 
1650  {
1651  aOutputData.DrawExtraShadow( bShLeft, bShTop, bShRight, bShBottom );
1652  aOutputData.DrawFrame(*pDev);
1653  aOutputData.DrawStrings();
1654  aOutputData.DrawEdit(false);
1655  }
1656 
1657  if (aTableParam.bGrid)
1658  aOutputData.DrawGrid(*pDev, true, false); // no page breaks
1659 
1660  aOutputData.AddPDFNotes(); // has no effect if not rendering PDF with notes enabled
1661 
1662  // test if all paint parts are hidden, then a paint is not necessary at all
1663  if(!bHideAllDrawingLayer)
1664  {
1665  // #i72502#
1666  aOutputData.PrintDrawingLayer(SC_LAYER_FRONT, aMMOffset);
1667  }
1668 
1669  // #i72502#
1670  aOutputData.PrintDrawingLayer(SC_LAYER_INTERN, aMMOffset);
1671  aOutputData.PostPrintDrawingLayer(aMMOffset); // #i74768#
1672 }
1673 
1674 bool ScPrintFunc::IsMirror( tools::Long nPageNo ) // Mirror margins?
1675 {
1676  return nPageUsage == SvxPageUsage::Mirror && (nPageNo & 1);
1677 }
1678 
1679 bool ScPrintFunc::IsLeft( tools::Long nPageNo ) // left foot notes?
1680 {
1681  bool bLeft;
1682  if (nPageUsage == SvxPageUsage::Left)
1683  bLeft = true;
1684  else if (nPageUsage == SvxPageUsage::Right)
1685  bLeft = false;
1686  else
1687  bLeft = (nPageNo & 1) != 0;
1688  return bLeft;
1689 }
1690 
1692 {
1693  OUString aTmp;
1694  rDoc.GetName(nPrintTab, aTmp);
1695  aFieldData.aTabName = aTmp;
1696 }
1697 
1699 {
1700  if (!pEditEngine)
1701  {
1702  // can't use document's edit engine pool here,
1703  // because pool must have twips as default metric
1704  pEditEngine.reset( new ScHeaderEditEngine( EditEngine::CreatePool().get() ) );
1705 
1706  pEditEngine->EnableUndo(false);
1707  //fdo#45869 we want text to be positioned as it would be for the
1708  //high dpi printed output, not as would be ideal for the 96dpi preview
1709  //window itself
1710  pEditEngine->SetRefDevice(pPrinter ? pPrinter : rDoc.GetRefDevice());
1711  pEditEngine->SetWordDelimiters(
1712  ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
1713  pEditEngine->SetControlWord( pEditEngine->GetControlWord() & ~EEControlBits::RTFSTYLESHEETS );
1715  pEditEngine->EnableAutoColor( bUseStyleColor );
1716 
1717  // Default-Set for alignment
1718  pEditDefaults.reset( new SfxItemSet( pEditEngine->GetEmptyItemSet() ) );
1719 
1720  const ScPatternAttr& rPattern = rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN);
1721  rPattern.FillEditItemSet( pEditDefaults.get() );
1722  // FillEditItemSet adjusts font height to 1/100th mm,
1723  // but for header/footer twips is needed, as in the PatternAttr:
1727  // don't use font color, because background color is not used
1729  pEditDefaults->ClearItem( EE_CHAR_COLOR );
1730  if (ScGlobal::IsSystemRTL())
1731  pEditDefaults->Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
1732  }
1733 
1734  pEditEngine->SetData( aFieldData ); // Set page count etc.
1735 }
1736 
1737 // nStartY = logic
1738 void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStartY,
1739  bool bDoPrint, ScPreviewLocationData* pLocationData )
1740 {
1741  const ScPrintHFParam& rParam = bHeader ? aHdr : aFtr;
1742 
1743  pDev->SetMapMode( aTwipMode ); // Head-/Footlines in Twips
1744 
1745  bool bLeft = IsLeft(nPageNo) && !rParam.bShared;
1746  const ScPageHFItem* pHFItem = bLeft ? rParam.pLeft : rParam.pRight;
1747 
1748  tools::Long nLineStartX = aPageRect.Left() + rParam.nLeft;
1749  tools::Long nLineEndX = aPageRect.Right() - rParam.nRight;
1750  tools::Long nLineWidth = nLineEndX - nLineStartX + 1;
1751 
1752  // Edit-Engine
1753 
1754  Point aStart( nLineStartX, nStartY );
1755  Size aPaperSize( nLineWidth, rParam.nHeight-rParam.nDistance );
1756  if ( rParam.pBorder )
1757  {
1758  tools::Long nLeft = lcl_LineTotal( rParam.pBorder->GetLeft() ) + rParam.pBorder->GetDistance(SvxBoxItemLine::LEFT);
1759  tools::Long nTop = lcl_LineTotal( rParam.pBorder->GetTop() ) + rParam.pBorder->GetDistance(SvxBoxItemLine::TOP);
1760  aStart.AdjustX(nLeft );
1761  aStart.AdjustY(nTop );
1762  aPaperSize.AdjustWidth( -(nLeft + lcl_LineTotal( rParam.pBorder->GetRight() ) + rParam.pBorder->GetDistance(SvxBoxItemLine::RIGHT)) );
1763  aPaperSize.AdjustHeight( -(nTop + lcl_LineTotal( rParam.pBorder->GetBottom() ) + rParam.pBorder->GetDistance(SvxBoxItemLine::BOTTOM)) );
1764  }
1765 
1766  if ( rParam.pShadow && rParam.pShadow->GetLocation() != SvxShadowLocation::NONE )
1767  {
1768  tools::Long nLeft = rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT);
1769  tools::Long nTop = rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::TOP);
1770  aStart.AdjustX(nLeft );
1771  aStart.AdjustY(nTop );
1772  aPaperSize.AdjustWidth( -(nLeft + rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT)) );
1773  aPaperSize.AdjustHeight( -(nTop + rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM)) );
1774  }
1775 
1777  MakeEditEngine();
1778 
1779  pEditEngine->SetPaperSize(aPaperSize);
1780 
1781  // Frame / Background
1782 
1783  Point aBorderStart( nLineStartX, nStartY );
1784  Size aBorderSize( nLineWidth, rParam.nHeight-rParam.nDistance );
1785  if ( rParam.bDynamic )
1786  {
1787  // adjust here again, for even/odd head-/footlines
1788  // and probably other breaks by variable (page number etc.)
1789 
1790  tools::Long nMaxHeight = 0;
1791  nMaxHeight = std::max( nMaxHeight, TextHeight( pHFItem->GetLeftArea() ) );
1792  nMaxHeight = std::max( nMaxHeight, TextHeight( pHFItem->GetCenterArea() ) );
1793  nMaxHeight = std::max( nMaxHeight, TextHeight( pHFItem->GetRightArea() ) );
1794  if (rParam.pBorder)
1795  nMaxHeight += lcl_LineTotal( rParam.pBorder->GetTop() ) +
1796  lcl_LineTotal( rParam.pBorder->GetBottom() ) +
1797  rParam.pBorder->GetDistance(SvxBoxItemLine::TOP) +
1798  rParam.pBorder->GetDistance(SvxBoxItemLine::BOTTOM);
1799  if (rParam.pShadow && rParam.pShadow->GetLocation() != SvxShadowLocation::NONE)
1800  nMaxHeight += rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) +
1801  rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM);
1802 
1803  if (nMaxHeight < rParam.nManHeight-rParam.nDistance)
1804  nMaxHeight = rParam.nManHeight-rParam.nDistance; // configured Minimum
1805 
1806  aBorderSize.setHeight( nMaxHeight );
1807  }
1808 
1809  if ( bDoPrint )
1810  {
1811  double nOldScaleX = nScaleX;
1812  double nOldScaleY = nScaleY;
1813  nScaleX = nScaleY = 1.0; // output directly in Twips
1814  DrawBorder( aBorderStart.X(), aBorderStart.Y(), aBorderSize.Width(), aBorderSize.Height(),
1815  rParam.pBorder, rParam.pBack, rParam.pShadow );
1816  nScaleX = nOldScaleX;
1817  nScaleY = nOldScaleY;
1818 
1819  // Clipping for Text
1820 
1821  pDev->SetClipRegion(vcl::Region(tools::Rectangle(aStart, aPaperSize)));
1822 
1823  // left
1824 
1825  const EditTextObject* pObject = pHFItem->GetLeftArea();
1826  if (pObject)
1827  {
1828  pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
1829  pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false );
1830  Point aDraw = aStart;
1831  tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight());
1832  if (nDif > 0)
1833  aDraw.AdjustY(nDif / 2 );
1834  pEditEngine->Draw(*pDev, aDraw);
1835  }
1836 
1837  // center
1838 
1839  pObject = pHFItem->GetCenterArea();
1840  if (pObject)
1841  {
1842  pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
1843  pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false );
1844  Point aDraw = aStart;
1845  tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight());
1846  if (nDif > 0)
1847  aDraw.AdjustY(nDif / 2 );
1848  pEditEngine->Draw(*pDev, aDraw);
1849  }
1850 
1851  // right
1852 
1853  pObject = pHFItem->GetRightArea();
1854  if (pObject)
1855  {
1856  pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
1857  pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false );
1858  Point aDraw = aStart;
1859  tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight());
1860  if (nDif > 0)
1861  aDraw.AdjustY(nDif / 2 );
1862  pEditEngine->Draw(*pDev, aDraw);
1863  }
1864 
1865  pDev->SetClipRegion();
1866  }
1867 
1868  if ( pLocationData )
1869  {
1870  tools::Rectangle aHeaderRect( aBorderStart, aBorderSize );
1871  pLocationData->AddHeaderFooter( aHeaderRect, bHeader, bLeft );
1872  }
1873 }
1874 
1875 tools::Long ScPrintFunc::DoNotes( tools::Long nNoteStart, bool bDoPrint, ScPreviewLocationData* pLocationData )
1876 {
1877  if (bDoPrint)
1879 
1880  MakeEditEngine();
1881  pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
1882  pEditEngine->SetDefaults( *pEditDefaults );
1883 
1884  vcl::Font aMarkFont;
1886  rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN).GetFont( aMarkFont, eColorMode );
1887  pDev->SetFont( aMarkFont );
1888  tools::Long nMarkLen = pDev->GetTextWidth("GW99999:");
1889  // without Space-Char, because it rarely arrives there
1890 
1891  Size aDataSize = aPageRect.GetSize();
1892  if ( nMarkLen > aDataSize.Width() / 2 ) // everything much too small?
1893  nMarkLen = aDataSize.Width() / 2; // split the page appropriately
1894  aDataSize.AdjustWidth( -nMarkLen );
1895 
1896  pEditEngine->SetPaperSize( aDataSize );
1897  tools::Long nPosX = aPageRect.Left() + nMarkLen;
1898  tools::Long nPosY = aPageRect.Top();
1899 
1900  tools::Long nCount = 0;
1901  tools::Long nSize = aNotePosList.size();
1902  bool bOk;
1903  do
1904  {
1905  bOk = false;
1906  if ( nNoteStart + nCount < nSize)
1907  {
1908  ScAddress &rPos = aNotePosList[ nNoteStart + nCount ];
1909 
1910  if( const ScPostIt* pNote = rDoc.GetNote( rPos ) )
1911  {
1912  if(const EditTextObject *pEditText = pNote->GetEditTextObject())
1913  pEditEngine->SetTextCurrentDefaults(*pEditText);
1914  tools::Long nTextHeight = pEditEngine->GetTextHeight();
1915  if ( nPosY + nTextHeight < aPageRect.Bottom() )
1916  {
1917  if (bDoPrint)
1918  {
1919  pEditEngine->Draw(*pDev, Point(nPosX, nPosY));
1920 
1921  OUString aMarkStr(rPos.Format(ScRefFlags::VALID, &rDoc, rDoc.GetAddressConvention()) + ":");
1922 
1923  // cell position also via EditEngine, for correct positioning
1924  pEditEngine->SetTextCurrentDefaults(aMarkStr);
1925  pEditEngine->Draw(*pDev, Point(aPageRect.Left(), nPosY));
1926  }
1927 
1928  if ( pLocationData )
1929  {
1930  tools::Rectangle aTextRect( Point( nPosX, nPosY ), Size( aDataSize.Width(), nTextHeight ) );
1931  pLocationData->AddNoteText( aTextRect, rPos );
1932  tools::Rectangle aMarkRect( Point( aPageRect.Left(), nPosY ), Size( nMarkLen, nTextHeight ) );
1933  pLocationData->AddNoteMark( aMarkRect, rPos );
1934  }
1935 
1936  nPosY += nTextHeight;
1937  nPosY += 200; // Distance
1938  ++nCount;
1939  bOk = true;
1940  }
1941  }
1942  }
1943  }
1944  while (bOk);
1945 
1946  return nCount;
1947 }
1948 
1949 tools::Long ScPrintFunc::PrintNotes( tools::Long nPageNo, tools::Long nNoteStart, bool bDoPrint, ScPreviewLocationData* pLocationData )
1950 {
1951  if ( nNoteStart >= static_cast<tools::Long>(aNotePosList.size()) || !aTableParam.bNotes )
1952  return 0;
1953 
1954  if ( bDoPrint && bClearWin )
1955  {
1957 
1958  Color aBackgroundColor( COL_WHITE );
1959  if ( bUseStyleColor )
1960  aBackgroundColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
1961 
1963  pDev->SetLineColor();
1964  pDev->SetFillColor(aBackgroundColor);
1966  Size(static_cast<tools::Long>(aPageSize.Width() * nScaleX * 100 / nZoom),
1967  static_cast<tools::Long>(aPageSize.Height() * nScaleY * 100 / nZoom))));
1968  }
1969 
1970  // adjust aPageRect for left/right page
1971 
1972  tools::Rectangle aTempRect( Point(), aPageSize );
1973  if (IsMirror(nPageNo))
1974  {
1975  aPageRect.SetLeft( ( aTempRect.Left() + nRightMargin ) * 100 / nZoom );
1976  aPageRect.SetRight( ( aTempRect.Right() - nLeftMargin ) * 100 / nZoom );
1977  }
1978  else
1979  {
1980  aPageRect.SetLeft( ( aTempRect.Left() + nLeftMargin ) * 100 / nZoom );
1981  aPageRect.SetRight( ( aTempRect.Right() - nRightMargin ) * 100 / nZoom );
1982  }
1983 
1984  if ( pPrinter && bDoPrint )
1985  {
1986  OSL_FAIL( "StartPage does not exist anymore" );
1987  }
1988 
1989  if ( bDoPrint || pLocationData )
1990  {
1991  // Head and foot lines
1992 
1993  if (aHdr.bEnable)
1994  {
1995  tools::Long nHeaderY = aPageRect.Top()-aHdr.nHeight;
1996  PrintHF( nPageNo, true, nHeaderY, bDoPrint, pLocationData );
1997  }
1998  if (aFtr.bEnable)
1999  {
2000  tools::Long nFooterY = aPageRect.Bottom()+aFtr.nDistance;
2001  PrintHF( nPageNo, false, nFooterY, bDoPrint, pLocationData );
2002  }
2003  }
2004 
2005  tools::Long nCount = DoNotes( nNoteStart, bDoPrint, pLocationData );
2006 
2007  if ( pPrinter && bDoPrint )
2008  {
2009  OSL_FAIL( "EndPage does not exist anymore" );
2010  }
2011 
2012  return nCount;
2013 }
2014 
2015 void ScPrintFunc::PrintPage( tools::Long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
2016  bool bDoPrint, ScPreviewLocationData* pLocationData )
2017 {
2018  bool bLayoutRTL = rDoc.IsLayoutRTL( nPrintTab );
2019  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2020 
2021  // nPageNo is the page number within all sheets of one "start page" setting
2022 
2023  if ( bClearWin && bDoPrint )
2024  {
2025  // must exactly fit to painting the frame in preview.cxx !!!
2026 
2027  Color aBackgroundColor( COL_WHITE );
2028  if ( bUseStyleColor )
2029  aBackgroundColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
2030 
2032  pDev->SetLineColor();
2033  pDev->SetFillColor(aBackgroundColor);
2035  Size(static_cast<tools::Long>(aPageSize.Width() * nScaleX * 100 / nZoom),
2036  static_cast<tools::Long>(aPageSize.Height() * nScaleY * 100 / nZoom))));
2037  }
2038 
2039  // adjust aPageRect for left/right page
2040 
2041  tools::Rectangle aTempRect( Point(), aPageSize );
2042  if (IsMirror(nPageNo))
2043  {
2044  aPageRect.SetLeft( ( aTempRect.Left() + nRightMargin ) * 100 / nZoom );
2045  aPageRect.SetRight( ( aTempRect.Right() - nLeftMargin ) * 100 / nZoom );
2046  }
2047  else
2048  {
2049  aPageRect.SetLeft( ( aTempRect.Left() + nLeftMargin ) * 100 / nZoom );
2050  aPageRect.SetRight( ( aTempRect.Right() - nRightMargin ) * 100 / nZoom );
2051  }
2052 
2053  if ( aAreaParam.bRepeatCol )
2054  if ( nX1 > nRepeatStartCol && nX1 <= nRepeatEndCol )
2055  nX1 = nRepeatEndCol + 1;
2056  bool bDoRepCol = (aAreaParam.bRepeatCol && nX1 > nRepeatEndCol);
2057  if ( aAreaParam.bRepeatRow )
2058  if ( nY1 > nRepeatStartRow && nY1 <= nRepeatEndRow )
2059  nY1 = nRepeatEndRow + 1;
2060  bool bDoRepRow = (aAreaParam.bRepeatRow && nY1 > nRepeatEndRow);
2061 
2062  // use new object hide flags in SdrPaintView
2063  if(pDrawView)
2064  {
2069  }
2070 
2071  if ( pPrinter && bDoPrint )
2072  {
2073  OSL_FAIL( "StartPage does not exist anymore" );
2074  }
2075 
2076  // head and foot lines (without centering)
2077 
2078  if (aHdr.bEnable)
2079  {
2080  tools::Long nHeaderY = aPageRect.Top()-aHdr.nHeight;
2081  PrintHF( nPageNo, true, nHeaderY, bDoPrint, pLocationData );
2082  }
2083  if (aFtr.bEnable)
2084  {
2085  tools::Long nFooterY = aPageRect.Bottom()+aFtr.nDistance;
2086  PrintHF( nPageNo, false, nFooterY, bDoPrint, pLocationData );
2087  }
2088 
2089  // Position ( margins / centering )
2090 
2091  tools::Long nLeftSpace = aPageRect.Left(); // Document-Twips
2092  tools::Long nTopSpace = aPageRect.Top();
2093  if ( bCenterHor || bLayoutRTL )
2094  {
2095  tools::Long nDataWidth = 0;
2096  SCCOL i;
2097  for (i=nX1; i<=nX2; i++)
2098  nDataWidth += rDoc.GetColWidth( i,nPrintTab );
2099  if (bDoRepCol)
2100  for (i=nRepeatStartCol; i<=nRepeatEndCol; i++)
2101  nDataWidth += rDoc.GetColWidth( i,nPrintTab );
2102  if (aTableParam.bHeaders)
2103  nDataWidth += tools::Long(PRINT_HEADER_WIDTH);
2104  if (pBorderItem)
2105  nDataWidth += pBorderItem->GetDistance(SvxBoxItemLine::LEFT) +
2106  pBorderItem->GetDistance(SvxBoxItemLine::RIGHT);
2107  if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE)
2108  nDataWidth += pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) +
2109  pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT);
2110  if ( bCenterHor )
2111  {
2112  nLeftSpace += ( aPageRect.GetWidth() - nDataWidth ) / 2; // LTR or RTL
2113  if (pBorderItem)
2114  nLeftSpace -= lcl_LineTotal(pBorderItem->GetLeft());
2115  }
2116  else if ( bLayoutRTL )
2117  nLeftSpace += aPageRect.GetWidth() - nDataWidth; // align to the right edge of the page
2118  }
2119  if ( bCenterVer )
2120  {
2121  tools::Long nDataHeight = rDoc.GetRowHeight( nY1, nY2, nPrintTab);
2122  if (bDoRepRow)
2123  nDataHeight += rDoc.GetRowHeight( nRepeatStartRow,
2125  if (aTableParam.bHeaders)
2126  nDataHeight += tools::Long(PRINT_HEADER_HEIGHT);
2127  if (pBorderItem)
2128  nDataHeight += pBorderItem->GetDistance(SvxBoxItemLine::TOP) +
2129  pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM);
2130  if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE)
2131  nDataHeight += pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) +
2132  pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM);
2133  nTopSpace += ( aPageRect.GetHeight() - nDataHeight ) / 2;
2134  if (pBorderItem)
2135  nTopSpace -= lcl_LineTotal(pBorderItem->GetTop());
2136  }
2137 
2138  // calculate sizes of the elements for partitioning
2139  // (header, repeat, data)
2140 
2141  tools::Long nHeaderWidth = 0;
2142  tools::Long nHeaderHeight = 0;
2143  tools::Long nRepeatWidth = 0;
2144  tools::Long nRepeatHeight = 0;
2145  tools::Long nContentWidth = 0; // scaled - not the same as nDataWidth above
2146  tools::Long nContentHeight = 0;
2147  if (aTableParam.bHeaders)
2148  {
2149  nHeaderWidth = static_cast<tools::Long>(PRINT_HEADER_WIDTH * nScaleX);
2150  nHeaderHeight = static_cast<tools::Long>(PRINT_HEADER_HEIGHT * nScaleY);
2151  }
2152  if (bDoRepCol)
2153  for (SCCOL i=nRepeatStartCol; i<=nRepeatEndCol; i++)
2154  nRepeatWidth += static_cast<tools::Long>(rDoc.GetColWidth(i,nPrintTab) * nScaleX);
2155  if (bDoRepRow)
2156  nRepeatHeight += rDoc.GetScaledRowHeight( nRepeatStartRow,
2158  for (SCCOL i=nX1; i<=nX2; i++)
2159  nContentWidth += static_cast<tools::Long>(rDoc.GetColWidth(i,nPrintTab) * nScaleX);
2160  nContentHeight += rDoc.GetScaledRowHeight( nY1, nY2, nPrintTab,
2161  nScaleY);
2162 
2163  // partition the page
2164 
2165  tools::Long nStartX = static_cast<tools::Long>( nLeftSpace * nScaleX );
2166  tools::Long nStartY = static_cast<tools::Long>( nTopSpace * nScaleY );
2167  tools::Long nInnerStartX = nStartX;
2168  tools::Long nInnerStartY = nStartY;
2169  if (pBorderItem)
2170  {
2171  nInnerStartX += static_cast<tools::Long>( ( lcl_LineTotal(pBorderItem->GetLeft()) +
2172  pBorderItem->GetDistance(SvxBoxItemLine::LEFT) ) * nScaleX );
2173  nInnerStartY += static_cast<tools::Long>( ( lcl_LineTotal(pBorderItem->GetTop()) +
2174  pBorderItem->GetDistance(SvxBoxItemLine::TOP) ) * nScaleY );
2175  }
2176  if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE)
2177  {
2178  nInnerStartX += static_cast<tools::Long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX );
2179  nInnerStartY += static_cast<tools::Long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY );
2180  }
2181 
2182  if ( bLayoutRTL )
2183  {
2184  // arrange elements starting from the right edge
2185  nInnerStartX += nHeaderWidth + nRepeatWidth + nContentWidth;
2186 
2187  // make rounding easier so the elements are really next to each other in preview
2188  Size aOffsetOnePixel = pDev->PixelToLogic( Size(1,1), aOffsetMode );
2189  tools::Long nOffsetOneX = aOffsetOnePixel.Width();
2190  nInnerStartX += nOffsetOneX / 2;
2191  }
2192 
2193  tools::Long nFrameStartX = nInnerStartX;
2194  tools::Long nFrameStartY = nInnerStartY;
2195 
2196  tools::Long nRepStartX = nInnerStartX + nHeaderWidth * nLayoutSign; // widths/heights are 0 if not used
2197  tools::Long nRepStartY = nInnerStartY + nHeaderHeight;
2198  tools::Long nDataX = nRepStartX + nRepeatWidth * nLayoutSign;
2199  tools::Long nDataY = nRepStartY + nRepeatHeight;
2200  tools::Long nEndX = nDataX + nContentWidth * nLayoutSign;
2201  tools::Long nEndY = nDataY + nContentHeight;
2202  tools::Long nFrameEndX = nEndX;
2203  tools::Long nFrameEndY = nEndY;
2204 
2205  if ( bLayoutRTL )
2206  {
2207  // each element's start position is its left edge
2209  nInnerStartX -= nHeaderWidth; // used for header
2210  nRepStartX -= nRepeatWidth;
2211  nDataX -= nContentWidth;
2212 
2213  // continue right of the main elements again
2214  nEndX += nHeaderWidth + nRepeatWidth + nContentWidth;
2215  }
2216 
2217  // Page frame / background
2218 
2220 
2221  tools::Long nBorderEndX = nEndX;
2222  tools::Long nBorderEndY = nEndY;
2223  if (pBorderItem)
2224  {
2225  nBorderEndX += static_cast<tools::Long>( ( lcl_LineTotal(pBorderItem->GetRight()) +
2226  pBorderItem->GetDistance(SvxBoxItemLine::RIGHT) ) * nScaleX );
2227  nBorderEndY += static_cast<tools::Long>( ( lcl_LineTotal(pBorderItem->GetBottom()) +
2228  pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM) ) * nScaleY );
2229  }
2230  if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE)
2231  {
2232  nBorderEndX += static_cast<tools::Long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX );
2233  nBorderEndY += static_cast<tools::Long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY );
2234  }
2235 
2236  if ( bDoPrint )
2237  {
2239  DrawBorder( nStartX, nStartY, nBorderEndX-nStartX, nBorderEndY-nStartY,
2241 
2243  }
2244 
2246 
2247  // Output repeating rows/columns
2248 
2249  if (bDoRepCol && bDoRepRow)
2250  {
2251  if ( bDoPrint )
2253  nRepStartX,nRepStartY, true, true, false, false );
2254  if ( pLocationData )
2256  nRepStartX,nRepStartY, true, true, *pLocationData );
2257  }
2258  if (bDoRepCol)
2259  {
2260  if ( bDoPrint )
2261  PrintArea( nRepeatStartCol,nY1, nRepeatEndCol,nY2, nRepStartX,nDataY,
2262  true, !bDoRepRow, false, true );
2263  if ( pLocationData )
2264  LocateArea( nRepeatStartCol,nY1, nRepeatEndCol,nY2, nRepStartX,nDataY, true, false, *pLocationData );
2265  }
2266  if (bDoRepRow)
2267  {
2268  if ( bDoPrint )
2269  PrintArea( nX1,nRepeatStartRow, nX2,nRepeatEndRow, nDataX,nRepStartY,
2270  !bDoRepCol, true, true, false );
2271  if ( pLocationData )
2272  LocateArea( nX1,nRepeatStartRow, nX2,nRepeatEndRow, nDataX,nRepStartY, false, true, *pLocationData );
2273  }
2274 
2275  // output data
2276 
2277  if ( bDoPrint )
2278  PrintArea( nX1,nY1, nX2,nY2, nDataX,nDataY, !bDoRepCol,!bDoRepRow, true, true );
2279  if ( pLocationData )
2280  LocateArea( nX1,nY1, nX2,nY2, nDataX,nDataY, false,false, *pLocationData );
2281 
2282  // output column/row headers
2283  // after data (through probably shadow)
2284 
2285  Color aGridColor( COL_BLACK );
2286  if ( bUseStyleColor )
2287  aGridColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
2288 
2289  if (aTableParam.bHeaders)
2290  {
2291  if ( bDoPrint )
2292  {
2293  pDev->SetLineColor( aGridColor );
2294  pDev->SetFillColor();
2296  }
2297 
2298  ScPatternAttr aPattern( rDoc.GetPool() );
2299  vcl::Font aFont;
2301  aPattern.GetFont( aFont, eColorMode, pDev );
2302  pDev->SetFont( aFont );
2303 
2304  if (bDoRepCol)
2305  {
2306  if ( bDoPrint )
2307  PrintColHdr( nRepeatStartCol,nRepeatEndCol, nRepStartX,nInnerStartY );
2308  if ( pLocationData )
2309  LocateColHdr( nRepeatStartCol,nRepeatEndCol, nRepStartX,nInnerStartY, true, *pLocationData );
2310  }
2311  if ( bDoPrint )
2312  PrintColHdr( nX1,nX2, nDataX,nInnerStartY );
2313  if ( pLocationData )
2314  LocateColHdr( nX1,nX2, nDataX,nInnerStartY, false, *pLocationData );
2315  if (bDoRepRow)
2316  {
2317  if ( bDoPrint )
2318  PrintRowHdr( nRepeatStartRow,nRepeatEndRow, nInnerStartX,nRepStartY );
2319  if ( pLocationData )
2320  LocateRowHdr( nRepeatStartRow,nRepeatEndRow, nInnerStartX,nRepStartY, true, *pLocationData );
2321  }
2322  if ( bDoPrint )
2323  PrintRowHdr( nY1,nY2, nInnerStartX,nDataY );
2324  if ( pLocationData )
2325  LocateRowHdr( nY1,nY2, nInnerStartX,nDataY, false, *pLocationData );
2326  }
2327 
2328  // simple frame
2329 
2330  if ( bDoPrint && ( aTableParam.bGrid || aTableParam.bHeaders ) )
2331  {
2332  Size aOnePixel = pDev->PixelToLogic(Size(1,1));
2333  tools::Long nOneX = aOnePixel.Width();
2334  tools::Long nOneY = aOnePixel.Height();
2335 
2336  tools::Long nLeftX = nFrameStartX;
2337  tools::Long nTopY = nFrameStartY - nOneY;
2338  tools::Long nRightX = nFrameEndX;
2339  tools::Long nBottomY = nFrameEndY - nOneY;
2340  if ( !bLayoutRTL )
2341  {
2342  nLeftX -= nOneX;
2343  nRightX -= nOneX;
2344  }
2346  pDev->SetLineColor( aGridColor );
2347  pDev->SetFillColor();
2348  pDev->DrawRect( tools::Rectangle( nLeftX, nTopY, nRightX, nBottomY ) );
2349  // nEndX/Y without frame-adaptation
2350  }
2351 
2352  if ( pPrinter && bDoPrint )
2353  {
2354  OSL_FAIL( "EndPage does not exist anymore" );
2355  }
2356 
2357  aLastSourceRange = ScRange( nX1, nY1, nPrintTab, nX2, nY2, nPrintTab );
2358  bSourceRangeValid = true;
2359 }
2360 
2361 void ScPrintFunc::SetOffset( const Point& rOfs )
2362 {
2363  aSrcOffset = rOfs;
2364 }
2365 
2366 void ScPrintFunc::SetManualZoom( sal_uInt16 nNewZoom )
2367 {
2368  nManualZoom = nNewZoom;
2369 }
2370 
2371 void ScPrintFunc::SetClearFlag( bool bFlag )
2372 {
2373  bClearWin = bFlag;
2374 }
2375 
2377 {
2378  bUseStyleColor = bFlag;
2379  if (pEditEngine)
2380  pEditEngine->EnableAutoColor( bUseStyleColor );
2381 }
2382 
2383 void ScPrintFunc::SetRenderFlag( bool bFlag )
2384 {
2385  bIsRender = bFlag; // set when using XRenderable (PDF)
2386 }
2387 
2389 {
2390  aTableParam.bCellContent = false;
2391  aTableParam.bNotes = false;
2392  aTableParam.bGrid = false;
2393  aTableParam.bHeaders = false;
2394  aTableParam.bFormulas = false;
2395  aTableParam.bNullVals = false;
2396 }
2397 
2398 // UpdatePages is only called from outside to set the breaks correctly for viewing
2399 // - always without UserArea
2400 
2402 {
2403  if (!pParamSet)
2404  return false;
2405 
2406  // Zoom
2407 
2408  nZoom = 100;
2410  nZoom = ZOOM_MIN; // correct for breaks
2411  else if (aTableParam.bScaleAll)
2412  {
2414  if ( nZoom <= ZOOM_MIN )
2415  nZoom = ZOOM_MIN;
2416  }
2417 
2418  OUString aName = rDoc.GetPageStyle( nPrintTab );
2419  SCTAB nTabCount = rDoc.GetTableCount();
2420  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
2421  if ( nTab==nPrintTab || rDoc.GetPageStyle(nTab)==aName )
2422  {
2423  // Repeating rows/columns
2425 
2426  // set breaks
2427  ResetBreaks(nTab);
2429  }
2430 
2431  return true;
2432 }
2433 
2434 tools::Long ScPrintFunc::CountPages() // sets also nPagesX, nPagesY
2435 {
2436  bool bAreaOk = false;
2437 
2438  if (rDoc.HasTable( nPrintTab ))
2439  {
2440  if (aAreaParam.bPrintArea) // Specify print area?
2441  {
2442  if ( bPrintCurrentTable )
2443  {
2444  ScRange& rRange = aAreaParam.aPrintArea;
2445 
2446  // Here, no comparison of the tables any more. Area is always valid for this table
2447  // If comparison should be done here, the table of print ranges must be adjusted
2448  // when inserting tables etc.!
2449 
2450  nStartCol = rRange.aStart.Col();
2451  nStartRow = rRange.aStart.Row();
2452  nEndCol = rRange.aEnd .Col();
2453  nEndRow = rRange.aEnd .Row();
2454  bAreaOk = AdjustPrintArea(false); // limit
2455  }
2456  else
2457  bAreaOk = false;
2458  }
2459  else // search from document
2460  bAreaOk = AdjustPrintArea(true);
2461  }
2462 
2463  if (bAreaOk)
2464  {
2465  tools::Long nPages = 0;
2466  size_t nY;
2467  if (bMultiArea)
2468  {
2469  sal_uInt16 nRCount = rDoc.GetPrintRangeCount( nPrintTab );
2470  for (sal_uInt16 i=0; i<nRCount; i++)
2471  {
2472  CalcZoom(i);
2473  if ( aTableParam.bSkipEmpty )
2474  for (nY=0; nY< m_aRanges.m_nPagesY; nY++)
2475  {
2476  OSL_ENSURE(nY < m_aRanges.m_aPageRows.size(), "vector access error for aPageRows");
2477  nPages += m_aRanges.m_aPageRows[nY].CountVisible();
2478  }
2479  else
2480  nPages += static_cast<tools::Long>(m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY;
2481  if ( pPageData )
2482  FillPageData();
2483  }
2484  }
2485  else
2486  {
2487  CalcZoom(RANGENO_NORANGE); // calculate Zoom
2488  if ( aTableParam.bSkipEmpty )
2489  for (nY=0; nY<m_aRanges.m_nPagesY; nY++)
2490  {
2491  OSL_ENSURE(nY < m_aRanges.m_aPageRows.size(), "vector access error for aPageRows");
2492  nPages += m_aRanges.m_aPageRows[nY].CountVisible();
2493  }
2494  else
2495  nPages += static_cast<tools::Long>(m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY;
2496  if ( pPageData )
2497  FillPageData();
2498  }
2499  return nPages;
2500  }
2501  else
2502  {
2504  return 0;
2505  }
2506 }
2507 
2509 {
2511  return 0;
2512 
2513  bool bError = false;
2514  if (!aAreaParam.bPrintArea)
2515  bError = !AdjustPrintArea(true); // completely search in Doc
2516 
2517  sal_uInt16 nRepeats = 1; // how often go through it ?
2518  if (bMultiArea)
2519  nRepeats = rDoc.GetPrintRangeCount(nPrintTab);
2520  if (bError)
2521  nRepeats = 0;
2522 
2523  for (sal_uInt16 nStep=0; nStep<nRepeats; nStep++)
2524  {
2525  bool bDoThis = true;
2526  if (bMultiArea) // go through all Areas
2527  {
2528  const ScRange* pThisRange = rDoc.GetPrintRange( nPrintTab, nStep );
2529  if ( pThisRange )
2530  {
2531  nStartCol = pThisRange->aStart.Col();
2532  nStartRow = pThisRange->aStart.Row();
2533  nEndCol = pThisRange->aEnd .Col();
2534  nEndRow = pThisRange->aEnd .Row();
2535  bDoThis = AdjustPrintArea(false);
2536  }
2537  }
2538 
2539  if (bDoThis)
2540  {
2542  for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
2543  {
2544  if (rDoc.HasColNotes(nCol, nPrintTab))
2545  {
2546  for ( SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow )
2547  {
2548  if ( rDoc.HasNote(nCol, nRow, nPrintTab) )
2549  aNotePosList.emplace_back( nCol, nRow, nPrintTab );
2550  }
2551  }
2552  }
2553  }
2554  }
2555 
2556  tools::Long nPages = 0;
2557  tools::Long nNoteNr = 0;
2558  tools::Long nNoteAdd;
2559  do
2560  {
2561  nNoteAdd = PrintNotes( nPages, nNoteNr, false, nullptr );
2562  if (nNoteAdd)
2563  {
2564  nNoteNr += nNoteAdd;
2565  ++nPages;
2566  }
2567  }
2568  while (nNoteAdd);
2569 
2570  return nPages;
2571 }
2572 
2573 void ScPrintFunc::InitModes() // set MapModes from nZoom etc.
2574 {
2575  aOffset = Point( aSrcOffset.X()*100/nZoom, aSrcOffset.Y()*100/nZoom );
2576 
2577  tools::Long nEffZoom = nZoom * static_cast<tools::Long>(nManualZoom);
2578  nScaleX = nScaleY = HMM_PER_TWIPS; // output in 1/100 mm
2579 
2580  Fraction aZoomFract( nEffZoom,10000 );
2581  Fraction aHorFract = aZoomFract;
2582 
2583  if ( !pPrinter && !bIsRender ) // adjust scale for preview
2584  {
2585  double nFact = pDocShell->GetOutputFactor();
2586  aHorFract = Fraction( static_cast<tools::Long>( nEffZoom / nFact ), 10000 );
2587  }
2588 
2589  aLogicMode = MapMode( MapUnit::Map100thMM, Point(), aHorFract, aZoomFract );
2590 
2591  Point aLogicOfs( -aOffset.X(), -aOffset.Y() );
2592  aOffsetMode = MapMode( MapUnit::Map100thMM, aLogicOfs, aHorFract, aZoomFract );
2593 
2594  Point aTwipsOfs( static_cast<tools::Long>( -aOffset.X() / nScaleX + 0.5 ), static_cast<tools::Long>( -aOffset.Y() / nScaleY + 0.5 ) );
2595  aTwipMode = MapMode( MapUnit::MapTwip, aTwipsOfs, aHorFract, aZoomFract );
2596 }
2597 
2599 {
2600  if ( !pPrinter )
2601  return;
2602 
2603  // Configure Printer to Printing
2604 
2605  Size aEnumSize = aPageSize;
2606 
2607  pPrinter->SetOrientation( bLandscape ? Orientation::Landscape : Orientation::Portrait );
2608  if ( bLandscape )
2609  {
2610  // landscape is always interpreted as a rotation by 90 degrees !
2611  // this leads to non WYSIWIG but at least it prints!
2612  // #i21775#
2613  tools::Long nTemp = aEnumSize.Width();
2614  aEnumSize.setWidth( aEnumSize.Height() );
2615  aEnumSize.setHeight( nTemp );
2616  }
2617  Paper ePaper = SvxPaperInfo::GetSvxPaper( aEnumSize, MapUnit::MapTwip );
2618  sal_uInt16 nPaperBin = pParamSet->Get(ATTR_PAGE_PAPERBIN).GetValue();
2619 
2620  pPrinter->SetPaper( ePaper );
2621  if ( PAPER_USER == ePaper )
2622  {
2623  MapMode aPrinterMode = pPrinter->GetMapMode();
2624  MapMode aLocalMode( MapUnit::MapTwip );
2625  pPrinter->SetMapMode( aLocalMode );
2626  pPrinter->SetPaperSizeUser( aEnumSize );
2627  pPrinter->SetMapMode( aPrinterMode );
2628  }
2629 
2630  pPrinter->SetPaperBin( nPaperBin );
2631 }
2632 
2633 // rPageRanges = range for all tables
2634 // nStartPage = rPageRanges starts at nStartPage
2635 // nDisplayStart = continuous number for displaying the page number
2636 
2638  tools::Long nStartPage, tools::Long nDisplayStart, bool bDoPrint,
2639  ScPreviewLocationData* pLocationData )
2640 {
2641  OSL_ENSURE(pDev,"Device == NULL");
2642  if (!pParamSet)
2643  return 0;
2644 
2645  if ( pPrinter && bDoPrint )
2647 
2648  InitModes();
2649  if ( pLocationData )
2650  {
2651  pLocationData->SetCellMapMode( aOffsetMode );
2652  pLocationData->SetPrintTab( nPrintTab );
2653  }
2654 
2655  MakeTableString();
2656 
2657  tools::Long nPageNo = 0;
2658  tools::Long nPrinted = 0;
2659  tools::Long nEndPage = rPageRanges.GetTotalRange().Max();
2660 
2661  sal_uInt16 nRepeats = 1;
2662  if (bMultiArea)
2663  nRepeats = rDoc.GetPrintRangeCount(nPrintTab);
2664  for (sal_uInt16 nStep=0; nStep<nRepeats; nStep++)
2665  {
2666  if (bMultiArea) // replace area
2667  {
2668  CalcZoom(nStep); // also sets nStartCol etc. new
2669  InitModes();
2670  }
2671 
2672  SCCOL nX1;
2673  SCROW nY1;
2674  SCCOL nX2;
2675  SCROW nY2;
2676  size_t nCountX;
2677  size_t nCountY;
2678 
2679  if (aTableParam.bTopDown) // top-bottom
2680  {
2681  nX1 = nStartCol;
2682  for (nCountX=0; nCountX<m_aRanges.m_nPagesX; nCountX++)
2683  {
2684  OSL_ENSURE(nCountX < m_aRanges.m_aPageEndX.size(), "vector access error for aPageEndX (!)");
2685  nX2 = m_aRanges.m_aPageEndX[nCountX];
2686  for (nCountY=0; nCountY<m_aRanges.m_nPagesY; nCountY++)
2687  {
2688  OSL_ENSURE(nCountY < m_aRanges.m_aPageRows.size(), "vector access error for aPageRows (!)");
2689  nY1 = m_aRanges.m_aPageRows[nCountY].GetStartRow();
2690  nY2 = m_aRanges.m_aPageRows[nCountY].GetEndRow();
2691  if ( !aTableParam.bSkipEmpty || !m_aRanges.m_aPageRows[nCountY].IsHidden(nCountX) )
2692  {
2693  if ( rPageRanges.IsSelected( nPageNo+nStartPage+1 ) )
2694  {
2695  PrintPage( nPageNo+nDisplayStart, nX1, nY1, nX2, nY2,
2696  bDoPrint, pLocationData );
2697  ++nPrinted;
2698  }
2699  ++nPageNo;
2700  }
2701  }
2702  nX1 = nX2 + 1;
2703  }
2704  }
2705  else // left to right
2706  {
2707  for (nCountY=0; nCountY<m_aRanges.m_nPagesY; nCountY++)
2708  {
2709  OSL_ENSURE(nCountY < m_aRanges.m_aPageRows.size(), "vector access error for aPageRows");
2710  nY1 = m_aRanges.m_aPageRows[nCountY].GetStartRow();
2711  nY2 = m_aRanges.m_aPageRows[nCountY].GetEndRow();
2712  nX1 = nStartCol;
2713  for (nCountX=0; nCountX<m_aRanges.m_nPagesX; nCountX++)
2714  {
2715  OSL_ENSURE(nCountX < m_aRanges.m_aPageEndX.size(), "vector access error for aPageEndX");
2716  nX2 = m_aRanges.m_aPageEndX[nCountX];
2717  if ( !aTableParam.bSkipEmpty || !m_aRanges.m_aPageRows[nCountY].IsHidden(nCountX) )
2718  {
2719  if ( rPageRanges.IsSelected( nPageNo+nStartPage+1 ) )
2720  {
2721  PrintPage( nPageNo+nDisplayStart, nX1, nY1, nX2, nY2,
2722  bDoPrint, pLocationData );
2723  ++nPrinted;
2724  }
2725  ++nPageNo;
2726  }
2727  nX1 = nX2 + 1;
2728  }
2729  }
2730  }
2731  }
2732 
2733  aFieldData.aTabName = ScResId( STR_NOTES );
2734 
2735  tools::Long nNoteNr = 0;
2736  tools::Long nNoteAdd;
2737  do
2738  {
2739  if ( nPageNo+nStartPage <= nEndPage )
2740  {
2741  bool bPageSelected = rPageRanges.IsSelected( nPageNo+nStartPage+1 );
2742  nNoteAdd = PrintNotes( nPageNo+nStartPage, nNoteNr, bDoPrint && bPageSelected,
2743  ( bPageSelected ? pLocationData : nullptr ) );
2744  if ( nNoteAdd )
2745  {
2746  nNoteNr += nNoteAdd;
2747  if (bPageSelected)
2748  {
2749  ++nPrinted;
2750  bSourceRangeValid = false; // last page was no cell range
2751  }
2752  ++nPageNo;
2753  }
2754  }
2755  else
2756  nNoteAdd = 0;
2757  }
2758  while (nNoteAdd);
2759 
2760  if ( bMultiArea )
2761  ResetBreaks(nPrintTab); //breaks correct for displaying
2762 
2763  return nPrinted;
2764 }
2765 
2766 void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calculate zoom
2767 {
2768  sal_uInt16 nRCount = rDoc.GetPrintRangeCount( nPrintTab );
2769  const ScRange* pThisRange = nullptr;
2770  if (nRangeNo != RANGENO_NORANGE && nRangeNo < nRCount)
2771  pThisRange = rDoc.GetPrintRange( nPrintTab, nRangeNo );
2772  if ( pThisRange )
2773  {
2774  nStartCol = pThisRange->aStart.Col();
2775  nStartRow = pThisRange->aStart.Row();
2776  nEndCol = pThisRange->aEnd .Col();
2777  nEndRow = pThisRange->aEnd .Row();
2778  }
2779 
2780  if (!AdjustPrintArea(false)) // empty
2781  {
2782  nZoom = 100;
2784  return;
2785  }
2786 
2788 
2790  {
2791  nZoom = 100;
2792  sal_uInt16 nPagesToFit = aTableParam.nScalePageNum;
2793 
2794  // If manual breaks are forced, calculate minimum # pages required
2796  {
2797  sal_uInt16 nMinPages = 0;
2798  std::set<SCROW> aRowBreaks;
2799  std::set<SCCOL> aColBreaks;
2800  rDoc.GetAllRowBreaks(aRowBreaks, nPrintTab, false, true);
2801  rDoc.GetAllColBreaks(aColBreaks, nPrintTab, false, true);
2802  nMinPages = (aRowBreaks.size() + 1) * (aColBreaks.size() + 1);
2803 
2804  // #i54993# use min forced by breaks if it's > # pages in
2805  // scale parameter to avoid bottoming out at <= ZOOM_MIN
2806  nPagesToFit = std::max(nMinPages, nPagesToFit);
2807  }
2808 
2809  sal_uInt16 nLastFitZoom = 0, nLastNonFitZoom = 0;
2810  while (true)
2811  {
2812  if (nZoom <= ZOOM_MIN)
2813  break;
2814 
2815  CalcPages();
2816  bool bFitsPage = (m_aRanges.m_nPagesX * m_aRanges.m_nPagesY <= nPagesToFit);
2817 
2818  if (bFitsPage)
2819  {
2820  if (nZoom == 100)
2821  // If it fits at 100%, it's good enough for me.
2822  break;
2823 
2824  nLastFitZoom = nZoom;
2825  nZoom = (nLastNonFitZoom + nZoom) / 2;
2826 
2827  if (nLastFitZoom == nZoom)
2828  // It converged. Use this zoom level.
2829  break;
2830  }
2831  else
2832  {
2833  if (nZoom - nLastFitZoom <= 1)
2834  {
2835  nZoom = nLastFitZoom;
2836  CalcPages();
2837  break;
2838  }
2839 
2840  nLastNonFitZoom = nZoom;
2841  nZoom = (nLastFitZoom + nZoom) / 2;
2842  }
2843  }
2844  }
2845  else if (aTableParam.bScaleTo)
2846  {
2847  nZoom = 100;
2848  sal_uInt16 nW = aTableParam.nScaleWidth;
2849  sal_uInt16 nH = aTableParam.nScaleHeight;
2850 
2851  // If manual breaks are forced, calculate minimum # pages required
2853  {
2854  sal_uInt16 nMinPagesW = 0, nMinPagesH = 0;
2855  std::set<SCROW> aRowBreaks;
2856  std::set<SCCOL> aColBreaks;
2857  rDoc.GetAllRowBreaks(aRowBreaks, nPrintTab, false, true);
2858  rDoc.GetAllColBreaks(aColBreaks, nPrintTab, false, true);
2859  nMinPagesW = aColBreaks.size() + 1;
2860  nMinPagesH = aRowBreaks.size() + 1;
2861 
2862  // #i54993# use min forced by breaks if it's > # pages in
2863  // scale parameters to avoid bottoming out at <= ZOOM_MIN
2864  nW = std::max(nMinPagesW, nW);
2865  nH = std::max(nMinPagesH, nH);
2866  }
2867 
2868  sal_uInt16 nLastFitZoom = 0, nLastNonFitZoom = 0;
2869  while (true)
2870  {
2871  if (nZoom <= ZOOM_MIN)
2872  break;
2873 
2874  CalcPages();
2875  bool bFitsPage = ((!nW || (m_aRanges.m_nPagesX <= nW)) && (!nH || (m_aRanges.m_nPagesY <= nH)));
2876 
2877  if (bFitsPage)
2878  {
2879  if (nZoom == 100)
2880  // If it fits at 100%, it's good enough for me.
2881  break;
2882 
2883  nLastFitZoom = nZoom;
2884  nZoom = (nLastNonFitZoom + nZoom) / 2;
2885 
2886  if (nLastFitZoom == nZoom)
2887  // It converged. Use this zoom level.
2888  break;
2889  }
2890  else
2891  {
2892  if (nZoom - nLastFitZoom <= 1)
2893  {
2894  nZoom = nLastFitZoom;
2895  CalcPages();
2896  break;
2897  }
2898 
2899  nLastNonFitZoom = nZoom;
2900  nZoom = (nLastFitZoom + nZoom) / 2;
2901  }
2902  }
2903  // tdf#103516 remove the almost blank page(s) for better
2904  // interoperability by using slightly smaller zoom
2905  if (nW > 0 && nH == 0 && m_aRanges.m_nPagesY > 1)
2906  {
2907  sal_uInt32 nLastPagesY = m_aRanges.m_nPagesY;
2908  nLastFitZoom = nZoom;
2909  nZoom *= 0.98;
2910  if (nZoom < nLastFitZoom)
2911  {
2912  CalcPages();
2913  // same page count with smaller zoom: use the original zoom
2914  if (m_aRanges.m_nPagesY == nLastPagesY)
2915  {
2916  nZoom = nLastFitZoom;
2917  CalcPages();
2918  }
2919  }
2920  }
2921  }
2922  else if (aTableParam.bScaleAll)
2923  {
2925  if ( nZoom <= ZOOM_MIN )
2926  nZoom = ZOOM_MIN;
2927  CalcPages();
2928  }
2929  else
2930  {
2931  OSL_ENSURE( aTableParam.bScaleNone, "no scale flag is set" );
2932  nZoom = 100;
2933  CalcPages();
2934  }
2935 }
2936 
2938 {
2939  // Adjust height of head/foot line
2940 
2941  InitModes(); // initialize aTwipMode from nZoom
2942  pDev->SetMapMode( aTwipMode ); // head/foot line in Twips
2943  UpdateHFHeight( aHdr );
2944  UpdateHFHeight( aFtr );
2945 
2946  // Page size in Document-Twips
2947  // Calculating Left / Right also in PrintPage
2948 
2950  aPageRect.SetLeft( ( aPageRect.Left() + nLeftMargin ) * 100 / nZoom );
2951  aPageRect.SetRight( ( aPageRect.Right() - nRightMargin ) * 100 / nZoom );
2952  aPageRect.SetTop( ( aPageRect.Top() + nTopMargin ) * 100 / nZoom + aHdr.nHeight );
2954 
2955  Size aDocPageSize = aPageRect.GetSize();
2956  if (aTableParam.bHeaders)
2957  {
2958  aDocPageSize.AdjustWidth( -(tools::Long(PRINT_HEADER_WIDTH)) );
2959  aDocPageSize.AdjustHeight( -(tools::Long(PRINT_HEADER_HEIGHT)) );
2960  }
2961  if (pBorderItem)
2962  {
2963  aDocPageSize.AdjustWidth( -(lcl_LineTotal(pBorderItem->GetLeft()) +
2965  pBorderItem->GetDistance(SvxBoxItemLine::LEFT) +
2966  pBorderItem->GetDistance(SvxBoxItemLine::RIGHT)) );
2967  aDocPageSize.AdjustHeight( -(lcl_LineTotal(pBorderItem->GetTop()) +
2969  pBorderItem->GetDistance(SvxBoxItemLine::TOP) +
2970  pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM)) );
2971  }
2972  if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE)
2973  {
2974  aDocPageSize.AdjustWidth( -(pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) +
2975  pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT)) );
2976  aDocPageSize.AdjustHeight( -(pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) +
2977  pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM)) );
2978  }
2979  return aDocPageSize;
2980 }
2981 
2982 void ScPrintFunc::ResetBreaks( SCTAB nTab ) // Set Breaks correctly for view
2983 {
2984  rDoc.SetPageSize( nTab, GetDocPageSize() );
2985  rDoc.UpdatePageBreaks( nTab );
2986 }
2987 
2988 static void lcl_SetHidden( const ScDocument& rDoc, SCTAB nPrintTab, ScPageRowEntry& rPageRowEntry,
2989  SCCOL nStartCol, const std::vector< SCCOL >& rPageEndX )
2990 {
2991  size_t nPagesX = rPageRowEntry.GetPagesX();
2992  SCROW nStartRow = rPageRowEntry.GetStartRow();
2993  SCROW nEndRow = rPageRowEntry.GetEndRow();
2994 
2995  bool bLeftIsEmpty = false;
2996  ScRange aTempRange;
2997  tools::Rectangle aTempRect = rDoc.GetMMRect( 0,0, 0,0, 0 );
2998 
2999  for (size_t i=0; i<nPagesX; i++)
3000  {
3001  OSL_ENSURE(i < rPageEndX.size(), "vector access error for aPageEndX");
3002  SCCOL nEndCol = rPageEndX[i];
3003  if ( rDoc.IsPrintEmpty( nPrintTab, nStartCol, nStartRow, nEndCol, nEndRow,
3004  bLeftIsEmpty, &aTempRange, &aTempRect ) )
3005  {
3006  rPageRowEntry.SetHidden(i);
3007  bLeftIsEmpty = true;
3008  }
3009  else
3010  bLeftIsEmpty = false;
3011 
3012  nStartCol = nEndCol+1;
3013  }
3014 }
3015 
3016 void ScPrintFunc::CalcPages() // calculates aPageRect and pages from nZoom
3017 {
3020 }
3021 
3022 namespace sc
3023 {
3024 
3026  : m_nPagesX(0)
3027  , m_nPagesY(0)
3028  , m_nTotalY(0)
3029 {}
3030 
3032  bool bSkipEmpty, bool bPrintArea,
3033  SCROW nStartRow, SCROW nEndRow,
3034  SCCOL nStartCol, SCCOL nEndCol,
3035  SCTAB nPrintTab, Size const & rDocSize)
3036 {
3037  if (bSkipEmpty == m_aInput.m_bSkipEmpty &&
3038  bPrintArea == m_aInput.m_bPrintArea &&
3039  nStartRow == m_aInput.m_nStartRow && nEndRow == m_aInput.m_nEndRow &&
3040  nStartCol == m_aInput.m_nStartCol && nEndCol == m_aInput.m_nEndCol &&
3041  nPrintTab == m_aInput.m_nPrintTab &&
3042  rDocSize == m_aInput.m_aDocSize)
3043  {
3044  return true;
3045  }
3046 
3047  m_aInput.m_bSkipEmpty = bSkipEmpty;
3048  m_aInput.m_bPrintArea = bPrintArea;
3049  m_aInput.m_nStartRow = nStartRow;
3050  m_aInput.m_nEndRow = nEndRow;
3051  m_aInput.m_nStartCol = nStartCol;
3052  m_aInput.m_nEndCol = nEndCol;
3053  m_aInput.m_nPrintTab = nPrintTab;
3054  m_aInput.m_aDocSize = rDocSize;
3055 
3056  return false;
3057 }
3058 
3060  bool bSkipEmpty, bool bPrintArea,
3061  SCROW nStartRow, SCROW nEndRow,
3062  SCCOL nStartCol, SCCOL nEndCol,
3063  SCTAB nPrintTab, Size const & rDocSize)
3064 {
3065  // Already calculated?
3066  if (checkIfAlreadyCalculatedAndSet(bSkipEmpty, bPrintArea,
3067  nStartRow, nEndRow, nStartCol, nEndCol,
3068  nPrintTab, rDocSize))
3069  return;
3070 
3071  rDoc.SetPageSize(nPrintTab, rDocSize);
3072 
3073  // #i123672# use dynamic mem to react on size changes
3074  if (m_aPageEndX.size() < static_cast<size_t>(rDoc.MaxCol()) + 1)
3075  {
3076  m_aPageEndX.resize(rDoc.MaxCol()+1, SCCOL());
3077  }
3078 
3079  if (bPrintArea)
3080  {
3081  ScRange aRange(nStartCol, nStartRow, nPrintTab, nEndCol, nEndRow, nPrintTab);
3082  rDoc.UpdatePageBreaks(nPrintTab, &aRange);
3083  }
3084  else
3085  {
3086  rDoc.UpdatePageBreaks(nPrintTab); // else, end is marked
3087  }
3088 
3089  const size_t nRealCnt = nEndRow - nStartRow + 1;
3090 
3091  // #i123672# use dynamic mem to react on size changes
3092  if (m_aPageEndY.size() < nRealCnt+1)
3093  {
3094  m_aPageEndY.resize(nRealCnt + 1, SCROW());
3095  }
3096 
3097  // #i123672# use dynamic mem to react on size changes
3098  if (m_aPageRows.size() < nRealCnt+1)
3099  {
3100  m_aPageRows.resize(nRealCnt+1, ScPageRowEntry());
3101  }
3102 
3103  // Page alignment/splitting after breaks in Col/RowFlags
3104  // Of several breaks in a hidden area, only one counts.
3105 
3106  m_nPagesX = 0;
3107  m_nPagesY = 0;
3108  m_nTotalY = 0;
3109 
3110  bool bVisCol = false;
3111  for (SCCOL i = nStartCol; i <= nEndCol; i++)
3112  {
3113  bool bHidden = rDoc.ColHidden(i, nPrintTab);
3114  bool bPageBreak(rDoc.HasColBreak(i, nPrintTab) & ScBreakType::Page);
3115  if (i > nStartCol && bVisCol && bPageBreak)
3116  {
3117  OSL_ENSURE(m_nPagesX < m_aPageEndX.size(), "vector access error for aPageEndX");
3118  m_aPageEndX[m_nPagesX] = i-1;
3119  ++m_nPagesX;
3120  bVisCol = false;
3121  }
3122  if (!bHidden)
3123  bVisCol = true;
3124  }
3125  if (bVisCol) // also at the end, no empty pages
3126  {
3127  OSL_ENSURE(m_nPagesX < m_aPageEndX.size(), "vector access error for aPageEndX");
3128  m_aPageEndX[m_nPagesX] = nEndCol;
3129  ++m_nPagesX;
3130  }
3131 
3132  bool bVisRow = false;
3133  SCROW nPageStartRow = nStartRow;
3134  SCROW nLastVisibleRow = -1;
3135 
3136  std::unique_ptr<ScRowBreakIterator> pRowBreakIter(rDoc.GetRowBreakIterator(nPrintTab));
3137  SCROW nNextPageBreak = pRowBreakIter->first();
3138  while (nNextPageBreak != ScRowBreakIterator::NOT_FOUND && nNextPageBreak < nStartRow)
3139  // Skip until the page break position is at the start row or greater.
3140  nNextPageBreak = pRowBreakIter->next();
3141 
3142  for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
3143  {
3144  bool bPageBreak = (nNextPageBreak == nRow);
3145  if (bPageBreak)
3146  nNextPageBreak = pRowBreakIter->next();
3147 
3148  if (nRow > nStartRow && bVisRow && bPageBreak)
3149  {
3150  OSL_ENSURE(m_nTotalY < m_aPageEndY.size(), "vector access error for rPageEndY");
3151  m_aPageEndY[m_nTotalY] = nRow - 1;
3152  ++m_nTotalY;
3153 
3154  if (!bSkipEmpty || !rDoc.IsPrintEmpty(nPrintTab, nStartCol, nPageStartRow, nEndCol, nRow-1))
3155  {
3156  OSL_ENSURE(m_nPagesY < m_aPageRows.size(), "vector access error for rPageRows");
3157  m_aPageRows[m_nPagesY].SetStartRow(nPageStartRow);
3158  m_aPageRows[m_nPagesY].SetEndRow(nRow - 1);
3159  m_aPageRows[m_nPagesY].SetPagesX(m_nPagesX);
3160  if (bSkipEmpty)
3161  lcl_SetHidden(rDoc, nPrintTab, m_aPageRows[m_nPagesY], nStartCol, m_aPageEndX);
3162  ++m_nPagesY;
3163  }
3164 
3165  nPageStartRow = nRow;
3166  bVisRow = false;
3167  }
3168 
3169  if (nRow <= nLastVisibleRow)
3170  {
3171  // This row is still visible. Don't bother calling RowHidden() to
3172  // find out, for speed optimization.
3173  bVisRow = true;
3174  continue;
3175  }
3176 
3177  SCROW nLastRow = -1;
3178  if (!rDoc.RowHidden(nRow, nPrintTab, nullptr, &nLastRow))
3179  {
3180  bVisRow = true;
3181  nLastVisibleRow = nLastRow;
3182  }
3183  else
3184  // skip all hidden rows.
3185  nRow = nLastRow;
3186  }
3187 
3188  if (!bVisRow)
3189  return;
3190 
3191  OSL_ENSURE(m_nTotalY < m_aPageEndY.size(), "vector access error for maPageEndY");
3192  m_aPageEndY[m_nTotalY] = nEndRow;
3193  ++m_nTotalY;
3194 
3195  if (!bSkipEmpty || !rDoc.IsPrintEmpty(nPrintTab, nStartCol, nPageStartRow, nEndCol, nEndRow))
3196  {
3197  OSL_ENSURE(m_nPagesY < m_aPageRows.size(), "vector access error for maPageRows");
3198  m_aPageRows[m_nPagesY].SetStartRow(nPageStartRow);
3199  m_aPageRows[m_nPagesY].SetEndRow(nEndRow);
3200  m_aPageRows[m_nPagesY].SetPagesX(m_nPagesX);
3201  if (bSkipEmpty)
3202  lcl_SetHidden(rDoc, nPrintTab, m_aPageRows[m_nPagesY], nStartCol, m_aPageEndX);
3203  ++m_nPagesY;
3204  }
3205 }
3206 
3207 } // end namespace sc
3208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool IsSystemRTL()
Definition: global.cxx:844
bool IsLandscape() const
SC_DLLPUBLIC bool GetPrintArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow, bool bNotes=true) const
Definition: documen2.cxx:575
void SetClipRegion()
const Fraction & GetScaleX() const
std::unique_ptr< RowInfo[]> mpRowInfo
Definition: fillinfo.hxx:194
OutDevType GetOutDevType() const
FmFormView * pDrawView
Definition: printfun.hxx:195
void FillInfo(ScTableInfo &rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode, const ScMarkData *pMarkData=nullptr)
Definition: fillinfo.cxx:347
OUString aLongDocName
Definition: editutil.hxx:208
sal_uInt16 GetHeight() const
Definition: attrib.hxx:241
bool bMultiArea
Definition: printfun.hxx:240
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6247
SCCOL nEndCol
Definition: printfun.hxx:150
bool IsHidden(size_t nX) const
Definition: printfun.cxx:131
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2116
#define OLE_STD_CELLS_Y
Definition: global.hxx:114
void GetPrintState(ScPrintState &rState, bool bSavePageRanges=false)
Definition: printfun.cxx:335
void GetScaleData(Size &rPhysSize, tools::Long &rDocHdr, tools::Long &rDocFtr)
Definition: printfun.cxx:1102
std::vector< SCROW > aPageEndY
Definition: printfun.hxx:166
SC_DLLPUBLIC const ScRange * GetRepeatColRange(SCTAB nTab)
Definition: document.cxx:6313
MapMode aOffsetMode
Definition: printfun.hxx:248
ScAddress aStart
Definition: address.hxx:499
sal_uInt16 nTopMargin
Definition: printfun.hxx:217
std::vector< SCROW > m_aPageEndY
Definition: printfun.hxx:124
Size GetDocPageSize()
Definition: printfun.cxx:2937
void DrawFrame(vcl::RenderContext &rRenderContext)
Definition: output.cxx:1383
void UpdatePendingRowHeights(SCTAB nUpdateTab, bool bBefore=false)
Definition: docsh5.cxx:432
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_DYNAMIC(165)
SC_DLLPUBLIC bool HasPrintRange()
Definition: document.cxx:6276
constexpr TypedWhichId< SvxSizeItem > ATTR_PAGE_SIZE(161)
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:718
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
void CalcZoom(sal_uInt16 nRangeNo)
Definition: printfun.cxx:2766
void SetShowNullValues(bool bSet)
Definition: output.cxx:247
void SetManualZoom(sal_uInt16 nNewZoom)
Definition: printfun.cxx:2366
#define RANGENO_NORANGE
Definition: printfun.hxx:42
void SetUseStyleColor(bool bFlag)
Definition: printfun.cxx:2376
ScRange aPrintArea
Definition: pagepar.hxx:60
sal_uInt16 GetLower() const
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< ScViewObjectModeItem > ATTR_PAGE_DRAWINGS(172)
SCROW Row() const
Definition: address.hxx:261
ScVSplitPos
Definition: viewdata.hxx:46
SCROW GetEndRow() const
Definition: printfun.hxx:81
void setWidth(tools::Long nWidth)
GPOS_RM
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_GRID(168)
void SetUseStyleColor(bool bSet)
Definition: output.hxx:323
OUString GetTitle(sal_uInt16 nMaxLen=0) const
virtual bool IsVirtual() const
#define PRINT_HEADER_WIDTH
Definition: printfun.hxx:44
double nScaleX
Definition: printfun.hxx:250
Point PrePrintDrawingLayer(tools::Long nLogStX, tools::Long nLogStY)
Definition: output3.cxx:38
SCROW nStartRow
Definition: printfun.hxx:68
std::string GetValue
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
ScPrintFunc(ScDocShell *pShell, SfxPrinter *pNewPrinter, SCTAB nTab, tools::Long nPage=0, tools::Long nDocP=0, const ScRange *pArea=nullptr, const ScPrintOptions *pOptions=nullptr, ScPageBreakData *pData=nullptr)
Definition: printfun.cxx:198
tools::Long nDocPages
Definition: printfun.hxx:208
static void DrawToDev(ScDocument &rDoc, OutputDevice *pDev, double nPrintFactor, const tools::Rectangle &rBound, ScViewData *pViewData, bool bMetaFile)
Definition: printfun.cxx:447
void SetRepeatArea(SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow)
Definition: document.cxx:6235
void MakeTableString()
Definition: printfun.cxx:1691
bool IsLeft(tools::Long nPageNo)
Definition: printfun.cxx:1679
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_FORMULAS(183)
void PrintPage(tools::Long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, bool bDoPrint, ScPreviewLocationData *pLocationData)
Definition: printfun.cxx:2015
void SetPagesX(size_t nNew)
Definition: printfun.cxx:111
GPOS_NONE
GPOS_LT
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(175)
#define OLE_STD_CELLS_X
Definition: global.hxx:113
const OUString & GetName() const
long Long
sal_uInt16 nScaleHeight
Definition: pagepar.hxx:45
tools::Long GetRight() const
const EditTextObject * GetCenterArea() const
Definition: attrib.hxx:185
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:712
void ResetBreaks(SCTAB nTab)
Definition: printfun.cxx:2982
SCSIZE mnArrCount
Definition: fillinfo.hxx:195
double GetOutputFactor() const
Definition: docsh.hxx:353
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
Definition: address.cxx:1926
void AddNoteText(const tools::Rectangle &rRect, const ScAddress &rPos)
Definition: prevloc.cxx:248
void SetSnapPixel()
Definition: output.cxx:262
const SvxShadowItem * pShadow
Definition: printfun.hxx:62
bool IsSupportedGraphic() const
const SfxItemSet * pParamSet
Definition: printfun.hxx:212
sal_uInt16 GetValue() const
ScPrintRangeData & GetData(size_t i)
Definition: pagedata.cxx:60
void PrintRowHdr(SCROW nY1, SCROW nY2, tools::Long nScrX, tools::Long nScrY)
Definition: printfun.cxx:1442
virtual SdrPageView * ShowSdrPage(SdrPage *pPage) override
bool IsOver(const tools::Rectangle &rRect) const
const ScPageHFItem * pRight
Definition: printfun.hxx:59
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
const ContentProperties & rData
sal_uInt16 nLeftMargin
Definition: printfun.hxx:216
const MapMode & GetMapMode() const
tools::Long TextHeight(const EditTextObject *pObject)
Definition: printfun.cxx:767
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
bool mbHasPrintRange
Definition: printfun.hxx:241
constexpr SdrLayerID SC_LAYER_BACK(1)
sal_uInt16 nBottomMargin
Definition: printfun.hxx:219
ScAddress aEnd
Definition: address.hxx:500
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:397
void PrintArea(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, tools::Long nScrX, tools::Long nScrY, bool bShLeft, bool bShTop, bool bShRight, bool bShBottom)
Definition: printfun.cxx:1567
void IntersectClipRegion(const tools::Rectangle &rRect)
void SetShowFormulas(bool bSet)
Definition: output.cxx:252
sal_uInt16 nFirstPageNo
Definition: pagepar.hxx:47
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+15)
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
virtual SfxItemSet & GetItemSet()
bool GetLastSourceRange(ScRange &rRange) const
Definition: printfun.cxx:361
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
void GetEmbedded(ScRange &rRange) const
Definition: documen3.cxx:1701
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_NULLVALS(184)
SC_DLLPUBLIC ScRange GetRange(SCTAB nTab, const tools::Rectangle &rMMRect, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1798
void ApplyAsianEditSettings(ScEditEngineDefaulter &rEngine)
Definition: documen9.cxx:673
const editeng::SvxBorderLine * GetRight() const
EmbeddedObjectRef * pObject
EEControlBits
css::chart::ChartAxisLabelPosition ePos
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:494
Size GetDataSize() const
Definition: printfun.cxx:1093
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1394
SCTAB nPrintTab
Definition: printfun.hxx:147
SCROW GetStartRow() const
Definition: printfun.hxx:80
void SetMapMode()
bool bClearWin
Definition: printfun.hxx:202
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5205
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
void SetRight(tools::Long v)
bool bSourceRangeValid
Definition: printfun.hxx:223
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
constexpr TypedWhichId< ScPageScaleToItem > ATTR_PAGE_SCALETO(185)
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4192
tools::Rectangle aPageRect
Definition: printfun.hxx:245
std::vector< ScAddress > aNotePosList
Definition: printfun.hxx:271
ScSplitPos
Definition: viewdata.hxx:44
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6087
ScPageTableParam aTableParam
Definition: printfun.hxx:234
constexpr tools::Long Width() const
static rtl::Reference< SfxItemPool > CreatePool()
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: documen8.cxx:113
GPOS_TILED
SC_DLLPUBLIC bool GetPrintAreaVer(SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW &rEndRow, bool bNotes) const
Definition: documen2.cxx:621
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
Notes.
Definition: document.cxx:6534
SvxGraphicPosition GetGraphicPos() const
SvxNumType GetNumType() const
SvxShadowLocation GetLocation() const
GPOS_LM
const ScRange * pUserArea
Definition: printfun.hxx:210
tools::Long Left() const
void FillPageData()
Definition: printfun.cxx:367
void SetLeft(tools::Long v)
bool IsValid() const
Definition: attrib.hxx:242
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:871
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
const Fraction & GetScaleY() const
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:313
static void lcl_DrawGraphic(const Graphic &rGraphic, vcl::RenderContext &rOutDev, const tools::Rectangle &rGrf, const tools::Rectangle &rOut)
Definition: printfun.cxx:1117
Additional class containing cell annotation data.
Definition: postit.hxx:159
SCCOL VisibleCellsX(ScHSplitPos eWhichX) const
Definition: viewdata.cxx:2674
void DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBottom)
Definition: output.cxx:1182
int nCount
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_VERCENTER(163)
void AddNoteMark(const tools::Rectangle &rRect, const ScAddress &rPos)
Definition: prevloc.cxx:240
void LocateColHdr(SCCOL nX1, SCCOL nX2, tools::Long nScrX, tools::Long nScrY, bool bRepCol, ScPreviewLocationData &rLocationData)
Definition: printfun.cxx:1483
tools::Long Bottom() const
void InitParam(const ScPrintOptions *pOptions)
Definition: printfun.cxx:832
const SvxBoxItem * pBorder
Definition: printfun.hxx:60
MapMode aLogicMode
Definition: printfun.hxx:247
bool IsSelected(sal_Int32 nIndex) const
constexpr tools::Long GetWidth() const
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:190
SvxPageUsage nPageUsage
Definition: printfun.hxx:225
#define HMM_PER_TWIPS
Definition: global.hxx:92
void SetDrawView(FmFormView *pNew)
Definition: output.hxx:320
SC_DLLPUBLIC const ScRange * GetPrintRange(SCTAB nTab, sal_uInt16 nPos)
Definition: document.cxx:6305
OUString aShortDocName
Definition: editutil.hxx:209
const Graphic * GetGraphic(OUString const &referer=OUString()) const
tools::Long DoPrint(const MultiSelection &rPageRanges, tools::Long nStartPage, tools::Long nDisplayStart, bool bDoPrint, ScPreviewLocationData *pLocationData)
Definition: printfun.cxx:2637
ScPageAreaParam aAreaParam
Definition: printfun.hxx:235
std::vector< ScPageRowEntry > m_aPageRows
Definition: printfun.hxx:125
void AddHeaderFooter(const tools::Rectangle &rRect, bool bHeader, bool bLeft)
Definition: prevloc.cxx:228
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_HEADERS(169)
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1408
size_t GetCount() const
Definition: pagedata.hxx:73
void DrawLine(const Point &rStartPt, const Point &rEndPt)
ScDocShell * pDocShell
Definition: printfun.hxx:191
bool IsPrintEntireSheet(SCTAB nTab) const
Returns true, if the specified sheet is always printed.
Definition: document.cxx:6292
bool GetForceBreaks() const
Definition: printopt.hxx:40
constexpr TypedWhichId< SvxPaperBinItem > ATTR_PAGE_PAPERBIN(160)
void setHideOle(bool bNew)
void DrawRect(const tools::Rectangle &rRect)
tools::Long PrintNotes(tools::Long nPageNo, tools::Long nNoteStart, bool bDoPrint, ScPreviewLocationData *pLocationData)
Definition: printfun.cxx:1949
bool bPrintAreaValid
Definition: printfun.hxx:262
bool bPrintAreaValid
Definition: printfun.hxx:152
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:70
void ResetEmbedded()
Definition: documen3.cxx:1745
SCROW VisibleCellsY(ScVSplitPos eWhichY) const
Definition: viewdata.cxx:2679
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERLEFT(178)
SCROW nStartRow
Definition: printfun.hxx:259
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_TOPDOWN(173)
sc::PrintPageRanges m_aRanges
Definition: printfun.hxx:264
bool IsPrintEmpty(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool bLeftIsEmpty=false, ScRange *pLastRange=nullptr, tools::Rectangle *pLastMM=nullptr) const
Definition: documen9.cxx:435
const Color & GetColor() const
tools::Long nTabPages
Definition: printfun.hxx:156
ScPrintHFParam aFtr
Definition: printfun.hxx:233
tools::Long nTotalPages
Definition: printfun.hxx:157
const Color & GetColor() const
static void lcl_HidePrint(const ScTableInfo &rTabInfo, SCCOL nX1, SCCOL nX2)
Definition: printfun.cxx:421
void SetTab(SCTAB nTabP)
Definition: address.hxx:282
sal_uInt16 GetWidth() const
Definition: attrib.hxx:240
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1057
const editeng::SvxBorderLine * GetTop() const
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:870
void SetLineColor()
tools::Long CountNotePages()
Definition: printfun.cxx:2508
bool UpdatePages()
Definition: printfun.cxx:2401
tools::Long nTabPages
Definition: printfun.hxx:242
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4476
SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount(SCTAB nTab)
Definition: document.cxx:6297
void MakeEditEngine()
Definition: printfun.cxx:1698
bool bCenterHor
Definition: printfun.hxx:220
const ScPatternAttr * pPatternAttr
Definition: fillinfo.hxx:134
SCTAB nPrintTab
Definition: printfun.hxx:206
tools::Long nTotalPages
Definition: editutil.hxx:213
tools::Long DoNotes(tools::Long nNoteStart, bool bDoPrint, ScPreviewLocationData *pLocationData)
Definition: printfun.cxx:1875
Point aOffset
Definition: printfun.hxx:200
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const editeng::SvxBorderLine * GetLeft() const
int i
sal_uInt16 nScalePageNum
Definition: pagepar.hxx:46
bool bUseStyleColor
Definition: printfun.hxx:203
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_FOOTERSET(182)
void LocateArea(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, tools::Long nScrX, tools::Long nScrY, bool bRepCol, bool bRepRow, ScPreviewLocationData &rLocationData)
Definition: printfun.cxx:1524
size_t nPagesX
Definition: printfun.hxx:154
tools::Long nDocPages
Definition: printfun.hxx:159
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2620
SC_DLLPUBLIC void GetAllColBreaks(std::set< SCCOL > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4382
OUTDEV_PDF
sal_Int16 SCCOL
Definition: types.hxx:21
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
sal_uLong GetScaledRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale, const sal_uLong *pnMaxHeight=nullptr) const
Definition: document.cxx:4229
#define SC_MOD()
Definition: scmod.hxx:250
bool bFromPrintState
Definition: printfun.hxx:213
void ExtendPrintArea(OutputDevice *pDev, SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW nEndRow) const
Find the maximum column position that contains printable data for the specified row range...
Definition: documen3.cxx:2101
ScRange aLastSourceRange
Definition: printfun.hxx:231
Size GetOutputSize() const
OUString aTabName
Definition: editutil.hxx:210
tools::Long GetLeft() const
SCROW nEndRow
Definition: printfun.hxx:151
void SetFillColor()
GPOS_MT
bool getHideFormControl() const
SvxGraphicPosition
void DrawBackground(vcl::RenderContext &rRenderContext)
Definition: output.cxx:1019
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_HORCENTER(162)
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:88
void ApplyPrintSettings()
Definition: printfun.cxx:2598
GPOS_MM
SCCOL nStartCol
Definition: printfun.hxx:148
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6212
void DrawStrings(bool bPixelToLogic=false)
Definition: output2.cxx:1481
bool IsInside(const Point &rPOINT) const
void DrawTiled(OutputDevice &rOut, const tools::Rectangle &rArea, const Size &rSize, const Size &rOffset, int nTileCacheSize1D=128)
sal_uInt16 nZoom
Definition: printfun.hxx:238
PrintPageRangesInput m_aInput
Definition: printfun.hxx:131
ScDocument & rDoc
Definition: printfun.hxx:192
bool bIsRender
Definition: printfun.hxx:204
void SetTop(tools::Long v)
bool HasName() const
bool IsMirror(tools::Long nPageNo)
Definition: printfun.cxx:1674
void SetBottom(tools::Long v)
constexpr TypedWhichId< ScViewObjectModeItem > ATTR_PAGE_OBJECTS(171)
void LocateRowHdr(SCROW nY1, SCROW nY2, tools::Long nScrX, tools::Long nScrY, bool bRepRow, ScPreviewLocationData &rLocationData)
Definition: printfun.cxx:1504
ScPageBreakData * pPageData
Definition: printfun.hxx:273
Paper
MapUnit GetMapUnit() const
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1988
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
tools::Long nPageStart
Definition: printfun.hxx:158
void AddColHeaders(const tools::Rectangle &rRect, SCCOL nStartCol, SCCOL nEndCol, bool bRepCol)
Definition: prevloc.cxx:210
ScPageRowEntry & operator=(const ScPageRowEntry &r)
Definition: printfun.cxx:101
VclPtr< SfxPrinter > pPrinter
Definition: printfun.hxx:193
sal_uInt16 nRight
Definition: printfun.hxx:57
ScRefCellValue maCell
Definition: fillinfo.hxx:132
sal_uInt16 nScaleWidth
Definition: pagepar.hxx:44
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
tools::Long Top() const
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERRIGHT(179)
GPOS_AREA
void SetOffset(const Point &rOfs)
Definition: printfun.cxx:2361
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const SvxBoxItem * pBorderItem
Definition: printfun.hxx:227
constexpr TypedWhichId< SvxLRSpaceItem > ATTR_LRSPACE(157)
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:100
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5594
SfxItemPool * GetPool() const
SC_DLLPUBLIC bool HasNote(const ScAddress &rPos) const
Definition: document.cxx:6559
sal_uInt16 nScaleAll
Definition: pagepar.hxx:43
SCCOL nRepeatEndCol
Definition: printfun.hxx:254
sc::PrintPageRangesInput aPrintPageRangesInput
Definition: printfun.hxx:163
const SCROW SCROW_REPEAT_NONE
Definition: address.hxx:87
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERRIGHT(180)
sal_Int32 nLineWidth
void SetGridColor(const Color &rColor)
Definition: output.cxx:237
Size aPageSize
Definition: printfun.hxx:226
void SetPrintTab(SCTAB nNew)
Definition: prevloc.cxx:166
GraphicType GetType() const
std::vector< ScPageRowEntry > aPageRows
Definition: printfun.hxx:167
const SvxBrushItem * pBackgroundItem
Definition: printfun.hxx:228
SCCOL Col() const
Definition: address.hxx:266
bool bCenterVer
Definition: printfun.hxx:221
void calculate(ScDocument &rDoc, bool bSkipEmpty, bool bPrintArea, SCROW nStartRow, SCROW nEndRow, SCCOL nStartCol, SCCOL nEndCol, SCTAB nPrintTab, Size const &aDocSize)
Definition: printfun.cxx:3059
GPOS_MB
constexpr Point TopLeft() const
SC_DLLPUBLIC const ScViewOptions & GetViewOptions() const
Definition: documen3.cxx:1953
ScAutoFontColorMode
how to treat COL_AUTO in GetFont:
Definition: patattr.hxx:41
void PrintColHdr(SCCOL nX1, SCCOL nX2, tools::Long nScrX, tools::Long nScrY)
Definition: printfun.cxx:1393
sal_uInt16 nLeft
Definition: printfun.hxx:56
SCCOL nRepeatStartCol
Definition: printfun.hxx:253
ScHeaderFieldData aFieldData
Definition: printfun.hxx:269
bool AdjustPrintArea(bool bNew)
Definition: printfun.cxx:683
Point PixelToLogic(const Point &rDevicePt) const
Size GetPrefSize() const
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
void SetDateTime(const DateTime &)
Definition: printfun.cxx:1112
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void AddRowHeaders(const tools::Rectangle &rRect, SCROW nStartRow, SCROW nEndRow, bool bRepRow)
Definition: prevloc.cxx:219
std::vector< SCCOL > m_aPageEndX
Definition: printfun.hxx:123
static tools::Long lcl_LineTotal(const ::editeng::SvxBorderLine *pLine)
Definition: printfun.cxx:150
double nScaleY
Definition: printfun.hxx:251
ScHSplitPos
Definition: viewdata.hxx:45
bool bLandscape
Definition: printfun.hxx:222
SvxPageUsage GetPageUsage() const
void SetHidden(size_t nX)
Definition: printfun.cxx:117
void DrawGrid(vcl::RenderContext &rRenderContext, bool bGrid, bool bPage, bool bMergeCover=false)
Definition: output.cxx:291
void SetEmbedded(const ScRange &rRange)
Definition: documen3.cxx:1739
sal_Int32 SCROW
Definition: types.hxx:17
static constexpr SCROW NOT_FOUND
Definition: dociter.hxx:578
bool getHideChart() const
bool bScalePageNum
Definition: pagepar.hxx:41
constexpr Size GetSize() const
sal_uInt16 nManualZoom
Definition: printfun.hxx:201
void PrintHF(tools::Long nPageNo, bool bHeader, tools::Long nStartY, bool bDoPrint, ScPreviewLocationData *pLocationData)
Definition: printfun.cxx:1738
SC_DLLPUBLIC OutputDevice * GetRefDevice()
Definition: documen8.cxx:198
PAPER_USER
OUString ScResId(std::string_view aId)
Definition: scdll.cxx:89
sal_uInt16 nDistance
Definition: printfun.hxx:55
SCROW nRepeatEndRow
Definition: printfun.hxx:256
Point aSrcOffset
Definition: printfun.hxx:199
SfxItemState
void SetDrawView(FmFormView *pNew)
Definition: printfun.cxx:416
size_t CountVisible() const
Definition: printfun.cxx:136
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:222
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SC_DLLPUBLIC const ScRange * GetRepeatRowRange(SCTAB nTab)
Definition: document.cxx:6321
MapMode GetPrefMapMode() const
SC_DLLPUBLIC bool GetPrintAreaHor(SCTAB nTab, SCROW nStartRow, SCROW nEndRow, SCCOL &rEndCol) const
Definition: documen2.cxx:599
constexpr tools::Long Height() const
#define PRINT_HEADER_HEIGHT
Definition: printfun.hxx:45
VclPtr< OutputDevice > pDev
Definition: printfun.hxx:194
const Range & GetTotalRange() const
MapMode aTwipMode
Definition: printfun.hxx:249
const EditTextObject * GetRightArea() const
Definition: attrib.hxx:186
bool bSavedStateRanges
Definition: printfun.hxx:162
void PostPrintDrawingLayer(const Point &rMMOffset)
Definition: output3.cxx:104
void SetFont(const vcl::Font &rNewFont)
const EditTextObject * GetLeftArea() const
Definition: attrib.hxx:184
void Construct(const ScPrintOptions *pOptions)
Definition: printfun.cxx:155
ScRowBreakIterator * GetRowBreakIterator(SCTAB nTab) const
Definition: document.cxx:6417
void AddCellRange(const tools::Rectangle &rRect, const ScRange &rRange, bool bRepCol, bool bRepRow, const MapMode &rDrawMap)
Definition: prevloc.cxx:178
void CalcPages()
Definition: printfun.cxx:3016
constexpr SdrLayerID SC_LAYER_FRONT(0)
bool getHideOle() const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
tools::Long GetTextHeight() const
SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4405
OUString aName
size_t GetPagesX() const
Definition: printfun.hxx:82
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
constexpr TypedWhichId< ScViewObjectModeItem > ATTR_PAGE_CHARTS(170)
black or white, depending on background
void setHideFormControl(bool bNew)
tools::Long CountPages()
Definition: printfun.cxx:2434
size_t nPagesY
Definition: printfun.hxx:155
constexpr SdrLayerID SC_LAYER_INTERN(2)
tools::Long AdjustWidth(tools::Long n)
SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:6594
static OUString ModifyDelimiters(const OUString &rOld)
Definition: editutil.cxx:62
bool IsEmbedded() const
Definition: document.hxx:926
void DrawBorder(tools::Long nScrX, tools::Long nScrY, tools::Long nScrW, tools::Long nScrH, const SvxBoxItem *pBorderData, const SvxBrushItem *pBackground, const SvxShadowItem *pShadow)
Definition: printfun.cxx:1257
MapMode aOldPrinterMode
Definition: printfun.hxx:197
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
SCCOL nEndCol
Definition: printfun.hxx:260
const INetURLObject & GetURLObject() const
constexpr TypedWhichId< SvxULSpaceItem > ATTR_ULSPACE(158)
void InitModes()
Definition: printfun.cxx:2573
const SvxShadowItem * pShadowItem
Definition: printfun.hxx:229
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
tools::Long nTotalPages
Definition: printfun.hxx:243
constexpr TypedWhichId< SvxPageItem > ATTR_PAGE(159)
DateTime aDateTime
Definition: editutil.hxx:211
bool checkIfAlreadyCalculatedAndSet(bool bSkipEmpty, bool bPrintArea, SCROW nStartRow, SCROW nEndRow, SCCOL nStartCol, SCCOL nEndCol, SCTAB nPrintTab, Size const &aDocSize)
Definition: printfun.cxx:3031
tools::Long AdjustHeight(tools::Long n)
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6092
const SvxBrushItem * pBack
Definition: printfun.hxx:61
std::unique_ptr< ScHeaderEditEngine > pEditEngine
Definition: printfun.hxx:266
bool bPrintCurrentTable
Definition: printfun.hxx:239
tools::Long GetScrH() const
Definition: output.hxx:335
tools::Long nHeight
Definition: printfun.hxx:53
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:985
from style settings, or black/white if needed
SCCOL nStartCol
Definition: printfun.hxx:258
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4460
void setHideDraw(bool bNew)
static void lcl_FillHFParam(ScPrintHFParam &rParam, const SfxItemSet *pHFSet)
Definition: printfun.cxx:640
tools::Long nPageNo
Definition: editutil.hxx:212
void SetCellMapMode(const MapMode &rMapMode)
Definition: prevloc.cxx:161
void setHeight(tools::Long nHeight)
tools::Long GetScrW() const
Definition: output.hxx:334
void setHideChart(bool bNew)
reference_type * get() const
SC_DLLPUBLIC bool IsVisible(SCTAB nTab) const
Definition: document.cxx:907
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_HEADERSET(181)
std::vector< SCCOL > aPageEndX
Definition: printfun.hxx:165
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
void SetClearFlag(bool bFlag)
Definition: printfun.cxx:2371
void SetMetaFileMode(bool bNewMode)
Definition: output.cxx:274
GPOS_RB
static void lcl_SetHidden(const ScDocument &rDoc, SCTAB nPrintTab, ScPageRowEntry &rPageRowEntry, SCCOL nStartCol, const std::vector< SCCOL > &rPageEndX)
Definition: printfun.cxx:2988
bool GetSkipEmpty() const
Definition: printopt.hxx:36
const MapMode & GetLogicMode(ScSplitPos eWhich)
Definition: viewdata.cxx:2973
#define ZOOM_MIN
Definition: printfun.cxx:70
CellInfo * pCellInfo
Definition: fillinfo.hxx:178
sal_uInt16 nRightMargin
Definition: printfun.hxx:218
SC_DLLPUBLIC void GetAllRowBreaks(std::set< SCROW > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4375
SvxNumType eNumType
Definition: editutil.hxx:214
void DrawEdit(bool bPixelToLogic)
Definition: output2.cxx:4290
void UpdateHFHeight(ScPrintHFParam &rParam)
Definition: printfun.cxx:780
void SetRenderFlag(bool bFlag)
Definition: printfun.cxx:2383
GPOS_LB
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_ON(164)
size_t nPagesX
Definition: printfun.hxx:70
void DrawShadow()
Definition: output.cxx:1177
void SetRefDevice(OutputDevice *pRDev)
Definition: output.hxx:316
void SetPageSize(SCTAB nTab, const Size &rSize)
Definition: document.cxx:6220
void AddPDFNotes()
Definition: output.cxx:2393
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(174)
std::vector< bool > aHidden
Definition: printfun.hxx:71
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4151
PAPER_A4
tools::Long Max() const
void Push(PushFlags nFlags=PushFlags::ALL)
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
GPOS_RT
bool bEmptyCellText
Definition: fillinfo.hxx:157
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_NOTES(167)
ScPageRowEntry()
Cache Number of really visible?
Definition: printfun.hxx:75
sal_uInt16 nZoom
Definition: printfun.hxx:153
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERLEFT(177)
void SetExclusivelyDrawOleAndDrawObjects()
Definition: printfun.cxx:2388
bool getHideDraw() const
const ScPageHFItem * pLeft
Definition: printfun.hxx:58
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:212
const editeng::SvxBorderLine * GetBottom() const
tools::Long nPageStart
Definition: printfun.hxx:207
tools::Long nManHeight
Definition: printfun.hxx:54
tools::Long Right() const
const SCCOL SCCOL_REPEAT_NONE
Definition: address.hxx:86
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_FIRSTPAGENO(176)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_SHARED(166)
SCROW nEndRow
Definition: printfun.hxx:261
sal_Int16 SCTAB
Definition: types.hxx:22
size_t nTotalY
Definition: printfun.hxx:164
sal_uInt16 GetUpper() const
const SfxItemSet * pConditionSet
Definition: fillinfo.hxx:135
SCROW nStartRow
Definition: printfun.hxx:149
std::unique_ptr< SfxItemSet > pEditDefaults
Definition: printfun.hxx:267
void PrintDrawingLayer(SdrLayerID nLayer, const Point &rMMOffset)
Definition: output3.cxx:135
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:774
constexpr tools::Long GetHeight() const
sal_uInt16 GetWidth() const
static Paper GetSvxPaper(const Size &rSize, MapUnit eUnit)
ScPrintHFParam aHdr
Definition: printfun.hxx:232
SCROW nRepeatStartRow
Definition: printfun.hxx:255
SfxMedium * GetMedium() const