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 <editeng/boxitem.hxx>
22 #include <editeng/brushitem.hxx>
23 #include <editeng/contouritem.hxx>
24 #include <editeng/colritem.hxx>
25 #include <editeng/crossedoutitem.hxx>
26 #include <editeng/fontitem.hxx>
27 #include <editeng/justifyitem.hxx>
28 #include <editeng/lineitem.hxx>
29 #include <editeng/postitem.hxx>
30 #include <editeng/shdditem.hxx>
31 #include <editeng/udlnitem.hxx>
32 #include <editeng/wghtitem.hxx>
33 #include <svl/zforlist.hxx>
34 #include <svtools/scriptedtext.hxx>
35 #include <svx/framelink.hxx>
36 #include <vcl/settings.hxx>
37 #include <vcl/svapp.hxx>
38 #include <vcl/virdev.hxx>
39 #include <comphelper/processfactory.hxx>
40 #include <drawinglayer/processor2d/processor2dtools.hxx>
41 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
42 
43 #include <strings.hrc>
44 #include <zforauto.hxx>
45 #include <global.hxx>
46 #include <autoform.hxx>
47 #include <autofmt.hxx>
48 #include <scresid.hxx>
49 #include <document.hxx>
50 #include <viewdata.hxx>
51 
52 #define FRAME_OFFSET 4
53 
54 // ScAutoFmtPreview
55 
ScAutoFmtPreview()56 ScAutoFmtPreview::ScAutoFmtPreview()
57     : pCurData(nullptr)
58     , bFitWidth(false)
59     , mbRTL(false)
60     , aStrJan(ScResId(STR_JAN))
61     , aStrFeb(ScResId(STR_FEB))
62     , aStrMar(ScResId(STR_MAR))
63     , aStrNorth(ScResId(STR_NORTH))
64     , aStrMid(ScResId(STR_MID))
65     , aStrSouth(ScResId(STR_SOUTH))
66     , aStrSum(ScResId(STR_SUM))
67     , pNumFmt(new SvNumberFormatter(::comphelper::getProcessComponentContext(), ScGlobal::eLnge))
68 {
69     Init();
70 }
71 
SetDrawingArea(weld::DrawingArea * pDrawingArea)72 void ScAutoFmtPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
73 {
74     aVD.disposeAndReset(VclPtr<VirtualDevice>::Create(pDrawingArea->get_ref_device()));
75     CustomWidgetController::SetDrawingArea(pDrawingArea);
76 }
77 
Resize()78 void ScAutoFmtPreview::Resize()
79 {
80     Size aSize(GetOutputSizePixel());
81     aPrvSize  = Size(aSize.Width() - 6, aSize.Height() - 30);
82     mnLabelColWidth = (aPrvSize.Width() - 4) / 4 - 12;
83     mnDataColWidth1 = (aPrvSize.Width() - 4 - 2 * mnLabelColWidth) / 3;
84     mnDataColWidth2 = (aPrvSize.Width() - 4 - 2 * mnLabelColWidth) / 4;
85     mnRowHeight = (aPrvSize.Height() - 4) / 5;
86     NotifyChange(pCurData);
87 }
88 
~ScAutoFmtPreview()89 ScAutoFmtPreview::~ScAutoFmtPreview()
90 {
91 }
92 
lcl_SetFontProperties(vcl::Font & rFont,const SvxFontItem & rFontItem,const SvxWeightItem & rWeightItem,const SvxPostureItem & rPostureItem)93 static void lcl_SetFontProperties(
94         vcl::Font& rFont,
95         const SvxFontItem& rFontItem,
96         const SvxWeightItem& rWeightItem,
97         const SvxPostureItem& rPostureItem )
98 {
99     rFont.SetFamily     ( rFontItem.GetFamily() );
100     rFont.SetFamilyName ( rFontItem.GetFamilyName() );
101     rFont.SetStyleName  ( rFontItem.GetStyleName() );
102     rFont.SetCharSet    ( rFontItem.GetCharSet() );
103     rFont.SetPitch      ( rFontItem.GetPitch() );
104     rFont.SetWeight     ( rWeightItem.GetValue() );
105     rFont.SetItalic     ( rPostureItem.GetValue() );
106 }
107 
MakeFonts(vcl::RenderContext const & rRenderContext,sal_uInt16 nIndex,vcl::Font & rFont,vcl::Font & rCJKFont,vcl::Font & rCTLFont)108 void ScAutoFmtPreview::MakeFonts(vcl::RenderContext const& rRenderContext, sal_uInt16 nIndex, vcl::Font& rFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont)
109 {
110     if ( pCurData )
111     {
112         rFont = rCJKFont = rCTLFont = rRenderContext.GetFont();
113         Size aFontSize(rFont.GetFontSize().Width(), 10 * rRenderContext.GetDPIScaleFactor());
114 
115         const SvxFontItem*        pFontItem       = pCurData->GetItem( nIndex, ATTR_FONT );
116         const SvxWeightItem*      pWeightItem     = pCurData->GetItem( nIndex, ATTR_FONT_WEIGHT );
117         const SvxPostureItem*     pPostureItem    = pCurData->GetItem( nIndex, ATTR_FONT_POSTURE );
118         const SvxFontItem*        pCJKFontItem    = pCurData->GetItem( nIndex, ATTR_CJK_FONT );
119         const SvxWeightItem*      pCJKWeightItem  = pCurData->GetItem( nIndex, ATTR_CJK_FONT_WEIGHT );
120         const SvxPostureItem*     pCJKPostureItem = pCurData->GetItem( nIndex, ATTR_CJK_FONT_POSTURE );
121         const SvxFontItem*        pCTLFontItem    = pCurData->GetItem( nIndex, ATTR_CTL_FONT );
122         const SvxWeightItem*      pCTLWeightItem  = pCurData->GetItem( nIndex, ATTR_CTL_FONT_WEIGHT );
123         const SvxPostureItem*     pCTLPostureItem = pCurData->GetItem( nIndex, ATTR_CTL_FONT_POSTURE );
124         const SvxUnderlineItem*   pUnderlineItem  = pCurData->GetItem( nIndex, ATTR_FONT_UNDERLINE );
125         const SvxOverlineItem*    pOverlineItem   = pCurData->GetItem( nIndex, ATTR_FONT_OVERLINE );
126         const SvxCrossedOutItem*  pCrossedOutItem = pCurData->GetItem( nIndex, ATTR_FONT_CROSSEDOUT );
127         const SvxContourItem*     pContourItem    = pCurData->GetItem( nIndex, ATTR_FONT_CONTOUR );
128         const SvxShadowedItem*    pShadowedItem   = pCurData->GetItem( nIndex, ATTR_FONT_SHADOWED );
129         const SvxColorItem*       pColorItem      = pCurData->GetItem( nIndex, ATTR_FONT_COLOR );
130 
131         lcl_SetFontProperties( rFont, *pFontItem, *pWeightItem, *pPostureItem );
132         lcl_SetFontProperties( rCJKFont, *pCJKFontItem, *pCJKWeightItem, *pCJKPostureItem );
133         lcl_SetFontProperties( rCTLFont, *pCTLFontItem, *pCTLWeightItem, *pCTLPostureItem );
134 
135         Color aColor( pColorItem->GetValue() );
136         if( aColor == COL_TRANSPARENT )
137             aColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor();
138 
139 #define SETONALLFONTS( MethodName, Value ) \
140 rFont.MethodName( Value ); rCJKFont.MethodName( Value ); rCTLFont.MethodName( Value );
141 
142         SETONALLFONTS( SetUnderline,        pUnderlineItem->GetValue() )
143         SETONALLFONTS( SetOverline,         pOverlineItem->GetValue() )
144         SETONALLFONTS( SetStrikeout,        pCrossedOutItem->GetValue() )
145         SETONALLFONTS( SetOutline,          pContourItem->GetValue() )
146         SETONALLFONTS( SetShadow,           pShadowedItem->GetValue() )
147         SETONALLFONTS( SetColor,            aColor )
148         SETONALLFONTS( SetFontSize,  aFontSize )
149         SETONALLFONTS( SetTransparent,      true )
150 
151 #undef SETONALLFONTS
152     }
153 }
154 
GetFormatIndex(size_t nCol,size_t nRow) const155 sal_uInt16 ScAutoFmtPreview::GetFormatIndex( size_t nCol, size_t nRow ) const
156 {
157     static const sal_uInt16 pnFmtMap[] =
158     {
159         0,  1,  2,  1,  3,
160         4,  5,  6,  5,  7,
161         8,  9,  10, 9,  11,
162         4,  5,  6,  5,  7,
163         12, 13, 14, 13, 15
164     };
165     return pnFmtMap[ maArray.GetCellIndex( nCol, nRow, mbRTL ) ];
166 }
167 
GetBoxItem(size_t nCol,size_t nRow) const168 const SvxBoxItem& ScAutoFmtPreview::GetBoxItem( size_t nCol, size_t nRow ) const
169 {
170     OSL_ENSURE( pCurData, "ScAutoFmtPreview::GetBoxItem - no format data found" );
171     return * pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BORDER );
172 }
173 
GetDiagItem(size_t nCol,size_t nRow,bool bTLBR) const174 const SvxLineItem& ScAutoFmtPreview::GetDiagItem( size_t nCol, size_t nRow, bool bTLBR ) const
175 {
176     OSL_ENSURE( pCurData, "ScAutoFmtPreview::GetDiagItem - no format data found" );
177     return * pCurData->GetItem( GetFormatIndex( nCol, nRow ), bTLBR ? ATTR_BORDER_TLBR : ATTR_BORDER_BLTR );
178 }
179 
DrawString(vcl::RenderContext & rRenderContext,size_t nCol,size_t nRow)180 void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCol, size_t nRow)
181 {
182     if (!pCurData)
183     {
184         return;
185     }
186 
187     // Emit the cell text
188 
189     OUString cellString;
190     bool bNumFormat = pCurData->GetIncludeValueFormat();
191     sal_uInt32 nNum;
192     double nVal;
193     Color* pDummy = nullptr;
194     sal_uInt16 nIndex = static_cast<sal_uInt16>(maArray.GetCellIndex(nCol, nRow, mbRTL));
195 
196     switch (nIndex)
197     {
198         case  1: cellString = aStrJan;          break;
199         case  2: cellString = aStrFeb;          break;
200         case  3: cellString = aStrMar;          break;
201         case  5: cellString = aStrNorth;        break;
202         case 10: cellString = aStrMid;          break;
203         case 15: cellString = aStrSouth;        break;
204         case  4:
205         case 20: cellString = aStrSum;          break;
206 
207         case  6:
208         case  8:
209         case 16:
210         case 18: nVal = nIndex;
211                  nNum = 5;
212                  goto mknum;
213         case 17:
214         case  7: nVal = nIndex;
215                  nNum = 6;
216                  goto mknum;
217         case 11:
218         case 12:
219         case 13: nVal = nIndex;
220                  nNum = 12 == nIndex ? 10 : 9;
221                  goto mknum;
222 
223         case  9: nVal = 21; nNum = 7; goto mknum;
224         case 14: nVal = 36; nNum = 11; goto mknum;
225         case 19: nVal = 51; nNum = 7; goto mknum;
226         case 21: nVal = 33; nNum = 13; goto mknum;
227         case 22: nVal = 36; nNum = 14; goto mknum;
228         case 23: nVal = 39; nNum = 13; goto mknum;
229         case 24: nVal = 108; nNum = 15;
230         mknum:
231             if (bNumFormat)
232             {
233                 ScNumFormatAbbrev& rNumFormat = const_cast<ScNumFormatAbbrev&>(pCurData->GetNumFormat(sal_uInt16(nNum)));
234                 nNum = rNumFormat.GetFormatIndex(*pNumFmt);
235             }
236             else
237                 nNum = 0;
238             pNumFmt->GetOutputString(nVal, nNum, cellString, &pDummy);
239             break;
240     }
241 
242     if (!cellString.isEmpty())
243     {
244 
245         Size aStrSize;
246         sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
247         const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow, true ));
248         Point aPos(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
249         sal_uInt16 nRightX = 0;
250         bool bJustify = pCurData->GetIncludeJustify();
251         SvxCellHorJustify eJustification;
252 
253         SvtScriptedTextHelper aScriptedText(rRenderContext);
254 
255         // Justification:
256 
257         eJustification  = mbRTL ? SvxCellHorJustify::Right : bJustify ?
258             pCurData->GetItem(nFmtIndex, ATTR_HOR_JUSTIFY)->GetValue() :
259             SvxCellHorJustify::Standard;
260 
261         if (pCurData->GetIncludeFont())
262         {
263             vcl::Font aFont, aCJKFont, aCTLFont;
264             Size theMaxStrSize;
265 
266             MakeFonts(rRenderContext, nFmtIndex, aFont, aCJKFont, aCTLFont);
267 
268             theMaxStrSize = Size(basegfx::fround(cellRange.getWidth()), basegfx::fround(cellRange.getHeight()));
269             theMaxStrSize.AdjustWidth( -(FRAME_OFFSET) );
270             theMaxStrSize.AdjustHeight( -(FRAME_OFFSET) );
271 
272             aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
273             aScriptedText.SetText(cellString, xBreakIter);
274             aStrSize = aScriptedText.GetTextSize();
275 
276             if (theMaxStrSize.Height() < aStrSize.Height())
277             {
278                 // if the string does not fit in the row using this font,
279                 // the default font is used
280                 aScriptedText.SetDefaultFont();
281                 aStrSize = aScriptedText.GetTextSize();
282             }
283             while((theMaxStrSize.Width() <= aStrSize.Width()) && (cellString.getLength() > 1))
284             {
285                 if( eJustification == SvxCellHorJustify::Right )
286                     cellString = cellString.copy(1);
287                 else
288                     cellString = cellString.copy(0, cellString.getLength() - 1 );
289 
290                 aScriptedText.SetText( cellString, xBreakIter );
291                 aStrSize = aScriptedText.GetTextSize();
292             }
293         }
294         else
295         {
296             aScriptedText.SetDefaultFont();
297             aScriptedText.SetText( cellString, xBreakIter );
298             aStrSize = aScriptedText.GetTextSize();
299         }
300 
301         nRightX  = sal_uInt16(basegfx::fround(cellRange.getWidth()) - aStrSize.Width() - FRAME_OFFSET);
302 
303         // vertical (always center):
304 
305         aPos.AdjustY((mnRowHeight - static_cast<sal_uInt16>(aStrSize.Height())) / 2 );
306 
307         // horizontal
308 
309         if (eJustification != SvxCellHorJustify::Standard)
310         {
311             sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
312             //sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
313 
314             switch (eJustification)
315             {
316                 case SvxCellHorJustify::Left:
317                     aPos.AdjustX(FRAME_OFFSET );
318                     break;
319                 case SvxCellHorJustify::Right:
320                     aPos.AdjustX(nRightX );
321                     break;
322                 case SvxCellHorJustify::Block:
323                 case SvxCellHorJustify::Repeat:
324                 case SvxCellHorJustify::Center:
325                     aPos.AdjustX(nHorPos );
326                     break;
327                 // coverity[dead_error_line] - following conditions exist to avoid compiler warning
328                 case SvxCellHorJustify::Standard:
329                 default:
330                     // Standard is not handled here
331                     break;
332             }
333         }
334         else
335         {
336 
337             // Standard justification
338 
339             if (nCol == 0 || nRow == 0)
340             {
341                 // Text label to the left or sum left adjusted
342                 aPos.AdjustX(FRAME_OFFSET );
343             }
344             else
345             {
346                  // Numbers/Dates right adjusted
347                 aPos.AdjustX(nRightX );
348             }
349         }
350         aScriptedText.DrawText(aPos);
351     }
352 }
353 
354 #undef FRAME_OFFSET
355 
DrawBackground(vcl::RenderContext & rRenderContext)356 void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext)
357 {
358     if (pCurData)
359     {
360         for(size_t nRow = 0; nRow < 5; ++nRow)
361         {
362             for(size_t nCol = 0; nCol < 5; ++nCol)
363             {
364                 const SvxBrushItem* pItem =
365                     pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BACKGROUND );
366 
367                 rRenderContext.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
368                 rRenderContext.SetLineColor();
369                 rRenderContext.SetFillColor( pItem->GetColor() );
370 
371                 const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
372                 rRenderContext.DrawRect(
373                     tools::Rectangle(
374                         basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
375                         basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())));
376 
377                 rRenderContext.Pop();
378             }
379         }
380     }
381 }
382 
PaintCells(vcl::RenderContext & rRenderContext)383 void ScAutoFmtPreview::PaintCells(vcl::RenderContext& rRenderContext)
384 {
385     if (pCurData)
386     {
387         // 1) background
388         if (pCurData->GetIncludeBackground())
389             DrawBackground(rRenderContext);
390 
391         // 2) values
392         for(size_t nRow = 0; nRow < 5; ++nRow)
393             for(size_t nCol = 0; nCol < 5; ++nCol)
394                 DrawString(rRenderContext, nCol, nRow);
395 
396         // 3) border
397         if (pCurData->GetIncludeFrame())
398         {
399             const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
400             std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
401                 drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
402                     rRenderContext,
403                     aNewViewInformation2D));
404 
405             if (pProcessor2D)
406             {
407                 pProcessor2D->process(maArray.CreateB2DPrimitiveArray());
408                 pProcessor2D.reset();
409             }
410         }
411     }
412 }
413 
Init()414 void ScAutoFmtPreview::Init()
415 {
416     maArray.Initialize( 5, 5 );
417     mnLabelColWidth = 0;
418     mnDataColWidth1 = 0;
419     mnDataColWidth2 = 0;
420     mnRowHeight = 0;
421     CalcCellArray( false );
422     CalcLineMap();
423 }
424 
DetectRTL(const ScViewData * pViewData)425 void ScAutoFmtPreview::DetectRTL(const ScViewData *pViewData)
426 {
427     SCTAB nCurrentTab = pViewData->GetTabNo();
428     ScDocument* pDoc = pViewData->GetDocument();
429     mbRTL = pDoc->IsLayoutRTL(nCurrentTab);
430     xBreakIter = pDoc->GetBreakIterator();
431 }
432 
CalcCellArray(bool bFitWidthP)433 void ScAutoFmtPreview::CalcCellArray( bool bFitWidthP )
434 {
435     maArray.SetXOffset( 2 );
436     maArray.SetAllColWidths( bFitWidthP ? mnDataColWidth2 : mnDataColWidth1 );
437     maArray.SetColWidth( 0, mnLabelColWidth );
438     maArray.SetColWidth( 4, mnLabelColWidth );
439 
440     maArray.SetYOffset( 2 );
441     maArray.SetAllRowHeights( mnRowHeight );
442 
443     aPrvSize.setWidth( maArray.GetWidth() + 4 );
444     aPrvSize.setHeight( maArray.GetHeight() + 4 );
445 }
446 
lclSetStyleFromBorder(svx::frame::Style & rStyle,const::editeng::SvxBorderLine * pBorder)447 static void lclSetStyleFromBorder( svx::frame::Style& rStyle, const ::editeng::SvxBorderLine* pBorder )
448 {
449     rStyle.Set( pBorder, 1.0 / TWIPS_PER_POINT, 5 );
450 }
451 
CalcLineMap()452 void ScAutoFmtPreview::CalcLineMap()
453 {
454     if ( pCurData )
455     {
456         for( size_t nRow = 0; nRow < 5; ++nRow )
457         {
458             for( size_t nCol = 0; nCol < 5; ++nCol )
459             {
460                 svx::frame::Style aStyle;
461 
462                 const SvxBoxItem& rItem = GetBoxItem( nCol, nRow );
463                 lclSetStyleFromBorder( aStyle, rItem.GetLeft() );
464                 maArray.SetCellStyleLeft( nCol, nRow, aStyle );
465                 lclSetStyleFromBorder( aStyle, rItem.GetRight() );
466                 maArray.SetCellStyleRight( nCol, nRow, aStyle );
467                 lclSetStyleFromBorder( aStyle, rItem.GetTop() );
468                 maArray.SetCellStyleTop( nCol, nRow, aStyle );
469                 lclSetStyleFromBorder( aStyle, rItem.GetBottom() );
470                 maArray.SetCellStyleBottom( nCol, nRow, aStyle );
471 
472                 lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, true ).GetLine() );
473                 maArray.SetCellStyleTLBR( nCol, nRow, aStyle );
474                 lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, false ).GetLine() );
475                 maArray.SetCellStyleBLTR( nCol, nRow, aStyle );
476             }
477         }
478     }
479 }
480 
NotifyChange(ScAutoFormatData * pNewData)481 void ScAutoFmtPreview::NotifyChange( ScAutoFormatData* pNewData )
482 {
483     if (pNewData)
484     {
485         pCurData = pNewData;
486         bFitWidth = pNewData->GetIncludeWidthHeight();
487     }
488 
489     CalcCellArray( bFitWidth );
490     CalcLineMap();
491 
492     Invalidate();
493 }
494 
DoPaint(vcl::RenderContext & rRenderContext)495 void ScAutoFmtPreview::DoPaint(vcl::RenderContext& rRenderContext)
496 {
497     rRenderContext.Push(PushFlags::ALL);
498     DrawModeFlags nOldDrawMode = aVD->GetDrawMode();
499 
500     Size aWndSize(GetOutputSizePixel());
501     vcl::Font aFont(aVD->GetFont());
502     Color aBackCol(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor());
503     tools::Rectangle aRect(Point(), aWndSize);
504 
505     aFont.SetTransparent( true );
506     aVD->SetFont(aFont);
507     aVD->SetLineColor();
508     aVD->SetFillColor(aBackCol);
509     aVD->SetOutputSize(aWndSize);
510     aVD->DrawRect(aRect);
511 
512     PaintCells(*aVD);
513 
514     rRenderContext.SetLineColor();
515     rRenderContext.SetFillColor(aBackCol);
516     rRenderContext.DrawRect(aRect);
517 
518     Point aPos((aWndSize.Width() - aPrvSize.Width()) / 2, (aWndSize.Height() - aPrvSize.Height()) / 2);
519     if (AllSettings::GetLayoutRTL())
520        aPos.setX( -aPos.X() );
521     rRenderContext.DrawOutDev(aPos, aWndSize, Point(), aWndSize, *aVD);
522     aVD->SetDrawMode(nOldDrawMode);
523     rRenderContext.Pop();
524 }
525 
Paint(vcl::RenderContext & rRenderContext,const tools::Rectangle &)526 void ScAutoFmtPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
527 {
528     DoPaint(rRenderContext);
529 }
530 
531 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
532