[Libreoffice-commits] .: 9 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Feb 2 21:02:41 PST 2012
sc/inc/chartlis.hxx | 4
sc/inc/chgtrack.hxx | 1668 ++++++++---------
sc/inc/document.hxx | 1
sc/source/core/data/documen2.cxx | 2
sc/source/core/data/documen5.cxx | 20
sc/source/core/tool/chartlis.cxx | 5
sc/source/core/tool/chgtrack.cxx | 922 +++++----
sc/source/filter/xcl97/XclExpChangeTrack.cxx | 11
sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx | 8
sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 23
sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx | 2
sc/source/filter/xml/xmlimprt.cxx | 2
sc/source/ui/docshell/docsh3.cxx | 15
sc/source/ui/miscdlgs/acredlin.cxx | 44
sc/source/ui/miscdlgs/conflictsdlg.cxx | 6
sc/source/ui/miscdlgs/highred.cxx | 7
sc/source/ui/miscdlgs/redcom.cxx | 2
sc/source/ui/view/gridwin5.cxx | 4
sc/source/ui/view/output.cxx | 21
sc/source/ui/view/viewutil.cxx | 15
20 files changed, 1445 insertions(+), 1337 deletions(-)
New commits:
commit 5477b6f5fb1f91378c049308d7031bb5c25c3931
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Fri Feb 3 00:02:01 2012 -0500
More on eradicating String in favor of rtl::OUString.
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index c44da6a..c4cb308 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -533,16 +533,12 @@ class ScChangeActionDel : public ScChangeAction
virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; }
public:
- ScChangeActionDel(const sal_uLong nActionNumber,
- const ScChangeActionState eState,
- const sal_uLong nRejectingNumber,
- const ScBigRange& aBigRange,
- const String& aUser,
- const DateTime& aDateTime,
- const String &sComment,
- const ScChangeActionType eType,
- const SCsCOLROW nD,
- ScChangeTrack* pTrack); // only to use in the XML import
+ ScChangeActionDel(
+ const sal_uLong nActionNumber, const ScChangeActionState eState,
+ const sal_uLong nRejectingNumber, const ScBigRange& aBigRange,
+ const rtl::OUString& aUser, const DateTime& aDateTime,
+ const rtl::OUString &sComment, const ScChangeActionType eType,
+ const SCsCOLROW nD, ScChangeTrack* pTrack); // only to use in the XML import
// which of nDx and nDy is set is dependend on the type
// is the last in a row (or single)
@@ -632,9 +628,9 @@ public:
const ScChangeActionState eState,
const sal_uLong nRejectingNumber,
const ScBigRange& aToBigRange,
- const String& aUser,
+ const rtl::OUString& aUser,
const DateTime& aDateTime,
- const String &sComment,
+ const rtl::OUString &sComment,
const ScBigRange& aFromBigRange,
ScChangeTrack* pTrack); // only to use in the XML import
@@ -743,8 +739,9 @@ class ScChangeActionContent : public ScChangeAction
bool Select( ScDocument*, ScChangeTrack*,
bool bOldest, ::std::stack<ScChangeActionContent*>* pRejectActions );
- void PutValueToDoc( ScBaseCell*, const String&,
- ScDocument*, SCsCOL nDx, SCsROW nDy ) const;
+ void PutValueToDoc(
+ ScBaseCell* pCell, const rtl::OUString& rValue, ScDocument* pDoc,
+ SCsCOL nDx, SCsROW nDy ) const;
protected:
using ScChangeAction::GetRefString;
@@ -762,21 +759,18 @@ public:
pNextInSlot( NULL ),
ppPrevInSlot( NULL )
{}
- ScChangeActionContent(const sal_uLong nActionNumber,
- const ScChangeActionState eState,
- const sal_uLong nRejectingNumber,
- const ScBigRange& aBigRange,
- const String& aUser,
- const DateTime& aDateTime,
- const String &sComment,
- ScBaseCell* pOldCell,
- ScDocument* pDoc,
- const String& sOldValue); // to use for XML Import
- ScChangeActionContent(const sal_uLong nActionNumber,
- ScBaseCell* pNewCell,
- const ScBigRange& aBigRange,
- ScDocument* pDoc,
- const String& sNewValue); // to use for XML Import of Generated Actions
+ ScChangeActionContent(
+ const sal_uLong nActionNumber, const ScChangeActionState eState,
+ const sal_uLong nRejectingNumber, const ScBigRange& aBigRange,
+ const rtl::OUString& aUser, const DateTime& aDateTime,
+ const rtl::OUString &sComment, ScBaseCell* pOldCell,
+ ScDocument* pDoc, const rtl::OUString& sOldValue); // to use for XML Import
+
+ ScChangeActionContent(
+ const sal_uLong nActionNumber, ScBaseCell* pNewCell,
+ const ScBigRange& aBigRange, ScDocument* pDoc,
+ const rtl::OUString& sNewValue); // to use for XML Import of Generated Actions
+
virtual ~ScChangeActionContent();
ScChangeActionContent* GetNextContent() const { return pNextContent; }
@@ -807,9 +801,10 @@ public:
sal_uLong nOldFormat, ScBaseCell* pNewCell,
sal_uLong nNewFormat, ScDocument* pDoc );
- // Use this only in the XML import,
- // takes ownership of cell.
- void SetNewCell( ScBaseCell* pCell, ScDocument* pDoc, const String& rFormatted );
+ // Use this only in the XML import,
+ // takes ownership of cell.
+ void SetNewCell(
+ ScBaseCell* pCell, ScDocument* pDoc, const rtl::OUString& rFormatted );
// These functions should be protected but for
// the XML import they are public.
@@ -869,9 +864,9 @@ public:
const ScChangeActionState eState,
const sal_uLong nRejectingNumber,
const ScBigRange& aBigRange,
- const String& aUser,
+ const rtl::OUString& aUser,
const DateTime& aDateTime,
- const String &sComment); // only to use in the XML import
+ const rtl::OUString &sComment); // only to use in the XML import
};
@@ -1266,8 +1261,8 @@ public:
sal_uInt16 GetLoadedFileFormatVersion() const
{ return nLoadedFileFormatVersion; }
- sal_uLong AddLoadedGenerated(ScBaseCell* pOldCell,
- const ScBigRange& aBigRange, const String& sNewValue ); // only to use in the XML import
+ sal_uLong AddLoadedGenerated(
+ ScBaseCell* pOldCell, const ScBigRange& aBigRange, const rtl::OUString& sNewValue ); // only to use in the XML import
void AppendLoaded( ScChangeAction* pAppend ); // this is only for the XML import public, it should be protected
void SetActionMax(sal_uLong nTempActionMax)
{ nActionMax = nTempActionMax; } // only to use in the XML import
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index d6f7f20..b86e3b0 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -858,18 +858,19 @@ ScChangeActionDel::ScChangeActionDel( const ScRange& rRange,
}
-ScChangeActionDel::ScChangeActionDel(const sal_uLong nActionNumber, const ScChangeActionState eStateP, const sal_uLong nRejectingNumber,
- const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String &sComment,
- const ScChangeActionType eTypeP, const SCsCOLROW nD, ScChangeTrack* pTrackP) // wich of nDx and nDy is set is depend on the type
- :
- ScChangeAction(eTypeP, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
- pTrack( pTrackP ),
- pFirstCell( NULL ),
- pCutOff( NULL ),
- nCutOff( 0 ),
- pLinkMove( NULL ),
- nDx( 0 ),
- nDy( 0 )
+ScChangeActionDel::ScChangeActionDel(
+ const sal_uLong nActionNumber, const ScChangeActionState eStateP,
+ const sal_uLong nRejectingNumber, const ScBigRange& aBigRangeP,
+ const rtl::OUString& aUserP, const DateTime& aDateTimeP, const rtl::OUString &sComment,
+ const ScChangeActionType eTypeP, const SCsCOLROW nD, ScChangeTrack* pTrackP) : // wich of nDx and nDy is set is depend on the type
+ ScChangeAction(eTypeP, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
+ pTrack( pTrackP ),
+ pFirstCell( NULL ),
+ pCutOff( NULL ),
+ nCutOff( 0 ),
+ pLinkMove( NULL ),
+ nDx( 0 ),
+ nDy( 0 )
{
if (eType == SC_CAT_DELETE_COLS)
nDx = static_cast<SCsCOL>(nD);
@@ -1202,16 +1203,18 @@ void ScChangeActionDel::UndoCutOffInsert()
// --- ScChangeActionMove --------------------------------------------------
-ScChangeActionMove::ScChangeActionMove(const sal_uLong nActionNumber, const ScChangeActionState eStateP, const sal_uLong nRejectingNumber,
- const ScBigRange& aToBigRange, const String& aUserP, const DateTime& aDateTimeP, const String &sComment,
- const ScBigRange& aFromBigRange, ScChangeTrack* pTrackP) // wich of nDx and nDy is set is depend on the type
- :
- ScChangeAction(SC_CAT_MOVE, aToBigRange, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
- aFromRange(aFromBigRange),
- pTrack( pTrackP ),
- pFirstCell( NULL ),
- nStartLastCut(0),
- nEndLastCut(0)
+ScChangeActionMove::ScChangeActionMove(
+ const sal_uLong nActionNumber, const ScChangeActionState eStateP,
+ const sal_uLong nRejectingNumber, const ScBigRange& aToBigRange,
+ const rtl::OUString& aUserP, const DateTime& aDateTimeP,
+ const rtl::OUString &sComment, const ScBigRange& aFromBigRange,
+ ScChangeTrack* pTrackP) : // wich of nDx and nDy is set is depend on the type
+ ScChangeAction(SC_CAT_MOVE, aToBigRange, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
+ aFromRange(aFromBigRange),
+ pTrack( pTrackP ),
+ pFirstCell( NULL ),
+ nStartLastCut(0),
+ nEndLastCut(0)
{
}
@@ -1365,9 +1368,9 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ScChangeActionContent )
ScChangeActionContent::ScChangeActionContent( const sal_uLong nActionNumber,
const ScChangeActionState eStateP, const sal_uLong nRejectingNumber,
- const ScBigRange& aBigRangeP, const String& aUserP,
- const DateTime& aDateTimeP, const String& sComment,
- ScBaseCell* pTempOldCell, ScDocument* pDoc, const String& sOldValue )
+ const ScBigRange& aBigRangeP, const rtl::OUString& aUserP,
+ const DateTime& aDateTimeP, const rtl::OUString& sComment,
+ ScBaseCell* pTempOldCell, ScDocument* pDoc, const rtl::OUString& sOldValue )
:
ScChangeAction(SC_CAT_CONTENT, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
aOldValue(sOldValue),
@@ -1381,13 +1384,13 @@ ScChangeActionContent::ScChangeActionContent( const sal_uLong nActionNumber,
{
if (pOldCell)
ScChangeActionContent::SetCell( aOldValue, pOldCell, 0, pDoc );
- if ( sOldValue.Len() ) // #i40704# don't overwrite SetCell result with empty string
+ if (!sOldValue.isEmpty()) // #i40704# don't overwrite SetCell result with empty string
aOldValue = sOldValue; // set again, because SetCell removes it
}
ScChangeActionContent::ScChangeActionContent( const sal_uLong nActionNumber,
ScBaseCell* pTempNewCell, const ScBigRange& aBigRangeP,
- ScDocument* pDoc, const String& sNewValue )
+ ScDocument* pDoc, const rtl::OUString& sNewValue )
:
ScChangeAction(SC_CAT_CONTENT, aBigRangeP, nActionNumber),
aNewValue(sNewValue),
@@ -1400,7 +1403,7 @@ ScChangeActionContent::ScChangeActionContent( const sal_uLong nActionNumber,
{
if (pNewCell)
ScChangeActionContent::SetCell( aNewValue, pNewCell, 0, pDoc );
- if ( sNewValue.Len() ) // #i40704# don't overwrite SetCell result with empty string
+ if (!sNewValue.isEmpty()) // #i40704# don't overwrite SetCell result with empty string
aNewValue = sNewValue; // set again, because SetCell removes it
}
@@ -1483,14 +1486,15 @@ void ScChangeActionContent::SetOldNewCells( ScBaseCell* pOldCellP,
ScChangeActionContent::SetCell( aNewValue, pNewCell, nNewFormat, pDoc );
}
-void ScChangeActionContent::SetNewCell( ScBaseCell* pCell, ScDocument* pDoc, const String& rFormatted )
+void ScChangeActionContent::SetNewCell(
+ ScBaseCell* pCell, ScDocument* pDoc, const rtl::OUString& rFormatted )
{
OSL_ENSURE( !pNewCell, "ScChangeActionContent::SetNewCell: overwriting existing cell" );
pNewCell = pCell;
ScChangeActionContent::SetCell( aNewValue, pNewCell, 0, pDoc );
// #i40704# allow to set formatted text here - don't call SetNewValue with String from XML filter
- if ( rFormatted.Len() )
+ if (!rFormatted.isEmpty())
aNewValue = rFormatted;
}
@@ -1920,15 +1924,16 @@ void ScChangeActionContent::PutNewValueToDoc( ScDocument* pDoc,
}
-void ScChangeActionContent::PutValueToDoc( ScBaseCell* pCell,
- const String& rValue, ScDocument* pDoc, SCsCOL nDx, SCsROW nDy ) const
+void ScChangeActionContent::PutValueToDoc(
+ ScBaseCell* pCell, const rtl::OUString& rValue, ScDocument* pDoc,
+ SCsCOL nDx, SCsROW nDy ) const
{
ScAddress aPos( aBigRange.aStart.MakeAddress() );
if ( nDx )
aPos.IncCol( nDx );
if ( nDy )
aPos.IncRow( nDy );
- if ( !rValue.Len() )
+ if (rValue.isEmpty())
{
if ( pCell )
{
@@ -2162,10 +2167,12 @@ bool ScChangeActionContent::IsOldMatrixReference() const
// --- ScChangeActionReject ------------------------------------------------
-ScChangeActionReject::ScChangeActionReject(const sal_uLong nActionNumber, const ScChangeActionState eStateP, const sal_uLong nRejectingNumber,
- const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String& sComment)
- :
- ScChangeAction(SC_CAT_CONTENT, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment)
+ScChangeActionReject::ScChangeActionReject(
+ const sal_uLong nActionNumber, const ScChangeActionState eStateP,
+ const sal_uLong nRejectingNumber,
+ const ScBigRange& aBigRangeP, const rtl::OUString& aUserP,
+ const DateTime& aDateTimeP, const rtl::OUString& sComment) :
+ ScChangeAction(SC_CAT_CONTENT, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment)
{
}
@@ -4522,7 +4529,8 @@ bool ScChangeTrack::Reject(
}
-sal_uLong ScChangeTrack::AddLoadedGenerated(ScBaseCell* pNewCell, const ScBigRange& aBigRange, const String& sNewValue )
+sal_uLong ScChangeTrack::AddLoadedGenerated(
+ ScBaseCell* pNewCell, const ScBigRange& aBigRange, const rtl::OUString& sNewValue )
{
ScChangeActionContent* pAct = new ScChangeActionContent( --nGeneratedMin, pNewCell, aBigRange, pDoc, sNewValue );
if ( pAct )
commit a5033979fdb12afd28193dcc0bc31005bf706a4a
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Feb 2 23:47:36 2012 -0500
No more sal_Bool from the change tracking code.
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 7781e93..c44da6a 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -1005,9 +1005,8 @@ class ScChangeTrack : public utl::ConfigurationListener
ScChangeAction* pDependent );
void Dependencies( ScChangeAction* );
- void UpdateReference( ScChangeAction*, sal_Bool bUndo );
- void UpdateReference( ScChangeAction** ppFirstAction,
- ScChangeAction* pAct, sal_Bool bUndo );
+ void UpdateReference( ScChangeAction*, bool bUndo );
+ void UpdateReference( ScChangeAction** ppFirstAction, ScChangeAction* pAct, bool bUndo );
void Append( ScChangeAction* pAppend, sal_uLong nAction );
SC_DLLPUBLIC void AppendDeleteRange( const ScRange&,
ScDocument* pRefDoc, SCsTAB nDz,
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 4b32449..d6f7f20 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -325,7 +325,7 @@ void ScChangeAction::RemoveAllAnyLinks()
bool ScChangeAction::RemoveDeletedIn( const ScChangeAction* p )
{
- sal_Bool bRemoved = false;
+ bool bRemoved = false;
ScChangeActionLinkEntry* pL = GetDeletedIn();
while ( pL )
{
@@ -1048,7 +1048,7 @@ bool ScChangeActionDel::Reject( ScDocument* pDoc )
if ( !aBigRange.IsValid( pDoc ) && GetType() != SC_CAT_DELETE_TABS )
return false;
- sal_Bool bOk = true;
+ bool bOk = true;
if ( IsTopDelete() )
{ // den kompletten Bereich in einem Rutsch restaurieren
@@ -1305,7 +1305,7 @@ bool ScChangeActionMove::Reject( ScDocument* pDoc )
ScRange aToRange( aBigRange.MakeRange() );
ScRange aFrmRange( aFromRange.MakeRange() );
- sal_Bool bOk = pDoc->IsBlockEditable( aToRange.aStart.Tab(),
+ bool bOk = pDoc->IsBlockEditable( aToRange.aStart.Tab(),
aToRange.aStart.Col(), aToRange.aStart.Row(),
aToRange.aEnd.Col(), aToRange.aEnd.Row() );
if ( bOk )
@@ -2038,8 +2038,8 @@ void ScChangeActionContent::UpdateReference( const ScChangeTrack* pTrack,
if ( pTrack->IsInDelete() && !pTrack->IsInDeleteTop() )
return ; // Formeln nur kompletten Bereich updaten
- sal_Bool bOldFormula = ( pOldCell && pOldCell->GetCellType() == CELLTYPE_FORMULA );
- sal_Bool bNewFormula = ( pNewCell && pNewCell->GetCellType() == CELLTYPE_FORMULA );
+ bool bOldFormula = ( pOldCell && pOldCell->GetCellType() == CELLTYPE_FORMULA );
+ bool bNewFormula = ( pNewCell && pNewCell->GetCellType() == CELLTYPE_FORMULA );
if ( bOldFormula || bNewFormula )
{ // via ScFormulaCell UpdateReference anpassen (dort)
if ( pTrack->IsInDelete() )
@@ -2405,7 +2405,7 @@ void ScChangeTrack::EndBlockModify( sal_uLong nEndAction )
}
if ( !pBlockModifyMsg )
{
- sal_Bool bNew = false;
+ bool bNew = false;
while ( !aMsgStackFinal.empty() )
{
aMsgQueue.push_back( aMsgStackFinal.top() );
@@ -2827,7 +2827,7 @@ void ScChangeTrack::AppendContentRange( const ScRange& rRange,
SCROW nRow2;
SCTAB nTab2;
rRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- sal_Bool bDoContents;
+ bool bDoContents;
if ( eClipMode == SC_CACM_PASTE && HasLastCut() )
{
bDoContents = false;
@@ -3093,10 +3093,10 @@ void ScChangeTrack::Dependencies( ScChangeAction* pAct )
// also genau richtig
const ScBigRange& rRange = pAct->GetBigRange();
- sal_Bool bActNoInsert = !pAct->IsInsertType();
- sal_Bool bActColDel = ( eActType == SC_CAT_DELETE_COLS );
- sal_Bool bActRowDel = ( eActType == SC_CAT_DELETE_ROWS );
- sal_Bool bActTabDel = ( eActType == SC_CAT_DELETE_TABS );
+ bool bActNoInsert = !pAct->IsInsertType();
+ bool bActColDel = ( eActType == SC_CAT_DELETE_COLS );
+ bool bActRowDel = ( eActType == SC_CAT_DELETE_ROWS );
+ bool bActTabDel = ( eActType == SC_CAT_DELETE_TABS );
if ( pLinkInsertCol && (eActType == SC_CAT_INSERT_COLS ||
(bActNoInsert && !bActRowDel && !bActTabDel)) )
@@ -3400,19 +3400,19 @@ void ScChangeTrack::MergeOwn( ScChangeAction* pAct, sal_uLong nFirstMerge, bool
}
-void ScChangeTrack::UpdateReference( ScChangeAction* pAct, sal_Bool bUndo )
+void ScChangeTrack::UpdateReference( ScChangeAction* pAct, bool bUndo )
{
ScChangeActionType eActType = pAct->GetType();
if ( eActType == SC_CAT_CONTENT || eActType == SC_CAT_REJECT )
return ;
//! Formelzellen haengen nicht im Dokument
- sal_Bool bOldAutoCalc = pDoc->GetAutoCalc();
+ bool bOldAutoCalc = pDoc->GetAutoCalc();
pDoc->SetAutoCalc( false );
- sal_Bool bOldNoListening = pDoc->GetNoListening();
+ bool bOldNoListening = pDoc->GetNoListening();
pDoc->SetNoListening( true );
//! Formelzellen ExpandRefs synchronisiert zu denen im Dokument
- sal_Bool bOldExpandRefs = pDoc->IsExpandRefs();
+ bool bOldExpandRefs = pDoc->IsExpandRefs();
if ( (!bUndo && pAct->IsInsertType()) || (bUndo && pAct->IsDeleteType()) )
pDoc->SetExpandRefs( SC_MOD()->GetInputOptions().GetExpandRefs() );
@@ -3445,10 +3445,10 @@ void ScChangeTrack::UpdateReference( ScChangeAction* pAct, sal_Bool bUndo )
void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
- ScChangeAction* pAct, sal_Bool bUndo )
+ ScChangeAction* pAct, bool bUndo )
{
ScChangeActionType eActType = pAct->GetType();
- sal_Bool bGeneratedDelContents =
+ bool bGeneratedDelContents =
( ppFirstAction == (ScChangeAction**)&pFirstGeneratedDelContent );
const ScBigRange& rOrgRange = pAct->GetBigRange();
ScBigRange aRange( rOrgRange );
@@ -3456,7 +3456,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
sal_Int32 nDx, nDy, nDz;
nDx = nDy = nDz = 0;
UpdateRefMode eMode = URM_INSDEL;
- sal_Bool bDel = false;
+ bool bDel = false;
switch ( eActType )
{
case SC_CAT_INSERT_COLS :
@@ -3529,7 +3529,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
{
if ( p == pAct )
continue; // for
- sal_Bool bUpdate = true;
+ bool bUpdate = true;
if ( GetMergeState() == SC_CTMS_OTHER &&
p->GetActionNumber() <= GetLastMerge() )
{ // Delete in mergendem Dokument, Action im zu mergenden
@@ -3742,7 +3742,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
{
if ( p == pAct )
continue; // for
- sal_Bool bUpdate = true;
+ bool bUpdate = true;
if ( aDelRange.In( p->GetBigRange() ) )
{
// #i94841# [Collaboration] When deleting rows is rejected, the content is sometimes wrong
@@ -3794,7 +3794,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
else if ( eActType == SC_CAT_MOVE )
{
ScChangeActionMove* pActMove = (ScChangeActionMove*) pAct;
- sal_Bool bLastCutMove = ( pActMove == pLastCutMove );
+ bool bLastCutMove = ( pActMove == pLastCutMove );
const ScBigRange& rTo = pActMove->GetBigRange();
const ScBigRange& rFrom = pActMove->GetFromRange();
if ( !bUndo )
@@ -3844,7 +3844,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
}
else
{ // Undo Move
- sal_Bool bActRejected = pActMove->IsRejected();
+ bool bActRejected = pActMove->IsRejected();
for ( ScChangeAction* p = *ppFirstAction; p; p = p->GetNext() )
{
if ( p == pAct )
@@ -4008,8 +4008,8 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
//! bAllFlat==TRUE: intern aus Accept oder Reject gerufen,
//! => Generated werden nicht aufgenommen
- sal_Bool bIsDelete = pAct->IsDeleteType();
- sal_Bool bIsMasterDelete = ( bListMasterDelete && pAct->IsMasterDelete() );
+ bool bIsDelete = pAct->IsDeleteType();
+ bool bIsMasterDelete = ( bListMasterDelete && pAct->IsMasterDelete() );
const ScChangeAction* pCur = NULL;
::std::stack<ScChangeAction*> cStack;
@@ -4235,7 +4235,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
if ( pContent->HasDependent() )
{
- sal_Bool bOk = true;
+ bool bOk = true;
::std::stack<ScChangeActionContent*> aRejectActions;
const ScChangeActionLinkEntry* pL = pContent->GetFirstDependentEntry();
while ( pL )
@@ -4380,7 +4380,7 @@ bool ScChangeTrack::Reject(
OSL_ENSURE( !pMap, "ScChangeTrack::Reject: Delete mit map" );
ScBigRange aDelRange;
sal_uLong nRejectAction = pAct->GetActionNumber();
- sal_Bool bTabDel, bTabDelOk;
+ bool bTabDel, bTabDelOk;
if ( pAct->GetType() == SC_CAT_DELETE_TABS )
{
bTabDel = true;
@@ -4401,7 +4401,7 @@ bool ScChangeTrack::Reject(
aDelRange = pDel->GetOverAllRange();
bOk = aDelRange.IsValid( pDoc );
}
- sal_Bool bOneOk = false;
+ bool bOneOk = false;
if ( bOk )
{
ScChangeActionType eActType = pAct->GetType();
@@ -4422,7 +4422,7 @@ bool ScChangeTrack::Reject(
}
}
ScChangeAction* p = pAct;
- sal_Bool bLoop = true;
+ bool bLoop = true;
do
{
pDel = (ScChangeActionDel*) p;
commit c827b9756f069bec82c559c0e7dee534bcee8c2e
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Feb 2 23:42:34 2012 -0500
GetDescription() now deals with rtl::OUString.
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 7fb4cd7..7781e93 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -392,8 +392,9 @@ public:
// description will be appended to string
// with bSplitRange only one column/row will be considered for delete
// (for a listing of entries)
- virtual void GetDescription( String&, ScDocument*,
- sal_Bool bSplitRange = false, bool bWarning = true ) const;
+ virtual void GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc,
+ bool bSplitRange = false, bool bWarning = true ) const;
virtual void GetRefString( String&, ScDocument*, bool bFlag3D = false ) const;
@@ -438,13 +439,13 @@ public:
const ScChangeActionState eState,
const sal_uLong nRejectingNumber,
const ScBigRange& aBigRange,
- const String& aUser,
+ const rtl::OUString& aUser,
const DateTime& aDateTime,
- const String &sComment,
+ const rtl::OUString &sComment,
const ScChangeActionType eType); // only to use in the XML import
- virtual void GetDescription( String&, ScDocument*,
- sal_Bool bSplitRange = false, bool bWarning = true ) const;
+ virtual void GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc, bool bSplitRange = false, bool bWarning = true) const;
};
@@ -567,8 +568,9 @@ public:
const ScChangeActionIns* GetCutOffInsert() const { return pCutOff; }
short GetCutOffCount() const { return nCutOff; }
- virtual void GetDescription( String&, ScDocument*,
- sal_Bool bSplitRange = false, bool bWarning = true ) const;
+ virtual void GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc, bool bSplitRange = false, bool bWarning = true ) const;
+
void SetCutOffInsert( ScChangeActionIns* p, short n )
{ pCutOff = p; nCutOff = n; } // only to use in the XML import
// this should be protected, but for the XML import it is public
@@ -642,8 +644,9 @@ public:
const ScBigRange& GetFromRange() const { return aFromRange; }
SC_DLLPUBLIC void GetDelta( sal_Int32& nDx, sal_Int32& nDy, sal_Int32& nDz ) const;
- virtual void GetDescription( String&, ScDocument*,
- sal_Bool bSplitRange = false, bool bWarning = true ) const;
+ virtual void GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc, bool bSplitRange = false,
+ bool bWarning = true ) const;
virtual void GetRefString( String&, ScDocument*, bool bFlag3D = false ) const;
};
@@ -824,8 +827,9 @@ public:
void GetNewString( rtl::OUString& rStr ) const;
const ScBaseCell* GetOldCell() const { return pOldCell; }
const ScBaseCell* GetNewCell() const { return pNewCell; }
- virtual void GetDescription( String&, ScDocument*,
- sal_Bool bSplitRange = false, bool bWarning = true ) const;
+ virtual void GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc, bool bSplitRange = false, bool bWarning = true ) const;
+
virtual void GetRefString( String&, ScDocument*, bool bFlag3D = false ) const;
static ScChangeActionContentCellType GetContentCellType( const ScBaseCell* );
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 3f9e64d..4b32449 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -454,71 +454,85 @@ void ScChangeAction::UpdateReference( const ScChangeTrack* /* pTrack */,
}
-void ScChangeAction::GetDescription( String& rStr, ScDocument* /* pDoc */,
- sal_Bool /* bSplitRange */, bool bWarning ) const
+void ScChangeAction::GetDescription(
+ rtl::OUString& rStr, ScDocument* /* pDoc */, bool /* bSplitRange */, bool bWarning ) const
{
- if ( IsRejecting() && bWarning )
+ if (!IsRejecting() || !bWarning)
+ return;
+
+ // Add comment if rejection may have resulted in references
+ // not properly restored in formulas. See specification at
+ // http://specs.openoffice.org/calc/ease-of-use/redlining_comment.sxw
+
+ rtl::OUStringBuffer aBuf(rStr); // Take the original string.
+ if (GetType() == SC_CAT_MOVE)
{
- // Add comment if rejection may have resulted in references
- // not properly restored in formulas. See specification at
- // http://specs.openoffice.org/calc/ease-of-use/redlining_comment.sxw
- if (GetType() == SC_CAT_MOVE)
- {
- rStr += ScGlobal::GetRscString(
- STR_CHANGED_MOVE_REJECTION_WARNING);
- rStr += ' ';
- }
- else if (IsInsertType())
- {
- rStr += ScGlobal::GetRscString(
- STR_CHANGED_DELETE_REJECTION_WARNING);
- rStr += ' ';
- }
- else
+ aBuf.append(
+ ScGlobal::GetRscString(STR_CHANGED_MOVE_REJECTION_WARNING));
+ aBuf.append(sal_Unicode(' '));
+ rStr = aBuf.makeStringAndClear();
+ return;
+ }
+
+ if (IsInsertType())
+ {
+ aBuf.append(
+ ScGlobal::GetRscString(STR_CHANGED_DELETE_REJECTION_WARNING));
+ aBuf.append(sal_Unicode(' '));
+ rStr = aBuf.makeStringAndClear();
+ return;
+ }
+
+ const ScChangeTrack* pCT = GetChangeTrack();
+ if (!pCT)
+ return;
+
+ ScChangeAction* pReject = pCT->GetActionOrGenerated(GetRejectAction());
+
+ if (!pReject)
+ return;
+
+ if (pReject->GetType() == SC_CAT_MOVE)
+ {
+ aBuf.append(
+ ScGlobal::GetRscString(STR_CHANGED_MOVE_REJECTION_WARNING));
+ aBuf.append(sal_Unicode(' '));
+ rStr = aBuf.makeStringAndClear();
+ return;
+ }
+
+ if (pReject->IsDeleteType())
+ {
+ aBuf.append(
+ ScGlobal::GetRscString(STR_CHANGED_DELETE_REJECTION_WARNING));
+ aBuf.append(sal_Unicode(' '));
+ rStr = aBuf.makeStringAndClear();
+ return;
+ }
+
+ if (pReject->HasDependent())
+ {
+ ScChangeActionMap aMap;
+ pCT->GetDependents( pReject, aMap, false, true );
+ ScChangeActionMap::iterator itChangeAction;
+ for( itChangeAction = aMap.begin(); itChangeAction != aMap.end(); ++itChangeAction )
{
- const ScChangeTrack* pCT = GetChangeTrack();
- if (pCT)
+ if( itChangeAction->second->GetType() == SC_CAT_MOVE)
{
- ScChangeAction* pReject = pCT->GetActionOrGenerated(
- GetRejectAction());
- if (pReject)
- {
- if (pReject->GetType() == SC_CAT_MOVE)
- {
- rStr += ScGlobal::GetRscString(
- STR_CHANGED_MOVE_REJECTION_WARNING);
- rStr += ' ';
- }
- else if (pReject->IsDeleteType())
- {
- rStr += ScGlobal::GetRscString(
- STR_CHANGED_DELETE_REJECTION_WARNING);
- rStr += ' ';
- }
- else if (pReject->HasDependent())
- {
- ScChangeActionMap aMap;
- pCT->GetDependents( pReject, aMap, false, true );
- ScChangeActionMap::iterator itChangeAction;
- for( itChangeAction = aMap.begin(); itChangeAction != aMap.end(); ++itChangeAction )
- {
- if( itChangeAction->second->GetType() == SC_CAT_MOVE)
- {
- rStr += ScGlobal::GetRscString(
- STR_CHANGED_MOVE_REJECTION_WARNING);
- rStr += ' ';
- break; // for
- }
- else if (pReject->IsDeleteType())
- {
- rStr += ScGlobal::GetRscString(
- STR_CHANGED_DELETE_REJECTION_WARNING);
- rStr += ' ';
- break; // for
- }
- }
- }
- }
+ aBuf.append(
+ ScGlobal::GetRscString(STR_CHANGED_MOVE_REJECTION_WARNING));
+ aBuf.append(sal_Unicode(' '));
+ rStr = aBuf.makeStringAndClear();
+ return;
+ }
+
+ if (pReject->IsDeleteType())
+ {
+ aBuf.append(
+ ScGlobal::GetRscString(STR_CHANGED_DELETE_REJECTION_WARNING));
+ aBuf.append(sal_Unicode(' '));
+ rStr = aBuf.makeStringAndClear();
+ return;
}
}
}
@@ -724,11 +738,12 @@ ScChangeActionIns::ScChangeActionIns( const ScRange& rRange )
}
-ScChangeActionIns::ScChangeActionIns(const sal_uLong nActionNumber, const ScChangeActionState eStateP, const sal_uLong nRejectingNumber,
- const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String& sComment,
- const ScChangeActionType eTypeP)
- :
- ScChangeAction(eTypeP, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment)
+ScChangeActionIns::ScChangeActionIns(
+ const sal_uLong nActionNumber, const ScChangeActionState eStateP,
+ const sal_uLong nRejectingNumber, const ScBigRange& aBigRangeP,
+ const rtl::OUString& aUserP, const DateTime& aDateTimeP,
+ const rtl::OUString& sComment, const ScChangeActionType eTypeP) :
+ ScChangeAction(eTypeP, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment)
{
}
@@ -736,9 +751,8 @@ ScChangeActionIns::~ScChangeActionIns()
{
}
-
-void ScChangeActionIns::GetDescription( String& rStr, ScDocument* pDoc,
- sal_Bool bSplitRange, bool bWarning ) const
+void ScChangeActionIns::GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
{
ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
@@ -755,15 +769,22 @@ void ScChangeActionIns::GetDescription( String& rStr, ScDocument* pDoc,
nWhatId = STR_AREA;
}
- String aRsc( ScGlobal::GetRscString( STR_CHANGED_INSERT ) );
- xub_StrLen nPos = aRsc.SearchAscii( "#1" );
- rStr += aRsc.Copy( 0, nPos );
- rStr += ScGlobal::GetRscString( nWhatId );
- rStr += ' ';
- rStr += GetRefString( GetBigRange(), pDoc );
- rStr += aRsc.Copy( nPos+2 );
-}
+ rtl::OUString aRsc = ScGlobal::GetRscString(STR_CHANGED_INSERT);
+ sal_Int32 nPos = aRsc.indexOfAsciiL("#1", 2);
+ if (nPos >= 0)
+ {
+ // Construct a range string to replace '#1' first.
+ rtl::OUStringBuffer aBuf(ScGlobal::GetRscString(nWhatId));
+ aBuf.append(sal_Unicode(' '));
+ aBuf.append(GetRefString(GetBigRange(), pDoc));
+ rtl::OUString aRangeStr = aBuf.makeStringAndClear();
+
+ aRsc.replaceAt(nPos, 2, aRangeStr); // replace '#1' with the range string.
+ aBuf.append(rStr).append(aRsc);
+ rStr = aBuf.makeStringAndClear();
+ }
+}
bool ScChangeActionIns::Reject( ScDocument* pDoc )
{
@@ -974,8 +995,8 @@ ScBigRange ScChangeActionDel::GetOverAllRange() const
}
-void ScChangeActionDel::GetDescription( String& rStr, ScDocument* pDoc,
- sal_Bool bSplitRange, bool bWarning ) const
+void ScChangeActionDel::GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
{
ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
@@ -1004,13 +1025,21 @@ void ScChangeActionDel::GetDescription( String& rStr, ScDocument* pDoc,
aTmpRange.aEnd.SetRow( aTmpRange.aEnd.Row() + GetDy() );
}
- String aRsc( ScGlobal::GetRscString( STR_CHANGED_DELETE ) );
- xub_StrLen nPos = aRsc.SearchAscii( "#1" );
- rStr += aRsc.Copy( 0, nPos );
- rStr += ScGlobal::GetRscString( nWhatId );
- rStr += ' ';
- rStr += GetRefString( aTmpRange, pDoc );
- rStr += aRsc.Copy( nPos+2 );
+ rtl::OUString aRsc = ScGlobal::GetRscString(STR_CHANGED_DELETE);
+ sal_Int32 nPos = aRsc.indexOfAsciiL("#1", 2);
+ if (nPos >= 0)
+ {
+ // Build a string to replace with.
+ rtl::OUStringBuffer aBuf;
+ aBuf.append(ScGlobal::GetRscString(nWhatId));
+ aBuf.append(sal_Unicode(' '));
+ aBuf.append(GetRefString(aTmpRange, pDoc));
+ rtl::OUString aRangeStr = aBuf.makeStringAndClear();
+ aRsc = aRsc.replaceAt(nPos, 2, aRangeStr); // replace '#1' with the string.
+
+ aBuf.append(rStr).append(aRsc);
+ rStr = aBuf.makeStringAndClear(); // append to the original.
+ }
}
@@ -1225,29 +1254,34 @@ void ScChangeActionMove::GetDelta( sal_Int32& nDx, sal_Int32& nDy, sal_Int32& nD
}
-void ScChangeActionMove::GetDescription( String& rStr, ScDocument* pDoc,
- sal_Bool bSplitRange, bool bWarning ) const
+void ScChangeActionMove::GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
{
ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
- sal_Bool bFlag3D = ( GetFromRange().aStart.Tab() != GetBigRange().aStart.Tab() );
+ bool bFlag3D = GetFromRange().aStart.Tab() != GetBigRange().aStart.Tab();
- String aRsc( ScGlobal::GetRscString( STR_CHANGED_MOVE ) );
+ rtl::OUString aRsc = ScGlobal::GetRscString(STR_CHANGED_MOVE);
- xub_StrLen nPos = 0;
- String aTmpStr = ScChangeAction::GetRefString( GetFromRange(), pDoc, bFlag3D );
- nPos = aRsc.SearchAscii( "#1", nPos );
- aRsc.Erase( nPos, 2 );
- aRsc.Insert( aTmpStr, nPos );
- nPos = sal::static_int_cast<xub_StrLen>( nPos + aTmpStr.Len() );
+ rtl::OUString aTmpStr = ScChangeAction::GetRefString(GetFromRange(), pDoc, bFlag3D);
+ sal_Int32 nPos = aRsc.indexOfAsciiL("#1", 2);
+ if (nPos >= 0)
+ {
+ aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
+ nPos += aTmpStr.getLength();
+ }
- aTmpStr = ScChangeAction::GetRefString( GetBigRange(), pDoc, bFlag3D );
- nPos = aRsc.SearchAscii( "#2", nPos );
- aRsc.Erase( nPos, 2 );
- aRsc.Insert( aTmpStr, nPos );
- nPos = sal::static_int_cast<xub_StrLen>( nPos + aTmpStr.Len() );
+ aTmpStr = ScChangeAction::GetRefString(GetBigRange(), pDoc, bFlag3D);
+ nPos = aRsc.indexOfAsciiL("#2", 2, nPos);
+ if (nPos >= 0)
+ {
+ aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
+ nPos += aTmpStr.getLength();
+ }
- rStr += aRsc;
+ rtl::OUStringBuffer aBuf(rStr); // append to the original string.
+ aBuf.append(aRsc);
+ rStr = aBuf.makeStringAndClear();
}
@@ -1505,8 +1539,8 @@ void ScChangeActionContent::GetNewString( rtl::OUString& rStr ) const
}
-void ScChangeActionContent::GetDescription( String& rStr, ScDocument* pDoc,
- sal_Bool bSplitRange, bool bWarning ) const
+void ScChangeActionContent::GetDescription(
+ rtl::OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
{
ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
@@ -1547,7 +1581,9 @@ void ScChangeActionContent::GetDescription( String& rStr, ScDocument* pDoc,
nPos += aTmpStr.getLength();
}
- rStr += String(aRsc);
+ rtl::OUStringBuffer aBuf(rStr); // append to the original string.
+ aBuf.append(aRsc);
+ rStr = aBuf.makeStringAndClear();
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 929a5ef..349a7a8 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -782,11 +782,11 @@ bool lcl_FindAction( ScDocument* pDoc, const ScChangeAction* pAction, ScDocument
pAction->GetDateTimeUTC() == pA->GetDateTimeUTC() ) &&
pAction->GetBigRange() == pA->GetBigRange() )
{
- String aActionDesc;
- pAction->GetDescription( aActionDesc, pDoc, sal_True );
- String aADesc;
- pA->GetDescription( aADesc, pSearchDoc, sal_True );
- if ( aActionDesc.Equals( aADesc ) )
+ rtl::OUString aActionDesc;
+ pAction->GetDescription(aActionDesc, pDoc, true);
+ rtl::OUString aADesc;
+ pA->GetDescription(aADesc, pSearchDoc, true);
+ if (aActionDesc.equals(aADesc))
{
OSL_FAIL( "lcl_FindAction(): found equal action!" );
return true;
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index f3ab4db..b012630 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -337,23 +337,23 @@ bool ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction)
ScChangeActionType eType=pScChangeAction->GetType();
String aString;
- String aDesc;
+ rtl::OUString aDesc;
String aComment = comphelper::string::remove(pScChangeAction->GetComment(), '\n');
if(eType==SC_CAT_CONTENT)
{
if(!pScChangeAction->IsDialogParent())
- pScChangeAction->GetDescription( aDesc, pDoc, true);
+ pScChangeAction->GetDescription(aDesc, pDoc, true);
}
else
- pScChangeAction->GetDescription( aDesc, pDoc,!pScChangeAction->IsMasterDelete());
+ pScChangeAction->GetDescription(aDesc, pDoc, !pScChangeAction->IsMasterDelete());
- if(aDesc.Len()>0)
+ if (!aDesc.isEmpty())
{
aComment.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
- aComment+=aDesc;
- aComment+=')';
+ aComment += String(aDesc);
+ aComment += ')';
}
if(pTheView->IsValidEntry(&aUser,&aDateTime,&aComment))
@@ -395,7 +395,7 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeAction(
String aRefStr;
ScChangeActionType eType=pScChangeAction->GetType();
rtl::OUStringBuffer aBuf;
- String aDesc;
+ rtl::OUString aDesc;
ScRedlinData* pNewData=new ScRedlinData;
pNewData->pData=(void *)pScChangeAction;
@@ -466,11 +466,11 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeAction(
String aComment = comphelper::string::remove(pScChangeAction->GetComment(), '\n');
- if(aDesc.Len()>0)
+ if (!aDesc.isEmpty())
{
aComment.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
- aComment+=aDesc;
- aComment+=')';
+ aComment += String(aDesc);
+ aComment += ')';
}
aBuf.append(aComment);
@@ -572,8 +572,7 @@ SvLBoxEntry* ScAcceptChgDlg::InsertFilteredAction(
String aRefStr;
ScChangeActionType eType=pScChangeAction->GetType();
String aString;
- String aDesc;
-
+ rtl::OUString aDesc;
ScRedlinData* pNewData=new ScRedlinData;
pNewData->pData=(void *)pScChangeAction;
@@ -638,11 +637,11 @@ SvLBoxEntry* ScAcceptChgDlg::InsertFilteredAction(
String aComment = comphelper::string::remove(pScChangeAction->GetComment(), '\n');
- if(aDesc.Len()>0)
+ if (!aDesc.isEmpty())
{
aComment.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
- aComment+=aDesc;
- aComment+=')';
+ aComment += String(aDesc);
+ aComment += ')';
}
if(pTheView->IsValidComment(&aComment))
{
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index 4e087cb..3ef5ad4 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -497,9 +497,9 @@ String ScConflictsDlg::GetActionString( const ScChangeAction* pAction, ScDocumen
OSL_ENSURE( pDoc, "ScConflictsDlg::GetActionString(): pDoc is null!" );
if ( pAction && pDoc )
{
- String aDesc;
- pAction->GetDescription( aDesc, pDoc, sal_True, false );
- aString += aDesc;
+ rtl::OUString aDesc;
+ pAction->GetDescription(aDesc, pDoc, true, false);
+ aString += String(aDesc);
aString += '\t';
String aUser = comphelper::string::strip(pAction->GetUser(), ' ');
diff --git a/sc/source/ui/miscdlgs/redcom.cxx b/sc/source/ui/miscdlgs/redcom.cxx
index df04b07..46d6ef6 100644
--- a/sc/source/ui/miscdlgs/redcom.cxx
+++ b/sc/source/ui/miscdlgs/redcom.cxx
@@ -109,7 +109,7 @@ void ScRedComDialog::ReInit(ScChangeAction *pAction)
pChangeAction=pAction;
if(pChangeAction!=NULL && pDocShell !=NULL)
{
- String aTitle;
+ rtl::OUString aTitle;
pChangeAction->GetDescription( aTitle, pDocShell->GetDocument());
pDlg->SetText(aTitle);
aComment=pChangeAction->GetComment();
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 0561342..ed6ebae 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -188,7 +188,9 @@ bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard )
aTrackText += aComStr;
aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\n( " ));
}
- pFound->GetDescription( aTrackText, pDoc );
+ rtl::OUString aTmp;
+ pFound->GetDescription(aTmp, pDoc);
+ aTrackText += String(aTmp);
if(aComStr.Len()>0)
{
aTrackText +=')';
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index a1eea9e..74bcb89 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -173,10 +173,13 @@ sal_Bool ScViewUtil::IsActionShown( const ScChangeAction& rAction,
if ( rSettings.HasComment() )
{
- String aComStr=rAction.GetComment();
- aComStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
- rAction.GetDescription( aComStr, &rDocument );
- aComStr+=')';
+ rtl::OUStringBuffer aBuf(rAction.GetComment());
+ aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" ("));
+ rtl::OUString aTmp;
+ rAction.GetDescription(aTmp, &rDocument);
+ aBuf.append(aTmp);
+ aBuf.append(sal_Unicode(')'));
+ String aComStr = aBuf.makeStringAndClear();
if(!rSettings.IsValidComment(&aComStr))
return false;
commit d7c1b89abd85e6edd317f6c4eb1e86eef02df923
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Feb 2 21:03:58 2012 -0500
More on bool & string conversions.
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index cef2eda..7fb4cd7 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -335,49 +335,35 @@ protected:
virtual const ScChangeTrack* GetChangeTrack() const = 0;
public:
- sal_Bool IsInsertType() const
- {
- return eType == SC_CAT_INSERT_COLS ||
- eType == SC_CAT_INSERT_ROWS ||
- eType == SC_CAT_INSERT_TABS;
- }
- sal_Bool IsDeleteType() const
- {
- return eType == SC_CAT_DELETE_COLS ||
- eType == SC_CAT_DELETE_ROWS ||
- eType == SC_CAT_DELETE_TABS;
- }
- sal_Bool IsVirgin() const
- { return eState == SC_CAS_VIRGIN; }
- sal_Bool IsAccepted() const
- { return eState == SC_CAS_ACCEPTED; }
- sal_Bool IsRejected() const
- { return eState == SC_CAS_REJECTED; }
+ bool IsInsertType() const;
+ bool IsDeleteType() const;
+ bool IsVirgin() const;
+ SC_DLLPUBLIC bool IsAccepted() const;
+ bool IsRejected() const;
- // Action rejects another Action
- sal_Bool IsRejecting() const
- { return nRejectAction != 0; }
+ // Action rejects another Action
+ bool IsRejecting() const;
- // if action is visible in the document
- sal_Bool IsVisible() const;
+ // if action is visible in the document
+ bool IsVisible() const;
- // if action if touchable
- sal_Bool IsTouchable() const;
+ // if action if touchable
+ bool IsTouchable() const;
- // if action is an entry in dialog root
- sal_Bool IsDialogRoot() const;
+ // if action is an entry in dialog root
+ bool IsDialogRoot() const;
- // if an entry in a dialog shall be a drop down entry
- sal_Bool IsDialogParent() const;
+ // if an entry in a dialog shall be a drop down entry
+ bool IsDialogParent() const;
- // if action is a delete with subdeletes (aufgeklappt = open ?)
- sal_Bool IsMasterDelete() const;
+ // if action is a delete with subdeletes (aufgeklappt = open ?)
+ bool IsMasterDelete() const;
- // if action is acceptable/selectable/rejectable
- sal_Bool IsClickable() const;
+ // if action is acceptable/selectable/rejectable
+ bool IsClickable() const;
- // if action is rejectable
- sal_Bool IsRejectable() const;
+ // if action is rejectable
+ bool IsRejectable() const;
const ScBigRange& GetBigRange() const { return aBigRange; }
SC_DLLPUBLIC DateTime GetDateTime() const; // local time
@@ -391,27 +377,23 @@ public:
ScChangeAction* GetNext() const { return pNext; }
ScChangeAction* GetPrev() const { return pPrev; }
- sal_Bool IsDeletedIn() const
- { return GetDeletedIn() != NULL; }
- sal_Bool IsDeleted() const
- { return IsDeleteType() || IsDeletedIn(); }
- sal_Bool IsDeletedIn( const ScChangeAction* ) const;
- sal_Bool IsDeletedInDelType( ScChangeActionType ) const;
- void RemoveAllDeletedIn();
+ bool IsDeletedIn() const;
+ bool IsDeleted() const;
+ bool IsDeletedIn( const ScChangeAction* ) const;
+ bool IsDeletedInDelType( ScChangeActionType ) const;
+ void RemoveAllDeletedIn();
const ScChangeActionLinkEntry* GetFirstDeletedEntry() const
{ return pLinkDeleted; }
const ScChangeActionLinkEntry* GetFirstDependentEntry() const
{ return pLinkDependent; }
- sal_Bool HasDependent() const
- { return pLinkDependent != NULL; }
- sal_Bool HasDeleted() const { return pLinkDeleted != NULL; }
-
+ bool HasDependent() const;
+ bool HasDeleted() const;
// description will be appended to string
// with bSplitRange only one column/row will be considered for delete
// (for a listing of entries)
- virtual void GetDescription( String&, ScDocument*,
- sal_Bool bSplitRange = false, bool bWarning = true ) const;
+ virtual void GetDescription( String&, ScDocument*,
+ sal_Bool bSplitRange = false, bool bWarning = true ) const;
virtual void GetRefString( String&, ScDocument*, bool bFlag3D = false ) const;
@@ -562,20 +544,20 @@ public:
ScChangeTrack* pTrack); // only to use in the XML import
// which of nDx and nDy is set is dependend on the type
- // is the last in a row (or single)
- sal_Bool IsBaseDelete() const;
+ // is the last in a row (or single)
+ bool IsBaseDelete() const;
- // is the first in a row (or single)
- sal_Bool IsTopDelete() const;
+ // is the first in a row (or single)
+ bool IsTopDelete() const;
- // is part of a row
- sal_Bool IsMultiDelete() const;
+ // is part of a row
+ bool IsMultiDelete() const;
- // is col, belonging to a TabDelete
- sal_Bool IsTabDeleteCol() const;
+ // is col, belonging to a TabDelete
+ bool IsTabDeleteCol() const;
- SCsCOL GetDx() const { return nDx; }
- SCsROW GetDy() const { return nDy; }
+ SCsCOL GetDx() const;
+ SCsROW GetDy() const;
ScBigRange GetOverAllRange() const; // BigRange + (nDx, nDy)
const ScChangeActionCellListEntry* GetFirstCellEntry() const
@@ -592,12 +574,8 @@ public:
// this should be protected, but for the XML import it is public
// only to use in the XML import
// this should be protected, but for the XML import it is public
- ScChangeActionDelMoveEntry* AddCutOffMove( ScChangeActionMove* pMove,
- short nFrom, short nTo )
- {
- return new ScChangeActionDelMoveEntry(
- &pLinkMove, pMove, nFrom, nTo );
- }
+ ScChangeActionDelMoveEntry* AddCutOffMove(
+ ScChangeActionMove* pMove, short nFrom, short nTo );
};
@@ -685,8 +663,8 @@ class ScChangeActionContent : public ScChangeAction
{
friend class ScChangeTrack;
- String aOldValue;
- String aNewValue;
+ rtl::OUString aOldValue;
+ rtl::OUString aNewValue;
ScBaseCell* pOldCell;
ScBaseCell* pNewCell;
ScChangeActionContent* pNextContent; // at the same position
@@ -717,45 +695,34 @@ class ScChangeActionContent : public ScChangeAction
ScChangeActionContent* GetNextInSlot() { return pNextInSlot; }
- void ClearTrack();
+ void ClearTrack();
- static void GetStringOfCell( String& rStr,
- const ScBaseCell* pCell,
- const ScDocument* pDoc,
- const ScAddress& rPos );
+ static void GetStringOfCell( rtl::OUString& rStr, const ScBaseCell* pCell,
+ const ScDocument* pDoc, const ScAddress& rPos );
- static void GetStringOfCell( String& rStr,
- const ScBaseCell* pCell,
- const ScDocument* pDoc,
- sal_uLong nFormat );
+ static void GetStringOfCell( rtl::OUString& rStr, const ScBaseCell* pCell,
+ const ScDocument* pDoc, sal_uLong nFormat );
- static void SetValue( String& rStr, ScBaseCell*& pCell,
- const ScAddress& rPos,
- const ScBaseCell* pOrgCell,
- const ScDocument* pFromDoc,
- ScDocument* pToDoc );
+ static void SetValue( rtl::OUString& rStr, ScBaseCell*& pCell, const ScAddress& rPos,
+ const ScBaseCell* pOrgCell, const ScDocument* pFromDoc,
+ ScDocument* pToDoc );
- static void SetValue( String& rStr, ScBaseCell*& pCell,
- sal_uLong nFormat,
- const ScBaseCell* pOrgCell,
- const ScDocument* pFromDoc,
- ScDocument* pToDoc );
+ static void SetValue( rtl::OUString& rStr, ScBaseCell*& pCell, sal_uLong nFormat,
+ const ScBaseCell* pOrgCell, const ScDocument* pFromDoc,
+ ScDocument* pToDoc );
- static void SetCell( String& rStr, ScBaseCell* pCell,
- sal_uLong nFormat, const ScDocument* pDoc );
+ static void SetCell( rtl::OUString& rStr, ScBaseCell* pCell,
+ sal_uLong nFormat, const ScDocument* pDoc );
static bool NeedsNumberFormat( const ScBaseCell* );
- void SetValueString( String& rValue,
- ScBaseCell*& pCell, const String& rStr,
- ScDocument* pDoc );
+ void SetValueString( rtl::OUString& rValue, ScBaseCell*& pCell,
+ const rtl::OUString& rStr, ScDocument* pDoc );
- void GetValueString( String& rStr,
- const String& rValue,
- const ScBaseCell* pCell ) const;
+ void GetValueString( rtl::OUString& rStr, const rtl::OUString& rValue,
+ const ScBaseCell* pCell ) const;
- void GetFormulaString( String& rStr,
- const ScFormulaCell* pCell ) const;
+ void GetFormulaString( rtl::OUString& rStr, const ScFormulaCell* pCell ) const;
virtual void AddContent( ScChangeActionContent* ) {}
virtual void DeleteCellEntries() {}
@@ -848,13 +815,13 @@ public:
void SetPrevContent( ScChangeActionContent* p )
{ pPrevContent = p; }
- // don't use:
- // assigns String / creates forumula cell
- void SetOldValue( const String& rOld, ScDocument* );
- void SetNewValue( const String& rNew, ScDocument* );
+ // don't use:
+ // assigns String / creates forumula cell
+ void SetOldValue( const rtl::OUString& rOld, ScDocument* pDoc );
+ void SetNewValue( const rtl::OUString& rNew, ScDocument* pDoc );
- void GetOldString( String& ) const;
- void GetNewString( String& ) const;
+ void GetOldString( rtl::OUString& rStr ) const;
+ void GetNewString( rtl::OUString& rStr ) const;
const ScBaseCell* GetOldCell() const { return pOldCell; }
const ScBaseCell* GetNewCell() const { return pNewCell; }
virtual void GetDescription( String&, ScDocument*,
@@ -863,28 +830,12 @@ public:
static ScChangeActionContentCellType GetContentCellType( const ScBaseCell* );
- // NewCell
- sal_Bool IsMatrixOrigin() const
- {
- return GetContentCellType( GetNewCell() )
- == SC_CACCT_MATORG;
- }
- sal_Bool IsMatrixReference() const
- {
- return GetContentCellType( GetNewCell() )
- == SC_CACCT_MATREF;
- }
- // OldCell
- sal_Bool IsOldMatrixOrigin() const
- {
- return GetContentCellType( GetOldCell() )
- == SC_CACCT_MATORG;
- }
- sal_Bool IsOldMatrixReference() const
- {
- return GetContentCellType( GetOldCell() )
- == SC_CACCT_MATREF;
- }
+ // NewCell
+ bool IsMatrixOrigin() const;
+ bool IsMatrixReference() const;
+ // OldCell
+ bool IsOldMatrixOrigin() const;
+ bool IsOldMatrixReference() const;
};
@@ -977,7 +928,7 @@ class ScChangeTrack : public utl::ConfigurationListener
ScChangeTrackMsgStack aMsgStackTmp;
ScChangeTrackMsgStack aMsgStackFinal;
std::set<rtl::OUString> maUserCollection;
- String aUser;
+ rtl::OUString maUser;
Link aModifiedLink;
ScRange aInDeleteRange;
DateTime aFixDateTime;
@@ -1000,13 +951,13 @@ class ScChangeTrack : public utl::ConfigurationListener
sal_uLong nLastMerge;
ScChangeTrackMergeState eMergeState;
sal_uInt16 nLoadedFileFormatVersion;
- sal_Bool bLoadSave;
- sal_Bool bInDelete;
- sal_Bool bInDeleteUndo;
- sal_Bool bInDeleteTop;
- sal_Bool bInPasteCut;
- sal_Bool bUseFixDateTime;
- sal_Bool bTime100thSeconds;
+ bool bLoadSave:1;
+ bool bInDelete:1;
+ bool bInDeleteUndo:1;
+ bool bInDeleteTop:1;
+ bool bInPasteCut:1;
+ bool bUseFixDateTime:1;
+ bool bTime100thSeconds:1;
// not implemented, prevent usage
ScChangeTrack( const ScChangeTrack& );
@@ -1015,24 +966,23 @@ class ScChangeTrack : public utl::ConfigurationListener
#ifdef SC_CHGTRACK_CXX
static SCROW InitContentRowsPerSlot();
- // true if one is MM_FORMULA and the other is
- // not, or if both are and range differs
- static sal_Bool IsMatrixFormulaRangeDifferent(
- const ScBaseCell* pOldCell,
- const ScBaseCell* pNewCell );
+ // true if one is MM_FORMULA and the other is
+ // not, or if both are and range differs
+ static bool IsMatrixFormulaRangeDifferent(
+ const ScBaseCell* pOldCell, const ScBaseCell* pNewCell );
void Init();
void DtorClear();
- void SetLoadSave( sal_Bool bVal ) { bLoadSave = bVal; }
+ void SetLoadSave( bool bVal ) { bLoadSave = bVal; }
void SetInDeleteRange( const ScRange& rRange )
{ aInDeleteRange = rRange; }
- void SetInDelete( sal_Bool bVal )
+ void SetInDelete( bool bVal )
{ bInDelete = bVal; }
- void SetInDeleteTop( sal_Bool bVal )
+ void SetInDeleteTop( bool bVal )
{ bInDeleteTop = bVal; }
- void SetInDeleteUndo( sal_Bool bVal )
+ void SetInDeleteUndo( bool bVal )
{ bInDeleteUndo = bVal; }
- void SetInPasteCut( sal_Bool bVal )
+ void SetInPasteCut( bool bVal )
{ bInPasteCut = bVal; }
void SetMergeState( ScChangeTrackMergeState eState )
{ eMergeState = eState; }
@@ -1110,8 +1060,8 @@ public:
ScChangeAction* GetFirst() const { return pFirst; }
ScChangeAction* GetLast() const { return pLast; }
sal_uLong GetActionMax() const { return nActionMax; }
- sal_Bool IsGenerated( sal_uLong nAction ) const
- { return nAction >= nGeneratedMin; }
+ bool IsGenerated( sal_uLong nAction ) const
+ { return nAction >= nGeneratedMin; }
ScChangeAction* GetAction( sal_uLong nAction ) const
{
ScChangeActionMap::const_iterator it = aMap.find( nAction );
@@ -1148,15 +1098,15 @@ public:
}
ScChangeActionContent** GetContentSlots() const { return ppContentSlots; }
- sal_Bool IsLoadSave() const { return bLoadSave; }
+ bool IsLoadSave() const { return bLoadSave; }
const ScRange& GetInDeleteRange() const
{ return aInDeleteRange; }
- sal_Bool IsInDelete() const { return bInDelete; }
- sal_Bool IsInDeleteTop() const { return bInDeleteTop; }
- sal_Bool IsInDeleteUndo() const { return bInDeleteUndo; }
- sal_Bool IsInPasteCut() const { return bInPasteCut; }
- SC_DLLPUBLIC void SetUser( const String& );
- const String& GetUser() const { return aUser; }
+ bool IsInDelete() const { return bInDelete; }
+ bool IsInDeleteTop() const { return bInDeleteTop; }
+ bool IsInDeleteUndo() const { return bInDeleteUndo; }
+ bool IsInPasteCut() const { return bInPasteCut; }
+ SC_DLLPUBLIC void SetUser( const rtl::OUString& rUser );
+ SC_DLLPUBLIC const rtl::OUString& GetUser() const;
SC_DLLPUBLIC const std::set<rtl::OUString>& GetUserCollection() const;
ScDocument* GetDocument() const { return pDoc; }
// for import filter
@@ -1165,7 +1115,7 @@ public:
// set this if the date/time set with
// SetFixDateTime...() shall be applied to
// appended actions
- void SetUseFixDateTime( sal_Bool bVal )
+ void SetUseFixDateTime( bool bVal )
{ bUseFixDateTime = bVal; }
// for MergeDocument, apply original date/time as UTC
void SetFixDateTimeUTC( const DateTime& rDT )
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index b44b916..3f9e64d 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -130,8 +130,37 @@ ScChangeAction::~ScChangeAction()
RemoveAllLinks();
}
+bool ScChangeAction::IsInsertType() const
+{
+ return eType == SC_CAT_INSERT_COLS || eType == SC_CAT_INSERT_ROWS || eType == SC_CAT_INSERT_TABS;
+}
+
+bool ScChangeAction::IsDeleteType() const
+{
+ return eType == SC_CAT_DELETE_COLS || eType == SC_CAT_DELETE_ROWS || eType == SC_CAT_DELETE_TABS;
+}
+
+bool ScChangeAction::IsVirgin() const
+{
+ return eState == SC_CAS_VIRGIN;
+}
+
+bool ScChangeAction::IsAccepted() const
+{
+ return eState == SC_CAS_ACCEPTED;
+}
+
+bool ScChangeAction::IsRejected() const
+{
+ return eState == SC_CAS_REJECTED;
+}
-sal_Bool ScChangeAction::IsVisible() const
+bool ScChangeAction::IsRejecting() const
+{
+ return nRejectAction != 0;
+}
+
+bool ScChangeAction::IsVisible() const
{
//! sequence order of execution is significant
if ( IsRejected() || GetType() == SC_CAT_DELETE_TABS || IsDeletedIn() )
@@ -142,7 +171,7 @@ sal_Bool ScChangeAction::IsVisible() const
}
-sal_Bool ScChangeAction::IsTouchable() const
+bool ScChangeAction::IsTouchable() const
{
//! sequence order of execution is significant
if ( IsRejected() || GetType() == SC_CAT_REJECT || IsDeletedIn() )
@@ -156,7 +185,7 @@ sal_Bool ScChangeAction::IsTouchable() const
}
-sal_Bool ScChangeAction::IsClickable() const
+bool ScChangeAction::IsClickable() const
{
//! sequence order of execution is significant
if ( !IsVirgin() )
@@ -188,7 +217,7 @@ sal_Bool ScChangeAction::IsClickable() const
}
-sal_Bool ScChangeAction::IsRejectable() const
+bool ScChangeAction::IsRejectable() const
{
//! sequence order of execution is significant
if ( !IsClickable() )
@@ -226,13 +255,13 @@ bool ScChangeAction::IsInternalRejectable() const
}
-sal_Bool ScChangeAction::IsDialogRoot() const
+bool ScChangeAction::IsDialogRoot() const
{
return IsInternalRejectable(); // only rejectables in root
}
-sal_Bool ScChangeAction::IsDialogParent() const
+bool ScChangeAction::IsDialogParent() const
{
//! sequence order of execution is significant
if ( GetType() == SC_CAT_CONTENT )
@@ -269,7 +298,7 @@ sal_Bool ScChangeAction::IsDialogParent() const
}
-sal_Bool ScChangeAction::IsMasterDelete() const
+bool ScChangeAction::IsMasterDelete() const
{
if ( !IsDeleteType() )
return false;
@@ -311,8 +340,17 @@ bool ScChangeAction::RemoveDeletedIn( const ScChangeAction* p )
return bRemoved;
}
+bool ScChangeAction::IsDeletedIn() const
+{
+ return GetDeletedIn() != NULL;
+}
-sal_Bool ScChangeAction::IsDeletedIn( const ScChangeAction* p ) const
+bool ScChangeAction::IsDeleted() const
+{
+ return IsDeleteType() || IsDeletedIn();
+}
+
+bool ScChangeAction::IsDeletedIn( const ScChangeAction* p ) const
{
ScChangeActionLinkEntry* pL = GetDeletedIn();
while ( pL )
@@ -324,7 +362,6 @@ sal_Bool ScChangeAction::IsDeletedIn( const ScChangeAction* p ) const
return false;
}
-
void ScChangeAction::RemoveAllDeletedIn()
{
//! nicht vom evtl. TopContent sondern wirklich dieser
@@ -332,8 +369,7 @@ void ScChangeAction::RemoveAllDeletedIn()
delete pLinkDeletedIn; // rueckt sich selbst hoch
}
-
-sal_Bool ScChangeAction::IsDeletedInDelType( ScChangeActionType eDelType ) const
+bool ScChangeAction::IsDeletedInDelType( ScChangeActionType eDelType ) const
{
ScChangeAction* p;
ScChangeActionLinkEntry* pL = GetDeletedIn();
@@ -366,6 +402,15 @@ sal_Bool ScChangeAction::IsDeletedInDelType( ScChangeActionType eDelType ) const
return false;
}
+bool ScChangeAction::HasDependent() const
+{
+ return pLinkDependent != NULL;
+}
+
+bool ScChangeAction::HasDeleted() const
+{
+ return pLinkDeleted != NULL;
+}
void ScChangeAction::SetDeletedIn( ScChangeAction* p )
{
@@ -832,13 +877,13 @@ void ScChangeActionDel::DeleteCellEntries()
}
-sal_Bool ScChangeActionDel::IsBaseDelete() const
+bool ScChangeActionDel::IsBaseDelete() const
{
return !GetDx() && !GetDy();
}
-sal_Bool ScChangeActionDel::IsTopDelete() const
+bool ScChangeActionDel::IsTopDelete() const
{
const ScChangeAction* p = GetNext();
if ( !p || p->GetType() != GetType() )
@@ -847,7 +892,7 @@ sal_Bool ScChangeActionDel::IsTopDelete() const
}
-sal_Bool ScChangeActionDel::IsMultiDelete() const
+bool ScChangeActionDel::IsMultiDelete() const
{
if ( GetDx() || GetDy() )
return true;
@@ -862,7 +907,7 @@ sal_Bool ScChangeActionDel::IsMultiDelete() const
}
-sal_Bool ScChangeActionDel::IsTabDeleteCol() const
+bool ScChangeActionDel::IsTabDeleteCol() const
{
if ( GetType() != SC_CAT_DELETE_COLS )
return false;
@@ -873,6 +918,14 @@ sal_Bool ScChangeActionDel::IsTabDeleteCol() const
return p && p->GetType() == SC_CAT_DELETE_TABS;
}
+SCsCOL ScChangeActionDel::GetDx() const { return nDx; }
+SCsROW ScChangeActionDel::GetDy() const { return nDy; }
+
+ScChangeActionDelMoveEntry* ScChangeActionDel::AddCutOffMove(
+ ScChangeActionMove* pMove, short nFrom, short nTo )
+{
+ return new ScChangeActionDelMoveEntry(&pLinkMove, pMove, nFrom, nTo);
+}
void ScChangeActionDel::UpdateReference( const ScChangeTrack* /* pTrack */,
UpdateRefMode eMode, const ScBigRange& rRange,
@@ -1407,19 +1460,20 @@ void ScChangeActionContent::SetNewCell( ScBaseCell* pCell, ScDocument* pDoc, con
aNewValue = rFormatted;
}
-void ScChangeActionContent::SetValueString( String& rValue, ScBaseCell*& pCell,
- const String& rStr, ScDocument* pDoc )
+void ScChangeActionContent::SetValueString(
+ rtl::OUString& rValue, ScBaseCell*& pCell, const rtl::OUString& rStr, ScDocument* pDoc )
{
if ( pCell )
{
pCell->Delete();
pCell = NULL;
}
- if ( rStr.Len() > 1 && rStr.GetChar(0) == '=' )
+ if ( rStr.getLength() > 1 && rStr.getStr()[0] == '=' )
{
- rValue.Erase();
+ rValue = rtl::OUString();
pCell = new ScFormulaCell(
- pDoc, aBigRange.aStart.MakeAddress(), rStr, formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::CONV_OOO );
+ pDoc, aBigRange.aStart.MakeAddress(), rStr,
+ formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::CONV_OOO );
((ScFormulaCell*)pCell)->SetInChangeTrack( true );
}
else
@@ -1427,25 +1481,25 @@ void ScChangeActionContent::SetValueString( String& rValue, ScBaseCell*& pCell,
}
-void ScChangeActionContent::SetOldValue( const String& rOld, ScDocument* pDoc )
+void ScChangeActionContent::SetOldValue( const rtl::OUString& rOld, ScDocument* pDoc )
{
SetValueString( aOldValue, pOldCell, rOld, pDoc );
}
-void ScChangeActionContent::SetNewValue( const String& rNew, ScDocument* pDoc )
+void ScChangeActionContent::SetNewValue( const rtl::OUString& rNew, ScDocument* pDoc )
{
SetValueString( aNewValue, pNewCell, rNew, pDoc );
}
-void ScChangeActionContent::GetOldString( String& rStr ) const
+void ScChangeActionContent::GetOldString( rtl::OUString& rStr ) const
{
GetValueString( rStr, aOldValue, pOldCell );
}
-void ScChangeActionContent::GetNewString( String& rStr ) const
+void ScChangeActionContent::GetNewString( rtl::OUString& rStr ) const
{
GetValueString( rStr, aNewValue, pNewCell );
}
@@ -1456,33 +1510,44 @@ void ScChangeActionContent::GetDescription( String& rStr, ScDocument* pDoc,
{
ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
- String aRsc( ScGlobal::GetRscString( STR_CHANGED_CELL ) );
+ rtl::OUString aRsc = ScGlobal::GetRscString(STR_CHANGED_CELL);
- String aTmpStr;
- GetRefString( aTmpStr, pDoc );
+ rtl::OUString aTmpStr;
+ String aFoo;
+ GetRefString(aFoo, pDoc);
+ aTmpStr = aFoo;
- xub_StrLen nPos = 0;
- nPos = aRsc.SearchAscii( "#1", nPos );
- aRsc.Erase( nPos, 2 );
- aRsc.Insert( aTmpStr, nPos );
- nPos = sal::static_int_cast<xub_StrLen>( nPos + aTmpStr.Len() );
+ sal_Int32 nPos = 0;
+ nPos = aRsc.indexOfAsciiL("#1", 2, nPos);
+ if (nPos >= 0)
+ {
+ aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
+ nPos += aTmpStr.getLength();
+ }
GetOldString( aTmpStr );
- if ( !aTmpStr.Len() )
+ if (aTmpStr.isEmpty())
aTmpStr = ScGlobal::GetRscString( STR_CHANGED_BLANK );
- nPos = aRsc.SearchAscii( "#2", nPos );
- aRsc.Erase( nPos, 2 );
- aRsc.Insert( aTmpStr, nPos );
- nPos = sal::static_int_cast<xub_StrLen>( nPos + aTmpStr.Len() );
+
+ nPos = aRsc.indexOfAsciiL("#2", 2, nPos);
+ if (nPos >= 0)
+ {
+ aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
+ nPos += aTmpStr.getLength();
+ }
GetNewString( aTmpStr );
- if ( !aTmpStr.Len() )
+ if (aTmpStr.isEmpty())
aTmpStr = ScGlobal::GetRscString( STR_CHANGED_BLANK );
- nPos = aRsc.SearchAscii( "#3", nPos );
- aRsc.Erase( nPos, 2 );
- aRsc.Insert( aTmpStr, nPos );
- rStr += aRsc;
+ nPos = aRsc.indexOfAsciiL("#3", 2, nPos);
+ if (nPos >= 0)
+ {
+ aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
+ nPos += aTmpStr.getLength();
+ }
+
+ rStr += String(aRsc);
}
@@ -1598,8 +1663,8 @@ bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
}
-void ScChangeActionContent::GetStringOfCell( String& rStr,
- const ScBaseCell* pCell, const ScDocument* pDoc, const ScAddress& rPos )
+void ScChangeActionContent::GetStringOfCell( rtl::OUString& rStr,
+ const ScBaseCell* pCell, const ScDocument* pDoc, const ScAddress& rPos )
{
if ( pCell )
{
@@ -1609,12 +1674,12 @@ void ScChangeActionContent::GetStringOfCell( String& rStr,
GetStringOfCell( rStr, pCell, pDoc, 0 );
}
else
- rStr.Erase();
+ rStr = rtl::OUString();
}
-void ScChangeActionContent::GetStringOfCell( String& rStr,
- const ScBaseCell* pCell, const ScDocument* pDoc, sal_uLong nFormat )
+void ScChangeActionContent::GetStringOfCell( rtl::OUString& rStr,
+ const ScBaseCell* pCell, const ScDocument* pDoc, sal_uLong nFormat )
{
if ( ScChangeActionContent::GetContentCellType( pCell ) )
{
@@ -1637,11 +1702,11 @@ void ScChangeActionContent::GetStringOfCell( String& rStr,
((ScFormulaCell*)pCell)->GetFormula( rStr );
break;
default:
- rStr.Erase();
+ rStr = rtl::OUString();
}
}
else
- rStr.Erase();
+ rStr = rtl::OUString();
}
@@ -1686,19 +1751,19 @@ bool ScChangeActionContent::NeedsNumberFormat( const ScBaseCell* pCell )
}
-void ScChangeActionContent::SetValue( String& rStr, ScBaseCell*& pCell,
- const ScAddress& rPos, const ScBaseCell* pOrgCell,
- const ScDocument* pFromDoc, ScDocument* pToDoc )
+void ScChangeActionContent::SetValue(
+ rtl::OUString& rStr, ScBaseCell*& pCell, const ScAddress& rPos, const ScBaseCell* pOrgCell,
+ const ScDocument* pFromDoc, ScDocument* pToDoc )
{
sal_uLong nFormat = NeedsNumberFormat( pOrgCell ) ? pFromDoc->GetNumberFormat( rPos ) : 0;
SetValue( rStr, pCell, nFormat, pOrgCell, pFromDoc, pToDoc );
}
-void ScChangeActionContent::SetValue( String& rStr, ScBaseCell*& pCell,
- sal_uLong nFormat, const ScBaseCell* pOrgCell,
- const ScDocument* pFromDoc, ScDocument* pToDoc )
+void ScChangeActionContent::SetValue(
+ rtl::OUString& rStr, ScBaseCell*& pCell, sal_uLong nFormat, const ScBaseCell* pOrgCell,
+ const ScDocument* pFromDoc, ScDocument* pToDoc )
{
- rStr.Erase();
+ rStr = rtl::OUString();
if ( pCell )
pCell->Delete();
if ( ScChangeActionContent::GetContentCellType( pOrgCell ) )
@@ -1727,10 +1792,10 @@ void ScChangeActionContent::SetValue( String& rStr, ScBaseCell*& pCell,
}
-void ScChangeActionContent::SetCell( String& rStr, ScBaseCell* pCell,
- sal_uLong nFormat, const ScDocument* pDoc )
+void ScChangeActionContent::SetCell(
+ rtl::OUString& rStr, ScBaseCell* pCell, sal_uLong nFormat, const ScDocument* pDoc )
{
- rStr.Erase();
+ rStr = rtl::OUString();
if ( pCell )
{
switch ( pCell->GetCellType() )
@@ -1754,10 +1819,10 @@ void ScChangeActionContent::SetCell( String& rStr, ScBaseCell* pCell,
}
-void ScChangeActionContent::GetValueString( String& rStr,
- const String& rValue, const ScBaseCell* pCell ) const
+void ScChangeActionContent::GetValueString(
+ rtl::OUString& rStr, const rtl::OUString& rValue, const ScBaseCell* pCell ) const
{
- if ( !rValue.Len() )
+ if (rValue.isEmpty())
{
if ( pCell )
{
@@ -1782,15 +1847,15 @@ void ScChangeActionContent::GetValueString( String& rStr,
}
}
else
- rStr.Erase();
+ rStr = rtl::OUString();
}
else
rStr = rValue;
}
-void ScChangeActionContent::GetFormulaString( String& rStr,
- const ScFormulaCell* pCell ) const
+void ScChangeActionContent::GetFormulaString(
+ rtl::OUString& rStr, const ScFormulaCell* pCell ) const
{
ScAddress aPos( aBigRange.aStart.MakeAddress() );
if ( aPos == pCell->aPos || IsDeletedIn() )
@@ -2039,6 +2104,25 @@ void ScChangeActionContent::UpdateReference( const ScChangeTrack* pTrack,
}
}
+bool ScChangeActionContent::IsMatrixOrigin() const
+{
+ return GetContentCellType(GetNewCell()) == SC_CACCT_MATORG;
+}
+
+bool ScChangeActionContent::IsMatrixReference() const
+{
+ return GetContentCellType(GetNewCell()) == SC_CACCT_MATREF;
+}
+
+bool ScChangeActionContent::IsOldMatrixOrigin() const
+{
+ return GetContentCellType(GetOldCell()) == SC_CACCT_MATORG;
+}
+
+bool ScChangeActionContent::IsOldMatrixReference() const
+{
+ return GetContentCellType(GetOldCell()) == SC_CACCT_MATREF;
+}
// --- ScChangeActionReject ------------------------------------------------
@@ -2131,10 +2215,12 @@ void ScChangeTrack::Init()
bTime100thSeconds = true;
const SvtUserOptions& rUserOpt = SC_MOD()->GetUserOptions();
- aUser = rUserOpt.GetFirstName();
- aUser += ' ';
- aUser += (String)rUserOpt.GetLastName();
- maUserCollection.insert(aUser);
+ rtl::OUStringBuffer aBuf;
+ aBuf.append(rUserOpt.GetFirstName());
+ aBuf.append(sal_Unicode(' '));
+ aBuf.append(rUserOpt.GetLastName());
+ maUser = aBuf.makeStringAndClear();
+ maUserCollection.insert(maUser);
}
@@ -2195,7 +2281,7 @@ void ScChangeTrack::Clear()
aGeneratedMap.clear();
aPasteCutMap.clear();
maUserCollection.clear();
- aUser.Erase();
+ maUser = rtl::OUString();
Init();
}
@@ -2231,15 +2317,19 @@ void ScChangeTrack::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uI
}
-void ScChangeTrack::SetUser( const String& rUser )
+void ScChangeTrack::SetUser( const rtl::OUString& rUser )
{
if ( IsLoadSave() )
return ; // nicht die Collection zerschiessen
- aUser = rUser;
- maUserCollection.insert(aUser);
+ maUser = rUser;
+ maUserCollection.insert(maUser);
}
+const rtl::OUString& ScChangeTrack::GetUser() const
+{
+ return maUser;
+}
void ScChangeTrack::StartBlockModify( ScChangeTrackMsgType eMsgType,
sal_uLong nStartAction )
@@ -2385,7 +2475,7 @@ void ScChangeTrack::Append( ScChangeAction* pAppend, sal_uLong nAction )
{
if ( nActionMax < nAction )
nActionMax = nAction;
- pAppend->SetUser( aUser );
+ pAppend->SetUser( maUser );
if ( bUseFixDateTime )
pAppend->SetDateTimeUTC( aFixDateTime );
pAppend->SetActionNumber( nAction );
@@ -2596,8 +2686,8 @@ void ScChangeTrack::AppendMove( const ScRange& rFromRange,
}
-sal_Bool ScChangeTrack::IsMatrixFormulaRangeDifferent( const ScBaseCell* pOldCell,
- const ScBaseCell* pNewCell )
+bool ScChangeTrack::IsMatrixFormulaRangeDifferent(
+ const ScBaseCell* pOldCell, const ScBaseCell* pNewCell )
{
SCCOL nC1, nC2;
SCROW nR1, nR2;
@@ -2617,13 +2707,12 @@ void ScChangeTrack::AppendContent( const ScAddress& rPos,
{
if ( !pRefDoc )
pRefDoc = pDoc;
- String aOldValue;
+ rtl::OUString aOldValue;
ScChangeActionContent::GetStringOfCell( aOldValue, pOldCell, pRefDoc, nOldFormat );
- String aNewValue;
+ rtl::OUString aNewValue;
ScBaseCell* pNewCell = pDoc->GetCell( rPos );
ScChangeActionContent::GetStringOfCell( aNewValue, pNewCell, pDoc, rPos );
- if ( aOldValue != aNewValue ||
- IsMatrixFormulaRangeDifferent( pOldCell, pNewCell ) )
+ if (!aOldValue.equals(aNewValue) || IsMatrixFormulaRangeDifferent(pOldCell, pNewCell))
{ // nur wirkliche Aenderung tracken
ScRange aRange( rPos );
ScChangeActionContent* pAct = new ScChangeActionContent( aRange );
@@ -2637,14 +2726,13 @@ void ScChangeTrack::AppendContent( const ScAddress& rPos,
void ScChangeTrack::AppendContent( const ScAddress& rPos,
ScDocument* pRefDoc )
{
- String aOldValue;
+ rtl::OUString aOldValue;
ScBaseCell* pOldCell = pRefDoc->GetCell( rPos );
ScChangeActionContent::GetStringOfCell( aOldValue, pOldCell, pRefDoc, rPos );
- String aNewValue;
+ rtl::OUString aNewValue;
ScBaseCell* pNewCell = pDoc->GetCell( rPos );
ScChangeActionContent::GetStringOfCell( aNewValue, pNewCell, pDoc, rPos );
- if ( aOldValue != aNewValue ||
- IsMatrixFormulaRangeDifferent( pOldCell, pNewCell ) )
+ if (!aOldValue.equals(aNewValue) || IsMatrixFormulaRangeDifferent(pOldCell, pNewCell))
{ // nur wirkliche Aenderung tracken
ScRange aRange( rPos );
ScChangeActionContent* pAct = new ScChangeActionContent( aRange );
@@ -4454,7 +4542,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
if ( pNewCell )
{
ScBaseCell* pClonedNewCell = pNewCell->CloneWithoutNote( *pDocument );
- String aNewValue;
+ rtl::OUString aNewValue;
pContent->GetNewString( aNewValue );
pClonedTrack->nGeneratedMin = pGenerated->GetActionNumber() + 1;
pClonedTrack->AddLoadedGenerated( pClonedNewCell, pGenerated->GetBigRange(), aNewValue );
@@ -4538,7 +4626,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
OSL_ENSURE( pContent, "ScChangeTrack::Clone: pContent is null!" );
const ScBaseCell* pOldCell = pContent->GetOldCell();
ScBaseCell* pClonedOldCell = pOldCell ? pOldCell->CloneWithoutNote( *pDocument ) : 0;
- String aOldValue;
+ rtl::OUString aOldValue;
pContent->GetOldString( aOldValue );
ScChangeActionContent* pClonedContent = new ScChangeActionContent(
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index e666da9..926a8c0 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -158,7 +158,7 @@ void ScChangeTrackingExportHelper::WriteGenerated(const ScChangeAction* pGenerat
#endif
SvXMLElementExport aElemPrev(rExport, XML_NAMESPACE_TABLE, XML_CELL_CONTENT_DELETION, true, true);
WriteBigRange(pGeneratedAction->GetBigRange(), XML_CELL_ADDRESS);
- String sValue;
+ rtl::OUString sValue;
static_cast<const ScChangeActionContent*>(pGeneratedAction)->GetNewString(sValue);
WriteCell(static_cast<const ScChangeActionContent*>(pGeneratedAction)->GetNewCell(), sValue);
}
@@ -177,9 +177,9 @@ void ScChangeTrackingExportHelper::WriteDeleted(const ScChangeAction* pDeletedAc
SvXMLElementExport aElemPrev(rExport, XML_NAMESPACE_TABLE, XML_CELL_CONTENT_DELETION, true, true);
if (static_cast<const ScChangeActionContent*>(pDeletedAction)->IsTopContent() && pDeletedAction->IsDeletedIn())
{
- String sValue;
+ rtl::OUString sValue;
pContentAction->GetNewString(sValue);
- WriteCell(pContentAction->GetNewCell(), sValue);
+ WriteCell(pContentAction->GetNewCell(), sValue);
}
}
else
@@ -445,7 +445,7 @@ void ScChangeTrackingExportHelper::WriteContentChange(ScChangeAction* pAction)
if (pPrevAction)
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ID, GetChangeID(pPrevAction->GetActionNumber()));
SvXMLElementExport aElemPrev(rExport, XML_NAMESPACE_TABLE, XML_PREVIOUS, true, true);
- String sValue;
+ rtl::OUString sValue;
static_cast<ScChangeActionContent*>(pAction)->GetOldString(sValue);
WriteCell(static_cast<ScChangeActionContent*>(pAction)->GetOldCell(), sValue);
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index bc769e9..929a5ef 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1021,7 +1021,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
OSL_ENSURE( aSourceRange.aStart == aSourceRange.aEnd, "huch?" );
ScAddress aPos = aSourceRange.aStart;
- String aValue;
+ rtl::OUString aValue;
((const ScChangeActionContent*)pSourceAction)->GetNewString( aValue );
sal_uInt8 eMatrix = MM_NONE;
const ScBaseCell* pCell = ((const ScChangeActionContent*)pSourceAction)->GetNewCell();
@@ -1039,8 +1039,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
((const ScFormulaCell*)pCell)->GetMatColsRows( nCols, nRows );
aSourceRange.aEnd.SetCol( aPos.Col() + nCols - 1 );
aSourceRange.aEnd.SetRow( aPos.Row() + nRows - 1 );
- aValue.Erase( 0, 1 );
- aValue.Erase( aValue.Len()-1, 1 );
+ aValue = aValue.copy(1, aValue.getLength()-2); // remove the 1st and last characters.
GetDocFunc().EnterMatrix( aSourceRange,
NULL, NULL, aValue, false, false,
EMPTY_STRING, formula::FormulaGrammar::GRAM_DEFAULT );
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index ae100b0..f3ab4db 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -696,7 +696,9 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionConte
if(nSpecial==RD_SPECIAL_CONTENT)
{
- pScChangeAction->GetOldString(a2String);
+ rtl::OUString aTmp;
+ pScChangeAction->GetOldString(aTmp);
+ a2String = aTmp;
if(a2String.Len()==0) a2String=aStrEmpty;
//aString+="\'";
@@ -708,7 +710,9 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionConte
}
else
{
- pScChangeAction->GetNewString(a2String);
+ rtl::OUString aTmp;
+ pScChangeAction->GetNewString(aTmp);
+ a2String = aTmp;
if(a2String.Len()==0)
{
a2String=aStrEmpty;
commit e996e3d1eb5da932ed3d764789581d13dcb0f9b3
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Feb 2 15:35:06 2012 -0500
Oops, bug.
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 13a131f..cfa44de 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -155,7 +155,7 @@ void ScActionColorChanger::Update( const ScChangeAction& rAction )
else
{
size_t nPos = std::distance(rUsers.begin(), it);
- nLastUserIndex = nPos & SC_AUTHORCOLORCOUNT;
+ nLastUserIndex = nPos % SC_AUTHORCOLORCOUNT;
}
}
nColor = nAuthorColor[nLastUserIndex];
commit adad96ac1b2e865287c99cf1fbde76fa94ea2f24
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Feb 2 15:32:58 2012 -0500
String to rtl::OUString.
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 7372471..cef2eda 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -232,8 +232,8 @@ protected:
ScBigRange aBigRange; // Ins/Del/MoveTo/ContentPos
DateTime aDateTime; //! UTC
- String aUser; // who?
- String aComment; // user comment
+ rtl::OUString aUser; // who?
+ rtl::OUString aComment; // user comment
ScChangeAction* pNext; // next in linked list
ScChangeAction* pPrev; // previous in linked list
ScChangeActionLinkEntry* pLinkAny; // arbitrary links
@@ -246,8 +246,7 @@ protected:
ScChangeActionType eType;
ScChangeActionState eState;
- ScChangeAction( ScChangeActionType,
- const ScRange& );
+ ScChangeAction( ScChangeActionType, const ScRange& );
// only to be used in the XML import
ScChangeAction( ScChangeActionType,
@@ -256,20 +255,20 @@ protected:
const sal_uLong nRejectAction,
const ScChangeActionState eState,
const DateTime& aDateTime,
- const String& aUser,
- const String& aComment );
+ const rtl::OUString& aUser,
+ const rtl::OUString& aComment );
+
// only to be used in the XML import
- ScChangeAction( ScChangeActionType,
- const ScBigRange&,
- const sal_uLong nAction);
+ ScChangeAction( ScChangeActionType, const ScBigRange&, const sal_uLong nAction);
virtual ~ScChangeAction();
- String GetRefString( const ScBigRange&, ScDocument*, bool bFlag3D = false ) const;
+ rtl::OUString GetRefString(
+ const ScBigRange& rRange, ScDocument* pDoc, bool bFlag3D = false) const;
void SetActionNumber( sal_uLong n ) { nAction = n; }
void SetRejectAction( sal_uLong n ) { nRejectAction = n; }
- void SetUser( const String& r ) { aUser = r; }
+ void SetUser( const rtl::OUString& r );
void SetType( ScChangeActionType e ) { eType = e; }
void SetState( ScChangeActionState e ) { eState = e; }
void SetRejected();
@@ -325,7 +324,7 @@ protected:
sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz );
void Accept();
- virtual sal_Bool Reject( ScDocument* ) = 0;
+ virtual bool Reject(ScDocument* pDoc) = 0;
void RejectRestoreContents( ScChangeTrack*, SCsCOL nDx, SCsROW nDy );
// used in Reject() instead of IsRejectable()
@@ -384,8 +383,6 @@ public:
SC_DLLPUBLIC DateTime GetDateTime() const; // local time
const DateTime& GetDateTimeUTC() const // UTC time
{ return aDateTime; }
- const String& GetUser() const { return aUser; }
- const String& GetComment() const { return aComment; }
ScChangeActionType GetType() const { return eType; }
ScChangeActionState GetState() const { return eState; }
sal_uLong GetActionNumber() const { return nAction; }
@@ -423,9 +420,11 @@ public:
void SetDateTimeUTC( const DateTime& rDT )
{ aDateTime = rDT; }
- // set user comment
- void SetComment( const String& rStr )
- { aComment = rStr; }
+ SC_DLLPUBLIC const rtl::OUString& GetUser() const;
+ const rtl::OUString& GetComment() const;
+
+ // set user comment
+ void SetComment( const rtl::OUString& rStr );
// only to be used in the XML import
void SetDeletedInThis( sal_uLong nActionNumber,
@@ -448,7 +447,7 @@ class ScChangeActionIns : public ScChangeAction
virtual void AddContent( ScChangeActionContent* ) {}
virtual void DeleteCellEntries() {}
- virtual sal_Bool Reject( ScDocument* );
+ virtual bool Reject(ScDocument* pDoc);
virtual const ScChangeTrack* GetChangeTrack() const { return 0; }
@@ -546,7 +545,7 @@ class ScChangeActionDel : public ScChangeAction
UpdateRefMode, const ScBigRange&,
sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz );
- virtual sal_Bool Reject( ScDocument* );
+ virtual bool Reject(ScDocument* pDoc);
virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; }
@@ -641,7 +640,7 @@ class ScChangeActionMove : public ScChangeAction
UpdateRefMode, const ScBigRange&,
sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz );
- virtual sal_Bool Reject( ScDocument* );
+ virtual bool Reject(ScDocument* pDoc);
virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; }
@@ -765,7 +764,7 @@ class ScChangeActionContent : public ScChangeAction
UpdateRefMode, const ScBigRange&,
sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz );
- virtual sal_Bool Reject( ScDocument* );
+ virtual bool Reject(ScDocument* pDoc);
virtual const ScChangeTrack* GetChangeTrack() const { return 0; }
@@ -906,7 +905,7 @@ class ScChangeActionReject : public ScChangeAction
virtual void AddContent( ScChangeActionContent* ) {}
virtual void DeleteCellEntries() {}
- virtual sal_Bool Reject( ScDocument* ) { return false; }
+ virtual bool Reject(ScDocument* pDoc);
virtual const ScChangeTrack* GetChangeTrack() const { return 0; }
@@ -962,10 +961,10 @@ enum ScChangeTrackMergeState
class ScChangeTrack : public utl::ConfigurationListener
{
friend void ScChangeAction::RejectRestoreContents( ScChangeTrack*, SCsCOL, SCsROW );
- friend sal_Bool ScChangeActionDel::Reject( ScDocument* pDoc );
+ friend bool ScChangeActionDel::Reject( ScDocument* pDoc );
friend void ScChangeActionDel::DeleteCellEntries();
friend void ScChangeActionMove::DeleteCellEntries();
- friend sal_Bool ScChangeActionMove::Reject( ScDocument* pDoc );
+ friend bool ScChangeActionMove::Reject( ScDocument* pDoc );
static const SCROW nContentRowsPerSlot;
static const SCSIZE nContentSlots;
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 1239a53..b44b916 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -83,11 +83,11 @@ ScChangeAction::ScChangeAction( ScChangeActionType eTypeP, const ScRange& rRange
aDateTime.ConvertToUTC();
}
-ScChangeAction::ScChangeAction( ScChangeActionType eTypeP, const ScBigRange& rRange,
- const sal_uLong nTempAction, const sal_uLong nTempRejectAction,
- const ScChangeActionState eTempState, const DateTime& aTempDateTime,
- const String& aTempUser, const String& aTempComment)
- :
+ScChangeAction::ScChangeAction(
+ ScChangeActionType eTypeP, const ScBigRange& rRange,
+ const sal_uLong nTempAction, const sal_uLong nTempRejectAction,
+ const ScChangeActionState eTempState, const DateTime& aTempDateTime,
+ const rtl::OUString& aTempUser, const rtl::OUString& aTempComment) :
aBigRange( rRange ),
aDateTime( aTempDateTime ),
aUser( aTempUser ),
@@ -480,13 +480,13 @@ void ScChangeAction::GetDescription( String& rStr, ScDocument* /* pDoc */,
}
-String ScChangeAction::GetRefString(
+rtl::OUString ScChangeAction::GetRefString(
const ScBigRange& rRange, ScDocument* pDoc, bool bFlag3D ) const
{
- String aStr;
+ rtl::OUStringBuffer aBuf;
sal_uInt16 nFlags = ( rRange.IsValid( pDoc ) ? SCA_VALID : 0 );
if ( !nFlags )
- aStr = ScGlobal::GetRscString( STR_NOREF_STR );
+ aBuf.append(ScGlobal::GetRscString(STR_NOREF_STR));
else
{
ScRange aTmpRange( rRange.MakeRange() );
@@ -498,12 +498,12 @@ String ScChangeAction::GetRefString(
{
rtl::OUString aTmp;
pDoc->GetName( aTmpRange.aStart.Tab(), aTmp );
- aStr = aTmp;
- aStr += '.';
+ aBuf.append(aTmp);
+ aBuf.append(sal_Unicode('.'));
}
- aStr += ::ScColToAlpha( aTmpRange.aStart.Col() );
- aStr += ':';
- aStr += ::ScColToAlpha( aTmpRange.aEnd.Col() );
+ aBuf.append(ScColToAlpha(aTmpRange.aStart.Col()));
+ aBuf.append(sal_Unicode(':'));
+ aBuf.append(ScColToAlpha(aTmpRange.aEnd.Col()));
break;
case SC_CAT_INSERT_ROWS :
case SC_CAT_DELETE_ROWS :
@@ -511,27 +511,51 @@ String ScChangeAction::GetRefString(
{
rtl::OUString aTmp;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list