| 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 | /// SfxPoolItem subclass that is owned by an SwTextRuby and contains info entered in Format -> Asian |
| 29 | /// Phonetic Guide. This is a character property, i.e. appears in the SwpHints of an SwTextNode. |
| 30 | class SW_DLLPUBLIC SwFormatRuby final : public SfxPoolItem |
| 31 | { |
| 32 | friend class SwTextRuby; |
| 33 | |
| 34 | OUString m_sRubyText; ///< The ruby text. |
| 35 | UIName m_sCharFormatName; ///< Name of the charformat. |
| 36 | SwTextRuby* m_pTextAttr; ///< The TextAttribute. |
| 37 | sal_uInt16 m_nCharFormatId; ///< PoolId of the charformat. |
| 38 | sal_uInt16 m_nPosition; ///< Position of the Ruby-character. |
| 39 | css::text::RubyAdjust m_eAdjustment; ///< Specific adjustment of the Ruby-ch. |
| 40 | |
| 41 | public: |
| 42 | DECLARE_ITEM_TYPE_FUNCTION(SwFormatRuby) |
| 43 | SwFormatRuby( OUString aRubyText ); |
| 44 | SwFormatRuby( const SwFormatRuby& rAttr ); |
| 45 | virtual ~SwFormatRuby() override; |
| 46 | |
| 47 | SwFormatRuby& operator=( const SwFormatRuby& rAttr ); |
| 48 | |
| 49 | // "Pure virtual methods" of SfxPoolItem. |
| 50 | virtual bool operator==( const SfxPoolItem& ) const override; |
| 51 | virtual SwFormatRuby* Clone( SfxItemPool* pPool = nullptr ) const override; |
| 52 | |
| 53 | virtual bool GetPresentation( SfxItemPresentation ePres, |
| 54 | MapUnit eCoreMetric, |
| 55 | MapUnit ePresMetric, |
| 56 | OUString &rText, |
| 57 | const IntlWrapper& rIntl ) const override; |
| 58 | |
| 59 | virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; |
| 60 | virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; |
| 61 | |
| 62 | const SwTextRuby* GetTextRuby() const { return m_pTextAttr; } |
| 63 | |
| 64 | const OUString& GetText() const { return m_sRubyText; } |
| 65 | void SetText( const OUString& rText ) { m_sRubyText = rText; } |
| 66 | |
| 67 | const UIName& GetCharFormatName() const { return m_sCharFormatName; } |
| 68 | void SetCharFormatName( const UIName& rNm ) { m_sCharFormatName = rNm; } |
| 69 | |
| 70 | sal_uInt16 GetCharFormatId() const { return m_nCharFormatId; } |
| 71 | void SetCharFormatId( sal_uInt16 nNew ) { m_nCharFormatId = nNew; } |
| 72 | |
| 73 | sal_uInt16 GetPosition() const { return m_nPosition; } |
| 74 | void SetPosition( sal_uInt16 nNew ) { m_nPosition = nNew; } |
| 75 | |
| 76 | css::text::RubyAdjust GetAdjustment() const { return m_eAdjustment; } |
| 77 | void SetAdjustment( css::text::RubyAdjust nNew ) { m_eAdjustment = nNew; } |
| 78 | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
| 79 | }; |
| 80 | |
| 81 | #endif |
| 82 | |
| 83 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |