1*c4eee24dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c4eee24dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c4eee24dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c4eee24dSAndrew Rist * distributed with this work for additional information 6*c4eee24dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c4eee24dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c4eee24dSAndrew Rist * "License"); you may not use this file except in compliance 9*c4eee24dSAndrew Rist * with the License. You may obtain a copy of the License at 10*c4eee24dSAndrew Rist * 11*c4eee24dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*c4eee24dSAndrew Rist * 13*c4eee24dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c4eee24dSAndrew Rist * software distributed under the License is distributed on an 15*c4eee24dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c4eee24dSAndrew Rist * KIND, either express or implied. See the License for the 17*c4eee24dSAndrew Rist * specific language governing permissions and limitations 18*c4eee24dSAndrew Rist * under the License. 19*c4eee24dSAndrew Rist * 20*c4eee24dSAndrew Rist *************************************************************/ 21*c4eee24dSAndrew Rist 22*c4eee24dSAndrew Rist 23cdf0e10cSrcweir #ifndef _SVX_NUMFMT_HXX 24cdf0e10cSrcweir #define _SVX_NUMFMT_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir //------------------------------------------------------------------------ 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <vcl/window.hxx> 29cdf0e10cSrcweir #include <tools/color.hxx> 30cdf0e10cSrcweir #include <tools/string.hxx> 31cdf0e10cSrcweir #include <sfx2/tabdlg.hxx> 32cdf0e10cSrcweir #include <vcl/fixed.hxx> 33cdf0e10cSrcweir #include <vcl/lstbox.hxx> 34cdf0e10cSrcweir #include <vcl/edit.hxx> 35cdf0e10cSrcweir #include <vcl/toolbox.hxx> 36cdf0e10cSrcweir #include <vcl/field.hxx> 37cdf0e10cSrcweir #include <svx/langbox.hxx> 38cdf0e10cSrcweir #include <svx/fontlb.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir //CHINA001 #define SVX_NUMVAL_STANDARD -1234.12345678901234 41cdf0e10cSrcweir //CHINA001 #define SVX_NUMVAL_CURRENCY -1234 42cdf0e10cSrcweir //CHINA001 #define SVX_NUMVAL_PERCENT -0.1295 43cdf0e10cSrcweir //CHINA001 #define SVX_NUMVAL_TIME 36525.5678935185 44cdf0e10cSrcweir //CHINA001 #define SVX_NUMVAL_DATE 36525.5678935185 45cdf0e10cSrcweir //CHINA001 #define SVX_NUMVAL_BOOLEAN 1 46cdf0e10cSrcweir 47cdf0e10cSrcweir //------------------------------------------------------------------------ 48cdf0e10cSrcweir 49cdf0e10cSrcweir class SvxNumberFormatShell; 50cdf0e10cSrcweir class SvxNumberInfoItem; 51cdf0e10cSrcweir 52cdf0e10cSrcweir //------------------------------------------------------------------------ 53cdf0e10cSrcweir 54cdf0e10cSrcweir class SvxNumberPreviewImpl : public Window 55cdf0e10cSrcweir { 56cdf0e10cSrcweir private: 57cdf0e10cSrcweir String aPrevStr; 58cdf0e10cSrcweir Color aPrevCol; 59cdf0e10cSrcweir 60cdf0e10cSrcweir void InitSettings( sal_Bool bForeground, sal_Bool bBackground ); 61cdf0e10cSrcweir 62cdf0e10cSrcweir protected: 63cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 64cdf0e10cSrcweir virtual void StateChanged( StateChangedType nStateChange ); 65cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 66cdf0e10cSrcweir 67cdf0e10cSrcweir public: 68cdf0e10cSrcweir SvxNumberPreviewImpl( Window* pParent, const ResId& rResId ); 69cdf0e10cSrcweir ~SvxNumberPreviewImpl(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir void NotifyChange( const String& rPrevStr, const Color* pColor = NULL ); 72cdf0e10cSrcweir }; 73cdf0e10cSrcweir 74cdf0e10cSrcweir // ----------------------------------------------------------------------- 75cdf0e10cSrcweir 76cdf0e10cSrcweir #include <sfx2/layout.hxx> 77cdf0e10cSrcweir #include <layout/layout-pre.hxx> 78cdf0e10cSrcweir 79cdf0e10cSrcweir class SvxNumberFormatTabPage : public SfxTabPage 80cdf0e10cSrcweir { 81cdf0e10cSrcweir using SfxTabPage::DeactivatePage; 82cdf0e10cSrcweir 83cdf0e10cSrcweir public: 84cdf0e10cSrcweir ~SvxNumberFormatTabPage(); 85cdf0e10cSrcweir 86cdf0e10cSrcweir static SfxTabPage* Create( Window* pParent, 87cdf0e10cSrcweir const SfxItemSet& rAttrSet ); 88cdf0e10cSrcweir static sal_uInt16* GetRanges(); 89cdf0e10cSrcweir 90cdf0e10cSrcweir virtual sal_Bool FillItemSet( SfxItemSet& rSet ); 91cdf0e10cSrcweir virtual void Reset( const SfxItemSet& rSet ); 92cdf0e10cSrcweir virtual int DeactivatePage ( SfxItemSet* pSet = NULL ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir void SetInfoItem( const SvxNumberInfoItem& rItem ); SetNumberFormatList(const SvxNumberInfoItem & rItem)95cdf0e10cSrcweir void SetNumberFormatList( const SvxNumberInfoItem& rItem ) 96cdf0e10cSrcweir { SetInfoItem( rItem ); } 97cdf0e10cSrcweir 98cdf0e10cSrcweir void SetOkHdl( const Link& rOkHandler ); 99cdf0e10cSrcweir void HideLanguage(sal_Bool nFlag=sal_True); 100cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 101cdf0e10cSrcweir virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001 102cdf0e10cSrcweir private: 103cdf0e10cSrcweir SvxNumberFormatTabPage( Window* pParent, 104cdf0e10cSrcweir const SfxItemSet& rCoreAttrs ); 105cdf0e10cSrcweir FixedText aFtCategory; 106cdf0e10cSrcweir ListBox aLbCategory; 107cdf0e10cSrcweir FixedText aFtFormat; 108cdf0e10cSrcweir ListBox aLbCurrency; 109cdf0e10cSrcweir SvxFontListBox aLbFormat; 110cdf0e10cSrcweir FixedText aFtLanguage; 111cdf0e10cSrcweir SvxLanguageBox aLbLanguage; 112cdf0e10cSrcweir CheckBox aCbSourceFormat; 113cdf0e10cSrcweir SvxNumberPreviewImpl aWndPreview; 114cdf0e10cSrcweir FixedLine aFlOptions; 115cdf0e10cSrcweir FixedText aFtDecimals; 116cdf0e10cSrcweir NumericField aEdDecimals; 117cdf0e10cSrcweir CheckBox aBtnNegRed; 118cdf0e10cSrcweir FixedText aFtLeadZeroes; 119cdf0e10cSrcweir NumericField aEdLeadZeroes; 120cdf0e10cSrcweir CheckBox aBtnThousand; 121cdf0e10cSrcweir 122cdf0e10cSrcweir FixedText aFtEdFormat; 123cdf0e10cSrcweir Edit aEdFormat; 124cdf0e10cSrcweir ImageButton aIbAdd; 125cdf0e10cSrcweir ImageButton aIbInfo; 126cdf0e10cSrcweir ImageButton aIbRemove; 127cdf0e10cSrcweir 128cdf0e10cSrcweir FixedText aFtComment; 129cdf0e10cSrcweir Edit aEdComment; 130cdf0e10cSrcweir Timer aResetWinTimer; 131cdf0e10cSrcweir 132cdf0e10cSrcweir 133cdf0e10cSrcweir SvxNumberInfoItem* pNumItem; 134cdf0e10cSrcweir SvxNumberFormatShell* pNumFmtShell; 135cdf0e10cSrcweir sal_uLong nInitFormat; 136cdf0e10cSrcweir Link fnOkHdl; 137cdf0e10cSrcweir 138cdf0e10cSrcweir sal_Bool bNumItemFlag; //Fuer Handling mit DocShell 139cdf0e10cSrcweir sal_Bool bOneAreaFlag; 140cdf0e10cSrcweir short nFixedCategory; 141cdf0e10cSrcweir 142cdf0e10cSrcweir long nCatHeight; 143cdf0e10cSrcweir 144cdf0e10cSrcweir long nCurFormatY; 145cdf0e10cSrcweir long nCurFormatHeight; 146cdf0e10cSrcweir long nStdFormatY; 147cdf0e10cSrcweir long nStdFormatHeight; 148cdf0e10cSrcweir LocalizedString sAutomaticEntry; 149cdf0e10cSrcweir 150cdf0e10cSrcweir Window* pLastActivWindow; 151cdf0e10cSrcweir 152cdf0e10cSrcweir #ifdef _SVX_NUMFMT_CXX 153cdf0e10cSrcweir void Init_Impl(); 154cdf0e10cSrcweir void FillCurrencyBox(); 155cdf0e10cSrcweir void FillFormatListBox_Impl( SvxDelStrgs& rEntries ); 156cdf0e10cSrcweir void UpdateOptions_Impl( sal_Bool bCheckCatChange ); 157cdf0e10cSrcweir void UpdateFormatListBox_Impl( sal_uInt16 bCat, sal_Bool bUpdateEdit ); 158cdf0e10cSrcweir void DeleteEntryList_Impl( SvxDelStrgs& rEntries ); 159cdf0e10cSrcweir void Obstructing(); 160cdf0e10cSrcweir void EnableBySourceFormat_Impl(); 161cdf0e10cSrcweir void SetCategory( sal_uInt16 nPos ); 162cdf0e10cSrcweir String GetExpColorString( Color*& rpPreviewColor, const String& aFormatStr, short nTmpCatPos ); 163cdf0e10cSrcweir void MakePreviewText( const String& rFormat ); 164cdf0e10cSrcweir void ChangePreviewText( sal_uInt16 nPos ); 165cdf0e10cSrcweir void AddAutomaticLanguage_Impl(LanguageType eAutoLang, sal_Bool bSelect); 166cdf0e10cSrcweir // Handler 167cdf0e10cSrcweir DECL_LINK( LostFocusHdl_Impl, Edit* pEd ); 168cdf0e10cSrcweir DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* pLb ); 169cdf0e10cSrcweir DECL_LINK( SelFormatHdl_Impl, void * ); 170cdf0e10cSrcweir DECL_LINK( ClickHdl_Impl, ImageButton* pIB ); 171cdf0e10cSrcweir DECL_LINK( EditHdl_Impl, Edit* pEdFormat ); 172cdf0e10cSrcweir DECL_LINK( OptHdl_Impl, void * ); 173cdf0e10cSrcweir DECL_LINK( TimeHdl_Impl, Timer * ); 174cdf0e10cSrcweir 175cdf0e10cSrcweir #endif 176cdf0e10cSrcweir }; 177cdf0e10cSrcweir 178cdf0e10cSrcweir #include <layout/layout-post.hxx> 179cdf0e10cSrcweir 180cdf0e10cSrcweir #endif 181cdf0e10cSrcweir 182