[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 5 commits - officecfg/registry sc/source sw/source writerfilter/source

Lennard Wasserthal Wasserthal at nefkom.net
Sun Apr 13 03:17:28 PDT 2014


 officecfg/registry/data/org/openoffice/Office/Paths.xcu |    1 
 sc/source/core/data/column3.cxx                         |  100 ++++++++++++--
 sc/source/ui/docshell/docsh8.cxx                        |  112 +++++++++++-----
 sc/source/ui/inc/namedlg.hxx                            |    5 
 sc/source/ui/inc/namemgrtable.hxx                       |   12 +
 sc/source/ui/namedlg/namedlg.cxx                        |   17 +-
 sc/source/ui/namedlg/namemgrtable.cxx                   |   14 +-
 sw/source/ui/docvw/edtwin.cxx                           |   19 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx       |    7 -
 9 files changed, 214 insertions(+), 73 deletions(-)

New commits:
commit 8992620a8e56250f4770e7379539956c89c6a5de
Author: Lennard Wasserthal <Wasserthal at nefkom.net>
Date:   Sat Apr 5 11:55:24 2014 +0200

    fdo#69157 Apply object-in front selection on mouseUp
    
    Before, all selection was recklessly replaced when you clicked something
    else than a scaling handle (or the like).
    It caused bug 69157.
    
    But now, you can still drag the frame by gripping the interior one.
    Btw, that the timer did not correctly start was because of the return
    statement in the prior state.
    
    Change-Id: I5e02cfb2d5fe9cdb9fd7f50d0c961dcc418fadd6
    Signed-off-by: Lennard Wasserthal <Wasserthal at nefkom.net>
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit 351ab7b879a1e5bf879600bf47909181029a4d11)
    Reviewed-on: https://gerrit.libreoffice.org/8907
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 3dd87c0..cd838c0 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -2618,8 +2618,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 {
     SwWrtShell &rSh = m_rView.GetWrtShell();
 
-    SdrObject* pObj;
-    SdrPageView* pPV;
     // We have to check if a context menu is shown and we have an UI
     // active inplace client. In that case we have to ignore the mouse
     // button down event. Otherwise we would crash (context menu has been
@@ -2936,12 +2934,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                                 // only if no position to size was hit.
                                 if (!bHitHandle)
                                 {
-                                    if (pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_BEFOREMARK))
-                                    {
-                                        pSdrView->UnmarkAllObj();
-                                        pSdrView->MarkObj(pObj,pPV,false,false);
-                                        return;
-                                    }
                                     StartDDTimer();
                                     SwEditWin::m_nDDStartPosY = aDocPos.Y();
                                     SwEditWin::m_nDDStartPosX = aDocPos.X();
@@ -4029,6 +4021,8 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
  */
 void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
 {
+    SdrObject* pObj;
+    SdrPageView* pPV;
     bool bCallBase = true;
 
     sal_Bool bCallShadowCrsr = m_bWasShdwCrsr;
@@ -4080,6 +4074,15 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
             bFrmDrag = false;
         }
         bNoInterrupt = false;
+        const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
+        if ((PixelToLogic(m_aStartPos).Y() == (aDocPos.Y())) && (PixelToLogic(m_aStartPos).X() == (aDocPos.X())))//To make sure it was not moved
+        {
+            if (pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER ))
+            {
+                pSdrView->UnmarkAllObj();
+                pSdrView->MarkObj(pObj,pPV,false,false);
+            }
+        }
         ReleaseMouse();
         return;
     }
commit 52e8cf6b55ace96d962d3f3ef1dd4cce28858c86
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 11 11:10:14 2014 +0100

    check that stacks are not empty before top()
    
    Change-Id: Iad5b3381b8201c5ac32a5bdf99bd3d5872ea3afc
    (cherry picked from commit a1ea3838adee634ccf725bc5f2be7805c6294a16)
    Reviewed-on: https://gerrit.libreoffice.org/8933
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6f908a8..a696e12 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1245,6 +1245,9 @@ void DomainMapper_Impl::appendTextContent(
     const uno::Sequence< beans::PropertyValue > xPropertyValues
     )
 {
+    SAL_WARN_IF(m_aTextAppendStack.empty(), "writerfilter.dmapper", "no text append stack");
+    if (m_aTextAppendStack.empty())
+        return;
     uno::Reference< text::XTextAppendAndConvert >  xTextAppendAndConvert( m_aTextAppendStack.top().xTextAppend, uno::UNO_QUERY );
     OSL_ENSURE( xTextAppendAndConvert.is(), "trying to append a text content without XTextAppendAndConvert" );
     if(xTextAppendAndConvert.is() && ! getTableManager( ).isIgnore())
@@ -1294,7 +1297,9 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, OLEHandlerPtr pO
         // gives a better ( visually ) result
         xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ),  uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) );
         // remove ( if valid ) associated shape ( used for graphic replacement )
-        m_aAnchoredStack.top( ).bToRemove = true;
+        SAL_WARN_IF(m_aAnchoredStack.empty(), "writerfilter.dmapper", "no anchor stack");
+        if (!m_aAnchoredStack.empty())
+            m_aAnchoredStack.top( ).bToRemove = true;
         RemoveLastParagraph();
         m_aTextAppendStack.pop();
 
commit 47ac8726523a75eac3f119a7dae4a831c33a5c02
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Mar 31 19:28:31 2014 +0200

    re-enabled user-defined numeric fields for dBase export
    
    Since commit f59e350d1733125055f1144f8b3b1b0a46f6d1ca it was impossible
    to define a numeric field with a precision of less than 2 decimals, even
    if all values were integers. It was also impossible to define a field
    width larger than needed for any values in that column. Furthermore, the
    integer part was shortened if the overall column's values resulted in
    more precision than defined, but the overall length did not reach the
    predefined length.
    
    This does not change the behavior of the original intention of
    f59e350d1733125055f1144f8b3b1b0a46f6d1ca to give the precision of number
    formats precedence over precision defined in the column header, which is
    debatable though because conflicts may silently change the field
    definition.
    
    (cherry picked from commit e65141e93a540fc9fb4343ee65a5a7da7e3b1769)
    
    Plus comment translation.
    
    Conflicts:
    	sc/source/core/data/column3.cxx
    	sc/source/ui/docshell/docsh8.cxx
    
    Backported.
    
    Change-Id: I234c4bceaa1a6aadbd259cb8d9b6cb6f16bf91c2
    Reviewed-on: https://gerrit.libreoffice.org/8809
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 4bd6a5a..3630be3 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1906,15 +1906,19 @@ xub_StrLen ScColumn::GetMaxNumberStringLen(
     sal_uInt16& nPrecision, SCROW nRowStart, SCROW nRowEnd ) const
 {
     xub_StrLen nStringLen = 0;
-    nPrecision = pDocument->GetDocOptions().GetStdPrecision();
-    if ( nPrecision == SvNumberFormatter::UNLIMITED_PRECISION )
-        // In case of unlimited precision, use 2 instead.
-        nPrecision = 2;
+    nPrecision = 0;
 
     if ( !maItems.empty() )
     {
         OUString aString;
+        String aSep;
         SvNumberFormatter* pNumFmt = pDocument->GetFormatTable();
+        sal_uInt16 nMaxGeneralPrecision = pDocument->GetDocOptions().GetStdPrecision();
+        // Limit the decimals passed to doubleToUString().
+        // Also, the dBaseIII maximum precision is 15.
+        if (nMaxGeneralPrecision > 15)
+            nMaxGeneralPrecision = 15;
+        bool bHaveSigned = false;
         SCSIZE nIndex;
         SCROW nRow;
         Search( nRowStart, nIndex );
@@ -1926,16 +1930,33 @@ xub_StrLen ScColumn::GetMaxNumberStringLen(
             if ( eType == CELLTYPE_VALUE || (eType == CELLTYPE_FORMULA
                     && aCell.mpFormula->IsValue()) )
             {
-                sal_uLong nFormat = (sal_uLong) ((SfxUInt32Item*) GetAttr(
-                    nRow, ATTR_VALUE_FORMAT ))->GetValue();
-                ScCellFormat::GetInputString(aCell, nFormat, aString, *pNumFmt, pDocument);
-                xub_StrLen nLen = aString.getLength();
-                if ( nLen )
+                do
                 {
-                    if ( nFormat )
+                    sal_uInt16 nCellPrecision = nMaxGeneralPrecision;
+                    if (eType == CELLTYPE_FORMULA)
                     {
+                        // Limit unformatted formula cell precision to precision
+                        // encountered so far, if any, otherwise we'd end up with 15 just
+                        // because of =1/3 ...  If no precision yet then arbitrarily limit
+                        // to a maximum of 4 unless a maximum general precision is set.
+                        if (nPrecision)
+                            nCellPrecision = nPrecision;
+                        else
+                            nCellPrecision = (nMaxGeneralPrecision >= 15) ? 4 : nMaxGeneralPrecision;
+                    }
+
+                    double fVal = aCell.getValue();
+                    if (!bHaveSigned && fVal < 0.0)
+                        bHaveSigned = true;
+
+                    sal_uInt16 nPrec;
+                    sal_uLong nFormat = (sal_uLong) ((SfxUInt32Item*) GetAttr(
+                                nRow, ATTR_VALUE_FORMAT ))->GetValue();
+                    if (nFormat % SV_COUNTRY_LANGUAGE_OFFSET)
+                    {
+                        aSep = pNumFmt->GetFormatDecimalSep(nFormat);
+                        ScCellFormat::GetInputString(aCell, nFormat, aString, *pNumFmt, pDocument);
                         const SvNumberformat* pEntry = pNumFmt->GetEntry( nFormat );
-                        sal_uInt16 nPrec;
                         if (pEntry)
                         {
                             bool bThousand, bNegRed;
@@ -1944,14 +1965,54 @@ xub_StrLen ScColumn::GetMaxNumberStringLen(
                         }
                         else
                             nPrec = pNumFmt->GetFormatPrecision( nFormat );
+                    }
+                    else
+                    {
+                        if (nPrecision >= nMaxGeneralPrecision)
+                            break;      // early bail out for nothing changes here
+
+                        if (!fVal)
+                        {
+                            // 0 doesn't change precision, but set a maximum length if none yet.
+                            if (!nStringLen)
+                                nStringLen = 1;
+                            break;
+                        }
+
+                        // Simple number string with at most 15 decimals and trailing
+                        // decimal zeros eliminated.
+                        aSep = ".";
+                        aString = rtl::math::doubleToUString( fVal, rtl_math_StringFormat_F, nCellPrecision, '.', true);
+                        nPrec = SvNumberFormatter::UNLIMITED_PRECISION;
+                    }
+
+                    sal_Int32 nLen = aString.getLength();
+                    if (nLen <= 0)
+                        // Ignore empty string.
+                        break;
+
+                    if (nPrec == SvNumberFormatter::UNLIMITED_PRECISION && nPrecision < nMaxGeneralPrecision)
+                    {
+                        if (nFormat % SV_COUNTRY_LANGUAGE_OFFSET)
+                        {
+                            // For some reason we couldn't obtain a precision from the
+                            // format, retry with simple number string.
+                            aSep = ".";
+                            aString = rtl::math::doubleToUString( fVal, rtl_math_StringFormat_F, nCellPrecision, '.', true);
+                            nLen = aString.getLength();
+                        }
+                        sal_Int32 nSep = aString.indexOf( aSep);
+                        if (nSep != -1)
+                            nPrec = aString.getLength() - nSep - 1;
 
-                        if ( nPrec != SvNumberFormatter::UNLIMITED_PRECISION && nPrec > nPrecision )
-                            nPrecision = nPrec;
                     }
+
+                    if (nPrec != SvNumberFormatter::UNLIMITED_PRECISION && nPrec > nPrecision)
+                        nPrecision = nPrec;
+
                     if ( nPrecision )
                     {   // less than nPrecision in string => widen it
                         // more => shorten it
-                        String aSep = pNumFmt->GetFormatDecimalSep( nFormat );
                         sal_Int32 nTmp = aString.indexOf( aSep );
                         if ( nTmp == -1 )
                             nLen += nPrecision + aSep.Len();
@@ -1964,9 +2025,18 @@ xub_StrLen ScColumn::GetMaxNumberStringLen(
                                 // nPrecision < nTmp : nLen - Diff
                         }
                     }
+
+                    // Enlarge for sign if necessary. Bear in mind that
+                    // GetMaxNumberStringLen() is for determining dBase decimal field width
+                    // and precision where the overall field width must include the sign.
+                    // Fitting -1 into "#.##" (width 4, 2 decimals) does not work.
+                    if (bHaveSigned && fVal >= 0.0)
+                        ++nLen;
+
                     if ( nStringLen < nLen )
                         nStringLen = nLen;
-                }
+
+                } while (0);
             }
             nIndex++;
         }
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 2eb7b25..5c8ee27 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -519,8 +519,8 @@ void lcl_GetColumnTypes(
         sal_Int32 nDbType = sdbc::DataType::SQLNULL;
         String aFieldName, aString;
 
-        // Feldname[,Type[,Width[,Prec]]]
-        // Typ etc.: L; D; C[,W]; N[,W[,P]]
+        // Fieldname[,Type[,Width[,Prec]]]
+        // Type etc.: L; D; C[,W]; N[,W[,P]]
         if ( bHasFieldNames )
         {
             aString = pDoc->GetString(nCol, nFirstRow, nTab);
@@ -535,29 +535,30 @@ void lcl_GetColumnTypes(
                     case 'L' :
                         nDbType = sdbc::DataType::BIT;
                         nFieldLen = 1;
-                        bTypeDefined = sal_True;
-                        bPrecDefined = sal_True;
+                        bTypeDefined = true;
+                        bPrecDefined = true;
                         break;
                     case 'D' :
                         nDbType = sdbc::DataType::DATE;
                         nFieldLen = 8;
-                        bTypeDefined = sal_True;
-                        bPrecDefined = sal_True;
+                        bTypeDefined = true;
+                        bPrecDefined = true;
                         break;
                     case 'M' :
                         nDbType = sdbc::DataType::LONGVARCHAR;
                         nFieldLen = 10;
-                        bTypeDefined = sal_True;
-                        bPrecDefined = sal_True;
-                        bHasMemo = sal_True;
+                        bTypeDefined = true;
+                        bPrecDefined = true;
+                        bHasMemo = true;
                         break;
                     case 'C' :
                         nDbType = sdbc::DataType::VARCHAR;
-                        bTypeDefined = sal_True;
-                        bPrecDefined = sal_True;
+                        bTypeDefined = true;
+                        bPrecDefined = true;
                         break;
                     case 'N' :
                         nDbType = sdbc::DataType::DECIMAL;
+                        bTypeDefined = true;
                         break;
                 }
                 if ( bTypeDefined && !nFieldLen && nToken > 2 )
@@ -569,6 +570,8 @@ void lcl_GetColumnTypes(
                         if ( CharClass::isAsciiNumeric(aTmp) )
                         {
                             nPrecision = aTmp.ToInt32();
+                            if (nPrecision && nFieldLen < nPrecision+1)
+                                nFieldLen = nPrecision + 1;     // include decimal separator
                             bPrecDefined = sal_True;
                         }
                     }
@@ -577,11 +580,12 @@ void lcl_GetColumnTypes(
             else
                 aFieldName = aString;
 
-            // Feldnamen pruefen und ggbf. gueltigen Feldnamen erzeugen.
-            // Erstes Zeichen muss Buchstabe sein,
-            // weitere nur alphanumerisch und Unterstrich erlaubt,
-            // "_DBASELOCK" ist reserviert (obsolet weil erstes Zeichen kein Buchstabe),
-            // keine doppelten Namen.
+            // Check field name and generate valid field name if necessary.
+            // First character has to be alphabetical, subsequent characters
+            // have to be alphanumerical or underscore.
+            // "_DBASELOCK" is reserved (obsolete because first character is
+            // not alphabetical).
+            // No duplicated names.
             if ( !IsAsciiAlpha( aFieldName.GetChar(0) ) )
                 aFieldName.Insert( 'N', 0 );
             String aTmpStr;
@@ -598,7 +602,7 @@ void lcl_GetColumnTypes(
                 aFieldName.Erase( 10 );
 
             if (!aFieldNames.insert(aFieldName).second)
-            {   // doppelter Feldname, numerisch erweitern
+            {   // Duplicated field name, append numeric suffix.
                 sal_uInt16 nSub = 1;
                 String aFixPart( aFieldName );
                 do
@@ -619,7 +623,7 @@ void lcl_GetColumnTypes(
         }
 
         if ( !bTypeDefined )
-        {   // Feldtyp
+        {   // Field type.
             ScRefCellValue aCell;
             aCell.assign(*pDoc, ScAddress(nCol, nFirstDataRow, nTab));
             if (aCell.isEmpty() || aCell.hasString())
@@ -649,61 +653,99 @@ void lcl_GetColumnTypes(
         }
         bool bSdbLenAdjusted = false;
         bool bSdbLenBad = false;
-        // Feldlaenge
+        // Field length.
         if ( nDbType == sdbc::DataType::VARCHAR && !nFieldLen )
-        {   // maximale Feldbreite bestimmen
+        {   // Determine maximum field width.
             nFieldLen = pDoc->GetMaxStringLen( nTab, nCol, nFirstDataRow,
                 nLastRow, eCharSet );
             if ( nFieldLen == 0 )
                 nFieldLen = 1;
         }
         else if ( nDbType == sdbc::DataType::DECIMAL )
-        {   // maximale Feldbreite und Nachkommastellen bestimmen
+        {   // Determine maximum field width and precision.
             xub_StrLen nLen;
             sal_uInt16 nPrec;
             nLen = pDoc->GetMaxNumberStringLen( nPrec, nTab, nCol,
                 nFirstDataRow, nLastRow );
-            // dBaseIII Limit Nachkommastellen: 15
+            // dBaseIII precision limit: 15
             if ( nPrecision > 15 )
                 nPrecision = 15;
             if ( nPrec > 15 )
                 nPrec = 15;
             if ( bPrecDefined && nPrecision != nPrec )
-            {   // Laenge auf vorgegebene Nachkommastellen anpassen
-                if ( nPrecision )
-                    nLen = sal::static_int_cast<xub_StrLen>( nLen + ( nPrecision - nPrec ) );
+            {
+                if (nPrecision < nPrec)
+                {
+                    // This is a hairy case. User defined nPrecision but a
+                    // number format has more precision. Modifying a dBase
+                    // field may as well render the resulting file useless for
+                    // an application that relies on its defined structure,
+                    // especially if we are resaving an already existing file.
+                    // So who's right, the user who (or the loaded file that)
+                    // defined the field, or the user who applied the format?
+                    // Commit f59e350d1733125055f1144f8b3b1b0a46f6d1ca gave the
+                    // format a higher priority, which is debatable.
+                    SAL_WARN( "sc", "lcl_GetColumnTypes: conflicting dBase field precision for "
+                            << aFieldName << " (" << nPrecision << "<" << nPrec << ")");
+
+                    // Adjust length to larger predefined integer part. There
+                    // may be a reason that the field was prepared for larger
+                    // numbers.
+                    if (nFieldLen - nPrecision > nLen - nPrec)
+                        nLen = sal::static_int_cast<xub_StrLen>(nFieldLen - (nPrecision ? nPrecision+1 : 0) + 1 + nPrec);
+                    // And override precision.
+                    nPrecision = nPrec;
+                }
                 else
-                    nLen -= nPrec+1;            // auch den . mit raus
+                {
+                    // Adjust length to predefined precision.
+                    if ( nPrecision )
+                        nLen = sal::static_int_cast<xub_StrLen>(nLen + ( nPrecision - nPrec ));
+                    else
+                        nLen -= nPrec+1;    // also remove the decimal separator
+                }
+            }
+            if (nFieldLen < nLen)
+            {
+                if (!bTypeDefined)
+                    nFieldLen = nLen;
+                else
+                {
+                    // Again a hairy case and conflict. Furthermore, the
+                    // larger overall length may be a result of only a higher
+                    // precision obtained from formats.
+                    SAL_WARN( "sc", "lcl_GetColumnTypes: conflicting dBase field length for "
+                            << aFieldName << " (" << nFieldLen << "<" << nLen << ")");
+                    nFieldLen = nLen;
+                }
             }
-            if ( nLen > nFieldLen && !bTypeDefined )
-                nFieldLen = nLen;
             if ( !bPrecDefined )
                 nPrecision = nPrec;
             if ( nFieldLen == 0 )
                 nFieldLen = 1;
             else if ( nFieldLen > 19 )
-                nFieldLen = 19;     // dBaseIII Limit Feldlaenge numerisch: 19
+                nFieldLen = 19;     // dBaseIII numeric field length limit: 19
             if ( nPrecision && nFieldLen < nPrecision + 2 )
-                nFieldLen = nPrecision + 2;     // 0. muss mit reinpassen
+                nFieldLen = nPrecision + 2;     // 0. must fit into
             // 538 MUST: Sdb internal representation adds 2 to the field length!
             // To give the user what he wants we must substract it here.
              //! CAVEAT! There is no way to define a numeric field with a length
              //! of 1 and no decimals!
             if ( nFieldLen == 1 && nPrecision == 0 )
-                bSdbLenBad = sal_True;
+                bSdbLenBad = true;
             nFieldLen = SvDbaseConverter::ConvertPrecisionToOdbc( nFieldLen, nPrecision );
-            bSdbLenAdjusted = sal_True;
+            bSdbLenAdjusted = true;
         }
         if ( nFieldLen > 254 )
         {
             if ( nDbType == sdbc::DataType::VARCHAR )
-            {   // zu lang fuer normales Textfeld => Memofeld
+            {   // Too long for a normal text field => memo field.
                 nDbType = sdbc::DataType::LONGVARCHAR;
                 nFieldLen = 10;
-                bHasMemo = sal_True;
+                bHasMemo = true;
             }
             else
-                nFieldLen = 254;                    // dumm gelaufen..
+                nFieldLen = 254;                    // bad luck..
         }
 
         pColNames[nField] = aFieldName;
commit 53c0160e3b57157f55a170f32332add6877ab184
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Apr 8 14:34:13 2014 -0400

    fdo#71729: Fill the range edit boxes after the table is fully initialized.
    
    Otherwise the range formula expression would not be available yet.
    
    (cherry picked from commit ffaaf35206b8f049bb9e9ffd7a85c8ebd758a21c)
    
    Conflicts:
    	sc/source/ui/namedlg/namedlg.cxx
    	sc/source/ui/namedlg/namemgrtable.cxx
    
    Change-Id: If9c5040366f9038e8094fd5448ca5e4ee2e73edd
    Reviewed-on: https://gerrit.libreoffice.org/8898
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx
index b6ed196..020c88f 100644
--- a/sc/source/ui/inc/namedlg.hxx
+++ b/sc/source/ui/inc/namedlg.hxx
@@ -43,7 +43,7 @@ class ScDocument;
 //==================================================================
 
 //logic behind the manage names dialog
-class ScNameDlg : public ScAnyRefDlg
+class ScNameDlg : public ScAnyRefDlg, public ScRangeManagerTable::InitListener
 {
 private:
     Edit*               m_pEdName;
@@ -133,9 +133,10 @@ public:
     virtual void    SetActive();
     virtual sal_Bool    Close();
 
+    virtual void tableInitialized() SAL_OVERRIDE;
+
     void GetRangeNames(boost::ptr_map<OUString, ScRangeName>& rRangeMap);
     void SetEntry(const OUString& rName, const OUString& rScope);
-
 };
 
 
diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx
index 08bd36d..730e0b0 100644
--- a/sc/source/ui/inc/namemgrtable.hxx
+++ b/sc/source/ui/inc/namemgrtable.hxx
@@ -32,6 +32,14 @@ struct ScRangeNameLine
 //Need some sort of a filter to handle several range names
 class SC_DLLPUBLIC ScRangeManagerTable : public SvxSimpleTable
 {
+public:
+    class InitListener
+    {
+    public:
+        virtual ~InitListener();
+        virtual void tableInitialized() = 0;
+    };
+
 private:
     OUString maGlobalString;
 
@@ -43,6 +51,8 @@ private:
     std::map<SvTreeListEntry*, bool> maCalculatedFormulaEntries;
     const ScAddress maPos;
 
+    InitListener* mpInitListener;
+
     void GetLine(ScRangeNameLine& aLine, SvTreeListEntry* pEntry);
     void Init();
     void CheckForFormulaString();
@@ -57,6 +67,8 @@ public:
     virtual void Resize();
     virtual void StateChanged( StateChangedType nStateChange );
 
+    void setInitListener( InitListener* pListener );
+
     void addEntry( const ScRangeNameLine& rLine, bool bSetCurEntry = true );
     void DeleteSelectedEntries();
     void SetEntry( const ScRangeNameLine& rLine );
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index d3718a0..51a5ff2 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -118,6 +118,7 @@ void ScNameDlg::Init()
     pCtrl->set_height_request(pCtrl->GetTextHeight()*12);
 
     m_pRangeManagerTable = new ScRangeManagerTable(*pCtrl, maRangeMap, maCursorPos);
+    m_pRangeManagerTable->setInitListener(this);
     m_pRangeManagerTable->SetSelectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
     m_pRangeManagerTable->SetDeselectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
 
@@ -145,15 +146,7 @@ void ScNameDlg::Init()
         m_pLbScope->InsertEntry(aTabName);
     }
 
-
-
-    if (m_pRangeManagerTable->GetSelectionCount())
-    {
-        SelectionChanged();
-    }
-
     CheckForEmptyTable();
-
 }
 
 sal_Bool ScNameDlg::IsRefInputMode() const
@@ -187,6 +180,12 @@ sal_Bool ScNameDlg::Close()
     return DoClose( ScNameDlgWrapper::GetChildWindowId() );
 }
 
+void ScNameDlg::tableInitialized()
+{
+    if (m_pRangeManagerTable->GetSelectionCount())
+        SelectionChanged();
+}
+
 void ScNameDlg::CheckForEmptyTable()
 {
     if (!m_pRangeManagerTable->GetEntryCount())
@@ -418,8 +417,6 @@ void ScNameDlg::NameModified()
 
 void ScNameDlg::SelectionChanged()
 {
-
-
     //don't update if we have just modified due to user input
     if (!mbNeedUpdate)
     {
diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx
index b0e308a..853b4c5 100644
--- a/sc/source/ui/namedlg/namemgrtable.cxx
+++ b/sc/source/ui/namedlg/namemgrtable.cxx
@@ -37,11 +37,14 @@ String createEntryString(const ScRangeNameLine& rLine)
     return aRet;
 }
 
+ScRangeManagerTable::InitListener::~InitListener() {}
+
 ScRangeManagerTable::ScRangeManagerTable( SvxSimpleTableContainer& rParent, boost::ptr_map<OUString, ScRangeName>& rRangeMap, const ScAddress& rPos ):
     SvxSimpleTable( rParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ),
     maGlobalString( ScGlobal::GetRscString(STR_GLOBAL_SCOPE)),
     mrRangeMap( rRangeMap ),
-    maPos( rPos )
+    maPos( rPos ),
+    mpInitListener(NULL)
 {
     static long aStaticTabs[] = {3, 0, 0, 0 };
     SetTabs( &aStaticTabs[0], MAP_PIXEL );
@@ -84,6 +87,9 @@ void ScRangeManagerTable::StateChanged( StateChangedType nStateChange )
             SetCurEntry(GetEntryOnPos(0));
             CheckForFormulaString();
         }
+
+        if (mpInitListener)
+            mpInitListener->tableInitialized();
     }
 }
 
@@ -107,6 +113,11 @@ ScRangeManagerTable::~ScRangeManagerTable()
     Clear();
 }
 
+void ScRangeManagerTable::setInitListener( InitListener* pListener )
+{
+    mpInitListener = pListener;
+}
+
 void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry)
 {
     SvTreeListEntry* pEntry = InsertEntryToColumn( createEntryString(rLine), LIST_APPEND, 0xffff);
@@ -181,7 +192,6 @@ void ScRangeManagerTable::CheckForFormulaString()
             SetEntryText(aFormulaString, pEntry, 1);
             maCalculatedFormulaEntries.insert( std::pair<SvTreeListEntry*, bool>(pEntry, true) );
         }
-
     }
 }
 
commit 8e82fefab102bc89497f602fcf8e09c9fbcae871
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 25 09:55:48 2014 +0000

    Resolves: fdo#76930 explictly list common lang-independant template dir
    
    (cherry picked from commit 6f48d0bb2d3f3b4e4d3e46d3a5cdeaa552df1933)
    
    Reviewed-on: https://gerrit.libreoffice.org/8909
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit a5b68f520067219c5e571238eafe93d1d728ce38)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Conflicts:
    	officecfg/registry/data/org/openoffice/Office/Paths.xcu
    
    Change-Id: I50d8efe46fc2eb3dfe615ad1f6eb7ee03cdcd29a

diff --git a/officecfg/registry/data/org/openoffice/Office/Paths.xcu b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
index a5c438d..9384200 100644
--- a/officecfg/registry/data/org/openoffice/Office/Paths.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
@@ -158,6 +158,7 @@
     </node>
     <node oor:name="Template" oor:op="fuse" oor:mandatory="true">
       <node oor:name="InternalPaths">
+        <node oor:name="$(insturl)/share/template/common" oor:op="fuse"/>
         <node oor:name="$(insturl)/share/template/$(vlang)" oor:op="fuse"/>
       </node>
       <prop oor:name="WritePath">


More information about the Libreoffice-commits mailing list