View | Details | Raw Unified | Return to issue 53545
Collapse All | Expand All

(-)sc/inc/attarray.hxx (-2 / +8 lines)
Lines 35-40 Link Here
35
#include "attrib.hxx"
35
#include "attrib.hxx"
36
36
37
class ScDocument;
37
class ScDocument;
38
class ScEditDataArray;
38
class ScMarkArray;
39
class ScMarkArray;
39
class ScPatternAttr;
40
class ScPatternAttr;
40
class ScStyleSheet;
41
class ScStyleSheet;
Lines 104-109 friend void lcl_IterGetNumberFormat( ULONG& nFormat, Link Here
104
							SCROW nStartRow, SCROW nEndRow,
105
							SCROW nStartRow, SCROW nEndRow,
105
							BOOL bLeft, SCCOL nDistRight, BOOL bTop, SCROW nDistBottom );
106
							BOOL bLeft, SCCOL nDistRight, BOOL bTop, SCROW nDistBottom );
106
107
108
    void RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow, 
109
                              const ScPatternAttr* pPattern, ScEditDataArray* pDataArray );
110
107
public:
111
public:
108
			ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc );
112
			ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc );
109
			~ScAttrArray();
113
			~ScAttrArray();
Lines 125-133 public: Link Here
125
							SCROW nStartRow, SCROW nEndRow, BOOL bLeft, SCCOL nDistRight );
129
							SCROW nStartRow, SCROW nEndRow, BOOL bLeft, SCCOL nDistRight );
126
130
127
	void	SetPattern( SCROW nRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE );
131
	void	SetPattern( SCROW nRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE );
128
	void	SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE);
132
	void	SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern, 
133
                            BOOL bPutToPool = FALSE, ScEditDataArray* pDataArray = NULL );
129
	void	ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle );
134
	void	ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle );
130
	void	ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache );
135
	void	ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache, 
136
                            ScEditDataArray* pDataArray = NULL );
131
	void	ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
137
	void	ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
132
								const SvxBorderLine* pLine, BOOL bColorOnly );
138
								const SvxBorderLine* pLine, BOOL bColorOnly );
133
139
(-)sc/inc/cell.hxx (+53 lines)
Lines 34-39 Link Here
34
#include <stddef.h>
34
#include <stddef.h>
35
35
36
#include <set>
36
#include <set>
37
#include <vector>
38
#include <boost/shared_ptr.hpp>
39
37
#include <tools/mempool.hxx>
40
#include <tools/mempool.hxx>
38
#include <svtools/listener.hxx>
41
#include <svtools/listener.hxx>
39
#include "global.hxx"
42
#include "global.hxx"
Lines 58-63 class ScCodeArray; Link Here
58
class ScTokenArray;
61
class ScTokenArray;
59
class ScProgress;
62
class ScProgress;
60
class ScPostIt;
63
class ScPostIt;
64
class ScPatternAttr;
61
65
62
class ScMultipleReadHeader;
66
class ScMultipleReadHeader;
63
class ScMultipleWriteHeader;
67
class ScMultipleWriteHeader;
Lines 217-224 public: Link Here
217
	const EditTextObject* GetData() const	{ return pData; }
221
	const EditTextObject* GetData() const	{ return pData; }
218
222
219
	void			Save( SvStream& rStream ) const;
223
	void			Save( SvStream& rStream ) const;
224
225
    /** Removes character attribute based on new pattern attributes. */
226
    void            RemoveCharAttribs( const ScPatternAttr& rAttr );
227
};
228
229
// ----------------------------------------------------------------------------
230
231
class ScEditDataArray
232
{
233
public:
234
    class Item
235
    {
236
    public:
237
        explicit Item(SCTAB nTab, SCCOL nCol, SCROW nRow, 
238
                      EditTextObject* pOldData, EditTextObject* pNewData);
239
        ~Item();
240
    
241
        const EditTextObject* GetOldData() const;
242
        const EditTextObject* GetNewData() const;
243
        SCTAB GetTab() const;
244
        SCCOL GetCol() const;
245
        SCROW GetRow() const;
246
    
247
    private:
248
        Item(); // disabled
249
    
250
    private:
251
        ::boost::shared_ptr<EditTextObject> mpOldData;
252
        ::boost::shared_ptr<EditTextObject> mpNewData;
253
        SCTAB mnTab;
254
        SCCOL mnCol;
255
        SCROW mnRow;
256
257
    };
258
259
    ScEditDataArray();
260
    ~ScEditDataArray();
261
262
    void AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow, 
263
                 EditTextObject* pOldData, EditTextObject* pNewData);
264
265
    const Item* First();
266
    const Item* Next();
267
268
private:
269
    ::std::vector<Item>::const_iterator maIter;
270
    ::std::vector<Item> maArray;
220
};
271
};
221
272
273
// ----------------------------------------------------------------------------
274
222
enum ScMatrixMode {
275
enum ScMatrixMode {
223
    MM_NONE      = 0,                   // No matrix formula
276
    MM_NONE      = 0,                   // No matrix formula
224
    MM_FORMULA   = 1,                   // Upper left matrix formula cell
277
    MM_FORMULA   = 1,                   // Upper left matrix formula cell
(-)sc/inc/column.hxx (-2 / +4 lines)
Lines 56-61 class ScAttrIterator; Link Here
56
class ScAttrArray;
56
class ScAttrArray;
57
class ScBaseCell;
57
class ScBaseCell;
58
class ScDocument;
58
class ScDocument;
59
class ScEditDataArray;
59
class ScFormulaCell;
60
class ScFormulaCell;
60
class ScMarkData;
61
class ScMarkData;
61
class ScMultipleReadHeader;
62
class ScMultipleReadHeader;
Lines 316-322 public: Link Here
316
317
317
	void		ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
318
	void		ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
318
	void		ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
319
	void		ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
319
	void		ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr );
320
	void		ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr, 
321
                                  ScEditDataArray* pDataArray = NULL );
320
	void		SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, BOOL bPutToPool = FALSE );
322
	void		SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, BOOL bPutToPool = FALSE );
321
	void		SetPatternArea( SCROW nStartRow, SCROW nEndRow,
323
	void		SetPatternArea( SCROW nStartRow, SCROW nEndRow,
322
								const ScPatternAttr& rPatAttr, BOOL bPutToPool = FALSE );
324
								const ScPatternAttr& rPatAttr, BOOL bPutToPool = FALSE );
Lines 348-354 public: Link Here
348
350
349
	void		RemoveProtected( SCROW nStartRow, SCROW nEndRow );
351
	void		RemoveProtected( SCROW nStartRow, SCROW nEndRow );
350
352
351
	SCsROW		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
353
	SCsROW		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
352
	void		DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
354
	void		DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
353
355
354
	void		ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
356
	void		ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
(-)sc/inc/document.hxx (-2 / +7 lines)
Lines 368-373 private: Link Here
368
	// kein Broadcast, keine Listener aufbauen waehrend aus einem anderen
368
	// kein Broadcast, keine Listener aufbauen waehrend aus einem anderen
369
	// Doc (per Filter o.ae.) inserted wird, erst bei CompileAll / CalcAfterLoad
369
	// Doc (per Filter o.ae.) inserted wird, erst bei CompileAll / CalcAfterLoad
370
	BOOL				bInsertingFromOtherDoc;
370
	BOOL				bInsertingFromOtherDoc;
371
    bool                bLoadingMedium;
371
	BOOL				bImportingXML;		// special handling of formula text
372
	BOOL				bImportingXML;		// special handling of formula text
372
    BOOL                bXMLFromWrapper;    // distinguish ScXMLImportWrapper from external component
373
    BOOL                bXMLFromWrapper;    // distinguish ScXMLImportWrapper from external component
373
	BOOL				bCalcingAfterLoad;				// in CalcAfterLoad TRUE
374
	BOOL				bCalcingAfterLoad;				// in CalcAfterLoad TRUE
Lines 1140-1146 SC_DLLPUBLIC ScDBCollection* GetDBCollection() const; Link Here
1140
									const ScPatternAttr& rAttr );
1141
									const ScPatternAttr& rAttr );
1141
	void			ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
1142
	void			ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
1142
										SCCOL nEndCol, SCROW nEndRow,
1143
										SCCOL nEndCol, SCROW nEndRow,
1143
										const ScMarkData& rMark, const ScPatternAttr& rAttr );
1144
										const ScMarkData& rMark, const ScPatternAttr& rAttr,
1145
                                      ScEditDataArray* pDataArray = NULL );
1144
	void			ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
1146
	void			ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
1145
											SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1147
											SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1146
											const ScPatternAttr& rAttr );
1148
											const ScPatternAttr& rAttr );
Lines 1207-1213 SC_DLLPUBLIC ScDBCollection* GetDBCollection() const; Link Here
1207
							SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
1209
							SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
1208
							const String& sValStr, double& nX);
1210
							const String& sValStr, double& nX);
1209
1211
1210
	void			ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark );
1212
	void			ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark, 
1213
                                           ScEditDataArray* pDataArray = NULL );
1211
	void			DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
1214
	void			DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
1212
	void			DeleteSelectionTab( SCTAB nTab, USHORT nDelFlag, const ScMarkData& rMark );
1215
	void			DeleteSelectionTab( SCTAB nTab, USHORT nDelFlag, const ScMarkData& rMark );
1213
1216
Lines 1477-1482 SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const; Link Here
1477
	BOOL			GetNoSetDirty() const { return bNoSetDirty; }
1480
	BOOL			GetNoSetDirty() const { return bNoSetDirty; }
1478
	void			SetInsertingFromOtherDoc( BOOL bVal ) { bInsertingFromOtherDoc = bVal; }
1481
	void			SetInsertingFromOtherDoc( BOOL bVal ) { bInsertingFromOtherDoc = bVal; }
1479
	BOOL			IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
1482
	BOOL			IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
1483
    void            SetLoadingMedium( bool bVal );
1484
    bool            IsLoadingMedium() const;
1480
	void			SetImportingXML( BOOL bVal );
1485
	void			SetImportingXML( BOOL bVal );
1481
	BOOL			IsImportingXML() const { return bImportingXML; }
1486
	BOOL			IsImportingXML() const { return bImportingXML; }
1482
	void			SetXMLFromWrapper( BOOL bVal );
1487
	void			SetXMLFromWrapper( BOOL bVal );
(-)sc/inc/table.hxx (-2 / +4 lines)
Lines 57-62 class ScAutoFormatData; Link Here
57
class ScBaseCell;
57
class ScBaseCell;
58
class ScDocument;
58
class ScDocument;
59
class ScDrawLayer;
59
class ScDrawLayer;
60
class ScEditDataArray;
60
class ScFormulaCell;
61
class ScFormulaCell;
61
class ScOutlineTable;
62
class ScOutlineTable;
62
class ScPostIt;
63
class ScPostIt;
Lines 454-460 public: Link Here
454
455
455
	void		ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
456
	void		ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
456
	void		ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
457
	void		ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
457
	void		ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
458
	void		ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, 
459
                                  const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
458
	void		SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE )
460
	void		SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE )
459
					{ aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool ); }
461
					{ aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool ); }
460
	void		SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE );
462
	void		SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE );
Lines 482-488 public: Link Here
482
	BOOL		ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
484
	BOOL		ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
483
	BOOL		RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
485
	BOOL		RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
484
486
485
	void		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
487
	void		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
486
	void		DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
488
	void		DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
487
489
488
	void		ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
490
	void		ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
(-)sc/source/core/data/attarray.cxx (-4 / +35 lines)
Lines 41-46 Link Here
41
#include <svx/bolnitem.hxx>
41
#include <svx/bolnitem.hxx>
42
#include <svx/frmdiritem.hxx>
42
#include <svx/frmdiritem.hxx>
43
#include <svx/shaditem.hxx>
43
#include <svx/shaditem.hxx>
44
#include <svx/editobj.hxx>
44
#include <svtools/poolcach.hxx>
45
#include <svtools/poolcach.hxx>
45
#include <svx/fontitem.hxx>
46
#include <svx/fontitem.hxx>
46
#include <vcl/fontcvt.hxx>
47
#include <vcl/fontcvt.hxx>
Lines 55-61 Link Here
55
#include "markarr.hxx"
56
#include "markarr.hxx"
56
#include "rechead.hxx"
57
#include "rechead.hxx"
57
#include "globstr.hrc"
58
#include "globstr.hrc"
58
59
#include "cell.hxx"
59
60
60
#undef DBG_INVALIDATE
61
#undef DBG_INVALIDATE
61
#define DBGOUTPUT(s) \
62
#define DBGOUTPUT(s) \
Lines 299-306 void ScAttrArray::SetPattern( SCROW nRow, const ScPatternAttr* pPattern, BOOL bP Link Here
299
	SetPatternArea( nRow, nRow, pPattern, bPutToPool );
300
	SetPatternArea( nRow, nRow, pPattern, bPutToPool );
300
}
301
}
301
302
303
void ScAttrArray::RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow, 
304
                                       const ScPatternAttr* pPattern, ScEditDataArray* pDataArray )
305
{
306
    for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
307
    {
308
        ScBaseCell* pCell;
309
        pDocument->GetCell(nCol, nRow, nTab, pCell);
310
        if (pCell && pCell->GetCellType() == CELLTYPE_EDIT)
311
        {
312
            EditTextObject* pOldData = NULL;
313
            ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
314
            if (pDataArray)
315
                pOldData = pEditCell->GetData()->Clone();
316
            pEditCell->RemoveCharAttribs(*pPattern);
317
            if (pDataArray)
318
            {
319
                EditTextObject* pNewData = pEditCell->GetData()->Clone();
320
                pDataArray->AddItem(nTab, nCol, nRow, pOldData, pNewData);
321
            }
322
        }
323
    }
324
}
302
325
303
void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern, BOOL bPutToPool )
326
void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern, 
327
                                 BOOL bPutToPool, ScEditDataArray* pDataArray )
304
{
328
{
305
	if (ValidRow(nStartRow) && ValidRow(nEndRow))
329
	if (ValidRow(nStartRow) && ValidRow(nEndRow))
306
	{
330
	{
Lines 470-475 void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern Link Here
470
                    pData[nInsert-1].nRow = nStartRow - 1;
494
                    pData[nInsert-1].nRow = nStartRow - 1;
471
                pData[nInsert].nRow = nEndRow;
495
                pData[nInsert].nRow = nEndRow;
472
                pData[nInsert].pPattern = pPattern;
496
                pData[nInsert].pPattern = pPattern;
497
498
                // Remove character attributes from these cells if the pattern
499
                // is applied during normal session.  We don't want to do this
500
                // while importing document.
501
                if (!pDocument->IsLoadingMedium())
502
                    RemoveCellCharAttribs(nStartRow, nEndRow, pPattern ,pDataArray);
503
473
                nCount++;
504
                nCount++;
474
            }
505
            }
475
		}
506
		}
Lines 705-711 void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow, Link Here
705
#undef SET_LINE
736
#undef SET_LINE
706
737
707
738
708
void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache )
739
void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache, ScEditDataArray* pDataArray )
709
{
740
{
710
#ifdef DBG_UTIL
741
#ifdef DBG_UTIL
711
	TestData();
742
	TestData();
Lines 740-746 void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac Link Here
740
				{
771
				{
741
					if (nY1 < nStartRow) nY1=nStartRow;
772
					if (nY1 < nStartRow) nY1=nStartRow;
742
					if (nY2 > nEndRow) nY2=nEndRow;
773
					if (nY2 > nEndRow) nY2=nEndRow;
743
					SetPatternArea( nY1, nY2, pNewPattern );
774
					SetPatternArea( nY1, nY2, pNewPattern, false, pDataArray );
744
					Search( nStart, nPos );
775
					Search( nStart, nPos );
745
				}
776
				}
746
				else
777
				else
(-)sc/source/core/data/cell2.cxx (-1 / +93 lines)
Lines 49-55 Link Here
49
#include "editutil.hxx"
49
#include "editutil.hxx"
50
#include "chgtrack.hxx"
50
#include "chgtrack.hxx"
51
#include "indexmap.hxx"
51
#include "indexmap.hxx"
52
52
#include "scitems.hxx"
53
#include "patattr.hxx"
53
54
54
// STATIC DATA -----------------------------------------------------------
55
// STATIC DATA -----------------------------------------------------------
55
56
Lines 189-194 void ScEditCell::Save( SvStream& rStream ) const Link Here
189
        pData->Store( rStream );
190
        pData->Store( rStream );
190
}
191
}
191
192
193
void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr )
194
{
195
    const struct {
196
        USHORT nAttrType; 
197
        USHORT nCharType;
198
    } AttrTypeMap[] = {
199
        { ATTR_FONT,        EE_CHAR_FONTINFO },
200
        { ATTR_FONT_HEIGHT, EE_CHAR_FONTHEIGHT },
201
        { ATTR_FONT_COLOR,  EE_CHAR_COLOR }
202
    };
203
    USHORT nMapCount = sizeof(AttrTypeMap) / sizeof(AttrTypeMap[0]);
204
205
    const SfxItemSet& rSet = rAttr.GetItemSet();
206
    const SfxPoolItem* pItem;
207
    for (USHORT i = 0; i < nMapCount; ++i)
208
    {
209
        if ( rSet.GetItemState(AttrTypeMap[i].nAttrType, false, &pItem) == SFX_ITEM_SET )
210
            pData->RemoveCharAttribs(AttrTypeMap[i].nCharType);
211
    }
212
}
213
192
void ScEditCell::SetTextObject( const EditTextObject* pObject,
214
void ScEditCell::SetTextObject( const EditTextObject* pObject,
193
            const SfxItemPool* pFromPool )
215
            const SfxItemPool* pFromPool )
194
{
216
{
Lines 224-229 void ScEditCell::SetTextObject( const EditTextObject* pObject, Link Here
224
        pData = NULL;
246
        pData = NULL;
225
}
247
}
226
248
249
ScEditDataArray::ScEditDataArray()
250
{
251
}
252
253
ScEditDataArray::~ScEditDataArray()
254
{
255
}
256
257
void ScEditDataArray::AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow, 
258
                              EditTextObject* pOldData, EditTextObject* pNewData)
259
{
260
    maArray.push_back(Item(nTab, nCol, nRow, pOldData, pNewData));
261
}
262
263
const ScEditDataArray::Item* ScEditDataArray::First()
264
{
265
    maIter = maArray.begin();
266
    if (maIter == maArray.end())
267
        return NULL;
268
    return &(*maIter++);
269
}
270
271
const ScEditDataArray::Item* ScEditDataArray::Next()
272
{
273
    if (maIter == maArray.end())
274
        return NULL;
275
    return &(*maIter++);
276
}
277
278
//---------------------------------------------------------------------
279
280
ScEditDataArray::Item::Item(SCTAB nTab, SCCOL nCol, SCROW nRow, 
281
                            EditTextObject* pOldData, EditTextObject* pNewData) :
282
    mnTab(nTab),
283
    mnCol(nCol),
284
    mnRow(nRow)
285
{
286
    mpOldData.reset(pOldData);
287
    mpNewData.reset(pNewData);
288
}
289
290
ScEditDataArray::Item::~Item()
291
{
292
}
293
294
const EditTextObject* ScEditDataArray::Item::GetOldData() const
295
{
296
    return mpOldData.get();
297
}
298
299
const EditTextObject* ScEditDataArray::Item::GetNewData() const
300
{
301
    return mpNewData.get();
302
}
303
304
SCTAB ScEditDataArray::Item::GetTab() const
305
{
306
    return mnTab;
307
}
308
309
SCCOL ScEditDataArray::Item::GetCol() const
310
{
311
    return mnCol;
312
}
313
314
SCROW ScEditDataArray::Item::GetRow() const
315
{
316
    return mnRow;
317
}
318
227
//---------------------------------------------------------------------
319
//---------------------------------------------------------------------
228
320
229
BOOL ScFormulaCell::IsEmpty()
321
BOOL ScFormulaCell::IsEmpty()
(-)sc/source/core/data/column.cxx (-4 / +5 lines)
Lines 369-375 ULONG ScColumn::GetNumberFormat( SCROW nRow ) const Link Here
369
}
369
}
370
370
371
371
372
SCsROW ScColumn::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark )
372
SCsROW ScColumn::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray )
373
{
373
{
374
    SCROW nTop = 0;
374
    SCROW nTop = 0;
375
    SCROW nBottom = 0;
375
    SCROW nBottom = 0;
Lines 380-386 SCsROW ScColumn::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData Link Here
380
		ScMarkArrayIter aMarkIter( rMark.GetArray() + nCol );
380
		ScMarkArrayIter aMarkIter( rMark.GetArray() + nCol );
381
		while (aMarkIter.Next( nTop, nBottom ))
381
		while (aMarkIter.Next( nTop, nBottom ))
382
		{
382
		{
383
			pAttrArray->ApplyCacheArea( nTop, nBottom, pCache );
383
			pAttrArray->ApplyCacheArea( nTop, nBottom, pCache, pDataArray );
384
			bFound = TRUE;
384
			bFound = TRUE;
385
		}
385
		}
386
	}
386
	}
Lines 454-464 void ScColumn::ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr ) Link Here
454
}
454
}
455
455
456
456
457
void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr )
457
void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr, 
458
                                 ScEditDataArray* pDataArray )
458
{
459
{
459
	const SfxItemSet* pSet = &rPatAttr.GetItemSet();
460
	const SfxItemSet* pSet = &rPatAttr.GetItemSet();
460
	SfxItemPoolCache aCache( pDocument->GetPool(), pSet );
461
	SfxItemPoolCache aCache( pDocument->GetPool(), pSet );
461
	pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache );
462
	pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache, pDataArray );
462
}
463
}
463
464
464
465
(-)sc/source/core/data/documen2.cxx (+1 lines)
Lines 187-192 ScDocument::ScDocument( ScDocumentMode eMode, Link Here
187
//		bNoSetDirty( TRUE ),
187
//		bNoSetDirty( TRUE ),
188
		bNoSetDirty( FALSE ),
188
		bNoSetDirty( FALSE ),
189
		bInsertingFromOtherDoc( FALSE ),
189
		bInsertingFromOtherDoc( FALSE ),
190
        bLoadingMedium(false),
190
		bImportingXML( FALSE ),
191
		bImportingXML( FALSE ),
191
        bXMLFromWrapper( FALSE ),
192
        bXMLFromWrapper( FALSE ),
192
		bCalcingAfterLoad( FALSE ),
193
		bCalcingAfterLoad( FALSE ),
(-)sc/source/core/data/documen9.cxx (+10 lines)
Lines 885-890 void ScDocument::UpdateFontCharSet() Link Here
885
	}
885
	}
886
}
886
}
887
887
888
void ScDocument::SetLoadingMedium( bool bVal )
889
{
890
    bLoadingMedium = bVal;
891
}
892
893
bool ScDocument::IsLoadingMedium() const
894
{
895
    return bLoadingMedium;
896
}
897
888
void ScDocument::SetImportingXML( BOOL bVal )
898
void ScDocument::SetImportingXML( BOOL bVal )
889
{
899
{
890
	bImportingXML = bVal;
900
	bImportingXML = bVal;
(-)sc/source/core/data/document.cxx (-5 / +6 lines)
Lines 3117-3128 void ScDocument::ApplyPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatte Link Here
3117
void ScDocument::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
3117
void ScDocument::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
3118
						SCCOL nEndCol, SCROW nEndRow,
3118
						SCCOL nEndCol, SCROW nEndRow,
3119
						const ScMarkData& rMark,
3119
						const ScMarkData& rMark,
3120
						const ScPatternAttr& rAttr )
3120
						const ScPatternAttr& rAttr,
3121
                        ScEditDataArray* pDataArray )
3121
{
3122
{
3122
	for (SCTAB i=0; i <= MAXTAB; i++)
3123
	for (SCTAB i=0; i <= MAXTAB; i++)
3123
		if (pTab[i])
3124
		if (pTab[i])
3124
			if (rMark.GetTableSelect(i))
3125
			if (rMark.GetTableSelect(i))
3125
				pTab[i]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr );
3126
				pTab[i]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr, pDataArray );
3126
}
3127
}
3127
3128
3128
3129
Lines 4211-4217 void ScDocument::ApplyFrameAreaTab( const ScRange& rRange, Link Here
4211
}
4212
}
4212
4213
4213
4214
4214
void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark )
4215
void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark, ScEditDataArray* pDataArray )
4215
{
4216
{
4216
	const SfxItemSet* pSet = &rAttr.GetItemSet();
4217
	const SfxItemSet* pSet = &rAttr.GetItemSet();
4217
	BOOL bSet = FALSE;
4218
	BOOL bSet = FALSE;
Lines 4228-4234 void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMark Link Here
4228
			ScRange aRange;
4229
			ScRange aRange;
4229
			rMark.GetMarkArea( aRange );
4230
			rMark.GetMarkArea( aRange );
4230
			ApplyPatternArea( aRange.aStart.Col(), aRange.aStart.Row(),
4231
			ApplyPatternArea( aRange.aStart.Col(), aRange.aStart.Row(),
4231
							  aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr );
4232
							  aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr, pDataArray );
4232
		}
4233
		}
4233
		else
4234
		else
4234
		{
4235
		{
Lines 4236-4242 void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMark Link Here
4236
            for (SCTAB nTab=0; nTab<=MAXTAB; nTab++)
4237
            for (SCTAB nTab=0; nTab<=MAXTAB; nTab++)
4237
                if (pTab[nTab])
4238
                if (pTab[nTab])
4238
                    if (rMark.GetTableSelect(nTab))
4239
                    if (rMark.GetTableSelect(nTab))
4239
                        pTab[nTab]->ApplySelectionCache( &aCache, rMark );
4240
                        pTab[nTab]->ApplySelectionCache( &aCache, rMark, pDataArray );
4240
		}
4241
		}
4241
	}
4242
	}
4242
}
4243
}
(-)sc/source/core/data/table2.cxx (-4 / +5 lines)
Lines 1648-1661 void ScTable::ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr ) Link Here
1648
1648
1649
1649
1650
void ScTable::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1650
void ScTable::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1651
									 const ScPatternAttr& rAttr )
1651
									 const ScPatternAttr& rAttr, ScEditDataArray* pDataArray )
1652
{
1652
{
1653
	if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow))
1653
	if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow))
1654
	{
1654
	{
1655
		PutInOrder(nStartCol, nEndCol);
1655
		PutInOrder(nStartCol, nEndCol);
1656
		PutInOrder(nStartRow, nEndRow);
1656
		PutInOrder(nStartRow, nEndRow);
1657
		for (SCCOL i = nStartCol; i <= nEndCol; i++)
1657
		for (SCCOL i = nStartCol; i <= nEndCol; i++)
1658
			aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr);
1658
			aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr, pDataArray);
1659
	}
1659
	}
1660
}
1660
}
1661
1661
Lines 1863-1872 void ScTable::ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr ) Link Here
1863
}
1863
}
1864
1864
1865
1865
1866
void ScTable::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark )
1866
void ScTable::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark,
1867
                                   ScEditDataArray* pDataArray )
1867
{
1868
{
1868
	for (SCCOL i=0; i<=MAXCOL; i++)
1869
	for (SCCOL i=0; i<=MAXCOL; i++)
1869
		aCol[i].ApplySelectionCache( pCache, rMark );
1870
		aCol[i].ApplySelectionCache( pCache, rMark, pDataArray );
1870
}
1871
}
1871
1872
1872
1873
(-)sc/source/ui/docshell/docsh.cxx (-2 / +24 lines)
Lines 680-689 BOOL ScDocShell::SaveXML( SfxMedium* pSaveMedium, const ::com::sun::star::uno::R Link Here
680
    return bRet;
680
    return bRet;
681
}
681
}
682
682
683
namespace {
684
685
class DocLoadChecker
686
{
687
public:
688
    explicit DocLoadChecker(ScDocument* pDoc) :
689
        mpDoc(pDoc)
690
    {
691
        mpDoc->SetLoadingMedium(true);
692
    }
693
694
    ~DocLoadChecker()
695
    {
696
        mpDoc->SetLoadingMedium(false);
697
    }
698
private:
699
    ScDocument* mpDoc;
700
};
701
702
}
703
683
BOOL __EXPORT ScDocShell::Load( SfxMedium& rMedium )
704
BOOL __EXPORT ScDocShell::Load( SfxMedium& rMedium )
684
{
705
{
685
	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Load" );
706
	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Load" );
686
707
    DocLoadChecker aChecker(&aDocument);
687
	ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
708
	ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
688
709
689
	//	only the latin script language is loaded
710
	//	only the latin script language is loaded
Lines 1048-1054 void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) Link Here
1048
BOOL __EXPORT ScDocShell::LoadFrom( SfxMedium& rMedium )
1069
BOOL __EXPORT ScDocShell::LoadFrom( SfxMedium& rMedium )
1049
{
1070
{
1050
	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::LoadFrom" );
1071
	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::LoadFrom" );
1051
1072
    DocLoadChecker aChecker(&aDocument);
1052
	ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
1073
	ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
1053
1074
1054
	WaitObject aWait( GetActiveDialogParent() );
1075
	WaitObject aWait( GetActiveDialogParent() );
Lines 1075-1080 BOOL __EXPORT ScDocShell::LoadFrom( SfxMedium& rMedium ) Link Here
1075
BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
1096
BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
1076
{
1097
{
1077
	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertFrom" );
1098
	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertFrom" );
1099
    DocLoadChecker aChecker(&aDocument);
1078
1100
1079
	BOOL bRet = FALSE;				// FALSE heisst Benutzerabbruch !!
1101
	BOOL bRet = FALSE;				// FALSE heisst Benutzerabbruch !!
1080
									// bei Fehler: Fehler am Stream setzen!!
1102
									// bei Fehler: Fehler am Stream setzen!!
(-)sc/source/ui/inc/undoblk.hxx (+7 lines)
Lines 35-40 Link Here
35
#include "viewutil.hxx"
35
#include "viewutil.hxx"
36
#include "spellparam.hxx"
36
#include "spellparam.hxx"
37
37
38
#include "cell.hxx"
39
40
#include <boost/shared_ptr.hpp>
41
38
class ScDocShell;
42
class ScDocShell;
39
class ScDocument;
43
class ScDocument;
40
class ScOutlineTable;
44
class ScOutlineTable;
Lines 347-355 public: Link Here
347
351
348
	virtual String	GetComment() const;
352
	virtual String	GetComment() const;
349
353
354
    ScEditDataArray*    GetDataArray();
350
private:
355
private:
351
	ScMarkData		aMarkData;
356
	ScMarkData		aMarkData;
352
	ScRange			aRange;
357
	ScRange			aRange;
358
    ScEditDataArray aDataArray; 
353
	ScDocument*		pUndoDoc;
359
	ScDocument*		pUndoDoc;
354
	BOOL			bMulti;
360
	BOOL			bMulti;
355
	ScPatternAttr*	pApplyPattern;
361
	ScPatternAttr*	pApplyPattern;
Lines 357-362 private: Link Here
357
	SvxBoxInfoItem*	pLineInner;
363
	SvxBoxInfoItem*	pLineInner;
358
364
359
	void			DoChange( const BOOL bUndo );
365
	void			DoChange( const BOOL bUndo );
366
    void            ChangeEditData( const bool bUndo );
360
};
367
};
361
368
362
369
(-)sc/source/ui/inc/undocell.hxx (-1 / +10 lines)
Lines 34-39 Link Here
34
#include "undobase.hxx"
34
#include "undobase.hxx"
35
#include "postit.hxx"
35
#include "postit.hxx"
36
36
37
#include <boost/shared_ptr.hpp>
38
37
class ScDocShell;
39
class ScDocShell;
38
class ScBaseCell;
40
class ScBaseCell;
39
class ScPatternAttr;
41
class ScPatternAttr;
Lines 62-67 public: Link Here
62
64
63
	virtual String	GetComment() const;
65
	virtual String	GetComment() const;
64
66
67
    /** once the objects are passed to this class, their life-cycle is
68
        managed by this class; the calling function must pass new'ed
69
        objects to this method. */
70
    void            SetEditData( EditTextObject* pOld, EditTextObject* pNew );
71
65
private:
72
private:
66
	SCCOL			nCol;
73
	SCCOL			nCol;
67
	SCROW			nRow;
74
	SCROW			nRow;
Lines 69-77 private: Link Here
69
	ScPatternAttr*	pOldPattern;
76
	ScPatternAttr*	pOldPattern;
70
	ScPatternAttr*	pNewPattern;
77
	ScPatternAttr*	pNewPattern;
71
	ScPatternAttr*	pApplyPattern;
78
	ScPatternAttr*	pApplyPattern;
79
    ::boost::shared_ptr<EditTextObject> pOldEditData;
80
    ::boost::shared_ptr<EditTextObject> pNewEditData;
72
	BOOL			bIsAutomatic;
81
	BOOL			bIsAutomatic;
73
82
74
	void			DoChange( const ScPatternAttr* pWhichPattern ) const;
83
	void			DoChange( const ScPatternAttr* pWhichPattern, const ::boost::shared_ptr<EditTextObject>& pEditData ) const;
75
};
84
};
76
85
77
86
(-)sc/source/ui/undo/makefile.mk (+1 lines)
Lines 78-83 SLOFILES = \ Link Here
78
		$(SLO)$/undotab.obj
78
		$(SLO)$/undotab.obj
79
79
80
EXCEPTIONSFILES= \
80
EXCEPTIONSFILES= \
81
    $(SLO)$/undocell.obj \
81
    $(SLO)$/undostyl.obj
82
    $(SLO)$/undostyl.obj
82
83
83
# --- Tagets -------------------------------------------------------
84
# --- Tagets -------------------------------------------------------
(-)sc/source/ui/undo/undoblk3.cxx (+26 lines)
Lines 474-479 String __EXPORT ScUndoSelectionAttr::GetComment() const Link Here
474
	return ScGlobal::GetRscString( pLineOuter ? STR_UNDO_SELATTRLINES : STR_UNDO_SELATTR );
474
	return ScGlobal::GetRscString( pLineOuter ? STR_UNDO_SELATTRLINES : STR_UNDO_SELATTR );
475
}
475
}
476
476
477
//----------------------------------------------------------------------------
478
479
ScEditDataArray* ScUndoSelectionAttr::GetDataArray()
480
{
481
    return &aDataArray;
482
}
477
483
478
//----------------------------------------------------------------------------
484
//----------------------------------------------------------------------------
479
485
Lines 492-497 void ScUndoSelectionAttr::DoChange( const BOOL bUndo ) Link Here
492
	USHORT nExtFlags = 0;
498
	USHORT nExtFlags = 0;
493
	pDocShell->UpdatePaintExt( nExtFlags, aEffRange );
499
	pDocShell->UpdatePaintExt( nExtFlags, aEffRange );
494
500
501
    ChangeEditData(bUndo);
502
495
	if (bUndo)	// nur bei Undo
503
	if (bUndo)	// nur bei Undo
496
	{
504
	{
497
		ScRange aCopyRange = aRange;
505
		ScRange aCopyRange = aRange;
Lines 516-521 void ScUndoSelectionAttr::DoChange( const BOOL bUndo ) Link Here
516
	ShowTable( aRange );
524
	ShowTable( aRange );
517
}
525
}
518
526
527
void ScUndoSelectionAttr::ChangeEditData( const bool bUndo )
528
{
529
    ScDocument* pDoc = pDocShell->GetDocument();
530
    for (const ScEditDataArray::Item* pItem = aDataArray.First(); pItem; pItem = aDataArray.Next())
531
    {
532
        ScBaseCell* pCell;
533
        pDoc->GetCell(pItem->GetCol(), pItem->GetRow(), pItem->GetTab(), pCell);
534
        if (!pCell || pCell->GetCellType() != CELLTYPE_EDIT)
535
            continue;
536
537
        ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
538
        if (bUndo)
539
            pEditCell->SetData(pItem->GetOldData(), NULL);
540
        else
541
            pEditCell->SetData(pItem->GetNewData(), NULL);
542
    }
543
}
544
519
545
520
//----------------------------------------------------------------------------
546
//----------------------------------------------------------------------------
521
547
(-)sc/source/ui/undo/undocell.cxx (-4 / +20 lines)
Lines 61-66 Link Here
61
#include "chgtrack.hxx"
61
#include "chgtrack.hxx"
62
#include "sc.hrc"
62
#include "sc.hrc"
63
63
64
using ::boost::shared_ptr;
65
64
// STATIC DATA -----------------------------------------------------------
66
// STATIC DATA -----------------------------------------------------------
65
67
66
TYPEINIT1(ScUndoCursorAttr, ScSimpleUndo);
68
TYPEINIT1(ScUndoCursorAttr, ScSimpleUndo);
Lines 89-94 ScUndoCursorAttr::ScUndoCursorAttr( ScDocShell* pNewDocShell, Link Here
89
	nCol( nNewCol ),
91
	nCol( nNewCol ),
90
	nRow( nNewRow ),
92
	nRow( nNewRow ),
91
	nTab( nNewTab ),
93
	nTab( nNewTab ),
94
    pOldEditData( static_cast<EditTextObject*>(NULL) ),
95
    pNewEditData( static_cast<EditTextObject*>(NULL) ),
92
	bIsAutomatic( bAutomatic )
96
	bIsAutomatic( bAutomatic )
93
{
97
{
94
	ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
98
	ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
Lines 113-121 String __EXPORT ScUndoCursorAttr::GetComment() const Link Here
113
	return ScGlobal::GetRscString( nId );
117
	return ScGlobal::GetRscString( nId );
114
}
118
}
115
119
116
void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern ) const
120
void ScUndoCursorAttr::SetEditData( EditTextObject* pOld, EditTextObject* pNew )
117
{
121
{
118
	pDocShell->GetDocument()->SetPattern( nCol, nRow, nTab, *pWhichPattern, TRUE );
122
    pOldEditData.reset(pOld);
123
    pNewEditData.reset(pNew);
124
}
125
126
void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern, const shared_ptr<EditTextObject>& pEditData ) const
127
{
128
    ScDocument* pDoc = pDocShell->GetDocument();
129
	pDoc->SetPattern( nCol, nRow, nTab, *pWhichPattern, TRUE );
130
131
    ScBaseCell* pCell;
132
    pDoc->GetCell(nCol, nRow, nTab, pCell);
133
    if (pCell && pCell->GetCellType() == CELLTYPE_EDIT && pEditData.get())
134
        static_cast<ScEditCell*>(pCell)->SetData(pEditData.get(), NULL);
119
135
120
	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
136
	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
121
	if (pViewShell)
137
	if (pViewShell)
Lines 141-147 void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern ) const Link Here
141
void __EXPORT ScUndoCursorAttr::Undo()
157
void __EXPORT ScUndoCursorAttr::Undo()
142
{
158
{
143
	BeginUndo();
159
	BeginUndo();
144
	DoChange(pOldPattern);
160
	DoChange(pOldPattern, pOldEditData);
145
161
146
	if ( bIsAutomatic )
162
	if ( bIsAutomatic )
147
	{
163
	{
Lines 159-165 void __EXPORT ScUndoCursorAttr::Undo() Link Here
159
void __EXPORT ScUndoCursorAttr::Redo()
175
void __EXPORT ScUndoCursorAttr::Redo()
160
{
176
{
161
	BeginRedo();
177
	BeginRedo();
162
	DoChange(pNewPattern);
178
	DoChange(pNewPattern, pNewEditData);
163
	EndRedo();
179
	EndRedo();
164
}
180
}
165
181
(-)sc/source/ui/view/viewfunc.cxx (-12 / +25 lines)
Lines 1293-1298 void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, Link Here
1293
		SCROW nEndRow = aMarkRange.aEnd.Row();
1293
		SCROW nEndRow = aMarkRange.aEnd.Row();
1294
		SCTAB nEndTab = aMarkRange.aEnd.Tab();
1294
		SCTAB nEndTab = aMarkRange.aEnd.Tab();
1295
1295
1296
        ScUndoSelectionAttr* pUndoAttr = NULL;
1297
        ScEditDataArray* pEditDataArray = NULL;
1296
		if (bRecord)
1298
		if (bRecord)
1297
		{
1299
		{
1298
			ScRange aCopyRange = aMarkRange;
1300
			ScRange aCopyRange = aMarkRange;
Lines 1309-1323 void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, Link Here
1309
1311
1310
			aFuncMark.MarkToMulti();
1312
			aFuncMark.MarkToMulti();
1311
1313
1312
			pDocSh->GetUndoManager()->AddUndoAction(
1314
            pUndoAttr = new ScUndoSelectionAttr(
1313
				new ScUndoSelectionAttr(
1315
                pDocSh, aFuncMark, nStartCol, nStartRow, nStartTab,
1314
							pDocSh, aFuncMark,
1316
                nEndCol, nEndRow, nEndTab, pUndoDoc, bMulti, &rAttr );
1315
							nStartCol, nStartRow, nStartTab,
1317
			pDocSh->GetUndoManager()->AddUndoAction(pUndoAttr);
1316
							nEndCol, nEndRow, nEndTab,
1318
            pEditDataArray = pUndoAttr->GetDataArray();
1317
							pUndoDoc, bMulti, &rAttr ) );
1318
		}
1319
		}
1319
1320
1320
		pDoc->ApplySelectionPattern( rAttr, aFuncMark );
1321
		pDoc->ApplySelectionPattern( rAttr, aFuncMark, pEditDataArray );
1321
1322
1322
		pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
1323
		pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
1323
						   nEndCol,   nEndRow,   nEndTab,
1324
						   nEndCol,   nEndRow,   nEndTab,
Lines 1331-1336 void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, Link Here
1331
		SCCOL nCol = pViewData->GetCurX();
1332
		SCCOL nCol = pViewData->GetCurX();
1332
		SCROW nRow = pViewData->GetCurY();
1333
		SCROW nRow = pViewData->GetCurY();
1333
		SCTAB nTab = pViewData->GetTabNo();
1334
		SCTAB nTab = pViewData->GetTabNo();
1335
1336
        ScBaseCell* pCell;
1337
        pDoc->GetCell(nCol, nRow, nTab, pCell);
1338
        EditTextObject* pOldEditData = NULL;
1339
        EditTextObject* pNewEditData = NULL;
1340
        if (pCell && pCell->GetCellType() == CELLTYPE_EDIT)
1341
        {
1342
            ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
1343
            pOldEditData = pEditCell->GetData()->Clone();
1344
            pEditCell->RemoveCharAttribs(rAttr);
1345
            pNewEditData = pEditCell->GetData()->Clone();
1346
        }
1347
1334
		ScPatternAttr* pOldPat = new ScPatternAttr(*pDoc->GetPattern( nCol, nRow, nTab ));
1348
		ScPatternAttr* pOldPat = new ScPatternAttr(*pDoc->GetPattern( nCol, nRow, nTab ));
1335
1349
1336
		if (!bCursorOnly)
1350
		if (!bCursorOnly)
Lines 1340-1350 void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, Link Here
1340
1354
1341
		if (bRecord)
1355
		if (bRecord)
1342
		{
1356
		{
1343
			pDocSh->GetUndoManager()->AddUndoAction(
1357
            ScUndoCursorAttr* pUndo = new ScUndoCursorAttr( 
1344
						new ScUndoCursorAttr( pDocSh,
1358
                pDocSh, nCol, nRow, nTab, pOldPat, pNewPat, &rAttr, false );
1345
											  nCol, nRow, nTab,
1359
            pUndo->SetEditData(pOldEditData, pNewEditData);
1346
											  pOldPat, pNewPat, &rAttr,
1360
			pDocSh->GetUndoManager()->AddUndoAction(pUndo);
1347
											  FALSE ) );	// FALSE = nicht automatisch
1348
		}
1361
		}
1349
		delete pOldPat;		// wird im Undo kopiert (Pool)
1362
		delete pOldPat;		// wird im Undo kopiert (Pool)
1350
1363

Return to issue 53545