[Libreoffice-commits] core.git: 21 commits - sw/inc sw/source

Matteo Casalin matteo.casalin at yahoo.com
Mon Mar 24 15:22:44 PDT 2014


 sw/inc/fesh.hxx                            |    4 -
 sw/inc/tabcol.hxx                          |   20 ++---
 sw/source/core/bastyp/tabcol.cxx           |   12 +--
 sw/source/core/docnode/ndtbl.cxx           |   10 +-
 sw/source/core/docnode/ndtbl1.cxx          |   28 +++----
 sw/source/core/frmedt/fetab.cxx            |   14 +--
 sw/source/core/table/swtable.cxx           |   65 ++++++++--------
 sw/source/core/uibase/inc/unotools.hxx     |    2 
 sw/source/core/uibase/table/swtablerep.cxx |    8 +-
 sw/source/core/uibase/table/tablemgr.cxx   |   30 +++----
 sw/source/core/uibase/uiview/viewtab.cxx   |   15 +--
 sw/source/core/uibase/utlui/unotools.cxx   |    2 
 sw/source/core/unocore/unotbl.cxx          |   16 ++--
 sw/source/ui/index/cnttab.cxx              |  115 +++++++++++++----------------
 sw/source/ui/index/swuiidxmrk.cxx          |  109 +++++++++++----------------
 sw/source/ui/misc/bookmark.cxx             |   12 +--
 sw/source/ui/misc/docfnote.cxx             |   11 +-
 sw/source/ui/misc/glosbib.cxx              |   50 ++++--------
 sw/source/ui/misc/glossary.cxx             |   10 +-
 sw/source/ui/misc/num.cxx                  |   36 ++++-----
 sw/source/ui/misc/outline.cxx              |  103 ++++++++++---------------
 sw/source/ui/misc/pggrid.cxx               |    3 
 sw/source/ui/misc/srtdlg.cxx               |   28 +++----
 sw/source/ui/table/tabledlg.cxx            |   59 ++++++--------
 sw/source/ui/table/tautofmt.cxx            |   16 +---
 sw/source/ui/utlui/swrenamexnameddlg.cxx   |   10 +-
 sw/source/ui/vba/vbatablehelper.cxx        |   28 +++----
 27 files changed, 368 insertions(+), 448 deletions(-)

New commits:
commit ee84eb9678c1743d3e7387359158e2509adeb87f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 23:07:35 2014 +0100

    Do not compare the same OUString twice
    
    Change-Id: Id915a41e3cc50720d36955da9aa2c7efa6c9034c

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 3433bef..658b004 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2448,8 +2448,9 @@ IMPL_LINK(SwTOXEntryTabPage, StyleSelectHdl, ListBox*, pBox)
 {
     OUString sEntry = pBox->GetSelectEntry();
     const sal_uInt16 nId = (sal_uInt16)(sal_IntPtr)pBox->GetEntryData(pBox->GetSelectEntryPos());
-    m_pEditStylePB->Enable(sEntry != sNoCharStyle);
-    if(sEntry == sNoCharStyle)
+    const bool bEqualsNoCharStyle = sEntry == sNoCharStyle;
+    m_pEditStylePB->Enable(!bEqualsNoCharStyle);
+    if (bEqualsNoCharStyle)
         sEntry = "";
     Control* pCtrl = m_pTokenWIN->GetActiveControl();
     OSL_ENSURE(pCtrl, "no active control?");
commit d6fea2034f25b68de46a2734b9d03d1b2ecd2622
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 22:37:47 2014 +0100

    OUString* to const OUString* as constructor argument
    
    Change-Id: I54e3b086c57b9b727ffdd5d3aa0c38c2c2ea2954

diff --git a/sw/source/core/uibase/inc/unotools.hxx b/sw/source/core/uibase/inc/unotools.hxx
index 0b85820..e821ec9 100644
--- a/sw/source/core/uibase/inc/unotools.hxx
+++ b/sw/source/core/uibase/inc/unotools.hxx
@@ -98,7 +98,7 @@ public:
     SwOneExampleFrame(Window& rWin,
                     sal_uInt32 nStyleFlags = EX_SHOW_ONLINE_LAYOUT,
                     const Link* pInitalizedLink = 0,
-                    OUString* pURL = 0);
+                    const OUString* pURL = 0);
     ~SwOneExampleFrame();
 
     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > &       GetControl()    {return _xControl; }
diff --git a/sw/source/core/uibase/utlui/unotools.cxx b/sw/source/core/uibase/utlui/unotools.cxx
index 6d9b90c..ac334a3 100644
--- a/sw/source/core/uibase/utlui/unotools.cxx
+++ b/sw/source/core/uibase/utlui/unotools.cxx
@@ -65,7 +65,7 @@ bool SwOneExampleFrame::bShowServiceNotAvailableMessage = true;
 SwOneExampleFrame::SwOneExampleFrame( Window& rWin,
                                         sal_uInt32 nFlags,
                                         const Link* pInitializedLink,
-                                        OUString* pURL ) :
+                                        const OUString* pURL ) :
     aTopWindow(&rWin, this),
     aMenuRes(SW_RES(RES_FRMEX_MENU)),
     pModuleView(SW_MOD()->GetView()),
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index f4166ae9e..3433bef 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -513,9 +513,8 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl )
             else
             {
                 Link aLink(LINK(this, SwMultiTOXTabDialog, CreateExample_Hdl));
-                OUString sTemp(sTemplate);
                 pExampleFrame = new SwOneExampleFrame(
-                        *m_pExampleContainerWIN, EX_SHOW_ONLINE_LAYOUT, &aLink, &sTemp);
+                        *m_pExampleContainerWIN, EX_SHOW_ONLINE_LAYOUT, &aLink, &sTemplate);
 
                 if(!pExampleFrame->IsServiceAvailable())
                 {
commit 6af1e845baa0ec63ce16f25868e5e3313bd647bb
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 22:08:32 2014 +0100

    sal_uInt16 to sal_(u)Int32 + some constifications
    
    Change-Id: I60a552f14c4c4735f702581be18231e658cb30e7

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index bd7ee96..f4166ae9e 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -207,12 +207,8 @@ public:
 
 sal_uInt16 CurTOXType::GetFlatIndex() const
 {
-    sal_uInt16 nRet = static_cast< sal_uInt16 >(eType);
-    if(eType == TOX_USER && nIndex)
-    {
-        nRet = static_cast< sal_uInt16 >(TOX_AUTHORITIES + nIndex);
-    }
-    return nRet;
+    return static_cast< sal_uInt16 >( (eType == TOX_USER && nIndex)
+        ? eType : TOX_AUTHORITIES + nIndex );
 }
 
 #define EDIT_MINWIDTH 15
@@ -243,7 +239,7 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet
     eCurrentTOXType.eType = TOX_CONTENT;
     eCurrentTOXType.nIndex = 0;
 
-    sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER);
+    const sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER);
     nTypeCount = nUserTypeCount + 6;
     pFormArr = new SwForm*[nTypeCount];
     pDescArr = new SwTOXDescription*[nTypeCount];
@@ -375,11 +371,10 @@ short SwMultiTOXTabDialog::Ok()
     SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
     SwTOXBase aNewDef(*rSh.GetDefaultTOXBase( eCurrentTOXType.eType, true ));
 
-    sal_uInt16 nIndex = static_cast< sal_uInt16 >(eCurrentTOXType.eType);
-    if(eCurrentTOXType.eType == TOX_USER && eCurrentTOXType.nIndex)
-    {
-        nIndex =  static_cast< sal_uInt16 >(TOX_AUTHORITIES + eCurrentTOXType.nIndex);
-    }
+    const sal_uInt16 nIndex = static_cast< sal_uInt16 >(
+        eCurrentTOXType.eType == TOX_USER && eCurrentTOXType.nIndex
+        ? eCurrentTOXType.eType
+        : TOX_AUTHORITIES + eCurrentTOXType.nIndex );
 
     if(pFormArr[nIndex])
     {
@@ -402,7 +397,7 @@ short SwMultiTOXTabDialog::Ok()
 
 SwForm* SwMultiTOXTabDialog::GetForm(CurTOXType eType)
 {
-    sal_uInt16 nIndex = eType.GetFlatIndex();
+    const sal_uInt16 nIndex = eType.GetFlatIndex();
     if(!pFormArr[nIndex])
         pFormArr[nIndex] = new SwForm(eType.eType);
     return pFormArr[nIndex];
@@ -410,7 +405,7 @@ SwForm* SwMultiTOXTabDialog::GetForm(CurTOXType eType)
 
 SwTOXDescription& SwMultiTOXTabDialog::GetTOXDescription(CurTOXType eType)
 {
-    sal_uInt16 nIndex = eType.GetFlatIndex();
+    const sal_uInt16 nIndex = eType.GetFlatIndex();
     if(!pDescArr[nIndex])
     {
         const SwTOXBase* pDef = rSh.GetDefaultTOXBase( eType.eType );
@@ -547,7 +542,8 @@ sal_Bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, const OUString& rName)
     if(pColl && ! pColl->IsAssignedToListLevelOfOutlineStyle())
         return sal_True;
 
-    sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
+    const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(
+        rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
     if(nId != USHRT_MAX &&
         ! rSh.GetTxtCollFromPool(nId)->IsAssignedToListLevelOfOutlineStyle())
         return sal_True;
@@ -701,7 +697,9 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent,
     for (sal_uInt16 i = 0; i < MAXLEVEL; ++i)
     {
         OUString sStyles(rStringArr[i]);
-        for(sal_uInt16 nToken = 0; nToken < comphelper::string::getTokenCount(sStyles, TOX_STYLE_DELIMITER); nToken++)
+        for(sal_Int32 nToken = 0;
+            nToken < comphelper::string::getTokenCount(sStyles, TOX_STYLE_DELIMITER);
+            ++nToken)
         {
             OUString sTmp(sStyles.getToken(nToken, TOX_STYLE_DELIMITER));
             SvTreeListEntry* pEntry = m_pHeaderTree->InsertEntry(sTmp);
@@ -870,7 +868,7 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrS
     sAddStyleContent = m_pAddStylesCB->GetText();
 
     ResStringArray& rNames = aFromNames.GetNames();
-    for(sal_uInt16 i = 0; i < rNames.Count(); i++)
+    for(sal_uInt32 i = 0; i < rNames.Count(); i++)
     {
         m_pFromObjCLB->InsertEntry(rNames.GetString(i));
         m_pFromObjCLB->SetEntryData( i, (void*)rNames.GetValue(i) );
@@ -919,12 +917,11 @@ SwTOXSelectTabPage::~SwTOXSelectTabPage()
 
 void SwTOXSelectTabPage::SetWrtShell(SwWrtShell& rSh)
 {
-    sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER);
+    const sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER);
     if(nUserTypeCount > 1)
     {
         //insert all new user indexes names after the standard user index
-        sal_Int32 nPos = m_pTypeLB->GetEntryPos((void*)(sal_uInt32)TO_USER);
-        nPos++;
+        sal_Int32 nPos = m_pTypeLB->GetEntryPos((void*)(sal_uInt32)TO_USER) + 1;
         for(sal_uInt16 nUser = 1; nUser < nUserTypeCount; nUser++)
         {
             nPos = m_pTypeLB->InsertEntry(rSh.GetTOXType(TOX_USER, nUser)->GetTypeName(), nPos);
@@ -1022,9 +1019,8 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
 
     //user + content
     sal_Bool bHasStyleNames = sal_False;
-    sal_uInt16 i;
 
-    for( i = 0; i < MAXLEVEL; i++)
+    for( sal_uInt16 i = 0; i < MAXLEVEL; i++)
         if(!rDesc.GetStyleNames(i).isEmpty())
         {
             bHasStyleNames = sal_True;
@@ -1052,7 +1048,7 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
     //index only
     else if(TOX_INDEX == aCurType.eType)
     {
-        sal_uInt16 nIndexOptions = rDesc.GetIndexOptions();
+        const sal_uInt16 nIndexOptions = rDesc.GetIndexOptions();
         m_pCollectSameCB->     Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_SAME_ENTRY) );
         m_pUseFFCB->           Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_FF) );
         m_pUseDashCB->         Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_DASH) );
@@ -1095,7 +1091,7 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
     }
     m_pAutoMarkPB->Enable(m_pFromFileCB->IsChecked());
 
-    for(i = 0; i < MAXLEVEL; i++)
+    for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
         aStyleArr[i] = rDesc.GetStyleNames(i);
 
     m_pLanguageLB->SelectLanguage(rDesc.GetLanguage());
@@ -1241,8 +1237,8 @@ void SwTOXSelectTabPage::Reset( const SfxItemSet& )
     m_pFromFileCB->Check( !sAutoMarkURL.isEmpty() );
 
     m_pCaptionSequenceLB->Clear();
-    sal_uInt16 i, nCount = rSh.GetFldTypeCount(RES_SETEXPFLD);
-    for (i = 0; i < nCount; i++)
+    const sal_uInt16 nCount = rSh.GetFldTypeCount(RES_SETEXPFLD);
+    for (sal_uInt16 i = 0; i < nCount; i++)
     {
         SwFieldType *pType = rSh.GetFldType( i, RES_SETEXPFLD );
         if( pType->Which() == RES_SETEXPFLD &&
@@ -1536,9 +1532,9 @@ void SwTOXEdit::RequestHelp( const HelpEvent& rHEvt )
 void SwTOXEdit::KeyInput( const KeyEvent& rKEvt )
 {
     const Selection& rSel = GetSelection();
-    sal_Int32 nTextLen = GetText().getLength();
+    const sal_Int32 nTextLen = GetText().getLength();
     if((rSel.A() == rSel.B() &&
-        !rSel.A()) || rSel.A() == (sal_uInt16)nTextLen )
+        !rSel.A()) || rSel.A() == nTextLen )
     {
         bool bCall = false;
         KeyCode aCode = rKEvt.GetKeyCode();
@@ -2004,7 +2000,7 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/)
                 else
                 {
                     m_pSortContentRB->Check();
-                    sal_uInt16 nKeyCount = pFType->GetSortKeyCount();
+                    const sal_uInt16 nKeyCount = pFType->GetSortKeyCount();
                     if(0 < nKeyCount)
                     {
                         const SwTOXSortKey* pKey = pFType->GetSortKey(0);
@@ -2276,9 +2272,9 @@ void SwTOXEntryTabPage::WriteBackLevel()
     if(m_pTokenWIN->IsValid())
     {
         OUString sNewToken = m_pTokenWIN->GetPattern();
-        sal_uInt16 nLastLevel = m_pTokenWIN->GetLastLevel();
+        const sal_uInt16 nLastLevel = m_pTokenWIN->GetLastLevel();
         if(nLastLevel != USHRT_MAX)
-            m_pCurrentForm->SetPattern(nLastLevel + 1, sNewToken );
+            m_pCurrentForm->SetPattern(nLastLevel + 1, sNewToken);
     }
 }
 
@@ -2289,7 +2285,8 @@ IMPL_LINK(SwTOXEntryTabPage, LevelHdl, SvTreeListBox*, pBox)
     bInLevelHdl = true;
     WriteBackLevel();
 
-    sal_uInt16 nLevel = static_cast< sal_uInt16 >(pBox->GetModel()->GetAbsPos(pBox->FirstSelected()));
+    const sal_uInt16 nLevel = static_cast< sal_uInt16 >(
+        pBox->GetModel()->GetAbsPos(pBox->FirstSelected()));
     m_pTokenWIN->SetForm(*m_pCurrentForm, nLevel);
     if(TOX_AUTHORITIES == m_pCurrentForm->GetTOXType())
     {
@@ -2370,9 +2367,8 @@ IMPL_LINK(SwTOXEntryTabPage, TokenSelectedHdl, SwFormToken*, pToken)
     if(pToken->eTokenType == TOKEN_ENTRY_NO)
     {
         m_pEntryOutlineLevelNF->SetValue(pToken->nOutlineLevel);
-        sal_uInt16 nFormat = 0;
-        if( pToken->nChapterFormat == CF_NUM_NOPREPST_TITLE )
-            nFormat = 1;
+        const sal_uInt16 nFormat =
+            pToken->nChapterFormat == CF_NUM_NOPREPST_TITLE ? 1 : 0;
         m_pNumberFormatLB->SelectEntryPos(nFormat);
     }
 
@@ -2452,7 +2448,7 @@ IMPL_LINK(SwTOXEntryTabPage, TokenSelectedHdl, SwFormToken*, pToken)
 IMPL_LINK(SwTOXEntryTabPage, StyleSelectHdl, ListBox*, pBox)
 {
     OUString sEntry = pBox->GetSelectEntry();
-    sal_uInt16 nId = (sal_uInt16)(sal_IntPtr)pBox->GetEntryData(pBox->GetSelectEntryPos());
+    const sal_uInt16 nId = (sal_uInt16)(sal_IntPtr)pBox->GetEntryData(pBox->GetSelectEntryPos());
     m_pEditStylePB->Enable(sEntry != sNoCharStyle);
     if(sEntry == sNoCharStyle)
         sEntry = "";
@@ -2619,14 +2615,14 @@ SwTokenWindow::SwTokenWindow(Window* pParent)
     m_pCtrlParentWin->set_height_request(Edit::GetMinimumEditSize().Height());
     get(m_pRightScrollWin, "right");
 
-    for (sal_uInt16 i = 0; i < TOKEN_END; ++i)
+    for (sal_uInt32 i = 0; i < TOKEN_END; ++i)
     {
-        sal_uInt16 nTextId = STR_BUTTON_TEXT_START + i;
+        sal_uInt32 nTextId = STR_BUTTON_TEXT_START + i;
         if( STR_TOKEN_ENTRY_TEXT == nTextId )
             nTextId = STR_TOKEN_ENTRY;
         aButtonTexts[i] = SW_RESSTR(nTextId);
 
-        sal_uInt16 nHelpId = STR_BUTTON_HELP_TEXT_START + i;
+        sal_uInt32 nHelpId = STR_BUTTON_HELP_TEXT_START + i;
         if(STR_TOKEN_HELP_ENTRY_TEXT == nHelpId)
             nHelpId = STR_TOKEN_HELP_ENTRY;
         aButtonHelpTexts[i] = SW_RESSTR(nHelpId);
@@ -3009,9 +3005,8 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken&
         aSel.Justify();
 
         OUString sEditText = ((SwTOXEdit*)pActiveCtrl)->GetText();
-        OUString sLeft = sEditText.copy( 0, static_cast< sal_uInt16 >(aSel.A()) );
-        OUString sRight = sEditText.copy( static_cast< sal_uInt16 >(aSel.B()),
-                                        static_cast< sal_uInt16 >(sEditText.getLength() - aSel.B()));
+        OUString sLeft = sEditText.copy( 0, aSel.A() );
+        OUString sRight = sEditText.copy( aSel.B(), sEditText.getLength() - aSel.B());
 
         ((SwTOXEdit*)pActiveCtrl)->SetText(sLeft);
         ((SwTOXEdit*)pActiveCtrl)->AdjustSize();
@@ -3477,10 +3472,10 @@ IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton*, pBtn )
 
         if (!isNext)
         {
-            sal_Int32 nLen = static_cast<SwTOXEdit*>(pCtrlFocus)->GetText().getLength();
+            const sal_Int32 nLen = static_cast<SwTOXEdit*>(pCtrlFocus)->GetText().getLength();
 
-            aSel.A() = (sal_uInt16)nLen;
-            aSel.B() = (sal_uInt16)nLen;
+            aSel.A() = nLen;
+            aSel.B() = nLen;
         }
 
         static_cast<SwTOXEdit*>(pCtrlFocus)->SetSelection(aSel);
@@ -3608,7 +3603,7 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
 
     // not hyperlink for user directories
 
-    sal_uInt16 i, nSize = m_pCurrentForm->GetFormMax();
+    const sal_uInt16 nSize = m_pCurrentForm->GetFormMax();
 
     // display form pattern without title
 
@@ -3623,7 +3618,7 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
     }
     m_pLevelLB->InsertEntry(aStr);
 
-    for( i=1; i < nSize; ++i )
+    for( sal_uInt16 i=1; i < nSize; ++i )
     {
         if( TOX_INDEX == m_pCurrentForm->GetTOXType() &&
             FORM_ALPHA_DELIMITTER == i )
@@ -3651,12 +3646,12 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
     SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell();
     const sal_uInt16 nSz = rSh.GetTxtFmtCollCount();
 
-    for( i = 0; i < nSz; ++i )
+    for( sal_uInt16 i = 0; i < nSz; ++i )
         if( !(pColl = &rSh.GetTxtFmtColl( i ))->IsDefault() )
             m_pParaLayLB->InsertEntry( pColl->GetName() );
 
     // query pool collections and set them for the directory
-    for( i = 0; i < m_pCurrentForm->GetFormMax(); ++i )
+    for( sal_uInt16 i = 0; i < m_pCurrentForm->GetFormMax(); ++i )
     {
         aStr = m_pCurrentForm->GetTemplate( i );
         if( !aStr.isEmpty() &&
@@ -3910,7 +3905,7 @@ bool SwEntryBrowseBox::SeekRow( long nRow )
 OUString SwEntryBrowseBox::GetCellText(long nRow, sal_uInt16 nColumn) const
 {
     const OUString* pRet = &aEmptyOUStr;
-    if(static_cast<sal_uInt16>( aEntryArr.size() ) > nRow)
+    if (aEntryArr.size() > static_cast<size_t>(nRow))
     {
         const AutoMarkEntry* pEntry = &aEntryArr[ nRow ];
         switch(nColumn)
@@ -3943,8 +3938,8 @@ void SwEntryBrowseBox::PaintCell(OutputDevice& rDev,
 bool SwEntryBrowseBox::SaveModified()
 {
     SetModified();
-    sal_uInt16 nRow = static_cast< sal_uInt16 >(GetCurRow());
-    sal_uInt16 nCol = GetCurColumnId();
+    const size_t nRow = GetCurRow();
+    const sal_uInt16 nCol = GetCurColumnId();
 
     OUString sNew;
     sal_Bool bVal = sal_False;
@@ -4057,17 +4052,17 @@ void SwEntryBrowseBox::ReadEntries(SvStream& rInStr)
 void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr)
 {
     //check if the current controller is modified
-    sal_uInt16 nCol = GetCurColumnId();
+    const sal_uInt16 nCol = GetCurColumnId();
     ::svt::CellController* pController;
     if(nCol < ITEM_CASE)
         pController = xController;
     else
         pController = xCheckController;
     if(pController ->IsModified())
-        GoToColumnId(nCol < ITEM_CASE ? ++nCol : --nCol );
+        GoToColumnId(nCol + (nCol < ITEM_CASE ? 1 : -1 ));
 
     rtl_TextEncoding  eTEnc = osl_getThreadTextEncoding();
-    for(sal_uInt16 i = 0; i < aEntryArr.size(); i++)
+    for(size_t i = 0; i < aEntryArr.size(); i++)
     {
         AutoMarkEntry* pEntry = &aEntryArr[i];
         if(!pEntry->sComment.isEmpty())
@@ -4100,7 +4095,7 @@ bool SwEntryBrowseBox::IsModified()const
         return true;
 
     //check if the current controller is modified
-    sal_uInt16 nCol = GetCurColumnId();
+    const sal_uInt16 nCol = GetCurColumnId();
     ::svt::CellController* pController;
     if(nCol < ITEM_CASE)
         pController = xController;
commit 5131a9d086148c8a0d14a8b7c74e6c5ce46267e6
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 01:35:16 2014 +0100

    Remove temporary OUString by bailing out early
    
    Change-Id: I58e63b11c684d686e0e0830bb4e0e3b7fc9bbc32

diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index f14438b..8617752 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1565,30 +1565,28 @@ SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl()
 
 OUString  SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const
 {
-    OUString sRet;
     if( AUTH_FIELD_AUTHORITY_TYPE == eField )
     {
         OSL_ENSURE(pTypeListBox, "No ListBox");
-        sRet = OUString::number(pTypeListBox->GetSelectEntryPos());
+        return OUString::number(pTypeListBox->GetSelectEntryPos());
     }
-    else if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
+
+    if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
     {
         OSL_ENSURE(pIdentifierBox, "No ComboBox");
-        sRet = pIdentifierBox->GetText();
+        return pIdentifierBox->GetText();
     }
-    else
+
+    for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
     {
-        for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
+        const TextInfo aCurInfo = aTextInfoArr[nIndex];
+        if(aCurInfo.nToxField == eField)
         {
-            const TextInfo aCurInfo = aTextInfoArr[nIndex];
-            if(aCurInfo.nToxField == eField)
-            {
-                sRet = pEdits[nIndex]->GetText();
-                break;
-            }
+            return pEdits[nIndex]->GetText();
         }
     }
-    return sRet;
+
+    return OUString();
 }
 
 IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, ComboBox*, pBox)
commit 1e7e296eaea378b63f15c1c2dad0744681986630
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 01:32:32 2014 +0100

    Remove temporary OUStrings
    
    Change-Id: I328eb08b719b5fdd51e1ca7c5c6fa3546ac90adb

diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index d6c72a3..f14438b 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -464,10 +464,8 @@ void SwIndexMarkPane::InsertMark()
         case POS_INDEX:     // keyword index mark
         {
             UpdateKeyBoxes();
-            OUString  aPrim(m_pKey1DCB->GetText());
-            OUString  aSec(m_pKey2DCB->GetText());
-            aDesc.SetPrimKey(aPrim);
-            aDesc.SetSecKey(aSec);
+            aDesc.SetPrimKey(m_pKey1DCB->GetText());
+            aDesc.SetSecKey(m_pKey2DCB->GetText());
             aDesc.SetMainEntry(m_pMainEntryCB->IsChecked());
             aDesc.SetPhoneticReadingOfAltStr(m_pPhoneticED0->GetText());
             aDesc.SetPhoneticReadingOfPrimKey(m_pPhoneticED1->GetText());
@@ -476,11 +474,10 @@ void SwIndexMarkPane::InsertMark()
         break;
         default:            // Userdefined index mark
         {
-            OUString aName(m_pTypeDCB->GetSelectEntry());
-            aDesc.SetTOUName(aName);
+            aDesc.SetTOUName(m_pTypeDCB->GetSelectEntry());
         }
     }
-    if (OUString(aOrgStr) != m_pEntryED->GetText())
+    if (aOrgStr != m_pEntryED->GetText())
         aDesc.SetAltStr(m_pEntryED->GetText());
     sal_Bool bApplyAll = m_pApplyToAllCB->IsChecked();
     sal_Bool bWordOnly = m_pSearchCaseWordOnlyCB->IsChecked();
@@ -1161,32 +1158,28 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, CloseHdl)
 
 static OUString lcl_FindColumnEntry(const beans::PropertyValue* pFields, sal_Int32 nLen, const OUString& rColumnTitle)
 {
-    OUString sRet;
-    OUString uColumnTitle = rColumnTitle;
     for(sal_Int32 i = 0; i < nLen; i++)
     {
-        OUString uTmp;
-        if(pFields[i].Name == uColumnTitle &&
-            (pFields[i].Value >>= uTmp))
+        OUString sRet;
+        if(pFields[i].Name == rColumnTitle &&
+            (pFields[i].Value >>= sRet))
         {
-            sRet = uTmp;
-            break;
+            return sRet;
         }
     }
-    return sRet;
+    return OUString();
 }
 
 IMPL_LINK( SwAuthorMarkPane, CompEntryHdl, ListBox*, pBox)
 {
-    OUString sEntry(pBox->GetSelectEntry());
+    const OUString sEntry(pBox->GetSelectEntry());
     if(bIsFromComponent)
     {
         if(xBibAccess.is() && !sEntry.isEmpty())
         {
-            OUString uEntry(sEntry);
-            if(xBibAccess->hasByName(uEntry))
+            if(xBibAccess->hasByName(sEntry))
             {
-                uno::Any aEntry(xBibAccess->getByName(uEntry));
+                uno::Any aEntry(xBibAccess->getByName(sEntry));
                 uno::Sequence<beans::PropertyValue> aFieldProps;
                 if(aEntry >>= aFieldProps)
                 {
@@ -1252,8 +1245,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl)
         OUString sFields;
         for(int i = 0; i < AUTH_FIELD_END; i++)
         {
-            sFields += m_sFields[i];
-            sFields += OUString(TOX_STYLE_DELIMITER);
+            sFields += m_sFields[i] + OUString(TOX_STYLE_DELIMITER);
         }
         if(bNewEntry)
         {
commit 56de142fffd0ff0d6090b6b67fc2846a5206da97
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 01:18:43 2014 +0100

    sal_uInt16 to sal_Int32/int and remove some temporaries
    
    Change-Id: I2ab4bb2f57c95d2d4b1029fd6e324ebbe0ff7148

diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 5641d4a..d6c72a3 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -194,8 +194,7 @@ void SwIndexMarkPane::InitControls()
 
     // user index
     sal_uInt16 nCount = pSh->GetTOXTypeCount(TOX_USER);
-    sal_uInt16 i;
-    for( i = 0; i < nCount; ++i )
+    for( sal_uInt16 i = 0; i < nCount; ++i )
         m_pTypeDCB->InsertEntry( pSh->GetTOXType(TOX_USER, i)->GetTypeName() );
 
     // read keywords primary
@@ -265,8 +264,7 @@ void SwIndexMarkPane::InitControls()
     }
     else
     {   // display current selection (first element) ????
-        sal_uInt16 nCnt = pSh->GetCrsrCnt();
-        if (nCnt < 2)
+        if (pSh->GetCrsrCnt() < 2)
         {
             bSelected = !pSh->HasSelection();
             aOrgStr = pSh->GetView().GetSelectionTextParam(true, false);
@@ -326,9 +324,8 @@ void    SwIndexMarkPane::UpdateLanguageDependenciesForPhoneticReading()
     }
     else //if dialog is opened to create a new mark
     {
-        sal_uInt16 nScriptType = pSh->GetScriptType();
         sal_uInt16 nWhich;
-        switch(nScriptType)
+        switch(pSh->GetScriptType())
         {
             case SCRIPTTYPE_ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break;
             case SCRIPTTYPE_COMPLEX:nWhich = RES_CHRATR_CTL_LANGUAGE; break;
@@ -357,8 +354,7 @@ void    SwIndexMarkPane::Activate()
     // display current selection (first element) ????
     if(bNewMark)
     {
-        sal_uInt16 nCnt = pSh->GetCrsrCnt();
-        if (nCnt < 2)
+        if (pSh->GetCrsrCnt() < 2)
         {
             bSelected = !pSh->HasSelection();
             aOrgStr = pSh->GetView().GetSelectionTextParam(true, false);
@@ -461,7 +457,7 @@ void SwIndexMarkPane::InsertMark()
 
     SwTOXMarkDescription aDesc(eType);
 
-    sal_uInt16 nLevel = (sal_uInt16)m_pLevelNF->Denormalize(m_pLevelNF->GetValue());
+    const int nLevel = m_pLevelNF->Denormalize(m_pLevelNF->GetValue());
     switch(nPos)
     {
         case POS_CONTENT : break;
@@ -1167,7 +1163,7 @@ static OUString lcl_FindColumnEntry(const beans::PropertyValue* pFields, sal_Int
 {
     OUString sRet;
     OUString uColumnTitle = rColumnTitle;
-    for(sal_uInt16 i = 0; i < nLen; i++)
+    for(sal_Int32 i = 0; i < nLen; i++)
     {
         OUString uTmp;
         if(pFields[i].Name == uColumnTitle &&
@@ -1195,7 +1191,7 @@ IMPL_LINK( SwAuthorMarkPane, CompEntryHdl, ListBox*, pBox)
                 if(aEntry >>= aFieldProps)
                 {
                     const beans::PropertyValue* pProps = aFieldProps.getConstArray();
-                    for(sal_uInt16 i = 0; i < AUTH_FIELD_END && i < aFieldProps.getLength(); i++)
+                    for(sal_Int32 i = 0; i < AUTH_FIELD_END && i < aFieldProps.getLength(); i++)
                     {
                         m_sFields[i] = lcl_FindColumnEntry(
                                 pProps, aFieldProps.getLength(), m_sColumnTitles[i]);
@@ -1211,14 +1207,14 @@ IMPL_LINK( SwAuthorMarkPane, CompEntryHdl, ListBox*, pBox)
             const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
                                         pSh->GetFldType(RES_AUTHORITY, OUString());
             const SwAuthEntry*  pEntry = pFType ? pFType->GetEntryByIdentifier(sEntry) : 0;
-            for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+            for(int i = 0; i < AUTH_FIELD_END; i++)
                 m_sFields[i] = pEntry ?
                             pEntry->GetAuthorField((ToxAuthorityField)i) : OUString();
         }
     }
     if (pBox->GetSelectEntry().isEmpty())
     {
-        for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+        for(int i = 0; i < AUTH_FIELD_END; i++)
             m_sFields[i] = OUString();
     }
     m_pAuthorFI->SetText(m_sFields[AUTH_FIELD_AUTHOR]);
@@ -1242,7 +1238,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl)
                 : 0;
         if(pEntry)
         {
-            for(sal_uInt16 i = 0; i < AUTH_FIELD_END && !bDifferent; i++)
+            for(int i = 0; i < AUTH_FIELD_END && !bDifferent; i++)
                 bDifferent |= m_sFields[i] != pEntry->GetAuthorField((ToxAuthorityField)i);
             if(bDifferent)
             {
@@ -1254,7 +1250,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl)
 
         SwFldMgr aMgr(pSh);
         OUString sFields;
-        for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+        for(int i = 0; i < AUTH_FIELD_END; i++)
         {
             sFields += m_sFields[i];
             sFields += OUString(TOX_STYLE_DELIMITER);
@@ -1264,7 +1260,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl)
             if(bDifferent)
             {
                 SwAuthEntry aNewData;
-                for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+                for(int i = 0; i < AUTH_FIELD_END; i++)
                     aNewData.SetAuthorField((ToxAuthorityField)i, m_sFields[i]);
                 pSh->ChangeAuthorityData(&aNewData);
             }
@@ -1285,7 +1281,7 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton)
 {
     bool bCreate = pButton == m_pCreateEntryPB;
     OUString sOldId = m_sCreatedEntry[0];
-    for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+    for(int i = 0; i < AUTH_FIELD_END; i++)
         m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i];
     SwCreateAuthEntryDlg_Impl aDlg(pButton,
                 bCreate ? m_sCreatedEntry : m_sFields,
@@ -1300,7 +1296,7 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton)
         {
             m_pEntryLB->RemoveEntry(sOldId);
         }
-        for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+        for(int i = 0; i < AUTH_FIELD_END; i++)
         {
             m_sFields[i] = aDlg.GetEntryText((ToxAuthorityField)i);
             m_sCreatedEntry[i] = m_sFields[i];
@@ -1347,7 +1343,7 @@ IMPL_LINK(SwAuthorMarkPane, ChangeSourceHdl, RadioButton*, pButton)
                 if( aNames >>= aSeq)
                 {
                     const beans::PropertyValue* pArr = aSeq.getConstArray();
-                    for(sal_uInt16 i = 0; i < aSeq.getLength(); i++)
+                    for(sal_Int32 i = 0; i < aSeq.getLength(); i++)
                     {
                         OUString sTitle = pArr[i].Name;
                         sal_Int16 nField = 0;
@@ -1363,7 +1359,7 @@ IMPL_LINK(SwAuthorMarkPane, ChangeSourceHdl, RadioButton*, pButton)
         {
             uno::Sequence<OUString> aIdentifiers = xBibAccess->getElementNames();
             const OUString* pNames = aIdentifiers.getConstArray();
-            for(sal_uInt16 i = 0; i < aIdentifiers.getLength(); i++)
+            for(sal_Int32 i = 0; i < aIdentifiers.getLength(); i++)
             {
                 m_pEntryLB->InsertEntry(pNames[i]);
             }
@@ -1434,7 +1430,7 @@ void SwAuthorMarkPane::InitControls()
         ChangeSourceHdl(m_pFromComponentRB->IsChecked() ? m_pFromComponentRB : m_pFromDocContentRB);
         m_pCreateEntryPB->Enable(!m_pFromComponentRB->IsChecked());
         if(!m_pFromComponentRB->IsChecked() && !m_sCreatedEntry[0].isEmpty())
-            for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+            for(int i = 0; i < AUTH_FIELD_END; i++)
                 m_sFields[i] = m_sCreatedEntry[i];
     }
     if(bNewEntry || !pField || pField->GetTyp()->Which() != RES_AUTHORITY)
@@ -1446,7 +1442,7 @@ void SwAuthorMarkPane::InitControls()
     OSL_ENSURE(pEntry, "No authority entry found");
     if(!pEntry)
         return;
-    for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+    for(int i = 0; i < AUTH_FIELD_END; i++)
         m_sFields[i] = pEntry->GetAuthorField((ToxAuthorityField)i);
 
     m_pEntryED->SetText(pEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER));
@@ -1481,7 +1477,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent,
 
     bool bLeft = true;
     sal_Int32 nLeftRow(0), nRightRow(0);
-    for(sal_uInt16 nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
+    for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
     {
         const TextInfo aCurInfo = aTextInfoArr[nIndex];
 
@@ -1495,12 +1491,11 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent,
         if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField )
         {
             pTypeListBox = new ListBox(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER);
-            for(sal_uInt16 j = 0; j < AUTH_TYPE_END; j++)
+            for(int j = 0; j < AUTH_TYPE_END; j++)
                 pTypeListBox->InsertEntry(SW_RESSTR(STR_AUTH_TYPE_START + j));
             if(!pFields[aCurInfo.nToxField].isEmpty())
             {
-                sal_uInt16 nIndexPos = static_cast< sal_uInt16 >(pFields[aCurInfo.nToxField].toInt32());
-                pTypeListBox->SelectEntryPos(nIndexPos);
+                pTypeListBox->SelectEntryPos(pFields[aCurInfo.nToxField].toInt32());
             }
             pTypeListBox->set_grid_left_attach(1);
             pTypeListBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
@@ -1567,7 +1562,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent,
 
 SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl()
 {
-    for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+    for(int i = 0; i < AUTH_FIELD_END; i++)
     {
         delete pFixedTexts[i];
         delete pEdits[i];
@@ -1591,7 +1586,7 @@ OUString  SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) cons
     }
     else
     {
-        for(sal_uInt16 nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
+        for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
         {
             const TextInfo aCurInfo = aTextInfoArr[nIndex];
             if(aCurInfo.nToxField == eField)
@@ -1614,7 +1609,7 @@ IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, ComboBox*, pBox)
                                                         pBox->GetText());
         if(pEntry)
         {
-            for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+            for(int i = 0; i < AUTH_FIELD_END; i++)
             {
                 const TextInfo aCurInfo = aTextInfoArr[i];
                 if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
commit 7f48d14419690a9bd4c9081b4dec11810f2c8ce6
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 00:29:20 2014 +0100

    sal_uInt16 to sal_Int32 and remove a temporary OUString
    
    Change-Id: Ia305ad3b1e04129e172f0f2fe3428f84e4654576

diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index f8b383c..e612bd2 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -40,11 +40,11 @@ IMPL_LINK( SwInsertBookmarkDlg, ModifyHdl, BookmarkCombo *, pBox )
     if(!bSelEntries)
     {
         OUString sTmp = pBox->GetText();
-        sal_uInt16 nLen = sTmp.getLength();
+        const sal_Int32 nLen = sTmp.getLength();
         OUString sMsg;
-        for(sal_uInt16 i = 0; i < BookmarkCombo::aForbiddenChars.getLength(); i++)
+        for(sal_Int32 i = 0; i < BookmarkCombo::aForbiddenChars.getLength(); i++)
         {
-            sal_uInt16 nTmpLen = sTmp.getLength();
+            const sal_Int32 nTmpLen = sTmp.getLength();
             sTmp = comphelper::string::remove(sTmp, BookmarkCombo::aForbiddenChars[i]);
             if(sTmp.getLength() != nTmpLen)
                 sMsg += OUString(BookmarkCombo::aForbiddenChars[i]);
@@ -52,9 +52,7 @@ IMPL_LINK( SwInsertBookmarkDlg, ModifyHdl, BookmarkCombo *, pBox )
         if(sTmp.getLength() != nLen)
         {
             pBox->SetText(sTmp);
-            OUString sWarning(sRemoveWarning);
-            sWarning += sMsg;
-            InfoBox(this, sWarning).Execute();
+            InfoBox(this, sRemoveWarning+sMsg).Execute();
         }
 
     }
@@ -136,7 +134,7 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rS, SfxRe
 
     // fill Combobox with existing bookmarks
     IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
-    sal_uInt16 nId = 0;
+    sal_Int32 nId = 0;
     for( IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
         ppBookmark != pMarkAccess->getBookmarksEnd();
         ++ppBookmark)
commit 9c925ddd5efdfc32dd62481c3a1f6469c4149bd4
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 00:18:25 2014 +0100

    Constify and reduce scope
    
    Change-Id: If80b842a79d476e5e90eeedc4520fc952c8f8f2a

diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
index 88f3245..ff4e2be 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -115,7 +115,6 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& )
     SwEndNoteInfo *pInf = bEndNote ? new SwEndNoteInfo( pSh->GetEndNoteInfo() )
                                    : new SwFtnInfo( pSh->GetFtnInfo() );
     SfxObjectShell * pDocSh = SfxObjectShell::Current();
-    sal_uInt16 i;
 
     if (PTR_CAST(SwWebDocShell, pDocSh))
         m_pStylesContainer->Hide();
@@ -198,12 +197,12 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& )
         }
     }
 
-        // page
-    for( i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i )
+    // page
+    for( sal_uInt16 i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i )
         m_pPageTemplBox->InsertEntry(SwStyleNameMapper::GetUIName( i, OUString() ));
 
-    sal_uInt16 nCount = pSh->GetPageDescCnt();
-    for(i = 0; i < nCount; ++i)
+    const sal_uInt16 nCount = pSh->GetPageDescCnt();
+    for(sal_uInt16 i = 0; i < nCount; ++i)
     {
         const SwPageDesc &rPageDesc = pSh->GetPageDesc(i);
         if(LISTBOX_ENTRY_NOTFOUND == m_pPageTemplBox->GetEntryPos(rPageDesc.GetName()))
@@ -327,7 +326,7 @@ IMPL_LINK_NOARG_INLINE_END(SwEndNoteOptionPage, PosChapterHdl)
 static SwCharFmt* lcl_GetCharFormat( SwWrtShell* pSh, const OUString& rCharFmtName )
 {
     SwCharFmt* pFmt = 0;
-    sal_uInt16 nChCount = pSh->GetCharFmtCount();
+    const sal_uInt16 nChCount = pSh->GetCharFmtCount();
     for(sal_uInt16 i = 0; i< nChCount; i++)
     {
         SwCharFmt& rChFmt = pSh->GetCharFmt(i);
commit edf385a19b1cfa024bc61ac2a793f24aa9689e37
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Mar 23 00:11:49 2014 +0100

    Remove some OUString concatenated appends and some temporaries
    
    Change-Id: I9f92a57644239b11941236a1cee5302eca993a7b

diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index a506684..216d335 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -102,11 +102,8 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent,
         GlosBibUserData* pData = new GlosBibUserData;
         pData->sGroupName = sGroup;
         pData->sGroupTitle = sTitle;
-        OUString sTemp(sTitle);
-        sTemp += "\t";
         pData->sPath = m_pPathLB->GetEntry(sGroup.getToken(1, GLOS_DELIM).toInt32());
-        sTemp += pData->sPath;
-        SvTreeListEntry* pEntry = m_pGroupTLB->InsertEntry(sTemp);
+        SvTreeListEntry* pEntry = m_pGroupTLB->InsertEntry(sTitle + "\t" + pData->sPath);
         pEntry->SetUserData(pData);
 
     }
@@ -138,11 +135,10 @@ void SwGlossaryGroupDlg::Apply()
                 pGlosHdl->SetCurGroup(pUserData->sGroupName);
             }
         }
-        OUString sMsg(SW_RES(STR_QUERY_DELETE_GROUP1));
         OUString sTitle( it->getToken(1, '\t') );
-        if(!sTitle.isEmpty())
-            sMsg += sTitle;
-        sMsg += SW_RESSTR(STR_QUERY_DELETE_GROUP2);
+        const OUString sMsg(SW_RESSTR(STR_QUERY_DELETE_GROUP1)
+                            + sTitle
+                            + SW_RESSTR(STR_QUERY_DELETE_GROUP2));
         QueryBox aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg );
         if(RET_YES == aQuery.Execute())
             pGlosHdl->DelGroup( sDelGroup );
@@ -190,8 +186,7 @@ IMPL_LINK( SwGlossaryGroupDlg, SelectHdl, SvTabListBox*, EMPTYARG  )
         {
             SvTreeListEntry* pEntry = m_pGroupTLB->GetEntry(nPos);
             GlosBibUserData* pFoundData = (GlosBibUserData*)pEntry->GetUserData();
-            OUString sGroup = pFoundData->sGroupName;
-            bExists = sGroup == sEntry;
+            bExists = pFoundData->sGroupName == sEntry;
         }
 
         m_pRenamePB->Enable(!bExists && !sName.isEmpty());
@@ -207,9 +202,7 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, NewHdl)
         + OUString::number(m_pPathLB->GetSelectEntryPos());
     OSL_ENSURE(!pGlosHdl->FindGroupName(sGroup), "group already available!");
     m_InsertedArr.push_back(sGroup);
-    OUString sTemp(m_pNameED->GetText());
-    sTemp += "\t";
-    sTemp += m_pPathLB->GetSelectEntry();
+    const OUString sTemp(m_pNameED->GetText() + "\t" + m_pPathLB->GetSelectEntry());
     SvTreeListEntry* pEntry = m_pGroupTLB->InsertEntry(sTemp);
     GlosBibUserData* pData = new GlosBibUserData;
     pData->sPath = m_pPathLB->GetSelectEntry();
@@ -262,10 +255,7 @@ IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, Button*, pButton  )
     }
     if(bDelete)
     {
-        OUString sGroupEntry(pUserData->sGroupName);
-        sGroupEntry += "\t";
-        sGroupEntry += pUserData->sGroupTitle;
-        m_RemovedArr.push_back(sGroupEntry);
+        m_RemovedArr.push_back(pUserData->sGroupName + "\t" + pUserData->sGroupTitle);
     }
     delete pUserData;
     m_pGroupTLB->GetModel()->Remove(pEntry);
@@ -303,18 +293,14 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl)
     }
     if(!bDone)
     {
-        sEntry += OUString(RENAME_TOKEN_DELIM);
-        sEntry += sNewName;
-        sEntry += OUString(RENAME_TOKEN_DELIM);
-        sEntry += sNewTitle;
+        sEntry += OUString(RENAME_TOKEN_DELIM) + sNewName
+                + OUString(RENAME_TOKEN_DELIM) + sNewTitle;
         m_RenamedArr.push_back(sEntry);
     }
     delete (GlosBibUserData*)pEntry->GetUserData();
     m_pGroupTLB->GetModel()->Remove(pEntry);
-    OUString sTemp(m_pNameED->GetText());
-    sTemp += "\t";
-    sTemp += m_pPathLB->GetSelectEntry();
-    pEntry = m_pGroupTLB->InsertEntry(sTemp);
+    pEntry = m_pGroupTLB->InsertEntry(m_pNameED->GetText() + "\t"
+                                      + m_pPathLB->GetSelectEntry());
     GlosBibUserData* pData = new GlosBibUserData;
     pData->sPath = m_pPathLB->GetSelectEntry();
     pData->sGroupName = sNewName;
@@ -432,12 +418,10 @@ void    SwGlossaryGroupTLB::RequestHelp( const HelpEvent& rHEvt )
                 aSize.Width() = GetSizePixel().Width() - aPos.X();
             aPos = OutputToScreenPixel(aPos);
             Rectangle aItemRect( aPos, aSize );
-            OUString sMsg;
             GlosBibUserData* pData = (GlosBibUserData*)pEntry->GetUserData();
-            sMsg = pData->sPath;
-            sMsg += OUString(INET_PATH_TOKEN);
-            sMsg += pData->sGroupName.getToken(0, GLOS_DELIM);
-            sMsg += SwGlossaries::GetExtension();
+            const OUString sMsg = pData->sPath + OUString(INET_PATH_TOKEN)
+                                + pData->sGroupName.getToken(0, GLOS_DELIM)
+                                + SwGlossaries::GetExtension();
 
             Help::ShowQuickHelp( this, aItemRect, sMsg,
                         QUICKHELP_LEFT|QUICKHELP_VCENTER );
commit a3ea6e856f5679d9e08187ff22cdf84a8f70190d
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Mar 22 23:41:26 2014 +0100

    Result of expression is unused, remove that code
    
    This code has been there at least since 2000-09-18, so removing it
    seems to be safer than adding the evaluated token to the sMsg
    OUString, as the surrounding code would suggest.
    
    Change-Id: Ie9b2446b80a7bf79efbf6963b3a5e40548d4154c

diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index b9d5bee..a506684 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -142,8 +142,6 @@ void SwGlossaryGroupDlg::Apply()
         OUString sTitle( it->getToken(1, '\t') );
         if(!sTitle.isEmpty())
             sMsg += sTitle;
-        else
-            sDelGroup.getToken(1, GLOS_DELIM);
         sMsg += SW_RESSTR(STR_QUERY_DELETE_GROUP2);
         QueryBox aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg );
         if(RET_YES == aQuery.Execute())
commit 5b592e25e7dddb8cc8c132882964b43e10cc155f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Mar 22 18:42:17 2014 +0100

    sal_uInt16 to sal_uLong and remove unneeded cast
    
    Change-Id: I45152c575720e0720139d8a6d973333b105e1fa5

diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index bcbb029..b9d5bee 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -104,7 +104,7 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent,
         pData->sGroupTitle = sTitle;
         OUString sTemp(sTitle);
         sTemp += "\t";
-        pData->sPath = m_pPathLB->GetEntry((sal_uInt16)sGroup.getToken(1, GLOS_DELIM).toInt32());
+        pData->sPath = m_pPathLB->GetEntry(sGroup.getToken(1, GLOS_DELIM).toInt32());
         sTemp += pData->sPath;
         SvTreeListEntry* pEntry = m_pGroupTLB->InsertEntry(sTemp);
         pEntry->SetUserData(pData);
@@ -346,7 +346,7 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, ModifyHdl)
         if( 0xffffffff == nPos)
         {
             const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
-            for(sal_uInt16 i = 0; i < m_pGroupTLB->GetEntryCount(); i++)
+            for(sal_uLong i = 0; i < m_pGroupTLB->GetEntryCount(); i++)
             {
                 OUString sTemp = m_pGroupTLB->GetEntryText( i, 0 );
                 nCaseReadonly = (sal_uLong)m_pPathLB->GetEntryData(
commit 009799fda59e6320d9e8c5b9381232bc2e3dc2b4
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Mar 22 18:28:14 2014 +0100

    sal_uInt16 to sal_Int32
    
    Change-Id: I9d92d5866be5f579a2d645d9039f9fb939e6e61e

diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index bcae7a5..87e1109 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -594,9 +594,9 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl)
         //check if at least one glossary path is write enabled
         SvtPathOptions aPathOpt;
         const OUString sGlosPath( aPathOpt.GetAutoTextPath() );
-        sal_uInt16 nPaths = comphelper::string::getTokenCount(sGlosPath, ';');
+        const sal_Int32 nPaths = comphelper::string::getTokenCount(sGlosPath, ';');
         bool bIsWritable = false;
-        for(sal_uInt16 nPath = 0; nPath < nPaths; nPath++)
+        for(sal_Int32 nPath = 0; nPath < nPaths; nPath++)
         {
             const OUString sPath = URIHelper::SmartRel2Abs(
                 INetURLObject(), sGlosPath.getToken(nPath, ';'),
@@ -670,7 +670,7 @@ void SwGlossaryDlg::Init()
     const sal_uInt16 nCnt = pGlossaryHdl->GetGroupCnt();
     SvTreeListEntry* pSelEntry = 0;
     const OUString sSelStr(::GetCurrGlosGroup().getToken(0, GLOS_DELIM));
-    const sal_uInt16 nSelPath = static_cast< sal_uInt16 >(::GetCurrGlosGroup().getToken(1, GLOS_DELIM).toInt32());
+    const sal_Int32 nSelPath = ::GetCurrGlosGroup().getToken(1, GLOS_DELIM).toInt32();
     // #i66304# - "My AutoText" comes from mytexts.bau, but should be translated
     const OUString sMyAutoTextEnglish("My AutoText");
     const OUString sMyAutoTextTranslated(SW_RES(STR_MY_AUTOTEXT));
@@ -685,11 +685,11 @@ void SwGlossaryDlg::Init()
         if(sTitle == sMyAutoTextEnglish)
             sTitle = sMyAutoTextTranslated;
         SvTreeListEntry* pEntry = m_pCategoryBox->InsertEntry( sTitle );
-        sal_uInt16 nPath = static_cast< sal_uInt16 >(sGroupName.getToken( 1, GLOS_DELIM ).toInt32());
+        const sal_Int32 nPath = sGroupName.getToken( 1, GLOS_DELIM ).toInt32();
 
         GroupUserData* pData = new GroupUserData;
         pData->sGroupName = sGroupName.getToken(0, GLOS_DELIM);
-        pData->nPathIdx = nPath;
+        pData->nPathIdx = static_cast< sal_uInt16 >(nPath);
         pData->bReadonly = pGlossaryHdl->IsReadOnly(&sGroupName);
 
         pEntry->SetUserData(pData);
commit c373dc5d6c45cf9d04b079dfbc26820547031d57
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Mar 22 17:43:07 2014 +0100

    Group common expression
    
    Change-Id: Id286b57ccba1edb35490c374740a58128ce7f0c4

diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index ab6df7e..5079ed9 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -209,15 +209,13 @@ void SwNumPositionTabPage::InitControls()
                 {
                     if(bRelative)
                     {
-                        if(nFirstBorderTextRelative == -1)
-                            nFirstBorderTextRelative =
-                            (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
-                            aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
+                        const long nBorderTextRelative =
+                            aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
+                            aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset();
+                        if (nFirstBorderTextRelative == -1)
+                            nFirstBorderTextRelative = nBorderTextRelative;
                         else
-                            bSameDistBorderNum &= nFirstBorderTextRelative ==
-                            (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
-                            aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
-
+                            bSameDistBorderNum &= nFirstBorderTextRelative == nBorderTextRelative;
                     }
                     else
                     {
commit 0dcd33cf92585af85e3a73e75c4a9988dd3c395a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Mar 22 17:38:47 2014 +0100

    sal_uInt16 to sal_Int32 and removed some unneeded casts
    
    Change-Id: I122af4ed8a2504242f527cf98b26c9e1599497ea

diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index c37c9b1..ab6df7e 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -107,7 +107,7 @@ SwNumPositionTabPage::SwNumPositionTabPage(Window* pParent,
     m_pRelativeCB->Check();
     m_pAlignLB->SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl));
     m_pAlign2LB->SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl));
-    for ( sal_uInt16 i = 0; i < m_pAlignLB->GetEntryCount(); ++i )
+    for ( sal_Int32 i = 0; i < m_pAlignLB->GetEntryCount(); ++i )
     {
         m_pAlign2LB->InsertEntry( m_pAlignLB->GetEntry( i ) );
     }
@@ -280,7 +280,7 @@ void SwNumPositionTabPage::InitControls()
 
     if(bSameAdjust)
     {
-        sal_uInt16 nPos = 1; // centered
+        sal_Int32 nPos = 1; // centered
         if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
             nPos = 0;
         else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
@@ -296,7 +296,7 @@ void SwNumPositionTabPage::InitControls()
 
     if ( bSameLabelFollowedBy )
     {
-        sal_uInt16 nPos = 0; // LISTTAB
+        sal_Int32 nPos = 0; // LISTTAB
         if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
         {
             nPos = 1;
@@ -567,7 +567,7 @@ IMPL_LINK_NOARG(SwNumPositionTabPage, EditModifyHdl)
         {
             SwNumFmt aNumFmt(pActNum->Get(i));
 
-            const sal_uInt16 nPos = m_pAlignLB->IsVisible()
+            const sal_Int32 nPos = m_pAlignLB->IsVisible()
                                 ? m_pAlignLB->GetSelectEntryPos()
                                 : m_pAlign2LB->GetSelectEntryPos();
             SvxAdjust eAdjust = SVX_ADJUST_CENTER;
@@ -649,7 +649,7 @@ IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pFld )
                     if(0 == i)
                     {
                         long nTmp = aNumFmt.GetFirstLineOffset();
-                        aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp));
+                        aNumFmt.SetAbsLSpace( nValue - nTmp );
                     }
                     else
                     {
@@ -657,7 +657,7 @@ IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pFld )
                                     pActNum->Get( i - 1 ).GetFirstLineOffset() -
                                     pActNum->Get( i ).GetFirstLineOffset();
 
-                        aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp));
+                        aNumFmt.SetAbsLSpace( nValue + nTmp );
                     }
                 }
                 else
@@ -667,15 +667,15 @@ IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pFld )
             }
             else if (pFld == m_pDistNumMF)
             {
-                aNumFmt.SetCharTextDistance( (short)nValue );
+                aNumFmt.SetCharTextDistance( nValue );
             }
             else if (pFld == m_pIndentMF)
             {
                 // now AbsLSpace also has to be modified by FirstLineOffset
                 long nDiff = nValue + aNumFmt.GetFirstLineOffset();
                 long nAbsLSpace = aNumFmt.GetAbsLSpace();
-                aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff));
-                aNumFmt.SetFirstLineOffset( -(short)nValue );
+                aNumFmt.SetAbsLSpace( nAbsLSpace + nDiff );
+                aNumFmt.SetFirstLineOffset( -nValue );
             }
 
             pActNum->Set( i, aNumFmt );
@@ -734,7 +734,7 @@ IMPL_LINK_NOARG(SwNumPositionTabPage, LabelFollowedByHdl_Impl)
     // determine value to be set at the chosen list levels
     SvxNumberFormat::LabelFollowedBy eLabelFollowedBy = SvxNumberFormat::LISTTAB;
     {
-        const sal_uInt16 nPos = m_pLabelFollowedByLB->GetSelectEntryPos();
+        const sal_Int32 nPos = m_pLabelFollowedByLB->GetSelectEntryPos();
         if ( nPos == 1 )
         {
             eLabelFollowedBy = SvxNumberFormat::SPACE;
@@ -967,7 +967,7 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
         ::FillCharStyleListBox(rCharFmtLB,  pDocShell);
 
         std::vector<OUString> aList;
-        for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
+        for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
              aList.push_back( rCharFmtLB.GetEntry(j) );
 
         aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
commit c3251f7073448714392b449e3c2851513964e076
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Mar 22 16:52:30 2014 +0100

    sal_uInt16 to long in NumberingPreview::Paint and its helpers
    
    Change-Id: I52f3365a00f05bf1ff34f5a01cb0c0dbdf2fda11

diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 3f35e7e..b532e69 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -845,9 +845,9 @@ void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType
         m_pStartEdit->GetModifyHdl().Call(m_pStartEdit);
 }
 
-static sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev,
-            const SwNumFmt& rFmt, sal_uInt16 nXStart,
-            sal_uInt16 nYStart, const Size& rSize)
+static long lcl_DrawBullet(VirtualDevice* pVDev,
+            const SwNumFmt& rFmt, long nXStart,
+            long nYStart, const Size& rSize)
 {
     Font aTmpFont(pVDev->GetFont());
 
@@ -857,17 +857,17 @@ static sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev,
     pVDev->SetFont( aFont );
     OUString aText(rFmt.GetBulletChar());
     pVDev->DrawText( Point(nXStart, nYStart), aText );
-    sal_uInt16 nRet = (sal_uInt16)pVDev->GetTextWidth(aText);
+    const long nRet = pVDev->GetTextWidth(aText);
 
     pVDev->SetFont(aTmpFont);
     return nRet;
 }
 
-static sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SwNumFmt &rFmt, sal_uInt16 nXStart,
-                        sal_uInt16 nYStart, sal_uInt16 nDivision)
+static long lcl_DrawGraphic(VirtualDevice* pVDev, const SwNumFmt &rFmt, long nXStart,
+                        long nYStart, long nDivision)
 {
     const SvxBrushItem* pBrushItem = rFmt.GetBrush();
-    sal_uInt16 nRet = 0;
+    long nRet = 0;
     if(pBrushItem)
     {
         const Graphic* pGrf = pBrushItem->GetGraphic();
@@ -875,7 +875,7 @@ static sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SwNumFmt &rFmt, sa
         {
             Size aGSize( rFmt.GetGraphicSize());
             aGSize.Width() /= nDivision;
-            nRet = (sal_uInt16)aGSize.Width();
+            nRet = aGSize.Width();
             aGSize.Height() /= nDivision;
             pGrf->Draw( pVDev, Point(nXStart,nYStart),
                     pVDev->PixelToLogic( aGSize ) );
@@ -892,8 +892,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeNumberingPreview(Window *pP
 // paint numbering's preview
 void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
 {
-    Size aSize(PixelToLogic(GetOutputSizePixel()));
-    Rectangle aRect(Point(0,0), aSize);
+    const Size aSize(PixelToLogic(GetOutputSizePixel()));
 
     VirtualDevice* pVDev = new VirtualDevice(*this);
     pVDev->SetMapMode(GetMapMode());
@@ -902,44 +901,38 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
     // #101524# OJ
     pVDev->SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() );
     pVDev->SetLineColor( GetSettings().GetStyleSettings().GetButtonTextColor() );
-    pVDev->DrawRect(aRect);
+    pVDev->DrawRect(Rectangle(Point(0,0), aSize));
 
     if(pActNum)
     {
-        sal_uInt16 nWidthRelation;
+        long nWidthRelation = 30; // chapter dialog
         if(nPageWidth)
         {
-            nWidthRelation = sal_uInt16 (nPageWidth / aSize.Width());
+            nWidthRelation = nPageWidth / aSize.Width();
             if(bPosition)
                 nWidthRelation = nWidthRelation * 2 / 3;
             else
                 nWidthRelation = nWidthRelation / 4;
         }
-        else
-            nWidthRelation = 30; // chapter dialog
 
         // height per level
-        sal_uInt16 nXStep = sal_uInt16(aSize.Width() / (3 * MAXLEVEL));
-        if(MAXLEVEL < 10)
-            nXStep /= 2;
-        sal_uInt16 nYStart = 4;
-        sal_uInt16 nYStep = sal_uInt16((aSize.Height() - 6)/ MAXLEVEL);
+        const long nXStep = aSize.Width() / (3 * MAXLEVEL * ((MAXLEVEL < 10) ? 2 : 1));
+        const long nYStep = (aSize.Height() - 6)/ MAXLEVEL;
+        long nYStart = 4;
         aStdFont = OutputDevice::GetDefaultFont(
                                     DEFAULTFONT_UI_SANS, GetAppLanguage(),
                                     DEFAULTFONT_FLAGS_ONLYONE, this );
         // #101524# OJ
         aStdFont.SetColor( SwViewOption::GetFontColor() );
 
-        sal_uInt16 nFontHeight = nYStep * 6 / 10;
-        if(bPosition)
-            nFontHeight = nYStep * 15 / 10;
+        const long nFontHeight = nYStep * ( bPosition ? 15 : 6 ) / 10;
         aStdFont.SetSize(Size( 0, nFontHeight ));
 
-        sal_uInt16 nPreNum = pActNum->Get(0).GetStart();
+        long nPreNum = pActNum->Get(0).GetStart();
 
         if(bPosition)
         {
-            sal_uInt16 nLineHeight = nFontHeight * 8 / 7;
+            const long nLineHeight = nFontHeight * 8 / 7;
             sal_uInt8 nStart = 0;
             while( !(nActLevel & (1<<nStart)) )
             {
@@ -955,18 +948,18 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                 const SwNumFmt &rFmt = pActNum->Get(nLevel);
                 aNumVector.push_back(rFmt.GetStart());
 
-                sal_uInt16 nXStart( 0 );
-                short nTextOffset( 0 );
-                sal_uInt16 nNumberXPos( 0 );
+                long nXStart( 0 );
+                long nTextOffset( 0 );
+                long nNumberXPos( 0 );
                 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
                 {
                     nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
                     nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
                     nNumberXPos = nXStart;
-                    sal_uInt16 nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
+                    const long nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
 
                     if(nFirstLineOffset <= nNumberXPos)
-                        nNumberXPos = nNumberXPos - nFirstLineOffset;
+                        nNumberXPos -= nFirstLineOffset;
                     else
                         nNumberXPos = 0;
                 }
@@ -975,26 +968,19 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                     const long nTmpNumberXPos( ( rFmt.GetIndentAt() +
                                                  rFmt.GetFirstLineIndent() ) /
                                                nWidthRelation );
-                    if ( nTmpNumberXPos < 0 )
-                    {
-                        nNumberXPos = 0;
-                    }
-                    else
-                    {
-                        nNumberXPos = static_cast<sal_uInt16>(nTmpNumberXPos);
-                    }
+                    nNumberXPos = ( nTmpNumberXPos < 0 ) ? 0 : nTmpNumberXPos;
                 }
 
-                sal_uInt16 nBulletWidth = 0;
+                long nBulletWidth = 0;
                 if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
                 {
-                    nBulletWidth = lcl_DrawGraphic(pVDev, rFmt,
-                                        nNumberXPos,
-                                            nYStart, nWidthRelation);
+                    nBulletWidth = lcl_DrawGraphic(pVDev, rFmt, nNumberXPos,
+                                                   nYStart, nWidthRelation);
                 }
                 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
                 {
-                    nBulletWidth =  lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize());
+                    nBulletWidth = lcl_DrawBullet(pVDev, rFmt, nNumberXPos,
+                                                  nYStart, aStdFont.GetSize());
                 }
                 else
                 {
@@ -1004,7 +990,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                     // #128041#
                     OUString aText(pActNum->MakeNumString( aNumVector ));
                     pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
-                    nBulletWidth = (sal_uInt16)pVDev->GetTextWidth(aText);
+                    nBulletWidth = pVDev->GetTextWidth(aText);
                     nPreNum++;
                 }
                 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
@@ -1013,10 +999,10 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                     pVDev->SetFont(aStdFont);
                     OUString aText(' ');
                     pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
-                    nBulletWidth = nBulletWidth + (sal_uInt16)pVDev->GetTextWidth(aText);
+                    nBulletWidth += pVDev->GetTextWidth(aText);
                 }
 
-                sal_uInt16 nTextXPos( 0 );
+                long nTextXPos( 0 );
                 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
                 {
                     nTextXPos = nXStart;
@@ -1031,8 +1017,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                     {
                         case SvxNumberFormat::LISTTAB:
                         {
-                            nTextXPos = static_cast<sal_uInt16>(
-                                            rFmt.GetListtabPos() / nWidthRelation );
+                            nTextXPos = rFmt.GetListtabPos() / nWidthRelation;
                             if ( nTextXPos < nNumberXPos + nBulletWidth )
                             {
                                 nTextXPos = nNumberXPos + nBulletWidth;
@@ -1047,7 +1032,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                         break;
                     }
 
-                    nXStart = static_cast<sal_uInt16>( rFmt.GetIndentAt() / nWidthRelation );
+                    nXStart = rFmt.GetIndentAt() / nWidthRelation;
                 }
 
                 Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
@@ -1062,13 +1047,13 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
         else
         {
             SwNumberTree::tNumberVector aNumVector;
-            sal_uInt16 nLineHeight = nFontHeight * 3 / 2;
+            const long nLineHeight = nFontHeight * 3 / 2;
             for( sal_uInt8 nLevel = 0; nLevel < MAXLEVEL;
                             ++nLevel, nYStart = nYStart + nYStep )
             {
                 const SwNumFmt &rFmt = pActNum->Get(nLevel);
                 aNumVector.push_back(rFmt.GetStart());
-                sal_uInt16 nXStart( 0 );
+                long nXStart( 0 );
                 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
                 {
                     nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
@@ -1078,18 +1063,11 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                     const long nTmpXStart( ( rFmt.GetIndentAt() +
                                              rFmt.GetFirstLineIndent() ) /
                                            nWidthRelation );
-                    if ( nTmpXStart < 0 )
-                    {
-                        nXStart = 0;
-                    }
-                    else
-                    {
-                        nXStart = static_cast<sal_uInt16>(nTmpXStart);
-                    }
+                    nXStart = ( nTmpXStart < 0 ) ? 0 : nTmpXStart;
                 }
                 nXStart /= 2;
                 nXStart += 2;
-                sal_uInt16 nTextOffset = 2 * nXStep;
+                long nTextOffset = 2 * nXStep;
                 if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
                 {
                     lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
@@ -1098,7 +1076,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
                 {
                     nTextOffset =  lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
-                    nTextOffset = nTextOffset + nXStep;
+                    nTextOffset += nXStep;
                 }
                 else
                 {
@@ -1108,8 +1086,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
                     // #128041#
                     OUString aText(pActNum->MakeNumString( aNumVector ));
                     pVDev->DrawText( Point(nXStart, nYStart), aText );
-                    nTextOffset = (sal_uInt16)pVDev->GetTextWidth(aText);
-                    nTextOffset = nTextOffset + nXStep;
+                    nTextOffset = pVDev->GetTextWidth(aText) + nXStep;
                     nPreNum++;
                 }
                 pVDev->SetFont(aStdFont);
commit 1802ccd4ea202789b0076c1b499c729f95b4d753
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Mar 22 00:17:41 2014 +0100

    sal_uInt16 to long and constify loop bound
    
    Change-Id: Iad9498676994cd60521f251fd84dcc2b90b54e88

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 3b252f9..3fb9dd1 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -109,7 +109,8 @@ SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) :
 
     XColorListRef pColorLst = XColorList::GetStdColorList();
     m_pColorLB->InsertAutomaticEntryColor( Color( COL_AUTO ) );
-    for( sal_uInt16 i = 0; i < pColorLst->Count(); ++i )
+    const long nCount = pColorLst->Count();
+    for( long i = 0; i < nCount; ++i )
     {
         XColorEntry* pEntry = pColorLst->GetColor( i );
         Color aColor = pEntry->GetColor();
commit 766f13a807537da4f48cf58f769f0af679bc1980
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Mar 21 23:46:51 2014 +0100

    Improved integer type consistence + some optimizations
    
    Change-Id: I5e2a6ef9c3f744997e9e473e9431d590ba6f9d04

diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index c28cf09..6c6bf51 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -68,10 +68,11 @@ using namespace ::com::sun::star;
 
 static void lcl_ClearLstBoxAndDelUserData( ListBox& rLstBox )
 {
-    void* pDel;
-    for( sal_uInt16 n = 0, nEnd = rLstBox.GetEntryCount(); n < nEnd; ++n )
-        if( 0 != ( pDel = rLstBox.GetEntryData( n )) )
-            delete (OUString*)pDel;
+    const sal_Int32 nEnd = rLstBox.GetEntryCount();
+    for( sal_Int32 n = 0; n < nEnd; ++n )
+    {
+        delete reinterpret_cast<OUString *>(rLstBox.GetEntryData( n ));
+    }
     rLstBox.Clear();
 }
 
@@ -426,41 +427,40 @@ IMPL_LINK( SwSortDlg, LanguageHdl, ListBox*, pLBox )
     if( !pColRes )
         pColRes = new CollatorResource();
 
-    const sal_uInt16 nLstBoxCnt = 3;
+    const int nLstBoxCnt = 3;
     ListBox* aLstArr[ nLstBoxCnt ] = { m_pTypDLB1, m_pTypDLB2, m_pTypDLB3 };
     sal_uInt16* aTypeArr[ nLstBoxCnt ] = { &nType1, &nType2, &nType3 };
     OUString aOldStrArr[ nLstBoxCnt ];
-    sal_uInt16 n;
 
-    void* pUserData;
-    for( n = 0; n < nLstBoxCnt; ++n )
+    for( int n = 0; n < nLstBoxCnt; ++n )
     {
         ListBox* pL = aLstArr[ n ];
-        if( 0 != (pUserData = pL->GetEntryData( pL->GetSelectEntryPos())) )
+        void* pUserData = pL->GetEntryData( pL->GetSelectEntryPos() );
+        if (pUserData)
             aOldStrArr[ n ] = *(OUString*)pUserData;
         ::lcl_ClearLstBoxAndDelUserData( *pL );
     }
 
-    sal_uInt16 nInsPos;
     OUString sAlg, sUINm;
-    for( long nCnt = 0, nEnd = aSeq.getLength(); nCnt <= nEnd; ++nCnt )
+    const sal_Int32 nEnd = aSeq.getLength();
+    for( sal_Int32 nCnt = 0; nCnt <= nEnd; ++nCnt )
     {
         if( nCnt < nEnd )
             sUINm = pColRes->GetTranslation( sAlg = aSeq[ nCnt ] );
         else
             sUINm = sAlg = aNumericTxt;
 
-        for( n = 0; n < nLstBoxCnt; ++n )
+        for( int n = 0; n < nLstBoxCnt; ++n )
         {
             ListBox* pL = aLstArr[ n ];
-            nInsPos = pL->InsertEntry( sUINm );
+            const sal_Int32 nInsPos = pL->InsertEntry( sUINm );
             pL->SetEntryData( nInsPos, new OUString( sAlg ));
             if( pLBox && sAlg == aOldStrArr[ n ] )
                 pL->SelectEntryPos( nInsPos );
         }
     }
 
-    for( n = 0; n < nLstBoxCnt; ++n )
+    for( int n = 0; n < nLstBoxCnt; ++n )
     {
         ListBox* pL = aLstArr[ n ];
         if( !pLBox )
commit ae3d2a5511baed6e4fd985c3742b010012788d3a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Mar 19 22:37:40 2014 +0100

    sal_uInt16 to sal_Int32, reduce scopes, constify
    
    Change-Id: Idc283b9e9ebb2e1745c4bad54a27db3e73712bbc

diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 4b1383b..396448c 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -393,10 +393,8 @@ sal_Bool  SwFormatTablePage::FillItemSet( SfxItemSet& rCoreSet )
             m_pTopMF->GetText() != m_pTopMF->GetSavedValue() )
         {
             SvxULSpaceItem aULSpace(RES_UL_SPACE);
-            aULSpace.SetUpper( (sal_uInt16) m_pTopMF->Denormalize(
-                                        m_pTopMF->GetValue( FUNIT_TWIP )));
-            aULSpace.SetLower( (sal_uInt16) m_pBottomMF->Denormalize(
-                                        m_pBottomMF->GetValue( FUNIT_TWIP )));
+            aULSpace.SetUpper( m_pTopMF->Denormalize(m_pTopMF->GetValue( FUNIT_TWIP )));
+            aULSpace.SetLower( m_pBottomMF->Denormalize(m_pBottomMF->GetValue( FUNIT_TWIP )));
             rCoreSet.Put(aULSpace);
         }
 
@@ -407,14 +405,16 @@ sal_Bool  SwFormatTablePage::FillItemSet( SfxItemSet& rCoreSet )
         bModified = sal_True;
     }
 
-    sal_uInt16 nPos;
-    if( m_pTextDirectionLB->IsVisible() &&
-        ( nPos = m_pTextDirectionLB->GetSelectEntryPos() ) !=
-                                            m_pTextDirectionLB->GetSavedValue() )
+    if( m_pTextDirectionLB->IsVisible() )
     {
-        sal_uInt32 nDirection = (sal_uInt32)(sal_uIntPtr)m_pTextDirectionLB->GetEntryData( nPos );
-        rCoreSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR));
-        bModified = sal_True;
+        const sal_Int32 nPos = m_pTextDirectionLB->GetSelectEntryPos();
+        if ( nPos != m_pTextDirectionLB->GetSavedValue() )
+        {
+            const sal_uInt32 nDirection =
+                             (sal_uInt32)(sal_uIntPtr)m_pTextDirectionLB->GetEntryData( nPos );
+            rCoreSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR));
+            bModified = sal_True;
+        }
     }
 
     return bModified;
@@ -555,7 +555,7 @@ void  SwFormatTablePage::Reset( const SfxItemSet& )
     if( SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, true, &pItem ) )
     {
         sal_uIntPtr nVal  = ((SvxFrameDirectionItem*)pItem)->GetValue();
-        sal_uInt16 nPos = m_pTextDirectionLB->GetEntryPos( (void*) nVal );
+        const sal_Int32 nPos = m_pTextDirectionLB->GetEntryPos( (void*) nVal );
         m_pTextDirectionLB->SelectEntryPos( nPos );
         m_pTextDirectionLB->SaveValue();
     }
@@ -626,7 +626,7 @@ int  SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
             if (m_pRelWidthCB->IsChecked() && m_pRelWidthCB->IsEnabled())
             {
                 lWidth = pTblData->GetSpace() - lRight - lLeft;
-                sal_uInt16 nPercentWidth = (sal_uInt16)m_aWidthMF.GetValue(FUNIT_CUSTOM);
+                const sal_uInt16 nPercentWidth = m_aWidthMF.GetValue(FUNIT_CUSTOM);
                 if(pTblData->GetWidthPercent() != nPercentWidth)
                 {
                     pTblData->SetWidthPercent(nPercentWidth);
@@ -641,9 +641,8 @@ int  SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
             pTblData->SetWidth(lWidth);
 
             SwTwips nColSum = 0;
-            sal_uInt16 i;
 
-            for( i = 0; i < pTblData->GetColCount(); i++)
+            for( sal_uInt16 i = 0; i < pTblData->GetColCount(); i++)
             {
                 nColSum += pTblData->GetColumns()[i].nWidth;
             }
@@ -656,7 +655,7 @@ int  SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
                 while ( std::abs(nDiff) > pTblData->GetColCount() + 1 )
                 {
                     SwTwips nSub = nDiff / pTblData->GetColCount();
-                    for( i = 0; i < pTblData->GetColCount(); i++)
+                    for( sal_uInt16 i = 0; i < pTblData->GetColCount(); i++)
                     {
                         if(pTblData->GetColumns()[i].nWidth - nMinWidth > nSub)
                         {
@@ -773,15 +772,14 @@ void  SwTableColumnPage::Reset( const SfxItemSet& )
                             pTblData->GetAlign() != text::HoriOrientation::LEFT_AND_WIDTH?
                         pTblData->GetWidth() : pTblData->GetSpace();
 
-        sal_uInt16 i;
-        for( i = 0; i < nNoOfCols; i++ )
+        for( sal_uInt16 i = 0; i < nNoOfCols; i++ )
         {
             if( pTblData->GetColumns()[i].nWidth  < nMinWidth )
                     nMinWidth = pTblData->GetColumns()[i].nWidth;
         }
         sal_Int64 nMinTwips = m_aFieldArr[0].NormalizePercent( nMinWidth );
         sal_Int64 nMaxTwips = m_aFieldArr[0].NormalizePercent( nTableWidth );
-        for( i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
+        for( sal_uInt16 i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
         {
             m_aFieldArr[i].SetPrcntValue( m_aFieldArr[i].NormalizePercent(
                                                 GetVisibleWidth(i) ), FUNIT_TWIP );
@@ -793,12 +791,11 @@ void  SwTableColumnPage::Reset( const SfxItemSet& )
 
         if( nNoOfVisibleCols > MET_FIELDS )
             m_pUpBtn->Enable();
-        i = nNoOfVisibleCols;
-        while( i < MET_FIELDS )
+
+        for( sal_uInt16 i = nNoOfVisibleCols; i < MET_FIELDS; ++i )
         {
             m_aFieldArr[i].SetText( OUString() );
             m_pTextArr[i]->Disable();
-            i++;
         }
     }
     ActivatePage(rSet);
@@ -928,7 +925,6 @@ sal_Bool  SwTableColumnPage::FillItemSet( SfxItemSet& )
 void   SwTableColumnPage::ModifyHdl( MetricField* pField )
 {
         PercentField *pEdit = NULL;
-        sal_uInt16 nAktPos;
         sal_uInt16 i;
 
         for( i = 0; i < MET_FIELDS; i++)
@@ -947,17 +943,15 @@ void   SwTableColumnPage::ModifyHdl( MetricField* pField )
         }
 
         SetVisibleWidth(aValueTbl[i], static_cast< SwTwips >(pEdit->DenormalizePercent(pEdit->GetValue( FUNIT_TWIP ))) );
-        nAktPos = aValueTbl[i];
 
-        UpdateCols( nAktPos );
+        UpdateCols( aValueTbl[i] );
 };
 
 void   SwTableColumnPage::UpdateCols( sal_uInt16 nAktPos )
 {
     SwTwips nSum = 0;
-    sal_uInt16 i;
 
-    for( i = 0; i < nNoOfCols; i++ )
+    for( sal_uInt16 i = 0; i < nNoOfCols; i++ )
     {
         nSum += (pTblData->GetColumns())[i].nWidth;
     }
@@ -1035,7 +1029,7 @@ void   SwTableColumnPage::UpdateCols( sal_uInt16 nAktPos )
             nDiff = nAdd;
         }
         if(nAdd)
-            for(i = 0; i < nNoOfVisibleCols; i++ )
+            for( sal_uInt16 i = 0; i < nNoOfVisibleCols; i++ )
             {
                 if(i == nAktPos)
                     continue;
@@ -1058,7 +1052,7 @@ void   SwTableColumnPage::UpdateCols( sal_uInt16 nAktPos )
     if(!bPercentMode)
         m_pSpaceED->SetValue(m_pSpaceED->Normalize( pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
 
-    for( i = 0; ( i < nNoOfVisibleCols ) && ( i < MET_FIELDS ); i++)
+    for( sal_uInt16 i = 0; ( i < nNoOfVisibleCols ) && ( i < MET_FIELDS ); i++)
     {
         m_aFieldArr[i].SetPrcntValue(m_aFieldArr[i].NormalizePercent(
                         GetVisibleWidth(aValueTbl[i]) ), FUNIT_TWIP);
@@ -1075,7 +1069,7 @@ void    SwTableColumnPage::ActivatePage( const SfxItemSet& )
         m_aFieldArr[i].ShowPercent( bPercentMode );
     }
 
-    sal_uInt16 nTblAlign = pTblData->GetAlign();
+    const sal_uInt16 nTblAlign = pTblData->GetAlign();
     if((text::HoriOrientation::FULL != nTblAlign && nTableWidth != pTblData->GetWidth()) ||
     (text::HoriOrientation::FULL == nTblAlign && nTableWidth != pTblData->GetSpace()))
     {
@@ -1448,16 +1442,15 @@ void   SwTextFlowPage::Reset( const SfxItemSet& rSet )
     {
         //Inserting of the existing page templates in the list box
         const sal_uInt16 nCount = pShell->GetPageDescCnt();
-        sal_uInt16 i;
 
-        for( i = 0; i < nCount; ++i)
+        for( sal_uInt16 i = 0; i < nCount; ++i)
         {
             const SwPageDesc &rPageDesc = pShell->GetPageDesc(i);
             m_pPageCollLB->InsertEntry(rPageDesc.GetName());
         }
 
         OUString aFmtName;
-        for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i)
+        for(sal_uInt16 i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i)
             if( LISTBOX_ENTRY_NOTFOUND == m_pPageCollLB->GetEntryPos(
                     aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ) ))
                 m_pPageCollLB->InsertEntry( aFmtName );
commit a46c4bf3c2454f81b4889e86c50ff901192b1bd7
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Mar 19 21:51:05 2014 +0100

    sal_uInt16 to size_t/long
    
    Change-Id: I9284ef8c51f9639ad4f7c0c4b4f65019a4ca524b

diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 5b134fd..63a453c 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -297,7 +297,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl)
 
             if ( !aFormatName.isEmpty() )
             {
-                sal_uInt16 n;
+                size_t n;
                 for( n = 0; n < pTableTbl->size(); ++n )
                     if( (*pTableTbl)[n].GetName() == aFormatName )
                         break;
@@ -396,7 +396,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
 
             if ( !aFormatName.isEmpty() )
             {
-                sal_uInt16 n;
+                size_t n;
                 for( n = 0; n < pTableTbl->size(); ++n )
                     if ((*pTableTbl)[n].GetName() == aFormatName)
                         break;
@@ -668,7 +668,7 @@ MAKENUMSTR:
         sal_uInt8           nFmtIndex       = GetFormatIndex( nCol, nRow );
         Rectangle           cellRect        = maArray.GetCellRect( nCol, nRow );
         Point               aPos            = cellRect.TopLeft();
-        sal_uInt16          nRightX         = 0;
+        long                nRightX         = 0;
 
         Size theMaxStrSize( cellRect.GetWidth() - FRAME_OFFSET,
                             cellRect.GetHeight() - FRAME_OFFSET );
@@ -702,20 +702,16 @@ MAKENUMSTR:
             aStrSize = aScriptedText.GetTextSize();
         }
 
-        nRightX  = (sal_uInt16)(  cellRect.GetWidth()
-                                - aStrSize.Width()
-                                - FRAME_OFFSET );
+        nRightX = cellRect.GetWidth() - aStrSize.Width() - FRAME_OFFSET;
 
         // vertical (always centering):
-        aPos.Y() += (nRowHeight - (sal_uInt16)aStrSize.Height()) / 2;
+        aPos.Y() += (nRowHeight - aStrSize.Height()) / 2;
 
         // horizontal
         if( mbRTL )
             aPos.X() += nRightX;
         else if (aCurData.IsJustify())
         {
-            sal_uInt16 nHorPos = (sal_uInt16)
-                    ((cellRect.GetWidth()-aStrSize.Width())/2);
             const SvxAdjustItem& rAdj = aCurData.GetBoxFmt(nFmtIndex).GetAdjust();
             switch ( rAdj.GetAdjust() )
             {
@@ -726,7 +722,7 @@ MAKENUMSTR:
                     aPos.X() += nRightX;
                     break;
                 default:
-                    aPos.X() += nHorPos;
+                    aPos.X() += (cellRect.GetWidth() - aStrSize.Width())/2;
                     break;
             }
         }
commit c7363cb6d1d31f2a7d40a76e62b5934629a1a8a1
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Mar 19 20:57:54 2014 +0100

    sal_uInt16 to sal_Int32 and remove OUString temporaries
    
    Change-Id: I476fb65a1e55db084bb12e61e6d3d9ccf3a41637

diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx
index 7aaa56b..c718024 100644
--- a/sw/source/ui/utlui/swrenamexnameddlg.cxx
+++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx
@@ -93,11 +93,11 @@ IMPL_LINK(SwRenameXNamedDlg, ModifyHdl, NoSpaceEdit*, pEdit)
     OUString sTmp(pEdit->GetText());
 
     // prevent from pasting illegal characters
-    sal_uInt16 nLen = sTmp.getLength();
+    const sal_Int32 nLen = sTmp.getLength();
     OUString sMsg;
-    for(sal_uInt16 i = 0; i < pEdit->GetForbiddenChars().getLength(); i++)
+    for(sal_Int32 i = 0; i < pEdit->GetForbiddenChars().getLength(); ++i)
     {
-        sal_uInt16 nTmpLen = sTmp.getLength();
+        const sal_Int32 nTmpLen = sTmp.getLength();
         sTmp = comphelper::string::remove(sTmp, pEdit->GetForbiddenChars()[i]);
         if(sTmp.getLength() != nTmpLen)
             sMsg += OUString(pEdit->GetForbiddenChars()[i]);
@@ -105,9 +105,7 @@ IMPL_LINK(SwRenameXNamedDlg, ModifyHdl, NoSpaceEdit*, pEdit)
     if(sTmp.getLength() != nLen)
     {
         pEdit->SetText(sTmp);
-        OUString sWarning(m_sRemoveWarning);
-        sWarning += sMsg;
-        InfoBox(this, sWarning).Execute();
+        InfoBox(this, m_sRemoveWarning + sMsg).Execute();
     }
 
     m_pOk->Enable(!sTmp.isEmpty()
commit 4c2393eae69902107febc62161fd842fdea953c4
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Mar 19 20:42:14 2014 +0100

    sal_uInt16 to size_t and optimizations
    
    Removed unneeded casts, adapted cycles, reduced scope...
    
    Change-Id: I1781a9d4c42bd6b85f16e9573d0bc2b201084646

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 65cf7c5..94a9f20 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -701,8 +701,8 @@ public:
     sal_uInt16 GetCurColNum( SwGetCurColNumPara* pPara = 0 ) const; //0 == not in any column.
     sal_uInt16 GetCurMouseColNum( const Point &rPt,
                             SwGetCurColNumPara* pPara = 0 ) const;
-    sal_uInt16 GetCurTabColNum() const;     //0 == not in any table.
-    sal_uInt16 GetCurMouseTabColNum( const Point &rPt ) const;
+    size_t GetCurTabColNum() const;     //0 == not in any table.
+    size_t GetCurMouseTabColNum( const Point &rPt ) const;
     sal_uInt16 GetCurOutColNum( SwGetCurColNumPara* pPara = 0 ) const;  ///< Current outer column.
 
     sal_Bool IsTableRightToLeft() const;
diff --git a/sw/inc/tabcol.hxx b/sw/inc/tabcol.hxx
index 270a834..b124658 100644
--- a/sw/inc/tabcol.hxx
+++ b/sw/inc/tabcol.hxx
@@ -60,19 +60,19 @@ public:
     SwTabCols( const SwTabCols& );
     SwTabCols &operator=( const SwTabCols& );
     bool operator==( const SwTabCols& rCmp ) const;
-    long& operator[]( sal_uInt16 nPos ) { return aData[nPos].nPos; }
-    long operator[]( sal_uInt16 nPos ) const { return aData[nPos].nPos; }
-    sal_uInt16 Count() const { return sal::static_int_cast< sal_uInt16 >(aData.size()); }
+    long& operator[]( size_t nPos ) { return aData[nPos].nPos; }
+    long operator[]( size_t nPos ) const { return aData[nPos].nPos; }
+    size_t Count() const { return aData.size(); }
 
-    sal_Bool IsHidden( sal_uInt16 nPos ) const         { return aData[nPos].bHidden; }
-    void SetHidden( sal_uInt16 nPos, sal_Bool bValue ) { aData[nPos].bHidden = bValue; }
+    sal_Bool IsHidden( size_t nPos ) const         { return aData[nPos].bHidden; }
+    void SetHidden( size_t nPos, sal_Bool bValue ) { aData[nPos].bHidden = bValue; }
 
-    void Insert( long nValue, sal_Bool bValue, sal_uInt16 nPos );
-    void Insert( long nValue, long nMin, long nMax, sal_Bool bValue, sal_uInt16 nPos );
-    void Remove( sal_uInt16 nPos, sal_uInt16 nAnz = 1 );
+    void Insert( long nValue, sal_Bool bValue, size_t nPos );
+    void Insert( long nValue, long nMin, long nMax, sal_Bool bValue, size_t nPos );
+    void Remove( size_t nPos, size_t nAnz = 1 );
 
-    const SwTabColsEntry& GetEntry( sal_uInt16 nPos ) const { return aData[nPos]; }
-          SwTabColsEntry& GetEntry( sal_uInt16 nPos )  { return aData[nPos]; }
+    const SwTabColsEntry& GetEntry( size_t nPos ) const { return aData[nPos]; }
+          SwTabColsEntry& GetEntry( size_t nPos )  { return aData[nPos]; }
 
     long GetLeftMin() const { return nLeftMin; }
     long GetLeft()  const { return nLeft;    }
diff --git a/sw/source/core/bastyp/tabcol.cxx b/sw/source/core/bastyp/tabcol.cxx
index 9375daa..fcca7e2 100644
--- a/sw/source/core/bastyp/tabcol.cxx
+++ b/sw/source/core/bastyp/tabcol.cxx
@@ -41,7 +41,7 @@ SwTabCols::SwTabCols( const SwTabCols& rCpy ) :
     aData( rCpy.GetData() )
 {
 #if OSL_DEBUG_LEVEL > 0
-    for ( sal_uInt16 i = 0; i < Count(); ++i )
+    for ( size_t i = 0; i < Count(); ++i )
     {
         SwTabColsEntry aEntry1 = aData[i];
         SwTabColsEntry aEntry2 = rCpy.GetData()[i];
@@ -72,8 +72,6 @@ SwTabCols &SwTabCols::operator=( const SwTabCols& rCpy )
 
 bool SwTabCols::operator==( const SwTabCols& rCmp ) const
 {
-    sal_uInt16 i;
-
     if ( !(nLeftMin == rCmp.GetLeftMin() &&
            nLeft    == rCmp.GetLeft()    &&
            nRight   == rCmp.GetRight()   &&
@@ -82,7 +80,7 @@ bool SwTabCols::operator==( const SwTabCols& rCmp ) const
            Count()== rCmp.Count()) )
         return false;
 
-    for ( i = 0; i < Count(); ++i )
+    for ( size_t i = 0; i < Count(); ++i )
     {
         SwTabColsEntry aEntry1 = aData[i];
         SwTabColsEntry aEntry2 = rCmp.GetData()[i];
@@ -94,7 +92,7 @@ bool SwTabCols::operator==( const SwTabCols& rCmp ) const
 }
 
 void SwTabCols::Insert( long nValue, long nMin, long nMax,
-                        sal_Bool bValue, sal_uInt16 nPos )
+                        sal_Bool bValue, size_t nPos )
 {
     SwTabColsEntry aEntry;
     aEntry.nPos = nValue;
@@ -104,7 +102,7 @@ void SwTabCols::Insert( long nValue, long nMin, long nMax,
     aData.insert( aData.begin() + nPos, aEntry );
 }
 
-void SwTabCols::Insert( long nValue, sal_Bool bValue, sal_uInt16 nPos )
+void SwTabCols::Insert( long nValue, sal_Bool bValue, size_t nPos )
 {
     SwTabColsEntry aEntry;
     aEntry.nPos = nValue;
@@ -122,7 +120,7 @@ void SwTabCols::Insert( long nValue, sal_Bool bValue, sal_uInt16 nPos )
 #endif
 }
 
-void SwTabCols::Remove( sal_uInt16 nPos, sal_uInt16 nAnz )
+void SwTabCols::Remove( size_t nPos, size_t nAnz )
 {
     SwTabColsEntries::iterator aStart = aData.begin() + nPos;
     aData.erase( aStart, aStart + nAnz );
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 9223c7d..317c9e6 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2655,7 +2655,7 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* ,
     }
 
     // transfer calculated values from BoundaryMap and HiddenMap into rFill:
-    sal_uInt16 nIdx = 0;
+    size_t nIdx = 0;
     for ( aIter = aBoundaries.begin(); aIter != aBoundaries.end(); ++aIter )
     {
         const long nTabTop = (pTab->*fnRect->fnGetPrtTop)();
@@ -2793,14 +2793,14 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCur
     GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_ATTR, NULL );
 
     // check for differences between aOld and rNew:
-    const sal_uInt16 nCount = rNew.Count();
+    const size_t nCount = rNew.Count();
     const SwTable* pTable = pTab->GetTable();
     OSL_ENSURE( pTable, "My colleague told me, this couldn't happen" );
 
-    for ( sal_uInt16 i = 0; i <= nCount; ++i )
+    for ( size_t i = 0; i <= nCount; ++i )
     {
-        const sal_uInt16 nIdxStt = bVert ? nCount - i : i - 1;
-        const sal_uInt16 nIdxEnd = bVert ? nCount - i - 1 : i;
+        const size_t nIdxStt = bVert ? nCount - i : i - 1;
+        const size_t nIdxEnd = bVert ? nCount - i - 1 : i;
 
         const long nOldRowStart = i == 0  ? 0 : aOld[ nIdxStt ];
         const long nOldRowEnd =   i == nCount ? aOld.GetRight() : aOld[ nIdxEnd ];
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 08bad4c..744dafe 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -1305,7 +1305,7 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC
 
     SWRECTFN( pTab )
 
-    for ( sal_uInt16 i = 0 ; i <= rCols.Count(); ++i )
+    for ( size_t i = 0 ; i <= rCols.Count(); ++i )
     {
         long nColLeft  = i == 0             ? rCols.GetLeft()  : rCols[i-1];
         long nColRight = i == rCols.Count() ? rCols.GetRight() : rCols[i];
@@ -1313,7 +1313,7 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC
         nColRight += rCols.GetLeftMin();
 
         // Adapt values to the proportions of the Table (Follows)
-        if ( rCols.GetLeftMin() !=  sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) )
+        if ( rCols.GetLeftMin() != (pTab->Frm().*fnRect->fnGetLeft)() )
         {
             const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin();
             nColLeft  += nDiff;
@@ -1383,7 +1383,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols
 
                 bool bNotInCols = true;
 
-                for ( sal_uInt16 i = 0; i <= rCols.Count(); ++i )
+                for ( size_t i = 0; i <= rCols.Count(); ++i )
                 {
                     sal_uInt16 nFit = rToFill[i];
                     long nColLeft  = i == 0             ? rCols.GetLeft()  : rCols[i-1];
@@ -1467,8 +1467,6 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
     std::vector<sal_uInt16> aWish(aTabCols.Count() + 1);
     std::vector<sal_uInt16> aMins(aTabCols.Count() + 1);
 
-    sal_uInt16 i;
-
     ::lcl_CalcColValues( aWish, aTabCols, pStart, pEnd, sal_True  );
 
     // It's more robust if we calculate the minimum values for the whole Table
@@ -1485,27 +1483,27 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
         // We add up the current values, divide the result by their
         // count and get a desired value for balancing.
         sal_uInt16 nWish = 0, nCnt = 0;
-        for ( i = 0; i <= aTabCols.Count(); ++i )
+        for ( size_t i = 0; i <= aTabCols.Count(); ++i )
         {
             int nDiff = aWish[i];
             if ( nDiff )
             {
                 if ( i == 0 )
-                    nWish = static_cast<sal_uInt16>( nWish + aTabCols[i] - aTabCols.GetLeft() );
+                    nWish += aTabCols[i] - aTabCols.GetLeft();
                 else if ( i == aTabCols.Count() )
-                    nWish = static_cast<sal_uInt16>(nWish + aTabCols.GetRight() - aTabCols[i-1] );
+                    nWish += aTabCols.GetRight() - aTabCols[i-1];
                 else
-                    nWish = static_cast<sal_uInt16>(nWish + aTabCols[i] - aTabCols[i-1] );
+                    nWish += aTabCols[i] - aTabCols[i-1];
                 ++nCnt;
             }
         }
-        nWish = nWish / nCnt;
-        for ( i = 0; i < aWish.size(); ++i )
+        nWish /= nCnt;
+        for ( size_t i = 0; i < aWish.size(); ++i )
             if ( aWish[i] )
                 aWish[i] = nWish;
     }
 
-    const sal_uInt16 nOldRight = static_cast<sal_uInt16>(aTabCols.GetRight());
+    const long nOldRight = aTabCols.GetRight();
 
     // In order to make the implementation easier, but still use the available
     // space properly, we do this twice.
@@ -1516,7 +1514,7 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
     // the Table's width to exceed the maximum width.
     for ( sal_uInt16 k = 0; k < 2; ++k )
     {
-        for ( i = 0; i <= aTabCols.Count(); ++i )
+        for ( size_t i = 0; i <= aTabCols.Count(); ++i )
         {
             int nDiff = aWish[i];
             if ( nDiff )
@@ -1547,14 +1545,14 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
                     nDiff     -= nTmpD;
                     nTabRight -= nTmpD;
                 }
-                for ( sal_uInt16 i2 = i; i2 < aTabCols.Count(); ++i2 )
+                for ( size_t i2 = i; i2 < aTabCols.Count(); ++i2 )
                     aTabCols[i2] += nDiff;
                 aTabCols.SetRight( nTabRight );
             }
         }
     }
 
-    const sal_uInt16 nNewRight = static_cast<sal_uInt16>(aTabCols.GetRight());
+    const long nNewRight = aTabCols.GetRight();
 
     SwFrmFmt *pFmt = pTblNd->GetTable().GetFrmFmt();
     const sal_Int16 nOriHori = pFmt->GetHoriOrient().GetHoriOrient();
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index dcf268a..2d0227b 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1372,10 +1372,10 @@ sal_Bool SwFEShell::DeleteTblSel()
 |*  SwFEShell::GetCurTabColNum()
 |*
 |*************************************************************************/
-sal_uInt16 SwFEShell::GetCurTabColNum() const
+size_t SwFEShell::GetCurTabColNum() const
 {
     //!!!GetCurMouseTabColNum() mitpflegen!!!!
-    sal_uInt16 nRet = 0;
+    size_t nRet = 0;
 
     SwFrm *pFrm = GetCurrFrm();
     OSL_ENSURE( pFrm, "Crsr parked?" );
@@ -1404,7 +1404,7 @@ sal_uInt16 SwFEShell::GetCurTabColNum() const
             if ( !::IsSame( nX, nRight ) )
             {
                 nX = nRight - nX + aTabCols.GetLeft();
-                for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
+                for ( size_t i = 0; i < aTabCols.Count(); ++i )
                     if ( ::IsSame( nX, aTabCols[i] ) )
                     {
                         nRet = i + 1;
@@ -1421,7 +1421,7 @@ sal_uInt16 SwFEShell::GetCurTabColNum() const
 
             if ( !::IsSame( nX, nLeft + aTabCols.GetLeft() ) )
             {
-                for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
+                for ( size_t i = 0; i < aTabCols.Count(); ++i )
                     if ( ::IsSame( nX, nLeft + aTabCols[i] ) )
                     {
                         nRet = i + 1;
@@ -2124,10 +2124,10 @@ sal_uInt16 SwFEShell::GetCurMouseColNum( const Point &rPt,
     return _GetCurColNum( GetBox( rPt ), pPara );
 }
 
-sal_uInt16 SwFEShell::GetCurMouseTabColNum( const Point &rPt ) const
+size_t SwFEShell::GetCurMouseTabColNum( const Point &rPt ) const
 {
     //!!!GetCurTabColNum() mitpflegen!!!!
-    sal_uInt16 nRet = 0;
+    size_t nRet = 0;
 
     const SwFrm *pFrm = GetBox( rPt );
     OSL_ENSURE( pFrm, "Table not found" );
@@ -2143,7 +2143,7 @@ sal_uInt16 SwFEShell::GetCurMouseTabColNum( const Point &rPt ) const
 
         if ( !::IsSame( nX, nLeft + aTabCols.GetLeft() ) )
         {
-            for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
+            for ( size_t i = 0; i < aTabCols.Count(); ++i )
                 if ( ::IsSame( nX, nLeft + aTabCols[i] ) )
                 {
                     nRet = i + 1;
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 6edee7b..a55b9a5 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -427,11 +427,11 @@ void SwTable::AdjustWidths( const long nOld, const long nNew )
 |*  SwTable::GetTabCols()
 |*
 |*************************************************************************/
-static void lcl_RefreshHidden( SwTabCols &rToFill, sal_uInt16 nPos )
+static void lcl_RefreshHidden( SwTabCols &rToFill, size_t nPos )
 {
-    for ( sal_uInt16 i = 0; i < rToFill.Count(); ++i )
+    for ( size_t i = 0; i < rToFill.Count(); ++i )
     {
-        if ( std::abs((long)(nPos - rToFill[i])) <= COLFUZZY )
+        if ( std::abs(static_cast<long>(nPos) - rToFill[i]) <= COLFUZZY )
         {
             rToFill.SetHidden( i, sal_False );
             break;
@@ -488,7 +488,7 @@ static void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox,
     }
 
     bool bInsert = !bRefreshHidden;
-    for ( sal_uInt16 j = 0; bInsert && (j < rToFill.Count()); ++j )
+    for ( size_t j = 0; bInsert && (j < rToFill.Count()); ++j )
     {
         long nCmp = rToFill[j];
         if ( (nPos >= ((nCmp >= COLFUZZY) ? nCmp - COLFUZZY : nCmp)) &&
@@ -516,7 +516,7 @@ static void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox,
         // check if nPos is entry:
         bool bFoundPos = false;
         bool bFoundMax = false;
-        for ( sal_uInt16 j = 0; !(bFoundPos && bFoundMax ) && j < rToFill.Count(); ++j )
+        for ( size_t j = 0; !(bFoundPos && bFoundMax ) && j < rToFill.Count(); ++j )
         {
             SwTabColsEntry& rEntry = rToFill.GetEntry( j );
             long nCmp = rToFill[j];
@@ -586,8 +586,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart,
     if ( bRefreshHidden )
     {
         // remove corrections
-        sal_uInt16 i;
-        for ( i = 0; i < rToFill.Count(); ++i )
+        for ( size_t i = 0; i < rToFill.Count(); ++i )
         {
             SwTabColsEntry& rEntry = rToFill.GetEntry( i );
             rEntry.nPos -= rToFill.GetLeft();
@@ -596,7 +595,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart,
         }
 
         // All are hidden, so add the visible ones.
-        for ( i = 0; i < rToFill.Count(); ++i )
+        for ( size_t i = 0; i < rToFill.Count(); ++i )
             rToFill.SetHidden( i, sal_True );
     }
     else
@@ -623,8 +622,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart,
     // 1.
     const SwTableBoxes &rBoxes = pStart->GetUpper()->GetTabBoxes();
 
-    sal_uInt16 i;
-    for ( i = 0; i < rBoxes.size(); ++i )
+    for ( size_t i = 0; i < rBoxes.size(); ++i )
         ::lcl_ProcessBoxGet( rBoxes[i], rToFill, pTabFmt, bRefreshHidden );
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list