1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_AUTOFMT_HXX 25cdf0e10cSrcweir #define SC_AUTOFMT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef _VIRDEV_HXX //autogen 28cdf0e10cSrcweir #include <vcl/virdev.hxx> 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir #ifndef SV_FIXED_HXX 31cdf0e10cSrcweir #include <vcl/fixed.hxx> 32cdf0e10cSrcweir #endif 33cdf0e10cSrcweir #ifndef SV_LSTBOX_HXX 34cdf0e10cSrcweir #include <vcl/lstbox.hxx> 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir #ifndef SV_BUTTON_HXX 37cdf0e10cSrcweir #include <vcl/button.hxx> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #ifndef SV_MOREBTN_HXX 40cdf0e10cSrcweir #include <vcl/morebtn.hxx> 41cdf0e10cSrcweir #endif 42cdf0e10cSrcweir #ifndef _DIALOG_HXX //autogen 43cdf0e10cSrcweir #include <vcl/dialog.hxx> 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir #include <svtools/scriptedtext.hxx> 46cdf0e10cSrcweir #include <svx/framelinkarray.hxx> 47cdf0e10cSrcweir #include "scdllapi.h" 48cdf0e10cSrcweir 49cdf0e10cSrcweir //------------------------------------------------------------------------ 50cdf0e10cSrcweir 51cdf0e10cSrcweir class ScAutoFormat; 52cdf0e10cSrcweir class ScAutoFormatData; 53cdf0e10cSrcweir class SvxBoxItem; 54cdf0e10cSrcweir class SvxLineItem; 55cdf0e10cSrcweir class ScAutoFmtPreview; // s.u. 56cdf0e10cSrcweir class SvNumberFormatter; 57cdf0e10cSrcweir class ScDocument; 58cdf0e10cSrcweir 59cdf0e10cSrcweir //------------------------------------------------------------------------ 60cdf0e10cSrcweir 61cdf0e10cSrcweir enum AutoFmtLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE }; 62cdf0e10cSrcweir 63cdf0e10cSrcweir //======================================================================== 64cdf0e10cSrcweir 65cdf0e10cSrcweir //CHINA001 class ScAutoFormatDlg : public ModalDialog 66cdf0e10cSrcweir //CHINA001 { 67cdf0e10cSrcweir //CHINA001 public: 68cdf0e10cSrcweir //CHINA001 ScAutoFormatDlg( Window* pParent, 69cdf0e10cSrcweir //CHINA001 ScAutoFormat* pAutoFormat, 70cdf0e10cSrcweir //CHINA001 const ScAutoFormatData* pSelFormatData, 71cdf0e10cSrcweir //CHINA001 ScDocument* pDoc ); 72cdf0e10cSrcweir //CHINA001 ~ScAutoFormatDlg(); 73cdf0e10cSrcweir //CHINA001 74cdf0e10cSrcweir //CHINA001 sal_uInt16 GetIndex() const { return nIndex; } 75cdf0e10cSrcweir //CHINA001 String GetCurrFormatName(); 76cdf0e10cSrcweir //CHINA001 77cdf0e10cSrcweir //CHINA001 private: 78cdf0e10cSrcweir //CHINA001 FixedLine aFlFormat; 79cdf0e10cSrcweir //CHINA001 ListBox aLbFormat; 80cdf0e10cSrcweir //CHINA001 ScAutoFmtPreview* pWndPreview; 81cdf0e10cSrcweir //CHINA001 OKButton aBtnOk; 82cdf0e10cSrcweir //CHINA001 CancelButton aBtnCancel; 83cdf0e10cSrcweir //CHINA001 HelpButton aBtnHelp; 84cdf0e10cSrcweir //CHINA001 PushButton aBtnAdd; 85cdf0e10cSrcweir //CHINA001 PushButton aBtnRemove; 86cdf0e10cSrcweir //CHINA001 MoreButton aBtnMore; 87cdf0e10cSrcweir //CHINA001 FixedLine aFlFormatting; 88cdf0e10cSrcweir //CHINA001 CheckBox aBtnNumFormat; 89cdf0e10cSrcweir //CHINA001 CheckBox aBtnBorder; 90cdf0e10cSrcweir //CHINA001 CheckBox aBtnFont; 91cdf0e10cSrcweir //CHINA001 CheckBox aBtnPattern; 92cdf0e10cSrcweir //CHINA001 CheckBox aBtnAlignment; 93cdf0e10cSrcweir //CHINA001 CheckBox aBtnAdjust; 94cdf0e10cSrcweir //CHINA001 PushButton aBtnRename; 95cdf0e10cSrcweir //CHINA001 String aStrTitle; 96cdf0e10cSrcweir //CHINA001 String aStrLabel; 97cdf0e10cSrcweir //CHINA001 String aStrClose; 98cdf0e10cSrcweir //CHINA001 String aStrDelTitle; 99cdf0e10cSrcweir //CHINA001 String aStrDelMsg; 100cdf0e10cSrcweir //CHINA001 String aStrRename; 101cdf0e10cSrcweir //CHINA001 102cdf0e10cSrcweir //CHINA001 //------------------------ 103cdf0e10cSrcweir //CHINA001 ScAutoFormat* pFormat; 104cdf0e10cSrcweir //CHINA001 const ScAutoFormatData* pSelFmtData; 105cdf0e10cSrcweir //CHINA001 sal_uInt16 nIndex; 106cdf0e10cSrcweir //CHINA001 sal_Bool bCoreDataChanged; 107cdf0e10cSrcweir //CHINA001 sal_Bool bFmtInserted; 108cdf0e10cSrcweir //CHINA001 109cdf0e10cSrcweir //CHINA001 void Init (); 110cdf0e10cSrcweir //CHINA001 void UpdateChecks (); 111cdf0e10cSrcweir //CHINA001 //------------------------ 112cdf0e10cSrcweir //CHINA001 DECL_LINK( CheckHdl, Button * ); 113cdf0e10cSrcweir //CHINA001 DECL_LINK( AddHdl, void * ); 114cdf0e10cSrcweir //CHINA001 DECL_LINK( RemoveHdl, void * ); 115cdf0e10cSrcweir //CHINA001 DECL_LINK( SelFmtHdl, void * ); 116cdf0e10cSrcweir //CHINA001 DECL_LINK( CloseHdl, PushButton * ); 117cdf0e10cSrcweir //CHINA001 DECL_LINK( DblClkHdl, void * ); 118cdf0e10cSrcweir //CHINA001 DECL_LINK( RenameHdl, void *); 119cdf0e10cSrcweir //CHINA001 120cdf0e10cSrcweir //CHINA001 }; 121cdf0e10cSrcweir //CHINA001 122cdf0e10cSrcweir //======================================================================== 123cdf0e10cSrcweir 124cdf0e10cSrcweir class SC_DLLPUBLIC ScAutoFmtPreview : public Window 125cdf0e10cSrcweir { 126cdf0e10cSrcweir public: 127cdf0e10cSrcweir ScAutoFmtPreview( Window* pParent, const ResId& rRes, ScDocument* pDoc ); 128cdf0e10cSrcweir ~ScAutoFmtPreview(); 129cdf0e10cSrcweir 130cdf0e10cSrcweir void NotifyChange( ScAutoFormatData* pNewData ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir protected: 133cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 134cdf0e10cSrcweir 135cdf0e10cSrcweir private: 136cdf0e10cSrcweir ScAutoFormatData* pCurData; 137cdf0e10cSrcweir VirtualDevice aVD; 138cdf0e10cSrcweir SvtScriptedTextHelper aScriptedText; 139cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIter; 140cdf0e10cSrcweir sal_Bool bFitWidth; 141cdf0e10cSrcweir svx::frame::Array maArray; /// Implementation to draw the frame borders. 142cdf0e10cSrcweir bool mbRTL; 143cdf0e10cSrcweir Size aPrvSize; 144cdf0e10cSrcweir long mnLabelColWidth; 145cdf0e10cSrcweir long mnDataColWidth1; 146cdf0e10cSrcweir long mnDataColWidth2; 147cdf0e10cSrcweir long mnRowHeight; 148cdf0e10cSrcweir const String aStrJan; 149cdf0e10cSrcweir const String aStrFeb; 150cdf0e10cSrcweir const String aStrMar; 151cdf0e10cSrcweir const String aStrNorth; 152cdf0e10cSrcweir const String aStrMid; 153cdf0e10cSrcweir const String aStrSouth; 154cdf0e10cSrcweir const String aStrSum; 155cdf0e10cSrcweir SvNumberFormatter* pNumFmt; 156cdf0e10cSrcweir //------------------------------------------- 157cdf0e10cSrcweir SC_DLLPRIVATE void Init (); 158cdf0e10cSrcweir SC_DLLPRIVATE void DoPaint ( const Rectangle& rRect ); 159cdf0e10cSrcweir SC_DLLPRIVATE void CalcCellArray ( sal_Bool bFitWidth ); 160cdf0e10cSrcweir SC_DLLPRIVATE void CalcLineMap (); 161cdf0e10cSrcweir SC_DLLPRIVATE void PaintCells (); 162cdf0e10cSrcweir 163cdf0e10cSrcweir /* Usage of type size_t instead of SCCOL/SCROW is correct here - used in 164cdf0e10cSrcweir conjunction with class svx::frame::Array (svx/framelinkarray.hxx), which 165cdf0e10cSrcweir expects size_t coordinates. */ 166cdf0e10cSrcweir 167cdf0e10cSrcweir SC_DLLPRIVATE sal_uInt16 GetFormatIndex( size_t nCol, size_t nRow ) const; 168cdf0e10cSrcweir SC_DLLPRIVATE const SvxBoxItem& GetBoxItem( size_t nCol, size_t nRow ) const; 169cdf0e10cSrcweir SC_DLLPRIVATE const SvxLineItem& GetDiagItem( size_t nCol, size_t nRow, bool bTLBR ) const; 170cdf0e10cSrcweir 171cdf0e10cSrcweir SC_DLLPRIVATE void DrawString( size_t nCol, size_t nRow ); 172cdf0e10cSrcweir SC_DLLPRIVATE void DrawStrings(); 173cdf0e10cSrcweir SC_DLLPRIVATE void DrawBackground(); 174cdf0e10cSrcweir 175cdf0e10cSrcweir SC_DLLPRIVATE void MakeFonts ( sal_uInt16 nIndex, 176cdf0e10cSrcweir Font& rFont, 177cdf0e10cSrcweir Font& rCJKFont, 178cdf0e10cSrcweir Font& rCTLFont ); 179cdf0e10cSrcweir 180cdf0e10cSrcweir SC_DLLPRIVATE String MakeNumberString( String cellString, sal_Bool bAddDec ); 181cdf0e10cSrcweir SC_DLLPRIVATE void DrawFrameLine ( const SvxBorderLine& rLineD, 182cdf0e10cSrcweir Point from, 183cdf0e10cSrcweir Point to, 184cdf0e10cSrcweir sal_Bool bHorizontal, 185cdf0e10cSrcweir const SvxBorderLine& rLineLT, 186cdf0e10cSrcweir const SvxBorderLine& rLineL, 187cdf0e10cSrcweir const SvxBorderLine& rLineLB, 188cdf0e10cSrcweir const SvxBorderLine& rLineRT, 189cdf0e10cSrcweir const SvxBorderLine& rLineR, 190cdf0e10cSrcweir const SvxBorderLine& rLineRB ); 191cdf0e10cSrcweir SC_DLLPRIVATE void CheckPriority ( sal_uInt16 nCurLine, 192cdf0e10cSrcweir AutoFmtLine eLine, 193cdf0e10cSrcweir SvxBorderLine& rLine ); 194cdf0e10cSrcweir SC_DLLPRIVATE void GetLines ( sal_uInt16 nIndex, AutoFmtLine eLine, 195cdf0e10cSrcweir SvxBorderLine& rLineD, 196cdf0e10cSrcweir SvxBorderLine& rLineLT, 197cdf0e10cSrcweir SvxBorderLine& rLineL, 198cdf0e10cSrcweir SvxBorderLine& rLineLB, 199cdf0e10cSrcweir SvxBorderLine& rLineRT, 200cdf0e10cSrcweir SvxBorderLine& rLineR, 201cdf0e10cSrcweir SvxBorderLine& rLineRB ); 202cdf0e10cSrcweir }; 203cdf0e10cSrcweir 204cdf0e10cSrcweir #endif // SC_AUTOFMT_HXX 205cdf0e10cSrcweir 206cdf0e10cSrcweir 207