LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / forms / source / richtext / rtattributehandler.hxx
blob0f2badd640dd5d76ca93d09d64bb68d181125372
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include "rtattributes.hxx"
23 #include <rtl/ref.hxx>
24 #include <svl/languageoptions.hxx>
25 #include <editeng/svxenum.hxx>
26 #include <editeng/frmdir.hxx>
27 #include <salhelper/simplereferenceobject.hxx>
29 class SfxItemSet;
30 class SfxPoolItem;
31 class SfxItemPool;
33 namespace frm
36 class AttributeHandler : public salhelper::SimpleReferenceObject
38 private:
39 AttributeId m_nAttribute;
40 WhichId m_nWhich;
42 protected:
43 AttributeId getAttribute() const { return m_nAttribute; }
44 WhichId getWhich() const { return m_nWhich; }
46 public:
47 AttributeHandler( AttributeId _nAttributeId, WhichId _nWhichId );
49 AttributeId getAttributeId( ) const;
50 virtual AttributeState getState( const SfxItemSet& _rAttribs ) const;
51 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const = 0;
53 protected:
54 /// helper method calling implGetCheckState
55 AttributeCheckState getCheckState( const SfxItemSet& _rAttribs ) const;
57 /// helper method putting an item into a set, respecting a script type
58 void putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, SvtScriptType _nForScriptType ) const;
60 // pseudo-abstract
61 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
63 protected:
64 virtual ~AttributeHandler() override;
67 namespace AttributeHandlerFactory
69 ::rtl::Reference< AttributeHandler > getHandlerFor( AttributeId _nAttributeId, const SfxItemPool& _rEditEnginePool );
72 class ParaAlignmentHandler : public AttributeHandler
74 private:
75 SvxAdjust m_eAdjust;
77 public:
78 explicit ParaAlignmentHandler( AttributeId _nAttributeId );
80 public:
81 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
82 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
85 class LineSpacingHandler : public AttributeHandler
87 private:
88 sal_uInt16 m_nLineSpace;
90 public:
91 explicit LineSpacingHandler( AttributeId _nAttributeId );
93 public:
94 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
95 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
98 class EscapementHandler : public AttributeHandler
100 private:
101 SvxEscapement m_eEscapement;
103 public:
104 explicit EscapementHandler( AttributeId _nAttributeId );
106 public:
107 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
108 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
111 class SlotHandler : public AttributeHandler
113 private:
114 bool m_bScriptDependent;
116 public:
117 SlotHandler( AttributeId _nAttributeId, WhichId _nWhichId );
119 public:
120 virtual AttributeState getState( const SfxItemSet& _rAttribs ) const override;
121 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
124 class BooleanHandler : public AttributeHandler
126 public:
127 BooleanHandler( AttributeId _nAttributeId, WhichId _nWhichId );
129 public:
130 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
131 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
134 class FontSizeHandler : public AttributeHandler
136 public:
137 FontSizeHandler( AttributeId _nAttributeId, WhichId _nWhichId );
139 public:
140 virtual AttributeState getState( const SfxItemSet& _rAttribs ) const override;
141 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
144 class ParagraphDirectionHandler : public AttributeHandler
146 private:
147 SvxFrameDirection m_eParagraphDirection;
148 SvxAdjust m_eDefaultAdjustment;
149 SvxAdjust m_eOppositeDefaultAdjustment;
151 public:
152 explicit ParagraphDirectionHandler( AttributeId _nAttributeId );
154 public:
155 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
156 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
160 } // namespace frm
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */