ooo-build r12139 - in trunk: . patches/src680
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r12139 - in trunk: . patches/src680
- Date: Wed, 9 Apr 2008 13:14:41 +0100 (BST)
Author: kyoshida
Date: Wed Apr 9 13:14:41 2008
New Revision: 12139
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12139&view=rev
Log:
2008-04-09 Kohei Yoshida <kyoshida novell com>
* patches/src680/sc-overwrite-char-font-attrs.diff: overwrite character
level font attributes (font name and size for now) when changing them at
cell level (n#374580).
* patches/src680/apply: apply the new patch.
Added:
trunk/patches/src680/sc-overwrite-char-font-attrs.diff
Modified:
trunk/ChangeLog
trunk/patches/src680/apply
Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply (original)
+++ trunk/patches/src680/apply Wed Apr 9 13:14:41 2008
@@ -761,6 +761,9 @@
# the value.
sc-formula-int-precision.diff, n#310706, i#86775, kohei
+# overwrite character level font attributes when changing them at cell level.
+sc-overwrite-char-font-attrs.diff, n#374580, kohei
+
[ LinuxOnly ]
# accelerate linking, by extreme cunning i#63927
speed-local-link-except.diff, i#63927, michael
Added: trunk/patches/src680/sc-overwrite-char-font-attrs.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/sc-overwrite-char-font-attrs.diff Wed Apr 9 13:14:41 2008
@@ -0,0 +1,946 @@
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/attarray.hxx sc/inc/attarray.hxx
+--- sc.clean/inc/attarray.hxx 2008-04-09 07:28:41.000000000 -0400
++++ sc/inc/attarray.hxx 2008-04-09 08:08:22.000000000 -0400
+@@ -45,6 +45,7 @@
+ #endif
+
+ class ScDocument;
++class ScEditDataArray;
+ class ScMarkArray;
+ class ScPatternAttr;
+ class ScStyleSheet;
+@@ -135,9 +136,11 @@ public:
+ SCROW nStartRow, SCROW nEndRow, BOOL bLeft, SCCOL nDistRight );
+
+ void SetPattern( SCROW nRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE );
+- void SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE);
++ void SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern,
++ BOOL bPutToPool = FALSE, ScEditDataArray* pDataArray = NULL );
+ void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle );
+- void ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache );
++ void ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache,
++ ScEditDataArray* pDataArray = NULL );
+ void ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
+ const SvxBorderLine* pLine, BOOL bColorOnly );
+
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/cell.hxx sc/inc/cell.hxx
+--- sc.clean/inc/cell.hxx 2008-04-09 07:28:41.000000000 -0400
++++ sc/inc/cell.hxx 2008-04-09 08:08:35.000000000 -0400
+@@ -39,6 +39,7 @@
+ #include <stddef.h>
+
+ #include <set>
++#include <vector>
+
+ #ifndef _SVMEMPOOL_HXX //autogen
+ #include <tools/mempool.hxx>
+@@ -61,6 +62,8 @@
+ #include <vcl/fontcvt.hxx>
+ #endif
+
++#include <boost/shared_ptr.hpp>
++
+ #define USE_MEMPOOL
+ #define TEXTWIDTH_DIRTY 0xffff
+
+@@ -76,6 +79,7 @@ class ScCodeArray;
+ class ScTokenArray;
+ class ScProgress;
+ class ScPostIt;
++class ScPatternAttr;
+
+ class ScMultipleReadHeader;
+ class ScMultipleWriteHeader;
+@@ -230,8 +234,57 @@ public:
+ const EditTextObject* GetData() const { return pData; }
+
+ void Save( SvStream& rStream ) const;
++
++ /** Removes character attribute based on new pattern attributes. */
++ void RemoveCharAttribs( const ScPatternAttr& rAttr );
+ };
+
++// ----------------------------------------------------------------------------
++
++class ScEditDataArray
++{
++public:
++ class Item
++ {
++ public:
++ explicit Item(SCTAB nTab, SCCOL nCol, SCROW nRow,
++ EditTextObject* pOldData, EditTextObject* pNewData);
++ ~Item();
++
++ const EditTextObject* GetOldData() const;
++ const EditTextObject* GetNewData() const;
++ SCTAB GetTab() const;
++ SCCOL GetCol() const;
++ SCROW GetRow() const;
++
++ private:
++ Item(); // disabled
++
++ private:
++ ::boost::shared_ptr<EditTextObject> mpOldData;
++ ::boost::shared_ptr<EditTextObject> mpNewData;
++ SCTAB mnTab;
++ SCCOL mnCol;
++ SCROW mnRow;
++
++ };
++
++ ScEditDataArray();
++ ~ScEditDataArray();
++
++ void AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow,
++ EditTextObject* pOldData, EditTextObject* pNewData);
++
++ const Item* First();
++ const Item* Next();
++
++private:
++ ::std::vector<Item>::const_iterator maIter;
++ ::std::vector<Item> maArray;
++};
++
++// ----------------------------------------------------------------------------
++
+ enum ScMatrixMode {
+ MM_NONE = 0, // keine Matrixformel
+ MM_FORMULA = 1, // Matrixformel
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/column.hxx sc/inc/column.hxx
+--- sc.clean/inc/column.hxx 2008-04-09 07:28:41.000000000 -0400
++++ sc/inc/column.hxx 2008-04-09 08:08:22.000000000 -0400
+@@ -73,6 +73,7 @@ class ScAttrIterator;
+ class ScAttrArray;
+ class ScBaseCell;
+ class ScDocument;
++class ScEditDataArray;
+ class ScFormulaCell;
+ class ScMarkData;
+ class ScMultipleReadHeader;
+@@ -333,7 +334,8 @@ public:
+
+ void ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
+ void ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
+- void ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr );
++ void ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
++ ScEditDataArray* pDataArray = NULL );
+ void SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, BOOL bPutToPool = FALSE );
+ void SetPatternArea( SCROW nStartRow, SCROW nEndRow,
+ const ScPatternAttr& rPatAttr, BOOL bPutToPool = FALSE );
+@@ -365,7 +367,7 @@ public:
+
+ void RemoveProtected( SCROW nStartRow, SCROW nEndRow );
+
+- SCsROW ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
++ SCsROW ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
+ void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
+
+ void ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/document.hxx sc/inc/document.hxx
+--- sc.clean/inc/document.hxx 2008-04-09 07:28:41.000000000 -0400
++++ sc/inc/document.hxx 2008-04-09 08:08:22.000000000 -0400
+@@ -1130,7 +1130,8 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollec
+ const ScPatternAttr& rAttr );
+ void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
+ SCCOL nEndCol, SCROW nEndRow,
+- const ScMarkData& rMark, const ScPatternAttr& rAttr );
++ const ScMarkData& rMark, const ScPatternAttr& rAttr,
++ ScEditDataArray* pDataArray = NULL );
+ void ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
+ SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
+ const ScPatternAttr& rAttr );
+@@ -1197,7 +1198,8 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollec
+ SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
+ const String& sValStr, double& nX);
+
+- void ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark );
++ void ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
++ ScEditDataArray* pDataArray = NULL );
+ void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
+ void DeleteSelectionTab( SCTAB nTab, USHORT nDelFlag, const ScMarkData& rMark );
+
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/document.hxx.orig sc/inc/document.hxx.orig
+--- sc.clean/inc/document.hxx.orig 2008-04-09 07:28:41.000000000 -0400
++++ sc/inc/document.hxx.orig 2008-04-09 08:08:22.000000000 -0400
+@@ -162,6 +162,7 @@ class ScAutoNameCache;
+ class ScTemporaryChartLock;
+ class ScLookupCache;
+ struct ScLookupCacheMapImpl;
++struct ScTableViewOptions;
+
+ namespace com { namespace sun { namespace star {
+ namespace lang {
+@@ -1716,6 +1717,8 @@ public:
+ /// an ID unique to each document instance
+ sal_uInt32 GetDocumentID() const;
+
++ ScTableViewOptions* GetTableViewOptions( SCTAB nTab ) const;
++
+ void InvalidateStyleSheetUsage()
+ { bStyleSheetUsageInvalid = TRUE; }
+ void GetSortParam( ScSortParam& rParam, SCTAB nTab );
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/table.hxx sc/inc/table.hxx
+--- sc.clean/inc/table.hxx 2008-04-09 07:28:41.000000000 -0400
++++ sc/inc/table.hxx 2008-04-09 08:08:22.000000000 -0400
+@@ -77,6 +77,7 @@ class ScAutoFormatData;
+ class ScBaseCell;
+ class ScDocument;
+ class ScDrawLayer;
++class ScEditDataArray;
+ class ScFormulaCell;
+ class ScOutlineTable;
+ class ScPostIt;
+@@ -472,7 +473,8 @@ public:
+
+ void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
+ void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
+- void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
++ void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
++ const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
+ void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE )
+ { aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool ); }
+ void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE );
+@@ -500,7 +502,7 @@ public:
+ BOOL ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
+ BOOL RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
+
+- void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
++ void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
+ void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
+
+ void ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/table.hxx.orig sc/inc/table.hxx.orig
+--- sc.clean/inc/table.hxx.orig 2008-04-09 07:28:41.000000000 -0400
++++ sc/inc/table.hxx.orig 2008-04-09 08:08:22.000000000 -0400
+@@ -37,6 +37,7 @@
+ #define SC_TABLE_HXX
+
+ #include <vector>
++#include <memory>
+
+ #ifndef _GEN_HXX //autogen
+ #include <tools/gen.hxx>
+@@ -91,6 +92,7 @@ class ScIndexMap;
+ struct RowInfo;
+ struct ScFunctionData;
+ struct ScLineFlags;
++struct ScTableViewOptions;
+ class CollatorWrapper;
+
+
+@@ -167,6 +169,8 @@ private:
+ USHORT nScenarioFlags;
+ BOOL bActiveScenario;
+
++ ::std::auto_ptr<ScTableViewOptions> pViewOptions;
++
+ friend class ScDocument; // fuer FillInfo
+ friend class ScDocumentIterator;
+ friend class ScValueIterator;
+@@ -184,6 +188,7 @@ public:
+ BOOL bColInfo = TRUE, BOOL bRowInfo = TRUE );
+ ~ScTable();
+
++ ScTableViewOptions* GetViewOptions();
+ ScOutlineTable* GetOutlineTable() { return pOutlineTable; }
+
+ ULONG GetCellCount() const;
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/data/attarray.cxx sc/source/core/data/attarray.cxx
+--- sc.clean/source/core/data/attarray.cxx 2008-04-09 07:28:45.000000000 -0400
++++ sc/source/core/data/attarray.cxx 2008-04-09 08:08:22.000000000 -0400
+@@ -46,6 +46,7 @@
+ #include <svx/bolnitem.hxx>
+ #include <svx/frmdiritem.hxx>
+ #include <svx/shaditem.hxx>
++#include <svx/editobj.hxx>
+ #include <svtools/poolcach.hxx>
+
+ #ifndef _SVX_FONTITEM_HXX
+@@ -65,7 +66,7 @@
+ #include "markarr.hxx"
+ #include "rechead.hxx"
+ #include "globstr.hrc"
+-
++#include "cell.hxx"
+
+ #undef DBG_INVALIDATE
+ #define DBGOUTPUT(s) \
+@@ -310,7 +311,8 @@ void ScAttrArray::SetPattern( SCROW nRow
+ }
+
+
+-void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern, BOOL bPutToPool )
++void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern,
++ BOOL bPutToPool, ScEditDataArray* pDataArray )
+ {
+ if (ValidRow(nStartRow) && ValidRow(nEndRow))
+ {
+@@ -480,6 +482,27 @@ void ScAttrArray::SetPatternArea(SCROW n
+ pData[nInsert-1].nRow = nStartRow - 1;
+ pData[nInsert].nRow = nEndRow;
+ pData[nInsert].pPattern = pPattern;
++
++ // Remove character attributes from these cells.
++ for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
++ {
++ ScBaseCell* pCell;
++ pDocument->GetCell(nCol, nRow, nTab, pCell);
++ if (pCell && pCell->GetCellType() == CELLTYPE_EDIT)
++ {
++ EditTextObject* pOldData = NULL;
++ ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
++ if (pDataArray)
++ pOldData = pEditCell->GetData()->Clone();
++ pEditCell->RemoveCharAttribs(*pPattern);
++ if (pDataArray)
++ {
++ EditTextObject* pNewData = pEditCell->GetData()->Clone();
++ pDataArray->AddItem(nTab, nCol, nRow, pOldData, pNewData);
++ }
++ }
++ }
++
+ nCount++;
+ }
+ }
+@@ -715,7 +738,7 @@ void ScAttrArray::ApplyLineStyleArea( SC
+ #undef SET_LINE
+
+
+-void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache )
++void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache, ScEditDataArray* pDataArray )
+ {
+ #ifdef DBG_UTIL
+ TestData();
+@@ -750,7 +773,7 @@ void ScAttrArray::ApplyCacheArea( SCROW
+ {
+ if (nY1 < nStartRow) nY1=nStartRow;
+ if (nY2 > nEndRow) nY2=nEndRow;
+- SetPatternArea( nY1, nY2, pNewPattern );
++ SetPatternArea( nY1, nY2, pNewPattern, false, pDataArray );
+ Search( nStart, nPos );
+ }
+ else
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/data/cell2.cxx sc/source/core/data/cell2.cxx
+--- sc.clean/source/core/data/cell2.cxx 2008-04-09 07:28:45.000000000 -0400
++++ sc/source/core/data/cell2.cxx 2008-04-09 08:08:22.000000000 -0400
+@@ -61,7 +61,8 @@
+ #include "editutil.hxx"
+ #include "chgtrack.hxx"
+ #include "indexmap.hxx"
+-
++#include "scitems.hxx"
++#include "patattr.hxx"
+
+ // STATIC DATA -----------------------------------------------------------
+
+@@ -201,6 +202,26 @@ void ScEditCell::Save( SvStream& rStream
+ pData->Store( rStream );
+ }
+
++void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr )
++{
++ const struct {
++ USHORT nAttrType;
++ USHORT nCharType;
++ } AttrTypeMap[] = {
++ { ATTR_FONT, EE_CHAR_FONTINFO },
++ { ATTR_FONT_HEIGHT, EE_CHAR_FONTHEIGHT }
++ };
++ USHORT nMapCount = sizeof(AttrTypeMap) / sizeof(AttrTypeMap[0]);
++
++ const SfxItemSet& rSet = rAttr.GetItemSet();
++ const SfxPoolItem* pItem;
++ for (USHORT i = 0; i < nMapCount; ++i)
++ {
++ if ( rSet.GetItemState(AttrTypeMap[i].nAttrType, false, &pItem) == SFX_ITEM_SET )
++ pData->RemoveCharAttribs(AttrTypeMap[i].nCharType);
++ }
++}
++
+ void ScEditCell::SetTextObject( const EditTextObject* pObject,
+ const SfxItemPool* pFromPool )
+ {
+@@ -236,6 +257,76 @@ void ScEditCell::SetTextObject( const Ed
+ pData = NULL;
+ }
+
++ScEditDataArray::ScEditDataArray()
++{
++}
++
++ScEditDataArray::~ScEditDataArray()
++{
++}
++
++void ScEditDataArray::AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow,
++ EditTextObject* pOldData, EditTextObject* pNewData)
++{
++ maArray.push_back(Item(nTab, nCol, nRow, pOldData, pNewData));
++}
++
++const ScEditDataArray::Item* ScEditDataArray::First()
++{
++ maIter = maArray.begin();
++ if (maIter == maArray.end())
++ return NULL;
++ return &(*maIter++);
++}
++
++const ScEditDataArray::Item* ScEditDataArray::Next()
++{
++ if (maIter == maArray.end())
++ return NULL;
++ return &(*maIter++);
++}
++
++//---------------------------------------------------------------------
++
++ScEditDataArray::Item::Item(SCTAB nTab, SCCOL nCol, SCROW nRow,
++ EditTextObject* pOldData, EditTextObject* pNewData) :
++ mnTab(nTab),
++ mnCol(nCol),
++ mnRow(nRow)
++{
++ mpOldData.reset(pOldData);
++ mpNewData.reset(pNewData);
++}
++
++ScEditDataArray::Item::~Item()
++{
++}
++
++const EditTextObject* ScEditDataArray::Item::GetOldData() const
++{
++ return mpOldData.get();
++}
++
++const EditTextObject* ScEditDataArray::Item::GetNewData() const
++{
++ return mpNewData.get();
++}
++
++SCTAB ScEditDataArray::Item::GetTab() const
++{
++ return mnTab;
++}
++
++SCCOL ScEditDataArray::Item::GetCol() const
++{
++ return mnCol;
++}
++
++SCROW ScEditDataArray::Item::GetRow() const
++{
++ return mnRow;
++}
++
+ //---------------------------------------------------------------------
+
+ void ScFormulaCell::GetEnglishFormula( String& rFormula, BOOL bCompileXML,
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/data/column.cxx sc/source/core/data/column.cxx
+--- sc.clean/source/core/data/column.cxx 2008-04-09 07:28:45.000000000 -0400
++++ sc/source/core/data/column.cxx 2008-04-09 08:08:22.000000000 -0400
+@@ -370,7 +370,7 @@ ULONG ScColumn::GetNumberFormat( SCROW n
+ }
+
+
+-SCsROW ScColumn::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark )
++SCsROW ScColumn::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray )
+ {
+ SCROW nTop = 0;
+ SCROW nBottom = 0;
+@@ -381,7 +381,7 @@ SCsROW ScColumn::ApplySelectionCache( Sf
+ ScMarkArrayIter aMarkIter( rMark.GetArray() + nCol );
+ while (aMarkIter.Next( nTop, nBottom ))
+ {
+- pAttrArray->ApplyCacheArea( nTop, nBottom, pCache );
++ pAttrArray->ApplyCacheArea( nTop, nBottom, pCache, pDataArray );
+ bFound = TRUE;
+ }
+ }
+@@ -455,11 +455,12 @@ void ScColumn::ApplyPattern( SCROW nRow,
+ }
+
+
+-void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr )
++void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
++ ScEditDataArray* pDataArray )
+ {
+ const SfxItemSet* pSet = &rPatAttr.GetItemSet();
+ SfxItemPoolCache aCache( pDocument->GetPool(), pSet );
+- pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache );
++ pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache, pDataArray );
+ }
+
+
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/data/document.cxx sc/source/core/data/document.cxx
+--- sc.clean/source/core/data/document.cxx 2008-04-09 07:28:45.000000000 -0400
++++ sc/source/core/data/document.cxx 2008-04-09 08:08:22.000000000 -0400
+@@ -3049,12 +3049,13 @@ void ScDocument::ApplyPattern( SCCOL nCo
+ void ScDocument::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
+ SCCOL nEndCol, SCROW nEndRow,
+ const ScMarkData& rMark,
+- const ScPatternAttr& rAttr )
++ const ScPatternAttr& rAttr,
++ ScEditDataArray* pDataArray )
+ {
+ for (SCTAB i=0; i <= MAXTAB; i++)
+ if (pTab[i])
+ if (rMark.GetTableSelect(i))
+- pTab[i]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr );
++ pTab[i]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr, pDataArray );
+ }
+
+
+@@ -4143,7 +4144,7 @@ void ScDocument::ApplyFrameAreaTab( cons
+ }
+
+
+-void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark )
++void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark, ScEditDataArray* pDataArray )
+ {
+ const SfxItemSet* pSet = &rAttr.GetItemSet();
+ BOOL bSet = FALSE;
+@@ -4160,7 +4161,7 @@ void ScDocument::ApplySelectionPattern(
+ ScRange aRange;
+ rMark.GetMarkArea( aRange );
+ ApplyPatternArea( aRange.aStart.Col(), aRange.aStart.Row(),
+- aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr );
++ aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr, pDataArray );
+ }
+ else
+ {
+@@ -4168,7 +4169,7 @@ void ScDocument::ApplySelectionPattern(
+ for (SCTAB nTab=0; nTab<=MAXTAB; nTab++)
+ if (pTab[nTab])
+ if (rMark.GetTableSelect(nTab))
+- pTab[nTab]->ApplySelectionCache( &aCache, rMark );
++ pTab[nTab]->ApplySelectionCache( &aCache, rMark, pDataArray );
+ }
+ }
+ }
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/data/document.cxx.orig sc/source/core/data/document.cxx.orig
+--- sc.clean/source/core/data/document.cxx.orig 2008-04-09 07:28:45.000000000 -0400
++++ sc/source/core/data/document.cxx.orig 2008-04-09 08:08:22.000000000 -0400
+@@ -3608,8 +3608,8 @@ BOOL ScDocument::IsBlockEditable( SCTAB
+ SCCOL nEndCol, SCROW nEndRow,
+ BOOL* pOnlyNotBecauseOfMatrix /* = NULL */ ) const
+ {
+- // import into read-only document is possible - must be extended if other filters use api
+- if ( pShell && pShell->IsReadOnly() && !bImportingXML )
++ // import into read-only document is possible
++ if ( !bImportingXML && !mbChangeReadOnlyEnabled && pShell && pShell->IsReadOnly() )
+ {
+ if ( pOnlyNotBecauseOfMatrix )
+ *pOnlyNotBecauseOfMatrix = FALSE;
+@@ -3632,8 +3632,8 @@ BOOL ScDocument::IsSelectedBlockEditable
+ SCCOL nEndCol, SCROW nEndRow,
+ const ScMarkData& rMark ) const
+ {
+- // import into read-only document is possible - must be extended if other filters use api
+- if ( pShell && pShell->IsReadOnly() && !bImportingXML )
++ // import into read-only document is possible
++ if ( !bImportingXML && !mbChangeReadOnlyEnabled && pShell && pShell->IsReadOnly() )
+ return FALSE;
+
+ BOOL bOk = TRUE;
+@@ -3650,8 +3650,8 @@ BOOL ScDocument::IsSelectedBlockEditable
+ BOOL ScDocument::IsSelectionEditable( const ScMarkData& rMark,
+ BOOL* pOnlyNotBecauseOfMatrix /* = NULL */ ) const
+ {
+- // import into read-only document is possible - must be extended if other filters use api
+- if ( pShell && pShell->IsReadOnly() && !bImportingXML )
++ // import into read-only document is possible
++ if ( !bImportingXML && !mbChangeReadOnlyEnabled && pShell && pShell->IsReadOnly() )
+ {
+ if ( pOnlyNotBecauseOfMatrix )
+ *pOnlyNotBecauseOfMatrix = FALSE;
+@@ -3701,8 +3701,8 @@ BOOL ScDocument::IsSelectionOrBlockEdita
+ SCCOL nEndCol, SCROW nEndRow,
+ const ScMarkData& rMark ) const
+ {
+- // import into read-only document is possible - must be extended if other filters use api
+- if ( pShell && pShell->IsReadOnly() && !bImportingXML )
++ // import into read-only document is possible
++ if ( !bImportingXML && !mbChangeReadOnlyEnabled && pShell && pShell->IsReadOnly() )
+ return FALSE;
+
+ BOOL bOk = TRUE;
+@@ -3734,8 +3734,8 @@ BOOL ScDocument::IsSelectedOrBlockEditab
+ SCCOL nEndCol, SCROW nEndRow,
+ const ScMarkData& rMark ) const
+ {
+- // import into read-only document is possible - must be extended if other filters use api
+- if ( pShell && pShell->IsReadOnly() && !bImportingXML )
++ // import into read-only document is possible
++ if ( !bImportingXML && !mbChangeReadOnlyEnabled && pShell && pShell->IsReadOnly() )
+ return FALSE;
+
+ BOOL bOk = TRUE;
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/data/table2.cxx sc/source/core/data/table2.cxx
+--- sc.clean/source/core/data/table2.cxx 2008-04-09 07:28:45.000000000 -0400
++++ sc/source/core/data/table2.cxx 2008-04-09 08:08:22.000000000 -0400
+@@ -1657,14 +1657,14 @@ void ScTable::ApplyPattern( SCCOL nCol,
+
+
+ void ScTable::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
+- const ScPatternAttr& rAttr )
++ const ScPatternAttr& rAttr, ScEditDataArray* pDataArray )
+ {
+ if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow))
+ {
+ PutInOrder(nStartCol, nEndCol);
+ PutInOrder(nStartRow, nEndRow);
+ for (SCCOL i = nStartCol; i <= nEndCol; i++)
+- aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr);
++ aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr, pDataArray);
+ }
+ }
+
+@@ -1872,10 +1872,11 @@ void ScTable::ApplyAttr( SCCOL nCol, SCR
+ }
+
+
+-void ScTable::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark )
++void ScTable::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark,
++ ScEditDataArray* pDataArray )
+ {
+ for (SCCOL i=0; i<=MAXCOL; i++)
+- aCol[i].ApplySelectionCache( pCache, rMark );
++ aCol[i].ApplySelectionCache( pCache, rMark, pDataArray );
+ }
+
+
+Only in sc/source/filter/excel: xlocx.cxx.orig
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/inc/undoblk.hxx sc/source/ui/inc/undoblk.hxx
+--- sc.clean/source/ui/inc/undoblk.hxx 2008-04-09 07:28:43.000000000 -0400
++++ sc/source/ui/inc/undoblk.hxx 2008-04-09 08:08:22.000000000 -0400
+@@ -48,6 +48,10 @@
+ #include "spellparam.hxx"
+ #endif
+
++#include "cell.hxx"
++
++#include <boost/shared_ptr.hpp>
++
+ class ScDocShell;
+ class ScDocument;
+ class ScOutlineTable;
+@@ -360,9 +364,11 @@ public:
+
+ virtual String GetComment() const;
+
++ ScEditDataArray* GetDataArray();
+ private:
+ ScMarkData aMarkData;
+ ScRange aRange;
++ ScEditDataArray aDataArray;
+ ScDocument* pUndoDoc;
+ BOOL bMulti;
+ ScPatternAttr* pApplyPattern;
+@@ -370,6 +376,7 @@ private:
+ SvxBoxInfoItem* pLineInner;
+
+ void DoChange( const BOOL bUndo );
++ void ChangeEditData( const bool bUndo );
+ };
+
+
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/inc/undocell.hxx sc/source/ui/inc/undocell.hxx
+--- sc.clean/source/ui/inc/undocell.hxx 2008-04-09 07:28:43.000000000 -0400
++++ sc/source/ui/inc/undocell.hxx 2008-04-09 08:08:22.000000000 -0400
+@@ -43,6 +43,8 @@
+ #include "postit.hxx"
+ #endif
+
++#include <boost/shared_ptr.hpp>
++
+ class ScDocShell;
+ class ScBaseCell;
+ class ScPatternAttr;
+@@ -71,6 +73,11 @@ public:
+
+ virtual String GetComment() const;
+
++ /** once the objects are passed to this class, their life-cycle is
++ managed by this class; the calling function must pass new'ed
++ objects to this method. */
++ void SetEditData( EditTextObject* pOld, EditTextObject* pNew );
++
+ private:
+ SCCOL nCol;
+ SCROW nRow;
+@@ -78,9 +85,11 @@ private:
+ ScPatternAttr* pOldPattern;
+ ScPatternAttr* pNewPattern;
+ ScPatternAttr* pApplyPattern;
++ ::boost::shared_ptr<EditTextObject> pOldEditData;
++ ::boost::shared_ptr<EditTextObject> pNewEditData;
+ BOOL bIsAutomatic;
+
+- void DoChange( const ScPatternAttr* pWhichPattern ) const;
++ void DoChange( const ScPatternAttr* pWhichPattern, const ::boost::shared_ptr<EditTextObject>& pEditData ) const;
+ };
+
+
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/makefile.mk sc/source/ui/undo/makefile.mk
+--- sc.clean/source/ui/undo/makefile.mk 2008-04-09 07:28:44.000000000 -0400
++++ sc/source/ui/undo/makefile.mk 2008-04-09 08:08:22.000000000 -0400
+@@ -89,6 +89,7 @@ SLOFILES = \
+ $(SLO)$/undotab.obj
+
+ EXCEPTIONSFILES= \
++ $(SLO)$/undocell.obj \
+ $(SLO)$/undostyl.obj
+
+ # --- Tagets -------------------------------------------------------
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undoblk3.cxx sc/source/ui/undo/undoblk3.cxx
+--- sc.clean/source/ui/undo/undoblk3.cxx 2008-04-09 07:28:44.000000000 -0400
++++ sc/source/ui/undo/undoblk3.cxx 2008-04-09 08:08:22.000000000 -0400
+@@ -473,6 +473,12 @@ String __EXPORT ScUndoSelectionAttr::Get
+ return ScGlobal::GetRscString( pLineOuter ? STR_UNDO_SELATTRLINES : STR_UNDO_SELATTR );
+ }
+
++//----------------------------------------------------------------------------
++
++ScEditDataArray* ScUndoSelectionAttr::GetDataArray()
++{
++ return &aDataArray;
++}
+
+ //----------------------------------------------------------------------------
+
+@@ -495,6 +501,8 @@ void ScUndoSelectionAttr::DoChange( cons
+ USHORT nExtFlags = 0;
+ pDocShell->UpdatePaintExt( nExtFlags, aEffRange );
+
++ ChangeEditData(bUndo);
++
+ if (bUndo) // nur bei Undo
+ {
+ ScRange aCopyRange = aRange;
+@@ -519,6 +527,24 @@ void ScUndoSelectionAttr::DoChange( cons
+ ShowTable( aRange );
+ }
+
++void ScUndoSelectionAttr::ChangeEditData( const bool bUndo )
++{
++ ScDocument* pDoc = pDocShell->GetDocument();
++ for (const ScEditDataArray::Item* pItem = aDataArray.First(); pItem; pItem = aDataArray.Next())
++ {
++ ScBaseCell* pCell;
++ pDoc->GetCell(pItem->GetCol(), pItem->GetRow(), pItem->GetTab(), pCell);
++ if (!pCell || pCell->GetCellType() != CELLTYPE_EDIT)
++ continue;
++
++ ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
++ if (bUndo)
++ pEditCell->SetData(pItem->GetOldData(), NULL);
++ else
++ pEditCell->SetData(pItem->GetNewData(), NULL);
++ }
++}
++
+
+ //----------------------------------------------------------------------------
+
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undoblk3.cxx.orig sc/source/ui/undo/undoblk3.cxx.orig
+--- sc.clean/source/ui/undo/undoblk3.cxx.orig 2008-04-09 07:28:44.000000000 -0400
++++ sc/source/ui/undo/undoblk3.cxx.orig 2008-04-09 08:08:22.000000000 -0400
+@@ -39,6 +39,7 @@
+ // INCLUDE -------------------------------------------------------------------
+
+ #include "scitems.hxx"
++#include <svx/algitem.hxx>
+ #include <svx/boxitem.hxx>
+ #include <svx/srchitem.hxx>
+ #include <svx/linkmgr.hxx>
+@@ -772,13 +773,15 @@ BOOL __EXPORT ScUndoAutoFill::CanRepeat(
+ ScUndoMerge::ScUndoMerge( ScDocShell* pNewDocShell,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+- BOOL bNewDoMerge, ScDocument* pNewUndoDoc )
++ BOOL bNewDoMerge, ScDocument* pNewUndoDoc,
++ BOOL bNewCenter )
+ //
+ : ScSimpleUndo( pNewDocShell ),
+ //
+ aRange ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
+ bDoMerge( bNewDoMerge ),
+- pUndoDoc( pNewUndoDoc )
++ pUndoDoc( pNewUndoDoc ),
++ bCenter ( bNewCenter )
+ {
+ }
+
+@@ -825,9 +828,20 @@ void ScUndoMerge::DoChange( const BOOL b
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pDoc );
+ }
+ else
++ {
+ /*!*/ pDoc->DoMergeContents( aRange.aStart.Tab(),
+ aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row() );
++ if (bCenter)
++ {
++ pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
++ aRange.aStart.Tab(),
++ SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER ) );
++ pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
++ aRange.aStart.Tab(),
++ SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER ) );
++ }
++ }
+
+ BOOL bDidPaint = FALSE;
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undocell.cxx sc/source/ui/undo/undocell.cxx
+--- sc.clean/source/ui/undo/undocell.cxx 2008-04-09 07:28:44.000000000 -0400
++++ sc/source/ui/undo/undocell.cxx 2008-04-09 08:08:22.000000000 -0400
+@@ -66,6 +66,8 @@
+ #include "chgtrack.hxx"
+ #include "sc.hrc"
+
++using ::boost::shared_ptr;
++
+ // STATIC DATA -----------------------------------------------------------
+
+ TYPEINIT1(ScUndoCursorAttr, ScSimpleUndo);
+@@ -94,6 +96,8 @@ ScUndoCursorAttr::ScUndoCursorAttr( ScDo
+ nCol( nNewCol ),
+ nRow( nNewRow ),
+ nTab( nNewTab ),
++ pOldEditData( static_cast<EditTextObject*>(NULL) ),
++ pNewEditData( static_cast<EditTextObject*>(NULL) ),
+ bIsAutomatic( bAutomatic )
+ {
+ ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+@@ -118,9 +122,21 @@ String __EXPORT ScUndoCursorAttr::GetCom
+ return ScGlobal::GetRscString( nId );
+ }
+
+-void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern ) const
++void ScUndoCursorAttr::SetEditData( EditTextObject* pOld, EditTextObject* pNew )
+ {
+- pDocShell->GetDocument()->SetPattern( nCol, nRow, nTab, *pWhichPattern, TRUE );
++ pOldEditData.reset(pOld);
++ pNewEditData.reset(pNew);
++}
++
++void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern, const shared_ptr<EditTextObject>& pEditData ) const
++{
++ ScDocument* pDoc = pDocShell->GetDocument();
++ pDoc->SetPattern( nCol, nRow, nTab, *pWhichPattern, TRUE );
++
++ ScBaseCell* pCell;
++ pDoc->GetCell(nCol, nRow, nTab, pCell);
++ if (pCell && pCell->GetCellType() == CELLTYPE_EDIT && pEditData.get())
++ static_cast<ScEditCell*>(pCell)->SetData(pEditData.get(), NULL);
+
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (pViewShell)
+@@ -146,7 +162,7 @@ void ScUndoCursorAttr::DoChange( const S
+ void __EXPORT ScUndoCursorAttr::Undo()
+ {
+ BeginUndo();
+- DoChange(pOldPattern);
++ DoChange(pOldPattern, pOldEditData);
+
+ if ( bIsAutomatic )
+ {
+@@ -164,7 +180,7 @@ void __EXPORT ScUndoCursorAttr::Undo()
+ void __EXPORT ScUndoCursorAttr::Redo()
+ {
+ BeginRedo();
+- DoChange(pNewPattern);
++ DoChange(pNewPattern, pNewEditData);
+ EndRedo();
+ }
+
+Only in sc/source/ui/view: select.cxx.orig
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/viewfunc.cxx sc/source/ui/view/viewfunc.cxx
+--- sc.clean/source/ui/view/viewfunc.cxx 2008-04-09 07:28:44.000000000 -0400
++++ sc/source/ui/view/viewfunc.cxx 2008-04-09 08:08:22.000000000 -0400
+@@ -1294,6 +1294,8 @@ void ScViewFunc::ApplySelectionPattern(
+ SCROW nEndRow = aMarkRange.aEnd.Row();
+ SCTAB nEndTab = aMarkRange.aEnd.Tab();
+
++ ScUndoSelectionAttr* pUndoAttr = NULL;
++ ScEditDataArray* pEditDataArray = NULL;
+ if (bRecord)
+ {
+ ScRange aCopyRange = aMarkRange;
+@@ -1310,15 +1312,14 @@ void ScViewFunc::ApplySelectionPattern(
+
+ aFuncMark.MarkToMulti();
+
+- pDocSh->GetUndoManager()->AddUndoAction(
+- new ScUndoSelectionAttr(
+- pDocSh, aFuncMark,
+- nStartCol, nStartRow, nStartTab,
+- nEndCol, nEndRow, nEndTab,
+- pUndoDoc, bMulti, &rAttr ) );
++ pUndoAttr = new ScUndoSelectionAttr(
++ pDocSh, aFuncMark, nStartCol, nStartRow, nStartTab,
++ nEndCol, nEndRow, nEndTab, pUndoDoc, bMulti, &rAttr );
++ pDocSh->GetUndoManager()->AddUndoAction(pUndoAttr);
++ pEditDataArray = pUndoAttr->GetDataArray();
+ }
+
+- pDoc->ApplySelectionPattern( rAttr, aFuncMark );
++ pDoc->ApplySelectionPattern( rAttr, aFuncMark, pEditDataArray );
+
+ pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
+ nEndCol, nEndRow, nEndTab,
+@@ -1332,6 +1333,19 @@ void ScViewFunc::ApplySelectionPattern(
+ SCCOL nCol = pViewData->GetCurX();
+ SCROW nRow = pViewData->GetCurY();
+ SCTAB nTab = pViewData->GetTabNo();
++
++ ScBaseCell* pCell;
++ pDoc->GetCell(nCol, nRow, nTab, pCell);
++ EditTextObject* pOldEditData = NULL;
++ EditTextObject* pNewEditData = NULL;
++ if (pCell && pCell->GetCellType() == CELLTYPE_EDIT)
++ {
++ ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
++ pOldEditData = pEditCell->GetData()->Clone();
++ pEditCell->RemoveCharAttribs(rAttr);
++ pNewEditData = pEditCell->GetData()->Clone();
++ }
++
+ ScPatternAttr* pOldPat = new ScPatternAttr(*pDoc->GetPattern( nCol, nRow, nTab ));
+
+ if (!bCursorOnly)
+@@ -1341,11 +1355,10 @@ void ScViewFunc::ApplySelectionPattern(
+
+ if (bRecord)
+ {
+- pDocSh->GetUndoManager()->AddUndoAction(
+- new ScUndoCursorAttr( pDocSh,
+- nCol, nRow, nTab,
+- pOldPat, pNewPat, &rAttr,
+- FALSE ) ); // FALSE = nicht automatisch
++ ScUndoCursorAttr* pUndo = new ScUndoCursorAttr(
++ pDocSh, nCol, nRow, nTab, pOldPat, pNewPat, &rAttr, false );
++ pUndo->SetEditData(pOldEditData, pNewEditData);
++ pDocSh->GetUndoManager()->AddUndoAction(pUndo);
+ }
+ delete pOldPat; // wird im Undo kopiert (Pool)
+
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/viewfunc.cxx.orig sc/source/ui/view/viewfunc.cxx.orig
+--- sc.clean/source/ui/view/viewfunc.cxx.orig 2008-04-09 07:28:44.000000000 -0400
++++ sc/source/ui/view/viewfunc.cxx.orig 2008-04-09 08:08:22.000000000 -0400
+@@ -887,7 +887,7 @@ void ScViewFunc::EnterMatrix( const Stri
+ if (pData->GetSimpleArea(aRange))
+ {
+ ScDocShell* pDocSh = pData->GetDocShell();
+- BOOL bSuccess = pDocSh->GetDocFunc().EnterMatrix( aRange, &rMark, rString, FALSE, FALSE );
++ BOOL bSuccess = pDocSh->GetDocFunc().EnterMatrix( aRange, &rMark, NULL, rString, FALSE, FALSE );
+ if (bSuccess)
+ pDocSh->UpdateOle(GetViewData());
+ }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]