LibreOffice Module sc (master) 1
uiitems.cxx
Go to the documentation of this file.
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
20#include <uiitems.hxx>
21
22#include <userlist.hxx>
23#include <dpsave.hxx>
24#include <queryparam.hxx>
25
26#include <osl/diagnose.h>
27#include <editeng/editobj.hxx>
28#include <utility>
29
34 sal_uInt16 nWhichP, const ScAddress& rCurPos, const ScAddress& rStartPos,
35 const ScAddress& rEndPos, OUString _aString, const EditTextObject* pData ) :
36 SfxPoolItem ( nWhichP ),
37 aCursorPos ( rCurPos ),
38 aStartPos ( rStartPos ),
39 aEndPos ( rEndPos ),
40 aString (std::move( _aString )),
41 pEditData ( pData ? pData->Clone() : nullptr ),
42 mpMisspellRanges(nullptr)
43{
44}
45
47 SfxPoolItem ( rItem ),
48 aCursorPos ( rItem.aCursorPos ),
49 aStartPos ( rItem.aStartPos ),
50 aEndPos ( rItem.aEndPos ),
51 aString ( rItem.aString ),
52 pEditData ( rItem.pEditData ? rItem.pEditData->Clone() : nullptr ),
53 mpMisspellRanges(rItem.mpMisspellRanges)
54{
55}
56
58{
59}
60
62{
63 assert(SfxPoolItem::operator==(rItem));
64
65 return (aStartPos == static_cast<const ScInputStatusItem&>(rItem).aStartPos)
66 && (aEndPos == static_cast<const ScInputStatusItem&>(rItem).aEndPos)
67 && (aCursorPos == static_cast<const ScInputStatusItem&>(rItem).aCursorPos)
68 && (aString == static_cast<const ScInputStatusItem&>(rItem).aString);
69 //TODO: Compare Edit data!
70}
71
73{
74 return new ScInputStatusItem( *this );
75}
76
77void ScInputStatusItem::SetMisspellRanges( const std::vector<editeng::MisspellRanges>* pRanges )
78{
79 mpMisspellRanges = pRanges;
80}
81
82// ScPaintHint was moved to hints.cxx
83
87ScTablesHint::ScTablesHint(sal_uInt16 nNewId, SCTAB nTable1, SCTAB nTable2) :
88 nId( nNewId ),
89 nTab1( nTable1 ),
90 nTab2( nTable2 )
91{
92}
93
95{
96}
97
98ScIndexHint::ScIndexHint(SfxHintId nNewId, sal_uInt16 nIdx) :
99 SfxHint( nNewId ),
100 nIndex( nIdx )
101{
102}
103
105{
106}
107
112 pEditEngine( pEngine ),
113 aCursorPos( rCurPos )
114{
115}
116
118{
119}
120
124ScSortItem::ScSortItem( sal_uInt16 nWhichP,
125 ScViewData* ptrViewData,
126 const ScSortParam* pSortData ) :
127 SfxPoolItem ( nWhichP ),
128 pViewData ( ptrViewData )
129{
130 if ( pSortData ) theSortData = *pSortData;
131}
132
133ScSortItem::ScSortItem( sal_uInt16 nWhichP,
134 const ScSortParam* pSortData ) :
135 SfxPoolItem ( nWhichP ),
136 pViewData ( nullptr )
137{
138 if ( pSortData ) theSortData = *pSortData;
139}
140
141bool ScSortItem::operator==( const SfxPoolItem& rItem ) const
142{
143 assert(SfxPoolItem::operator==(rItem));
144
145 const ScSortItem& rOther = static_cast<const ScSortItem&>(rItem);
146
147 return ( (pViewData == rOther.pViewData)
148 && (theSortData == rOther.theSortData) );
149}
150
152{
153 return new ScSortItem( *this );
154}
155
156bool ScSortItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /* nMemberUd */ ) const
157{
158 // Return empty value as there is no useful conversion
159 rVal = css::uno::Any();
160 return true;
161}
162
166ScQueryItem::ScQueryItem( sal_uInt16 nWhichP,
167 ScViewData* ptrViewData,
168 const ScQueryParam* pQueryData ) :
169 SfxPoolItem ( nWhichP ),
170 pViewData ( ptrViewData ),
171 bIsAdvanced ( false )
172{
173 if (pQueryData)
174 mpQueryData.reset(new ScQueryParam(*pQueryData));
175 else
176 mpQueryData.reset(new ScQueryParam);
177}
178
179ScQueryItem::ScQueryItem( sal_uInt16 nWhichP,
180 const ScQueryParam* pQueryData ) :
181 SfxPoolItem ( nWhichP ),
182 pViewData ( nullptr ),
183 bIsAdvanced ( false )
184{
185 if (pQueryData)
186 mpQueryData.reset(new ScQueryParam(*pQueryData));
187 else
188 mpQueryData.reset(new ScQueryParam);
189}
190
192 SfxPoolItem ( rItem ),
193 mpQueryData(new ScQueryParam(*rItem.mpQueryData)),
194 pViewData ( rItem.pViewData ),
195 aAdvSource ( rItem.aAdvSource ),
196 bIsAdvanced ( rItem.bIsAdvanced )
197{
198}
199
201{
202}
203
205{
206 if (pSource)
207 {
208 aAdvSource = *pSource;
209 bIsAdvanced = true;
210 }
211 else
212 bIsAdvanced = false;
213}
214
216{
217 return *mpQueryData;
218}
219
221{
222 rSource = aAdvSource;
223 return bIsAdvanced;
224}
225
226bool ScQueryItem::operator==( const SfxPoolItem& rItem ) const
227{
228 assert(SfxPoolItem::operator==(rItem));
229
230 const ScQueryItem& rQueryItem = static_cast<const ScQueryItem&>(rItem);
231
232 return ( (pViewData == rQueryItem.pViewData)
233 && (bIsAdvanced == rQueryItem.bIsAdvanced)
234 && (aAdvSource == rQueryItem.aAdvSource)
235 && (*mpQueryData == *rQueryItem.mpQueryData) );
236}
237
239{
240 return new ScQueryItem( *this );
241}
242
247 ScViewData* ptrViewData,
248 const ScSubTotalParam* pSubTotalData ) :
249 SfxPoolItem ( nWhichP ),
250 pViewData ( ptrViewData )
251{
252 if ( pSubTotalData ) theSubTotalData = *pSubTotalData;
253}
254
255bool ScSubTotalItem::operator==( const SfxPoolItem& rItem ) const
256{
257 assert(SfxPoolItem::operator==(rItem));
258
259 const ScSubTotalItem& rSTItem = static_cast<const ScSubTotalItem&>(rItem);
260
261 return ( (pViewData == rSTItem.pViewData)
262 && (theSubTotalData == rSTItem.theSubTotalData) );
263}
264
266{
267 return new ScSubTotalItem( *this );
268}
269
270bool ScSubTotalItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /* nMemberUd */ ) const
271{
272 // Return empty value as there is no useful conversion
273 rVal = css::uno::Any();
274 return true;
275}
276
281 : SfxPoolItem ( nWhichP )
282{
283}
284
286 : SfxPoolItem ( rItem )
287{
288 if ( rItem.pUserList )
289 pUserList.reset( new ScUserList( *(rItem.pUserList) ) );
290}
291
293{
294}
295
296bool ScUserListItem::operator==( const SfxPoolItem& rItem ) const
297{
298 assert(SfxPoolItem::operator==(rItem));
299
300 const ScUserListItem& r = static_cast<const ScUserListItem&>(rItem);
301 bool bEqual = false;
302
303 if ( !pUserList || !r.pUserList )
304 bEqual = ( !pUserList && !r.pUserList );
305 else
306 bEqual = ( *pUserList == *(r.pUserList) );
307
308 return bEqual;
309}
310
312{
313 return new ScUserListItem( *this );
314}
315
317{
318 pUserList.reset( new ScUserList( rUserList ) );
319}
320
325 sal_uInt16 nWhichP,
326 const ScConsolidateParam* pConsolidateData ) :
327 SfxPoolItem ( nWhichP )
328{
329 if ( pConsolidateData ) theConsData = *pConsolidateData;
330}
331
333{
334 assert(SfxPoolItem::operator==(rItem));
335
336 const ScConsolidateItem& rCItem = static_cast<const ScConsolidateItem&>(rItem);
337
338 return ( theConsData == rCItem.theConsData);
339}
340
342{
343 return new ScConsolidateItem( *this );
344}
345
349ScPivotItem::ScPivotItem( sal_uInt16 nWhichP, const ScDPSaveData* pData,
350 const ScRange* pRange, bool bNew ) :
351 SfxPoolItem ( nWhichP )
352{
353 // pSaveData must always exist
354 if ( pData )
355 pSaveData.reset( new ScDPSaveData(*pData) );
356 else
357 pSaveData.reset( new ScDPSaveData );
358 if ( pRange ) aDestRange = *pRange;
359 bNewSheet = bNew;
360}
361
363 SfxPoolItem ( rItem ),
364 aDestRange ( rItem.aDestRange ),
365 bNewSheet ( rItem.bNewSheet )
366{
367 assert(rItem.pSaveData && "pSaveData");
368 pSaveData.reset( new ScDPSaveData(*rItem.pSaveData) );
369}
370
372{
373}
374
375bool ScPivotItem::operator==( const SfxPoolItem& rItem ) const
376{
377 assert(SfxPoolItem::operator==(rItem));
378
379 const ScPivotItem& rPItem = static_cast<const ScPivotItem&>(rItem);
380 OSL_ENSURE( pSaveData && rPItem.pSaveData, "pSaveData" );
381 return ( *pSaveData == *rPItem.pSaveData &&
382 aDestRange == rPItem.aDestRange &&
383 bNewSheet == rPItem.bNewSheet );
384}
385
387{
388 return new ScPivotItem( *this );
389}
390
394ScSolveItem::ScSolveItem( sal_uInt16 nWhichP,
395 const ScSolveParam* pSolveData )
396 : SfxPoolItem ( nWhichP )
397{
398 if ( pSolveData ) theSolveData = *pSolveData;
399}
400
401bool ScSolveItem::operator==( const SfxPoolItem& rItem ) const
402{
403 assert(SfxPoolItem::operator==(rItem));
404
405 const ScSolveItem& rPItem = static_cast<const ScSolveItem&>(rItem);
406
407 return ( theSolveData == rPItem.theSolveData );
408}
409
411{
412 return new ScSolveItem( *this );
413}
414
418ScTabOpItem::ScTabOpItem( sal_uInt16 nWhichP,
419 const ScTabOpParam* pTabOpData )
420 : SfxPoolItem ( nWhichP )
421{
422 if ( pTabOpData ) theTabOpData = *pTabOpData;
423}
424
425bool ScTabOpItem::operator==( const SfxPoolItem& rItem ) const
426{
427 assert(SfxPoolItem::operator==(rItem));
428
429 const ScTabOpItem& rPItem = static_cast<const ScTabOpItem&>(rItem);
430
431 return ( theTabOpData == rPItem.theTabOpData );
432}
433
435{
436 return new ScTabOpItem( *this );
437}
438
439/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:332
virtual ScConsolidateItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:341
ScConsolidateItem(sal_uInt16 nWhich, const ScConsolidateParam *pParam)
Data for the Consolidate dialog.
Definition: uiitems.cxx:324
ScConsolidateParam theConsData
Definition: uiitems.hxx:223
ScEditViewHint()=delete
virtual ~ScEditViewHint() override
Definition: uiitems.cxx:117
ScIndexHint(SfxHintId nNewId, sal_uInt16 nIdx)
Definition: uiitems.cxx:98
virtual ~ScIndexHint() override
Definition: uiitems.cxx:104
const std::vector< editeng::MisspellRanges > * mpMisspellRanges
Definition: uiitems.hxx:50
virtual ~ScInputStatusItem() override
Definition: uiitems.cxx:57
OUString aString
Definition: uiitems.hxx:48
ScAddress aCursorPos
Definition: uiitems.hxx:45
void SetMisspellRanges(const std::vector< editeng::MisspellRanges > *pRanges)
Definition: uiitems.cxx:77
virtual ScInputStatusItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:72
ScAddress aStartPos
Definition: uiitems.hxx:46
ScInputStatusItem(sal_uInt16 nWhich, const ScAddress &rCurPos, const ScAddress &rStartPos, const ScAddress &rEndPos, OUString aString, const EditTextObject *pData)
Status update for entry field.
Definition: uiitems.cxx:33
ScAddress aEndPos
Definition: uiitems.hxx:47
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:61
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:375
virtual ~ScPivotItem() override
Definition: uiitems.cxx:371
ScPivotItem(sal_uInt16 nWhich, const ScDPSaveData *pData, const ScRange *pRange, bool bNew)
Data for the Pivot dialog.
Definition: uiitems.cxx:349
std::unique_ptr< ScDPSaveData > pSaveData
Definition: uiitems.hxx:242
ScRange aDestRange
Definition: uiitems.hxx:243
bool bNewSheet
Definition: uiitems.hxx:244
virtual ScPivotItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:386
ScViewData * pViewData
Definition: uiitems.hxx:170
bool GetAdvancedQuerySource(ScRange &rSource) const
Definition: uiitems.cxx:220
ScRange aAdvSource
Definition: uiitems.hxx:171
bool bIsAdvanced
Definition: uiitems.hxx:172
virtual ~ScQueryItem() override
Definition: uiitems.cxx:200
void SetAdvancedQuerySource(const ScRange *pSource)
Definition: uiitems.cxx:204
virtual ScQueryItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:238
ScQueryItem(sal_uInt16 nWhich, ScViewData *ptrViewData, const ScQueryParam *pQueryData)
Data for the Filter dialog.
Definition: uiitems.cxx:166
std::unique_ptr< ScQueryParam > mpQueryData
Definition: uiitems.hxx:169
const ScQueryParam & GetQueryData() const
Definition: uiitems.cxx:215
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:226
ScSolveParam theSolveData
Definition: uiitems.hxx:259
ScSolveItem(sal_uInt16 nWhich, const ScSolveParam *pParam)
Data for the Solver dialog.
Definition: uiitems.cxx:394
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:401
virtual ScSolveItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:410
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: uiitems.cxx:156
ScViewData * pViewData
Definition: uiitems.hxx:144
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:141
ScSortParam theSortData
Definition: uiitems.hxx:145
virtual ScSortItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:151
ScSortItem(sal_uInt16 nWhich, ScViewData *ptrViewData, const ScSortParam *pSortData)
Data for the sorting dialog.
Definition: uiitems.cxx:124
virtual ScSubTotalItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:265
ScSubTotalItem(sal_uInt16 nWhich, ScViewData *ptrViewData, const ScSubTotalParam *pSubTotalData)
Data for the SubTotal dialog.
Definition: uiitems.cxx:246
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: uiitems.cxx:270
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:255
ScSubTotalParam theSubTotalData
Definition: uiitems.hxx:191
ScViewData * pViewData
Definition: uiitems.hxx:190
ScTabOpItem(sal_uInt16 nWhich, const ScTabOpParam *pParam)
Data for the TabOp dialog.
Definition: uiitems.cxx:418
virtual ScTabOpItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:434
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:425
ScTabOpParam theTabOpData
Definition: uiitems.hxx:274
virtual ~ScTablesHint() override
Definition: uiitems.cxx:94
ScTablesHint(sal_uInt16 nNewId, SCTAB nTable1, SCTAB nTable2=0)
Adapt Views when inserting/deleting a table.
Definition: uiitems.cxx:87
virtual ~ScUserListItem() override
Definition: uiitems.cxx:292
std::unique_ptr< ScUserList > pUserList
Definition: uiitems.hxx:208
void SetUserList(const ScUserList &rUserList)
Definition: uiitems.cxx:316
ScUserListItem(sal_uInt16 nWhich)
Transporter for the UserLIst dialog.
Definition: uiitems.cxx:280
virtual bool operator==(const SfxPoolItem &) const override
Definition: uiitems.cxx:296
virtual ScUserListItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:311
Collection of user-defined sort lists.
Definition: userlist.hxx:62
SfxHintId
sal_Int32 nIndex
std::unique_ptr< sal_Int32[]> pData
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
sal_Int16 nId
Parameter for data table aka multiple operations.
Definition: paramisc.hxx:46
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22