summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputhdl.cxx2
-rw-r--r--sc/source/ui/app/msgpool.cxx21
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx4
-rw-r--r--sc/source/ui/inc/editsh.hxx12
-rw-r--r--sc/source/ui/undo/undoblk3.cxx12
-rw-r--r--sc/source/ui/undo/undocell.cxx12
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/view/cellsh1.cxx8
-rw-r--r--sc/source/ui/view/editsh.cxx27
-rw-r--r--sc/source/ui/view/output.cxx6
-rw-r--r--sc/source/ui/view/output2.cxx70
-rw-r--r--sc/source/ui/view/spelleng.cxx2
-rw-r--r--sc/source/ui/view/tabvwshc.cxx2
-rw-r--r--sc/source/ui/view/viewfunc.cxx10
14 files changed, 101 insertions, 89 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index de2ce3679cca..769f4249a4bf 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2519,7 +2519,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
const ScPatternAttr* pPattern = rDoc.GetPattern( aCursorPos.Col(),
aCursorPos.Row(),
aCursorPos.Tab() );
- if (pPattern != pLastPattern)
+ if (!SfxPoolItem::areSame(pPattern, pLastPattern))
{
// Percent format?
const SfxItemSet& rAttrSet = pPattern->GetItemSet();
diff --git a/sc/source/ui/app/msgpool.cxx b/sc/source/ui/app/msgpool.cxx
index 58daba682830..227dbce4560b 100644
--- a/sc/source/ui/app/msgpool.cxx
+++ b/sc/source/ui/app/msgpool.cxx
@@ -25,16 +25,17 @@
SfxItemInfo const aMsgItemInfos[] =
{
- { 0, true }, // SCITEM_STRING
- { 0, true }, // SCITEM_SEARCHDATA - stop using this!
- { SID_SORT, true }, // SCITEM_SORTDATA
- { SID_QUERY, true }, // SCITEM_QUERYDATA
- { SID_SUBTOTALS, true }, // SCITEM_SUBTDATA
- { SID_CONSOLIDATE, true }, // SCITEM_CONSOLIDATEDATA
- { SID_PIVOT_TABLE, true }, // SCITEM_PIVOTDATA
- { SID_SOLVE, true }, // SCITEM_SOLVEDATA
- { SID_SCUSERLISTS, true }, // SCITEM_USERLIST
- { 0, false } // SCITEM_CONDFORMATDLGDATA
+ // _nSID, _bNeedsPoolRegistration, _bShareable
+ { 0, false, true }, // SCITEM_STRING
+ { 0, false, true }, // SCITEM_SEARCHDATA - stop using this!
+ { SID_SORT, false, true }, // SCITEM_SORTDATA
+ { SID_QUERY, false, true }, // SCITEM_QUERYDATA
+ { SID_SUBTOTALS, false, true }, // SCITEM_SUBTDATA
+ { SID_CONSOLIDATE, false, true }, // SCITEM_CONSOLIDATEDATA
+ { SID_PIVOT_TABLE, false, true }, // SCITEM_PIVOTDATA
+ { SID_SOLVE, false, true }, // SCITEM_SOLVEDATA
+ { SID_SCUSERLISTS, false, true }, // SCITEM_USERLIST
+ { 0, true, false } // SCITEM_CONDFORMATDLGDATA
};
ScMessagePool::ScMessagePool()
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 6fd71f90f6e9..2a1b72459665 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -634,7 +634,7 @@ void ScCondFormatDlg::OkPressed()
pFormat->SetKey(nKey);
pList->InsertNew(std::move(pFormat));
}
- mpViewData->GetViewShell()->GetPool().Put(*mpDlgItem);
+ mpViewData->GetViewShell()->GetPool().DirectPutItemInPool(*mpDlgItem);
SetDispatcherLock( false );
// Queue message to open Conditional Format Manager Dialog
@@ -650,7 +650,7 @@ void ScCondFormatDlg::CancelPressed()
{
if ( mpDlgItem->IsManaged() )
{
- mpViewData->GetViewShell()->GetPool().Put(*mpDlgItem);
+ mpViewData->GetViewShell()->GetPool().DirectPutItemInPool(*mpDlgItem);
SetDispatcherLock( false );
// Queue message to open Conditional Format Manager Dialog
GetBindings().GetDispatcher()->Execute( SID_OPENDLG_CONDFRMT_MANAGER,
diff --git a/sc/source/ui/inc/editsh.hxx b/sc/source/ui/inc/editsh.hxx
index 01457c3b7f2a..3777d1988887 100644
--- a/sc/source/ui/inc/editsh.hxx
+++ b/sc/source/ui/inc/editsh.hxx
@@ -29,7 +29,7 @@ class SfxModule;
class EditView;
class ScViewData;
class ScInputHandler;
-class SvxURLField;
+class SvxFieldData;
class TransferableDataHelper;
class TransferableClipboardListener;
@@ -48,8 +48,14 @@ private:
// currently happens to be when the menu was dismissed.
std::optional<bool> moAtContextMenu_DisableEditHyperlink;
- const SvxURLField* GetURLField();
- const SvxURLField* GetFirstURLFieldFromCell();
+ // These methods did return 'const SvxURLField*' before, but
+ // at least for GetFirstURLFieldFromCell this is not safe: The
+ // SvxFieldItem accessed there and held in the local temporary
+ // SfxItemSet may be deleted with it, so return value can be
+ // corrupted/deleted. To avoid that, return a Clone
+ std::unique_ptr<const SvxFieldData> GetURLField();
+ std::unique_ptr<const SvxFieldData> GetFirstURLFieldFromCell();
+
ScInputHandler* GetMyInputHdl();
DECL_LINK( ClipboardChanged, TransferableDataHelper*, void );
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index f614e0ff0b4a..b7b615d6608f 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -355,20 +355,20 @@ ScUndoSelectionAttr::ScUndoSelectionAttr( ScDocShell* pNewDocShell,
bMulti ( bNewMulti )
{
ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
- pApplyPattern = const_cast<ScPatternAttr*>(&pPool->Put( *pNewApply ));
- pLineOuter = pNewOuter ? const_cast<SvxBoxItem*>( &pPool->Put( *pNewOuter ) ) : nullptr;
- pLineInner = pNewInner ? const_cast<SvxBoxInfoItem*>( &pPool->Put( *pNewInner ) ) : nullptr;
+ pApplyPattern = const_cast<ScPatternAttr*>(&pPool->DirectPutItemInPool( *pNewApply ));
+ pLineOuter = pNewOuter ? const_cast<SvxBoxItem*>( &pPool->DirectPutItemInPool( *pNewOuter ) ) : nullptr;
+ pLineInner = pNewInner ? const_cast<SvxBoxInfoItem*>( &pPool->DirectPutItemInPool( *pNewInner ) ) : nullptr;
aRangeCover = pRangeCover ? *pRangeCover : aRange;
}
ScUndoSelectionAttr::~ScUndoSelectionAttr()
{
ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
- pPool->Remove(*pApplyPattern);
+ pPool->DirectRemoveItemFromPool(*pApplyPattern);
if (pLineOuter)
- pPool->Remove(*pLineOuter);
+ pPool->DirectRemoveItemFromPool(*pLineOuter);
if (pLineInner)
- pPool->Remove(*pLineInner);
+ pPool->DirectRemoveItemFromPool(*pLineInner);
pUndoDoc.reset();
}
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 4cb9d03fed6d..84e4a95bcb1e 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -84,17 +84,17 @@ ScUndoCursorAttr::ScUndoCursorAttr( ScDocShell* pNewDocShell,
pNewEditData( static_cast<EditTextObject*>(nullptr) )
{
ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
- pNewPattern = const_cast<ScPatternAttr*>( &pPool->Put( *pNewPat ) );
- pOldPattern = const_cast<ScPatternAttr*>( &pPool->Put( *pOldPat ) );
- pApplyPattern = const_cast<ScPatternAttr*>( &pPool->Put( *pApplyPat ) );
+ pNewPattern = const_cast<ScPatternAttr*>( &pPool->DirectPutItemInPool( *pNewPat ) );
+ pOldPattern = const_cast<ScPatternAttr*>( &pPool->DirectPutItemInPool( *pOldPat ) );
+ pApplyPattern = const_cast<ScPatternAttr*>( &pPool->DirectPutItemInPool( *pApplyPat ) );
}
ScUndoCursorAttr::~ScUndoCursorAttr()
{
ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
- pPool->Remove(*pNewPattern);
- pPool->Remove(*pOldPattern);
- pPool->Remove(*pApplyPattern);
+ pPool->DirectRemoveItemFromPool(*pNewPattern);
+ pPool->DirectRemoveItemFromPool(*pOldPattern);
+ pPool->DirectRemoveItemFromPool(*pApplyPattern);
}
OUString ScUndoCursorAttr::GetComment() const
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 59d77e3517fa..3325b0bbcf6c 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2448,7 +2448,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntr
case SC_WID_UNO_FORMATID:
{
const ScPatternAttr* pPattern = GetCurrentAttrsFlat();
- rAny <<= pPattern->GetKey();
+ rAny <<= pPattern->GetPAKey();
}
break;
}
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 1b307963dc01..558d5a816615 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2410,7 +2410,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
// Conditional Format Dialog.
ScCondFormatDlgItem aDlgItem(nullptr, nIndex, false);
aDlgItem.SetDialogType(eType);
- pTabViewShell->GetPool().Put(aDlgItem);
+ pTabViewShell->GetPool().DirectPutItemInPool(aDlgItem);
sal_uInt16 nId = ScCondFormatDlgWrapper::GetChildWindowId();
SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
@@ -2878,7 +2878,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
// Put the xml string parameter to initialize the
// Conditional Format Dialog. ( add new )
- pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
+ pTabViewShell->GetPool().DirectPutItemInPool(ScCondFormatDlgItem(
std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), -1, true));
// Queue message to open Conditional Format Dialog
GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
@@ -2889,7 +2889,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
sal_Int32 nIndex = pFormat ? pFormat->GetKey() : -1;
// Put the xml string parameter to initialize the
// Conditional Format Dialog. ( edit selected conditional format )
- pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
+ pTabViewShell->GetPool().DirectPutItemInPool(ScCondFormatDlgItem(
std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), nIndex, true));
// Queue message to open Conditional Format Dialog
@@ -2899,7 +2899,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pCondFormatList.reset();
if (pDlgItem)
- pTabViewShell->GetPool().Remove(*pDlgItem);
+ pTabViewShell->GetPool().DirectRemoveItemFromPool(*pDlgItem);
pDlg->disposeOnce();
});
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 493ab18f78cc..2c4328d78145 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -577,7 +577,8 @@ void ScEditShell::Execute( SfxRequest& rReq )
bool bDone = false;
if ( (eMode == HLINK_DEFAULT || eMode == HLINK_FIELD) && !bCellLinksOnly )
{
- const SvxURLField* pURLField = GetURLField();
+ std::unique_ptr<const SvxFieldData> aSvxFieldDataPtr(GetURLField());
+ const SvxURLField* pURLField(static_cast<const SvxURLField*>(aSvxFieldDataPtr.get()));
if ( pURLField )
{
// select old field
@@ -637,7 +638,8 @@ void ScEditShell::Execute( SfxRequest& rReq )
break;
case SID_OPEN_HYPERLINK:
{
- const SvxURLField* pURLField = GetURLField();
+ std::unique_ptr<const SvxFieldData> aSvxFieldDataPtr(GetURLField());
+ const SvxURLField* pURLField(static_cast<const SvxURLField*>(aSvxFieldDataPtr.get()));
if ( pURLField )
ScGlobal::OpenURL( pURLField->GetURL(), pURLField->GetTargetFrame(), true );
return;
@@ -792,7 +794,8 @@ void ScEditShell::GetState( SfxItemSet& rSet )
bool bCellLinksOnly
= SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
&& rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat();
- const SvxURLField* pURLField = GetURLField();
+ std::unique_ptr<const SvxFieldData> aSvxFieldDataPtr(GetURLField());
+ const SvxURLField* pURLField(static_cast<const SvxURLField*>(aSvxFieldDataPtr.get()));
if (!bCellLinksOnly)
{
if (pURLField)
@@ -814,7 +817,8 @@ void ScEditShell::GetState( SfxItemSet& rSet )
{
if (!pURLField)
{
- pURLField = GetFirstURLFieldFromCell();
+ aSvxFieldDataPtr = GetFirstURLFieldFromCell();
+ pURLField = static_cast<const SvxURLField*>(aSvxFieldDataPtr.get());
}
if (pURLField)
{
@@ -893,21 +897,21 @@ void ScEditShell::GetState( SfxItemSet& rSet )
}
}
-const SvxURLField* ScEditShell::GetURLField()
+std::unique_ptr<const SvxFieldData> ScEditShell::GetURLField()
{
ScInputHandler* pHdl = GetMyInputHdl();
EditView* pActiveView = pHdl ? pHdl->GetActiveView() : pEditView;
if (!pActiveView)
- return nullptr;
+ return std::unique_ptr<const SvxFieldData>();
const SvxFieldData* pField = pActiveView->GetFieldAtCursor();
if (auto pURLField = dynamic_cast<const SvxURLField*>(pField))
- return pURLField;
+ return pURLField->Clone();
- return nullptr;
+ return std::unique_ptr<const SvxFieldData>();
}
-const SvxURLField* ScEditShell::GetFirstURLFieldFromCell()
+std::unique_ptr<const SvxFieldData> ScEditShell::GetFirstURLFieldFromCell()
{
EditEngine* pEE = GetEditView()->GetEditEngine();
sal_Int32 nParaCount = pEE->GetParagraphCount();
@@ -929,14 +933,15 @@ const SvxURLField* ScEditShell::GetFirstURLFieldFromCell()
const SvxFieldData* pField = pItem->GetField();
if (const SvxURLField* pUrlField = dynamic_cast<const SvxURLField*>(pField))
{
- return pUrlField;
+ return pUrlField->Clone();
}
}
}
aSel.nStartPos = aSel.nEndPos;
}
}
- return nullptr;
+
+ return std::unique_ptr<const SvxFieldData>();
}
IMPL_LINK( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHelper, void )
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 8461aaaac446..47fdab381c9f 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -766,14 +766,14 @@ static bool lcl_EqualBack( const RowInfo& rFirst, const RowInfo& rOther,
const ScPatternAttr* pPat1 = rFirst.cellInfo(nX).pPatternAttr;
const ScPatternAttr* pPat2 = rOther.cellInfo(nX).pPatternAttr;
if ( !pPat1 || !pPat2 ||
- &pPat1->GetItem(ATTR_PROTECTION) != &pPat2->GetItem(ATTR_PROTECTION) )
+ !SfxPoolItem::areSame(&pPat1->GetItem(ATTR_PROTECTION), &pPat2->GetItem(ATTR_PROTECTION) ) )
return false;
}
}
else
{
for ( nX=nX1; nX<=nX2; nX++ )
- if ( rFirst.cellInfo(nX).pBackground != rOther.cellInfo(nX).pBackground )
+ if ( !SfxPoolItem::areSame(rFirst.cellInfo(nX).pBackground, rOther.cellInfo(nX).pBackground ) )
return false;
}
@@ -970,7 +970,7 @@ void drawCells(vcl::RenderContext& rRenderContext, std::optional<Color> const &
rRect.SetLeft( nPosX - nSignedOneX );
}
- if ( pOldBackground && (pColor ||pBackground != pOldBackground || pOldDataBarInfo || pDataBarInfo || pIconSetInfo || pOldIconSetInfo) )
+ if ( pOldBackground && (pColor || !SfxPoolItem::areSame(pBackground, pOldBackground) || pOldDataBarInfo || pDataBarInfo || pIconSetInfo || pOldIconSetInfo) )
{
rRect.SetRight( nPosX-nSignedOneX );
if (pOldBackground) // ==0 if hidden
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 1b67ab4f4b24..2d6cda3d652a 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1025,71 +1025,71 @@ static bool StringDiffer( const ScPatternAttr*& rpOldPattern, const ScPatternAtt
{
OSL_ENSURE( pNewPattern, "pNewPattern" );
- if ( pNewPattern == rpOldPattern )
+ if ( SfxPoolItem::areSame( pNewPattern, rpOldPattern ) )
return false;
else if ( !rpOldPattern )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT ) != &rpOldPattern->GetItem( ATTR_FONT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT ), &rpOldPattern->GetItem( ATTR_FONT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_CJK_FONT ) != &rpOldPattern->GetItem( ATTR_CJK_FONT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_CJK_FONT ), &rpOldPattern->GetItem( ATTR_CJK_FONT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_CTL_FONT ) != &rpOldPattern->GetItem( ATTR_CTL_FONT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_CTL_FONT ), &rpOldPattern->GetItem( ATTR_CTL_FONT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_HEIGHT ) != &rpOldPattern->GetItem( ATTR_FONT_HEIGHT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_HEIGHT ), &rpOldPattern->GetItem( ATTR_FONT_HEIGHT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_CJK_FONT_HEIGHT ) != &rpOldPattern->GetItem( ATTR_CJK_FONT_HEIGHT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_CJK_FONT_HEIGHT ), &rpOldPattern->GetItem( ATTR_CJK_FONT_HEIGHT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_CTL_FONT_HEIGHT ) != &rpOldPattern->GetItem( ATTR_CTL_FONT_HEIGHT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_CTL_FONT_HEIGHT ), &rpOldPattern->GetItem( ATTR_CTL_FONT_HEIGHT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_WEIGHT ) != &rpOldPattern->GetItem( ATTR_FONT_WEIGHT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_WEIGHT ), &rpOldPattern->GetItem( ATTR_FONT_WEIGHT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_CJK_FONT_WEIGHT ) != &rpOldPattern->GetItem( ATTR_CJK_FONT_WEIGHT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_CJK_FONT_WEIGHT ), &rpOldPattern->GetItem( ATTR_CJK_FONT_WEIGHT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_CTL_FONT_WEIGHT ) != &rpOldPattern->GetItem( ATTR_CTL_FONT_WEIGHT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_CTL_FONT_WEIGHT ), &rpOldPattern->GetItem( ATTR_CTL_FONT_WEIGHT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_POSTURE ) != &rpOldPattern->GetItem( ATTR_FONT_POSTURE ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_POSTURE ), &rpOldPattern->GetItem( ATTR_FONT_POSTURE ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_CJK_FONT_POSTURE ) != &rpOldPattern->GetItem( ATTR_CJK_FONT_POSTURE ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_CJK_FONT_POSTURE ), &rpOldPattern->GetItem( ATTR_CJK_FONT_POSTURE ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_CTL_FONT_POSTURE ) != &rpOldPattern->GetItem( ATTR_CTL_FONT_POSTURE ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_CTL_FONT_POSTURE ), &rpOldPattern->GetItem( ATTR_CTL_FONT_POSTURE ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_UNDERLINE ) != &rpOldPattern->GetItem( ATTR_FONT_UNDERLINE ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_UNDERLINE ), &rpOldPattern->GetItem( ATTR_FONT_UNDERLINE ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_OVERLINE ) != &rpOldPattern->GetItem( ATTR_FONT_OVERLINE ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_OVERLINE ), &rpOldPattern->GetItem( ATTR_FONT_OVERLINE ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_WORDLINE ) != &rpOldPattern->GetItem( ATTR_FONT_WORDLINE ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_WORDLINE ), &rpOldPattern->GetItem( ATTR_FONT_WORDLINE ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_CROSSEDOUT ) != &rpOldPattern->GetItem( ATTR_FONT_CROSSEDOUT ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_CROSSEDOUT ), &rpOldPattern->GetItem( ATTR_FONT_CROSSEDOUT ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_CONTOUR ) != &rpOldPattern->GetItem( ATTR_FONT_CONTOUR ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_CONTOUR ), &rpOldPattern->GetItem( ATTR_FONT_CONTOUR ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_SHADOWED ) != &rpOldPattern->GetItem( ATTR_FONT_SHADOWED ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_SHADOWED ), &rpOldPattern->GetItem( ATTR_FONT_SHADOWED ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_COLOR ) != &rpOldPattern->GetItem( ATTR_FONT_COLOR ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_COLOR ), &rpOldPattern->GetItem( ATTR_FONT_COLOR ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_HOR_JUSTIFY ) != &rpOldPattern->GetItem( ATTR_HOR_JUSTIFY ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_HOR_JUSTIFY ), &rpOldPattern->GetItem( ATTR_HOR_JUSTIFY ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_HOR_JUSTIFY_METHOD ) != &rpOldPattern->GetItem( ATTR_HOR_JUSTIFY_METHOD ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_HOR_JUSTIFY_METHOD ), &rpOldPattern->GetItem( ATTR_HOR_JUSTIFY_METHOD ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_VER_JUSTIFY ) != &rpOldPattern->GetItem( ATTR_VER_JUSTIFY ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_VER_JUSTIFY ), &rpOldPattern->GetItem( ATTR_VER_JUSTIFY ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_VER_JUSTIFY_METHOD ) != &rpOldPattern->GetItem( ATTR_VER_JUSTIFY_METHOD ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_VER_JUSTIFY_METHOD ), &rpOldPattern->GetItem( ATTR_VER_JUSTIFY_METHOD ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_STACKED ) != &rpOldPattern->GetItem( ATTR_STACKED ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_STACKED ), &rpOldPattern->GetItem( ATTR_STACKED ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_LINEBREAK ) != &rpOldPattern->GetItem( ATTR_LINEBREAK ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_LINEBREAK ), &rpOldPattern->GetItem( ATTR_LINEBREAK ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_MARGIN ) != &rpOldPattern->GetItem( ATTR_MARGIN ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_MARGIN ), &rpOldPattern->GetItem( ATTR_MARGIN ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_ROTATE_VALUE ) != &rpOldPattern->GetItem( ATTR_ROTATE_VALUE ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_ROTATE_VALUE ), &rpOldPattern->GetItem( ATTR_ROTATE_VALUE ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FORBIDDEN_RULES ) != &rpOldPattern->GetItem( ATTR_FORBIDDEN_RULES ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FORBIDDEN_RULES ), &rpOldPattern->GetItem( ATTR_FORBIDDEN_RULES ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_EMPHASISMARK ) != &rpOldPattern->GetItem( ATTR_FONT_EMPHASISMARK ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_EMPHASISMARK ), &rpOldPattern->GetItem( ATTR_FONT_EMPHASISMARK ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_FONT_RELIEF ) != &rpOldPattern->GetItem( ATTR_FONT_RELIEF ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_FONT_RELIEF ), &rpOldPattern->GetItem( ATTR_FONT_RELIEF ) ) )
return true;
- else if ( &pNewPattern->GetItem( ATTR_BACKGROUND ) != &rpOldPattern->GetItem( ATTR_BACKGROUND ) )
+ else if ( !SfxPoolItem::areSame( &pNewPattern->GetItem( ATTR_BACKGROUND ), &rpOldPattern->GetItem( ATTR_BACKGROUND ) ) )
return true; // needed with automatic text color
else
{
@@ -1714,7 +1714,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
if (nScript == SvtScriptType::NONE)
nScript = ScGlobal::GetDefaultScriptType();
- if ( pPattern != pOldPattern || pCondSet != pOldCondSet ||
+ if ( !SfxPoolItem::areSame(pPattern, pOldPattern) || pCondSet != pOldCondSet ||
nScript != nOldScript || mbSyntaxMode )
{
if ( StringDiffer(pOldPattern,pPattern) ||
@@ -2488,7 +2488,7 @@ void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor)
// syntax highlighting mode is ignored here
// StringDiffer doesn't look at hyphenate, language items
- if (mpPattern == mpOldPattern && mpCondSet == mpOldCondSet && mpPreviewFontSet == mpOldPreviewFontSet )
+ if (SfxPoolItem::areSame(mpPattern, mpOldPattern) && mpCondSet == mpOldCondSet && mpPreviewFontSet == mpOldPreviewFontSet )
return;
Color nConfBackColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
@@ -4701,7 +4701,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
// syntax mode is ignored here...
// StringDiffer doesn't look at hyphenate, language items
- if ( pPattern != pOldPattern || pCondSet != pOldCondSet )
+ if ( !SfxPoolItem::areSame(pPattern, pOldPattern) || pCondSet != pOldCondSet )
{
auto pSet = std::make_unique<SfxItemSet>( mxOutputEditEngine->GetEmptyItemSet() );
pPattern->FillEditItemSet( pSet.get(), pCondSet );
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index f325d7dd556c..ae50d82930ee 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -209,7 +209,7 @@ bool ScConversionEngineBase::FindNextConversionCell()
{
// GetPattern may implicitly allocates the column if not exists,
pPattern = mrDoc.GetPattern( nNewCol, nNewRow, mnStartTab );
- if( pPattern && (pPattern != pLastPattern) )
+ if( pPattern && !SfxPoolItem::areSame(pPattern, pLastPattern) )
{
pPattern->FillEditItemSet( &aEditDefaults );
SetDefaults( aEditDefaults );
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 47a15f64a7c9..d253e8102396 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -440,7 +440,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
xResult = std::make_shared<ScCondFormatDlg>(pB, pCW, pParent, &rViewData, pDlgItem);
// Remove the pool item stored by Conditional Format Manager Dialog.
- GetPool().Remove(*pDlgItem);
+ GetPool().DirectRemoveItemFromPool(*pDlgItem);
}
break;
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index af0dc57357f9..cffb0dcab5c9 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1050,8 +1050,8 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
SfxItemPool* pNewPool = rNewSet.GetPool();
- pNewPool->Put(rNewOuter); // don't delete yet
- pNewPool->Put(rNewInner);
+ pNewPool->DirectPutItemInPool(rNewOuter); // don't delete yet
+ pNewPool->DirectPutItemInPool(rNewInner);
rNewSet.ClearItem( ATTR_BORDER );
rNewSet.ClearItem( ATTR_BORDER_INNER );
@@ -1065,7 +1065,7 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
bool bFrame = (pDialogSet->GetItemState( ATTR_BORDER ) != SfxItemState::DEFAULT)
|| (pDialogSet->GetItemState( ATTR_BORDER_INNER ) != SfxItemState::DEFAULT);
- if (&rNewOuter == &rOldOuter && &rNewInner == &rOldInner)
+ if (SfxPoolItem::areSame(&rNewOuter, &rOldOuter) && SfxPoolItem::areSame(&rNewInner, &rOldInner))
bFrame = false;
// this should be intercepted by the pool: ?!??!??
@@ -1095,8 +1095,8 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
bDefNewInner ? &rOldInner : &rNewInner );
}
- pNewPool->Remove(rNewOuter); // release
- pNewPool->Remove(rNewInner);
+ pNewPool->DirectRemoveItemFromPool(rNewOuter); // release
+ pNewPool->DirectRemoveItemFromPool(rNewInner);
// adjust height only if needed
if (bAdjustBlockHeight)