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 /** This stuff is used to work with %charname.
22 * Will remember the char name, char code and font.
32 #include "utility.hxx"
35 #define SYMBOL_NONE 0xFFFF
42 OUString m_aExportName
;
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 SmFormat
* pFormat
= nullptr) const;
56 sal_UCS4
GetCharacter() const { return m_cChar
; }
57 const OUString
& GetUiName() const { return m_aUiName
; }
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
;
78 SymbolMap_t m_aSymbols
;
83 SmSymbolManager(const SmSymbolManager
& rSymbolSetManager
);
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 SymbolPtrVec_t
GetSymbolSet( std::u16string_view rSymbolSetName
);
92 SymbolPtrVec_t
GetSymbols() const;
93 bool AddOrReplaceSymbol( const SmSym
& rSymbol
, bool bForceChange
= false );
94 void RemoveSymbol( const OUString
& rSymbolName
);
96 SmSym
* GetSymbolByName(std::u16string_view rSymbolName
);
97 SmSym
* GetSymbolByUiName(std::u16string_view rSymbolName
);
98 SmSym
* GetSymbolByExportName(std::u16string_view rSymbolName
);
100 bool IsModified() const { return m_bModified
; }
101 void SetModified(bool bModify
) { m_bModified
= bModify
; }
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */