summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-18 09:19:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-18 18:17:10 +0200
commitb138878a934be25183f4d2b3da437cc0035eb8b6 (patch)
tree7c59f6b4a906c1ba6a69631d17e399008bb4f06d /sw
parenta88e477346361665311eb2310e84023ce8a2fe59 (diff)
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@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx109
1 files changed, 15 insertions, 94 deletions
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)