tdf#48459 sw inline heading: don't apply inside frames or over 120 chars
[LibreOffice.git] / sc / inc / afmtuno.hxx
blobf880d753438db82df9c801c0c87c740e33c23a2a
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 <rtl/ref.hxx>
23 #include <svl/itemprop.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/container/XIndexAccess.hpp>
26 #include <com/sun/star/container/XEnumerationAccess.hpp>
27 #include <com/sun/star/container/XNameContainer.hpp>
28 #include <com/sun/star/container/XNamed.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <cppuhelper/implbase.hxx>
32 #include <climits>
34 class ScAutoFormatFieldObj;
35 class ScAutoFormatObj;
37 #define SC_AFMTOBJ_INVALID USHRT_MAX
39 class ScAutoFormatsObj final : public ::cppu::WeakImplHelper<
40 css::container::XNameContainer,
41 css::container::XEnumerationAccess,
42 css::container::XIndexAccess,
43 css::lang::XServiceInfo >
45 private:
46 static rtl::Reference<ScAutoFormatObj> GetObjectByIndex_Impl(sal_uInt16 nIndex);
47 static rtl::Reference<ScAutoFormatObj> GetObjectByName_Impl(std::u16string_view aName);
49 public:
50 ScAutoFormatsObj();
51 virtual ~ScAutoFormatsObj() override;
53 // XNameContainer
54 virtual void SAL_CALL insertByName( const OUString& aName,
55 const css::uno::Any& aElement ) override;
56 virtual void SAL_CALL removeByName( const OUString& Name ) override;
58 // XNameReplace
59 virtual void SAL_CALL replaceByName( const OUString& aName,
60 const css::uno::Any& aElement ) override;
62 // XNameAccess
63 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
64 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
65 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
67 // XElementAccess
68 virtual css::uno::Type SAL_CALL getElementType() override;
69 virtual sal_Bool SAL_CALL hasElements() override;
71 // XEnumerationAccess
72 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
73 createEnumeration() override;
75 // XIndexAccess
76 virtual sal_Int32 SAL_CALL getCount() override;
77 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
79 // XServiceInfo
80 virtual OUString SAL_CALL getImplementationName() override;
81 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
82 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
85 class ScAutoFormatObj final : public ::cppu::WeakImplHelper<
86 css::container::XIndexAccess,
87 css::container::XEnumerationAccess,
88 css::container::XNamed,
89 css::beans::XPropertySet,
90 css::lang::XServiceInfo >
92 private:
93 SfxItemPropertySet aPropSet;
94 sal_uInt16 nFormatIndex;
96 rtl::Reference<ScAutoFormatFieldObj> GetObjectByIndex_Impl(sal_uInt16 nIndex);
98 public:
99 ScAutoFormatObj(sal_uInt16 nIndex);
100 virtual ~ScAutoFormatObj() override;
102 // called via getImplementation:
103 bool IsInserted() const { return nFormatIndex != SC_AFMTOBJ_INVALID; }
104 void InitFormat( sal_uInt16 nNewIndex );
106 // XIndexAccess
107 virtual sal_Int32 SAL_CALL getCount() override;
108 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
110 // XElementAccess
111 virtual css::uno::Type SAL_CALL getElementType() override;
112 virtual sal_Bool SAL_CALL hasElements() override;
114 // XEnumerationAccess
115 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
116 createEnumeration() override;
118 // XNamed
119 virtual OUString SAL_CALL getName() override;
120 virtual void SAL_CALL setName( const OUString& aName ) override;
122 // XPropertySet
123 virtual css::uno::Reference< css::beans::XPropertySetInfo >
124 SAL_CALL getPropertySetInfo() override;
125 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
126 const css::uno::Any& aValue ) override;
127 virtual css::uno::Any SAL_CALL getPropertyValue(
128 const OUString& PropertyName ) override;
129 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
130 const css::uno::Reference<
131 css::beans::XPropertyChangeListener >& xListener ) override;
132 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
133 const css::uno::Reference<
134 css::beans::XPropertyChangeListener >& aListener ) override;
135 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
136 const css::uno::Reference<
137 css::beans::XVetoableChangeListener >& aListener ) override;
138 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
139 const css::uno::Reference<
140 css::beans::XVetoableChangeListener >& aListener ) override;
142 // XServiceInfo
143 virtual OUString SAL_CALL getImplementationName() override;
144 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
145 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
148 class ScAutoFormatFieldObj final : public ::cppu::WeakImplHelper<
149 css::beans::XPropertySet,
150 css::lang::XServiceInfo >
152 private:
153 SfxItemPropertySet aPropSet;
154 sal_uInt16 nFormatIndex;
155 sal_uInt16 nFieldIndex;
157 public:
158 ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField);
159 virtual ~ScAutoFormatFieldObj() override;
161 // XPropertySet
162 virtual css::uno::Reference< css::beans::XPropertySetInfo >
163 SAL_CALL getPropertySetInfo() override;
164 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
165 const css::uno::Any& aValue ) override;
166 virtual css::uno::Any SAL_CALL getPropertyValue(
167 const OUString& PropertyName ) override;
168 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
169 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
170 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
171 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
172 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
173 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
174 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
175 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
177 // XServiceInfo
178 virtual OUString SAL_CALL getImplementationName() override;
179 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
180 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */