summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-09-08 16:34:47 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-09-08 20:44:25 +0100
commit7fd6d43c1dae1548aca5ae4ed6d63cbf7e10b7ea (patch)
treebfb79a7732e4948b871856a89c3affdc0877cc2a /sw
parenta77a573883ce49d045159bdf3f8735594d1e81b4 (diff)
Related: fdo#38838 String::GetBufferAccess is now no more
Change-Id: I9fdd600fd0a530c0763875109eee6600e4a77879
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/undo/unovwr.cxx5
-rw-r--r--sw/source/ui/docvw/edtwin2.cxx13
-rw-r--r--sw/source/ui/inc/content.hxx2
-rw-r--r--sw/source/ui/inc/navipi.hxx2
-rw-r--r--sw/source/ui/utlui/content.cxx29
-rw-r--r--sw/source/ui/utlui/navipi.cxx16
6 files changed, 36 insertions, 31 deletions
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index b223846b6eaf..b7559c2e3b06 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -200,9 +200,6 @@ void SwUndoOverwrite::UndoImpl(::sw::UndoRedoContext & rContext)
if( aDelStr.Len() )
{
- String aTmpStr = OUString('1');
- sal_Unicode* pTmpStr = aTmpStr.GetBufferAccess();
-
bool bOldExpFlg = pTxtNd->IsIgnoreDontExpand();
pTxtNd->SetIgnoreDontExpand( true );
@@ -210,7 +207,7 @@ void SwUndoOverwrite::UndoImpl(::sw::UndoRedoContext & rContext)
for( xub_StrLen n = 0; n < aDelStr.Len(); n++ )
{
// do it individually, to keep the attributes!
- *pTmpStr = aDelStr.GetChar( n );
+ OUString aTmpStr(aDelStr.GetChar(n));
OUString const ins( pTxtNd->InsertText(aTmpStr, rIdx) );
assert(ins.getLength() == 1); // cannot fail
rIdx -= 2;
diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx
index 559aa1478507..57588811b65b 100644
--- a/sw/source/ui/docvw/edtwin2.cxx
+++ b/sw/source/ui/docvw/edtwin2.cxx
@@ -195,14 +195,15 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
if( sTxt.Len() )
{
- sTxt = comphelper::string::remove(sTxt, 0xad);
- for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p )
+ OUStringBuffer sTmp(comphelper::string::remove(sTxt, 0xad));
+ for (sal_Int32 i = 0; i < sTmp.getLength(); ++i)
{
- if( *p < 0x20 )
- *p = 0x20;
- else if(*p == 0x2011)
- *p = '-';
+ if (sTmp[i] < 0x20)
+ sTmp[i] = 0x20;
+ else if (sTmp[i] == 0x2011)
+ sTmp[i] = '-';
}
+ sTxt = sTmp.makeStringAndClear();
}
}
}
diff --git a/sw/source/ui/inc/content.hxx b/sw/source/ui/inc/content.hxx
index 57c292748db0..4e1cbcd77052 100644
--- a/sw/source/ui/inc/content.hxx
+++ b/sw/source/ui/inc/content.hxx
@@ -181,7 +181,7 @@ class SwContentType : public SwTypeNumber
bool bEdit: 1; // can this type be edited?
bool bDelete: 1; // can this type be deleted?
protected:
- void RemoveNewline(String&);
+ OUString RemoveNewline(const OUString&);
public:
SwContentType(SwWrtShell* pParent, sal_uInt16 nType, sal_uInt8 nLevel );
~SwContentType();
diff --git a/sw/source/ui/inc/navipi.hxx b/sw/source/ui/inc/navipi.hxx
index 4e339cf2eed3..0fb4bd0f3e23 100644
--- a/sw/source/ui/inc/navipi.hxx
+++ b/sw/source/ui/inc/navipi.hxx
@@ -156,7 +156,7 @@ public:
const SfxPoolItem* pState );
static String CreateDropFileName( TransferableDataHelper& rData );
- static void CleanEntry( String& rEntry );
+ static OUString CleanEntry(const OUString& rEntry);
sal_uInt16 GetRegionDropMode() const {return nRegionMode;}
void SetRegionDropMode(sal_uInt16 nNewMode);
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 1a471c17e41e..6d5ea1f721c0 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -391,8 +391,8 @@ void SwContentType::Init(sal_Bool* pbInvalidateWindow)
if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
{
- String sEntry = aFmtFld->GetFld()->GetPar2();
- RemoveNewline(sEntry);
+ OUString sEntry = aFmtFld->GetFld()->GetPar2();
+ sEntry = RemoveNewline(sEntry);
SwPostItContent* pCnt = new SwPostItContent(
this,
sEntry,
@@ -494,9 +494,9 @@ void SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibilityChanged)
nMemberCount--;
else
{
- String aEntry(comphelper::string::stripStart(
+ OUString aEntry(comphelper::string::stripStart(
pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i), ' '));
- SwNavigationPI::CleanEntry( aEntry );
+ aEntry = SwNavigationPI::CleanEntry(aEntry);
SwOutlineContent* pCnt = new SwOutlineContent(this, aEntry, i, nLevel,
pWrtShell->IsOutlineMovable( i ), nPos );
pMember->insert(pCnt);//, nPos);
@@ -717,8 +717,8 @@ void SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibilityChanged)
if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
{
- String sEntry = aFmtFld->GetFld()->GetPar2();
- RemoveNewline(sEntry);
+ OUString sEntry = aFmtFld->GetFld()->GetPar2();
+ sEntry = RemoveNewline(sEntry);
SwPostItContent* pCnt = new SwPostItContent(
this,
sEntry,
@@ -2677,14 +2677,17 @@ void SwContentTree::SetRootType(sal_uInt16 nType)
pConfig->SetRootType( nRootType );
}
-void SwContentType::RemoveNewline(String& rEntry)
+OUString SwContentType::RemoveNewline(const OUString& rEntry)
{
- sal_Unicode* pStr = rEntry.GetBufferAccess();
- for(xub_StrLen i = rEntry.Len(); i; --i, ++pStr )
- {
- if( *pStr == 10 || *pStr == 13 )
- *pStr = 0x20;
- }
+ if (rEntry.isEmpty())
+ return rEntry;
+
+ OUStringBuffer aEntry(rEntry);
+ for (sal_Int32 i = 0; i < rEntry.getLength(); ++i)
+ if(aEntry[i] == 10 || aEntry[i] == 13)
+ aEntry[i] = 0x20;
+
+ return aEntry.makeStringAndClear();
}
void SwContentTree::EditEntry(SvTreeListEntry* pEntry, sal_uInt8 nMode)
diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx
index 95a6e2290588..45a53174b9fc 100644
--- a/sw/source/ui/utlui/navipi.cxx
+++ b/sw/source/ui/utlui/navipi.cxx
@@ -63,13 +63,17 @@ SFX_IMPL_CHILDWINDOW_CONTEXT( SwNavigationChild, SID_NAVIGATOR, SwView )
// Filter the control characters out of the Outline-Entry
-void SwNavigationPI::CleanEntry( String& rEntry )
+OUString SwNavigationPI::CleanEntry(const OUString& rEntry)
{
- sal_uInt16 i = rEntry.Len();
- if( i )
- for( sal_Unicode* pStr = rEntry.GetBufferAccess(); i; --i, ++pStr )
- if( *pStr == 10 || *pStr == 9 )
- *pStr = 0x20;
+ if (rEntry.isEmpty())
+ return rEntry;
+
+ OUStringBuffer aEntry(rEntry);
+ for (sal_Int32 i = 0; i < rEntry.getLength(); ++i)
+ if(aEntry[i] == 10 || aEntry[i] == 9)
+ aEntry[i] = 0x20;
+
+ return aEntry.makeStringAndClear();
}
// Execution of the drag operation with and without the children.