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