Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / starmath / inc / symbol.hxx
blob7a3a79cd6210d25613bd9213df9f09b9ed217605
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_INC_SYMBOL_HXX
21 #define INCLUDED_STARMATH_INC_SYMBOL_HXX
23 #include <vcl/font.hxx>
24 #include <svl/lstner.hxx>
26 #include <map>
27 #include <vector>
28 #include <set>
30 #include "unomodel.hxx"
31 #include "utility.hxx"
32 #include "smmod.hxx"
35 #define SYMBOL_NONE 0xFFFF
37 class SmSym
39 private:
40 SmFace m_aFace;
41 OUString m_aName;
42 OUString m_aExportName;
43 OUString m_aSetName;
44 sal_UCS4 m_cChar;
45 bool m_bPredefined;
47 public:
48 SmSym();
49 SmSym(const OUString& rName, const vcl::Font& rFont, sal_UCS4 cChar,
50 const OUString& rSet, bool bIsPredefined = false);
51 SmSym(const SmSym& rSymbol);
53 SmSym& operator = (const SmSym& rSymbol);
55 const vcl::Font& GetFace() const { return m_aFace; }
56 sal_UCS4 GetCharacter() const { return m_cChar; }
57 const OUString& GetName() const { return m_aName; }
59 bool IsPredefined() const { return m_bPredefined; }
60 const OUString& GetSymbolSetName() const { return m_aSetName; }
61 const OUString& GetExportName() const { return m_aExportName; }
62 void SetExportName( const OUString &rName ) { m_aExportName = rName; }
64 // true if rSymbol has the same name, font and character
65 bool IsEqualInUI( const SmSym& rSymbol ) const;
68 // type of the actual container to hold the symbols
69 typedef std::map< OUString, SmSym > SymbolMap_t;
71 // vector of pointers to the actual symbols in the above container
72 typedef std::vector< const SmSym * > SymbolPtrVec_t;
75 class SmSymbolManager
77 private:
78 SymbolMap_t m_aSymbols;
79 bool m_bModified;
81 public:
82 SmSymbolManager();
83 SmSymbolManager(const SmSymbolManager& rSymbolSetManager);
84 ~SmSymbolManager();
86 SmSymbolManager & operator = (const SmSymbolManager& rSymbolSetManager);
88 // symbol sets are for UI purpose only, thus we assemble them here
89 std::set< OUString > GetSymbolSetNames() const;
90 const SymbolPtrVec_t GetSymbolSet( const OUString& rSymbolSetName );
92 const SymbolPtrVec_t GetSymbols() const;
93 bool AddOrReplaceSymbol( const SmSym & rSymbol, bool bForceChange = false );
94 void RemoveSymbol( const OUString & rSymbolName );
96 SmSym * GetSymbolByName(const OUString& rSymbolName);
97 const SmSym * GetSymbolByName(const OUString& rSymbolName) const
99 return const_cast<SmSymbolManager *>(this)->GetSymbolByName(rSymbolName);
102 bool IsModified() const { return m_bModified; }
103 void SetModified(bool bModify) { m_bModified = bModify; }
105 void Load();
106 void Save();
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */