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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_AUTOFMT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_AUTOFMT_HXX
23 #include <svx/framelinkarray.hxx>
25 #include <vcl/customweld.hxx>
27 namespace com::sun::star::i18n
{ class XBreakIterator
; }
29 class ScAutoFormatData
;
32 class SvNumberFormatter
;
36 class SC_DLLPUBLIC ScAutoFmtPreview
: public weld::CustomWidgetController
40 void DetectRTL(const ScViewData
*pViewData
);
41 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
42 virtual ~ScAutoFmtPreview() override
;
44 void NotifyChange( ScAutoFormatData
* pNewData
);
47 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
48 virtual void Resize() override
;
51 ScAutoFormatData
* pCurData
;
52 ScopedVclPtrInstance
<VirtualDevice
> aVD
;
53 css::uno::Reference
<css::i18n::XBreakIterator
> xBreakIter
;
55 svx::frame::Array maArray
; /// Implementation to draw the frame borders.
58 tools::Long mnLabelColWidth
;
59 tools::Long mnDataColWidth1
;
60 tools::Long mnDataColWidth2
;
61 tools::Long mnRowHeight
;
62 const OUString aStrJan
;
63 const OUString aStrFeb
;
64 const OUString aStrMar
;
65 const OUString aStrNorth
;
66 const OUString aStrMid
;
67 const OUString aStrSouth
;
68 const OUString aStrSum
;
69 std::unique_ptr
<SvNumberFormatter
> pNumFmt
;
71 SAL_DLLPRIVATE
void Init();
72 SAL_DLLPRIVATE
void DoPaint(vcl::RenderContext
& rRenderContext
);
73 SAL_DLLPRIVATE
void CalcCellArray(bool bFitWidth
);
74 SAL_DLLPRIVATE
void CalcLineMap();
75 SAL_DLLPRIVATE
void PaintCells(vcl::RenderContext
& rRenderContext
);
77 /* Usage of type size_t instead of SCCOL/SCROW is correct here - used in
78 conjunction with class svx::frame::Array (svx/framelinkarray.hxx), which
79 expects size_t coordinates. */
81 SAL_DLLPRIVATE sal_uInt16
GetFormatIndex( size_t nCol
, size_t nRow
) const;
82 SAL_DLLPRIVATE
const SvxBoxItem
& GetBoxItem( size_t nCol
, size_t nRow
) const;
83 SAL_DLLPRIVATE
const SvxLineItem
& GetDiagItem( size_t nCol
, size_t nRow
, bool bTLBR
) const;
85 SAL_DLLPRIVATE
void DrawString(vcl::RenderContext
& rRenderContext
, size_t nCol
, size_t nRow
);
86 SAL_DLLPRIVATE
void DrawBackground(vcl::RenderContext
& rRenderContext
);
88 SAL_DLLPRIVATE
void MakeFonts(vcl::RenderContext
const& rRenderContext
, sal_uInt16 nIndex
,
89 vcl::Font
& rFont
, vcl::Font
& rCJKFont
, vcl::Font
& rCTLFont
);
92 #endif // INCLUDED_SC_SOURCE_UI_INC_AUTOFMT_HXX
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */