[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue Jun 18 12:37:39 PDT 2013


 sc/inc/cell.hxx               |  204 ------------------------------------------
 sc/source/core/data/cell.cxx  |  166 ----------------------------------
 sc/source/core/data/cell2.cxx |  156 --------------------------------
 3 files changed, 526 deletions(-)

New commits:
commit 2f0e2ff8aa2028a9edaaffc90b1a05092176c68d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Jun 18 15:39:14 2013 -0400

    Put ScBaseCell, ScValueCell, ScStringCell, ScEditCell to eternal rest.
    
    You had your day. Now it's time for us to part ways.
    
    Change-Id: I4bd5797adf2091387cacaf6474069c3f9f20c134

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
deleted file mode 100644
index aef29df..0000000
--- a/sc/inc/cell.hxx
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#ifndef SC_CELL_HXX
-#define SC_CELL_HXX
-
-#include "scdllapi.h"
-#include "global.hxx"
-
-#include "tools/mempool.hxx"
-
-#include <boost/shared_ptr.hpp>
-
-#define USE_MEMPOOL
-
-class ScDocument;
-class EditTextObject;
-class ScMatrix;
-class SvtBroadcaster;
-class ScProgress;
-class ScPatternAttr;
-
-class ScBaseCell
-{
-protected:
-                    ~ScBaseCell();  // not virtual - not to be called directly.
-
-public:
-    explicit        ScBaseCell( CellType eNewType );
-
-    /** Base copy constructor. Does NOT clone cell note or broadcaster! */
-                    ScBaseCell( const ScBaseCell& rCell );
-
-    /** Returns a clone of this cell at the same position,
-        broadcaster will not be cloned. */
-    ScBaseCell*     Clone( ScDocument& rDestDoc, int nCloneFlags = SC_CLONECELL_DEFAULT ) const;
-
-    /** Returns a clone of this cell for the passed document position,
-        broadcaster will not be cloned. */
-    ScBaseCell*     Clone( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const;
-
-    inline CellType GetCellType() const { return (CellType)eCellType; }
-
-    /** ScFormulaCell with formula::svEmptyCell result, or ScNoteCell (may have been
-        created due to reference to empty cell). */
-    bool            HasEmptyData() const;
-    bool            HasValueData() const;
-    bool            HasStringData() const;
-    OUString   GetStringData() const;          // only real strings
-
-private:
-    ScBaseCell&     operator=( const ScBaseCell& );
-
-protected:
-    sal_uInt8            eCellType;      // enum CellType - sal_uInt8 spart Speicher
-};
-
-class ScValueCell : public ScBaseCell
-{
-public:
-#ifdef USE_MEMPOOL
-    DECL_FIXEDMEMPOOL_NEWDEL( ScValueCell )
-#endif
-
-    explicit        ScValueCell( double fValue );
-
-#if OSL_DEBUG_LEVEL > 0
-                    ~ScValueCell();
-#endif
-
-    inline void     SetValue( double fValue ) { mfValue = fValue; }
-    inline double   GetValue() const { return mfValue; }
-    double* GetValuePtr() { return &mfValue; }
-
-private:
-    double          mfValue;
-};
-
-class ScStringCell : public ScBaseCell
-{
-public:
-#ifdef USE_MEMPOOL
-    DECL_FIXEDMEMPOOL_NEWDEL( ScStringCell )
-#endif
-
-    explicit        ScStringCell(const OUString& rString);
-
-#if OSL_DEBUG_LEVEL > 0
-                    ~ScStringCell();
-#endif
-
-    inline void     SetString( const OUString& rString ) { maString = rString; }
-    inline const    OUString& GetString() const { return maString; }
-    const OUString* GetStringPtr() const { return &maString; }
-
-private:
-    OUString   maString;
-};
-
-class ScEditCell : public ScBaseCell
-{
-    EditTextObject* mpData;
-    mutable OUString* mpString;        // for faster access to formulas
-    ScDocument* mpDoc;           // for EditEngine access with Pool
-
-    void            SetTextObject( const EditTextObject* pObject,
-                                    const SfxItemPool* pFromPool );
-
-                    // not implemented
-                    ScEditCell( const ScEditCell& );
-
-public:
-
-#ifdef USE_MEMPOOL
-    DECL_FIXEDMEMPOOL_NEWDEL( ScEditCell )
-#endif
-
-                    ~ScEditCell();              // always because of pData!
-
-    /**
-     * Constructor that takes ownership of the passed EditTextObject instance
-     * which the caller must not delete afterward!
-     *
-     * <p>Also ensure that the passed edit text object <i>uses the SfxItemPool
-     * instance returned from ScDocument::GetEditPool()</i>.  This is
-     * important.</p>
-     */
-    ScEditCell(EditTextObject* pObject, ScDocument* pDoc);
-
-    /**
-     * Constructor.  The caller is responsible for deleting the text object
-     * instance passed on to this constructor, since it creates a clone and
-     * stores it instead of the original.
-     *
-     * @param rObject text object to clone from.
-     * @param pDoc pointer to the document instance.
-     * @param pFromPool pointer to SfxItemPool instance that the new text
-     *                  object that is to be stored in the cell instance
-     *                  should use.  If it's NULL, it uses the default pool
-     *                  for edit cells from the document instance (one
-     *                  returned from GetEditPool()).
-     */
-    ScEditCell(const EditTextObject& rObject, ScDocument* pDoc, const SfxItemPool* pFromPool);
-    ScEditCell(const ScEditCell& rCell, ScDocument& rDoc, const ScAddress& rDestPos);
-
-    // for line breaks
-    ScEditCell(const OUString& rString, ScDocument* pDoc);
-
-    /**
-     * Remove the text data as well as string cache.
-     */
-    void ClearData();
-
-    /**
-     * Set new text data.  This method clones the passed text data and stores
-     * the clone; the caller is responsible for deleting the text data
-     * instance after the call.
-     *
-     * @param rObject text object to clone from.
-     * @param pFromPool pointer to SfxItemPool instance that the new text
-     *                  object that is to be stored in the cell instance
-     *                  should use.  If it's NULL, it uses the default pool
-     *                  for edit cells from the document instance (one
-     *                  returned from GetEditPool()).
-     */
-    void SetData(const EditTextObject& rObject, const SfxItemPool* pFromPool);
-
-    /**
-     * Set new text data. The passed text data instance will be owned by the
-     * cell.  The caller must ensure that the text data uses the SfxItemPool
-     * instance returned from ScDocument::GetEditPool().
-     */
-    void SetData(EditTextObject* pObject);
-
-    OUString GetString() const;
-
-    const EditTextObject* GetData() const;
-
-    /** Removes character attribute based on new pattern attributes. */
-    void            RemoveCharAttribs( const ScPatternAttr& rAttr );
-
-    /** Update field items if any. */
-    void UpdateFields(SCTAB nTab);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
deleted file mode 100644
index 102daef..0000000
--- a/sc/source/core/data/cell.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#include "cell.hxx"
-
-#include "document.hxx"
-#include "formulacell.hxx"
-
-#include <svl/broadcast.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-#ifdef USE_MEMPOOL
-IMPL_FIXEDMEMPOOL_NEWDEL( ScValueCell )
-IMPL_FIXEDMEMPOOL_NEWDEL( ScStringCell )
-#endif
-
-// ============================================================================
-
-ScBaseCell::ScBaseCell( CellType eNewType ) :
-    eCellType( sal::static_int_cast<sal_uInt8>(eNewType) )
-{
-}
-
-ScBaseCell::ScBaseCell( const ScBaseCell& rCell ) :
-    eCellType( rCell.eCellType )
-{
-}
-
-ScBaseCell::~ScBaseCell()
-{
-}
-
-namespace {
-
-ScBaseCell* lclCloneCell( const ScBaseCell& rSrcCell, ScDocument& rDestDoc, const ScAddress& rDestPos )
-{
-    switch( rSrcCell.GetCellType() )
-    {
-        case CELLTYPE_VALUE:
-            return new ScValueCell( static_cast< const ScValueCell& >( rSrcCell ) );
-        case CELLTYPE_STRING:
-            return new ScStringCell( static_cast< const ScStringCell& >( rSrcCell ) );
-        case CELLTYPE_EDIT:
-            return new ScEditCell(static_cast<const ScEditCell&>(rSrcCell), rDestDoc, rDestPos);
-        default:;
-    }
-    OSL_FAIL( "lclCloneCell - unknown cell type" );
-    return 0;
-}
-
-} // namespace
-
-ScBaseCell* ScBaseCell::Clone( ScDocument& rDestDoc, int ) const
-{
-    // notes will not be cloned -> cell address only needed for formula cells
-    ScAddress aDestPos;
-    return lclCloneCell( *this, rDestDoc, aDestPos );
-}
-
-ScBaseCell* ScBaseCell::Clone( ScDocument& rDestDoc, const ScAddress& rDestPos, int ) const
-{
-    return lclCloneCell( *this, rDestDoc, rDestPos );
-}
-
-bool ScBaseCell::HasEmptyData() const
-{
-    switch ( eCellType )
-    {
-        case CELLTYPE_FORMULA :
-            return ((ScFormulaCell*)this)->IsEmpty();
-        default:
-            return false;
-    }
-}
-
-
-bool ScBaseCell::HasValueData() const
-{
-    switch ( eCellType )
-    {
-        case CELLTYPE_VALUE :
-            return true;
-        case CELLTYPE_FORMULA :
-            return ((ScFormulaCell*)this)->IsValue();
-        default:
-            return false;
-    }
-}
-
-
-bool ScBaseCell::HasStringData() const
-{
-    switch ( eCellType )
-    {
-        case CELLTYPE_STRING :
-        case CELLTYPE_EDIT :
-            return true;
-        case CELLTYPE_FORMULA :
-            return !((ScFormulaCell*)this)->IsValue();
-        default:
-            return false;
-    }
-}
-
-OUString ScBaseCell::GetStringData() const
-{
-    OUString aStr;
-    switch ( eCellType )
-    {
-        case CELLTYPE_STRING:
-            aStr = ((const ScStringCell*)this)->GetString();
-            break;
-        case CELLTYPE_EDIT:
-            aStr = ((const ScEditCell*)this)->GetString();
-            break;
-        case CELLTYPE_FORMULA:
-            aStr = ((ScFormulaCell*)this)->GetString();      // On the Formula cells are not constant
-            break;
-    }
-    return aStr;
-}
-
-ScValueCell::ScValueCell( double fValue ) :
-    ScBaseCell( CELLTYPE_VALUE ),
-    mfValue( fValue )
-{
-}
-
-#if OSL_DEBUG_LEVEL > 0
-ScValueCell::~ScValueCell()
-{
-}
-#endif
-
-// ============================================================================
-
-ScStringCell::ScStringCell( const OUString& rString ) :
-    ScBaseCell( CELLTYPE_STRING ),
-    maString( rString.intern() )
-{
-}
-
-#if OSL_DEBUG_LEVEL > 0
-ScStringCell::~ScStringCell()
-{
-}
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
deleted file mode 100644
index 4503086..0000000
--- a/sc/source/core/data/cell2.cxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#include "cell.hxx"
-
-#include "document.hxx"
-#include "editutil.hxx"
-
-#include "editeng/editobj.hxx"
-#include "editeng/editstat.hxx"
-#include "editeng/fieldupdater.hxx"
-
-// STATIC DATA -----------------------------------------------------------
-
-#ifdef USE_MEMPOOL
-IMPL_FIXEDMEMPOOL_NEWDEL( ScEditCell )
-#endif
-
-// ============================================================================
-
-ScEditCell::ScEditCell(EditTextObject* pObject, ScDocument* pDoc) :
-    ScBaseCell(CELLTYPE_EDIT),
-    mpData(pObject), mpString(NULL), mpDoc(pDoc) {}
-
-ScEditCell::ScEditCell(
-    const EditTextObject& rObject, ScDocument* pDoc, const SfxItemPool* pFromPool) :
-    ScBaseCell(CELLTYPE_EDIT),
-    mpString(NULL),
-    mpDoc(pDoc)
-{
-    SetTextObject(&rObject, pFromPool);
-}
-
-ScEditCell::ScEditCell(const ScEditCell& rCell, ScDocument& rDoc, const ScAddress& rDestPos) :
-    ScBaseCell(rCell), mpString(NULL), mpDoc(&rDoc)
-{
-    SetTextObject( rCell.mpData, rCell.mpDoc->GetEditPool() );
-    UpdateFields(rDestPos.Tab());
-}
-
-ScEditCell::ScEditCell(const OUString& rString, ScDocument* pDoc)  :
-    ScBaseCell(CELLTYPE_EDIT),
-    mpData(NULL),
-    mpString(NULL),
-    mpDoc(pDoc)
-{
-    OSL_ENSURE( rString.indexOf('\n') != -1 ||
-                rString.indexOf(CHAR_CR) != -1,
-                "EditCell mit einfachem Text !?!?" );
-
-    EditEngine& rEngine = mpDoc->GetEditEngine();
-    rEngine.SetText( rString );
-    mpData = rEngine.CreateTextObject();
-}
-
-ScEditCell::~ScEditCell()
-{
-    delete mpData;
-    delete mpString;
-
-#if OSL_DEBUG_LEVEL > 0
-    eCellType = CELLTYPE_DESTROYED;
-#endif
-}
-
-void ScEditCell::ClearData()
-{
-    delete mpString;
-    mpString = NULL;
-    delete mpData;
-    mpData = NULL;
-}
-
-void ScEditCell::SetData(const EditTextObject& rObject, const SfxItemPool* pFromPool)
-{
-    ClearData();
-    SetTextObject(&rObject, pFromPool);
-}
-
-void ScEditCell::SetData(EditTextObject* pObject)
-{
-    ClearData();
-    mpData = pObject;
-}
-
-OUString ScEditCell::GetString() const
-{
-    if (mpString)
-        return *mpString;
-
-    if (mpData)
-    {
-        // Also Text from URL fields, Doc-Engine is a ScFieldEditEngine
-        EditEngine& rEngine = mpDoc->GetEditEngine();
-        rEngine.SetText(*mpData);
-        OUString sRet = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs
-        // cache short strings for formulas
-        if ( sRet.getLength() < 256 )
-            mpString = new OUString(sRet);   //! non-const
-        return sRet;
-    }
-
-    return OUString();
-}
-
-const EditTextObject* ScEditCell::GetData() const
-{
-    return mpData;
-}
-
-void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr )
-{
-    ScEditUtil::RemoveCharAttribs(*mpData, rAttr);
-}
-
-void ScEditCell::UpdateFields(SCTAB nTab)
-{
-    editeng::FieldUpdater aUpdater = mpData->GetFieldUpdater();
-    aUpdater.updateTableFields(nTab);
-}
-
-void ScEditCell::SetTextObject(
-    const EditTextObject* pObject, const SfxItemPool* pFromPool )
-{
-    if (!pObject)
-    {
-        mpData = NULL;
-        return;
-    }
-
-    if ( pFromPool && mpDoc->GetEditPool() == pFromPool )
-    {
-        mpData = pObject->Clone();
-        return;
-    }
-
-    mpData = ScEditUtil::Clone(*pObject, *mpDoc);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list