1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SC_INC_AFMTUNO_HXX
21 #define INCLUDED_SC_INC_AFMTUNO_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 <com/sun/star/lang/XUnoTunnel.hpp>
31 #include <comphelper/servicehelper.hxx>
32 #include <cppuhelper/implbase.hxx>
36 class ScAutoFormatFieldObj
;
37 class ScAutoFormatObj
;
39 #define SC_AFMTOBJ_INVALID USHRT_MAX
41 class ScAutoFormatsObj final
: public ::cppu::WeakImplHelper
<
42 css::container::XNameContainer
,
43 css::container::XEnumerationAccess
,
44 css::container::XIndexAccess
,
45 css::lang::XServiceInfo
>
48 static ScAutoFormatObj
* GetObjectByIndex_Impl(sal_uInt16 nIndex
);
49 static ScAutoFormatObj
* GetObjectByName_Impl(const OUString
& aName
);
53 virtual ~ScAutoFormatsObj() override
;
56 virtual void SAL_CALL
insertByName( const OUString
& aName
,
57 const css::uno::Any
& aElement
) override
;
58 virtual void SAL_CALL
removeByName( const OUString
& Name
) override
;
61 virtual void SAL_CALL
replaceByName( const OUString
& aName
,
62 const css::uno::Any
& aElement
) override
;
65 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
66 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
67 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
70 virtual css::uno::Type SAL_CALL
getElementType() override
;
71 virtual sal_Bool SAL_CALL
hasElements() override
;
74 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
75 createEnumeration() override
;
78 virtual sal_Int32 SAL_CALL
getCount() override
;
79 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
82 virtual OUString SAL_CALL
getImplementationName() override
;
83 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
84 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
87 class ScAutoFormatObj
: public ::cppu::WeakImplHelper
<
88 css::container::XIndexAccess
,
89 css::container::XEnumerationAccess
,
90 css::container::XNamed
,
91 css::beans::XPropertySet
,
92 css::lang::XUnoTunnel
,
93 css::lang::XServiceInfo
>
96 SfxItemPropertySet aPropSet
;
97 sal_uInt16 nFormatIndex
;
99 ScAutoFormatFieldObj
* GetObjectByIndex_Impl(sal_uInt16 nIndex
);
102 ScAutoFormatObj(sal_uInt16 nIndex
);
103 virtual ~ScAutoFormatObj() override
;
105 // called via getImplementation:
106 bool IsInserted() const { return nFormatIndex
!= SC_AFMTOBJ_INVALID
; }
107 void InitFormat( sal_uInt16 nNewIndex
);
110 virtual sal_Int32 SAL_CALL
getCount() override
;
111 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
114 virtual css::uno::Type SAL_CALL
getElementType() override
;
115 virtual sal_Bool SAL_CALL
hasElements() override
;
117 // XEnumerationAccess
118 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
119 createEnumeration() override
;
122 virtual OUString SAL_CALL
getName() override
;
123 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
126 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
127 SAL_CALL
getPropertySetInfo() override
;
128 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
129 const css::uno::Any
& aValue
) override
;
130 virtual css::uno::Any SAL_CALL
getPropertyValue(
131 const OUString
& PropertyName
) override
;
132 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
133 const css::uno::Reference
<
134 css::beans::XPropertyChangeListener
>& xListener
) override
;
135 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
136 const css::uno::Reference
<
137 css::beans::XPropertyChangeListener
>& aListener
) override
;
138 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
139 const css::uno::Reference
<
140 css::beans::XVetoableChangeListener
>& aListener
) override
;
141 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
142 const css::uno::Reference
<
143 css::beans::XVetoableChangeListener
>& aListener
) override
;
146 virtual OUString SAL_CALL
getImplementationName() override
;
147 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
148 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
151 UNO3_GETIMPLEMENTATION_DECL(ScAutoFormatObj
)
154 class ScAutoFormatFieldObj
: public ::cppu::WeakImplHelper
<
155 css::beans::XPropertySet
,
156 css::lang::XServiceInfo
>
159 SfxItemPropertySet aPropSet
;
160 sal_uInt16 nFormatIndex
;
161 sal_uInt16 nFieldIndex
;
164 ScAutoFormatFieldObj(sal_uInt16 nFormat
, sal_uInt16 nField
);
165 virtual ~ScAutoFormatFieldObj() override
;
168 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
169 SAL_CALL
getPropertySetInfo() override
;
170 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
171 const css::uno::Any
& aValue
) override
;
172 virtual css::uno::Any SAL_CALL
getPropertyValue(
173 const OUString
& PropertyName
) override
;
174 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
175 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
176 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
177 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
178 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
179 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
180 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
181 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
184 virtual OUString SAL_CALL
getImplementationName() override
;
185 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
186 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */