1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <svx/framelinkarray.hxx>
24 #include <vcl/customweld.hxx>
26 namespace com::sun::star::i18n
{ class XBreakIterator
; }
28 class ScAutoFormatData
;
31 class SvNumberFormatter
;
35 class SC_DLLPUBLIC ScAutoFmtPreview
: public weld::CustomWidgetController
39 void DetectRTL(const ScViewData
& rViewData
);
40 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
41 virtual ~ScAutoFmtPreview() override
;
43 void NotifyChange( ScAutoFormatData
* pNewData
);
46 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
47 virtual void Resize() override
;
50 ScAutoFormatData
* pCurData
;
51 ScopedVclPtrInstance
<VirtualDevice
> aVD
;
52 css::uno::Reference
<css::i18n::XBreakIterator
> xBreakIter
;
54 svx::frame::Array maArray
; /// Implementation to draw the frame borders.
57 tools::Long mnLabelColWidth
;
58 tools::Long mnDataColWidth1
;
59 tools::Long mnDataColWidth2
;
60 tools::Long mnRowHeight
;
61 const OUString aStrJan
;
62 const OUString aStrFeb
;
63 const OUString aStrMar
;
64 const OUString aStrNorth
;
65 const OUString aStrMid
;
66 const OUString aStrSouth
;
67 const OUString aStrSum
;
68 std::unique_ptr
<SvNumberFormatter
> pNumFmt
;
70 SAL_DLLPRIVATE
void Init();
71 SAL_DLLPRIVATE
void DoPaint(vcl::RenderContext
& rRenderContext
);
72 SAL_DLLPRIVATE
void CalcCellArray(bool bFitWidth
);
73 SAL_DLLPRIVATE
void CalcLineMap();
74 SAL_DLLPRIVATE
void PaintCells(vcl::RenderContext
& rRenderContext
);
76 /* Usage of type size_t instead of SCCOL/SCROW is correct here - used in
77 conjunction with class svx::frame::Array (svx/framelinkarray.hxx), which
78 expects size_t coordinates. */
80 SAL_DLLPRIVATE sal_uInt16
GetFormatIndex( size_t nCol
, size_t nRow
) const;
81 SAL_DLLPRIVATE
const SvxBoxItem
& GetBoxItem( size_t nCol
, size_t nRow
) const;
82 SAL_DLLPRIVATE
const SvxLineItem
& GetDiagItem( size_t nCol
, size_t nRow
, bool bTLBR
) const;
84 SAL_DLLPRIVATE
void DrawString(vcl::RenderContext
& rRenderContext
, size_t nCol
, size_t nRow
);
85 SAL_DLLPRIVATE
void DrawBackground(vcl::RenderContext
& rRenderContext
);
87 SAL_DLLPRIVATE
void MakeFonts(vcl::RenderContext
const& rRenderContext
, sal_uInt16 nIndex
,
88 vcl::Font
& rFont
, vcl::Font
& rCJKFont
, vcl::Font
& rCTLFont
);
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */