[Libreoffice-commits] core.git: 11 commits - basic/source bridges/source cui/source dbaccess/source editeng/source idlc/source include/tools rsc/source sfx2/inc sfx2/source svtools/inc svtools/source svx/source sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Thu Sep 12 05:09:37 PDT 2013
basic/source/comp/symtbl.cxx | 5 ++
basic/source/inc/parser.hxx | 3 +
basic/source/runtime/runtime.cxx | 2 -
bridges/source/cpp_uno/shared/vtablefactory.cxx | 4 ++
cui/source/tabpages/numpages.cxx | 22 +++++++++--
dbaccess/source/ui/app/AppDetailPageHelper.cxx | 7 +--
editeng/source/editeng/editdoc.cxx | 40 ++++++++++----------
editeng/source/editeng/editdoc.hxx | 16 ++++----
idlc/source/fehelper.cxx | 4 +-
idlc/source/idlccompile.cxx | 4 ++
include/tools/solar.h | 1
rsc/source/rscpp/cpp6.c | 1
sfx2/inc/bluthsndapi.hxx | 4 +-
sfx2/inc/inettbc.hxx | 8 +---
sfx2/inc/pch/precompiled_sfx.hxx | 2 -
sfx2/source/appl/appcfg.cxx | 2 -
sfx2/source/appl/fileobj.hxx | 1
sfx2/source/appl/helpinterceptor.hxx | 1
sfx2/source/appl/impldde.hxx | 2 -
sfx2/source/appl/openuriexternally.cxx | 1
sfx2/source/doc/doctempl.cxx | 1
sfx2/source/doc/oleprops.hxx | 3 +
sfx2/source/inc/appdata.hxx | 6 +--
sfx2/source/inc/helper.hxx | 3 -
svtools/inc/pch/precompiled_svt.hxx | 1
svtools/source/contnr/contentenumeration.hxx | 1
svtools/source/control/valueimp.hxx | 1
svtools/source/java/javainteractionhandler.cxx | 1
svtools/source/svhtml/htmlkywd.cxx | 3 -
svtools/source/svrtf/rtfkeywd.cxx | 3 -
svtools/source/svrtf/rtfout.cxx | 1
svx/source/dialog/sendreportunx.cxx | 10 ++++-
sw/inc/fmtrfmrk.hxx | 2 -
sw/source/core/access/parachangetrackinginfo.cxx | 2 -
sw/source/core/inc/swfont.hxx | 18 ++++-----
sw/source/core/inc/txtfrm.hxx | 6 +--
sw/source/core/text/frmcrsr.cxx | 2 -
sw/source/core/text/frmform.cxx | 14 +++----
sw/source/core/text/frminf.cxx | 18 ++++-----
sw/source/core/text/inftxt.cxx | 6 +--
sw/source/core/text/inftxt.hxx | 14 +++----
sw/source/core/text/itrform2.cxx | 2 -
sw/source/core/text/itrtxt.cxx | 2 -
sw/source/core/text/txtdrop.cxx | 2 -
sw/source/core/text/txtfrm.cxx | 31 +++++++--------
sw/source/core/txtnode/atrref.cxx | 2 -
sw/source/core/txtnode/fntcache.cxx | 8 ++--
sw/source/core/txtnode/fntcap.cxx | 40 ++++++++++----------
sw/source/core/txtnode/swfont.cxx | 46 +++++++++++------------
sw/source/core/txtnode/txtedt.cxx | 20 +++++-----
50 files changed, 206 insertions(+), 193 deletions(-)
New commits:
commit 1c4f72748d43dfbabd26b3c99a76f547eb050da0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 12:48:21 2013 +0100
CID#736168 help coverity out a bit
coverity thinks theres an overrun here, I think its wrong, but its
needlessly complicated code, simplify
Change-Id: I9db4886b4e60d49c25de514081953cb380d4146f
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 148d469..cd36d98 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -346,12 +346,11 @@ void OAppDetailPageHelper::getSelectionElementNames( ::std::vector< OUString>& _
void OAppDetailPageHelper::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
{
- enum ElementType eType = E_TABLE;
- for ( size_t i=0; i < E_ELEMENT_TYPE_COUNT; eType = static_cast< ElementType >( ++i ) )
+ for (size_t i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
{
- if ( m_pLists[eType] == &_rControl )
+ if ( m_pLists[i] == &_rControl )
{
- describeCurrentSelectionForType( eType, _out_rSelectedObjects );
+ describeCurrentSelectionForType(static_cast<ElementType>(i), _out_rSelectedObjects);
return;
}
}
commit dbff5bd4cd4eec4db844244d5ff431a3f2b1b82e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 12:31:43 2013 +0100
CID#736166 unlikely out of bounds
Change-Id: I8a0f97be1723766df9f8fe287417365febf54966
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 0a5e3a2..fccc044 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -350,7 +350,10 @@ void SbiSymDef::SetType( SbxDataType t )
unsigned char c = (unsigned char)ch2;
if( c > 0 && c < 128 )
{
- t = pIn->pParser->eDefTypes[ ch2 - 'A' ];
+ int nIndex = ch2 - 'A';
+ assert(nIndex >= 0 && nIndex < N_DEF_TYPES);
+ if (nIndex >= 0 && nIndex < N_DEF_TYPES)
+ t = pIn->pParser->eDefTypes[nIndex];
}
}
}
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index a6f3751..27bb4fb 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -77,7 +77,8 @@ public:
bool bClassModule; // true: OPTION ClassModule
StringVector aIfaceVector; // Holds all interfaces implemented by a class module
StringVector aRequiredTypes; // Types used in Dim As New <type> outside subs
- SbxDataType eDefTypes[26]; // DEFxxx data types
+# define N_DEF_TYPES 26
+ SbxDataType eDefTypes[N_DEF_TYPES]; // DEFxxx data types
SbiParser( StarBASIC*, SbModule* );
bool Parse();
commit 463bf0870ade53e5dee3b95605f2c1d9898ca410
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 12:21:14 2013 +0100
CID#736167 unlikely out of bounds
Change-Id: Ib20864bdcc7760258a19f80325003a14b3c362a3
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 8233636..9353dcd 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1446,10 +1446,26 @@ void SvxNumOptionsTabPage::InitControls()
aNumFmtArr[i] = 0;
nMask <<= 1 ;
-
}
SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0);
- CheckForStartValue_Impl(aNumFmtArr[nLvl]->GetNumberingType());
+
+ sal_uInt16 nNumberingType;
+ if (nLvl != USHRT_MAX)
+ nNumberingType = aNumFmtArr[nLvl]->GetNumberingType();
+ else
+ {
+ nNumberingType = SVX_NUM_NUMBER_NONE;
+ bAllLevel = false;
+ bSameAdjust = false;
+ bSameBulRelSize = false;
+ bSameBulColor = false;
+ bSameStart = false;
+ bSamePrefix = false;
+ bSameSuffix = false;
+ }
+
+ CheckForStartValue_Impl(nNumberingType);
+
if(bShowBitmap)
{
if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE)
@@ -1473,7 +1489,7 @@ void SvxNumOptionsTabPage::InitControls()
if(bSameType)
{
- sal_uInt16 nLBData = (sal_uInt16) aNumFmtArr[nLvl]->GetNumberingType();
+ sal_uInt16 nLBData = nNumberingType;
m_pFmtLB->SelectEntryPos(m_pFmtLB->GetEntryPos( (void*)sal::static_int_cast<sal_uIntPtr>( nLBData ) ));
}
else
commit 57482ed493ee26f808caa76def9e759218e0c27b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 12:04:00 2013 +0100
CID#707499 check for 0 nDims
Change-Id: I828339695db1b1880d7e884f8bf26911d04b8508
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 0cf478a..047c25c 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -2268,7 +2268,7 @@ void SbiRuntime::StepREDIMP()
{
StarBASIC::Error( SbERR_OUT_OF_RANGE );
}
- else
+ else if (nDims > 0)
{
// Store dims to use them for copying later
sal_Int32* pLowerBounds = new sal_Int32[nDims];
commit 5db93465bb5fc7f90b897783302118c198ae55f3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 11:52:16 2013 +0100
CID#705986 avoid tmpnam
Change-Id: I47fa843284a074ef77da8631f4e4de914f4d0cf7
diff --git a/svx/source/dialog/sendreportunx.cxx b/svx/source/dialog/sendreportunx.cxx
index 9a058ad..7d1afc6 100644
--- a/svx/source/dialog/sendreportunx.cxx
+++ b/svx/source/dialog/sendreportunx.cxx
@@ -30,6 +30,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#define RCFILE ".crash_reportrc"
@@ -206,8 +208,12 @@ namespace svx{
OUString strSubject(GetDocType());
osl_setEnvironment(sSubEnvVar.pData, strSubject.pData);
- char szBodyFile[L_tmpnam] = "";
- FILE *fp = fopen( tmpnam( szBodyFile ), "w" );
+ char szBodyFile[]="/tmp/locrsXXXXXXX";
+ mode_t nOrigMode = umask(S_IRWXG | S_IRWXO);
+ int nDescriptor = mkstemp(szBodyFile);
+ umask(nOrigMode);
+
+ FILE *fp = nDescriptor != -1 ? fdopen(nDescriptor, "w") : NULL;
if ( fp )
{
commit 5f5a981dd6df406b7bbddd88fa0b701b5a8d2246
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 11:41:18 2013 +0100
CID#705985 ensure umask for mkstemp
Change-Id: I861b85ac38a2881ff4b993047c1a15335308ba62
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 894e5d8..8a98af2 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -38,6 +38,8 @@
#else
#include <wait.h>
#endif
+#include <sys/types.h>
+#include <sys/stat.h>
#endif
#include <string.h>
@@ -154,7 +156,9 @@ OString makeTempName(const OString& prefix)
strncat(tmpFilePattern, "XXXXXX", sizeof(tmpFilePattern)-1-strlen(tmpFilePattern));
#ifdef SAL_UNX
+ mode_t nOrigMode = umask(S_IRWXG | S_IRWXO);
int nDescriptor = mkstemp(tmpFilePattern);
+ umask(nOrigMode);
if( -1 == nDescriptor )
{
fprintf(stderr, "idlc: mkstemp(\"%s\") failed: %s\n", tmpFilePattern, strerror(errno));
commit 9ab99483808bad973363f1f27bb548c8628ace1d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 11:33:50 2013 +0100
CID#705982 ensure umask for mkstemp
Change-Id: I5c67346d09d04a2d1a781f8fee07c84004aac960
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index a293d99..43a5c81 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -59,6 +59,8 @@
#if defined USE_DOUBLE_MMAP
#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#endif
using bridges::cpp_uno::shared::VtableFactory;
@@ -239,6 +241,7 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
if (aSecurity.getHomeDir(strURLDirectory))
osl::File::getSystemPathFromFileURL(strURLDirectory, strDirectory);
+ mode_t nOrigMode = umask(S_IRWXG | S_IRWXO);
for (int i = strDirectory.isEmpty() ? 1 : 0; i < 2; ++i)
{
if (strDirectory.isEmpty())
@@ -290,6 +293,7 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
strDirectory = OUString();
}
+ umask(nOrigMode);
if (!block.start || !block.exec || block.fd == -1)
{
//Fall back to non-doublemmaped allocation
commit 5a0d01ee8385dc5d73e921a9fe3d561430867aa2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 11:25:46 2013 +0100
CID#441298 use after free
Change-Id: I4fd16f157244fa3406036d0f506c32bed0cf5b8a
diff --git a/rsc/source/rscpp/cpp6.c b/rsc/source/rscpp/cpp6.c
index 2e3be99..59708ef 100644
--- a/rsc/source/rscpp/cpp6.c
+++ b/rsc/source/rscpp/cpp6.c
@@ -626,6 +626,7 @@ defendel(char* name, int delete)
if (dp->repl != NULL) /* Free the replacement */
free(dp->repl); /* if any, and then */
free((char *) dp); /* Free the symbol */
+ dp = NULL;
}
break;
}
commit b1404ef4e54b06364977065451f3c1564d939534
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 11:23:02 2013 +0100
drop tools/string.hxx from a bunch of places
Change-Id: Id6d22b71f2b552ea7872e8a3da6afe207e856561
diff --git a/sfx2/inc/bluthsndapi.hxx b/sfx2/inc/bluthsndapi.hxx
index 202c579..abd9e42 100644
--- a/sfx2/inc/bluthsndapi.hxx
+++ b/sfx2/inc/bluthsndapi.hxx
@@ -13,8 +13,8 @@
#include <vector>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XModel.hpp>
-#include "tools/link.hxx"
-#include <tools/string.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/link.hxx>
#include "sfx2/dllapi.h"
#include "mailmodelapi.hxx"
diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx
index 04eb03c8..5d1dc1f 100644
--- a/sfx2/inc/inettbc.hxx
+++ b/sfx2/inc/inettbc.hxx
@@ -20,12 +20,10 @@
#ifndef _SFX_INETTBC_HXX
#define _SFX_INETTBC_HXX
-#include <tools/string.hxx>
-
-#include <vcl/combobox.hxx>
-#include <svtools/acceleratorexecute.hxx>
-
+#include <rtl/ustring.hxx>
#include <sfx2/tbxctrl.hxx>
+#include <svtools/acceleratorexecute.hxx>
+#include <vcl/combobox.hxx>
class SvtURLBox;
diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx
index 4d575bb..ac79cc3 100644
--- a/sfx2/inc/pch/precompiled_sfx.hxx
+++ b/sfx2/inc/pch/precompiled_sfx.hxx
@@ -100,7 +100,6 @@
#include "toolkit/awt/vclxdevice.hxx"
#include "tools/datetime.hxx"
#include "tools/debug.hxx"
-#include "tools/string.hxx"
#include "vcl/msgbox.hxx"
#include "vcl/svapp.hxx"
#include <algorithm>
@@ -760,7 +759,6 @@
#include <tools/rtti.hxx>
#include <tools/shl.hxx>
#include <tools/stream.hxx>
-#include <tools/string.hxx>
#include <tools/svborder.hxx>
#include <tools/tenccvt.hxx>
#include <tools/time.hxx>
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index f53278c..56c0833 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <vcl/msgbox.hxx>
-#include <tools/string.hxx>
+#include <rtl/ustring.hxx>
#include <svl/itempool.hxx>
#include <svl/aeitem.hxx>
#include <svl/slstitm.hxx>
diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx
index 131a68c..9d6cbee 100644
--- a/sfx2/source/appl/fileobj.hxx
+++ b/sfx2/source/appl/fileobj.hxx
@@ -19,7 +19,6 @@
#ifndef _FILEOBJ_HXX
#define _FILEOBJ_HXX
-#include <tools/string.hxx>
#include <sfx2/linksrc.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/linkmgr.hxx>
diff --git a/sfx2/source/appl/helpinterceptor.hxx b/sfx2/source/appl/helpinterceptor.hxx
index 3600f5e..e2eebaa 100644
--- a/sfx2/source/appl/helpinterceptor.hxx
+++ b/sfx2/source/appl/helpinterceptor.hxx
@@ -27,7 +27,6 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/frame/XStatusListener.hpp>
-#include <tools/string.hxx>
#include <tools/link.hxx>
#include <vector>
diff --git a/sfx2/source/appl/impldde.hxx b/sfx2/source/appl/impldde.hxx
index 1f80a70..4690457 100644
--- a/sfx2/source/appl/impldde.hxx
+++ b/sfx2/source/appl/impldde.hxx
@@ -19,8 +19,8 @@
#ifndef _IMPLDDE_HXX
#define _IMPLDDE_HXX
+#include <rtl/ustring.hxx>
#include <sfx2/linksrc.hxx>
-#include <tools/string.hxx>
class DdeConnection;
class DdeData;
diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx
index c6e4f3a..ea229a2 100644
--- a/sfx2/source/appl/openuriexternally.cxx
+++ b/sfx2/source/appl/openuriexternally.cxx
@@ -21,7 +21,6 @@
#include "rtl/ustring.hxx"
#include "sfx2/app.hxx"
#include "sfx2/sfxresid.hxx"
-#include "tools/string.hxx"
#include "vcl/msgbox.hxx"
#include "vcl/svapp.hxx"
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index b5b215c..afd3b92 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -28,7 +28,6 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/pathoptions.hxx>
#include <tools/resary.hxx>
-#include <tools/string.hxx>
#include <tools/urlobj.hxx>
#include <svtools/ehdl.hxx>
#include <svtools/sfxecode.hxx>
diff --git a/sfx2/source/doc/oleprops.hxx b/sfx2/source/doc/oleprops.hxx
index 9422c7f..d7f2a19 100644
--- a/sfx2/source/doc/oleprops.hxx
+++ b/sfx2/source/doc/oleprops.hxx
@@ -19,8 +19,9 @@
#include <map>
#include <boost/shared_ptr.hpp>
+#include <osl/thread.h>
+#include <rtl/ustring.hxx>
#include <sot/storage.hxx>
-#include <tools/string.hxx>
#include <vcl/bitmapex.hxx>
#include <com/sun/star/util/DateTime.hpp>
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index b9b4113..00bf7b4 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -19,11 +19,11 @@
#ifndef _SFX_APPDATA_HXX
#define _SFX_APPDATA_HXX
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
#include <svl/lstner.hxx>
-#include <vcl/timer.hxx>
-#include <tools/string.hxx>
#include <svtools/ehdl.hxx>
-#include "rtl/ref.hxx"
+#include <vcl/timer.hxx>
#include <com/sun/star/frame/XModel.hpp>
diff --git a/sfx2/source/inc/helper.hxx b/sfx2/source/inc/helper.hxx
index 31b32a6..65bd80d 100644
--- a/sfx2/source/inc/helper.hxx
+++ b/sfx2/source/inc/helper.hxx
@@ -21,8 +21,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/ucb/NameClash.hpp>
-
-#include <tools/string.hxx>
+#include <rtl/ustring.hxx>
#include <tools/errcode.hxx>
#include <vector>
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index 3b4b18e..dfd106a 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -45,7 +45,6 @@
#include "tools/datetime.hxx"
#include "tools/debug.hxx"
#include "tools/link.hxx"
-#include "tools/string.hxx"
#include "tools/urlobj.hxx"
#include "unotools/configmgr.hxx"
#include "unotools/pathoptions.hxx"
diff --git a/svtools/source/contnr/contentenumeration.hxx b/svtools/source/contnr/contentenumeration.hxx
index 4849e42..4e7bc4c 100644
--- a/svtools/source/contnr/contentenumeration.hxx
+++ b/svtools/source/contnr/contentenumeration.hxx
@@ -26,7 +26,6 @@
#include <ucbhelper/content.hxx>
#include <rtl/ustring.hxx>
#include <tools/datetime.hxx>
-#include <tools/string.hxx>
#include <vcl/image.hxx>
//........................................................................
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index 09cc83a..7b98251 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -19,7 +19,6 @@
#include <osl/mutex.hxx>
#include <tools/color.hxx>
-#include <tools/string.hxx>
#include <vcl/image.hxx>
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/compbase6.hxx>
diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx
index d142ded..afe7a04 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -31,7 +31,6 @@
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <osl/mutex.hxx>
-#include <tools/string.hxx>
#include <tools/rcid.h>
#include <jvmfwk/framework.h>
diff --git a/svtools/source/svhtml/htmlkywd.cxx b/svtools/source/svhtml/htmlkywd.cxx
index 7abac4a..334adb0 100644
--- a/svtools/source/svhtml/htmlkywd.cxx
+++ b/svtools/source/svhtml/htmlkywd.cxx
@@ -22,10 +22,9 @@
#include <sal/types.h> // for sal_Char, sal_Unicode, etc
#include <stdlib.h> // for bsearch, qsort
#include <string.h> // for strcmp
+#include <rtl/ustring.hxx>
#include <svtools/htmltokn.h>
-#include <tools/solar.h> // for String
#include <svtools/htmlkywd.hxx>
-#include <tools/string.hxx> // for String::CompareToAscii, etc
// Table has still to be sorted
struct HTML_TokenEntry
diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx
index db0286c..c1159e1 100644
--- a/svtools/source/svrtf/rtfkeywd.cxx
+++ b/svtools/source/svrtf/rtfkeywd.cxx
@@ -17,10 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
+#include <rtl/ustring.hxx>
#include <svtools/rtfkeywd.hxx>
#include <svtools/rtftoken.h>
-#include "tools/string.hxx"
#include <string.h>
#include <ctype.h>
diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx
index 64f7e12..5272fe1 100644
--- a/svtools/source/svrtf/rtfout.cxx
+++ b/svtools/source/svrtf/rtfout.cxx
@@ -19,7 +19,6 @@
#include <tools/debug.hxx>
#include <tools/stream.hxx>
-#include <tools/string.hxx>
#include <rtl/string.hxx>
#include <rtl/ustrbuf.hxx>
#include <svtools/rtfkeywd.hxx>
commit af05fe65ab9f1340ccd4038c14fc91d8595207a7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 11:22:27 2013 +0100
CID#440614 use after free
a bit of guesswork here I admit
Change-Id: I774da6f585e4b81a25660b7823d6bb150630f44f
diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx
index fdfd838..02df3a8 100644
--- a/idlc/source/fehelper.cxx
+++ b/idlc/source/fehelper.cxx
@@ -50,7 +50,6 @@ sal_Bool FeDeclarator::checkType(AstDeclaration const * type)
AstType const * FeDeclarator::compose(AstDeclaration const * pDecl)
{
- AstArray* pArray;
AstType* pType;
if ( pDecl == 0 )
@@ -68,7 +67,7 @@ AstType const * FeDeclarator::compose(AstDeclaration const * pDecl)
if (m_pComplexPart->getNodeType() == NT_array)
{
- pArray = (AstArray*)m_pComplexPart;
+ AstArray* pArray = (AstArray*)m_pComplexPart;
pArray->setType(pType);
// insert array type in global scope
@@ -80,6 +79,7 @@ AstType const * FeDeclarator::compose(AstDeclaration const * pDecl)
{
delete m_pComplexPart;
m_pComplexPart = pDecl2;
+ return (AstType*)pDecl2;
}
}
return pArray;
commit d908422f5763ed8ea79af81336ca564f46435baf
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 12 10:38:48 2013 +0100
Related: fdo#38838 remove XubString alias
Change-Id: I29efbe2bee94c0059f5a2e3dc4d163375e439e1a
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 4439615..32e0da2 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1301,7 +1301,7 @@ ContentNode::ContentNode( SfxItemPool& rPool ) : aContentAttribs( rPool )
DBG_CTOR( EE_ContentNode, 0 );
}
-ContentNode::ContentNode( const XubString& rStr, const ContentAttribs& rContentAttribs ) :
+ContentNode::ContentNode( const OUString& rStr, const ContentAttribs& rContentAttribs ) :
maString(rStr), aContentAttribs(rContentAttribs)
{
DBG_CTOR( EE_ContentNode, 0 );
@@ -1697,12 +1697,12 @@ void ContentNode::SetChar(sal_uInt16 nPos, sal_Unicode c)
maString = maString.replaceAt(nPos, 1, OUString(c));
}
-void ContentNode::Insert(const XubString& rStr, sal_uInt16 nPos)
+void ContentNode::Insert(const OUString& rStr, sal_uInt16 nPos)
{
maString = maString.replaceAt(nPos, 0, rStr);
}
-void ContentNode::Append(const XubString& rStr)
+void ContentNode::Append(const OUString& rStr)
{
maString += rStr;
}
@@ -1717,12 +1717,12 @@ void ContentNode::Erase(sal_uInt16 nPos, sal_uInt16 nCount)
maString = maString.replaceAt(nPos, nCount, "");
}
-XubString ContentNode::Copy(sal_uInt16 nPos) const
+OUString ContentNode::Copy(sal_uInt16 nPos) const
{
return maString.copy(nPos);
}
-XubString ContentNode::Copy(sal_uInt16 nPos, sal_uInt16 nCount) const
+OUString ContentNode::Copy(sal_uInt16 nPos, sal_uInt16 nCount) const
{
return maString.copy(nPos, nCount);
}
@@ -2126,12 +2126,12 @@ OUString EditDoc::GetText( LineEnd eEnd ) const
return OUString(newStr, SAL_NO_ACQUIRE);
}
-XubString EditDoc::GetParaAsString( sal_Int32 nNode ) const
+OUString EditDoc::GetParaAsString( sal_Int32 nNode ) const
{
return GetParaAsString( GetObject( nNode ) );
}
-XubString EditDoc::GetParaAsString(
+OUString EditDoc::GetParaAsString(
const ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, bool bResolveFields) const
{
if ( nEndPos > pNode->Len() )
@@ -2140,7 +2140,7 @@ XubString EditDoc::GetParaAsString(
DBG_ASSERT( nStartPos <= nEndPos, "Start and End reversed?" );
sal_uInt16 nIndex = nStartPos;
- XubString aStr;
+ OUString aStr;
const EditCharAttrib* pNextFeature = pNode->GetCharAttribs().FindFeature( nIndex );
while ( nIndex < nEndPos )
{
@@ -2154,15 +2154,15 @@ XubString EditDoc::GetParaAsString(
//!! beware of sub string length of -1 which is also defined as STRING_LEN and
//!! thus would result in adding the whole sub string up to the end of the node !!
if (nEnd > nIndex)
- aStr += XubString(pNode->GetString(), nIndex, nEnd - nIndex);
+ aStr += pNode->GetString().copy(nIndex, nEnd - nIndex);
if ( pNextFeature )
{
switch ( pNextFeature->GetItem()->Which() )
{
- case EE_FEATURE_TAB: aStr += '\t';
+ case EE_FEATURE_TAB: aStr += "\t";
break;
- case EE_FEATURE_LINEBR: aStr += '\x0A';
+ case EE_FEATURE_LINEBR: aStr += "\x0A";
break;
case EE_FEATURE_FIELD:
if ( bResolveFields )
@@ -2266,16 +2266,16 @@ EditPaM EditDoc::RemoveText()
return aPaM;
}
-EditPaM EditDoc::InsertText( EditPaM aPaM, const XubString& rStr )
+EditPaM EditDoc::InsertText( EditPaM aPaM, const OUString& rStr )
{
- DBG_ASSERT( rStr.Search( 0x0A ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
- DBG_ASSERT( rStr.Search( 0x0D ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
- DBG_ASSERT( rStr.Search( '\t' ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
+ DBG_ASSERT( rStr.indexOf( 0x0A ) == -1, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
+ DBG_ASSERT( rStr.indexOf( 0x0D ) == -1, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
+ DBG_ASSERT( rStr.indexOf( '\t' ) == -1, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
DBG_ASSERT( aPaM.GetNode(), "Blinder PaM in EditDoc::InsertText1" );
aPaM.GetNode()->Insert( rStr, aPaM.GetIndex() );
- aPaM.GetNode()->ExpandAttribs( aPaM.GetIndex(), rStr.Len(), GetItemPool() );
- aPaM.GetIndex() = aPaM.GetIndex() + rStr.Len();
+ aPaM.GetNode()->ExpandAttribs( aPaM.GetIndex(), rStr.getLength(), GetItemPool() );
+ aPaM.GetIndex() = aPaM.GetIndex() + rStr.getLength();
SetModified( sal_True );
@@ -2287,7 +2287,7 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs )
DBG_ASSERT( aPaM.GetNode(), "Blinder PaM in EditDoc::InsertParaBreak" );
ContentNode* pCurNode = aPaM.GetNode();
sal_Int32 nPos = GetPos( pCurNode );
- XubString aStr = aPaM.GetNode()->Copy( aPaM.GetIndex() );
+ OUString aStr = aPaM.GetNode()->Copy( aPaM.GetIndex() );
aPaM.GetNode()->Erase( aPaM.GetIndex() );
// the paragraph attributes...
@@ -2304,8 +2304,8 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs )
SfxStyleSheet* pStyle = aPaM.GetNode()->GetStyleSheet();
if ( pStyle )
{
- XubString aFollow( pStyle->GetFollow() );
- if ( aFollow.Len() && ( aFollow != pStyle->GetName() ) )
+ OUString aFollow( pStyle->GetFollow() );
+ if ( !aFollow.isEmpty() && ( aFollow != pStyle->GetName() ) )
{
SfxStyleSheetBase* pNext = pStyle->GetPool().Find( aFollow, pStyle->GetFamily() );
pNode->SetStyleSheet( (SfxStyleSheet*)pNext );
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 422e44f..ab6d577 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -263,7 +263,7 @@ private:
public:
ContentNode( SfxItemPool& rItemPool );
- ContentNode( const XubString& rStr, const ContentAttribs& rContentAttribs );
+ ContentNode( const OUString& rStr, const ContentAttribs& rContentAttribs );
~ContentNode();
ContentAttribs& GetContentAttribs() { return aContentAttribs; }
@@ -297,12 +297,12 @@ public:
const OUString& GetString() const;
void SetChar(sal_uInt16 nPos, sal_Unicode c);
- void Insert(const XubString& rStr, sal_uInt16 nPos);
- void Append(const XubString& rStr);
+ void Insert(const OUString& rStr, sal_uInt16 nPos);
+ void Append(const OUString& rStr);
void Erase(sal_uInt16 nPos);
void Erase(sal_uInt16 nPos, sal_uInt16 nCount);
- XubString Copy(sal_uInt16 nPos) const;
- XubString Copy(sal_uInt16 nPos, sal_uInt16 nCount) const;
+ OUString Copy(sal_uInt16 nPos) const;
+ OUString Copy(sal_uInt16 nPos, sal_uInt16 nCount) const;
sal_Unicode GetChar(sal_uInt16 nPos) const;
};
@@ -774,7 +774,7 @@ public:
EditPaM Clear();
EditPaM RemoveText();
EditPaM RemoveChars( EditPaM aPaM, sal_uInt16 nChars );
- EditPaM InsertText( EditPaM aPaM, const XubString& rStr );
+ EditPaM InsertText( EditPaM aPaM, const OUString& rStr );
EditPaM InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs );
EditPaM InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem );
EditPaM ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight );
@@ -782,8 +782,8 @@ public:
OUString GetText( LineEnd eEnd ) const;
sal_uLong GetTextLen() const;
- XubString GetParaAsString( sal_Int32 nNode ) const;
- XubString GetParaAsString(const ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, bool bResolveFields = true) const;
+ OUString GetParaAsString( sal_Int32 nNode ) const;
+ OUString GetParaAsString(const ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, bool bResolveFields = true) const;
EditPaM GetStartPaM() const;
EditPaM GetEndPaM() const;
diff --git a/include/tools/solar.h b/include/tools/solar.h
index 0645a61..b6d90e6 100644
--- a/include/tools/solar.h
+++ b/include/tools/solar.h
@@ -119,7 +119,6 @@ inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((sal_uInt8*)&n)[7
#endif
#define UniString String
-#define XubString String
#define xub_StrLen sal_uInt16
#define STRING_CONCAT3( s1, s2, s3 ) \
diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx
index 3e7a0c8..f1b8975 100644
--- a/sw/inc/fmtrfmrk.hxx
+++ b/sw/inc/fmtrfmrk.hxx
@@ -37,7 +37,7 @@ class SwFmtRefMark : public SfxPoolItem
OUString aRefName;
public:
- SwFmtRefMark( const String& rTxt );
+ SwFmtRefMark( const OUString& rTxt );
SwFmtRefMark( const SwFmtRefMark& rRefMark );
~SwFmtRefMark( );
diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx
index fa9abed..66b6db1 100644
--- a/sw/source/core/access/parachangetrackinginfo.cxx
+++ b/sw/source/core/access/parachangetrackinginfo.cxx
@@ -72,7 +72,7 @@ namespace {
: 0;
const xub_StrLen nTxtFrmTextEndPos = rTxtFrm.HasFollow()
? rTxtFrm.GetFollow()->GetOfst()
- : rTxtFrm.GetTxt().Len();
+ : rTxtFrm.GetTxt().getLength();
// iteration over the redlines which overlap with the text node.
const SwRedlineTbl& rRedlineTbl = pIDocChangeTrack->GetRedlineTbl();
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index be21ae7..4b9821b 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -104,8 +104,8 @@ class SwSubFont : public SvxFont
inline void SetProportion( const sal_uInt8 nNewPropr );
inline void SetFamily( const FontFamily eFamily );
- inline void SetName( const XubString& rName );
- inline void SetStyleName( const XubString& rStyleName );
+ inline void SetName( const OUString& rName );
+ inline void SetStyleName( const OUString& rStyleName );
inline void SetSize( const Size& rSize );
inline void SetWeight( const FontWeight eWeight );
inline void SetLanguage( LanguageType eNewLang );
@@ -227,8 +227,8 @@ public:
inline void SetPropWidth( const sal_uInt16 nNew );
inline void SetFamily( const FontFamily eFamily, const sal_uInt8 nWhich );
- inline void SetName( const XubString& rName, const sal_uInt8 nWhich );
- inline void SetStyleName( const XubString& rStyleName, const sal_uInt8 nWhich );
+ inline void SetName( const OUString& rName, const sal_uInt8 nWhich );
+ inline void SetStyleName( const OUString& rStyleName, const sal_uInt8 nWhich );
inline void SetSize( const Size& rSize, const sal_uInt8 nWhich );
inline void SetWeight( const FontWeight eWeight, const sal_uInt8 nWhich );
inline void SetItalic( const FontItalic eItalic, const sal_uInt8 nWhich );
@@ -329,7 +329,7 @@ public:
{ return aSub[nActual].GetCapitalSize( rInf ); }
xub_StrLen GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
- const SwScriptInfo* pScript, const XubString& rTxt,
+ const SwScriptInfo* pScript, const OUString& rTxt,
long nTextWidth, const xub_StrLen nIdx,
const xub_StrLen nLen );
@@ -485,26 +485,26 @@ inline void SwFont::SetFamily( const FontFamily eFamily, const sal_uInt8 nWhich
}
// gekapselte SV-Font-Methode
-inline void SwSubFont::SetName( const XubString& rName )
+inline void SwSubFont::SetName( const OUString& rName )
{
pMagic = 0;
Font::SetName( rName );
}
-inline void SwFont::SetName( const XubString& rName, const sal_uInt8 nWhich )
+inline void SwFont::SetName( const OUString& rName, const sal_uInt8 nWhich )
{
bFntChg = sal_True;
aSub[nWhich].SetName( rName );
}
// gekapselte SV-Font-Methode
-inline void SwSubFont::SetStyleName( const XubString& rStyleName )
+inline void SwSubFont::SetStyleName( const OUString& rStyleName )
{
pMagic = 0;
Font::SetStyleName( rStyleName );
}
-inline void SwFont::SetStyleName( const XubString& rStyle, const sal_uInt8 nWhich )
+inline void SwFont::SetStyleName( const OUString& rStyle, const sal_uInt8 nWhich )
{
bFntChg = sal_True;
aSub[nWhich].SetStyleName( rStyle );
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index fc12757..8d4a3e0 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -155,8 +155,8 @@ class SwTxtFrm: public SwCntntFrm
sal_Bool CalcFollow( const xub_StrLen nTxtOfst );
// korrigiert die Stelle ab der formatiert werden muss.
- xub_StrLen FindBrk(const String &rTxt, const xub_StrLen nStart,
- const xub_StrLen nEnd) const;
+ xub_StrLen FindBrk(const OUString &rTxt, const sal_Int32 nStart,
+ const sal_Int32 nEnd) const;
// inline-Weiche
SwTwips _GetFtnFrmHeight() const;
@@ -316,7 +316,7 @@ public:
{ return GetFollow() && !GetFollow()->GetOfst(); }
// Liefert den zu bearbeitenden Textausschnitt zurueck (inline, s.u.)
- const String& GetTxt() const;
+ const OUString& GetTxt() const;
inline SwTxtNode *GetTxtNode()
{ return static_cast< SwTxtNode* >( SwCntntFrm::GetNode()); }
inline const SwTxtNode *GetTxtNode() const
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index c3021e4..96ae5a0 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -462,7 +462,7 @@ bool SwTxtFrm::GetTopOfLine( SwTwips& _onTopOfLine,
// get position offset
xub_StrLen nOffset = _rPos.nContent.GetIndex();
- if ( GetTxt().Len() < nOffset )
+ if ( GetTxt().getLength() < nOffset )
{
bRet = false;
}
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 4bd5c03..e36de87 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -730,7 +730,7 @@ void SwTxtFrm::_SetOfst( const xub_StrLen nNewOfst )
{
SwCharRange &rReformat = *(pPara->GetReformat());
rReformat.Start() = 0;
- rReformat.Len() = GetTxt().Len();
+ rReformat.Len() = GetTxt().getLength();
*(pPara->GetDelta()) = rReformat.Len();
}
InvalidateSize();
@@ -1243,8 +1243,8 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
rLine.SetUnclipped( sal_False );
// That was too complicated for the C30: aString( GetTxt() );
- const XubString &rString = GetTxtNode()->GetTxt();
- const xub_StrLen nStrLen = rString.Len();
+ const OUString &rString = GetTxtNode()->GetTxt();
+ const xub_StrLen nStrLen = rString.getLength();
SwCharRange &rReformat = *(pPara->GetReformat());
SwRepaint &rRepaint = *(pPara->GetRepaint());
@@ -1308,7 +1308,7 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
if( nNew )
{
--nNew;
- if( CH_BREAK == rString.GetChar( nNew ) )
+ if( CH_BREAK == rString[nNew] )
{
++nNew;
rLine.Next();
@@ -1620,9 +1620,9 @@ void SwTxtFrm::FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
void SwTxtFrm::_Format( SwParaPortion *pPara )
{
- const xub_StrLen nStrLen = GetTxt().Len();
+ const bool bIsEmpty = GetTxt().isEmpty();
- if ( !nStrLen )
+ if ( bIsEmpty )
{
// Empty lines do not get tortured for very long:
// pPara is cleared, which is the same as:
@@ -1865,7 +1865,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat )
"SwTxtFrm::FormatQuick with swapped frame" );
#if OSL_DEBUG_LEVEL > 1
- const XubString aXXX = GetTxtNode()->GetTxt();
+ const OUString aXXX = GetTxtNode()->GetTxt();
const SwTwips nDbgY = Frm().Top();
(void)nDbgY;
// nStopAt allows CV to alter it
diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx
index 4d4f243..5a65a07 100644
--- a/sw/source/core/text/frminf.cxx
+++ b/sw/source/core/text/frminf.cxx
@@ -27,14 +27,14 @@
xub_StrLen SwTxtMargin::GetTxtStart() const
{
- const XubString &rTxt = GetInfo().GetTxt();
+ const OUString &rTxt = GetInfo().GetTxt();
const xub_StrLen nTmpPos = nStart;
const xub_StrLen nEnd = nTmpPos + pCurr->GetLen();
xub_StrLen i;
for( i = nTmpPos; i < nEnd; ++i )
{
- const sal_Unicode aChar = rTxt.GetChar( i );
+ const sal_Unicode aChar = rTxt[i];
if( CH_TAB != aChar && ' ' != aChar )
return i;
}
@@ -47,13 +47,13 @@ xub_StrLen SwTxtMargin::GetTxtStart() const
xub_StrLen SwTxtMargin::GetTxtEnd() const
{
- const XubString &rTxt = GetInfo().GetTxt();
+ const OUString &rTxt = GetInfo().GetTxt();
const xub_StrLen nTmpPos = nStart;
const xub_StrLen nEnd = nTmpPos + pCurr->GetLen();
- long i;
+ sal_Int32 i;
for( i = nEnd - 1; i >= nTmpPos; --i )
{
- sal_Unicode aChar = rTxt.GetChar( static_cast<xub_StrLen>(i) );
+ sal_Unicode aChar = rTxt[i];
if( CH_TAB != aChar && CH_BREAK != aChar && ' ' != aChar )
return static_cast<xub_StrLen>(i + 1);
}
@@ -337,20 +337,20 @@ KSHORT SwTxtFrmInfo::GetBigIndent( xub_StrLen& rFndPos,
return 0;
// Is on front of a non-space
- const XubString& rTxt = aInf.GetTxt();
- sal_Unicode aChar = rTxt.GetChar( rFndPos );
+ const OUString& rTxt = aInf.GetTxt();
+ sal_Unicode aChar = rTxt[rFndPos];
if( CH_TAB == aChar || CH_BREAK == aChar || ' ' == aChar ||
(( CH_TXTATR_BREAKWORD == aChar || CH_TXTATR_INWORD == aChar ) &&
aInf.HasHint( rFndPos ) ) )
return 0;
// and after a space
- aChar = rTxt.GetChar( rFndPos - 1 );
+ aChar = rTxt[rFndPos - 1];
if( CH_TAB != aChar && CH_BREAK != aChar &&
( ( CH_TXTATR_BREAKWORD != aChar && CH_TXTATR_INWORD != aChar ) ||
!aInf.HasHint( rFndPos - 1 ) ) &&
// More than two Blanks!
- ( ' ' != aChar || ' ' != rTxt.GetChar( rFndPos - 2 ) ) )
+ ( ' ' != aChar || ' ' != rTxt[rFndPos - 2] ) )
return 0;
SwRect aRect;
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index ece87be..cf8e582 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -363,7 +363,7 @@ void SwTxtSizeInfo::NoteAnimation() const
SwPosSize SwTxtSizeInfo::GetTxtSize( OutputDevice* pOutDev,
const SwScriptInfo* pSI,
- const XubString& rTxt,
+ const OUString& rTxt,
const xub_StrLen nIndex,
const xub_StrLen nLength,
const sal_uInt16 nComp ) const
@@ -540,7 +540,7 @@ static sal_Bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf )
* SwTxtPaintInfo::_DrawText()
*************************************************************************/
-void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPor,
+void SwTxtPaintInfo::_DrawText( const OUString &rText, const SwLinePortion &rPor,
const xub_StrLen nStart, const xub_StrLen nLength,
const sal_Bool bKern, const sal_Bool bWrong,
const sal_Bool bSmartTag,
@@ -1638,7 +1638,7 @@ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor,
{
if( pCh )
{
- aTxt = XubString( pCh, RTL_TEXTENCODING_MS_1252 );
+ aTxt = OUString( pCh, strlen(pCh), RTL_TEXTENCODING_MS_1252 );
bOn = sal_True;
}
else
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 99c777b..df2ccc3 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -276,7 +276,7 @@ public:
// GetTxtSize
//
SwPosSize GetTxtSize( OutputDevice* pOut, const SwScriptInfo* pSI,
- const XubString& rTxt, const xub_StrLen nIdx,
+ const OUString& rTxt, const xub_StrLen nIdx,
const xub_StrLen nLen, const sal_uInt16 nComp ) const;
SwPosSize GetTxtSize() const;
void GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx,
@@ -284,7 +284,7 @@ public:
sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const;
inline SwPosSize GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx,
const xub_StrLen nLen, const sal_uInt16 nComp ) const;
- inline SwPosSize GetTxtSize( const XubString &rTxt ) const;
+ inline SwPosSize GetTxtSize( const OUString &rTxt ) const;
//
// GetTxtBreak
@@ -383,7 +383,7 @@ class SwTxtPaintInfo : public SwTxtSizeInfo
SwRect aPaintRect; // Original paint rect (from Layout paint)
MSHORT nSpaceIdx;
- void _DrawText( const XubString &rText, const SwLinePortion &rPor,
+ void _DrawText( const OUString &rText, const SwLinePortion &rPor,
const xub_StrLen nIdx, const xub_StrLen nLen,
const sal_Bool bKern, const sal_Bool bWrong = sal_False,
const sal_Bool bSmartTag = sal_False,
@@ -421,7 +421,7 @@ public:
inline SwTxtFly *GetTxtFly() { return &aTxtFly; }
inline const SwTxtFly *GetTxtFly() const { return &aTxtFly; }
- inline void DrawText( const XubString &rText, const SwLinePortion &rPor,
+ inline void DrawText( const OUString &rText, const SwLinePortion &rPor,
const xub_StrLen nIdx = 0,
const xub_StrLen nLen = STRING_LEN,
const sal_Bool bKern = sal_False) const;
@@ -804,9 +804,9 @@ inline KSHORT SwTxtSizeInfo::GetTxtHeight() const
return ((SwFont*)GetFont())->GetHeight( m_pVsh, *GetOut() );
}
-inline SwPosSize SwTxtSizeInfo::GetTxtSize( const XubString &rTxt ) const
+inline SwPosSize SwTxtSizeInfo::GetTxtSize( const OUString &rTxt ) const
{
- return GetTxtSize( m_pOut, 0, rTxt, 0, rTxt.Len(), 0 );
+ return GetTxtSize( m_pOut, 0, rTxt, 0, rTxt.getLength(), 0 );
}
inline SwPosSize SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI,
@@ -832,7 +832,7 @@ inline void SwTxtPaintInfo::SetPaintOfst( const SwTwips nNew )
}
-inline void SwTxtPaintInfo::DrawText( const XubString &rText,
+inline void SwTxtPaintInfo::DrawText( const OUString &rText,
const SwLinePortion &rPor,
const xub_StrLen nStart, const xub_StrLen nLength,
const sal_Bool bKern ) const
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 6408d5d..05d6854 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1759,7 +1759,7 @@ void SwTxtFormatter::CalcRealHeight( sal_Bool bNewLine )
// Zeile am Absatzende geben (bei leeren Abs?tzen oder nach einem
// Shift-Return), die das Register durchaus beachten soll.
if( !pCurr->IsDummy() || ( !pCurr->GetNext() &&
- GetStart() >= GetTxtFrm()->GetTxt().Len() && !bNewLine ) )
+ GetStart() >= GetTxtFrm()->GetTxt().getLength() && !bNewLine ) )
{
const SvxLineSpacingItem *pSpace = aLineInf.GetLineSpacing();
if( pSpace )
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 59e916a..e2a1787 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -435,7 +435,7 @@ void SwTxtIter::TruncLines( bool bNoteFollow )
}
if( pCurr->IsDummy() &&
!pCurr->GetLen() &&
- nStart < GetTxtFrm()->GetTxt().Len() )
+ nStart < GetTxtFrm()->GetTxt().getLength() )
pCurr->SetRealHeight( 1 );
if( GetHints() )
pFrm->RemoveFtn( nEnd );
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 63f2ac4..cc03993 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -760,7 +760,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf )
SwDropPortionPart* pCurrPart = pDrop->GetPart();
const bool bUseCache = ! pCurrPart->GetFollow() && !pCurrPart->GetFont().HasBorder();
xub_StrLen nIdx = rInf.GetIdx();
- XubString aStr( rInf.GetTxt(), nIdx, pCurrPart->GetLen() );
+ OUString aStr(rInf.GetTxt().copy(nIdx, pCurrPart->GetLen()));
long nAscent = 0;
long nDescent = 0;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 3a03336..96313d0 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -388,9 +388,9 @@ SwTxtFrm::~SwTxtFrm()
ClearPara();
}
-const XubString& SwTxtFrm::GetTxt() const
+const OUString& SwTxtFrm::GetTxt() const
{
- return reinterpret_cast<const XubString&>(GetTxtNode()->GetTxt()); //FIXME
+ return GetTxtNode()->GetTxt();
}
void SwTxtFrm::ResetPreps()
@@ -643,17 +643,15 @@ void SwTxtFrm::HideAndShowObjects()
* nFound ist <= nEndLine.
*************************************************************************/
-xub_StrLen SwTxtFrm::FindBrk( const XubString &rTxt,
- const xub_StrLen nStart,
- const xub_StrLen nEnd ) const
+xub_StrLen SwTxtFrm::FindBrk( const OUString &rTxt,
+ const sal_Int32 nStart,
+ const sal_Int32 nEnd ) const
{
- // #i104291# - applying patch to avoid overflow.
- unsigned long nFound = nStart;
- const xub_StrLen nEndLine = std::min( nEnd, rTxt.Len() );
+ sal_Int32 nFound = nStart;
+ const sal_Int32 nEndLine = std::min( nEnd, rTxt.getLength() );
// Wir ueberlesen erst alle Blanks am Anfang der Zeile (vgl. Bug 2235).
- while( nFound <= nEndLine &&
- ' ' == rTxt.GetChar( static_cast<xub_StrLen>(nFound) ) )
+ while( nFound <= nEndLine && ' ' == rTxt[nFound] )
{
nFound++;
}
@@ -662,8 +660,7 @@ xub_StrLen SwTxtFrm::FindBrk( const XubString &rTxt,
// "Dr.$Meyer" am Anfang der zweiten Zeile. Dahinter ein Blank eingegeben
// und das Wort rutscht nicht in die erste Zeile, obwohl es ginge.
// Aus diesem Grund nehmen wir das Dummy-Zeichen noch mit.
- while( nFound <= nEndLine &&
- ' ' != rTxt.GetChar( static_cast<xub_StrLen>(nFound) ) )
+ while( nFound <= nEndLine && ' ' != rTxt[nFound] )
{
nFound++;
}
@@ -689,7 +686,7 @@ sal_Bool SwTxtFrm::IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) c
// der Bereich liegt nicht komplett hinter uns bzw.
// unser Text ist geloescht worden.
- if( nMax > nPos || nMax > GetTxt().Len() )
+ if( nMax > nPos || nMax > GetTxt().getLength() )
return sal_True;
// changes made in the first line of a follow can modify the master
@@ -1465,7 +1462,7 @@ static bool lcl_ErgoVadis( SwTxtFrm* pFrm, xub_StrLen &rPos, const PrepareHint e
if( pFrm->HasFollow() )
rPos = pFrm->GetFollow()->GetOfst();
else
- rPos = pFrm->GetTxt().Len();
+ rPos = pFrm->GetTxt().getLength();
if( rPos )
--rPos; // unser letztes Zeichen
}
@@ -2059,7 +2056,7 @@ KSHORT SwTxtFrm::GetParHeight() const
KSHORT nRet = (KSHORT)Prt().SSize().Height();
if( IsUndersized() )
{
- if( IsEmpty() || GetTxt().Len() == 0 )
+ if( IsEmpty() || GetTxt().isEmpty() )
nRet = (KSHORT)EmptyHeight();
else
++nRet;
@@ -2324,7 +2321,7 @@ void SwTxtFrm::_CalcHeightOfLastLine( const bool _bUseFont )
else
{
bool bCalcHeightOfLastLine = true;
- if ( ( !HasPara() && IsEmpty( ) ) || GetTxt().Len( ) == 0 )
+ if ( ( !HasPara() && IsEmpty( ) ) || GetTxt().isEmpty() )
{
mnHeightOfLastLine = EmptyHeight();
bCalcHeightOfLastLine = false;
@@ -2477,7 +2474,7 @@ void SwTxtFrm::ChgThisLines()
sal_uLong nNew = 0;
const SwLineNumberInfo &rInf = GetNode()->getIDocumentLineNumberAccess()->GetLineNumberInfo();
- if ( GetTxt().Len() && HasPara() )
+ if ( !GetTxt().isEmpty() && HasPara() )
{
SwTxtSizeInfo aInf( this );
SwTxtMargin aLine( this, &aInf );
diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx
index 7c04437..04c8d4a 100644
--- a/sw/source/core/txtnode/atrref.cxx
+++ b/sw/source/core/txtnode/atrref.cxx
@@ -33,7 +33,7 @@ SwFmtRefMark::~SwFmtRefMark( )
{
}
-SwFmtRefMark::SwFmtRefMark( const XubString& rName )
+SwFmtRefMark::SwFmtRefMark( const OUString& rName )
: SfxPoolItem( RES_TXTATR_REFMARK ),
pTxtAttr( 0 ),
aRefName( rName )
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 756f2c1..2372ea7 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2339,7 +2339,7 @@ SwCacheObj *SwFntAccess::NewObj( )
}
extern xub_StrLen sw_CalcCaseMap( const SwFont& rFnt,
- const XubString& rOrigString,
+ const OUString& rOrigString,
xub_StrLen nOfst,
xub_StrLen nLen,
xub_StrLen nIdx );
@@ -2450,7 +2450,7 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
}
else
{
- const XubString aSnippet( rInf.GetText(), rInf.GetIdx(), nLn );
+ const OUString aSnippet(rInf.GetText().copy(rInf.GetIdx(), nLn));
aTmpText = aSub[nActual].CalcCaseMap( aSnippet );
const bool bTitle = SVX_CASEMAP_TITEL == aSub[nActual].GetCaseMap() &&
g_pBreakIt->GetBreakIter().is();
@@ -2465,9 +2465,9 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
{
// In this case, the beginning of aTmpText is wrong.
- XubString aSnippetTmp( aSnippet, 0, 1 );
+ OUString aSnippetTmp(aSnippet.copy(0, 1));
aSnippetTmp = aSub[nActual].CalcCaseMap( aSnippetTmp );
- aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.Len(), OUString(aSnippet.GetChar( 0 )) );
+ aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.getLength(), OUString(aSnippet[0]) );
}
}
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index f0e6e04..3717575 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -46,9 +46,9 @@ using namespace ::com::sun::star::i18n;
class SwCapitalInfo
{
public:
- explicit SwCapitalInfo( const XubString& rOrigText ) :
+ explicit SwCapitalInfo( const OUString& rOrigText ) :
rString( rOrigText ), nIdx( 0 ), nLen( 0 ) {};
- const XubString& rString;
+ const OUString& rString;
xub_StrLen nIdx;
xub_StrLen nLen;
};
@@ -65,21 +65,21 @@ public:
*************************************************************************/
xub_StrLen sw_CalcCaseMap( const SwFont& rFnt,
- const XubString& rOrigString,
+ const OUString& rOrigString,
xub_StrLen nOfst,
xub_StrLen nLen,
xub_StrLen nIdx )
{
int j = 0;
const xub_StrLen nEnd = nOfst + nLen;
- OSL_ENSURE( nEnd <= rOrigString.Len(), "sw_CalcCaseMap: Wrong parameters" );
+ OSL_ENSURE( nEnd <= rOrigString.getLength(), "sw_CalcCaseMap: Wrong parameters" );
// special case for title case:
const bool bTitle = SVX_CASEMAP_TITEL == rFnt.GetCaseMap() &&
g_pBreakIt->GetBreakIter().is();
for ( xub_StrLen i = nOfst; i < nEnd; ++i )
{
- XubString aTmp( rOrigString, i, 1 );
+ OUString aTmp(rOrigString.copy(i, 1));
if ( !bTitle ||
g_pBreakIt->GetBreakIter()->isBeginWord(
@@ -88,7 +88,7 @@ xub_StrLen sw_CalcCaseMap( const SwFont& rFnt,
WordType::ANYWORD_IGNOREWHITESPACES ) )
aTmp = rFnt.GetActualFont().CalcCaseMap( aTmp );
- j += aTmp.Len();
+ j += aTmp.getLength();
if ( j > nIdx )
return i;
@@ -244,7 +244,7 @@ void SwDoGetCapitalBreak::Do()
*************************************************************************/
xub_StrLen SwFont::GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
- const SwScriptInfo* pScript, const XubString& rTxt, long const nTextWidth,
+ const SwScriptInfo* pScript, const OUString& rTxt, long const nTextWidth,
const xub_StrLen nIdx, const xub_StrLen nLen )
{
// Start:
@@ -543,12 +543,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
OSL_ENSURE( pLastFont, "SwFont::DoOnCapitals: No LastFont?!" );
long nKana = 0;
- const XubString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) );
+ const OUString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) );
xub_StrLen nMaxPos = std::min( sal_uInt16(rDo.GetInf().GetText().getLength() - rDo.GetInf().GetIdx()),
rDo.GetInf().GetLen() );
rDo.GetInf().SetLen( nMaxPos );
- const XubString& rOldText = rDo.GetInf().GetText();
+ const OUString& rOldText = rDo.GetInf().GetText();
rDo.GetInf().SetText( aTxt );
xub_StrLen nPos = rDo.GetInf().GetIdx();
xub_StrLen nOldPos = nPos;
@@ -557,9 +557,9 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// #107816#
// Look if the length of the original text and the ToUpper-converted
// text is different. If yes, do special handling.
- XubString aNewText;
+ OUString aNewText;
SwCapitalInfo aCapInf( rOldText );
- sal_Bool bCaseMapLengthDiffers( aTxt.Len() != rOldText.Len() );
+ sal_Bool bCaseMapLengthDiffers( aTxt.getLength() != rOldText.getLength() );
if ( bCaseMapLengthDiffers )
rDo.SetCapInf( aCapInf );
@@ -654,12 +654,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const XubString aSnippet( rOldText, nOldPos, nPos - nOldPos);
+ const OUString aSnippet(rOldText.copy(nOldPos, nPos - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nPos - nOldPos;
rDo.GetInf().SetIdx( 0 );
- rDo.GetInf().SetLen( aNewText.Len() );
+ rDo.GetInf().SetLen( aNewText.getLength() );
rDo.GetInf().SetText( aNewText );
}
else
@@ -702,7 +702,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
if( bWordWise )
{
nTmp = nOldPos;
- while( nTmp < nPos && CH_BLANK == rOldText.GetChar( nTmp ) )
+ while( nTmp < nPos && CH_BLANK == rOldText[nTmp] )
++nTmp;
if( nOldPos < nTmp )
{
@@ -720,12 +720,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const XubString aSnippet( rOldText, nOldPos, nTmp - nOldPos);
+ const OUString aSnippet(rOldText.copy(nOldPos, nTmp - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nTmp - nOldPos;
rDo.GetInf().SetIdx( 0 );
- rDo.GetInf().SetLen( aNewText.Len() );
+ rDo.GetInf().SetLen( aNewText.getLength() );
rDo.GetInf().SetText( aNewText );
}
else
@@ -748,7 +748,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
nOldPos = nTmp;
}
- while( nTmp < nPos && CH_BLANK != rOldText.GetChar( nTmp ) )
+ while( nTmp < nPos && CH_BLANK != rOldText[nTmp] )
++nTmp;
}
else
@@ -761,12 +761,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const XubString aSnippet( rOldText, nOldPos, nTmp - nOldPos);
+ const OUString aSnippet(rOldText.copy(nOldPos, nTmp - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nTmp - nOldPos;
rDo.GetInf().SetIdx( 0 );
- rDo.GetInf().SetLen( aNewText.Len() );
+ rDo.GetInf().SetLen( aNewText.getLength() );
rDo.GetInf().SetText( aNewText );
}
else
@@ -783,7 +783,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
{
for( xub_StrLen nI = nOldPos; nI < nPos; ++nI )
{
- if( CH_BLANK == rOldText.GetChar( nI ) )
+ if( CH_BLANK == rOldText[nI] )
aPartSize.Width() += nSpaceAdd;
}
}
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 63023a1..bd78bb5 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1080,15 +1080,15 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
{
SV_STAT( nGetTextSize );
long nOldKern = rInf.GetKern();
- const XubString &rOldTxt = rInf.GetText();
+ const OUString &rOldTxt = rInf.GetText();
rInf.SetKern( CheckKerning() );
if ( !IsCaseMap() )
aTxtSize = pLastFont->GetTextSize( rInf );
else
{
- String aTmp = CalcCaseMap( rInf.GetText() );
- const XubString &rOldStr = rInf.GetText();
- bool bCaseMapLengthDiffers(aTmp.Len() != rOldStr.Len());
+ OUString aTmp = CalcCaseMap( rInf.GetText() );
+ const OUString &rOldStr = rInf.GetText();
+ bool bCaseMapLengthDiffers(aTmp.getLength() != rOldStr.getLength());
if(bCaseMapLengthDiffers && rInf.GetLen())
{
@@ -1098,12 +1098,12 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
// a single snippet since its size may differ, too.
xub_StrLen nOldIdx(rInf.GetIdx());
xub_StrLen nOldLen(rInf.GetLen());
- const XubString aSnippet(rOldStr, nOldIdx, nOldLen);
- XubString aNewText(CalcCaseMap(aSnippet));
+ const OUString aSnippet(rOldStr.copy(nOldIdx, nOldLen));
+ OUString aNewText(CalcCaseMap(aSnippet));
rInf.SetText( aNewText );
rInf.SetIdx( 0 );
- rInf.SetLen( aNewText.Len() );
+ rInf.SetLen( aNewText.getLength() );
aTxtSize = pLastFont->GetTextSize( rInf );
@@ -1201,9 +1201,9 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
pLastFont->DrawText( rInf );
else
{
- const XubString &rOldStr = rInf.GetText();
- XubString aString( CalcCaseMap( rOldStr ) );
- bool bCaseMapLengthDiffers(aString.Len() != rOldStr.Len());
+ const OUString &rOldStr = rInf.GetText();
+ OUString aString( CalcCaseMap( rOldStr ) );
+ bool bCaseMapLengthDiffers(aString.getLength() != rOldStr.getLength());
if(bCaseMapLengthDiffers && rInf.GetLen())
{
@@ -1213,12 +1213,12 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
// a single snippet since its size may differ, too.
xub_StrLen nOldIdx(rInf.GetIdx());
xub_StrLen nOldLen(rInf.GetLen());
- const XubString aSnippet(rOldStr, nOldIdx, nOldLen);
- XubString aNewText = CalcCaseMap(aSnippet);
+ const OUString aSnippet(rOldStr.copy(nOldIdx, nOldLen));
+ OUString aNewText = CalcCaseMap(aSnippet);
rInf.SetText( aNewText );
rInf.SetIdx( 0 );
- rInf.SetLen( aNewText.Len() );
+ rInf.SetLen( aNewText.getLength() );
pLastFont->DrawText( rInf );
@@ -1237,10 +1237,9 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
if( pUnderFnt && nOldUnder != UNDERLINE_NONE )
{
-static sal_Char const sDoubleSpace[] = " ";
Size aFontSize = _GetTxtSize( rInf );
- const XubString &rOldStr = rInf.GetText();
- XubString aStr( sDoubleSpace, RTL_TEXTENCODING_MS_1252 );
+ const OUString &rOldStr = rInf.GetText();
+ OUString aStr(" ");
xub_StrLen nOldIdx = rInf.GetIdx();
xub_StrLen nOldLen = rInf.GetLen();
@@ -1248,8 +1247,8 @@ static sal_Char const sDoubleSpace[] = " ";
if( rInf.GetSpace() )
{
xub_StrLen nTmpEnd = nOldIdx + nOldLen;
- if( nTmpEnd > rOldStr.Len() )
- nTmpEnd = rOldStr.Len();
+ if( nTmpEnd > rOldStr.getLength() )
+ nTmpEnd = rOldStr.getLength();
const SwScriptInfo* pSI = rInf.GetScriptInfo();
@@ -1257,8 +1256,8 @@ static sal_Char const sDoubleSpace[] = " ";
( rInf.GetFont() && SW_CJK == rInf.GetFont()->GetActual() );
for( xub_StrLen nTmp = nOldIdx; nTmp < nTmpEnd; ++nTmp )
{
- if( CH_BLANK == rOldStr.GetChar( nTmp ) || bAsianFont ||
- ( nTmp + 1 < rOldStr.Len() && pSI &&
+ if( CH_BLANK == rOldStr[nTmp] || bAsianFont ||
+ ( nTmp + 1 < rOldStr.getLength() && pSI &&
i18n::ScriptType::ASIAN == pSI->ScriptType( nTmp + 1 ) ) )
++nSpace;
}
@@ -1350,9 +1349,8 @@ void SwSubFont::_DrawStretchText( SwDrawTextInfo &rInf )
if( pUnderFnt && nOldUnder != UNDERLINE_NONE )
{
-static sal_Char const sDoubleSpace[] = " ";
- const XubString &rOldStr = rInf.GetText();
- XubString aStr( sDoubleSpace, RTL_TEXTENCODING_MS_1252 );
+ const OUString &rOldStr = rInf.GetText();
+ OUString aStr(" ");
xub_StrLen nOldIdx = rInf.GetIdx();
xub_StrLen nOldLen = rInf.GetLen();
rInf.SetText( aStr );
@@ -1390,7 +1388,7 @@ xub_StrLen SwSubFont::_GetCrsrOfst( SwDrawTextInfo& rInf )
nCrsr = GetCapitalCrsrOfst( rInf );
else
{
- const XubString &rOldTxt = rInf.GetText();
+ const OUString &rOldTxt = rInf.GetText();
long nOldKern = rInf.GetKern();
rInf.SetKern( CheckKerning() );
SV_STAT( nGetTextSize );
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index dcb2b72..d7f4b48 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -952,13 +952,13 @@ sal_uInt16 SwTxtNode::Spell(SwSpellArgs* pArgs)
nBegin, nEnd );
while( !pArgs->xSpellAlt.is() && aScanner.NextWord() )
{
- const XubString& rWord = aScanner.GetWord();
+ const OUString& rWord = aScanner.GetWord();
// get next language for next word, consider language attributes
// within the word
LanguageType eActLang = aScanner.GetCurrentLanguage();
- if( rWord.Len() > 0 && LANGUAGE_NONE != eActLang )
+ if( rWord.getLength() > 0 && LANGUAGE_NONE != eActLang )
{
if (pArgs->xSpeller.is())
{
@@ -979,11 +979,11 @@ sal_uInt16 SwTxtNode::Spell(SwSpellArgs* pArgs)
// left and right in order to preserve those. Therefore
// count those "in words" in order to modify the
// selection accordingly.
- const sal_Unicode* pChar = rWord.GetBuffer();
+ const sal_Unicode* pChar = rWord.getStr();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
++nLeft;
- pChar = rWord.Len() ? rWord.GetBuffer() + rWord.Len() - 1 : 0;
+ pChar = rWord.getLength() ? rWord.getStr() + rWord.getLength() - 1 : 0;
xub_StrLen nRight = 0;
while (pChar && *pChar-- == CH_TXTATR_INWORD)
++nRight;
@@ -1282,7 +1282,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
while( aScanner.NextWord() )
{
- const XubString& rWord = aScanner.GetWord();
+ const OUString& rWord = aScanner.GetWord();
nBegin = aScanner.GetBegin();
xub_StrLen nLen = aScanner.GetLen();
@@ -1291,7 +1291,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
LanguageType eActLang = aScanner.GetCurrentLanguage();
sal_Bool bSpell = xSpell.is() ? xSpell->hasLanguage( eActLang ) : sal_False;
- if( bSpell && rWord.Len() > 0 )
+ if( bSpell && !rWord.isEmpty() )
{
// check for: bAlter => xHyphWord.is()
OSL_ENSURE(!bSpell || xSpell.is(), "NULL pointer");
@@ -1317,11 +1317,11 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
}
}
}
- else if( bAddAutoCmpl && rACW.GetMinWordLen() <= rWord.Len() )
+ else if( bAddAutoCmpl && rACW.GetMinWordLen() <= rWord.getLength() )
{
if ( bRedlineChg )
{
- XubString rNewWord( rWord );
+ OUString rNewWord( rWord );
rACW.InsertWord( rNewWord, *pDoc );
}
else
@@ -1519,11 +1519,11 @@ void SwTxtFrm::CollectAutoCmplWrds( SwCntntNode* pActNode, xub_StrLen nActPos )
nLen = aScanner.GetLen();
if( rACW.GetMinWordLen() <= nLen )
{
- const XubString& rWord = aScanner.GetWord();
+ const OUString& rWord = aScanner.GetWord();
if( nActPos < nBegin || ( nBegin + nLen ) < nActPos )
{
- if( rACW.GetMinWordLen() <= rWord.Len() )
+ if( rACW.GetMinWordLen() <= rWord.getLength() )
rACW.InsertWord( rWord, *pDoc );
bAnyWrd = true;
}
More information about the Libreoffice-commits
mailing list