1cdf0e10cSrcweir /************************************************************************* 2cdf0e10cSrcweir * 3cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4cdf0e10cSrcweir * 5cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6cdf0e10cSrcweir * 7cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8cdf0e10cSrcweir * 9cdf0e10cSrcweir * This file is part of OpenOffice.org. 10cdf0e10cSrcweir * 11cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14cdf0e10cSrcweir * 15cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20cdf0e10cSrcweir * 21cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25cdf0e10cSrcweir * 26cdf0e10cSrcweir ************************************************************************/ 27cdf0e10cSrcweir 28cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29cdf0e10cSrcweir #include "precompiled_sc.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir 33cdf0e10cSrcweir // INCLUDE --------------------------------------------------------------- 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include "scitems.hxx" 36cdf0e10cSrcweir #include <editeng/eeitem.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 40cdf0e10cSrcweir #include <editeng/colritem.hxx> 41cdf0e10cSrcweir #include <editeng/editview.hxx> 42cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 43cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 44cdf0e10cSrcweir #include <sfx2/bindings.hxx> 45cdf0e10cSrcweir #include <sfx2/printer.hxx> 46cdf0e10cSrcweir 47cdf0e10cSrcweir #include <svx/svdview.hxx> 48cdf0e10cSrcweir #include "tabvwsh.hxx" 49cdf0e10cSrcweir 50cdf0e10cSrcweir #include "gridwin.hxx" 51cdf0e10cSrcweir #include "viewdata.hxx" 52cdf0e10cSrcweir #include "output.hxx" 53cdf0e10cSrcweir #include "document.hxx" 54cdf0e10cSrcweir #include "attrib.hxx" 55cdf0e10cSrcweir #include "patattr.hxx" // InvertSimple 56cdf0e10cSrcweir #include "dbcolect.hxx" 57cdf0e10cSrcweir #include "docoptio.hxx" 58cdf0e10cSrcweir #include "notemark.hxx" 59cdf0e10cSrcweir #include "dbfunc.hxx" // oder GetPageBreakData an die ViewData 60cdf0e10cSrcweir #include "scmod.hxx" 61cdf0e10cSrcweir #include "inputhdl.hxx" 62cdf0e10cSrcweir #include "rfindlst.hxx" 63cdf0e10cSrcweir #include "hiranges.hxx" 64cdf0e10cSrcweir #include "pagedata.hxx" 65cdf0e10cSrcweir #include "docpool.hxx" 66cdf0e10cSrcweir #include "globstr.hrc" 67cdf0e10cSrcweir #include "docsh.hxx" // oder GetSfxInPlaceObject 68cdf0e10cSrcweir #include "cbutton.hxx" 69cdf0e10cSrcweir #include "invmerge.hxx" 70cdf0e10cSrcweir #include "editutil.hxx" 71cdf0e10cSrcweir #include "inputopt.hxx" 72cdf0e10cSrcweir #include "fillinfo.hxx" 73cdf0e10cSrcweir #include "dpcontrol.hxx" 74cdf0e10cSrcweir #include "queryparam.hxx" 75cdf0e10cSrcweir #include "sc.hrc" 76cdf0e10cSrcweir #include <vcl/virdev.hxx> 77cdf0e10cSrcweir 78cdf0e10cSrcweir // #i74769# 79cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx> 80cdf0e10cSrcweir 81cdf0e10cSrcweir //#include "tabvwsh.hxx" //! Test !!!! 82cdf0e10cSrcweir 83cdf0e10cSrcweir //------------------------------------------------------------------------ 84cdf0e10cSrcweir 85cdf0e10cSrcweir void lcl_LimitRect( Rectangle& rRect, const Rectangle& rVisible ) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir if ( rRect.Top() < rVisible.Top()-1 ) rRect.Top() = rVisible.Top()-1; 88cdf0e10cSrcweir // if ( rRect.Left() < rVisible.Left()-1 ) rRect.Left() = rVisible.Left()-1; 89cdf0e10cSrcweir if ( rRect.Bottom() > rVisible.Bottom()+1 ) rRect.Bottom() = rVisible.Bottom()+1; 90cdf0e10cSrcweir // if ( rRect.Right() > rVisible.Right()+1 ) rRect.Right() = rVisible.Right()+1; 91cdf0e10cSrcweir 92cdf0e10cSrcweir // #51122# auch wenn das inner-Rectangle nicht sichtbar ist, muss evtl. 93cdf0e10cSrcweir // die Titelzeile gezeichnet werden, darum kein Rueckgabewert mehr. 94cdf0e10cSrcweir // Wenn's weit daneben liegt, wird lcl_DrawOneFrame erst gar nicht gerufen. 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir void lcl_DrawOneFrame( OutputDevice* pDev, const Rectangle& rInnerPixel, 98cdf0e10cSrcweir const String& rTitle, const Color& rColor, sal_Bool bTextBelow, 99cdf0e10cSrcweir double nPPTX, double nPPTY, const Fraction& rZoomY, 100cdf0e10cSrcweir ScDocument* pDoc, ScViewData* pButtonViewData, sal_Bool bLayoutRTL ) 101cdf0e10cSrcweir { 102cdf0e10cSrcweir // pButtonViewData wird nur benutzt, um die Button-Groesse zu setzen, 103cdf0e10cSrcweir // darf ansonsten NULL sein! 104cdf0e10cSrcweir 105cdf0e10cSrcweir Rectangle aInner = rInnerPixel; 106cdf0e10cSrcweir if ( bLayoutRTL ) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir aInner.Left() = rInnerPixel.Right(); 109cdf0e10cSrcweir aInner.Right() = rInnerPixel.Left(); 110cdf0e10cSrcweir } 111cdf0e10cSrcweir 112cdf0e10cSrcweir Rectangle aVisible( Point(0,0), pDev->GetOutputSizePixel() ); 113cdf0e10cSrcweir lcl_LimitRect( aInner, aVisible ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir Rectangle aOuter = aInner; 116cdf0e10cSrcweir long nHor = (long) ( SC_SCENARIO_HSPACE * nPPTX ); 117cdf0e10cSrcweir long nVer = (long) ( SC_SCENARIO_VSPACE * nPPTY ); 118cdf0e10cSrcweir aOuter.Left() -= nHor; 119cdf0e10cSrcweir aOuter.Right() += nHor; 120cdf0e10cSrcweir aOuter.Top() -= nVer; 121cdf0e10cSrcweir aOuter.Bottom() += nVer; 122cdf0e10cSrcweir 123cdf0e10cSrcweir // use ScPatternAttr::GetFont only for font size 124cdf0e10cSrcweir Font aAttrFont; 125cdf0e10cSrcweir ((const ScPatternAttr&)pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)). 126cdf0e10cSrcweir GetFont(aAttrFont,SC_AUTOCOL_BLACK,pDev,&rZoomY); 127cdf0e10cSrcweir 128cdf0e10cSrcweir // everything else from application font 129cdf0e10cSrcweir Font aAppFont = pDev->GetSettings().GetStyleSettings().GetAppFont(); 130cdf0e10cSrcweir aAppFont.SetSize( aAttrFont.GetSize() ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir aAppFont.SetAlign( ALIGN_TOP ); 133cdf0e10cSrcweir pDev->SetFont( aAppFont ); 134cdf0e10cSrcweir 135cdf0e10cSrcweir Size aTextSize( pDev->GetTextWidth( rTitle ), pDev->GetTextHeight() ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir if ( bTextBelow ) 138cdf0e10cSrcweir aOuter.Bottom() += aTextSize.Height(); 139cdf0e10cSrcweir else 140cdf0e10cSrcweir aOuter.Top() -= aTextSize.Height(); 141cdf0e10cSrcweir 142cdf0e10cSrcweir pDev->SetLineColor(); 143cdf0e10cSrcweir pDev->SetFillColor( rColor ); 144cdf0e10cSrcweir // links, oben, rechts, unten 145cdf0e10cSrcweir pDev->DrawRect( Rectangle( aOuter.Left(), aOuter.Top(), aInner.Left(), aOuter.Bottom() ) ); 146cdf0e10cSrcweir pDev->DrawRect( Rectangle( aOuter.Left(), aOuter.Top(), aOuter.Right(), aInner.Top() ) ); 147cdf0e10cSrcweir pDev->DrawRect( Rectangle( aInner.Right(), aOuter.Top(), aOuter.Right(), aOuter.Bottom() ) ); 148cdf0e10cSrcweir pDev->DrawRect( Rectangle( aOuter.Left(), aInner.Bottom(), aOuter.Right(), aOuter.Bottom() ) ); 149cdf0e10cSrcweir 150cdf0e10cSrcweir long nButtonY = bTextBelow ? aInner.Bottom() : aOuter.Top(); 151cdf0e10cSrcweir 152cdf0e10cSrcweir ScDDComboBoxButton aComboButton((Window*)pDev); 153cdf0e10cSrcweir aComboButton.SetOptSizePixel(); 154cdf0e10cSrcweir long nBWidth = ( aComboButton.GetSizePixel().Width() * rZoomY.GetNumerator() ) 155cdf0e10cSrcweir / rZoomY.GetDenominator(); 156cdf0e10cSrcweir long nBHeight = nVer + aTextSize.Height() + 1; 157cdf0e10cSrcweir Size aButSize( nBWidth, nBHeight ); 158cdf0e10cSrcweir long nButtonPos = bLayoutRTL ? aOuter.Left() : aOuter.Right()-nBWidth+1; 159cdf0e10cSrcweir aComboButton.Draw( Point(nButtonPos, nButtonY), aButSize, sal_False ); 160cdf0e10cSrcweir if (pButtonViewData) 161cdf0e10cSrcweir pButtonViewData->SetScenButSize( aButSize ); 162cdf0e10cSrcweir 163cdf0e10cSrcweir long nTextStart = bLayoutRTL ? aInner.Right() - aTextSize.Width() + 1 : aInner.Left(); 164cdf0e10cSrcweir 165cdf0e10cSrcweir sal_Bool bWasClip = sal_False; 166cdf0e10cSrcweir Region aOldClip; 167cdf0e10cSrcweir sal_Bool bClip = ( aTextSize.Width() > aOuter.Right() - nBWidth - aInner.Left() ); 168cdf0e10cSrcweir if ( bClip ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir if (pDev->IsClipRegion()) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir bWasClip = sal_True; 173cdf0e10cSrcweir aOldClip = pDev->GetActiveClipRegion(); 174cdf0e10cSrcweir } 175cdf0e10cSrcweir long nClipStartX = bLayoutRTL ? aOuter.Left() + nBWidth : aInner.Left(); 176cdf0e10cSrcweir long nClipEndX = bLayoutRTL ? aInner.Right() : aOuter.Right() - nBWidth; 177cdf0e10cSrcweir pDev->SetClipRegion( Rectangle( nClipStartX, nButtonY + nVer/2, 178cdf0e10cSrcweir nClipEndX, nButtonY + nVer/2 + aTextSize.Height() ) ); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir pDev->DrawText( Point( nTextStart, nButtonY + nVer/2 ), rTitle ); 182cdf0e10cSrcweir 183cdf0e10cSrcweir if ( bClip ) 184cdf0e10cSrcweir { 185cdf0e10cSrcweir if ( bWasClip ) 186cdf0e10cSrcweir pDev->SetClipRegion(aOldClip); 187cdf0e10cSrcweir else 188cdf0e10cSrcweir pDev->SetClipRegion(); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir pDev->SetFillColor(); 192cdf0e10cSrcweir pDev->SetLineColor( COL_BLACK ); 193cdf0e10cSrcweir pDev->DrawRect( aInner ); 194cdf0e10cSrcweir pDev->DrawRect( aOuter ); 195cdf0e10cSrcweir } 196cdf0e10cSrcweir 197cdf0e10cSrcweir void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, ScSplitPos eWhich, 198cdf0e10cSrcweir SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 201cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 202cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 203cdf0e10cSrcweir if ( nTab+1<nTabCount && pDoc->IsScenario(nTab+1) && !pDoc->IsScenario(nTab) ) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir if ( nX1 > 0 ) --nX1; 206cdf0e10cSrcweir if ( nY1>=2 ) nY1 -= 2; // Hack: Titelzeile beruehrt zwei Zellen 207cdf0e10cSrcweir else if ( nY1 > 0 ) --nY1; 208cdf0e10cSrcweir if ( nX2 < MAXCOL ) ++nX2; 209cdf0e10cSrcweir if ( nY2 < MAXROW-1 ) nY2 += 2; // Hack: Titelzeile beruehrt zwei Zellen 210cdf0e10cSrcweir else if ( nY2 < MAXROW ) ++nY2; 211cdf0e10cSrcweir ScRange aViewRange( nX1,nY1,nTab, nX2,nY2,nTab ); 212cdf0e10cSrcweir 213cdf0e10cSrcweir //! Ranges an der Table cachen!!!! 214cdf0e10cSrcweir 215cdf0e10cSrcweir ScMarkData aMarks; 216cdf0e10cSrcweir for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++) 217cdf0e10cSrcweir pDoc->MarkScenario( i, nTab, aMarks, sal_False, SC_SCENARIO_SHOWFRAME ); 218cdf0e10cSrcweir ScRangeListRef xRanges = new ScRangeList; 219cdf0e10cSrcweir aMarks.FillRangeListWithMarks( xRanges, sal_False ); 220cdf0e10cSrcweir 221cdf0e10cSrcweir sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 222cdf0e10cSrcweir long nLayoutSign = bLayoutRTL ? -1 : 1; 223cdf0e10cSrcweir 224cdf0e10cSrcweir sal_uInt16 nRangeCount = (sal_uInt16)xRanges->Count(); 225cdf0e10cSrcweir for (sal_uInt16 j=0; j<nRangeCount; j++) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir ScRange aRange = *xRanges->GetObject(j); 228cdf0e10cSrcweir // Szenario-Rahmen immer dann auf zusammengefasste Zellen erweitern, wenn 229cdf0e10cSrcweir // dadurch keine neuen nicht-ueberdeckten Zellen mit umrandet werden 230cdf0e10cSrcweir pDoc->ExtendTotalMerge( aRange ); 231cdf0e10cSrcweir 232cdf0e10cSrcweir //! -> Repaint beim Zusammenfassen erweitern !!! 233cdf0e10cSrcweir 234cdf0e10cSrcweir if ( aRange.Intersects( aViewRange ) ) //! Platz fuer Text/Button? 235cdf0e10cSrcweir { 236cdf0e10cSrcweir Point aStartPos = pViewData->GetScrPos( 237cdf0e10cSrcweir aRange.aStart.Col(), aRange.aStart.Row(), eWhich, sal_True ); 238cdf0e10cSrcweir Point aEndPos = pViewData->GetScrPos( 239cdf0e10cSrcweir aRange.aEnd.Col()+1, aRange.aEnd.Row()+1, eWhich, sal_True ); 240cdf0e10cSrcweir // on the grid: 241cdf0e10cSrcweir aStartPos.X() -= nLayoutSign; 242cdf0e10cSrcweir aStartPos.Y() -= 1; 243cdf0e10cSrcweir aEndPos.X() -= nLayoutSign; 244cdf0e10cSrcweir aEndPos.Y() -= 1; 245cdf0e10cSrcweir 246cdf0e10cSrcweir sal_Bool bTextBelow = ( aRange.aStart.Row() == 0 ); 247cdf0e10cSrcweir 248cdf0e10cSrcweir String aCurrent; 249cdf0e10cSrcweir Color aColor( COL_LIGHTGRAY ); 250cdf0e10cSrcweir for (SCTAB nAct=nTab+1; nAct<nTabCount && pDoc->IsScenario(nAct); nAct++) 251cdf0e10cSrcweir if ( pDoc->IsActiveScenario(nAct) && pDoc->HasScenarioRange(nAct,aRange) ) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir String aDummyComment; 254cdf0e10cSrcweir sal_uInt16 nDummyFlags; 255cdf0e10cSrcweir pDoc->GetName( nAct, aCurrent ); 256cdf0e10cSrcweir pDoc->GetScenarioData( nAct, aDummyComment, aColor, nDummyFlags ); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir 259cdf0e10cSrcweir if (!aCurrent.Len()) 260cdf0e10cSrcweir aCurrent = ScGlobal::GetRscString( STR_EMPTYDATA ); 261cdf0e10cSrcweir 262cdf0e10cSrcweir //! eigener Text "(keins)" statt "(leer)" ??? 263cdf0e10cSrcweir 264cdf0e10cSrcweir lcl_DrawOneFrame( pDev, Rectangle( aStartPos, aEndPos ), 265cdf0e10cSrcweir aCurrent, aColor, bTextBelow, 266cdf0e10cSrcweir pViewData->GetPPTX(), pViewData->GetPPTY(), pViewData->GetZoomY(), 267cdf0e10cSrcweir pDoc, pViewData, bLayoutRTL ); 268cdf0e10cSrcweir } 269cdf0e10cSrcweir } 270cdf0e10cSrcweir } 271cdf0e10cSrcweir } 272cdf0e10cSrcweir 273cdf0e10cSrcweir //------------------------------------------------------------------------ 274cdf0e10cSrcweir 275cdf0e10cSrcweir void lcl_DrawHighlight( ScOutputData& rOutputData, ScViewData* pViewData, 276cdf0e10cSrcweir ScHighlightRanges& rHighlightRanges ) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 279cdf0e10cSrcweir sal_uLong nCount = rHighlightRanges.Count(); 280cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir ScHighlightEntry* pEntry = rHighlightRanges.GetObject( i ); 283cdf0e10cSrcweir if (pEntry) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir ScRange aRange = pEntry->aRef; 286cdf0e10cSrcweir if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() ) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir rOutputData.DrawRefMark( 289cdf0e10cSrcweir aRange.aStart.Col(), aRange.aStart.Row(), 290cdf0e10cSrcweir aRange.aEnd.Col(), aRange.aEnd.Row(), 291cdf0e10cSrcweir pEntry->aColor, sal_False ); 292cdf0e10cSrcweir } 293cdf0e10cSrcweir } 294cdf0e10cSrcweir } 295cdf0e10cSrcweir } 296cdf0e10cSrcweir 297cdf0e10cSrcweir //------------------------------------------------------------------------ 298cdf0e10cSrcweir 299cdf0e10cSrcweir void ScGridWindow::DoInvertRect( const Rectangle& rPixel ) 300cdf0e10cSrcweir { 301cdf0e10cSrcweir // Invert( PixelToLogic(rPixel) ); 302cdf0e10cSrcweir 303cdf0e10cSrcweir if ( rPixel == aInvertRect ) 304cdf0e10cSrcweir aInvertRect = Rectangle(); // aufheben 305cdf0e10cSrcweir else 306cdf0e10cSrcweir { 307cdf0e10cSrcweir DBG_ASSERT( aInvertRect.IsEmpty(), "DoInvertRect nicht paarig" ); 308cdf0e10cSrcweir 309cdf0e10cSrcweir aInvertRect = rPixel; // neues Rechteck merken 310cdf0e10cSrcweir } 311cdf0e10cSrcweir 312cdf0e10cSrcweir UpdateHeaderOverlay(); // uses aInvertRect 313cdf0e10cSrcweir } 314cdf0e10cSrcweir 315cdf0e10cSrcweir //------------------------------------------------------------------------ 316cdf0e10cSrcweir 317cdf0e10cSrcweir void __EXPORT ScGridWindow::PrePaint() 318cdf0e10cSrcweir { 319cdf0e10cSrcweir // forward PrePaint to DrawingLayer 320cdf0e10cSrcweir ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); 321cdf0e10cSrcweir 322cdf0e10cSrcweir if(pTabViewShell) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir SdrView* pDrawView = pTabViewShell->GetSdrView(); 325cdf0e10cSrcweir 326cdf0e10cSrcweir if(pDrawView) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir pDrawView->PrePaint(); 329cdf0e10cSrcweir } 330cdf0e10cSrcweir } 331cdf0e10cSrcweir } 332cdf0e10cSrcweir 333cdf0e10cSrcweir //------------------------------------------------------------------------ 334cdf0e10cSrcweir 335cdf0e10cSrcweir void __EXPORT ScGridWindow::Paint( const Rectangle& rRect ) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir //TODO/LATER: how to get environment? Do we need that?! 338cdf0e10cSrcweir /* 339cdf0e10cSrcweir ScDocShell* pDocSh = pViewData->GetDocShell(); 340cdf0e10cSrcweir SvInPlaceEnvironment* pEnv = pDocSh->GetIPEnv(); 341cdf0e10cSrcweir if (pEnv && pEnv->GetRectsChangedLockCount()) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir Invalidate(rRect); 344cdf0e10cSrcweir return; 345cdf0e10cSrcweir }*/ 346cdf0e10cSrcweir 347cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 348cdf0e10cSrcweir if ( pDoc->IsInInterpreter() ) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir // via Reschedule, interpretierende Zellen nicht nochmal anstossen 351cdf0e10cSrcweir // hier kein Invalidate, sonst kommt z.B. eine Error-Box nie an die Reihe 352cdf0e10cSrcweir // (Bug 36381). Durch bNeedsRepaint wird spaeter alles nochmal gemalt. 353cdf0e10cSrcweir 354cdf0e10cSrcweir if ( bNeedsRepaint ) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir //! Rechtecke zusammenfassen? 357cdf0e10cSrcweir aRepaintPixel = Rectangle(); // mehrfach -> alles painten 358cdf0e10cSrcweir } 359cdf0e10cSrcweir else 360cdf0e10cSrcweir { 361cdf0e10cSrcweir bNeedsRepaint = sal_True; 362cdf0e10cSrcweir aRepaintPixel = LogicToPixel(rRect); // nur betroffenen Bereich 363cdf0e10cSrcweir } 364cdf0e10cSrcweir return; 365cdf0e10cSrcweir } 366cdf0e10cSrcweir 367*edef121bSMichael Stahl // #i117893# If GetSizePixel needs to call the resize handler, the resulting nested Paint call 368*edef121bSMichael Stahl // (possibly for a larger rectangle) has to be allowed. Call GetSizePixel before setting bIsInPaint. 369*edef121bSMichael Stahl GetSizePixel(); 370*edef121bSMichael Stahl 371cdf0e10cSrcweir if (bIsInPaint) 372cdf0e10cSrcweir return; 373cdf0e10cSrcweir 374cdf0e10cSrcweir bIsInPaint = sal_True; 375cdf0e10cSrcweir 376cdf0e10cSrcweir Rectangle aPixRect = LogicToPixel( rRect ); 377cdf0e10cSrcweir 378cdf0e10cSrcweir SCCOL nX1 = pViewData->GetPosX(eHWhich); 379cdf0e10cSrcweir SCROW nY1 = pViewData->GetPosY(eVWhich); 380cdf0e10cSrcweir 381cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 382cdf0e10cSrcweir 383cdf0e10cSrcweir double nPPTX = pViewData->GetPPTX(); 384cdf0e10cSrcweir double nPPTY = pViewData->GetPPTY(); 385cdf0e10cSrcweir 386cdf0e10cSrcweir Rectangle aMirroredPixel = aPixRect; 387cdf0e10cSrcweir if ( pDoc->IsLayoutRTL( nTab ) ) 388cdf0e10cSrcweir { 389cdf0e10cSrcweir // mirror and swap 390cdf0e10cSrcweir long nWidth = GetSizePixel().Width(); 391cdf0e10cSrcweir aMirroredPixel.Left() = nWidth - 1 - aPixRect.Right(); 392cdf0e10cSrcweir aMirroredPixel.Right() = nWidth - 1 - aPixRect.Left(); 393cdf0e10cSrcweir } 394cdf0e10cSrcweir 395cdf0e10cSrcweir long nScrX = ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX ); 396cdf0e10cSrcweir while ( nScrX <= aMirroredPixel.Left() && nX1 < MAXCOL ) 397cdf0e10cSrcweir { 398cdf0e10cSrcweir ++nX1; 399cdf0e10cSrcweir nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX ); 400cdf0e10cSrcweir } 401cdf0e10cSrcweir SCCOL nX2 = nX1; 402cdf0e10cSrcweir while ( nScrX <= aMirroredPixel.Right() && nX2 < MAXCOL ) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir ++nX2; 405cdf0e10cSrcweir nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX2, nTab ), nPPTX ); 406cdf0e10cSrcweir } 407cdf0e10cSrcweir 408cdf0e10cSrcweir long nScrY = 0; 409cdf0e10cSrcweir ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, MAXROW, nPPTY, pDoc, nTab); 410cdf0e10cSrcweir SCROW nY2 = nY1; 411cdf0e10cSrcweir if (nScrY <= aPixRect.Bottom() && nY2 < MAXROW) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir ++nY2; 414cdf0e10cSrcweir ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab); 415cdf0e10cSrcweir } 416cdf0e10cSrcweir 417cdf0e10cSrcweir Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS ); // nicht weiterzeichnen 418cdf0e10cSrcweir 419cdf0e10cSrcweir bIsInPaint = sal_False; 420cdf0e10cSrcweir } 421cdf0e10cSrcweir 422cdf0e10cSrcweir // 423cdf0e10cSrcweir // Draw ---------------------------------------------------------------- 424cdf0e10cSrcweir // 425cdf0e10cSrcweir 426cdf0e10cSrcweir void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode ) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir ScModule* pScMod = SC_MOD(); 429cdf0e10cSrcweir sal_Bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg(); 430cdf0e10cSrcweir sal_Bool bGridFirst = sal_True; //! entscheiden!!! 431cdf0e10cSrcweir 432cdf0e10cSrcweir if (pViewData->IsMinimized()) 433cdf0e10cSrcweir return; 434cdf0e10cSrcweir 435cdf0e10cSrcweir PutInOrder( nX1, nX2 ); 436cdf0e10cSrcweir PutInOrder( nY1, nY2 ); 437cdf0e10cSrcweir 438cdf0e10cSrcweir DBG_ASSERT( ValidCol(nX2) && ValidRow(nY2), "GridWin Draw Bereich zu gross" ); 439cdf0e10cSrcweir 440cdf0e10cSrcweir SCCOL nPosX = pViewData->GetPosX( eHWhich ); 441cdf0e10cSrcweir SCROW nPosY = pViewData->GetPosY( eVWhich ); 442cdf0e10cSrcweir if (nX2 < nPosX || nY2 < nPosY) 443cdf0e10cSrcweir return; // unsichtbar 444cdf0e10cSrcweir if (nX1 < nPosX) nX1 = nPosX; 445cdf0e10cSrcweir if (nY1 < nPosY) nY1 = nPosY; 446cdf0e10cSrcweir 447cdf0e10cSrcweir SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich); 448cdf0e10cSrcweir if (nXRight > MAXCOL) nXRight = MAXCOL; 449cdf0e10cSrcweir SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich); 450cdf0e10cSrcweir if (nYBottom > MAXROW) nYBottom = MAXROW; 451cdf0e10cSrcweir 452cdf0e10cSrcweir // Store the current visible range. 453cdf0e10cSrcweir maVisibleRange.mnCol1 = nPosX; 454cdf0e10cSrcweir maVisibleRange.mnCol2 = nXRight; 455cdf0e10cSrcweir maVisibleRange.mnRow1 = nPosY; 456cdf0e10cSrcweir maVisibleRange.mnRow2 = nYBottom; 457cdf0e10cSrcweir 458cdf0e10cSrcweir if (nX1 > nXRight || nY1 > nYBottom) 459cdf0e10cSrcweir return; // unsichtbar 460cdf0e10cSrcweir if (nX2 > nXRight) nX2 = nXRight; 461cdf0e10cSrcweir if (nY2 > nYBottom) nY2 = nYBottom; 462cdf0e10cSrcweir 463cdf0e10cSrcweir if ( eMode != SC_UPDATE_MARKS ) 464cdf0e10cSrcweir if (nX2 < nXRight) 465cdf0e10cSrcweir nX2 = nXRight; // zum Weiterzeichnen 466cdf0e10cSrcweir 467cdf0e10cSrcweir // ab hier kein return mehr 468cdf0e10cSrcweir 469cdf0e10cSrcweir ++nPaintCount; // merken, dass gemalt wird (wichtig beim Invertieren) 470cdf0e10cSrcweir 471cdf0e10cSrcweir ScDocShell* pDocSh = pViewData->GetDocShell(); 472cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument(); 473cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 474cdf0e10cSrcweir 475cdf0e10cSrcweir pDoc->ExtendHidden( nX1, nY1, nX2, nY2, nTab ); 476cdf0e10cSrcweir 477cdf0e10cSrcweir Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); 478cdf0e10cSrcweir long nMirrorWidth = GetSizePixel().Width(); 479cdf0e10cSrcweir sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 480cdf0e10cSrcweir long nLayoutSign = bLayoutRTL ? -1 : 1; 481cdf0e10cSrcweir if ( bLayoutRTL ) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir long nEndPixel = pViewData->GetScrPos( nX2+1, nPosY, eWhich ).X(); 484cdf0e10cSrcweir nMirrorWidth = aScrPos.X() - nEndPixel; 485cdf0e10cSrcweir aScrPos.X() = nEndPixel + 1; 486cdf0e10cSrcweir } 487cdf0e10cSrcweir 488cdf0e10cSrcweir long nScrX = aScrPos.X(); 489cdf0e10cSrcweir long nScrY = aScrPos.Y(); 490cdf0e10cSrcweir 491cdf0e10cSrcweir SCCOL nCurX = pViewData->GetCurX(); 492cdf0e10cSrcweir SCROW nCurY = pViewData->GetCurY(); 493cdf0e10cSrcweir SCCOL nCurEndX = nCurX; 494cdf0e10cSrcweir SCROW nCurEndY = nCurY; 495cdf0e10cSrcweir pDoc->ExtendMerge( nCurX, nCurY, nCurEndX, nCurEndY, nTab ); 496cdf0e10cSrcweir sal_Bool bCurVis = nCursorHideCount==0 && 497cdf0e10cSrcweir ( nCurEndX+1 >= nX1 && nCurX <= nX2+1 && nCurEndY+1 >= nY1 && nCurY <= nY2+1 ); 498cdf0e10cSrcweir 499cdf0e10cSrcweir // AutoFill-Anfasser 500cdf0e10cSrcweir if ( !bCurVis && nCursorHideCount==0 && bAutoMarkVisible && aAutoMarkPos.Tab() == nTab && 501cdf0e10cSrcweir ( aAutoMarkPos.Col() != nCurX || aAutoMarkPos.Row() != nCurY ) ) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir SCCOL nHdlX = aAutoMarkPos.Col(); 504cdf0e10cSrcweir SCROW nHdlY = aAutoMarkPos.Row(); 505cdf0e10cSrcweir pDoc->ExtendMerge( nHdlX, nHdlY, nHdlX, nHdlY, nTab ); 506cdf0e10cSrcweir bCurVis = ( nHdlX+1 >= nX1 && nHdlX <= nX2 && nHdlY+1 >= nY1 && nHdlY <= nY2 ); 507cdf0e10cSrcweir // links und oben ist nicht betroffen 508cdf0e10cSrcweir 509cdf0e10cSrcweir //! AutoFill-Anfasser alleine (ohne Cursor) zeichnen ??? 510cdf0e10cSrcweir } 511cdf0e10cSrcweir 512cdf0e10cSrcweir double nPPTX = pViewData->GetPPTX(); 513cdf0e10cSrcweir double nPPTY = pViewData->GetPPTY(); 514cdf0e10cSrcweir 515cdf0e10cSrcweir const ScViewOptions& rOpts = pViewData->GetOptions(); 516cdf0e10cSrcweir sal_Bool bFormulaMode = rOpts.GetOption( VOPT_FORMULAS ); 517cdf0e10cSrcweir sal_Bool bMarkClipped = rOpts.GetOption( VOPT_CLIPMARKS ); 518cdf0e10cSrcweir 519cdf0e10cSrcweir // Datenblock 520cdf0e10cSrcweir 521cdf0e10cSrcweir ScTableInfo aTabInfo; 522cdf0e10cSrcweir pDoc->FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, 523cdf0e10cSrcweir nPPTX, nPPTY, sal_False, bFormulaMode, 524cdf0e10cSrcweir &pViewData->GetMarkData() ); 525cdf0e10cSrcweir 526cdf0e10cSrcweir //-------------------------------------------------------------------- 527cdf0e10cSrcweir 528cdf0e10cSrcweir Fraction aZoomX = pViewData->GetZoomX(); 529cdf0e10cSrcweir Fraction aZoomY = pViewData->GetZoomY(); 530cdf0e10cSrcweir ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, 531cdf0e10cSrcweir nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, 532cdf0e10cSrcweir &aZoomX, &aZoomY ); 533cdf0e10cSrcweir 534cdf0e10cSrcweir aOutputData.SetMirrorWidth( nMirrorWidth ); // needed for RTL 535cdf0e10cSrcweir 536cdf0e10cSrcweir std::auto_ptr< VirtualDevice > xFmtVirtDev; 537cdf0e10cSrcweir sal_Bool bLogicText = bTextWysiwyg; // call DrawStrings in logic MapMode? 538cdf0e10cSrcweir 539cdf0e10cSrcweir if ( bTextWysiwyg ) 540cdf0e10cSrcweir { 541cdf0e10cSrcweir // use printer for text formatting 542cdf0e10cSrcweir 543cdf0e10cSrcweir OutputDevice* pFmtDev = pDoc->GetPrinter(); 544cdf0e10cSrcweir pFmtDev->SetMapMode( pViewData->GetLogicMode(eWhich) ); 545cdf0e10cSrcweir aOutputData.SetFmtDevice( pFmtDev ); 546cdf0e10cSrcweir } 547cdf0e10cSrcweir else if ( aZoomX != aZoomY && pViewData->IsOle() ) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir // #i45033# For OLE inplace editing with different zoom factors, 550cdf0e10cSrcweir // use a virtual device with 1/100th mm as text formatting reference 551cdf0e10cSrcweir 552cdf0e10cSrcweir xFmtVirtDev.reset( new VirtualDevice ); 553cdf0e10cSrcweir xFmtVirtDev->SetMapMode( MAP_100TH_MM ); 554cdf0e10cSrcweir aOutputData.SetFmtDevice( xFmtVirtDev.get() ); 555cdf0e10cSrcweir 556cdf0e10cSrcweir bLogicText = sal_True; // use logic MapMode 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig(); 560cdf0e10cSrcweir Color aGridColor( rColorCfg.GetColorValue( svtools::CALCGRID, sal_False ).nColor ); 561cdf0e10cSrcweir if ( aGridColor.GetColor() == COL_TRANSPARENT ) 562cdf0e10cSrcweir { 563cdf0e10cSrcweir // use view options' grid color only if color config has "automatic" color 564cdf0e10cSrcweir aGridColor = rOpts.GetGridColor(); 565cdf0e10cSrcweir } 566cdf0e10cSrcweir 567cdf0e10cSrcweir aOutputData.SetSyntaxMode ( pViewData->IsSyntaxMode() ); 568cdf0e10cSrcweir aOutputData.SetGridColor ( aGridColor ); 569cdf0e10cSrcweir aOutputData.SetShowNullValues ( rOpts.GetOption( VOPT_NULLVALS ) ); 570cdf0e10cSrcweir aOutputData.SetShowFormulas ( bFormulaMode ); 571cdf0e10cSrcweir aOutputData.SetShowSpellErrors ( pDoc->GetDocOptions().IsAutoSpell() ); 572cdf0e10cSrcweir aOutputData.SetMarkClipped ( bMarkClipped ); 573cdf0e10cSrcweir 574cdf0e10cSrcweir aOutputData.SetUseStyleColor( sal_True ); // always set in table view 575cdf0e10cSrcweir 576cdf0e10cSrcweir aOutputData.SetEditObject( GetEditObject() ); 577cdf0e10cSrcweir aOutputData.SetViewShell( pViewData->GetViewShell() ); 578cdf0e10cSrcweir 579cdf0e10cSrcweir sal_Bool bGrid = rOpts.GetOption( VOPT_GRID ); 580cdf0e10cSrcweir sal_Bool bPage = rOpts.GetOption( VOPT_PAGEBREAKS ); 581cdf0e10cSrcweir 582cdf0e10cSrcweir if ( eMode == SC_UPDATE_CHANGED ) 583cdf0e10cSrcweir { 584cdf0e10cSrcweir aOutputData.FindChanged(); 585cdf0e10cSrcweir aOutputData.SetSingleGrid(sal_True); 586cdf0e10cSrcweir } 587cdf0e10cSrcweir 588cdf0e10cSrcweir sal_Bool bPageMode = pViewData->IsPagebreakMode(); 589cdf0e10cSrcweir if (bPageMode) // nach FindChanged 590cdf0e10cSrcweir { 591cdf0e10cSrcweir // SetPagebreakMode initialisiert auch bPrinted Flags 592cdf0e10cSrcweir aOutputData.SetPagebreakMode( pViewData->GetView()->GetPageBreakData() ); 593cdf0e10cSrcweir } 594cdf0e10cSrcweir 595cdf0e10cSrcweir EditView* pEditView = NULL; 596cdf0e10cSrcweir sal_Bool bEditMode = pViewData->HasEditView(eWhich); 597cdf0e10cSrcweir if ( bEditMode && pViewData->GetRefTabNo() == nTab ) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir SCCOL nEditCol; 600cdf0e10cSrcweir SCROW nEditRow; 601cdf0e10cSrcweir pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow ); 602cdf0e10cSrcweir SCCOL nEditEndCol = pViewData->GetEditEndCol(); 603cdf0e10cSrcweir SCROW nEditEndRow = pViewData->GetEditEndRow(); 604cdf0e10cSrcweir 605cdf0e10cSrcweir if ( nEditEndCol >= nX1 && nEditCol <= nX2 && nEditEndRow >= nY1 && nEditRow <= nY2 ) 606cdf0e10cSrcweir aOutputData.SetEditCell( nEditCol, nEditRow ); 607cdf0e10cSrcweir else 608cdf0e10cSrcweir bEditMode = sal_False; 609cdf0e10cSrcweir 610cdf0e10cSrcweir // nur Edit-Area zu zeichnen? 611cdf0e10cSrcweir //! dann muss trotzdem noch der Rand / das Gitter gemalt werden! 612cdf0e10cSrcweir 613cdf0e10cSrcweir // if ( nEditCol <= nX1 && nEditEndCol >= nX2 && nEditRow <= nY1 && nEditEndRow >= nY2 ) 614cdf0e10cSrcweir // bOnlyEdit = sal_True; 615cdf0e10cSrcweir } 616cdf0e10cSrcweir 617cdf0e10cSrcweir // define drawing layer map mode and paint rectangle 618cdf0e10cSrcweir const MapMode aDrawMode = GetDrawMapMode(); 619cdf0e10cSrcweir Rectangle aDrawingRectLogic; 620cdf0e10cSrcweir 621cdf0e10cSrcweir { 622cdf0e10cSrcweir // get drawing pixel rect 623cdf0e10cSrcweir Rectangle aDrawingRectPixel(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH())); 624cdf0e10cSrcweir 625cdf0e10cSrcweir // correct for border (left/right) 626cdf0e10cSrcweir if(MAXCOL == nX2) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir if(bLayoutRTL) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir aDrawingRectPixel.Left() = 0L; 631cdf0e10cSrcweir } 632cdf0e10cSrcweir else 633cdf0e10cSrcweir { 634cdf0e10cSrcweir aDrawingRectPixel.Right() = GetOutputSizePixel().getWidth(); 635cdf0e10cSrcweir } 636cdf0e10cSrcweir } 637cdf0e10cSrcweir 638cdf0e10cSrcweir // correct for border (bottom) 639cdf0e10cSrcweir if(MAXROW == nY2) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir aDrawingRectPixel.Bottom() = GetOutputSizePixel().getHeight(); 642cdf0e10cSrcweir } 643cdf0e10cSrcweir 644cdf0e10cSrcweir // get logic positions 645cdf0e10cSrcweir aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir 648cdf0e10cSrcweir // not necessary with overlay 649cdf0e10cSrcweir // if (bCurVis) 650cdf0e10cSrcweir // HideCursor(); 651cdf0e10cSrcweir 652cdf0e10cSrcweir OutputDevice* pContentDev = this; // device for document content, used by overlay manager 653cdf0e10cSrcweir SdrPaintWindow* pTargetPaintWindow = 0; // #i74769# work with SdrPaintWindow directly 654cdf0e10cSrcweir 655cdf0e10cSrcweir { 656cdf0e10cSrcweir // init redraw 657cdf0e10cSrcweir ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); 658cdf0e10cSrcweir 659cdf0e10cSrcweir if(pTabViewShell) 660cdf0e10cSrcweir { 661cdf0e10cSrcweir MapMode aCurrentMapMode(pContentDev->GetMapMode()); 662cdf0e10cSrcweir pContentDev->SetMapMode(aDrawMode); 663cdf0e10cSrcweir SdrView* pDrawView = pTabViewShell->GetSdrView(); 664cdf0e10cSrcweir 665cdf0e10cSrcweir if(pDrawView) 666cdf0e10cSrcweir { 667cdf0e10cSrcweir // #i74769# Use new BeginDrawLayers() interface 668cdf0e10cSrcweir Region aDrawingRegion(aDrawingRectLogic); 669cdf0e10cSrcweir pTargetPaintWindow = pDrawView->BeginDrawLayers(this, aDrawingRegion); 670cdf0e10cSrcweir OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)"); 671cdf0e10cSrcweir 672cdf0e10cSrcweir // #i74769# get target device from SdrPaintWindow, this may be the prerender 673cdf0e10cSrcweir // device now, too. 674cdf0e10cSrcweir pContentDev = &(pTargetPaintWindow->GetTargetOutputDevice()); 675cdf0e10cSrcweir aOutputData.SetContentDevice( pContentDev ); 676cdf0e10cSrcweir } 677cdf0e10cSrcweir 678cdf0e10cSrcweir pContentDev->SetMapMode(aCurrentMapMode); 679cdf0e10cSrcweir } 680cdf0e10cSrcweir } 681cdf0e10cSrcweir 682cdf0e10cSrcweir // Rand (Wiese) (Pixel) 683cdf0e10cSrcweir if ( nX2==MAXCOL || nY2==MAXROW ) 684cdf0e10cSrcweir { 685cdf0e10cSrcweir // save MapMode and set to pixel 686cdf0e10cSrcweir MapMode aCurrentMapMode(pContentDev->GetMapMode()); 687cdf0e10cSrcweir pContentDev->SetMapMode(MAP_PIXEL); 688cdf0e10cSrcweir 689cdf0e10cSrcweir Rectangle aPixRect = Rectangle( Point(), GetOutputSizePixel() ); 690cdf0e10cSrcweir pContentDev->SetFillColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor ); 691cdf0e10cSrcweir pContentDev->SetLineColor(); 692cdf0e10cSrcweir if ( nX2==MAXCOL ) 693cdf0e10cSrcweir { 694cdf0e10cSrcweir Rectangle aDrawRect( aPixRect ); 695cdf0e10cSrcweir if ( bLayoutRTL ) 696cdf0e10cSrcweir aDrawRect.Right() = nScrX - 1; 697cdf0e10cSrcweir else 698cdf0e10cSrcweir aDrawRect.Left() = nScrX + aOutputData.GetScrW(); 699cdf0e10cSrcweir if (aDrawRect.Right() >= aDrawRect.Left()) 700cdf0e10cSrcweir pContentDev->DrawRect( aDrawRect ); 701cdf0e10cSrcweir } 702cdf0e10cSrcweir if ( nY2==MAXROW ) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir Rectangle aDrawRect( aPixRect ); 705cdf0e10cSrcweir aDrawRect.Top() = nScrY + aOutputData.GetScrH(); 706cdf0e10cSrcweir if ( nX2==MAXCOL ) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir // no double painting of the corner 709cdf0e10cSrcweir if ( bLayoutRTL ) 710cdf0e10cSrcweir aDrawRect.Left() = nScrX; 711cdf0e10cSrcweir else 712cdf0e10cSrcweir aDrawRect.Right() = nScrX + aOutputData.GetScrW() - 1; 713cdf0e10cSrcweir } 714cdf0e10cSrcweir if (aDrawRect.Bottom() >= aDrawRect.Top()) 715cdf0e10cSrcweir pContentDev->DrawRect( aDrawRect ); 716cdf0e10cSrcweir } 717cdf0e10cSrcweir 718cdf0e10cSrcweir // restore MapMode 719cdf0e10cSrcweir pContentDev->SetMapMode(aCurrentMapMode); 720cdf0e10cSrcweir } 721cdf0e10cSrcweir 722cdf0e10cSrcweir if ( pDoc->HasBackgroundDraw( nTab, aDrawingRectLogic ) ) 723cdf0e10cSrcweir { 724cdf0e10cSrcweir pContentDev->SetMapMode(MAP_PIXEL); 725cdf0e10cSrcweir aOutputData.DrawClear(); 726cdf0e10cSrcweir 727cdf0e10cSrcweir // Drawing Hintergrund 728cdf0e10cSrcweir 729cdf0e10cSrcweir pContentDev->SetMapMode(aDrawMode); 730cdf0e10cSrcweir DrawRedraw( aOutputData, eMode, SC_LAYER_BACK ); 731cdf0e10cSrcweir } 732cdf0e10cSrcweir else 733cdf0e10cSrcweir aOutputData.SetSolidBackground(sal_True); 734cdf0e10cSrcweir 735cdf0e10cSrcweir pContentDev->SetMapMode(MAP_PIXEL); 736cdf0e10cSrcweir aOutputData.DrawBackground(); 737cdf0e10cSrcweir if ( bGridFirst && ( bGrid || bPage ) ) 738cdf0e10cSrcweir aOutputData.DrawGrid( bGrid, bPage ); 739cdf0e10cSrcweir if ( bPageMode ) 740cdf0e10cSrcweir { 741cdf0e10cSrcweir // #87655# DrawPagePreview draws complete lines/page numbers, must always be clipped 742cdf0e10cSrcweir if ( aOutputData.SetChangedClip() ) 743cdf0e10cSrcweir { 744cdf0e10cSrcweir DrawPagePreview(nX1,nY1,nX2,nY2, pContentDev); 745cdf0e10cSrcweir pContentDev->SetClipRegion(); 746cdf0e10cSrcweir } 747cdf0e10cSrcweir } 748cdf0e10cSrcweir aOutputData.DrawShadow(); 749cdf0e10cSrcweir aOutputData.DrawFrame(); 750cdf0e10cSrcweir if ( !bLogicText ) 751cdf0e10cSrcweir aOutputData.DrawStrings(sal_False); // in pixel MapMode 752cdf0e10cSrcweir 753cdf0e10cSrcweir // edit cells and printer-metrics text must be before the buttons 754cdf0e10cSrcweir // (DataPilot buttons contain labels in UI font) 755cdf0e10cSrcweir 756cdf0e10cSrcweir pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich)); 757cdf0e10cSrcweir if ( bLogicText ) 758cdf0e10cSrcweir aOutputData.DrawStrings(sal_True); // in logic MapMode if bTextWysiwyg is set 759cdf0e10cSrcweir aOutputData.DrawEdit(sal_True); 760cdf0e10cSrcweir pContentDev->SetMapMode(MAP_PIXEL); 761cdf0e10cSrcweir 762cdf0e10cSrcweir // Autofilter- und Pivot-Buttons 763cdf0e10cSrcweir 764cdf0e10cSrcweir DrawButtons( nX1, nY1, nX2, nY2, aTabInfo, pContentDev ); // Pixel 765cdf0e10cSrcweir 766cdf0e10cSrcweir // Notiz-Anzeiger 767cdf0e10cSrcweir 768cdf0e10cSrcweir if ( rOpts.GetOption( VOPT_NOTES ) ) 769cdf0e10cSrcweir aOutputData.DrawNoteMarks(); 770cdf0e10cSrcweir 771cdf0e10cSrcweir if ( !bGridFirst && ( bGrid || bPage ) ) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir aOutputData.DrawGrid( bGrid, bPage ); 774cdf0e10cSrcweir } 775cdf0e10cSrcweir aOutputData.DrawClipMarks(); 776cdf0e10cSrcweir 777cdf0e10cSrcweir // Szenario / ChangeTracking muss auf jeden Fall nach DrawGrid sein, auch bei !bGridFirst 778cdf0e10cSrcweir 779cdf0e10cSrcweir //! Test, ob ChangeTrack-Anzeige aktiv ist 780cdf0e10cSrcweir //! Szenario-Rahmen per View-Optionen abschaltbar? 781cdf0e10cSrcweir 782cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 783cdf0e10cSrcweir ScHighlightRanges* pHigh = pViewData->GetView()->GetHighlightRanges(); 784cdf0e10cSrcweir sal_Bool bHasScenario = ( nTab+1<nTabCount && pDoc->IsScenario(nTab+1) && !pDoc->IsScenario(nTab) ); 785cdf0e10cSrcweir sal_Bool bHasChange = ( pDoc->GetChangeTrack() != NULL ); 786cdf0e10cSrcweir 787cdf0e10cSrcweir if ( bHasChange || bHasScenario || pHigh != NULL ) 788cdf0e10cSrcweir { 789cdf0e10cSrcweir 790cdf0e10cSrcweir //! SetChangedClip() mit DrawMarks() zusammenfassen?? (anderer MapMode!) 791cdf0e10cSrcweir 792cdf0e10cSrcweir sal_Bool bAny = sal_True; 793cdf0e10cSrcweir if (eMode == SC_UPDATE_CHANGED) 794cdf0e10cSrcweir bAny = aOutputData.SetChangedClip(); 795cdf0e10cSrcweir if (bAny) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir if ( bHasChange ) 798cdf0e10cSrcweir aOutputData.DrawChangeTrack(); 799cdf0e10cSrcweir 800cdf0e10cSrcweir if ( bHasScenario ) 801cdf0e10cSrcweir lcl_DrawScenarioFrames( pContentDev, pViewData, eWhich, nX1,nY1,nX2,nY2 ); 802cdf0e10cSrcweir 803cdf0e10cSrcweir if ( pHigh ) 804cdf0e10cSrcweir lcl_DrawHighlight( aOutputData, pViewData, *pHigh ); 805cdf0e10cSrcweir 806cdf0e10cSrcweir if (eMode == SC_UPDATE_CHANGED) 807cdf0e10cSrcweir pContentDev->SetClipRegion(); 808cdf0e10cSrcweir } 809cdf0e10cSrcweir } 810cdf0e10cSrcweir 811cdf0e10cSrcweir // Drawing Vordergrund 812cdf0e10cSrcweir 813cdf0e10cSrcweir pContentDev->SetMapMode(aDrawMode); 814cdf0e10cSrcweir 815cdf0e10cSrcweir DrawRedraw( aOutputData, eMode, SC_LAYER_FRONT ); 816cdf0e10cSrcweir DrawRedraw( aOutputData, eMode, SC_LAYER_INTERN ); 817cdf0e10cSrcweir DrawSdrGrid( aDrawingRectLogic, pContentDev ); 818cdf0e10cSrcweir 819cdf0e10cSrcweir if (!bIsInScroll) // Drawing Markierungen 820cdf0e10cSrcweir { 821cdf0e10cSrcweir if(eMode == SC_UPDATE_CHANGED && aOutputData.SetChangedClip()) 822cdf0e10cSrcweir { 823cdf0e10cSrcweir pContentDev->SetClipRegion(); 824cdf0e10cSrcweir } 825cdf0e10cSrcweir 826cdf0e10cSrcweir //sal_Bool bDraw = sal_True; 827cdf0e10cSrcweir //if (eMode == SC_UPDATE_CHANGED) 828cdf0e10cSrcweir // bDraw = NeedDrawMarks() && aOutputData.SetChangedClip(); 829cdf0e10cSrcweir //if (bDraw) 830cdf0e10cSrcweir //{ 831cdf0e10cSrcweir // DrawMarks(); 832cdf0e10cSrcweir // if (eMode == SC_UPDATE_CHANGED) 833cdf0e10cSrcweir // pContentDev->SetClipRegion(); 834cdf0e10cSrcweir //} 835cdf0e10cSrcweir } 836cdf0e10cSrcweir 837cdf0e10cSrcweir pContentDev->SetMapMode(MAP_PIXEL); 838cdf0e10cSrcweir 839cdf0e10cSrcweir #ifdef OLD_SELECTION_PAINT 840cdf0e10cSrcweir if (pViewData->IsActive()) 841cdf0e10cSrcweir aOutputData.DrawMark( this ); 842cdf0e10cSrcweir #endif 843cdf0e10cSrcweir 844cdf0e10cSrcweir if ( pViewData->IsRefMode() && nTab >= pViewData->GetRefStartZ() && nTab <= pViewData->GetRefEndZ() ) 845cdf0e10cSrcweir { 846cdf0e10cSrcweir // The AutoFill shrink area has an own overlay now 847cdf0e10cSrcweir #if 0 848cdf0e10cSrcweir // Schraffur beim Loeschen per AutoFill 849cdf0e10cSrcweir if ( pViewData->GetRefType() == SC_REFTYPE_FILL ) 850cdf0e10cSrcweir { 851cdf0e10cSrcweir ScRange aRange; 852cdf0e10cSrcweir if ( pViewData->GetDelMark( aRange ) ) 853cdf0e10cSrcweir { 854cdf0e10cSrcweir if ( aRange.aStart.Col() < nX1 ) aRange.aStart.SetCol(nX1); 855cdf0e10cSrcweir if ( aRange.aEnd.Col() > nX2 ) aRange.aEnd.SetCol(nX2); 856cdf0e10cSrcweir if ( aRange.aStart.Row() < nY1 ) aRange.aStart.SetRow(nY1); 857cdf0e10cSrcweir if ( aRange.aEnd.Row() > nY2 ) aRange.aEnd.SetRow(nY2); 858cdf0e10cSrcweir if ( aRange.aStart.Col() <= aRange.aEnd.Col() && 859cdf0e10cSrcweir aRange.aStart.Row() <= aRange.aEnd.Row() ) 860cdf0e10cSrcweir { 861cdf0e10cSrcweir Point aStart = pViewData->GetScrPos( aRange.aStart.Col(), 862cdf0e10cSrcweir aRange.aStart.Row(), eWhich ); 863cdf0e10cSrcweir Point aEnd = pViewData->GetScrPos( aRange.aEnd.Col()+1, 864cdf0e10cSrcweir aRange.aEnd.Row()+1, eWhich ); 865cdf0e10cSrcweir aEnd.X() -= 1; 866cdf0e10cSrcweir aEnd.Y() -= 1; 867cdf0e10cSrcweir 868cdf0e10cSrcweir // Markierung aufheben - roter Rahmen bleibt stehen 869cdf0e10cSrcweir Rectangle aRect( aStart,aEnd ); 870cdf0e10cSrcweir Invert( aRect, INVERT_HIGHLIGHT ); 871cdf0e10cSrcweir 872cdf0e10cSrcweir //! Delete-Bereich extra kennzeichnen?!?!? 873cdf0e10cSrcweir } 874cdf0e10cSrcweir } 875cdf0e10cSrcweir } 876cdf0e10cSrcweir #endif 877cdf0e10cSrcweir 878cdf0e10cSrcweir Color aRefColor( rColorCfg.GetColorValue(svtools::CALCREFERENCE).nColor ); 879cdf0e10cSrcweir aOutputData.DrawRefMark( pViewData->GetRefStartX(), pViewData->GetRefStartY(), 880cdf0e10cSrcweir pViewData->GetRefEndX(), pViewData->GetRefEndY(), 881cdf0e10cSrcweir aRefColor, sal_False ); 882cdf0e10cSrcweir } 883cdf0e10cSrcweir 884cdf0e10cSrcweir // Range-Finder 885cdf0e10cSrcweir 886cdf0e10cSrcweir ScInputHandler* pHdl = pScMod->GetInputHdl( pViewData->GetViewShell() ); 887cdf0e10cSrcweir if (pHdl) 888cdf0e10cSrcweir { 889cdf0e10cSrcweir ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList(); 890cdf0e10cSrcweir if ( pRangeFinder && !pRangeFinder->IsHidden() && 891cdf0e10cSrcweir pRangeFinder->GetDocName() == pDocSh->GetTitle() ) 892cdf0e10cSrcweir { 893cdf0e10cSrcweir sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count(); 894cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++) 895cdf0e10cSrcweir { 896cdf0e10cSrcweir ScRangeFindData* pData = pRangeFinder->GetObject(i); 897cdf0e10cSrcweir if (pData) 898cdf0e10cSrcweir { 899cdf0e10cSrcweir ScRange aRef = pData->aRef; 900cdf0e10cSrcweir aRef.Justify(); 901cdf0e10cSrcweir if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab ) 902cdf0e10cSrcweir aOutputData.DrawRefMark( aRef.aStart.Col(), aRef.aStart.Row(), 903cdf0e10cSrcweir aRef.aEnd.Col(), aRef.aEnd.Row(), 904cdf0e10cSrcweir Color( ScRangeFindList::GetColorName( i ) ), 905cdf0e10cSrcweir sal_True ); 906cdf0e10cSrcweir } 907cdf0e10cSrcweir } 908cdf0e10cSrcweir } 909cdf0e10cSrcweir } 910cdf0e10cSrcweir 911cdf0e10cSrcweir { 912cdf0e10cSrcweir // end redraw 913cdf0e10cSrcweir ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); 914cdf0e10cSrcweir 915cdf0e10cSrcweir if(pTabViewShell) 916cdf0e10cSrcweir { 917cdf0e10cSrcweir MapMode aCurrentMapMode(pContentDev->GetMapMode()); 918cdf0e10cSrcweir pContentDev->SetMapMode(aDrawMode); 919cdf0e10cSrcweir SdrView* pDrawView = pTabViewShell->GetSdrView(); 920cdf0e10cSrcweir 921cdf0e10cSrcweir if(pDrawView) 922cdf0e10cSrcweir { 923cdf0e10cSrcweir // #i74769# work with SdrPaintWindow directly 924cdf0e10cSrcweir pDrawView->EndDrawLayers(*pTargetPaintWindow, true); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir 927cdf0e10cSrcweir pContentDev->SetMapMode(aCurrentMapMode); 928cdf0e10cSrcweir } 929cdf0e10cSrcweir } 930cdf0e10cSrcweir 931cdf0e10cSrcweir // InPlace Edit-View 932cdf0e10cSrcweir // moved after EndDrawLayers() to get it outside the overlay buffer and 933cdf0e10cSrcweir // on top of everything 934cdf0e10cSrcweir if ( bEditMode && (pViewData->GetRefTabNo() == pViewData->GetTabNo()) ) 935cdf0e10cSrcweir { 936cdf0e10cSrcweir //! use pContentDev for EditView? 937cdf0e10cSrcweir SetMapMode(MAP_PIXEL); 938cdf0e10cSrcweir SCCOL nCol1 = pViewData->GetEditStartCol(); 939cdf0e10cSrcweir SCROW nRow1 = pViewData->GetEditStartRow(); 940cdf0e10cSrcweir SCCOL nCol2 = pViewData->GetEditEndCol(); 941cdf0e10cSrcweir SCROW nRow2 = pViewData->GetEditEndRow(); 942cdf0e10cSrcweir SetLineColor(); 943cdf0e10cSrcweir SetFillColor( pEditView->GetBackgroundColor() ); 944cdf0e10cSrcweir Point aStart = pViewData->GetScrPos( nCol1, nRow1, eWhich ); 945cdf0e10cSrcweir Point aEnd = pViewData->GetScrPos( nCol2+1, nRow2+1, eWhich ); 946cdf0e10cSrcweir aEnd.X() -= 2 * nLayoutSign; // don't overwrite grid 947cdf0e10cSrcweir aEnd.Y() -= 2; 948cdf0e10cSrcweir DrawRect( Rectangle( aStart,aEnd ) ); 949cdf0e10cSrcweir 950cdf0e10cSrcweir SetMapMode(pViewData->GetLogicMode()); 951cdf0e10cSrcweir pEditView->Paint( PixelToLogic( Rectangle( Point( nScrX, nScrY ), 952cdf0e10cSrcweir Size( aOutputData.GetScrW(), aOutputData.GetScrH() ) ) ) ); 953cdf0e10cSrcweir SetMapMode(MAP_PIXEL); 954cdf0e10cSrcweir } 955cdf0e10cSrcweir 956cdf0e10cSrcweir if (pViewData->HasEditView(eWhich)) 957cdf0e10cSrcweir { 958cdf0e10cSrcweir // flush OverlayManager before changing the MapMode 959cdf0e10cSrcweir flushOverlayManager(); 960cdf0e10cSrcweir 961cdf0e10cSrcweir // set MapMode for text edit 962cdf0e10cSrcweir SetMapMode(pViewData->GetLogicMode()); 963cdf0e10cSrcweir } 964cdf0e10cSrcweir else 965cdf0e10cSrcweir SetMapMode(aDrawMode); 966cdf0e10cSrcweir 967cdf0e10cSrcweir if ( pNoteMarker ) 968cdf0e10cSrcweir pNoteMarker->Draw(); // ueber den Cursor, im Drawing-MapMode 969cdf0e10cSrcweir 970cdf0e10cSrcweir //DrawStartTimer(); // fuer bunte Handles ohne System-Clipping 971cdf0e10cSrcweir 972cdf0e10cSrcweir // 973cdf0e10cSrcweir // Wenn waehrend des Paint etwas invertiert wurde (Selektion geaendert aus Basic-Macro), 974cdf0e10cSrcweir // ist das jetzt durcheinandergekommen und es muss neu gemalt werden 975cdf0e10cSrcweir // 976cdf0e10cSrcweir 977cdf0e10cSrcweir DBG_ASSERT(nPaintCount, "nPaintCount falsch"); 978cdf0e10cSrcweir --nPaintCount; 979cdf0e10cSrcweir if (!nPaintCount) 980cdf0e10cSrcweir CheckNeedsRepaint(); 981cdf0e10cSrcweir } 982cdf0e10cSrcweir 983cdf0e10cSrcweir void ScGridWindow::CheckNeedsRepaint() 984cdf0e10cSrcweir { 985cdf0e10cSrcweir // called at the end of painting, and from timer after background text width calculation 986cdf0e10cSrcweir 987cdf0e10cSrcweir if (bNeedsRepaint) 988cdf0e10cSrcweir { 989cdf0e10cSrcweir bNeedsRepaint = sal_False; 990cdf0e10cSrcweir if (aRepaintPixel.IsEmpty()) 991cdf0e10cSrcweir Invalidate(); 992cdf0e10cSrcweir else 993cdf0e10cSrcweir Invalidate(PixelToLogic(aRepaintPixel)); 994cdf0e10cSrcweir aRepaintPixel = Rectangle(); 995cdf0e10cSrcweir 996cdf0e10cSrcweir // selection function in status bar might also be invalid 997cdf0e10cSrcweir SfxBindings& rBindings = pViewData->GetBindings(); 998cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_SUM ); 999cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_SIZE ); 1000cdf0e10cSrcweir rBindings.Invalidate( SID_TABLE_CELL ); 1001cdf0e10cSrcweir } 1002cdf0e10cSrcweir } 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, OutputDevice* pContentDev ) 1005cdf0e10cSrcweir { 1006cdf0e10cSrcweir ScPageBreakData* pPageData = pViewData->GetView()->GetPageBreakData(); 1007cdf0e10cSrcweir if (pPageData) 1008cdf0e10cSrcweir { 1009cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 1010cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 1011cdf0e10cSrcweir Size aWinSize = GetOutputSizePixel(); 1012cdf0e10cSrcweir const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); 1013cdf0e10cSrcweir Color aManual( rColorCfg.GetColorValue(svtools::CALCPAGEBREAKMANUAL).nColor ); 1014cdf0e10cSrcweir Color aAutomatic( rColorCfg.GetColorValue(svtools::CALCPAGEBREAK).nColor ); 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir String aPageText = ScGlobal::GetRscString( STR_PAGE ); 1017cdf0e10cSrcweir if ( nPageScript == 0 ) 1018cdf0e10cSrcweir { 1019cdf0e10cSrcweir // get script type of translated "Page" string only once 1020cdf0e10cSrcweir nPageScript = pDoc->GetStringScriptType( aPageText ); 1021cdf0e10cSrcweir if (nPageScript == 0) 1022cdf0e10cSrcweir nPageScript = ScGlobal::GetDefaultScriptType(); 1023cdf0e10cSrcweir } 1024cdf0e10cSrcweir aPageText += ' '; 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir Font aFont; 1027cdf0e10cSrcweir ScEditEngineDefaulter* pEditEng = NULL; 1028cdf0e10cSrcweir const ScPatternAttr& rDefPattern = ((const ScPatternAttr&)pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)); 1029cdf0e10cSrcweir if ( nPageScript == SCRIPTTYPE_LATIN ) 1030cdf0e10cSrcweir { 1031cdf0e10cSrcweir // use single font and call DrawText directly 1032cdf0e10cSrcweir rDefPattern.GetFont( aFont, SC_AUTOCOL_BLACK ); 1033cdf0e10cSrcweir aFont.SetColor( Color( COL_LIGHTGRAY ) ); 1034cdf0e10cSrcweir // font size is set as needed 1035cdf0e10cSrcweir } 1036cdf0e10cSrcweir else 1037cdf0e10cSrcweir { 1038cdf0e10cSrcweir // use EditEngine to draw mixed-script string 1039cdf0e10cSrcweir pEditEng = new ScEditEngineDefaulter( EditEngine::CreatePool(), sal_True ); 1040cdf0e10cSrcweir pEditEng->SetRefMapMode( pContentDev->GetMapMode() ); 1041cdf0e10cSrcweir SfxItemSet* pEditDefaults = new SfxItemSet( pEditEng->GetEmptyItemSet() ); 1042cdf0e10cSrcweir rDefPattern.FillEditItemSet( pEditDefaults ); 1043cdf0e10cSrcweir pEditDefaults->Put( SvxColorItem( Color( COL_LIGHTGRAY ), EE_CHAR_COLOR ) ); 1044cdf0e10cSrcweir pEditEng->SetDefaults( pEditDefaults ); 1045cdf0e10cSrcweir } 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() ); 1048cdf0e10cSrcweir for (sal_uInt16 nPos=0; nPos<nCount; nPos++) 1049cdf0e10cSrcweir { 1050cdf0e10cSrcweir ScPrintRangeData& rData = pPageData->GetData(nPos); 1051cdf0e10cSrcweir ScRange aRange = rData.GetPrintRange(); 1052cdf0e10cSrcweir if ( aRange.aStart.Col() <= nX2+1 && aRange.aEnd.Col()+1 >= nX1 && 1053cdf0e10cSrcweir aRange.aStart.Row() <= nY2+1 && aRange.aEnd.Row()+1 >= nY1 ) 1054cdf0e10cSrcweir { 1055cdf0e10cSrcweir // 3 Pixel Rahmen um den Druckbereich 1056cdf0e10cSrcweir // (mittlerer Pixel auf den Gitterlinien) 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir pContentDev->SetLineColor(); 1059cdf0e10cSrcweir if (rData.IsAutomatic()) 1060cdf0e10cSrcweir pContentDev->SetFillColor( aAutomatic ); 1061cdf0e10cSrcweir else 1062cdf0e10cSrcweir pContentDev->SetFillColor( aManual ); 1063cdf0e10cSrcweir 1064cdf0e10cSrcweir Point aStart = pViewData->GetScrPos( 1065cdf0e10cSrcweir aRange.aStart.Col(), aRange.aStart.Row(), eWhich, sal_True ); 1066cdf0e10cSrcweir Point aEnd = pViewData->GetScrPos( 1067cdf0e10cSrcweir aRange.aEnd.Col() + 1, aRange.aEnd.Row() + 1, eWhich, sal_True ); 1068cdf0e10cSrcweir aStart.X() -= 2; 1069cdf0e10cSrcweir aStart.Y() -= 2; 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir // Ueberlaeufe verhindern: 1072cdf0e10cSrcweir if ( aStart.X() < -10 ) aStart.X() = -10; 1073cdf0e10cSrcweir if ( aStart.Y() < -10 ) aStart.Y() = -10; 1074cdf0e10cSrcweir if ( aEnd.X() > aWinSize.Width() + 10 ) 1075cdf0e10cSrcweir aEnd.X() = aWinSize.Width() + 10; 1076cdf0e10cSrcweir if ( aEnd.Y() > aWinSize.Height() + 10 ) 1077cdf0e10cSrcweir aEnd.Y() = aWinSize.Height() + 10; 1078cdf0e10cSrcweir 1079cdf0e10cSrcweir pContentDev->DrawRect( Rectangle( aStart, Point(aEnd.X(),aStart.Y()+2) ) ); 1080cdf0e10cSrcweir pContentDev->DrawRect( Rectangle( aStart, Point(aStart.X()+2,aEnd.Y()) ) ); 1081cdf0e10cSrcweir pContentDev->DrawRect( Rectangle( Point(aStart.X(),aEnd.Y()-2), aEnd ) ); 1082cdf0e10cSrcweir pContentDev->DrawRect( Rectangle( Point(aEnd.X()-2,aStart.Y()), aEnd ) ); 1083cdf0e10cSrcweir 1084cdf0e10cSrcweir // Seitenumbrueche 1085cdf0e10cSrcweir //! anders darstellen (gestrichelt ????) 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir size_t nColBreaks = rData.GetPagesX(); 1088cdf0e10cSrcweir const SCCOL* pColEnd = rData.GetPageEndX(); 1089cdf0e10cSrcweir size_t nColPos; 1090cdf0e10cSrcweir for (nColPos=0; nColPos+1<nColBreaks; nColPos++) 1091cdf0e10cSrcweir { 1092cdf0e10cSrcweir SCCOL nBreak = pColEnd[nColPos]+1; 1093cdf0e10cSrcweir if ( nBreak >= nX1 && nBreak <= nX2+1 ) 1094cdf0e10cSrcweir { 1095cdf0e10cSrcweir //! hidden suchen 1096cdf0e10cSrcweir if (pDoc->HasColBreak(nBreak, nTab) & BREAK_MANUAL) 1097cdf0e10cSrcweir pContentDev->SetFillColor( aManual ); 1098cdf0e10cSrcweir else 1099cdf0e10cSrcweir pContentDev->SetFillColor( aAutomatic ); 1100cdf0e10cSrcweir Point aBreak = pViewData->GetScrPos( 1101cdf0e10cSrcweir nBreak, aRange.aStart.Row(), eWhich, sal_True ); 1102cdf0e10cSrcweir pContentDev->DrawRect( Rectangle( aBreak.X()-1, aStart.Y(), aBreak.X(), aEnd.Y() ) ); 1103cdf0e10cSrcweir } 1104cdf0e10cSrcweir } 1105cdf0e10cSrcweir 1106cdf0e10cSrcweir size_t nRowBreaks = rData.GetPagesY(); 1107cdf0e10cSrcweir const SCROW* pRowEnd = rData.GetPageEndY(); 1108cdf0e10cSrcweir size_t nRowPos; 1109cdf0e10cSrcweir for (nRowPos=0; nRowPos+1<nRowBreaks; nRowPos++) 1110cdf0e10cSrcweir { 1111cdf0e10cSrcweir SCROW nBreak = pRowEnd[nRowPos]+1; 1112cdf0e10cSrcweir if ( nBreak >= nY1 && nBreak <= nY2+1 ) 1113cdf0e10cSrcweir { 1114cdf0e10cSrcweir //! hidden suchen 1115cdf0e10cSrcweir if (pDoc->HasRowBreak(nBreak, nTab) & BREAK_MANUAL) 1116cdf0e10cSrcweir pContentDev->SetFillColor( aManual ); 1117cdf0e10cSrcweir else 1118cdf0e10cSrcweir pContentDev->SetFillColor( aAutomatic ); 1119cdf0e10cSrcweir Point aBreak = pViewData->GetScrPos( 1120cdf0e10cSrcweir aRange.aStart.Col(), nBreak, eWhich, sal_True ); 1121cdf0e10cSrcweir pContentDev->DrawRect( Rectangle( aStart.X(), aBreak.Y()-1, aEnd.X(), aBreak.Y() ) ); 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir } 1124cdf0e10cSrcweir 1125cdf0e10cSrcweir // Seitenzahlen 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir SCROW nPrStartY = aRange.aStart.Row(); 1128cdf0e10cSrcweir for (nRowPos=0; nRowPos<nRowBreaks; nRowPos++) 1129cdf0e10cSrcweir { 1130cdf0e10cSrcweir SCROW nPrEndY = pRowEnd[nRowPos]; 1131cdf0e10cSrcweir if ( nPrEndY >= nY1 && nPrStartY <= nY2 ) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir SCCOL nPrStartX = aRange.aStart.Col(); 1134cdf0e10cSrcweir for (nColPos=0; nColPos<nColBreaks; nColPos++) 1135cdf0e10cSrcweir { 1136cdf0e10cSrcweir SCCOL nPrEndX = pColEnd[nColPos]; 1137cdf0e10cSrcweir if ( nPrEndX >= nX1 && nPrStartX <= nX2 ) 1138cdf0e10cSrcweir { 1139cdf0e10cSrcweir Point aPageStart = pViewData->GetScrPos( 1140cdf0e10cSrcweir nPrStartX, nPrStartY, eWhich, sal_True ); 1141cdf0e10cSrcweir Point aPageEnd = pViewData->GetScrPos( 1142cdf0e10cSrcweir nPrEndX+1,nPrEndY+1, eWhich, sal_True ); 1143cdf0e10cSrcweir 1144cdf0e10cSrcweir long nPageNo = rData.GetFirstPage(); 1145cdf0e10cSrcweir if ( rData.IsTopDown() ) 1146cdf0e10cSrcweir nPageNo += ((long)nColPos)*nRowBreaks+nRowPos; 1147cdf0e10cSrcweir else 1148cdf0e10cSrcweir nPageNo += ((long)nRowPos)*nColBreaks+nColPos; 1149cdf0e10cSrcweir String aPageStr = aPageText; 1150cdf0e10cSrcweir aPageStr += String::CreateFromInt32(nPageNo); 1151cdf0e10cSrcweir 1152cdf0e10cSrcweir if ( pEditEng ) 1153cdf0e10cSrcweir { 1154cdf0e10cSrcweir // find right font size with EditEngine 1155cdf0e10cSrcweir long nHeight = 100; 1156cdf0e10cSrcweir pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); 1157cdf0e10cSrcweir pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); 1158cdf0e10cSrcweir pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); 1159cdf0e10cSrcweir pEditEng->SetText( aPageStr ); 1160cdf0e10cSrcweir Size aSize100( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() ); 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir // 40% of width or 60% of height 1163cdf0e10cSrcweir long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width(); 1164cdf0e10cSrcweir long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height(); 1165cdf0e10cSrcweir nHeight = Min(nSizeX,nSizeY); 1166cdf0e10cSrcweir pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); 1167cdf0e10cSrcweir pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); 1168cdf0e10cSrcweir pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); 1169cdf0e10cSrcweir 1170cdf0e10cSrcweir // centered output with EditEngine 1171cdf0e10cSrcweir Size aTextSize( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() ); 1172cdf0e10cSrcweir Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2, 1173cdf0e10cSrcweir (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 ); 1174cdf0e10cSrcweir pEditEng->Draw( pContentDev, aPos ); 1175cdf0e10cSrcweir } 1176cdf0e10cSrcweir else 1177cdf0e10cSrcweir { 1178cdf0e10cSrcweir // find right font size for DrawText 1179cdf0e10cSrcweir aFont.SetSize( Size( 0,100 ) ); 1180cdf0e10cSrcweir pContentDev->SetFont( aFont ); 1181cdf0e10cSrcweir Size aSize100( pContentDev->GetTextWidth( aPageStr ), pContentDev->GetTextHeight() ); 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir // 40% of width or 60% of height 1184cdf0e10cSrcweir long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width(); 1185cdf0e10cSrcweir long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height(); 1186cdf0e10cSrcweir aFont.SetSize( Size( 0,Min(nSizeX,nSizeY) ) ); 1187cdf0e10cSrcweir pContentDev->SetFont( aFont ); 1188cdf0e10cSrcweir 1189cdf0e10cSrcweir // centered output with DrawText 1190cdf0e10cSrcweir Size aTextSize( pContentDev->GetTextWidth( aPageStr ), pContentDev->GetTextHeight() ); 1191cdf0e10cSrcweir Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2, 1192cdf0e10cSrcweir (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 ); 1193cdf0e10cSrcweir pContentDev->DrawText( aPos, aPageStr ); 1194cdf0e10cSrcweir } 1195cdf0e10cSrcweir } 1196cdf0e10cSrcweir nPrStartX = nPrEndX + 1; 1197cdf0e10cSrcweir } 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir nPrStartY = nPrEndY + 1; 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir } 1202cdf0e10cSrcweir } 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir delete pEditEng; 1205cdf0e10cSrcweir } 1206cdf0e10cSrcweir } 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2*/, ScTableInfo& rTabInfo, OutputDevice* pContentDev ) 1209cdf0e10cSrcweir { 1210cdf0e10cSrcweir aComboButton.SetOutputDevice( pContentDev ); 1211cdf0e10cSrcweir 1212cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 1213cdf0e10cSrcweir ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc); 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir SCCOL nCol; 1216cdf0e10cSrcweir SCROW nRow; 1217cdf0e10cSrcweir SCSIZE nArrY; 1218cdf0e10cSrcweir SCSIZE nQuery; 1219cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 1220cdf0e10cSrcweir ScDBData* pDBData = NULL; 1221cdf0e10cSrcweir ScQueryParam* pQueryParam = NULL; 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir RowInfo* pRowInfo = rTabInfo.mpRowInfo; 1224cdf0e10cSrcweir sal_uInt16 nArrCount = rTabInfo.mnArrCount; 1225cdf0e10cSrcweir 1226cdf0e10cSrcweir sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 1227cdf0e10cSrcweir 1228cdf0e10cSrcweir Point aOldPos = aComboButton.GetPosPixel(); // Zustand fuer MouseDown/Up 1229cdf0e10cSrcweir Size aOldSize = aComboButton.GetSizePixel(); // merken 1230cdf0e10cSrcweir 1231cdf0e10cSrcweir for (nArrY=1; nArrY+1<nArrCount; nArrY++) 1232cdf0e10cSrcweir { 1233cdf0e10cSrcweir if ( pRowInfo[nArrY].bAutoFilter && pRowInfo[nArrY].bChanged ) 1234cdf0e10cSrcweir { 1235cdf0e10cSrcweir RowInfo* pThisRowInfo = &pRowInfo[nArrY]; 1236cdf0e10cSrcweir 1237cdf0e10cSrcweir nRow = pThisRowInfo->nRowNo; 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir 1240cdf0e10cSrcweir for (nCol=nX1; nCol<=nX2; nCol++) 1241cdf0e10cSrcweir { 1242cdf0e10cSrcweir CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1]; 1243cdf0e10cSrcweir if ( pInfo->bAutoFilter && !pInfo->bHOverlapped && !pInfo->bVOverlapped ) 1244cdf0e10cSrcweir { 1245cdf0e10cSrcweir if (!pQueryParam) 1246cdf0e10cSrcweir pQueryParam = new ScQueryParam; 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir sal_Bool bNewData = sal_True; 1249cdf0e10cSrcweir if (pDBData) 1250cdf0e10cSrcweir { 1251cdf0e10cSrcweir SCCOL nStartCol; 1252cdf0e10cSrcweir SCROW nStartRow; 1253cdf0e10cSrcweir SCCOL nEndCol; 1254cdf0e10cSrcweir SCROW nEndRow; 1255cdf0e10cSrcweir SCTAB nAreaTab; 1256cdf0e10cSrcweir pDBData->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow ); 1257cdf0e10cSrcweir if ( nCol >= nStartCol && nCol <= nEndCol && 1258cdf0e10cSrcweir nRow >= nStartRow && nRow <= nEndRow ) 1259cdf0e10cSrcweir bNewData = sal_False; 1260cdf0e10cSrcweir } 1261cdf0e10cSrcweir if (bNewData) 1262cdf0e10cSrcweir { 1263cdf0e10cSrcweir pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab ); 1264cdf0e10cSrcweir if (pDBData) 1265cdf0e10cSrcweir pDBData->GetQueryParam( *pQueryParam ); 1266cdf0e10cSrcweir else 1267cdf0e10cSrcweir { 1268cdf0e10cSrcweir // can also be part of DataPilot table 1269cdf0e10cSrcweir // DBG_ERROR("Auto-Filter-Button ohne DBData"); 1270cdf0e10cSrcweir } 1271cdf0e10cSrcweir } 1272cdf0e10cSrcweir 1273cdf0e10cSrcweir // pQueryParam kann nur MAXQUERY Eintraege enthalten 1274cdf0e10cSrcweir 1275cdf0e10cSrcweir sal_Bool bSimpleQuery = sal_True; 1276cdf0e10cSrcweir sal_Bool bColumnFound = sal_False; 1277cdf0e10cSrcweir if (!pQueryParam->bInplace) 1278cdf0e10cSrcweir bSimpleQuery = sal_False; 1279cdf0e10cSrcweir for (nQuery=0; nQuery<MAXQUERY && bSimpleQuery; nQuery++) 1280cdf0e10cSrcweir if (pQueryParam->GetEntry(nQuery).bDoQuery) 1281cdf0e10cSrcweir { 1282cdf0e10cSrcweir // hier nicht auf EQUAL beschraenken 1283cdf0e10cSrcweir // (auch bei ">1" soll der Spaltenkopf blau werden) 1284cdf0e10cSrcweir 1285cdf0e10cSrcweir if (pQueryParam->GetEntry(nQuery).nField == nCol) 1286cdf0e10cSrcweir bColumnFound = sal_True; 1287cdf0e10cSrcweir if (nQuery > 0) 1288cdf0e10cSrcweir if (pQueryParam->GetEntry(nQuery).eConnect != SC_AND) 1289cdf0e10cSrcweir bSimpleQuery = sal_False; 1290cdf0e10cSrcweir } 1291cdf0e10cSrcweir 1292cdf0e10cSrcweir bool bArrowState = bSimpleQuery && bColumnFound; 1293cdf0e10cSrcweir long nSizeX; 1294cdf0e10cSrcweir long nSizeY; 1295cdf0e10cSrcweir pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); 1296cdf0e10cSrcweir Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich ); 1297cdf0e10cSrcweir 1298cdf0e10cSrcweir aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL); 1299cdf0e10cSrcweir aCellBtn.setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL 1300cdf0e10cSrcweir aCellBtn.setDrawBaseButton(false); 1301cdf0e10cSrcweir aCellBtn.setDrawPopupButton(true); 1302cdf0e10cSrcweir aCellBtn.setHasHiddenMember(bArrowState); 1303cdf0e10cSrcweir aCellBtn.draw(); 1304cdf0e10cSrcweir } 1305cdf0e10cSrcweir } 1306cdf0e10cSrcweir } 1307cdf0e10cSrcweir 1308cdf0e10cSrcweir if ( pRowInfo[nArrY].bPushButton && pRowInfo[nArrY].bChanged ) 1309cdf0e10cSrcweir { 1310cdf0e10cSrcweir RowInfo* pThisRowInfo = &pRowInfo[nArrY]; 1311cdf0e10cSrcweir nRow = pThisRowInfo->nRowNo; 1312cdf0e10cSrcweir for (nCol=nX1; nCol<=nX2; nCol++) 1313cdf0e10cSrcweir { 1314cdf0e10cSrcweir CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1]; 1315cdf0e10cSrcweir if ( pInfo->bPushButton && !pInfo->bHOverlapped && !pInfo->bVOverlapped ) 1316cdf0e10cSrcweir { 1317cdf0e10cSrcweir Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich ); 1318cdf0e10cSrcweir long nSizeX; 1319cdf0e10cSrcweir long nSizeY; 1320cdf0e10cSrcweir pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); 1321cdf0e10cSrcweir long nPosX = aScrPos.X(); 1322cdf0e10cSrcweir long nPosY = aScrPos.Y(); 1323cdf0e10cSrcweir // bLayoutRTL is handled in setBoundingBox 1324cdf0e10cSrcweir 1325cdf0e10cSrcweir String aStr; 1326cdf0e10cSrcweir pDoc->GetString(nCol, nRow, nTab, aStr); 1327cdf0e10cSrcweir aCellBtn.setText(aStr); 1328cdf0e10cSrcweir aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1), bLayoutRTL); 1329cdf0e10cSrcweir aCellBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now 1330cdf0e10cSrcweir aCellBtn.setDrawBaseButton(true); 1331cdf0e10cSrcweir aCellBtn.setDrawPopupButton(pInfo->bPopupButton); 1332cdf0e10cSrcweir aCellBtn.setHasHiddenMember(pInfo->bFilterActive); 1333cdf0e10cSrcweir aCellBtn.draw(); 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir } 1336cdf0e10cSrcweir } 1337cdf0e10cSrcweir 1338cdf0e10cSrcweir if ( bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged ) 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir Rectangle aRect = GetListValButtonRect( aListValPos ); 1341cdf0e10cSrcweir aComboButton.SetPosPixel( aRect.TopLeft() ); 1342cdf0e10cSrcweir aComboButton.SetSizePixel( aRect.GetSize() ); 1343cdf0e10cSrcweir pContentDev->SetClipRegion( aRect ); 1344cdf0e10cSrcweir aComboButton.Draw( sal_False, sal_False ); 1345cdf0e10cSrcweir pContentDev->SetClipRegion(); // always called from Draw() without clip region 1346cdf0e10cSrcweir aComboButton.SetPosPixel( aOldPos ); // restore old state 1347cdf0e10cSrcweir aComboButton.SetSizePixel( aOldSize ); // for MouseUp/Down (AutoFilter) 1348cdf0e10cSrcweir } 1349cdf0e10cSrcweir } 1350cdf0e10cSrcweir 1351cdf0e10cSrcweir delete pQueryParam; 1352cdf0e10cSrcweir aComboButton.SetOutputDevice( this ); 1353cdf0e10cSrcweir } 1354cdf0e10cSrcweir 1355cdf0e10cSrcweir Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos ) 1356cdf0e10cSrcweir { 1357cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 1358cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 1359cdf0e10cSrcweir sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 1360cdf0e10cSrcweir long nLayoutSign = bLayoutRTL ? -1 : 1; 1361cdf0e10cSrcweir 1362cdf0e10cSrcweir ScDDComboBoxButton aButton( this ); // for optimal size 1363cdf0e10cSrcweir Size aBtnSize = aButton.GetSizePixel(); 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir SCCOL nCol = rButtonPos.Col(); 1366cdf0e10cSrcweir SCROW nRow = rButtonPos.Row(); 1367cdf0e10cSrcweir 1368cdf0e10cSrcweir long nCellSizeX; // width of this cell, including merged 1369cdf0e10cSrcweir long nDummy; 1370cdf0e10cSrcweir pViewData->GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy ); 1371cdf0e10cSrcweir 1372cdf0e10cSrcweir // for height, only the cell's row is used, excluding merged cells 1373cdf0e10cSrcweir long nCellSizeY = ScViewData::ToPixel( pDoc->GetRowHeight( nRow, nTab ), pViewData->GetPPTY() ); 1374cdf0e10cSrcweir long nAvailable = nCellSizeX; 1375cdf0e10cSrcweir 1376cdf0e10cSrcweir // left edge of next cell if there is a non-hidden next column 1377cdf0e10cSrcweir SCCOL nNextCol = nCol + 1; 1378cdf0e10cSrcweir const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(pDoc->GetAttr( nCol,nRow,nTab, ATTR_MERGE )); 1379cdf0e10cSrcweir if ( pMerge->GetColMerge() > 1 ) 1380cdf0e10cSrcweir nNextCol = nCol + pMerge->GetColMerge(); // next cell after the merged area 1381cdf0e10cSrcweir while ( nNextCol <= MAXCOL && pDoc->ColHidden(nNextCol, nTab) ) 1382cdf0e10cSrcweir ++nNextCol; 1383cdf0e10cSrcweir sal_Bool bNextCell = ( nNextCol <= MAXCOL ); 1384cdf0e10cSrcweir if ( bNextCell ) 1385cdf0e10cSrcweir nAvailable = ScViewData::ToPixel( pDoc->GetColWidth( nNextCol, nTab ), pViewData->GetPPTX() ); 1386cdf0e10cSrcweir 1387cdf0e10cSrcweir if ( nAvailable < aBtnSize.Width() ) 1388cdf0e10cSrcweir aBtnSize.Width() = nAvailable; 1389cdf0e10cSrcweir if ( nCellSizeY < aBtnSize.Height() ) 1390cdf0e10cSrcweir aBtnSize.Height() = nCellSizeY; 1391cdf0e10cSrcweir 1392cdf0e10cSrcweir Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich, sal_True ); 1393cdf0e10cSrcweir aPos.X() += nCellSizeX * nLayoutSign; // start of next cell 1394cdf0e10cSrcweir if (!bNextCell) 1395cdf0e10cSrcweir aPos.X() -= aBtnSize.Width() * nLayoutSign; // right edge of cell if next cell not available 1396cdf0e10cSrcweir aPos.Y() += nCellSizeY - aBtnSize.Height(); 1397cdf0e10cSrcweir // X remains at the left edge 1398cdf0e10cSrcweir 1399cdf0e10cSrcweir if ( bLayoutRTL ) 1400cdf0e10cSrcweir aPos.X() -= aBtnSize.Width()-1; // align right edge of button with cell border 1401cdf0e10cSrcweir 1402cdf0e10cSrcweir return Rectangle( aPos, aBtnSize ); 1403cdf0e10cSrcweir } 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir sal_Bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ) 1406cdf0e10cSrcweir { 1407cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 1408cdf0e10cSrcweir ScDBData* pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab ); 1409cdf0e10cSrcweir ScQueryParam aQueryParam; 1410cdf0e10cSrcweir 1411cdf0e10cSrcweir if ( pDBData ) 1412cdf0e10cSrcweir pDBData->GetQueryParam( aQueryParam ); 1413cdf0e10cSrcweir else 1414cdf0e10cSrcweir { 1415cdf0e10cSrcweir DBG_ERROR("Auto-Filter-Button ohne DBData"); 1416cdf0e10cSrcweir } 1417cdf0e10cSrcweir 1418cdf0e10cSrcweir sal_Bool bSimpleQuery = sal_True; 1419cdf0e10cSrcweir sal_Bool bColumnFound = sal_False; 1420cdf0e10cSrcweir SCSIZE nQuery; 1421cdf0e10cSrcweir 1422cdf0e10cSrcweir if ( !aQueryParam.bInplace ) 1423cdf0e10cSrcweir bSimpleQuery = sal_False; 1424cdf0e10cSrcweir 1425cdf0e10cSrcweir // aQueryParam kann nur MAXQUERY Eintraege enthalten 1426cdf0e10cSrcweir 1427cdf0e10cSrcweir for ( nQuery=0; nQuery<MAXQUERY && bSimpleQuery; nQuery++ ) 1428cdf0e10cSrcweir if ( aQueryParam.GetEntry(nQuery).bDoQuery ) 1429cdf0e10cSrcweir { 1430cdf0e10cSrcweir if (aQueryParam.GetEntry(nQuery).nField == nCol) 1431cdf0e10cSrcweir bColumnFound = sal_True; 1432cdf0e10cSrcweir 1433cdf0e10cSrcweir if (nQuery > 0) 1434cdf0e10cSrcweir if (aQueryParam.GetEntry(nQuery).eConnect != SC_AND) 1435cdf0e10cSrcweir bSimpleQuery = sal_False; 1436cdf0e10cSrcweir } 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir return ( bSimpleQuery && bColumnFound ); 1439cdf0e10cSrcweir } 1440cdf0e10cSrcweir 1441cdf0e10cSrcweir void ScGridWindow::DrawComboButton( const Point& rCellPos, 1442cdf0e10cSrcweir long nCellSizeX, 1443cdf0e10cSrcweir long nCellSizeY, 1444cdf0e10cSrcweir sal_Bool bArrowState, 1445cdf0e10cSrcweir sal_Bool bBtnIn ) 1446cdf0e10cSrcweir { 1447cdf0e10cSrcweir Point aScrPos = rCellPos; 1448cdf0e10cSrcweir Size aBtnSize = aComboButton.GetSizePixel(); 1449cdf0e10cSrcweir 1450cdf0e10cSrcweir if ( nCellSizeX < aBtnSize.Width() || nCellSizeY < aBtnSize.Height() ) 1451cdf0e10cSrcweir { 1452cdf0e10cSrcweir if ( nCellSizeX < aBtnSize.Width() ) 1453cdf0e10cSrcweir aBtnSize.Width() = nCellSizeX; 1454cdf0e10cSrcweir 1455cdf0e10cSrcweir if ( nCellSizeY < aBtnSize.Height() ) 1456cdf0e10cSrcweir aBtnSize.Height() = nCellSizeY; 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir aComboButton.SetSizePixel( aBtnSize ); 1459cdf0e10cSrcweir } 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir sal_Bool bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() ); 1462cdf0e10cSrcweir 1463cdf0e10cSrcweir if ( bLayoutRTL ) 1464cdf0e10cSrcweir aScrPos.X() -= nCellSizeX - 1; 1465cdf0e10cSrcweir else 1466cdf0e10cSrcweir aScrPos.X() += nCellSizeX - aBtnSize.Width(); 1467cdf0e10cSrcweir aScrPos.Y() += nCellSizeY - aBtnSize.Height(); 1468cdf0e10cSrcweir 1469cdf0e10cSrcweir aComboButton.SetPosPixel( aScrPos ); 1470cdf0e10cSrcweir 1471cdf0e10cSrcweir HideCursor(); 1472cdf0e10cSrcweir aComboButton.Draw( bArrowState, bBtnIn ); 1473cdf0e10cSrcweir ShowCursor(); 1474cdf0e10cSrcweir } 1475cdf0e10cSrcweir 1476cdf0e10cSrcweir void ScGridWindow::InvertSimple( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, 1477cdf0e10cSrcweir sal_Bool bTestMerge, sal_Bool bRepeat ) 1478cdf0e10cSrcweir { 1479cdf0e10cSrcweir //! if INVERT_HIGHLIGHT swaps foreground and background (like on Mac), 1480cdf0e10cSrcweir //! use INVERT_HIGHLIGHT only for cells that have no background color set 1481cdf0e10cSrcweir //! (here and in ScOutputData::DrawMark) 1482cdf0e10cSrcweir 1483cdf0e10cSrcweir PutInOrder( nX1, nX2 ); 1484cdf0e10cSrcweir PutInOrder( nY1, nY2 ); 1485cdf0e10cSrcweir 1486cdf0e10cSrcweir ScMarkData& rMark = pViewData->GetMarkData(); 1487cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 1488cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 1489cdf0e10cSrcweir 1490cdf0e10cSrcweir sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 1491cdf0e10cSrcweir long nLayoutSign = bLayoutRTL ? -1 : 1; 1492cdf0e10cSrcweir 1493cdf0e10cSrcweir SCCOL nTestX2 = nX2; 1494cdf0e10cSrcweir SCROW nTestY2 = nY2; 1495cdf0e10cSrcweir if (bTestMerge) 1496cdf0e10cSrcweir pDoc->ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab ); 1497cdf0e10cSrcweir 1498cdf0e10cSrcweir SCCOL nPosX = pViewData->GetPosX( eHWhich ); 1499cdf0e10cSrcweir SCROW nPosY = pViewData->GetPosY( eVWhich ); 1500cdf0e10cSrcweir if (nTestX2 < nPosX || nTestY2 < nPosY) 1501cdf0e10cSrcweir return; // unsichtbar 1502cdf0e10cSrcweir SCCOL nRealX1 = nX1; 1503cdf0e10cSrcweir if (nX1 < nPosX) 1504cdf0e10cSrcweir nX1 = nPosX; 1505cdf0e10cSrcweir if (nY1 < nPosY) 1506cdf0e10cSrcweir nY1 = nPosY; 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich); 1509cdf0e10cSrcweir if (nXRight > MAXCOL) nXRight = MAXCOL; 1510cdf0e10cSrcweir SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich); 1511cdf0e10cSrcweir if (nYBottom > MAXROW) nYBottom = MAXROW; 1512cdf0e10cSrcweir 1513cdf0e10cSrcweir if (nX1 > nXRight || nY1 > nYBottom) 1514cdf0e10cSrcweir return; // unsichtbar 1515cdf0e10cSrcweir if (nX2 > nXRight) nX2 = nXRight; 1516cdf0e10cSrcweir if (nY2 > nYBottom) nY2 = nYBottom; 1517cdf0e10cSrcweir 1518cdf0e10cSrcweir MapMode aOld = GetMapMode(); SetMapMode(MAP_PIXEL); // erst nach den return's !!! 1519cdf0e10cSrcweir 1520cdf0e10cSrcweir double nPPTX = pViewData->GetPPTX(); 1521cdf0e10cSrcweir double nPPTY = pViewData->GetPPTY(); 1522cdf0e10cSrcweir 1523cdf0e10cSrcweir ScInvertMerger aInvert( this ); 1524cdf0e10cSrcweir 1525cdf0e10cSrcweir Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); 1526cdf0e10cSrcweir long nScrY = aScrPos.Y(); 1527cdf0e10cSrcweir sal_Bool bWasHidden = sal_False; 1528cdf0e10cSrcweir for (SCROW nY=nY1; nY<=nY2; nY++) 1529cdf0e10cSrcweir { 1530cdf0e10cSrcweir sal_Bool bFirstRow = ( nY == nPosY ); // first visible row? 1531cdf0e10cSrcweir sal_Bool bDoHidden = sal_False; // versteckte nachholen ? 1532cdf0e10cSrcweir sal_uInt16 nHeightTwips = pDoc->GetRowHeight( nY,nTab ); 1533cdf0e10cSrcweir sal_Bool bDoRow = ( nHeightTwips != 0 ); 1534cdf0e10cSrcweir if (bDoRow) 1535cdf0e10cSrcweir { 1536cdf0e10cSrcweir if (bTestMerge) 1537cdf0e10cSrcweir if (bWasHidden) // auf versteckte zusammengefasste testen 1538cdf0e10cSrcweir { 1539cdf0e10cSrcweir // --nY; // nY geaendert -> vorherige zeichnen 1540cdf0e10cSrcweir bDoHidden = sal_True; 1541cdf0e10cSrcweir bDoRow = sal_True; 1542cdf0e10cSrcweir } 1543cdf0e10cSrcweir 1544cdf0e10cSrcweir bWasHidden = sal_False; 1545cdf0e10cSrcweir } 1546cdf0e10cSrcweir else 1547cdf0e10cSrcweir { 1548cdf0e10cSrcweir bWasHidden = sal_True; 1549cdf0e10cSrcweir if (bTestMerge) 1550cdf0e10cSrcweir if (nY==nY2) 1551cdf0e10cSrcweir bDoRow = sal_True; // letzte Zeile aus Block 1552cdf0e10cSrcweir } 1553cdf0e10cSrcweir 1554cdf0e10cSrcweir if ( bDoRow ) 1555cdf0e10cSrcweir { 1556cdf0e10cSrcweir SCCOL nLoopEndX = nX2; 1557cdf0e10cSrcweir if (nX2 < nX1) // Rest von zusammengefasst 1558cdf0e10cSrcweir { 1559cdf0e10cSrcweir SCCOL nStartX = nX1; 1560cdf0e10cSrcweir while ( ((const ScMergeFlagAttr*)pDoc-> 1561cdf0e10cSrcweir GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG))->IsHorOverlapped() ) 1562cdf0e10cSrcweir --nStartX; 1563cdf0e10cSrcweir if (nStartX <= nX2) 1564cdf0e10cSrcweir nLoopEndX = nX1; 1565cdf0e10cSrcweir } 1566cdf0e10cSrcweir 1567cdf0e10cSrcweir long nEndY = nScrY + ScViewData::ToPixel( nHeightTwips, nPPTY ) - 1; 1568cdf0e10cSrcweir long nScrX = aScrPos.X(); 1569cdf0e10cSrcweir for (SCCOL nX=nX1; nX<=nLoopEndX; nX++) 1570cdf0e10cSrcweir { 1571cdf0e10cSrcweir long nWidth = ScViewData::ToPixel( pDoc->GetColWidth( nX,nTab ), nPPTX ); 1572cdf0e10cSrcweir if ( nWidth > 0 ) 1573cdf0e10cSrcweir { 1574cdf0e10cSrcweir long nEndX = nScrX + ( nWidth - 1 ) * nLayoutSign; 1575cdf0e10cSrcweir if (bTestMerge) 1576cdf0e10cSrcweir { 1577cdf0e10cSrcweir SCROW nThisY = nY; 1578cdf0e10cSrcweir const ScPatternAttr* pPattern = pDoc->GetPattern( nX, nY, nTab ); 1579cdf0e10cSrcweir const ScMergeFlagAttr* pMergeFlag = (const ScMergeFlagAttr*) &pPattern-> 1580cdf0e10cSrcweir GetItem(ATTR_MERGE_FLAG); 1581cdf0e10cSrcweir if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) ) 1582cdf0e10cSrcweir { 1583cdf0e10cSrcweir while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 && 1584cdf0e10cSrcweir (pDoc->RowHidden(nThisY-1, nTab) || bFirstRow) ) 1585cdf0e10cSrcweir { 1586cdf0e10cSrcweir --nThisY; 1587cdf0e10cSrcweir pPattern = pDoc->GetPattern( nX, nThisY, nTab ); 1588cdf0e10cSrcweir pMergeFlag = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); 1589cdf0e10cSrcweir } 1590cdf0e10cSrcweir } 1591cdf0e10cSrcweir 1592cdf0e10cSrcweir // nur Rest von zusammengefasster zu sehen ? 1593cdf0e10cSrcweir SCCOL nThisX = nX; 1594cdf0e10cSrcweir if ( pMergeFlag->IsHorOverlapped() && nX == nPosX && nX > nRealX1 ) 1595cdf0e10cSrcweir { 1596cdf0e10cSrcweir while ( pMergeFlag->IsHorOverlapped() ) 1597cdf0e10cSrcweir { 1598cdf0e10cSrcweir --nThisX; 1599cdf0e10cSrcweir pPattern = pDoc->GetPattern( nThisX, nThisY, nTab ); 1600cdf0e10cSrcweir pMergeFlag = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); 1601cdf0e10cSrcweir } 1602cdf0e10cSrcweir } 1603cdf0e10cSrcweir 1604cdf0e10cSrcweir if ( rMark.IsCellMarked( nThisX, nThisY, sal_True ) == bRepeat ) 1605cdf0e10cSrcweir { 1606cdf0e10cSrcweir if ( !pMergeFlag->IsOverlapped() ) 1607cdf0e10cSrcweir { 1608cdf0e10cSrcweir ScMergeAttr* pMerge = (ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE); 1609cdf0e10cSrcweir if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0) 1610cdf0e10cSrcweir { 1611cdf0e10cSrcweir Point aEndPos = pViewData->GetScrPos( 1612cdf0e10cSrcweir nThisX + pMerge->GetColMerge(), 1613cdf0e10cSrcweir nThisY + pMerge->GetRowMerge(), eWhich ); 1614cdf0e10cSrcweir if ( aEndPos.X() * nLayoutSign > nScrX * nLayoutSign && aEndPos.Y() > nScrY ) 1615cdf0e10cSrcweir { 1616cdf0e10cSrcweir aInvert.AddRect( Rectangle( nScrX,nScrY, 1617cdf0e10cSrcweir aEndPos.X()-nLayoutSign,aEndPos.Y()-1 ) ); 1618cdf0e10cSrcweir } 1619cdf0e10cSrcweir } 1620cdf0e10cSrcweir else if ( nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY ) 1621cdf0e10cSrcweir { 1622cdf0e10cSrcweir aInvert.AddRect( Rectangle( nScrX,nScrY,nEndX,nEndY ) ); 1623cdf0e10cSrcweir } 1624cdf0e10cSrcweir } 1625cdf0e10cSrcweir } 1626cdf0e10cSrcweir } 1627cdf0e10cSrcweir else // !bTestMerge 1628cdf0e10cSrcweir { 1629cdf0e10cSrcweir if ( rMark.IsCellMarked( nX, nY, sal_True ) == bRepeat && 1630cdf0e10cSrcweir nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY ) 1631cdf0e10cSrcweir { 1632cdf0e10cSrcweir aInvert.AddRect( Rectangle( nScrX,nScrY,nEndX,nEndY ) ); 1633cdf0e10cSrcweir } 1634cdf0e10cSrcweir } 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir nScrX = nEndX + nLayoutSign; 1637cdf0e10cSrcweir } 1638cdf0e10cSrcweir } 1639cdf0e10cSrcweir nScrY = nEndY + 1; 1640cdf0e10cSrcweir } 1641cdf0e10cSrcweir } 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir aInvert.Flush(); // before restoring MapMode 1644cdf0e10cSrcweir 1645cdf0e10cSrcweir SetMapMode(aOld); 1646cdf0e10cSrcweir 1647cdf0e10cSrcweir CheckInverted(); 1648cdf0e10cSrcweir } 1649cdf0e10cSrcweir 1650cdf0e10cSrcweir void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) 1651cdf0e10cSrcweir { 1652cdf0e10cSrcweir // transformed from ScGridWindow::InvertSimple 1653cdf0e10cSrcweir 1654cdf0e10cSrcweir // ScMarkData& rMark = pViewData->GetMarkData(); 1655cdf0e10cSrcweir ScMarkData aMultiMark( pViewData->GetMarkData() ); 1656cdf0e10cSrcweir aMultiMark.SetMarking( sal_False ); 1657cdf0e10cSrcweir aMultiMark.MarkToMulti(); 1658cdf0e10cSrcweir 1659cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 1660cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 1661cdf0e10cSrcweir 1662cdf0e10cSrcweir sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 1663cdf0e10cSrcweir long nLayoutSign = bLayoutRTL ? -1 : 1; 1664cdf0e10cSrcweir 1665cdf0e10cSrcweir if ( !aMultiMark.IsMultiMarked() ) 1666cdf0e10cSrcweir return; 1667cdf0e10cSrcweir 1668cdf0e10cSrcweir ScRange aMultiRange; 1669cdf0e10cSrcweir aMultiMark.GetMultiMarkArea( aMultiRange ); 1670cdf0e10cSrcweir SCCOL nX1 = aMultiRange.aStart.Col(); 1671cdf0e10cSrcweir SCROW nY1 = aMultiRange.aStart.Row(); 1672cdf0e10cSrcweir SCCOL nX2 = aMultiRange.aEnd.Col(); 1673cdf0e10cSrcweir SCROW nY2 = aMultiRange.aEnd.Row(); 1674cdf0e10cSrcweir 1675cdf0e10cSrcweir PutInOrder( nX1, nX2 ); 1676cdf0e10cSrcweir PutInOrder( nY1, nY2 ); 1677cdf0e10cSrcweir 1678cdf0e10cSrcweir sal_Bool bTestMerge = sal_True; 1679cdf0e10cSrcweir sal_Bool bRepeat = sal_True; 1680cdf0e10cSrcweir 1681cdf0e10cSrcweir SCCOL nTestX2 = nX2; 1682cdf0e10cSrcweir SCROW nTestY2 = nY2; 1683cdf0e10cSrcweir if (bTestMerge) 1684cdf0e10cSrcweir pDoc->ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab ); 1685cdf0e10cSrcweir 1686cdf0e10cSrcweir SCCOL nPosX = pViewData->GetPosX( eHWhich ); 1687cdf0e10cSrcweir SCROW nPosY = pViewData->GetPosY( eVWhich ); 1688cdf0e10cSrcweir if (nTestX2 < nPosX || nTestY2 < nPosY) 1689cdf0e10cSrcweir return; // unsichtbar 1690cdf0e10cSrcweir SCCOL nRealX1 = nX1; 1691cdf0e10cSrcweir if (nX1 < nPosX) 1692cdf0e10cSrcweir nX1 = nPosX; 1693cdf0e10cSrcweir if (nY1 < nPosY) 1694cdf0e10cSrcweir nY1 = nPosY; 1695cdf0e10cSrcweir 1696cdf0e10cSrcweir SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich); 1697cdf0e10cSrcweir if (nXRight > MAXCOL) nXRight = MAXCOL; 1698cdf0e10cSrcweir SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich); 1699cdf0e10cSrcweir if (nYBottom > MAXROW) nYBottom = MAXROW; 1700cdf0e10cSrcweir 1701cdf0e10cSrcweir if (nX1 > nXRight || nY1 > nYBottom) 1702cdf0e10cSrcweir return; // unsichtbar 1703cdf0e10cSrcweir if (nX2 > nXRight) nX2 = nXRight; 1704cdf0e10cSrcweir if (nY2 > nYBottom) nY2 = nYBottom; 1705cdf0e10cSrcweir 1706cdf0e10cSrcweir // MapMode aOld = GetMapMode(); SetMapMode(MAP_PIXEL); // erst nach den return's !!! 1707cdf0e10cSrcweir 1708cdf0e10cSrcweir double nPPTX = pViewData->GetPPTX(); 1709cdf0e10cSrcweir double nPPTY = pViewData->GetPPTY(); 1710cdf0e10cSrcweir 1711cdf0e10cSrcweir ScInvertMerger aInvert( &rPixelRects ); 1712cdf0e10cSrcweir 1713cdf0e10cSrcweir Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); 1714cdf0e10cSrcweir long nScrY = aScrPos.Y(); 1715cdf0e10cSrcweir sal_Bool bWasHidden = sal_False; 1716cdf0e10cSrcweir for (SCROW nY=nY1; nY<=nY2; nY++) 1717cdf0e10cSrcweir { 1718cdf0e10cSrcweir sal_Bool bFirstRow = ( nY == nPosY ); // first visible row? 1719cdf0e10cSrcweir sal_Bool bDoHidden = sal_False; // versteckte nachholen ? 1720cdf0e10cSrcweir sal_uInt16 nHeightTwips = pDoc->GetRowHeight( nY,nTab ); 1721cdf0e10cSrcweir sal_Bool bDoRow = ( nHeightTwips != 0 ); 1722cdf0e10cSrcweir if (bDoRow) 1723cdf0e10cSrcweir { 1724cdf0e10cSrcweir if (bTestMerge) 1725cdf0e10cSrcweir if (bWasHidden) // auf versteckte zusammengefasste testen 1726cdf0e10cSrcweir { 1727cdf0e10cSrcweir bDoHidden = sal_True; 1728cdf0e10cSrcweir bDoRow = sal_True; 1729cdf0e10cSrcweir } 1730cdf0e10cSrcweir 1731cdf0e10cSrcweir bWasHidden = sal_False; 1732cdf0e10cSrcweir } 1733cdf0e10cSrcweir else 1734cdf0e10cSrcweir { 1735cdf0e10cSrcweir bWasHidden = sal_True; 1736cdf0e10cSrcweir if (bTestMerge) 1737cdf0e10cSrcweir if (nY==nY2) 1738cdf0e10cSrcweir bDoRow = sal_True; // letzte Zeile aus Block 1739cdf0e10cSrcweir } 1740cdf0e10cSrcweir 1741cdf0e10cSrcweir if ( bDoRow ) 1742cdf0e10cSrcweir { 1743cdf0e10cSrcweir SCCOL nLoopEndX = nX2; 1744cdf0e10cSrcweir if (nX2 < nX1) // Rest von zusammengefasst 1745cdf0e10cSrcweir { 1746cdf0e10cSrcweir SCCOL nStartX = nX1; 1747cdf0e10cSrcweir while ( ((const ScMergeFlagAttr*)pDoc-> 1748cdf0e10cSrcweir GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG))->IsHorOverlapped() ) 1749cdf0e10cSrcweir --nStartX; 1750cdf0e10cSrcweir if (nStartX <= nX2) 1751cdf0e10cSrcweir nLoopEndX = nX1; 1752cdf0e10cSrcweir } 1753cdf0e10cSrcweir 1754cdf0e10cSrcweir long nEndY = nScrY + ScViewData::ToPixel( nHeightTwips, nPPTY ) - 1; 1755cdf0e10cSrcweir long nScrX = aScrPos.X(); 1756cdf0e10cSrcweir for (SCCOL nX=nX1; nX<=nLoopEndX; nX++) 1757cdf0e10cSrcweir { 1758cdf0e10cSrcweir long nWidth = ScViewData::ToPixel( pDoc->GetColWidth( nX,nTab ), nPPTX ); 1759cdf0e10cSrcweir if ( nWidth > 0 ) 1760cdf0e10cSrcweir { 1761cdf0e10cSrcweir long nEndX = nScrX + ( nWidth - 1 ) * nLayoutSign; 1762cdf0e10cSrcweir if (bTestMerge) 1763cdf0e10cSrcweir { 1764cdf0e10cSrcweir SCROW nThisY = nY; 1765cdf0e10cSrcweir const ScPatternAttr* pPattern = pDoc->GetPattern( nX, nY, nTab ); 1766cdf0e10cSrcweir const ScMergeFlagAttr* pMergeFlag = (const ScMergeFlagAttr*) &pPattern-> 1767cdf0e10cSrcweir GetItem(ATTR_MERGE_FLAG); 1768cdf0e10cSrcweir if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) ) 1769cdf0e10cSrcweir { 1770cdf0e10cSrcweir while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 && 1771cdf0e10cSrcweir (pDoc->RowHidden(nThisY-1, nTab) || bFirstRow) ) 1772cdf0e10cSrcweir { 1773cdf0e10cSrcweir --nThisY; 1774cdf0e10cSrcweir pPattern = pDoc->GetPattern( nX, nThisY, nTab ); 1775cdf0e10cSrcweir pMergeFlag = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); 1776cdf0e10cSrcweir } 1777cdf0e10cSrcweir } 1778cdf0e10cSrcweir 1779cdf0e10cSrcweir // nur Rest von zusammengefasster zu sehen ? 1780cdf0e10cSrcweir SCCOL nThisX = nX; 1781cdf0e10cSrcweir if ( pMergeFlag->IsHorOverlapped() && nX == nPosX && nX > nRealX1 ) 1782cdf0e10cSrcweir { 1783cdf0e10cSrcweir while ( pMergeFlag->IsHorOverlapped() ) 1784cdf0e10cSrcweir { 1785cdf0e10cSrcweir --nThisX; 1786cdf0e10cSrcweir pPattern = pDoc->GetPattern( nThisX, nThisY, nTab ); 1787cdf0e10cSrcweir pMergeFlag = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); 1788cdf0e10cSrcweir } 1789cdf0e10cSrcweir } 1790cdf0e10cSrcweir 1791cdf0e10cSrcweir if ( aMultiMark.IsCellMarked( nThisX, nThisY, sal_True ) == bRepeat ) 1792cdf0e10cSrcweir { 1793cdf0e10cSrcweir if ( !pMergeFlag->IsOverlapped() ) 1794cdf0e10cSrcweir { 1795cdf0e10cSrcweir ScMergeAttr* pMerge = (ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE); 1796cdf0e10cSrcweir if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0) 1797cdf0e10cSrcweir { 1798cdf0e10cSrcweir Point aEndPos = pViewData->GetScrPos( 1799cdf0e10cSrcweir nThisX + pMerge->GetColMerge(), 1800cdf0e10cSrcweir nThisY + pMerge->GetRowMerge(), eWhich ); 1801cdf0e10cSrcweir if ( aEndPos.X() * nLayoutSign > nScrX * nLayoutSign && aEndPos.Y() > nScrY ) 1802cdf0e10cSrcweir { 1803cdf0e10cSrcweir aInvert.AddRect( Rectangle( nScrX,nScrY, 1804cdf0e10cSrcweir aEndPos.X()-nLayoutSign,aEndPos.Y()-1 ) ); 1805cdf0e10cSrcweir } 1806cdf0e10cSrcweir } 1807cdf0e10cSrcweir else if ( nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY ) 1808cdf0e10cSrcweir { 1809cdf0e10cSrcweir aInvert.AddRect( Rectangle( nScrX,nScrY,nEndX,nEndY ) ); 1810cdf0e10cSrcweir } 1811cdf0e10cSrcweir } 1812cdf0e10cSrcweir } 1813cdf0e10cSrcweir } 1814cdf0e10cSrcweir else // !bTestMerge 1815cdf0e10cSrcweir { 1816cdf0e10cSrcweir if ( aMultiMark.IsCellMarked( nX, nY, sal_True ) == bRepeat && 1817cdf0e10cSrcweir nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY ) 1818cdf0e10cSrcweir { 1819cdf0e10cSrcweir aInvert.AddRect( Rectangle( nScrX,nScrY,nEndX,nEndY ) ); 1820cdf0e10cSrcweir } 1821cdf0e10cSrcweir } 1822cdf0e10cSrcweir 1823cdf0e10cSrcweir nScrX = nEndX + nLayoutSign; 1824cdf0e10cSrcweir } 1825cdf0e10cSrcweir } 1826cdf0e10cSrcweir nScrY = nEndY + 1; 1827cdf0e10cSrcweir } 1828cdf0e10cSrcweir } 1829cdf0e10cSrcweir 1830cdf0e10cSrcweir // aInvert.Flush(); // before restoring MapMode 1831cdf0e10cSrcweir } 1832cdf0e10cSrcweir 1833cdf0e10cSrcweir // ------------------------------------------------------------------------- 1834cdf0e10cSrcweir 1835cdf0e10cSrcweir //UNUSED2008-05 void ScGridWindow::DrawDragRect( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ) 1836cdf0e10cSrcweir //UNUSED2008-05 { 1837cdf0e10cSrcweir //UNUSED2008-05 if ( nX2 < pViewData->GetPosX(eHWhich) || nY2 < pViewData->GetPosY(eVWhich) ) 1838cdf0e10cSrcweir //UNUSED2008-05 return; 1839cdf0e10cSrcweir //UNUSED2008-05 1840cdf0e10cSrcweir //UNUSED2008-05 Update(); // wegen XOR 1841cdf0e10cSrcweir //UNUSED2008-05 1842cdf0e10cSrcweir //UNUSED2008-05 MapMode aOld = GetMapMode(); SetMapMode(MAP_PIXEL); 1843cdf0e10cSrcweir //UNUSED2008-05 1844cdf0e10cSrcweir //UNUSED2008-05 SCTAB nTab = pViewData->GetTabNo(); 1845cdf0e10cSrcweir //UNUSED2008-05 1846cdf0e10cSrcweir //UNUSED2008-05 SCCOL nPosX = pViewData->GetPosX(WhichH(eWhich)); 1847cdf0e10cSrcweir //UNUSED2008-05 SCROW nPosY = pViewData->GetPosY(WhichV(eWhich)); 1848cdf0e10cSrcweir //UNUSED2008-05 if (nX1 < nPosX) nX1 = nPosX; 1849cdf0e10cSrcweir //UNUSED2008-05 if (nX2 < nPosX) nX2 = nPosX; 1850cdf0e10cSrcweir //UNUSED2008-05 if (nY1 < nPosY) nY1 = nPosY; 1851cdf0e10cSrcweir //UNUSED2008-05 if (nY2 < nPosY) nY2 = nPosY; 1852cdf0e10cSrcweir //UNUSED2008-05 1853cdf0e10cSrcweir //UNUSED2008-05 Point aScrPos( pViewData->GetScrPos( nX1, nY1, eWhich ) ); 1854cdf0e10cSrcweir //UNUSED2008-05 1855cdf0e10cSrcweir //UNUSED2008-05 long nSizeXPix=0; 1856cdf0e10cSrcweir //UNUSED2008-05 long nSizeYPix=0; 1857cdf0e10cSrcweir //UNUSED2008-05 ScDocument* pDoc = pViewData->GetDocument(); 1858cdf0e10cSrcweir //UNUSED2008-05 double nPPTX = pViewData->GetPPTX(); 1859cdf0e10cSrcweir //UNUSED2008-05 double nPPTY = pViewData->GetPPTY(); 1860cdf0e10cSrcweir //UNUSED2008-05 SCCOLROW i; 1861cdf0e10cSrcweir //UNUSED2008-05 1862cdf0e10cSrcweir //UNUSED2008-05 sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 1863cdf0e10cSrcweir //UNUSED2008-05 long nLayoutSign = bLayoutRTL ? -1 : 1; 1864cdf0e10cSrcweir //UNUSED2008-05 1865cdf0e10cSrcweir //UNUSED2008-05 if (ValidCol(nX2) && nX2>=nX1) 1866cdf0e10cSrcweir //UNUSED2008-05 for (i=nX1; i<=nX2; i++) 1867cdf0e10cSrcweir //UNUSED2008-05 nSizeXPix += ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(i), nTab ), nPPTX ); 1868cdf0e10cSrcweir //UNUSED2008-05 else 1869cdf0e10cSrcweir //UNUSED2008-05 { 1870cdf0e10cSrcweir //UNUSED2008-05 aScrPos.X() -= nLayoutSign; 1871cdf0e10cSrcweir //UNUSED2008-05 nSizeXPix += 2; 1872cdf0e10cSrcweir //UNUSED2008-05 } 1873cdf0e10cSrcweir //UNUSED2008-05 1874cdf0e10cSrcweir //UNUSED2008-05 if (ValidRow(nY2) && nY2>=nY1) 1875cdf0e10cSrcweir //UNUSED2008-05 for (i=nY1; i<=nY2; i++) 1876cdf0e10cSrcweir //UNUSED2008-05 nSizeYPix += ScViewData::ToPixel( pDoc->GetRowHeight( i, nTab ), nPPTY ); 1877cdf0e10cSrcweir //UNUSED2008-05 else 1878cdf0e10cSrcweir //UNUSED2008-05 { 1879cdf0e10cSrcweir //UNUSED2008-05 aScrPos.Y() -= 1; 1880cdf0e10cSrcweir //UNUSED2008-05 nSizeYPix += 2; 1881cdf0e10cSrcweir //UNUSED2008-05 } 1882cdf0e10cSrcweir //UNUSED2008-05 1883cdf0e10cSrcweir //UNUSED2008-05 aScrPos.X() -= 2 * nLayoutSign; 1884cdf0e10cSrcweir //UNUSED2008-05 aScrPos.Y() -= 2; 1885cdf0e10cSrcweir //UNUSED2008-05 // Rectangle aRect( aScrPos, Size( nSizeXPix + 3, nSizeYPix + 3 ) ); 1886cdf0e10cSrcweir //UNUSED2008-05 Rectangle aRect( aScrPos.X(), aScrPos.Y(), 1887cdf0e10cSrcweir //UNUSED2008-05 aScrPos.X() + ( nSizeXPix + 2 ) * nLayoutSign, aScrPos.Y() + nSizeYPix + 2 ); 1888cdf0e10cSrcweir //UNUSED2008-05 if ( bLayoutRTL ) 1889cdf0e10cSrcweir //UNUSED2008-05 { 1890cdf0e10cSrcweir //UNUSED2008-05 aRect.Left() = aRect.Right(); // end position is left 1891cdf0e10cSrcweir //UNUSED2008-05 aRect.Right() = aScrPos.X(); 1892cdf0e10cSrcweir //UNUSED2008-05 } 1893cdf0e10cSrcweir //UNUSED2008-05 1894cdf0e10cSrcweir //UNUSED2008-05 Invert(Rectangle( aRect.Left(), aRect.Top(), aRect.Left()+2, aRect.Bottom() )); 1895cdf0e10cSrcweir //UNUSED2008-05 Invert(Rectangle( aRect.Right()-2, aRect.Top(), aRect.Right(), aRect.Bottom() )); 1896cdf0e10cSrcweir //UNUSED2008-05 Invert(Rectangle( aRect.Left()+3, aRect.Top(), aRect.Right()-3, aRect.Top()+2 )); 1897cdf0e10cSrcweir //UNUSED2008-05 Invert(Rectangle( aRect.Left()+3, aRect.Bottom()-2, aRect.Right()-3, aRect.Bottom() )); 1898cdf0e10cSrcweir //UNUSED2008-05 1899cdf0e10cSrcweir //UNUSED2008-05 SetMapMode(aOld); 1900cdf0e10cSrcweir //UNUSED2008-05 } 1901cdf0e10cSrcweir 1902cdf0e10cSrcweir // ------------------------------------------------------------------------- 1903cdf0e10cSrcweir 1904cdf0e10cSrcweir void ScGridWindow::DrawCursor() 1905cdf0e10cSrcweir { 1906cdf0e10cSrcweir // #114409# 1907cdf0e10cSrcweir // SCTAB nTab = pViewData->GetTabNo(); 1908cdf0e10cSrcweir // SCCOL nX = pViewData->GetCurX(); 1909cdf0e10cSrcweir // SCROW nY = pViewData->GetCurY(); 1910cdf0e10cSrcweir // 1911cdf0e10cSrcweir // // in verdeckten Zellen nicht zeichnen 1912cdf0e10cSrcweir // 1913cdf0e10cSrcweir // ScDocument* pDoc = pViewData->GetDocument(); 1914cdf0e10cSrcweir // const ScPatternAttr* pPattern = pDoc->GetPattern(nX,nY,nTab); 1915cdf0e10cSrcweir // const ScMergeFlagAttr& rMerge = (const ScMergeFlagAttr&) pPattern->GetItem(ATTR_MERGE_FLAG); 1916cdf0e10cSrcweir // if (rMerge.IsOverlapped()) 1917cdf0e10cSrcweir // return; 1918cdf0e10cSrcweir // 1919cdf0e10cSrcweir // // links/oben ausserhalb des Bildschirms ? 1920cdf0e10cSrcweir // 1921cdf0e10cSrcweir // sal_Bool bVis = ( nX>=pViewData->GetPosX(eHWhich) && nY>=pViewData->GetPosY(eVWhich) ); 1922cdf0e10cSrcweir // if (!bVis) 1923cdf0e10cSrcweir // { 1924cdf0e10cSrcweir // SCCOL nEndX = nX; 1925cdf0e10cSrcweir // SCROW nEndY = nY; 1926cdf0e10cSrcweir // ScDocument* pDoc = pViewData->GetDocument(); 1927cdf0e10cSrcweir // const ScMergeAttr& rMerge = (const ScMergeAttr&) pPattern->GetItem(ATTR_MERGE); 1928cdf0e10cSrcweir // if (rMerge.GetColMerge() > 1) 1929cdf0e10cSrcweir // nEndX += rMerge.GetColMerge()-1; 1930cdf0e10cSrcweir // if (rMerge.GetRowMerge() > 1) 1931cdf0e10cSrcweir // nEndY += rMerge.GetRowMerge()-1; 1932cdf0e10cSrcweir // bVis = ( nEndX>=pViewData->GetPosX(eHWhich) && nEndY>=pViewData->GetPosY(eVWhich) ); 1933cdf0e10cSrcweir // } 1934cdf0e10cSrcweir // 1935cdf0e10cSrcweir // if ( bVis ) 1936cdf0e10cSrcweir // { 1937cdf0e10cSrcweir // // hier kein Update, da aus Paint gerufen und laut Zaehler Cursor schon da 1938cdf0e10cSrcweir // // wenn Update noetig, dann bei Hide/Showcursor vor dem Hoch-/Runterzaehlen 1939cdf0e10cSrcweir // 1940cdf0e10cSrcweir // MapMode aOld = GetMapMode(); SetMapMode(MAP_PIXEL); 1941cdf0e10cSrcweir // 1942cdf0e10cSrcweir // Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, sal_True ); 1943cdf0e10cSrcweir // sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 1944cdf0e10cSrcweir // 1945cdf0e10cSrcweir // // completely right of/below the screen? 1946cdf0e10cSrcweir // // (test with logical start position in aScrPos) 1947cdf0e10cSrcweir // sal_Bool bMaybeVisible; 1948cdf0e10cSrcweir // if ( bLayoutRTL ) 1949cdf0e10cSrcweir // bMaybeVisible = ( aScrPos.X() >= -2 && aScrPos.Y() >= -2 ); 1950cdf0e10cSrcweir // else 1951cdf0e10cSrcweir // { 1952cdf0e10cSrcweir // Size aOutSize = GetOutputSizePixel(); 1953cdf0e10cSrcweir // bMaybeVisible = ( aScrPos.X() <= aOutSize.Width() + 2 && aScrPos.Y() <= aOutSize.Height() + 2 ); 1954cdf0e10cSrcweir // } 1955cdf0e10cSrcweir // if ( bMaybeVisible ) 1956cdf0e10cSrcweir // { 1957cdf0e10cSrcweir // long nSizeXPix; 1958cdf0e10cSrcweir // long nSizeYPix; 1959cdf0e10cSrcweir // pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); 1960cdf0e10cSrcweir // 1961cdf0e10cSrcweir // if ( bLayoutRTL ) 1962cdf0e10cSrcweir // aScrPos.X() -= nSizeXPix - 2; // move instead of mirroring 1963cdf0e10cSrcweir // 1964cdf0e10cSrcweir // sal_Bool bFix = ( pViewData->GetHSplitMode() == SC_SPLIT_FIX || 1965cdf0e10cSrcweir // pViewData->GetVSplitMode() == SC_SPLIT_FIX ); 1966cdf0e10cSrcweir // if ( pViewData->GetActivePart()==eWhich || bFix ) 1967cdf0e10cSrcweir // { 1968cdf0e10cSrcweir // // old UNX version with two Invert calls causes flicker. 1969cdf0e10cSrcweir // // if optimization is needed, a new flag should be added 1970cdf0e10cSrcweir // // to InvertTracking 1971cdf0e10cSrcweir // 1972cdf0e10cSrcweir // aScrPos.X() -= 2; 1973cdf0e10cSrcweir // aScrPos.Y() -= 2; 1974cdf0e10cSrcweir // Rectangle aRect( aScrPos, Size( nSizeXPix + 3, nSizeYPix + 3 ) ); 1975cdf0e10cSrcweir // 1976cdf0e10cSrcweir // Invert(Rectangle( aRect.Left(), aRect.Top(), aRect.Left()+2, aRect.Bottom() )); 1977cdf0e10cSrcweir // Invert(Rectangle( aRect.Right()-2, aRect.Top(), aRect.Right(), aRect.Bottom() )); 1978cdf0e10cSrcweir // Invert(Rectangle( aRect.Left()+3, aRect.Top(), aRect.Right()-3, aRect.Top()+2 )); 1979cdf0e10cSrcweir // Invert(Rectangle( aRect.Left()+3, aRect.Bottom()-2, aRect.Right()-3, aRect.Bottom() )); 1980cdf0e10cSrcweir // } 1981cdf0e10cSrcweir // else 1982cdf0e10cSrcweir // { 1983cdf0e10cSrcweir // Rectangle aRect( aScrPos, Size( nSizeXPix - 1, nSizeYPix - 1 ) ); 1984cdf0e10cSrcweir // Invert( aRect ); 1985cdf0e10cSrcweir // } 1986cdf0e10cSrcweir // } 1987cdf0e10cSrcweir // 1988cdf0e10cSrcweir // SetMapMode(aOld); 1989cdf0e10cSrcweir // } 1990cdf0e10cSrcweir } 1991cdf0e10cSrcweir 1992cdf0e10cSrcweir // AutoFill-Anfasser: 1993cdf0e10cSrcweir 1994cdf0e10cSrcweir void ScGridWindow::DrawAutoFillMark() 1995cdf0e10cSrcweir { 1996cdf0e10cSrcweir // #114409# 1997cdf0e10cSrcweir // if ( bAutoMarkVisible && aAutoMarkPos.Tab() == pViewData->GetTabNo() ) 1998cdf0e10cSrcweir // { 1999cdf0e10cSrcweir // SCCOL nX = aAutoMarkPos.Col(); 2000cdf0e10cSrcweir // SCROW nY = aAutoMarkPos.Row(); 2001cdf0e10cSrcweir // SCTAB nTab = pViewData->GetTabNo(); 2002cdf0e10cSrcweir // ScDocument* pDoc = pViewData->GetDocument(); 2003cdf0e10cSrcweir // sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); 2004cdf0e10cSrcweir // 2005cdf0e10cSrcweir // Point aFillPos = pViewData->GetScrPos( nX, nY, eWhich, sal_True ); 2006cdf0e10cSrcweir // long nSizeXPix; 2007cdf0e10cSrcweir // long nSizeYPix; 2008cdf0e10cSrcweir // pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); 2009cdf0e10cSrcweir // if ( bLayoutRTL ) 2010cdf0e10cSrcweir // aFillPos.X() -= nSizeXPix + 3; 2011cdf0e10cSrcweir // else 2012cdf0e10cSrcweir // aFillPos.X() += nSizeXPix - 2; 2013cdf0e10cSrcweir // 2014cdf0e10cSrcweir // aFillPos.Y() += nSizeYPix; 2015cdf0e10cSrcweir // aFillPos.Y() -= 2; 2016cdf0e10cSrcweir // Rectangle aFillRect( aFillPos, Size(6,6) ); 2017cdf0e10cSrcweir // // Anfasser von Zeichenobjekten sind 7*7 2018cdf0e10cSrcweir // 2019cdf0e10cSrcweir // MapMode aOld = GetMapMode(); SetMapMode(MAP_PIXEL); 2020cdf0e10cSrcweir // Invert( aFillRect ); 2021cdf0e10cSrcweir // SetMapMode(aOld); 2022cdf0e10cSrcweir // } 2023cdf0e10cSrcweir } 2024cdf0e10cSrcweir 2025cdf0e10cSrcweir // ------------------------------------------------------------------------- 2026cdf0e10cSrcweir 2027cdf0e10cSrcweir void ScGridWindow::DataChanged( const DataChangedEvent& rDCEvt ) 2028cdf0e10cSrcweir { 2029cdf0e10cSrcweir Window::DataChanged(rDCEvt); 2030cdf0e10cSrcweir 2031cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_PRINTER) || 2032cdf0e10cSrcweir (rDCEvt.GetType() == DATACHANGED_DISPLAY) || 2033cdf0e10cSrcweir (rDCEvt.GetType() == DATACHANGED_FONTS) || 2034cdf0e10cSrcweir (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || 2035cdf0e10cSrcweir ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && 2036cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) 2037cdf0e10cSrcweir { 2038cdf0e10cSrcweir if ( rDCEvt.GetType() == DATACHANGED_FONTS && eWhich == pViewData->GetActivePart() ) 2039cdf0e10cSrcweir pViewData->GetDocShell()->UpdateFontList(); 2040cdf0e10cSrcweir 2041cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 2042cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 2043cdf0e10cSrcweir { 2044cdf0e10cSrcweir if ( eWhich == pViewData->GetActivePart() ) // only once for the view 2045cdf0e10cSrcweir { 2046cdf0e10cSrcweir ScTabView* pView = pViewData->GetView(); 2047cdf0e10cSrcweir 2048cdf0e10cSrcweir // update scale in case the UI ScreenZoom has changed 2049cdf0e10cSrcweir ScGlobal::UpdatePPT(this); 2050cdf0e10cSrcweir pView->RecalcPPT(); 2051cdf0e10cSrcweir 2052cdf0e10cSrcweir // RepeatResize in case scroll bar sizes have changed 2053cdf0e10cSrcweir pView->RepeatResize(); 2054cdf0e10cSrcweir pView->UpdateAllOverlays(); 2055cdf0e10cSrcweir 2056cdf0e10cSrcweir // invalidate cell attribs in input handler, in case the 2057cdf0e10cSrcweir // EditEngine BackgroundColor has to be changed 2058cdf0e10cSrcweir if ( pViewData->IsActive() ) 2059cdf0e10cSrcweir { 2060cdf0e10cSrcweir ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); 2061cdf0e10cSrcweir if (pHdl) 2062cdf0e10cSrcweir pHdl->ForgetLastPattern(); 2063cdf0e10cSrcweir } 2064cdf0e10cSrcweir } 2065cdf0e10cSrcweir } 2066cdf0e10cSrcweir 2067cdf0e10cSrcweir Invalidate(); 2068cdf0e10cSrcweir } 2069cdf0e10cSrcweir } 2070cdf0e10cSrcweir 2071cdf0e10cSrcweir 2072cdf0e10cSrcweir 2073cdf0e10cSrcweir 2074