1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cfgitem.hxx,v $
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 ************************************************************************/
35 #ifndef _MATH_CFGITEM_HXX_
36 #define _MATH_CFGITEM_HXX_
40 #include <com/sun/star/beans/PropertyValues.hpp>
41 #include <com/sun/star/uno/Sequence.hxx>
42 #include <com/sun/star/uno/Any.h>
44 #include <tools/solar.h>
45 #include <rtl/ustring.hxx>
46 #include <unotools/configitem.hxx>
47 #include <svtools/svarray.hxx>
48 #include <vcl/timer.hxx>
53 using namespace com::sun::star
;
60 /////////////////////////////////////////////////////////////////
73 SmFontFormat( const Font
&rFont
);
75 const Font
GetFont() const;
76 BOOL
operator == ( const SmFontFormat
&rFntFmt
) const;
80 struct SmFntFmtListEntry
85 SmFntFmtListEntry( const String
&rId
, const SmFontFormat
&rFntFmt
);
89 SV_DECL_OBJARR( SmFntFmtListEntryArr
, SmFntFmtListEntry
, 8, 8 )
92 class SmFontFormatList
94 SmFntFmtListEntryArr aEntries
;
97 // disallow copy-constructor and assignment-operator for now
98 SmFontFormatList( const SmFontFormatList
& );
99 SmFontFormatList
& operator = ( const SmFontFormatList
& );
105 void AddFontFormat( const String
&rFntFmtId
, const SmFontFormat
&rFntFmt
);
106 void RemoveFontFormat( const String
&rFntFmtId
);
108 const SmFontFormat
* GetFontFormat( const String
&rFntFmtId
) const;
109 const SmFontFormat
* GetFontFormat( USHORT nPos
) const;
110 const String
GetFontFormatId( const SmFontFormat
&rFntFmt
) const;
111 const String
GetFontFormatId( const SmFontFormat
&rFntFmt
, BOOL bAdd
);
112 const String
GetFontFormatId( USHORT nPos
) const;
113 const String
GetNewFontFormatId() const;
114 USHORT
GetCount() const { return aEntries
.Count(); }
116 BOOL
IsModified() const { return bModified
; }
117 void SetModified( BOOL bVal
) { bModified
= bVal
; }
121 /////////////////////////////////////////////////////////////////
123 class SmMathConfig
: public utl::ConfigItem
127 SmFontFormatList
* pFontFormatList
;
128 SmSymSetManager
* pSymSetMgr
;
129 BOOL bIsOtherModified
;
130 BOOL bIsFormatModified
;
132 // disallow copy-constructor and assignment-operator for now
133 SmMathConfig( const SmMathConfig
& );
134 SmMathConfig
& operator = ( const SmMathConfig
& );
137 void StripFontFormatList( const std::vector
< SmSym
> &rSymbols
);
142 void ReadSymbol( SmSym
&rSymbol
,
143 const rtl::OUString
&rSymbolName
,
144 const rtl::OUString
&rBaseNode
) const;
145 void ReadFontFormat( SmFontFormat
&rFontFormat
,
146 const rtl::OUString
&rSymbolName
,
147 const rtl::OUString
&rBaseNode
) const;
149 void SetOtherIfNotEqual( BOOL
&rbItem
, BOOL bNewVal
);
156 void LoadFontFormatList();
157 void SaveFontFormatList();
159 void SetOtherModified( BOOL bVal
);
160 inline BOOL
IsOtherModified() const { return bIsOtherModified
; }
161 void SetFormatModified( BOOL bVal
);
162 inline BOOL
IsFormatModified() const { return bIsFormatModified
; }
163 void SetFontFormatListModified( BOOL bVal
);
164 inline BOOL
IsFontFormatListModified() const { return pFontFormatList
? pFontFormatList
->IsModified(): FALSE
; }
166 SmFontFormatList
& GetFontFormatList();
167 const SmFontFormatList
& GetFontFormatList() const
169 return ((SmMathConfig
*) this)->GetFontFormatList();
174 virtual ~SmMathConfig();
177 //virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
178 virtual void Commit();
180 // make some protected functions of utl::ConfigItem public
181 //using utl::ConfigItem::GetNodeNames;
182 //using utl::ConfigItem::GetProperties;
183 //using utl::ConfigItem::PutProperties;
184 //using utl::ConfigItem::SetSetProperties;
185 //using utl::ConfigItem::ReplaceSetProperties;
186 //using utl::ConfigItem::GetReadOnlyStates;
188 SmSymSetManager
& GetSymSetManager();
189 void GetSymbols( std::vector
< SmSym
> &rSymbols
) const;
190 void SetSymbols( const std::vector
< SmSym
> &rNewSymbols
);
191 USHORT
GetSymbolCount() const;
192 const SmSym
* GetSymbol( USHORT nIndex
) const;
194 const SmFormat
& GetStandardFormat() const;
195 void SetStandardFormat( const SmFormat
&rFormat
, BOOL bSaveFontFormatList
= FALSE
);
197 BOOL
IsPrintTitle() const;
198 void SetPrintTitle( BOOL bVal
);
199 BOOL
IsPrintFormulaText() const;
200 void SetPrintFormulaText( BOOL bVal
);
201 BOOL
IsPrintFrame() const;
202 void SetPrintFrame( BOOL bVal
);
203 SmPrintSize
GetPrintSize() const;
204 void SetPrintSize( SmPrintSize eSize
);
205 USHORT
GetPrintZoomFactor() const;
206 void SetPrintZoomFactor( USHORT nVal
);
208 BOOL
IsIgnoreSpacesRight() const;
209 void SetIgnoreSpacesRight( BOOL bVal
);
210 BOOL
IsAutoRedraw() const;
211 void SetAutoRedraw( BOOL bVal
);
212 BOOL
IsShowFormulaCursor() const;
213 void SetShowFormulaCursor( BOOL bVal
);
216 /////////////////////////////////////////////////////////////////