tdf#48459 sw inline heading: don't apply inside frames or over 120 chars
[LibreOffice.git] / sc / inc / fmtuno.hxx
blob91e3b66db020507bd7023cdf91063676211926d5
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 <vector>
24 #include <formula/grammar.hxx>
25 #include <rtl/ref.hxx>
26 #include <svl/itemprop.hxx>
27 #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
28 #include <com/sun/star/sheet/XSheetCondition2.hpp>
29 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/container/XNameAccess.hpp>
32 #include <com/sun/star/container/XEnumerationAccess.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
36 #include <com/sun/star/sheet/FormulaToken.hpp>
37 #include <cppuhelper/implbase.hxx>
39 #include "address.hxx"
40 #include "conditio.hxx"
42 class ScDocument;
43 class ScTableConditionalEntry;
44 class ScValidationData;
46 struct ScCondFormatEntryItem
48 css::uno::Sequence< css::sheet::FormulaToken > maTokens1;
49 css::uno::Sequence< css::sheet::FormulaToken > maTokens2;
50 OUString maExpr1;
51 OUString maExpr2;
52 OUString maExprNmsp1;
53 OUString maExprNmsp2;
54 OUString maPosStr; // formula position as text
55 OUString maStyle; // display name as stored in ScStyleSheet
56 ScAddress maPos;
57 formula::FormulaGrammar::Grammar meGrammar1; // grammar used with maExpr1
58 formula::FormulaGrammar::Grammar meGrammar2; // grammar used with maExpr2
59 ScConditionMode meMode;
61 // Make sure the grammar is initialized for API calls.
62 ScCondFormatEntryItem();
65 class ScTableConditionalFormat final : public cppu::WeakImplHelper<
66 css::sheet::XSheetConditionalEntries,
67 css::container::XNameAccess,
68 css::container::XEnumerationAccess,
69 css::lang::XServiceInfo >
71 private:
72 std::vector<rtl::Reference<ScTableConditionalEntry>> maEntries;
74 ScTableConditionalEntry* GetObjectByIndex_Impl(sal_uInt16 nIndex) const;
75 void AddEntry_Impl(const ScCondFormatEntryItem& aEntry);
76 public:
77 ScTableConditionalFormat() = delete;
78 ScTableConditionalFormat(const ScDocument* pDoc, sal_uLong nKey,
79 SCTAB nTab, formula::FormulaGrammar::Grammar eGrammar);
80 virtual ~ScTableConditionalFormat() override;
82 void FillFormat( ScConditionalFormat& rFormat, ScDocument& rDoc,
83 formula::FormulaGrammar::Grammar eGrammar) const;
85 // XSheetConditionalEntries
86 virtual void SAL_CALL addNew( const css::uno::Sequence< css::beans::PropertyValue >& aConditionalEntry ) override;
87 virtual void SAL_CALL removeByIndex( sal_Int32 nIndex ) override;
88 virtual void SAL_CALL clear() override;
90 // XIndexAccess
91 virtual sal_Int32 SAL_CALL getCount() override;
92 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
94 // XNameAccess
95 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
96 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
97 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
99 // XEnumerationAccess
100 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
101 createEnumeration() override;
103 // XElementAccess
104 virtual css::uno::Type SAL_CALL getElementType() override;
105 virtual sal_Bool SAL_CALL hasElements() override;
107 // XServiceInfo
108 virtual OUString SAL_CALL getImplementationName() override;
109 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
110 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
113 class ScTableConditionalEntry final : public cppu::WeakImplHelper<
114 css::sheet::XSheetCondition2,
115 css::sheet::XSheetConditionalEntry,
116 css::lang::XServiceInfo >
118 private:
119 ScCondFormatEntryItem aData;
121 public:
122 ScTableConditionalEntry() = delete;
123 ScTableConditionalEntry(ScCondFormatEntryItem aItem);
124 virtual ~ScTableConditionalEntry() override;
126 void GetData(ScCondFormatEntryItem& rData) const;
128 // XSheetCondition
129 virtual css::sheet::ConditionOperator SAL_CALL getOperator() override;
130 virtual sal_Int32 SAL_CALL getConditionOperator() override;
131 virtual void SAL_CALL setOperator( css::sheet::ConditionOperator nOperator ) override;
132 virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator ) override;
133 virtual OUString SAL_CALL getFormula1() override;
134 virtual void SAL_CALL setFormula1( const OUString& aFormula1 ) override;
135 virtual OUString SAL_CALL getFormula2() override;
136 virtual void SAL_CALL setFormula2( const OUString& aFormula2 ) override;
137 virtual css::table::CellAddress SAL_CALL getSourcePosition() override;
138 virtual void SAL_CALL setSourcePosition( const css::table::CellAddress& aSourcePosition ) override;
140 // XSheetConditionalEntry
141 virtual OUString SAL_CALL getStyleName() override;
142 virtual void SAL_CALL setStyleName( const OUString& aStyleName ) override;
144 // XServiceInfo
145 virtual OUString SAL_CALL getImplementationName() override;
146 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
147 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
150 class ScTableValidationObj final : public cppu::WeakImplHelper<
151 css::sheet::XSheetCondition2,
152 css::sheet::XMultiFormulaTokens,
153 css::beans::XPropertySet,
154 css::lang::XServiceInfo >
156 private:
157 SfxItemPropertySet aPropSet;
158 ScConditionMode nMode;
159 OUString aExpr1;
160 OUString aExpr2;
161 OUString maExprNmsp1;
162 OUString maExprNmsp2;
163 formula::FormulaGrammar::Grammar meGrammar1; // grammar used with aExpr1 and aExpr2
164 formula::FormulaGrammar::Grammar meGrammar2; // grammar used with aExpr1 and aExpr2
165 css::uno::Sequence< css::sheet::FormulaToken > aTokens1;
166 css::uno::Sequence< css::sheet::FormulaToken > aTokens2;
167 ScAddress aSrcPos;
168 OUString aPosString; // formula position as text
169 sal_uInt16 nValMode; // enum ScValidationMode
170 bool bIgnoreBlank;
171 bool bCaseSensitive;
172 sal_Int16 nShowList;
173 bool bShowInput;
174 OUString aInputTitle;
175 OUString aInputMessage;
176 bool bShowError;
177 sal_uInt16 nErrorStyle; // enum ScValidErrorStyle
178 OUString aErrorTitle;
179 OUString aErrorMessage;
181 void ClearData_Impl();
183 public:
185 ScTableValidationObj() = delete;
186 ScTableValidationObj(const ScDocument& rDoc, sal_uInt32 nKey,
187 const formula::FormulaGrammar::Grammar eGrammar);
188 virtual ~ScTableValidationObj() override;
190 ScValidationData* CreateValidationData( ScDocument& rDoc,
191 formula::FormulaGrammar::Grammar eGrammar ) const;
193 // XSheetCondition
194 virtual css::sheet::ConditionOperator SAL_CALL getOperator() override;
195 virtual sal_Int32 SAL_CALL getConditionOperator() override;
196 virtual void SAL_CALL setOperator( css::sheet::ConditionOperator nOperator ) override;
197 virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator ) override;
198 virtual OUString SAL_CALL getFormula1() override;
199 virtual void SAL_CALL setFormula1( const OUString& aFormula1 ) override;
200 virtual OUString SAL_CALL getFormula2() override;
201 virtual void SAL_CALL setFormula2( const OUString& aFormula2 ) override;
202 virtual css::table::CellAddress SAL_CALL getSourcePosition() override;
203 virtual void SAL_CALL setSourcePosition( const css::table::CellAddress& aSourcePosition ) override;
205 // XMultiFormulaTokens
206 virtual css::uno::Sequence< css::sheet::FormulaToken >
207 SAL_CALL getTokens( sal_Int32 nIndex ) override;
208 virtual void SAL_CALL setTokens( sal_Int32 nIndex,
209 const css::uno::Sequence< css::sheet::FormulaToken >& aTokens ) override;
210 virtual sal_Int32 SAL_CALL getCount() override;
212 // XPropertySet
213 virtual css::uno::Reference< css::beans::XPropertySetInfo >
214 SAL_CALL getPropertySetInfo() override;
215 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
216 const css::uno::Any& aValue ) override;
217 virtual css::uno::Any SAL_CALL getPropertyValue(
218 const OUString& PropertyName ) override;
219 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
220 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
221 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
222 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
223 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
224 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
225 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
226 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
228 // XServiceInfo
229 virtual OUString SAL_CALL getImplementationName() override;
230 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
231 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */