bump product version to 4.1.6.2
[LibreOffice.git] / starmath / source / cfgitem.hxx
blob590621ccb3f2824d211552a1f8271be7cb2d26dc
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 #ifdef _MSC_VER
21 #pragma hdrstop
22 #endif
24 #ifndef _MATH_CFGITEM_HXX_
25 #define _MATH_CFGITEM_HXX_
27 #include <deque>
28 #include <vector>
30 #include <com/sun/star/beans/PropertyValues.hpp>
31 #include <com/sun/star/uno/Sequence.hxx>
32 #include <com/sun/star/uno/Any.h>
34 #include <tools/solar.h>
35 #include <rtl/ustring.hxx>
36 #include <unotools/configitem.hxx>
37 #include <vcl/timer.hxx>
39 #include <symbol.hxx>
40 #include <types.hxx>
42 class SmSym;
43 class SmFormat;
44 class Font;
45 struct SmCfgOther;
47 /////////////////////////////////////////////////////////////////
50 struct SmFontFormat
52 String aName;
53 sal_Int16 nCharSet;
54 sal_Int16 nFamily;
55 sal_Int16 nPitch;
56 sal_Int16 nWeight;
57 sal_Int16 nItalic;
59 SmFontFormat();
60 SmFontFormat( const Font &rFont );
62 const Font GetFont() const;
63 bool operator == ( const SmFontFormat &rFntFmt ) const;
67 struct SmFntFmtListEntry
69 String aId;
70 SmFontFormat aFntFmt;
72 SmFntFmtListEntry( const String &rId, const SmFontFormat &rFntFmt );
75 class SmFontFormatList
77 std::deque<SmFntFmtListEntry> aEntries;
78 bool bModified;
80 // disallow copy-constructor and assignment-operator for now
81 SmFontFormatList( const SmFontFormatList & );
82 SmFontFormatList & operator = ( const SmFontFormatList & );
84 public:
85 SmFontFormatList();
87 void Clear();
88 void AddFontFormat( const String &rFntFmtId, const SmFontFormat &rFntFmt );
89 void RemoveFontFormat( const String &rFntFmtId );
91 const SmFontFormat * GetFontFormat( const String &rFntFmtId ) const;
92 const SmFontFormat * GetFontFormat( size_t nPos ) const;
93 const String GetFontFormatId( const SmFontFormat &rFntFmt ) const;
94 const String GetFontFormatId( const SmFontFormat &rFntFmt, bool bAdd );
95 const String GetFontFormatId( size_t nPos ) const;
96 const OUString GetNewFontFormatId() const;
97 size_t GetCount() const { return aEntries.size(); }
99 bool IsModified() const { return bModified; }
100 void SetModified( bool bVal ) { bModified = bVal; }
104 /////////////////////////////////////////////////////////////////
106 class SmMathConfig : public utl::ConfigItem
108 SmFormat * pFormat;
109 SmCfgOther * pOther;
110 SmFontFormatList * pFontFormatList;
111 SmSymbolManager * pSymbolMgr;
112 bool bIsOtherModified;
113 bool bIsFormatModified;
115 // disallow copy-constructor and assignment-operator for now
116 SmMathConfig( const SmMathConfig & );
117 SmMathConfig & operator = ( const SmMathConfig & );
120 void StripFontFormatList( const std::vector< SmSym > &rSymbols );
123 void Save();
125 void ReadSymbol( SmSym &rSymbol,
126 const OUString &rSymbolName,
127 const OUString &rBaseNode ) const;
128 void ReadFontFormat( SmFontFormat &rFontFormat,
129 const OUString &rSymbolName,
130 const OUString &rBaseNode ) const;
132 void SetOtherIfNotEqual( bool &rbItem, bool bNewVal );
134 protected:
135 void LoadOther();
136 void SaveOther();
137 void LoadFormat();
138 void SaveFormat();
139 void LoadFontFormatList();
140 void SaveFontFormatList();
142 void SetOtherModified( bool bVal );
143 inline bool IsOtherModified() const { return bIsOtherModified; }
144 void SetFormatModified( bool bVal );
145 inline bool IsFormatModified() const { return bIsFormatModified; }
146 void SetFontFormatListModified( bool bVal );
147 inline bool IsFontFormatListModified() const { return pFontFormatList ? pFontFormatList->IsModified(): false; }
149 SmFontFormatList & GetFontFormatList();
150 const SmFontFormatList & GetFontFormatList() const
152 return ((SmMathConfig *) this)->GetFontFormatList();
155 public:
156 SmMathConfig();
157 virtual ~SmMathConfig();
159 // utl::ConfigItem
160 virtual void Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames );
161 virtual void Commit();
163 SmSymbolManager & GetSymbolManager();
164 void GetSymbols( std::vector< SmSym > &rSymbols ) const;
165 void SetSymbols( const std::vector< SmSym > &rNewSymbols );
167 const SmFormat & GetStandardFormat() const;
168 void SetStandardFormat( const SmFormat &rFormat, bool bSaveFontFormatList = false );
170 bool IsPrintTitle() const;
171 void SetPrintTitle( bool bVal );
172 bool IsPrintFormulaText() const;
173 void SetPrintFormulaText( bool bVal );
174 bool IsPrintFrame() const;
175 void SetPrintFrame( bool bVal );
176 SmPrintSize GetPrintSize() const;
177 void SetPrintSize( SmPrintSize eSize );
178 sal_uInt16 GetPrintZoomFactor() const;
179 void SetPrintZoomFactor( sal_uInt16 nVal );
181 bool IsSaveOnlyUsedSymbols() const;
182 void SetSaveOnlyUsedSymbols( bool bVal );
183 bool IsIgnoreSpacesRight() const;
184 void SetIgnoreSpacesRight( bool bVal );
185 bool IsAutoRedraw() const;
186 void SetAutoRedraw( bool bVal );
187 bool IsShowFormulaCursor() const;
188 void SetShowFormulaCursor( bool bVal );
189 void SetAutoRedraw( sal_Bool bVal );
192 /////////////////////////////////////////////////////////////////
194 #endif
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */