1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: uiitems.cxx,v $
10 * $Revision: 1.9.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 #include <svx/editobj.hxx>
38 #include "userlist.hxx"
39 #include "uiitems.hxx"
42 // STATIC DATA -----------------------------------------------------------
44 TYPEINIT1(ScInputStatusItem
, SfxPoolItem
);
45 TYPEINIT1(ScSortItem
, SfxPoolItem
);
46 TYPEINIT1(ScQueryItem
, SfxPoolItem
);
47 TYPEINIT1(ScSubTotalItem
, SfxPoolItem
);
48 TYPEINIT1(ScUserListItem
, SfxPoolItem
);
49 TYPEINIT1(ScConsolidateItem
, SfxPoolItem
);
50 TYPEINIT1(ScPivotItem
, SfxPoolItem
);
51 TYPEINIT1(ScSolveItem
, SfxPoolItem
);
52 TYPEINIT1(ScTabOpItem
, SfxPoolItem
);
53 TYPEINIT1(ScCondFrmtItem
, SfxPoolItem
);
55 TYPEINIT1(ScTablesHint
, SfxHint
);
56 TYPEINIT1(ScEditViewHint
, SfxHint
);
57 TYPEINIT1(ScIndexHint
, SfxHint
);
59 // -----------------------------------------------------------------------
60 // ScInputStatusItem - Status-Update fuer Eingabezeile
61 // -----------------------------------------------------------------------
63 //UNUSED2008-05 ScInputStatusItem::ScInputStatusItem( USHORT nWhichP,
64 //UNUSED2008-05 SCTAB nTab,
65 //UNUSED2008-05 SCCOL nCol, SCROW nRow,
66 //UNUSED2008-05 SCCOL nStartCol, SCROW nStartRow,
67 //UNUSED2008-05 SCCOL nEndCol, SCROW nEndRow,
68 //UNUSED2008-05 const String& rString, const EditTextObject* pData )
70 //UNUSED2008-05 : SfxPoolItem ( nWhichP ),
71 //UNUSED2008-05 aCursorPos ( nCol, nRow, nTab ),
72 //UNUSED2008-05 aStartPos ( nStartCol, nStartRow, nTab ),
73 //UNUSED2008-05 aEndPos ( nEndCol, nEndRow, nTab ),
74 //UNUSED2008-05 aString ( rString ),
75 //UNUSED2008-05 pEditData ( pData ? pData->Clone() : NULL )
79 ScInputStatusItem::ScInputStatusItem( USHORT nWhichP
,
80 const ScAddress
& rCurPos
,
81 const ScAddress
& rStartPos
,
82 const ScAddress
& rEndPos
,
83 const String
& rString
,
84 const EditTextObject
* pData
)
85 : SfxPoolItem ( nWhichP
),
86 aCursorPos ( rCurPos
),
87 aStartPos ( rStartPos
),
90 pEditData ( pData
? pData
->Clone() : NULL
)
94 ScInputStatusItem::ScInputStatusItem( const ScInputStatusItem
& rItem
)
95 : SfxPoolItem ( rItem
),
96 aCursorPos ( rItem
.aCursorPos
),
97 aStartPos ( rItem
.aStartPos
),
98 aEndPos ( rItem
.aEndPos
),
99 aString ( rItem
.aString
),
100 pEditData ( rItem
.pEditData
? rItem
.pEditData
->Clone() : NULL
)
104 __EXPORT
ScInputStatusItem::~ScInputStatusItem()
109 String __EXPORT
ScInputStatusItem::GetValueText() const
111 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("InputStatus"));
114 int __EXPORT
ScInputStatusItem::operator==( const SfxPoolItem
& rItem
) const
116 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
118 return ( (aStartPos
== ((ScInputStatusItem
&)rItem
).aStartPos
)
119 && (aEndPos
== ((ScInputStatusItem
&)rItem
).aEndPos
)
120 && (aCursorPos
== ((ScInputStatusItem
&)rItem
).aCursorPos
)
121 && (aString
== ((ScInputStatusItem
&)rItem
).aString
) );
122 //! Edit-Daten vergleichen!
125 SfxPoolItem
* __EXPORT
ScInputStatusItem::Clone( SfxItemPool
* ) const
127 return new ScInputStatusItem( *this );
131 // ScPaintHint ist nach schints.cxx verschoben
134 // -----------------------------------------------------------------------
135 // ScTablesHint - Views anpassen, wenn Tabellen eingefuegt / geloescht
136 // -----------------------------------------------------------------------
138 ScTablesHint::ScTablesHint(USHORT nNewId
, SCTAB nTable1
, SCTAB nTable2
) :
145 ScTablesHint::~ScTablesHint()
150 // -----------------------------------------------------------------------
152 // -----------------------------------------------------------------------
154 ScIndexHint::ScIndexHint(USHORT nNewId
, USHORT nIdx
) :
160 ScIndexHint::~ScIndexHint()
165 // -----------------------------------------------------------------------
166 // ScEditViewHint - neue EditView fuer Cursorposition anlegen
167 // -----------------------------------------------------------------------
169 ScEditViewHint::ScEditViewHint( ScEditEngineDefaulter
* pEngine
, const ScAddress
& rCurPos
) :
170 pEditEngine( pEngine
),
171 aCursorPos( rCurPos
)
175 ScEditViewHint::~ScEditViewHint()
179 // -----------------------------------------------------------------------
180 // ScSortItem - Daten fuer den Sortierdialog
181 // -----------------------------------------------------------------------
183 ScSortItem::ScSortItem( USHORT nWhichP
,
184 ScViewData
* ptrViewData
,
185 const ScSortParam
* pSortData
) :
186 SfxPoolItem ( nWhichP
),
187 pViewData ( ptrViewData
)
189 if ( pSortData
) theSortData
= *pSortData
;
192 //------------------------------------------------------------------------
194 ScSortItem::ScSortItem( USHORT nWhichP
,
195 const ScSortParam
* pSortData
) :
196 SfxPoolItem ( nWhichP
),
199 if ( pSortData
) theSortData
= *pSortData
;
202 //------------------------------------------------------------------------
204 ScSortItem::ScSortItem( const ScSortItem
& rItem
) :
205 SfxPoolItem ( rItem
),
206 pViewData ( rItem
.pViewData
),
207 theSortData ( rItem
.theSortData
)
211 __EXPORT
ScSortItem::~ScSortItem()
215 //------------------------------------------------------------------------
217 String __EXPORT
ScSortItem::GetValueText() const
219 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("SortItem"));
222 //------------------------------------------------------------------------
224 int __EXPORT
ScSortItem::operator==( const SfxPoolItem
& rItem
) const
226 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
228 const ScSortItem
& rOther
= (const ScSortItem
&)rItem
;
230 return ( (pViewData
== rOther
.pViewData
)
231 && (theSortData
== rOther
.theSortData
) );
234 //------------------------------------------------------------------------
236 SfxPoolItem
* __EXPORT
ScSortItem::Clone( SfxItemPool
* ) const
238 return new ScSortItem( *this );
241 //------------------------------------------------------------------------
243 sal_Bool
ScSortItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/* nMemberUd */ ) const
245 // Return empty value as there is no useful conversion
246 rVal
= com::sun::star::uno::Any();
250 // -----------------------------------------------------------------------
251 // ScQueryItem - Daten fuer den Filterdialog
252 // -----------------------------------------------------------------------
254 ScQueryItem::ScQueryItem( USHORT nWhichP
,
255 ScViewData
* ptrViewData
,
256 const ScQueryParam
* pQueryData
) :
257 SfxPoolItem ( nWhichP
),
258 pViewData ( ptrViewData
),
259 bIsAdvanced ( FALSE
)
261 if ( pQueryData
) theQueryData
= *pQueryData
;
264 //------------------------------------------------------------------------
266 ScQueryItem::ScQueryItem( USHORT nWhichP
,
267 const ScQueryParam
* pQueryData
) :
268 SfxPoolItem ( nWhichP
),
270 bIsAdvanced ( FALSE
)
272 if ( pQueryData
) theQueryData
= *pQueryData
;
275 //------------------------------------------------------------------------
277 ScQueryItem::ScQueryItem( const ScQueryItem
& rItem
) :
278 SfxPoolItem ( rItem
),
279 pViewData ( rItem
.pViewData
),
280 theQueryData( rItem
.theQueryData
),
281 bIsAdvanced ( rItem
.bIsAdvanced
),
282 aAdvSource ( rItem
.aAdvSource
)
286 __EXPORT
ScQueryItem::~ScQueryItem()
290 //------------------------------------------------------------------------
292 void ScQueryItem::SetAdvancedQuerySource(const ScRange
* pSource
)
296 aAdvSource
= *pSource
;
303 BOOL
ScQueryItem::GetAdvancedQuerySource(ScRange
& rSource
) const
305 rSource
= aAdvSource
;
309 //------------------------------------------------------------------------
311 String __EXPORT
ScQueryItem::GetValueText() const
313 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("QueryItem"));
316 //------------------------------------------------------------------------
318 int __EXPORT
ScQueryItem::operator==( const SfxPoolItem
& rItem
) const
320 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
322 const ScQueryItem
& rQueryItem
= (const ScQueryItem
&)rItem
;
324 return ( (pViewData
== rQueryItem
.pViewData
)
325 && (bIsAdvanced
== rQueryItem
.bIsAdvanced
)
326 && (aAdvSource
== rQueryItem
.aAdvSource
)
327 && (theQueryData
== rQueryItem
.theQueryData
) );
330 //------------------------------------------------------------------------
332 SfxPoolItem
* __EXPORT
ScQueryItem::Clone( SfxItemPool
* ) const
334 return new ScQueryItem( *this );
337 // -----------------------------------------------------------------------
338 // ScSubTotalItem - Daten fuer den Zwischenergebnisdialog
339 // -----------------------------------------------------------------------
341 ScSubTotalItem::ScSubTotalItem( USHORT nWhichP
,
342 ScViewData
* ptrViewData
,
343 const ScSubTotalParam
* pSubTotalData
) :
344 SfxPoolItem ( nWhichP
),
345 pViewData ( ptrViewData
)
347 if ( pSubTotalData
) theSubTotalData
= *pSubTotalData
;
350 //------------------------------------------------------------------------
352 ScSubTotalItem::ScSubTotalItem( USHORT nWhichP
,
353 const ScSubTotalParam
* pSubTotalData
) :
354 SfxPoolItem ( nWhichP
),
357 if ( pSubTotalData
) theSubTotalData
= *pSubTotalData
;
360 //------------------------------------------------------------------------
362 ScSubTotalItem::ScSubTotalItem( const ScSubTotalItem
& rItem
) :
363 SfxPoolItem ( rItem
),
364 pViewData ( rItem
.pViewData
),
365 theSubTotalData ( rItem
.theSubTotalData
)
369 __EXPORT
ScSubTotalItem::~ScSubTotalItem()
373 //------------------------------------------------------------------------
375 String __EXPORT
ScSubTotalItem::GetValueText() const
377 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("SubTotalItem"));
380 //------------------------------------------------------------------------
382 int __EXPORT
ScSubTotalItem::operator==( const SfxPoolItem
& rItem
) const
384 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
386 const ScSubTotalItem
& rSTItem
= (const ScSubTotalItem
&)rItem
;
388 return ( (pViewData
== rSTItem
.pViewData
)
389 && (theSubTotalData
== rSTItem
.theSubTotalData
) );
392 //------------------------------------------------------------------------
394 SfxPoolItem
* __EXPORT
ScSubTotalItem::Clone( SfxItemPool
* ) const
396 return new ScSubTotalItem( *this );
399 //------------------------------------------------------------------------
401 sal_Bool
ScSubTotalItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/* nMemberUd */ ) const
403 // Return empty value as there is no useful conversion
404 rVal
= com::sun::star::uno::Any();
408 // -----------------------------------------------------------------------
409 // ScUserListItem - Transporter fuer den Benutzerlisten-TabPage
410 // -----------------------------------------------------------------------
412 ScUserListItem::ScUserListItem( USHORT nWhichP
)
413 : SfxPoolItem ( nWhichP
),
418 //------------------------------------------------------------------------
420 ScUserListItem::ScUserListItem( const ScUserListItem
& rItem
)
421 : SfxPoolItem ( rItem
)
423 if ( rItem
.pUserList
)
424 pUserList
= new ScUserList( *(rItem
.pUserList
) );
429 __EXPORT
ScUserListItem::~ScUserListItem()
434 //------------------------------------------------------------------------
436 String __EXPORT
ScUserListItem::GetValueText() const
438 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScUserListItem"));
441 //------------------------------------------------------------------------
443 int __EXPORT
ScUserListItem::operator==( const SfxPoolItem
& rItem
) const
445 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
447 const ScUserListItem
& r
= (const ScUserListItem
&)rItem
;
450 if ( !pUserList
|| !(r
.pUserList
) )
451 bEqual
= ( !pUserList
&& !(r
.pUserList
) );
453 bEqual
= ( *pUserList
== *(r
.pUserList
) );
459 //------------------------------------------------------------------------
461 SfxPoolItem
* __EXPORT
ScUserListItem::Clone( SfxItemPool
* ) const
463 return new ScUserListItem( *this );
466 //------------------------------------------------------------------------
468 void ScUserListItem::SetUserList( const ScUserList
& rUserList
)
471 pUserList
= new ScUserList( rUserList
);
474 // -----------------------------------------------------------------------
475 // ScConsolidateItem - Daten fuer den Konsolidieren-Dialog
476 // -----------------------------------------------------------------------
478 ScConsolidateItem::ScConsolidateItem(
480 const ScConsolidateParam
* pConsolidateData
) :
481 SfxPoolItem ( nWhichP
)
483 if ( pConsolidateData
) theConsData
= *pConsolidateData
;
486 //------------------------------------------------------------------------
488 ScConsolidateItem::ScConsolidateItem( const ScConsolidateItem
& rItem
) :
489 SfxPoolItem ( rItem
),
490 theConsData ( rItem
.theConsData
)
494 //------------------------------------------------------------------------
496 __EXPORT
ScConsolidateItem::~ScConsolidateItem()
500 //------------------------------------------------------------------------
502 String __EXPORT
ScConsolidateItem::GetValueText() const
504 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScConsolidateItem"));
507 //------------------------------------------------------------------------
509 int __EXPORT
ScConsolidateItem::operator==( const SfxPoolItem
& rItem
) const
511 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
513 const ScConsolidateItem
& rCItem
= (const ScConsolidateItem
&)rItem
;
515 return ( theConsData
== rCItem
.theConsData
);
518 //------------------------------------------------------------------------
520 SfxPoolItem
* __EXPORT
ScConsolidateItem::Clone( SfxItemPool
* ) const
522 return new ScConsolidateItem( *this );
526 // -----------------------------------------------------------------------
527 // ScPivotItem - Daten fuer den Pivot-Dialog
528 // -----------------------------------------------------------------------
530 ScPivotItem::ScPivotItem( USHORT nWhichP
, const ScDPSaveData
* pData
,
531 const ScRange
* pRange
, BOOL bNew
) :
532 SfxPoolItem ( nWhichP
)
534 // pSaveData must always exist
536 pSaveData
= new ScDPSaveData(*pData
);
538 pSaveData
= new ScDPSaveData
;
539 if ( pRange
) aDestRange
= *pRange
;
543 //------------------------------------------------------------------------
545 ScPivotItem::ScPivotItem( const ScPivotItem
& rItem
) :
546 SfxPoolItem ( rItem
),
547 aDestRange ( rItem
.aDestRange
),
548 bNewSheet ( rItem
.bNewSheet
)
550 DBG_ASSERT(rItem
.pSaveData
, "pSaveData");
551 pSaveData
= new ScDPSaveData(*rItem
.pSaveData
);
554 //------------------------------------------------------------------------
556 __EXPORT
ScPivotItem::~ScPivotItem()
561 //------------------------------------------------------------------------
563 String __EXPORT
ScPivotItem::GetValueText() const
565 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScPivotItem"));
568 //------------------------------------------------------------------------
570 int __EXPORT
ScPivotItem::operator==( const SfxPoolItem
& rItem
) const
572 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
574 const ScPivotItem
& rPItem
= (const ScPivotItem
&)rItem
;
575 DBG_ASSERT( pSaveData
&& rPItem
.pSaveData
, "pSaveData" );
576 return ( *pSaveData
== *rPItem
.pSaveData
&&
577 aDestRange
== rPItem
.aDestRange
&&
578 bNewSheet
== rPItem
.bNewSheet
);
581 //------------------------------------------------------------------------
583 SfxPoolItem
* __EXPORT
ScPivotItem::Clone( SfxItemPool
* ) const
585 return new ScPivotItem( *this );
589 // -----------------------------------------------------------------------
590 // ScSolveItem - Daten fuer den Solver-Dialog
591 // -----------------------------------------------------------------------
593 ScSolveItem::ScSolveItem( USHORT nWhichP
,
594 const ScSolveParam
* pSolveData
)
595 : SfxPoolItem ( nWhichP
)
597 if ( pSolveData
) theSolveData
= *pSolveData
;
600 //------------------------------------------------------------------------
602 ScSolveItem::ScSolveItem( const ScSolveItem
& rItem
)
603 : SfxPoolItem ( rItem
),
604 theSolveData ( rItem
.theSolveData
)
608 //------------------------------------------------------------------------
610 __EXPORT
ScSolveItem::~ScSolveItem()
614 //------------------------------------------------------------------------
616 String __EXPORT
ScSolveItem::GetValueText() const
618 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScSolveItem"));
621 //------------------------------------------------------------------------
623 int __EXPORT
ScSolveItem::operator==( const SfxPoolItem
& rItem
) const
625 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
627 const ScSolveItem
& rPItem
= (const ScSolveItem
&)rItem
;
629 return ( theSolveData
== rPItem
.theSolveData
);
632 //------------------------------------------------------------------------
634 SfxPoolItem
* __EXPORT
ScSolveItem::Clone( SfxItemPool
* ) const
636 return new ScSolveItem( *this );
639 // -----------------------------------------------------------------------
640 // ScTabOpItem - Daten fuer den TabOp-Dialog
641 // -----------------------------------------------------------------------
643 ScTabOpItem::ScTabOpItem( USHORT nWhichP
,
644 const ScTabOpParam
* pTabOpData
)
645 : SfxPoolItem ( nWhichP
)
647 if ( pTabOpData
) theTabOpData
= *pTabOpData
;
650 //------------------------------------------------------------------------
652 ScTabOpItem::ScTabOpItem( const ScTabOpItem
& rItem
)
653 : SfxPoolItem ( rItem
),
654 theTabOpData ( rItem
.theTabOpData
)
658 //------------------------------------------------------------------------
660 __EXPORT
ScTabOpItem::~ScTabOpItem()
664 //------------------------------------------------------------------------
666 String __EXPORT
ScTabOpItem::GetValueText() const
668 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScTabOpItem"));
671 //------------------------------------------------------------------------
673 int __EXPORT
ScTabOpItem::operator==( const SfxPoolItem
& rItem
) const
675 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
677 const ScTabOpItem
& rPItem
= (const ScTabOpItem
&)rItem
;
679 return ( theTabOpData
== rPItem
.theTabOpData
);
682 //------------------------------------------------------------------------
684 SfxPoolItem
* __EXPORT
ScTabOpItem::Clone( SfxItemPool
* ) const
686 return new ScTabOpItem( *this );
690 // -----------------------------------------------------------------------
691 // ScCondFrmtItem - Daten fuer den Dialog bedingte Formatierung
692 // -----------------------------------------------------------------------
694 ScCondFrmtItem::ScCondFrmtItem( USHORT nWhichP
,
695 //! const ScConditionalFormat* pCondFrmt )
696 const ScConditionalFormat
& rCondFrmt
)
697 : SfxPoolItem ( nWhichP
),
698 theCondFrmtData ( rCondFrmt
) //!
700 //! if ( pCondFrmt ) theCondFrmtData = *pCondFrmt;
703 //------------------------------------------------------------------------
705 ScCondFrmtItem::ScCondFrmtItem( const ScCondFrmtItem
& rItem
)
706 : SfxPoolItem ( rItem
),
707 theCondFrmtData ( rItem
.theCondFrmtData
)
711 //------------------------------------------------------------------------
713 __EXPORT
ScCondFrmtItem::~ScCondFrmtItem()
717 //------------------------------------------------------------------------
719 String __EXPORT
ScCondFrmtItem::GetValueText() const
721 return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScCondFrmtItem"));
724 //------------------------------------------------------------------------
726 int __EXPORT
ScCondFrmtItem::operator==( const SfxPoolItem
& rItem
) const
728 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
730 const ScCondFrmtItem
& rPItem
= (const ScCondFrmtItem
&)rItem
;
732 return ( theCondFrmtData
== rPItem
.theCondFrmtData
);
735 //------------------------------------------------------------------------
737 SfxPoolItem
* __EXPORT
ScCondFrmtItem::Clone( SfxItemPool
* ) const
739 return new ScCondFrmtItem( *this );