[Libreoffice-commits] .: 3 commits - sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Wed Jul 27 01:31:39 PDT 2011


 sw/source/ui/dbui/addresslistdialog.cxx  |    8 +++----
 sw/source/ui/dbui/dbinsdlg.cxx           |   16 ++++++---------
 sw/source/ui/dbui/dbtree.cxx             |   14 +++++++------
 sw/source/ui/dbui/maildispatcher.cxx     |    4 +--
 sw/source/ui/dbui/mailmergehelper.cxx    |    4 +--
 sw/source/ui/dbui/mmaddressblockpage.cxx |    6 +++--
 sw/source/ui/dbui/mmconfigitem.cxx       |   10 ++++-----
 sw/source/ui/dbui/mmgreetingspage.cxx    |    2 -
 sw/source/ui/dbui/mmoutputpage.cxx       |   32 ++++++++++++++++++-------------
 sw/source/ui/utlui/content.cxx           |   16 +++++++--------
 10 files changed, 60 insertions(+), 52 deletions(-)

New commits:
commit 254c08bf5096e341a395ed55945fc1009b78e878
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 26 23:49:42 2011 +0100

    catch by const reference

diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index fc018d5..fe8262a 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -263,7 +263,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) :
                         SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577#
                         !SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL );
                 }
-                catch(const uno::Exception& )
+                catch (const uno::Exception&)
                 {
                     bEnableOK = sal_False;
                 }
@@ -345,7 +345,7 @@ IMPL_LINK(SwAddressListDialog, FilterHdl_Impl, PushButton*, EMPTYARG)
                 }
                 ::comphelper::disposeComponent(xRowSet);
             }
-            catch(Exception& )
+            catch (const Exception&)
             {
                 OSL_FAIL("exception caught in SwAddressListDialog::FilterHdl_Impl");
             }
@@ -448,7 +448,7 @@ IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton)
             m_aCreateListPB.Enable(sal_False);
 
         }
-        catch(Exception& )
+        catch (const Exception&)
         {
         }
     }
@@ -645,7 +645,7 @@ void SwAddressListDialog::DetectTablesAndQueries(
         m_aFilterPB.Enable( pUserData->xConnection.is() && sCommand.Len() );
         m_aTablePB.Enable( pUserData->nTableAndQueryCount > 1 );
     }
-    catch(Exception& )
+    catch (const Exception&)
     {
         OSL_FAIL("exception caught in SwAddressListDialog::DetectTablesAndQueries");
         m_aOK.Enable( sal_False );
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 2616491..991f196 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -352,7 +352,7 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
                                 }
                                 pNew->nDBNumFmt = nKey;
                             }
-                            catch(const Exception& )
+                            catch (const Exception&)
                             {
                                 OSL_FAIL("illegal number format key");
                             }
@@ -1097,7 +1097,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
                 else if(!i)
                     bBreak = !xResultSet->first();
             }
-            catch(const Exception& )
+            catch (const Exception&)
             {
                 bBreak = sal_True;
             }
@@ -1177,14 +1177,12 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
                         }
                     }
                 }
-                catch(Exception&
-#if OSL_DEBUG_LEVEL > 1
-                            aExcept
-#endif
-                )
+                catch (const Exception& rExcept)
                 {
 #if OSL_DEBUG_LEVEL > 1
-                    OSL_FAIL(ByteString(String(aExcept.Message), gsl_getSystemTextEncoding()).GetBuffer());
+                    OSL_FAIL(ByteString(String(rExcept.Message), gsl_getSystemTextEncoding()).GetBuffer());
+#else
+                    (void)rExcept;
 #endif
                 }
             }
@@ -1299,7 +1297,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
                     else if(!i)
                         bBreak = !xResultSet->first();
                 }
-                catch(Exception&)
+                catch (const Exception&)
                 {
                     bBreak = sal_True;
                 }
diff --git a/sw/source/ui/dbui/dbtree.cxx b/sw/source/ui/dbui/dbtree.cxx
index 3595e44..0f27ba6 100644
--- a/sw/source/ui/dbui/dbtree.cxx
+++ b/sw/source/ui/dbui/dbtree.cxx
@@ -314,8 +314,9 @@ void  SwDBTreeList::RequestingChilds(SvLBoxEntry* pParent)
                             aTable >>= xPropSet;
                             xColsSupplier = Reference<XColumnsSupplier>(xPropSet, UNO_QUERY);
                         }
-                        catch(Exception&)
-                        {}
+                        catch (const Exception&)
+                        {
+                        }
                     }
                 }
                 else
@@ -332,8 +333,9 @@ void  SwDBTreeList::RequestingChilds(SvLBoxEntry* pParent)
                             aQuery >>= xPropSet;
                             xColsSupplier = Reference<XColumnsSupplier>(xPropSet, UNO_QUERY);
                         }
-                        catch(Exception&)
-                        {}
+                        catch (const Exception&)
+                        {
+                        }
                     }
                 }
 
@@ -353,7 +355,7 @@ void  SwDBTreeList::RequestingChilds(SvLBoxEntry* pParent)
                     }
                 }
             }
-            catch(const Exception&)
+            catch (const Exception&)
             {
             }
         }
@@ -403,7 +405,7 @@ void  SwDBTreeList::RequestingChilds(SvLBoxEntry* pParent)
                     }
                 }
             }
-            catch(const Exception&)
+            catch (const Exception&)
             {
             }
         }
diff --git a/sw/source/ui/dbui/maildispatcher.cxx b/sw/source/ui/dbui/maildispatcher.cxx
index d2c9e28..8a1e5b5 100644
--- a/sw/source/ui/dbui/maildispatcher.cxx
+++ b/sw/source/ui/dbui/maildispatcher.cxx
@@ -232,12 +232,12 @@ void MailDispatcher::sendMailMessageNotifyListener(uno::Reference<mail::XMailMes
         MailDispatcherListenerContainer_t listeners_cloned(cloneListener());            
         std::for_each(listeners_cloned.begin(), listeners_cloned.end(), MailDeliveryNotifier(this, message));                   
     }
-    catch (mail::MailException& ex)
+    catch (const mail::MailException& ex)
     {            
         MailDispatcherListenerContainer_t listeners_cloned(cloneListener());            
         std::for_each(listeners_cloned.begin(), listeners_cloned.end(), MailDeliveryErrorNotifier(this, message, ex.Message));                   
     }
-    catch (uno::RuntimeException& ex)
+    catch (const uno::RuntimeException& ex)
     {   
         MailDispatcherListenerContainer_t listeners_cloned(cloneListener());            
         std::for_each(listeners_cloned.begin(), listeners_cloned.end(), MailDeliveryErrorNotifier(this, message, ex.Message));                   
diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx
index 4421ddc..7554ce7 100644
--- a/sw/source/ui/dbui/mailmergehelper.cxx
+++ b/sw/source/ui/dbui/mailmergehelper.cxx
@@ -173,7 +173,7 @@ uno::Reference< mail::XSmtpService > ConnectToSmtpServer(
             xSmtpServer->connect(xConnectionContext, xAuthenticator);
             rxInMailService = uno::Reference< mail::XMailService >( xSmtpServer, uno::UNO_QUERY );
         }
-        catch(uno::Exception& )
+        catch (const uno::Exception&)
         {
             OSL_FAIL("exception caught");
         }
@@ -539,7 +539,7 @@ String SwAddressPreview::FillData(
                             aItem.sText = sReplace;
                         }
                     }
-                    catch( sdbc::SQLException& )
+                    catch (const sdbc::SQLException&)
                     {
                         OSL_FAIL("SQLException caught");
                     }
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index ee2dc55..c785c96 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1057,13 +1057,15 @@ SwAssignFieldsControl::SwAssignFieldsControl(
             uno::Reference< XColumn > xColumn;
             aCol >>= xColumn;
             if(xColumn.is())
+            {
                 try
                 {
                     pNewPreview->SetText(xColumn->getString());
                 }
-                catch(SQLException& )
+                catch (const SQLException&)
                 {
                 }
+            }
         }
         if(!i)
         {
@@ -1198,7 +1200,7 @@ IMPL_LINK(SwAssignFieldsControl, MatchHdl_Impl, ListBox*, pBox)
             {
                 sPreview = xColumn->getString();
             }
-            catch( sdbc::SQLException& )
+            catch (const sdbc::SQLException&)
             {
             }
         }
diff --git a/sw/source/ui/dbui/mmconfigitem.cxx b/sw/source/ui/dbui/mmconfigitem.cxx
index 13cba5f..3937f15 100644
--- a/sw/source/ui/dbui/mmconfigitem.cxx
+++ b/sw/source/ui/dbui/mmconfigitem.cxx
@@ -928,7 +928,7 @@ Reference< XResultSet>   SwMailMergeConfigItem::GetResultSet() const
                     xRowProperties->setPropertyValue(C2U("ApplyFilter"), makeAny(m_pImpl->sFilter.getLength()>0));
                     xRowProperties->setPropertyValue(C2U("Filter"), makeAny(m_pImpl->sFilter));
                 }
-                catch(Exception&)
+                catch (const Exception&)
                 {
                     OSL_FAIL("exception caught in xResultSet->SetFilter()");
                 }
@@ -938,7 +938,7 @@ Reference< XResultSet>   SwMailMergeConfigItem::GetResultSet() const
                 m_pImpl->nResultSetCursorPos = 1;
             }
         }
-        catch(Exception& )
+        catch (const Exception&)
         {
             OSL_FAIL("exception caught in: SwMailMergeConfigItem::GetResultSet() ");
         }
@@ -976,7 +976,7 @@ void  SwMailMergeConfigItem::SetFilter(::rtl::OUString& rFilter)
                 uno::Reference<XRowSet> xRowSet( m_pImpl->xResultSet, UNO_QUERY_THROW );
                 xRowSet->execute();
             }
-            catch(Exception&)
+            catch (const Exception&)
             {
                 OSL_FAIL("exception caught in SwMailMergeConfigItem::SetFilter()");
             }
@@ -1011,7 +1011,7 @@ sal_Int32 SwMailMergeConfigItem::MoveResultSet(sal_Int32 nTarget)
                 m_pImpl->nResultSetCursorPos = m_pImpl->xResultSet->getRow();
             }
         }
-        catch(Exception&)
+        catch (const Exception&)
         {
         }
     }
@@ -1031,7 +1031,7 @@ bool SwMailMergeConfigItem::IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast)
             bIsLast = m_pImpl->xResultSet->isLast();
             bRet = true;
         }
-        catch(Exception&)
+        catch (const Exception&)
         {
         }
     }
diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx
index 165dfec..8820e81 100644
--- a/sw/source/ui/dbui/mmgreetingspage.cxx
+++ b/sw/source/ui/dbui/mmgreetingspage.cxx
@@ -208,7 +208,7 @@ void SwMailMergeGreetingsPage::UpdatePreview()
                         }
                     }
                 }
-                catch( sdbc::SQLException& )
+                catch (const sdbc::SQLException&)
                 {
                     OSL_FAIL("SQLException caught");
                 }
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 28c3f7b..7b82c00 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -693,11 +693,11 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
         {
             xStore->storeToURL( sPath, aValues );
         }
-        catch( task::ErrorCodeIOException& aErrorEx )
+        catch (const task::ErrorCodeIOException& rErrorEx)
         {
-            nErrorCode = (sal_uInt32)aErrorEx.ErrCode;
+            nErrorCode = (sal_uInt32)rErrorEx.ErrCode;
         }
-        catch( Exception& )
+        catch (const Exception&)
         {
             nErrorCode = ERRCODE_IO_GENERAL;
         }
@@ -745,11 +745,11 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
         {
             xStore->storeToURL( sTargetTempURL, aValues );
         }
-        catch( task::ErrorCodeIOException& aErrorEx )
+        catch (const task::ErrorCodeIOException& rErrorEx)
         {
-            nErrorCode = (sal_uInt32)aErrorEx.ErrCode;
+            nErrorCode = (sal_uInt32)rErrorEx.ErrCode;
         }
-        catch( Exception& )
+        catch (const Exception&)
         {
             nErrorCode = ERRCODE_IO_GENERAL;
         }
@@ -824,7 +824,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
                     uno::Reference< frame::XStorable > xTempStore( xTempDocShell->GetModel(), uno::UNO_QUERY);
                     xTempStore->storeToURL( sOutPath, aValues   );
                 }
-                catch( const uno::Exception& )
+                catch (const uno::Exception&)
                 {
                     bFailed = true;
                 }
commit 6e5e307f7cdd9e05d9c4e9d2cda71152dd75021c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 26 23:38:02 2011 +0100

    Related: fdo#35404 treat failed column same as non-existing column

diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 8a6eaab..28c3f7b 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -101,13 +101,19 @@ String lcl_GetExtensionForDocType(sal_uLong nDocType)
 ::rtl::OUString lcl_GetColumnValueOf(const ::rtl::OUString& rColumn, Reference < container::XNameAccess>& rxColAccess )
 {
     ::rtl::OUString sRet;
-    if(rxColAccess->hasByName(rColumn))
+    try
+    {
+        if (rxColAccess->hasByName(rColumn))
+        {
+            Any aCol = rxColAccess->getByName(rColumn);
+            Reference< sdb::XColumn > xColumn;
+            aCol >>= xColumn;
+            if(xColumn.is())
+                sRet = xColumn->getString();
+        }
+    }
+    catch (const uno::Exception&)
     {
-        Any aCol = rxColAccess->getByName(rColumn);
-        Reference< sdb::XColumn > xColumn;
-        aCol >>= xColumn;
-        if(xColumn.is())
-            sRet = xColumn->getString();
     }
     return sRet;
 }
commit 09e5f1e25ff00e35b02bbb41b20c8eb1a145b60d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 26 22:03:30 2011 +0100

    ByteString::CreateFromInt32->rtl::OStringBuffer::append

diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index a63193a..c78672d 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -3107,14 +3107,14 @@ void NaviContentBookmark::Copy( TransferDataContainer& rData ) const
 {
     rtl_TextEncoding eSysCSet = gsl_getSystemTextEncoding();
 
-    ByteString sStr( aUrl, eSysCSet );
-    sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
-    sStr += ByteString( aDescr, eSysCSet );
-    sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
-    sStr += ByteString::CreateFromInt32( nDefDrag );
-    sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
-    sStr += ByteString::CreateFromInt32( nDocSh );
-    rData.CopyByteString( SOT_FORMATSTR_ID_SONLK, sStr );
+    rtl::OStringBuffer sStrBuf(rtl::OUStringToOString(aUrl, eSysCSet));
+    sStrBuf.append(static_cast<char>(NAVI_BOOKMARK_DELIM));
+    sStrBuf.append(rtl::OUStringToOString(aDescr, eSysCSet));
+    sStrBuf.append(static_cast<char>(NAVI_BOOKMARK_DELIM));
+    sStrBuf.append(static_cast<sal_Int32>(nDefDrag));
+    sStrBuf.append(static_cast<char>(NAVI_BOOKMARK_DELIM));
+    sStrBuf.append(static_cast<sal_Int32>(nDocSh));
+    rData.CopyByteString(SOT_FORMATSTR_ID_SONLK, sStrBuf.makeStringAndClear());
 }
 
 sal_Bool NaviContentBookmark::Paste( TransferableDataHelper& rData )


More information about the Libreoffice-commits mailing list