Update ooo320-m1
[ooovba.git] / binfilter / bf_starmath / source / cfgitem.hxx
blobc2d87fab5b3628a1caba13ec3170147b3682db69
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cfgitem.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifdef _MSC_VER
32 #pragma hdrstop
33 #endif
35 #ifndef _MATH_CFGITEM_HXX_
36 #define _MATH_CFGITEM_HXX_
38 #include <com/sun/star/beans/PropertyValues.hpp>
39 #include <com/sun/star/uno/Sequence.hxx>
41 #ifndef _COM_SUN_STAR_UNO_ANY_H_
42 #include <com/sun/star/uno/Any.h>
43 #endif
45 #include <tools/solar.h>
47 #ifndef _RTL_USTRING_HXX_
48 #include <rtl/ustring.hxx>
49 #endif
50 #ifndef _UTL_CONFIGITEM_HXX_
51 #include <unotools/configitem.hxx>
52 #endif
53 #ifndef _SVARRAY_HXX
54 #include <bf_svtools/svarray.hxx>
55 #endif
56 #ifndef _SV_TIMER_HXX
57 #include <vcl/timer.hxx>
58 #endif
60 #include <symbol.hxx>
61 #include <types.hxx>
62 class Font;
63 namespace binfilter {
65 using namespace ::com::sun::star;
67 class SmSym;
68 class SmFormat;
70 struct SmCfgOther;
72 /////////////////////////////////////////////////////////////////
74 class SmMathConfigItem : public ::utl::ConfigItem
76 // disallow copy-constructor and assignment-operator for now
77 SmMathConfigItem( const SmMathConfigItem & );
78 SmMathConfigItem & operator = ( const SmMathConfigItem & );
80 public:
81 inline SmMathConfigItem( const ::rtl::OUString &rPath,
82 sal_Int16 nMode = CONFIG_MODE_IMMEDIATE_UPDATE );
84 uno::Sequence< ::rtl::OUString > GetFormatPropertyNames();
85 uno::Sequence< ::rtl::OUString > GetOtherPropertyNames();
87 uno::Sequence< uno::Any >
88 GetProperties( const uno::Sequence< ::rtl::OUString > &rNames )
90 return ConfigItem::GetProperties(rNames);
93 sal_Bool
94 PutProperties( const uno::Sequence< ::rtl::OUString > &rNames,
95 const uno::Sequence< uno::Any > &rValues)
97 return ConfigItem::PutProperties( rNames, rValues);
100 sal_Bool
101 SetSetProperties( const ::rtl::OUString &rNode,
102 uno::Sequence< beans::PropertyValue > rValues )
104 return ConfigItem::SetSetProperties( rNode, rValues );
107 uno::Sequence< ::rtl::OUString >
108 GetNodeNames( const ::rtl::OUString &rNode )
110 return ConfigItem::GetNodeNames( rNode );
113 sal_Bool
114 ReplaceSetProperties( const ::rtl::OUString& rNode,
115 uno::Sequence< beans::PropertyValue > rValues )
117 return ConfigItem::ReplaceSetProperties( rNode, rValues );
122 inline SmMathConfigItem::SmMathConfigItem(
123 const ::rtl::OUString &rPath,
124 sal_Int16 nMode ) :
125 ConfigItem( rPath, nMode )
130 /////////////////////////////////////////////////////////////////
133 struct SmFontFormat
135 String aName;
136 INT16 nCharSet;
137 INT16 nFamily;
138 INT16 nPitch;
139 INT16 nWeight;
140 INT16 nItalic;
142 SmFontFormat();
143 // SmFontFormat( const Font &rFont );
145 const Font GetFont() const;
149 struct SmFntFmtListEntry
151 String aId;
152 SmFontFormat aFntFmt;
154 SmFntFmtListEntry( const String &rId, const SmFontFormat &rFntFmt );
158 SV_DECL_OBJARR( SmFntFmtListEntryArr, SmFntFmtListEntry, 8, 8 )//STRIP008 ;
161 class SmFontFormatList
163 SmFntFmtListEntryArr aEntries;
164 BOOL bModified;
166 // disallow copy-constructor and assignment-operator for now
167 SmFontFormatList( const SmFontFormatList & );
168 SmFontFormatList & operator = ( const SmFontFormatList & );
170 public:
171 SmFontFormatList();
173 void AddFontFormat( const String &rFntFmtId, const SmFontFormat &rFntFmt );
175 const SmFontFormat * GetFontFormat( const String &rFntFmtId ) const;
176 // const SmFontFormat * GetFontFormat( USHORT nPos ) const;
177 USHORT GetCount() const { return aEntries.Count(); }
179 BOOL IsModified() const { return bModified; }
180 void SetModified( BOOL bVal ) { bModified = bVal; }
184 /////////////////////////////////////////////////////////////////
186 class SmMathConfig
188 Timer aSaveTimer;
189 SmFormat * pFormat;
190 SmCfgOther * pOther;
191 SmFontFormatList * pFontFormatList;
192 SmSym * pSymbols;
193 USHORT nSymbolCount;
194 BOOL bIsOtherModified;
195 BOOL bIsFormatModified;
197 // disallow copy-constructor and assignment-operator for now
198 SmMathConfig( const SmMathConfig & );
199 SmMathConfig & operator = ( const SmMathConfig & );
201 void LoadSymbols();
203 void LoadOther();
204 void SaveOther();
205 void LoadFormat();
206 void SaveFormat();
207 void LoadFontFormatList();
208 void SaveFontFormatList();
212 void Save();
214 SmSym ReadSymbol( SmMathConfigItem &rCfg,
215 const ::rtl::OUString &rSymbolName,
216 const ::rtl::OUString &rBaseNode ) const;
217 SmFontFormat ReadFontFormat( SmMathConfigItem &rCfg,
218 const ::rtl::OUString &rSymbolName,
219 const ::rtl::OUString &rBaseNode ) const;
222 DECL_LINK( TimeOut, Timer * );
224 protected:
225 void SetOtherModified( BOOL bVal );
226 inline BOOL IsOtherModified() const { return bIsOtherModified; }
227 void SetFormatModified( BOOL bVal );
228 inline BOOL IsFormatModified() const { return bIsFormatModified; }
230 SmFontFormatList & GetFontFormatList();
231 const SmFontFormatList & GetFontFormatList() const
233 return ((SmMathConfig *) this)->GetFontFormatList();
236 public:
237 SmMathConfig();
238 ~SmMathConfig();
240 USHORT GetSymbolCount() const;
241 const SmSym * GetSymbol( USHORT nIndex ) const;
243 const SmFormat & GetStandardFormat() const;
245 BOOL IsPrintTitle() const;
246 BOOL IsPrintFormulaText() const;
247 BOOL IsPrintFrame() const;
248 SmPrintSize GetPrintSize() const;
249 USHORT GetPrintZoomFactor() const;
251 BOOL IsIgnoreSpacesRight() const;
252 BOOL IsAutoRedraw() const;
255 /////////////////////////////////////////////////////////////////
257 } //namespace binfilter
258 #endif