fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / view / output3.cxx
blob4b56c47421aba4921a703d9b404e066727df2064
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <editeng/eeitem.hxx>
21 #include <svx/svdograf.hxx>
22 #include <svx/svdoole2.hxx>
23 #include <svx/svdoutl.hxx>
24 #include <svx/svdpage.hxx>
25 #include <svx/svdpagv.hxx>
26 #include <svx/svdview.hxx>
27 #include <vcl/svapp.hxx>
28 #include <vcl/settings.hxx>
30 #include "output.hxx"
31 #include "drwlayer.hxx"
32 #include "document.hxx"
33 #include "tabvwsh.hxx"
34 #include "fillinfo.hxx"
36 #include <svx/fmview.hxx>
38 // #i72502#
39 Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY )
41 Rectangle aRect;
42 SCCOL nCol;
43 Point aOffset;
44 long nLayoutSign(bLayoutRTL ? -1 : 1);
46 for (nCol=0; nCol<nX1; nCol++)
47 aOffset.X() -= mpDoc->GetColWidth( nCol, nTab ) * nLayoutSign;
48 aOffset.Y() -= mpDoc->GetRowHeight( 0, nY1-1, nTab );
50 long nDataWidth = 0;
51 for (nCol=nX1; nCol<=nX2; nCol++)
52 nDataWidth += mpDoc->GetColWidth( nCol, nTab );
54 if ( bLayoutRTL )
55 aOffset.X() += nDataWidth;
57 aRect.Left() = aRect.Right() = -aOffset.X();
58 aRect.Top() = aRect.Bottom() = -aOffset.Y();
60 Point aMMOffset( aOffset );
61 aMMOffset.X() = (long)(aMMOffset.X() * HMM_PER_TWIPS);
62 aMMOffset.Y() = (long)(aMMOffset.Y() * HMM_PER_TWIPS);
64 if (!bMetaFile)
65 aMMOffset += Point( nLogStX, nLogStY );
67 for (nCol=nX1; nCol<=nX2; nCol++)
68 aRect.Right() += mpDoc->GetColWidth( nCol, nTab );
69 aRect.Bottom() += mpDoc->GetRowHeight( nY1, nY2, nTab );
71 aRect.Left() = (long) (aRect.Left() * HMM_PER_TWIPS);
72 aRect.Top() = (long) (aRect.Top() * HMM_PER_TWIPS);
73 aRect.Right() = (long) (aRect.Right() * HMM_PER_TWIPS);
74 aRect.Bottom() = (long) (aRect.Bottom() * HMM_PER_TWIPS);
76 if(pViewShell || pDrawView)
78 SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
80 if(pLocalDrawView)
82 // #i76114# MapMode has to be set because BeginDrawLayers uses GetPaintRegion
83 MapMode aOldMode = mpDev->GetMapMode();
84 if (!bMetaFile)
85 mpDev->SetMapMode( MapMode( MAP_100TH_MM, aMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
87 // #i74769# work with SdrPaintWindow directly
88 // #i76114# pass bDisableIntersect = true, because the intersection of the table area
89 // with the Window's paint region can be empty
90 vcl::Region aRectRegion(aRect);
91 mpTargetPaintWindow = pLocalDrawView->BeginDrawLayers(mpDev, aRectRegion, true);
92 OSL_ENSURE(mpTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
94 if (!bMetaFile)
95 mpDev->SetMapMode( aOldMode );
99 return aMMOffset;
102 // #i72502#
103 void ScOutputData::PostPrintDrawingLayer(const Point& rMMOffset) // #i74768#
105 // #i74768# just use offset as in PrintDrawingLayer() to also get the form controls
106 // painted with offset
107 MapMode aOldMode = mpDev->GetMapMode();
109 if (!bMetaFile)
111 mpDev->SetMapMode( MapMode( MAP_100TH_MM, rMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
114 if(pViewShell || pDrawView)
116 SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
118 if(pLocalDrawView)
120 // #i74769# work with SdrPaintWindow directly
121 pLocalDrawView->EndDrawLayers(*mpTargetPaintWindow, true);
122 mpTargetPaintWindow = 0;
126 // #i74768#
127 if (!bMetaFile)
129 mpDev->SetMapMode( aOldMode );
133 // #i72502#
134 void ScOutputData::PrintDrawingLayer(const sal_uInt16 nLayer, const Point& rMMOffset)
136 bool bHideAllDrawingLayer(false);
138 if(pViewShell || pDrawView)
140 SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
142 if(pLocalDrawView)
144 bHideAllDrawingLayer = pLocalDrawView->getHideOle() && pLocalDrawView->getHideChart()
145 && pLocalDrawView->getHideDraw() && pLocalDrawView->getHideFormControl();
149 // #109985#
150 if(bHideAllDrawingLayer || (!mpDoc->GetDrawLayer()))
152 return;
155 MapMode aOldMode = mpDev->GetMapMode();
157 if (!bMetaFile)
159 mpDev->SetMapMode( MapMode( MAP_100TH_MM, rMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
162 // #109985#
163 DrawSelectiveObjects( nLayer );
165 if (!bMetaFile)
167 mpDev->SetMapMode( aOldMode );
171 // #109985#
172 void ScOutputData::DrawSelectiveObjects(const sal_uInt16 nLayer)
174 ScDrawLayer* pModel = mpDoc->GetDrawLayer();
175 if (!pModel)
176 return;
178 // #i46362# high contrast mode (and default text direction) must be handled
179 // by the application, so it's still needed when using DrawLayer().
181 SdrOutliner& rOutl = pModel->GetDrawOutliner();
182 rOutl.EnableAutoColor( mbUseStyleColor );
183 rOutl.SetDefaultHorizontalTextDirection(
184 (EEHorizontalTextDirection)mpDoc->GetEditTextDirection( nTab ) );
186 // #i69767# The hyphenator must be set (used to be before drawing a text shape with hyphenation).
187 // LinguMgr::GetHyphenator (EditEngine) uses a wrapper now that creates the real hyphenator on demand,
188 // so it's not a performance problem to call UseHyphenator even when it's not needed.
190 pModel->UseHyphenator();
192 DrawModeFlags nOldDrawMode = mpDev->GetDrawMode();
193 if ( mbUseStyleColor && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
195 mpDev->SetDrawMode( nOldDrawMode | DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill |
196 DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient );
199 // #109985#
200 if(pViewShell || pDrawView)
202 SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
204 if(pLocalDrawView)
206 SdrPageView* pPageView = pLocalDrawView->GetSdrPageView();
208 if(pPageView)
210 pPageView->DrawLayer(sal::static_int_cast<SdrLayerID>(nLayer), mpDev);
215 mpDev->SetDrawMode(nOldDrawMode);
218 // Teile nur fuer Bildschirm
220 // #109985#
221 void ScOutputData::DrawingSingle(const sal_uInt16 nLayer)
223 bool bHad = false;
224 SCSIZE nArrY;
225 for (nArrY=1; nArrY+1<nArrCount; nArrY++)
227 RowInfo* pThisRowInfo = &pRowInfo[nArrY];
229 if ( pThisRowInfo->bChanged )
231 if (!bHad)
233 bHad = true;
236 else if (bHad)
238 DrawSelectiveObjects( nLayer );
239 bHad = false;
243 if (bHad)
244 DrawSelectiveObjects( nLayer );
247 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */