Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/embed/EmbedMisc.hpp>
30 : :
31 : : #include "scitems.hxx"
32 : : #include <editeng/boxitem.hxx>
33 : : #include <editeng/brshitem.hxx>
34 : : #include <editeng/editdata.hxx>
35 : : #include <svtools/colorcfg.hxx>
36 : : #include <svx/rotmodit.hxx>
37 : : #include <editeng/shaditem.hxx>
38 : : #include <editeng/svxfont.hxx>
39 : : #include <svx/svdoole2.hxx>
40 : : #include <tools/poly.hxx>
41 : : #include <vcl/svapp.hxx>
42 : : #include <vcl/pdfextoutdevdata.hxx>
43 : : #include <svtools/accessibilityoptions.hxx>
44 : : #include <svx/framelinkarray.hxx>
45 : : #include <drawinglayer/geometry/viewinformation2d.hxx>
46 : : #include <drawinglayer/processor2d/baseprocessor2d.hxx>
47 : : #include <basegfx/matrix/b2dhommatrix.hxx>
48 : : #include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
49 : : #include <vcl/lineinfo.hxx>
50 : : #include <vcl/gradient.hxx>
51 : : #include <svx/unoapi.hxx>
52 : :
53 : : #include "output.hxx"
54 : : #include "document.hxx"
55 : : #include "drwlayer.hxx"
56 : : #include "cell.hxx"
57 : : #include "attrib.hxx"
58 : : #include "patattr.hxx"
59 : : #include "docpool.hxx"
60 : : #include "tabvwsh.hxx"
61 : : #include "progress.hxx"
62 : : #include "pagedata.hxx"
63 : : #include "chgtrack.hxx"
64 : : #include "chgviset.hxx"
65 : : #include "viewutil.hxx"
66 : : #include "gridmerg.hxx"
67 : : #include "invmerge.hxx"
68 : : #include "fillinfo.hxx"
69 : : #include "scmod.hxx"
70 : : #include "appoptio.hxx"
71 : : #include "postit.hxx"
72 : :
73 : : #include <math.h>
74 : :
75 : : using namespace com::sun::star;
76 : :
77 : : // STATIC DATA -----------------------------------------------------------
78 : :
79 : : // Farben fuer ChangeTracking "nach Autor" wie im Writer (swmodul1.cxx)
80 : :
81 : : #define SC_AUTHORCOLORCOUNT 9
82 : :
83 : : static ColorData nAuthorColor[ SC_AUTHORCOLORCOUNT ] = {
84 : : COL_LIGHTRED, COL_LIGHTBLUE, COL_LIGHTMAGENTA,
85 : : COL_GREEN, COL_RED, COL_BLUE,
86 : : COL_BROWN, COL_MAGENTA, COL_CYAN };
87 : :
88 : : // Hilfsklasse, fuer die Farbzuordnung,
89 : : // um nicht mehrfach hintereinander denselben User aus der Liste zu suchen
90 : :
91 : : class ScActionColorChanger
92 : : {
93 : : private:
94 : : const ScAppOptions& rOpt;
95 : : const std::set<rtl::OUString>& rUsers;
96 : : rtl::OUString aLastUserName;
97 : : size_t nLastUserIndex;
98 : : ColorData nColor;
99 : :
100 : : public:
101 : : ScActionColorChanger( const ScChangeTrack& rTrack );
102 : 0 : ~ScActionColorChanger() {}
103 : :
104 : : void Update( const ScChangeAction& rAction );
105 : 0 : ColorData GetColor() const { return nColor; }
106 : : };
107 : :
108 : : //------------------------------------------------------------------
109 : :
110 : 0 : ScActionColorChanger::ScActionColorChanger( const ScChangeTrack& rTrack ) :
111 : 0 : rOpt( SC_MOD()->GetAppOptions() ),
112 : 0 : rUsers( rTrack.GetUserCollection() ),
113 : : nLastUserIndex( 0 ),
114 : 0 : nColor( COL_BLACK )
115 : : {
116 : 0 : }
117 : :
118 : 0 : void ScActionColorChanger::Update( const ScChangeAction& rAction )
119 : : {
120 : : ColorData nSetColor;
121 [ # # # # ]: 0 : switch (rAction.GetType())
122 : : {
123 : : case SC_CAT_INSERT_COLS:
124 : : case SC_CAT_INSERT_ROWS:
125 : : case SC_CAT_INSERT_TABS:
126 : 0 : nSetColor = rOpt.GetTrackInsertColor();
127 : 0 : break;
128 : : case SC_CAT_DELETE_COLS:
129 : : case SC_CAT_DELETE_ROWS:
130 : : case SC_CAT_DELETE_TABS:
131 : 0 : nSetColor = rOpt.GetTrackDeleteColor();
132 : 0 : break;
133 : : case SC_CAT_MOVE:
134 : 0 : nSetColor = rOpt.GetTrackMoveColor();
135 : 0 : break;
136 : : default:
137 : 0 : nSetColor = rOpt.GetTrackContentColor();
138 : 0 : break;
139 : : }
140 [ # # ]: 0 : if ( nSetColor != COL_TRANSPARENT ) // Farbe eingestellt
141 : 0 : nColor = nSetColor;
142 : : else // nach Autor
143 : : {
144 [ # # ]: 0 : if (!aLastUserName.equals(rAction.GetUser()))
145 : : {
146 [ # # ]: 0 : aLastUserName = rAction.GetUser();
147 [ # # ]: 0 : std::set<rtl::OUString>::const_iterator it = rUsers.find(aLastUserName);
148 [ # # ]: 0 : if (it == rUsers.end())
149 : : {
150 : : // empty string is possible if a name wasn't found while saving a 5.0 file
151 : : SAL_INFO_IF( aLastUserName.isEmpty(), "sc.ui", "Author not found" );
152 : 0 : nLastUserIndex = 0;
153 : : }
154 : : else
155 : : {
156 [ # # ]: 0 : size_t nPos = std::distance(rUsers.begin(), it);
157 : 0 : nLastUserIndex = nPos % SC_AUTHORCOLORCOUNT;
158 : : }
159 : : }
160 : 0 : nColor = nAuthorColor[nLastUserIndex];
161 : : }
162 : 0 : }
163 : :
164 : : //==================================================================
165 : :
166 : 5170 : ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType,
167 : : ScTableInfo& rTabInfo, ScDocument* pNewDoc,
168 : : SCTAB nNewTab, long nNewScrX, long nNewScrY,
169 : : SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2,
170 : : double nPixelPerTwipsX, double nPixelPerTwipsY,
171 : : const Fraction* pZoomX, const Fraction* pZoomY ) :
172 : : mpDev( pNewDev ),
173 : : mpRefDevice( pNewDev ), // default is output device
174 : : pFmtDevice( pNewDev ), // default is output device
175 : : mrTabInfo( rTabInfo ),
176 : : pRowInfo( rTabInfo.mpRowInfo ),
177 : : nArrCount( rTabInfo.mnArrCount ),
178 : : mpDoc( pNewDoc ),
179 : : nTab( nNewTab ),
180 : : nScrX( nNewScrX ),
181 : : nScrY( nNewScrY ),
182 : : nX1( nNewX1 ),
183 : : nY1( nNewY1 ),
184 : : nX2( nNewX2 ),
185 : : nY2( nNewY2 ),
186 : : eType( eNewType ),
187 : : mnPPTX( nPixelPerTwipsX ),
188 : : mnPPTY( nPixelPerTwipsY ),
189 : : pEditObj( NULL ),
190 : : pViewShell( NULL ),
191 : : pDrawView( NULL ), // #114135#
192 : : bEditMode( false ),
193 : : bMetaFile( false ),
194 : : bSingleGrid( false ),
195 : : bPagebreakMode( false ),
196 : : bSolidBackground( false ),
197 : : mbUseStyleColor( false ),
198 : 5170 : mbForceAutoColor( SC_MOD()->GetAccessOptions().GetIsAutomaticFontColor() ),
199 : : mbSyntaxMode( false ),
200 : : pValueColor( NULL ),
201 : : pTextColor( NULL ),
202 : : pFormulaColor( NULL ),
203 : : aGridColor( COL_BLACK ),
204 : : mbShowNullValues( sal_True ),
205 : : mbShowFormulas( false ),
206 : : bShowSpellErrors( false ),
207 : : bMarkClipped( false ), // sal_False fuer Drucker/Metafile etc.
208 : : bSnapPixel( false ),
209 : : bAnyRotated( false ),
210 : : bAnyClipped( false ),
211 : 10340 : mpTargetPaintWindow(0) // #i74769# use SdrPaintWindow direct
212 : : {
213 [ + + ]: 5170 : if (pZoomX)
214 : 5103 : aZoomX = *pZoomX;
215 : : else
216 [ + - ]: 67 : aZoomX = Fraction(1,1);
217 [ + + ]: 5170 : if (pZoomY)
218 : 5103 : aZoomY = *pZoomY;
219 : : else
220 [ + - ]: 67 : aZoomY = Fraction(1,1);
221 : :
222 : 5170 : nVisX1 = nX1;
223 : 5170 : nVisY1 = nY1;
224 : 5170 : nVisX2 = nX2;
225 : 5170 : nVisY2 = nY2;
226 : 5170 : mpDoc->StripHidden( nVisX1, nVisY1, nVisX2, nVisY2, nTab );
227 : :
228 : 5170 : nScrW = 0;
229 [ + + ]: 55098 : for (SCCOL nX=nVisX1; nX<=nVisX2; nX++)
230 : 49928 : nScrW += pRowInfo[0].pCellInfo[nX+1].nWidth;
231 : :
232 : 5170 : nMirrorW = nScrW;
233 : :
234 : 5170 : nScrH = 0;
235 [ + + ]: 116276 : for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
236 : 111106 : nScrH += pRowInfo[nArrY].nHeight;
237 : :
238 : 5170 : bTabProtected = mpDoc->IsTabProtected( nTab );
239 : 5170 : nTabTextDirection = mpDoc->GetEditTextDirection( nTab );
240 : 5170 : bLayoutRTL = mpDoc->IsLayoutRTL( nTab );
241 : 5170 : }
242 : :
243 : 5170 : ScOutputData::~ScOutputData()
244 : : {
245 : 5170 : delete pValueColor;
246 : 5170 : delete pTextColor;
247 : 5170 : delete pFormulaColor;
248 : 5170 : }
249 : :
250 : 1278 : void ScOutputData::SetContentDevice( OutputDevice* pContentDev )
251 : : {
252 : : // use pContentDev instead of pDev where used
253 : :
254 [ + - ]: 1278 : if ( mpRefDevice == mpDev )
255 : 1278 : mpRefDevice = pContentDev;
256 [ + + ]: 1278 : if ( pFmtDevice == mpDev )
257 : 1208 : pFmtDevice = pContentDev;
258 : 1278 : mpDev = pContentDev;
259 : 1278 : }
260 : :
261 : 5103 : void ScOutputData::SetMirrorWidth( long nNew )
262 : : {
263 : 5103 : nMirrorW = nNew;
264 : 5103 : }
265 : :
266 : 1341 : void ScOutputData::SetGridColor( const Color& rColor )
267 : : {
268 : 1341 : aGridColor = rColor;
269 : 1341 : }
270 : :
271 : 1278 : void ScOutputData::SetMarkClipped( sal_Bool bSet )
272 : : {
273 : 1278 : bMarkClipped = bSet;
274 : 1278 : }
275 : :
276 : 1345 : void ScOutputData::SetShowNullValues( sal_Bool bSet )
277 : : {
278 : 1345 : mbShowNullValues = bSet;
279 : 1345 : }
280 : :
281 : 1345 : void ScOutputData::SetShowFormulas( sal_Bool bSet )
282 : : {
283 : 1345 : mbShowFormulas = bSet;
284 : 1345 : }
285 : :
286 : 1278 : void ScOutputData::SetShowSpellErrors( sal_Bool bSet )
287 : : {
288 : 1278 : bShowSpellErrors = bSet;
289 : 1278 : }
290 : :
291 : 4 : void ScOutputData::SetSnapPixel( sal_Bool bSet )
292 : : {
293 : 4 : bSnapPixel = bSet;
294 : 4 : }
295 : :
296 : 0 : void ScOutputData::SetEditCell( SCCOL nCol, SCROW nRow )
297 : : {
298 : 0 : nEditCol = nCol;
299 : 0 : nEditRow = nRow;
300 : 0 : bEditMode = sal_True;
301 : 0 : }
302 : :
303 : 4 : void ScOutputData::SetMetaFileMode( sal_Bool bNewMode )
304 : : {
305 : 4 : bMetaFile = bNewMode;
306 : 4 : }
307 : :
308 : 0 : void ScOutputData::SetSingleGrid( sal_Bool bNewMode )
309 : : {
310 : 0 : bSingleGrid = bNewMode;
311 : 0 : }
312 : :
313 : 1278 : void ScOutputData::SetSyntaxMode( sal_Bool bNewMode )
314 : : {
315 : 1278 : mbSyntaxMode = bNewMode;
316 [ - + ]: 1278 : if (bNewMode)
317 [ # # ]: 0 : if (!pValueColor)
318 : : {
319 : 0 : pValueColor = new Color( COL_LIGHTBLUE );
320 : 0 : pTextColor = new Color( COL_BLACK );
321 : 0 : pFormulaColor = new Color( COL_GREEN );
322 : : }
323 : 1278 : }
324 : :
325 : 1278 : void ScOutputData::DrawGrid( sal_Bool bGrid, sal_Bool bPage )
326 : : {
327 : : SCCOL nX;
328 : : SCROW nY;
329 : : long nPosX;
330 : : long nPosY;
331 : : SCSIZE nArrY;
332 : 1278 : ScBreakType nBreak = BREAK_NONE;
333 : 1278 : ScBreakType nBreakOld = BREAK_NONE;
334 : :
335 : : sal_Bool bSingle;
336 : 1278 : Color aPageColor;
337 : 1278 : Color aManualColor;
338 : :
339 [ - + ]: 1278 : if (bPagebreakMode)
340 : 0 : bPage = false; // keine "normalen" Umbrueche ueber volle Breite/Hoehe
341 : :
342 : : //! um den einen Pixel sieht das Metafile (oder die Druck-Ausgabe) anders aus
343 : : //! als die Bildschirmdarstellung, aber wenigstens passen Druck und Metafile zusammen
344 : :
345 [ + - ]: 1278 : Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
346 : 1278 : long nOneX = aOnePixel.Width();
347 : 1278 : long nOneY = aOnePixel.Height();
348 [ - + ]: 1278 : if (bMetaFile)
349 : 0 : nOneX = nOneY = 1;
350 : :
351 [ + + ]: 1278 : long nLayoutSign = bLayoutRTL ? -1 : 1;
352 : 1278 : long nSignedOneX = nOneX * nLayoutSign;
353 : :
354 [ + - ]: 1278 : if ( eType == OUTTYPE_WINDOW )
355 : : {
356 [ + - ][ + - ]: 1278 : const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
357 [ + - ]: 1278 : aPageColor.SetColor( rColorCfg.GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor );
358 [ + - ]: 1278 : aManualColor.SetColor( rColorCfg.GetColorValue(svtools::CALCPAGEBREAKMANUAL).nColor );
359 : : }
360 : : else
361 : : {
362 : 0 : aPageColor = aGridColor;
363 : 0 : aManualColor = aGridColor;
364 : : }
365 : :
366 [ + - ]: 1278 : mpDev->SetLineColor( aGridColor );
367 [ + - ]: 1278 : ScGridMerger aGrid( mpDev, nOneX, nOneY );
368 : :
369 : : //
370 : : // Vertikale Linien
371 : : //
372 : :
373 : 1278 : nPosX = nScrX;
374 [ + + ]: 1278 : if ( bLayoutRTL )
375 : 2 : nPosX += nMirrorW - nOneX;
376 : :
377 [ + + ]: 12980 : for (nX=nX1; nX<=nX2; nX++)
378 : : {
379 : 11702 : SCCOL nXplus1 = nX+1;
380 : 11702 : SCCOL nXplus2 = nX+2;
381 : 11702 : sal_uInt16 nWidth = pRowInfo[0].pCellInfo[nXplus1].nWidth;
382 [ + - ]: 11702 : if (nWidth)
383 : : {
384 : 11702 : nPosX += nWidth * nLayoutSign;
385 : :
386 [ + - ]: 11702 : if ( bPage )
387 : : {
388 : : // Seitenumbrueche auch in ausgeblendeten suchen
389 : 11702 : SCCOL nCol = nXplus1;
390 [ + - ]: 11702 : while (nCol <= MAXCOL)
391 : : {
392 [ + - ]: 11702 : nBreak = mpDoc->HasColBreak(nCol, nTab);
393 [ + - ]: 11702 : bool bHidden = mpDoc->ColHidden(nCol, nTab);
394 : :
395 [ + + ][ + - ]: 11702 : if ( nBreak || !bHidden )
396 : 11702 : break;
397 : 0 : ++nCol;
398 : : }
399 : :
400 [ + + ]: 11702 : if (nBreak != nBreakOld)
401 : : {
402 [ + - ]: 4 : aGrid.Flush();
403 : : mpDev->SetLineColor( (nBreak & BREAK_MANUAL) ? aManualColor :
404 [ + - ][ + + ]: 4 : nBreak ? aPageColor : aGridColor );
[ + - ]
405 : 4 : nBreakOld = nBreak;
406 : : }
407 : : }
408 : :
409 [ + + ][ - + ]: 11702 : sal_Bool bDraw = bGrid || nBreakOld; // einfaches Gitter nur wenn eingestellt
410 : :
411 : 11702 : sal_uInt16 nWidthXplus2 = pRowInfo[0].pCellInfo[nXplus2].nWidth;
412 : 11702 : bSingle = bSingleGrid; //! in Fillinfo holen !!!!!
413 [ + - ][ + - ]: 11702 : if ( nX<MAXCOL && !bSingle )
414 : : {
415 : 11702 : bSingle = ( nWidthXplus2 == 0 );
416 [ + + ][ + + ]: 162132 : for (nArrY=1; nArrY+1<nArrCount && !bSingle; nArrY++)
[ + + ]
417 : : {
418 [ + + ]: 150430 : if (pRowInfo[nArrY].pCellInfo[nXplus2].bHOverlapped)
419 : 6 : bSingle = sal_True;
420 [ - + ]: 150430 : if (pRowInfo[nArrY].pCellInfo[nXplus1].bHideGrid)
421 : 0 : bSingle = sal_True;
422 : : }
423 : : }
424 : :
425 [ + + ]: 11702 : if (bDraw)
426 : : {
427 [ + - ][ + + ]: 11675 : if ( nX<MAXCOL && bSingle )
428 : : {
429 : 6 : SCCOL nVisX = nXplus1;
430 [ + - ][ + - ]: 6 : while ( nVisX < MAXCOL && !mpDoc->GetColWidth(nVisX,nTab) )
[ - + ][ - + ]
431 : 0 : ++nVisX;
432 : :
433 : 6 : nPosY = nScrY;
434 : : long nNextY;
435 [ + + ]: 168 : for (nArrY=1; nArrY+1<nArrCount; nArrY++)
436 : : {
437 : 162 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
438 : 162 : nNextY = nPosY + pThisRowInfo->nHeight;
439 : :
440 : 162 : sal_Bool bHOver = pThisRowInfo->pCellInfo[nXplus1].bHideGrid;
441 [ + - ]: 162 : if (!bHOver)
442 : : {
443 [ + - ]: 162 : if (nWidthXplus2)
444 : 162 : bHOver = pThisRowInfo->pCellInfo[nXplus2].bHOverlapped;
445 : : else
446 : : {
447 [ # # ]: 0 : if (nVisX <= nX2)
448 : 0 : bHOver = pThisRowInfo->pCellInfo[nVisX+1].bHOverlapped;
449 : : else
450 : : bHOver = ((ScMergeFlagAttr*)mpDoc->GetAttr(
451 [ # # ]: 0 : nVisX,pThisRowInfo->nRowNo,nTab,ATTR_MERGE_FLAG))
452 : 0 : ->IsHorOverlapped();
453 [ # # ]: 0 : if (bHOver)
454 : : bHOver = ((ScMergeFlagAttr*)mpDoc->GetAttr(
455 [ # # ]: 0 : nXplus1,pThisRowInfo->nRowNo,nTab,ATTR_MERGE_FLAG))
456 : 0 : ->IsHorOverlapped();
457 : : }
458 : : }
459 : :
460 [ + - ][ + + ]: 162 : if (pThisRowInfo->bChanged && !bHOver)
461 : : {
462 [ + - ]: 135 : aGrid.AddVerLine( nPosX-nSignedOneX, nPosY, nNextY-nOneY );
463 : : }
464 : 162 : nPosY = nNextY;
465 : 6 : }
466 : : }
467 : : else
468 : : {
469 [ + - ]: 11675 : aGrid.AddVerLine( nPosX-nSignedOneX, nScrY, nScrY+nScrH-nOneY );
470 : : }
471 : : }
472 : : }
473 : : }
474 : :
475 : : //
476 : : // Horizontale Linien
477 : : //
478 : :
479 : 1278 : bool bHiddenRow = true;
480 : 1278 : SCROW nHiddenEndRow = -1;
481 : 1278 : nPosY = nScrY;
482 [ + + ]: 16974 : for (nArrY=1; nArrY+1<nArrCount; nArrY++)
483 : : {
484 : 15696 : SCSIZE nArrYplus1 = nArrY+1;
485 : 15696 : nY = pRowInfo[nArrY].nRowNo;
486 : 15696 : SCROW nYplus1 = nY+1;
487 : 15696 : nPosY += pRowInfo[nArrY].nHeight;
488 : :
489 [ + - ]: 15696 : if (pRowInfo[nArrY].bChanged)
490 : : {
491 [ + - ]: 15696 : if ( bPage )
492 : : {
493 [ + - ]: 15722 : for (SCROW i = nYplus1; i <= MAXROW; ++i)
494 : : {
495 [ + + ]: 15722 : if (i > nHiddenEndRow)
496 [ + - ]: 1294 : bHiddenRow = mpDoc->RowHidden(i, nTab, NULL, &nHiddenEndRow);
497 : : /* TODO: optimize the row break thing for large hidden
498 : : * segments where HasRowBreak() has to be called
499 : : * nevertheless for each row, as a row break is drawn also
500 : : * for hidden rows, above them. This needed to be done only
501 : : * once per hidden segment, maybe giving manual breaks
502 : : * priority. Something like GetNextRowBreak() and
503 : : * GetNextManualRowBreak(). */
504 [ + - ]: 15722 : nBreak = mpDoc->HasRowBreak(i, nTab);
505 [ + + ][ - + ]: 15722 : if (!bHiddenRow || nBreak)
506 : 15696 : break;
507 : : }
508 : :
509 [ - + ]: 15696 : if (nBreakOld != nBreak)
510 : : {
511 [ # # ]: 0 : aGrid.Flush();
512 : : mpDev->SetLineColor( (nBreak & BREAK_MANUAL) ? aManualColor :
513 [ # # ][ # # ]: 0 : (nBreak) ? aPageColor : aGridColor );
[ # # ]
514 : 0 : nBreakOld = nBreak;
515 : : }
516 : : }
517 : :
518 [ + + ][ - + ]: 15696 : sal_Bool bDraw = bGrid || nBreakOld; // einfaches Gitter nur wenn eingestellt
519 : :
520 : 15696 : sal_Bool bNextYisNextRow = (pRowInfo[nArrYplus1].nRowNo == nYplus1);
521 : 15696 : bSingle = !bNextYisNextRow; // Hidden
522 [ + + ][ + + ]: 166059 : for (SCCOL i=nX1; i<=nX2 && !bSingle; i++)
[ + + ]
523 : : {
524 [ + + ]: 150363 : if (pRowInfo[nArrYplus1].pCellInfo[i+1].bVOverlapped)
525 : 7 : bSingle = sal_True;
526 : : }
527 : :
528 [ + + ]: 15696 : if (bDraw)
529 : : {
530 [ + + ][ + - ]: 15613 : if ( bSingle && nY<MAXROW )
531 : : {
532 : 23 : SCROW nVisY = pRowInfo[nArrYplus1].nRowNo;
533 : :
534 : 23 : nPosX = nScrX;
535 [ - + ]: 23 : if ( bLayoutRTL )
536 : 0 : nPosX += nMirrorW - nOneX;
537 : :
538 : : long nNextX;
539 [ + + ]: 253 : for (SCCOL i=nX1; i<=nX2; i++)
540 : : {
541 : 230 : nNextX = nPosX + pRowInfo[0].pCellInfo[i+1].nWidth * nLayoutSign;
542 [ + - ]: 230 : if (nNextX != nPosX) // sichtbar
543 : : {
544 : : sal_Bool bVOver;
545 [ + + ]: 230 : if ( bNextYisNextRow )
546 : 70 : bVOver = pRowInfo[nArrYplus1].pCellInfo[i+1].bVOverlapped;
547 : : else
548 : : {
549 : : bVOver = ((ScMergeFlagAttr*)mpDoc->GetAttr(
550 [ + - ]: 160 : i,nYplus1,nTab,ATTR_MERGE_FLAG))
551 : 160 : ->IsVerOverlapped()
552 : : && ((ScMergeFlagAttr*)mpDoc->GetAttr(
553 [ # # ]: 0 : i,nVisY,nTab,ATTR_MERGE_FLAG))
554 [ # # ][ - + ]: 160 : ->IsVerOverlapped();
555 : : //! nVisY aus Array ??
556 : : }
557 [ + + ]: 230 : if (!bVOver)
558 : : {
559 [ + - ]: 202 : aGrid.AddHorLine( nPosX, nNextX-nSignedOneX, nPosY-nOneY );
560 : : }
561 : : }
562 : 230 : nPosX = nNextX;
563 : 23 : }
564 : : }
565 : : else
566 : : {
567 [ + - ]: 15613 : aGrid.AddHorLine( nScrX, nScrX+nScrW-nOneX, nPosY-nOneY );
568 : : }
569 : : }
570 : : }
571 [ + - ]: 1278 : }
572 : 1278 : }
573 : :
574 : : // ----------------------------------------------------------------------------
575 : :
576 : 0 : void ScOutputData::SetPagebreakMode( ScPageBreakData* pPageData )
577 : : {
578 : 0 : bPagebreakMode = sal_True;
579 [ # # ]: 0 : if (!pPageData)
580 : 0 : return; // noch nicht initialisiert -> alles "nicht gedruckt"
581 : :
582 : : // gedruckten Bereich markieren
583 : : // (in FillInfo ist schon alles auf sal_False initialisiert)
584 : :
585 : 0 : sal_uInt16 nRangeCount = sal::static_int_cast<sal_uInt16>(pPageData->GetCount());
586 [ # # ]: 0 : for (sal_uInt16 nPos=0; nPos<nRangeCount; nPos++)
587 : : {
588 [ # # ]: 0 : ScRange aRange = pPageData->GetData( nPos ).GetPrintRange();
589 : :
590 : 0 : SCCOL nStartX = Max( aRange.aStart.Col(), nX1 );
591 : 0 : SCCOL nEndX = Min( aRange.aEnd.Col(), nX2 );
592 : 0 : SCROW nStartY = Max( aRange.aStart.Row(), nY1 );
593 : 0 : SCROW nEndY = Min( aRange.aEnd.Row(), nY2 );
594 : :
595 [ # # ]: 0 : for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
596 : : {
597 : 0 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
598 [ # # ][ # # ]: 0 : if ( pThisRowInfo->bChanged && pThisRowInfo->nRowNo >= nStartY &&
[ # # ]
599 : : pThisRowInfo->nRowNo <= nEndY )
600 : : {
601 [ # # ]: 0 : for (SCCOL nX=nStartX; nX<=nEndX; nX++)
602 : 0 : pThisRowInfo->pCellInfo[nX+1].bPrinted = sal_True;
603 : : }
604 : : }
605 : : }
606 : : }
607 : :
608 : 1345 : void ScOutputData::FindRotated()
609 : : {
610 : : //! nRotMax speichern
611 : 1345 : SCCOL nRotMax = nX2;
612 [ + + ]: 19902 : for (SCSIZE nRotY=0; nRotY<nArrCount; nRotY++)
613 [ + + ][ - + ]: 18557 : if (pRowInfo[nRotY].nRotMaxCol != SC_ROTMAX_NONE && pRowInfo[nRotY].nRotMaxCol > nRotMax)
614 : 0 : nRotMax = pRowInfo[nRotY].nRotMaxCol;
615 : :
616 [ + + ]: 18557 : for (SCSIZE nArrY=1; nArrY<nArrCount; nArrY++)
617 : : {
618 : 17212 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
619 [ + + ][ - + ]: 17212 : if ( pThisRowInfo->nRotMaxCol != SC_ROTMAX_NONE &&
[ # # ][ # # ]
[ # # ]
620 : 0 : ( pThisRowInfo->bChanged || pRowInfo[nArrY-1].bChanged ||
621 : 0 : ( nArrY+1<nArrCount && pRowInfo[nArrY+1].bChanged ) ) )
622 : : {
623 : 413 : SCROW nY = pThisRowInfo->nRowNo;
624 : :
625 [ + + ]: 4543 : for (SCCOL nX=0; nX<=nRotMax; nX++)
626 : : {
627 : 4130 : CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
628 : 4130 : const ScPatternAttr* pPattern = pInfo->pPatternAttr;
629 : 4130 : const SfxItemSet* pCondSet = pInfo->pConditionSet;
630 : :
631 [ - + ][ # # ]: 4130 : if ( !pPattern && !mpDoc->ColHidden(nX, nTab) )
[ - + ]
632 : : {
633 : 0 : pPattern = mpDoc->GetPattern( nX, nY, nTab );
634 : 0 : pCondSet = mpDoc->GetCondResult( nX, nY, nTab );
635 : : }
636 : :
637 [ + - ]: 4130 : if ( pPattern ) // Spalte nicht ausgeblendet
638 : : {
639 : 4130 : sal_uInt8 nDir = pPattern->GetRotateDir( pCondSet );
640 [ + + ]: 4130 : if (nDir != SC_ROTDIR_NONE)
641 : : {
642 : 1643 : pInfo->nRotateDir = nDir;
643 : 1643 : bAnyRotated = sal_True;
644 : : }
645 : : }
646 : : }
647 : : }
648 : : }
649 : 1345 : }
650 : :
651 : : // ----------------------------------------------------------------------------
652 : :
653 : 0 : sal_uInt16 lcl_GetRotateDir( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab )
654 : : {
655 : 0 : const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab );
656 : 0 : const SfxItemSet* pCondSet = pDoc->GetCondResult( nCol, nRow, nTab );
657 : :
658 : 0 : sal_uInt16 nRet = SC_ROTDIR_NONE;
659 : :
660 : 0 : long nAttrRotate = pPattern->GetRotateVal( pCondSet );
661 [ # # ]: 0 : if ( nAttrRotate )
662 : : {
663 : : SvxRotateMode eRotMode = (SvxRotateMode)((const SvxRotateModeItem&)
664 : 0 : pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue();
665 : :
666 [ # # ]: 0 : if ( eRotMode == SVX_ROTATE_MODE_STANDARD )
667 : 0 : nRet = SC_ROTDIR_STANDARD;
668 [ # # ]: 0 : else if ( eRotMode == SVX_ROTATE_MODE_CENTER )
669 : 0 : nRet = SC_ROTDIR_CENTER;
670 [ # # ][ # # ]: 0 : else if ( eRotMode == SVX_ROTATE_MODE_TOP || eRotMode == SVX_ROTATE_MODE_BOTTOM )
671 : : {
672 : 0 : long nRot180 = nAttrRotate % 18000; // 1/100 Grad
673 [ # # ]: 0 : if ( nRot180 == 9000 )
674 : 0 : nRet = SC_ROTDIR_CENTER;
675 [ # # ][ # # ]: 0 : else if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nRot180 < 9000 ) ||
[ # # ][ # # ]
676 : : ( eRotMode == SVX_ROTATE_MODE_BOTTOM && nRot180 > 9000 ) )
677 : 0 : nRet = SC_ROTDIR_LEFT;
678 : : else
679 : 0 : nRet = SC_ROTDIR_RIGHT;
680 : : }
681 : : }
682 : :
683 : 0 : return nRet;
684 : : }
685 : :
686 : 0 : const SvxBrushItem* lcl_FindBackground( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab )
687 : : {
688 : 0 : const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab );
689 : 0 : const SfxItemSet* pCondSet = pDoc->GetCondResult( nCol, nRow, nTab );
690 : : const SvxBrushItem* pBackground = (const SvxBrushItem*)
691 : 0 : &pPattern->GetItem( ATTR_BACKGROUND, pCondSet );
692 : :
693 : 0 : sal_uInt16 nDir = lcl_GetRotateDir( pDoc, nCol, nRow, nTab );
694 : :
695 : : // CENTER wird wie RIGHT behandelt...
696 [ # # ][ # # ]: 0 : if ( nDir == SC_ROTDIR_RIGHT || nDir == SC_ROTDIR_CENTER )
697 : : {
698 : : // Text geht nach rechts -> Hintergrund von links nehmen
699 [ # # ]: 0 : while ( nCol > 0 && lcl_GetRotateDir( pDoc, nCol, nRow, nTab ) == nDir &&
[ # # # # ]
[ # # ]
700 : 0 : pBackground->GetColor().GetTransparency() != 255 )
701 : : {
702 : 0 : --nCol;
703 : 0 : pPattern = pDoc->GetPattern( nCol, nRow, nTab );
704 : 0 : pCondSet = pDoc->GetCondResult( nCol, nRow, nTab );
705 : 0 : pBackground = (const SvxBrushItem*)&pPattern->GetItem( ATTR_BACKGROUND, pCondSet );
706 : : }
707 : : }
708 [ # # ]: 0 : else if ( nDir == SC_ROTDIR_LEFT )
709 : : {
710 : : // Text geht nach links -> Hintergrund von rechts nehmen
711 [ # # ]: 0 : while ( nCol < MAXCOL && lcl_GetRotateDir( pDoc, nCol, nRow, nTab ) == nDir &&
[ # # # # ]
[ # # ]
712 : 0 : pBackground->GetColor().GetTransparency() != 255 )
713 : : {
714 : 0 : ++nCol;
715 : 0 : pPattern = pDoc->GetPattern( nCol, nRow, nTab );
716 : 0 : pCondSet = pDoc->GetCondResult( nCol, nRow, nTab );
717 : 0 : pBackground = (const SvxBrushItem*)&pPattern->GetItem( ATTR_BACKGROUND, pCondSet );
718 : : }
719 : : }
720 : :
721 : 0 : return pBackground;
722 : : }
723 : :
724 : : // ----------------------------------------------------------------------------
725 : :
726 : 14418 : sal_Bool lcl_EqualBack( const RowInfo& rFirst, const RowInfo& rOther,
727 : : SCCOL nX1, SCCOL nX2, sal_Bool bShowProt, sal_Bool bPagebreakMode )
728 : : {
729 [ + - ][ + + ]: 14418 : if ( rFirst.bChanged != rOther.bChanged ||
730 : : rFirst.bEmptyBack != rOther.bEmptyBack )
731 : 60 : return false;
732 : :
733 : : SCCOL nX;
734 [ - + ]: 14358 : if ( bShowProt )
735 : : {
736 [ # # ]: 0 : for ( nX=nX1; nX<=nX2; nX++ )
737 : : {
738 : 0 : const ScPatternAttr* pPat1 = rFirst.pCellInfo[nX+1].pPatternAttr;
739 : 0 : const ScPatternAttr* pPat2 = rOther.pCellInfo[nX+1].pPatternAttr;
740 [ # # ]: 0 : if ( !pPat1 || !pPat2 ||
[ # # # # ]
[ # # ]
741 : 0 : &pPat1->GetItem(ATTR_PROTECTION) != &pPat2->GetItem(ATTR_PROTECTION) )
742 : 0 : return false;
743 : : }
744 : : }
745 : : else
746 : : {
747 [ + + ]: 152565 : for ( nX=nX1; nX<=nX2; nX++ )
748 [ + + ]: 138217 : if ( rFirst.pCellInfo[nX+1].pBackground != rOther.pCellInfo[nX+1].pBackground )
749 : 10 : return false;
750 : : }
751 : :
752 [ + + ][ - + ]: 14348 : if ( rFirst.nRotMaxCol != SC_ROTMAX_NONE || rOther.nRotMaxCol != SC_ROTMAX_NONE )
753 [ + + ]: 2937 : for ( nX=nX1; nX<=nX2; nX++ )
754 [ - + ]: 2670 : if ( rFirst.pCellInfo[nX+1].nRotateDir != rOther.pCellInfo[nX+1].nRotateDir )
755 : 0 : return false;
756 : :
757 [ - + ]: 14348 : if ( bPagebreakMode )
758 [ # # ]: 0 : for ( nX=nX1; nX<=nX2; nX++ )
759 [ # # ]: 0 : if ( rFirst.pCellInfo[nX+1].bPrinted != rOther.pCellInfo[nX+1].bPrinted )
760 : 0 : return false;
761 : :
762 [ + + ]: 152551 : for ( nX=nX1; nX<=nX2; nX++ )
763 : : {
764 : 138203 : const Color* pCol1 = rFirst.pCellInfo[nX+1].pColorScale;
765 : 138203 : const Color* pCol2 = rOther.pCellInfo[nX+1].pColorScale;
766 [ - + ][ # # ]: 138203 : if( (pCol1 && !pCol2) || (!pCol1 && pCol2) )
[ + - ][ - + ]
767 : 0 : return false;
768 : :
769 [ - + ][ # # ]: 138203 : if (pCol1 && (*pCol1 != *pCol2))
[ - + ]
770 : 0 : return false;
771 : :
772 : 138203 : const ScDataBarInfo* pInfo1 = rFirst.pCellInfo[nX+1].pDataBar;
773 : 138203 : const ScDataBarInfo* pInfo2 = rOther.pCellInfo[nX+1].pDataBar;
774 : :
775 [ - + ][ # # ]: 138203 : if( (pInfo1 && !pInfo2) || (!pInfo1 && pInfo2) )
[ + - ][ - + ]
776 : 0 : return false;
777 : :
778 [ - + ][ # # ]: 138203 : if (pInfo1 && (*pInfo1 != *pInfo2))
[ - + ]
779 : 0 : return false;
780 : : }
781 : :
782 : 14418 : return sal_True;
783 : : }
784 : :
785 : 1278 : void ScOutputData::DrawDocumentBackground()
786 : : {
787 [ + - ]: 1278 : if ( !bSolidBackground )
788 : 1278 : return;
789 : :
790 [ + - ]: 1278 : Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
791 : 1278 : long nOneX = aOnePixel.Width();
792 : 1278 : long nOneY = aOnePixel.Height();
793 [ + - ]: 1278 : Rectangle aRect(nScrX - nOneX, nScrY - nOneY, nScrX + nScrW, nScrY + nScrH);
794 [ + - ][ + - ]: 1278 : Color aBgColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor );
[ + - ]
795 [ + - ]: 1278 : mpDev->SetFillColor(aBgColor);
796 [ + - ]: 1278 : mpDev->DrawRect(aRect);
797 : : }
798 : :
799 : : namespace {
800 : :
801 : 0 : void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, const Rectangle& rRect)
802 : : {
803 : 0 : long nPosZero = 0;
804 : 0 : Rectangle aPaintRect = rRect;
805 : 0 : aPaintRect.Top() += 2;
806 : 0 : aPaintRect.Bottom() -= 2;
807 : 0 : aPaintRect.Left() += 2;
808 : 0 : aPaintRect.Right() -= 2;
809 [ # # ]: 0 : if(pOldDataBarInfo->mnZero)
810 : : {
811 : : //need to calculate null point in cell
812 : 0 : long nLength = aPaintRect.Right() - aPaintRect.Left();
813 : 0 : nPosZero = static_cast<long>(aPaintRect.Left() + nLength*pOldDataBarInfo->mnZero/100.0);
814 : : }
815 : : else
816 : : {
817 : 0 : nPosZero = aPaintRect.Left();
818 : : }
819 : :
820 [ # # ]: 0 : if(pOldDataBarInfo->mnLength < 0)
821 : : {
822 : 0 : aPaintRect.Right() = nPosZero;
823 : 0 : long nLength = nPosZero - aPaintRect.Left();
824 : 0 : aPaintRect.Left() = nPosZero + static_cast<long>(nLength * pOldDataBarInfo->mnLength/100.0);
825 : : }
826 [ # # ]: 0 : else if(pOldDataBarInfo->mnLength > 0)
827 : : {
828 : 0 : aPaintRect.Left() = nPosZero;
829 : 0 : long nLength = aPaintRect.Right() - nPosZero;
830 : 0 : aPaintRect.Right() = nPosZero + static_cast<long>(nLength * pOldDataBarInfo->mnLength/100.0);
831 : : }
832 : : else
833 : 0 : return;
834 : :
835 [ # # ]: 0 : if(pOldDataBarInfo->mbGradient)
836 : : {
837 [ # # ]: 0 : pDev->SetLineColor(pOldDataBarInfo->maColor);
838 [ # # ]: 0 : Gradient aGradient(GradientStyle_LINEAR, pOldDataBarInfo->maColor, COL_TRANSPARENT);
839 : :
840 [ # # ]: 0 : if(pOldDataBarInfo->mnLength < 0)
841 [ # # ]: 0 : aGradient.SetAngle(2700);
842 : : else
843 [ # # ]: 0 : aGradient.SetAngle(900);
844 : :
845 [ # # ]: 0 : pDev->DrawGradient(aPaintRect, aGradient);
846 : :
847 [ # # ][ # # ]: 0 : pDev->SetLineColor();
848 : : }
849 : : else
850 : : {
851 [ # # ]: 0 : pDev->SetFillColor(pOldDataBarInfo->maColor);
852 [ # # ]: 0 : pDev->DrawRect(aPaintRect);
853 : : }
854 : :
855 : : //draw axis
856 [ # # ][ # # ]: 0 : if(pOldDataBarInfo->mnZero && pOldDataBarInfo->mnZero != 100)
857 : : {
858 : 0 : Point aPoint1(nPosZero, rRect.Top());
859 : 0 : Point aPoint2(nPosZero, rRect.Bottom());
860 [ # # ]: 0 : LineInfo aLineInfo(LINE_DASH, 1);
861 [ # # ]: 0 : aLineInfo.SetDashCount( 4 );
862 [ # # ]: 0 : aLineInfo.SetDistance( 3 );
863 [ # # ]: 0 : aLineInfo.SetDashLen( 3 );
864 [ # # ]: 0 : pDev->SetFillColor(pOldDataBarInfo->maAxisColor);
865 [ # # ]: 0 : pDev->SetLineColor(pOldDataBarInfo->maAxisColor);
866 [ # # ]: 0 : pDev->DrawLine(aPoint1, aPoint2, aLineInfo);
867 [ # # ]: 0 : pDev->SetLineColor();
868 [ # # ][ # # ]: 0 : pDev->SetFillColor();
869 : : }
870 : : }
871 : :
872 : 13731 : void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color*& pOldColor, const SvxBrushItem*& pOldBackground,
873 : : Rectangle& rRect, long nPosX, long nSignedOneX, OutputDevice* pDev, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo)
874 : : {
875 : :
876 : : // need to paint if old color scale has been used and now
877 : : // we have a different color or a style based background
878 : : // we can here fall back to pointer comparison
879 [ - + ][ # # ]: 13731 : if (pOldColor && (pBackground || pOldColor != pColor || pOldDataBarInfo || pDataBarInfo))
[ # # ][ # # ]
[ # # ]
880 : : {
881 : 0 : rRect.Right() = nPosX-nSignedOneX;
882 [ # # ]: 0 : if( !pOldColor->GetTransparency() )
883 : : {
884 : 0 : pDev->SetFillColor( *pOldColor );
885 : 0 : pDev->DrawRect( rRect );
886 : : }
887 [ # # ]: 0 : if( pOldDataBarInfo )
888 : 0 : drawDataBars( pOldDataBarInfo, pDev, rRect );
889 : 0 : rRect.Left() = nPosX - nSignedOneX;
890 : : }
891 : :
892 [ + + ][ + - ]: 13731 : if ( pOldBackground && (pColor ||pBackground != pOldBackground || pOldDataBarInfo || pDataBarInfo) )
[ + + ][ + - ]
[ - + ]
893 : : {
894 : 1533 : rRect.Right() = nPosX-nSignedOneX;
895 [ + - ]: 1533 : if (pOldBackground) // ==0 if hidden
896 : : {
897 : 1533 : Color aBackCol = pOldBackground->GetColor();
898 [ + + ]: 1533 : if ( !aBackCol.GetTransparency() ) //! partial transparency?
899 : : {
900 [ + - ]: 128 : pDev->SetFillColor( aBackCol );
901 [ + - ]: 1533 : pDev->DrawRect( rRect );
902 : : }
903 : : }
904 [ - + ]: 1533 : if( pOldDataBarInfo )
905 : 0 : drawDataBars( pOldDataBarInfo, pDev, rRect );
906 : 1533 : rRect.Left() = nPosX - nSignedOneX;
907 : : }
908 : :
909 [ + + ][ + - ]: 13731 : if (!pOldBackground && !pOldColor && pDataBarInfo)
[ - + ]
910 : : {
911 : 0 : rRect.Right() = nPosX -nSignedOneX;
912 : 0 : rRect.Left() = nPosX - nSignedOneX;
913 : : }
914 : :
915 [ - + ]: 13731 : if(pColor)
916 : : {
917 : : // only update pOldColor if the colors changed
918 [ # # ][ # # ]: 0 : if (!pOldColor || *pOldColor != *pColor)
[ # # ]
919 : 0 : pOldColor = pColor;
920 : :
921 : 0 : pOldBackground = NULL;
922 : : }
923 [ + + ]: 13731 : else if(pBackground)
924 : : {
925 : 12383 : pOldBackground = pBackground;
926 : 12383 : pOldColor = NULL;
927 : : }
928 : :
929 [ - + ]: 13731 : if(pDataBarInfo)
930 : 0 : pOldDataBarInfo = pDataBarInfo;
931 : : else
932 : 13731 : pOldDataBarInfo = NULL;
933 : 13731 : }
934 : :
935 : : }
936 : :
937 : 1345 : void ScOutputData::DrawBackground()
938 : : {
939 [ + - ]: 1345 : FindRotated(); //! von aussen ?
940 : :
941 [ + - ]: 1345 : Rectangle aRect;
942 [ + - ]: 1345 : Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
943 : 1345 : long nOneX = aOnePixel.Width();
944 : 1345 : long nOneY = aOnePixel.Height();
945 : :
946 [ + + ]: 1345 : if (bMetaFile)
947 : 4 : nOneX = nOneY = 0;
948 : :
949 [ + + ]: 1345 : long nLayoutSign = bLayoutRTL ? -1 : 1;
950 : 1345 : long nSignedOneX = nOneX * nLayoutSign;
951 : :
952 [ + - ]: 1345 : mpDev->SetLineColor();
953 : :
954 [ - + ][ # # ]: 1345 : sal_Bool bShowProt = mbSyntaxMode && mpDoc->IsTabProtected(nTab);
[ # # ]
955 [ + - ][ + - ]: 1345 : sal_Bool bDoAll = bShowProt || bPagebreakMode || bSolidBackground;
[ + + ]
956 : :
957 : : sal_Bool bCellContrast = mbUseStyleColor &&
958 [ + + ][ + - ]: 1345 : Application::GetSettings().GetStyleSettings().GetHighContrastMode();
[ - + ]
959 : :
960 : 1345 : long nPosY = nScrY;
961 [ + + ]: 2864 : for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
962 : : {
963 : 1519 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
964 : 1519 : long nRowHeight = pThisRowInfo->nHeight;
965 : :
966 [ + - ]: 1519 : if ( pThisRowInfo->bChanged )
967 : : {
968 [ + + ][ - + ]: 1519 : if ( ( ( pThisRowInfo->bEmptyBack ) || mbSyntaxMode ) && !bDoAll )
[ + + ]
969 : : {
970 : : // nichts
971 : : }
972 : : else
973 : : {
974 : : // scan for rows with the same background:
975 : 1348 : SCSIZE nSkip = 0;
976 [ + + ][ + + ]: 30114 : while ( nArrY+nSkip+2<nArrCount &&
[ + + ]
977 : 28836 : lcl_EqualBack( *pThisRowInfo, pRowInfo[nArrY+nSkip+1],
978 [ + - ]: 14418 : nX1, nX2, bShowProt, bPagebreakMode ) )
979 : : {
980 : 14348 : ++nSkip;
981 : 14348 : nRowHeight += pRowInfo[nArrY+nSkip].nHeight; // after incrementing
982 : : }
983 : :
984 : 1348 : long nPosX = nScrX;
985 [ + + ]: 1348 : if ( bLayoutRTL )
986 : 2 : nPosX += nMirrorW - nOneX;
987 [ + - ]: 1348 : aRect = Rectangle( nPosX, nPosY-nOneY, nPosX, nPosY+nRowHeight-nOneY );
988 : :
989 : 1348 : const SvxBrushItem* pOldBackground = NULL;
990 : : const SvxBrushItem* pBackground;
991 : 1348 : const Color* pOldColor = NULL;
992 : 1348 : const Color* pColor = NULL;
993 : 1348 : const ScDataBarInfo* pOldDataBarInfo = NULL;
994 [ + + ]: 13731 : for (SCCOL nX=nX1; nX<=nX2; nX++)
995 : : {
996 : 12383 : CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
997 : :
998 [ - + ]: 12383 : if (bCellContrast)
999 : : {
1000 : : // high contrast for cell borders and backgrounds -> empty background
1001 : 0 : pBackground = ScGlobal::GetEmptyBrushItem();
1002 : : }
1003 [ - + ]: 12383 : else if (bShowProt) // show cell protection in syntax mode
1004 : : {
1005 : 0 : const ScPatternAttr* pP = pInfo->pPatternAttr;
1006 [ # # ]: 0 : if (pP)
1007 : : {
1008 : : const ScProtectionAttr& rProt = (const ScProtectionAttr&)
1009 [ # # ]: 0 : pP->GetItem(ATTR_PROTECTION);
1010 [ # # ][ # # ]: 0 : if (rProt.GetProtection() || rProt.GetHideCell())
[ # # ]
1011 : 0 : pBackground = ScGlobal::GetProtectedBrushItem();
1012 : : else
1013 : 0 : pBackground = ScGlobal::GetEmptyBrushItem();
1014 : : }
1015 : : else
1016 : 0 : pBackground = NULL;
1017 : : }
1018 : : else
1019 : 12383 : pBackground = pInfo->pBackground;
1020 : :
1021 [ - + ][ # # ]: 12383 : if ( bPagebreakMode && !pInfo->bPrinted )
1022 : 0 : pBackground = ScGlobal::GetProtectedBrushItem();
1023 : :
1024 [ - + # # ]: 12383 : if ( pInfo->nRotateDir > SC_ROTDIR_STANDARD &&
[ # # ][ - + ]
1025 : 0 : pBackground->GetColor().GetTransparency() != 255 &&
1026 : : !bCellContrast )
1027 : : {
1028 : 0 : SCROW nY = pRowInfo[nArrY].nRowNo;
1029 [ # # ]: 0 : pBackground = lcl_FindBackground( mpDoc, nX, nY, nTab );
1030 : : }
1031 : :
1032 : 12383 : pColor = pInfo->pColorScale;
1033 : 12383 : const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar;
1034 [ + - ]: 12383 : drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo );
1035 : :
1036 : 12383 : nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
1037 : : }
1038 [ + - ]: 1348 : drawCells( NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, NULL, pOldDataBarInfo );
1039 : :
1040 : 1519 : nArrY += nSkip;
1041 : : }
1042 : : }
1043 : 1519 : nPosY += nRowHeight;
1044 : : }
1045 : 1345 : }
1046 : :
1047 : 1282 : void ScOutputData::DrawShadow()
1048 : : {
1049 : 1282 : DrawExtraShadow( false, false, false, false );
1050 : 1282 : }
1051 : :
1052 : 1345 : void ScOutputData::DrawExtraShadow(sal_Bool bLeft, sal_Bool bTop, sal_Bool bRight, sal_Bool bBottom)
1053 : : {
1054 [ + - ]: 1345 : mpDev->SetLineColor();
1055 : :
1056 [ + - ]: 1345 : const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1057 [ - + ][ + + ]: 1345 : sal_Bool bCellContrast = mbUseStyleColor && rStyleSettings.GetHighContrastMode();
1058 : 1345 : Color aAutoTextColor;
1059 [ - + ]: 1345 : if ( bCellContrast )
1060 [ # # ][ # # ]: 0 : aAutoTextColor.SetColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
[ # # ]
1061 : :
1062 : 1345 : long nInitPosX = nScrX;
1063 [ + + ]: 1345 : if ( bLayoutRTL )
1064 : : {
1065 [ + - ]: 2 : Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
1066 : 2 : long nOneX = aOnePixel.Width();
1067 : 2 : nInitPosX += nMirrorW - nOneX;
1068 : : }
1069 [ + + ]: 1345 : long nLayoutSign = bLayoutRTL ? -1 : 1;
1070 : :
1071 : 1345 : long nPosY = nScrY - pRowInfo[0].nHeight;
1072 [ + + ]: 19902 : for (SCSIZE nArrY=0; nArrY<nArrCount; nArrY++)
1073 : : {
1074 [ + + ][ + + ]: 18557 : sal_Bool bCornerY = ( nArrY == 0 ) || ( nArrY+1 == nArrCount );
1075 [ + + ][ + + ]: 18557 : sal_Bool bSkipY = ( nArrY==0 && !bTop ) || ( nArrY+1 == nArrCount && !bBottom );
[ + + ][ + + ]
1076 : :
1077 : 18557 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1078 : 18557 : long nRowHeight = pThisRowInfo->nHeight;
1079 : :
1080 [ + - ][ + + ]: 18557 : if ( pThisRowInfo->bChanged && !bSkipY )
1081 : : {
1082 : 15993 : long nPosX = nInitPosX - pRowInfo[0].pCellInfo[nX1].nWidth * nLayoutSign;
1083 [ + + ]: 199234 : for (SCCOL nArrX=nX1; nArrX<=nX2+2; nArrX++)
1084 : : {
1085 [ + + ][ + + ]: 183241 : sal_Bool bCornerX = ( nArrX==nX1 || nArrX==nX2+2 );
1086 [ + + ][ + + ]: 183241 : sal_Bool bSkipX = ( nArrX==nX1 && !bLeft ) || ( nArrX==nX2+2 && !bRight );
[ + + ][ + + ]
1087 : :
1088 [ + + ]: 549723 : for (sal_uInt16 nPass=0; nPass<2; nPass++) // horizontal / vertikal
1089 : : {
1090 : : const SvxShadowItem* pAttr = nPass ?
1091 : 183241 : pThisRowInfo->pCellInfo[nArrX].pVShadowOrigin :
1092 [ + + ]: 366482 : pThisRowInfo->pCellInfo[nArrX].pHShadowOrigin;
1093 [ - + ][ # # ]: 366482 : if ( pAttr && !bSkipX )
1094 : : {
1095 : : ScShadowPart ePart = nPass ?
1096 : 0 : pThisRowInfo->pCellInfo[nArrX].eVShadowPart :
1097 [ # # ]: 0 : pThisRowInfo->pCellInfo[nArrX].eHShadowPart;
1098 : :
1099 : 0 : sal_Bool bDo = sal_True;
1100 [ # # ][ # # ]: 0 : if ( (nPass==0 && bCornerX) || (nPass==1 && bCornerY) )
[ # # ][ # # ]
1101 [ # # ]: 0 : if ( ePart != SC_SHADOW_CORNER )
1102 : 0 : bDo = false;
1103 : :
1104 [ # # ]: 0 : if (bDo)
1105 : : {
1106 : 0 : long nThisWidth = pRowInfo[0].pCellInfo[nArrX].nWidth;
1107 : 0 : long nMaxWidth = nThisWidth;
1108 [ # # ]: 0 : if (!nMaxWidth)
1109 : : {
1110 : : //! direction must depend on shadow location
1111 : 0 : SCCOL nWx = nArrX; // nX+1
1112 [ # # ][ # # ]: 0 : while (nWx<nX2 && !pRowInfo[0].pCellInfo[nWx+1].nWidth)
[ # # ]
1113 : 0 : ++nWx;
1114 : 0 : nMaxWidth = pRowInfo[0].pCellInfo[nWx+1].nWidth;
1115 : : }
1116 : :
1117 : : // rectangle is in logical orientation
1118 : : Rectangle aRect( nPosX, nPosY,
1119 : : nPosX + ( nThisWidth - 1 ) * nLayoutSign,
1120 [ # # ]: 0 : nPosY + pRowInfo[nArrY].nHeight - 1 );
1121 : :
1122 : 0 : long nSize = pAttr->GetWidth();
1123 : 0 : long nSizeX = (long)(nSize*mnPPTX);
1124 [ # # ]: 0 : if (nSizeX >= nMaxWidth) nSizeX = nMaxWidth-1;
1125 : 0 : long nSizeY = (long)(nSize*mnPPTY);
1126 [ # # ]: 0 : if (nSizeY >= nRowHeight) nSizeY = nRowHeight-1;
1127 : :
1128 : 0 : nSizeX *= nLayoutSign; // used only to add to rectangle values
1129 : :
1130 : 0 : SvxShadowLocation eLoc = pAttr->GetLocation();
1131 [ # # ]: 0 : if ( bLayoutRTL )
1132 : : {
1133 : : // Shadow location is specified as "visual" (right is always right),
1134 : : // so the attribute's location value is mirrored here and in FillInfo.
1135 [ # # # # : 0 : switch (eLoc)
# ]
1136 : : {
1137 : 0 : case SVX_SHADOW_BOTTOMRIGHT: eLoc = SVX_SHADOW_BOTTOMLEFT; break;
1138 : 0 : case SVX_SHADOW_BOTTOMLEFT: eLoc = SVX_SHADOW_BOTTOMRIGHT; break;
1139 : 0 : case SVX_SHADOW_TOPRIGHT: eLoc = SVX_SHADOW_TOPLEFT; break;
1140 : 0 : case SVX_SHADOW_TOPLEFT: eLoc = SVX_SHADOW_TOPRIGHT; break;
1141 : : default:
1142 : : {
1143 : : // added to avoid warnings
1144 : : }
1145 : : }
1146 : : }
1147 : :
1148 [ # # ][ # # ]: 0 : if (ePart == SC_SHADOW_HORIZ || ePart == SC_SHADOW_HSTART ||
[ # # ]
1149 : : ePart == SC_SHADOW_CORNER)
1150 : : {
1151 [ # # ][ # # ]: 0 : if (eLoc == SVX_SHADOW_TOPLEFT || eLoc == SVX_SHADOW_TOPRIGHT)
1152 : 0 : aRect.Top() = aRect.Bottom() - nSizeY;
1153 : : else
1154 : 0 : aRect.Bottom() = aRect.Top() + nSizeY;
1155 : : }
1156 [ # # ][ # # ]: 0 : if (ePart == SC_SHADOW_VERT || ePart == SC_SHADOW_VSTART ||
[ # # ]
1157 : : ePart == SC_SHADOW_CORNER)
1158 : : {
1159 [ # # ][ # # ]: 0 : if (eLoc == SVX_SHADOW_TOPLEFT || eLoc == SVX_SHADOW_BOTTOMLEFT)
1160 : 0 : aRect.Left() = aRect.Right() - nSizeX;
1161 : : else
1162 : 0 : aRect.Right() = aRect.Left() + nSizeX;
1163 : : }
1164 [ # # ]: 0 : if (ePart == SC_SHADOW_HSTART)
1165 : : {
1166 [ # # ][ # # ]: 0 : if (eLoc == SVX_SHADOW_TOPLEFT || eLoc == SVX_SHADOW_BOTTOMLEFT)
1167 : 0 : aRect.Right() -= nSizeX;
1168 : : else
1169 : 0 : aRect.Left() += nSizeX;
1170 : : }
1171 [ # # ]: 0 : if (ePart == SC_SHADOW_VSTART)
1172 : : {
1173 [ # # ][ # # ]: 0 : if (eLoc == SVX_SHADOW_TOPLEFT || eLoc == SVX_SHADOW_TOPRIGHT)
1174 : 0 : aRect.Bottom() -= nSizeY;
1175 : : else
1176 : 0 : aRect.Top() += nSizeY;
1177 : : }
1178 : :
1179 : : //! merge rectangles?
1180 [ # # ][ # # ]: 0 : mpDev->SetFillColor( bCellContrast ? aAutoTextColor : pAttr->GetColor() );
1181 [ # # ]: 0 : mpDev->DrawRect( aRect );
1182 : : }
1183 : : }
1184 : : }
1185 : :
1186 : 183241 : nPosX += pRowInfo[0].pCellInfo[nArrX].nWidth * nLayoutSign;
1187 : : }
1188 : : }
1189 : 18557 : nPosY += nRowHeight;
1190 : : }
1191 : 1345 : }
1192 : :
1193 : : //
1194 : : // Loeschen
1195 : : //
1196 : :
1197 : 0 : void ScOutputData::DrawClear()
1198 : : {
1199 [ # # ]: 0 : Rectangle aRect;
1200 [ # # ]: 0 : Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
1201 : 0 : long nOneX = aOnePixel.Width();
1202 : 0 : long nOneY = aOnePixel.Height();
1203 : :
1204 : : // (called only for ScGridWindow)
1205 [ # # ][ # # ]: 0 : Color aBgColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor );
[ # # ]
1206 : :
1207 [ # # ]: 0 : if (bMetaFile)
1208 : 0 : nOneX = nOneY = 0;
1209 : :
1210 [ # # ]: 0 : mpDev->SetLineColor();
1211 : :
1212 [ # # ]: 0 : mpDev->SetFillColor( aBgColor );
1213 : :
1214 : 0 : long nPosY = nScrY;
1215 [ # # ]: 0 : for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
1216 : : {
1217 : 0 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1218 : 0 : long nRowHeight = pThisRowInfo->nHeight;
1219 : :
1220 [ # # ]: 0 : if ( pThisRowInfo->bChanged )
1221 : : {
1222 : : // scan for more rows which must be painted:
1223 : 0 : SCSIZE nSkip = 0;
1224 [ # # ][ # # ]: 0 : while ( nArrY+nSkip+2<nArrCount && pRowInfo[nArrY+nSkip+1].bChanged )
[ # # ]
1225 : : {
1226 : 0 : ++nSkip;
1227 : 0 : nRowHeight += pRowInfo[nArrY+nSkip].nHeight; // after incrementing
1228 : : }
1229 : :
1230 : : aRect = Rectangle( Point( nScrX, nPosY ),
1231 [ # # ]: 0 : Size( nScrW+1-nOneX, nRowHeight+1-nOneY) );
1232 [ # # ]: 0 : mpDev->DrawRect( aRect );
1233 : :
1234 : 0 : nArrY += nSkip;
1235 : : }
1236 : 0 : nPosY += nRowHeight;
1237 : : }
1238 : 0 : }
1239 : :
1240 : :
1241 : : //
1242 : : // Linien
1243 : : //
1244 : :
1245 : 15832 : long lclGetSnappedX( OutputDevice& rDev, long nPosX, bool bSnapPixel )
1246 : : {
1247 [ + + ][ + + ]: 15832 : return (bSnapPixel && nPosX) ? rDev.PixelToLogic( rDev.LogicToPixel( Size( nPosX, 0 ) ) ).Width() : nPosX;
[ + - ][ + - ]
[ + + ][ + + ]
[ + + ][ # #
# # # # ]
1248 : : }
1249 : :
1250 : 19902 : long lclGetSnappedY( OutputDevice& rDev, long nPosY, bool bSnapPixel )
1251 : : {
1252 [ + + ][ + + ]: 19902 : return (bSnapPixel && nPosY) ? rDev.PixelToLogic( rDev.LogicToPixel( Size( 0, nPosY ) ) ).Height() : nPosY;
[ + - ][ + - ]
[ + + ][ + + ]
[ + + ][ # #
# # # # ]
1253 : : }
1254 : :
1255 : 14487 : size_t lclGetArrayColFromCellInfoX( sal_uInt16 nCellInfoX, sal_uInt16 nCellInfoFirstX, sal_uInt16 nCellInfoLastX, bool bRTL )
1256 : : {
1257 [ + + ]: 14487 : return static_cast< size_t >( bRTL ? (nCellInfoLastX + 2 - nCellInfoX) : (nCellInfoX - nCellInfoFirstX) );
1258 : : }
1259 : :
1260 : 1345 : void ScOutputData::DrawFrame()
1261 : : {
1262 : 1345 : sal_uLong nOldDrawMode = mpDev->GetDrawMode();
1263 : :
1264 : 1345 : Color aSingleColor;
1265 : 1345 : sal_Bool bUseSingleColor = false;
1266 [ + - ]: 1345 : const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1267 [ - + ][ + + ]: 1345 : sal_Bool bCellContrast = mbUseStyleColor && rStyleSettings.GetHighContrastMode();
1268 : :
1269 : : // if a Calc OLE object is embedded in Draw/Impress, the VCL DrawMode is used
1270 : : // for display mode / B&W printing. The VCL DrawMode handling doesn't work for lines
1271 : : // that are drawn with DrawRect, so if the line/background bits are set, the DrawMode
1272 : : // must be reset and the border colors handled here.
1273 : :
1274 [ - + ][ # # ]: 1345 : if ( ( nOldDrawMode & DRAWMODE_WHITEFILL ) && ( nOldDrawMode & DRAWMODE_BLACKLINE ) )
1275 : : {
1276 [ # # ]: 0 : mpDev->SetDrawMode( nOldDrawMode & (~DRAWMODE_WHITEFILL) );
1277 : 0 : aSingleColor.SetColor( COL_BLACK );
1278 : 0 : bUseSingleColor = sal_True;
1279 : : }
1280 [ - + ][ # # ]: 1345 : else if ( ( nOldDrawMode & DRAWMODE_SETTINGSFILL ) && ( nOldDrawMode & DRAWMODE_SETTINGSLINE ) )
1281 : : {
1282 [ # # ]: 0 : mpDev->SetDrawMode( nOldDrawMode & (~DRAWMODE_SETTINGSFILL) );
1283 : 0 : aSingleColor = rStyleSettings.GetWindowTextColor(); // same as used in VCL for DRAWMODE_SETTINGSLINE
1284 : 0 : bUseSingleColor = sal_True;
1285 : : }
1286 [ - + ]: 1345 : else if ( bCellContrast )
1287 : : {
1288 [ # # ][ # # ]: 0 : aSingleColor.SetColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
[ # # ]
1289 : 0 : bUseSingleColor = sal_True;
1290 : : }
1291 : :
1292 [ - + ]: 1345 : const Color* pForceColor = bUseSingleColor ? &aSingleColor : 0;
1293 : :
1294 [ + + ]: 1345 : if (bAnyRotated)
1295 [ + - ]: 99 : DrawRotatedFrame( pForceColor ); // removes the lines that must not be painted here
1296 : :
1297 : 1345 : long nInitPosX = nScrX;
1298 [ + + ]: 1345 : if ( bLayoutRTL )
1299 : : {
1300 [ + - ]: 2 : Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
1301 : 2 : long nOneX = aOnePixel.Width();
1302 : 2 : nInitPosX += nMirrorW - nOneX;
1303 : : }
1304 [ + + ]: 1345 : long nLayoutSign = bLayoutRTL ? -1 : 1;
1305 : :
1306 : :
1307 : : // *** set column and row sizes of the frame border array ***
1308 : :
1309 : 1345 : svx::frame::Array& rArray = mrTabInfo.maArray;
1310 [ + - ]: 1345 : size_t nColCount = rArray.GetColCount();
1311 [ + - ]: 1345 : size_t nRowCount = rArray.GetRowCount();
1312 : :
1313 : : // row heights
1314 : :
1315 : : // row 0 is not visible (dummy for borders from top) - subtract its height from initial position
1316 : : // subtract 1 unit more, because position 0 is first *in* cell, grid line is one unit before
1317 : 1345 : long nOldPosY = nScrY - 1 - pRowInfo[ 0 ].nHeight;
1318 [ + - ]: 1345 : long nOldSnapY = lclGetSnappedY( *mpDev, nOldPosY, bSnapPixel );
1319 [ + - ]: 1345 : rArray.SetYOffset( nOldSnapY );
1320 [ + + ]: 19902 : for( size_t nRow = 0; nRow < nRowCount; ++nRow )
1321 : : {
1322 : 18557 : long nNewPosY = nOldPosY + pRowInfo[ nRow ].nHeight;
1323 [ + - ]: 18557 : long nNewSnapY = lclGetSnappedY( *mpDev, nNewPosY, bSnapPixel );
1324 [ + - ]: 18557 : rArray.SetRowHeight( nRow, nNewSnapY - nOldSnapY );
1325 : 18557 : nOldPosY = nNewPosY;
1326 : 18557 : nOldSnapY = nNewSnapY;
1327 : : }
1328 : :
1329 : : // column widths
1330 : :
1331 : : // column nX1 is not visible (dummy for borders from left) - subtract its width from initial position
1332 : : // subtract 1 unit more, because position 0 is first *in* cell, grid line is one unit above
1333 : 1345 : long nOldPosX = nInitPosX - nLayoutSign * (1 + pRowInfo[ 0 ].pCellInfo[ nX1 ].nWidth);
1334 [ + - ]: 1345 : long nOldSnapX = lclGetSnappedX( *mpDev, nOldPosX, bSnapPixel );
1335 : : // set X offset for left-to-right sheets; for right-to-left sheets this is done after for() loop
1336 [ + + ]: 1345 : if( !bLayoutRTL )
1337 [ + - ]: 1343 : rArray.SetXOffset( nOldSnapX );
1338 [ + + ]: 15832 : for( sal_uInt16 nInfoIdx = nX1; nInfoIdx <= nX2 + 2; ++nInfoIdx )
1339 : : {
1340 : 14487 : size_t nCol = lclGetArrayColFromCellInfoX( nInfoIdx, nX1, nX2, bLayoutRTL );
1341 : 14487 : long nNewPosX = nOldPosX + pRowInfo[ 0 ].pCellInfo[ nInfoIdx ].nWidth * nLayoutSign;
1342 [ + - ]: 14487 : long nNewSnapX = lclGetSnappedX( *mpDev, nNewPosX, bSnapPixel );
1343 [ + - ]: 14487 : rArray.SetColWidth( nCol, Abs( nNewSnapX - nOldSnapX ) );
1344 : 14487 : nOldPosX = nNewPosX;
1345 : 14487 : nOldSnapX = nNewSnapX;
1346 : : }
1347 [ + + ]: 1345 : if( bLayoutRTL )
1348 [ + - ]: 2 : rArray.SetXOffset( nOldSnapX );
1349 : :
1350 : : // *** draw the array ***
1351 : :
1352 : 1345 : size_t nFirstCol = 1;
1353 : 1345 : size_t nFirstRow = 1;
1354 : 1345 : size_t nLastCol = nColCount - 2;
1355 : 1345 : size_t nLastRow = nRowCount - 2;
1356 : :
1357 [ + + ]: 1345 : if( mrTabInfo.mbPageMode )
1358 [ + - ]: 63 : rArray.SetClipRange( nFirstCol, nFirstRow, nLastCol, nLastRow );
1359 : :
1360 : : // draw only rows with set RowInfo::bChanged flag
1361 : 1345 : size_t nRow1 = nFirstRow;
1362 [ + - ]: 1345 : drawinglayer::processor2d::BaseProcessor2D* pProcessor = CreateProcessor2D();
1363 [ + - ]: 1345 : if (!pProcessor)
1364 : 1345 : return;
1365 : :
1366 [ + + ]: 2690 : while( nRow1 <= nLastRow )
1367 : : {
1368 [ + - ][ - + ]: 1345 : while( (nRow1 <= nLastRow) && !pRowInfo[ nRow1 ].bChanged ) ++nRow1;
[ - + ]
1369 [ + - ]: 1345 : if( nRow1 <= nLastRow )
1370 : : {
1371 : 1345 : size_t nRow2 = nRow1;
1372 [ + + ][ + - ]: 15867 : while( (nRow2 + 1 <= nLastRow) && pRowInfo[ nRow2 + 1 ].bChanged ) ++nRow2;
[ + + ]
1373 [ + - ]: 1345 : rArray.DrawRange( pProcessor, nFirstCol, nRow1, nLastCol, nRow2, pForceColor );
1374 : 1345 : nRow1 = nRow2 + 1;
1375 : : }
1376 : : }
1377 [ + - ]: 1345 : if ( pProcessor )
1378 [ + - ][ + - ]: 1345 : delete pProcessor;
1379 : :
1380 [ + - ]: 1345 : mpDev->SetDrawMode(nOldDrawMode);
1381 : : }
1382 : :
1383 : : // -------------------------------------------------------------------------
1384 : :
1385 : : // Linie unter der Zelle
1386 : :
1387 : 0 : const ::editeng::SvxBorderLine* lcl_FindHorLine( ScDocument* pDoc,
1388 : : SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nRotDir,
1389 : : sal_Bool bTopLine )
1390 : : {
1391 [ # # ][ # # ]: 0 : if ( nRotDir != SC_ROTDIR_LEFT && nRotDir != SC_ROTDIR_RIGHT )
1392 : 0 : return NULL;
1393 : :
1394 : 0 : sal_Bool bFound = false;
1395 [ # # ]: 0 : while (!bFound)
1396 : : {
1397 [ # # ]: 0 : if ( nRotDir == SC_ROTDIR_LEFT )
1398 : : {
1399 : : // Text nach links -> Linie von rechts
1400 [ # # ]: 0 : if ( nCol < MAXCOL )
1401 : 0 : ++nCol;
1402 : : else
1403 : 0 : return NULL; // war nix
1404 : : }
1405 : : else
1406 : : {
1407 : : // Text nach rechts -> Linie von links
1408 [ # # ]: 0 : if ( nCol > 0 )
1409 : 0 : --nCol;
1410 : : else
1411 : 0 : return NULL; // war nix
1412 : : }
1413 : 0 : const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab );
1414 : 0 : const SfxItemSet* pCondSet = pDoc->GetCondResult( nCol, nRow, nTab );
1415 [ # # ]: 0 : if ( !pPattern->GetRotateVal( pCondSet ) ||
[ # # # # ]
1416 : : ((const SvxRotateModeItem&)pPattern->GetItem(
1417 : 0 : ATTR_ROTATE_MODE, pCondSet)).GetValue() == SVX_ROTATE_MODE_STANDARD )
1418 : 0 : bFound = sal_True;
1419 : : }
1420 : :
1421 [ # # ]: 0 : if (bTopLine)
1422 : 0 : --nRow;
1423 : : const ::editeng::SvxBorderLine* pThisBottom;
1424 [ # # ]: 0 : if ( ValidRow(nRow) )
1425 : 0 : pThisBottom = ((const SvxBoxItem*)pDoc->GetAttr( nCol, nRow, nTab, ATTR_BORDER ))->GetBottom();
1426 : : else
1427 : 0 : pThisBottom = NULL;
1428 : : const ::editeng::SvxBorderLine* pNextTop;
1429 [ # # ]: 0 : if ( nRow < MAXROW )
1430 : 0 : pNextTop = ((const SvxBoxItem*)pDoc->GetAttr( nCol, nRow+1, nTab, ATTR_BORDER ))->GetTop();
1431 : : else
1432 : 0 : pNextTop = NULL;
1433 : :
1434 [ # # ]: 0 : if ( ScHasPriority( pThisBottom, pNextTop ) )
1435 : 0 : return pThisBottom;
1436 : : else
1437 : 0 : return pNextTop;
1438 : : }
1439 : :
1440 : :
1441 : 0 : long lcl_getRotate( ScDocument* pDoc, SCTAB nTab, SCCOL nX, SCROW nY )
1442 : : {
1443 : 0 : long nRotate = 0;
1444 : :
1445 : 0 : const ScPatternAttr* pPattern = pDoc->GetPattern( nX, nY, nTab );
1446 : 0 : const SfxItemSet* pCondSet = pDoc->GetCondResult( nX, nY, nTab );
1447 : :
1448 : 0 : nRotate = pPattern->GetRotateVal( pCondSet );
1449 : :
1450 : 0 : return nRotate;
1451 : : }
1452 : :
1453 : 99 : void ScOutputData::DrawRotatedFrame( const Color* pForceColor )
1454 : : {
1455 : : //! nRotMax speichern
1456 : 99 : SCCOL nRotMax = nX2;
1457 [ + + ]: 736 : for (SCSIZE nRotY=0; nRotY<nArrCount; nRotY++)
1458 [ + + ][ - + ]: 637 : if (pRowInfo[nRotY].nRotMaxCol != SC_ROTMAX_NONE && pRowInfo[nRotY].nRotMaxCol > nRotMax)
1459 : 0 : nRotMax = pRowInfo[nRotY].nRotMaxCol;
1460 : :
1461 : : const ScPatternAttr* pPattern;
1462 : : const SfxItemSet* pCondSet;
1463 : :
1464 [ + - ]: 99 : const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1465 [ - + ][ + - ]: 99 : sal_Bool bCellContrast = mbUseStyleColor && rStyleSettings.GetHighContrastMode();
1466 : :
1467 : : // color (pForceColor) is determined externally, including DrawMode changes
1468 : :
1469 : 99 : long nInitPosX = nScrX;
1470 [ - + ]: 99 : if ( bLayoutRTL )
1471 : : {
1472 [ # # ]: 0 : Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
1473 : 0 : long nOneX = aOnePixel.Width();
1474 : 0 : nInitPosX += nMirrorW - nOneX;
1475 : : }
1476 [ - + ]: 99 : long nLayoutSign = bLayoutRTL ? -1 : 1;
1477 : :
1478 [ + - ]: 99 : Rectangle aClipRect( Point(nScrX, nScrY), Size(nScrW, nScrH) );
1479 [ - + ]: 99 : if (bMetaFile)
1480 : : {
1481 [ # # ]: 0 : mpDev->Push();
1482 [ # # ]: 0 : mpDev->IntersectClipRegion( aClipRect );
1483 : : }
1484 : : else
1485 [ + - ][ + - ]: 99 : mpDev->SetClipRegion( Region( aClipRect ) );
[ + - ]
1486 : :
1487 : 99 : svx::frame::Array& rArray = mrTabInfo.maArray;
1488 [ + - ]: 99 : drawinglayer::processor2d::BaseProcessor2D* pProcessor = CreateProcessor2D( );
1489 : :
1490 : 99 : long nPosY = nScrY;
1491 [ + + ]: 637 : for (SCSIZE nArrY=1; nArrY<nArrCount; nArrY++)
1492 : : {
1493 : : // Rotated wird auch 1 Zeile ueber/unter Changed gezeichnet, falls Teile
1494 : : // in die Zeile hineinragen...
1495 : :
1496 : 538 : RowInfo& rPrevRowInfo = pRowInfo[nArrY-1];
1497 : 538 : RowInfo& rThisRowInfo = pRowInfo[nArrY];
1498 : 538 : RowInfo& rNextRowInfo = pRowInfo[nArrY+1];
1499 : :
1500 : 538 : size_t nRow = static_cast< size_t >( nArrY );
1501 : :
1502 : 538 : long nRowHeight = rThisRowInfo.nHeight;
1503 [ + + ][ - + ]: 538 : if ( rThisRowInfo.nRotMaxCol != SC_ROTMAX_NONE &&
[ # # ][ # # ]
[ # # ]
1504 : : ( rThisRowInfo.bChanged || rPrevRowInfo.bChanged ||
1505 : : ( nArrY+1<nArrCount && rNextRowInfo.bChanged ) ) )
1506 : : {
1507 : 413 : SCROW nY = rThisRowInfo.nRowNo;
1508 : 413 : long nPosX = 0;
1509 : : SCCOL nX;
1510 [ + + ]: 4543 : for (nX=0; nX<=nRotMax; nX++)
1511 : : {
1512 [ + + ]: 4130 : if (nX==nX1) nPosX = nInitPosX; // calculated individually for preceding positions
1513 : :
1514 : 4130 : sal_uInt16 nArrX = nX + 1;
1515 : :
1516 : 4130 : CellInfo* pInfo = &rThisRowInfo.pCellInfo[nArrX];
1517 : 4130 : long nColWidth = pRowInfo[0].pCellInfo[nArrX].nWidth;
1518 [ - + ][ # # ]: 4130 : if ( pInfo->nRotateDir > SC_ROTDIR_STANDARD &&
[ # # ]
1519 : 0 : !pInfo->bHOverlapped && !pInfo->bVOverlapped )
1520 : : {
1521 : 0 : pPattern = pInfo->pPatternAttr;
1522 : 0 : pCondSet = pInfo->pConditionSet;
1523 [ # # ]: 0 : if (!pPattern)
1524 : : {
1525 [ # # ]: 0 : pPattern = mpDoc->GetPattern( nX, nY, nTab );
1526 : 0 : pInfo->pPatternAttr = pPattern;
1527 [ # # ]: 0 : pCondSet = mpDoc->GetCondResult( nX, nY, nTab );
1528 : 0 : pInfo->pConditionSet = pCondSet;
1529 : : }
1530 : :
1531 : : //! LastPattern etc.
1532 : :
1533 [ # # ]: 0 : long nAttrRotate = pPattern->GetRotateVal( pCondSet );
1534 : : SvxRotateMode eRotMode = (SvxRotateMode)((const SvxRotateModeItem&)
1535 [ # # ]: 0 : pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue();
1536 : :
1537 [ # # ]: 0 : if ( nAttrRotate )
1538 : : {
1539 [ # # ]: 0 : if (nX<nX1) // negative Position berechnen
1540 : : {
1541 : 0 : nPosX = nInitPosX;
1542 : 0 : SCCOL nCol = nX1;
1543 [ # # ]: 0 : while (nCol > nX)
1544 : : {
1545 : 0 : --nCol;
1546 : 0 : nPosX -= nLayoutSign * (long) pRowInfo[0].pCellInfo[nCol+1].nWidth;
1547 : : }
1548 : : }
1549 : :
1550 : : // Startposition minus 1, damit auch schraege Hintergruende
1551 : : // zur Umrandung passen (Umrandung ist auf dem Gitter)
1552 : :
1553 : 0 : long nTop = nPosY - 1;
1554 : 0 : long nBottom = nPosY + nRowHeight - 1;
1555 : 0 : long nTopLeft = nPosX - nLayoutSign;
1556 : 0 : long nTopRight = nPosX + ( nColWidth - 1 ) * nLayoutSign;
1557 : 0 : long nBotLeft = nTopLeft;
1558 : 0 : long nBotRight = nTopRight;
1559 : :
1560 : : // inclusion of the sign here hasn't been decided yet
1561 : : // (if not, the extension of the non-rotated background must also be changed)
1562 : 0 : double nRealOrient = nLayoutSign * nAttrRotate * F_PI18000; // 1/100th degrees
1563 : 0 : double nCos = cos( nRealOrient );
1564 : 0 : double nSin = sin( nRealOrient );
1565 : : //! begrenzen !!!
1566 : 0 : long nSkew = (long) ( nRowHeight * nCos / nSin );
1567 : :
1568 [ # # # # ]: 0 : switch (eRotMode)
1569 : : {
1570 : : case SVX_ROTATE_MODE_BOTTOM:
1571 : 0 : nTopLeft += nSkew;
1572 : 0 : nTopRight += nSkew;
1573 : 0 : break;
1574 : : case SVX_ROTATE_MODE_CENTER:
1575 : 0 : nSkew /= 2;
1576 : 0 : nTopLeft += nSkew;
1577 : 0 : nTopRight += nSkew;
1578 : 0 : nBotLeft -= nSkew;
1579 : 0 : nBotRight -= nSkew;
1580 : 0 : break;
1581 : : case SVX_ROTATE_MODE_TOP:
1582 : 0 : nBotLeft -= nSkew;
1583 : 0 : nBotRight -= nSkew;
1584 : 0 : break;
1585 : : default:
1586 : : {
1587 : : // added to avoid warnings
1588 : : }
1589 : : }
1590 : :
1591 [ # # ]: 0 : Point aPoints[4];
1592 : 0 : aPoints[0] = Point( nTopLeft, nTop );
1593 : 0 : aPoints[1] = Point( nTopRight, nTop );
1594 : 0 : aPoints[2] = Point( nBotRight, nBottom );
1595 : 0 : aPoints[3] = Point( nBotLeft, nBottom );
1596 : :
1597 : 0 : const SvxBrushItem* pBackground = pInfo->pBackground;
1598 [ # # ]: 0 : if (!pBackground)
1599 : : pBackground = (const SvxBrushItem*) &pPattern->GetItem(
1600 [ # # ]: 0 : ATTR_BACKGROUND, pCondSet );
1601 [ # # ]: 0 : if (bCellContrast)
1602 : : {
1603 : : // high contrast for cell borders and backgrounds -> empty background
1604 : 0 : pBackground = ScGlobal::GetEmptyBrushItem();
1605 : : }
1606 [ # # ]: 0 : if(!pInfo->pColorScale)
1607 : : {
1608 : 0 : const Color& rColor = pBackground->GetColor();
1609 [ # # ]: 0 : if ( rColor.GetTransparency() != 255 )
1610 : : {
1611 : : // draw background only for the changed row itself
1612 : : // (background doesn't extend into other cells).
1613 : : // For the borders (rotated and normal), clipping should be
1614 : : // set if the row isn't changed, but at least the borders
1615 : : // don't cover the cell contents.
1616 [ # # ]: 0 : if ( rThisRowInfo.bChanged )
1617 : : {
1618 [ # # ]: 0 : Polygon aPoly( 4, aPoints );
1619 : :
1620 : : // ohne Pen wird bei DrawPolygon rechts und unten
1621 : : // ein Pixel weggelassen...
1622 [ # # ]: 0 : if ( rColor.GetTransparency() == 0 )
1623 [ # # ]: 0 : mpDev->SetLineColor(rColor);
1624 : : else
1625 [ # # ]: 0 : mpDev->SetLineColor();
1626 [ # # ]: 0 : mpDev->SetFillColor(rColor);
1627 [ # # ][ # # ]: 0 : mpDev->DrawPolygon( aPoly );
1628 : : }
1629 : : }
1630 : : }
1631 : : else
1632 : : {
1633 [ # # ]: 0 : Polygon aPoly( 4, aPoints );
1634 : 0 : const Color* pColor = pInfo->pColorScale;
1635 : :
1636 : : // ohne Pen wird bei DrawPolygon rechts und unten
1637 : : // ein Pixel weggelassen...
1638 [ # # ]: 0 : if ( pColor->GetTransparency() == 0 )
1639 [ # # ]: 0 : mpDev->SetLineColor(*pColor);
1640 : : else
1641 [ # # ]: 0 : mpDev->SetLineColor();
1642 [ # # ]: 0 : mpDev->SetFillColor(*pColor);
1643 [ # # ][ # # ]: 0 : mpDev->DrawPolygon( aPoly );
1644 : :
1645 : : }
1646 : :
1647 [ # # ][ # # ]: 0 : svx::frame::Style aTopLine, aBottomLine, aLeftLine, aRightLine;
[ # # ][ # # ]
1648 : :
1649 [ # # ][ # # ]: 0 : if ( nX < nX1 || nX > nX2 ) // Attribute in FillInfo nicht gesetzt
1650 : : {
1651 : : //! Seitengrenzen fuer Druck beruecksichtigen !!!!!
1652 : : const ::editeng::SvxBorderLine* pLeftLine;
1653 : : const ::editeng::SvxBorderLine* pTopLine;
1654 : : const ::editeng::SvxBorderLine* pRightLine;
1655 : : const ::editeng::SvxBorderLine* pBottomLine;
1656 : : mpDoc->GetBorderLines( nX, nY, nTab,
1657 [ # # ]: 0 : &pLeftLine, &pTopLine, &pRightLine, &pBottomLine );
1658 [ # # ]: 0 : aTopLine.Set( pTopLine, mnPPTY );
1659 [ # # ]: 0 : aBottomLine.Set( pBottomLine, mnPPTY );
1660 [ # # ]: 0 : aLeftLine.Set( pLeftLine, mnPPTX );
1661 [ # # ]: 0 : aRightLine.Set( pRightLine, mnPPTX );
1662 : : }
1663 : : else
1664 : : {
1665 : 0 : size_t nCol = lclGetArrayColFromCellInfoX( nArrX, nX1, nX2, bLayoutRTL );
1666 [ # # ]: 0 : aTopLine = rArray.GetCellStyleTop( nCol, nRow );
1667 [ # # ]: 0 : aBottomLine = rArray.GetCellStyleBottom( nCol, nRow );
1668 [ # # ]: 0 : aLeftLine = rArray.GetCellStyleLeft( nCol, nRow );
1669 [ # # ]: 0 : aRightLine = rArray.GetCellStyleRight( nCol, nRow );
1670 : : // in RTL mode the array is already mirrored -> swap back left/right borders
1671 [ # # ]: 0 : if( bLayoutRTL )
1672 : 0 : std::swap( aLeftLine, aRightLine );
1673 : : }
1674 : :
1675 [ # # ]: 0 : const svx::frame::Style noStyle;
1676 : : // Horizontal lines
1677 [ # # ]: 0 : long nUpperRotate = lcl_getRotate( mpDoc, nTab, nX, nY - 1 );
1678 : : pProcessor->process( svx::frame::CreateBorderPrimitives(
1679 [ # # ][ # # ]: 0 : aPoints[bLayoutRTL?1:0], aPoints[bLayoutRTL?0:1], aTopLine,
1680 : : svx::frame::Style(),
1681 : : svx::frame::Style(),
1682 : : aLeftLine,
1683 : : svx::frame::Style(),
1684 : : svx::frame::Style(),
1685 : : aRightLine,
1686 [ # # ][ # # ]: 0 : pForceColor, nUpperRotate, nAttrRotate ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1687 : :
1688 [ # # ]: 0 : long nLowerRotate = lcl_getRotate( mpDoc, nTab, nX, nY + 1 );
1689 : : pProcessor->process( svx::frame::CreateBorderPrimitives(
1690 [ # # ][ # # ]: 0 : aPoints[bLayoutRTL?2:3], aPoints[bLayoutRTL?3:2], aBottomLine,
1691 : : aLeftLine,
1692 : : svx::frame::Style(),
1693 : : svx::frame::Style(),
1694 : : aRightLine,
1695 : : svx::frame::Style(),
1696 : : svx::frame::Style(),
1697 [ # # ][ # # ]: 0 : pForceColor, 18000 - nAttrRotate, 18000 - nLowerRotate ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1698 : :
1699 : : // Vertical slanted lines
1700 [ # # ]: 0 : long nLeftRotate = lcl_getRotate( mpDoc, nTab, nX - 1, nY );
1701 : : pProcessor->process( svx::frame::CreateBorderPrimitives(
1702 : : aPoints[0], aPoints[3], aLeftLine,
1703 : : aTopLine,
1704 : : svx::frame::Style(),
1705 : : svx::frame::Style(),
1706 : : aBottomLine,
1707 : : svx::frame::Style(),
1708 : : svx::frame::Style(),
1709 [ # # ][ # # ]: 0 : pForceColor, nAttrRotate, nLeftRotate ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1710 : :
1711 [ # # ]: 0 : long nRightRotate = lcl_getRotate( mpDoc, nTab, nX + 1, nY );
1712 : : pProcessor->process( svx::frame::CreateBorderPrimitives(
1713 : : aPoints[1], aPoints[2], aRightLine,
1714 : : svx::frame::Style(),
1715 : : svx::frame::Style(),
1716 : : aTopLine,
1717 : : svx::frame::Style(),
1718 : : svx::frame::Style(),
1719 : : aBottomLine,
1720 [ # # ][ # # ]: 0 : pForceColor, 18000 - nRightRotate, 18000 - nAttrRotate ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1721 : : }
1722 : : }
1723 : 4130 : nPosX += nColWidth * nLayoutSign;
1724 : : }
1725 : :
1726 : : // erst hinterher im zweiten Schritt die Linien fuer normale Ausgabe loeschen
1727 : :
1728 [ + + ]: 413 : nX = nX1 > 0 ? (nX1-1) : static_cast<SCCOL>(0);
1729 [ + + ]: 4956 : for (; nX<=nX2+1; nX++) // sichtbarer Teil +- 1
1730 : : {
1731 : 4543 : sal_uInt16 nArrX = nX + 1;
1732 : 4543 : CellInfo& rInfo = rThisRowInfo.pCellInfo[nArrX];
1733 [ - + ][ # # ]: 4543 : if ( rInfo.nRotateDir > SC_ROTDIR_STANDARD &&
[ # # ]
1734 : 0 : !rInfo.bHOverlapped && !rInfo.bVOverlapped )
1735 : : {
1736 : 0 : pPattern = rInfo.pPatternAttr;
1737 : 0 : pCondSet = rInfo.pConditionSet;
1738 : :
1739 : 0 : size_t nCol = lclGetArrayColFromCellInfoX( nArrX, nX1, nX2, bLayoutRTL );
1740 : :
1741 : : // horizontal: angrenzende Linie verlaengern
1742 : : // (nur, wenn die gedrehte Zelle eine Umrandung hat)
1743 : 0 : sal_uInt16 nDir = rInfo.nRotateDir;
1744 [ # # ][ # # ]: 0 : if ( rArray.GetCellStyleTop( nCol, nRow ).Prim() )
1745 : : {
1746 [ # # ][ # # ]: 0 : svx::frame::Style aStyle( lcl_FindHorLine( mpDoc, nX, nY, nTab, nDir, sal_True ), mnPPTY );
1747 [ # # ]: 0 : rArray.SetCellStyleTop( nCol, nRow, aStyle );
1748 [ # # ]: 0 : if( nRow > 0 )
1749 [ # # ]: 0 : rArray.SetCellStyleBottom( nCol, nRow - 1, aStyle );
1750 : : }
1751 [ # # ][ # # ]: 0 : if ( rArray.GetCellStyleBottom( nCol, nRow ).Prim() )
1752 : : {
1753 [ # # ][ # # ]: 0 : svx::frame::Style aStyle( lcl_FindHorLine( mpDoc, nX, nY, nTab, nDir, false ), mnPPTY );
1754 [ # # ]: 0 : rArray.SetCellStyleBottom( nCol, nRow, aStyle );
1755 [ # # ][ # # ]: 0 : if( nRow + 1 < rArray.GetRowCount() )
1756 [ # # ]: 0 : rArray.SetCellStyleTop( nCol, nRow + 1, aStyle );
1757 : : }
1758 : :
1759 : : // always remove vertical borders
1760 [ # # ][ # # ]: 0 : if( !rArray.IsMergedOverlappedLeft( nCol, nRow ) )
1761 : : {
1762 [ # # ][ # # ]: 0 : rArray.SetCellStyleLeft( nCol, nRow, svx::frame::Style() );
1763 [ # # ]: 0 : if( nCol > 0 )
1764 [ # # ][ # # ]: 0 : rArray.SetCellStyleRight( nCol - 1, nRow, svx::frame::Style() );
1765 : : }
1766 [ # # ][ # # ]: 0 : if( !rArray.IsMergedOverlappedRight( nCol, nRow ) )
1767 : : {
1768 [ # # ][ # # ]: 0 : rArray.SetCellStyleRight( nCol, nRow, svx::frame::Style() );
1769 [ # # ][ # # ]: 0 : if( nCol + 1 < rArray.GetColCount() )
1770 [ # # ][ # # ]: 0 : rArray.SetCellStyleLeft( nCol + 1, nRow, svx::frame::Style() );
1771 : : }
1772 : :
1773 : : // remove diagonal borders
1774 [ # # ][ # # ]: 0 : rArray.SetCellStyleTLBR( nCol, nRow, svx::frame::Style() );
1775 [ # # ][ # # ]: 0 : rArray.SetCellStyleBLTR( nCol, nRow, svx::frame::Style() );
1776 : : }
1777 : : }
1778 : : }
1779 : 538 : nPosY += nRowHeight;
1780 : : }
1781 : :
1782 [ + - ][ + - ]: 99 : if ( pProcessor ) delete pProcessor;
[ + - ]
1783 : :
1784 [ - + ]: 99 : if (bMetaFile)
1785 [ # # ]: 0 : mpDev->Pop();
1786 : : else
1787 [ + - ]: 99 : mpDev->SetClipRegion();
1788 : 99 : }
1789 : :
1790 : 1444 : drawinglayer::processor2d::BaseProcessor2D* ScOutputData::CreateProcessor2D( )
1791 : : {
1792 [ + - ]: 1444 : mpDoc->InitDrawLayer(mpDoc->GetDocumentShell());
1793 [ + - ]: 1444 : ScDrawLayer* pDrawLayer = mpDoc->GetDrawLayer();
1794 [ - + ]: 1444 : if (!pDrawLayer)
1795 : 0 : return NULL;
1796 : :
1797 [ + - ]: 1444 : basegfx::B2DRange aViewRange;
1798 [ + - ]: 1444 : SdrPage *pDrawPage = pDrawLayer->GetPage( static_cast< sal_uInt16 >( nTab ) );
1799 : : const drawinglayer::geometry::ViewInformation2D aNewViewInfos(
1800 : : basegfx::B2DHomMatrix( ),
1801 : : mpDev->GetViewTransformation(),
1802 : : aViewRange,
1803 : : GetXDrawPageForSdrPage( pDrawPage ),
1804 : : 0.0,
1805 [ + - ][ + - ]: 1444 : uno::Sequence< beans::PropertyValue >() );
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
1806 : :
1807 : : return drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(
1808 [ + - ][ + - ]: 1444 : *mpDev, aNewViewInfos );
1809 : : }
1810 : :
1811 : : // Drucker
1812 : :
1813 : 3825 : PolyPolygon ScOutputData::GetChangedArea()
1814 : : {
1815 [ + - ]: 3825 : PolyPolygon aPoly;
1816 : :
1817 [ + - ]: 3825 : Rectangle aDrawingRect;
1818 : 3825 : aDrawingRect.Left() = nScrX;
1819 : 3825 : aDrawingRect.Right() = nScrX+nScrW-1;
1820 : :
1821 : 3825 : sal_Bool bHad = false;
1822 : 3825 : long nPosY = nScrY;
1823 : : SCSIZE nArrY;
1824 [ + + ]: 99064 : for (nArrY=1; nArrY+1<nArrCount; nArrY++)
1825 : : {
1826 : 95239 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1827 : :
1828 [ + + ]: 95239 : if ( pThisRowInfo->bChanged )
1829 : : {
1830 [ + + ]: 141 : if (!bHad)
1831 : : {
1832 : 111 : aDrawingRect.Top() = nPosY;
1833 : 111 : bHad = sal_True;
1834 : : }
1835 : 141 : aDrawingRect.Bottom() = nPosY + pRowInfo[nArrY].nHeight - 1;
1836 : : }
1837 [ + + ]: 95098 : else if (bHad)
1838 : : {
1839 [ + - ][ + - ]: 111 : aPoly.Insert( Polygon( mpDev->PixelToLogic(aDrawingRect) ) );
[ + - ][ + - ]
1840 : 111 : bHad = false;
1841 : : }
1842 : 95239 : nPosY += pRowInfo[nArrY].nHeight;
1843 : : }
1844 : :
1845 [ - + ]: 3825 : if (bHad)
1846 [ # # ][ # # ]: 3825 : aPoly.Insert( Polygon( mpDev->PixelToLogic(aDrawingRect) ) );
[ # # ][ # # ]
1847 : :
1848 : 3825 : return aPoly;
1849 : : }
1850 : :
1851 : 0 : sal_Bool ScOutputData::SetChangedClip()
1852 : : {
1853 [ # # ]: 0 : PolyPolygon aPoly;
1854 : :
1855 [ # # ]: 0 : Rectangle aDrawingRect;
1856 : 0 : aDrawingRect.Left() = nScrX;
1857 : 0 : aDrawingRect.Right() = nScrX+nScrW-1;
1858 : :
1859 : 0 : sal_Bool bHad = false;
1860 : 0 : long nPosY = nScrY;
1861 : : SCSIZE nArrY;
1862 [ # # ]: 0 : for (nArrY=1; nArrY+1<nArrCount; nArrY++)
1863 : : {
1864 : 0 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1865 : :
1866 [ # # ]: 0 : if ( pThisRowInfo->bChanged )
1867 : : {
1868 [ # # ]: 0 : if (!bHad)
1869 : : {
1870 : 0 : aDrawingRect.Top() = nPosY;
1871 : 0 : bHad = sal_True;
1872 : : }
1873 : 0 : aDrawingRect.Bottom() = nPosY + pRowInfo[nArrY].nHeight - 1;
1874 : : }
1875 [ # # ]: 0 : else if (bHad)
1876 : : {
1877 [ # # ][ # # ]: 0 : aPoly.Insert( Polygon( mpDev->PixelToLogic(aDrawingRect) ) );
[ # # ][ # # ]
1878 : 0 : bHad = false;
1879 : : }
1880 : 0 : nPosY += pRowInfo[nArrY].nHeight;
1881 : : }
1882 : :
1883 [ # # ]: 0 : if (bHad)
1884 [ # # ][ # # ]: 0 : aPoly.Insert( Polygon( mpDev->PixelToLogic(aDrawingRect) ) );
[ # # ][ # # ]
1885 : :
1886 [ # # ]: 0 : sal_Bool bRet = (aPoly.Count() != 0);
1887 [ # # ]: 0 : if (bRet)
1888 [ # # ][ # # ]: 0 : mpDev->SetClipRegion(Region(aPoly));
[ # # ]
1889 [ # # ]: 0 : return bRet;
1890 : : }
1891 : :
1892 : 3825 : void ScOutputData::FindChanged()
1893 : : {
1894 : : SCCOL nX;
1895 : : SCSIZE nArrY;
1896 : :
1897 : 3825 : bool bWasIdleDisabled = mpDoc->IsIdleDisabled();
1898 : 3825 : mpDoc->DisableIdle(true);
1899 [ + + ]: 106714 : for (nArrY=0; nArrY<nArrCount; nArrY++)
1900 : 102889 : pRowInfo[nArrY].bChanged = false;
1901 : :
1902 : 3825 : bool bProgress = false;
1903 [ + + ]: 106714 : for (nArrY=0; nArrY<nArrCount; nArrY++)
1904 : : {
1905 : 102889 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1906 [ + + ]: 1128277 : for (nX=nX1; nX<=nX2; nX++)
1907 : : {
1908 : 1025388 : ScBaseCell* pCell = pThisRowInfo->pCellInfo[nX+1].pCell;
1909 [ + + ]: 1025388 : if (!pCell)
1910 : 938261 : continue;
1911 : :
1912 [ + + ]: 87127 : if (pCell->GetCellType() != CELLTYPE_FORMULA)
1913 : 86357 : continue;
1914 : :
1915 [ + - ]: 770 : ScFormulaCell* pFCell = (ScFormulaCell*)pCell;
1916 [ + + ][ + + ]: 770 : if ( !bProgress && pFCell->GetDirty() )
[ + + ]
1917 : : {
1918 : 76 : ScProgress::CreateInterpretProgress(mpDoc, true);
1919 : 76 : bProgress = true;
1920 : : }
1921 [ - + ]: 770 : if (pFCell->IsRunning())
1922 : : // still being interpreted. Skip it.
1923 : 0 : continue;
1924 : :
1925 : 770 : (void)pFCell->GetValue();
1926 [ + + ]: 770 : if (!pFCell->IsChanged())
1927 : : // the result hasn't changed. Skip it.
1928 : 556 : continue;
1929 : :
1930 : 214 : pThisRowInfo->bChanged = true;
1931 [ - + ]: 214 : if ( pThisRowInfo->pCellInfo[nX+1].bMerged )
1932 : : {
1933 : 0 : SCSIZE nOverY = nArrY + 1;
1934 [ # # ][ # # ]: 0 : while ( nOverY<nArrCount &&
[ # # ]
1935 : 0 : pRowInfo[nOverY].pCellInfo[nX+1].bVOverlapped )
1936 : : {
1937 : 0 : pRowInfo[nOverY].bChanged = true;
1938 : 0 : ++nOverY;
1939 : : }
1940 : : }
1941 : : }
1942 : : }
1943 [ + + ]: 3825 : if ( bProgress )
1944 : 76 : ScProgress::DeleteInterpretProgress();
1945 : 3825 : mpDoc->DisableIdle( bWasIdleDisabled );
1946 : 3825 : }
1947 : :
1948 : 0 : void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
1949 : : SCCOL nRefEndX, SCROW nRefEndY,
1950 : : const Color& rColor, sal_Bool bHandle )
1951 : : {
1952 : 0 : PutInOrder( nRefStartX, nRefEndX );
1953 : 0 : PutInOrder( nRefStartY, nRefEndY );
1954 : :
1955 [ # # ][ # # ]: 0 : if ( nRefStartX == nRefEndX && nRefStartY == nRefEndY )
1956 : 0 : mpDoc->ExtendMerge( nRefStartX, nRefStartY, nRefEndX, nRefEndY, nTab );
1957 : :
1958 [ # # ][ # # ]: 0 : if ( nRefStartX <= nVisX2 && nRefEndX >= nVisX1 &&
[ # # ][ # # ]
1959 : : nRefStartY <= nVisY2 && nRefEndY >= nVisY1 )
1960 : : {
1961 : 0 : long nMinX = nScrX;
1962 : 0 : long nMinY = nScrY;
1963 : 0 : long nMaxX = nScrX+nScrW-1;
1964 : 0 : long nMaxY = nScrY+nScrH-1;
1965 [ # # ]: 0 : if ( bLayoutRTL )
1966 : : {
1967 : 0 : long nTemp = nMinX;
1968 : 0 : nMinX = nMaxX;
1969 : 0 : nMaxX = nTemp;
1970 : : }
1971 [ # # ]: 0 : long nLayoutSign = bLayoutRTL ? -1 : 1;
1972 : :
1973 : 0 : sal_Bool bTop = false;
1974 : 0 : sal_Bool bBottom = false;
1975 : 0 : sal_Bool bLeft = false;
1976 : 0 : sal_Bool bRight = false;
1977 : :
1978 : 0 : long nPosY = nScrY;
1979 : 0 : sal_Bool bNoStartY = ( nY1 < nRefStartY );
1980 : 0 : sal_Bool bNoEndY = false;
1981 [ # # ]: 0 : for (SCSIZE nArrY=1; nArrY<nArrCount; nArrY++) // loop to end for bNoEndY check
1982 : : {
1983 : 0 : SCROW nY = pRowInfo[nArrY].nRowNo;
1984 : :
1985 [ # # ][ # # ]: 0 : if ( nY==nRefStartY || (nY>nRefStartY && bNoStartY) )
[ # # ]
1986 : : {
1987 : 0 : nMinY = nPosY;
1988 : 0 : bTop = sal_True;
1989 : : }
1990 [ # # ]: 0 : if ( nY==nRefEndY )
1991 : : {
1992 : 0 : nMaxY = nPosY + pRowInfo[nArrY].nHeight - 2;
1993 : 0 : bBottom = sal_True;
1994 : : }
1995 [ # # ][ # # ]: 0 : if ( nY>nRefEndY && bNoEndY )
1996 : : {
1997 : 0 : nMaxY = nPosY-2;
1998 : 0 : bBottom = sal_True;
1999 : : }
2000 : 0 : bNoStartY = ( nY < nRefStartY );
2001 : 0 : bNoEndY = ( nY < nRefEndY );
2002 : 0 : nPosY += pRowInfo[nArrY].nHeight;
2003 : : }
2004 : :
2005 : 0 : long nPosX = nScrX;
2006 [ # # ]: 0 : if ( bLayoutRTL )
2007 : 0 : nPosX += nMirrorW - 1; // always in pixels
2008 : :
2009 [ # # ]: 0 : for (SCCOL nX=nX1; nX<=nX2; nX++)
2010 : : {
2011 [ # # ]: 0 : if ( nX==nRefStartX )
2012 : : {
2013 : 0 : nMinX = nPosX;
2014 : 0 : bLeft = sal_True;
2015 : : }
2016 [ # # ]: 0 : if ( nX==nRefEndX )
2017 : : {
2018 : 0 : nMaxX = nPosX + ( pRowInfo[0].pCellInfo[nX+1].nWidth - 2 ) * nLayoutSign;
2019 : 0 : bRight = sal_True;
2020 : : }
2021 : 0 : nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
2022 : : }
2023 : :
2024 [ # # ][ # # ]: 0 : if ( nMaxX * nLayoutSign >= nMinX * nLayoutSign &&
2025 : : nMaxY >= nMinY )
2026 : : {
2027 : 0 : mpDev->SetLineColor( rColor );
2028 [ # # ][ # # ]: 0 : if (bTop && bBottom && bLeft && bRight)
[ # # ][ # # ]
2029 : : {
2030 : 0 : mpDev->SetFillColor();
2031 [ # # ]: 0 : mpDev->DrawRect( Rectangle( nMinX, nMinY, nMaxX, nMaxY ) );
2032 : : }
2033 : : else
2034 : : {
2035 [ # # ]: 0 : if (bTop)
2036 [ # # ]: 0 : mpDev->DrawLine( Point( nMinX,nMinY ), Point( nMaxX,nMinY ) );
2037 [ # # ]: 0 : if (bBottom)
2038 [ # # ]: 0 : mpDev->DrawLine( Point( nMinX,nMaxY ), Point( nMaxX,nMaxY ) );
2039 [ # # ]: 0 : if (bLeft)
2040 [ # # ]: 0 : mpDev->DrawLine( Point( nMinX,nMinY ), Point( nMinX,nMaxY ) );
2041 [ # # ]: 0 : if (bRight)
2042 [ # # ]: 0 : mpDev->DrawLine( Point( nMaxX,nMinY ), Point( nMaxX,nMaxY ) );
2043 : : }
2044 [ # # ][ # # ]: 0 : if ( bHandle && bRight && bBottom )
[ # # ]
2045 : : {
2046 : 0 : mpDev->SetLineColor();
2047 : 0 : mpDev->SetFillColor( rColor );
2048 [ # # ]: 0 : mpDev->DrawRect( Rectangle( nMaxX-3*nLayoutSign, nMaxY-3, nMaxX+nLayoutSign, nMaxY+1 ) );
2049 : : }
2050 : : }
2051 : : }
2052 : 0 : }
2053 : :
2054 : 0 : void ScOutputData::DrawOneChange( SCCOL nRefStartX, SCROW nRefStartY,
2055 : : SCCOL nRefEndX, SCROW nRefEndY,
2056 : : const Color& rColor, sal_uInt16 nType )
2057 : : {
2058 : 0 : PutInOrder( nRefStartX, nRefEndX );
2059 : 0 : PutInOrder( nRefStartY, nRefEndY );
2060 : :
2061 [ # # ][ # # ]: 0 : if ( nRefStartX == nRefEndX && nRefStartY == nRefEndY )
2062 : 0 : mpDoc->ExtendMerge( nRefStartX, nRefStartY, nRefEndX, nRefEndY, nTab );
2063 : :
2064 [ # # ][ # # ]: 0 : if ( nRefStartX <= nVisX2 + 1 && nRefEndX >= nVisX1 &&
[ # # ][ # # ]
2065 : : nRefStartY <= nVisY2 + 1 && nRefEndY >= nVisY1 ) // +1 because it touches next cells left/top
2066 : : {
2067 : 0 : long nMinX = nScrX;
2068 : 0 : long nMinY = nScrY;
2069 : 0 : long nMaxX = nScrX+nScrW-1;
2070 : 0 : long nMaxY = nScrY+nScrH-1;
2071 [ # # ]: 0 : if ( bLayoutRTL )
2072 : : {
2073 : 0 : long nTemp = nMinX;
2074 : 0 : nMinX = nMaxX;
2075 : 0 : nMaxX = nTemp;
2076 : : }
2077 [ # # ]: 0 : long nLayoutSign = bLayoutRTL ? -1 : 1;
2078 : :
2079 : 0 : sal_Bool bTop = false;
2080 : 0 : sal_Bool bBottom = false;
2081 : 0 : sal_Bool bLeft = false;
2082 : 0 : sal_Bool bRight = false;
2083 : :
2084 : 0 : long nPosY = nScrY;
2085 : 0 : sal_Bool bNoStartY = ( nY1 < nRefStartY );
2086 : 0 : sal_Bool bNoEndY = false;
2087 [ # # ]: 0 : for (SCSIZE nArrY=1; nArrY<nArrCount; nArrY++) // loop to end for bNoEndY check
2088 : : {
2089 : 0 : SCROW nY = pRowInfo[nArrY].nRowNo;
2090 : :
2091 [ # # ][ # # ]: 0 : if ( nY==nRefStartY || (nY>nRefStartY && bNoStartY) )
[ # # ]
2092 : : {
2093 : 0 : nMinY = nPosY - 1;
2094 : 0 : bTop = sal_True;
2095 : : }
2096 [ # # ]: 0 : if ( nY==nRefEndY )
2097 : : {
2098 : 0 : nMaxY = nPosY + pRowInfo[nArrY].nHeight - 1;
2099 : 0 : bBottom = sal_True;
2100 : : }
2101 [ # # ][ # # ]: 0 : if ( nY>nRefEndY && bNoEndY )
2102 : : {
2103 : 0 : nMaxY = nPosY - 1;
2104 : 0 : bBottom = sal_True;
2105 : : }
2106 : 0 : bNoStartY = ( nY < nRefStartY );
2107 : 0 : bNoEndY = ( nY < nRefEndY );
2108 : 0 : nPosY += pRowInfo[nArrY].nHeight;
2109 : : }
2110 : :
2111 : 0 : long nPosX = nScrX;
2112 [ # # ]: 0 : if ( bLayoutRTL )
2113 : 0 : nPosX += nMirrorW - 1; // always in pixels
2114 : :
2115 [ # # ]: 0 : for (SCCOL nX=nX1; nX<=nX2+1; nX++)
2116 : : {
2117 [ # # ]: 0 : if ( nX==nRefStartX )
2118 : : {
2119 : 0 : nMinX = nPosX - nLayoutSign;
2120 : 0 : bLeft = sal_True;
2121 : : }
2122 [ # # ]: 0 : if ( nX==nRefEndX )
2123 : : {
2124 : 0 : nMaxX = nPosX + ( pRowInfo[0].pCellInfo[nX+1].nWidth - 1 ) * nLayoutSign;
2125 : 0 : bRight = sal_True;
2126 : : }
2127 : 0 : nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
2128 : : }
2129 : :
2130 [ # # ][ # # ]: 0 : if ( nMaxX * nLayoutSign >= nMinX * nLayoutSign &&
2131 : : nMaxY >= nMinY )
2132 : : {
2133 [ # # ]: 0 : if ( nType == SC_CAT_DELETE_ROWS )
2134 : 0 : bLeft = bRight = bBottom = false; //! dicke Linie ???
2135 [ # # ]: 0 : else if ( nType == SC_CAT_DELETE_COLS )
2136 : 0 : bTop = bBottom = bRight = false; //! dicke Linie ???
2137 : :
2138 : 0 : mpDev->SetLineColor( rColor );
2139 [ # # ][ # # ]: 0 : if (bTop && bBottom && bLeft && bRight)
[ # # ][ # # ]
2140 : : {
2141 : 0 : mpDev->SetFillColor();
2142 [ # # ]: 0 : mpDev->DrawRect( Rectangle( nMinX, nMinY, nMaxX, nMaxY ) );
2143 : : }
2144 : : else
2145 : : {
2146 [ # # ]: 0 : if (bTop)
2147 : : {
2148 [ # # ]: 0 : mpDev->DrawLine( Point( nMinX,nMinY ), Point( nMaxX,nMinY ) );
2149 [ # # ]: 0 : if ( nType == SC_CAT_DELETE_ROWS )
2150 [ # # ]: 0 : mpDev->DrawLine( Point( nMinX,nMinY+1 ), Point( nMaxX,nMinY+1 ) );
2151 : : }
2152 [ # # ]: 0 : if (bBottom)
2153 [ # # ]: 0 : mpDev->DrawLine( Point( nMinX,nMaxY ), Point( nMaxX,nMaxY ) );
2154 [ # # ]: 0 : if (bLeft)
2155 : : {
2156 [ # # ]: 0 : mpDev->DrawLine( Point( nMinX,nMinY ), Point( nMinX,nMaxY ) );
2157 [ # # ]: 0 : if ( nType == SC_CAT_DELETE_COLS )
2158 [ # # ]: 0 : mpDev->DrawLine( Point( nMinX+nLayoutSign,nMinY ), Point( nMinX+nLayoutSign,nMaxY ) );
2159 : : }
2160 [ # # ]: 0 : if (bRight)
2161 [ # # ]: 0 : mpDev->DrawLine( Point( nMaxX,nMinY ), Point( nMaxX,nMaxY ) );
2162 : : }
2163 [ # # ][ # # ]: 0 : if ( bLeft && bTop )
2164 : : {
2165 : 0 : mpDev->SetLineColor();
2166 : 0 : mpDev->SetFillColor( rColor );
2167 [ # # ]: 0 : mpDev->DrawRect( Rectangle( nMinX+nLayoutSign, nMinY+1, nMinX+3*nLayoutSign, nMinY+3 ) );
2168 : : }
2169 : : }
2170 : : }
2171 : 0 : }
2172 : :
2173 : 0 : void ScOutputData::DrawChangeTrack()
2174 : : {
2175 : 0 : ScChangeTrack* pTrack = mpDoc->GetChangeTrack();
2176 : 0 : ScChangeViewSettings* pSettings = mpDoc->GetChangeViewSettings();
2177 [ # # ][ # # ]: 0 : if ( !pTrack || !pTrack->GetFirst() || !pSettings || !pSettings->ShowChanges() )
[ # # ][ # # ]
[ # # ]
2178 : 0 : return; // nix da oder abgeschaltet
2179 : :
2180 [ # # ]: 0 : ScActionColorChanger aColorChanger(*pTrack);
2181 : :
2182 : : // Clipping passiert von aussen
2183 : : //! ohne Clipping, nur betroffene Zeilen painten ??!??!?
2184 : :
2185 : 0 : SCCOL nEndX = nX2;
2186 : 0 : SCROW nEndY = nY2;
2187 [ # # ]: 0 : if ( nEndX < MAXCOL ) ++nEndX; // auch noch von der naechsten Zelle, weil die Markierung
2188 [ # # ]: 0 : if ( nEndY < MAXROW ) ++nEndY; // in die jeweils vorhergehende Zelle hineinragt
2189 : 0 : ScRange aViewRange( nX1, nY1, nTab, nEndX, nEndY, nTab );
2190 : 0 : const ScChangeAction* pAction = pTrack->GetFirst();
2191 [ # # ]: 0 : while (pAction)
2192 : : {
2193 : : ScChangeActionType eActionType;
2194 [ # # ][ # # ]: 0 : if ( pAction->IsVisible() )
2195 : : {
2196 : 0 : eActionType = pAction->GetType();
2197 : 0 : const ScBigRange& rBig = pAction->GetBigRange();
2198 [ # # ]: 0 : if ( rBig.aStart.Tab() == nTab )
2199 : : {
2200 : 0 : ScRange aRange = rBig.MakeRange();
2201 : :
2202 [ # # ]: 0 : if ( eActionType == SC_CAT_DELETE_ROWS )
2203 : 0 : aRange.aEnd.SetRow( aRange.aStart.Row() );
2204 [ # # ]: 0 : else if ( eActionType == SC_CAT_DELETE_COLS )
2205 : 0 : aRange.aEnd.SetCol( aRange.aStart.Col() );
2206 : :
2207 [ # # ][ # # ]: 0 : if ( aRange.Intersects( aViewRange ) &&
[ # # ][ # # ]
2208 [ # # ]: 0 : ScViewUtil::IsActionShown( *pAction, *pSettings, *mpDoc ) )
2209 : : {
2210 [ # # ]: 0 : aColorChanger.Update( *pAction );
2211 : 0 : Color aColor( aColorChanger.GetColor() );
2212 : 0 : DrawOneChange( aRange.aStart.Col(), aRange.aStart.Row(),
2213 [ # # ]: 0 : aRange.aEnd.Col(), aRange.aEnd.Row(), aColor, sal::static_int_cast<sal_uInt16>(eActionType) );
2214 : :
2215 : : }
2216 : : }
2217 [ # # # # ]: 0 : if ( eActionType == SC_CAT_MOVE &&
[ # # ]
2218 : : ((const ScChangeActionMove*)pAction)->
2219 : 0 : GetFromRange().aStart.Tab() == nTab )
2220 : : {
2221 : : ScRange aRange = ((const ScChangeActionMove*)pAction)->
2222 : 0 : GetFromRange().MakeRange();
2223 [ # # ][ # # ]: 0 : if ( aRange.Intersects( aViewRange ) &&
[ # # ][ # # ]
2224 [ # # ]: 0 : ScViewUtil::IsActionShown( *pAction, *pSettings, *mpDoc ) )
2225 : : {
2226 [ # # ]: 0 : aColorChanger.Update( *pAction );
2227 : 0 : Color aColor( aColorChanger.GetColor() );
2228 : 0 : DrawOneChange( aRange.aStart.Col(), aRange.aStart.Row(),
2229 [ # # ]: 0 : aRange.aEnd.Col(), aRange.aEnd.Row(), aColor, sal::static_int_cast<sal_uInt16>(eActionType) );
2230 : : }
2231 : : }
2232 : : }
2233 : :
2234 : 0 : pAction = pAction->GetNext();
2235 : 0 : }
2236 : : }
2237 : :
2238 : : //TODO: moggi Need to check if this can't be written simpler
2239 : 1278 : void ScOutputData::DrawNoteMarks()
2240 : : {
2241 : :
2242 : 1278 : sal_Bool bFirst = sal_True;
2243 : :
2244 : 1278 : long nInitPosX = nScrX;
2245 [ + + ]: 1278 : if ( bLayoutRTL )
2246 : 2 : nInitPosX += nMirrorW - 1; // always in pixels
2247 [ + + ]: 1278 : long nLayoutSign = bLayoutRTL ? -1 : 1;
2248 : :
2249 : 1278 : long nPosY = nScrY;
2250 [ + + ]: 16974 : for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
2251 : : {
2252 : 15696 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
2253 [ + - ]: 15696 : if ( pThisRowInfo->bChanged )
2254 : : {
2255 : 15696 : long nPosX = nInitPosX;
2256 [ + + ]: 166282 : for (SCCOL nX=nX1; nX<=nX2; nX++)
2257 : : {
2258 : 150586 : CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
2259 : 150586 : sal_Bool bIsMerged = false;
2260 : :
2261 [ + + ][ - + ]: 150586 : if ( nX==nX1 && pInfo->bHOverlapped && !pInfo->bVOverlapped )
[ # # ]
2262 : : {
2263 : : // find start of merged cell
2264 : 0 : bIsMerged = sal_True;
2265 : 0 : SCROW nY = pRowInfo[nArrY].nRowNo;
2266 : 0 : SCCOL nMergeX = nX;
2267 : 0 : SCROW nMergeY = nY;
2268 [ # # ]: 0 : mpDoc->ExtendOverlapped( nMergeX, nMergeY, nX, nY, nTab );
2269 : : // use origin's pCell for NotePtr test below
2270 : : }
2271 : :
2272 [ + + ][ + - ]: 150586 : if ( mpDoc->GetNotes(nTab)->findByAddress(nX, pRowInfo[nArrY].nRowNo) && ( bIsMerged ||
[ + - ][ + - ]
[ + + ]
2273 : 12 : ( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
2274 : : {
2275 [ + + ]: 6 : if (bFirst)
2276 : : {
2277 : 5 : mpDev->SetLineColor();
2278 : :
2279 : 5 : const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2280 [ - + ][ - + ]: 5 : if ( mbUseStyleColor && rStyleSettings.GetHighContrastMode() )
[ + - ]
2281 [ # # ]: 0 : mpDev->SetFillColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
2282 : : else
2283 [ + - ]: 5 : mpDev->SetFillColor(COL_LIGHTRED);
2284 : :
2285 : 5 : bFirst = false;
2286 : : }
2287 : :
2288 : 6 : long nMarkX = nPosX + ( pRowInfo[0].pCellInfo[nX+1].nWidth - 4 ) * nLayoutSign;
2289 [ + - ][ - + ]: 6 : if ( bIsMerged || pInfo->bMerged )
2290 : : {
2291 : : // if merged, add widths of all cells
2292 : 0 : SCCOL nNextX = nX + 1;
2293 [ # # ][ # # ]: 0 : while ( nNextX <= nX2 + 1 && pThisRowInfo->pCellInfo[nNextX+1].bHOverlapped )
[ # # ]
2294 : : {
2295 : 0 : nMarkX += pRowInfo[0].pCellInfo[nNextX+1].nWidth * nLayoutSign;
2296 : 0 : ++nNextX;
2297 : : }
2298 : : }
2299 [ - + ][ + - ]: 6 : if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrW ) )
2300 [ + - ]: 6 : mpDev->DrawRect( Rectangle( nMarkX,nPosY,nMarkX+2*nLayoutSign,nPosY+2 ) );
2301 : : }
2302 : :
2303 : 150586 : nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
2304 : : }
2305 : : }
2306 : 15696 : nPosY += pThisRowInfo->nHeight;
2307 : : }
2308 : 1278 : }
2309 : :
2310 : 63 : void ScOutputData::AddPDFNotes()
2311 : : {
2312 [ - + ][ # # ]: 63 : vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, mpDev->GetExtOutDevData() );
2313 [ - + ][ # # ]: 63 : if ( !pPDFData || !pPDFData->GetIsExportNotes() )
[ + - ]
2314 : 63 : return;
2315 : :
2316 : 0 : long nInitPosX = nScrX;
2317 [ # # ]: 0 : if ( bLayoutRTL )
2318 : : {
2319 [ # # ]: 0 : Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
2320 : 0 : long nOneX = aOnePixel.Width();
2321 : 0 : nInitPosX += nMirrorW - nOneX;
2322 : : }
2323 [ # # ]: 0 : long nLayoutSign = bLayoutRTL ? -1 : 1;
2324 : :
2325 : 0 : long nPosY = nScrY;
2326 [ # # ]: 0 : for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
2327 : : {
2328 : 0 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
2329 [ # # ]: 0 : if ( pThisRowInfo->bChanged )
2330 : : {
2331 : 0 : long nPosX = nInitPosX;
2332 [ # # ]: 0 : for (SCCOL nX=nX1; nX<=nX2; nX++)
2333 : : {
2334 : 0 : CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
2335 : 0 : sal_Bool bIsMerged = false;
2336 : 0 : SCROW nY = pRowInfo[nArrY].nRowNo;
2337 : 0 : SCCOL nMergeX = nX;
2338 : 0 : SCROW nMergeY = nY;
2339 : :
2340 [ # # ][ # # ]: 0 : if ( nX==nX1 && pInfo->bHOverlapped && !pInfo->bVOverlapped )
[ # # ]
2341 : : {
2342 : : // find start of merged cell
2343 : 0 : bIsMerged = sal_True;
2344 [ # # ]: 0 : mpDoc->ExtendOverlapped( nMergeX, nMergeY, nX, nY, nTab );
2345 : : // use origin's pCell for NotePtr test below
2346 : : }
2347 : :
2348 [ # # ][ # # ]: 0 : if ( mpDoc->GetNotes(nTab)->findByAddress(nMergeX, nMergeY) && ( bIsMerged ||
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2349 : 0 : ( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
2350 : : {
2351 : 0 : long nNoteWidth = (long)( SC_CLIPMARK_SIZE * mnPPTX );
2352 : 0 : long nNoteHeight = (long)( SC_CLIPMARK_SIZE * mnPPTY );
2353 : :
2354 : 0 : long nMarkX = nPosX + ( pRowInfo[0].pCellInfo[nX+1].nWidth - nNoteWidth ) * nLayoutSign;
2355 [ # # ][ # # ]: 0 : if ( bIsMerged || pInfo->bMerged )
2356 : : {
2357 : : // if merged, add widths of all cells
2358 : 0 : SCCOL nNextX = nX + 1;
2359 [ # # ][ # # ]: 0 : while ( nNextX <= nX2 + 1 && pThisRowInfo->pCellInfo[nNextX+1].bHOverlapped )
[ # # ]
2360 : : {
2361 : 0 : nMarkX += pRowInfo[0].pCellInfo[nNextX+1].nWidth * nLayoutSign;
2362 : 0 : ++nNextX;
2363 : : }
2364 : : }
2365 [ # # ][ # # ]: 0 : if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrW ) )
2366 : : {
2367 [ # # ]: 0 : Rectangle aNoteRect( nMarkX, nPosY, nMarkX+nNoteWidth*nLayoutSign, nPosY+nNoteHeight );
2368 [ # # ][ # # ]: 0 : const ScPostIt* pNote = mpDoc->GetNotes(nTab)->findByAddress(nMergeX, nMergeY);
2369 : :
2370 : : // Note title is the cell address (as on printed note pages)
2371 [ # # ]: 0 : String aTitle;
2372 : 0 : ScAddress aAddress( nMergeX, nMergeY, nTab );
2373 [ # # ][ # # ]: 0 : aAddress.Format( aTitle, SCA_VALID, mpDoc, mpDoc->GetAddressConvention() );
2374 : :
2375 : : // Content has to be a simple string without line breaks
2376 [ # # ][ # # ]: 0 : String aContent = pNote->GetText();
2377 : : xub_StrLen nPos;
2378 [ # # ][ # # ]: 0 : while ( (nPos=aContent.Search('\n')) != STRING_NOTFOUND )
2379 [ # # ]: 0 : aContent.SetChar( nPos, ' ' );
2380 : :
2381 [ # # ]: 0 : vcl::PDFNote aNote;
2382 [ # # ]: 0 : aNote.Title = aTitle;
2383 [ # # ]: 0 : aNote.Contents = aContent;
2384 [ # # ][ # # ]: 0 : pPDFData->CreateNote( aNoteRect, aNote );
[ # # ][ # # ]
2385 : : }
2386 : : }
2387 : :
2388 : 0 : nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
2389 : : }
2390 : : }
2391 : 0 : nPosY += pThisRowInfo->nHeight;
2392 : : }
2393 : : }
2394 : :
2395 : 1278 : void ScOutputData::DrawClipMarks()
2396 : : {
2397 [ + + ]: 1278 : if (!bAnyClipped)
2398 : 1278 : return;
2399 : :
2400 : 53 : Color aArrowFillCol( COL_LIGHTRED );
2401 : :
2402 : 53 : sal_uLong nOldDrawMode = mpDev->GetDrawMode();
2403 [ + - ]: 53 : const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2404 [ - + ][ - + ]: 53 : if ( mbUseStyleColor && rStyleSettings.GetHighContrastMode() )
[ + - ]
2405 : : {
2406 : : // use DrawMode to change the arrow's outline color
2407 [ # # ]: 0 : mpDev->SetDrawMode( nOldDrawMode | DRAWMODE_SETTINGSLINE );
2408 : : // use text color also for the fill color
2409 [ # # ][ # # ]: 0 : aArrowFillCol.SetColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
[ # # ]
2410 : : }
2411 : :
2412 : 53 : long nInitPosX = nScrX;
2413 [ - + ]: 53 : if ( bLayoutRTL )
2414 : 0 : nInitPosX += nMirrorW - 1; // always in pixels
2415 [ - + ]: 53 : long nLayoutSign = bLayoutRTL ? -1 : 1;
2416 : :
2417 [ + - ]: 53 : Rectangle aCellRect;
2418 : 53 : long nPosY = nScrY;
2419 [ + + ]: 407 : for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
2420 : : {
2421 : 354 : RowInfo* pThisRowInfo = &pRowInfo[nArrY];
2422 [ + - ]: 354 : if ( pThisRowInfo->bChanged )
2423 : : {
2424 : 354 : SCROW nY = pThisRowInfo->nRowNo;
2425 : 354 : long nPosX = nInitPosX;
2426 [ + + ]: 3894 : for (SCCOL nX=nX1; nX<=nX2; nX++)
2427 : : {
2428 : 3540 : CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
2429 [ + + ]: 3540 : if (pInfo->nClipMark)
2430 : : {
2431 [ + - ][ - + ]: 151 : if (pInfo->bHOverlapped || pInfo->bVOverlapped)
2432 : : {
2433 : : // merge origin may be outside of visible area - use document functions
2434 : :
2435 : 0 : SCCOL nOverX = nX;
2436 : 0 : SCROW nOverY = nY;
2437 : 0 : long nStartPosX = nPosX;
2438 : 0 : long nStartPosY = nPosY;
2439 : :
2440 [ # # # # ]: 0 : while ( nOverX > 0 && ( ((const ScMergeFlagAttr*)mpDoc->GetAttr(
[ # # ]
2441 [ # # ]: 0 : nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & SC_MF_HOR ) )
2442 : : {
2443 : 0 : --nOverX;
2444 [ # # ]: 0 : nStartPosX -= nLayoutSign * (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX );
2445 : : }
2446 : :
2447 [ # # # # ]: 0 : while ( nOverY > 0 && ( ((const ScMergeFlagAttr*)mpDoc->GetAttr(
[ # # ]
2448 [ # # ]: 0 : nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & SC_MF_VER ) )
2449 : : {
2450 : 0 : --nOverY;
2451 [ # # ]: 0 : nStartPosY -= nLayoutSign * (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY );
2452 : : }
2453 : :
2454 [ # # ]: 0 : long nOutWidth = (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX );
2455 [ # # ]: 0 : long nOutHeight = (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY );
2456 : :
2457 : : const ScMergeAttr* pMerge = (const ScMergeAttr*)
2458 [ # # ]: 0 : mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE );
2459 : 0 : SCCOL nCountX = pMerge->GetColMerge();
2460 [ # # ]: 0 : for (SCCOL i=1; i<nCountX; i++)
2461 [ # # ]: 0 : nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
2462 : 0 : SCROW nCountY = pMerge->GetRowMerge();
2463 [ # # ]: 0 : nOutHeight += (long) mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY);
2464 : :
2465 [ # # ]: 0 : if ( bLayoutRTL )
2466 : 0 : nStartPosX -= nOutWidth - 1;
2467 [ # # ]: 0 : aCellRect = Rectangle( Point( nStartPosX, nStartPosY ), Size( nOutWidth, nOutHeight ) );
2468 : : }
2469 : : else
2470 : : {
2471 : 151 : long nOutWidth = pRowInfo[0].pCellInfo[nX+1].nWidth;
2472 : 151 : long nOutHeight = pThisRowInfo->nHeight;
2473 : :
2474 [ - + ][ # # ]: 151 : if ( pInfo->bMerged && pInfo->pPatternAttr )
2475 : : {
2476 : 0 : SCCOL nOverX = nX;
2477 : 0 : SCROW nOverY = nY;
2478 : : const ScMergeAttr* pMerge =
2479 [ # # ]: 0 : (ScMergeAttr*)&pInfo->pPatternAttr->GetItem(ATTR_MERGE);
2480 : 0 : SCCOL nCountX = pMerge->GetColMerge();
2481 [ # # ]: 0 : for (SCCOL i=1; i<nCountX; i++)
2482 [ # # ]: 0 : nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
2483 : 0 : SCROW nCountY = pMerge->GetRowMerge();
2484 [ # # ]: 0 : nOutHeight += (long) mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY);
2485 : : }
2486 : :
2487 : 151 : long nStartPosX = nPosX;
2488 [ - + ]: 151 : if ( bLayoutRTL )
2489 : 0 : nStartPosX -= nOutWidth - 1;
2490 : : // #i80447# create aCellRect from two points in case nOutWidth is 0
2491 : : aCellRect = Rectangle( Point( nStartPosX, nPosY ),
2492 [ + - ]: 151 : Point( nStartPosX+nOutWidth-1, nPosY+nOutHeight-1 ) );
2493 : : }
2494 : :
2495 : 151 : aCellRect.Bottom() -= 1; // don't paint over the cell grid
2496 [ - + ]: 151 : if ( bLayoutRTL )
2497 : 0 : aCellRect.Left() += 1;
2498 : : else
2499 : 151 : aCellRect.Right() -= 1;
2500 : :
2501 : 151 : long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
2502 : 151 : Size aMarkSize( nMarkPixel, (nMarkPixel-1)*2 );
2503 : :
2504 [ + + ][ - + ]: 151 : if ( pInfo->nClipMark & ( bLayoutRTL ? SC_CLIPMARK_RIGHT : SC_CLIPMARK_LEFT ) )
2505 : : {
2506 : : // visually left
2507 : 123 : Rectangle aMarkRect = aCellRect;
2508 : 123 : aMarkRect.Right() = aCellRect.Left()+nMarkPixel-1;
2509 [ + - ]: 123 : SvxFont::DrawArrow( *mpDev, aMarkRect, aMarkSize, aArrowFillCol, true );
2510 : : }
2511 [ - + ][ + + ]: 151 : if ( pInfo->nClipMark & ( bLayoutRTL ? SC_CLIPMARK_LEFT : SC_CLIPMARK_RIGHT ) )
2512 : : {
2513 : : // visually right
2514 : 28 : Rectangle aMarkRect = aCellRect;
2515 : 28 : aMarkRect.Left() = aCellRect.Right()-nMarkPixel+1;
2516 [ + - ]: 151 : SvxFont::DrawArrow( *mpDev, aMarkRect, aMarkSize, aArrowFillCol, false );
2517 : : }
2518 : : }
2519 : 3540 : nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
2520 : : }
2521 : : }
2522 : 354 : nPosY += pThisRowInfo->nHeight;
2523 : : }
2524 : :
2525 [ + - ]: 1278 : mpDev->SetDrawMode(nOldDrawMode);
2526 : : }
2527 : :
2528 : :
2529 : :
2530 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|