[Libreoffice-commits] core.git: 2 commits - shell/Package_scripts_kde.mk shell/source sw/inc sw/source

Jan-Marek Glogowski glogow at fbihome.de
Mon Feb 16 12:33:43 PST 2015


 shell/Package_scripts_kde.mk            |    6 +
 shell/source/unix/misc/kde4-open-url.sh |   22 ++++++
 sw/inc/dbmgr.hxx                        |    2 
 sw/source/core/fields/dbfld.cxx         |    4 -
 sw/source/core/fields/docufld.cxx       |    3 
 sw/source/uibase/dbui/dbmgr.cxx         |  104 ++++++++++++++++----------------
 6 files changed, 86 insertions(+), 55 deletions(-)

New commits:
commit f7db2461292be3e23f5b3af47e488eaa8105d8db
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Nov 26 13:35:42 2014 +0100

    Add kde4-open-url script
    
    Adds a KDE4 specific URL processing script.
    
    Change-Id: I0116fa95f076a5772e88c616e93de542fe4fe4e4

diff --git a/shell/Package_scripts_kde.mk b/shell/Package_scripts_kde.mk
index c5e4978..162bcc5 100644
--- a/shell/Package_scripts_kde.mk
+++ b/shell/Package_scripts_kde.mk
@@ -9,6 +9,12 @@
 
 $(eval $(call gb_Package_Package,shell_scripts_kde,$(SRCDIR)/shell/source/unix/misc))
 
+ifeq ($(ENABLE_KDE),TRUE)
 $(eval $(call gb_Package_add_file,shell_scripts_kde,$(LIBO_BIN_FOLDER)/kde-open-url,kde-open-url.sh))
+endif
+
+ifeq ($(ENABLE_KDE4),TRUE)
+$(eval $(call gb_Package_add_file,shell_scripts_kde,$(LIBO_BIN_FOLDER)/kde4-open-url,kde4-open-url.sh))
+endif
 
 # vim: set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/shell/source/unix/misc/kde4-open-url.sh b/shell/source/unix/misc/kde4-open-url.sh
new file mode 100755
index 0000000..e5b8125
--- /dev/null
+++ b/shell/source/unix/misc/kde4-open-url.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements. See the NOTICE file distributed
+#   with this work for additional information regarding copyright
+#   ownership. The ASF licenses this file to you under the Apache
+#   License, Version 2.0 (the "License"); you may not use this file
+#   except in compliance with the License. You may obtain a copy of
+#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+# use kde-open or xdg-open if available, falling back to our own open-url
+kde-open "$1" 2>/dev/null || xdg-open "$1" 2>/dev/null || `dirname "$0"`/open-url "$1" 2>/dev/null
+exit 0
commit 585bcac8eaa27396ea749a7bdb66abf62fc60335
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Oct 29 16:04:47 2014 +0100

    MM: don't read column content twice to fill SwCalc
    
    Currently we fill the SwCalc dict twice via lcl_GetColumnCnt and
    GetMergeColumnCnt.
    
    This also drops the unused nFmt argument from GetMergeColumnCnt.
    
    Change-Id: I2f7fd1578353e919209002c0c3040adc14b08528

diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index b79cda0..aa6117b 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -311,7 +311,7 @@ public:
     void            CloseAll(bool bIncludingMerge = true);
 
     bool            GetMergeColumnCnt(const OUString& rColumnName, sal_uInt16 nLanguage,
-                                      OUString &rResult, double *pNumber, sal_uInt32 *pFormat);
+                                      OUString &rResult, double *pNumber);
     bool            FillCalcWithMergeData(SvNumberFormatter *pDocFormatter,
                                           sal_uInt16 nLanguage, bool asString, SwCalc &aCalc);
     bool            ToNextMergeRecord();
diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx
index fb724d2..c81dec1 100644
--- a/sw/source/core/fields/dbfld.cxx
+++ b/sw/source/core/fields/dbfld.cxx
@@ -322,13 +322,13 @@ void SwDBField::Evaluate()
     if(!pMgr || !pMgr->IsDataSourceOpen(aTmpData.sDataSource, aTmpData.sCommand, true))
         return ;
 
-    sal_uInt32 nFmt;
+    sal_uInt32 nFmt = 0;
 
     // search corresponding column name
     OUString aColNm( static_cast<SwDBFieldType*>(GetTyp())->GetColumnName() );
 
     SvNumberFormatter* pDocFormatter = GetDoc()->GetNumberFormatter();
-    pMgr->GetMergeColumnCnt(aColNm, GetLanguage(), aContent, &nValue, &nFmt);
+    pMgr->GetMergeColumnCnt(aColNm, GetLanguage(), aContent, &nValue);
     if( !( nSubType & nsSwExtendedSubType::SUB_OWN_FMT ) )
         SetFormat( nFmt = pMgr->GetColumnFmt( aTmpData.sDataSource, aTmpData.sCommand,
                                         aColNm, pDocFormatter, GetLanguage() ));
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 3e02a32..2a74a43 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1381,9 +1381,8 @@ void SwHiddenTxtField::Evaluate(SwDoc* pDoc)
                                                 sDataTableOrQuery, false))
                 {
                     double fNumber;
-                    sal_uInt32 nTmpFormat;
                     pMgr->GetMergeColumnCnt(GetColumnName( sTmpName ),
-                        GetLanguage(), aContent, &fNumber, &nTmpFormat );
+                        GetLanguage(), aContent, &fNumber );
                     bValid = true;
                 }
                 else if( !sDBName.isEmpty() && !sDataSource.isEmpty() &&
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index fc79e80..3b085cc 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -276,8 +276,27 @@ static bool lcl_MoveAbsolute(SwDSParam* pParam, long nAbsPos)
     return bRet;
 }
 
-static bool lcl_GetColumnCnt(SwDSParam* pParam,
-    const OUString& rColumnName, long nLanguage, OUString& rResult, double* pNumber)
+static void lcl_GetColumnCnt(SwDSParam *pParam,
+                             const uno::Reference< XPropertySet > &rColumnProps,
+                             long nLanguage, OUString &rResult, double* pNumber)
+{
+    SwDBFormatData aFormatData;
+    if(!pParam->xFormatter.is())
+    {
+        uno::Reference<XDataSource> xSource = SwDBManager::getDataSourceAsParent(
+                                    pParam->xConnection,pParam->sDataSource);
+        lcl_InitNumberFormatter(*pParam, xSource );
+    }
+    aFormatData.aNullDate = pParam->aNullDate;
+    aFormatData.xFormatter = pParam->xFormatter;
+
+    aFormatData.aLocale = LanguageTag( (LanguageType)nLanguage ).getLocale();
+
+    rResult = SwDBManager::GetDBField( rColumnProps, aFormatData, pNumber);
+}
+
+static bool lcl_GetColumnCnt(SwDSParam* pParam, const OUString& rColumnName,
+                             long nLanguage, OUString& rResult, double* pNumber)
 {
     uno::Reference< XColumnsSupplier > xColsSupp( pParam->xResultSet, UNO_QUERY );
     uno::Reference<XNameAccess> xCols;
@@ -293,20 +312,7 @@ static bool lcl_GetColumnCnt(SwDSParam* pParam,
     Any aCol = xCols->getByName(rColumnName);
     uno::Reference< XPropertySet > xColumnProps;
     aCol >>= xColumnProps;
-
-    SwDBFormatData aFormatData;
-    if(!pParam->xFormatter.is())
-    {
-        uno::Reference<XDataSource> xSource = SwDBManager::getDataSourceAsParent(
-                                    pParam->xConnection,pParam->sDataSource);
-        lcl_InitNumberFormatter(*pParam, xSource );
-    }
-    aFormatData.aNullDate = pParam->aNullDate;
-    aFormatData.xFormatter = pParam->xFormatter;
-
-    aFormatData.aLocale = LanguageTag( (LanguageType)nLanguage ).getLocale();
-
-    rResult = SwDBManager::GetDBField( xColumnProps, aFormatData, pNumber);
+    lcl_GetColumnCnt( pParam, xColumnProps, nLanguage, rResult, pNumber );
     return true;
 };
 
@@ -1867,7 +1873,7 @@ bool SwDBManager::GetColumnCnt(const OUString& rSourceName, const OUString& rTab
 
 // reads the column data at the current position
 bool    SwDBManager::GetMergeColumnCnt(const OUString& rColumnName, sal_uInt16 nLanguage,
-                                   OUString &rResult, double *pNumber, sal_uInt32 * /*pFormat*/)
+                                   OUString &rResult, double *pNumber)
 {
     if(!pImpl->pMergeData || !pImpl->pMergeData->xResultSet.is() || pImpl->pMergeData->bAfterSelection )
     {
@@ -1912,46 +1918,44 @@ bool SwDBManager::FillCalcWithMergeData( SvNumberFormatter *pDocFormatter,
                 continue;
             }
 
+            // get the column type
+            sal_Int32 nColumnType = DataType::SQLNULL;
+            Any aCol = xCols->getByName( pColNames[nCol] );
+            uno::Reference<XPropertySet> xColumnProps;
+            aCol >>= xColumnProps;
+            Any aType = xColumnProps->getPropertyValue( "Type" );
+            aType >>= nColumnType;
             double aNumber = DBL_MAX;
-            if( lcl_GetColumnCnt(pImpl->pMergeData, rColName, nLanguage, aString, &aNumber) )
+
+            lcl_GetColumnCnt( pImpl->pMergeData, xColumnProps, nLanguage, aString, &aNumber );
+
+            sal_uInt32 nFmt = GetColumnFmt( pImpl->pMergeData->sDataSource,
+                                            pImpl->pMergeData->sCommand,
+                                            pColNames[nCol], pDocFormatter, nLanguage );
+            // aNumber is overwritten by SwDBField::FormatValue, so store initial status
+            bool colIsNumber = aNumber != DBL_MAX;
+            bool bValidValue = SwDBField::FormatValue( pDocFormatter, aString, nFmt,
+                                                       aNumber, nColumnType, NULL );
+            if( colIsNumber )
             {
-                // get the column type
-                sal_Int32 nColumnType = DataType::SQLNULL;
-                Any aCol = xCols->getByName( pColNames[nCol] );
-                uno::Reference<XPropertySet> xCol;
-                aCol >>= xCol;
-                Any aType = xCol->getPropertyValue( "Type" );
-                aType >>= nColumnType;
-
-                sal_uInt32 nFmt;
-                if( !GetMergeColumnCnt(pColNames[nCol], nLanguage, aString, &aNumber, &nFmt) )
-                    continue;
-
-                // aNumber is overwritten by SwDBField::FormatValue, so store initial status
-                bool colIsNumber = aNumber != DBL_MAX;
-                bool bValidValue = SwDBField::FormatValue( pDocFormatter, aString, nFmt,
-                                                           aNumber, nColumnType, NULL );
-                if( colIsNumber )
-                {
-                    if( bValidValue )
-                    {
-                        SwSbxValue aValue;
-                        if( !asString )
-                            aValue.PutDouble( aNumber );
-                        else
-                            aValue.PutString( aString );
-                        SAL_INFO( "sw.dbmgr", "'" << pColNames[nCol] << "': " << aNumber << " / " << aString );
-                        rCalc.VarChange( pColNames[nCol], aValue );
-                    }
-                }
-                else
+                if( bValidValue )
                 {
                     SwSbxValue aValue;
-                    aValue.PutString( aString );
-                    SAL_INFO( "sw.dbmgr", "'" << pColNames[nCol] << "': " << aString );
+                    if( !asString )
+                        aValue.PutDouble( aNumber );
+                    else
+                        aValue.PutString( aString );
+                    SAL_INFO( "sw.dbmgr", "'" << pColNames[nCol] << "': " << aNumber << " / " << aString );
                     rCalc.VarChange( pColNames[nCol], aValue );
                 }
             }
+            else
+            {
+                SwSbxValue aValue;
+                aValue.PutString( aString );
+                SAL_INFO( "sw.dbmgr", "'" << pColNames[nCol] << "': " << aString );
+                rCalc.VarChange( pColNames[nCol], aValue );
+            }
         }
         return bExistsNextRecord;
     }


More information about the Libreoffice-commits mailing list