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_FMTRUBY_HXX
20 #define INCLUDED_SW_INC_FMTRUBY_HXX
21 
22 #include "swdllapi.h"
23 #include <svl/poolitem.hxx>
24 #include <com/sun/star/text/RubyAdjust.hpp>
25 
26 class SwTextRuby;
27 
28 class SW_DLLPUBLIC SwFormatRuby final : public SfxPoolItem
29 {
30     friend class SwTextRuby;
31 
32     OUString m_sRubyText;                     ///< The ruby text.
33     OUString m_sCharFormatName;               ///< Name of the charformat.
34     SwTextRuby* m_pTextAttr;                  ///< The TextAttribute.
35     sal_uInt16 m_nCharFormatId;               ///< PoolId of the charformat.
36     sal_uInt16 m_nPosition;                   ///< Position of the Ruby-character.
37     css::text::RubyAdjust m_eAdjustment;      ///< Specific adjustment of the Ruby-ch.
38 
39 public:
40     SwFormatRuby( const OUString& rRubyText );
41     SwFormatRuby( const SwFormatRuby& rAttr );
42     virtual ~SwFormatRuby() override;
43 
44     SwFormatRuby& operator=( const SwFormatRuby& rAttr );
45 
46     // "Pure virtual methods" of SfxPoolItem.
47     virtual bool            operator==( const SfxPoolItem& ) const override;
48     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = nullptr ) const override;
49 
50     virtual bool GetPresentation( SfxItemPresentation ePres,
51                                   MapUnit eCoreMetric,
52                                   MapUnit ePresMetric,
53                                   OUString &rText,
54                                   const IntlWrapper& rIntl ) const override;
55 
56     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
57     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
58 
GetTextRuby() const59     const SwTextRuby* GetTextRuby() const         { return m_pTextAttr; }
60 
GetText() const61     const OUString& GetText() const                    { return m_sRubyText; }
SetText(const OUString & rText)62     void SetText( const OUString& rText )        { m_sRubyText = rText; }
63 
GetCharFormatName() const64     const OUString& GetCharFormatName() const             { return m_sCharFormatName; }
SetCharFormatName(const OUString & rNm)65     void SetCharFormatName( const OUString& rNm )  { m_sCharFormatName = rNm; }
66 
GetCharFormatId() const67     sal_uInt16 GetCharFormatId() const                 { return m_nCharFormatId; }
SetCharFormatId(sal_uInt16 nNew)68     void SetCharFormatId( sal_uInt16 nNew )            { m_nCharFormatId = nNew; }
69 
GetPosition() const70     sal_uInt16 GetPosition() const                  { return m_nPosition; }
SetPosition(sal_uInt16 nNew)71     void SetPosition( sal_uInt16 nNew )             { m_nPosition = nNew; }
72 
GetAdjustment() const73     css::text::RubyAdjust GetAdjustment() const       { return m_eAdjustment; }
SetAdjustment(css::text::RubyAdjust nNew)74     void SetAdjustment( css::text::RubyAdjust nNew )  { m_eAdjustment = nNew; }
75 };
76 
77 #endif
78 
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
80