1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SC_AUTOFMT_HXX 29*cdf0e10cSrcweir #define SC_AUTOFMT_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef _VIRDEV_HXX //autogen 32*cdf0e10cSrcweir #include <vcl/virdev.hxx> 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #ifndef SV_FIXED_HXX 35*cdf0e10cSrcweir #include <vcl/fixed.hxx> 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #ifndef SV_LSTBOX_HXX 38*cdf0e10cSrcweir #include <vcl/lstbox.hxx> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #ifndef SV_BUTTON_HXX 41*cdf0e10cSrcweir #include <vcl/button.hxx> 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #ifndef SV_MOREBTN_HXX 44*cdf0e10cSrcweir #include <vcl/morebtn.hxx> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #ifndef _DIALOG_HXX //autogen 47*cdf0e10cSrcweir #include <vcl/dialog.hxx> 48*cdf0e10cSrcweir #endif 49*cdf0e10cSrcweir #include <svtools/scriptedtext.hxx> 50*cdf0e10cSrcweir #include <svx/framelinkarray.hxx> 51*cdf0e10cSrcweir #include "scdllapi.h" 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir //------------------------------------------------------------------------ 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir class ScAutoFormat; 56*cdf0e10cSrcweir class ScAutoFormatData; 57*cdf0e10cSrcweir class SvxBoxItem; 58*cdf0e10cSrcweir class SvxLineItem; 59*cdf0e10cSrcweir class ScAutoFmtPreview; // s.u. 60*cdf0e10cSrcweir class SvNumberFormatter; 61*cdf0e10cSrcweir class ScDocument; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir //------------------------------------------------------------------------ 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir enum AutoFmtLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE }; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir //======================================================================== 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir //CHINA001 class ScAutoFormatDlg : public ModalDialog 70*cdf0e10cSrcweir //CHINA001 { 71*cdf0e10cSrcweir //CHINA001 public: 72*cdf0e10cSrcweir //CHINA001 ScAutoFormatDlg( Window* pParent, 73*cdf0e10cSrcweir //CHINA001 ScAutoFormat* pAutoFormat, 74*cdf0e10cSrcweir //CHINA001 const ScAutoFormatData* pSelFormatData, 75*cdf0e10cSrcweir //CHINA001 ScDocument* pDoc ); 76*cdf0e10cSrcweir //CHINA001 ~ScAutoFormatDlg(); 77*cdf0e10cSrcweir //CHINA001 78*cdf0e10cSrcweir //CHINA001 sal_uInt16 GetIndex() const { return nIndex; } 79*cdf0e10cSrcweir //CHINA001 String GetCurrFormatName(); 80*cdf0e10cSrcweir //CHINA001 81*cdf0e10cSrcweir //CHINA001 private: 82*cdf0e10cSrcweir //CHINA001 FixedLine aFlFormat; 83*cdf0e10cSrcweir //CHINA001 ListBox aLbFormat; 84*cdf0e10cSrcweir //CHINA001 ScAutoFmtPreview* pWndPreview; 85*cdf0e10cSrcweir //CHINA001 OKButton aBtnOk; 86*cdf0e10cSrcweir //CHINA001 CancelButton aBtnCancel; 87*cdf0e10cSrcweir //CHINA001 HelpButton aBtnHelp; 88*cdf0e10cSrcweir //CHINA001 PushButton aBtnAdd; 89*cdf0e10cSrcweir //CHINA001 PushButton aBtnRemove; 90*cdf0e10cSrcweir //CHINA001 MoreButton aBtnMore; 91*cdf0e10cSrcweir //CHINA001 FixedLine aFlFormatting; 92*cdf0e10cSrcweir //CHINA001 CheckBox aBtnNumFormat; 93*cdf0e10cSrcweir //CHINA001 CheckBox aBtnBorder; 94*cdf0e10cSrcweir //CHINA001 CheckBox aBtnFont; 95*cdf0e10cSrcweir //CHINA001 CheckBox aBtnPattern; 96*cdf0e10cSrcweir //CHINA001 CheckBox aBtnAlignment; 97*cdf0e10cSrcweir //CHINA001 CheckBox aBtnAdjust; 98*cdf0e10cSrcweir //CHINA001 PushButton aBtnRename; 99*cdf0e10cSrcweir //CHINA001 String aStrTitle; 100*cdf0e10cSrcweir //CHINA001 String aStrLabel; 101*cdf0e10cSrcweir //CHINA001 String aStrClose; 102*cdf0e10cSrcweir //CHINA001 String aStrDelTitle; 103*cdf0e10cSrcweir //CHINA001 String aStrDelMsg; 104*cdf0e10cSrcweir //CHINA001 String aStrRename; 105*cdf0e10cSrcweir //CHINA001 106*cdf0e10cSrcweir //CHINA001 //------------------------ 107*cdf0e10cSrcweir //CHINA001 ScAutoFormat* pFormat; 108*cdf0e10cSrcweir //CHINA001 const ScAutoFormatData* pSelFmtData; 109*cdf0e10cSrcweir //CHINA001 sal_uInt16 nIndex; 110*cdf0e10cSrcweir //CHINA001 sal_Bool bCoreDataChanged; 111*cdf0e10cSrcweir //CHINA001 sal_Bool bFmtInserted; 112*cdf0e10cSrcweir //CHINA001 113*cdf0e10cSrcweir //CHINA001 void Init (); 114*cdf0e10cSrcweir //CHINA001 void UpdateChecks (); 115*cdf0e10cSrcweir //CHINA001 //------------------------ 116*cdf0e10cSrcweir //CHINA001 DECL_LINK( CheckHdl, Button * ); 117*cdf0e10cSrcweir //CHINA001 DECL_LINK( AddHdl, void * ); 118*cdf0e10cSrcweir //CHINA001 DECL_LINK( RemoveHdl, void * ); 119*cdf0e10cSrcweir //CHINA001 DECL_LINK( SelFmtHdl, void * ); 120*cdf0e10cSrcweir //CHINA001 DECL_LINK( CloseHdl, PushButton * ); 121*cdf0e10cSrcweir //CHINA001 DECL_LINK( DblClkHdl, void * ); 122*cdf0e10cSrcweir //CHINA001 DECL_LINK( RenameHdl, void *); 123*cdf0e10cSrcweir //CHINA001 124*cdf0e10cSrcweir //CHINA001 }; 125*cdf0e10cSrcweir //CHINA001 126*cdf0e10cSrcweir //======================================================================== 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir class SC_DLLPUBLIC ScAutoFmtPreview : public Window 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir public: 131*cdf0e10cSrcweir ScAutoFmtPreview( Window* pParent, const ResId& rRes, ScDocument* pDoc ); 132*cdf0e10cSrcweir ~ScAutoFmtPreview(); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir void NotifyChange( ScAutoFormatData* pNewData ); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir protected: 137*cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir private: 140*cdf0e10cSrcweir ScAutoFormatData* pCurData; 141*cdf0e10cSrcweir VirtualDevice aVD; 142*cdf0e10cSrcweir SvtScriptedTextHelper aScriptedText; 143*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIter; 144*cdf0e10cSrcweir sal_Bool bFitWidth; 145*cdf0e10cSrcweir svx::frame::Array maArray; /// Implementation to draw the frame borders. 146*cdf0e10cSrcweir bool mbRTL; 147*cdf0e10cSrcweir Size aPrvSize; 148*cdf0e10cSrcweir long mnLabelColWidth; 149*cdf0e10cSrcweir long mnDataColWidth1; 150*cdf0e10cSrcweir long mnDataColWidth2; 151*cdf0e10cSrcweir long mnRowHeight; 152*cdf0e10cSrcweir const String aStrJan; 153*cdf0e10cSrcweir const String aStrFeb; 154*cdf0e10cSrcweir const String aStrMar; 155*cdf0e10cSrcweir const String aStrNorth; 156*cdf0e10cSrcweir const String aStrMid; 157*cdf0e10cSrcweir const String aStrSouth; 158*cdf0e10cSrcweir const String aStrSum; 159*cdf0e10cSrcweir SvNumberFormatter* pNumFmt; 160*cdf0e10cSrcweir //------------------------------------------- 161*cdf0e10cSrcweir SC_DLLPRIVATE void Init (); 162*cdf0e10cSrcweir SC_DLLPRIVATE void DoPaint ( const Rectangle& rRect ); 163*cdf0e10cSrcweir SC_DLLPRIVATE void CalcCellArray ( sal_Bool bFitWidth ); 164*cdf0e10cSrcweir SC_DLLPRIVATE void CalcLineMap (); 165*cdf0e10cSrcweir SC_DLLPRIVATE void PaintCells (); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir /* Usage of type size_t instead of SCCOL/SCROW is correct here - used in 168*cdf0e10cSrcweir conjunction with class svx::frame::Array (svx/framelinkarray.hxx), which 169*cdf0e10cSrcweir expects size_t coordinates. */ 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir SC_DLLPRIVATE sal_uInt16 GetFormatIndex( size_t nCol, size_t nRow ) const; 172*cdf0e10cSrcweir SC_DLLPRIVATE const SvxBoxItem& GetBoxItem( size_t nCol, size_t nRow ) const; 173*cdf0e10cSrcweir SC_DLLPRIVATE const SvxLineItem& GetDiagItem( size_t nCol, size_t nRow, bool bTLBR ) const; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir SC_DLLPRIVATE void DrawString( size_t nCol, size_t nRow ); 176*cdf0e10cSrcweir SC_DLLPRIVATE void DrawStrings(); 177*cdf0e10cSrcweir SC_DLLPRIVATE void DrawBackground(); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir SC_DLLPRIVATE void MakeFonts ( sal_uInt16 nIndex, 180*cdf0e10cSrcweir Font& rFont, 181*cdf0e10cSrcweir Font& rCJKFont, 182*cdf0e10cSrcweir Font& rCTLFont ); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir SC_DLLPRIVATE String MakeNumberString( String cellString, sal_Bool bAddDec ); 185*cdf0e10cSrcweir SC_DLLPRIVATE void DrawFrameLine ( const SvxBorderLine& rLineD, 186*cdf0e10cSrcweir Point from, 187*cdf0e10cSrcweir Point to, 188*cdf0e10cSrcweir sal_Bool bHorizontal, 189*cdf0e10cSrcweir const SvxBorderLine& rLineLT, 190*cdf0e10cSrcweir const SvxBorderLine& rLineL, 191*cdf0e10cSrcweir const SvxBorderLine& rLineLB, 192*cdf0e10cSrcweir const SvxBorderLine& rLineRT, 193*cdf0e10cSrcweir const SvxBorderLine& rLineR, 194*cdf0e10cSrcweir const SvxBorderLine& rLineRB ); 195*cdf0e10cSrcweir SC_DLLPRIVATE void CheckPriority ( sal_uInt16 nCurLine, 196*cdf0e10cSrcweir AutoFmtLine eLine, 197*cdf0e10cSrcweir SvxBorderLine& rLine ); 198*cdf0e10cSrcweir SC_DLLPRIVATE void GetLines ( sal_uInt16 nIndex, AutoFmtLine eLine, 199*cdf0e10cSrcweir SvxBorderLine& rLineD, 200*cdf0e10cSrcweir SvxBorderLine& rLineLT, 201*cdf0e10cSrcweir SvxBorderLine& rLineL, 202*cdf0e10cSrcweir SvxBorderLine& rLineLB, 203*cdf0e10cSrcweir SvxBorderLine& rLineRT, 204*cdf0e10cSrcweir SvxBorderLine& rLineR, 205*cdf0e10cSrcweir SvxBorderLine& rLineRB ); 206*cdf0e10cSrcweir }; 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir #endif // SC_AUTOFMT_HXX 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir 211