1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_STARMATH_SOURCE_CFGITEM_HXX
21 #define INCLUDED_STARMATH_SOURCE_CFGITEM_HXX
23 #include <utility.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
29 #include <rtl/ustring.hxx>
30 #include <svl/SfxBroadcaster.hxx>
31 #include <unotools/configitem.hxx>
37 class SmSymbolManager
;
39 namespace vcl
{ class Font
; }
53 explicit SmFontFormat( const vcl::Font
&rFont
);
55 const vcl::Font
GetFont() const;
56 bool operator == ( const SmFontFormat
&rFntFmt
) const;
59 struct SmFntFmtListEntry
64 SmFntFmtListEntry( const OUString
&rId
, const SmFontFormat
&rFntFmt
);
67 class SmFontFormatList
69 std::vector
<SmFntFmtListEntry
> aEntries
;
72 SmFontFormatList(const SmFontFormatList
&) = delete;
73 SmFontFormatList
& operator=(const SmFontFormatList
&) = delete;
79 void AddFontFormat( const OUString
&rFntFmtId
, const SmFontFormat
&rFntFmt
);
80 void RemoveFontFormat( const OUString
&rFntFmtId
);
82 const SmFontFormat
* GetFontFormat( const OUString
&rFntFmtId
) const;
83 const SmFontFormat
* GetFontFormat( size_t nPos
) const;
84 const OUString
GetFontFormatId( const SmFontFormat
&rFntFmt
) const;
85 const OUString
GetFontFormatId( const SmFontFormat
&rFntFmt
, bool bAdd
);
86 const OUString
GetFontFormatId( size_t nPos
) const;
87 const OUString
GetNewFontFormatId() const;
88 size_t GetCount() const { return aEntries
.size(); }
90 bool IsModified() const { return bModified
; }
91 void SetModified( bool bVal
) { bModified
= bVal
; }
94 class SmMathConfig final
: public utl::ConfigItem
, public SfxBroadcaster
96 std::unique_ptr
<SmFormat
> pFormat
;
97 std::unique_ptr
<SmCfgOther
> pOther
;
98 std::unique_ptr
<SmFontFormatList
> pFontFormatList
;
99 std::unique_ptr
<SmSymbolManager
> pSymbolMgr
;
100 bool bIsOtherModified
;
101 bool bIsFormatModified
;
102 SmFontPickList vFontPickList
[7];
104 SmMathConfig(const SmMathConfig
&) = delete;
105 SmMathConfig
& operator=(const SmMathConfig
&) = delete;
107 void StripFontFormatList( const std::vector
< SmSym
> &rSymbols
);
112 void ReadSymbol( SmSym
&rSymbol
,
113 const OUString
&rSymbolName
,
114 const OUString
&rBaseNode
) const;
115 void ReadFontFormat( SmFontFormat
&rFontFormat
,
116 const OUString
&rSymbolName
,
117 const OUString
&rBaseNode
) const;
119 void SetOtherIfNotEqual( bool &rbItem
, bool bNewVal
);
125 void LoadFontFormatList();
126 void SaveFontFormatList();
128 void SetOtherModified( bool bVal
);
129 bool IsOtherModified() const { return bIsOtherModified
; }
130 void SetFormatModified( bool bVal
);
131 bool IsFormatModified() const { return bIsFormatModified
; }
133 SmFontFormatList
& GetFontFormatList();
134 const SmFontFormatList
& GetFontFormatList() const
136 return const_cast<SmMathConfig
*>(this)->GetFontFormatList();
139 virtual void ImplCommit() override
;
143 virtual ~SmMathConfig() override
;
146 virtual void Notify( const css::uno::Sequence
< OUString
> &rPropertyNames
) override
;
148 SmSymbolManager
& GetSymbolManager();
149 void GetSymbols( std::vector
< SmSym
> &rSymbols
) const;
150 void SetSymbols( const std::vector
< SmSym
> &rNewSymbols
);
152 const SmFormat
& GetStandardFormat() const;
153 void SetStandardFormat( const SmFormat
&rFormat
, bool bSaveFontFormatList
= false );
155 bool IsPrintTitle() const;
156 void SetPrintTitle( bool bVal
);
157 bool IsPrintFormulaText() const;
158 void SetPrintFormulaText( bool bVal
);
159 bool IsPrintFrame() const;
160 void SetPrintFrame( bool bVal
);
161 SmPrintSize
GetPrintSize() const;
162 void SetPrintSize( SmPrintSize eSize
);
163 sal_uInt16
GetPrintZoomFactor() const;
164 void SetPrintZoomFactor( sal_uInt16 nVal
);
166 bool IsSaveOnlyUsedSymbols() const;
167 void SetSaveOnlyUsedSymbols( bool bVal
);
168 bool IsAutoCloseBrackets() const;
169 void SetAutoCloseBrackets( bool bVal
);
170 bool IsIgnoreSpacesRight() const;
171 void SetIgnoreSpacesRight( bool bVal
);
172 bool IsAutoRedraw() const;
173 void SetAutoRedraw( bool bVal
);
174 bool IsShowFormulaCursor() const;
175 void SetShowFormulaCursor( bool bVal
);
177 SmFontPickList
& GetFontPickList(sal_uInt16 nIdent
) { return vFontPickList
[nIdent
]; }
179 void ItemSetToConfig(const SfxItemSet
&rSet
);
180 void ConfigToItemSet(SfxItemSet
&rSet
) const;
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */