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 <vcl/virdev.hxx>
24 #include <vcl/fixed.hxx>
25 #include <vcl/lstbox.hxx>
26 #include <vcl/button.hxx>
27 #include <vcl/morebtn.hxx>
28 #include <vcl/dialog.hxx>
29 #include <svtools/scriptedtext.hxx>
30 #include <svx/framelinkarray.hxx>
32 #include "viewdata.hxx"
34 class ScAutoFormatData
;
37 class ScAutoFmtPreview
; // s.u.
38 class SvNumberFormatter
;
41 enum AutoFmtLine
{ TOP_LINE
, BOTTOM_LINE
, LEFT_LINE
, RIGHT_LINE
};
43 class SC_DLLPUBLIC ScAutoFmtPreview
: public vcl::Window
46 ScAutoFmtPreview(vcl::Window
* pParent
);
47 void DetectRTL(ScViewData
*pViewData
);
48 virtual ~ScAutoFmtPreview();
49 virtual void dispose() SAL_OVERRIDE
;
51 void NotifyChange( ScAutoFormatData
* pNewData
);
54 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
55 virtual void Resize() SAL_OVERRIDE
;
58 ScAutoFormatData
* pCurData
;
59 ScopedVclPtrInstance
<VirtualDevice
> aVD
;
60 css::uno::Reference
<css::i18n::XBreakIterator
> xBreakIter
;
62 svx::frame::Array maArray
; /// Implementation to draw the frame borders.
69 const OUString aStrJan
;
70 const OUString aStrFeb
;
71 const OUString aStrMar
;
72 const OUString aStrNorth
;
73 const OUString aStrMid
;
74 const OUString aStrSouth
;
75 const OUString aStrSum
;
76 SvNumberFormatter
* pNumFmt
;
78 SAL_DLLPRIVATE
void Init();
79 SAL_DLLPRIVATE
void DoPaint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
);
80 SAL_DLLPRIVATE
void CalcCellArray(bool bFitWidth
);
81 SAL_DLLPRIVATE
void CalcLineMap();
82 SAL_DLLPRIVATE
void PaintCells(vcl::RenderContext
& rRenderContext
);
84 /* Usage of type size_t instead of SCCOL/SCROW is correct here - used in
85 conjunction with class svx::frame::Array (svx/framelinkarray.hxx), which
86 expects size_t coordinates. */
88 SAL_DLLPRIVATE sal_uInt16
GetFormatIndex( size_t nCol
, size_t nRow
) const;
89 SAL_DLLPRIVATE
const SvxBoxItem
& GetBoxItem( size_t nCol
, size_t nRow
) const;
90 SAL_DLLPRIVATE
const SvxLineItem
& GetDiagItem( size_t nCol
, size_t nRow
, bool bTLBR
) const;
92 SAL_DLLPRIVATE
void DrawString(vcl::RenderContext
& rRenderContext
, size_t nCol
, size_t nRow
);
93 SAL_DLLPRIVATE
void DrawStrings(vcl::RenderContext
& rRenderContext
);
94 SAL_DLLPRIVATE
void DrawBackground(vcl::RenderContext
& rRenderContext
);
96 SAL_DLLPRIVATE
void MakeFonts(sal_uInt16 nIndex
, vcl::Font
& rFont
,
97 vcl::Font
& rCJKFont
, vcl::Font
& rCTLFont
);
99 SAL_DLLPRIVATE
void CheckPriority(sal_uInt16 nCurLine
, AutoFmtLine eLine
, editeng::SvxBorderLine
& rLine
);
100 SAL_DLLPRIVATE
void GetLines(sal_uInt16 nIndex
, AutoFmtLine eLine
,
101 editeng::SvxBorderLine
& rLineD
, editeng::SvxBorderLine
& rLineLT
,
102 editeng::SvxBorderLine
& rLineL
, editeng::SvxBorderLine
& rLineLB
,
103 editeng::SvxBorderLine
& rLineRT
, editeng::SvxBorderLine
& rLineR
,
104 editeng::SvxBorderLine
& rLineRB
);
107 #endif // INCLUDED_SC_SOURCE_UI_INC_AUTOFMT_HXX
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */