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