Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / autofmt.hxx
blob775522b5d15ef07997486560403a97bab0475563
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 SC_AUTOFMT_HXX
21 #define SC_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>
31 #include "scdllapi.h"
33 //------------------------------------------------------------------------
35 class ScAutoFormatData;
36 class SvxBoxItem;
37 class SvxLineItem;
38 class ScAutoFmtPreview; // s.u.
39 class SvNumberFormatter;
40 class ScDocument;
42 //------------------------------------------------------------------------
44 enum AutoFmtLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE };
46 //========================================================================
48 class SC_DLLPUBLIC ScAutoFmtPreview : public Window
50 public:
51 ScAutoFmtPreview( Window* pParent, const ResId& rRes, ScDocument* pDoc );
52 ~ScAutoFmtPreview();
54 void NotifyChange( ScAutoFormatData* pNewData );
56 protected:
57 virtual void Paint( const Rectangle& rRect );
59 private:
60 ScAutoFormatData* pCurData;
61 VirtualDevice aVD;
62 SvtScriptedTextHelper aScriptedText;
63 ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIter;
64 bool bFitWidth;
65 svx::frame::Array maArray; /// Implementation to draw the frame borders.
66 bool mbRTL;
67 Size aPrvSize;
68 long mnLabelColWidth;
69 long mnDataColWidth1;
70 long mnDataColWidth2;
71 long mnRowHeight;
72 const OUString aStrJan;
73 const OUString aStrFeb;
74 const OUString aStrMar;
75 const OUString aStrNorth;
76 const OUString aStrMid;
77 const OUString aStrSouth;
78 const OUString aStrSum;
79 SvNumberFormatter* pNumFmt;
80 //-------------------------------------------
81 SC_DLLPRIVATE void Init ();
82 SC_DLLPRIVATE void DoPaint ( const Rectangle& rRect );
83 SC_DLLPRIVATE void CalcCellArray ( bool bFitWidth );
84 SC_DLLPRIVATE void CalcLineMap ();
85 SC_DLLPRIVATE void PaintCells ();
87 /* Usage of type size_t instead of SCCOL/SCROW is correct here - used in
88 conjunction with class svx::frame::Array (svx/framelinkarray.hxx), which
89 expects size_t coordinates. */
91 SC_DLLPRIVATE sal_uInt16 GetFormatIndex( size_t nCol, size_t nRow ) const;
92 SC_DLLPRIVATE const SvxBoxItem& GetBoxItem( size_t nCol, size_t nRow ) const;
93 SC_DLLPRIVATE const SvxLineItem& GetDiagItem( size_t nCol, size_t nRow, bool bTLBR ) const;
95 SC_DLLPRIVATE void DrawString( size_t nCol, size_t nRow );
96 SC_DLLPRIVATE void DrawStrings();
97 SC_DLLPRIVATE void DrawBackground();
99 SC_DLLPRIVATE void MakeFonts ( sal_uInt16 nIndex,
100 Font& rFont,
101 Font& rCJKFont,
102 Font& rCTLFont );
104 SC_DLLPRIVATE OUString MakeNumberString( OUString cellString, sal_Bool bAddDec );
105 SC_DLLPRIVATE void DrawFrameLine ( const ::editeng::SvxBorderLine& rLineD,
106 Point from,
107 Point to,
108 sal_Bool bHorizontal,
109 const ::editeng::SvxBorderLine& rLineLT,
110 const ::editeng::SvxBorderLine& rLineL,
111 const ::editeng::SvxBorderLine& rLineLB,
112 const ::editeng::SvxBorderLine& rLineRT,
113 const ::editeng::SvxBorderLine& rLineR,
114 const ::editeng::SvxBorderLine& rLineRB );
115 SC_DLLPRIVATE void CheckPriority ( sal_uInt16 nCurLine,
116 AutoFmtLine eLine,
117 ::editeng::SvxBorderLine& rLine );
118 SC_DLLPRIVATE void GetLines ( sal_uInt16 nIndex, AutoFmtLine eLine,
119 ::editeng::SvxBorderLine& rLineD,
120 ::editeng::SvxBorderLine& rLineLT,
121 ::editeng::SvxBorderLine& rLineL,
122 ::editeng::SvxBorderLine& rLineLB,
123 ::editeng::SvxBorderLine& rLineRT,
124 ::editeng::SvxBorderLine& rLineR,
125 ::editeng::SvxBorderLine& rLineRB );
128 #endif // SC_AUTOFMT_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */