1*d107581fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*d107581fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d107581fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*d107581fSAndrew Rist * distributed with this work for additional information
6*d107581fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*d107581fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d107581fSAndrew Rist * "License"); you may not use this file except in compliance
9*d107581fSAndrew Rist * with the License. You may obtain a copy of the License at
10*d107581fSAndrew Rist *
11*d107581fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*d107581fSAndrew Rist *
13*d107581fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d107581fSAndrew Rist * software distributed under the License is distributed on an
15*d107581fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d107581fSAndrew Rist * KIND, either express or implied. See the License for the
17*d107581fSAndrew Rist * specific language governing permissions and limitations
18*d107581fSAndrew Rist * under the License.
19*d107581fSAndrew Rist *
20*d107581fSAndrew Rist *************************************************************/
21*d107581fSAndrew Rist
22*d107581fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_starmath.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <vcl/svapp.hxx>
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include "cfgitem.hxx"
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include "starmath.hrc"
33cdf0e10cSrcweir #include "smdll.hxx"
34cdf0e10cSrcweir #include "format.hxx"
35cdf0e10cSrcweir
36cdf0e10cSrcweir using namespace rtl;
37cdf0e10cSrcweir using namespace com::sun::star;
38cdf0e10cSrcweir using namespace com::sun::star::uno;
39cdf0e10cSrcweir using namespace com::sun::star::beans;
40cdf0e10cSrcweir
41cdf0e10cSrcweir
42cdf0e10cSrcweir static const char* aRootName = "Office.Math";
43cdf0e10cSrcweir
44cdf0e10cSrcweir #define SYMBOL_LIST "SymbolList"
45cdf0e10cSrcweir #define FONT_FORMAT_LIST "FontFormatList"
46cdf0e10cSrcweir
47cdf0e10cSrcweir /////////////////////////////////////////////////////////////////
48cdf0e10cSrcweir
49cdf0e10cSrcweir
lcl_GetFontPropertyNames()50cdf0e10cSrcweir static Sequence< OUString > lcl_GetFontPropertyNames()
51cdf0e10cSrcweir {
52cdf0e10cSrcweir static const char * aPropNames[] =
53cdf0e10cSrcweir {
54cdf0e10cSrcweir "Name",
55cdf0e10cSrcweir "CharSet",
56cdf0e10cSrcweir "Family",
57cdf0e10cSrcweir "Pitch",
58cdf0e10cSrcweir "Weight",
59cdf0e10cSrcweir "Italic",
60cdf0e10cSrcweir 0
61cdf0e10cSrcweir };
62cdf0e10cSrcweir
63cdf0e10cSrcweir const char** ppPropName = aPropNames;
64cdf0e10cSrcweir
65cdf0e10cSrcweir Sequence< OUString > aNames( 6 );
66cdf0e10cSrcweir OUString *pNames = aNames.getArray();
67cdf0e10cSrcweir for( sal_Int32 i = 0; *ppPropName; ++i, ++ppPropName )
68cdf0e10cSrcweir {
69cdf0e10cSrcweir pNames[i] = A2OU( *ppPropName );
70cdf0e10cSrcweir }
71cdf0e10cSrcweir //aNames.realloc( i );
72cdf0e10cSrcweir return aNames;
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir /////////////////////////////////////////////////////////////////
76cdf0e10cSrcweir
77cdf0e10cSrcweir
lcl_GetSymbolPropertyNames()78cdf0e10cSrcweir static Sequence< OUString > lcl_GetSymbolPropertyNames()
79cdf0e10cSrcweir {
80cdf0e10cSrcweir static const char * aPropNames[] =
81cdf0e10cSrcweir {
82cdf0e10cSrcweir "Char",
83cdf0e10cSrcweir "Set",
84cdf0e10cSrcweir "Predefined",
85cdf0e10cSrcweir "FontFormatId",
86cdf0e10cSrcweir 0
87cdf0e10cSrcweir };
88cdf0e10cSrcweir
89cdf0e10cSrcweir const char** ppPropName = aPropNames;
90cdf0e10cSrcweir
91cdf0e10cSrcweir Sequence< OUString > aNames( 4 );
92cdf0e10cSrcweir OUString *pNames = aNames.getArray();
93cdf0e10cSrcweir for( sal_Int32 i = 0; *ppPropName; ++i, ++ppPropName )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir pNames[i] = A2OU( *ppPropName );
96cdf0e10cSrcweir }
97cdf0e10cSrcweir //aNames.realloc( i );
98cdf0e10cSrcweir return aNames;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
101cdf0e10cSrcweir /////////////////////////////////////////////////////////////////
102cdf0e10cSrcweir
103cdf0e10cSrcweir static const char * aMathPropNames[] =
104cdf0e10cSrcweir {
105cdf0e10cSrcweir "Print/Title",
106cdf0e10cSrcweir "Print/FormulaText",
107cdf0e10cSrcweir "Print/Frame",
108cdf0e10cSrcweir "Print/Size",
109cdf0e10cSrcweir "Print/ZoomFactor",
110cdf0e10cSrcweir "LoadSave/IsSaveOnlyUsedSymbols",
111cdf0e10cSrcweir //"Misc/NoSymbolsWarning", @deprecated
112cdf0e10cSrcweir "Misc/IgnoreSpacesRight",
113cdf0e10cSrcweir "View/ToolboxVisible",
114cdf0e10cSrcweir "View/AutoRedraw",
115cdf0e10cSrcweir "View/FormulaCursor"
116cdf0e10cSrcweir };
117cdf0e10cSrcweir
118cdf0e10cSrcweir
119cdf0e10cSrcweir //! Beware of order according to *_BEGIN *_END defines in format.hxx !
120cdf0e10cSrcweir //! see respective load/save routines here
121cdf0e10cSrcweir static const char * aFormatPropNames[] =
122cdf0e10cSrcweir {
123cdf0e10cSrcweir "StandardFormat/Textmode",
124cdf0e10cSrcweir "StandardFormat/GreekCharStyle",
125cdf0e10cSrcweir "StandardFormat/ScaleNormalBracket",
126cdf0e10cSrcweir "StandardFormat/HorizontalAlignment",
127cdf0e10cSrcweir "StandardFormat/BaseSize",
128cdf0e10cSrcweir "StandardFormat/TextSize",
129cdf0e10cSrcweir "StandardFormat/IndexSize",
130cdf0e10cSrcweir "StandardFormat/FunctionSize",
131cdf0e10cSrcweir "StandardFormat/OperatorSize",
132cdf0e10cSrcweir "StandardFormat/LimitsSize",
133cdf0e10cSrcweir "StandardFormat/Distance/Horizontal",
134cdf0e10cSrcweir "StandardFormat/Distance/Vertical",
135cdf0e10cSrcweir "StandardFormat/Distance/Root",
136cdf0e10cSrcweir "StandardFormat/Distance/SuperScript",
137cdf0e10cSrcweir "StandardFormat/Distance/SubScript",
138cdf0e10cSrcweir "StandardFormat/Distance/Numerator",
139cdf0e10cSrcweir "StandardFormat/Distance/Denominator",
140cdf0e10cSrcweir "StandardFormat/Distance/Fraction",
141cdf0e10cSrcweir "StandardFormat/Distance/StrokeWidth",
142cdf0e10cSrcweir "StandardFormat/Distance/UpperLimit",
143cdf0e10cSrcweir "StandardFormat/Distance/LowerLimit",
144cdf0e10cSrcweir "StandardFormat/Distance/BracketSize",
145cdf0e10cSrcweir "StandardFormat/Distance/BracketSpace",
146cdf0e10cSrcweir "StandardFormat/Distance/MatrixRow",
147cdf0e10cSrcweir "StandardFormat/Distance/MatrixColumn",
148cdf0e10cSrcweir "StandardFormat/Distance/OrnamentSize",
149cdf0e10cSrcweir "StandardFormat/Distance/OrnamentSpace",
150cdf0e10cSrcweir "StandardFormat/Distance/OperatorSize",
151cdf0e10cSrcweir "StandardFormat/Distance/OperatorSpace",
152cdf0e10cSrcweir "StandardFormat/Distance/LeftSpace",
153cdf0e10cSrcweir "StandardFormat/Distance/RightSpace",
154cdf0e10cSrcweir "StandardFormat/Distance/TopSpace",
155cdf0e10cSrcweir "StandardFormat/Distance/BottomSpace",
156cdf0e10cSrcweir "StandardFormat/Distance/NormalBracketSize",
157cdf0e10cSrcweir "StandardFormat/VariableFont",
158cdf0e10cSrcweir "StandardFormat/FunctionFont",
159cdf0e10cSrcweir "StandardFormat/NumberFont",
160cdf0e10cSrcweir "StandardFormat/TextFont",
161cdf0e10cSrcweir "StandardFormat/SerifFont",
162cdf0e10cSrcweir "StandardFormat/SansFont",
163cdf0e10cSrcweir "StandardFormat/FixedFont"
164cdf0e10cSrcweir };
165cdf0e10cSrcweir
166cdf0e10cSrcweir
lcl_GetPropertyNames(const char * aPropNames[],sal_uInt16 nCount)167cdf0e10cSrcweir static Sequence< OUString > lcl_GetPropertyNames(
168cdf0e10cSrcweir const char * aPropNames[], sal_uInt16 nCount )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir
171cdf0e10cSrcweir const char** ppPropName = aPropNames;
172cdf0e10cSrcweir
173cdf0e10cSrcweir Sequence< OUString > aNames( nCount );
174cdf0e10cSrcweir OUString *pNames = aNames.getArray();
175cdf0e10cSrcweir for (sal_Int32 i = 0; i < nCount; ++i, ++ppPropName)
176cdf0e10cSrcweir {
177cdf0e10cSrcweir pNames[i] = A2OU( *ppPropName );
178cdf0e10cSrcweir }
179cdf0e10cSrcweir //aNames.realloc( i );
180cdf0e10cSrcweir return aNames;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir
183cdf0e10cSrcweir
GetFormatPropertyNames()184cdf0e10cSrcweir static Sequence< OUString > GetFormatPropertyNames()
185cdf0e10cSrcweir {
186cdf0e10cSrcweir sal_uInt16 nCnt = sizeof(aFormatPropNames) / sizeof(aFormatPropNames[0]);
187cdf0e10cSrcweir return lcl_GetPropertyNames( aFormatPropNames, nCnt );
188cdf0e10cSrcweir }
189cdf0e10cSrcweir
190cdf0e10cSrcweir
GetOtherPropertyNames()191cdf0e10cSrcweir static Sequence< OUString > GetOtherPropertyNames()
192cdf0e10cSrcweir {
193cdf0e10cSrcweir sal_uInt16 nCnt = sizeof(aMathPropNames) / sizeof(aMathPropNames[0]);
194cdf0e10cSrcweir return lcl_GetPropertyNames( aMathPropNames, nCnt );
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir /////////////////////////////////////////////////////////////////
198cdf0e10cSrcweir
199cdf0e10cSrcweir struct SmCfgOther
200cdf0e10cSrcweir {
201cdf0e10cSrcweir SmPrintSize ePrintSize;
202cdf0e10cSrcweir sal_uInt16 nPrintZoomFactor;
203cdf0e10cSrcweir sal_Bool bPrintTitle;
204cdf0e10cSrcweir sal_Bool bPrintFormulaText;
205cdf0e10cSrcweir sal_Bool bPrintFrame;
206cdf0e10cSrcweir sal_Bool bIsSaveOnlyUsedSymbols;
207cdf0e10cSrcweir sal_Bool bIgnoreSpacesRight;
208cdf0e10cSrcweir sal_Bool bToolboxVisible;
209cdf0e10cSrcweir sal_Bool bAutoRedraw;
210cdf0e10cSrcweir sal_Bool bFormulaCursor;
211cdf0e10cSrcweir //sal_Bool bNoSymbolsWarning;
212cdf0e10cSrcweir
213cdf0e10cSrcweir SmCfgOther();
214cdf0e10cSrcweir };
215cdf0e10cSrcweir
216cdf0e10cSrcweir
SmCfgOther()217cdf0e10cSrcweir SmCfgOther::SmCfgOther()
218cdf0e10cSrcweir {
219cdf0e10cSrcweir ePrintSize = PRINT_SIZE_NORMAL;
220cdf0e10cSrcweir nPrintZoomFactor = 100;
221cdf0e10cSrcweir bPrintTitle = bPrintFormulaText =
222cdf0e10cSrcweir bPrintFrame = bIgnoreSpacesRight =
223cdf0e10cSrcweir bToolboxVisible = bAutoRedraw =
224cdf0e10cSrcweir bFormulaCursor = bIsSaveOnlyUsedSymbols = sal_True;
225cdf0e10cSrcweir }
226cdf0e10cSrcweir
227cdf0e10cSrcweir /////////////////////////////////////////////////////////////////
228cdf0e10cSrcweir
229cdf0e10cSrcweir
SmFontFormat()230cdf0e10cSrcweir SmFontFormat::SmFontFormat()
231cdf0e10cSrcweir {
232cdf0e10cSrcweir aName.AssignAscii( FONTNAME_MATH );
233cdf0e10cSrcweir nCharSet = RTL_TEXTENCODING_UNICODE;
234cdf0e10cSrcweir nFamily = FAMILY_DONTKNOW;
235cdf0e10cSrcweir nPitch = PITCH_DONTKNOW;
236cdf0e10cSrcweir nWeight = WEIGHT_DONTKNOW;
237cdf0e10cSrcweir nItalic = ITALIC_NONE;
238cdf0e10cSrcweir }
239cdf0e10cSrcweir
240cdf0e10cSrcweir
SmFontFormat(const Font & rFont)241cdf0e10cSrcweir SmFontFormat::SmFontFormat( const Font &rFont )
242cdf0e10cSrcweir {
243cdf0e10cSrcweir aName = rFont.GetName();
244cdf0e10cSrcweir nCharSet = (sal_Int16) rFont.GetCharSet();
245cdf0e10cSrcweir nFamily = (sal_Int16) rFont.GetFamily();
246cdf0e10cSrcweir nPitch = (sal_Int16) rFont.GetPitch();
247cdf0e10cSrcweir nWeight = (sal_Int16) rFont.GetWeight();
248cdf0e10cSrcweir nItalic = (sal_Int16) rFont.GetItalic();
249cdf0e10cSrcweir }
250cdf0e10cSrcweir
251cdf0e10cSrcweir
GetFont() const252cdf0e10cSrcweir const Font SmFontFormat::GetFont() const
253cdf0e10cSrcweir {
254cdf0e10cSrcweir Font aRes;
255cdf0e10cSrcweir aRes.SetName( aName );
256cdf0e10cSrcweir aRes.SetCharSet( (rtl_TextEncoding) nCharSet );
257cdf0e10cSrcweir aRes.SetFamily( (FontFamily) nFamily );
258cdf0e10cSrcweir aRes.SetPitch( (FontPitch) nPitch );
259cdf0e10cSrcweir aRes.SetWeight( (FontWeight) nWeight );
260cdf0e10cSrcweir aRes.SetItalic( (FontItalic) nItalic );
261cdf0e10cSrcweir return aRes;
262cdf0e10cSrcweir }
263cdf0e10cSrcweir
264cdf0e10cSrcweir
operator ==(const SmFontFormat & rFntFmt) const265cdf0e10cSrcweir sal_Bool SmFontFormat::operator == ( const SmFontFormat &rFntFmt ) const
266cdf0e10cSrcweir {
267cdf0e10cSrcweir return aName == rFntFmt.aName &&
268cdf0e10cSrcweir nCharSet == rFntFmt.nCharSet &&
269cdf0e10cSrcweir nFamily == rFntFmt.nFamily &&
270cdf0e10cSrcweir nPitch == rFntFmt.nPitch &&
271cdf0e10cSrcweir nWeight == rFntFmt.nWeight &&
272cdf0e10cSrcweir nItalic == rFntFmt.nItalic;
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
275cdf0e10cSrcweir
276cdf0e10cSrcweir /////////////////////////////////////////////////////////////////
277cdf0e10cSrcweir
SmFntFmtListEntry(const String & rId,const SmFontFormat & rFntFmt)278cdf0e10cSrcweir SmFntFmtListEntry::SmFntFmtListEntry( const String &rId, const SmFontFormat &rFntFmt ) :
279cdf0e10cSrcweir aId (rId),
280cdf0e10cSrcweir aFntFmt (rFntFmt)
281cdf0e10cSrcweir {
282cdf0e10cSrcweir }
283cdf0e10cSrcweir
284cdf0e10cSrcweir
SmFontFormatList()285cdf0e10cSrcweir SmFontFormatList::SmFontFormatList()
286cdf0e10cSrcweir {
287cdf0e10cSrcweir bModified = sal_False;
288cdf0e10cSrcweir }
289cdf0e10cSrcweir
290cdf0e10cSrcweir
Clear()291cdf0e10cSrcweir void SmFontFormatList::Clear()
292cdf0e10cSrcweir {
293cdf0e10cSrcweir if (!aEntries.empty())
294cdf0e10cSrcweir {
295cdf0e10cSrcweir aEntries.clear();
296cdf0e10cSrcweir SetModified( sal_True );
297cdf0e10cSrcweir }
298cdf0e10cSrcweir }
299cdf0e10cSrcweir
300cdf0e10cSrcweir
AddFontFormat(const String & rFntFmtId,const SmFontFormat & rFntFmt)301cdf0e10cSrcweir void SmFontFormatList::AddFontFormat( const String &rFntFmtId,
302cdf0e10cSrcweir const SmFontFormat &rFntFmt )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir const SmFontFormat *pFntFmt = GetFontFormat( rFntFmtId );
305cdf0e10cSrcweir DBG_ASSERT( !pFntFmt, "FontFormatId already exists" );
306cdf0e10cSrcweir if (!pFntFmt)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir SmFntFmtListEntry aEntry( rFntFmtId, rFntFmt );
309cdf0e10cSrcweir aEntries.push_back( aEntry );
310cdf0e10cSrcweir SetModified( sal_True );
311cdf0e10cSrcweir }
312cdf0e10cSrcweir }
313cdf0e10cSrcweir
314cdf0e10cSrcweir
RemoveFontFormat(const String & rFntFmtId)315cdf0e10cSrcweir void SmFontFormatList::RemoveFontFormat( const String &rFntFmtId )
316cdf0e10cSrcweir {
317cdf0e10cSrcweir
318cdf0e10cSrcweir // search for entry
319cdf0e10cSrcweir for (size_t i = 0; i < aEntries.size(); ++i)
320cdf0e10cSrcweir {
321cdf0e10cSrcweir if (aEntries[i].aId == rFntFmtId)
322cdf0e10cSrcweir {
323cdf0e10cSrcweir // remove entry if found
324cdf0e10cSrcweir aEntries.erase( aEntries.begin() + i );
325cdf0e10cSrcweir SetModified( sal_True );
326cdf0e10cSrcweir break;
327cdf0e10cSrcweir }
328cdf0e10cSrcweir }
329cdf0e10cSrcweir }
330cdf0e10cSrcweir
331cdf0e10cSrcweir
GetFontFormat(const String & rFntFmtId) const332cdf0e10cSrcweir const SmFontFormat * SmFontFormatList::GetFontFormat( const String &rFntFmtId ) const
333cdf0e10cSrcweir {
334cdf0e10cSrcweir const SmFontFormat *pRes = 0;
335cdf0e10cSrcweir
336cdf0e10cSrcweir for (size_t i = 0; i < aEntries.size(); ++i)
337cdf0e10cSrcweir {
338cdf0e10cSrcweir if (aEntries[i].aId == rFntFmtId)
339cdf0e10cSrcweir {
340cdf0e10cSrcweir pRes = &aEntries[i].aFntFmt;
341cdf0e10cSrcweir break;
342cdf0e10cSrcweir }
343cdf0e10cSrcweir }
344cdf0e10cSrcweir
345cdf0e10cSrcweir return pRes;
346cdf0e10cSrcweir }
347cdf0e10cSrcweir
348cdf0e10cSrcweir
349cdf0e10cSrcweir
GetFontFormat(size_t nPos) const350cdf0e10cSrcweir const SmFontFormat * SmFontFormatList::GetFontFormat( size_t nPos ) const
351cdf0e10cSrcweir {
352cdf0e10cSrcweir const SmFontFormat *pRes = 0;
353cdf0e10cSrcweir if (nPos < aEntries.size())
354cdf0e10cSrcweir pRes = &aEntries[nPos].aFntFmt;
355cdf0e10cSrcweir return pRes;
356cdf0e10cSrcweir }
357cdf0e10cSrcweir
358cdf0e10cSrcweir
GetFontFormatId(const SmFontFormat & rFntFmt) const359cdf0e10cSrcweir const String SmFontFormatList::GetFontFormatId( const SmFontFormat &rFntFmt ) const
360cdf0e10cSrcweir {
361cdf0e10cSrcweir String aRes;
362cdf0e10cSrcweir
363cdf0e10cSrcweir for (size_t i = 0; i < aEntries.size(); ++i)
364cdf0e10cSrcweir {
365cdf0e10cSrcweir if (aEntries[i].aFntFmt == rFntFmt)
366cdf0e10cSrcweir {
367cdf0e10cSrcweir aRes = aEntries[i].aId;
368cdf0e10cSrcweir break;
369cdf0e10cSrcweir }
370cdf0e10cSrcweir }
371cdf0e10cSrcweir
372cdf0e10cSrcweir return aRes;
373cdf0e10cSrcweir }
374cdf0e10cSrcweir
375cdf0e10cSrcweir
GetFontFormatId(const SmFontFormat & rFntFmt,sal_Bool bAdd)376cdf0e10cSrcweir const String SmFontFormatList::GetFontFormatId( const SmFontFormat &rFntFmt, sal_Bool bAdd )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir String aRes( GetFontFormatId( rFntFmt) );
379cdf0e10cSrcweir if (0 == aRes.Len() && bAdd)
380cdf0e10cSrcweir {
381cdf0e10cSrcweir aRes = GetNewFontFormatId();
382cdf0e10cSrcweir AddFontFormat( aRes, rFntFmt );
383cdf0e10cSrcweir }
384cdf0e10cSrcweir return aRes;
385cdf0e10cSrcweir }
386cdf0e10cSrcweir
387cdf0e10cSrcweir
GetFontFormatId(size_t nPos) const388cdf0e10cSrcweir const String SmFontFormatList::GetFontFormatId( size_t nPos ) const
389cdf0e10cSrcweir {
390cdf0e10cSrcweir String aRes;
391cdf0e10cSrcweir if (nPos < aEntries.size())
392cdf0e10cSrcweir aRes = aEntries[nPos].aId;
393cdf0e10cSrcweir return aRes;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir
396cdf0e10cSrcweir
GetNewFontFormatId() const397cdf0e10cSrcweir const String SmFontFormatList::GetNewFontFormatId() const
398cdf0e10cSrcweir {
399cdf0e10cSrcweir // returns first unused FormatId
400cdf0e10cSrcweir
401cdf0e10cSrcweir String aRes;
402cdf0e10cSrcweir
403cdf0e10cSrcweir String aPrefix( RTL_CONSTASCII_STRINGPARAM( "Id" ) );
404cdf0e10cSrcweir sal_Int32 nCnt = GetCount();
405cdf0e10cSrcweir for (sal_Int32 i = 1; i <= nCnt + 1; ++i)
406cdf0e10cSrcweir {
407cdf0e10cSrcweir String aTmpId( aPrefix );
408cdf0e10cSrcweir aTmpId += String::CreateFromInt32( i );
409cdf0e10cSrcweir if (!GetFontFormat( aTmpId ))
410cdf0e10cSrcweir {
411cdf0e10cSrcweir aRes = aTmpId;
412cdf0e10cSrcweir break;
413cdf0e10cSrcweir }
414cdf0e10cSrcweir }
415cdf0e10cSrcweir DBG_ASSERT( 0 != aRes.Len(), "failed to create new FontFormatId" );
416cdf0e10cSrcweir
417cdf0e10cSrcweir return aRes;
418cdf0e10cSrcweir }
419cdf0e10cSrcweir
420cdf0e10cSrcweir /////////////////////////////////////////////////////////////////
421cdf0e10cSrcweir
SmMathConfig()422cdf0e10cSrcweir SmMathConfig::SmMathConfig() :
423cdf0e10cSrcweir ConfigItem( String::CreateFromAscii( aRootName ))
424cdf0e10cSrcweir {
425cdf0e10cSrcweir pFormat = 0;
426cdf0e10cSrcweir pOther = 0;
427cdf0e10cSrcweir pFontFormatList = 0;
428cdf0e10cSrcweir pSymbolMgr = 0;
429cdf0e10cSrcweir
430cdf0e10cSrcweir bIsOtherModified = bIsFormatModified = sal_False;
431cdf0e10cSrcweir }
432cdf0e10cSrcweir
433cdf0e10cSrcweir
~SmMathConfig()434cdf0e10cSrcweir SmMathConfig::~SmMathConfig()
435cdf0e10cSrcweir {
436cdf0e10cSrcweir Save();
437cdf0e10cSrcweir delete pFormat;
438cdf0e10cSrcweir delete pOther;
439cdf0e10cSrcweir delete pFontFormatList;
440cdf0e10cSrcweir delete pSymbolMgr;
441cdf0e10cSrcweir }
442cdf0e10cSrcweir
443cdf0e10cSrcweir
SetOtherModified(sal_Bool bVal)444cdf0e10cSrcweir void SmMathConfig::SetOtherModified( sal_Bool bVal )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir bIsOtherModified = bVal;
447cdf0e10cSrcweir }
448cdf0e10cSrcweir
449cdf0e10cSrcweir
SetFormatModified(sal_Bool bVal)450cdf0e10cSrcweir void SmMathConfig::SetFormatModified( sal_Bool bVal )
451cdf0e10cSrcweir {
452cdf0e10cSrcweir bIsFormatModified = bVal;
453cdf0e10cSrcweir }
454cdf0e10cSrcweir
455cdf0e10cSrcweir
SetFontFormatListModified(sal_Bool bVal)456cdf0e10cSrcweir void SmMathConfig::SetFontFormatListModified( sal_Bool bVal )
457cdf0e10cSrcweir {
458cdf0e10cSrcweir if (pFontFormatList)
459cdf0e10cSrcweir pFontFormatList->SetModified( bVal );
460cdf0e10cSrcweir }
461cdf0e10cSrcweir
462cdf0e10cSrcweir
ReadSymbol(SmSym & rSymbol,const rtl::OUString & rSymbolName,const rtl::OUString & rBaseNode) const463cdf0e10cSrcweir void SmMathConfig::ReadSymbol( SmSym &rSymbol,
464cdf0e10cSrcweir const rtl::OUString &rSymbolName,
465cdf0e10cSrcweir const rtl::OUString &rBaseNode ) const
466cdf0e10cSrcweir {
467cdf0e10cSrcweir Sequence< OUString > aNames = lcl_GetSymbolPropertyNames();
468cdf0e10cSrcweir sal_Int32 nProps = aNames.getLength();
469cdf0e10cSrcweir
470cdf0e10cSrcweir OUString aDelim( OUString::valueOf( (sal_Unicode) '/' ) );
471cdf0e10cSrcweir OUString *pName = aNames.getArray();
472cdf0e10cSrcweir for (sal_Int32 i = 0; i < nProps; ++i)
473cdf0e10cSrcweir {
474cdf0e10cSrcweir OUString &rName = pName[i];
475cdf0e10cSrcweir OUString aTmp( rName );
476cdf0e10cSrcweir rName = rBaseNode;
477cdf0e10cSrcweir rName += aDelim;
478cdf0e10cSrcweir rName += rSymbolName;
479cdf0e10cSrcweir rName += aDelim;
480cdf0e10cSrcweir rName += aTmp;
481cdf0e10cSrcweir }
482cdf0e10cSrcweir
483cdf0e10cSrcweir const Sequence< Any > aValues = ((SmMathConfig*) this)->GetProperties( aNames );
484cdf0e10cSrcweir
485cdf0e10cSrcweir if (nProps && aValues.getLength() == nProps)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir const Any * pValue = aValues.getConstArray();
488cdf0e10cSrcweir Font aFont;
489cdf0e10cSrcweir sal_UCS4 cChar = '\0';
490cdf0e10cSrcweir String aSet;
491cdf0e10cSrcweir sal_Bool bPredefined = sal_False;
492cdf0e10cSrcweir
493cdf0e10cSrcweir OUString aTmpStr;
494cdf0e10cSrcweir sal_Int32 nTmp32 = 0;
495cdf0e10cSrcweir sal_Bool bTmp = sal_False;
496cdf0e10cSrcweir
497cdf0e10cSrcweir sal_Bool bOK = sal_True;
498cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= nTmp32))
499cdf0e10cSrcweir cChar = static_cast< sal_UCS4 >( nTmp32 );
500cdf0e10cSrcweir else
501cdf0e10cSrcweir bOK = sal_False;
502cdf0e10cSrcweir ++pValue;
503cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= aTmpStr))
504cdf0e10cSrcweir aSet = aTmpStr;
505cdf0e10cSrcweir else
506cdf0e10cSrcweir bOK = sal_False;
507cdf0e10cSrcweir ++pValue;
508cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= bTmp))
509cdf0e10cSrcweir bPredefined = bTmp;
510cdf0e10cSrcweir else
511cdf0e10cSrcweir bOK = sal_False;
512cdf0e10cSrcweir ++pValue;
513cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= aTmpStr))
514cdf0e10cSrcweir {
515cdf0e10cSrcweir const SmFontFormat *pFntFmt = GetFontFormatList().GetFontFormat( aTmpStr );
516cdf0e10cSrcweir DBG_ASSERT( pFntFmt, "unknown FontFormat" );
517cdf0e10cSrcweir if (pFntFmt)
518cdf0e10cSrcweir aFont = pFntFmt->GetFont();
519cdf0e10cSrcweir }
520cdf0e10cSrcweir else
521cdf0e10cSrcweir bOK = sal_False;
522cdf0e10cSrcweir ++pValue;
523cdf0e10cSrcweir
524cdf0e10cSrcweir if (bOK)
525cdf0e10cSrcweir {
526cdf0e10cSrcweir String aUiName( rSymbolName );
527cdf0e10cSrcweir String aUiSetName( aSet );
528cdf0e10cSrcweir if (bPredefined)
529cdf0e10cSrcweir {
530cdf0e10cSrcweir String aTmp;
531cdf0e10cSrcweir aTmp = GetUiSymbolName( rSymbolName );
532cdf0e10cSrcweir DBG_ASSERT( aTmp.Len(), "localized symbol-name not found" );
533cdf0e10cSrcweir if (aTmp.Len())
534cdf0e10cSrcweir aUiName = aTmp;
535cdf0e10cSrcweir aTmp = GetUiSymbolSetName( aSet );
536cdf0e10cSrcweir DBG_ASSERT( aTmp.Len(), "localized symbolset-name not found" );
537cdf0e10cSrcweir if (aTmp.Len())
538cdf0e10cSrcweir aUiSetName = aTmp;
539cdf0e10cSrcweir }
540cdf0e10cSrcweir
541cdf0e10cSrcweir rSymbol = SmSym( aUiName, aFont, cChar, aUiSetName, bPredefined );
542cdf0e10cSrcweir if (aUiName != String(rSymbolName))
543cdf0e10cSrcweir rSymbol.SetExportName( rSymbolName );
544cdf0e10cSrcweir }
545cdf0e10cSrcweir else
546cdf0e10cSrcweir {
547cdf0e10cSrcweir DBG_ERROR( "symbol read error" );
548cdf0e10cSrcweir }
549cdf0e10cSrcweir }
550cdf0e10cSrcweir }
551cdf0e10cSrcweir
552cdf0e10cSrcweir
GetSymbolManager()553cdf0e10cSrcweir SmSymbolManager & SmMathConfig::GetSymbolManager()
554cdf0e10cSrcweir {
555cdf0e10cSrcweir if (!pSymbolMgr)
556cdf0e10cSrcweir {
557cdf0e10cSrcweir pSymbolMgr = new SmSymbolManager;
558cdf0e10cSrcweir pSymbolMgr->Load();
559cdf0e10cSrcweir }
560cdf0e10cSrcweir return *pSymbolMgr;
561cdf0e10cSrcweir }
562cdf0e10cSrcweir
563cdf0e10cSrcweir
Commit()564cdf0e10cSrcweir void SmMathConfig::Commit()
565cdf0e10cSrcweir {
566cdf0e10cSrcweir Save();
567cdf0e10cSrcweir }
568cdf0e10cSrcweir
569cdf0e10cSrcweir
Save()570cdf0e10cSrcweir void SmMathConfig::Save()
571cdf0e10cSrcweir {
572cdf0e10cSrcweir SaveOther();
573cdf0e10cSrcweir SaveFormat();
574cdf0e10cSrcweir SaveFontFormatList();
575cdf0e10cSrcweir }
576cdf0e10cSrcweir
577cdf0e10cSrcweir
GetSymbols(std::vector<SmSym> & rSymbols) const578cdf0e10cSrcweir void SmMathConfig::GetSymbols( std::vector< SmSym > &rSymbols ) const
579cdf0e10cSrcweir {
580cdf0e10cSrcweir Sequence< OUString > aNodes( ((SmMathConfig*) this)->GetNodeNames( A2OU( SYMBOL_LIST ) ) );
581cdf0e10cSrcweir const OUString *pNode = aNodes.getConstArray();
582cdf0e10cSrcweir sal_Int32 nNodes = aNodes.getLength();
583cdf0e10cSrcweir
584cdf0e10cSrcweir rSymbols.resize( nNodes );
585cdf0e10cSrcweir std::vector< SmSym >::iterator aIt( rSymbols.begin() );
586cdf0e10cSrcweir std::vector< SmSym >::iterator aEnd( rSymbols.end() );
587cdf0e10cSrcweir while (aIt != aEnd)
588cdf0e10cSrcweir {
589cdf0e10cSrcweir ReadSymbol( *aIt++, *pNode++, A2OU( SYMBOL_LIST ) );
590cdf0e10cSrcweir }
591cdf0e10cSrcweir }
592cdf0e10cSrcweir
593cdf0e10cSrcweir
SetSymbols(const std::vector<SmSym> & rNewSymbols)594cdf0e10cSrcweir void SmMathConfig::SetSymbols( const std::vector< SmSym > &rNewSymbols )
595cdf0e10cSrcweir {
596cdf0e10cSrcweir sal_uIntPtr nCount = rNewSymbols.size();
597cdf0e10cSrcweir
598cdf0e10cSrcweir Sequence< OUString > aNames = lcl_GetSymbolPropertyNames();
599cdf0e10cSrcweir const OUString *pNames = aNames.getConstArray();
600cdf0e10cSrcweir sal_uIntPtr nSymbolProps = sal::static_int_cast< sal_uInt32 >(aNames.getLength());
601cdf0e10cSrcweir
602cdf0e10cSrcweir Sequence< PropertyValue > aValues( nCount * nSymbolProps );
603cdf0e10cSrcweir PropertyValue *pValues = aValues.getArray();
604cdf0e10cSrcweir
605cdf0e10cSrcweir PropertyValue *pVal = pValues;
606cdf0e10cSrcweir OUString aDelim( OUString::valueOf( (sal_Unicode) '/' ) );
607cdf0e10cSrcweir std::vector< SmSym >::const_iterator aIt( rNewSymbols.begin() );
608cdf0e10cSrcweir std::vector< SmSym >::const_iterator aEnd( rNewSymbols.end() );
609cdf0e10cSrcweir while (aIt != aEnd)
610cdf0e10cSrcweir {
611cdf0e10cSrcweir const SmSym &rSymbol = *aIt++;
612cdf0e10cSrcweir //const Font &rFont = rSymbol.GetFace();
613cdf0e10cSrcweir OUString aNodeNameDelim( A2OU( SYMBOL_LIST ) );
614cdf0e10cSrcweir aNodeNameDelim += aDelim;
615cdf0e10cSrcweir aNodeNameDelim += rSymbol.GetExportName();
616cdf0e10cSrcweir aNodeNameDelim += aDelim;
617cdf0e10cSrcweir
618cdf0e10cSrcweir const OUString *pName = pNames;
619cdf0e10cSrcweir
620cdf0e10cSrcweir // Char
621cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
622cdf0e10cSrcweir pVal->Name += *pName++;
623cdf0e10cSrcweir pVal->Value <<= static_cast< sal_UCS4 >( rSymbol.GetCharacter() );
624cdf0e10cSrcweir pVal++;
625cdf0e10cSrcweir // Set
626cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
627cdf0e10cSrcweir pVal->Name += *pName++;
628cdf0e10cSrcweir OUString aTmp( rSymbol.GetSymbolSetName() );
629cdf0e10cSrcweir if (rSymbol.IsPredefined())
630cdf0e10cSrcweir aTmp = GetExportSymbolSetName( aTmp );
631cdf0e10cSrcweir pVal->Value <<= aTmp;
632cdf0e10cSrcweir pVal++;
633cdf0e10cSrcweir // Predefined
634cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
635cdf0e10cSrcweir pVal->Name += *pName++;
636cdf0e10cSrcweir pVal->Value <<= (sal_Bool) rSymbol.IsPredefined();
637cdf0e10cSrcweir pVal++;
638cdf0e10cSrcweir // FontFormatId
639cdf0e10cSrcweir SmFontFormat aFntFmt( rSymbol.GetFace() );
640cdf0e10cSrcweir String aFntFmtId( GetFontFormatList().GetFontFormatId( aFntFmt, sal_True ) );
641cdf0e10cSrcweir DBG_ASSERT( aFntFmtId.Len(), "FontFormatId not found" );
642cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
643cdf0e10cSrcweir pVal->Name += *pName++;
644cdf0e10cSrcweir pVal->Value <<= OUString( aFntFmtId );
645cdf0e10cSrcweir pVal++;
646cdf0e10cSrcweir }
647cdf0e10cSrcweir DBG_ASSERT( pVal - pValues == sal::static_int_cast< ptrdiff_t >(nCount * nSymbolProps), "properties missing" );
648cdf0e10cSrcweir ReplaceSetProperties( A2OU( SYMBOL_LIST ) , aValues );
649cdf0e10cSrcweir
650cdf0e10cSrcweir StripFontFormatList( rNewSymbols );
651cdf0e10cSrcweir SaveFontFormatList();
652cdf0e10cSrcweir }
653cdf0e10cSrcweir
654cdf0e10cSrcweir
GetFontFormatList()655cdf0e10cSrcweir SmFontFormatList & SmMathConfig::GetFontFormatList()
656cdf0e10cSrcweir {
657cdf0e10cSrcweir if (!pFontFormatList)
658cdf0e10cSrcweir {
659cdf0e10cSrcweir LoadFontFormatList();
660cdf0e10cSrcweir }
661cdf0e10cSrcweir return *pFontFormatList;
662cdf0e10cSrcweir }
663cdf0e10cSrcweir
664cdf0e10cSrcweir
LoadFontFormatList()665cdf0e10cSrcweir void SmMathConfig::LoadFontFormatList()
666cdf0e10cSrcweir {
667cdf0e10cSrcweir if (!pFontFormatList)
668cdf0e10cSrcweir pFontFormatList = new SmFontFormatList;
669cdf0e10cSrcweir else
670cdf0e10cSrcweir pFontFormatList->Clear();
671cdf0e10cSrcweir
672cdf0e10cSrcweir Sequence< OUString > aNodes( GetNodeNames( A2OU( FONT_FORMAT_LIST ) ) );
673cdf0e10cSrcweir const OUString *pNode = aNodes.getConstArray();
674cdf0e10cSrcweir sal_Int32 nNodes = aNodes.getLength();
675cdf0e10cSrcweir
676cdf0e10cSrcweir for (sal_Int32 i = 0; i < nNodes; ++i)
677cdf0e10cSrcweir {
678cdf0e10cSrcweir SmFontFormat aFntFmt;
679cdf0e10cSrcweir ReadFontFormat( aFntFmt, pNode[i], A2OU( FONT_FORMAT_LIST ) );
680cdf0e10cSrcweir if (!pFontFormatList->GetFontFormat( pNode[i] ))
681cdf0e10cSrcweir {
682cdf0e10cSrcweir DBG_ASSERT( 0 == pFontFormatList->GetFontFormat( pNode[i] ),
683cdf0e10cSrcweir "FontFormat ID already exists" );
684cdf0e10cSrcweir pFontFormatList->AddFontFormat( pNode[i], aFntFmt );
685cdf0e10cSrcweir }
686cdf0e10cSrcweir }
687cdf0e10cSrcweir pFontFormatList->SetModified( sal_False );
688cdf0e10cSrcweir }
689cdf0e10cSrcweir
690cdf0e10cSrcweir
ReadFontFormat(SmFontFormat & rFontFormat,const OUString & rSymbolName,const OUString & rBaseNode) const691cdf0e10cSrcweir void SmMathConfig::ReadFontFormat( SmFontFormat &rFontFormat,
692cdf0e10cSrcweir const OUString &rSymbolName, const OUString &rBaseNode ) const
693cdf0e10cSrcweir {
694cdf0e10cSrcweir Sequence< OUString > aNames = lcl_GetFontPropertyNames();
695cdf0e10cSrcweir sal_Int32 nProps = aNames.getLength();
696cdf0e10cSrcweir
697cdf0e10cSrcweir OUString aDelim( OUString::valueOf( (sal_Unicode) '/' ) );
698cdf0e10cSrcweir OUString *pName = aNames.getArray();
699cdf0e10cSrcweir for (sal_Int32 i = 0; i < nProps; ++i)
700cdf0e10cSrcweir {
701cdf0e10cSrcweir OUString &rName = pName[i];
702cdf0e10cSrcweir OUString aTmp( rName );
703cdf0e10cSrcweir rName = rBaseNode;
704cdf0e10cSrcweir rName += aDelim;
705cdf0e10cSrcweir rName += rSymbolName;
706cdf0e10cSrcweir rName += aDelim;
707cdf0e10cSrcweir rName += aTmp;
708cdf0e10cSrcweir }
709cdf0e10cSrcweir
710cdf0e10cSrcweir const Sequence< Any > aValues = ((SmMathConfig*) this)->GetProperties( aNames );
711cdf0e10cSrcweir
712cdf0e10cSrcweir if (nProps && aValues.getLength() == nProps)
713cdf0e10cSrcweir {
714cdf0e10cSrcweir const Any * pValue = aValues.getConstArray();
715cdf0e10cSrcweir
716cdf0e10cSrcweir OUString aTmpStr;
717cdf0e10cSrcweir sal_Int16 nTmp16 = 0;
718cdf0e10cSrcweir
719cdf0e10cSrcweir sal_Bool bOK = sal_True;
720cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= aTmpStr))
721cdf0e10cSrcweir rFontFormat.aName = aTmpStr;
722cdf0e10cSrcweir else
723cdf0e10cSrcweir bOK = sal_False;
724cdf0e10cSrcweir ++pValue;
725cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= nTmp16))
726cdf0e10cSrcweir rFontFormat.nCharSet = nTmp16; // 6.0 file-format GetSOLoadTextEncoding not needed
727cdf0e10cSrcweir else
728cdf0e10cSrcweir bOK = sal_False;
729cdf0e10cSrcweir ++pValue;
730cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= nTmp16))
731cdf0e10cSrcweir rFontFormat.nFamily = nTmp16;
732cdf0e10cSrcweir else
733cdf0e10cSrcweir bOK = sal_False;
734cdf0e10cSrcweir ++pValue;
735cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= nTmp16))
736cdf0e10cSrcweir rFontFormat.nPitch = nTmp16;
737cdf0e10cSrcweir else
738cdf0e10cSrcweir bOK = sal_False;
739cdf0e10cSrcweir ++pValue;
740cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= nTmp16))
741cdf0e10cSrcweir rFontFormat.nWeight = nTmp16;
742cdf0e10cSrcweir else
743cdf0e10cSrcweir bOK = sal_False;
744cdf0e10cSrcweir ++pValue;
745cdf0e10cSrcweir if (pValue->hasValue() && (*pValue >>= nTmp16))
746cdf0e10cSrcweir rFontFormat.nItalic = nTmp16;
747cdf0e10cSrcweir else
748cdf0e10cSrcweir bOK = sal_False;
749cdf0e10cSrcweir ++pValue;
750cdf0e10cSrcweir
751cdf0e10cSrcweir DBG_ASSERT( bOK, "read FontFormat failed" );
752cdf0e10cSrcweir }
753cdf0e10cSrcweir }
754cdf0e10cSrcweir
755cdf0e10cSrcweir
SaveFontFormatList()756cdf0e10cSrcweir void SmMathConfig::SaveFontFormatList()
757cdf0e10cSrcweir {
758cdf0e10cSrcweir SmFontFormatList &rFntFmtList = GetFontFormatList();
759cdf0e10cSrcweir
760cdf0e10cSrcweir if (!rFntFmtList.IsModified())
761cdf0e10cSrcweir return;
762cdf0e10cSrcweir
763cdf0e10cSrcweir Sequence< OUString > aNames = lcl_GetFontPropertyNames();
764cdf0e10cSrcweir sal_Int32 nSymbolProps = aNames.getLength();
765cdf0e10cSrcweir
766cdf0e10cSrcweir size_t nCount = rFntFmtList.GetCount();
767cdf0e10cSrcweir
768cdf0e10cSrcweir Sequence< PropertyValue > aValues( nCount * nSymbolProps );
769cdf0e10cSrcweir PropertyValue *pValues = aValues.getArray();
770cdf0e10cSrcweir
771cdf0e10cSrcweir PropertyValue *pVal = pValues;
772cdf0e10cSrcweir OUString aDelim( OUString::valueOf( (sal_Unicode) '/' ) );
773cdf0e10cSrcweir for (size_t i = 0; i < nCount; ++i)
774cdf0e10cSrcweir {
775cdf0e10cSrcweir String aFntFmtId( rFntFmtList.GetFontFormatId( i ) );
776cdf0e10cSrcweir const SmFontFormat aFntFmt( *rFntFmtList.GetFontFormat( aFntFmtId ) );
777cdf0e10cSrcweir
778cdf0e10cSrcweir OUString aNodeNameDelim( A2OU( FONT_FORMAT_LIST ) );
779cdf0e10cSrcweir aNodeNameDelim += aDelim;
780cdf0e10cSrcweir aNodeNameDelim += aFntFmtId;
781cdf0e10cSrcweir aNodeNameDelim += aDelim;
782cdf0e10cSrcweir
783cdf0e10cSrcweir const OUString *pName = aNames.getConstArray();;
784cdf0e10cSrcweir
785cdf0e10cSrcweir // Name
786cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
787cdf0e10cSrcweir pVal->Name += *pName++;
788cdf0e10cSrcweir pVal->Value <<= OUString( aFntFmt.aName );
789cdf0e10cSrcweir pVal++;
790cdf0e10cSrcweir // CharSet
791cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
792cdf0e10cSrcweir pVal->Name += *pName++;
793cdf0e10cSrcweir pVal->Value <<= (sal_Int16) aFntFmt.nCharSet; // 6.0 file-format GetSOStoreTextEncoding not needed
794cdf0e10cSrcweir pVal++;
795cdf0e10cSrcweir // Family
796cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
797cdf0e10cSrcweir pVal->Name += *pName++;
798cdf0e10cSrcweir pVal->Value <<= (sal_Int16) aFntFmt.nFamily;
799cdf0e10cSrcweir pVal++;
800cdf0e10cSrcweir // Pitch
801cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
802cdf0e10cSrcweir pVal->Name += *pName++;
803cdf0e10cSrcweir pVal->Value <<= (sal_Int16) aFntFmt.nPitch;
804cdf0e10cSrcweir pVal++;
805cdf0e10cSrcweir // Weight
806cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
807cdf0e10cSrcweir pVal->Name += *pName++;
808cdf0e10cSrcweir pVal->Value <<= (sal_Int16) aFntFmt.nWeight;
809cdf0e10cSrcweir pVal++;
810cdf0e10cSrcweir // Italic
811cdf0e10cSrcweir pVal->Name = aNodeNameDelim;
812cdf0e10cSrcweir pVal->Name += *pName++;
813cdf0e10cSrcweir pVal->Value <<= (sal_Int16) aFntFmt.nItalic;
814cdf0e10cSrcweir pVal++;
815cdf0e10cSrcweir }
816cdf0e10cSrcweir DBG_ASSERT( static_cast<size_t>(pVal - pValues) == (nCount * nSymbolProps),
817cdf0e10cSrcweir "properties missing" );
818cdf0e10cSrcweir ReplaceSetProperties( A2OU( FONT_FORMAT_LIST ) , aValues );
819cdf0e10cSrcweir
820cdf0e10cSrcweir rFntFmtList.SetModified( sal_False );
821cdf0e10cSrcweir }
822cdf0e10cSrcweir
823cdf0e10cSrcweir
StripFontFormatList(const std::vector<SmSym> & rSymbols)824cdf0e10cSrcweir void SmMathConfig::StripFontFormatList( const std::vector< SmSym > &rSymbols )
825cdf0e10cSrcweir {
826cdf0e10cSrcweir size_t i;
827cdf0e10cSrcweir
828cdf0e10cSrcweir // build list of used font-formats only
829cdf0e10cSrcweir //!! font-format IDs may be different !!
830cdf0e10cSrcweir SmFontFormatList aUsedList;
831cdf0e10cSrcweir for (i = 0; i < rSymbols.size(); ++i)
832cdf0e10cSrcweir {
833cdf0e10cSrcweir DBG_ASSERT( rSymbols[i].GetName().Len() > 0, "non named symbol" );
834cdf0e10cSrcweir aUsedList.GetFontFormatId( SmFontFormat( rSymbols[i].GetFace() ) , sal_True );
835cdf0e10cSrcweir }
836cdf0e10cSrcweir const SmFormat & rStdFmt = GetStandardFormat();
837cdf0e10cSrcweir for (i = FNT_BEGIN; i <= FNT_END; ++i)
838cdf0e10cSrcweir {
839cdf0e10cSrcweir aUsedList.GetFontFormatId( SmFontFormat( rStdFmt.GetFont( i ) ) , sal_True );
840cdf0e10cSrcweir }
841cdf0e10cSrcweir
842cdf0e10cSrcweir // remove unused font-formats from list
843cdf0e10cSrcweir SmFontFormatList &rFntFmtList = GetFontFormatList();
844cdf0e10cSrcweir size_t nCnt = rFntFmtList.GetCount();
845cdf0e10cSrcweir SmFontFormat *pTmpFormat = new SmFontFormat[ nCnt ];
846cdf0e10cSrcweir String *pId = new String [ nCnt ];
847cdf0e10cSrcweir size_t k;
848cdf0e10cSrcweir for (k = 0; k < nCnt; ++k)
849cdf0e10cSrcweir {
850cdf0e10cSrcweir pTmpFormat[k] = *rFntFmtList.GetFontFormat( k );
851cdf0e10cSrcweir pId[k] = rFntFmtList.GetFontFormatId( k );
852cdf0e10cSrcweir }
853cdf0e10cSrcweir for (k = 0; k < nCnt; ++k)
854cdf0e10cSrcweir {
855cdf0e10cSrcweir if (0 == aUsedList.GetFontFormatId( pTmpFormat[k] ).Len())
856cdf0e10cSrcweir {
857cdf0e10cSrcweir rFntFmtList.RemoveFontFormat( pId[k] );
858cdf0e10cSrcweir }
859cdf0e10cSrcweir }
860cdf0e10cSrcweir delete [] pId;
861cdf0e10cSrcweir delete [] pTmpFormat;
862cdf0e10cSrcweir }
863cdf0e10cSrcweir
864cdf0e10cSrcweir
LoadOther()865cdf0e10cSrcweir void SmMathConfig::LoadOther()
866cdf0e10cSrcweir {
867cdf0e10cSrcweir if (!pOther)
868cdf0e10cSrcweir pOther = new SmCfgOther;
869cdf0e10cSrcweir
870cdf0e10cSrcweir Sequence< OUString > aNames( GetOtherPropertyNames() );
871cdf0e10cSrcweir sal_Int32 nProps = aNames.getLength();
872cdf0e10cSrcweir
873cdf0e10cSrcweir Sequence< Any > aValues( GetProperties( aNames ) );
874cdf0e10cSrcweir if (nProps && aValues.getLength() == nProps)
875cdf0e10cSrcweir {
876cdf0e10cSrcweir const Any *pValues = aValues.getConstArray();
877cdf0e10cSrcweir const Any *pVal = pValues;
878cdf0e10cSrcweir
879cdf0e10cSrcweir sal_Int16 nTmp16 = 0;
880cdf0e10cSrcweir sal_Bool bTmp = sal_False;
881cdf0e10cSrcweir
882cdf0e10cSrcweir // Print/Title
883cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
884cdf0e10cSrcweir pOther->bPrintTitle = bTmp;
885cdf0e10cSrcweir ++pVal;
886cdf0e10cSrcweir // Print/FormulaText
887cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
888cdf0e10cSrcweir pOther->bPrintFormulaText = bTmp;
889cdf0e10cSrcweir ++pVal;
890cdf0e10cSrcweir // Print/Frame
891cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
892cdf0e10cSrcweir pOther->bPrintFrame = bTmp;
893cdf0e10cSrcweir ++pVal;
894cdf0e10cSrcweir // Print/Size
895cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= nTmp16))
896cdf0e10cSrcweir pOther->ePrintSize = (SmPrintSize) nTmp16;
897cdf0e10cSrcweir ++pVal;
898cdf0e10cSrcweir // Print/ZoomFactor
899cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= nTmp16))
900cdf0e10cSrcweir pOther->nPrintZoomFactor = nTmp16;
901cdf0e10cSrcweir ++pVal;
902cdf0e10cSrcweir // LoadSave/IsSaveOnlyUsedSymbols
903cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
904cdf0e10cSrcweir pOther->bIsSaveOnlyUsedSymbols = bTmp;
905cdf0e10cSrcweir /* ++pVal;
906cdf0e10cSrcweir // Misc/NoSymbolsWarning
907cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
908cdf0e10cSrcweir pOther->bNoSymbolsWarning = bTmp;
909cdf0e10cSrcweir */
910cdf0e10cSrcweir ++pVal;
911cdf0e10cSrcweir // Misc/IgnoreSpacesRight
912cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
913cdf0e10cSrcweir pOther->bIgnoreSpacesRight = bTmp;
914cdf0e10cSrcweir ++pVal;
915cdf0e10cSrcweir // View/ToolboxVisible
916cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
917cdf0e10cSrcweir pOther->bToolboxVisible = bTmp;
918cdf0e10cSrcweir ++pVal;
919cdf0e10cSrcweir // View/AutoRedraw
920cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
921cdf0e10cSrcweir pOther->bAutoRedraw = bTmp;
922cdf0e10cSrcweir ++pVal;
923cdf0e10cSrcweir // View/FormulaCursor
924cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
925cdf0e10cSrcweir pOther->bFormulaCursor = bTmp;
926cdf0e10cSrcweir ++pVal;
927cdf0e10cSrcweir
928cdf0e10cSrcweir DBG_ASSERT( pVal - pValues == nProps, "property mismatch" );
929cdf0e10cSrcweir SetOtherModified( sal_False );
930cdf0e10cSrcweir }
931cdf0e10cSrcweir }
932cdf0e10cSrcweir
933cdf0e10cSrcweir
SaveOther()934cdf0e10cSrcweir void SmMathConfig::SaveOther()
935cdf0e10cSrcweir {
936cdf0e10cSrcweir if (!pOther || !IsOtherModified())
937cdf0e10cSrcweir return;
938cdf0e10cSrcweir
939cdf0e10cSrcweir const Sequence< OUString > aNames( GetOtherPropertyNames() );
940cdf0e10cSrcweir sal_Int32 nProps = aNames.getLength();
941cdf0e10cSrcweir
942cdf0e10cSrcweir Sequence< Any > aValues( nProps );
943cdf0e10cSrcweir Any *pValues = aValues.getArray();
944cdf0e10cSrcweir Any *pValue = pValues;
945cdf0e10cSrcweir
946cdf0e10cSrcweir // Print/Title
947cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bPrintTitle;
948cdf0e10cSrcweir // Print/FormulaText
949cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bPrintFormulaText;
950cdf0e10cSrcweir // Print/Frame
951cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bPrintFrame;
952cdf0e10cSrcweir // Print/Size
953cdf0e10cSrcweir *pValue++ <<= (sal_Int16) pOther->ePrintSize;
954cdf0e10cSrcweir // Print/ZoomFactor
955cdf0e10cSrcweir *pValue++ <<= (sal_Int16) pOther->nPrintZoomFactor;
956cdf0e10cSrcweir // LoadSave/IsSaveOnlyUsedSymbols
957cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bIsSaveOnlyUsedSymbols;
958cdf0e10cSrcweir /* // Misc/NoSymbolsWarning
959cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bNoSymbolsWarning;
960cdf0e10cSrcweir */
961cdf0e10cSrcweir // Misc/IgnoreSpacesRight
962cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bIgnoreSpacesRight;
963cdf0e10cSrcweir // View/ToolboxVisible
964cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bToolboxVisible;
965cdf0e10cSrcweir // View/AutoRedraw
966cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bAutoRedraw;
967cdf0e10cSrcweir // View/FormulaCursor
968cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pOther->bFormulaCursor;
969cdf0e10cSrcweir
970cdf0e10cSrcweir DBG_ASSERT( pValue - pValues == nProps, "property mismatch" );
971cdf0e10cSrcweir PutProperties( aNames , aValues );
972cdf0e10cSrcweir
973cdf0e10cSrcweir SetOtherModified( sal_False );
974cdf0e10cSrcweir }
975cdf0e10cSrcweir
LoadFormat()976cdf0e10cSrcweir void SmMathConfig::LoadFormat()
977cdf0e10cSrcweir {
978cdf0e10cSrcweir if (!pFormat)
979cdf0e10cSrcweir pFormat = new SmFormat;
980cdf0e10cSrcweir
981cdf0e10cSrcweir
982cdf0e10cSrcweir Sequence< OUString > aNames( GetFormatPropertyNames() );
983cdf0e10cSrcweir sal_Int32 nProps = aNames.getLength();
984cdf0e10cSrcweir
985cdf0e10cSrcweir Sequence< Any > aValues( GetProperties( aNames ) );
986cdf0e10cSrcweir if (nProps && aValues.getLength() == nProps)
987cdf0e10cSrcweir {
988cdf0e10cSrcweir const Any *pValues = aValues.getConstArray();
989cdf0e10cSrcweir const Any *pVal = pValues;
990cdf0e10cSrcweir
991cdf0e10cSrcweir OUString aTmpStr;
992cdf0e10cSrcweir sal_Int16 nTmp16 = 0;
993cdf0e10cSrcweir sal_Bool bTmp = sal_False;
994cdf0e10cSrcweir
995cdf0e10cSrcweir // StandardFormat/Textmode
996cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
997cdf0e10cSrcweir pFormat->SetTextmode( bTmp );
998cdf0e10cSrcweir ++pVal;
999cdf0e10cSrcweir // StandardFormat/GreekCharStyle
1000cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= nTmp16))
1001cdf0e10cSrcweir pFormat->SetGreekCharStyle( nTmp16 );
1002cdf0e10cSrcweir ++pVal;
1003cdf0e10cSrcweir // StandardFormat/ScaleNormalBracket
1004cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= bTmp))
1005cdf0e10cSrcweir pFormat->SetScaleNormalBrackets( bTmp );
1006cdf0e10cSrcweir ++pVal;
1007cdf0e10cSrcweir // StandardFormat/HorizontalAlignment
1008cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= nTmp16))
1009cdf0e10cSrcweir pFormat->SetHorAlign( (SmHorAlign) nTmp16 );
1010cdf0e10cSrcweir ++pVal;
1011cdf0e10cSrcweir // StandardFormat/BaseSize
1012cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= nTmp16))
1013cdf0e10cSrcweir pFormat->SetBaseSize( Size(0, SmPtsTo100th_mm( nTmp16 )) );
1014cdf0e10cSrcweir ++pVal;
1015cdf0e10cSrcweir
1016cdf0e10cSrcweir sal_uInt16 i;
1017cdf0e10cSrcweir for (i = SIZ_BEGIN; i <= SIZ_END; ++i)
1018cdf0e10cSrcweir {
1019cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= nTmp16))
1020cdf0e10cSrcweir pFormat->SetRelSize( i, nTmp16 );
1021cdf0e10cSrcweir ++pVal;
1022cdf0e10cSrcweir }
1023cdf0e10cSrcweir
1024cdf0e10cSrcweir for (i = DIS_BEGIN; i <= DIS_END; ++i)
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= nTmp16))
1027cdf0e10cSrcweir pFormat->SetDistance( i, nTmp16 );
1028cdf0e10cSrcweir ++pVal;
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir
1031cdf0e10cSrcweir LanguageType nLang = Application::GetSettings().GetUILanguage();
1032cdf0e10cSrcweir for (i = FNT_BEGIN; i < FNT_END; ++i)
1033cdf0e10cSrcweir {
1034cdf0e10cSrcweir Font aFnt;
1035cdf0e10cSrcweir sal_Bool bUseDefaultFont = sal_True;
1036cdf0e10cSrcweir if (pVal->hasValue() && (*pVal >>= aTmpStr))
1037cdf0e10cSrcweir {
1038cdf0e10cSrcweir bUseDefaultFont = 0 == aTmpStr.getLength();
1039cdf0e10cSrcweir if (bUseDefaultFont)
1040cdf0e10cSrcweir {
1041cdf0e10cSrcweir aFnt = pFormat->GetFont( i );
1042cdf0e10cSrcweir aFnt.SetName( GetDefaultFontName( nLang, i ) );
1043cdf0e10cSrcweir }
1044cdf0e10cSrcweir else
1045cdf0e10cSrcweir {
1046cdf0e10cSrcweir const SmFontFormat *pFntFmt = GetFontFormatList().GetFontFormat( aTmpStr );
1047cdf0e10cSrcweir DBG_ASSERT( pFntFmt, "unknown FontFormat" );
1048cdf0e10cSrcweir if (pFntFmt)
1049cdf0e10cSrcweir aFnt = pFntFmt->GetFont();
1050cdf0e10cSrcweir }
1051cdf0e10cSrcweir }
1052cdf0e10cSrcweir ++pVal;
1053cdf0e10cSrcweir
1054cdf0e10cSrcweir aFnt.SetSize( pFormat->GetBaseSize() );
1055cdf0e10cSrcweir pFormat->SetFont( i, aFnt, bUseDefaultFont );
1056cdf0e10cSrcweir }
1057cdf0e10cSrcweir
1058cdf0e10cSrcweir DBG_ASSERT( pVal - pValues == nProps, "property mismatch" );
1059cdf0e10cSrcweir SetFormatModified( sal_False );
1060cdf0e10cSrcweir }
1061cdf0e10cSrcweir }
1062cdf0e10cSrcweir
1063cdf0e10cSrcweir
SaveFormat()1064cdf0e10cSrcweir void SmMathConfig::SaveFormat()
1065cdf0e10cSrcweir {
1066cdf0e10cSrcweir if (!pFormat || !IsFormatModified())
1067cdf0e10cSrcweir return;
1068cdf0e10cSrcweir
1069cdf0e10cSrcweir const Sequence< OUString > aNames( GetFormatPropertyNames() );
1070cdf0e10cSrcweir sal_Int32 nProps = aNames.getLength();
1071cdf0e10cSrcweir
1072cdf0e10cSrcweir Sequence< Any > aValues( nProps );
1073cdf0e10cSrcweir Any *pValues = aValues.getArray();
1074cdf0e10cSrcweir Any *pValue = pValues;
1075cdf0e10cSrcweir
1076cdf0e10cSrcweir // StandardFormat/Textmode
1077cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pFormat->IsTextmode();
1078cdf0e10cSrcweir // StandardFormat/GreekCharStyle
1079cdf0e10cSrcweir *pValue++ <<= (sal_Int16) pFormat->GetGreekCharStyle();
1080cdf0e10cSrcweir // StandardFormat/ScaleNormalBracket
1081cdf0e10cSrcweir *pValue++ <<= (sal_Bool) pFormat->IsScaleNormalBrackets();
1082cdf0e10cSrcweir // StandardFormat/HorizontalAlignment
1083cdf0e10cSrcweir *pValue++ <<= (sal_Int16) pFormat->GetHorAlign();
1084cdf0e10cSrcweir // StandardFormat/BaseSize
1085cdf0e10cSrcweir *pValue++ <<= (sal_Int16) SmRoundFraction( Sm100th_mmToPts(
1086cdf0e10cSrcweir pFormat->GetBaseSize().Height() ) );
1087cdf0e10cSrcweir
1088cdf0e10cSrcweir sal_uInt16 i;
1089cdf0e10cSrcweir for (i = SIZ_BEGIN; i <= SIZ_END; ++i)
1090cdf0e10cSrcweir *pValue++ <<= (sal_Int16) pFormat->GetRelSize( i );
1091cdf0e10cSrcweir
1092cdf0e10cSrcweir for (i = DIS_BEGIN; i <= DIS_END; ++i)
1093cdf0e10cSrcweir *pValue++ <<= (sal_Int16) pFormat->GetDistance( i );
1094cdf0e10cSrcweir
1095cdf0e10cSrcweir for (i = FNT_BEGIN; i < FNT_END; ++i)
1096cdf0e10cSrcweir {
1097cdf0e10cSrcweir OUString aFntFmtId;
1098cdf0e10cSrcweir
1099cdf0e10cSrcweir if (!pFormat->IsDefaultFont( i ))
1100cdf0e10cSrcweir {
1101cdf0e10cSrcweir SmFontFormat aFntFmt( pFormat->GetFont( i ) );
1102cdf0e10cSrcweir aFntFmtId = GetFontFormatList().GetFontFormatId( aFntFmt, sal_True );
1103cdf0e10cSrcweir DBG_ASSERT( aFntFmtId.getLength(), "FontFormatId not found" );
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir
1106cdf0e10cSrcweir *pValue++ <<= aFntFmtId;
1107cdf0e10cSrcweir }
1108cdf0e10cSrcweir
1109cdf0e10cSrcweir DBG_ASSERT( pValue - pValues == nProps, "property mismatch" );
1110cdf0e10cSrcweir PutProperties( aNames , aValues );
1111cdf0e10cSrcweir
1112cdf0e10cSrcweir SetFormatModified( sal_False );
1113cdf0e10cSrcweir }
1114cdf0e10cSrcweir
1115cdf0e10cSrcweir
GetStandardFormat() const1116cdf0e10cSrcweir const SmFormat & SmMathConfig::GetStandardFormat() const
1117cdf0e10cSrcweir {
1118cdf0e10cSrcweir if (!pFormat)
1119cdf0e10cSrcweir ((SmMathConfig *) this)->LoadFormat();
1120cdf0e10cSrcweir return *pFormat;
1121cdf0e10cSrcweir }
1122cdf0e10cSrcweir
1123cdf0e10cSrcweir
SetStandardFormat(const SmFormat & rFormat,sal_Bool bSaveFontFormatList)1124cdf0e10cSrcweir void SmMathConfig::SetStandardFormat( const SmFormat &rFormat, sal_Bool bSaveFontFormatList )
1125cdf0e10cSrcweir {
1126cdf0e10cSrcweir if (!pFormat)
1127cdf0e10cSrcweir LoadFormat();
1128cdf0e10cSrcweir if (rFormat != *pFormat)
1129cdf0e10cSrcweir {
1130cdf0e10cSrcweir *pFormat = rFormat;
1131cdf0e10cSrcweir SetFormatModified( sal_True );
1132cdf0e10cSrcweir SaveFormat();
1133cdf0e10cSrcweir
1134cdf0e10cSrcweir if (bSaveFontFormatList)
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir // needed for SmFontTypeDialog's DefaultButtonClickHdl
1137cdf0e10cSrcweir SetFontFormatListModified( sal_True );
1138cdf0e10cSrcweir SaveFontFormatList();
1139cdf0e10cSrcweir }
1140cdf0e10cSrcweir }
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir
1143cdf0e10cSrcweir
GetPrintSize() const1144cdf0e10cSrcweir SmPrintSize SmMathConfig::GetPrintSize() const
1145cdf0e10cSrcweir {
1146cdf0e10cSrcweir if (!pOther)
1147cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1148cdf0e10cSrcweir return pOther->ePrintSize;
1149cdf0e10cSrcweir }
1150cdf0e10cSrcweir
1151cdf0e10cSrcweir
SetPrintSize(SmPrintSize eSize)1152cdf0e10cSrcweir void SmMathConfig::SetPrintSize( SmPrintSize eSize )
1153cdf0e10cSrcweir {
1154cdf0e10cSrcweir if (!pOther)
1155cdf0e10cSrcweir LoadOther();
1156cdf0e10cSrcweir if (eSize != pOther->ePrintSize)
1157cdf0e10cSrcweir {
1158cdf0e10cSrcweir pOther->ePrintSize = eSize;
1159cdf0e10cSrcweir SetOtherModified( sal_True );
1160cdf0e10cSrcweir }
1161cdf0e10cSrcweir }
1162cdf0e10cSrcweir
1163cdf0e10cSrcweir
GetPrintZoomFactor() const1164cdf0e10cSrcweir sal_uInt16 SmMathConfig::GetPrintZoomFactor() const
1165cdf0e10cSrcweir {
1166cdf0e10cSrcweir if (!pOther)
1167cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1168cdf0e10cSrcweir return pOther->nPrintZoomFactor;
1169cdf0e10cSrcweir }
1170cdf0e10cSrcweir
1171cdf0e10cSrcweir
SetPrintZoomFactor(sal_uInt16 nVal)1172cdf0e10cSrcweir void SmMathConfig::SetPrintZoomFactor( sal_uInt16 nVal )
1173cdf0e10cSrcweir {
1174cdf0e10cSrcweir if (!pOther)
1175cdf0e10cSrcweir LoadOther();
1176cdf0e10cSrcweir if (nVal != pOther->nPrintZoomFactor)
1177cdf0e10cSrcweir {
1178cdf0e10cSrcweir pOther->nPrintZoomFactor = nVal;
1179cdf0e10cSrcweir SetOtherModified( sal_True );
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir
1183cdf0e10cSrcweir
SetOtherIfNotEqual(sal_Bool & rbItem,sal_Bool bNewVal)1184cdf0e10cSrcweir void SmMathConfig::SetOtherIfNotEqual( sal_Bool &rbItem, sal_Bool bNewVal )
1185cdf0e10cSrcweir {
1186cdf0e10cSrcweir if (bNewVal != rbItem)
1187cdf0e10cSrcweir {
1188cdf0e10cSrcweir rbItem = bNewVal;
1189cdf0e10cSrcweir SetOtherModified( sal_True );
1190cdf0e10cSrcweir }
1191cdf0e10cSrcweir }
1192cdf0e10cSrcweir
1193cdf0e10cSrcweir
IsPrintTitle() const1194cdf0e10cSrcweir sal_Bool SmMathConfig::IsPrintTitle() const
1195cdf0e10cSrcweir {
1196cdf0e10cSrcweir if (!pOther)
1197cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1198cdf0e10cSrcweir return pOther->bPrintTitle;
1199cdf0e10cSrcweir }
1200cdf0e10cSrcweir
1201cdf0e10cSrcweir
SetPrintTitle(sal_Bool bVal)1202cdf0e10cSrcweir void SmMathConfig::SetPrintTitle( sal_Bool bVal )
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir if (!pOther)
1205cdf0e10cSrcweir LoadOther();
1206cdf0e10cSrcweir SetOtherIfNotEqual( pOther->bPrintTitle, bVal );
1207cdf0e10cSrcweir }
1208cdf0e10cSrcweir
1209cdf0e10cSrcweir
IsPrintFormulaText() const1210cdf0e10cSrcweir sal_Bool SmMathConfig::IsPrintFormulaText() const
1211cdf0e10cSrcweir {
1212cdf0e10cSrcweir if (!pOther)
1213cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1214cdf0e10cSrcweir return pOther->bPrintFormulaText;
1215cdf0e10cSrcweir }
1216cdf0e10cSrcweir
1217cdf0e10cSrcweir
SetPrintFormulaText(sal_Bool bVal)1218cdf0e10cSrcweir void SmMathConfig::SetPrintFormulaText( sal_Bool bVal )
1219cdf0e10cSrcweir {
1220cdf0e10cSrcweir if (!pOther)
1221cdf0e10cSrcweir LoadOther();
1222cdf0e10cSrcweir SetOtherIfNotEqual( pOther->bPrintFormulaText, bVal );
1223cdf0e10cSrcweir }
1224cdf0e10cSrcweir
1225cdf0e10cSrcweir
IsPrintFrame() const1226cdf0e10cSrcweir sal_Bool SmMathConfig::IsPrintFrame() const
1227cdf0e10cSrcweir {
1228cdf0e10cSrcweir if (!pOther)
1229cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1230cdf0e10cSrcweir return pOther->bPrintFrame;
1231cdf0e10cSrcweir }
1232cdf0e10cSrcweir
1233cdf0e10cSrcweir
SetPrintFrame(sal_Bool bVal)1234cdf0e10cSrcweir void SmMathConfig::SetPrintFrame( sal_Bool bVal )
1235cdf0e10cSrcweir {
1236cdf0e10cSrcweir if (!pOther)
1237cdf0e10cSrcweir LoadOther();
1238cdf0e10cSrcweir SetOtherIfNotEqual( pOther->bPrintFrame, bVal );
1239cdf0e10cSrcweir }
1240cdf0e10cSrcweir
1241cdf0e10cSrcweir
IsSaveOnlyUsedSymbols() const1242cdf0e10cSrcweir sal_Bool SmMathConfig::IsSaveOnlyUsedSymbols() const
1243cdf0e10cSrcweir {
1244cdf0e10cSrcweir if (!pOther)
1245cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1246cdf0e10cSrcweir return pOther->bIsSaveOnlyUsedSymbols;
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir
1249cdf0e10cSrcweir
SetSaveOnlyUsedSymbols(sal_Bool bVal)1250cdf0e10cSrcweir void SmMathConfig::SetSaveOnlyUsedSymbols( sal_Bool bVal )
1251cdf0e10cSrcweir {
1252cdf0e10cSrcweir if (!pOther)
1253cdf0e10cSrcweir LoadOther();
1254cdf0e10cSrcweir SetOtherIfNotEqual( pOther->bIsSaveOnlyUsedSymbols, bVal );
1255cdf0e10cSrcweir }
1256cdf0e10cSrcweir
1257cdf0e10cSrcweir
IsIgnoreSpacesRight() const1258cdf0e10cSrcweir sal_Bool SmMathConfig::IsIgnoreSpacesRight() const
1259cdf0e10cSrcweir {
1260cdf0e10cSrcweir if (!pOther)
1261cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1262cdf0e10cSrcweir return pOther->bIgnoreSpacesRight;
1263cdf0e10cSrcweir }
1264cdf0e10cSrcweir
1265cdf0e10cSrcweir
SetIgnoreSpacesRight(sal_Bool bVal)1266cdf0e10cSrcweir void SmMathConfig::SetIgnoreSpacesRight( sal_Bool bVal )
1267cdf0e10cSrcweir {
1268cdf0e10cSrcweir if (!pOther)
1269cdf0e10cSrcweir LoadOther();
1270cdf0e10cSrcweir SetOtherIfNotEqual( pOther->bIgnoreSpacesRight, bVal );
1271cdf0e10cSrcweir }
1272cdf0e10cSrcweir
1273cdf0e10cSrcweir
IsAutoRedraw() const1274cdf0e10cSrcweir sal_Bool SmMathConfig::IsAutoRedraw() const
1275cdf0e10cSrcweir {
1276cdf0e10cSrcweir if (!pOther)
1277cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1278cdf0e10cSrcweir return pOther->bAutoRedraw;
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir
1281cdf0e10cSrcweir
SetAutoRedraw(sal_Bool bVal)1282cdf0e10cSrcweir void SmMathConfig::SetAutoRedraw( sal_Bool bVal )
1283cdf0e10cSrcweir {
1284cdf0e10cSrcweir if (!pOther)
1285cdf0e10cSrcweir LoadOther();
1286cdf0e10cSrcweir SetOtherIfNotEqual( pOther->bAutoRedraw, bVal );
1287cdf0e10cSrcweir }
1288cdf0e10cSrcweir
1289cdf0e10cSrcweir
IsShowFormulaCursor() const1290cdf0e10cSrcweir sal_Bool SmMathConfig::IsShowFormulaCursor() const
1291cdf0e10cSrcweir {
1292cdf0e10cSrcweir if (!pOther)
1293cdf0e10cSrcweir ((SmMathConfig *) this)->LoadOther();
1294cdf0e10cSrcweir return pOther->bFormulaCursor;
1295cdf0e10cSrcweir }
1296cdf0e10cSrcweir
1297cdf0e10cSrcweir
SetShowFormulaCursor(sal_Bool bVal)1298cdf0e10cSrcweir void SmMathConfig::SetShowFormulaCursor( sal_Bool bVal )
1299cdf0e10cSrcweir {
1300cdf0e10cSrcweir if (!pOther)
1301cdf0e10cSrcweir LoadOther();
1302cdf0e10cSrcweir SetOtherIfNotEqual( pOther->bFormulaCursor, bVal );
1303cdf0e10cSrcweir }
1304cdf0e10cSrcweir
Notify(const com::sun::star::uno::Sequence<rtl::OUString> &)1305cdf0e10cSrcweir void SmMathConfig::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
1306cdf0e10cSrcweir {}
1307cdf0e10cSrcweir
1308cdf0e10cSrcweir /////////////////////////////////////////////////////////////////
1309cdf0e10cSrcweir
1310