[Libreoffice-commits] core.git: 4 commits - include/com include/sfx2 sd/source sfx2/source sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Wed Oct 2 08:04:53 PDT 2013
include/com/sun/star/uno/Sequence.h | 2
include/sfx2/shell.hxx | 4
include/sfx2/sidebar/ContextChangeBroadcaster.hxx | 9 ++
sd/source/ui/view/drviews1.cxx | 6 +
sd/source/ui/view/outlnvsh.cxx | 1
sd/source/ui/view/viewshel.cxx | 3
sfx2/source/control/shell.cxx | 5 +
sfx2/source/sidebar/ContextChangeBroadcaster.cxx | 16 +++
sw/inc/SwStyleNameMapper.hxx | 1
sw/inc/calc.hxx | 4
sw/inc/doc.hxx | 3
sw/inc/numrule.hxx | 1
sw/inc/stringhash.hxx | 98 ----------------------
sw/source/core/bastyp/calc.cxx | 14 +--
sw/source/core/crsr/crsrsh.cxx | 6 -
sw/source/core/doc/docnew.cxx | 4
sw/source/core/doc/docnum.cxx | 4
sw/source/core/edit/autofmt.cxx | 21 ++--
sw/source/core/edit/edlingu.cxx | 12 +-
sw/source/core/fields/fldbas.cxx | 2
sw/source/core/fields/scrptfld.cxx | 2
sw/source/core/inc/scriptinfo.hxx | 2
sw/source/core/text/porlay.cxx | 6 -
sw/source/core/unocore/unochart.cxx | 12 +-
sw/source/core/unocore/unotbl.cxx | 10 +-
sw/source/filter/ww8/writerwordglue.cxx | 28 +++---
sw/source/filter/xml/xmlimp.cxx | 65 +++++++-------
sw/source/ui/inc/view.hxx | 2
sw/source/ui/uiview/viewling.cxx | 6 -
29 files changed, 141 insertions(+), 208 deletions(-)
New commits:
commit dbbd252cee61981c72eb25fbb010632f2ac36aa1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 2 16:03:14 2013 +0100
find unused Sequences
Change-Id: Ic1227899d13627e6f52312be830cf9d91068994e
diff --git a/include/com/sun/star/uno/Sequence.h b/include/com/sun/star/uno/Sequence.h
index 1e6d2b0..19a73ed 100644
--- a/include/com/sun/star/uno/Sequence.h
+++ b/include/com/sun/star/uno/Sequence.h
@@ -48,7 +48,7 @@ namespace uno
@tparam E element type of sequence
*/
template< class E >
-class Sequence
+class SAL_WARN_UNUSED Sequence
{
/** sequence handle
*/
commit 03b52b540549d6e5c61fd7c8c1bf05c43eac0ddd
Author: Andre Fischer <af at apache.org>
Date: Wed Oct 2 08:52:09 2013 +0000
Resolves: #i123276# Properly forward Deactivate() call...
and still don't broadcast context change.
(cherry picked from commit 520cc667c80cea6bb48422825250b72ff36bb4ef)
Conflicts:
sd/source/ui/view/drviews1.cxx
sfx2/inc/sfx2/shell.hxx
sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
sfx2/source/control/shell.cxx
sfx2/source/sidebar/ContextChangeBroadcaster.cxx
Change-Id: I753009041a999bc31a0528e37f0a499897f311c5
diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx
index b5455a8..7bde39f 100644
--- a/include/sfx2/shell.hxx
+++ b/include/sfx2/shell.hxx
@@ -249,6 +249,10 @@ public:
*/
void BroadcastContextForActivation (const bool bIsActivated);
+ /** Enabled or disable the context broadcaster. Returns the old state.
+ */
+ bool SetContextBroadcasterEnabled (const bool bIsEnabled);
+
SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot );
SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI);
SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI);
diff --git a/include/sfx2/sidebar/ContextChangeBroadcaster.hxx b/include/sfx2/sidebar/ContextChangeBroadcaster.hxx
index 25701d3..b1012da 100644
--- a/include/sfx2/sidebar/ContextChangeBroadcaster.hxx
+++ b/include/sfx2/sidebar/ContextChangeBroadcaster.hxx
@@ -41,8 +41,17 @@ public:
void Activate (const cssu::Reference<css::frame::XFrame>& rxFrame);
void Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame);
+ /** Enable or disable the broadcaster.
+ @param bIsEnabled
+ The new value of the "enabled" state.
+ @return
+ The old value of the "enabled" state is returned.
+ */
+ bool SetBroadcasterEnabled (const bool bIsEnabled);
+
private:
rtl::OUString msContextName;
+ bool mbIsBroadcasterEnabled;
void BroadcastContextChange (
const cssu::Reference<css::frame::XFrame>& rxFrame,
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 54ea09a..2df556d 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -114,9 +114,15 @@ void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
}
-void DrawViewShell::Deactivate(sal_Bool /*bIsMDIActivate*/)
+void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate)
{
- // Do not forward to ViewShell::Deactivate() to prevent a context change.
+ // Temporarily disable context broadcasting while the Deactivate()
+ // call is forwarded to our base class.
+ const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false));
+
+ ViewShell::Deactivate(bIsMDIActivate);
+
+ SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled);
}
namespace
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 8ffef2c..eaed943 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -1176,4 +1176,9 @@ void SfxShell::BroadcastContextForActivation (const bool bIsActivated)
}
}
+bool SfxShell::SetContextBroadcasterEnabled (const bool bIsEnabled)
+{
+ return pImp->maContextChangeBroadcaster.SetBroadcasterEnabled(bIsEnabled);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
index 0e40f35..57d820f 100644
--- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
+++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
@@ -32,7 +32,8 @@ namespace sfx2 { namespace sidebar {
ContextChangeBroadcaster::ContextChangeBroadcaster (void)
- : msContextName()
+ : msContextName(),
+ mbIsBroadcasterEnabled(true)
{
}
@@ -76,11 +77,24 @@ void ContextChangeBroadcaster::Deactivate (const cssu::Reference<css::frame::XFr
+bool ContextChangeBroadcaster::SetBroadcasterEnabled (const bool bIsEnabled)
+{
+ const bool bWasEnabled (mbIsBroadcasterEnabled);
+ mbIsBroadcasterEnabled = bIsEnabled;
+ return bWasEnabled;
+}
+
+
+
+
void ContextChangeBroadcaster::BroadcastContextChange (
const cssu::Reference<css::frame::XFrame>& rxFrame,
const ::rtl::OUString& rsModuleName,
const ::rtl::OUString& rsContextName)
{
+ if ( ! mbIsBroadcasterEnabled)
+ return;
+
if (rsContextName.getLength() == 0)
return;
commit 9fec7c4e0d4fb4cf660d6304f8e11e47077f9ffa
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 2 15:07:23 2013 +0100
Revert "Resolves: fdo#66924 switching to master view is broken"
This reverts commit 4a578dc9c7b9c5697f624807790565c99ccb919d.
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 6d0db82..54ea09a 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -114,9 +114,9 @@ void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
}
-void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate)
+void DrawViewShell::Deactivate(sal_Bool /*bIsMDIActivate*/)
{
- ViewShell::Deactivate(bIsMDIActivate);
+ // Do not forward to ViewShell::Deactivate() to prevent a context change.
}
namespace
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 5e2b209..a5b142f 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -383,7 +383,6 @@ void OutlineViewShell::Deactivate( sal_Bool bIsMDIActivate )
// Links must be kept also on deactivated viewshell, to allow drag'n'drop
// to function properly
ViewShell::Deactivate( bIsMDIActivate );
- SfxShell::BroadcastContextForActivation(false);
}
/**
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 188c97c..079b8ce 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -403,7 +403,8 @@ void ViewShell::Deactivate(sal_Bool bIsMDIActivate)
mpHorizontalRuler->SetActive(sal_False);
if (mpVerticalRuler.get() != NULL)
mpVerticalRuler->SetActive(sal_False);
- // Do not forward to SfxShell::Deactivate()
+
+ SfxShell::Deactivate(bIsMDIActivate);
}
commit c1198cf209aa343575d0ebccde1053ac2909e67a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 2 13:34:02 2013 +0100
remove yet another StringHash impl
Change-Id: I1f7894a4a08b193b48dceb40bf0a451d4a3b3d6d
diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx
index 08251c1..e2fdede 100644
--- a/sw/inc/SwStyleNameMapper.hxx
+++ b/sw/inc/SwStyleNameMapper.hxx
@@ -25,7 +25,6 @@
#include "swdllapi.h"
#include <boost/unordered_map.hpp>
-#include <stringhash.hxx>
#include <vector>
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 4051e65..4227f8f 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -221,10 +221,10 @@ public:
void SetCalcError( SwCalcError eErr ) { eError = eErr; }
sal_Bool IsCalcError() const { return 0 != eError; }
- static bool Str2Double( const String& rStr, xub_StrLen& rPos,
+ static bool Str2Double( const OUString& rStr, sal_Int32& rPos,
double& rVal,
LocaleDataWrapper const*const pData = 0 );
- static bool Str2Double( const String& rStr, xub_StrLen& rPos,
+ static bool Str2Double( const OUString& rStr, sal_Int32& rPos,
double& rVal, SwDoc *const pDoc );
SW_DLLPUBLIC static sal_Bool IsValidVarName( const OUString& rStr,
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8d6ea4d..80caaa8 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -70,7 +70,6 @@ class SwList;
#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
#include <boost/unordered_map.hpp>
-#include <stringhash.hxx>
#include <svtools/embedhlp.hxx>
#include <vector>
@@ -352,7 +351,7 @@ class SW_DLLPUBLIC SwDoc :
/// Hash map to find numrules by name
mutable boost::unordered_map<OUString, SwNumRule *, OUStringHash> maNumRuleMap;
- typedef boost::unordered_map< String, SwList*, StringHash > tHashMapForLists;
+ typedef boost::unordered_map<OUString, SwList*, OUStringHash> tHashMapForLists;
/// container to hold the lists of the text document
tHashMapForLists maLists;
/// relation between list style and its default list
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 850d412..39edc8b 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -28,7 +28,6 @@
#include <calbck.hxx>
#include <hints.hxx>
#include <boost/unordered_map.hpp>
-#include <stringhash.hxx>
#include <SwNumberTreeTypes.hxx>
#include <vector>
diff --git a/sw/inc/stringhash.hxx b/sw/inc/stringhash.hxx
deleted file mode 100644
index 51efab4..0000000
--- a/sw/inc/stringhash.hxx
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _STRINGHASH_HXX
-#define _STRINGHASH_HXX
-
-#include <tools/string.hxx>
-
-struct StringEq
-{
- sal_Bool operator() ( const String *r1,
- const String *r2) const
- {
- return r1->Equals(*r2);
- }
-};
-
-struct StringEqRef
-{
- sal_Bool operator() (const String &r1, const String &r2) const
- {
- return r1.Equals(r2);
- }
-};
-
-struct StringHash
-{
- size_t operator() ( const String *rString) const
- {
- sal_Int32 h, nLen;
- h = nLen = rString->Len();
- const sal_Unicode *pStr = rString->GetBuffer();
-
- if ( nLen < 16 )
- while ( nLen-- > 0 )
- h = (h*37) + *(pStr++);
- else
- {
- sal_Int32 nSkip;
- const sal_Unicode* pEndStr = pStr+nLen-5;
-
- /* only sample some characters */
- /* the first 3, some characters between, and the last 5 */
- h = (h*39) + *(pStr++);
- h = (h*39) + *(pStr++);
- h = (h*39) + *(pStr++);
-
- nSkip = nLen / nLen < 32 ? 4 : 8;
- nLen -= 8;
- while ( nLen > 0 )
- {
- h = (h*39) + ( *pStr );
- pStr += nSkip;
- nLen -= nSkip;
- }
-
- h = (h*39) + *(pEndStr++);
- h = (h*39) + *(pEndStr++);
- h = (h*39) + *(pEndStr++);
- h = (h*39) + *(pEndStr++);
- h = (h*39) + *(pEndStr++);
- }
- return h;
- }
-
- size_t operator() (const String & rStr) const
- {
- return (*this)(&rStr);
- }
-};
-
-struct StringHashRef
-{
- size_t operator () (const String &rStr) const
- {
- StringHash aStrHash;
-
- return aStrHash(&rStr);
- }
-};
-#endif // _STRINGHASH_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 99a7229..b45ea58 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -1487,7 +1487,7 @@ String SwCalc::GetDBName(const String& rName)
namespace
{
- static bool lcl_Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+ static bool lcl_Str2Double( const OUString& rCommand, sal_Int32& rCommandPos,
double& rVal,
const LocaleDataWrapper* const pLclData )
{
@@ -1495,20 +1495,20 @@ namespace
const sal_Unicode nCurrCmdPos = rCommandPos;
rtl_math_ConversionStatus eStatus;
const sal_Unicode* pEnd;
- rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
- rCommand.GetBuffer() + rCommand.Len(),
+ rVal = rtl_math_uStringToDouble( rCommand.getStr() + rCommandPos,
+ rCommand.getStr() + rCommand.getLength(),
pLclData->getNumDecimalSep()[0],
pLclData->getNumThousandSep()[0],
&eStatus,
&pEnd );
- rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
+ rCommandPos = static_cast<sal_Int32>(pEnd - rCommand.getStr());
return rtl_math_ConversionStatus_Ok == eStatus &&
nCurrCmdPos != rCommandPos;
}
}
-bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+bool SwCalc::Str2Double( const OUString& rCommand, sal_Int32& rCommandPos,
double& rVal, const LocaleDataWrapper* const pLclData )
{
const SvtSysLocale aSysLocale;
@@ -1516,7 +1516,7 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
pLclData ? pLclData : aSysLocale.GetLocaleDataPtr() );
}
-bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+bool SwCalc::Str2Double( const OUString& rCommand, sal_Int32& rCommandPos,
double& rVal, SwDoc* const pDoc )
{
const SvtSysLocale aSysLocale;
@@ -1602,7 +1602,7 @@ double SwSbxValue::GetDouble() const
double nRet;
if( SbxSTRING == GetType() )
{
- xub_StrLen nStt = 0;
+ sal_Int32 nStt = 0;
SwCalc::Str2Double( GetOUString(), nStt, nRet );
}
else if (IsBool())
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 128684e..12f79af 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3306,7 +3306,7 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect,
lcl_FillTextRange( rRange, *pNode, nBegin, nLen );
// get smarttag word
- String aText( pNode->GetTxt().copy(nBegin, nLen) );
+ OUString aText( pNode->GetTxt().copy(nBegin, nLen) );
//save the start and end positons of the line and the starting point
Push();
@@ -3320,11 +3320,11 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect,
// include "in word" character to the left and right in order to
// preserve those. Therefore count those "in words" in order to
// modify the selection accordingly.
- const sal_Unicode* pChar = aText.GetBuffer();
+ const sal_Unicode* pChar = aText.getStr();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
++nLeft;
- pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0;
+ pChar = aText.getLength() ? aText.getStr() + aText.getLength() - 1 : 0;
xub_StrLen nRight = 0;
while (pChar && *pChar-- == CH_TXTATR_INWORD)
++nRight;
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 58e03cc..605b9b8 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -668,7 +668,7 @@ SwDoc::~SwDoc()
delete mpNumRuleTbl;
{
- for ( boost::unordered_map< String, SwList*, StringHash >::iterator
+ for ( boost::unordered_map< OUString, SwList*, OUStringHash >::iterator
aListIter = maLists.begin();
aListIter != maLists.end();
++aListIter )
@@ -842,7 +842,7 @@ void SwDoc::ClearDoc()
mpNumRuleTbl->clear();
// #i114725#,#i115828#
{
- for ( boost::unordered_map< String, SwList*, StringHash >::iterator
+ for ( boost::unordered_map< OUString, SwList*, OUStringHash >::iterator
aListIter = maLists.begin();
aListIter != maLists.end();
++aListIter )
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 235db1d..4d89ea3 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2495,7 +2495,7 @@ SwList* SwDoc::getListByName( const String sListId ) const
{
SwList* pList = 0;
- boost::unordered_map< String, SwList*, StringHash >::const_iterator
+ boost::unordered_map< OUString, SwList*, OUStringHash >::const_iterator
aListIter = maLists.find( sListId );
if ( aListIter != maLists.end() )
{
@@ -2542,7 +2542,7 @@ SwList* SwDoc::getListForListStyle( const String sListStyleName ) const
{
SwList* pList = 0;
- boost::unordered_map< String, SwList*, StringHash >::const_iterator
+ boost::unordered_map< OUString, SwList*, OUStringHash >::const_iterator
aListIter = maListStyleLists.find( sListStyleName );
if ( aListIter != maListStyleLists.end() )
{
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index c5022c9..3753f01 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -167,7 +167,7 @@ class SwAutoFormat
sal_uInt16 CalcLevel( const SwTxtNode&, sal_uInt16 *pDigitLvl = 0 ) const;
xub_StrLen GetBigIndent( xub_StrLen& rAktSpacePos ) const;
- String& DelLeadingBlanks( String& rStr ) const;
+ OUString DelLeadingBlanks(const OUString& rStr) const;
String& DelTrailingBlanks( String& rStr ) const;
xub_StrLen GetLeadingBlanks( const String& rStr ) const;
xub_StrLen GetTrailingBlanks( const String& rStr ) const;
@@ -417,9 +417,8 @@ sal_Bool SwAutoFormat::IsEnumericChar( const SwTxtNode& rNd ) const
sal_Bool SwAutoFormat::IsBlanksInString( const SwTxtNode& rNd ) const
{
// Search more that 5 blanks/tabs in the string.
- String sTmp( rNd.GetTxt() );
- DelTrailingBlanks( DelLeadingBlanks( sTmp ));
- const sal_Unicode* pTmp = sTmp.GetBuffer();
+ OUString sTmp( DelLeadingBlanks(rNd.GetTxt()) );
+ const sal_Unicode* pTmp = sTmp.getStr();
while( *pTmp )
{
if( IsSpace( *pTmp ) )
@@ -676,15 +675,13 @@ bool SwAutoFormat::DoTable()
return 1 < aPosArr.size();
}
-String& SwAutoFormat::DelLeadingBlanks( String& rStr ) const
+OUString SwAutoFormat::DelLeadingBlanks( const OUString& rStr ) const
{
- xub_StrLen nL;
- xub_StrLen n;
-
- for( nL = rStr.Len(), n = 0; n < nL && IsSpace( rStr.GetChar(n) ); ++n )
+ sal_Int32 nL, n;
+ for( nL = rStr.getLength(), n = 0; n < nL && IsSpace( rStr[n] ); ++n )
;
if( n ) // no Spaces
- rStr.Erase( 0, n );
+ return rStr.copy(n);
return rStr;
}
@@ -2324,9 +2321,9 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
if( !bReplaceStyles )
break;
- String sClrStr( pAktTxtNd->GetTxt() );
+ OUString sClrStr( DelLeadingBlanks(pAktTxtNd->GetTxt()) );
- if( !DelLeadingBlanks( sClrStr ).Len() )
+ if( sClrStr.isEmpty() )
{
bEmptyLine = true;
eStat = READ_NEXT_PARA;
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index c72cf02..cbb9392 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -839,7 +839,7 @@ uno::Reference< XSpellAlternatives >
xub_StrLen nLen = 1;
if( pWrong->InWrongWord(nBegin,nLen) && !pNode->IsSymbol(nBegin) )
{
- String const aText(pNode->GetTxt().copy(nBegin, nLen));
+ const OUString aText(pNode->GetTxt().copy(nBegin, nLen));
String aWord( aText );
aWord = comphelper::string::remove(aWord, CH_TXTATR_BREAKWORD);
aWord = comphelper::string::remove(aWord, CH_TXTATR_INWORD);
@@ -883,11 +883,11 @@ uno::Reference< XSpellAlternatives >
// not "in word" character to the left and right in order to
// preserve those. Therefore count those "in words" in order to
// modify the selection accordingly.
- const sal_Unicode* pChar = aText.GetBuffer();
+ const sal_Unicode* pChar = aText.getStr();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
++nLeft;
- pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0;
+ pChar = aText.getLength() ? aText.getStr() + aText.getLength() - 1 : 0;
xub_StrLen nRight = 0;
while (pChar && *pChar-- == CH_TXTATR_INWORD)
++nRight;
@@ -951,7 +951,7 @@ bool SwEditShell::GetGrammarCorrection(
xub_StrLen nLen = 1;
if (pWrong->InWrongWord(nBegin, nLen))
{
- String const aText(pNode->GetTxt().copy(nBegin, nLen));
+ const OUString aText(pNode->GetTxt().copy(nBegin, nLen));
uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( mpDoc->GetGCIterator() );
if (xGCIterator.is())
@@ -1009,11 +1009,11 @@ bool SwEditShell::GetGrammarCorrection(
// not include "in word" character to the left and right in
// order to preserve those. Therefore count those "in words" in
// order to modify the selection accordingly.
- const sal_Unicode* pChar = aText.GetBuffer();
+ const sal_Unicode* pChar = aText.getStr();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
++nLeft;
- pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0;
+ pChar = aText.getLength() ? aText.getStr() + aText.getLength() - 1 : 0;
xub_StrLen nRight = 0;
while (pChar && *pChar-- == CH_TXTATR_INWORD)
++nRight;
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index e80657c..5416bd2 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -650,7 +650,7 @@ void SwFormulaField::SetFormula(const OUString& rStr)
if( nFmt && SAL_MAX_UINT32 != nFmt )
{
- xub_StrLen nPos = 0;
+ sal_Int32 nPos = 0;
double fTmpValue;
if( SwCalc::Str2Double( rStr, nPos, fTmpValue, GetDoc() ) )
SwValueField::SetValue( fTmpValue );
diff --git a/sw/source/core/fields/scrptfld.cxx b/sw/source/core/fields/scrptfld.cxx
index 22ea9db..fa014b8 100644
--- a/sw/source/core/fields/scrptfld.cxx
+++ b/sw/source/core/fields/scrptfld.cxx
@@ -47,7 +47,7 @@ OUString SwScriptField::GetDescription() const
OUString SwScriptField::Expand() const
{
- return aEmptyStr;
+ return OUString();
}
SwField* SwScriptField::Copy() const
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index c0d5682..719fbf7 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -77,7 +77,7 @@ private:
xub_StrLen nInvalidityPos;
sal_uInt8 nDefaultDir;
- void UpdateBidiInfo( const String& rTxt );
+ void UpdateBidiInfo( const OUString& rTxt );
sal_Bool IsKashidaValid ( xub_StrLen nKashPos ) const;
void MarkKashidaInvalid ( xub_StrLen nKashPos );
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 2d04234..07ada0b 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1265,7 +1265,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
}
}
-void SwScriptInfo::UpdateBidiInfo( const String& rTxt )
+void SwScriptInfo::UpdateBidiInfo( const OUString& rTxt )
{
// remove invalid entries from direction information arrays
aDirectionChanges.clear();
@@ -1273,10 +1273,10 @@ void SwScriptInfo::UpdateBidiInfo( const String& rTxt )
// Bidi functions from icu 2.0
//
UErrorCode nError = U_ZERO_ERROR;
- UBiDi* pBidi = ubidi_openSized( rTxt.Len(), 0, &nError );
+ UBiDi* pBidi = ubidi_openSized( rTxt.getLength(), 0, &nError );
nError = U_ZERO_ERROR;
- ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(rTxt.GetBuffer()), rTxt.Len(), // UChar != sal_Unicode in MinGW
+ ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(rTxt.getStr()), rTxt.getLength(), // UChar != sal_Unicode in MinGW
nDefaultDir, NULL, &nError );
nError = U_ZERO_ERROR;
long nCount = ubidi_countRuns( pBidi, &nError );
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 7f2bf91..47131eb 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -54,7 +54,7 @@
using namespace ::com::sun::star;
// from unotbl.cxx
-extern void sw_GetCellPosition( const String &rCellName, sal_Int32 &rColumn, sal_Int32 &rRow);
+extern void sw_GetCellPosition( const OUString &rCellName, sal_Int32 &rColumn, sal_Int32 &rRow);
extern String sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow );
extern int sw_CompareCellsByColFirst( const String &rCellName1, const String &rCellName2 );
extern int sw_CompareCellsByRowFirst( const String &rCellName1, const String &rCellName2 );
@@ -2159,12 +2159,12 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel(
nCol = nCol + i;
else
nRow = nRow + i;
- String aCellName( sw_GetCellName( nCol, nRow ) );
+ OUString aCellName( sw_GetCellName( nCol, nRow ) );
- xub_StrLen nLen = aCellName.Len();
+ sal_Int32 nLen = aCellName.getLength();
if (nLen)
{
- const sal_Unicode *pBuf = aCellName.GetBuffer();
+ const sal_Unicode *pBuf = aCellName.getStr();
const sal_Unicode *pEnd = pBuf + nLen;
while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9'))
++pBuf;
@@ -2176,12 +2176,12 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel(
if (bUseCol)
{
aRplc = OUString("%COLUMNLETTER");
- aNew = OUString(aCellName.GetBuffer(), pBuf - aCellName.GetBuffer());
+ aNew = OUString(aCellName.getStr(), pBuf - aCellName.getStr());
}
else
{
aRplc = OUString("%ROWNUMBER");
- aNew = OUString(pBuf, (aCellName.GetBuffer() + nLen) - pBuf);
+ aNew = OUString(pBuf, (aCellName.getStr() + nLen) - pBuf);
}
xub_StrLen nPos = aTxt.Search( aRplc );
if (nPos != STRING_NOTFOUND)
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index d487448..3b66f15 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -347,22 +347,22 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
* @param [IN,OUT] rRow (0-based)
*/
//TODO: potential for throwing proper exceptions instead of having every caller to check for errors
-void sw_GetCellPosition(const String &rCellName,
+void sw_GetCellPosition(const OUString &rCellName,
sal_Int32 &rColumn, sal_Int32 &rRow)
{
rColumn = rRow = -1; // default return values indicating failure
- xub_StrLen nLen = rCellName.Len();
+ sal_Int32 nLen = rCellName.getLength();
if (nLen)
{
- const sal_Unicode *pBuf = rCellName.GetBuffer();
+ const sal_Unicode *pBuf = rCellName.getStr();
const sal_Unicode *pEnd = pBuf + nLen;
while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9'))
++pBuf;
// start of number found?
if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9'))
{
- OUString aColTxt(rCellName.GetBuffer(), pBuf - rCellName.GetBuffer());
- OUString aRowTxt(pBuf, (rCellName.GetBuffer() + nLen - pBuf));
+ OUString aColTxt(rCellName.getStr(), pBuf - rCellName.getStr());
+ OUString aRowTxt(pBuf, (rCellName.getStr() + nLen - pBuf));
if (!aColTxt.isEmpty() && !aRowTxt.isEmpty())
{
sal_Int32 nColIdx = 0;
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 8f879f3..a65175d 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -500,7 +500,7 @@ namespace sw
CharRuns GetPseudoCharRuns(const SwTxtNode& rTxtNd,
xub_StrLen nTxtStart, bool bSplitOnCharSet)
{
- const String &rTxt = rTxtNd.GetTxt();
+ const OUString &rTxt = rTxtNd.GetTxt();
bool bParaIsRTL = false;
OSL_ENSURE(rTxtNd.GetDoc(), "No document for node?, suspicious");
@@ -516,7 +516,7 @@ namespace sw
using namespace ::com::sun::star::i18n;
sal_uInt16 nScript = i18n::ScriptType::LATIN;
- if (rTxt.Len() && g_pBreakIt && g_pBreakIt->GetBreakIter().is())
+ if (!rTxt.isEmpty() && g_pBreakIt && g_pBreakIt->GetBreakIter().is())
nScript = g_pBreakIt->GetBreakIter()->getScriptType(rTxt, 0);
rtl_TextEncoding eChrSet = ItemGet<SvxFontItem>(rTxtNd,
@@ -525,7 +525,7 @@ namespace sw
CharRuns aRunChanges;
- if (!rTxt.Len())
+ if (rTxt.isEmpty())
{
aRunChanges.push_back(CharRunEntry(0, nScript, eChrSet,
bParaIsRTL));
@@ -550,8 +550,8 @@ namespace sw
UBiDiDirection eDefaultDir = bParaIsRTL ? UBIDI_RTL : UBIDI_LTR;
UErrorCode nError = U_ZERO_ERROR;
- UBiDi* pBidi = ubidi_openSized(rTxt.Len(), 0, &nError);
- ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(rTxt.GetBuffer()), rTxt.Len(),
+ UBiDi* pBidi = ubidi_openSized(rTxt.getLength(), 0, &nError);
+ ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(rTxt.getStr()), rTxt.getLength(),
static_cast< UBiDiLevel >(eDefaultDir), 0, &nError);
sal_Int32 nCount = ubidi_countRuns(pBidi, &nError);
@@ -583,15 +583,15 @@ namespace sw
{
//Split unicode text into plausable 8bit ranges for export to
//older non unicode aware format
- xub_StrLen nLen = rTxt.Len();
- xub_StrLen nPos = 0;
+ sal_Int32 nLen = rTxt.getLength();
+ sal_Int32 nPos = 0;
while (nPos != nLen)
{
rtl_TextEncoding ScriptType =
- getBestMSEncodingByChar(rTxt.GetChar(nPos++));
+ getBestMSEncodingByChar(rTxt[nPos++]);
while (
(nPos != nLen) &&
- (ScriptType == getBestMSEncodingByChar(rTxt.GetChar(nPos)))
+ (ScriptType == getBestMSEncodingByChar(rTxt[nPos]))
)
{
++nPos;
@@ -605,15 +605,15 @@ namespace sw
if (g_pBreakIt && g_pBreakIt->GetBreakIter().is())
{
- xub_StrLen nLen = rTxt.Len();
- xub_StrLen nPos = 0;
+ sal_Int32 nLen = rTxt.getLength();
+ sal_Int32 nPos = 0;
while (nPos < nLen)
{
sal_Int32 nEnd2 = g_pBreakIt->GetBreakIter()->endOfScript(rTxt, nPos,
nScript);
if (nEnd2 < 0)
break;
- nPos = static_cast< xub_StrLen >(nEnd2);
+ nPos = nEnd2;
aScripts.push_back(ScriptEntry(nPos, nScript));
nScript = g_pBreakIt->GetBreakIter()->getScriptType(rTxt, nPos);
}
@@ -635,12 +635,12 @@ namespace sw
aScriptIter != aScriptEnd
)
{
- xub_StrLen nMinPos = rTxt.Len();
+ sal_Int32 nMinPos = rTxt.getLength();
if (aBiDiIter != aBiDiEnd)
{
if (aBiDiIter->first < nMinPos)
- nMinPos = static_cast< xub_StrLen >(aBiDiIter->first);
+ nMinPos = aBiDiIter->first;
bCharIsRTL = aBiDiIter->second;
}
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index c5f20d0..7c31973 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -55,7 +55,6 @@
#include <unotools/saveopt.hxx>
#include <tools/diagnose_ex.h>
#include <boost/unordered_set.hpp>
-#include <stringhash.hxx>
// for locking SolarMutex: svapp + mutex
#include <vcl/svapp.hxx>
@@ -1096,38 +1095,38 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
if( !xInfo.is() )
return;
- boost::unordered_set< String, StringHashRef, StringEqRef > aSet;
- aSet.insert(String("ForbiddenCharacters", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("IsKernAsianPunctuation", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("CharacterCompressionType", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("LinkUpdateMode", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("FieldAutoUpdate", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("ChartAutoUpdate", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("AddParaTableSpacing", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("AddParaTableSpacingAtStart", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintAnnotationMode", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintBlackFonts", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintControls", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintDrawings", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintGraphics", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintLeftPages", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintPageBackground", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintProspect", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintReversed", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintRightPages", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintFaxName", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintPaperFromSetup", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintTables", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintSingleJobs", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("UpdateFromTemplate", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrinterIndependentLayout", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("PrintEmptyPages", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("SmallCapsPercentage66", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("TabOverflow", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("ClippedPictures", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("BackgroundParaOverDrawings", RTL_TEXTENCODING_ASCII_US));
- aSet.insert(String("TabOverMargin", RTL_TEXTENCODING_ASCII_US));
+ boost::unordered_set< OUString, OUStringHash > aSet;
+ aSet.insert(OUString("ForbiddenCharacters"));
+ aSet.insert(OUString("IsKernAsianPunctuation"));
+ aSet.insert(OUString("CharacterCompressionType"));
+ aSet.insert(OUString("LinkUpdateMode"));
+ aSet.insert(OUString("FieldAutoUpdate"));
+ aSet.insert(OUString("ChartAutoUpdate"));
+ aSet.insert(OUString("AddParaTableSpacing"));
+ aSet.insert(OUString("AddParaTableSpacingAtStart"));
+ aSet.insert(OUString("PrintAnnotationMode"));
+ aSet.insert(OUString("PrintBlackFonts"));
+ aSet.insert(OUString("PrintControls"));
+ aSet.insert(OUString("PrintDrawings"));
+ aSet.insert(OUString("PrintGraphics"));
+ aSet.insert(OUString("PrintLeftPages"));
+ aSet.insert(OUString("PrintPageBackground"));
+ aSet.insert(OUString("PrintProspect"));
+ aSet.insert(OUString("PrintReversed"));
+ aSet.insert(OUString("PrintRightPages"));
+ aSet.insert(OUString("PrintFaxName"));
+ aSet.insert(OUString("PrintPaperFromSetup"));
+ aSet.insert(OUString("PrintTables"));
+ aSet.insert(OUString("PrintSingleJobs"));
+ aSet.insert(OUString("UpdateFromTemplate"));
+ aSet.insert(OUString("PrinterIndependentLayout"));
+ aSet.insert(OUString("PrintEmptyPages"));
+ aSet.insert(OUString("SmallCapsPercentage66"));
+ aSet.insert(OUString("TabOverflow"));
+ aSet.insert(OUString("UnbreakableNumberings"));
+ aSet.insert(OUString("ClippedPictures"));
+ aSet.insert(OUString("BackgroundParaOverDrawings"));
+ aSet.insert(OUString("TabOverMargin"));
sal_Int32 nCount = aConfigProps.getLength();
const PropertyValue* pValues = aConfigProps.getConstArray();
diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
index cd7a323..93885d7 100644
--- a/sw/source/ui/inc/view.hxx
+++ b/sw/source/ui/inc/view.hxx
@@ -422,7 +422,7 @@ public:
// replace word/selection with text from the thesaurus
// (this code has special handling for "in word" character)
- void InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bValidSelection );
+ void InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection );
bool IsValidSelectionForThesaurus() const;
String GetThesaurusLookUpText( bool bSelection ) const;
diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx
index fc1bf1c..1620eb9 100644
--- a/sw/source/ui/uiview/viewling.cxx
+++ b/sw/source/ui/uiview/viewling.cxx
@@ -497,7 +497,7 @@ String SwView::GetThesaurusLookUpText( bool bSelection ) const
return bSelection ? m_pWrtShell->GetSelTxt() : m_pWrtShell->GetCurWord();
}
-void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bSelection )
+void SwView::InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bSelection )
{
sal_Bool bOldIns = m_pWrtShell->IsInsMode();
m_pWrtShell->SetInsMode( sal_True );
@@ -516,11 +516,11 @@ void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rL
// include "in word" character to the left and right in order to
// preserve those. Therefore count those "in words" in order to modify
// the selection accordingly.
- const sal_Unicode* pChar = rLookUpText.GetBuffer();
+ const sal_Unicode* pChar = rLookUpText.getStr();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
++nLeft;
- pChar = rLookUpText.Len() ? rLookUpText.GetBuffer() + rLookUpText.Len() - 1 : 0;
+ pChar = rLookUpText.getLength() ? rLookUpText.getStr() + rLookUpText.getLength() - 1 : 0;
xub_StrLen nRight = 0;
while (pChar && *pChar-- == CH_TXTATR_INWORD)
++nRight;
More information about the Libreoffice-commits
mailing list