[Libreoffice-commits] core.git: 7 commits - include/oox include/sax oox/source sax/source sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Nov 22 06:02:55 PST 2013


 include/oox/helper/attributelist.hxx      |    8 ---
 include/sax/fastattribs.hxx               |    2 
 oox/source/export/drawingml.cxx           |    2 
 oox/source/helper/attributelist.cxx       |   14 ++----
 sax/source/tools/fastattribs.cxx          |    8 ---
 sc/inc/document.hxx                       |    4 -
 sc/inc/documentimport.hxx                 |    6 ++
 sc/source/core/data/column2.cxx           |    1 
 sc/source/core/data/documentimport.cxx    |    9 ++++
 sc/source/filter/inc/addressconverter.hxx |    7 +--
 sc/source/filter/inc/workbookhelper.hxx   |    2 
 sc/source/filter/inc/worksheethelper.hxx  |   28 ++++++-------
 sc/source/filter/oox/addressconverter.cxx |   16 ++-----
 sc/source/filter/oox/sheetdatacontext.cxx |    8 +--
 sc/source/filter/oox/workbookfragment.cxx |    6 +-
 sc/source/filter/oox/workbookhelper.cxx   |   62 +++++++++++++++++-------------
 sc/source/filter/oox/worksheethelper.cxx  |   26 ++++++++----
 17 files changed, 112 insertions(+), 97 deletions(-)

New commits:
commit 6087da0dd402013b7d67fe6754081e647fdc5f8c
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 21 20:32:46 2013 -0500

    getChar() to return a null-terminated char array.
    
    No need to fetch string size with this change.
    
    Change-Id: Iae5f6c60430fc57985a0fec5bfec59727e5a8f0f

diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx
index 78ea83e..e22e816 100644
--- a/include/oox/helper/attributelist.hxx
+++ b/include/oox/helper/attributelist.hxx
@@ -75,12 +75,6 @@ public:
 class OOX_DLLPUBLIC AttributeList
 {
 public:
-    struct Char
-    {
-        const char* mpPos;
-        size_t mnSize;
-    };
-
     explicit            AttributeList(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
 
@@ -138,7 +132,7 @@ public:
         passed default string if the attribute is missing. */
     OUString     getXString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
 
-    Char getChar( sal_Int32 nAttrToken ) const;
+    const char* getChar( sal_Int32 nAttrToken ) const;
 
 
     /** Returns the double value of the specified attribute, or the passed
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index f47da07..42b285c 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -76,7 +76,7 @@ public:
     // performance sensitive shortcuts to avoid allocation ...
     bool getAsInteger( sal_Int32 nToken, sal_Int32 &rInt);
     bool getAsDouble( sal_Int32 nToken, double &rDouble);
-    bool getAsChar( sal_Int32 nToken, const char*& rPos, size_t& rLen ) const;
+    bool getAsChar( sal_Int32 nToken, const char*& rPos ) const;
 
     // XFastAttributeList
     virtual ::sal_Bool SAL_CALL hasAttribute( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx
index e57dd1d..2efc3a3 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -261,16 +261,14 @@ OUString AttributeList::getXString( sal_Int32 nAttrToken, const OUString& rDefau
     return getXString( nAttrToken ).get( rDefault );
 }
 
-AttributeList::Char AttributeList::getChar( sal_Int32 nAttrToken ) const
+const char* AttributeList::getChar( sal_Int32 nAttrToken ) const
 {
-    Char aRet;
-    bool bValid = getAttribList()->getAsChar(nAttrToken, aRet.mpPos, aRet.mnSize);
+    const char* p = NULL;
+    bool bValid = getAttribList()->getAsChar(nAttrToken, p);
     if (!bValid)
-    {
-        aRet.mpPos = NULL;
-        aRet.mnSize = 0;
-    }
-    return aRet;
+        p = NULL;
+
+    return p;
 }
 
 double AttributeList::getDouble( sal_Int32 nAttrToken, double fDefault ) const
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 17b9a3f..ee65cc6 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -157,7 +157,7 @@ bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble)
     return false;
 }
 
-bool FastAttributeList::getAsChar( sal_Int32 nToken, const char*& rPos, size_t& rLen ) const
+bool FastAttributeList::getAsChar( sal_Int32 nToken, const char*& rPos ) const
 {
     for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i)
     {
@@ -166,12 +166,6 @@ bool FastAttributeList::getAsChar( sal_Int32 nToken, const char*& rPos, size_t&
 
         sal_Int32 nOffset = maAttributeValues[i];
         rPos = mpChunk + nOffset;
-
-        if (i + 1 < maAttributeValues.size())
-            rLen = maAttributeValues[i+1] - nOffset - 1;
-        else
-            rLen = mnChunkLength - nOffset - 1;
-
         return true;
     }
 
diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx
index 886e074..36f8599 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -214,7 +214,7 @@ public:
                             sal_Int32 nLength = SAL_MAX_INT32 );
 
     static bool parseOoxAddress2d(
-        sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr, sal_Int32 nStrLen );
+        sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr );
 
     /** Tries to parse the passed string for a 2d cell range in A1 notation.
 
@@ -320,8 +320,7 @@ public:
                             sal_Int16 nSheet );
 
     bool convertToCellAddressUnchecked(
-        com::sun::star::table::CellAddress& orAddress,
-        const char* pStr, size_t nStrLen, sal_Int16 nSheet ) const;
+        com::sun::star::table::CellAddress& orAddress, const char* pStr, sal_Int16 nSheet ) const;
 
     /** Tries to convert the passed string to a single cell address.
 
@@ -340,7 +339,7 @@ public:
 
     bool convertToCellAddress(
         com::sun::star::table::CellAddress& rAddress,
-        const char* pStr, size_t nStrLen, sal_Int16 nSheet, bool bTrackOverflow );
+        const char* pStr, sal_Int16 nSheet, bool bTrackOverflow );
 
     /** Returns a valid cell address by moving it into allowed dimensions.
 
diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx
index b9dbc53..59028ba 100644
--- a/sc/source/filter/oox/addressconverter.cxx
+++ b/sc/source/filter/oox/addressconverter.cxx
@@ -226,16 +226,13 @@ bool AddressConverter::parseOoxAddress2d(
     return (ornColumn >= 0) && (ornRow >= 0);
 }
 
-bool AddressConverter::parseOoxAddress2d(
-    sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr, sal_Int32 nStrLen )
+bool AddressConverter::parseOoxAddress2d( sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr )
 {
     ornColumn = ornRow = 0;
 
-    const char* pStrEnd = pStr + nStrLen;
-
     enum { STATE_COL, STATE_ROW } eState = STATE_COL;
 
-    while (pStr < pStrEnd)
+    while (*pStr)
     {
         char cChar = *pStr;
         switch( eState )
@@ -356,11 +353,10 @@ bool AddressConverter::convertToCellAddressUnchecked( CellAddress& orAddress,
 }
 
 bool AddressConverter::convertToCellAddressUnchecked(
-        com::sun::star::table::CellAddress& orAddress,
-        const char* pStr, size_t nStrLen, sal_Int16 nSheet ) const
+        com::sun::star::table::CellAddress& orAddress, const char* pStr, sal_Int16 nSheet ) const
 {
     orAddress.Sheet = nSheet;
-    return parseOoxAddress2d(orAddress.Column, orAddress.Row, pStr, nStrLen);
+    return parseOoxAddress2d(orAddress.Column, orAddress.Row, pStr);
 }
 
 bool AddressConverter::convertToCellAddress( CellAddress& orAddress,
@@ -373,9 +369,9 @@ bool AddressConverter::convertToCellAddress( CellAddress& orAddress,
 
 bool AddressConverter::convertToCellAddress(
     com::sun::star::table::CellAddress& rAddress,
-    const char* pStr, size_t nStrLen, sal_Int16 nSheet, bool bTrackOverflow )
+    const char* pStr, sal_Int16 nSheet, bool bTrackOverflow )
 {
-    if (!convertToCellAddressUnchecked(rAddress, pStr, nStrLen, nSheet))
+    if (!convertToCellAddressUnchecked(rAddress, pStr, nSheet))
         return false;
 
     return checkCellAddress(rAddress, bTrackOverflow);
diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx
index ca55119..5170234 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -311,18 +311,16 @@ void SheetDataContext::importRow( const AttributeList& rAttribs )
 bool SheetDataContext::importCell( const AttributeList& rAttribs )
 {
     bool bValid = true;
-    AttributeList::Char aChar = rAttribs.getChar(XML_r);
+    const char* p = rAttribs.getChar(XML_r);
 
-    if (!aChar.mpPos)
+    if (!p)
     {
         ++mnCol;
         maCellData.maCellAddr = CellAddress( mnSheet, mnCol, mnRow );
     }
     else
     {
-        bValid = mrAddressConv.convertToCellAddress(
-            maCellData.maCellAddr, aChar.mpPos, aChar.mnSize, mnSheet, true);
-
+        bValid = mrAddressConv.convertToCellAddress(maCellData.maCellAddr, p, mnSheet, true);
         mnCol = maCellData.maCellAddr.Column;
     }
 
commit 151beeb0b234512768080da3441ebe40a46cd861
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 21 16:46:57 2013 -0500

    Set default cell style directly, without UNO API.
    
    This also avoids unnecessary row height adjustments.
    
    Change-Id: Icfecf0a5fdf7ef18db368ebadcf9d0b8700c0b65

diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index d2aa994..222908e 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -23,6 +23,7 @@ class ScColumn;
 class ScAddress;
 class ScTokenArray;
 class ScFormulaCell;
+class ScStyleSheet;
 struct ScSetStringParam;
 struct ScTabOpParam;
 struct ScDocumentImportImpl;
@@ -50,6 +51,11 @@ public:
     void setDefaultNumericScript(sal_uInt16 nScript);
 
     /**
+     * Apply specified cell style to an entire sheet.
+     */
+    void setCellStyleToSheet(SCTAB nTab, const ScStyleSheet& rStyle);
+
+    /**
      * @param rName sheet name.
      *
      * @return 0-based sheet index, or -1 in case no sheet is found by
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 7138795..3ca06c5 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -58,6 +58,15 @@ void ScDocumentImport::setDefaultNumericScript(sal_uInt16 nScript)
     mpImpl->mnDefaultScriptNumeric = nScript;
 }
 
+void ScDocumentImport::setCellStyleToSheet(SCTAB nTab, const ScStyleSheet& rStyle)
+{
+    ScTable* pTab = mpImpl->mrDoc.FetchTable(nTab);
+    if (!pTab)
+        return;
+
+    pTab->ApplyStyleArea(0, 0, MAXCOL, MAXROW, rStyle);
+}
+
 SCTAB ScDocumentImport::getSheetIndex(const OUString& rName) const
 {
     SCTAB nTab = -1;
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 6d0ea85..e3a4c89 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -70,6 +70,8 @@
 #include "tokenarray.hxx"
 #include "tablebuffer.hxx"
 #include "documentimport.hxx"
+#include "stlsheet.hxx"
+#include "stlpool.hxx"
 
 #include <svl/stritem.hxx>
 #include <editeng/editobj.hxx>
@@ -938,8 +940,14 @@ void WorksheetGlobals::setRowModel( const RowModel& rModel )
 void WorksheetGlobals::initializeWorksheetImport()
 {
     // set default cell style for unused cells
-    PropertySet aPropSet( mxSheet );
-    aPropSet.setProperty( PROP_CellStyle, getStyles().getDefaultStyleName() );
+    ScDocumentImport& rDoc = getDocImport();
+
+    ScStyleSheet* pStyleSheet =
+        static_cast<ScStyleSheet*>(rDoc.getDoc().GetStyleSheetPool()->Find(
+            getStyles().getDefaultStyleName(), SFX_STYLE_FAMILY_PARA));
+
+    if (pStyleSheet)
+        rDoc.setCellStyleToSheet(getSheetIndex(), *pStyleSheet);
 
     /*  Remember the current sheet index in global data, needed by global
         objects, e.g. the chart converter. */
commit 3797e61e5eb15b9dee9c55afe95013f134ac2d5d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 21 15:08:48 2013 -0500

    More removal of UNO API for setting document properties.
    
    Change-Id: I8c68308394a64eee0985d7d1f8c8b34637a6da74

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 80d724b..49fd571 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1126,7 +1126,7 @@ public:
     bool            IsUndo() const                              { return bIsUndo; }
     bool            IsClipboard() const                         { return bIsClip; }
     bool            IsUndoEnabled() const                       { return mbUndoEnabled; }
-    void            EnableUndo( bool bVal );
+    SC_DLLPUBLIC void EnableUndo( bool bVal );
 
     bool            IsAdjustHeightEnabled() const               { return mbAdjustHeightEnabled; }
     void            EnableAdjustHeight( bool bVal )             { mbAdjustHeightEnabled = bVal; }
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx
index 022f342..abafb20 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -56,6 +56,7 @@ namespace oox { namespace core {
 } }
 
 class ScDocument;
+class ScDocShell;
 class ScDocumentImport;
 class ScEditEngineDefaulter;
 
@@ -152,6 +153,7 @@ public:
     ScDocument& getScDocument();
     const ScDocument& getScDocument() const;
 
+    ScDocShell& getDocShell();
     ScDocumentImport& getDocImport();
 
     ScEditEngineDefaulter& getEditEngine() const;
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index fc3c2aa..30f0f34 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -338,7 +338,7 @@ void WorkbookFragment::finalizeImport()
 
     // Recalculate formula cells.
     ScDocument& rDoc = getScDocument();
-    ScDocShell* pDocSh = static_cast<ScDocShell*>(rDoc.GetDocumentShell());
+    ScDocShell& rDocSh = getDocShell();
     Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
     ScRecalcOptions nRecalcMode =
         static_cast<ScRecalcOptions>(officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::get(xContext));
@@ -349,7 +349,7 @@ void WorkbookFragment::finalizeImport()
         {
             // Ask the user if full re-calculation is desired.
             QueryBox aBox(
-                pDocSh->GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
+                rDocSh.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
                 ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
             aBox.SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED));
 
@@ -373,7 +373,7 @@ void WorkbookFragment::finalizeImport()
         bHardRecalc = true;
 
     if (bHardRecalc)
-        pDocSh->DoHardRecalc(false);
+        rDocSh.DoHardRecalc(false);
     else
         rDoc.CalcFormulaTree(false, true, false);
 }
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index a27998e..33270e5 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -72,6 +72,7 @@
 #include "datauno.hxx"
 #include "globalnames.hxx"
 #include "documentimport.hxx"
+#include "drwlayer.hxx"
 
 #include "formulabuffer.hxx"
 #include "vcl/mapmod.hxx"
@@ -150,6 +151,7 @@ public:
     ScDocument& getScDocument() { return *mpDoc; }
     const ScDocument& getScDocument() const { return *mpDoc; }
 
+    ScDocShell& getDocShell();
     ScDocumentImport& getDocImport();
 
     /** Returns a reference to the source/target spreadsheet document model. */
@@ -305,6 +307,7 @@ private:
     rtl_TextEncoding    meTextEnc;              /// BIFF byte string text encoding.
     bool                mbHasCodePage;          /// True = CODEPAGE record exists in imported stream.
     ScDocument* mpDoc;
+    ScDocShell* mpDocShell;
     boost::scoped_ptr<ScDocumentImport> mxDocImport;
 };
 
@@ -316,7 +319,8 @@ WorkbookGlobals::WorkbookGlobals( ExcelFilter& rFilter ) :
     meFilterType( FILTER_OOXML ),
     mpOoxFilter( &rFilter ),
     meBiff( BIFF_UNKNOWN ),
-    mpDoc( NULL )
+    mpDoc(NULL),
+    mpDocShell(NULL)
 {
     // register at the filter, needed for virtual callbacks (even during construction)
     mrExcelFilter.registerWorkbookGlobals( *this );
@@ -329,6 +333,11 @@ WorkbookGlobals::~WorkbookGlobals()
     mrExcelFilter.unregisterWorkbookGlobals();
 }
 
+ScDocShell& WorkbookGlobals::getDocShell()
+{
+    return *mpDocShell;
+}
+
 ScDocumentImport& WorkbookGlobals::getDocImport()
 {
     return *mxDocImport;
@@ -534,11 +543,10 @@ void WorkbookGlobals::initialize( bool bWorkbookFile )
     if (mxDoc.get())
     {
         ScModelObj* pModel = dynamic_cast<ScModelObj*>(mxDoc.get());
-        ScDocShell* pDocShell = NULL;
         if (pModel)
-            pDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject());
-        if (pDocShell)
-            mpDoc = pDocShell->GetDocument();
+            mpDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject());
+        if (mpDocShell)
+            mpDoc = mpDocShell->GetDocument();
     }
 
     if (!mpDoc)
@@ -578,19 +586,16 @@ void WorkbookGlobals::initialize( bool bWorkbookFile )
     // set some document properties needed during import
     if( mrBaseFilter.isImportFilter() )
     {
-        PropertySet aPropSet( mxDoc );
         // enable editing read-only documents (e.g. from read-only files)
-        aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, true );
+        mpDoc->EnableChangeReadOnly(true);
         // #i76026# disable Undo while loading the document
-        aPropSet.setProperty( PROP_IsUndoEnabled, false );
+        mpDoc->EnableUndo(false);
         // #i79826# disable calculating automatic row height while loading the document
-        aPropSet.setProperty( PROP_IsAdjustHeightEnabled, false );
+        mpDoc->EnableAdjustHeight(true);
         // disable automatic update of linked sheets and DDE links
-        aPropSet.setProperty( PROP_IsExecuteLinkEnabled, false );
+        mpDoc->EnableExecuteLink(false);
         // #i79890# disable automatic update of defined names
-        Reference< XActionLockable > xLockable( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY );
-        if( xLockable.is() )
-            xLockable->addActionLock();
+        mpDoc->CompileNameFormula(true);
 
         //! TODO: localize progress bar text
         mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), "Loading..." ) );
@@ -598,7 +603,7 @@ void WorkbookGlobals::initialize( bool bWorkbookFile )
 
         //prevent unnecessary broadcasts and "half way listeners" as
         //is done in ScDocShell::BeforeXMLLoading() for ods
-        getScDocument().SetInsertingFromOtherDoc(true);
+        mpDoc->SetInsertingFromOtherDoc(true);
     }
     else if( mrBaseFilter.isExportFilter() )
     {
@@ -625,26 +630,28 @@ void WorkbookGlobals::finalize()
     // set some document properties needed after import
     if( mrBaseFilter.isImportFilter() )
     {
-        PropertySet aPropSet( mxDoc );
         // #i74668# do not insert default sheets
-        aPropSet.setProperty( PROP_IsLoaded, true );
+        mpDocShell->SetEmpty(false);
         // #i79890# Compile named ranges before re-enabling row height adjustment. (no idea why).
         mpDoc->CompileNameFormula(false);
         // enable automatic update of linked sheets and DDE links
-        aPropSet.setProperty( PROP_IsExecuteLinkEnabled, true );
+        mpDoc->EnableExecuteLink(true);
         // #i79826# enable updating automatic row height after loading the document
-        aPropSet.setProperty( PROP_IsAdjustHeightEnabled, true );
+        mpDoc->EnableAdjustHeight(true);
 
         // #i76026# enable Undo after loading the document
-        aPropSet.setProperty( PROP_IsUndoEnabled, true );
+        mpDoc->EnableUndo(true);
+
         // disable editing read-only documents (e.g. from read-only files)
-        aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, false );
+        mpDoc->EnableChangeReadOnly(false);
         // #111099# open forms in alive mode (has no effect, if no controls in document)
-        aPropSet.setProperty( PROP_ApplyFormDesignMode, false );
+        ScDrawLayer* pModel = mpDoc->GetDrawLayer();
+        if (pModel)
+            pModel->SetOpenInDesignMode(false);
 
         //stop preventing establishment of listeners as is done in
         //ScDocShell::AfterXMLLoading() for ods
-        getScDocument().SetInsertingFromOtherDoc(false);
+        mpDoc->SetInsertingFromOtherDoc(false);
         getDocImport().finalize();
     }
 }
@@ -745,6 +752,11 @@ const ScDocument& WorkbookHelper::getScDocument() const
     return mrBookGlob.getScDocument();
 }
 
+ScDocShell& WorkbookHelper::getDocShell()
+{
+    return mrBookGlob.getDocShell();
+}
+
 ScDocumentImport& WorkbookHelper::getDocImport()
 {
     return mrBookGlob.getDocImport();
commit 0762f059c49289d56010d667fd2311d349f5d383
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 21 14:23:32 2013 -0500

    Call the method directly via ScDocument, not via obscure UNO API.
    
    Change-Id: I27628314337ae4df31420d63d7c09148369a6759

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 68e57d2..80d724b 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1920,7 +1920,7 @@ public:
 
     void            CompileDBFormula();
     void            CompileDBFormula( bool bCreateFormulaString );
-    void            CompileNameFormula( bool bCreateFormulaString );
+    SC_DLLPUBLIC void CompileNameFormula( bool bCreateFormulaString );
     void            CompileColRowNameFormula();
 
     /** Maximum string length of a column, e.g. for dBase export.
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 240677b..65d6c88 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -3198,7 +3198,6 @@ void ScColumn::CompileNameFormula( bool bCreateFormulaString )
 {
     CompileNameFormulaHandler aFunc(bCreateFormulaString);
     sc::ProcessFormula(maCells, aFunc);
-    RegroupFormulaCells();
 }
 
 void ScColumn::CompileColRowNameFormula()
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 31dd5bd..a27998e 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -628,10 +628,8 @@ void WorkbookGlobals::finalize()
         PropertySet aPropSet( mxDoc );
         // #i74668# do not insert default sheets
         aPropSet.setProperty( PROP_IsLoaded, true );
-        // #i79890# enable automatic update of defined names (before IsAdjustHeightEnabled!)
-        Reference< XActionLockable > xLockable( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY );
-        if( xLockable.is() )
-            xLockable->removeActionLock();
+        // #i79890# Compile named ranges before re-enabling row height adjustment. (no idea why).
+        mpDoc->CompileNameFormula(false);
         // enable automatic update of linked sheets and DDE links
         aPropSet.setProperty( PROP_IsExecuteLinkEnabled, true );
         // #i79826# enable updating automatic row height after loading the document
commit 79ceef879205c428bbb87e729a2d3ba68d6e6a0f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 21 13:44:45 2013 -0500

    Shrink class sizes a bit.
    
    Change-Id: I2561ede5a42ad1f0f3bb74f7b9375f87010eddc3

diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx
index 8cda876..bbcd152 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -83,9 +83,9 @@ struct ColumnModel
     double              mfWidth;            /// Column width in number of characters.
     sal_Int32           mnXfId;             /// Column default formatting.
     sal_Int32           mnLevel;            /// Column outline level.
-    bool                mbShowPhonetic;     /// True = cells in column show phonetic settings.
-    bool                mbHidden;           /// True = column is hidden.
-    bool                mbCollapsed;        /// True = column outline is collapsed.
+    bool                mbShowPhonetic:1;   /// True = cells in column show phonetic settings.
+    bool                mbHidden:1;         /// True = column is hidden.
+    bool                mbCollapsed:1;      /// True = column outline is collapsed.
 
     explicit            ColumnModel();
 
@@ -103,13 +103,13 @@ struct RowModel
     double              mfHeight;           /// Row height in points.
     sal_Int32           mnXfId;             /// Row default formatting (see mbIsFormatted).
     sal_Int32           mnLevel;            /// Row outline level.
-    bool                mbCustomHeight;     /// True = row has custom height.
-    bool                mbCustomFormat;     /// True = cells in row have explicit formatting.
-    bool                mbShowPhonetic;     /// True = cells in row show phonetic settings.
-    bool                mbHidden;           /// True = row is hidden.
-    bool                mbCollapsed;        /// True = row outline is collapsed.
-    bool                mbThickTop;         /// True = row has extra space above text.
-    bool                mbThickBottom;      /// True = row has extra space below text.
+    bool                mbCustomHeight:1;   /// True = row has custom height.
+    bool                mbCustomFormat:1;   /// True = cells in row have explicit formatting.
+    bool                mbShowPhonetic:1;   /// True = cells in row show phonetic settings.
+    bool                mbHidden:1;         /// True = row is hidden.
+    bool                mbCollapsed:1;      /// True = row outline is collapsed.
+    bool                mbThickTop:1;       /// True = row has extra space above text.
+    bool                mbThickBottom:1;    /// True = row has extra space below text.
 
     explicit            RowModel();
 
@@ -159,10 +159,10 @@ struct ValidationModel
     sal_Int32           mnType;
     sal_Int32           mnOperator;
     sal_Int32           mnErrorStyle;
-    bool                mbShowInputMsg;
-    bool                mbShowErrorMsg;
-    bool                mbNoDropDown;
-    bool                mbAllowBlank;
+    bool                mbShowInputMsg:1;
+    bool                mbShowErrorMsg:1;
+    bool                mbNoDropDown:1;
+    bool                mbAllowBlank:1;
 
     explicit            ValidationModel();
 
commit 3a22d789c22452b6a481c331db680a6b9d87a8ca
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 21 12:18:56 2013 -0500

    Avoid re-drawing progress bar too frequently.
    
    Change-Id: I01dcd6d421c1f648b4cd8413e3baf50fd26d4c8f

diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 0ff9293..6d0ea85 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -96,12 +96,14 @@ namespace {
 
 void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, const CellRangeAddress& rUsedArea, sal_Int32 nRow )
 {
-    if( rxProgressBar.get() && (rUsedArea.StartRow <= nRow) && (nRow <= rUsedArea.EndRow) )
-    {
-        double fPosition = static_cast< double >( nRow - rUsedArea.StartRow + 1 ) / (rUsedArea.EndRow - rUsedArea.StartRow + 1);
-        if( rxProgressBar->getPosition() < fPosition )
-            rxProgressBar->setPosition( fPosition );
-    }
+    if (!rxProgressBar || nRow < rUsedArea.StartRow || rUsedArea.EndRow < nRow)
+        return;
+
+    double fCurPos = rxProgressBar->getPosition();
+    double fNewPos = static_cast<double>(nRow - rUsedArea.StartRow + 1.0) / (rUsedArea.EndRow - rUsedArea.StartRow + 1.0);
+    if (fCurPos < fNewPos && (fNewPos - fCurPos) > 0.3)
+        // Try not to re-draw progress bar too frequently.
+        rxProgressBar->setPosition(fNewPos);
 }
 
 void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, double fPosition )
commit 5db19a417952381fc6349b9691c581090d7d2679
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 21 09:43:46 2013 -0500

    Compiler warning.
    
    Change-Id: I66b16e9767369fd54611f92d66cd1b43f4e8c5a8

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3f5731b..7526741 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -782,7 +782,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs
         mAny >>= nCharEscapement;
 
     if( nCharEscapement && GETAD( CharEscapementHeight ) ) {
-        sal_uInt32 nCharEscapementHeight;
+        sal_uInt32 nCharEscapementHeight = 0;
         mAny >>= nCharEscapementHeight;
         nSize = (nSize * nCharEscapementHeight) / 100;
         // MSO uses default ~58% size


More information about the Libreoffice-commits mailing list