1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
30 #include "drwlayer.hxx"
31 #include "document.hxx"
32 #include "tabvwsh.hxx"
33 #include "fillinfo.hxx"
35 #include <svx/fmview.hxx>
37 // STATIC DATA -----------------------------------------------------------
39 SdrObject
* pSkipPaintObj
= NULL
;
41 //==================================================================
44 Point
ScOutputData::PrePrintDrawingLayer(long nLogStX
, long nLogStY
)
49 long nLayoutSign(bLayoutRTL
? -1 : 1);
51 for (nCol
=0; nCol
<nX1
; nCol
++)
52 aOffset
.X() -= mpDoc
->GetColWidth( nCol
, nTab
) * nLayoutSign
;
53 aOffset
.Y() -= mpDoc
->GetRowHeight( 0, nY1
-1, nTab
);
56 for (nCol
=nX1
; nCol
<=nX2
; nCol
++)
57 nDataWidth
+= mpDoc
->GetColWidth( nCol
, nTab
);
60 aOffset
.X() += nDataWidth
;
62 aRect
.Left() = aRect
.Right() = -aOffset
.X();
63 aRect
.Top() = aRect
.Bottom() = -aOffset
.Y();
65 Point
aMMOffset( aOffset
);
66 aMMOffset
.X() = (long)(aMMOffset
.X() * HMM_PER_TWIPS
);
67 aMMOffset
.Y() = (long)(aMMOffset
.Y() * HMM_PER_TWIPS
);
70 aMMOffset
+= Point( nLogStX
, nLogStY
);
72 for (nCol
=nX1
; nCol
<=nX2
; nCol
++)
73 aRect
.Right() += mpDoc
->GetColWidth( nCol
, nTab
);
74 aRect
.Bottom() += mpDoc
->GetRowHeight( nY1
, nY2
, nTab
);
76 aRect
.Left() = (long) (aRect
.Left() * HMM_PER_TWIPS
);
77 aRect
.Top() = (long) (aRect
.Top() * HMM_PER_TWIPS
);
78 aRect
.Right() = (long) (aRect
.Right() * HMM_PER_TWIPS
);
79 aRect
.Bottom() = (long) (aRect
.Bottom() * HMM_PER_TWIPS
);
81 if(pViewShell
|| pDrawView
)
83 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
87 // #i76114# MapMode has to be set because BeginDrawLayers uses GetPaintRegion
88 MapMode aOldMode
= mpDev
->GetMapMode();
90 mpDev
->SetMapMode( MapMode( MAP_100TH_MM
, aMMOffset
, aOldMode
.GetScaleX(), aOldMode
.GetScaleY() ) );
92 // #i74769# work with SdrPaintWindow directly
93 // #i76114# pass bDisableIntersect = true, because the intersection of the table area
94 // with the Window's paint region can be empty
95 Region
aRectRegion(aRect
);
96 mpTargetPaintWindow
= pLocalDrawView
->BeginDrawLayers(mpDev
, aRectRegion
, true);
97 OSL_ENSURE(mpTargetPaintWindow
, "BeginDrawLayers: Got no SdrPaintWindow (!)");
100 mpDev
->SetMapMode( aOldMode
);
108 void ScOutputData::PostPrintDrawingLayer(const Point
& rMMOffset
) // #i74768#
110 // #i74768# just use offset as in PrintDrawingLayer() to also get the form controls
111 // painted with offset
112 MapMode aOldMode
= mpDev
->GetMapMode();
116 mpDev
->SetMapMode( MapMode( MAP_100TH_MM
, rMMOffset
, aOldMode
.GetScaleX(), aOldMode
.GetScaleY() ) );
119 if(pViewShell
|| pDrawView
)
121 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
125 // #i74769# work with SdrPaintWindow directly
126 pLocalDrawView
->EndDrawLayers(*mpTargetPaintWindow
, true);
127 mpTargetPaintWindow
= 0;
134 mpDev
->SetMapMode( aOldMode
);
139 void ScOutputData::PrintDrawingLayer(const sal_uInt16 nLayer
, const Point
& rMMOffset
)
141 bool bHideAllDrawingLayer(false);
143 if(pViewShell
|| pDrawView
)
145 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
149 bHideAllDrawingLayer
= pLocalDrawView
->getHideOle() && pLocalDrawView
->getHideChart()
150 && pLocalDrawView
->getHideDraw() && pLocalDrawView
->getHideFormControl();
155 if(bHideAllDrawingLayer
|| (!mpDoc
->GetDrawLayer()))
160 MapMode aOldMode
= mpDev
->GetMapMode();
164 mpDev
->SetMapMode( MapMode( MAP_100TH_MM
, rMMOffset
, aOldMode
.GetScaleX(), aOldMode
.GetScaleY() ) );
168 DrawSelectiveObjects( nLayer
);
172 mpDev
->SetMapMode( aOldMode
);
177 void ScOutputData::DrawSelectiveObjects(const sal_uInt16 nLayer
)
179 ScDrawLayer
* pModel
= mpDoc
->GetDrawLayer();
183 // #i46362# high contrast mode (and default text direction) must be handled
184 // by the application, so it's still needed when using DrawLayer().
186 SdrOutliner
& rOutl
= pModel
->GetDrawOutliner();
187 rOutl
.EnableAutoColor( mbUseStyleColor
);
188 rOutl
.SetDefaultHorizontalTextDirection(
189 (EEHorizontalTextDirection
)mpDoc
->GetEditTextDirection( nTab
) );
191 // #i69767# The hyphenator must be set (used to be before drawing a text shape with hyphenation).
192 // LinguMgr::GetHyphenator (EditEngine) uses a wrapper now that creates the real hyphenator on demand,
193 // so it's not a performance problem to call UseHyphenator even when it's not needed.
195 pModel
->UseHyphenator();
197 sal_uLong nOldDrawMode
= mpDev
->GetDrawMode();
198 if ( mbUseStyleColor
&& Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
200 mpDev
->SetDrawMode( nOldDrawMode
| DRAWMODE_SETTINGSLINE
| DRAWMODE_SETTINGSFILL
|
201 DRAWMODE_SETTINGSTEXT
| DRAWMODE_SETTINGSGRADIENT
);
205 if(pViewShell
|| pDrawView
)
207 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
211 SdrPageView
* pPageView
= pLocalDrawView
->GetSdrPageView();
215 pPageView
->DrawLayer(sal::static_int_cast
<SdrLayerID
>(nLayer
), mpDev
);
220 mpDev
->SetDrawMode(nOldDrawMode
);
226 // Teile nur fuer Bildschirm
229 void ScOutputData::DrawingSingle(const sal_uInt16 nLayer
)
231 sal_Bool bHad
= false;
233 for (nArrY
=1; nArrY
+1<nArrCount
; nArrY
++)
235 RowInfo
* pThisRowInfo
= &pRowInfo
[nArrY
];
237 if ( pThisRowInfo
->bChanged
)
246 DrawSelectiveObjects( nLayer
);
252 DrawSelectiveObjects( nLayer
);
258 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */