LibreOffice Module vcl (master)  1
impglyphitem.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <impglyphitem.hxx>
21 
22 #if (defined UNX && !defined MACOSX && !defined IOS)
24 #endif
25 
27 {
28  delete m_pImpl;
29  if (m_pExtraImpls)
31  delete impl;
32 }
33 
35 {
36  std::swap(m_pImpl, rOther.m_pImpl);
37  std::swap(m_pExtraImpls, rOther.m_pExtraImpls);
38 }
39 
41 {
42  if (this != &rOther)
43  {
44  std::swap(m_pImpl, rOther.m_pImpl);
45  std::swap(m_pExtraImpls, rOther.m_pExtraImpls);
46  }
47  return *this;
48 }
49 
51 {
52  if (m_pImpl == nullptr)
53  return false;
54  if (!m_pImpl->IsValid())
55  return false;
56  if (m_pExtraImpls)
58  if (!impl->IsValid())
59  return false;
60  return true;
61 }
62 
64 {
65  // Invalidating is in fact simply clearing.
66  delete m_pImpl;
67  m_pImpl = nullptr;
68  if (m_pExtraImpls)
69  {
71  delete impl;
72  delete m_pExtraImpls;
73  m_pExtraImpls = nullptr;
74  }
75 }
76 
77 SalLayoutGlyphsImpl* SalLayoutGlyphs::Impl(unsigned int nLevel) const
78 {
79  if (nLevel == 0)
80  return m_pImpl;
81  if (m_pExtraImpls != nullptr && nLevel - 1 < m_pExtraImpls->size())
82  return (*m_pExtraImpls)[nLevel - 1];
83  return nullptr;
84 }
85 
87 {
88  if (m_pImpl == nullptr)
89  m_pImpl = pImpl;
90  else
91  {
92  if (m_pExtraImpls == nullptr)
93  m_pExtraImpls = new std::vector<SalLayoutGlyphsImpl*>;
94  m_pExtraImpls->push_back(pImpl);
95  }
96 }
97 
99 
101 {
102  if (!m_rFontInstance.is())
103  return false;
104  if (empty())
105  return false;
106  return true;
107 }
108 
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SalLayoutGlyphs()=default
bool IsValid() const
void AppendImpl(SalLayoutGlyphsImpl *pImpl)
std::vector< SalLayoutGlyphsImpl * > * m_pExtraImpls
Definition: glyphitem.hxx:38
SalLayoutGlyphsImpl * m_pImpl
Definition: glyphitem.hxx:34
bool IsValid() const
SalLayoutGlyphsImpl(LogicalFontInstance &rFontInstance)
rtl::Reference< LogicalFontInstance > m_rFontInstance
SalLayoutGlyphs & operator=(const SalLayoutGlyphs &)=delete
SalLayoutGlyphsImpl * Impl(unsigned int nLevel) const
SalLayoutGlyphsImpl * clone() const