[Libreoffice-commits] core.git: 15 commits - basctl/source basic/source chart2/source compilerplugins/clang cui/source dbaccess/source formula/source fpicker/source include/sfx2 include/svx sc/source sd/source sfx2/source slideshow/source svx/source sw/inc sw/source vcl/generic vcl/inc vcl/source vcl/unx xmloff/source
Stephan Bergmann
sbergman at redhat.com
Fri Jan 17 09:45:56 PST 2014
basctl/source/basicide/baside2.cxx | 2
basctl/source/basicide/baside2.hxx | 2
basctl/source/basicide/basides1.cxx | 4
basctl/source/basicide/basobj3.cxx | 2
basctl/source/inc/basidesh.hxx | 2
basic/source/basmgr/basmgr.cxx | 4
chart2/source/controller/dialogs/tp_DataSource.cxx | 14
compilerplugins/clang/implicitboolconversion.cxx | 480 ++++++++++
cui/source/options/optcolor.cxx | 2
dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx | 2
formula/source/ui/dlg/funcutl.cxx | 2
fpicker/source/office/iodlg.cxx | 2
include/sfx2/bindings.hxx | 4
include/sfx2/frmdescr.hxx | 2
include/sfx2/objface.hxx | 2
include/svx/dlgctl3d.hxx | 4
include/svx/obj3d.hxx | 8
include/svx/rulritem.hxx | 4
include/svx/scene3d.hxx | 2
include/svx/sdr/contact/displayinfo.hxx | 8
include/svx/sdr/contact/objectcontact.hxx | 2
include/svx/sdr/contact/viewcontactofsdrpage.hxx | 4
include/svx/sdr/contact/viewobjectcontact.hxx | 2
include/svx/sdr/overlay/overlaymanagerbuffered.hxx | 2
include/svx/sdr/overlay/overlayobject.hxx | 8
include/svx/sdr/overlay/overlayrollingrectangle.hxx | 4
include/svx/sdr/overlay/overlayselection.hxx | 2
include/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 6
include/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx | 4
include/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx | 6
include/svx/sdr/primitive2d/sdrtextprimitive2d.hxx | 20
include/svx/sdrpaintwindow.hxx | 4
include/svx/srchdlg.hxx | 2
include/svx/svddrgmt.hxx | 6
include/svx/svddrgv.hxx | 40
include/svx/svdedtv.hxx | 82 -
include/svx/svdedxv.hxx | 12
include/svx/svdmrkv.hxx | 24
include/svx/svdoedge.hxx | 22
include/svx/svdpage.hxx | 10
include/svx/svdpntv.hxx | 60 -
include/svx/svdsnpv.hxx | 42
include/svx/svdview.hxx | 38
sc/source/filter/excel/xehelper.cxx | 2
sc/source/filter/xcl97/xcl97rec.cxx | 2
sc/source/ui/docshell/arealink.cxx | 5
sc/source/ui/docshell/docsh5.cxx | 4
sc/source/ui/docshell/tablink.cxx | 3
sc/source/ui/drawfunc/drtxtob.cxx | 2
sc/source/ui/inc/validate.hxx | 2
sc/source/ui/miscdlgs/anyrefdg.cxx | 4
sc/source/ui/miscdlgs/optsolver.cxx | 4
sc/source/ui/namedlg/namedlg.cxx | 2
sc/source/ui/pagedlg/tphfedit.cxx | 2
sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 2
sc/source/ui/vba/vbarange.cxx | 6
sc/source/ui/vba/vbaworksheets.cxx | 2
sc/source/ui/view/formatsh.cxx | 66 -
sc/source/ui/view/tabvwsh4.cxx | 4
sd/source/core/drawdoc2.cxx | 2
sd/source/filter/html/pubdlg.cxx | 4
sd/source/filter/xml/sdtransform.cxx | 4
sd/source/ui/docshell/docshel2.cxx | 4
sd/source/ui/inc/ViewShell.hxx | 2
sd/source/ui/inc/unomodel.hxx | 4
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 2
sd/source/ui/table/TableDesignPane.cxx | 4
sd/source/ui/tools/EventMultiplexer.cxx | 2
sd/source/ui/view/drviewsb.cxx | 2
sd/source/ui/view/viewshel.cxx | 4
sfx2/source/control/bindings.cxx | 4
sfx2/source/control/templatelocalview.cxx | 2
sfx2/source/dialog/securitypage.cxx | 2
sfx2/source/doc/frmdescr.cxx | 2
sfx2/source/menu/virtmenu.cxx | 2
sfx2/source/notify/eventsupplier.cxx | 2
sfx2/source/view/frame.cxx | 2
sfx2/source/view/viewfrm2.cxx | 2
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx | 2
svx/source/dialog/rulritem.cxx | 4
svx/source/dialog/srchdlg.cxx | 2
svx/source/engine3d/float3d.cxx | 16
svx/source/items/SmartTagItem.cxx | 4
svx/source/items/clipfmtitem.cxx | 2
svx/source/items/customshapeitem.cxx | 2
svx/source/items/galleryitem.cxx | 4
svx/source/sdr/attribute/sdrformtextattribute.cxx | 4
svx/source/sdr/attribute/sdrtextattribute.cxx | 18
svx/source/sdr/contact/viewobjectcontact.cxx | 4
svx/source/sdr/properties/customshapeproperties.cxx | 6
svx/source/svdraw/svdattr.cxx | 2
svx/source/svdraw/svddrgm1.hxx | 2
svx/source/svdraw/svdglev.cxx | 2
svx/source/svdraw/svdibrow.cxx | 2
svx/source/table/cell.cxx | 2
svx/source/table/viewcontactoftableobj.cxx | 10
sw/inc/PostItMgr.hxx | 2
sw/inc/edglbldc.hxx | 4
sw/inc/fmtcol.hxx | 4
sw/inc/ndarr.hxx | 8
sw/inc/ndhints.hxx | 4
sw/inc/node.hxx | 4
sw/inc/redline.hxx | 22
sw/inc/swatrset.hxx | 4
sw/inc/swcrsr.hxx | 2
sw/inc/swevent.hxx | 4
sw/inc/txatbase.hxx | 2
sw/source/core/attr/format.cxx | 6
sw/source/core/attr/swatrset.cxx | 8
sw/source/core/crsr/crsrsh.cxx | 2
sw/source/core/crsr/findattr.cxx | 34
sw/source/core/crsr/findcoll.cxx | 4
sw/source/core/crsr/findtxt.cxx | 4
sw/source/core/crsr/swcrsr.cxx | 8
sw/source/core/doc/docbm.cxx | 4
sw/source/core/doc/doccomp.cxx | 8
sw/source/core/doc/docedt.cxx | 6
sw/source/core/doc/docfld.cxx | 2
sw/source/core/doc/docnum.cxx | 2
sw/source/core/doc/docredln.cxx | 32
sw/source/core/doc/doctxm.cxx | 12
sw/source/core/doc/fmtcol.cxx | 12
sw/source/core/doc/swserv.cxx | 4
sw/source/core/doc/tblrwcl.cxx | 20
sw/source/core/docnode/ndcopy.cxx | 2
sw/source/core/docnode/ndtbl.cxx | 2
sw/source/core/docnode/ndtbl1.cxx | 12
sw/source/core/docnode/node.cxx | 24
sw/source/core/docnode/nodes.cxx | 8
sw/source/core/docnode/swbaslnk.cxx | 2
sw/source/core/draw/drawdoc.cxx | 2
sw/source/core/fields/authfld.cxx | 4
sw/source/core/graphic/ndgrf.cxx | 2
sw/source/core/inc/UndoManager.hxx | 2
sw/source/core/inc/docfld.hxx | 2
sw/source/core/inc/mvsave.hxx | 4
sw/source/core/inc/rolbck.hxx | 2
sw/source/core/layout/frmtool.cxx | 2
sw/source/core/layout/tabfrm.cxx | 2
sw/source/core/table/swtable.cxx | 2
sw/source/core/txtnode/txatbase.cxx | 2
sw/source/core/txtnode/txtatr2.cxx | 2
sw/source/core/txtnode/txtedt.cxx | 12
sw/source/core/undo/rolbck.cxx | 2
sw/source/core/unocore/unoframe.cxx | 4
sw/source/filter/ascii/parasc.cxx | 4
sw/source/filter/basflt/iodetect.cxx | 8
sw/source/filter/basflt/shellio.cxx | 2
sw/source/filter/html/htmlatr.cxx | 2
sw/source/filter/html/swhtml.cxx | 4
sw/source/filter/html/swhtml.hxx | 2
sw/source/filter/inc/wrtswtbl.hxx | 16
sw/source/filter/ww8/rtfattributeoutput.cxx | 2
sw/source/filter/ww8/wrtw8sty.cxx | 2
sw/source/filter/ww8/wrtww8.cxx | 2
sw/source/filter/ww8/wrtww8.hxx | 2
sw/source/filter/ww8/ww8graf2.cxx | 2
sw/source/filter/ww8/ww8par2.cxx | 2
sw/source/filter/ww8/ww8par6.cxx | 10
sw/source/filter/ww8/ww8scan.cxx | 8
sw/source/filter/ww8/ww8scan.hxx | 306 +++---
sw/source/filter/ww8/ww8struc.hxx | 24
sw/source/ui/app/docst.cxx | 2
sw/source/ui/app/docstyle.cxx | 2
sw/source/ui/cctrl/actctrl.cxx | 2
sw/source/ui/dbui/dbinsdlg.cxx | 2
sw/source/ui/dbui/dbmgr.cxx | 2
sw/source/ui/dialog/uiregionsw.cxx | 4
sw/source/ui/dochdl/swdtflvr.cxx | 12
sw/source/ui/fldui/flddok.cxx | 2
sw/source/ui/inc/dbinsdlg.hxx | 4
sw/source/ui/inc/pview.hxx | 2
sw/source/ui/inc/swdtflvr.hxx | 8
sw/source/ui/inc/wrtsh.hxx | 6
sw/source/ui/misc/glossary.cxx | 2
sw/source/ui/shells/basesh.cxx | 6
sw/source/ui/shells/tabsh.cxx | 2
sw/source/ui/shells/textsh1.cxx | 2
sw/source/ui/uiview/pview.cxx | 15
sw/source/ui/utlui/attrdesc.cxx | 2
sw/source/ui/utlui/unotools.cxx | 2
sw/source/ui/wrtsh/select.cxx | 6
sw/source/ui/wrtsh/wrtsh1.cxx | 2
vcl/generic/fontmanager/fontconfig.cxx | 10
vcl/generic/glyphs/glyphcache.cxx | 2
vcl/inc/salframe.hxx | 2
vcl/inc/salwtype.hxx | 2
vcl/inc/sft.hxx | 4
vcl/inc/unx/i18n_ic.hxx | 4
vcl/inc/unx/i18n_im.hxx | 10
vcl/inc/unx/salunxtime.h | 10
vcl/inc/window.h | 4
vcl/source/control/ilstbox.cxx | 2
vcl/source/filter/graphicfilter.cxx | 4
vcl/source/fontsubset/cff.cxx | 32
vcl/source/fontsubset/gsub.cxx | 6
vcl/source/fontsubset/gsub.h | 2
vcl/source/fontsubset/sft.cxx | 12
vcl/source/fontsubset/ttcr.cxx | 2
vcl/source/gdi/graphictools.cxx | 2
vcl/source/gdi/impfont.cxx | 2
vcl/source/gdi/pdfwriter_impl.cxx | 26
vcl/source/gdi/sallayout.cxx | 4
vcl/source/helper/strhelper.cxx | 8
vcl/source/window/layout.cxx | 6
vcl/source/window/winproc.cxx | 152 +--
vcl/unx/generic/app/i18n_ic.cxx | 2
vcl/unx/generic/app/i18n_im.cxx | 16
vcl/unx/generic/app/sm.cxx | 2
vcl/unx/generic/gdi/salgdi.cxx | 2
vcl/unx/generic/gdi/salgdi2.cxx | 2
vcl/unx/generic/window/salframe.cxx | 2
vcl/unx/gtk/a11y/atkwrapper.cxx | 4
vcl/unx/gtk/app/gtkdata.cxx | 5
vcl/unx/gtk/window/gtksalframe.cxx | 4
vcl/unx/gtk/window/gtksalmenu.cxx | 8
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 2
xmloff/source/draw/animationimport.cxx | 5
218 files changed, 1416 insertions(+), 961 deletions(-)
New commits:
commit 00d0a50e3b34e4f93ea2cb201db6e08714b63913
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jan 17 18:38:47 2014 +0100
Window::Notify should return bool, redux
Change-Id: Ib41ed9ace428081e1948cf109de095ea9e7c45c2
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 0d4eb16..06ef245 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -441,7 +441,7 @@ long EditBox::PreNotify( NotifyEvent& rNEvt )
sal_uInt16 nKey=aKeyCode.GetCode();
if( (nKey==KEY_RETURN && !aKeyCode.IsShift()) || nKey==KEY_TAB )
{
- nResult=GetParent()->Notify(rNEvt);
+ nResult=long(GetParent()->Notify(rNEvt));
}
else
{
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 63aa4a4..c2ba531 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -1719,7 +1719,7 @@ bool SvtFileDialog::Notify( NotifyEvent& rNEvt )
{
sal_uInt16 nType = rNEvt.GetType();
- long nRet = false;
+ bool nRet = false;
if ( EVENT_KEYINPUT == nType && rNEvt.GetKeyEvent() )
{
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index d2ef606..7fab33c 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -185,7 +185,7 @@ public:
virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin);
virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin);
virtual sal_Bool RequestHelp( const HelpEvent& rEvt, ::sd::Window* pWin );
- virtual long Notify( NotifyEvent& rNEvt, ::sd::Window* pWin );
+ virtual bool Notify( NotifyEvent& rNEvt, ::sd::Window* pWin );
virtual bool HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin);
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index d0b7a54..6b19b91 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -623,10 +623,10 @@ void ViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
}
}
-long ViewShell::Notify(NotifyEvent& rNEvt, ::sd::Window* pWin)
+bool ViewShell::Notify(NotifyEvent& rNEvt, ::sd::Window* pWin)
{
// handle scroll commands when they arrived at child windows
- long nRet = sal_False;
+ bool nRet = false;
if( rNEvt.GetType() == EVENT_COMMAND )
{
// note: dynamic_cast is not possible as GetData() returns a void*
diff --git a/sw/source/ui/cctrl/actctrl.cxx b/sw/source/ui/cctrl/actctrl.cxx
index b67303e..df8f5ec 100644
--- a/sw/source/ui/cctrl/actctrl.cxx
+++ b/sw/source/ui/cctrl/actctrl.cxx
@@ -30,7 +30,7 @@ void NumEditAction::Action()
bool NumEditAction::Notify( NotifyEvent& rNEvt )
{
- long nHandled = false;
+ bool nHandled = false;
if ( rNEvt.GetType() == EVENT_KEYINPUT )
{
commit ed1878d27e4fd0a81d37c2f092f300a23748f59b
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jan 17 17:58:12 2014 +0100
-Werror,-Wunused-function
Change-Id: Ia6c6d6fe484789722987cea7d8b4b4bfc1c28953
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index f307c94..c45328b 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -176,20 +176,6 @@ Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
return xResult;
}
-void lcl_shiftControlY( Control & rControl, long nYOffset )
-{
- Point aPos( rControl.GetPosPixel());
- aPos.setY( aPos.getY() + nYOffset );
- rControl.SetPosPixel( aPos );
-}
-
-void lcl_increaseHeightOfControl( Control & rControl, long nYOffset )
-{
- Size aSize( rControl.GetSizePixel());
- aSize.setHeight( aSize.getHeight () + nYOffset );
- rControl.SetSizePixel( aSize );
-}
-
} // anonymous namespace
namespace chart
commit e908f69ec0de53b6e8bad9dc80ceb2004a68c09b
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jan 17 17:12:36 2014 +0100
Clang plugin that flags implicit conversions from bool
...as they are often enough errors, like a typo in brace placement in
if (foo == (FOO || bar == BAR) && baz)
or a literal true passed as an argument to a function that rather expects an
integer bit mask, etc. The plugin is smart enough to detect interaction with
logically boolean return/parameter types of C functions that use [unsigned] int
instead, and knows the relevant boolean typedefs (sal_Bool, gboolean, etc.).
Change-Id: I5f0e4344fe86589bec35a71018c7effdedf85e3e
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
new file mode 100644
index 0000000..98cb94c
--- /dev/null
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -0,0 +1,480 @@
+/* -*- 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/.
+ */
+
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <iterator>
+#include <stack>
+#include <string>
+#include <vector>
+
+#include "plugin.hxx"
+
+template<> struct std::iterator_traits<ExprIterator> {
+ typedef std::ptrdiff_t difference_type;
+ typedef Expr * value_type;
+ typedef Expr const ** pointer;
+ typedef Expr const & reference;
+ typedef std::random_access_iterator_tag iterator_category;
+};
+
+namespace {
+
+bool isBool(Expr const * expr) {
+ QualType t1 { expr->getType() };
+ if (t1->isBooleanType()) {
+ return true;
+ }
+// css::uno::Sequence<sal_Bool> s(1);s[0]=false /*unotools/source/config/configitem.cxx*/:
+if(t1->isSpecificBuiltinType(BuiltinType::UChar))return true;
+ TypedefType const * t2 = t1->getAs<TypedefType>();
+ if (t2 == nullptr) {
+ return false;
+ }
+ std::string name(t2->getDecl()->getNameAsString());
+ return name == "sal_Bool" || name == "FcBool" || name == "UBool"
+ || name == "dbus_bool_t" || name == "gboolean" || name == "hb_bool_t";
+}
+
+bool isBoolExpr(Expr const * expr) {
+ if (isBool(expr)) {
+ return true;
+ }
+ ConditionalOperator const * co = dyn_cast<ConditionalOperator>(expr);
+ if (co != nullptr) {
+ ImplicitCastExpr const * ic1 = dyn_cast<ImplicitCastExpr>(
+ co->getTrueExpr()->IgnoreParens());
+ ImplicitCastExpr const * ic2 = dyn_cast<ImplicitCastExpr>(
+ co->getFalseExpr()->IgnoreParens());
+ if (ic1 != nullptr && ic2 != nullptr
+ && ic1->getType()->isSpecificBuiltinType(BuiltinType::Int)
+ && isBoolExpr(ic1->getSubExpr()->IgnoreParens())
+ && ic2->getType()->isSpecificBuiltinType(BuiltinType::Int)
+ && isBoolExpr(ic2->getSubExpr()->IgnoreParens()))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+class ImplicitBoolConversion:
+ public RecursiveASTVisitor<ImplicitBoolConversion>, public loplugin::Plugin
+{
+public:
+ explicit ImplicitBoolConversion(CompilerInstance & compiler):
+ Plugin(compiler) {}
+
+ virtual void run() override
+ { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+
+ bool TraverseCallExpr(CallExpr * expr);
+
+ bool TraverseCStyleCastExpr(CStyleCastExpr * expr);
+
+ bool TraverseCXXStaticCastExpr(CXXStaticCastExpr * expr);
+
+ bool TraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr);
+
+ bool TraverseConditionalOperator(ConditionalOperator * expr);
+
+ bool TraverseBinLT(BinaryOperator * expr);
+
+ bool TraverseBinLE(BinaryOperator * expr);
+
+ bool TraverseBinGT(BinaryOperator * expr);
+
+ bool TraverseBinGE(BinaryOperator * expr);
+
+ bool TraverseBinEQ(BinaryOperator * expr);
+
+ bool TraverseBinNE(BinaryOperator * expr);
+
+ bool TraverseBinAssign(BinaryOperator * expr);
+
+ bool TraverseBinAndAssign(CompoundAssignOperator * expr);
+
+ bool TraverseBinOrAssign(CompoundAssignOperator * expr);
+
+ bool TraverseBinXorAssign(CompoundAssignOperator * expr);
+
+ bool TraverseReturnStmt(ReturnStmt * stmt);
+
+ bool TraverseFunctionDecl(FunctionDecl * decl);
+
+ bool VisitImplicitCastExpr(ImplicitCastExpr const * expr);
+
+private:
+ void reportWarning(ImplicitCastExpr const * expr);
+
+ std::stack<std::vector<ImplicitCastExpr const *>> nested;
+ bool externCIntFunctionDefinition = false;
+};
+
+bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseCallExpr(expr);
+ Decl const * d = expr->getCalleeDecl();
+ bool ext = false;
+ FunctionProtoType const * t = nullptr;
+ if (d != nullptr) {
+ FunctionDecl const * fd = dyn_cast<FunctionDecl>(d);
+ if (fd != nullptr && (fd->isExternC() || fd->isInExternCContext())) {
+ ext = true;
+ PointerType const * pt = dyn_cast<PointerType>(fd->getType());
+ t = (pt == nullptr ? fd->getType() : pt->getPointeeType())
+ ->getAs<FunctionProtoType>();
+ } else {
+ VarDecl const * vd = dyn_cast<VarDecl>(d);
+ if (vd != nullptr && (vd->isExternC() || vd->isInExternCContext()))
+ {
+ ext = true;
+ PointerType const * pt = dyn_cast<PointerType>(vd->getType());
+ t = (pt == nullptr ? vd->getType() : pt->getPointeeType())
+ ->getAs<FunctionProtoType>();
+ }
+ }
+ }
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (ext) {
+ auto j = std::find_if(
+ expr->arg_begin(), expr->arg_end(),
+ [&i](Expr * e) { return i == e->IgnoreParens(); });
+ if (j == expr->arg_end()) {
+ reportWarning(i);
+ } else {
+ std::ptrdiff_t n = j - expr->arg_begin();
+ assert(n >= 0);
+ assert(n < t->getNumArgs() || t->isVariadic());
+ if (n < t->getNumArgs()
+ && !(t->getArgType(n)->isSpecificBuiltinType(
+ BuiltinType::Int)
+ || (t->getArgType(n)->isSpecificBuiltinType(
+ BuiltinType::UInt))))
+ {
+ reportWarning(i);
+ }
+ }
+ } else {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseCStyleCastExpr(CStyleCastExpr * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseCStyleCastExpr(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (i != expr->getSubExpr()->IgnoreParens()) {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseCXXStaticCastExpr(CXXStaticCastExpr * expr)
+{
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseCXXStaticCastExpr(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (i != expr->getSubExpr()->IgnoreParens()) {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseCXXFunctionalCastExpr(
+ CXXFunctionalCastExpr * expr)
+{
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseCXXFunctionalCastExpr(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (i != expr->getSubExpr()->IgnoreParens()) {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseConditionalOperator(
+ ConditionalOperator * expr)
+{
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseConditionalOperator(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (!((i == expr->getTrueExpr()->IgnoreParens()
+ && isBoolExpr(expr->getFalseExpr()->IgnoreParenImpCasts()))
+ || (i == expr->getFalseExpr()->IgnoreParens()
+ && isBoolExpr(expr->getTrueExpr()->IgnoreParenImpCasts()))))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinLT(BinaryOperator * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinLT(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (!((i == expr->getLHS()->IgnoreParens()
+ && isBool(expr->getRHS()->IgnoreParenImpCasts()))
+ || (i == expr->getRHS()->IgnoreParens()
+ && isBool(expr->getLHS()->IgnoreParenImpCasts()))))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinLE(BinaryOperator * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinLE(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (!((i == expr->getLHS()->IgnoreParens()
+ && isBool(expr->getRHS()->IgnoreParenImpCasts()))
+ || (i == expr->getRHS()->IgnoreParens()
+ && isBool(expr->getLHS()->IgnoreParenImpCasts()))))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinGT(BinaryOperator * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinGT(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (!((i == expr->getLHS()->IgnoreParens()
+ && isBool(expr->getRHS()->IgnoreParenImpCasts()))
+ || (i == expr->getRHS()->IgnoreParens()
+ && isBool(expr->getLHS()->IgnoreParenImpCasts()))))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinGE(BinaryOperator * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinGE(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (!((i == expr->getLHS()->IgnoreParens()
+ && isBool(expr->getRHS()->IgnoreParenImpCasts()))
+ || (i == expr->getRHS()->IgnoreParens()
+ && isBool(expr->getLHS()->IgnoreParenImpCasts()))))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinEQ(BinaryOperator * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinEQ(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (!((i == expr->getLHS()->IgnoreParens()
+ && isBool(expr->getRHS()->IgnoreParenImpCasts()))
+ || (i == expr->getRHS()->IgnoreParens()
+ && isBool(expr->getLHS()->IgnoreParenImpCasts()))))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinNE(BinaryOperator * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinNE(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (!((i == expr->getLHS()->IgnoreParens()
+ && isBool(expr->getRHS()->IgnoreParenImpCasts()))
+ || (i == expr->getRHS()->IgnoreParens()
+ && isBool(expr->getLHS()->IgnoreParenImpCasts()))))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+// /usr/include/gtk-2.0/gtk/gtktogglebutton.h: struct _GtkToggleButton:
+// guint GSEAL (active) : 1;
+// even though <http://www.gtk.org/api/2.6/gtk/GtkToggleButton.html>:
+// "active" gboolean : Read / Write
+bool ImplicitBoolConversion::TraverseBinAssign(BinaryOperator * expr) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinAssign(expr);
+ bool ext = false;
+ MemberExpr const * me = dyn_cast<MemberExpr>(expr->getLHS());
+ if (me != nullptr) {
+ FieldDecl const * fd = dyn_cast<FieldDecl>(me->getMemberDecl());
+ if (fd != nullptr && fd->isBitField()
+ && fd->getBitWidthValue(compiler.getASTContext()) == 1)
+ {
+ TypedefType const * t = fd->getType()->getAs<TypedefType>();
+ ext = t != nullptr && t->getDecl()->getNameAsString() == "guint";
+ }
+ }
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (i != expr->getRHS()->IgnoreParens() || !ext) {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinAndAssign(CompoundAssignOperator * expr)
+{
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinAndAssign(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (i != expr->getRHS()->IgnoreParens()
+ || !isBool(expr->getLHS()->IgnoreParens()))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinOrAssign(CompoundAssignOperator * expr)
+{
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinOrAssign(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (i != expr->getRHS()->IgnoreParens()
+ || !isBool(expr->getLHS()->IgnoreParens()))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseBinXorAssign(CompoundAssignOperator * expr)
+{
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseBinXorAssign(expr);
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (i != expr->getRHS()->IgnoreParens()
+ || !isBool(expr->getLHS()->IgnoreParens()))
+ {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseReturnStmt(ReturnStmt * stmt) {
+ nested.push(std::vector<ImplicitCastExpr const *>());
+ bool ret = RecursiveASTVisitor::TraverseReturnStmt(stmt);
+ Expr const * expr = stmt->getRetValue();
+ if (expr != nullptr) {
+ ExprWithCleanups const * ec = dyn_cast<ExprWithCleanups>(expr);
+ if (ec != nullptr) {
+ expr = ec->getSubExpr();
+ }
+ expr = expr->IgnoreParens();
+ }
+ assert(!nested.empty());
+ for (auto i: nested.top()) {
+ if (i != expr || !externCIntFunctionDefinition) {
+ reportWarning(i);
+ }
+ }
+ nested.pop();
+ return ret;
+}
+
+bool ImplicitBoolConversion::TraverseFunctionDecl(FunctionDecl * decl) {
+ bool ext = (decl->isExternC() || decl->isInExternCContext())
+ && decl->isThisDeclarationADefinition()
+ && (decl->getResultType()->isSpecificBuiltinType(BuiltinType::Int)
+ || decl->getResultType()->isSpecificBuiltinType(BuiltinType::UInt));
+ if (ext) {
+ assert(!externCIntFunctionDefinition);
+ externCIntFunctionDefinition = true;
+ }
+ bool ret = RecursiveASTVisitor::TraverseFunctionDecl(decl);
+ if (ext) {
+ externCIntFunctionDefinition = false;
+ }
+ return ret;
+}
+
+bool ImplicitBoolConversion::VisitImplicitCastExpr(
+ ImplicitCastExpr const * expr)
+{
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ if (expr->getSubExprAsWritten()->getType()->isBooleanType()
+ && !isBool(expr))
+ {
+ if (nested.empty()) {
+ reportWarning(expr);
+ } else {
+ nested.top().push_back(expr);
+ }
+ }
+ return true;
+}
+
+void ImplicitBoolConversion::reportWarning(ImplicitCastExpr const * expr) {
+ report(
+ DiagnosticsEngine::Warning,
+ "implicit conversion (%0) from bool to %1", expr->getLocStart())
+ << expr->getCastKindName() << expr->getType() << expr->getSourceRange();
+}
+
+loplugin::Plugin::Registration<ImplicitBoolConversion> X(
+ "implicitboolconversion");
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c963d7e642c24f40c19fb9dc227db5da96728c12
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jan 17 17:11:45 2014 +0100
bool improvements
Change-Id: I9324483db587be43238af79c2148d724397a4622
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index a87a9ba..faf1014 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -146,7 +146,7 @@ class SwPostItMgr: public SfxListener
sw::sidebarwindows::SwSidebarWin* mpActivePostIt;
bool mbLayout;
long mbLayoutHeight;
- long mbLayouting;
+ bool mbLayouting;
bool mbReadOnly;
bool mbDeleteNote;
FieldShadowState mShadowState;
diff --git a/sw/inc/edglbldc.hxx b/sw/inc/edglbldc.hxx
index 16cf557..56ecb9b 100644
--- a/sw/inc/edglbldc.hxx
+++ b/sw/inc/edglbldc.hxx
@@ -54,9 +54,9 @@ public:
sal_uLong GetDocPos() const { return nDocPos; }
/// For sorting.
- inline int operator==( const SwGlblDocContent& rCmp ) const
+ inline bool operator==( const SwGlblDocContent& rCmp ) const
{ return GetDocPos() == rCmp.GetDocPos(); }
- inline int operator<( const SwGlblDocContent& rCmp ) const
+ inline bool operator<( const SwGlblDocContent& rCmp ) const
{ return GetDocPos() < rCmp.GetDocPos(); }
};
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 0db5c36..d973d39 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -209,8 +209,8 @@ private:
SwCollCondition & operator= (const SwCollCondition &);
public:
- int operator==( const SwCollCondition& rCmp ) const;
- int operator!=( const SwCollCondition& rCmp ) const
+ bool operator==( const SwCollCondition& rCmp ) const;
+ bool operator!=( const SwCollCondition& rCmp ) const
{ return ! (*this == rCmp); }
sal_uLong GetCondition() const { return nCondition; }
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 4e8501f..ad510d6 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -201,10 +201,10 @@ public:
/** Go to next content-node that is not protected or hidden
(Both set FALSE ==> GoNext/GoPrevious!!!). */
- SwCntntNode* GoNextSection( SwNodeIndex *, int bSkipHidden = sal_True,
- int bSkipProtect = sal_True ) const;
- SwCntntNode* GoPrevSection( SwNodeIndex *, int bSkipHidden = sal_True,
- int bSkipProtect = sal_True ) const;
+ SwCntntNode* GoNextSection( SwNodeIndex *, bool bSkipHidden = sal_True,
+ bool bSkipProtect = sal_True ) const;
+ SwCntntNode* GoPrevSection( SwNodeIndex *, bool bSkipHidden = sal_True,
+ bool bSkipProtect = sal_True ) const;
/** Create an empty section of Start- and EndNote. It may be called
only if a new section with content is to be created,
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx
index 4230c49..3800258 100644
--- a/sw/inc/ndhints.hxx
+++ b/sw/inc/ndhints.hxx
@@ -35,8 +35,8 @@ class SfxItemSet;
class SwDoc;
typedef enum {
- COPY = true,
- NEW = false,
+ COPY = int(true),
+ NEW = int(false),
} CopyOrNew_t;
/// if COPY then pTxtNode must be given!
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index ee28196..9dea063 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -394,8 +394,8 @@ public:
virtual SwCntntNode *JoinPrev();
/** Is it possible to join two nodes?
In pIdx the second position can be returned. */
- int CanJoinNext( SwNodeIndex* pIdx =0 ) const;
- int CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
+ bool CanJoinNext( SwNodeIndex* pIdx =0 ) const;
+ bool CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
void MakeStartIndex( SwIndex * pIdx ) { pIdx->Assign( this, 0 ); }
void MakeEndIndex( SwIndex * pIdx ) { pIdx->Assign( this, Len() ); }
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 73f3884..b946618 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -46,7 +46,7 @@ public:
virtual void Accept( SwPaM& rPam ) const;
virtual void Reject( SwPaM& rPam ) const;
- virtual int operator == ( const SwRedlineExtraData& ) const;
+ virtual bool operator == ( const SwRedlineExtraData& ) const;
};
class SwRedlineExtraData_FmtColl : public SwRedlineExtraData
@@ -60,7 +60,7 @@ public:
virtual ~SwRedlineExtraData_FmtColl();
virtual SwRedlineExtraData* CreateNew() const;
virtual void Reject( SwPaM& rPam ) const;
- virtual int operator == ( const SwRedlineExtraData& ) const;
+ virtual bool operator == ( const SwRedlineExtraData& ) const;
void SetItemSet( const SfxItemSet& rSet );
};
@@ -76,7 +76,7 @@ public:
virtual ~SwRedlineExtraData_Format();
virtual SwRedlineExtraData* CreateNew() const;
virtual void Reject( SwPaM& rPam ) const;
- virtual int operator == ( const SwRedlineExtraData& ) const;
+ virtual bool operator == ( const SwRedlineExtraData& ) const;
};
/*
@@ -98,7 +98,7 @@ public:
virtual ~SwRedlineExtraData_FormattingChanges();
virtual SwRedlineExtraData* CreateNew() const;
virtual void Reject( SwPaM& rPam ) const;
- virtual int operator == ( const SwRedlineExtraData& ) const;
+ virtual bool operator == ( const SwRedlineExtraData& ) const;
SfxItemSet* GetItemSet( ) const;
};
@@ -125,7 +125,7 @@ public:
~SwRedlineData();
- int operator==( const SwRedlineData& rCmp ) const
+ bool operator==( const SwRedlineData& rCmp ) const
{
return nAuthor == rCmp.nAuthor &&
eType == rCmp.eType &&
@@ -136,7 +136,7 @@ public:
( pExtraData && rCmp.pExtraData &&
*pExtraData == *rCmp.pExtraData ));
}
- int operator!=( const SwRedlineData& rCmp ) const
+ bool operator!=( const SwRedlineData& rCmp ) const
{ return !operator==( rCmp ); }
RedlineType_t GetType() const
@@ -152,7 +152,7 @@ public:
void SetAutoFmtFlag()
{ eType = (RedlineType_t)(eType | nsRedlineType_t::REDLINE_FORM_AUTOFMT); }
- int CanCombine( const SwRedlineData& rCmp ) const
+ bool CanCombine( const SwRedlineData& rCmp ) const
{
return nAuthor == rCmp.nAuthor &&
eType == rCmp.eType &&
@@ -230,9 +230,9 @@ public:
sal_Bool HasValidRange() const;
const SwRedlineData& GetRedlineData(sal_uInt16 nPos = 0) const;
- int operator==( const SwRedlineData& rCmp ) const
+ bool operator==( const SwRedlineData& rCmp ) const
{ return *pRedlineData == rCmp; }
- int operator!=( const SwRedlineData& rCmp ) const
+ bool operator!=( const SwRedlineData& rCmp ) const
{ return *pRedlineData != rCmp; }
void SetAutoFmtFlag() { pRedlineData->SetAutoFmtFlag(); }
@@ -295,8 +295,8 @@ public:
*/
OUString GetDescr(sal_uInt16 nPos = 0);
- int operator==( const SwRangeRedline& ) const;
- int operator<( const SwRangeRedline& ) const;
+ bool operator==( const SwRangeRedline& ) const;
+ bool operator<( const SwRangeRedline& ) const;
};
class SW_DLLPUBLIC SwRedlineHint : public SfxHint
diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx
index 4e20e75..72e77cf 100644
--- a/sw/inc/swatrset.hxx
+++ b/sw/inc/swatrset.hxx
@@ -178,8 +178,8 @@ public:
virtual SfxItemSet* Clone(sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0) const;
- int Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
- int Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
+ bool Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
+ bool Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
// Delete an item or a range.
sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew );
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index 69f476a..d2ce2bd 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -42,7 +42,7 @@ const int FIND_NO_RING = 2;
struct SwFindParas
{
virtual int Find( SwPaM*, SwMoveFn, const SwPaM*, sal_Bool ) = 0;
- virtual int IsReplaceMode() const = 0;
+ virtual bool IsReplaceMode() const = 0;
protected:
~SwFindParas() {}
diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx
index 8bb787e..e89c89e 100644
--- a/sw/inc/swevent.hxx
+++ b/sw/inc/swevent.hxx
@@ -99,13 +99,13 @@ struct SwCallMouseEvent
void Set( const SwFmtINetFmt* pINetAttr )
{ eType = EVENT_OBJECT_INETATTR; PTR.pINetAttr = pINetAttr; PTR.IMAP.pIMapObj = 0; }
- int operator==( const SwCallMouseEvent& rEvent ) const
+ bool operator==( const SwCallMouseEvent& rEvent ) const
{
return eType == rEvent.eType &&
PTR.pFmt == rEvent.PTR.pFmt &&
PTR.IMAP.pIMapObj == rEvent.PTR.IMAP.pIMapObj;
}
- int operator!=( const SwCallMouseEvent& rEvent ) const
+ bool operator!=( const SwCallMouseEvent& rEvent ) const
{ return !( *this == rEvent ); }
void Clear()
diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index fb274bc..603b456 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -108,7 +108,7 @@ public:
inline SfxPoolItem& GetAttr();
inline sal_uInt16 Which() const { return GetAttr().Which(); }
- virtual int operator==( const SwTxtAttr& ) const;
+ virtual bool operator==( const SwTxtAttr& ) const;
inline const SwFmtCharFmt &GetCharFmt() const;
inline const SwFmtAutoFmt &GetAutoFmt() const;
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index e5b019c..025faf7 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -196,7 +196,7 @@ void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
aNew( *aSet.GetPool(), aSet.GetRanges() );
- if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
+ if ( aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
{
// a few special treatments for attributes
aSet.SetModifyAtAttr( this );
@@ -412,7 +412,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
aNew( *aSet.GetPool(), aSet.GetRanges() );
- bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
+ bRet = aSet.Put_BC( rAttr, &aOld, &aNew );
if( bRet )
{
// some special treatments for attributes
@@ -459,7 +459,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
{
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
aNew( *aSet.GetPool(), aSet.GetRanges() );
- bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew );
+ bRet = aSet.Put_BC( rSet, &aOld, &aNew );
if( bRet )
{
// some special treatments for attributes
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index 4bce888..9f41cd6 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -111,23 +111,23 @@ SfxItemSet* SwAttrSet::Clone( sal_Bool bItems, SfxItemPool *pToPool ) const
: new SwAttrSet( *GetPool(), GetRanges() );
}
-int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
+bool SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
SwAttrSet* pOld, SwAttrSet* pNew )
{
pNewSet = pNew;
pOldSet = pOld;
- int nRet = 0 != SfxItemSet::Put( rAttr );
+ bool nRet = 0 != SfxItemSet::Put( rAttr );
pOldSet = pNewSet = 0;
return nRet;
}
-int SwAttrSet::Put_BC( const SfxItemSet& rSet,
+bool SwAttrSet::Put_BC( const SfxItemSet& rSet,
SwAttrSet* pOld, SwAttrSet* pNew )
{
pNewSet = pNew;
pOldSet = pOld;
- int nRet = 0 != SfxItemSet::Put( rSet );
+ bool nRet = 0 != SfxItemSet::Put( rSet );
pOldSet = pNewSet = 0;
return nRet;
}
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f6988d8..d4e1987 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2838,7 +2838,7 @@ sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText )
( !IsReadOnlyAvailable() &&
pSectNd->GetSection().IsProtectFlag() )) )
{
- typedef SwCntntNode* (SwNodes:: *FNGoSection)( SwNodeIndex *, int, int ) const;
+ typedef SwCntntNode* (SwNodes:: *FNGoSection)( SwNodeIndex *, bool, bool ) const;
FNGoSection funcGoSection = &SwNodes::GoNextSection;
bOk = sal_False;
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index 3393fb4..1aade53 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -49,7 +49,7 @@ using namespace ::com::sun::star::util;
typedef std::set<SwFmt*> SwpFmts;
// Special case for SvxFontItem: only compare the name
-int CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 )
+bool CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 )
{
switch( rItem1.Which() )
{
@@ -196,15 +196,15 @@ class SwAttrCheckArr
sal_Bool bForward;
public:
- SwAttrCheckArr( const SfxItemSet& rSet, int bForward, int bNoCollections );
+ SwAttrCheckArr( const SfxItemSet& rSet, bool bForward, bool bNoCollections );
~SwAttrCheckArr();
void SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam );
/// how many attributes are there in total?
sal_uInt16 Count() const { return aCmpSet.Count(); }
- int Found() const { return nFound == aCmpSet.Count(); }
- int CheckStack();
+ bool Found() const { return nFound == aCmpSet.Count(); }
+ bool CheckStack();
sal_Int32 Start() const;
sal_Int32 End() const;
@@ -212,17 +212,17 @@ public:
sal_Int32 GetNdStt() const { return nNdStt; }
sal_Int32 GetNdEnd() const { return nNdEnd; }
- int SetAttrFwd( const SwTxtAttr& rAttr );
- int SetAttrBwd( const SwTxtAttr& rAttr );
+ bool SetAttrFwd( const SwTxtAttr& rAttr );
+ bool SetAttrBwd( const SwTxtAttr& rAttr );
};
-SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, int bFwd,
- int bNoCollections )
+SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, bool bFwd,
+ bool bNoCollections )
: aCmpSet( *rSet.GetPool(), RES_CHRATR_BEGIN, RES_TXTATR_END-1 )
{
aCmpSet.Put( rSet, sal_False );
- bNoColls = 0 != bNoCollections;
- bForward = 0 != bFwd;
+ bNoColls = bNoCollections;
+ bForward = bFwd;
// determine area of Fnd/Stack array (Min/Max)
SfxItemIter aIter( aCmpSet );
@@ -324,7 +324,7 @@ lcl_IsAttributeIgnorable(sal_Int32 const nNdStart, sal_Int32 const nNdEnd,
: ((rTmp.nEnd <= nNdStart) || (nNdEnd <= rTmp.nStt)));
}
-int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr )
+bool SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr )
{
_SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() );
@@ -477,7 +477,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr )
return Found();
}
-int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr )
+bool SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr )
{
_SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() );
@@ -650,10 +650,10 @@ sal_Int32 SwAttrCheckArr::End() const
return nEnd;
}
-int SwAttrCheckArr::CheckStack()
+bool SwAttrCheckArr::CheckStack()
{
if( !nStackCnt )
- return sal_False;
+ return false;
sal_uInt16 n;
const sal_Int32 nSttPos = Start();
@@ -877,7 +877,7 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove,
{
// determine which attribute is searched:
const sal_uInt16 nWhich = rAttr.Which();
- int bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich);
+ bool bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich);
SwPaM* pPam = MakeRegion( fnMove, pRegion );
@@ -1065,7 +1065,7 @@ struct SwFindParaAttr : public SwFindParas
virtual ~SwFindParaAttr() { delete pSTxt; }
virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, sal_Bool bInReadOnly );
- virtual int IsReplaceMode() const;
+ virtual bool IsReplaceMode() const;
};
int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
@@ -1206,7 +1206,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
return FIND_FOUND;
}
-int SwFindParaAttr::IsReplaceMode() const
+bool SwFindParaAttr::IsReplaceMode() const
{
return ( pSearchOpt && !pSearchOpt->replaceString.isEmpty() ) ||
( pReplSet && pReplSet->Count() );
diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx
index 0c0f6ca..17ba627 100644
--- a/sw/source/core/crsr/findcoll.cxx
+++ b/sw/source/core/crsr/findcoll.cxx
@@ -37,7 +37,7 @@ struct SwFindParaFmtColl : public SwFindParas
{}
virtual ~SwFindParaFmtColl() {}
virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, sal_Bool bInReadOnly );
- virtual int IsReplaceMode() const;
+ virtual bool IsReplaceMode() const;
};
int SwFindParaFmtColl::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
@@ -57,7 +57,7 @@ int SwFindParaFmtColl::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion
return nRet;
}
-int SwFindParaFmtColl::IsReplaceMode() const
+bool SwFindParaFmtColl::IsReplaceMode() const
{
return 0 != pReplColl;
}
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 6cf17f9..b3ca32c 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -548,7 +548,7 @@ struct SwFindParaText : public SwFindParas
: rSearchOpt( rOpt ), rCursor( rCrsr ), aSTxt( rOpt ), bReplace( 0 != bRepl ), bSearchInNotes( bSearchNotes )
{}
virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, sal_Bool bInReadOnly );
- virtual int IsReplaceMode() const;
+ virtual bool IsReplaceMode() const;
virtual ~SwFindParaText();
};
@@ -601,7 +601,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
return bFnd ? FIND_FOUND : FIND_NOT_FOUND;
}
-int SwFindParaText::IsReplaceMode() const
+bool SwFindParaText::IsReplaceMode() const
{
return bReplace;
}
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index fd1609c9..b0f1ff0 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -64,7 +64,7 @@ struct _PercentHdl
: pDSh(pSh), bBack(false), bNodeIdx(false)
{
nActPos = nStt;
- if( 0 != ( bBack = (nStt > nEnd )) )
+ if( ( bBack = (nStt > nEnd )) )
{
sal_uLong n = nStt; nStt = nEnd; nEnd = n;
}
@@ -88,7 +88,7 @@ struct _PercentHdl
nEnd = rPam.GetPoint()->nNode.GetIndex();
}
nActPos = nStt;
- if( 0 != ( bBack = (nStt > nEnd )) )
+ if( ( bBack = (nStt > nEnd )) )
{
sal_uLong n = nStt; nStt = nEnd; nEnd = n;
}
@@ -588,7 +588,7 @@ GoNextCell:
++aCellStt;
if( 0 == ( pCNd = aCellStt.GetNode().GetCntntNode() ))
pCNd = aCellStt.GetNodes().GoNext( &aCellStt );
- if( 0 == ( bProt = pCNd->IsProtect() ))
+ if( !( bProt = pCNd->IsProtect() ))
break;
aCellStt.Assign( *pCNd->FindTableBoxStartNode()->EndOfSectionNode(), 1 );
} while( bProt );
@@ -637,7 +637,7 @@ GoPrevCell:
aCellStt.Assign( *pNd->StartOfSectionNode(), +1 );
if( 0 == ( pCNd = aCellStt.GetNode().GetCntntNode() ))
pCNd = pNd->GetNodes().GoNext( &aCellStt );
- if( 0 == ( bProt = pCNd->IsProtect() ))
+ if( !( bProt = pCNd->IsProtect() ))
break;
aCellStt.Assign( *pNd->FindTableBoxStartNode(), -1 );
} while( bProt );
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index e7d5cdc..faae1a5 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -719,7 +719,7 @@ namespace sw { namespace mark
vMarksToDelete.push_back(ppMark);
}
}
- else if ( bIsPosInRange ^ bIsOtherPosInRange )
+ else if ( bIsPosInRange != bIsOtherPosInRange )
{
// the bookmark is partitially in the range
// move position of that is in the range out of it
@@ -1190,7 +1190,7 @@ namespace
return nReturn;
}
- static inline int lcl_Greater( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx )
+ static inline bool lcl_Greater( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx )
{
return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent > pIdx->GetIndex() );
}
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 4900f69..24b2ae2 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -101,8 +101,7 @@ public:
bool GetChanged( size_t nLine ) const
{
return (pChangedFlag && nLine < aLines.size())
- ? pChangedFlag[ nLine ]
- : 0;
+ && pChangedFlag[ nLine ];
}
size_t GetLineCount() const { return aLines.size(); }
@@ -1725,9 +1724,8 @@ void SwCompareData::SetRedlinesToDoc( sal_Bool bUseDocInfo )
if( rSttEnd == rEndStt ||
(!rEndStt.nContent.GetIndex() &&
rEndStt.nNode.GetIndex() - 1 == rSttEnd.nNode.GetIndex() &&
- 0 != ( pCNd = rSttEnd.nNode.GetNode().GetCntntNode() )
- ? rSttEnd.nContent.GetIndex() == pCNd->Len()
- : 0 ))
+ 0 != ( pCNd = rSttEnd.nNode.GetNode().GetCntntNode() ) &&
+ rSttEnd.nContent.GetIndex() == pCNd->Len()))
{
if( pTmp->GetNext() == pInsRing )
{
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index fdba68e..2816f8d 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -260,7 +260,7 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
}
else if( ( rSttNdIdx.GetIndex() + nSttOff <= pAPos->nNode.GetIndex()
&& pAPos->nNode.GetIndex() <= rEndNdIdx.GetIndex() - nOff ) ||
- 0 != ( bInsPos = rInsPos == pAPos->nNode ))
+ ( bInsPos = rInsPos == pAPos->nNode ))
{
_SaveFly aSave( pAPos->nNode.GetIndex() - rSttNdIdx.GetIndex(),
@@ -863,7 +863,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
}
- int bUpdateFtn = sal_False;
+ bool bUpdateFtn = false;
SwFtnIdxs aTmpFntIdx;
SwUndoMove * pUndoMove = 0;
@@ -1079,7 +1079,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
// Or else delete the Frames for all footnotes that are being moved
// and have it rebuild after the Move (footnotes can change pages).
// Additionally we have to correct the FtnIdx array's sorting.
- int bUpdateFtn = sal_False;
+ bool bUpdateFtn = false;
SwFtnIdxs aTmpFntIdx;
SwUndoMove* pUndo = 0;
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index f8c6e83..190c1c9 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -2193,7 +2193,7 @@ void SwDocUpdtFld::InsDelFldInFldLst( bool bIns, const SwTxtFld& rFld )
}
}
-void SwDocUpdtFld::MakeFldList( SwDoc& rDoc, int bAll, int eGetMode )
+void SwDocUpdtFld::MakeFldList( SwDoc& rDoc, bool bAll, int eGetMode )
{
if( !pFldSortLst || bAll || !( eGetMode & nFldLstGetMode ) ||
rDoc.GetNodes().Count() != nNodes )
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 9e7c1ea..c694880 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1468,7 +1468,7 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext,
aIdx--, pLast = 0;
while( bNext ? ( aIdx.GetIndex() < aIdx.GetNodes().Count() - 1 )
- : aIdx.GetIndex() )
+ : aIdx.GetIndex() != 0 )
{
if( aIdx.GetNode().IsTxtNode() )
{
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index a994c03..6e3f940 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -2837,9 +2837,9 @@ void SwRedlineExtraData::Reject( SwPaM& ) const
{
}
-int SwRedlineExtraData::operator == ( const SwRedlineExtraData& ) const
+bool SwRedlineExtraData::operator == ( const SwRedlineExtraData& ) const
{
- return sal_False;
+ return false;
}
SwRedlineExtraData_FmtColl::SwRedlineExtraData_FmtColl( const OUString& rColl,
@@ -2898,7 +2898,7 @@ void SwRedlineExtraData_FmtColl::Reject( SwPaM& rPam ) const
}
}
-int SwRedlineExtraData_FmtColl::operator == ( const SwRedlineExtraData& r) const
+bool SwRedlineExtraData_FmtColl::operator == ( const SwRedlineExtraData& r) const
{
const SwRedlineExtraData_FmtColl& rCmp = (SwRedlineExtraData_FmtColl&)r;
return sFmtNm == rCmp.sFmtNm && nPoolId == rCmp.nPoolId &&
@@ -2962,17 +2962,17 @@ void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const
pDoc->SetRedlineMode_intern( eOld );
}
-int SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) const
+bool SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) const
{
- int nRet = 1;
+ bool nRet = true;
size_t nEnd = aWhichIds.size();
if( nEnd != ((SwRedlineExtraData_Format&)rCmp).aWhichIds.size() )
- nRet = 0;
+ nRet = false;
else
for( size_t n = 0; n < nEnd; ++n )
if( ((SwRedlineExtraData_Format&)rCmp).aWhichIds[n] != aWhichIds[n])
{
- nRet = 0;
+ nRet = false;
break;
}
return nRet;
@@ -3015,21 +3015,21 @@ void SwRedlineExtraData_FormattingChanges::Reject( SwPaM& rPam ) const
// ToDo: Add 'Reject' logic
}
-int SwRedlineExtraData_FormattingChanges::operator == ( const SwRedlineExtraData& rExtraData ) const
+bool SwRedlineExtraData_FormattingChanges::operator == ( const SwRedlineExtraData& rExtraData ) const
{
const SwRedlineExtraData_FormattingChanges& rCmp = (SwRedlineExtraData_FormattingChanges&)rExtraData;
if ( !pSet && !rCmp.pSet )
{
// Both SfxItemSet are null
- return 1;
+ return true;
}
else if ( pSet && rCmp.pSet && *pSet == *rCmp.pSet )
{
// Both SfxItemSet exist and are equal
- return 1;
+ return true;
}
- return 0;
+ return false;
}
SfxItemSet* SwRedlineExtraData_FormattingChanges::GetItemSet( ) const
@@ -3792,20 +3792,20 @@ const OUString& SwRangeRedline::GetComment( sal_uInt16 nPos ) const
return GetRedlineData(nPos).sComment;
}
-int SwRangeRedline::operator==( const SwRangeRedline& rCmp ) const
+bool SwRangeRedline::operator==( const SwRangeRedline& rCmp ) const
{
return this == &rCmp;
}
-int SwRangeRedline::operator<( const SwRangeRedline& rCmp ) const
+bool SwRangeRedline::operator<( const SwRangeRedline& rCmp ) const
{
- sal_Bool nResult = sal_False;
+ bool nResult = false;
if (*Start() < *rCmp.Start())
- nResult = sal_True;
+ nResult = true;
else if (*Start() == *rCmp.Start())
if (*End() < *rCmp.End())
- nResult = sal_True;
+ nResult = true;
return nResult;
}
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index de4ccae..8bd1965 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -193,20 +193,20 @@ public:
CompareNodeCntnt( sal_uLong nNd, sal_Int32 nCnt )
: nNode( nNd ), nCntnt( nCnt ) {}
- int operator==( const CompareNodeCntnt& rCmp ) const
+ bool operator==( const CompareNodeCntnt& rCmp ) const
{ return nNode == rCmp.nNode && nCntnt == rCmp.nCntnt; }
- int operator!=( const CompareNodeCntnt& rCmp ) const
+ bool operator!=( const CompareNodeCntnt& rCmp ) const
{ return nNode != rCmp.nNode || nCntnt != rCmp.nCntnt; }
- int operator< ( const CompareNodeCntnt& rCmp ) const
+ bool operator< ( const CompareNodeCntnt& rCmp ) const
{ return nNode < rCmp.nNode ||
( nNode == rCmp.nNode && nCntnt < rCmp.nCntnt); }
- int operator<=( const CompareNodeCntnt& rCmp ) const
+ bool operator<=( const CompareNodeCntnt& rCmp ) const
{ return nNode < rCmp.nNode ||
( nNode == rCmp.nNode && nCntnt <= rCmp.nCntnt); }
- int operator> ( const CompareNodeCntnt& rCmp ) const
+ bool operator> ( const CompareNodeCntnt& rCmp ) const
{ return nNode > rCmp.nNode ||
( nNode == rCmp.nNode && nCntnt > rCmp.nCntnt); }
- int operator>=( const CompareNodeCntnt& rCmp ) const
+ bool operator>=( const CompareNodeCntnt& rCmp ) const
{ return nNode > rCmp.nNode ||
( nNode == rCmp.nNode && nCntnt >= rCmp.nCntnt); }
};
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 80823a8..dddc0d5 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -203,13 +203,13 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
this, pNewNumRuleItem );
}
- int bContinue = sal_True;
+ bool bContinue = true;
// Check against the own attributes
if( pNewLRSpace && SFX_ITEM_SET == GetItemState( RES_LR_SPACE, sal_False,
(const SfxPoolItem**)&pOldLRSpace ))
{
- int bChg = sal_False;
+ bool bChg = false;
if( pOldLRSpace != pNewLRSpace ) // Avoid recursion (SetAttr!)
{
SvxLRSpaceItem aNew( *pOldLRSpace );
@@ -252,7 +252,7 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
pOldULSpace != pNewULSpace ) // Avoid recursion (SetAttr!)
{
SvxULSpaceItem aNew( *pOldULSpace );
- int bChg = sal_False;
+ bool bChg = false;
// We had a relative value -> recalculate
if( 100 != aNew.GetPropUpper() )
{
@@ -502,9 +502,9 @@ void SwCollCondition::RegisterToFormat( SwFmt& rFmt )
rFmt.Add( this );
}
-int SwCollCondition::operator==( const SwCollCondition& rCmp ) const
+bool SwCollCondition::operator==( const SwCollCondition& rCmp ) const
{
- int nRet = 0;
+ bool nRet = false;
if( nCondition == rCmp.nCondition )
{
if( USRFLD_EXPRESSION & nCondition )
@@ -528,7 +528,7 @@ int SwCollCondition::operator==( const SwCollCondition& rCmp ) const
}
else if( aSubCondition.nSubCondition ==
rCmp.aSubCondition.nSubCondition )
- nRet = 1;
+ nRet = true;
}
return nRet;
}
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index 74e6525..8f0c459 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -116,7 +116,7 @@ void SwServerObject::SendDataChanged( const SwPosition& rPos )
// Is someone interested in our changes?
if( HasDataLinks() )
{
- int bCall = sal_False;
+ bool bCall = false;
const SwStartNode* pNd = 0;
switch( eType )
{
@@ -152,7 +152,7 @@ void SwServerObject::SendDataChanged( const SwPaM& rRange )
// Is someone interested in our changes?
if( HasDataLinks() )
{
- int bCall = sal_False;
+ bool bCall = false;
const SwStartNode* pNd = 0;
const SwPosition* pStt = rRange.Start(), *pEnd = rRange.End();
switch( eType )
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index d9d8df7..f0a11b6 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -889,7 +889,7 @@ lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
--*pCurPos;
pAllDelBoxes->erase( pAllDelBoxes->begin() + nFndPos );
}
- } while( bNxt ? ( nLinePos + 1 < (sal_uInt16)rTblLns.size() ) : nLinePos );
+ } while( bNxt ? ( nLinePos + 1 < (sal_uInt16)rTblLns.size() ) : nLinePos != 0 );
return pFndBox;
}
@@ -1550,7 +1550,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara)
// If there are already Lines, then these need to go into a new Line and Box
nMvPos = pRMBox->GetTabLines().GetPos( pInsLine );
- if( pULPara->bUL ? nMvPos
+ if( pULPara->bUL ? nMvPos != 0
: nMvPos+1 < (sal_uInt16)pRMBox->GetTabLines().size() )
{
// Merge all Lines into a new Line and Box
@@ -2452,7 +2452,7 @@ static bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
return false;
// Collect all "ContentBoxes"
- if( ( 0 != ( bGreaterBox = TBLFIX_CHGABS != rParam.nMode && ( nDist + ( rParam.bLeft ? 0 : nWidth ) ) >= rParam.nSide)) ||
+ if( (bGreaterBox = TBLFIX_CHGABS != rParam.nMode && ( nDist + ( rParam.bLeft ? 0 : nWidth ) ) >= rParam.nSide) ||
( !rParam.bBigger && ( std::abs( nDist + (( rParam.nMode && rParam.bLeft ) ? 0 : nWidth ) - rParam.nSide ) < COLFUZZY ) ) )
{
rParam.bAnyBoxFnd = true;
@@ -2486,8 +2486,8 @@ static bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
rParam.nLowerDiff = nOldLower;
if( nLowerDiff ||
- ( 0 != ( bGreaterBox = !nOldLower && TBLFIX_CHGABS != rParam.nMode &&
- ( nDist + ( rParam.bLeft ? 0 : nWidth ) ) >= rParam.nSide)) ||
+ (bGreaterBox = !nOldLower && TBLFIX_CHGABS != rParam.nMode &&
+ ( nDist + ( rParam.bLeft ? 0 : nWidth ) ) >= rParam.nSide) ||
( std::abs( nDist + ( (rParam.nMode && rParam.bLeft) ? 0 : nWidth )
- rParam.nSide ) < COLFUZZY ))
{
@@ -3671,7 +3671,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
}
}
else if( bInsDel ||
- ( bLeft ? nDist : std::abs( rSz.GetWidth() - nDist ) > COLFUZZY ) )
+ ( bLeft ? nDist != 0 : std::abs( rSz.GetWidth() - nDist ) > COLFUZZY ) )
{
bRet = true;
if( bLeft && TBLFIX_CHGABS == eTblChgMode && !bInsDel )
@@ -3812,7 +3812,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
eTblChgMode = eOld;
return bRet;
}
- else if( bInsDel || ( bLeft ? nDist
+ else if( bInsDel || ( bLeft ? nDist != 0
: (rSz.GetWidth() - nDist) > COLFUZZY ))
{
if( bLeft && TBLFIX_CHGABS == eTblChgMode && !bInsDel )
@@ -3824,7 +3824,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
while( pLine->GetUpper() )
{
sal_uInt16 nPos = pLine->GetTabBoxes().GetPos( pBox );
- if( bLeft ? nPos : nPos + 1 != (sal_uInt16)pLine->GetTabBoxes().size() )
+ if( bLeft ? nPos != 0 : nPos + 1 != (sal_uInt16)pLine->GetTabBoxes().size() )
break;
pBox = pLine->GetUpper();
@@ -3846,7 +3846,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
// First, see if there is enough room at all
if( bInsDel )
{
- if( 0 != ( bRet = bLeft ? nDist != 0
+ if( ( bRet = bLeft ? nDist != 0
: ( rSz.GetWidth() - nDist ) > COLFUZZY ) &&
!aParam.bBigger )
{
@@ -4317,7 +4317,7 @@ bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
}
else
{
- if( bTop ? nEnd : nStt < nEnd )
+ if( bTop ? nEnd != 0 : nStt < nEnd )
{
if( bTop )
nStt = nEnd - 1;
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 3840c19..ab5056d 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -1604,7 +1604,7 @@ void SwDoc::CopyFlyInFlyImpl(
{
const SwFrmFmt *pFmtN = (*nIt).GetFmt();
const SwFmtChain &rChain = pFmtN->GetChain();
- int nCnt = 0 != rChain.GetPrev();
+ int nCnt = int(0 != rChain.GetPrev());
nCnt += rChain.GetNext() ? 1: 0;
size_t k = 0;
for (::std::set< _ZSortFly >::const_iterator kIt=aSet.begin() ; kIt != aSet.end(); ++kIt, ++k )
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 4933b9d..6892e2b 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4477,7 +4477,7 @@ sal_Bool SwDoc::UnProtectTbls( const SwPaM& rPam )
// Check whether the Table is within the Selection
if( bHasSel )
{
- int bFound = sal_False;
+ bool bFound = false;
SwPaM* pTmp = (SwPaM*)&rPam;
do {
const SwPosition *pStt = pTmp->Start(),
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index f8d797a..9a13586 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -986,7 +986,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
}
else if ((aSetBox.GetTop() && rBox.GetTop() &&
!(*aSetBox.GetTop() == *rBox.GetTop())) ||
- ((!aSetBox.GetTop()) ^ (!rBox.GetTop()))) // XOR expression is sal_True, if one of the two pointers is 0
+ ((!aSetBox.GetTop()) != (!rBox.GetTop()))) // XOR expression is sal_True, if one of the two pointers is 0
{
aSetBoxInfo.SetValid(VALID_TOP, sal_False );
aSetBox.SetLine( 0, BOX_LINE_TOP );
@@ -1005,7 +1005,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
}
else if ((aSetBox.GetLeft() && rBox.GetLeft() &&
!(*aSetBox.GetLeft() == *rBox.GetLeft())) ||
- ((!aSetBox.GetLeft()) ^ (!rBox.GetLeft())))
+ ((!aSetBox.GetLeft()) != (!rBox.GetLeft())))
{
aSetBoxInfo.SetValid(VALID_LEFT, sal_False );
aSetBox.SetLine( 0, BOX_LINE_LEFT );
@@ -1022,7 +1022,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
}
else if ((aSetBoxInfo.GetVert() && rBox.GetLeft() &&
!(*aSetBoxInfo.GetVert() == *rBox.GetLeft())) ||
- ((!aSetBoxInfo.GetVert()) ^ (!rBox.GetLeft())))
+ ((!aSetBoxInfo.GetVert()) != (!rBox.GetLeft())))
{ aSetBoxInfo.SetValid( VALID_VERT, sal_False );
aSetBoxInfo.SetLine( 0, BOXINFO_LINE_VERT );
}
@@ -1038,7 +1038,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
}
else if ((aSetBox.GetRight() && rBox.GetRight() &&
!(*aSetBox.GetRight() == *rBox.GetRight())) ||
- (!aSetBox.GetRight() ^ !rBox.GetRight()))
+ (!aSetBox.GetRight() != !rBox.GetRight()))
{ aSetBoxInfo.SetValid( VALID_RIGHT, sal_False );
aSetBox.SetLine( 0, BOX_LINE_RIGHT );
}
@@ -1055,7 +1055,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
}
else if ((aSetBox.GetBottom() && rBox.GetBottom() &&
!(*aSetBox.GetBottom() == *rBox.GetBottom())) ||
- (!aSetBox.GetBottom() ^ !rBox.GetBottom()))
+ (!aSetBox.GetBottom() != !rBox.GetBottom()))
{ aSetBoxInfo.SetValid( VALID_BOTTOM, sal_False );
aSetBox.SetLine( 0, BOX_LINE_BOTTOM );
}
@@ -1073,7 +1073,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
}
else if ((aSetBoxInfo.GetHori() && rBox.GetBottom() &&
!(*aSetBoxInfo.GetHori() == *rBox.GetBottom())) ||
- ((!aSetBoxInfo.GetHori()) ^ (!rBox.GetBottom())))
+ ((!aSetBoxInfo.GetHori()) != (!rBox.GetBottom())))
{
aSetBoxInfo.SetValid( VALID_HORI, sal_False );
aSetBoxInfo.SetLine( 0, BOXINFO_LINE_HORI );
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 4f8bebb..e2f6eca 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -167,7 +167,7 @@ int Put( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, const SwCntntNode& rNo
return nRet;
}
-int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+bool Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
const SwCntntNode& rNode, const SfxPoolItem& rAttr,
SwAttrSet* pOld, SwAttrSet* pNew )
{
@@ -178,7 +178,7 @@ int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
if( rNode.GetModifyAtAttr() )
aNewSet.SetModifyAtAttr( &rNode );
- const int nRet = aNewSet.Put_BC( rAttr, pOld, pNew );
+ const bool nRet = aNewSet.Put_BC( rAttr, pOld, pNew );
if ( nRet )
GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
@@ -186,7 +186,7 @@ int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
return nRet;
}
-int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+bool Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
const SwCntntNode& rNode, const SfxItemSet& rSet,
SwAttrSet* pOld, SwAttrSet* pNew )
{
@@ -205,7 +205,7 @@ int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
if( rNode.GetModifyAtAttr() )
aNewSet.SetModifyAtAttr( &rNode );
- const int nRet = aNewSet.Put_BC( rSet, pOld, pNew );
+ const bool nRet = aNewSet.Put_BC( rSet, pOld, pNew );
// #i76273# Robust
if ( pStyleNames )
@@ -1367,7 +1367,7 @@ sal_Bool SwCntntNode::SetAttr(const SfxPoolItem& rAttr )
{
SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
- if( 0 != ( bRet = 0 != AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew ) ))
+ if( 0 != ( bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew ) ))
{
SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
@@ -1443,7 +1443,7 @@ sal_Bool SwCntntNode::SetAttr( const SfxItemSet& rSet )
{
SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
- if( 0 != (bRet = 0 != AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew )) )
+ if( 0 != (bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew )) )
{
// Some special treatment for Attributes
SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
@@ -1654,7 +1654,7 @@ static bool lcl_CheckMaxLength(SwNode const& rPrev, SwNode const& rNext)
/// Can we join two Nodes?
/// We can return the 2nd position in pIdx.
-int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const
+bool SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const
{
const SwNodes& rNds = GetNodes();
SwNodeIndex aIdx( *this, 1 );
@@ -1666,19 +1666,19 @@ int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const
++aIdx;
if (rNds.Count()-1 == aIdx.GetIndex())
- return sal_False;
+ return false;
if (!lcl_CheckMaxLength(*this, *pNd))
{
return false;
}
if( pIdx )
*pIdx = aIdx;
- return sal_True;
+ return true;
}
/// Can we join two Nodes?
/// We can return the 2nd position in pIdx.
-int SwCntntNode::CanJoinPrev( SwNodeIndex* pIdx ) const
+bool SwCntntNode::CanJoinPrev( SwNodeIndex* pIdx ) const
{
SwNodeIndex aIdx( *this, -1 );
@@ -1689,14 +1689,14 @@ int SwCntntNode::CanJoinPrev( SwNodeIndex* pIdx ) const
aIdx--;
if (0 == aIdx.GetIndex())
- return sal_False;
+ return false;
if (!lcl_CheckMaxLength(*pNd, *this))
{
return false;
}
if( pIdx )
*pIdx = aIdx;
- return sal_True;
+ return true;
}
//FEATURE::CONDCOLL
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 064545f..2d6e9ad 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1317,7 +1317,7 @@ SwCntntNode* SwNodes::GoPrevious(SwNodeIndex *pIdx) const
return (SwCntntNode*)pNd;
}
-inline int TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, sal_uLong nStt, sal_uLong nEnd )
+inline bool TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, sal_uLong nStt, sal_uLong nEnd )
{
return nStt < nSttIdx && nEnd >= nSttIdx &&
nStt < nEndIdx && nEnd >= nEndIdx;
@@ -1924,7 +1924,7 @@ SwStartNode* SwNodes::MakeTextSection( const SwNodeIndex & rWhere,
//TODO: provide better documentation
/** go to next section that is not protected nor hidden
*
- * @note if bSkipHidden == false and bSkipProtect == false, use GoNext/GoPrevious
+ * @note if !bSkipHidden and !bSkipProtect, use GoNext/GoPrevious
*
* @param pIdx
* @param bSkipHidden
@@ -1935,7 +1935,7 @@ SwStartNode* SwNodes::MakeTextSection( const SwNodeIndex & rWhere,
* @see SwNodes::GoNextSection (TODO: seems to be C&P programming here)
*/
SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx,
- int bSkipHidden, int bSkipProtect ) const
+ bool bSkipHidden, bool bSkipProtect ) const
{
bool bFirst = true;
SwNodeIndex aTmp( *pIdx );
@@ -1989,7 +1989,7 @@ SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx,
///@see SwNodes::GoNextSection (TODO: seems to be C&P programming here)
SwCntntNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx,
- int bSkipHidden, int bSkipProtect ) const
+ bool bSkipHidden, bool bSkipProtect ) const
{
bool bFirst = true;
SwNodeIndex aTmp( *pIdx );
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index 32c9da9..b2cf46b 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -72,7 +72,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
if( pLast ) // Were we able to jump to the beginning?
{
do {
- if( (0 == n) ^ ( 0 != pLast->ISA( SwCntntFrm )) )
+ if( (0 == n) != ( 0 != pLast->ISA( SwCntntFrm )) )
pLast->ModifyNotification( &rItem, &rItem );
} while( 0 != ( pLast = ++aIter ));
}
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
index 3b554a7..695805d 100644
--- a/sw/source/core/draw/drawdoc.cxx
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -133,7 +133,7 @@ SwDrawDocument::~SwDrawDocument()
*/
SdrPage* SwDrawDocument::AllocPage(bool bMasterPage)
{
- SwDPage* pPage = new SwDPage(*this, 0 != bMasterPage);
+ SwDPage* pPage = new SwDPage(*this, bMasterPage);
pPage->SetName(OUString("Controls"));
return pPage;
}
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 5ca2829..c83a82f 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -445,7 +445,7 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
case FIELD_PROP_LOCALE:
{
com::sun::star::lang::Locale aLocale;
- if( 0 != (bRet = rAny >>= aLocale ))
+ if( (bRet = rAny >>= aLocale ))
SetLanguage( LanguageTag::convertToLanguageType( aLocale ));
}
break;
@@ -453,7 +453,7 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
case FIELD_PROP_PROP_SEQ:
{
Sequence<PropertyValues> aSeq;
- if( 0 != (bRet = rAny >>= aSeq) )
+ if( (bRet = rAny >>= aSeq) )
{
m_SortKeyArr.clear();
const PropertyValues* pValues = aSeq.getConstArray();
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 150177d..06a10da 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -513,7 +513,7 @@ StreamAndStorageNames lcl_GetStreamStorageNames( const OUString sUserData )
short SwGrfNode::SwapIn( sal_Bool bWaitForData )
{
if( bInSwapIn ) // not recursively!
- return !maGrfObj.IsSwappedOut();
+ return short(!maGrfObj.IsSwappedOut());
short nRet = 0;
bInSwapIn = sal_True;
diff --git a/sw/source/core/inc/UndoManager.hxx b/sw/source/core/inc/UndoManager.hxx
index 2ab0bf7..4514b28 100644
--- a/sw/source/core/inc/UndoManager.hxx
+++ b/sw/source/core/inc/UndoManager.hxx
@@ -98,7 +98,7 @@ private:
/// position in Undo-Array at which Doc was saved (and is not modified)
UndoStackMark m_UndoSaveMark;
- typedef enum { UNDO = true, REDO = false } UndoOrRedo_t;
+ typedef enum { UNDO = int(true), REDO = int(false) } UndoOrRedo_t;
bool impl_DoUndoRedo(UndoOrRedo_t const undoOrRedo);
// UGLY: should not be called
diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx
index cee98d6..fec0a0a 100644
--- a/sw/source/core/inc/docfld.hxx
+++ b/sw/source/core/inc/docfld.hxx
@@ -159,7 +159,7 @@ public:
const _SetGetExpFlds* GetSortLst() const { return pFldSortLst; }
- void MakeFldList( SwDoc& rDoc, int bAll, int eGetMode );
+ void MakeFldList( SwDoc& rDoc, bool bAll, int eGetMode );
void InsDelFldInFldLst( bool bIns, const SwTxtFld& rFld );
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index e79d83e..b86726a 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -164,8 +164,8 @@ public:
return *this;
}
- int operator==( const _ZSortFly& ) const { return sal_False; }
- int operator<( const _ZSortFly& rCmp ) const
+ bool operator==( const _ZSortFly& ) const { return false; }
+ bool operator<( const _ZSortFly& rCmp ) const
{ return nOrdNum < rCmp.nOrdNum; }
const SwFrmFmt* GetFmt() const { return pFmt; }
diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index 817f3d9..aebed31 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -179,7 +179,7 @@ class SwHistorySetTOXMark : public SwHistoryHint
public:
SwHistorySetTOXMark( SwTxtTOXMark* pTxtHt, sal_uLong nNode );
virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
- int IsEqual( const SwTOXMark& rCmp ) const;
+ bool IsEqual( const SwTOXMark& rCmp ) const;
};
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index d3aebaf..9dee8b8 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2043,7 +2043,7 @@ void SwBorderAttrs::_IsLine()
|* sind identisch.
|*
|*************************************************************************/
-inline int CmpLines( const editeng::SvxBorderLine *pL1, const editeng::SvxBorderLine *pL2 )
+inline bool CmpLines( const editeng::SvxBorderLine *pL1, const editeng::SvxBorderLine *pL2 )
{
return ( ((pL1 && pL2) && (*pL1 == *pL2)) || (!pL1 && !pL2) );
}
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 2db4406..9d3275e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4633,7 +4633,7 @@ bool SwRowFrm::IsRowSplitAllowed() const
const SwTableLineFmt* pFrmFmt = (SwTableLineFmt*)GetTabLine()->GetFrmFmt();
const SwFmtRowSplit& rLP = pFrmFmt->GetRowSplit();
- return 0 != rLP.GetValue();
+ return rLP.GetValue();
}
/*************************************************************************
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 57551f7..c03c3c6 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1623,7 +1623,7 @@ void SwTableLine::ChgFrmFmt( SwTableLineFmt *pNewFmt )
pRow == pTab->GetFirstNonHeadlineRow();
if ( bInFirstNonHeadlineRow ||
!pRow->GetNext() ||
- 0 != ( bInFollowFlowRow = pRow->IsInFollowFlowRow() ) ||
+ ( bInFollowFlowRow = pRow->IsInFollowFlowRow() ) ||
0 != pRow->IsInSplitTableRow() )
{
if ( bInFirstNonHeadlineRow || bInFollowFlowRow )
diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx
index 8a96fc2..7fe27c2 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -57,7 +57,7 @@ void SwTxtAttr::Destroy( SwTxtAttr * pToDestroy, SfxItemPool& rPool )
rPool.Remove( *pAttr );
}
-int SwTxtAttr::operator==( const SwTxtAttr& rAttr ) const
+bool SwTxtAttr::operator==( const SwTxtAttr& rAttr ) const
{
return GetAttr() == rAttr.GetAttr();
}
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index 0a2c4c5..9776533 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -306,7 +306,7 @@ SwTxtMeta::CreateTxtMeta(
sal_Int32 const i_nEnd,
bool const i_bIsCopy)
{
- if (COPY == i_bIsCopy)
+ if (i_bIsCopy)
{ // i_rAttr is already cloned, now call DoCopy to copy the sw::Meta
OSL_ENSURE(i_pTargetTxtNode, "cannot copy Meta without target node");
i_rAttr.DoCopy(i_rTargetDocManager, *i_pTargetTxtNode);
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index ec91200..6707eb5 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -150,7 +150,7 @@ lcl_MaskRedlinesAndHiddenText( const SwTxtNode& rNode, OUStringBuffer& rText,
sal_uInt16 nHiddenCharsMasked = 0;
const SwDoc& rDoc = *rNode.GetDoc();
- const bool bShowChg = 0 != IDocumentRedlineAccess::IsShowChanges( rDoc.GetRedlineMode() );
+ const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.GetRedlineMode() );
// If called from word count or from spell checking, deleted redlines
// should be masked:
@@ -2253,7 +2253,7 @@ void SwTxtNode::SetParaNumberOfCharsExcludingSpaces( sal_uLong nNew ) const
bool SwTxtNode::IsWordCountDirty() const
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bWordCountDirty : 0;
+ return m_pParaIdleData_Impl && m_pParaIdleData_Impl->bWordCountDirty;
}
void SwTxtNode::SetWrongDirty( bool bNew ) const
@@ -2266,7 +2266,7 @@ void SwTxtNode::SetWrongDirty( bool bNew ) const
bool SwTxtNode::IsWrongDirty() const
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bWrongDirty : 0;
+ return m_pParaIdleData_Impl && m_pParaIdleData_Impl->bWrongDirty;
}
void SwTxtNode::SetGrammarCheckDirty( bool bNew ) const
@@ -2279,7 +2279,7 @@ void SwTxtNode::SetGrammarCheckDirty( bool bNew ) const
bool SwTxtNode::IsGrammarCheckDirty() const
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bGrammarCheckDirty : 0;
+ return m_pParaIdleData_Impl && m_pParaIdleData_Impl->bGrammarCheckDirty;
}
void SwTxtNode::SetSmartTagDirty( bool bNew ) const
@@ -2292,7 +2292,7 @@ void SwTxtNode::SetSmartTagDirty( bool bNew ) const
bool SwTxtNode::IsSmartTagDirty() const
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bSmartTagDirty : 0;
+ return m_pParaIdleData_Impl && m_pParaIdleData_Impl->bSmartTagDirty;
}
void SwTxtNode::SetAutoCompleteWordDirty( bool bNew ) const
@@ -2305,7 +2305,7 @@ void SwTxtNode::SetAutoCompleteWordDirty( bool bNew ) const
bool SwTxtNode::IsAutoCompleteWordDirty() const
{
- return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->bAutoComplDirty : 0;
+ return m_pParaIdleData_Impl && m_pParaIdleData_Impl->bAutoComplDirty;
}
// <-- Paragraph statistics end
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index a4d535c..ed714565 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -381,7 +381,7 @@ void SwHistorySetTOXMark::SetInDoc( SwDoc* pDoc, bool )
nsSetAttrMode::SETATTR_NOTXTATRCHR );
}
-int SwHistorySetTOXMark::IsEqual( const SwTOXMark& rCmp ) const
+bool SwHistorySetTOXMark::IsEqual( const SwTOXMark& rCmp ) const
{
return m_TOXName == rCmp.GetTOXType()->GetTypeName() &&
m_eTOXTypes == rCmp.GetTOXType()->GetType() &&
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 6a27eff..eab4e48 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1281,7 +1281,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
}
}
}
- else if(0 != (bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
+ else if((bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
|| rPropertyName == UNO_NAME_CHAIN_PREV_NAME)
{
OUString sChainName;
@@ -1953,7 +1953,7 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
pFmt->SetFmtAttr(aSet);
}
}
- else if(0 != (bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
+ else if((bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
|| rPropertyName == UNO_NAME_CHAIN_PREV_NAME)
{
SwDoc* pDoc = pFmt->GetDoc();
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index 3f13b50..3204478 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -61,7 +61,7 @@ class SwASCIIParser
public:
SwASCIIParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
- int bReadNewDoc, const SwAsciiOptions& rOpts );
+ bool bReadNewDoc, const SwAsciiOptions& rOpts );
~SwASCIIParser();
sal_uLong CallParser();
@@ -88,7 +88,7 @@ sal_uLong AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OU
}
SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
- int bReadNewDoc, const SwAsciiOptions& rOpts)
+ bool bReadNewDoc, const SwAsciiOptions& rOpts)
: pDoc(pD), rInput(rIn), rOpt(rOpts), nFileSize(0), nScript(0)
, bNewDoc(bReadNewDoc)
{
diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx
index a71587e..0b95aab 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -65,7 +65,7 @@ OUString SwIoDetect::IsReader(const sal_Char* pHeader, sal_uLong nLen_) const
sal_Bool fComplexGet() { return static_cast< sal_Bool >((fFlagsGet() >> 2) & 1); }
};
- int bRet = sal_False;
+ bool bRet = false;
if ( sHTML == sName )
bRet = HTMLParser::IsHTMLFormat( pHeader, sal_True, RTL_TEXTENCODING_DONTKNOW );
else if ( FILTER_RTF == sName )
@@ -164,9 +164,9 @@ sal_Bool SwIoSystem::IsValidStgFilter(SotStorage& rStg, const SfxFilter& rFilter
/* Bug 62703 - und auch WinWord Docs ohne ClipBoardId! */
if (rFilter.GetUserData() == FILTER_WW8 || rFilter.GetUserData() == sWW6)
{
- bRet = !((rStg.IsContained( OUString("0Table")) ||
- rStg.IsContained( OUString("1Table"))) ^
- (rFilter.GetUserData() == FILTER_WW8));
+ bRet = (rStg.IsContained(OUString("0Table"))
+ || rStg.IsContained(OUString("1Table")))
+ == (rFilter.GetUserData() == FILTER_WW8);
if (bRet && !rFilter.IsAllowedAsTemplate())
{
SotStorageStreamRef xRef =
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 76f8fef..6291775 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -218,7 +218,7 @@ sal_uLong SwReader::Read( const Reader& rOptions )
else
pUndoPam->GetPoint()->nContent.Assign( 0, 0 );
- int bChkHeaderFooter = pNd->FindHeaderStartNode() ||
+ bool bChkHeaderFooter = pNd->FindHeaderStartNode() ||
pNd->FindFooterStartNode();
// Suche alle neuen Fly's und speicher sie als einzelne Undo
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index a933c06..bf65c4f 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -236,7 +236,7 @@ SwHTMLFmtInfo::SwHTMLFmtInfo( const SwFmt *pF, SwDoc *pDoc, SwDoc *pTemplate,
nRefPoolId );
OSL_ENSURE( nDeep ? !aToken.isEmpty() : aToken.isEmpty(),
"Hier stimmt doch was mit dem Token nicht!" );
- OSL_ENSURE( nDeep ? nRefPoolId : !nRefPoolId,
+ OSL_ENSURE( nDeep ? nRefPoolId != 0 : nRefPoolId == 0,
"Hier stimmt doch was mit der Vergleichs-Vorlage nicht!" );
sal_Bool bTxtColl = pFmt->Which() == RES_TXTFMTCOLL ||
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 0dd7fc0..434619d 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -232,10 +232,10 @@ sal_uLong HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam,
SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCrsr, SvStream& rIn,
const OUString& rPath,
const OUString& rBaseURL,
- int bReadNewDoc,
+ bool bReadNewDoc,
SfxMedium* pMed, sal_Bool bReadUTF8,
sal_Bool bNoHTMLComments )
- : SfxHTMLParser( rIn, static_cast< sal_Bool >(bReadNewDoc), pMed ),
+ : SfxHTMLParser( rIn, bReadNewDoc, pMed ),
SwClient( 0 ),
aPathToFile( rPath ),
sBaseURL( rBaseURL ),
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 0552155..6a2304d 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -900,7 +900,7 @@ public:
SwHTMLParser( SwDoc* pD, SwPaM & rCrsr, SvStream& rIn,
const OUString& rFileName,
const OUString& rBaseURL,
- int bReadNewDoc = sal_True,
+ bool bReadNewDoc = true,
SfxMedium* pMed = 0, sal_Bool bReadUTF8 = sal_False,
sal_Bool bIgnoreHTMLComments = sal_False );
diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx
index 6c25b8a..de63e3e 100644
--- a/sw/source/filter/inc/wrtswtbl.hxx
+++ b/sw/source/filter/inc/wrtswtbl.hxx
@@ -145,18 +145,18 @@ public:
long GetPos() const { return nPos; }
const SwWriteTableCells& GetCells() const { return aCells; }
- inline int operator==( const SwWriteTableRow& rRow ) const;
- inline int operator<( const SwWriteTableRow& rRow2 ) const;
+ inline bool operator==( const SwWriteTableRow& rRow ) const;
+ inline bool operator<( const SwWriteTableRow& rRow2 ) const;
};
-inline int SwWriteTableRow::operator==( const SwWriteTableRow& rRow ) const
+inline bool SwWriteTableRow::operator==( const SwWriteTableRow& rRow ) const
{
// etwas Unschaerfe zulassen
return (nPos >= rRow.nPos ? nPos - rRow.nPos : rRow.nPos - nPos ) <=
(mbUseLayoutHeights ? 0 : ROWFUZZY);
}
-inline int SwWriteTableRow::operator<( const SwWriteTableRow& rRow ) const
+inline bool SwWriteTableRow::operator<( const SwWriteTableRow& rRow ) const
{
// Da wir hier nur die Wahrheits-Grade 0 und 1 kennen, lassen wir lieber
// auch nicht zu, dass x==y und x<y gleichzeitig gilt ;-)
@@ -194,8 +194,8 @@ public:
void SetOutWidth( bool bSet ) { bOutWidth = bSet; }
- inline int operator==( const SwWriteTableCol& rCol ) const;
- inline int operator<( const SwWriteTableCol& rCol ) const;
+ inline bool operator==( const SwWriteTableCol& rCol ) const;
+ inline bool operator<( const SwWriteTableCol& rCol ) const;
void SetWidthOpt( sal_uInt32 nWidth, bool bRel )
{
@@ -205,14 +205,14 @@ public:
bool HasRelWidthOpt() const { return bRelWidthOpt; }
};
-inline int SwWriteTableCol::operator==( const SwWriteTableCol& rCol ) const
+inline bool SwWriteTableCol::operator==( const SwWriteTableCol& rCol ) const
{
// etwas Unschaerfe zulassen
return (nPos >= rCol.nPos ? nPos - rCol.nPos
: rCol.nPos - nPos ) <= COLFUZZY;
}
-inline int SwWriteTableCol::operator<( const SwWriteTableCol& rCol ) const
+inline bool SwWriteTableCol::operator<( const SwWriteTableCol& rCol ) const
{
// Da wir hier nur die Wahrheits-Grade 0 und 1 kennen, lassen wir lieber
// auch nicht zu, dass x==y und x<y gleichzeitig gilt ;-)
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index ba75e69..834c642 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -776,7 +776,7 @@ void RtfAttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pT
const SwFmtRowSplit& rSplittable = pLineFmt->GetRowSplit( );
// The rtf default is to allow a row to break
- if (rSplittable.GetValue() == 0)
+ if (!rSplittable.GetValue())
m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_TRKEEP);
}
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 1dc1217..b46ebe4 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1398,7 +1398,7 @@ void MSWordSections::CheckForFacinPg( WW8Export& rWrt ) const
}
}
-int MSWordSections::HasBorderItem( const SwFmt& rFmt )
+bool MSWordSections::HasBorderItem( const SwFmt& rFmt )
{
const SfxPoolItem* pItem;
return SFX_ITEM_SET == rFmt.GetItemState(RES_BOX, true, &pItem) &&
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 0280445..9ccd4d7 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -414,7 +414,7 @@ static void WriteDop( WW8Export& rWrt )
rDop.cParasFtnEdn = rDStat.nPara;
rDop.cLinesFtnEdn = rDStat.nPara;
- rDop.fDontUseHTMLAutoSpacing = (rWrt.pDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX) != 0);
+ rDop.fDontUseHTMLAutoSpacing = rWrt.pDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX);
rDop.fExpShRtn = !rWrt.pDoc->get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK); // #i56856#
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index ea56f32..df34b50 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -215,7 +215,7 @@ public:
sal_uInt8 nFlag );
/// Should we output borders?
- static int HasBorderItem( const SwFmt& rFmt );
+ static bool HasBorderItem( const SwFmt& rFmt );
};
class WW8_WrPlcSepx : public MSWordSections
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index 6c54dbc..18c290b 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -290,7 +290,7 @@ bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic,
if (nData > 0)
{
rpGraphic = new Graphic();
- if (0 == (bOk = SwWW8ImplReader::GetPictGrafFromStream(*rpGraphic, *pSt)))
+ if (!(bOk = SwWW8ImplReader::GetPictGrafFromStream(*rpGraphic, *pSt)))
DELETEZ(rpGraphic);
}
return bOk; // Grafik drin
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 0adb299..ff49237 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2237,7 +2237,7 @@ void WW8TabDesc::CalcDefaults()
pR->bLEmptyCol = pR->nCenter[0] - nMinLeft >= MINLAY;
pR->bREmptyCol = (nMaxRight - pR->nCenter[pR->nWwCols] - nRightMaxThickness) >= MINLAY;
- short nAddCols = pR->bLEmptyCol + pR->bREmptyCol;
+ short nAddCols = short(pR->bLEmptyCol) + short(pR->bREmptyCol);
sal_uInt16 i;
sal_uInt16 j = ( pR->bLEmptyCol ) ? 1 : 0;
for (i = 0; i < pR->nWwCols; ++i)
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index e2b7ea4..808148a 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -651,7 +651,7 @@ SwSectionFmt *wwSectionManager::InsertSection(
SfxItemSet aSet( mrReader.rDoc.GetAttrPool(), aFrmFmtSetRange );
- sal_uInt8 nRTLPgn = maSegments.empty() ? 0 : maSegments.back().IsBiDi();
+ bool nRTLPgn = !maSegments.empty() && maSegments.back().IsBiDi();
aSet.Put(SvxFrameDirectionItem(
nRTLPgn ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
@@ -898,7 +898,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
{
// sprmSFEvenlySpaced
aNewSection.maSep.fEvenlySpaced =
- ReadBSprm(pSep, (eVer <= ww::eWW7 ? 138 : 0x3005), 1) ? true : false;
+ sal_uInt8(ReadBSprm(pSep, (eVer <= ww::eWW7 ? 138 : 0x3005), 1) ? true : false);
const sal_uInt8 numrgda = SAL_N_ELEMENTS(aNewSection.maSep.rgdxaColumnWidthSpacing);
if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced)
@@ -1230,7 +1230,7 @@ static sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRC* brc, WW8PLCFx_Cp_FKP* pPa
pSprm[0], pSprm[1], pSprm[2], pSprm[3] ) )
{
for( int i = 0; i < 4; ++i )
- nBorder |= (_SetWW8_BRC( bVer67, brc[ i ], pSprm[ i ] ))<<i;
+ nBorder |= int(_SetWW8_BRC( bVer67, brc[ i ], pSprm[ i ] ))<<i;
}
}
}
@@ -1247,12 +1247,12 @@ static sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRC* brc, WW8PLCFx_Cp_FKP* pPa
if( pPap )
{
for( int i = 0; i < 5; ++i, ++pIds )
- nBorder |= (_SetWW8_BRC( bVer67, brc[ i ], pPap->HasSprm( *pIds )))<<i;
+ nBorder |= int(_SetWW8_BRC( bVer67, brc[ i ], pPap->HasSprm( *pIds )))<<i;
}
else if( pSty )
{
for( int i = 0; i < 5; ++i, ++pIds )
- nBorder |= (_SetWW8_BRC( bVer67, brc[ i ], pSty->HasParaSprm( *pIds )))<<i;
+ nBorder |= int(_SetWW8_BRC( bVer67, brc[ i ], pSty->HasParaSprm( *pIds )))<<i;
}
else {
OSL_ENSURE( pSty || pPap, "WW8PLCFx_Cp_FKP and WW8RStyle "
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 372e7b1..0a49f04 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3076,7 +3076,7 @@ WW8PLCFx_Cp_FKP::WW8PLCFx_Cp_FKP( SvStream* pSt, SvStream* pTblSt,
: WW8PLCFx_Fc_FKP(pSt, pTblSt, pDataSt, *rBase.pWw8Fib, ePl,
rBase.WW8Cp2Fc(0)), rSBase(rBase), nAttrStart(-1), nAttrEnd(-1),
bLineEnd(false),
- bComplex( (7 < rBase.pWw8Fib->nVersion) || (0 != rBase.pWw8Fib->fComplex) )
+ bComplex( (7 < rBase.pWw8Fib->nVersion) || rBase.pWw8Fib->fComplex )
{
ResetAttrStartEnd();
@@ -3384,7 +3384,7 @@ void WW8PLCFx_SEPX::SetIdx( sal_uLong nIdx )
bool WW8PLCFx_SEPX::SeekPos(WW8_CP nCpPos)
{
- return pPLCF ? pPLCF->SeekPos( nCpPos ) : 0;
+ return pPLCF && pPLCF->SeekPos( nCpPos );
}
WW8_CP WW8PLCFx_SEPX::Where()
@@ -7175,10 +7175,10 @@ void WW8DopTypography::ReadFromMem(sal_uInt8 *&pData)
void WW8DopTypography::WriteToMem(sal_uInt8 *&pData) const
{
- sal_uInt16 a16Bit = fKerningPunct;
+ sal_uInt16 a16Bit = sal_uInt16(fKerningPunct);
a16Bit |= (iJustification << 1) & 0x0006;
a16Bit |= (iLevelOfKinsoku << 3) & 0x0018;
- a16Bit |= (f2on1 << 5) & 0x0020;
+ a16Bit |= (int(f2on1) << 5) & 0x0020;
a16Bit |= (reserved1 << 6) & 0x03C0;
a16Bit |= (reserved2 << 10) & 0xFC00;
Set_UInt16(pData,a16Bit);
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index e20af3e..50d5e58 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -163,8 +163,8 @@ struct WW8FieldDesc
WW8_CP nLRes; ///< Laenge ( == 0, falls kein Ergebnis )
sal_uInt16 nId; ///< WW-Id fuer Felder
sal_uInt8 nOpt; ///< WW-Flags ( z.B.: vom User geaendert )
- sal_uInt8 bCodeNest:1; ///< Befehl rekursiv verwendet
- sal_uInt8 bResNest:1; ///< Befehl in Resultat eingefuegt
+ bool bCodeNest:1; ///< Befehl rekursiv verwendet
+ bool bResNest:1; ///< Befehl in Resultat eingefuegt
};
struct WW8PLCFxSave1
@@ -1047,15 +1047,15 @@ public:
sal_Int16 lid; // 0x6 language stamp---localized version;
WW8_PN pnNext; // 0x8
- sal_uInt16 fDot :1; // 0xa 0001
- sal_uInt16 fGlsy :1;
- sal_uInt16 fComplex :1; // 0004 when 1, file is in complex, fast-saved format.
- sal_uInt16 fHasPic :1; // 0008 file contains 1 or more pictures
+ bool fDot :1; // 0xa 0001
+ bool fGlsy :1;
+ bool fComplex :1; // 0004 when 1, file is in complex, fast-saved format.
+ bool fHasPic :1; // 0008 file contains 1 or more pictures
sal_uInt16 cQuickSaves :4; // 00F0 count of times file was quicksaved
- sal_uInt16 fEncrypted :1; //0100 1 if file is encrypted, 0 if not
- sal_uInt16 fWhichTblStm :1; //0200 When 0, this fib refers to the table stream
- sal_uInt16 fReadOnlyRecommended :1;
- sal_uInt16 fWriteReservation :1;
+ bool fEncrypted :1; //0100 1 if file is encrypted, 0 if not
+ bool fWhichTblStm :1; //0200 When 0, this fib refers to the table stream
+ bool fReadOnlyRecommended :1;
+ bool fWriteReservation :1;
// named "0Table", when 1, this fib refers to the
// table stream named "1Table". Normally, a file
// will have only one table stream, but under unusual
@@ -1063,22 +1063,22 @@ public:
// both names. In that case, this flag must be used
// to decide which table stream is valid.
- sal_uInt16 fExtChar :1; // 1000 =1, when using extended character set in file
- sal_uInt16 fFarEast :1; // 4000 =1, probably, when far-East language vaiants of Word is used to create a file #i90932#
+ bool fExtChar :1; // 1000 =1, when using extended character set in file
+ bool fFarEast :1; // 4000 =1, probably, when far-East language vaiants of Word is used to create a file #i90932#
- sal_uInt16 fObfuscated :1; // 8000=1. specifies whether the document is obfuscated using XOR obfuscation. otherwise this bit MUST be ignored.
+ bool fObfuscated :1; // 8000=1. specifies whether the document is obfuscated using XOR obfuscation. otherwise this bit MUST be ignored.
sal_uInt16 nFibBack; // 0xc
sal_uInt16 nHash; // 0xe file encrypted hash
sal_uInt16 nKey; // 0x10 file encrypted key
sal_uInt8 envr; // 0x12 environment in which file was created
// 0 created by Win Word / 1 created by Mac Word
- sal_uInt8 fMac :1; // 0x13 when 1, this file was last saved in the Mac environment
- sal_uInt8 fEmptySpecial :1;
- sal_uInt8 fLoadOverridePage :1;
- sal_uInt8 fFuturesavedUndo :1;
- sal_uInt8 fWord97Saved :1;
- sal_uInt8 fWord2000Saved :1;
+ bool fMac :1; // 0x13 when 1, this file was last saved in the Mac environment
+ bool fEmptySpecial :1;
+ bool fLoadOverridePage :1;
+ bool fFuturesavedUndo :1;
+ bool fWord97Saved :1;
+ bool fWord2000Saved :1;
sal_uInt8 :2;
sal_uInt16 chse; // 0x14 default extended character set id for text in document stream. (overidden by chp.chse)
@@ -1489,14 +1489,14 @@ public:
// Initialisier-Dummy:
sal_uInt8 nDataStart;
//-------------------------
- sal_uInt16 fFacingPages : 1; // 1 when facing pages should be printed
+ bool fFacingPages : 1; // 1 when facing pages should be printed
- sal_uInt16 fWidowControl : 1; //a: orig 97 docs say
+ bool fWidowControl : 1; //a: orig 97 docs say
// 1 when widow control is in effect. 0 when widow control disabled.
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list