[Libreoffice-commits] core.git: 2 commits - sfx2/source sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 18 16:18:00 UTC 2020
sfx2/source/inet/inettbc.cxx | 10 ---
sw/source/uibase/dbui/dbmgr.cxx | 109 +++++-----------------------------------
2 files changed, 15 insertions(+), 104 deletions(-)
New commits:
commit 64aa52d85fccaa9154c4fcb1686cc8a047ae4e2a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 18 15:56:50 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 18 18:17:19 2020 +0200
remove dead code
since
commit 5be98eba1fddb559194066c511b53412009c2d5d
Date: Thu Mar 27 10:29:38 2003 +0000
MWS_SRX644: migrate branch mws_srx644 -> HEAD
found by loplugin:unusedvarsglobal
Change-Id: I0184e9157caaa7d7d9d58ff20fb8d9293ab0d604
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100925
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index 17dd5de0b61c..822374bc1cc3 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -120,7 +120,6 @@ SvtURLBox* SfxURLToolBoxControl_Impl::GetURLBox() const
void SfxURLToolBoxControl_Impl::OpenURL( const OUString& rName ) const
{
OUString aName;
- OUString aFilter;
INetURLObject aObj( rName );
if ( aObj.GetProtocol() == INetProtocol::NotValid )
@@ -151,15 +150,6 @@ void SfxURLToolBoxControl_Impl::OpenURL( const OUString& rName ) const
aArgs[1].Name = "FileName";
aArgs[1].Value <<= aName;
- if ( !aFilter.isEmpty() )
- {
- aArgs.realloc( 4 );
- aArgs[2].Name = "FilterOptions";
- aArgs[2].Value <<= OUString();
- aArgs[3].Name = "FilterName";
- aArgs[3].Value <<= aFilter;
- }
-
SfxURLToolBoxControl_Impl::ExecuteInfo* pExecuteInfo = new SfxURLToolBoxControl_Impl::ExecuteInfo;
pExecuteInfo->xDispatch = xDispatch;
pExecuteInfo->aTargetURL = aTargetURL;
commit b138878a934be25183f4d2b3da437cc0035eb8b6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 18 09:19:12 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 18 18:17:10 2020 +0200
remove dead code in SwDBManager::ImportDBEntry
Found by loplugin:unusedvarsglobal
I traced this back to
commit 751a98ff97ba8e61d31e8d109c64f2172a820229
Date: Thu Sep 27 10:31:02 2007 +0000
INTEGRATION: CWS swwarnings (1.114.42); FILE MERGED
where the code looked like
uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
String sFormatStr( lcl_GetDBInsertMode( *pImpl->pMergeData ));
but lcl_GetDBInsertMode looked like
inline String lcl_GetDBInsertMode( const SwDBData& rData )
{
return aEmptyStr;
}
So I guess this is a remnant of some unimplemented feature
Change-Id: Ic058d8703d60c9829099daba4fed32c16a6e1589
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100894
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 7b6cc8578016..cf1150f72a55 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -125,11 +125,6 @@
using namespace ::com::sun::star;
using namespace sw;
-#define DB_SEP_SPACE 0
-#define DB_SEP_TAB 1
-#define DB_SEP_RETURN 2
-#define DB_SEP_NEWLINE 3
-
namespace {
void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 nStrId, SfxObjectShell* pDocShell)
@@ -595,37 +590,6 @@ void SwDBManager::ImportFromConnection( SwWrtShell* pSh )
pSh->EndAllAction();
}
-static OUString lcl_FindColumn(const OUString& sFormatStr,sal_uInt16 &nUsedPos, sal_uInt8 &nSeparator)
-{
- OUStringBuffer sReturn;
- sal_uInt16 nLen = sFormatStr.getLength();
- nSeparator = 0xff;
- while(nUsedPos < nLen && nSeparator == 0xff)
- {
- sal_Unicode cCurrent = sFormatStr[nUsedPos];
- switch(cCurrent)
- {
- case ',':
- nSeparator = DB_SEP_SPACE;
- break;
- case ';':
- nSeparator = DB_SEP_RETURN;
- break;
- case ':':
- nSeparator = DB_SEP_TAB;
- break;
- case '#':
- nSeparator = DB_SEP_NEWLINE;
- break;
- default:
- sReturn.append(cCurrent);
- }
- nUsedPos++;
-
- }
- return sReturn.makeStringAndClear();
-}
-
void SwDBManager::ImportDBEntry(SwWrtShell* pSh)
{
if(!m_pImpl->pMergeData || m_pImpl->pMergeData->bEndOfDB)
@@ -633,65 +597,22 @@ void SwDBManager::ImportDBEntry(SwWrtShell* pSh)
uno::Reference< sdbcx::XColumnsSupplier > xColsSupp( m_pImpl->pMergeData->xResultSet, uno::UNO_QUERY );
uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
- OUString sFormatStr;
- sal_uInt16 nFormatLen = sFormatStr.getLength();
- if( nFormatLen )
- {
- const char cSpace = ' ';
- const char cTab = '\t';
- sal_uInt16 nUsedPos = 0;
- sal_uInt8 nSeparator;
- OUString sColumn = lcl_FindColumn(sFormatStr, nUsedPos, nSeparator);
- while( !sColumn.isEmpty() )
- {
- if(!xCols->hasByName(sColumn))
- return;
- uno::Any aCol = xCols->getByName(sColumn);
- uno::Reference< beans::XPropertySet > xColumnProp;
- aCol >>= xColumnProp;
- if(xColumnProp.is())
- {
- SwDBFormatData aDBFormat;
- OUString sInsert = GetDBField( xColumnProp, aDBFormat);
- if( DB_SEP_SPACE == nSeparator )
- sInsert += OUStringChar(cSpace);
- else if( DB_SEP_TAB == nSeparator)
- sInsert += OUStringChar(cTab);
- pSh->Insert(sInsert);
- if( DB_SEP_RETURN == nSeparator)
- pSh->SplitNode();
- else if(DB_SEP_NEWLINE == nSeparator)
- pSh->InsertLineBreak();
- }
- else
- {
- // column not found -> show error
- OUString sInsert = "?" + sColumn + "?";
- pSh->Insert(sInsert);
- }
- sColumn = lcl_FindColumn(sFormatStr, nUsedPos, nSeparator);
- }
- pSh->SplitNode();
- }
- else
- {
- OUStringBuffer sStr;
- uno::Sequence<OUString> aColNames = xCols->getElementNames();
- const OUString* pColNames = aColNames.getConstArray();
- long nLength = aColNames.getLength();
- for(long i = 0; i < nLength; i++)
- {
- uno::Any aCol = xCols->getByName(pColNames[i]);
- uno::Reference< beans::XPropertySet > xColumnProp;
- aCol >>= xColumnProp;
- SwDBFormatData aDBFormat;
- sStr.append(GetDBField( xColumnProp, aDBFormat));
- if (i < nLength - 1)
- sStr.append("\t");
- }
- pSh->SwEditShell::Insert2(sStr.makeStringAndClear());
- pSh->SwFEShell::SplitNode(); // line feed
+ OUStringBuffer sStr;
+ uno::Sequence<OUString> aColNames = xCols->getElementNames();
+ const OUString* pColNames = aColNames.getConstArray();
+ long nLength = aColNames.getLength();
+ for(long i = 0; i < nLength; i++)
+ {
+ uno::Any aCol = xCols->getByName(pColNames[i]);
+ uno::Reference< beans::XPropertySet > xColumnProp;
+ aCol >>= xColumnProp;
+ SwDBFormatData aDBFormat;
+ sStr.append(GetDBField( xColumnProp, aDBFormat));
+ if (i < nLength - 1)
+ sStr.append("\t");
}
+ pSh->SwEditShell::Insert2(sStr.makeStringAndClear());
+ pSh->SwFEShell::SplitNode(); // line feed
}
bool SwDBManager::GetTableNames(weld::ComboBox& rBox, const OUString& rDBName)
More information about the Libreoffice-commits
mailing list