diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-04 12:29:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-04 13:15:41 +0000 |
commit | c1805c48ae6057d370a35f2e059f3ee82396c407 (patch) | |
tree | 2da65ded84bbcfee66db65a24f71750ceb5e77f3 /dbaccess/source/ui/misc | |
parent | 2dfc4c0845c72b3a1cf19546a1606907f36eea42 (diff) |
loplugin:oncevar in dbaccess
Change-Id: I956063bb354fbbd002e922bb06d0b3863a2750fc
Reviewed-on: https://gerrit.libreoffice.org/30565
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess/source/ui/misc')
-rw-r--r-- | dbaccess/source/ui/misc/TokenWriter.cxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/indexcollection.cxx | 19 |
3 files changed, 15 insertions, 32 deletions
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index cb7d8873356c..ba5e4b083079 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -74,11 +74,6 @@ using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::util; -const static char sMyBegComment[] = "<!-- "; -const static char sMyEndComment[] = " -->"; -const static char sFontFamily[] = "font-family: "; -const static char sFontSize[] = "font-size: "; - #define SBA_FORMAT_SELECTION_COUNT 4 #define CELL_X 1437 @@ -410,8 +405,6 @@ bool ORTFImportExport::Write() m_pStream->WriteCharPtr( ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}" ) .WriteCharPtr( SAL_NEWLINE_STRING ); - static char const aTRRH[] = "\\trrh-270\\pard\\intbl"; - static char const aFS[] = "\\fs20\\f0\\cf0\\cb2"; static char const aCell1[] = "\\clbrdrl\\brdrs\\brdrcf0\\clbrdrt\\brdrs\\brdrcf0\\clbrdrb\\brdrs\\brdrcf0\\clbrdrr\\brdrs\\brdrcf0\\clshdng10000\\clcfpat2\\cellx"; m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TRGAPH ); @@ -442,7 +435,7 @@ bool ORTFImportExport::Write() // column description m_pStream->WriteChar( '{' ).WriteCharPtr( SAL_NEWLINE_STRING ); - m_pStream->WriteCharPtr( aTRRH ); + m_pStream->WriteCharPtr( "\\trrh-270\\pard\\intbl" ); std::unique_ptr<OString[]> pHorzChar(new OString[nCount]); @@ -481,7 +474,7 @@ bool ORTFImportExport::Write() if ( bUnderline ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_UL ); if ( bStrikeout ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_STRIKE ); - m_pStream->WriteCharPtr( aFS ); + m_pStream->WriteCharPtr( "\\fs20\\f0\\cf0\\cb2" ); m_pStream->WriteChar( ' ' ); RTFOutFuncs::Out_String(*m_pStream,sColumnName,eDestEnc); @@ -546,7 +539,6 @@ void ORTFImportExport::appendRow(OString* pHorzChar,sal_Int32 _nColumnCount,sal_ m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ); static char const aCell2[] = "\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx"; - static char const aTRRH[] = "\\trrh-270\\pard\\intbl"; for ( sal_Int32 i=1; i<=_nColumnCount; ++i ) { @@ -562,7 +554,7 @@ void ORTFImportExport::appendRow(OString* pHorzChar,sal_Int32 _nColumnCount,sal_ Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY); m_pStream->WriteChar( '{' ); - m_pStream->WriteCharPtr( aTRRH ); + m_pStream->WriteCharPtr( "\\trrh-270\\pard\\intbl" ); for ( sal_Int32 i=1; i <= _nColumnCount; ++i ) { m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ); @@ -711,15 +703,15 @@ void OHTMLImportExport::WriteBody() IncIndent(1); m_pStream->WriteCharPtr( "<" ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_style ).WriteCharPtr( " " ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_type ).WriteCharPtr( "=\"text/css\">" ); - m_pStream->WriteCharPtr( sMyBegComment ); OUT_LF(); - m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteCharPtr( " { " ).WriteCharPtr( sFontFamily ).WriteChar( '"' ).WriteCharPtr( OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()).getStr() ).WriteChar( '\"' ); + m_pStream->WriteCharPtr( "<!-- " ); OUT_LF(); + m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteCharPtr( " { " ).WriteCharPtr( "font-family: " ).WriteChar( '"' ).WriteCharPtr( OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()).getStr() ).WriteChar( '\"' ); // TODO : think about the encoding of the font name - m_pStream->WriteCharPtr( "; " ).WriteCharPtr( sFontSize ); + m_pStream->WriteCharPtr( "; " ).WriteCharPtr( "font-size: " ); m_pStream->WriteInt32AsString(m_aFont.Height); m_pStream->WriteChar( '}' ); OUT_LF(); - m_pStream->WriteCharPtr( sMyEndComment ); + m_pStream->WriteCharPtr( " -->" ); IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_style ); OUT_LF(); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 35ba9385d185..f416675c298e 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -436,8 +436,6 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, // Information for a single SQL type if(xRs.is()) { - static const char aB1[] = " [ "; - static const char aB2[] = " ]"; Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY)->getMetaData(); ::connectivity::ORowSetValue aValue; ::std::vector<sal_Int32> aTypes; @@ -620,11 +618,11 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, if ( !aName.isEmpty() ) { pInfo->aUIName = aName; - pInfo->aUIName += aB1; + pInfo->aUIName += " [ "; } pInfo->aUIName += pInfo->aTypeName; if ( !aName.isEmpty() ) - pInfo->aUIName += aB2; + pInfo->aUIName += " ]"; // Now that we have the type info, save it in the multimap _rTypeInfoMap.insert(OTypeInfoMap::value_type(pInfo->nType,pInfo)); } diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx index b45dbd4df956..96e70108a69c 100644 --- a/dbaccess/source/ui/misc/indexcollection.cxx +++ b/dbaccess/source/ui/misc/indexcollection.cxx @@ -142,11 +142,9 @@ namespace dbaui } // set the properties - static const char s_sUniquePropertyName[] = "IsUnique"; - static const char s_sSortPropertyName[] = "IsAscending"; static const char s_sNamePropertyName[] = "Name"; // the index' own props - xIndexDescriptor->setPropertyValue(s_sUniquePropertyName, css::uno::makeAny(_rPos->bUnique)); + xIndexDescriptor->setPropertyValue("IsUnique", css::uno::makeAny(_rPos->bUnique)); xIndexDescriptor->setPropertyValue(s_sNamePropertyName, makeAny(_rPos->sName)); // the fields @@ -161,7 +159,7 @@ namespace dbaui OSL_ENSURE(xColDescriptor.is(), "OIndexCollection::commitNewIndex: invalid column descriptor!"); if (xColDescriptor.is()) { - xColDescriptor->setPropertyValue(s_sSortPropertyName, css::uno::makeAny(aFieldLoop->bSortAscending)); + xColDescriptor->setPropertyValue("IsAscending", css::uno::makeAny(aFieldLoop->bSortAscending)); xColDescriptor->setPropertyValue(s_sNamePropertyName, makeAny(OUString(aFieldLoop->sFieldName))); xAppendCols->appendByDescriptor(xColDescriptor); } @@ -244,14 +242,9 @@ namespace dbaui void OIndexCollection::implFillIndexInfo(OIndex& _rIndex, const Reference< XPropertySet >& _rxDescriptor) { - static const char s_sPrimaryIndexPropertyName[] = "IsPrimaryKeyIndex"; - static const char s_sUniquePropertyName[] = "IsUnique"; - static const char s_sSortPropertyName[] = "IsAscending"; - static const char s_sCatalogPropertyName[] = "Catalog"; - - _rIndex.bPrimaryKey = ::cppu::any2bool(_rxDescriptor->getPropertyValue(s_sPrimaryIndexPropertyName)); - _rIndex.bUnique = ::cppu::any2bool(_rxDescriptor->getPropertyValue(s_sUniquePropertyName)); - _rxDescriptor->getPropertyValue(s_sCatalogPropertyName) >>= _rIndex.sDescription; + _rIndex.bPrimaryKey = ::cppu::any2bool(_rxDescriptor->getPropertyValue("IsPrimaryKeyIndex")); + _rIndex.bUnique = ::cppu::any2bool(_rxDescriptor->getPropertyValue("IsUnique")); + _rxDescriptor->getPropertyValue("Catalog") >>= _rIndex.sDescription; // the columns Reference< XColumnsSupplier > xSuppCols(_rxDescriptor, UNO_QUERY); @@ -283,7 +276,7 @@ namespace dbaui // get the relevant properties aCopyTo->sFieldName = *pFieldNames; - aCopyTo->bSortAscending = ::cppu::any2bool(xIndexColumn->getPropertyValue(s_sSortPropertyName)); + aCopyTo->bSortAscending = ::cppu::any2bool(xIndexColumn->getPropertyValue("IsAscending")); } _rIndex.aFields.resize(aCopyTo - _rIndex.aFields.begin()); |