Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "scitems.hxx"
21 : #include <svx/algitem.hxx>
22 : #include <editeng/boxitem.hxx>
23 : #include <editeng/brushitem.hxx>
24 : #include <editeng/contouritem.hxx>
25 : #include <editeng/colritem.hxx>
26 : #include <editeng/crossedoutitem.hxx>
27 : #include <editeng/fontitem.hxx>
28 : #include <editeng/postitem.hxx>
29 : #include <editeng/shdditem.hxx>
30 : #include <editeng/udlnitem.hxx>
31 : #include <editeng/wghtitem.hxx>
32 : #include <vcl/svapp.hxx>
33 : #include <svl/zforlist.hxx>
34 : #include <vcl/msgbox.hxx>
35 : #include <vcl/settings.hxx>
36 : #include <sfx2/viewfrm.hxx>
37 : #include <comphelper/processfactory.hxx>
38 :
39 : #include "sc.hrc"
40 : #include "scmod.hxx"
41 : #include "attrib.hxx"
42 : #include "zforauto.hxx"
43 : #include "global.hxx"
44 : #include "globstr.hrc"
45 : #include "autoform.hxx"
46 : #include "miscdlgs.hrc"
47 : #include "autofmt.hxx"
48 : #include "scresid.hxx"
49 : #include "document.hxx"
50 : #include "docsh.hxx"
51 : #include "tabvwsh.hxx"
52 :
53 : #define FRAME_OFFSET 4
54 :
55 : // ScAutoFmtPreview
56 :
57 0 : ScAutoFmtPreview::ScAutoFmtPreview(vcl::Window* pParent)
58 : : Window(pParent)
59 : , pCurData(NULL)
60 : , aVD(*this)
61 : , aScriptedText(aVD)
62 : , bFitWidth(false)
63 : , mbRTL(false)
64 : , aStrJan(ScResId(STR_JAN))
65 : , aStrFeb(ScResId(STR_FEB))
66 : , aStrMar(ScResId(STR_MAR))
67 : , aStrNorth(ScResId(STR_NORTH))
68 : , aStrMid(ScResId(STR_MID))
69 : , aStrSouth(ScResId(STR_SOUTH))
70 : , aStrSum(ScResId(STR_SUM))
71 0 : , pNumFmt(new SvNumberFormatter(::comphelper::getProcessComponentContext(), ScGlobal::eLnge))
72 : {
73 0 : Init();
74 0 : }
75 :
76 0 : extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScAutoFmtPreview(vcl::Window *pParent, VclBuilder::stringmap &)
77 : {
78 0 : return new ScAutoFmtPreview(pParent);
79 : }
80 :
81 0 : void ScAutoFmtPreview::Resize()
82 : {
83 0 : aPrvSize = Size(GetSizePixel().Width() - 6, GetSizePixel().Height() - 30);
84 0 : mnLabelColWidth = (aPrvSize.Width() - 4) / 4 - 12;
85 0 : mnDataColWidth1 = (aPrvSize.Width() - 4 - 2 * mnLabelColWidth) / 3;
86 0 : mnDataColWidth2 = (aPrvSize.Width() - 4 - 2 * mnLabelColWidth) / 4;
87 0 : mnRowHeight = (aPrvSize.Height() - 4) / 5;
88 0 : NotifyChange(pCurData);
89 0 : }
90 :
91 0 : ScAutoFmtPreview::~ScAutoFmtPreview()
92 : {
93 0 : delete pNumFmt;
94 0 : }
95 :
96 0 : static void lcl_SetFontProperties(
97 : vcl::Font& rFont,
98 : const SvxFontItem& rFontItem,
99 : const SvxWeightItem& rWeightItem,
100 : const SvxPostureItem& rPostureItem )
101 : {
102 0 : rFont.SetFamily ( rFontItem.GetFamily() );
103 0 : rFont.SetName ( rFontItem.GetFamilyName() );
104 0 : rFont.SetStyleName ( rFontItem.GetStyleName() );
105 0 : rFont.SetCharSet ( rFontItem.GetCharSet() );
106 0 : rFont.SetPitch ( rFontItem.GetPitch() );
107 0 : rFont.SetWeight ( (FontWeight)rWeightItem.GetValue() );
108 0 : rFont.SetItalic ( (FontItalic)rPostureItem.GetValue() );
109 0 : }
110 :
111 0 : void ScAutoFmtPreview::MakeFonts( sal_uInt16 nIndex, vcl::Font& rFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont )
112 : {
113 0 : if ( pCurData )
114 : {
115 0 : rFont = rCJKFont = rCTLFont = GetFont();
116 0 : Size aFontSize( rFont.GetSize().Width(), 10 * GetDPIScaleFactor() );
117 :
118 0 : const SvxFontItem* pFontItem = static_cast<const SvxFontItem*> (pCurData->GetItem( nIndex, ATTR_FONT ));
119 0 : const SvxWeightItem* pWeightItem = static_cast<const SvxWeightItem*> (pCurData->GetItem( nIndex, ATTR_FONT_WEIGHT ));
120 0 : const SvxPostureItem* pPostureItem = static_cast<const SvxPostureItem*> (pCurData->GetItem( nIndex, ATTR_FONT_POSTURE ));
121 0 : const SvxFontItem* pCJKFontItem = static_cast<const SvxFontItem*> (pCurData->GetItem( nIndex, ATTR_CJK_FONT ));
122 0 : const SvxWeightItem* pCJKWeightItem = static_cast<const SvxWeightItem*> (pCurData->GetItem( nIndex, ATTR_CJK_FONT_WEIGHT ));
123 0 : const SvxPostureItem* pCJKPostureItem = static_cast<const SvxPostureItem*> (pCurData->GetItem( nIndex, ATTR_CJK_FONT_POSTURE ));
124 0 : const SvxFontItem* pCTLFontItem = static_cast<const SvxFontItem*> (pCurData->GetItem( nIndex, ATTR_CTL_FONT ));
125 0 : const SvxWeightItem* pCTLWeightItem = static_cast<const SvxWeightItem*> (pCurData->GetItem( nIndex, ATTR_CTL_FONT_WEIGHT ));
126 0 : const SvxPostureItem* pCTLPostureItem = static_cast<const SvxPostureItem*> (pCurData->GetItem( nIndex, ATTR_CTL_FONT_POSTURE ));
127 0 : const SvxUnderlineItem* pUnderlineItem = static_cast<const SvxUnderlineItem*> (pCurData->GetItem( nIndex, ATTR_FONT_UNDERLINE ));
128 0 : const SvxOverlineItem* pOverlineItem = static_cast<const SvxOverlineItem*> (pCurData->GetItem( nIndex, ATTR_FONT_OVERLINE ));
129 0 : const SvxCrossedOutItem* pCrossedOutItem = static_cast<const SvxCrossedOutItem*>(pCurData->GetItem( nIndex, ATTR_FONT_CROSSEDOUT ));
130 0 : const SvxContourItem* pContourItem = static_cast<const SvxContourItem*> (pCurData->GetItem( nIndex, ATTR_FONT_CONTOUR ));
131 0 : const SvxShadowedItem* pShadowedItem = static_cast<const SvxShadowedItem*> (pCurData->GetItem( nIndex, ATTR_FONT_SHADOWED ));
132 0 : const SvxColorItem* pColorItem = static_cast<const SvxColorItem*> (pCurData->GetItem( nIndex, ATTR_FONT_COLOR ));
133 :
134 0 : lcl_SetFontProperties( rFont, *pFontItem, *pWeightItem, *pPostureItem );
135 0 : lcl_SetFontProperties( rCJKFont, *pCJKFontItem, *pCJKWeightItem, *pCJKPostureItem );
136 0 : lcl_SetFontProperties( rCTLFont, *pCTLFontItem, *pCTLWeightItem, *pCTLPostureItem );
137 :
138 0 : Color aColor( pColorItem->GetValue() );
139 0 : if( aColor.GetColor() == COL_TRANSPARENT )
140 0 : aColor = GetSettings().GetStyleSettings().GetWindowTextColor();
141 :
142 : #define SETONALLFONTS( MethodName, Value ) \
143 : rFont.MethodName( Value ); rCJKFont.MethodName( Value ); rCTLFont.MethodName( Value );
144 :
145 0 : SETONALLFONTS( SetUnderline, (FontUnderline)pUnderlineItem->GetValue() )
146 0 : SETONALLFONTS( SetOverline, (FontUnderline)pOverlineItem->GetValue() )
147 0 : SETONALLFONTS( SetStrikeout, (FontStrikeout)pCrossedOutItem->GetValue() )
148 0 : SETONALLFONTS( SetOutline, pContourItem->GetValue() )
149 0 : SETONALLFONTS( SetShadow, pShadowedItem->GetValue() )
150 0 : SETONALLFONTS( SetColor, aColor )
151 0 : SETONALLFONTS( SetSize, aFontSize )
152 0 : SETONALLFONTS( SetTransparent, true )
153 :
154 : #undef SETONALLFONTS
155 : }
156 0 : }
157 :
158 0 : sal_uInt16 ScAutoFmtPreview::GetFormatIndex( size_t nCol, size_t nRow ) const
159 : {
160 : static const sal_uInt16 pnFmtMap[] =
161 : {
162 : 0, 1, 2, 1, 3,
163 : 4, 5, 6, 5, 7,
164 : 8, 9, 10, 9, 11,
165 : 4, 5, 6, 5, 7,
166 : 12, 13, 14, 13, 15
167 : };
168 0 : return pnFmtMap[ maArray.GetCellIndex( nCol, nRow, mbRTL ) ];
169 : }
170 :
171 0 : const SvxBoxItem& ScAutoFmtPreview::GetBoxItem( size_t nCol, size_t nRow ) const
172 : {
173 : OSL_ENSURE( pCurData, "ScAutoFmtPreview::GetBoxItem - no format data found" );
174 0 : return *static_cast< const SvxBoxItem* >( pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BORDER ) );
175 : }
176 :
177 0 : const SvxLineItem& ScAutoFmtPreview::GetDiagItem( size_t nCol, size_t nRow, bool bTLBR ) const
178 : {
179 : OSL_ENSURE( pCurData, "ScAutoFmtPreview::GetDiagItem - no format data found" );
180 0 : return *static_cast< const SvxLineItem* >( pCurData->GetItem( GetFormatIndex( nCol, nRow ), bTLBR ? ATTR_BORDER_TLBR : ATTR_BORDER_BLTR ) );
181 : }
182 :
183 0 : void ScAutoFmtPreview::DrawString( size_t nCol, size_t nRow )
184 : {
185 0 : if ( pCurData )
186 : {
187 :
188 : // Emit the cell text
189 :
190 0 : OUString cellString;
191 0 : bool bNumFormat = pCurData->GetIncludeValueFormat();
192 : sal_uLong nNum;
193 : double nVal;
194 0 : Color* pDummy = NULL;
195 0 : sal_uInt16 nIndex = static_cast< sal_uInt16 >( maArray.GetCellIndex( nCol, nRow, mbRTL ) );
196 :
197 0 : switch( nIndex )
198 : {
199 0 : case 1: cellString = aStrJan; break;
200 0 : case 2: cellString = aStrFeb; break;
201 0 : case 3: cellString = aStrMar; break;
202 0 : case 5: cellString = aStrNorth; break;
203 0 : case 10: cellString = aStrMid; break;
204 0 : case 15: cellString = aStrSouth; break;
205 : case 4:
206 0 : case 20: cellString = aStrSum; break;
207 :
208 : case 6:
209 : case 8:
210 : case 16:
211 0 : case 18: nVal = nIndex;
212 0 : nNum = 5;
213 0 : goto mknum;
214 : case 17:
215 0 : case 7: nVal = nIndex;
216 0 : nNum = 6;
217 0 : goto mknum;
218 : case 11:
219 : case 12:
220 0 : case 13: nVal = nIndex;
221 0 : nNum = 12 == nIndex ? 10 : 9;
222 0 : goto mknum;
223 :
224 0 : case 9: nVal = 21; nNum = 7; goto mknum;
225 0 : case 14: nVal = 36; nNum = 11; goto mknum;
226 0 : case 19: nVal = 51; nNum = 7; goto mknum;
227 0 : case 21: nVal = 33; nNum = 13; goto mknum;
228 0 : case 22: nVal = 36; nNum = 14; goto mknum;
229 0 : case 23: nVal = 39; nNum = 13; goto mknum;
230 0 : case 24: nVal = 108; nNum = 15;
231 : mknum:
232 0 : if( bNumFormat )
233 : {
234 0 : ScNumFormatAbbrev& rNumFormat = (ScNumFormatAbbrev&)pCurData->GetNumFormat( (sal_uInt16) nNum );
235 0 : nNum = rNumFormat.GetFormatIndex( *pNumFmt );
236 : }
237 : else
238 0 : nNum = 0;
239 0 : pNumFmt->GetOutputString( nVal, nNum, cellString, &pDummy );
240 0 : break;
241 : }
242 :
243 0 : if ( !cellString.isEmpty())
244 : {
245 0 : Size aStrSize;
246 0 : sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
247 0 : Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
248 0 : Point aPos = cellRect.TopLeft();
249 0 : sal_uInt16 nRightX = 0;
250 0 : bool bJustify = pCurData->GetIncludeJustify();
251 0 : SvxHorJustifyItem aHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY );
252 : SvxCellHorJustify eJustification;
253 :
254 : // Justification:
255 :
256 : eJustification = mbRTL ? SVX_HOR_JUSTIFY_RIGHT : bJustify ?
257 0 : (SvxCellHorJustify)(static_cast<const SvxHorJustifyItem*>(pCurData->GetItem( nFmtIndex, ATTR_HOR_JUSTIFY ))->GetValue()) :
258 0 : SVX_HOR_JUSTIFY_STANDARD;
259 :
260 0 : if ( pCurData->GetIncludeFont() )
261 : {
262 0 : vcl::Font aFont, aCJKFont, aCTLFont;
263 0 : Size theMaxStrSize;
264 :
265 0 : MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
266 :
267 0 : theMaxStrSize = cellRect.GetSize();
268 0 : theMaxStrSize.Width() -= FRAME_OFFSET;
269 0 : theMaxStrSize.Height() -= FRAME_OFFSET;
270 :
271 0 : aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
272 0 : aScriptedText.SetText( cellString, xBreakIter );
273 0 : aStrSize = aScriptedText.GetTextSize();
274 :
275 0 : if ( theMaxStrSize.Height() < aStrSize.Height() )
276 : {
277 : // if the string does not fit in the row using this font,
278 : // the default font is used
279 0 : aScriptedText.SetDefaultFont();
280 0 : aStrSize = aScriptedText.GetTextSize();
281 : }
282 0 : while ( ( theMaxStrSize.Width() <= aStrSize.Width() )
283 0 : && ( cellString.getLength() > 1 ) )
284 : {
285 0 : if( eJustification == SVX_HOR_JUSTIFY_RIGHT )
286 0 : cellString = cellString.copy(1);
287 : else
288 0 : cellString = cellString.copy(0, cellString.getLength() - 1 );
289 :
290 0 : aScriptedText.SetText( cellString, xBreakIter );
291 0 : aStrSize = aScriptedText.GetTextSize();
292 0 : }
293 : }
294 : else
295 : {
296 0 : aScriptedText.SetDefaultFont();
297 0 : aScriptedText.SetText( cellString, xBreakIter );
298 0 : aStrSize = aScriptedText.GetTextSize();
299 : }
300 :
301 0 : nRightX = (sal_uInt16)( cellRect.GetWidth()
302 0 : - aStrSize.Width()
303 0 : - FRAME_OFFSET );
304 :
305 : // vertical (always center):
306 :
307 0 : aPos.Y() += (mnRowHeight - (sal_uInt16)aStrSize.Height()) / 2;
308 :
309 : // horizontal
310 :
311 0 : if ( eJustification != SVX_HOR_JUSTIFY_STANDARD )
312 : {
313 : sal_uInt16 nHorPos = (sal_uInt16)
314 0 : ((cellRect.GetWidth()-aStrSize.Width())/2);
315 :
316 0 : switch ( eJustification )
317 : {
318 : case SVX_HOR_JUSTIFY_LEFT:
319 0 : aPos.X() += FRAME_OFFSET;
320 0 : break;
321 : case SVX_HOR_JUSTIFY_RIGHT:
322 0 : aPos.X() += nRightX;
323 0 : break;
324 : case SVX_HOR_JUSTIFY_BLOCK:
325 : case SVX_HOR_JUSTIFY_REPEAT:
326 : case SVX_HOR_JUSTIFY_CENTER:
327 0 : aPos.X() += nHorPos;
328 0 : break;
329 : case SVX_HOR_JUSTIFY_STANDARD:
330 : default:
331 : // Standard is not handled here
332 0 : break;
333 : }
334 : }
335 : else
336 : {
337 :
338 : // Standard justification
339 :
340 0 : if ( (nCol == 0) || (nRow == 0) )
341 : {
342 : // Text label to the left or sum left adjusted
343 0 : aPos.X() += FRAME_OFFSET;
344 : }
345 : else
346 : {
347 : // Numbers/Dates right adjusted
348 0 : aPos.X() += nRightX;
349 : }
350 : }
351 :
352 0 : aScriptedText.DrawText( aPos );
353 :
354 0 : }
355 : }
356 0 : }
357 :
358 : #undef FRAME_OFFSET
359 :
360 0 : void ScAutoFmtPreview::DrawStrings()
361 : {
362 0 : for( size_t nRow = 0; nRow < 5; ++nRow )
363 0 : for( size_t nCol = 0; nCol < 5; ++nCol )
364 0 : DrawString( nCol, nRow );
365 0 : }
366 :
367 0 : void ScAutoFmtPreview::DrawBackground()
368 : {
369 0 : if( pCurData )
370 : {
371 0 : for( size_t nRow = 0; nRow < 5; ++nRow )
372 : {
373 0 : for( size_t nCol = 0; nCol < 5; ++nCol )
374 : {
375 : const SvxBrushItem* pItem = static_cast< const SvxBrushItem* >(
376 0 : pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BACKGROUND ) );
377 :
378 0 : aVD.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
379 0 : aVD.SetLineColor();
380 0 : aVD.SetFillColor( pItem->GetColor() );
381 0 : aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) );
382 0 : aVD.Pop();
383 : }
384 : }
385 : }
386 0 : }
387 :
388 0 : void ScAutoFmtPreview::PaintCells()
389 : {
390 0 : if ( pCurData )
391 : {
392 : // 1) background
393 0 : if ( pCurData->GetIncludeBackground() )
394 0 : DrawBackground();
395 :
396 : // 2) values
397 0 : DrawStrings();
398 :
399 : // 3) border
400 0 : if ( pCurData->GetIncludeFrame() )
401 0 : maArray.DrawArray( aVD );
402 : }
403 0 : }
404 :
405 0 : void ScAutoFmtPreview::Init()
406 : {
407 0 : SetBorderStyle( WindowBorderStyle::MONO );
408 0 : maArray.Initialize( 5, 5 );
409 0 : maArray.SetUseDiagDoubleClipping( false );
410 0 : CalcCellArray( false );
411 0 : CalcLineMap();
412 0 : }
413 :
414 0 : void ScAutoFmtPreview::DetectRTL(ScViewData *pViewData)
415 : {
416 0 : SCTAB nCurrentTab = pViewData->GetTabNo();
417 0 : ScDocument* pDoc = pViewData->GetDocument();
418 0 : mbRTL = pDoc->IsLayoutRTL(nCurrentTab);
419 0 : xBreakIter = pDoc->GetBreakIterator();
420 0 : }
421 :
422 0 : void ScAutoFmtPreview::CalcCellArray( bool bFitWidthP )
423 : {
424 0 : maArray.SetXOffset( 2 );
425 0 : maArray.SetAllColWidths( bFitWidthP ? mnDataColWidth2 : mnDataColWidth1 );
426 0 : maArray.SetColWidth( 0, mnLabelColWidth );
427 0 : maArray.SetColWidth( 4, mnLabelColWidth );
428 :
429 0 : maArray.SetYOffset( 2 );
430 0 : maArray.SetAllRowHeights( mnRowHeight );
431 :
432 0 : aPrvSize.Width() = maArray.GetWidth() + 4;
433 0 : aPrvSize.Height() = maArray.GetHeight() + 4;
434 0 : }
435 :
436 0 : inline void lclSetStyleFromBorder( svx::frame::Style& rStyle, const ::editeng::SvxBorderLine* pBorder )
437 : {
438 0 : rStyle.Set( pBorder, 1.0 / TWIPS_PER_POINT, 5 );
439 0 : }
440 :
441 0 : void ScAutoFmtPreview::CalcLineMap()
442 : {
443 0 : if ( pCurData )
444 : {
445 0 : for( size_t nRow = 0; nRow < 5; ++nRow )
446 : {
447 0 : for( size_t nCol = 0; nCol < 5; ++nCol )
448 : {
449 0 : svx::frame::Style aStyle;
450 :
451 0 : const SvxBoxItem& rItem = GetBoxItem( nCol, nRow );
452 0 : lclSetStyleFromBorder( aStyle, rItem.GetLeft() );
453 0 : maArray.SetCellStyleLeft( nCol, nRow, aStyle );
454 0 : lclSetStyleFromBorder( aStyle, rItem.GetRight() );
455 0 : maArray.SetCellStyleRight( nCol, nRow, aStyle );
456 0 : lclSetStyleFromBorder( aStyle, rItem.GetTop() );
457 0 : maArray.SetCellStyleTop( nCol, nRow, aStyle );
458 0 : lclSetStyleFromBorder( aStyle, rItem.GetBottom() );
459 0 : maArray.SetCellStyleBottom( nCol, nRow, aStyle );
460 :
461 0 : lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, true ).GetLine() );
462 0 : maArray.SetCellStyleTLBR( nCol, nRow, aStyle );
463 0 : lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, false ).GetLine() );
464 0 : maArray.SetCellStyleBLTR( nCol, nRow, aStyle );
465 : }
466 : }
467 : }
468 0 : }
469 :
470 0 : void ScAutoFmtPreview::NotifyChange( ScAutoFormatData* pNewData )
471 : {
472 0 : if (pNewData)
473 : {
474 0 : pCurData = pNewData;
475 0 : bFitWidth = pNewData->GetIncludeWidthHeight();
476 : }
477 :
478 0 : CalcCellArray( bFitWidth );
479 0 : CalcLineMap();
480 :
481 0 : DoPaint( Rectangle( Point(0,0), GetSizePixel() ) );
482 0 : }
483 :
484 0 : void ScAutoFmtPreview::DoPaint( const Rectangle& /* rRect */ )
485 : {
486 0 : sal_uInt32 nOldDrawMode = aVD.GetDrawMode();
487 :
488 0 : Size aWndSize( GetSizePixel() );
489 0 : vcl::Font aFont( aVD.GetFont() );
490 0 : Color aBackCol( GetSettings().GetStyleSettings().GetWindowColor() );
491 0 : Point aTmpPoint;
492 0 : Rectangle aRect( aTmpPoint, aWndSize );
493 :
494 0 : aFont.SetTransparent( true );
495 0 : aVD.SetFont( aFont );
496 0 : aVD.SetLineColor();
497 0 : aVD.SetFillColor( aBackCol );
498 0 : aVD.SetOutputSize( aWndSize );
499 0 : aVD.DrawRect( aRect );
500 :
501 0 : PaintCells();
502 0 : SetLineColor();
503 0 : SetFillColor( aBackCol );
504 0 : DrawRect( aRect );
505 :
506 0 : Point aPos( (aWndSize.Width() - aPrvSize.Width()) / 2, (aWndSize.Height() - aPrvSize.Height()) / 2 );
507 0 : if (Application::GetSettings().GetLayoutRTL())
508 0 : aPos.X() = -aPos.X();
509 0 : DrawOutDev( aPos, aWndSize, Point(), aWndSize, aVD );
510 :
511 0 : aVD.SetDrawMode( nOldDrawMode );
512 0 : }
513 :
514 0 : void ScAutoFmtPreview::Paint( const Rectangle& rRect )
515 : {
516 0 : DoPaint( rRect );
517 228 : }
518 :
519 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|