1*f6a9d5caSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6a9d5caSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6a9d5caSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6a9d5caSAndrew Rist * distributed with this work for additional information 6*f6a9d5caSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6a9d5caSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6a9d5caSAndrew Rist * "License"); you may not use this file except in compliance 9*f6a9d5caSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f6a9d5caSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f6a9d5caSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6a9d5caSAndrew Rist * software distributed under the License is distributed on an 15*f6a9d5caSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6a9d5caSAndrew Rist * KIND, either express or implied. See the License for the 17*f6a9d5caSAndrew Rist * specific language governing permissions and limitations 18*f6a9d5caSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f6a9d5caSAndrew Rist *************************************************************/ 21*f6a9d5caSAndrew Rist 22*f6a9d5caSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifdef _MSC_VER 25cdf0e10cSrcweir #pragma hdrstop 26cdf0e10cSrcweir #endif 27cdf0e10cSrcweir 28cdf0e10cSrcweir #ifndef _MATH_CFGITEM_HXX_ 29cdf0e10cSrcweir #define _MATH_CFGITEM_HXX_ 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <deque> 32cdf0e10cSrcweir #include <vector> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValues.hpp> 35cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 36cdf0e10cSrcweir #include <com/sun/star/uno/Any.h> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <tools/solar.h> 39cdf0e10cSrcweir #include <rtl/ustring.hxx> 40cdf0e10cSrcweir #include <unotools/configitem.hxx> 41cdf0e10cSrcweir #include <vcl/timer.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <symbol.hxx> 44cdf0e10cSrcweir #include <types.hxx> 45cdf0e10cSrcweir 46cdf0e10cSrcweir using namespace com::sun::star; 47cdf0e10cSrcweir 48cdf0e10cSrcweir class SmSym; 49cdf0e10cSrcweir class SmFormat; 50cdf0e10cSrcweir class Font; 51cdf0e10cSrcweir struct SmCfgOther; 52cdf0e10cSrcweir 53cdf0e10cSrcweir ///////////////////////////////////////////////////////////////// 54cdf0e10cSrcweir 55cdf0e10cSrcweir 56cdf0e10cSrcweir struct SmFontFormat 57cdf0e10cSrcweir { 58cdf0e10cSrcweir String aName; 59cdf0e10cSrcweir sal_Int16 nCharSet; 60cdf0e10cSrcweir sal_Int16 nFamily; 61cdf0e10cSrcweir sal_Int16 nPitch; 62cdf0e10cSrcweir sal_Int16 nWeight; 63cdf0e10cSrcweir sal_Int16 nItalic; 64cdf0e10cSrcweir 65cdf0e10cSrcweir SmFontFormat(); 66cdf0e10cSrcweir SmFontFormat( const Font &rFont ); 67cdf0e10cSrcweir 68cdf0e10cSrcweir const Font GetFont() const; 69cdf0e10cSrcweir sal_Bool operator == ( const SmFontFormat &rFntFmt ) const; 70cdf0e10cSrcweir }; 71cdf0e10cSrcweir 72cdf0e10cSrcweir 73cdf0e10cSrcweir struct SmFntFmtListEntry 74cdf0e10cSrcweir { 75cdf0e10cSrcweir String aId; 76cdf0e10cSrcweir SmFontFormat aFntFmt; 77cdf0e10cSrcweir 78cdf0e10cSrcweir SmFntFmtListEntry( const String &rId, const SmFontFormat &rFntFmt ); 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir 81cdf0e10cSrcweir class SmFontFormatList 82cdf0e10cSrcweir { 83cdf0e10cSrcweir std::deque<SmFntFmtListEntry> aEntries; 84cdf0e10cSrcweir sal_Bool bModified; 85cdf0e10cSrcweir 86cdf0e10cSrcweir // disallow copy-constructor and assignment-operator for now 87cdf0e10cSrcweir SmFontFormatList( const SmFontFormatList & ); 88cdf0e10cSrcweir SmFontFormatList & operator = ( const SmFontFormatList & ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir public: 91cdf0e10cSrcweir SmFontFormatList(); 92cdf0e10cSrcweir 93cdf0e10cSrcweir void Clear(); 94cdf0e10cSrcweir void AddFontFormat( const String &rFntFmtId, const SmFontFormat &rFntFmt ); 95cdf0e10cSrcweir void RemoveFontFormat( const String &rFntFmtId ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir const SmFontFormat * GetFontFormat( const String &rFntFmtId ) const; 98cdf0e10cSrcweir const SmFontFormat * GetFontFormat( size_t nPos ) const; 99cdf0e10cSrcweir const String GetFontFormatId( const SmFontFormat &rFntFmt ) const; 100cdf0e10cSrcweir const String GetFontFormatId( const SmFontFormat &rFntFmt, sal_Bool bAdd ); 101cdf0e10cSrcweir const String GetFontFormatId( size_t nPos ) const; 102cdf0e10cSrcweir const String GetNewFontFormatId() const; GetCount() const103cdf0e10cSrcweir size_t GetCount() const { return aEntries.size(); } 104cdf0e10cSrcweir IsModified() const105cdf0e10cSrcweir sal_Bool IsModified() const { return bModified; } SetModified(sal_Bool bVal)106cdf0e10cSrcweir void SetModified( sal_Bool bVal ) { bModified = bVal; } 107cdf0e10cSrcweir }; 108cdf0e10cSrcweir 109cdf0e10cSrcweir 110cdf0e10cSrcweir ///////////////////////////////////////////////////////////////// 111cdf0e10cSrcweir 112cdf0e10cSrcweir class SmMathConfig : public utl::ConfigItem 113cdf0e10cSrcweir { 114cdf0e10cSrcweir SmFormat * pFormat; 115cdf0e10cSrcweir SmCfgOther * pOther; 116cdf0e10cSrcweir SmFontFormatList * pFontFormatList; 117cdf0e10cSrcweir SmSymbolManager * pSymbolMgr; 118cdf0e10cSrcweir sal_Bool bIsOtherModified; 119cdf0e10cSrcweir sal_Bool bIsFormatModified; 120cdf0e10cSrcweir 121cdf0e10cSrcweir // disallow copy-constructor and assignment-operator for now 122cdf0e10cSrcweir SmMathConfig( const SmMathConfig & ); 123cdf0e10cSrcweir SmMathConfig & operator = ( const SmMathConfig & ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir 126cdf0e10cSrcweir void StripFontFormatList( const std::vector< SmSym > &rSymbols ); 127cdf0e10cSrcweir 128cdf0e10cSrcweir 129cdf0e10cSrcweir void Save(); 130cdf0e10cSrcweir 131cdf0e10cSrcweir void ReadSymbol( SmSym &rSymbol, 132cdf0e10cSrcweir const rtl::OUString &rSymbolName, 133cdf0e10cSrcweir const rtl::OUString &rBaseNode ) const; 134cdf0e10cSrcweir void ReadFontFormat( SmFontFormat &rFontFormat, 135cdf0e10cSrcweir const rtl::OUString &rSymbolName, 136cdf0e10cSrcweir const rtl::OUString &rBaseNode ) const; 137cdf0e10cSrcweir 138cdf0e10cSrcweir void SetOtherIfNotEqual( sal_Bool &rbItem, sal_Bool bNewVal ); 139cdf0e10cSrcweir 140cdf0e10cSrcweir protected: 141cdf0e10cSrcweir void LoadOther(); 142cdf0e10cSrcweir void SaveOther(); 143cdf0e10cSrcweir void LoadFormat(); 144cdf0e10cSrcweir void SaveFormat(); 145cdf0e10cSrcweir void LoadFontFormatList(); 146cdf0e10cSrcweir void SaveFontFormatList(); 147cdf0e10cSrcweir 148cdf0e10cSrcweir void SetOtherModified( sal_Bool bVal ); IsOtherModified() const149cdf0e10cSrcweir inline sal_Bool IsOtherModified() const { return bIsOtherModified; } 150cdf0e10cSrcweir void SetFormatModified( sal_Bool bVal ); IsFormatModified() const151cdf0e10cSrcweir inline sal_Bool IsFormatModified() const { return bIsFormatModified; } 152cdf0e10cSrcweir void SetFontFormatListModified( sal_Bool bVal ); IsFontFormatListModified() const153cdf0e10cSrcweir inline sal_Bool IsFontFormatListModified() const { return pFontFormatList ? pFontFormatList->IsModified(): sal_False; } 154cdf0e10cSrcweir 155cdf0e10cSrcweir SmFontFormatList & GetFontFormatList(); GetFontFormatList() const156cdf0e10cSrcweir const SmFontFormatList & GetFontFormatList() const 157cdf0e10cSrcweir { 158cdf0e10cSrcweir return ((SmMathConfig *) this)->GetFontFormatList(); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir public: 162cdf0e10cSrcweir SmMathConfig(); 163cdf0e10cSrcweir virtual ~SmMathConfig(); 164cdf0e10cSrcweir 165cdf0e10cSrcweir // utl::ConfigItem 166cdf0e10cSrcweir virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); 167cdf0e10cSrcweir virtual void Commit(); 168cdf0e10cSrcweir 169cdf0e10cSrcweir // make some protected functions of utl::ConfigItem public 170cdf0e10cSrcweir //using utl::ConfigItem::GetNodeNames; 171cdf0e10cSrcweir //using utl::ConfigItem::GetProperties; 172cdf0e10cSrcweir //using utl::ConfigItem::PutProperties; 173cdf0e10cSrcweir //using utl::ConfigItem::SetSetProperties; 174cdf0e10cSrcweir //using utl::ConfigItem::ReplaceSetProperties; 175cdf0e10cSrcweir //using utl::ConfigItem::GetReadOnlyStates; 176cdf0e10cSrcweir 177cdf0e10cSrcweir SmSymbolManager & GetSymbolManager(); 178cdf0e10cSrcweir void GetSymbols( std::vector< SmSym > &rSymbols ) const; 179cdf0e10cSrcweir void SetSymbols( const std::vector< SmSym > &rNewSymbols ); 180cdf0e10cSrcweir 181cdf0e10cSrcweir const SmFormat & GetStandardFormat() const; 182cdf0e10cSrcweir void SetStandardFormat( const SmFormat &rFormat, sal_Bool bSaveFontFormatList = sal_False ); 183cdf0e10cSrcweir 184cdf0e10cSrcweir sal_Bool IsPrintTitle() const; 185cdf0e10cSrcweir void SetPrintTitle( sal_Bool bVal ); 186cdf0e10cSrcweir sal_Bool IsPrintFormulaText() const; 187cdf0e10cSrcweir void SetPrintFormulaText( sal_Bool bVal ); 188cdf0e10cSrcweir sal_Bool IsPrintFrame() const; 189cdf0e10cSrcweir void SetPrintFrame( sal_Bool bVal ); 190cdf0e10cSrcweir SmPrintSize GetPrintSize() const; 191cdf0e10cSrcweir void SetPrintSize( SmPrintSize eSize ); 192cdf0e10cSrcweir sal_uInt16 GetPrintZoomFactor() const; 193cdf0e10cSrcweir void SetPrintZoomFactor( sal_uInt16 nVal ); 194cdf0e10cSrcweir 195cdf0e10cSrcweir sal_Bool IsSaveOnlyUsedSymbols() const; 196cdf0e10cSrcweir void SetSaveOnlyUsedSymbols( sal_Bool bVal ); 197cdf0e10cSrcweir 198cdf0e10cSrcweir sal_Bool IsIgnoreSpacesRight() const; 199cdf0e10cSrcweir void SetIgnoreSpacesRight( sal_Bool bVal ); 200cdf0e10cSrcweir sal_Bool IsAutoRedraw() const; 201cdf0e10cSrcweir void SetAutoRedraw( sal_Bool bVal ); 202cdf0e10cSrcweir sal_Bool IsShowFormulaCursor() const; 203cdf0e10cSrcweir void SetShowFormulaCursor( sal_Bool bVal ); 204cdf0e10cSrcweir }; 205cdf0e10cSrcweir 206cdf0e10cSrcweir ///////////////////////////////////////////////////////////////// 207cdf0e10cSrcweir 208cdf0e10cSrcweir #endif 209cdf0e10cSrcweir 210