1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: output3.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 // INCLUDE ---------------------------------------------------------------
38 #include <svx/eeitem.hxx>
39 #include <svx/svdograf.hxx>
40 #include <svx/svdoole2.hxx>
41 #include <svx/svdoutl.hxx>
42 #include <svx/svdpage.hxx>
43 #include <svx/svdpagv.hxx>
44 #include <svx/svdview.hxx>
45 #include <vcl/svapp.hxx>
48 #include "drwlayer.hxx"
49 #include "document.hxx"
50 #include "tabvwsh.hxx"
51 #include "fillinfo.hxx"
55 #include <basic/sbx.hxx>
57 #include <svx/fmview.hxx>
59 // STATIC DATA -----------------------------------------------------------
61 SdrObject
* pSkipPaintObj
= NULL
;
63 //==================================================================
66 Point
ScOutputData::PrePrintDrawingLayer(long nLogStX
, long nLogStY
)
71 long nLayoutSign(bLayoutRTL
? -1 : 1);
73 for (nCol
=0; nCol
<nX1
; nCol
++)
74 aOffset
.X() -= pDoc
->GetColWidth( nCol
, nTab
) * nLayoutSign
;
75 aOffset
.Y() -= pDoc
->GetRowHeight( 0, nY1
-1, nTab
);
79 for (nCol
=nX1
; nCol
<=nX2
; nCol
++)
80 nDataWidth
+= pDoc
->GetColWidth( nCol
, nTab
);
81 nDataHeight
+= pDoc
->GetRowHeight( nY1
, nY2
, nTab
);
84 aOffset
.X() += nDataWidth
;
86 aRect
.Left() = aRect
.Right() = -aOffset
.X();
87 aRect
.Top() = aRect
.Bottom() = -aOffset
.Y();
89 Point
aMMOffset( aOffset
);
90 aMMOffset
.X() = (long)(aMMOffset
.X() * HMM_PER_TWIPS
);
91 aMMOffset
.Y() = (long)(aMMOffset
.Y() * HMM_PER_TWIPS
);
94 aMMOffset
+= Point( nLogStX
, nLogStY
);
96 for (nCol
=nX1
; nCol
<=nX2
; nCol
++)
97 aRect
.Right() += pDoc
->GetColWidth( nCol
, nTab
);
98 aRect
.Bottom() += pDoc
->GetRowHeight( nY1
, nY2
, nTab
);
100 aRect
.Left() = (long) (aRect
.Left() * HMM_PER_TWIPS
);
101 aRect
.Top() = (long) (aRect
.Top() * HMM_PER_TWIPS
);
102 aRect
.Right() = (long) (aRect
.Right() * HMM_PER_TWIPS
);
103 aRect
.Bottom() = (long) (aRect
.Bottom() * HMM_PER_TWIPS
);
105 if(pViewShell
|| pDrawView
)
107 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
111 // #i76114# MapMode has to be set because BeginDrawLayers uses GetPaintRegion
112 MapMode aOldMode
= pDev
->GetMapMode();
114 pDev
->SetMapMode( MapMode( MAP_100TH_MM
, aMMOffset
, aOldMode
.GetScaleX(), aOldMode
.GetScaleY() ) );
116 // #i74769# work with SdrPaintWindow directly
117 // #i76114# pass bDisableIntersect = true, because the intersection of the table area
118 // with the Window's paint region can be empty
119 Region
aRectRegion(aRect
);
120 mpTargetPaintWindow
= pLocalDrawView
->BeginDrawLayers(pDev
, aRectRegion
, true);
121 OSL_ENSURE(mpTargetPaintWindow
, "BeginDrawLayers: Got no SdrPaintWindow (!)");
124 pDev
->SetMapMode( aOldMode
);
132 void ScOutputData::PostPrintDrawingLayer(const Point
& rMMOffset
) // #i74768#
134 // #i74768# just use offset as in PrintDrawingLayer() to also get the form controls
135 // painted with offset
136 MapMode aOldMode
= pDev
->GetMapMode();
140 pDev
->SetMapMode( MapMode( MAP_100TH_MM
, rMMOffset
, aOldMode
.GetScaleX(), aOldMode
.GetScaleY() ) );
143 if(pViewShell
|| pDrawView
)
145 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
149 // #i74769# work with SdrPaintWindow directly
150 pLocalDrawView
->EndDrawLayers(*mpTargetPaintWindow
, true);
151 mpTargetPaintWindow
= 0;
158 pDev
->SetMapMode( aOldMode
);
163 void ScOutputData::PrintDrawingLayer(const sal_uInt16 nLayer
, const Point
& rMMOffset
)
165 bool bHideAllDrawingLayer(false);
167 if(pViewShell
|| pDrawView
)
169 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
173 bHideAllDrawingLayer
= pLocalDrawView
->getHideOle() && pLocalDrawView
->getHideChart() && pLocalDrawView
->getHideDraw();
178 if(bHideAllDrawingLayer
|| (!pDoc
->GetDrawLayer()))
183 MapMode aOldMode
= pDev
->GetMapMode();
187 pDev
->SetMapMode( MapMode( MAP_100TH_MM
, rMMOffset
, aOldMode
.GetScaleX(), aOldMode
.GetScaleY() ) );
191 DrawSelectiveObjects( nLayer
);
195 pDev
->SetMapMode( aOldMode
);
200 void ScOutputData::DrawSelectiveObjects(const sal_uInt16 nLayer
)
202 ScDrawLayer
* pModel
= pDoc
->GetDrawLayer();
206 // #i46362# high contrast mode (and default text direction) must be handled
207 // by the application, so it's still needed when using DrawLayer().
209 SdrOutliner
& rOutl
= pModel
->GetDrawOutliner();
210 rOutl
.EnableAutoColor( bUseStyleColor
);
211 rOutl
.SetDefaultHorizontalTextDirection(
212 (EEHorizontalTextDirection
)pDoc
->GetEditTextDirection( nTab
) );
214 // #i69767# The hyphenator must be set (used to be before drawing a text shape with hyphenation).
215 // LinguMgr::GetHyphenator (EditEngine) uses a wrapper now that creates the real hyphenator on demand,
216 // so it's not a performance problem to call UseHyphenator even when it's not needed.
218 pModel
->UseHyphenator();
220 ULONG nOldDrawMode
= pDev
->GetDrawMode();
221 if ( bUseStyleColor
&& Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
223 pDev
->SetDrawMode( nOldDrawMode
| DRAWMODE_SETTINGSLINE
| DRAWMODE_SETTINGSFILL
|
224 DRAWMODE_SETTINGSTEXT
| DRAWMODE_SETTINGSGRADIENT
);
228 if(pViewShell
|| pDrawView
)
230 SdrView
* pLocalDrawView
= (pDrawView
) ? pDrawView
: pViewShell
->GetSdrView();
234 SdrPageView
* pPageView
= pLocalDrawView
->GetSdrPageView();
238 pPageView
->DrawLayer(sal::static_int_cast
<SdrLayerID
>(nLayer
), pDev
);
243 pDev
->SetDrawMode(nOldDrawMode
);
249 // Teile nur fuer Bildschirm
252 void ScOutputData::DrawingSingle(const sal_uInt16 nLayer
)
257 for (nArrY
=1; nArrY
+1<nArrCount
; nArrY
++)
259 RowInfo
* pThisRowInfo
= &pRowInfo
[nArrY
];
261 if ( pThisRowInfo
->bChanged
)
270 DrawSelectiveObjects( nLayer
);
273 nPosY
+= pRowInfo
[nArrY
].nHeight
;
277 DrawSelectiveObjects( nLayer
);