summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2012-02-02 23:42:34 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-02-03 00:02:47 -0500
commitc827b9756f069bec82c559c0e7dee534bcee8c2e (patch)
treebe2972011cd903744c09b6971bb01fea476a56fc /sc
parentd7c1b89abd85e6edd317f6c4eb1e86eef02df923 (diff)
GetDescription() now deals with rtl::OUString.
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/chgtrack.hxx28
-rw-r--r--sc/source/core/tool/chgtrack.cxx246
-rw-r--r--sc/source/ui/docshell/docsh3.cxx10
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx29
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx6
-rw-r--r--sc/source/ui/miscdlgs/redcom.cxx2
-rw-r--r--sc/source/ui/view/gridwin5.cxx4
-rw-r--r--sc/source/ui/view/viewutil.cxx11
8 files changed, 190 insertions, 146 deletions
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 7fb4cd7e4946..7781e930f02f 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 3f9e64d2a458..4b3244954422 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 929a5ef0c032..349a7a81d313 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 f3ab4db87d65..b0126304d860 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 4e087cb6221f..3ef5ad488a88 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 df04b07a4bf0..46d6ef6d3b2a 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 0561342fe645..ed6ebae8fc47 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 a1eea9eacccc..74bcb8929cd8 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;