LibreOffice Module sw (master)  1
fchrfmt.hxx
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 #ifndef INCLUDED_SW_INC_FCHRFMT_HXX
20 #define INCLUDED_SW_INC_FCHRFMT_HXX
21 
22 #include <svl/poolitem.hxx>
23 #include "calbck.hxx"
24 #include "format.hxx"
25 #include "charfmt.hxx"
26 
27 class SwTextCharFormat;
28 class IntlWrapper;
29 
31 {
32  friend class SwTextCharFormat;
34 
35 public:
37  explicit SwFormatCharFormat( SwCharFormat *pFormat );
38  virtual ~SwFormatCharFormat() override;
39 
41  SwFormatCharFormat( const SwFormatCharFormat& rAttr );
42 
43 private:
44  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
45 
48 public:
49 
50 
52  virtual bool operator==( const SfxPoolItem& ) const override;
53  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
54  virtual bool GetPresentation( SfxItemPresentation ePres,
55  MapUnit eCoreMetric,
56  MapUnit ePresMetric,
57  OUString &rText,
58  const IntlWrapper& rIntl ) const override;
59 
60  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
61  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
62 
63  virtual bool GetInfo( SfxPoolItem& rInfo ) const override;
64 
65  void SetCharFormat( SwFormat* pFormat )
66  {
67  assert(!pFormat->IsDefault()); // expose cases that lead to use-after-free
68  pFormat->Add(this);
69  }
70  SwCharFormat* GetCharFormat() const { return const_cast<SwCharFormat*>(static_cast<const SwCharFormat*>(GetRegisteredIn())); }
71 };
72 #endif
73 
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GetInfo(SfxPoolItem const &rInfo) const
Definition: txtatr2.cxx:73
void Add(SwClient *pDepend)
Definition: calbck.cxx:217
bool IsDefault() const
Definition: format.hxx:109
virtual bool operator==(const SfxPoolItem &) const =0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
SwTextCharFormat * m_pTextAttribute
My text attribute.
Definition: fchrfmt.hxx:33
SfxPoolItem & operator=(const SfxPoolItem &)=delete
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
Base class for various Writer styles.
Definition: format.hxx:43
SfxItemPresentation
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SwCharFormat * GetCharFormat() const
Definition: fchrfmt.hxx:70
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
unsigned char sal_uInt8
void SetCharFormat(SwFormat *pFormat)
Definition: fchrfmt.hxx:65
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
MapUnit
virtual void Modify(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.cxx:130