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>
28 #include <vcl/settings.hxx>
31 #include "drwlayer.hxx"
32 #include "document.hxx"
33 #include "tabvwsh.hxx"
34 #include "fillinfo.hxx"
36 #include <svx/fmview.hxx>
39 Point
ScOutputData::PrePrintDrawingLayer(long nLogStX
, long nLogStY
)
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
);
51 for (nCol
=nX1
; nCol
<=nX2
; nCol
++)
52 nDataWidth
+= mpDoc
->GetColWidth( nCol
, nTab
);
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
);
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();
82 // #i76114# MapMode has to be set because BeginDrawLayers uses GetPaintRegion
83 MapMode aOldMode
= mpDev
->GetMapMode();
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 (!)");
95 mpDev
->SetMapMode( aOldMode
);
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();
111 mpDev
->SetMapMode( MapMode( MAP_100TH_MM
, rMMOffset
, aOldMode
.GetScaleX(), aOldMode
.GetScaleY() ) );
114 if(pViewShell
|| pDrawView
)
116 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
120 // #i74769# work with SdrPaintWindow directly
121 pLocalDrawView
->EndDrawLayers(*mpTargetPaintWindow
, true);
122 mpTargetPaintWindow
= 0;
129 mpDev
->SetMapMode( aOldMode
);
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();
144 bHideAllDrawingLayer
= pLocalDrawView
->getHideOle() && pLocalDrawView
->getHideChart()
145 && pLocalDrawView
->getHideDraw() && pLocalDrawView
->getHideFormControl();
150 if(bHideAllDrawingLayer
|| (!mpDoc
->GetDrawLayer()))
155 MapMode aOldMode
= mpDev
->GetMapMode();
159 mpDev
->SetMapMode( MapMode( MAP_100TH_MM
, rMMOffset
, aOldMode
.GetScaleX(), aOldMode
.GetScaleY() ) );
163 DrawSelectiveObjects( nLayer
);
167 mpDev
->SetMapMode( aOldMode
);
172 void ScOutputData::DrawSelectiveObjects(const sal_uInt16 nLayer
)
174 ScDrawLayer
* pModel
= mpDoc
->GetDrawLayer();
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
);
200 if(pViewShell
|| pDrawView
)
202 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
206 SdrPageView
* pPageView
= pLocalDrawView
->GetSdrPageView();
210 pPageView
->DrawLayer(sal::static_int_cast
<SdrLayerID
>(nLayer
), mpDev
);
215 mpDev
->SetDrawMode(nOldDrawMode
);
218 // Teile nur fuer Bildschirm
221 void ScOutputData::DrawingSingle(const sal_uInt16 nLayer
)
225 for (nArrY
=1; nArrY
+1<nArrCount
; nArrY
++)
227 RowInfo
* pThisRowInfo
= &pRowInfo
[nArrY
];
229 if ( pThisRowInfo
->bChanged
)
238 DrawSelectiveObjects( nLayer
);
244 DrawSelectiveObjects( nLayer
);
247 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */