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