summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-03-02 14:19:13 +0000
committerOliver Bolte <obo@openoffice.org>2009-03-02 14:19:13 +0000
commit07b0c01857137de7e4bd02375e7c892d622d270e (patch)
treeca4599cb8c96535139e3e0ee07acb37bcb5ad636 /sc/source
parent74e4b152bbe46cf55cec4da21b9365363ec2fa8d (diff)
CWS-TOOLING: integrate CWS dr66
2009-01-22 15:51:40 +0100 dr r266730 : #i98028# moved to CWS dr66 2009-01-22 15:50:28 +0100 dr r266729 : #i98028# moved to CWS dr66 2009-01-20 16:25:49 +0100 dr r266595 : #i98282# resolve palette colors while loading chart gradients (convert back to unx lineends...) 2009-01-20 16:23:19 +0100 dr r266594 : #i98282# resolve palette colors while loading chart gradients 2009-01-19 15:43:57 +0100 dr r266507 : #i97900# move fix to CWS dr66 2009-01-19 15:40:28 +0100 dr r266506 : #i97900# move fix to CWS dr66 2009-01-19 15:20:14 +0100 dr r266505 : #i98141# correctly update note position while switching LTR/RTL mode of sheet 2009-01-06 10:28:02 +0100 dr r265899 : CWS-TOOLING: rebase CWS dr66 to trunk@265758 (milestone: DEV300:m38) 2008-11-13 13:59:02 +0100 dr r263644 : #i10000# merge problems 2008-11-13 13:25:15 +0100 dr r263639 : #i10000# merge problems 2008-11-13 13:22:58 +0100 dr r263638 : #i10000# merge problems 2008-11-13 13:22:25 +0100 dr r263637 : #i10000# merge problems 2008-11-12 13:40:46 +0100 dr r263595 : #i10000# merge problem 2008-11-12 11:34:51 +0100 dr r263583 : CWS-TOOLING: rebase CWS dr66 to trunk@263288 (milestone: DEV300:m35) 2008-11-11 16:58:11 +0100 dr r263568 : CWS-TOOLING: rebase CWS dr66 to trunk@262087 (milestone: DEV300:m33) 2008-10-27 14:38:34 +0100 dr r262675 : migrate CWS dr66 to SVN
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/autonamecache.cxx4
-rw-r--r--sc/source/core/data/cell.cxx311
-rw-r--r--sc/source/core/data/cell2.cxx21
-rw-r--r--sc/source/core/data/column.cxx470
-rw-r--r--sc/source/core/data/column2.cxx62
-rw-r--r--sc/source/core/data/column3.cxx553
-rw-r--r--sc/source/core/data/dociter.cxx4
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/core/data/documen3.cxx78
-rw-r--r--sc/source/core/data/documen4.cxx6
-rw-r--r--sc/source/core/data/documen9.cxx34
-rw-r--r--sc/source/core/data/document.cxx79
-rw-r--r--sc/source/core/data/drwlayer.cxx341
-rw-r--r--sc/source/core/data/global.cxx9
-rw-r--r--sc/source/core/data/makefile.mk5
-rw-r--r--sc/source/core/data/postit.cxx778
-rw-r--r--sc/source/core/data/table2.cxx63
-rw-r--r--sc/source/core/data/table3.cxx11
-rw-r--r--sc/source/core/data/table4.cxx24
-rw-r--r--sc/source/core/data/table6.cxx32
-rw-r--r--sc/source/core/data/userdat.cxx19
-rw-r--r--sc/source/core/tool/chgtrack.cxx23
-rw-r--r--sc/source/core/tool/compiler.cxx6
-rw-r--r--sc/source/core/tool/detfunc.cxx649
-rw-r--r--sc/source/core/tool/interpr2.cxx13
-rw-r--r--sc/source/filter/excel/impop.cxx2
-rw-r--r--sc/source/filter/excel/xeescher.cxx61
-rw-r--r--sc/source/filter/excel/xetable.cxx4
-rw-r--r--sc/source/filter/excel/xiescher.cxx108
-rw-r--r--sc/source/filter/inc/xeescher.hxx2
-rw-r--r--sc/source/filter/inc/xiescher.hxx22
-rw-r--r--sc/source/filter/lotus/expop.cxx3
-rw-r--r--sc/source/filter/lotus/op.cxx11
-rw-r--r--sc/source/filter/starcalc/scflt.cxx8
-rw-r--r--sc/source/filter/xcl97/xcl97esc.cxx6
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx11
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx71
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx4
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx92
-rw-r--r--sc/source/filter/xml/xmlexprt.hxx3
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx231
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx5
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx4
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx12
-rw-r--r--sc/source/ui/app/scmod.cxx7
-rw-r--r--sc/source/ui/dbgui/fieldwnd.cxx11
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx39
-rw-r--r--sc/source/ui/docshell/docfunc.cxx233
-rw-r--r--sc/source/ui/docshell/docsh.cxx10
-rw-r--r--sc/source/ui/docshell/docsh3.cxx7
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx7
-rw-r--r--sc/source/ui/drawfunc/drawsh2.cxx17
-rw-r--r--sc/source/ui/drawfunc/drawsh5.cxx34
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx7
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx12
-rw-r--r--sc/source/ui/drawfunc/fuconarc.cxx16
-rw-r--r--sc/source/ui/drawfunc/fuconcustomshape.cxx11
-rw-r--r--sc/source/ui/drawfunc/fuconpol.cxx110
-rw-r--r--sc/source/ui/drawfunc/fuconrec.cxx192
-rw-r--r--sc/source/ui/drawfunc/fuconstr.cxx167
-rw-r--r--sc/source/ui/drawfunc/fuconuno.cxx290
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx127
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx10
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx8
-rw-r--r--sc/source/ui/drawfunc/fumark.cxx10
-rw-r--r--sc/source/ui/drawfunc/fupoor.cxx193
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx45
-rw-r--r--sc/source/ui/drawfunc/fusel2.cxx94
-rw-r--r--sc/source/ui/drawfunc/futext.cxx31
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx304
-rw-r--r--sc/source/ui/inc/dbdocfun.hxx2
-rw-r--r--sc/source/ui/inc/dbfunc.hxx2
-rw-r--r--sc/source/ui/inc/docfunc.hxx10
-rw-r--r--sc/source/ui/inc/docsh.hxx3
-rw-r--r--sc/source/ui/inc/drawview.hxx35
-rw-r--r--sc/source/ui/inc/fuconarc.hxx8
-rw-r--r--sc/source/ui/inc/fuconcustomshape.hxx4
-rw-r--r--sc/source/ui/inc/fuconpol.hxx9
-rw-r--r--sc/source/ui/inc/fuconrec.hxx8
-rw-r--r--sc/source/ui/inc/fuconstr.hxx7
-rw-r--r--sc/source/ui/inc/fuconuno.hxx4
-rw-r--r--sc/source/ui/inc/fudraw.hxx8
-rw-r--r--sc/source/ui/inc/fuedipo.hxx7
-rw-r--r--sc/source/ui/inc/fuinsert.hxx10
-rw-r--r--sc/source/ui/inc/fumark.hxx4
-rw-r--r--sc/source/ui/inc/fupoor.hxx15
-rw-r--r--sc/source/ui/inc/fusel.hxx28
-rw-r--r--sc/source/ui/inc/futext.hxx4
-rw-r--r--sc/source/ui/inc/notemark.hxx11
-rw-r--r--sc/source/ui/inc/undobase.hxx7
-rw-r--r--sc/source/ui/inc/undoblk.hxx13
-rw-r--r--sc/source/ui/inc/undocell.hxx64
-rw-r--r--sc/source/ui/inc/viewfunc.hxx12
-rw-r--r--sc/source/ui/navipi/content.cxx25
-rw-r--r--sc/source/ui/src/globstr.src2
-rw-r--r--sc/source/ui/undo/undobase.cxx22
-rw-r--r--sc/source/ui/undo/undoblk.cxx46
-rw-r--r--sc/source/ui/undo/undoblk3.cxx118
-rw-r--r--sc/source/ui/undo/undocell.cxx237
-rw-r--r--sc/source/ui/undo/undodat.cxx51
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx6
-rw-r--r--sc/source/ui/unoobj/docuno.cxx41
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx81
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx268
-rw-r--r--sc/source/ui/view/cellsh.cxx53
-rw-r--r--sc/source/ui/view/cellsh1.cxx71
-rw-r--r--sc/source/ui/view/dbfunc.cxx2
-rw-r--r--sc/source/ui/view/drawview.cxx206
-rw-r--r--sc/source/ui/view/gridwin.cxx75
-rw-r--r--sc/source/ui/view/gridwin3.cxx11
-rw-r--r--sc/source/ui/view/gridwin5.cxx49
-rw-r--r--sc/source/ui/view/notemark.cxx45
-rw-r--r--sc/source/ui/view/output.cxx9
-rw-r--r--sc/source/ui/view/printfun.cxx7
-rw-r--r--sc/source/ui/view/spelleng.cxx18
-rw-r--r--sc/source/ui/view/tabcont.cxx6
-rw-r--r--sc/source/ui/view/tabview.cxx40
-rw-r--r--sc/source/ui/view/tabview4.cxx7
-rw-r--r--sc/source/ui/view/tabview5.cxx30
-rw-r--r--sc/source/ui/view/tabvwsh2.cxx8
-rw-r--r--sc/source/ui/view/tabvwshb.cxx4
-rw-r--r--sc/source/ui/view/viewfun2.cxx10
-rw-r--r--sc/source/ui/view/viewfun3.cxx25
-rw-r--r--sc/source/ui/view/viewfun6.cxx223
-rw-r--r--sc/source/ui/view/viewfunc.cxx43
125 files changed, 3193 insertions, 5170 deletions
diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx
index bac9e8098560..d106e5824571 100644
--- a/sc/source/core/data/autonamecache.cxx
+++ b/sc/source/core/data/autonamecache.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: autonamecache.cxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -93,7 +93,9 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurences( const String& rNa
case CELLTYPE_VALUE:
case CELLTYPE_NOTE:
case CELLTYPE_SYMBOLS:
+#ifdef DBG_UTIL
case CELLTYPE_DESTROYED:
+#endif
; // nothing, prevent compiler warning
break;
}
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index c3dd01f98970..57c0097dfee7 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cell.cxx,v $
- * $Revision: 1.42.30.4 $
+ * $Revision: 1.44.38.6 $
*
* This file is part of OpenOffice.org.
*
@@ -82,60 +82,87 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ScStringCell, nMemPoolStringCell, nMemPoolStringCell
IMPL_FIXEDMEMPOOL_NEWDEL( ScNoteCell, nMemPoolNoteCell, nMemPoolNoteCell )
#endif
-// -----------------------------------------------------------------------
+// ============================================================================
ScBaseCell::ScBaseCell( CellType eNewType ) :
- pNote( NULL ),
- pBroadcaster( NULL ),
+ mpNote( 0 ),
+ mpBroadcaster( 0 ),
nTextWidth( TEXTWIDTH_DIRTY ),
eCellType( sal::static_int_cast<BYTE>(eNewType) ),
nScriptType( SC_SCRIPTTYPE_UNKNOWN )
{
}
-ScBaseCell::ScBaseCell( const ScBaseCell& rBaseCell, ScDocument* pDoc ) :
- pBroadcaster( NULL ),
- nTextWidth( rBaseCell.nTextWidth ),
- eCellType( rBaseCell.eCellType ),
+ScBaseCell::ScBaseCell( const ScBaseCell& rCell ) :
+ mpNote( 0 ),
+ mpBroadcaster( 0 ),
+ nTextWidth( rCell.nTextWidth ),
+ eCellType( rCell.eCellType ),
nScriptType( SC_SCRIPTTYPE_UNKNOWN )
{
- if (rBaseCell.pNote)
- pNote = new ScPostIt( *rBaseCell.pNote, pDoc );
- else
- pNote = NULL;
}
-ScBaseCell* ScBaseCell::Clone(ScDocument* pDoc) const
+ScBaseCell::~ScBaseCell()
{
- switch (eCellType)
+ delete mpNote;
+ delete mpBroadcaster;
+ DBG_ASSERT( eCellType == CELLTYPE_DESTROYED, "BaseCell Destructor" );
+}
+
+namespace {
+
+ScBaseCell* lclCloneCell( const ScBaseCell& rSrcCell, ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags )
+{
+ switch( rSrcCell.GetCellType() )
{
case CELLTYPE_VALUE:
- return new ScValueCell(*(const ScValueCell*)this, pDoc);
+ return new ScValueCell( static_cast< const ScValueCell& >( rSrcCell ) );
case CELLTYPE_STRING:
- return new ScStringCell(*(const ScStringCell*)this, pDoc);
+ return new ScStringCell( static_cast< const ScStringCell& >( rSrcCell ) );
case CELLTYPE_EDIT:
- return new ScEditCell(*(const ScEditCell*)this, pDoc);
+ return new ScEditCell( static_cast< const ScEditCell& >( rSrcCell ), rDestDoc );
case CELLTYPE_FORMULA:
- return new ScFormulaCell(pDoc, ((ScFormulaCell*)this)->aPos,
- *(const ScFormulaCell*)this);
+ return new ScFormulaCell( static_cast< const ScFormulaCell& >( rSrcCell ), rDestDoc, rDestPos, nCloneFlags );
case CELLTYPE_NOTE:
- return new ScNoteCell(*(const ScNoteCell*)this, pDoc);
- default:
- DBG_ERROR("Unbekannter Zellentyp");
- return NULL;
+ return new ScNoteCell;
+ default:;
}
+ DBG_ERROR( "lclCloneCell - unknown cell type" );
+ return 0;
}
-ScBaseCell::~ScBaseCell()
+} // namespace
+
+ScBaseCell* ScBaseCell::CloneWithoutNote( ScDocument& rDestDoc, int nCloneFlags ) const
{
- delete pNote;
- delete pBroadcaster;
- DBG_ASSERT( eCellType == CELLTYPE_DESTROYED, "BaseCell Destructor" );
+ // notes will not be cloned -> cell address only needed for formula cells
+ ScAddress aDestPos;
+ if( eCellType == CELLTYPE_FORMULA )
+ aDestPos = static_cast< const ScFormulaCell* >( this )->aPos;
+ return lclCloneCell( *this, rDestDoc, aDestPos, nCloneFlags );
+}
+
+ScBaseCell* ScBaseCell::CloneWithoutNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags ) const
+{
+ return lclCloneCell( *this, rDestDoc, rDestPos, nCloneFlags );
+}
+
+ScBaseCell* ScBaseCell::CloneWithNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags ) const
+{
+ ScBaseCell* pNewCell = lclCloneCell( *this, rDestDoc, rDestPos, nCloneFlags );
+ if( mpNote )
+ {
+ if( !pNewCell )
+ pNewCell = new ScNoteCell;
+ bool bCloneCaption = (nCloneFlags & SC_CLONECELL_NOCAPTION) == 0;
+ pNewCell->TakeNote( ScNoteUtil::CloneNote( rDestDoc, rDestPos, *mpNote, bCloneCaption ) );
+ }
+ return pNewCell;
}
void ScBaseCell::Delete()
{
- DELETEZ(pNote);
+ DeleteNote();
switch (eCellType)
{
case CELLTYPE_VALUE:
@@ -159,32 +186,45 @@ void ScBaseCell::Delete()
}
}
-void ScBaseCell::SetNote( const ScPostIt& rNote )
+bool ScBaseCell::IsBlank( bool bIgnoreNotes ) const
{
- if (!rNote.IsEmpty())
- {
- if (!pNote)
- pNote = new ScPostIt(rNote);
- else
- *pNote = rNote;
- }
- else
- DELETEZ(pNote);
+ return (eCellType == CELLTYPE_NOTE) && (bIgnoreNotes || !mpNote);
}
-BOOL ScBaseCell::GetNote( ScPostIt& rNote ) const
+void ScBaseCell::TakeNote( ScPostIt* pNote )
{
- if ( pNote )
- rNote = *pNote;
- else
- rNote.Clear();
+ delete mpNote;
+ mpNote = pNote;
+}
- return ( pNote != NULL );
+ScPostIt* ScBaseCell::ReleaseNote()
+{
+ ScPostIt* pNote = mpNote;
+ mpNote = 0;
+ return pNote;
}
void ScBaseCell::DeleteNote()
{
- DELETEZ( pNote );
+ DELETEZ( mpNote );
+}
+
+void ScBaseCell::TakeBroadcaster( SvtBroadcaster* pBroadcaster )
+{
+ delete mpBroadcaster;
+ mpBroadcaster = pBroadcaster;
+}
+
+SvtBroadcaster* ScBaseCell::ReleaseBroadcaster()
+{
+ SvtBroadcaster* pBroadcaster = mpBroadcaster;
+ mpBroadcaster = 0;
+ return pBroadcaster;
+}
+
+void ScBaseCell::DeleteBroadcaster()
+{
+ DELETEZ( mpBroadcaster );
}
ScBaseCell* ScBaseCell::CreateTextCell( const String& rString, ScDocument* pDoc )
@@ -195,12 +235,6 @@ ScBaseCell* ScBaseCell::CreateTextCell( const String& rString, ScDocument* pDoc
return new ScStringCell( rString );
}
-void ScBaseCell::SetBroadcaster(SvtBroadcaster* pNew)
-{
- delete pBroadcaster;
- pBroadcaster = pNew;
-}
-
void ScBaseCell::StartListeningTo( ScDocument* pDoc )
{
if ( eCellType == CELLTYPE_FORMULA && !pDoc->IsClipOrUndo()
@@ -525,7 +559,87 @@ BOOL ScBaseCell::CellEqual( const ScBaseCell* pCell1, const ScBaseCell* pCell2 )
return FALSE;
}
-//-----------------------------------------------------------------------------------
+// ============================================================================
+
+ScNoteCell::ScNoteCell( SvtBroadcaster* pBC ) :
+ ScBaseCell( CELLTYPE_NOTE )
+{
+ TakeBroadcaster( pBC );
+}
+
+ScNoteCell::ScNoteCell( ScPostIt* pNote, SvtBroadcaster* pBC ) :
+ ScBaseCell( CELLTYPE_NOTE )
+{
+ TakeNote( pNote );
+ TakeBroadcaster( pBC );
+}
+
+#ifdef DBG_UTIL
+ScNoteCell::~ScNoteCell()
+{
+ eCellType = CELLTYPE_DESTROYED;
+}
+#endif
+
+ScNoteCell::ScNoteCell( SvStream& rStream, USHORT nVer ) :
+ ScBaseCell( CELLTYPE_NOTE )
+{
+ if( nVer >= SC_DATABYTES2 )
+ {
+ BYTE cData;
+ rStream >> cData;
+ if( cData & 0x0F )
+ rStream.SeekRel( cData & 0x0F );
+ }
+}
+
+void ScNoteCell::Save( SvStream& rStream ) const
+{
+ rStream << (BYTE) 0x00;
+}
+
+// ============================================================================
+
+ScValueCell::ScValueCell() :
+ ScBaseCell( CELLTYPE_VALUE ),
+ mfValue( 0.0 )
+{
+}
+
+ScValueCell::ScValueCell( double fValue ) :
+ ScBaseCell( CELLTYPE_VALUE ),
+ mfValue( fValue )
+{
+}
+
+#ifdef DBG_UTIL
+ScValueCell::~ScValueCell()
+{
+ eCellType = CELLTYPE_DESTROYED;
+}
+#endif
+
+// ============================================================================
+
+ScStringCell::ScStringCell() :
+ ScBaseCell( CELLTYPE_STRING )
+{
+}
+
+ScStringCell::ScStringCell( const String& rString ) :
+ ScBaseCell( CELLTYPE_STRING ),
+ maString( rString.intern() )
+{
+}
+
+#ifdef DBG_UTIL
+ScStringCell::~ScStringCell()
+{
+ eCellType = CELLTYPE_DESTROYED;
+}
+#endif
+
+// ============================================================================
//
// ScFormulaCell
@@ -631,36 +745,35 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
}
}
-ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rNewPos,
- const ScFormulaCell& rScFormulaCell, USHORT nCopyFlags ) :
- ScBaseCell( rScFormulaCell, pDoc ),
+ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, int nCloneFlags ) :
+ ScBaseCell( rCell ),
SvtListener(),
- aResult( rScFormulaCell.aResult ),
- eTempGrammar( rScFormulaCell.eTempGrammar),
- pDocument( pDoc ),
+ aResult( rCell.aResult ),
+ eTempGrammar( rCell.eTempGrammar),
+ pDocument( &rDoc ),
pPrevious(0),
pNext(0),
pPreviousTrack(0),
pNextTrack(0),
- nFormatIndex( pDoc == rScFormulaCell.pDocument ? rScFormulaCell.nFormatIndex : 0 ),
- nFormatType( rScFormulaCell.nFormatType ),
+ nFormatIndex( &rDoc == rCell.pDocument ? rCell.nFormatIndex : 0 ),
+ nFormatType( rCell.nFormatType ),
nSeenInIteration(0),
- cMatrixFlag ( rScFormulaCell.cMatrixFlag ),
- bDirty( rScFormulaCell.bDirty ),
- bChanged( rScFormulaCell.bChanged ),
+ cMatrixFlag ( rCell.cMatrixFlag ),
+ bDirty( rCell.bDirty ),
+ bChanged( rCell.bChanged ),
bRunning( FALSE ),
- bCompile( rScFormulaCell.bCompile ),
- bSubTotal( rScFormulaCell.bSubTotal ),
+ bCompile( rCell.bCompile ),
+ bSubTotal( rCell.bSubTotal ),
bIsIterCell( FALSE ),
bInChangeTrack( FALSE ),
bTableOpDirty( FALSE ),
bNeedListening( FALSE ),
- aPos( rNewPos )
+ aPos( rPos )
{
- pCode = rScFormulaCell.pCode->Clone();
+ pCode = rCell.pCode->Clone();
- if ( nCopyFlags & 0x0001 )
- pCode->ReadjustRelative3DReferences( rScFormulaCell.aPos, aPos );
+ if ( nCloneFlags & SC_CLONECELL_ADJUST3DREL )
+ pCode->ReadjustRelative3DReferences( rCell.aPos, aPos );
// evtl. Fehler zuruecksetzen und neu kompilieren
// nicht im Clipboard - da muss das Fehlerflag erhalten bleiben
@@ -672,7 +785,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rNewPos,
}
//! Compile ColRowNames on URM_MOVE/URM_COPY _after_ UpdateReference
BOOL bCompileLater = FALSE;
- BOOL bClipMode = rScFormulaCell.pDocument->IsClipboard();
+ BOOL bClipMode = rCell.pDocument->IsClipboard();
if( !bCompile )
{ // Name references with references and ColRowNames
pCode->Reset();
@@ -686,7 +799,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rNewPos,
}
else if ( t->GetType() == svIndex )
{
- ScRangeData* pRangeData = pDoc->GetRangeName()->FindIndex( t->GetIndex() );
+ ScRangeData* pRangeData = rDoc.GetRangeName()->FindIndex( t->GetIndex() );
if( pRangeData )
{
if( pRangeData->HasReferences() )
@@ -717,15 +830,18 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rNewPos,
CompileTokenArray( TRUE );
}
}
+
+ if( nCloneFlags & SC_CLONECELL_STARTLISTENING )
+ StartListeningTo( &rDoc );
}
-ScBaseCell* ScFormulaCell::Clone( ScDocument* pDoc, const ScAddress& rPos,
- BOOL bNoListening ) const
+ScFormulaCell::~ScFormulaCell()
{
- ScFormulaCell* pCell = new ScFormulaCell( pDoc, rPos, *this );
- if ( !bNoListening )
- pCell->StartListeningTo( pDoc );
- return pCell;
+ pDocument->RemoveFromFormulaTree( this );
+ delete pCode;
+#ifdef DBG_UTIL
+ eCellType = CELLTYPE_DESTROYED;
+#endif
}
void ScFormulaCell::GetFormula( rtl::OUStringBuffer& rBuffer,
@@ -1810,7 +1926,7 @@ EditTextObject* ScFormulaCell::CreateURLObject()
return rEE.CreateTextObject();
}
-//------------------------------------------------------------------------
+// ============================================================================
ScDetectiveRefIter::ScDetectiveRefIter( ScFormulaCell* pCell )
{
@@ -1861,41 +1977,4 @@ BOOL ScDetectiveRefIter::GetNextRef( ScRange& rRange )
return bRet;
}
-//-----------------------------------------------------------------------------------
-
-ScFormulaCell::~ScFormulaCell()
-{
- pDocument->RemoveFromFormulaTree( this );
- delete pCode;
-#ifdef DBG_UTIL
- eCellType = CELLTYPE_DESTROYED;
-#endif
-}
-
-
-#ifdef DBG_UTIL
-
-ScStringCell::~ScStringCell()
-{
- eCellType = CELLTYPE_DESTROYED;
-}
-#endif
- //! ValueCell auch nur bei DBG_UTIL,
- //! auch in cell.hxx aendern !!!!!!!!!!!!!!!!!!!!
-
-ScValueCell::~ScValueCell()
-{
- eCellType = CELLTYPE_DESTROYED;
-}
-
-#ifdef DBG_UTIL
-
-ScNoteCell::~ScNoteCell()
-{
- eCellType = CELLTYPE_DESTROYED;
-}
-#endif
-
-
-
-
+// ============================================================================
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 9a3d8698942b..0dffbdefa0b7 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cell2.cxx,v $
- * $Revision: 1.33.30.3 $
+ * $Revision: 1.34.102.2 $
*
* This file is part of OpenOffice.org.
*
@@ -60,7 +60,7 @@ const USHORT nMemPoolEditCell = (0x1000 - 64) / sizeof(ScNoteCell);
IMPL_FIXEDMEMPOOL_NEWDEL( ScEditCell, nMemPoolEditCell, nMemPoolEditCell )
#endif
-// -----------------------------------------------------------------------
+// ============================================================================
ScEditCell::ScEditCell( const EditTextObject* pObject, ScDocument* pDocP,
const SfxItemPool* pFromPool ) :
@@ -71,12 +71,12 @@ ScEditCell::ScEditCell( const EditTextObject* pObject, ScDocument* pDocP,
SetTextObject( pObject, pFromPool );
}
-ScEditCell::ScEditCell( const ScEditCell& rEditCell, ScDocument* pDocP ) :
- ScBaseCell( rEditCell, pDocP),
+ScEditCell::ScEditCell( const ScEditCell& rCell, ScDocument& rDoc ) :
+ ScBaseCell( rCell ),
pString( NULL ),
- pDoc( pDocP )
+ pDoc( &rDoc )
{
- SetTextObject( rEditCell.pData, rEditCell.pDoc->GetEditPool() );
+ SetTextObject( rCell.pData, rCell.pDoc->GetEditPool() );
}
ScEditCell::ScEditCell( const String& rString, ScDocument* pDocP ) :
@@ -103,11 +103,6 @@ ScEditCell::~ScEditCell()
#endif
}
-ScBaseCell* ScEditCell::Clone( ScDocument* pNewDoc ) const
-{
- return new ScEditCell( *this, pNewDoc );
-}
-
void ScEditCell::SetData( const EditTextObject* pObject,
const SfxItemPool* pFromPool )
{
@@ -178,7 +173,7 @@ void ScEditCell::SetTextObject( const EditTextObject* pObject,
pData = NULL;
}
-//---------------------------------------------------------------------
+// ============================================================================
BOOL ScFormulaCell::IsEmpty()
{
@@ -1357,3 +1352,5 @@ void ScFormulaCell::CompileColRowNameFormula()
}
}
+// ============================================================================
+
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 4fbd4aa7b910..67eb13b0c6c4 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: column.cxx,v $
- * $Revision: 1.31.32.1 $
+ * $Revision: 1.31.128.9 $
*
* This file is part of OpenOffice.org.
*
@@ -61,11 +61,6 @@
// STATIC DATA -----------------------------------------------------------
using namespace formula;
-inline BOOL CellVisible( const ScBaseCell* pCell ) //! an Zelle verschieben
-{
- return ( pCell->GetCellType() != CELLTYPE_NOTE || pCell->GetNotePtr() );
-}
-
inline BOOL IsAmbiguousScriptNonZero( BYTE nScript )
{
//! move to a header file
@@ -826,131 +821,124 @@ void ScColumn::Resize( SCSIZE nSize )
// SwapRow zum Sortieren
+namespace {
+
+/** Moves broadcaster from old cell to new cell if exists, otherwise creates a new note cell. */
+void lclTakeBroadcaster( ScBaseCell*& rpCell, SvtBroadcaster* pBC )
+{
+ if( pBC )
+ {
+ if( rpCell )
+ rpCell->TakeBroadcaster( pBC );
+ else
+ rpCell = new ScNoteCell( pBC );
+ }
+}
+
+} // namespace
+
void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
{
- // Zeiger vertauschen klappt nicht wegen Broadcastern
- // (Absturz, wenn Zelle, auch indirekt, auf sich selbst broadcasted)
+ /* Simple swap of cell pointers does not work if broadcasters exist (crash
+ if cell broadcasts directly or indirectly to itself). While swapping
+ the cells, broadcasters have to remain at old positions! */
- ScBaseCell *pCell1, *pCell2;
- SCSIZE nIndex1, nIndex2;
+ /* While cloning cells, do not clone notes, but move note pointers to new
+ cells. This prevents creation of new caption drawing objects for every
+ swap operation while sorting. */
+ ScBaseCell* pCell1 = 0;
+ SCSIZE nIndex1;
if ( Search( nRow1, nIndex1 ) )
pCell1 = pItems[nIndex1].pCell;
- else
- pCell1 = NULL;
+
+ ScBaseCell* pCell2 = 0;
+ SCSIZE nIndex2;
if ( Search( nRow2, nIndex2 ) )
pCell2 = pItems[nIndex2].pCell;
- else
- pCell2 = NULL;
+ // no cells found, nothing to do
if ( !pCell1 && !pCell2 )
return ;
- CellType eType1 = ( pCell1 ? pCell1->GetCellType() : CELLTYPE_NONE );
- CellType eType2 = ( pCell2 ? pCell2->GetCellType() : CELLTYPE_NONE );
+ // swap variables if first cell is empty, to save some code below
+ if ( !pCell1 )
+ {
+ ::std::swap( nRow1, nRow2 );
+ ::std::swap( nIndex1, nIndex2 );
+ ::std::swap( pCell1, pCell2 );
+ }
- // Broadcaster bleiben an alter Stelle
- SvtBroadcaster *pBC1, *pBC2;
+ // from here: first cell (pCell1, nIndex1) exists always
- if ( eType1 != CELLTYPE_FORMULA && eType2 != CELLTYPE_FORMULA )
- { // simple swap, kann nichts auf sich selbst broadcasten
- if ( pCell1 )
- {
- pBC1 = pCell1->GetBroadcaster();
- if ( pBC1 )
- pCell1->ForgetBroadcaster();
- }
- else
- pBC1 = NULL;
+ ScAddress aPos1( nCol, nRow1, nTab );
+ ScAddress aPos2( nCol, nRow2, nTab );
- if ( pCell2 )
- {
- pBC2 = pCell2->GetBroadcaster();
- if ( pBC2 )
- pCell2->ForgetBroadcaster();
- }
- else
- pBC2 = NULL;
+ CellType eType1 = pCell1->GetCellType();
+ CellType eType2 = pCell2 ? pCell2->GetCellType() : CELLTYPE_NONE;
+
+ ScFormulaCell* pFmlaCell1 = (eType1 == CELLTYPE_FORMULA) ? static_cast< ScFormulaCell* >( pCell1 ) : 0;
+ ScFormulaCell* pFmlaCell2 = (eType2 == CELLTYPE_FORMULA) ? static_cast< ScFormulaCell* >( pCell2 ) : 0;
+
+ // simple swap if no formula cells present
+ if ( !pFmlaCell1 && !pFmlaCell2 )
+ {
+ // remember cell broadcasters, must remain at old position
+ SvtBroadcaster* pBC1 = pCell1->ReleaseBroadcaster();
- if ( pCell1 && pCell2 )
+ if ( pCell2 )
{
+ /* Both cells exist, no formula cells involved, a simple swap can
+ be performed (but keep broadcasters and notes at old position). */
pItems[nIndex1].pCell = pCell2;
pItems[nIndex2].pCell = pCell1;
- if ( pBC1 )
- pCell2->SetBroadcaster( pBC1 );
- if ( pBC2 )
- pCell1->SetBroadcaster( pBC2 );
- ScAddress aPos( nCol, nRow1, nTab );
- ScHint aHint( SC_HINT_DATACHANGED, aPos, pCell2 );
- pDocument->Broadcast( aHint );
- aHint.GetAddress().SetRow( nRow2 );
- aHint.SetCell( pCell1 );
- pDocument->Broadcast( aHint );
+
+ SvtBroadcaster* pBC2 = pCell2->ReleaseBroadcaster();
+ pCell1->TakeBroadcaster( pBC2 );
+ pCell2->TakeBroadcaster( pBC1 );
+
+ ScHint aHint1( SC_HINT_DATACHANGED, aPos1, pCell2 );
+ pDocument->Broadcast( aHint1 );
+ ScHint aHint2( SC_HINT_DATACHANGED, aPos2, pCell1 );
+ pDocument->Broadcast( aHint2 );
}
- else if ( pCell1 )
+ else
{
- ScNoteCell* pNew = ( pBC1 ? new ScNoteCell : NULL );
- if ( pNew )
+ ScNoteCell* pDummyCell = pBC1 ? new ScNoteCell( pBC1 ) : 0;
+ if ( pDummyCell )
{
- pItems[nIndex1].pCell = pNew;
- pNew->SetBroadcaster( pBC1 );
+ // insert dummy note cell (without note) containing old broadcaster
+ pItems[nIndex1].pCell = pDummyCell;
}
else
- { // Loeschen
+ {
+ // remove ColEntry at old position
--nCount;
memmove( &pItems[nIndex1], &pItems[nIndex1 + 1], (nCount - nIndex1) * sizeof(ColEntry) );
pItems[nCount].nRow = 0;
- pItems[nCount].pCell = NULL;
+ pItems[nCount].pCell = 0;
}
- // Einfuegen
+
+ // insert ColEntry at new position
Insert( nRow2, pCell1 );
- pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
- ScAddress( nCol, nRow1, nTab ), pNew ) );
- }
- else // pCell2
- {
- ScNoteCell* pNew = ( pBC2 ? new ScNoteCell : NULL );
- if ( pNew )
- {
- pItems[nIndex2].pCell = pNew;
- pNew->SetBroadcaster( pBC2 );
- }
- else
- { // Loeschen
- --nCount;
- memmove( &pItems[nIndex2], &pItems[nIndex2 + 1], (nCount - nIndex2) * sizeof(ColEntry) );
- pItems[nCount].nRow = 0;
- pItems[nCount].pCell = NULL;
- }
- // Einfuegen
- Insert( nRow1, pCell2 );
- pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
- ScAddress( nCol, nRow2, nTab ), pNew ) );
- }
- ScPostIt aCellNote(pDocument);
- // Hide the visible note if doing a swap.
- if(pCell1 && pCell1->GetNote(aCellNote) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow1 );
- aCellNote.SetShown(FALSE);
- pCell1->SetNote(aCellNote);
- }
- if(pCell2 && pCell2->GetNote(aCellNote) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow2 );
- aCellNote.SetShown(FALSE);
- pCell2->SetNote(aCellNote);
+ pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pDummyCell ) );
}
- return ;
+ return;
}
- // ab hier ist mindestens eine Formelzelle beteiligt
+ // from here: at least one of the cells is a formula cell
- if ( eType1 == CELLTYPE_FORMULA && eType2 == CELLTYPE_FORMULA )
+ /* Never move any array formulas. Disabling sort if parts of array
+ formulas are contained is done at UI. */
+ if ( (pFmlaCell1 && (pFmlaCell1->GetMatrixFlag() != 0)) || (pFmlaCell2 && (pFmlaCell2->GetMatrixFlag() != 0)) )
+ return;
+
+ // do not swap, if formulas are equal
+ if ( pFmlaCell1 && pFmlaCell2 )
{
- ScTokenArray* pCode1 = ((ScFormulaCell*)pCell1)->GetCode();
- ScTokenArray* pCode2 = ((ScFormulaCell*)pCell2)->GetCode();
+ ScTokenArray* pCode1 = pFmlaCell1->GetCode();
+ ScTokenArray* pCode2 = pFmlaCell2->GetCode();
if (pCode1->GetLen() == pCode2->GetLen()) // nicht-UPN
{
@@ -968,218 +956,128 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
}
}
- if (bEqual) // gleiche Formeln nicht vertauschen
+ // do not swap formula cells with equal formulas, but swap notes
+ if (bEqual)
+ {
+ ScPostIt* pNote1 = pCell1->ReleaseNote();
+ pCell1->TakeNote( pCell2->ReleaseNote() );
+ pCell2->TakeNote( pNote1 );
return;
+ }
}
}
- if ( ( eType1 == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell1)->GetMatrixFlag() != 0 ) ||
- ( eType2 == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell2)->GetMatrixFlag() != 0 ) )
- {
- // never move any array formulas
- // (disabling sort if parts of array formulas are contained is done at ui)
-
- return;
- }
-
- ScBaseCell *pNew1, *pNew2;
-
// hier kein UpdateReference wegen #30529# - mitsortiert werden nur noch relative Referenzen
// long dy = (long)nRow2 - (long)nRow1;
- if (pCell1)
- {
- pBC1 = pCell1->GetBroadcaster();
- if ( pBC1 )
- pCell1->ForgetBroadcaster();
- ScPostIt aCellNote(pDocument);
- // Hide the visible note if doing a swap.
- if(pCell1->GetNote(aCellNote) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow1 );
- aCellNote.SetShown(FALSE);
- pCell1->SetNote(aCellNote);
- }
- if ( eType1 == CELLTYPE_FORMULA )
- {
- pNew2 = new ScFormulaCell( pDocument, ScAddress( nCol, nRow2, nTab ),
- *(const ScFormulaCell*)pCell1, 0x0001 );
-// ScRange aRange( ScAddress( 0, nRow2, nTab ), ScAddress( MAXCOL, nRow2, nTab ) );
-// ((ScFormulaCell*)pNew2)->UpdateReference(URM_MOVE, aRange, 0, dy, 0);
- }
- else
- pNew2 = pCell1->Clone( pDocument );
- }
- else
- {
- pNew2 = NULL;
- pBC1 = NULL;
- }
+ /* Create clone of pCell1 at position of pCell2 (pCell1 exists always, see
+ variable swapping above). Do not clone the note, but move pointer of
+ old note to new cell. */
+ ScBaseCell* pNew2 = pCell1->CloneWithoutNote( *pDocument, aPos2, SC_CLONECELL_ADJUST3DREL );
+ pNew2->TakeNote( pCell1->ReleaseNote() );
- if (pCell2)
+ /* Create clone of pCell2 at position of pCell1. Do not clone the note,
+ but move pointer of old note to new cell. */
+ ScBaseCell* pNew1 = 0;
+ if ( pCell2 )
{
- pBC2 = pCell2->GetBroadcaster();
- if ( pBC2 )
- pCell2->ForgetBroadcaster();
- ScPostIt aCellNote(pDocument);
- // Hide the visible note if doing a swap.
- if(pCell2->GetNote(aCellNote) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow2 );
- aCellNote.SetShown(FALSE);
- pCell2->SetNote(aCellNote);
- }
- if ( eType2 == CELLTYPE_FORMULA )
- {
- pNew1 = new ScFormulaCell( pDocument, ScAddress( nCol, nRow1, nTab ),
- *(const ScFormulaCell*)pCell2, 0x0001 );
-// ScRange aRange( ScAddress( 0, nRow1, nTab ), ScAddress( MAXCOL, nRow1, nTab ) );
-// ((ScFormulaCell*)pNew1)->UpdateReference(URM_MOVE, aRange, 0, -dy, 0);
- }
- else
- pNew1 = pCell2->Clone( pDocument );
+ pNew1 = pCell2->CloneWithoutNote( *pDocument, aPos1, SC_CLONECELL_ADJUST3DREL );
+ pNew1->TakeNote( pCell2->ReleaseNote() );
}
- else
- {
- pNew1 = NULL;
- pBC2 = NULL;
- }
-
- if ( !pNew1 && pBC1 )
- pNew1 = new ScNoteCell;
- if ( !pNew2 && pBC2 )
- pNew2 = new ScNoteCell;
- // Delete nur, wenn es keine neue Zelle gibt (Insert loescht die alte Zelle auch)
- // Notizen muessen aber einzeln geloescht werden, weil Insert sie stehenlaesst
+ // move old broadcasters new cells at the same old position
+ SvtBroadcaster* pBC1 = pCell1->ReleaseBroadcaster();
+ lclTakeBroadcaster( pNew1, pBC1 );
+ SvtBroadcaster* pBC2 = pCell2 ? pCell2->ReleaseBroadcaster() : 0;
+ lclTakeBroadcaster( pNew2, pBC2 );
- if ( pCell1 && ( !pNew1 || (pCell1->GetNotePtr() && !pNew1->GetNotePtr()) ) )
- Delete( nRow1 );
- if ( pCell2 && ( !pNew2 || (pCell2->GetNotePtr() && !pNew2->GetNotePtr()) ) )
- Delete( nRow2 );
+ /* Insert the new cells. Old cell has to be deleted, if there is no new
+ cell (call to Insert deletes old cell by itself). */
+ if ( !pNew1 )
+ Delete( nRow1 ); // deletes pCell1
+ else
+ Insert( nRow1, pNew1 ); // deletes pCell1, inserts pNew1
- if (pNew1)
- {
- Insert( nRow1, pNew1 );
- if ( pBC1 )
- pNew1->SetBroadcaster( pBC1 );
- }
- if (pNew2)
- {
- Insert( nRow2, pNew2 );
- if ( pBC2 )
- pNew2->SetBroadcaster( pBC2 );
- }
+ if ( pCell2 && !pNew2 )
+ Delete( nRow2 ); // deletes pCell2
+ else if ( pNew2 )
+ Insert( nRow2, pNew2 ); // deletes pCell2 (if existing), inserts pNew2
// #64122# Bei Formeln hinterher nochmal broadcasten, damit die Formel nicht in irgendwelchen
// FormulaTrack-Listen landet, ohne die Broadcaster beruecksichtigt zu haben
// (erst hier, wenn beide Zellen eingefuegt sind)
- if ( pBC1 && eType2 == CELLTYPE_FORMULA )
- pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, ScAddress( nCol, nRow1, nTab ), pNew1 ) );
- if ( pBC2 && eType1 == CELLTYPE_FORMULA )
- pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, ScAddress( nCol, nRow2, nTab ), pNew2 ) );
+ if ( pBC1 && pFmlaCell2 )
+ pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pNew1 ) );
+ if ( pBC2 && pFmlaCell1 )
+ pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos2, pNew2 ) );
}
void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol)
{
- BOOL bFound1;
- BOOL bFound2;
+ ScBaseCell* pCell1 = 0;
SCSIZE nIndex1;
+ if ( Search( nRow, nIndex1 ) )
+ pCell1 = pItems[nIndex1].pCell;
+
+ ScBaseCell* pCell2 = 0;
SCSIZE nIndex2;
- bFound1 = Search(nRow, nIndex1);
- bFound2 = rCol.Search(nRow, nIndex2);
- if (bFound1 && bFound2)
+ if ( rCol.Search( nRow, nIndex2 ) )
+ pCell2 = rCol.pItems[nIndex2].pCell;
+
+ // reverse call if own cell is missing (ensures own existing cell in following code)
+ if( !pCell1 )
+ {
+ if( pCell2 )
+ rCol.SwapCell( nRow, *this );
+ return;
+ }
+
+ // from here: own cell (pCell1, nIndex1) exists always
+
+ ScFormulaCell* pFmlaCell1 = (pCell1->GetCellType() == CELLTYPE_FORMULA) ? static_cast< ScFormulaCell* >( pCell1 ) : 0;
+ ScFormulaCell* pFmlaCell2 = (pCell2 && (pCell2->GetCellType() == CELLTYPE_FORMULA)) ? static_cast< ScFormulaCell* >( pCell2 ) : 0;
+
+ if ( pCell2 )
{
// Tauschen
- ScFormulaCell* pCell1 = (ScFormulaCell*) pItems[nIndex1].pCell;
- ScFormulaCell* pCell2 = (ScFormulaCell*) rCol.pItems[nIndex2].pCell;
- ScPostIt aCellNote(pDocument);
- // Hide the visible note if doing a swap.
- if(pCell1->GetNote(aCellNote) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow );
- aCellNote.SetShown(FALSE);
- pCell1->SetNote(aCellNote);
- }
- if(pCell2->GetNote(aCellNote) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( rCol.nCol, nRow );
- aCellNote.SetShown(FALSE);
- pCell2->SetNote(aCellNote);
- }
pItems[nIndex1].pCell = pCell2;
rCol.pItems[nIndex2].pCell = pCell1;
// Referenzen aktualisieren
SCsCOL dx = rCol.nCol - nCol;
- if (pCell1->GetCellType() == CELLTYPE_FORMULA)
+ if ( pFmlaCell1 )
{
ScRange aRange( ScAddress( rCol.nCol, 0, nTab ),
ScAddress( rCol.nCol, MAXROW, nTab ) );
- pCell1->aPos.SetCol( rCol.nCol );
- pCell1->UpdateReference(URM_MOVE, aRange, dx, 0, 0);
+ pFmlaCell1->aPos.SetCol( rCol.nCol );
+ pFmlaCell1->UpdateReference(URM_MOVE, aRange, dx, 0, 0);
}
- if (pCell2->GetCellType() == CELLTYPE_FORMULA)
+ if ( pFmlaCell2 )
{
ScRange aRange( ScAddress( nCol, 0, nTab ),
ScAddress( nCol, MAXROW, nTab ) );
- pCell2->aPos.SetCol( nCol );
- pCell2->UpdateReference(URM_MOVE, aRange, -dx, 0, 0);
+ pFmlaCell2->aPos.SetCol( nCol );
+ pFmlaCell2->UpdateReference(URM_MOVE, aRange, -dx, 0, 0);
}
}
- else if (bFound1)
+ else
{
- ScFormulaCell* pCell = (ScFormulaCell*) pItems[nIndex1].pCell;
- ScPostIt aCellNote(pDocument);
- if(pCell->GetNote(aCellNote) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow );
- aCellNote.SetShown(FALSE);
- pCell->SetNote(aCellNote);
- }
// Loeschen
--nCount;
memmove( &pItems[nIndex1], &pItems[nIndex1 + 1], (nCount - nIndex1) * sizeof(ColEntry) );
pItems[nCount].nRow = 0;
- pItems[nCount].pCell = NULL;
+ pItems[nCount].pCell = 0;
// Referenzen aktualisieren
SCsCOL dx = rCol.nCol - nCol;
- if (pCell->GetCellType() == CELLTYPE_FORMULA)
+ if ( pFmlaCell1 )
{
ScRange aRange( ScAddress( rCol.nCol, 0, nTab ),
ScAddress( rCol.nCol, MAXROW, nTab ) );
- pCell->aPos.SetCol( rCol.nCol );
- pCell->UpdateReference(URM_MOVE, aRange, dx, 0, 0);
- }
- // Einfuegen
- rCol.Insert(nRow, pCell);
- }
- else if (bFound2)
- {
- ScFormulaCell* pCell = (ScFormulaCell*) rCol.pItems[nIndex2].pCell;
- ScPostIt aCellNote(pDocument);
- if(pCell->GetNote(aCellNote) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( rCol.nCol, nRow );
- aCellNote.SetShown(FALSE);
- pCell->SetNote(aCellNote);
- }
- // Loeschen
- --(rCol.nCount);
- memmove( &rCol.pItems[nIndex2], &rCol.pItems[nIndex2 + 1], (rCol.nCount - nIndex2) * sizeof(ColEntry) );
- rCol.pItems[rCol.nCount].nRow = 0;
- rCol.pItems[rCol.nCount].pCell = NULL;
- // Referenzen aktualisieren
- SCsCOL dx = rCol.nCol - nCol;
- if (pCell->GetCellType() == CELLTYPE_FORMULA)
- {
- ScRange aRange( ScAddress( nCol, 0, nTab ),
- ScAddress( nCol, MAXROW, nTab ) );
- pCell->aPos.SetCol( nCol );
- pCell->UpdateReference(URM_MOVE, aRange, dx, 0, 0);
+ pFmlaCell1->aPos.SetCol( rCol.nCol );
+ pFmlaCell1->UpdateReference(URM_MOVE, aRange, dx, 0, 0);
}
// Einfuegen
- Insert(nRow, pCell);
+ rCol.Insert(nRow, pCell1);
}
}
@@ -1192,7 +1090,7 @@ BOOL ScColumn::TestInsertCol( SCROW nStartRow, SCROW nEndRow) const
if (pItems)
for (SCSIZE i=0; (i<nCount) && bTest; i++)
bTest = (pItems[i].nRow < nStartRow) || (pItems[i].nRow > nEndRow)
- || !CellVisible(pItems[i].pCell);
+ || pItems[i].pCell->IsBlank();
// AttrArray testet nur zusammengefasste
@@ -1225,7 +1123,7 @@ BOOL ScColumn::TestInsertRow( SCSIZE nSize ) const
return FALSE;
SCSIZE nVis = nCount;
- while ( nVis && !CellVisible(pItems[nVis-1].pCell) )
+ while ( nVis && pItems[nVis-1].pCell->IsBlank() )
--nVis;
if ( nVis )
@@ -1325,12 +1223,12 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
for (i = 0; i < nDelCount; i++)
{
ScBaseCell* pCell = ppDelCells[i];
- DBG_ASSERT( !CellVisible(pCell), "sichtbare Zelle weggeschoben" );
+ DBG_ASSERT( pCell->IsBlank(), "sichtbare Zelle weggeschoben" );
SvtBroadcaster* pBC = pCell->GetBroadcaster();
if (pBC)
{
MoveListeners( *pBC, pDelRows[i] - nSize );
- pCell->SetBroadcaster(NULL);
+ pCell->DeleteBroadcaster();
pCell->Delete();
}
}
@@ -1343,7 +1241,7 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
}
-void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, BOOL bKeepScenarioFlags)
+void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions)
{
pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray,
bKeepScenarioFlags ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL );
@@ -1372,9 +1270,14 @@ void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, BOOL bKee
if (nBlockCount)
{
+ int nCloneFlags = bCloneNoteCaptions ? SC_CLONECELL_DEFAULT : SC_CLONECELL_NOCAPTION;
rColumn.Resize( rColumn.GetCellCount() + nBlockCount );
+ ScAddress aPos( rColumn.nCol, 0, rColumn.nTab );
for (i = nStartIndex; i <= nEndIndex; i++)
- rColumn.Append(pItems[i].nRow, pItems[i].pCell->Clone(rColumn.pDocument));
+ {
+ aPos.SetRow( pItems[i].nRow );
+ rColumn.Append( aPos.Row(), pItems[i].pCell->CloneWithNote( *rColumn.pDocument, aPos, nCloneFlags ) );
+ }
}
}
@@ -1441,22 +1344,13 @@ void ScColumn::CopyToColumn(SCROW nRow1, SCROW nRow2, USHORT nFlags, BOOL bMarke
if (nBlockCount)
{
rColumn.Resize( rColumn.GetCellCount() + nBlockCount );
- ScAddress aAdr( rColumn.nCol, 0, rColumn.nTab );
+ ScAddress aDestPos( rColumn.nCol, 0, rColumn.nTab );
for (i = nStartIndex; i <= nEndIndex; i++)
{
- aAdr.SetRow( pItems[i].nRow );
- ScBaseCell* pNew;
- if (bAsLink)
- {
- pNew = CreateRefCell( rColumn.pDocument, aAdr, i, nFlags );
- }
- else
- {
- pNew = CloneCell( i, nFlags, rColumn.pDocument, aAdr );
-
- if ( pNew && pNew->GetNotePtr() && (nFlags & IDF_NOTE) == 0 )
- pNew->DeleteNote();
- }
+ aDestPos.SetRow( pItems[i].nRow );
+ ScBaseCell* pNew = bAsLink ?
+ CreateRefCell( rColumn.pDocument, aDestPos, i, nFlags ) :
+ CloneCell( i, nFlags, *rColumn.pDocument, aDestPos );
if (pNew)
rColumn.Insert(pItems[i].nRow, pNew);
@@ -1481,17 +1375,18 @@ void ScColumn::UndoToColumn(SCROW nRow1, SCROW nRow2, USHORT nFlags, BOOL bMarke
void ScColumn::CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const
{
- ScDocument* pDestDoc = rDestCol.pDocument;
+ ScDocument& rDestDoc = *rDestCol.pDocument;
+ ScAddress aDestPos( rDestCol.nCol, 0, rDestCol.nTab );
SCSIZE nPosCount = rPosCol.nCount;
for (SCSIZE nPosIndex = 0; nPosIndex < nPosCount; nPosIndex++)
{
- SCROW nRow = rPosCol.pItems[nPosIndex].nRow;
+ aDestPos.SetRow( rPosCol.pItems[nPosIndex].nRow );
SCSIZE nThisIndex;
- if ( Search( nRow, nThisIndex ) )
+ if ( Search( aDestPos.Row(), nThisIndex ) )
{
- ScBaseCell* pNew = pItems[nThisIndex].pCell->Clone(pDestDoc);
- rDestCol.Insert( nRow, pNew );
+ ScBaseCell* pNew = pItems[nThisIndex].pCell->CloneWithNote( rDestDoc, aDestPos );
+ rDestCol.Insert( aDestPos.Row(), pNew );
}
}
@@ -1879,10 +1774,9 @@ void ScColumn::UpdateDeleteTab( SCTAB nTable, BOOL bIsMove, ScColumn* pRefUndo )
SCROW nRow = pItems[i].nRow;
ScFormulaCell* pOld = (ScFormulaCell*)pItems[i].pCell;
- ScFormulaCell* pSave = NULL;
- if (pRefUndo)
- pSave = (ScFormulaCell*)pOld->Clone( pDocument,
- ScAddress( nCol, nRow, nTab ), TRUE );
+ /* Do not copy cell note to the undo document. Undo will copy
+ back the formula cell while keeping the original note. */
+ ScBaseCell* pSave = pRefUndo ? pOld->CloneWithoutNote( *pDocument ) : 0;
BOOL bChanged = pOld->UpdateDeleteTab(nTable, bIsMove);
if ( nRow != pItems[i].nRow )
@@ -1892,8 +1786,8 @@ void ScColumn::UpdateDeleteTab( SCTAB nTable, BOOL bIsMove, ScColumn* pRefUndo )
{
if (bChanged)
pRefUndo->Insert( nRow, pSave );
- else
- delete pSave;
+ else if(pSave)
+ pSave->Delete();
}
}
}
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index f4be351ee9ef..97de46655741 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: column2.cxx,v $
- * $Revision: 1.33 $
+ * $Revision: 1.32.126.6 $
*
* This file is part of OpenOffice.org.
*
@@ -69,7 +69,6 @@
#include "compiler.hxx" // ScTokenArray GetCodeLen
#include "dbcolect.hxx"
#include "fillinfo.hxx"
-#include "postit.hxx"
#include <math.h>
@@ -80,11 +79,6 @@
// -----------------------------------------------------------------------
-inline BOOL CellVisible( const ScBaseCell* pCell )
-{
- return ( pCell->GetCellType() != CELLTYPE_NOTE || pCell->GetNotePtr() );
-}
-
inline BOOL IsAmbiguousScript( BYTE nScript )
{
//! move to a header file
@@ -1008,11 +1002,8 @@ void ScColumn::RemoveAutoSpellObj()
{
String aText = ScEditUtil::GetSpaceDelimitedString( *pEngine );
ScBaseCell* pNewCell = new ScStringCell( aText );
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- pNewCell->SetBroadcaster( pBC );
- pOldCell->ForgetBroadcaster();
- if (pOldCell->GetNotePtr())
- pNewCell->SetNote( *pOldCell->GetNotePtr() );
+ pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
+ pNewCell->TakeNote( pOldCell->ReleaseNote() );
pItems[i].pCell = pNewCell;
delete pOldCell;
}
@@ -1083,11 +1074,8 @@ void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow )
{
String aText = ScEditUtil::GetSpaceDelimitedString( *pEngine );
ScBaseCell* pNewCell = new ScStringCell( aText );
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- pNewCell->SetBroadcaster( pBC );
- pOldCell->ForgetBroadcaster();
- if (pOldCell->GetNotePtr())
- pNewCell->SetNote( *pOldCell->GetNotePtr() );
+ pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
+ pNewCell->TakeNote( pOldCell->ReleaseNote() );
pItems[i].pCell = pNewCell;
delete pOldCell;
}
@@ -1236,7 +1224,7 @@ BOOL ScColumn::IsEmptyVisData(BOOL bNotes) const
for (i=0; i<nCount && !bVisData; i++)
{
ScBaseCell* pCell = pItems[i].pCell;
- if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->GetNotePtr()) )
+ if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->HasNote()) )
bVisData = TRUE;
}
return !bVisData;
@@ -1273,7 +1261,7 @@ SCROW ScColumn::GetLastVisDataPos(BOOL bNotes) const
{
--i;
ScBaseCell* pCell = pItems[i].pCell;
- if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->GetNotePtr()) )
+ if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->HasNote()) )
{
bFound = TRUE;
nRet = pItems[i].nRow;
@@ -1293,7 +1281,7 @@ SCROW ScColumn::GetFirstVisDataPos(BOOL bNotes) const
for (i=0; i<nCount && !bFound; i++)
{
ScBaseCell* pCell = pItems[i].pCell;
- if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->GetNotePtr()) )
+ if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->HasNote()) )
{
bFound = TRUE;
nRet = pItems[i].nRow;
@@ -1307,7 +1295,7 @@ BOOL ScColumn::HasVisibleDataAt(SCROW nRow) const
{
SCSIZE nIndex;
if (Search(nRow, nIndex))
- if (CellVisible(pItems[nIndex].pCell))
+ if (!pItems[nIndex].pCell->IsBlank())
return TRUE;
return FALSE;
@@ -1326,7 +1314,7 @@ BOOL ScColumn::IsEmpty() const
return (IsEmptyData() && IsEmptyAttr());
}
-BOOL ScColumn::IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const
+BOOL ScColumn::IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes) const
{
if ( nCount == 0 || !pItems )
return TRUE;
@@ -1335,7 +1323,7 @@ BOOL ScColumn::IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const
Search( nStartRow, nIndex );
while ( nIndex < nCount && pItems[nIndex].nRow <= nEndRow )
{
- if ( CellVisible(pItems[nIndex].pCell) ) // found a cell
+ if ( !pItems[nIndex].pCell->IsBlank( bIgnoreNotes ) ) // found a cell
return FALSE; // not empty
++nIndex;
}
@@ -1357,7 +1345,7 @@ SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirecti
i--;
if ( pItems[i].nRow < nStartRow )
break;
- bFound = pItems[i].nRow <= nEndRow && CellVisible(pItems[i].pCell);
+ bFound = pItems[i].nRow <= nEndRow && !pItems[i].pCell->IsBlank();
}
if (bFound)
nLines = static_cast<SCSIZE>(nEndRow - pItems[i].nRow);
@@ -1371,7 +1359,7 @@ SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirecti
{
if ( pItems[i].nRow > nEndRow )
break;
- bFound = pItems[i].nRow >= nStartRow && CellVisible(pItems[i].pCell);
+ bFound = pItems[i].nRow >= nStartRow && !pItems[i].pCell->IsBlank();
i++;
}
if (bFound)
@@ -1434,7 +1422,7 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) const
SCSIZE nIndex;
BOOL bThere = Search(rRow, nIndex);
- if (bThere && !CellVisible(pItems[nIndex].pCell))
+ if (bThere && pItems[nIndex].pCell->IsBlank())
bThere = FALSE;
if (bThere)
@@ -1447,13 +1435,13 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) const
{
++nIndex;
while (nIndex<nCount-1 && pItems[nIndex].nRow==nLast+1
- && CellVisible(pItems[nIndex].pCell))
+ && !pItems[nIndex].pCell->IsBlank())
{
++nIndex;
++nLast;
}
if (nIndex==nCount-1)
- if (pItems[nIndex].nRow==nLast+1 && CellVisible(pItems[nIndex].pCell))
+ if (pItems[nIndex].nRow==nLast+1 && !pItems[nIndex].pCell->IsBlank())
++nLast;
}
}
@@ -1463,13 +1451,13 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) const
{
--nIndex;
while (nIndex>0 && pItems[nIndex].nRow+1==nLast
- && CellVisible(pItems[nIndex].pCell))
+ && !pItems[nIndex].pCell->IsBlank())
{
--nIndex;
--nLast;
}
if (nIndex==0)
- if (pItems[nIndex].nRow+1==nLast && CellVisible(pItems[nIndex].pCell))
+ if (pItems[nIndex].nRow+1==nLast && !pItems[nIndex].pCell->IsBlank())
--nLast;
}
}
@@ -1486,7 +1474,7 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) const
{
if (bForward)
{
- while (nIndex<nCount && !CellVisible(pItems[nIndex].pCell))
+ while (nIndex<nCount && pItems[nIndex].pCell->IsBlank())
++nIndex;
if (nIndex<nCount)
rRow = pItems[nIndex].nRow;
@@ -1495,7 +1483,7 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) const
}
else
{
- while (nIndex>0 && !CellVisible(pItems[nIndex-1].pCell))
+ while (nIndex>0 && pItems[nIndex-1].pCell->IsBlank())
--nIndex;
if (nIndex>0)
rRow = pItems[nIndex-1].nRow;
@@ -1515,7 +1503,7 @@ BOOL ScColumn::HasDataAt(SCROW nRow) const
SCSIZE nIndex;
if (Search(nRow, nIndex))
- if (CellVisible(pItems[nIndex].pCell))
+ if (!pItems[nIndex].pCell->IsBlank())
return TRUE;
return FALSE;
@@ -1599,7 +1587,7 @@ void ScColumn::StartListening( SvtListener& rLst, SCROW nRow )
if (!pBC)
{
pBC = new SvtBroadcaster;
- pCell->SetBroadcaster(pBC);
+ pCell->TakeBroadcaster(pBC);
}
rLst.StartListening(*pBC);
}
@@ -1624,7 +1612,7 @@ void ScColumn::MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow )
if (!pBC)
{
pBC = new SvtBroadcaster;
- pCell->SetBroadcaster(pBC);
+ pCell->TakeBroadcaster(pBC);
}
if (rSource.HasListeners())
@@ -1651,10 +1639,10 @@ void ScColumn::EndListening( SvtListener& rLst, SCROW nRow )
if (!pBC->HasListeners())
{
- if (pCell->GetCellType() == CELLTYPE_NOTE && !pCell->GetNotePtr())
+ if (pCell->IsBlank())
DeleteAtIndex(nIndex);
else
- pCell->SetBroadcaster(NULL);
+ pCell->DeleteBroadcaster();
}
}
// else
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 2465bdf164c7..3faf5f2415b8 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: column3.cxx,v $
- * $Revision: 1.27 $
+ * $Revision: 1.27.128.7 $
*
* This file is part of OpenOffice.org.
*
@@ -80,14 +80,13 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
if (Search(nRow, nIndex))
{
ScBaseCell* pOldCell = pItems[nIndex].pCell;
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- if (pBC && !pNewCell->GetBroadcaster())
- {
- pNewCell->SetBroadcaster( pBC );
- pOldCell->ForgetBroadcaster();
- }
- if (pOldCell->GetNotePtr() && !pNewCell->GetNotePtr())
- pNewCell->SetNote( *pOldCell->GetNotePtr() );
+
+ // move broadcaster and note to new cell, if not existing in new cell
+ if (pOldCell->HasBroadcaster() && !pNewCell->HasBroadcaster())
+ pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
+ if (pOldCell->HasNote() && !pNewCell->HasNote())
+ pNewCell->TakeNote( pOldCell->ReleaseNote() );
+
if ( pOldCell->GetCellType() == CELLTYPE_FORMULA && !pDocument->IsClipOrUndo() )
{
pOldCell->EndListeningTo( pDocument );
@@ -209,11 +208,9 @@ void ScColumn::Delete( SCROW nRow )
pItems[nIndex].pCell = pNoteCell; // Dummy fuer Interpret
pDocument->Broadcast( ScHint( SC_HINT_DYING,
ScAddress( nCol, nRow, nTab ), pCell ) );
- SvtBroadcaster* pBC = pCell->GetBroadcaster();
- if ( pBC )
+ if ( SvtBroadcaster* pBC = pCell->ReleaseBroadcaster() )
{
- pNoteCell->SetBroadcaster( pBC );
- pCell->ForgetBroadcaster();
+ pNoteCell->TakeBroadcaster( pBC );
}
else
{
@@ -297,7 +294,7 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
{
// gibt jetzt invalid reference, kein Aufruecken der direkten Referenzen
// MoveListeners( *pBC, nRow+nSize );
- pCell->SetBroadcaster(NULL);
+ pCell->DeleteBroadcaster();
// in DeleteRange werden leere Broadcaster geloescht
}
}
@@ -363,49 +360,49 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, USHORT nDelFlag )
{
- SCSIZE nDelCount = 0;
- ScBaseCell** ppDelCells = new ScBaseCell*[nEndIndex-nStartIndex+1];
+ /* If caller specifies to not remove the note caption objects, all cells
+ have to forget the pointers to them. This is used e.g. while undoing a
+ "paste cells" operation, which removes the caption objects later in
+ drawing undo. */
+ bool bDeleteNote = (nDelFlag & IDF_NOTE) != 0;
+ bool bNoCaptions = (nDelFlag & IDF_NOCAPTIONS) != 0;
+ if (bDeleteNote && bNoCaptions)
+ for ( SCSIZE nIdx = nStartIndex; nIdx <= nEndIndex; ++nIdx )
+ if ( ScPostIt* pNote = pItems[ nIdx ].pCell->GetNote() )
+ pNote->ForgetCaption();
+
+ // special simple mode if all contents are deleted and cells do not contain broadcasters
+ bool bSimple = ((nDelFlag & IDF_CONTENTS) == IDF_CONTENTS);
+ if (bSimple)
+ for ( SCSIZE nIdx = nStartIndex; bSimple && (nIdx <= nEndIndex); ++nIdx )
+ if (pItems[ nIdx ].pCell->GetBroadcaster())
+ bSimple = false;
- BOOL bSimple = ((nDelFlag & IDF_CONTENTS) == IDF_CONTENTS);
- SCSIZE i;
+ ScHint aHint( SC_HINT_DYING, ScAddress( nCol, 0, nTab ), 0 );
- // Notiz-Zeichenobjekte
- if (nDelFlag & IDF_NOTE)
- {
- for ( i = nStartIndex; i <= nEndIndex; i++ )
- {
- const ScPostIt* pNote = pItems[i].pCell->GetNotePtr();
- if ( pNote && pNote->IsShown() )
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, pItems[i].nRow );
- }
- }
- }
+ // cache all formula cells, they will be deleted at end of this function
+ typedef ::std::vector< ScFormulaCell* > FormulaCellVector;
+ FormulaCellVector aDelCells;
+ aDelCells.reserve( nEndIndex - nStartIndex + 1 );
- // Broadcaster stehenlassen
+ // simple deletion of the cell objects
if (bSimple)
{
- for (i = nStartIndex; i <= nEndIndex && bSimple; i++)
- if (pItems[i].pCell->GetBroadcaster())
- bSimple = FALSE;
- }
-
- ScHint aHint( SC_HINT_DYING, ScAddress( nCol, 0, nTab ), NULL );
-
- if (bSimple) // Bereich komplett loeschen
- {
- ScBaseCell* pOldCell;
- ScNoteCell* pNoteCell = new ScNoteCell; // Dummy
- for (i = nStartIndex; i <= nEndIndex; i++)
+ // pNoteCell: dummy replacement for old cells, to prevent that interpreter uses old cell
+ ScNoteCell* pNoteCell = new ScNoteCell;
+ for ( SCSIZE nIdx = nStartIndex; nIdx <= nEndIndex; ++nIdx )
{
- pOldCell = pItems[i].pCell;
- if (pOldCell->GetCellType() == CELLTYPE_FORMULA) // Formeln spaeter loeschen
- ppDelCells[nDelCount++] = pOldCell;
+ ScBaseCell* pOldCell = pItems[ nIdx ].pCell;
+ if (pOldCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+ // cache formula cell, will be deleted below
+ aDelCells.push_back( static_cast< ScFormulaCell* >( pOldCell ) );
+ }
else
{
- // Interpret in Broadcast darf kein Value finden
- pItems[i].pCell = pNoteCell;
- aHint.GetAddress().SetRow( pItems[i].nRow );
+ // interpret in broadcast must not use the old cell
+ pItems[ nIdx ].pCell = pNoteCell;
+ aHint.GetAddress().SetRow( pItems[ nIdx ].nRow );
aHint.SetCell( pOldCell );
pDocument->Broadcast( aHint );
pOldCell->Delete();
@@ -415,128 +412,120 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, USHORT nDelFla
memmove( &pItems[nStartIndex], &pItems[nEndIndex + 1], (nCount - nEndIndex - 1) * sizeof(ColEntry) );
nCount -= nEndIndex-nStartIndex+1;
}
- else // Zellen einzeln durchgehen
+
+ // else: delete some contents of the cells
+ else
{
SCSIZE j = nStartIndex;
- for (i = nStartIndex; i <= nEndIndex; i++)
+ for ( SCSIZE nIdx = nStartIndex; nIdx <= nEndIndex; ++nIdx )
{
- BOOL bDelete = FALSE;
+ // decide whether to delete the cell object according to passed flags
+ bool bDelete = false;
ScBaseCell* pOldCell = pItems[j].pCell;
CellType eCellType = pOldCell->GetCellType();
switch ( eCellType )
{
case CELLTYPE_VALUE:
- if ( ( nDelFlag & (IDF_DATETIME|IDF_VALUE) ) == (IDF_DATETIME|IDF_VALUE) )
- bDelete = TRUE;
- else
+ {
+ USHORT nValFlags = nDelFlag & (IDF_DATETIME|IDF_VALUE);
+ // delete values and dates?
+ bDelete = nValFlags == (IDF_DATETIME|IDF_VALUE);
+ // if not, decide according to cell number format
+ if( !bDelete && (nValFlags != 0) )
{
ULONG nIndex = (ULONG)((SfxUInt32Item*)GetAttr( pItems[j].nRow, ATTR_VALUE_FORMAT ))->GetValue();
- short nTyp = pDocument->GetFormatTable()->GetType(nIndex);
- if ((nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) || (nTyp == NUMBERFORMAT_DATETIME))
- bDelete = ((nDelFlag & IDF_DATETIME) != 0);
- else
- bDelete = ((nDelFlag & IDF_VALUE) != 0);
+ short nType = pDocument->GetFormatTable()->GetType(nIndex);
+ bool bIsDate = (nType == NUMBERFORMAT_DATE) || (nType == NUMBERFORMAT_TIME) || (nType == NUMBERFORMAT_DATETIME);
+ bDelete = nValFlags == (bIsDate ? IDF_DATETIME : IDF_VALUE);
}
- break;
+ }
+ break;
+
case CELLTYPE_STRING:
- case CELLTYPE_EDIT: bDelete = ((nDelFlag & IDF_STRING) != 0); break;
- case CELLTYPE_FORMULA: bDelete = ((nDelFlag & IDF_FORMULA) != 0); break;
+ case CELLTYPE_EDIT:
+ bDelete = (nDelFlag & IDF_STRING) != 0;
+ break;
+
+ case CELLTYPE_FORMULA:
+ bDelete = (nDelFlag & IDF_FORMULA) != 0;
+ break;
+
case CELLTYPE_NOTE:
- bDelete = ((nDelFlag & IDF_NOTE) != 0) &&
- (pOldCell->GetBroadcaster() == NULL);
- break;
- default:
- {
- // added to avoid warnings
- }
+ // do note delete note cell with broadcaster
+ bDelete = bDeleteNote && !pOldCell->GetBroadcaster();
+ break;
+
+ default:; // added to avoid warnings
}
if (bDelete)
{
- ScNoteCell* pNoteCell = NULL;
+ // try to create a replacement note cell, if note or broadcaster exists
+ ScNoteCell* pNoteCell = 0;
if (eCellType != CELLTYPE_NOTE)
{
- if ((nDelFlag & IDF_NOTE) == 0)
- {
- const ScPostIt* pNote = pOldCell->GetNotePtr();
- if (pNote)
- pNoteCell = new ScNoteCell(*pNote);
- }
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- if (pBC)
- {
- if (!pNoteCell)
- pNoteCell = new ScNoteCell;
- pNoteCell->SetBroadcaster(pBC);
- }
+ // do not rescue note if it has to be deleted according to passed flags
+ ScPostIt* pNote = bDeleteNote ? 0 : pOldCell->ReleaseNote();
+ SvtBroadcaster* pBC = pOldCell->ReleaseBroadcaster();
+ if( pNote || pBC )
+ pNoteCell = new ScNoteCell( pNote, pBC );
}
+ // remove cell entry in cell item list
SCROW nOldRow = pItems[j].nRow;
if (pNoteCell)
{
+ // replace old cell with the replacement note cell
pItems[j].pCell = pNoteCell;
++j;
}
else
{
+ // remove the old cell from the cell item list
--nCount;
memmove( &pItems[j], &pItems[j + 1], (nCount - j) * sizeof(ColEntry) );
pItems[nCount].nRow = 0;
- pItems[nCount].pCell = NULL;
+ pItems[nCount].pCell = 0;
}
- // ACHTUNG! pItems bereits verschoben!
- // Interpret in Broadcast muss neue/keine Zelle finden
- if (eCellType == CELLTYPE_FORMULA) // Formeln spaeter loeschen
+
+ // cache formula cells (will be deleted later), delete cell of other type
+ if (eCellType == CELLTYPE_FORMULA)
{
- ppDelCells[nDelCount++] = pOldCell;
+ aDelCells.push_back( static_cast< ScFormulaCell* >( pOldCell ) );
}
else
{
aHint.GetAddress().SetRow( nOldRow );
aHint.SetCell( pOldCell );
pDocument->Broadcast( aHint );
- if (eCellType != CELLTYPE_NOTE)
- pOldCell->ForgetBroadcaster();
pOldCell->Delete();
}
}
else
{
- if (nDelFlag & IDF_NOTE)
- if (pItems[j].pCell->GetNotePtr())
- pItems[j].pCell->DeleteNote();
+ // delete cell note
+ if (bDeleteNote)
+ pItems[j].pCell->DeleteNote();
+ // cell not deleted, move index to next cell
++j;
}
}
}
- // erst Listener abhaengen kann Neuberechnungen sparen
- // eventuell werden dabei vorher entstandene NoteCell mitsamt
- // ihren Broadcaster deleted!
- for (i=0; i<nDelCount; i++)
- {
- ((ScFormulaCell*) ppDelCells[i])->EndListeningTo( pDocument );
- }
- // gibts die NoteCell und damit den Broadcaster noch?
- // If not, discard them all before broadcasting takes place!
- for (i=0; i<nDelCount; i++)
- {
- ScFormulaCell* pOldCell = (ScFormulaCell*) ppDelCells[i];
- SCSIZE nIndex;
- if ( !Search( pOldCell->aPos.Row(), nIndex ) )
- pOldCell->ForgetBroadcaster();
- }
- for (i=0; i<nDelCount; i++)
+ // *** delete all formula cells ***
+
+ // first, all cells stop listening, may save unneeded recalcualtions
+ for ( FormulaCellVector::iterator aIt = aDelCells.begin(), aEnd = aDelCells.end(); aIt != aEnd; ++aIt )
+ (*aIt)->EndListeningTo( pDocument );
+
+ // broadcast SC_HINT_DYING for all cells and delete them
+ for ( FormulaCellVector::iterator aIt = aDelCells.begin(), aEnd = aDelCells.end(); aIt != aEnd; ++aIt )
{
- ScFormulaCell* pOldCell = (ScFormulaCell*) ppDelCells[i];
- aHint.SetAddress( pOldCell->aPos );
- aHint.SetCell( pOldCell );
+ aHint.SetAddress( (*aIt)->aPos );
+ aHint.SetCell( *aIt );
pDocument->Broadcast( aHint );
- pOldCell->ForgetBroadcaster();
- pOldCell->Delete();
+ (*aIt)->Delete();
}
-
- delete[] ppDelCells;
}
@@ -547,7 +536,12 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, USHORT nDelFlag)
// Attribute erst am Ende, damit vorher noch zwischen Zahlen und Datum
// unterschieden werden kann (#47901#)
- USHORT nContFlag = nDelFlag & IDF_CONTENTS;
+ USHORT nContMask = IDF_CONTENTS;
+ // IDF_NOCAPTIONS needs to be passed too, if IDF_NOTE is set
+ if( nDelFlag & IDF_NOTE )
+ nContMask |= IDF_NOCAPTIONS;
+ USHORT nContFlag = nDelFlag & nContMask;
+
if (pItems && nCount>0 && nContFlag)
{
if (nStartRow==0 && nEndRow==MAXROW)
@@ -751,37 +745,10 @@ void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
// rows at the beginning may be skipped if filtered rows are left out,
// nDestRow may be negative then
- ScBaseCell* pNew;
-
- if ( bAsLink )
- {
- pNew = rColumn.CreateRefCell( pDocument,
- ScAddress( nCol, (SCROW)nDestRow, nTab ), i, nInsFlag );
- }
- else
- {
- pNew = rColumn.CloneCell( i, nInsFlag, pDocument, ScAddress(nCol,(SCROW)nDestRow,nTab) );
-
- if ( pNew && pNew->GetNotePtr())
- {
- if((nInsFlag & IDF_NOTE) == 0 )
- pNew->DeleteNote();
- else
- {
- // Set the cell note rectangle dimensions to default position
- // following the paste.
- ScPostIt aCellNote(pDocument);
- if(pNew->GetNote(aCellNote))
- {
- Rectangle aRect = aCellNote.DefaultRectangle(ScAddress(nCol,nDestRow,nTab));
- aCellNote.SetRectangle(aRect);
- // #i84412# pasted note is not visible, FIXME: make it visible
- aCellNote.SetShown(FALSE);
- pNew->SetNote(aCellNote);
- }
- }
- }
- }
+ ScAddress aDestPos( nCol, (SCROW)nDestRow, nTab );
+ ScBaseCell* pNew = bAsLink ?
+ rColumn.CreateRefCell( pDocument, aDestPos, i, nInsFlag ) :
+ rColumn.CloneCell( i, nInsFlag, *pDocument, aDestPos );
if (pNew)
Insert((SCROW)nDestRow, pNew);
@@ -790,128 +757,111 @@ void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
}
- // Formelzellen werden jetzt schon hier kopiert,
- // Notizen muessen aber evtl. noch geloescht werden
+namespace {
+
+/** Helper for ScColumn::CloneCell - decides whether to clone a value cell depending on clone flags and number format. */
+bool lclCanCloneValue( ScDocument& rDoc, const ScColumn& rCol, SCROW nRow, bool bCloneValue, bool bCloneDateTime )
+{
+ // values and dates, or nothing to be cloned -> not needed to check number format
+ if( bCloneValue == bCloneDateTime )
+ return bCloneValue;
+
+ // check number format of value cell
+ ULONG nNumIndex = (ULONG)((SfxUInt32Item*)rCol.GetAttr( nRow, ATTR_VALUE_FORMAT ))->GetValue();
+ short nTyp = rDoc.GetFormatTable()->GetType( nNumIndex );
+ bool bIsDateTime = (nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) || (nTyp == NUMBERFORMAT_DATETIME);
+ return bIsDateTime ? bCloneDateTime : bCloneValue;
+}
+
+} // namespace
+
-ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags,
- ScDocument* pDestDoc, const ScAddress& rDestPos)
+ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos)
{
+ bool bCloneValue = (nFlags & IDF_VALUE) != 0;
+ bool bCloneDateTime = (nFlags & IDF_DATETIME) != 0;
+ bool bCloneString = (nFlags & IDF_STRING) != 0;
+ bool bCloneFormula = (nFlags & IDF_FORMULA) != 0;
+ bool bCloneNote = (nFlags & IDF_NOTE) != 0;
+
ScBaseCell* pNew = 0;
- ScBaseCell* pSource = pItems[nIndex].pCell;
- switch (pSource->GetCellType())
+ ScBaseCell& rSource = *pItems[nIndex].pCell;
+ switch (rSource.GetCellType())
{
case CELLTYPE_NOTE:
- if (nFlags & IDF_NOTE)
- pNew = new ScNoteCell(*(ScNoteCell*)pSource, pDestDoc);
- break;
- case CELLTYPE_EDIT:
- if (nFlags & IDF_STRING)
- pNew = new ScEditCell( *(ScEditCell*)pSource, pDestDoc );
- break;
+ // note will be cloned below
+ break;
+
case CELLTYPE_STRING:
- if (nFlags & IDF_STRING)
- pNew = new ScStringCell(*(ScStringCell*)pSource, pDestDoc);
- break;
+ case CELLTYPE_EDIT:
+ // note will be cloned below
+ if (bCloneString)
+ pNew = rSource.CloneWithoutNote( rDestDoc, rDestPos );
+ break;
+
case CELLTYPE_VALUE:
+ // note will be cloned below
+ if (lclCanCloneValue( *pDocument, *this, pItems[nIndex].nRow, bCloneValue, bCloneDateTime ))
+ pNew = rSource.CloneWithoutNote( rDestDoc, rDestPos );
+ break;
+
+ case CELLTYPE_FORMULA:
+ if (bCloneFormula)
{
- BOOL bDoIns = FALSE;
- USHORT nMask = nFlags & ( IDF_DATETIME | IDF_VALUE );
- if ( nMask == (IDF_DATETIME | IDF_VALUE) )
- bDoIns = TRUE;
- else if ( nMask )
- {
- ULONG nNumIndex = (ULONG)((SfxUInt32Item*) GetAttr(
- pItems[nIndex].nRow, ATTR_VALUE_FORMAT ))->GetValue();
- short nTyp = pDocument->GetFormatTable()->GetType(nNumIndex);
- if (nTyp == NUMBERFORMAT_DATE || nTyp == NUMBERFORMAT_TIME || nTyp == NUMBERFORMAT_DATETIME)
- bDoIns = (nFlags & IDF_DATETIME)!=0;
- else
- bDoIns = (nFlags & IDF_VALUE)!=0;
- }
- if (bDoIns)
- pNew = new ScValueCell(*(ScValueCell*)pSource, pDestDoc);
+ // note will be cloned below
+ pNew = rSource.CloneWithoutNote( rDestDoc, rDestPos );
}
- break;
- case CELLTYPE_FORMULA:
+ else if ( (bCloneValue || bCloneDateTime || bCloneString) && !rDestDoc.IsUndo() )
{
- ScFormulaCell* pForm = (ScFormulaCell*)pSource;
- if (nFlags & IDF_FORMULA)
+ // #48491# ins Undo-Dokument immer nur die Original-Zelle kopieren,
+ // aus Formeln keine Value/String-Zellen erzeugen
+ ScFormulaCell& rForm = (ScFormulaCell&)rSource;
+ USHORT nErr = rForm.GetErrCode();
+ if ( nErr )
{
- pNew = pForm->Clone( pDestDoc, rDestPos, TRUE );
- }
- else if ( (nFlags & (IDF_VALUE | IDF_DATETIME | IDF_STRING)) &&
- !pDestDoc->IsUndo() )
- {
- // #48491# ins Undo-Dokument immer nur die Original-Zelle kopieren,
- // aus Formeln keine Value/String-Zellen erzeugen
-
- USHORT nErr = pForm->GetErrCode();
- if ( nErr )
+ // error codes are cloned with values
+ if (bCloneValue)
{
- // Fehler werden immer mit "Zahlen" kopiert
- // (Das ist hiermit willkuerlich so festgelegt)
-
- if ( nFlags & IDF_VALUE )
- {
- ScFormulaCell* pErrCell = new ScFormulaCell( pDestDoc, rDestPos );
- pErrCell->SetErrCode( nErr );
- pNew = pErrCell;
- }
+ ScFormulaCell* pErrCell = new ScFormulaCell( &rDestDoc, rDestPos );
+ pErrCell->SetErrCode( nErr );
+ pNew = pErrCell;
}
- else if ( pForm->IsValue() )
- {
- BOOL bDoIns = FALSE;
- USHORT nMask = nFlags & ( IDF_DATETIME | IDF_VALUE );
- if ( nMask == (IDF_DATETIME | IDF_VALUE) )
- bDoIns = TRUE;
- else if ( nMask )
- {
- ULONG nNumIndex = (ULONG)((SfxUInt32Item*) GetAttr(
- pItems[nIndex].nRow, ATTR_VALUE_FORMAT ))->GetValue();
- short nTyp = pDocument->GetFormatTable()->GetType(nNumIndex);
- if (nTyp == NUMBERFORMAT_DATE || nTyp == NUMBERFORMAT_TIME || nTyp == NUMBERFORMAT_DATETIME)
- bDoIns = (nFlags & IDF_DATETIME)!=0;
- else
- bDoIns = (nFlags & IDF_VALUE)!=0;
- }
-
- if (bDoIns)
- {
- double nVal = pForm->GetValue();
- pNew = new ScValueCell(nVal);
- }
- }
- else
- {
- if (nFlags & IDF_STRING)
- {
- String aString;
- pForm->GetString(aString);
- if ( aString.Len() )
- pNew = new ScStringCell(aString);
- // #33224# LeerStrings nicht kopieren
- }
- }
- if ( pNew && pSource->GetNotePtr() && ( nFlags & IDF_NOTE ) )
+ }
+ else if (rForm.IsValue())
+ {
+ if (lclCanCloneValue( *pDocument, *this, pItems[nIndex].nRow, bCloneValue, bCloneDateTime ))
{
- // #i52342# the note must be constructed with the destination document pointer
- ScPostIt aNewNote( *pSource->GetNotePtr(), pDestDoc );
- pNew->SetNote( aNewNote );
+ double nVal = rForm.GetValue();
+ pNew = new ScValueCell(nVal);
}
}
+ else if (bCloneString)
+ {
+ String aString;
+ rForm.GetString( aString );
+ // #33224# do not clone empty string
+ if (aString.Len() > 0)
+ pNew = new ScStringCell( aString );
+ }
}
- break;
- default:
- {
- // added to avoid warnings
- }
+ break;
+
+ default: DBG_ERRORFILE( "ScColumn::CloneCell - unknown cell type" );
}
- if ( !pNew && pSource->GetNotePtr() && ( nFlags & IDF_NOTE ) )
+ // clone the cell note
+ if (bCloneNote)
{
- // #i52342# the note must be constructed with the destination document pointer
- ScPostIt aNewNote( *pSource->GetNotePtr(), pDestDoc );
- pNew = new ScNoteCell( aNewNote );
+ if (ScPostIt* pNote = rSource.GetNote())
+ {
+ bool bCloneCaption = (nFlags & IDF_NOCAPTIONS) == 0;
+ // #i52342# if caption is cloned, the note must be constructed with the destination document
+ ScPostIt* pNewNote = ScNoteUtil::CloneNote( rDestDoc, rDestPos, *pNote, bCloneCaption );
+ if (!pNew)
+ pNew = new ScNoteCell( pNewNote );
+ else
+ pNew->TakeNote( pNewNote );
+ }
}
return pNew;
@@ -1023,7 +973,7 @@ void ScColumn::MixData( SCROW nRow1, SCROW nRow2,
{
if ( pSrc ) // war da eine Zelle?
{
- pNew = pSrc->Clone( pDocument );
+ pNew = pSrc->CloneWithoutNote( *pDocument );
}
}
else if ( nFunction ) // wirklich Rechenfunktion angegeben
@@ -1079,7 +1029,7 @@ void ScColumn::MixData( SCROW nRow1, SCROW nRow2,
// mit Texten wird nicht gerechnet - immer "alte" Zelle, also pSrc
if (pSrc)
- pNew = pSrc->Clone( pDocument );
+ pNew = pSrc->CloneWithoutNote( *pDocument );
else if (pDest)
bDelete = TRUE;
}
@@ -1375,18 +1325,17 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
if (Search(nRow, i))
{
ScBaseCell* pOldCell = pItems[i].pCell;
- const ScPostIt* pNote = pOldCell->GetNotePtr();
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
+ ScPostIt* pNote = pOldCell->ReleaseNote();
+ SvtBroadcaster* pBC = pOldCell->ReleaseBroadcaster();
if (pNewCell || pNote || pBC)
{
- if (!pNewCell)
- pNewCell = new ScNoteCell();
- if (pNote)
- pNewCell->SetNote(*pNote);
+ if (pNewCell)
+ pNewCell->TakeNote( pNote );
+ else
+ pNewCell = new ScNoteCell( pNote );
if (pBC)
{
- pNewCell->SetBroadcaster(pBC);
- pOldCell->ForgetBroadcaster();
+ pNewCell->TakeBroadcaster(pBC);
pLastFormulaTreeTop = 0; // Err527 Workaround
}
@@ -1466,14 +1415,16 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollec
pData = new TypedStrData( aString, nValue, SC_STRTYPE_VALUE );
}
- ScPostIt aCellNote(pDocument);
+#if 0 // DR
+ ScPostIt aCellNote( ScPostIt::UNINITIALIZED );
// Hide visible notes during Filtering.
- if(pCell->GetNote(aCellNote) && aCellNote.IsShown())
+ if(pCell->GetNote(aCellNote) && aCellNote.IsCaptionShown())
{
ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow );
- aCellNote.SetShown(FALSE);
+ aCellNote.SetShown( false );
pCell->SetNote(aCellNote);
}
+#endif
if ( !rStrings.Insert( pData ) )
delete pData; // doppelt
@@ -1634,27 +1585,6 @@ void ScColumn::SetValue( SCROW nRow, const double& rVal)
}
-void ScColumn::SetNote( SCROW nRow, const ScPostIt& rNote)
-{
- BOOL bEmpty = rNote.IsEmpty();
-
- SCSIZE nIndex;
- if (Search(nRow, nIndex))
- {
- ScBaseCell* pCell = pItems[nIndex].pCell;
- if (bEmpty && pCell->GetCellType() == CELLTYPE_NOTE && !pCell->GetBroadcaster())
- DeleteAtIndex(nIndex);
- else
- pCell->SetNote(rNote);
- }
- else
- {
- if (!bEmpty)
- Insert(nRow, new ScNoteCell(rNote, pDocument));
- }
-}
-
-
void ScColumn::GetString( SCROW nRow, String& rString ) const
{
SCSIZE nIndex;
@@ -1738,19 +1668,6 @@ void ScColumn::GetFormula( SCROW nRow, String& rFormula, BOOL ) const
}
-BOOL ScColumn::GetNote( SCROW nRow, ScPostIt& rNote) const
-{
- BOOL bHasNote = FALSE;
- SCSIZE nIndex;
- if (Search(nRow, nIndex))
- bHasNote = pItems[nIndex].pCell->GetNote(rNote);
- else
- rNote.Clear();
-
- return bHasNote;
-}
-
-
CellType ScColumn::GetCellType( SCROW nRow ) const
{
SCSIZE nIndex;
@@ -1810,6 +1727,44 @@ BOOL ScColumn::HasStringCells( SCROW nStartRow, SCROW nEndRow ) const
}
+ScPostIt* ScColumn::GetNote( SCROW nRow )
+{
+ SCSIZE nIndex;
+ return Search( nRow, nIndex ) ? pItems[ nIndex ].pCell->GetNote() : 0;
+}
+
+
+void ScColumn::TakeNote( SCROW nRow, ScPostIt* pNote )
+{
+ SCSIZE nIndex;
+ if( Search( nRow, nIndex ) )
+ pItems[ nIndex ].pCell->TakeNote( pNote );
+ else
+ Insert( nRow, new ScNoteCell( pNote ) );
+}
+
+
+ScPostIt* ScColumn::ReleaseNote( SCROW nRow )
+{
+ ScPostIt* pNote = 0;
+ SCSIZE nIndex;
+ if( Search( nRow, nIndex ) )
+ {
+ ScBaseCell* pCell = pItems[ nIndex ].pCell;
+ pNote = pCell->ReleaseNote();
+ if( (pCell->GetCellType() == CELLTYPE_NOTE) && !pCell->GetBroadcaster() )
+ DeleteAtIndex( nIndex );
+ }
+ return pNote;
+}
+
+
+void ScColumn::DeleteNote( SCROW nRow )
+{
+ delete ReleaseNote( nRow );
+}
+
+
sal_Int32 ScColumn::GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const
{
sal_Int32 nStringLen = 0;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index ce1f5ef49f9e..3b650f5d8ca4 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dociter.cxx,v $
- * $Revision: 1.21.32.3 $
+ * $Revision: 1.22.88.2 $
*
* This file is part of OpenOffice.org.
*
@@ -1619,7 +1619,7 @@ BOOL ScUsedAreaIterator::GetNext()
if ( pCell && IsGreater( nNextCol, nNextRow, nCellCol, nCellRow ) )
pCell = aCellIter.GetNext( nCellCol, nCellRow );
- while ( pCell && pCell->GetCellType() == CELLTYPE_NOTE && !pCell->GetNotePtr() )
+ while ( pCell && pCell->IsBlank() )
pCell = aCellIter.GetNext( nCellCol, nCellRow );
if ( pPattern && IsGreater( nNextCol, nNextRow, nAttrCol2, nAttrRow ) )
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index c3f8b2a06744..fa350ec3584b 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: documen2.cxx,v $
- * $Revision: 1.72.28.6 $
+ * $Revision: 1.75.18.1 $
*
* This file is part of OpenOffice.org.
*
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 72a5385f748b..7b90b5f7738f 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: documen3.cxx,v $
- * $Revision: 1.41.28.4 $
+ * $Revision: 1.42.100.5 $
*
* This file is part of OpenOffice.org.
*
@@ -77,8 +77,6 @@
#include "drwlayer.hxx"
#include "unoreflist.hxx"
#include "listenercalls.hxx"
-#include "editutil.hxx" // ScPostIt EditTextObject
-#include "postit.hxx"
#include <memory>
@@ -1836,12 +1834,6 @@ void ScDocument::DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
String aCellStr;
SCCOL nCol;
SCROW nRow;
- ScPostIt aCellNote(this);
- ::std::auto_ptr <EditTextObject> pObj;
- // assign the resulting merged note the ItemSet properties of first note occurring text object.
- ScPostIt aFirstNote(this);
- BOOL bDoNote = FALSE;
-
for (nRow=nStartRow; nRow<=nEndRow; nRow++)
for (nCol=nStartCol; nCol<=nEndCol; nCol++)
{
@@ -1854,51 +1846,13 @@ void ScDocument::DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
}
if (nCol != nStartCol || nRow != nStartRow)
SetString(nCol,nRow,nTab,aEmpty);
-
- if (GetNote(nCol,nRow,nTab,aCellNote))
- {
- // Create the first occurrence of a Note text object.
- if(!pObj.get())
- {
- if(const EditTextObject* pEditObj = aCellNote.GetEditTextObject())
- pObj.reset(pEditObj->Clone());
- // Hide this note if visible during merge as it will be shown
- // in a new location following the merge.
- if (aCellNote.IsShown())
- {
- ScDetectiveFunc( this, nTab ).HideComment( nCol, nRow );
- aCellNote.SetShown(FALSE);
- SetNote(nCol,nRow,nTab,aCellNote);
- }
- aFirstNote = aCellNote;
- }
- else
- {
- const EditTextObject* pAddText = aCellNote.GetEditTextObject();
- pObj->Insert(*pAddText, pObj->GetParagraphCount());
- }
-
- if (nCol != nStartCol || nRow != nStartRow)
- {
- if (aCellNote.IsShown())
- ScDetectiveFunc( this, nTab ).HideComment( nCol, nRow );
- SetNote(nCol,nRow,nTab,ScPostIt(this));
- bDoNote = TRUE;
- }
- }
}
SetString(nStartCol,nStartRow,nTab,aTotal);
- if (bDoNote)
- {
- ScPostIt aNewNote(pObj.get(),this);
- aNewNote.SetItemSet(aFirstNote.GetItemSet());
- SetNote(nStartCol,nStartRow,nTab,aNewNote);
- }
}
void ScDocument::DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
- SCCOL nEndCol, SCROW nEndRow )
+ SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions )
{
ScMergeAttr aAttr( nEndCol-nStartCol+1, nEndRow-nStartRow+1 );
ApplyAttr( nStartCol, nStartRow, nTab, aAttr );
@@ -1910,28 +1864,12 @@ void ScDocument::DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
if ( nEndCol > nStartCol && nEndRow > nStartRow )
ApplyFlagsTab( nStartCol+1, nStartRow+1, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER );
- ScPostIt aCellNote(this);
- Rectangle aRect;
-
- // Set all cell note rectangle dimensions to default position following the merge.
- for (SCROW nRow=nStartRow; nRow<=nEndRow; nRow++)
- {
- for (SCCOL nCol=nStartCol; nCol<=nEndCol; nCol++)
- {
- if (GetNote(nCol,nRow,nTab,aCellNote))
- {
- // Hide this note if visible during merge.
- if(aCellNote.IsShown())
- {
- ScDetectiveFunc( this, nTab ).HideComment( nCol, nRow );
- aCellNote.SetShown(FALSE);
- }
- aRect = aCellNote.DefaultRectangle(ScAddress(nCol,nRow,nTab));
- aCellNote.SetRectangle(aRect);
- SetNote(nCol,nRow,nTab,aCellNote);
- }
- }
- }
+ // remove all covered notes (removed captions are collected by drawing undo if active)
+ USHORT nDelFlag = IDF_NOTE | (bDeleteCaptions ? 0 : IDF_NOCAPTIONS);
+ if( nStartCol < nEndCol )
+ DeleteAreaTab( nStartCol + 1, nStartRow, nEndCol, nStartRow, nTab, nDelFlag );
+ if( nStartRow < nEndRow )
+ DeleteAreaTab( nStartCol, nStartRow + 1, nEndCol, nEndRow, nTab, nDelFlag );
}
void ScDocument::RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab )
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 926ae821d248..0f3d31964679 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: documen4.cxx,v $
- * $Revision: 1.22.32.2 $
+ * $Revision: 1.23.102.2 $
*
* This file is part of OpenOffice.org.
*
@@ -159,7 +159,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
if (i == nTab1)
pTab[i]->PutCell(nCol1, nRow1, pCell);
else
- pTab[i]->PutCell(nCol1, nRow1, pCell->Clone(this, ScAddress( nCol1, nRow1, i)));
+ pTab[i]->PutCell(nCol1, nRow1, pCell->CloneWithoutNote(*this, ScAddress( nCol1, nRow1, i), SC_CLONECELL_STARTLISTENING));
}
}
@@ -287,7 +287,7 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // Mehrfachopera
for( k = nRow1; k <= nRow2; k++ )
for (i = 0; i <= MAXTAB; i++)
if( pTab[i] && rMark.GetTableSelect(i) )
- pTab[i]->PutCell( j, k, aRefCell.Clone( this, ScAddress( j, k, i ) ) );
+ pTab[i]->PutCell( j, k, aRefCell.CloneWithoutNote( *this, ScAddress( j, k, i ), SC_CLONECELL_STARTLISTENING ) );
}
BOOL ScDocument::GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab,
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index ac6917e1c994..06a683b0bf72 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: documen9.cxx,v $
- * $Revision: 1.42.32.4 $
+ * $Revision: 1.43.52.5 $
*
* This file is part of OpenOffice.org.
*
@@ -64,7 +64,6 @@
#include "table.hxx"
#include "drwlayer.hxx"
#include "markdata.hxx"
-#include "userdat.hxx"
#include "patattr.hxx"
#include "rechead.hxx"
#include "poolhelp.hxx"
@@ -438,33 +437,6 @@ void ScDocument::StartAnimations( SCTAB nTab, Window* pWin )
}
}
-BOOL ScDocument::HasNoteObject( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
-{
- if (!pDrawLayer)
- return FALSE;
- SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
- DBG_ASSERT(pPage,"Page ?");
- if (!pPage)
- return FALSE;
-
- BOOL bFound = FALSE;
-
- SdrObjListIter aIter( *pPage, IM_FLAT );
- SdrObject* pObject = aIter.Next();
- while (pObject && !bFound)
- {
- if ( pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA( SdrCaptionObj ) )
- {
- ScDrawObjData* pData = ScDrawLayer::GetObjData( pObject );
- if ( pData && nCol == pData->aStt.Col() && nRow == pData->aStt.Row() )
- bFound = TRUE;
- }
- pObject = aIter.Next();
- }
-
- return bFound;
-}
-
//UNUSED2008-05 void ScDocument::RefreshNoteFlags()
//UNUSED2008-05 {
//UNUSED2008-05 if (!pDrawLayer)
@@ -599,7 +571,7 @@ SdrObject* ScDocument::GetObjectAtPoint( SCTAB nTab, const Point& rPos )
// Objekt vom Back-Layer nur, wenn kein Objekt von anderem Layer getroffen
SdrLayerID nLayer = pObject->GetLayer();
- if ( nLayer != SC_LAYER_INTERN )
+ if ( (nLayer != SC_LAYER_INTERN) && (nLayer != SC_LAYER_HIDDEN) )
{
if ( nLayer != SC_LAYER_BACK ||
!pFound || pFound->GetLayer() == SC_LAYER_BACK )
@@ -775,7 +747,7 @@ BOOL ScDocument::HasDetectiveObjects(SCTAB nTab) const
while (pObject && !bFound)
{
// anything on the internal layer except captions (annotations)
- if ( pObject->GetLayer() == SC_LAYER_INTERN && !pObject->ISA( SdrCaptionObj ) )
+ if ( (pObject->GetLayer() == SC_LAYER_INTERN) && !ScDrawLayer::IsNoteCaption( pObject ) )
bFound = TRUE;
pObject = aIter.Next();
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 2446e44770c0..c58e054fb62a 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: document.cxx,v $
- * $Revision: 1.88.22.5 $
+ * $Revision: 1.90.36.8 $
*
* This file is part of OpenOffice.org.
*
@@ -1341,7 +1341,7 @@ void ScDocument::CopyToClip(SCCOL nCol1, SCROW nRow1,
SCCOL nCol2, SCROW nRow2,
BOOL bCut, ScDocument* pClipDoc,
BOOL bAllTabs, const ScMarkData* pMarks,
- BOOL bKeepScenarioFlags, BOOL bIncludeObjects)
+ BOOL bKeepScenarioFlags, BOOL bIncludeObjects, BOOL bCloneNoteCaptions)
{
DBG_ASSERT( bAllTabs || pMarks, "CopyToClip: ScMarkData fehlt" );
@@ -1385,7 +1385,7 @@ void ScDocument::CopyToClip(SCCOL nCol1, SCROW nRow1,
if (pTab[j] && pClipDoc->pTab[j])
if ( bAllTabs || !pMarks || pMarks->GetTableSelect(j) )
{
- pTab[j]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[j], bKeepScenarioFlags);
+ pTab[j]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[j], bKeepScenarioFlags, bCloneNoteCaptions);
if ( pDrawLayer && bIncludeObjects )
{
@@ -1420,7 +1420,7 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
pClipDoc->ResetClip( this, nTab );
if (pTab[nTab] && pClipDoc->pTab[nTab])
- pTab[nTab]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[nTab], FALSE);
+ pTab[nTab]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[nTab], FALSE, TRUE);
pClipDoc->bCutMode = FALSE;
}
@@ -2211,14 +2211,6 @@ void ScDocument::SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVa
}
-void ScDocument::SetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPostIt& rNote )
-{
- if (VALIDTAB(nTab))
- if (pTab[nTab])
- pTab[nTab]->SetNote( nCol, nRow, rNote );
-}
-
-
void ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString )
{
if ( VALIDTAB(nTab) && pTab[nTab] )
@@ -2308,19 +2300,6 @@ void ScDocument::GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormul
}
-BOOL ScDocument::GetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt& rNote )
-{
- BOOL bHasNote = FALSE;
-
- if ( VALIDTAB(nTab) && pTab[nTab] )
- bHasNote = pTab[nTab]->GetNote( nCol, nRow, rNote );
- else
- rNote.Clear();
-
- return bHasNote;
-}
-
-
CellType ScDocument::GetCellType( const ScAddress& rPos ) const
{
SCTAB nTab = rPos.Tab();
@@ -2414,6 +2393,48 @@ BOOL ScDocument::HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
}
+ScPostIt* ScDocument::GetNote( const ScAddress& rPos )
+{
+ ScTable* pTable = ValidTab( rPos.Tab() ) ? pTab[ rPos.Tab() ] : 0;
+ return pTable ? pTable->GetNote( rPos.Col(), rPos.Row() ) : 0;
+}
+
+
+void ScDocument::TakeNote( const ScAddress& rPos, ScPostIt*& rpNote )
+{
+ if( ValidTab( rPos.Tab() ) && pTab[ rPos.Tab() ] )
+ pTab[ rPos.Tab() ]->TakeNote( rPos.Col(), rPos.Row(), rpNote );
+ else
+ DELETEZ( rpNote );
+}
+
+
+ScPostIt* ScDocument::ReleaseNote( const ScAddress& rPos )
+{
+ ScTable* pTable = ValidTab( rPos.Tab() ) ? pTab[ rPos.Tab() ] : 0;
+ return pTable ? pTable->ReleaseNote( rPos.Col(), rPos.Row() ) : 0;
+}
+
+
+ScPostIt* ScDocument::GetOrCreateNote( const ScAddress& rPos )
+{
+ ScPostIt* pNote = GetNote( rPos );
+ if( !pNote )
+ {
+ pNote = new ScPostIt( *this, rPos, false );
+ TakeNote( rPos, pNote );
+ }
+ return pNote;
+}
+
+
+void ScDocument::DeleteNote( const ScAddress& rPos )
+{
+ if( ValidTab( rPos.Tab() ) && pTab[ rPos.Tab() ] )
+ pTab[ rPos.Tab() ]->DeleteNote( rPos.Col(), rPos.Row() );
+}
+
+
void ScDocument::SetDirty()
{
BOOL bOldAutoCalc = GetAutoCalc();
@@ -3229,9 +3250,7 @@ void ScDocument::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, BOOL b
if ( pStyleSheet && pStyleSheet->GetName() == ScGlobal::GetRscString(STR_STYLENAME_STANDARD) )
{
// update attributes for all note objects
-
- ScDetectiveFunc aFunc( this, 0 );
- aFunc.UpdateAllComments();
+ ScDetectiveFunc::UpdateAllComments( *this );
}
}
@@ -3553,11 +3572,11 @@ void ScDocument::GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
}
BOOL ScDocument::IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
- SCCOL nEndCol, SCROW nEndRow ) const
+ SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes ) const
{
if (VALIDTAB(nTab))
if (pTab[nTab])
- return pTab[nTab]->IsBlockEmpty( nStartCol, nStartRow, nEndCol, nEndRow );
+ return pTab[nTab]->IsBlockEmpty( nStartCol, nStartRow, nEndCol, nEndRow, bIgnoreNotes );
DBG_ERROR("Falsche Tabellennummer");
return FALSE;
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index d1c5e6ac6361..5401c0e5327b 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drwlayer.cxx,v $
- * $Revision: 1.55.32.1 $
+ * $Revision: 1.55.128.8 $
*
* This file is part of OpenOffice.org.
*
@@ -80,6 +80,7 @@
#include "scmod.hxx"
#include "chartarr.hxx"
#include "postit.hxx"
+#include "attrib.hxx"
#define DET_ARROW_OFFSET 1000
@@ -93,30 +94,6 @@
using namespace ::com::sun::star;
-// -----------------------------------------------------------------------
-//
-// Das Anpassen der Detektiv-UserData muss zusammen mit den Draw-Undo's
-// in der SdrUndoGroup liegen, darum von SdrUndoAction abgeleitet:
-
-class ScUndoObjData : public SdrUndoObj
-{
-private:
- ScAddress aOldStt;
- ScAddress aOldEnd;
- ScAddress aNewStt;
- ScAddress aNewEnd;
- BOOL bHasNew;
-public:
- ScUndoObjData( SdrObject* pObj, const ScAddress& rOS, const ScAddress& rOE,
- const ScAddress& rNS, const ScAddress& rNE );
- ~ScUndoObjData();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-
// STATIC DATA -----------------------------------------------------------
TYPEINIT1(ScTabDeletedHint, SfxHint);
@@ -147,25 +124,25 @@ __EXPORT ScUndoObjData::~ScUndoObjData()
{
}
-void __EXPORT ScUndoObjData::Undo()
+void ScUndoObjData::Undo()
{
- ScDrawObjData* pData = ((ScDrawLayer&)rMod).GetObjData( pObj );
+ ScDrawObjData* pData = ScDrawLayer::GetObjData( pObj );
DBG_ASSERT(pData,"ScUndoObjData: Daten nicht da");
if (pData)
{
- pData->aStt = aOldStt;
- pData->aEnd = aOldEnd;
+ pData->maStart = aOldStt;
+ pData->maEnd = aOldEnd;
}
}
void __EXPORT ScUndoObjData::Redo()
{
- ScDrawObjData* pData = ((ScDrawLayer&)rMod).GetObjData( pObj );
+ ScDrawObjData* pData = ScDrawLayer::GetObjData( pObj );
DBG_ASSERT(pData,"ScUndoObjData: Daten nicht da");
if (pData)
{
- pData->aStt = aNewStt;
- pData->aEnd = aNewEnd;
+ pData->maStart = aNewStt;
+ pData->maEnd = aNewEnd;
}
}
@@ -225,24 +202,6 @@ void lcl_ReverseTwipsToMM( Rectangle& rRect )
ReverseTwipsToMM( rRect.Bottom() );
}
-BOOL lcl_MirrorCheckRect(const Rectangle& rRect, BOOL bNegativePage)
-{
- BOOL bMirrorChange = false;
-
- if ( bNegativePage )
- {
- if(rRect.Left() >= 0 && rRect.Right() > 0)
- bMirrorChange = true;
- }
- else
- {
- if(rRect.Left() < 0 && rRect.Right() <= 0)
- bMirrorChange = true;
- }
-
- return bMirrorChange;
-}
-
// -----------------------------------------------------------------------
@@ -513,29 +472,27 @@ void ScDrawLayer::MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SC
ScDrawObjData* pData = GetObjDataTab( pObj, nTab );
if( pData )
{
- ScAddress aOldStt = pData->aStt;
- ScAddress aOldEnd = pData->aEnd;
+ const ScAddress aOldStt = pData->maStart;
+ const ScAddress aOldEnd = pData->maEnd;
BOOL bChange = FALSE;
- if ( pData->bValidStart && IsInBlock( pData->aStt, nCol1,nRow1, nCol2,nRow2 ) )
+ if ( aOldStt.IsValid() && IsInBlock( aOldStt, nCol1,nRow1, nCol2,nRow2 ) )
{
- pData->aStt.IncCol( nDx);
- pData->aStt.IncRow( nDy);
+ pData->maStart.IncCol( nDx );
+ pData->maStart.IncRow( nDy );
bChange = TRUE;
}
- if ( pData->bValidEnd && IsInBlock( pData->aEnd, nCol1,nRow1, nCol2,nRow2 ) )
+ if ( aOldEnd.IsValid() && IsInBlock( aOldEnd, nCol1,nRow1, nCol2,nRow2 ) )
{
- pData->aEnd.IncCol( nDx);
- pData->aEnd.IncRow( nDy);
+ pData->maEnd.IncCol( nDx );
+ pData->maEnd.IncRow( nDy );
bChange = TRUE;
}
if (bChange)
{
- if ( pObj->ISA(SdrRectObj) && pData->bValidStart && pData->bValidEnd )
- {
- pData->aStt.PutInOrder( pData->aEnd);
- }
- AddCalcUndo( new ScUndoObjData( pObj, aOldStt, aOldEnd, pData->aStt, pData->aEnd ) );
- RecalcPos( pObj, pData, bNegativePage );
+ if ( pObj->ISA( SdrRectObj ) && pData->maStart.IsValid() && pData->maEnd.IsValid() )
+ pData->maStart.PutInOrder( pData->maEnd );
+ AddCalcUndo( new ScUndoObjData( pObj, aOldStt, aOldEnd, pData->maStart, pData->maEnd ) );
+ RecalcPos( pObj, *pData, aOldStt, aOldEnd, bNegativePage );
}
}
}
@@ -564,77 +521,55 @@ void ScDrawLayer::SetPageSize( USHORT nPageNo, const Size& rSize )
SdrObject* pObj = pPage->GetObj( i );
ScDrawObjData* pData = GetObjDataTab( pObj, static_cast<SCTAB>(nPageNo) );
if( pData )
- RecalcPos( pObj, pData, bNegativePage );
+ RecalcPos( pObj, *pData, pData->maStart, pData->maEnd, bNegativePage );
}
}
}
-void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData* pData, BOOL bNegativePage )
+void ScDrawLayer::RecalcPos( SdrObject* pObj, const ScDrawObjData& rData,
+ const ScAddress& rOldStart, const ScAddress& /*rOldEnd*/, bool bNegativePage )
{
- DBG_ASSERT( pDoc, "ScDrawLayer::RecalcPos without document" );
- if ( !pDoc )
+ DBG_ASSERT( pDoc, "ScDrawLayer::RecalcPos - missing document" );
+ if( !pDoc )
return;
- BOOL bArrow = ( pObj->IsPolyObj() && pObj->GetPointCount()==2 ); // Pfeil ?
- BOOL bCircle = ( pObj->ISA(SdrCircObj) ); // Kreis (Gueltigkeit)
- BOOL bCaption = ( pObj->ISA(SdrCaptionObj) && pObj->GetLayer() == SC_LAYER_INTERN ); // Notiz
-
- if (bCaption)
+ if( rData.mbNote )
{
- SdrCaptionObj* pCaptObj = (SdrCaptionObj*) pObj;
-
- SCCOL nCol = pData->aStt.Col();
- SCROW nRow = pData->aStt.Row();
- SCTAB nTab = pData->aStt.Tab();
- Point aPos( pDoc->GetColOffset( nCol+1, nTab ),
- pDoc->GetRowOffset( nRow, nTab ) );
- TwipsToMM( aPos.X() );
- TwipsToMM( aPos.Y() );
- aPos.X() -= 10;
- if ( bNegativePage )
- aPos.X() = -aPos.X();
-
- Point aOldTail = pCaptObj->GetTailPos();
- if ( aOldTail != aPos )
- {
- pCaptObj->SetTailPos(aPos);
-
- ScPostIt aNote(pDoc);
- if (pDoc->GetNote( pData->aStt.Col(), pData->aStt.Row(), nTab, aNote))
- {
- Rectangle aRect = pCaptObj->GetLogicRect();
- if(lcl_MirrorCheckRect( aRect, bNegativePage ))
- {
- MirrorRectRTL( aRect );
- pCaptObj->SetLogicRect( aRect );
- aNote.SetRectangle(aRect);
- pDoc->SetNote( pData->aStt.Col(), pData->aStt.Row(), nTab, aNote);
- }
- }
- else // new note in creation
- {
- Rectangle aRect = aNote.DefaultRectangle(ScAddress(pData->aStt.Col(), pData->aStt.Row(), nTab));
- if(lcl_MirrorCheckRect( aRect, bNegativePage ))
- MirrorRectRTL( aRect );
- pCaptObj->SetLogicRect( aRect );
- }
- if (bRecording)
- AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
- }
+ /* #i63671# while inserting/deleting cells/rows/columns: note has
+ not been moved yet in document, get it from old position. */
+ DBG_ASSERT( rOldStart.IsValid(), "ScDrawLayer::RecalcPos - invalid position for cell note" );
+ /* When inside an undo action, there may be pending note captions
+ where cell note is already deleted. The caption will be deleted
+ later with drawing undo. */
+ if( ScPostIt* pNote = pDoc->GetNote( rOldStart ) )
+ pNote->UpdateCaptionPos( rData.maStart );
+ return;
}
- else if (bCircle) // Kreis (Gueltigkeit)
+
+ bool bValid1 = rData.maStart.IsValid();
+ SCCOL nCol1 = rData.maStart.Col();
+ SCROW nRow1 = rData.maStart.Row();
+ SCTAB nTab1 = rData.maStart.Tab();
+ bool bValid2 = rData.maEnd.IsValid();
+ SCCOL nCol2 = rData.maEnd.Col();
+ SCROW nRow2 = rData.maEnd.Row();
+ SCTAB nTab2 = rData.maEnd.Tab();
+
+ // validation circle
+ bool bCircle = pObj->ISA( SdrCircObj );
+ // detective arrow
+ bool bArrow = pObj->IsPolyObj() && (pObj->GetPointCount() == 2);
+
+ if( bCircle )
{
- SCCOL nCol = pData->aStt.Col();
- SCROW nRow = pData->aStt.Row();
- SCTAB nTab = pData->aStt.Tab();
- Point aPos( pDoc->GetColOffset( nCol, nTab ), pDoc->GetRowOffset( nRow, nTab ) );
+ Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
TwipsToMM( aPos.X() );
TwipsToMM( aPos.Y() );
// Berechnung und Werte wie in detfunc.cxx
- Size aSize( (long) ( pDoc->GetColWidth(nCol, nTab) * HMM_PER_TWIPS ),
- (long) ( pDoc->GetRowHeight(nRow, nTab) * HMM_PER_TWIPS ) );
+ Size aSize( (long)(pDoc->GetColWidth( nCol1, nTab1 ) * HMM_PER_TWIPS),
+ (long)(pDoc->GetRowHeight( nRow1, nTab1 ) * HMM_PER_TWIPS) );
Rectangle aRect( aPos, aSize );
aRect.Left() -= 250;
aRect.Right() += 250;
@@ -650,41 +585,37 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData* pData, BOOL bNegati
pObj->SetLogicRect(aRect);
}
}
- else if (bArrow) // Pfeil
+ else if( bArrow )
{
//! nicht mehrere Undos fuer ein Objekt erzeugen (hinteres kann dann weggelassen werden)
- if( pData->bValidStart )
+ if( bValid1 )
{
- Point aPos(
- pDoc->GetColOffset( pData->aStt.Col(), pData->aStt.Tab() ),
- pDoc->GetRowOffset( pData->aStt.Row(), pData->aStt.Tab() ) );
- if( !( pDoc->GetColFlags( pData->aStt.Col(), pData->aStt.Tab() )
- & CR_HIDDEN ) )
- aPos.X() += pDoc->GetColWidth( pData->aStt.Col(), pData->aStt.Tab() ) / 4;
- if( !( pDoc->GetRowFlags( pData->aStt.Row(), pData->aStt.Tab() )
- & CR_HIDDEN ) )
- aPos.Y() += pDoc->GetRowHeight( pData->aStt.Row(), pData->aStt.Tab() ) / 2;
+ Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
+ if( (pDoc->GetColFlags( nCol1, nTab1 ) & CR_HIDDEN) == 0 )
+ aPos.X() += pDoc->GetColWidth( nCol1, nTab1 ) / 4;
+ if( (pDoc->GetRowFlags( nRow1, nTab1 ) & CR_HIDDEN) == 0 )
+ aPos.Y() += pDoc->GetRowHeight( nRow1, nTab1 ) / 2;
TwipsToMM( aPos.X() );
TwipsToMM( aPos.Y() );
Point aStartPos = aPos;
if ( bNegativePage )
aStartPos.X() = -aStartPos.X(); // don't modify aPos - used below
- if ( pObj->GetPoint(0) != aStartPos )
+ if ( pObj->GetPoint( 0 ) != aStartPos )
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
pObj->SetPoint( aStartPos, 0 );
}
- if( !pData->bValidEnd )
+ if( !bValid2 )
{
Point aEndPos( aPos.X() + DET_ARROW_OFFSET, aPos.Y() - DET_ARROW_OFFSET );
if (aEndPos.Y() < 0)
- aEndPos.Y() += 2*DET_ARROW_OFFSET;
+ aEndPos.Y() += (2 * DET_ARROW_OFFSET);
if ( bNegativePage )
aEndPos.X() = -aEndPos.X();
- if ( pObj->GetPoint(1) != aEndPos )
+ if ( pObj->GetPoint( 1 ) != aEndPos )
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
@@ -692,39 +623,35 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData* pData, BOOL bNegati
}
}
}
- if( pData->bValidEnd )
+ if( bValid2 )
{
- Point aPos(
- pDoc->GetColOffset( pData->aEnd.Col(), pData->aEnd.Tab() ),
- pDoc->GetRowOffset( pData->aEnd.Row(), pData->aEnd.Tab() ) );
- if( !( pDoc->GetColFlags( pData->aEnd.Col(), pData->aEnd.Tab() )
- & CR_HIDDEN ) )
- aPos.X() += pDoc->GetColWidth( pData->aEnd.Col(), pData->aEnd.Tab() ) / 4;
- if( !( pDoc->GetRowFlags( pData->aEnd.Row(), pData->aEnd.Tab() )
- & CR_HIDDEN ) )
- aPos.Y() += pDoc->GetRowHeight( pData->aEnd.Row(), pData->aEnd.Tab() ) / 2;
+ Point aPos( pDoc->GetColOffset( nCol2, nTab2 ), pDoc->GetRowOffset( nRow2, nTab2 ) );
+ if( (pDoc->GetColFlags( nCol2, nTab2 ) & CR_HIDDEN) == 0 )
+ aPos.X() += pDoc->GetColWidth( nCol2, nTab2 ) / 4;
+ if( (pDoc->GetRowFlags( nRow2, nTab2 ) & CR_HIDDEN) == 0 )
+ aPos.Y() += pDoc->GetRowHeight( nRow2, nTab2 ) / 2;
TwipsToMM( aPos.X() );
TwipsToMM( aPos.Y() );
Point aEndPos = aPos;
if ( bNegativePage )
aEndPos.X() = -aEndPos.X(); // don't modify aPos - used below
- if ( pObj->GetPoint(1) != aEndPos )
+ if ( pObj->GetPoint( 1 ) != aEndPos )
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
pObj->SetPoint( aEndPos, 1 );
}
- if( !pData->bValidStart )
+ if( !bValid1 )
{
Point aStartPos( aPos.X() - DET_ARROW_OFFSET, aPos.Y() - DET_ARROW_OFFSET );
if (aStartPos.X() < 0)
- aStartPos.X() += 2*DET_ARROW_OFFSET;
+ aStartPos.X() += (2 * DET_ARROW_OFFSET);
if (aStartPos.Y() < 0)
- aStartPos.Y() += 2*DET_ARROW_OFFSET;
+ aStartPos.Y() += (2 * DET_ARROW_OFFSET);
if ( bNegativePage )
aStartPos.X() = -aStartPos.X();
- if ( pObj->GetPoint(0) != aStartPos )
+ if ( pObj->GetPoint( 0 ) != aStartPos )
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
@@ -735,18 +662,14 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData* pData, BOOL bNegati
}
else // Referenz-Rahmen
{
- DBG_ASSERT( pData->bValidStart, "RecalcPos: kein Start" );
- Point aPos(
- pDoc->GetColOffset( pData->aStt.Col(), pData->aStt.Tab() ),
- pDoc->GetRowOffset( pData->aStt.Row(), pData->aStt.Tab() ) );
+ DBG_ASSERT( bValid1, "ScDrawLayer::RecalcPos - invalid start position" );
+ Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
TwipsToMM( aPos.X() );
TwipsToMM( aPos.Y() );
- if( pData->bValidEnd )
+ if( bValid2 )
{
- Point aEnd(
- pDoc->GetColOffset( pData->aEnd.Col()+1, pData->aEnd.Tab() ),
- pDoc->GetRowOffset( pData->aEnd.Row()+1, pData->aEnd.Tab() ) );
+ Point aEnd( pDoc->GetColOffset( nCol2 + 1, nTab2 ), pDoc->GetRowOffset( nRow2 + 1, nTab2 ) );
TwipsToMM( aEnd.X() );
TwipsToMM( aEnd.Y() );
@@ -772,7 +695,6 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData* pData, BOOL bNegati
}
}
}
-
}
BOOL ScDrawLayer::GetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) const
@@ -1260,6 +1182,7 @@ BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
return bFound;
}
+#if 0
void ScDrawLayer::DeleteObjects( SCTAB nTab )
{
SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
@@ -1295,6 +1218,7 @@ void ScDrawLayer::DeleteObjects( SCTAB nTab )
delete[] ppObj;
}
}
+#endif
void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
SCCOL nCol2,SCROW nRow2 )
@@ -1322,9 +1246,14 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
SdrObject* pObject = aIter.Next();
while (pObject)
{
- Rectangle aObjRect = pObject->GetCurrentBoundRect();
- if ( aDelRect.IsInside( aObjRect ) )
- ppObj[nDelCount++] = pObject;
+ // do not delete note caption, they are always handled by the cell note
+ // TODO: detective objects are still deleted, is this desired?
+ if (!IsNoteCaption( pObject ))
+ {
+ Rectangle aObjRect = pObject->GetCurrentBoundRect();
+ if ( aDelRect.IsInside( aObjRect ) )
+ ppObj[nDelCount++] = pObject;
+ }
pObject = aIter.Next();
}
@@ -1376,12 +1305,17 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
SdrObject* pObject = aIter.Next();
while (pObject)
{
- Rectangle aObjRect = pObject->GetCurrentBoundRect();
- if ( aMarkBound.IsInside( aObjRect ) )
+ // do not delete note caption, they are always handled by the cell note
+ // TODO: detective objects are still deleted, is this desired?
+ if (!IsNoteCaption( pObject ))
{
- ScRange aRange = pDoc->GetRange( nTab, aObjRect );
- if (rMark.IsAllMarked(aRange))
- ppObj[nDelCount++] = pObject;
+ Rectangle aObjRect = pObject->GetCurrentBoundRect();
+ if ( aMarkBound.IsInside( aObjRect ) )
+ {
+ ScRange aRange = pDoc->GetRange( nTab, aObjRect );
+ if (rMark.IsAllMarked(aRange))
+ ppObj[nDelCount++] = pObject;
+ }
}
pObject = aIter.Next();
@@ -1422,7 +1356,8 @@ void ScDrawLayer::CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const Rectangle&
while (pOldObject)
{
Rectangle aObjRect = pOldObject->GetCurrentBoundRect();
- if ( rRange.IsInside( aObjRect ) && pOldObject->GetLayer() != SC_LAYER_INTERN )
+ // do not copy internal objects (detective) and note captions
+ if ( rRange.IsInside( aObjRect ) && (pOldObject->GetLayer() != SC_LAYER_INTERN) && !IsNoteCaption( pOldObject ) )
{
if ( !pDestModel )
{
@@ -1563,7 +1498,8 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const
while (pOldObject)
{
Rectangle aObjRect = pOldObject->GetCurrentBoundRect();
- if ( rSourceRange.IsInside( aObjRect ) )
+ // do not copy internal objects (detective) and note captions
+ if ( rSourceRange.IsInside( aObjRect ) && (pOldObject->GetLayer() != SC_LAYER_INTERN) && !IsNoteCaption( pOldObject ) )
{
// #116235#
SdrObject* pNewObject = pOldObject->Clone();
@@ -1722,6 +1658,47 @@ void ScDrawLayer::MirrorRectRTL( Rectangle& rRect )
rRect.Right() = -nTemp;
}
+Rectangle ScDrawLayer::GetCellRect( ScDocument& rDoc, const ScAddress& rPos, bool bMergedCell )
+{
+ Rectangle aCellRect;
+ DBG_ASSERT( ValidColRowTab( rPos.Col(), rPos.Row(), rPos.Tab() ), "ScDrawLayer::GetCellRect - invalid cell address" );
+ if( ValidColRowTab( rPos.Col(), rPos.Row(), rPos.Tab() ) )
+ {
+ // find top left position of passed cell address
+ Point aTopLeft;
+ for( SCCOL nCol = 0; nCol < rPos.Col(); ++nCol )
+ aTopLeft.X() += rDoc.GetColWidth( nCol, rPos.Tab() );
+ if( rPos.Row() > 0 )
+ aTopLeft.Y() += rDoc.FastGetRowHeight( 0, rPos.Row() - 1, rPos.Tab() );
+
+ // find bottom-right position of passed cell address
+ ScAddress aEndPos = rPos;
+ if( bMergedCell )
+ {
+ const ScMergeAttr* pMerge = static_cast< const ScMergeAttr* >( rDoc.GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), ATTR_MERGE ) );
+ if( pMerge->GetColMerge() > 1 )
+ aEndPos.IncCol( pMerge->GetColMerge() - 1 );
+ if( pMerge->GetRowMerge() > 1 )
+ aEndPos.IncRow( pMerge->GetRowMerge() - 1 );
+ }
+ Point aBotRight = aTopLeft;
+ for( SCCOL nCol = rPos.Col(); nCol <= aEndPos.Col(); ++nCol )
+ aBotRight.X() += rDoc.GetColWidth( nCol, rPos.Tab() );
+ aBotRight.Y() += rDoc.FastGetRowHeight( rPos.Row(), aEndPos.Row(), rPos.Tab() );
+
+ // twips -> 1/100 mm
+ aTopLeft.X() = static_cast< long >( aTopLeft.X() * HMM_PER_TWIPS );
+ aTopLeft.Y() = static_cast< long >( aTopLeft.Y() * HMM_PER_TWIPS );
+ aBotRight.X() = static_cast< long >( aBotRight.X() * HMM_PER_TWIPS );
+ aBotRight.Y() = static_cast< long >( aBotRight.Y() * HMM_PER_TWIPS );
+
+ aCellRect = Rectangle( aTopLeft, aBotRight );
+ if( rDoc.IsNegativePage( rPos.Tab() ) )
+ MirrorRectRTL( aCellRect );
+ }
+ return aCellRect;
+}
+
// static
String ScDrawLayer::GetVisibleName( SdrObject* pObj )
{
@@ -1846,7 +1823,7 @@ ScAnchorType ScDrawLayer::GetAnchor( const SdrObject* pObj )
ScDrawObjData* ScDrawLayer::GetObjData( SdrObject* pObj, BOOL bCreate ) // static
{
- USHORT nCount = pObj->GetUserDataCount();
+ USHORT nCount = pObj ? pObj->GetUserDataCount() : 0;
for( USHORT i = 0; i < nCount; i++ )
{
SdrObjUserData* pData = pObj->GetUserData( i );
@@ -1854,13 +1831,13 @@ ScDrawObjData* ScDrawLayer::GetObjData( SdrObject* pObj, BOOL bCreate ) // s
&& pData->GetId() == SC_UD_OBJDATA )
return (ScDrawObjData*) pData;
}
- if( bCreate )
+ if( pObj && bCreate )
{
ScDrawObjData* pData = new ScDrawObjData;
pObj->InsertUserData( pData, 0 );
return pData;
}
- return NULL;
+ return 0;
}
ScDrawObjData* ScDrawLayer::GetObjDataTab( SdrObject* pObj, SCTAB nTab ) // static
@@ -1868,14 +1845,26 @@ ScDrawObjData* ScDrawLayer::GetObjDataTab( SdrObject* pObj, SCTAB nTab ) // s
ScDrawObjData* pData = GetObjData( pObj );
if ( pData )
{
- if ( pData->bValidStart )
- pData->aStt.SetTab( nTab );
- if ( pData->bValidEnd )
- pData->aEnd.SetTab( nTab );
+ if ( pData->maStart.IsValid() )
+ pData->maStart.SetTab( nTab );
+ if ( pData->maEnd.IsValid() )
+ pData->maEnd.SetTab( nTab );
}
return pData;
}
+bool ScDrawLayer::IsNoteCaption( SdrObject* pObj )
+{
+ ScDrawObjData* pData = pObj ? GetObjData( pObj ) : 0;
+ return pData && pData->mbNote;
+}
+
+ScDrawObjData* ScDrawLayer::GetNoteCaptionData( SdrObject* pObj, SCTAB nTab )
+{
+ ScDrawObjData* pData = pObj ? GetObjDataTab( pObj, nTab ) : 0;
+ return (pData && pData->mbNote) ? pData : 0;
+}
+
ScIMapInfo* ScDrawLayer::GetIMapInfo( SdrObject* pObj ) // static
{
USHORT nCount = pObj->GetUserDataCount();
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 965919f2823b..4a1babf7e755 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: global.cxx,v $
- * $Revision: 1.56.118.1 $
+ * $Revision: 1.56.102.1 $
*
* This file is part of OpenOffice.org.
*
@@ -361,8 +361,7 @@ void ScGlobal::SetUserList( const ScUserList* pNewList )
const String& ScGlobal::GetRscString( USHORT nIndex )
{
- DBG_ASSERT( nIndex <= STR_COUNT,
- "-ScGlobal::GetRscString(): Index zu gross!");
+ DBG_ASSERT( nIndex < STR_COUNT, "ScGlobal::GetRscString - invalid string index");
if( !ppRscString[ nIndex ] )
{
OpCode eOp = ocNone;
@@ -579,8 +578,8 @@ void ScGlobal::Init()
pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage );
pScIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), *pLocale );
- ppRscString = new String *[ STR_COUNT+1 ];
- for( USHORT nC = 0 ; nC <= STR_COUNT ; nC++ ) ppRscString[ nC ] = NULL;
+ ppRscString = new String *[ STR_COUNT ];
+ for( USHORT nC = 0 ; nC < STR_COUNT ; nC++ ) ppRscString[ nC ] = NULL;
pEmptyBrushItem = new SvxBrushItem( Color( COL_TRANSPARENT ), ATTR_BACKGROUND );
pButtonBrushItem = new SvxBrushItem( Color(), ATTR_BACKGROUND );
diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk
index 1803661dd530..7129198c204f 100644
--- a/sc/source/core/data/makefile.mk
+++ b/sc/source/core/data/makefile.mk
@@ -1,14 +1,14 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.26 $
+# $Revision: 1.26.100.1 $
#
# This file is part of OpenOffice.org.
#
@@ -117,6 +117,7 @@ EXCEPTIONSFILES= \
$(SLO)$/bcaslot.obj \
$(SLO)$/cell2.obj \
$(SLO)$/column.obj \
+ $(SLO)$/column3.obj \
$(SLO)$/documen2.obj \
$(SLO)$/document.obj \
$(SLO)$/dpdimsave.obj \
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 2dda0b38a30d..7de9d8b5ce26 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: postit.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.54.11 $
*
* This file is part of OpenOffice.org.
*
@@ -32,331 +32,629 @@
#include "precompiled_sc.hxx"
#include "postit.hxx"
-#include <svtools/itemset.hxx>
-#include <sfx2/objsh.hxx>
-#include <svx/sxcecitm.hxx>
+
+#include <svtools/useroptions.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/outlobj.hxx>
#include <svx/editobj.hxx>
-#include <unotools/charclass.hxx>
-#include <tools/urlobj.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
#include "scitems.hxx"
+#include <svx/xlnstit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/sxcecitm.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/sdshitm.hxx>
+#include <svx/sdsxyitm.hxx>
+
#include "document.hxx"
-#include "editutil.hxx"
-#include "attrib.hxx"
-#include "detfunc.hxx"
#include "docpool.hxx"
#include "patattr.hxx"
+#include "cell.hxx"
#include "drwlayer.hxx"
-#include "docuno.hxx"
-#include <svx/svdpage.hxx>
-#include <svx/xflclit.hxx>
-#include <svx/xlnstcit.hxx>
-#include <svx/xlnstit.hxx>
-#include <svx/xlnstwit.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
+#include "userdat.hxx"
+#include "detfunc.hxx"
-namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
+// ============================================================================
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::frame::XModel;
+namespace {
-//========================================================================
-// class ScPostIt
-//========================================================================
+const long SC_NOTECAPTION_WIDTH = 2900; /// Default width of note caption textbox.
+const long SC_NOTECAPTION_MAXWIDTH_TEMP = 12000; /// Maximum width of temporary note caption textbox.
+const long SC_NOTECAPTION_HEIGHT = 1800; /// Default height of note caption textbox.
+const long SC_NOTECAPTION_CELLDIST = 600; /// Default distance of note captions to border of anchor cell.
+const long SC_NOTECAPTION_OFFSET_Y = -1500; /// Default Y offset of note captions to top border of anchor cell.
+const long SC_NOTECAPTION_OFFSET_X = 1500; /// Default X offset of note captions to left border of anchor cell.
+const long SC_NOTECAPTION_BORDERDIST_TEMP = 100; /// Distance of temporary note captions to visible sheet area.
-ScPostIt::ScPostIt(ScDocument* pDoc):
- mpDoc(pDoc),
- mbShown(FALSE),
- maItemSet(pDoc->GetNoteItemPool(), SDRATTR_START, SDRATTR_END, EE_ITEMS_START, EE_ITEMS_END, 0,0)
+// ----------------------------------------------------------------------------
+
+class ScCaptionCreator
+{
+public:
+ /** Create a new caption. The caption will not be inserted into the document. */
+ explicit ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, bool bShown, bool bTailFront );
+ /** Manipulate an existing caption. */
+ explicit ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj& rCaption );
+
+ /** Returns the caption drawing obejct. */
+ inline SdrCaptionObj* GetCaption() { return mpCaption; }
+
+ /** Moves the caption inside the passed rectangle. Uses page area if 0 is passed. */
+ void FitCaptionToRect( const Rectangle* pVisRect = 0 );
+ /** Places the passed caption inside the passed rectangle, tries to keep the cell rectangle uncovered. Uses page area if 0 is passed. */
+ void AutoPlaceCaption( const Rectangle* pVisRect = 0 );
+ /** Updates caption tail and textbox according to current cell position. Uses page area if 0 is passed. */
+ void UpdateCaptionPos( const Rectangle* pVisRect = 0 );
+ /** Sets all default formatting attributes to the caption object. */
+ void SetDefaultItems();
+ /** Updates caption itemset according to the passed item set while removing shadow items. */
+ void SetCaptionItems( const SfxItemSet& rItemSet );
+
+private:
+ /** Initializes all members. */
+ void Initialize();
+ /** Returns the passed rectangle if existing, page rectangle otherwise. */
+ inline const Rectangle& GetVisRect( const Rectangle* pVisRect ) const { return pVisRect ? *pVisRect : maPageRect; }
+ /** Calculates the caption tail position according to current cell position. */
+ Point CalcTailPos( bool bTailFront );
+
+private:
+ ScDocument& mrDoc;
+ ScAddress maPos;
+ SdrCaptionObj* mpCaption;
+ Rectangle maPageRect;
+ Rectangle maCellRect;
+ bool mbNegPage;
+};
+
+// ----------------------------------------------------------------------------
+
+ScCaptionCreator::ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, bool bShown, bool bTailFront ) :
+ mrDoc( rDoc ),
+ maPos( rPos ),
+ mpCaption( 0 )
{
- // this 'default' ctor does not set the Author & Date stamp.
- // maRectangle is not initialised as it can be tested using IsEmpty().
+ Initialize();
+
+ // create the caption drawing object
+ Rectangle aTextRect( Point( 0 , 0 ), Size( SC_NOTECAPTION_WIDTH, SC_NOTECAPTION_HEIGHT ) );
+ Point aTailPos = CalcTailPos( bTailFront );
+ mpCaption = new SdrCaptionObj( aTextRect, aTailPos );
+
+ // basic settings
+ ScDrawLayer::SetAnchor( mpCaption, SCA_PAGE );
+ mpCaption->SetLayer( bShown ? SC_LAYER_INTERN : SC_LAYER_HIDDEN );
+ mpCaption->SetFixedTail();
+ mpCaption->SetSpecialTextBoxShadow();
}
-ScPostIt::ScPostIt( const String& rText, ScDocument* pDoc ):
- mpDoc(pDoc),
- mbShown(FALSE),
- maItemSet(pDoc->GetNoteItemPool(), SDRATTR_START, SDRATTR_END, EE_ITEMS_START, EE_ITEMS_END, 0,0)
+ScCaptionCreator::ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj& rCaption ) :
+ mrDoc( rDoc ),
+ maPos( rPos ),
+ mpCaption( &rCaption )
{
- // maRectangle is not initialised as it can be tested using IsEmpty().
- SetText( rText);
- AutoStamp( );
+ Initialize();
}
-ScPostIt::ScPostIt( const EditTextObject* pTextObj, ScDocument* pDoc ):
- mpDoc ( pDoc ),
- mbShown(FALSE),
- maItemSet(pDoc->GetNoteItemPool(), SDRATTR_START, SDRATTR_END, EE_ITEMS_START, EE_ITEMS_END, 0,0)
+void ScCaptionCreator::FitCaptionToRect( const Rectangle* pVisRect )
{
- // maRectangle is not initialised as it can be tested using IsEmpty().
- SetEditTextObject( pTextObj);
- AutoStamp( );
+ const Rectangle& rVisRect = GetVisRect( pVisRect );
+
+ // tail position
+ Point aTailPos = mpCaption->GetTailPos();
+ aTailPos.X() = ::std::max( ::std::min( aTailPos.X(), rVisRect.Right() ), rVisRect.Left() );
+ aTailPos.Y() = ::std::max( ::std::min( aTailPos.Y(), rVisRect.Bottom() ), rVisRect.Top() );
+ mpCaption->SetTailPos( aTailPos );
+
+ // caption rectangle
+ Rectangle aCaptRect = mpCaption->GetLogicRect();
+ Point aCaptPos = aCaptRect.TopLeft();
+ // move textbox inside right border of visible area
+ aCaptPos.X() = ::std::min< long >( aCaptPos.X(), rVisRect.Right() - aCaptRect.GetWidth() );
+ // move textbox inside left border of visible area (this may move it outside on right side again)
+ aCaptPos.X() = ::std::max< long >( aCaptPos.X(), rVisRect.Left() );
+ // move textbox inside bottom border of visible area
+ aCaptPos.Y() = ::std::min< long >( aCaptPos.Y(), rVisRect.Bottom() - aCaptRect.GetHeight() );
+ // move textbox inside top border of visible area (this may move it outside on bottom side again)
+ aCaptPos.Y() = ::std::max< long >( aCaptPos.Y(), rVisRect.Top() );
+ // update caption
+ aCaptRect.SetPos( aCaptPos );
+ mpCaption->SetLogicRect( aCaptRect );
}
-ScPostIt::ScPostIt( const ScPostIt& rNote, ScDocument* pDoc ):
- mpDoc ( pDoc ),
- maItemSet(pDoc->GetNoteItemPool(), SDRATTR_START, SDRATTR_END, EE_ITEMS_START, EE_ITEMS_END, 0,0)
+void ScCaptionCreator::AutoPlaceCaption( const Rectangle* pVisRect )
{
- SetEditTextObject( rNote.mpEditObj.get());
- maStrDate = rNote.maStrDate;
- maStrAuthor = rNote.maStrAuthor;
- mbShown = rNote.mbShown;
- maRectangle = rNote.maRectangle;
- maItemSet.PutExtended(rNote.maItemSet,SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT);
+ const Rectangle& rVisRect = GetVisRect( pVisRect );
+
+ // caption rectangle
+ Rectangle aCaptRect = mpCaption->GetLogicRect();
+ long nWidth = aCaptRect.GetWidth();
+ long nHeight = aCaptRect.GetHeight();
+
+ // n***Space contains available space between border of visible area and cell
+ long nLeftSpace = maCellRect.Left() - rVisRect.Left() + 1;
+ long nRightSpace = rVisRect.Right() - maCellRect.Right() + 1;
+ long nTopSpace = maCellRect.Top() - rVisRect.Top() + 1;
+ long nBottomSpace = rVisRect.Bottom() - maCellRect.Bottom() + 1;
+
+ // nNeeded*** contains textbox dimensions plus needed distances to cell or border of visible area
+ long nNeededSpaceX = nWidth + SC_NOTECAPTION_CELLDIST;
+ long nNeededSpaceY = nHeight + SC_NOTECAPTION_CELLDIST;
+
+ // bFitsWidth*** == true means width of textbox fits into horizontal free space of visible area
+ bool bFitsWidthLeft = nNeededSpaceX <= nLeftSpace; // text box width fits into the width left of cell
+ bool bFitsWidthRight = nNeededSpaceX <= nRightSpace; // text box width fits into the width right of cell
+ bool bFitsWidth = nWidth <= rVisRect.GetWidth(); // text box width fits into width of visible area
+
+ // bFitsHeight*** == true means height of textbox fits into vertical free space of visible area
+ bool bFitsHeightTop = nNeededSpaceY <= nTopSpace; // text box height fits into the height above cell
+ bool bFitsHeightBottom = nNeededSpaceY <= nBottomSpace; // text box height fits into the height below cell
+ bool bFitsHeight = nHeight <= rVisRect.GetHeight(); // text box height fits into height of visible area
+
+ // bFits*** == true means the textbox fits completely into free space of visible area
+ bool bFitsLeft = bFitsWidthLeft && bFitsHeight;
+ bool bFitsRight = bFitsWidthRight && bFitsHeight;
+ bool bFitsTop = bFitsWidth && bFitsHeightTop;
+ bool bFitsBottom = bFitsWidth && bFitsHeightBottom;
+
+ Point aCaptPos;
+ // use left/right placement if possible, or if top/bottom placement not possible
+ if( bFitsLeft || bFitsRight || (!bFitsTop && !bFitsBottom) )
+ {
+ // prefer left in RTL sheet and right in LTR sheets
+ bool bPreferLeft = bFitsLeft && (mbNegPage || !bFitsRight);
+ bool bPreferRight = bFitsRight && (!mbNegPage || !bFitsLeft);
+ // move to left, if left is preferred, or if neither left nor right fit and there is more space to the left
+ if( bPreferLeft || (!bPreferRight && (nLeftSpace > nRightSpace)) )
+ aCaptPos.X() = maCellRect.Left() - SC_NOTECAPTION_CELLDIST - nWidth;
+ else // to right
+ aCaptPos.X() = maCellRect.Right() + SC_NOTECAPTION_CELLDIST;
+ // Y position according to top cell border
+ aCaptPos.Y() = maCellRect.Top() + SC_NOTECAPTION_OFFSET_Y;
+ }
+ else // top or bottom placement
+ {
+ // X position
+ aCaptPos.X() = maCellRect.Left() + SC_NOTECAPTION_OFFSET_X;
+ // top placement, if possible
+ if( bFitsTop )
+ aCaptPos.Y() = maCellRect.Top() - SC_NOTECAPTION_CELLDIST - nHeight;
+ else // bottom placement
+ aCaptPos.Y() = maCellRect.Bottom() + SC_NOTECAPTION_CELLDIST;
+ }
+
+ // update textbox position in note caption object
+ aCaptRect.SetPos( aCaptPos );
+ mpCaption->SetLogicRect( aCaptRect );
+ FitCaptionToRect( pVisRect );
}
-ScPostIt::~ScPostIt()
+void ScCaptionCreator::UpdateCaptionPos( const Rectangle* pVisRect )
{
+ ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer();
+
+ // update caption position
+ const Point& rOldTailPos = mpCaption->GetTailPos();
+ Point aTailPos = CalcTailPos( false );
+ if( rOldTailPos != aTailPos )
+ {
+ // create drawing undo action
+ if( pDrawLayer && pDrawLayer->IsRecording() )
+ pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoGeoObject( *mpCaption ) );
+ // calculate new caption rectangle (#i98141# handle LTR<->RTL switch correctly)
+ Rectangle aCaptRect = mpCaption->GetLogicRect();
+ long nDiffX = (rOldTailPos.X() >= 0) ? (aCaptRect.Left() - rOldTailPos.X()) : (rOldTailPos.X() - aCaptRect.Right());
+ if( mbNegPage ) nDiffX = -nDiffX - aCaptRect.GetWidth();
+ long nDiffY = aCaptRect.Top() - rOldTailPos.Y();
+ aCaptRect.SetPos( aTailPos + Point( nDiffX, nDiffY ) );
+ // set new tail position and caption rectangle
+ mpCaption->SetTailPos( aTailPos );
+ mpCaption->SetLogicRect( aCaptRect );
+ // fit caption into draw page
+ FitCaptionToRect( pVisRect );
+ }
+
+ // update cell position in caption user data
+ ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( mpCaption, maPos.Tab() );
+ if( pCaptData && (maPos != pCaptData->maStart) )
+ {
+ // create drawing undo action
+ if( pDrawLayer && pDrawLayer->IsRecording() )
+ pDrawLayer->AddCalcUndo( new ScUndoObjData( mpCaption, pCaptData->maStart, pCaptData->maEnd, maPos, pCaptData->maEnd ) );
+ // set new position
+ pCaptData->maStart = maPos;
+ }
}
-const ScPostIt& ScPostIt::operator=( const ScPostIt& rCpy )
+void ScCaptionCreator::SetDefaultItems()
{
- mpDoc = rCpy.mpDoc;
- SetEditTextObject( rCpy.mpEditObj.get());
- maStrDate = rCpy.maStrDate;
- maStrAuthor = rCpy.maStrAuthor;
- mbShown = rCpy.mbShown;
- maRectangle = rCpy.maRectangle;
- maItemSet.PutExtended(rCpy.maItemSet,SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT);
+ SfxItemSet aItemSet = mpCaption->GetMergedItemSet();
+
+ // caption tail arrow
+ ::basegfx::B2DPolygon aTriangle;
+ aTriangle.append( ::basegfx::B2DPoint( 10.0, 0.0 ) );
+ aTriangle.append( ::basegfx::B2DPoint( 0.0, 30.0 ) );
+ aTriangle.append( ::basegfx::B2DPoint( 20.0, 30.0 ) );
+ aTriangle.setClosed( true );
+ /* #99319# Line ends are now created with an empty name. The
+ checkForUniqueItem() method then finds a unique name for the item's
+ value. */
+ aItemSet.Put( XLineStartItem( String::EmptyString(), ::basegfx::B2DPolyPolygon( aTriangle ) ) );
+ aItemSet.Put( XLineStartWidthItem( 200 ) );
+ aItemSet.Put( XLineStartCenterItem( FALSE ) );
+ aItemSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aItemSet.Put( XFillColorItem( String::EmptyString(), ScDetectiveFunc::GetCommentColor() ) );
+ aItemSet.Put( SdrCaptionEscDirItem( SDRCAPT_ESCBESTFIT ) );
+
+ // shadow
+ /* SdrShadowItem has FALSE, instead the shadow is set for the
+ rectangle only with SetSpecialTextBoxShadow when the object is
+ created (item must be set to adjust objects from older files). */
+ aItemSet.Put( SdrShadowItem( FALSE ) );
+ aItemSet.Put( SdrShadowXDistItem( 100 ) );
+ aItemSet.Put( SdrShadowYDistItem( 100 ) );
+
+ // text attributes
+ aItemSet.Put( SdrTextLeftDistItem( 100 ) );
+ aItemSet.Put( SdrTextRightDistItem( 100 ) );
+ aItemSet.Put( SdrTextUpperDistItem( 100 ) );
+ aItemSet.Put( SdrTextLowerDistItem( 100 ) );
+ aItemSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
+ aItemSet.Put( SdrTextAutoGrowHeightItem( TRUE ) );
+ // #78943# use the default cell style to be able to modify the caption font
+ const ScPatternAttr& rDefPattern = static_cast< const ScPatternAttr& >( mrDoc.GetPool()->GetDefaultItem( ATTR_PATTERN ) );
+ rDefPattern.FillEditItemSet( &aItemSet );
+
+ mpCaption->SetMergedItemSet( aItemSet );
+}
- return *this;
+void ScCaptionCreator::SetCaptionItems( const SfxItemSet& rItemSet )
+{
+ // copy all items
+ mpCaption->SetMergedItemSet( rItemSet );
+ // reset shadow items
+ mpCaption->SetMergedItem( SdrShadowItem( FALSE ) );
+ mpCaption->SetMergedItem( SdrShadowXDistItem( 100 ) );
+ mpCaption->SetMergedItem( SdrShadowYDistItem( 100 ) );
+ mpCaption->SetSpecialTextBoxShadow();
}
-// Support existing functionality - create simple text string from the
-// EditTextObject.
-String ScPostIt::GetText() const
+void ScCaptionCreator::Initialize()
{
- String aText;
- const EditTextObject* pEditText;
- if(mpDoc && ((pEditText = GetEditTextObject()) != 0))
+ maCellRect = ScDrawLayer::GetCellRect( mrDoc, maPos, true );
+ mbNegPage = mrDoc.IsNegativePage( maPos.Tab() );
+
+ if( ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer() )
{
- ScNoteEditEngine& rEE = mpDoc->GetNoteEngine();
- rEE.SetText( *pEditText );
- aText = rEE.GetText( LINEEND_LF );
- aText.SearchAndReplaceAll(CHAR_CR, ' ');
+ if( SdrPage* pPage = pDrawLayer->GetPage( static_cast< sal_uInt16 >( maPos.Tab() ) ) )
+ {
+ maPageRect = Rectangle( Point( 0, 0 ), pPage->GetSize() );
+ /* #i98141# SdrPage::GetSize() returns negative width in RTL mode.
+ The call to Rectangle::Adjust() orders left/right coordinate
+ accordingly. */
+ maPageRect.Justify();
+ }
}
- return aText;
}
-void ScPostIt::SetEditTextObject( const EditTextObject* pTextObj )
+Point ScCaptionCreator::CalcTailPos( bool bTailFront )
+{
+ // tail position
+ bool bTailLeft = bTailFront != mbNegPage;
+ Point aTailPos = bTailLeft ? maCellRect.TopLeft() : maCellRect.TopRight();
+ // move caption point 1/10 mm inside cell
+ if( bTailLeft ) aTailPos.X() += 10; else aTailPos.X() -= 10;
+ aTailPos.Y() += 10;
+ return aTailPos;
+}
+
+} // namespace
+
+// ============================================================================
+
+ScNoteData::ScNoteData( bool bShown ) :
+ mpCaption( 0 ),
+ mbShown( bShown )
+{
+}
+
+// ============================================================================
+
+ScPostIt::ScPostIt( ScDocument& rDoc, const ScAddress& rPos, bool bShown ) :
+ mrDoc( rDoc ),
+ maNoteData( bShown )
+{
+ AutoStamp();
+ CreateCaption( rPos );
+}
+
+ScPostIt::ScPostIt( ScDocument& rDoc, const ScAddress& rPos, const ScPostIt& rNote ) :
+ mrDoc( rDoc ),
+ maNoteData( rNote.maNoteData )
+{
+ maNoteData.mpCaption = 0;
+ CreateCaption( rPos, rNote.maNoteData.mpCaption );
+}
+
+ScPostIt::ScPostIt( ScDocument& rDoc, const ScNoteData& rNoteData ) :
+ mrDoc( rDoc ),
+ maNoteData( rNoteData )
+{
+}
+
+ScPostIt::~ScPostIt()
+{
+ RemoveCaption();
+}
+
+void ScPostIt::AutoStamp()
+{
+ maNoteData.maDate = ScGlobal::pLocaleData->getDate( Date() );
+ maNoteData.maAuthor = SvtUserOptions().GetID();
+}
+
+const EditTextObject* ScPostIt::GetEditTextObject() const
{
- if(pTextObj && mpDoc)
+ if( maNoteData.mpCaption )
+ if( const OutlinerParaObject* pOPO = maNoteData.mpCaption->GetOutlinerParaObject() )
+ return &pOPO->GetTextObject();
+ return 0;
+}
+
+String ScPostIt::GetText() const
+{
+ String aText;
+ if( const EditTextObject* pEditObj = GetEditTextObject() )
{
- ScNoteEditEngine& rEE = mpDoc->GetNoteEngine();
- rEE.SetText( *pTextObj );
- sal_uInt16 nCount = pTextObj->GetParagraphCount();
- for( sal_uInt16 nPara = 0; nPara < nCount; ++nPara )
+ for( USHORT nPara = 0, nParaCount = pEditObj->GetParagraphCount(); nPara < nParaCount; ++nPara )
{
- String aParaText( rEE.GetText( nPara ) );
- if( aParaText.Len() )
- {
- SfxItemSet aSet( pTextObj->GetParaAttribs( nPara));
- rEE.SetParaAttribs(nPara, aSet);
- }
+ if( nPara > 0 )
+ aText.Append( '\n' );
+ aText.Append( pEditObj->GetText( nPara ) );
}
- mpEditObj.reset(rEE.CreateTextObject());
}
- else
- mpEditObj.reset();
+ return aText;
}
-// Support existing functionality - create EditTextObject from a simple
-// text string
-void ScPostIt::SetText( const String& rText)
+bool ScPostIt::HasMultiLineText() const
{
- if(mpDoc && rText.Len())
- {
- ScNoteEditEngine& rEE = mpDoc->GetNoteEngine();
- rEE.SetText( rText );
- mpEditObj.reset(rEE.CreateTextObject());
- }
- else
- mpEditObj.reset();
+ const EditTextObject* pEditObj = GetEditTextObject();
+ return pEditObj && (pEditObj->GetParagraphCount() > 1);
+}
+void ScPostIt::SetText( const String& rText )
+{
+ if( maNoteData.mpCaption )
+ maNoteData.mpCaption->SetText( rText );
}
-void ScPostIt::AutoStamp( )
+void ScPostIt::ShowCaption( bool bShow )
{
- maStrDate = ScGlobal::pLocaleData->getDate( Date() );
+ maNoteData.mbShown = bShow;
+ UpdateCaptionLayer( maNoteData.mbShown );
+}
- SvtUserOptions aUserOpt;
- maStrAuthor = aUserOpt.GetID();
+void ScPostIt::ShowCaptionTemp( bool bShow )
+{
+ UpdateCaptionLayer( maNoteData.mbShown || bShow );
+}
+
+void ScPostIt::UpdateCaptionPos( const ScAddress& rPos )
+{
+ if( maNoteData.mpCaption )
+ {
+ ScCaptionCreator aCreator( mrDoc, rPos, *maNoteData.mpCaption );
+ aCreator.UpdateCaptionPos();
+ }
+}
+
+void ScPostIt::SetCaptionDefaultItems()
+{
+ if( maNoteData.mpCaption )
+ {
+ ScCaptionCreator aCreator( mrDoc, ScAddress(), *maNoteData.mpCaption );
+ aCreator.SetDefaultItems();
+ }
}
-BOOL ScPostIt::IsEmpty() const
+void ScPostIt::SetCaptionItems( const SfxItemSet& rItemSet )
{
- return (!mpEditObj.get());
+ if( maNoteData.mpCaption )
+ {
+ ScCaptionCreator aCreator( mrDoc, ScAddress(), *maNoteData.mpCaption );
+ aCreator.SetCaptionItems( rItemSet );
+ }
}
-Rectangle ScPostIt::DefaultRectangle(const ScAddress& rPos) const
+// private --------------------------------------------------------------------
+
+void ScPostIt::CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCaption )
{
- BOOL bNegativePage = mpDoc->IsNegativePage( rPos.Tab() );
- long nPageSign = bNegativePage ? -1 : 1;
+ DBG_ASSERT( !maNoteData.mpCaption, "ScPostIt::CreateCaption - unexpected caption object found" );
+ maNoteData.mpCaption = 0;
- SCCOL nNextCol = rPos.Col()+1;
- const ScMergeAttr* pMerge = (const ScMergeAttr*) mpDoc->GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), ATTR_MERGE );
- if ( pMerge->GetColMerge() > 1 )
- nNextCol = rPos.Col() + pMerge->GetColMerge();
+ // drawing layer may be missing, if a note is copied into a clipboard document
+ DBG_ASSERT( !mrDoc.IsUndo(), "ScPostIt::CreateCaption - note caption should not be created in undo documents" );
+ if( mrDoc.IsClipboard() )
+ mrDoc.InitDrawLayer();
- Point aRectPos = ScDetectiveFunc(mpDoc, rPos.Tab()).GetDrawPos( nNextCol, rPos.Row(), FALSE );
+ if( ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer() )
+ {
+ SdrPage* pDrawPage = pDrawLayer->GetPage( static_cast< sal_uInt16 >( rPos.Tab() ) );
+ DBG_ASSERT( pDrawPage, "ScPostIt::CreateCaption - no drawing page" );
+ if( pDrawPage )
+ {
+ // create the caption drawing object
+ ScCaptionCreator aCreator( mrDoc, rPos, maNoteData.mbShown, false );
+ maNoteData.mpCaption = aCreator.GetCaption();
- aRectPos.X() += 600 * nPageSign;
- aRectPos.Y() -= 1500;
- if ( aRectPos.Y() < 0 ) aRectPos.Y() = 0;
+ // additional user data (pass true to create the object data entry)
+ ScDrawObjData* pData = ScDrawLayer::GetObjData( maNoteData.mpCaption, true );
+ pData->maStart = rPos;
+ pData->mbNote = true;
- String aText = GetText();
- long nDefWidth = ( aText.Len() > SC_NOTE_SMALLTEXT ) ? 5800 : 2900;
- Size aRectSize( nDefWidth, 1800 );
+ // insert object into draw page
+ pDrawPage->InsertObject( maNoteData.mpCaption );
- if ( bNegativePage )
- aRectPos.X() -= aRectSize.Width();
- else
- if ( aRectPos.X() < 0 ) aRectPos.X() = 0;
+ // clone settings of passed caption
+ if( pCaption )
+ {
+ // copy edit text object (object must be inserted into page already)
+ if( const OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
+ maNoteData.mpCaption->SetOutlinerParaObject( pOPO->Clone() );
+ // copy formatting items (after text has been copied to apply font formatting)
+ maNoteData.mpCaption->SetMergedItemSetAndBroadcast( pCaption->GetMergedItemSet() );
+ // move textbox position relative to new cell, copy textbox size
+ Rectangle aCaptRect = pCaption->GetLogicRect();
+ Point aDist = maNoteData.mpCaption->GetTailPos() - pCaption->GetTailPos();
+ aCaptRect.Move( aDist.X(), aDist.Y() );
+ maNoteData.mpCaption->SetLogicRect( aCaptRect );
+ aCreator.FitCaptionToRect();
+ }
+ else
+ {
+ // set default formatting and default position
+ aCreator.SetDefaultItems();
+ aCreator.AutoPlaceCaption();
+ }
- return Rectangle(aRectPos, aRectSize);
+ // create undo action
+ if( pDrawLayer->IsRecording() )
+ pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoNewObject( *maNoteData.mpCaption ) );
+ }
+ }
}
-Rectangle ScPostIt::MimicOldRectangle(const ScAddress& rPos) const
-{
- // Mimic the functionality prior to the support for note positioning:
- // The DefaultRectangle() is modified once it is inserted in the
- // DrawPage. The Bottom part of the rectangle is modified against
- // the text. Thus using the DefaultRectangle() does not always return
- // the previous cell note appearance [see #i38350#] of sxc docs
- // containing notes created without a stored note position.
- Rectangle aDefaultRect(DefaultRectangle(rPos));
- SCCOL nNextCol = rPos.Col()+1;
- Point aTailPos = ScDetectiveFunc(mpDoc, rPos.Tab()).GetDrawPos( nNextCol, rPos.Row(), FALSE );
-
- SdrCaptionObj* pCaption = new SdrCaptionObj(aDefaultRect, aTailPos );
- InsertObject( pCaption, *mpDoc, rPos.Tab(), sal_False );
- pCaption->SetText( GetText() );
- Rectangle aRect = pCaption->GetLogicRect();
- if ( aRect.Bottom() > aDefaultRect.Bottom() )
+void ScPostIt::RemoveCaption()
+{
+ /* Remove caption object only, if this note is its owner (e.g. notes in
+ undo documents refer to captions in original document, do not remove
+ them from drawing layer here). */
+ if( maNoteData.mpCaption && (mrDoc.GetDrawLayer() == maNoteData.mpCaption->GetModel()) )
{
- long nDif = aRect.Bottom() - aDefaultRect.Bottom();
- aRect.Bottom() = aDefaultRect.Bottom();
- aRect.Top() = Max( aDefaultRect.Top(), static_cast<long>((aRect.Top() - nDif)) );
+ SdrPage* pDrawPage = maNoteData.mpCaption->GetPage();
+ DBG_ASSERT( pDrawPage, "ScPostIt::RemoveCaption - object without drawing page" );
+ if( pDrawPage )
+ {
+ pDrawPage->RecalcObjOrdNums();
+
+ ScDrawLayer* pDrawLayer = static_cast< ScDrawLayer* >( maNoteData.mpCaption->GetModel() );
+ DBG_ASSERT( pDrawLayer, "ScPostIt::RemoveCaption - object without drawing layer" );
+
+ // create drawing undo action (before removing the object to have valid draw page in undo action)
+ if( pDrawLayer && pDrawLayer->IsRecording() )
+ pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoDeleteObject( *maNoteData.mpCaption ) );
+
+ // remove the object from the drawing page, delete if undo is disabled
+ pDrawPage->RemoveObject( maNoteData.mpCaption->GetOrdNum() );
+ }
}
- RemoveObject( pCaption,*mpDoc,rPos.Tab() );
- delete pCaption;
- return aRect;
+ maNoteData.mpCaption = 0;
}
-void ScPostIt::SetRectangle(const Rectangle& aRect)
+void ScPostIt::UpdateCaptionLayer( bool bShow )
{
- maRectangle = aRect;
+ // no separate drawing undo needed, handled completely inside ScUndoShowHideNote
+ SdrLayerID nLayer = bShow ? SC_LAYER_INTERN : SC_LAYER_HIDDEN;
+ if( maNoteData.mpCaption && (nLayer != maNoteData.mpCaption->GetLayer()) )
+ maNoteData.mpCaption->SetLayer( nLayer );
}
-SfxItemSet ScPostIt::DefaultItemSet() const
-{
- SfxItemSet aCaptionSet( mpDoc->GetNoteItemPool(), SDRATTR_START, SDRATTR_END, EE_ITEMS_START, EE_ITEMS_END, 0,0);
-
- basegfx::B2DPolygon aTriangle;
- aTriangle.append(basegfx::B2DPoint(10.0, 0.0));
- aTriangle.append(basegfx::B2DPoint(0.0, 30.0));
- aTriangle.append(basegfx::B2DPoint(20.0, 30.0));
- aTriangle.setClosed(true);
-
- aCaptionSet.Put( XLineStartItem( EMPTY_STRING, basegfx::B2DPolyPolygon(aTriangle) ) );
- aCaptionSet.Put( XLineStartWidthItem( 200 ) );
- aCaptionSet.Put( XLineStartCenterItem( FALSE ) );
- aCaptionSet.Put( XFillStyleItem( XFILL_SOLID ) );
- Color aYellow( ScDetectiveFunc::GetCommentColor() );
- aCaptionSet.Put( XFillColorItem( String(), aYellow ) );
-
- // shadow
- // SdrShadowItem has FALSE, instead the shadow is set for the rectangle
- // only with SetSpecialTextBoxShadow when the object is created
- // (item must be set to adjust objects from older files)
- aCaptionSet.Put( SdrShadowItem( FALSE ) );
- aCaptionSet.Put( SdrShadowXDistItem( 100 ) );
- aCaptionSet.Put( SdrShadowYDistItem( 100 ) );
-
- // text attributes
- aCaptionSet.Put( SdrTextLeftDistItem( 100 ) );
- aCaptionSet.Put( SdrTextRightDistItem( 100 ) );
- aCaptionSet.Put( SdrTextUpperDistItem( 100 ) );
- aCaptionSet.Put( SdrTextLowerDistItem( 100 ) );
-
- // #78943# do use the default cell style, so the user has a chance to
- // modify the font for the annotations
- ((const ScPatternAttr&)mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)).
- FillEditItemSet( &aCaptionSet );
-
- // support the best position for the tail connector now that
- // that notes can be resized and repositioned.
- aCaptionSet.Put( SdrCaptionEscDirItem( SDRCAPT_ESCBESTFIT) );
-
- return aCaptionSet;
+// ============================================================================
+
+ScPostIt* ScNoteUtil::CloneNote( ScDocument& rDoc, const ScAddress& rPos, const ScPostIt& rNote, bool bCloneCaption )
+{
+ return bCloneCaption ? new ScPostIt( rDoc, rPos, rNote ) : new ScPostIt( rDoc, rNote.GetNoteData() );
}
-void ScPostIt::SetItemSet(const SfxItemSet& rItemSet)
+void ScNoteUtil::UpdateCaptionPositions( ScDocument& rDoc, const ScRange& rRange )
{
- maItemSet.PutExtended(rItemSet, SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT);
+ // do not use ScCellIterator, it skips filtered and subtotal cells
+ for( ScAddress aPos( rRange.aStart ); aPos.Tab() <= rRange.aEnd.Tab(); aPos.IncTab() )
+ for( aPos.SetCol( rRange.aStart.Col() ); aPos.Col() <= rRange.aEnd.Col(); aPos.IncCol() )
+ for( aPos.SetRow( rRange.aStart.Row() ); aPos.Row() <= rRange.aEnd.Row(); aPos.IncRow() )
+ if( ScPostIt* pNote = rDoc.GetNote( aPos ) )
+ pNote->UpdateCaptionPos( aPos );
}
-// Called from Excel import - Excel supports alignment on a per note
-// basis while Calc uses a per paragraph alignment. Thus we need to
-// apply the Note alignment to all paragraphs.
-void ScPostIt::SetAndApplyItemSet(const SfxItemSet& rItemSet)
+SdrCaptionObj* ScNoteUtil::CreateTempCaption( ScDocument& rDoc, const ScAddress& rPos,
+ SdrPage& rPage, const String& rUserText, const Rectangle& rVisRect, bool bTailFront )
{
- SetItemSet(rItemSet);
- if(mpEditObj.get() && mpDoc)
+ String aFinalText = rUserText;
+ // add plain text of invisible (!) cell note (no formatting etc.)
+ SdrCaptionObj* pNoteCaption = 0;
+ if( ScPostIt* pNote = rDoc.GetNote( rPos ) )
{
- ScNoteEditEngine& rEE = mpDoc->GetNoteEngine();
- rEE.SetText( *mpEditObj);
- sal_uInt16 nCount = mpEditObj.get()->GetParagraphCount();
- for( sal_uInt16 nPara = 0; nPara < nCount; ++nPara )
+ if( !pNote->IsCaptionShown() )
{
- String aParaText( rEE.GetText( nPara ) );
- if( aParaText.Len() )
- rEE.SetParaAttribs(nPara, rItemSet);
+ if( aFinalText.Len() > 0 )
+ aFinalText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n--------\n" ) );
+ aFinalText.Append( pNote->GetText() );
+ pNoteCaption = pNote->GetCaption();
}
- mpEditObj.reset(rEE.CreateTextObject());
}
-}
-void ScPostIt::InsertObject(SdrCaptionObj* pObj, ScDocument& rDoc, SCTAB nTab, sal_Bool bVisible) const
-{
- SdrPage* pPage = NULL;
- ScDrawLayer* pDrawModel = rDoc.GetDrawLayer();
- // Copying note cells between documents is one user scenario where the
- // DrawLayer may not exist. Use the ScModelObj() to create
- // and ensure there is a DrawLayer.
- if(!pDrawModel)
+ // create a caption if any text exists
+ if( aFinalText.Len() == 0 )
+ return 0;
+
+ // prepare visible rectangle (add default distance to all borders)
+ Rectangle aVisRect(
+ rVisRect.Left() + SC_NOTECAPTION_BORDERDIST_TEMP,
+ rVisRect.Top() + SC_NOTECAPTION_BORDERDIST_TEMP,
+ rVisRect.Right() - SC_NOTECAPTION_BORDERDIST_TEMP,
+ rVisRect.Bottom() - SC_NOTECAPTION_BORDERDIST_TEMP );
+
+ // create the caption object
+ ScCaptionCreator aCreator( rDoc, rPos, true, bTailFront );
+ SdrCaptionObj* pCaption = aCreator.GetCaption();
+ // insert caption into page (needed to set caption text)
+ rPage.InsertObject( pCaption );
+ // set the text to the object
+ pCaption->SetText( aFinalText );
+
+ // set formatting (must be done after setting text) and resize the box to fit the text
+ if( pNoteCaption && (rUserText.Len() == 0) )
{
- ScModelObj* pScModelObj = NULL;
- SfxObjectShell* pDocShell = rDoc.GetDocumentShell();
- if(pDocShell)
- pScModelObj = ScModelObj::getImplementation( Reference< XModel >( pDocShell->GetModel() ) );
- if(pScModelObj)
- pDrawModel= pScModelObj->MakeDrawLayer();
- if(pDrawModel)
- pPage = pDrawModel->GetPage(nTab);
+ pCaption->SetMergedItemSetAndBroadcast( pNoteCaption->GetMergedItemSet() );
+ Rectangle aCaptRect( pCaption->GetLogicRect().TopLeft(), pNoteCaption->GetLogicRect().GetSize() );
+ pCaption->SetLogicRect( aCaptRect );
}
else
- pPage = pDrawModel->GetPage(nTab);
-
- if(pPage && pObj)
{
- if (!bVisible)
- {
- pObj->NbcSetLayer(SC_LAYER_HIDDEN);
- }
- pPage->InsertObject(pObj);
+ aCreator.SetDefaultItems();
+ // adjust caption size to text size
+ long nMaxWidth = ::std::min< long >( aVisRect.GetWidth() * 2 / 3, SC_NOTECAPTION_MAXWIDTH_TEMP );
+ pCaption->SetMergedItem( SdrTextAutoGrowWidthItem( TRUE ) );
+ pCaption->SetMergedItem( SdrTextMinFrameWidthItem( SC_NOTECAPTION_WIDTH ) );
+ pCaption->SetMergedItem( SdrTextMaxFrameWidthItem( nMaxWidth ) );
+ pCaption->SetMergedItem( SdrTextAutoGrowHeightItem( TRUE ) );
+ pCaption->AdjustTextFrameWidthAndHeight();
}
+
+ // move caption into visible area
+ aCreator.AutoPlaceCaption( &aVisRect );
+ return pCaption;
}
-void ScPostIt::RemoveObject(SdrCaptionObj* pObj, ScDocument& rDoc, SCTAB nTab) const
+ScPostIt* ScNoteUtil::CreateNoteFromString( ScDocument& rDoc, const ScAddress& rPos, const String& rNoteText, bool bShown )
{
- SdrPage* pPage = NULL;
- ScDrawLayer* pDrawModel = rDoc.GetDrawLayer();
- if(pDrawModel)
- pPage = pDrawModel->GetPage(nTab);
- if(pPage && pObj)
- pPage->RemoveObject(pObj->GetOrdNum());
+ if( rNoteText.Len() == 0 )
+ return 0;
+ ScPostIt* pNote = new ScPostIt( rDoc, rPos, bShown );
+ rDoc.TakeNote( rPos, pNote );
+ if( SdrCaptionObj* pCaption = pNote->GetCaption() )
+ {
+ pCaption->SetText( rNoteText );
+ pNote->SetCaptionDefaultItems(); // reformat text with default font
+ pCaption->SetMergedItem( SdrTextMinFrameWidthItem( SC_NOTECAPTION_WIDTH ) );
+ pCaption->SetMergedItem( SdrTextMaxFrameWidthItem( SC_NOTECAPTION_MAXWIDTH_TEMP ) );
+ pCaption->AdjustTextFrameWidthAndHeight();
+ }
+ return pNote;
}
-//========================================================================
+// ============================================================================
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 0d7f69e1c7ce..1cf195567661 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: table2.cxx,v $
- * $Revision: 1.41 $
+ * $Revision: 1.40.124.8 $
*
* This file is part of OpenOffice.org.
*
@@ -331,7 +331,7 @@ void ScTable::DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark )
// pTable = Clipboard
void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- ScTable* pTable, BOOL bKeepScenarioFlags)
+ ScTable* pTable, BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions)
{
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
{
@@ -339,7 +339,7 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
SCCOL i;
for ( i = nCol1; i <= nCol2; i++)
- aCol[i].CopyToClip(nRow1, nRow2, pTable->aCol[i], bKeepScenarioFlags);
+ aCol[i].CopyToClip(nRow1, nRow2, pTable->aCol[i], bKeepScenarioFlags, bCloneNoteCaptions);
// copy widths/heights, and only "hidden", "filtered" and "manual" flags
// also for all preceding columns/rows, to have valid positions for drawing objects
@@ -476,20 +476,17 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ScColumnIterator aIter( &aCol[nCol], nRow1, nRow2 );
while (aIter.Next( nRow, pCell ))
{
+ ScAddress aDestPos( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
ScBaseCell* pNew;
if ( bAsLink ) // Referenz erzeugen ?
{
- pNew = aCol[nCol].CreateRefCell( pDestDoc,
- ScAddress( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab ),
- aIter.GetIndex(), nFlags );
+ pNew = aCol[nCol].CreateRefCell( pDestDoc, aDestPos, aIter.GetIndex(), nFlags );
}
else // kopieren
{
if (pCell->GetCellType() == CELLTYPE_FORMULA)
{
- pNew = ((ScFormulaCell*)pCell)->Clone( pDestDoc,
- ScAddress( static_cast<SCCOL>(nRow-nRow1),
- static_cast<SCROW>(nCol-nCol1), nTab));
+ pNew = pCell->CloneWithNote( *pDestDoc, aDestPos, SC_CLONECELL_STARTLISTENING );
// Referenzen drehen
// bei Cut werden Referenzen spaeter per UpdateTranspose angepasst
@@ -498,7 +495,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
((ScFormulaCell*)pNew)->TransposeReference();
}
else
- pNew = pCell->Clone( pDestDoc );
+ pNew = pCell->CloneWithNote( *pDestDoc, aDestPos );
}
pTransClip->PutCell( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pNew );
}
@@ -852,13 +849,6 @@ void ScTable::SetValue( SCCOL nCol, SCROW nRow, const double& rVal )
}
-void ScTable::SetNote( SCCOL nCol, SCROW nRow, const ScPostIt& rNote)
-{
- if (ValidColRow(nCol, nRow))
- aCol[nCol].SetNote(nRow, rNote);
-}
-
-
void ScTable::GetString( SCCOL nCol, SCROW nRow, String& rString )
{
if (ValidColRow(nCol,nRow))
@@ -895,16 +885,31 @@ void ScTable::GetFormula( SCCOL nCol, SCROW nRow, String& rFormula,
}
-BOOL ScTable::GetNote( SCCOL nCol, SCROW nRow, ScPostIt& rNote)
+ScPostIt* ScTable::GetNote( SCCOL nCol, SCROW nRow )
{
- BOOL bHasNote = FALSE;
+ return ValidColRow( nCol, nRow ) ? aCol[ nCol ].GetNote( nRow ) : 0;
+}
- if (ValidColRow(nCol,nRow))
- bHasNote = aCol[nCol].GetNote( nRow, rNote );
+
+void ScTable::TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote )
+{
+ if( ValidColRow( nCol, nRow ) )
+ aCol[ nCol ].TakeNote( nRow, rpNote );
else
- rNote.Clear();
+ DELETEZ( rpNote );
+}
+
- return bHasNote;
+ScPostIt* ScTable::ReleaseNote( SCCOL nCol, SCROW nRow )
+{
+ return ValidColRow( nCol, nRow ) ? aCol[ nCol ].ReleaseNote( nRow ) : 0;
+}
+
+
+void ScTable::DeleteNote( SCCOL nCol, SCROW nRow )
+{
+ if( ValidColRow( nCol, nRow ) )
+ aCol[ nCol ].DeleteNote( nRow );
}
@@ -1180,7 +1185,7 @@ BOOL ScTable::ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
}
-BOOL ScTable::IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const
+BOOL ScTable::IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes ) const
{
if (!(ValidCol(nCol1) && ValidCol(nCol2)))
{
@@ -1189,7 +1194,7 @@ BOOL ScTable::IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
}
BOOL bEmpty = TRUE;
for (SCCOL i=nCol1; i<=nCol2 && bEmpty; i++)
- bEmpty = aCol[i].IsEmptyBlock( nRow1, nRow2 );
+ bEmpty = aCol[i].IsEmptyBlock( nRow1, nRow2, bIgnoreNotes );
return bEmpty;
}
@@ -2680,12 +2685,6 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
}
}
-//
-// Datei-Operationen
-//
-
-// Speichern
-
// CopyData - fuer Query in anderen Bereich
void ScTable::CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
@@ -2710,7 +2709,7 @@ void ScTable::CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW n
ScBaseCell* pCell = GetCell( nCol, nRow );
if (pCell)
{
- pCell = pCell->Clone(pDocument);
+ pCell = pCell->CloneWithoutNote( *pDocument );
if (pCell->GetCellType() == CELLTYPE_FORMULA)
{
((ScFormulaCell*)pCell)->UpdateReference( URM_COPY, aRange,
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 36e045f56e98..74f2a97e9c2e 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: table3.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.30.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,10 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-// INCLUDE ---------------------------------------------------------------
-
#include <rtl/math.hxx>
#include <unotools/textsearch.hxx>
#include <svtools/zforlist.hxx>
@@ -63,6 +59,7 @@
#include "userlist.hxx"
#include "progress.hxx"
#include "cellform.hxx"
+#include "postit.hxx"
#include <vector>
@@ -536,6 +533,8 @@ void ScTable::Sort(const ScSortParam& rSortParam, BOOL bKeepQuery)
QuickSort( pArray, nRow1, nLastRow );
SortReorder( pArray, aProgress );
delete pArray;
+ // #158377# #i59745# update position of caption objects of cell notes
+ ScNoteUtil::UpdateCaptionPositions( *pDocument, ScRange( aSortParam.nCol1, nRow1, nTab, aSortParam.nCol2, nLastRow, nTab ) );
}
}
else
@@ -555,6 +554,8 @@ void ScTable::Sort(const ScSortParam& rSortParam, BOOL bKeepQuery)
QuickSort( pArray, nCol1, nLastCol );
SortReorder( pArray, aProgress );
delete pArray;
+ // #158377# #i59745# update position of caption objects of cell notes
+ ScNoteUtil::UpdateCaptionPositions( *pDocument, ScRange( nCol1, aSortParam.nRow1, nTab, nLastCol, aSortParam.nRow2, nTab ) );
}
}
DestroySortCollator();
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index d5b87bc6c572..a29a34ebd7e3 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: table4.cxx,v $
- * $Revision: 1.24 $
+ * $Revision: 1.23.126.4 $
*
* This file is part of OpenOffice.org.
*
@@ -453,12 +453,11 @@ void ScTable::FillFormula(ULONG& /* nFormulaCounter */, BOOL /* bFirst */, ScFor
else
*/ {
pDocument->SetNoListening( TRUE ); // noch falsche Referenzen
- ScFormulaCell* pDestCell = (ScFormulaCell*) pSrcCell->Clone( pDocument,
- ScAddress( nDestCol, nDestRow, nTab ), TRUE );
+ ScAddress aAddr( nDestCol, nDestRow, nTab );
+ ScFormulaCell* pDestCell = new ScFormulaCell( *pSrcCell, *pDocument, aAddr );
aCol[nDestCol].Insert(nDestRow, pDestCell);
#if 0
// mit RelRefs unnoetig
- ScAddress aAddr( nDestCol, nDestRow, nTab );
pDestCell->UpdateReference(URM_COPY,
ScRange( aAddr, aAddr ),
nDestCol - pSrcCell->aPos.Col(),
@@ -565,9 +564,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ULONG nIMax = nIEnd;
PutInOrder(nIMin,nIMax);
if (bVertical)
- DeleteArea(nCol1, static_cast<SCROW>(nIMin), nCol2, static_cast<SCROW>(nIMax), IDF_ALL);
+ DeleteArea(nCol1, static_cast<SCROW>(nIMin), nCol2, static_cast<SCROW>(nIMax), IDF_AUTOFILL);
else
- DeleteArea(static_cast<SCCOL>(nIMin), nRow1, static_cast<SCCOL>(nIMax), nRow2, IDF_ALL);
+ DeleteArea(static_cast<SCCOL>(nIMin), nRow1, static_cast<SCCOL>(nIMax), nRow2, IDF_AUTOFILL);
ULONG nProgress = rProgress.GetState();
@@ -823,16 +822,12 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
else
{
+ ScAddress aDestPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), nTab );
switch ( eCellType )
{
case CELLTYPE_STRING:
- aCol[nCol].Insert(static_cast<SCROW>(nRow),
- new ScStringCell(*(ScStringCell*)pSrcCell, pDocument));
- break;
case CELLTYPE_EDIT:
- aCol[nCol].Insert(static_cast<SCROW>(nRow),
- new ScEditCell( *(ScEditCell*)pSrcCell,
- pDocument ));
+ aCol[nCol].Insert( aDestPos.Row(), pSrcCell->CloneWithoutNote( *pDocument ) );
break;
default:
{
@@ -1303,7 +1298,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ULONG nIMin = nIStart;
ULONG nIMax = nIEnd;
PutInOrder(nIMin,nIMax);
- USHORT nDel = bAttribs ? IDF_ALL : IDF_CONTENTS;
+ USHORT nDel = bAttribs ? IDF_AUTOFILL : (IDF_AUTOFILL & IDF_CONTENTS);
if (bVertical)
DeleteArea(nCol1, static_cast<SCROW>(nIMin), nCol2, static_cast<SCROW>(nIMax), nDel);
else
@@ -1357,7 +1352,8 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
{
for (rInner = nIMin; rInner <= nIMax; rInner++)
{
- aCol[nCol].Insert(static_cast<SCROW>(nRow), pSrcCell->Clone(pDocument));
+ ScAddress aDestPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), nTab );
+ aCol[nCol].Insert( aDestPos.Row(), pSrcCell->CloneWithoutNote( *pDocument ) );
}
nProgress += nIMax - nIMin + 1;
rProgress.SetStateOnPercent( nProgress );
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index ef4c0c26da01..443d0f23e3d0 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: table6.cxx,v $
- * $Revision: 1.18 $
+ * $Revision: 1.18.128.3 $
*
* This file is part of OpenOffice.org.
*
@@ -37,6 +37,7 @@
#include <unotools/textsearch.hxx>
#include <svx/srchitem.hxx>
+#include <svx/editobj.hxx>
#include "table.hxx"
#include "collect.hxx"
@@ -101,11 +102,10 @@ BOOL ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
break;
case SVX_SEARCHIN_NOTE:
{
- ScPostIt aNote(pDocument);
- if(pCell->GetNote( aNote ))
+ if(const ScPostIt* pNote = pCell->GetNote())
{
- aString = aNote.GetText();
- bMultiLine = ( ((aNote.GetEditTextObject())->GetParagraphCount()) > 1 );
+ aString = pNote->GetText();
+ bMultiLine = pNote->HasMultiLineText();
}
}
break;
@@ -156,7 +156,7 @@ BOOL ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
else if (pUndoDoc)
{
ScAddress aAdr( nCol, nRow, nTab );
- ScBaseCell* pUndoCell = pCell->Clone(pUndoDoc);
+ ScBaseCell* pUndoCell = pCell->CloneWithoutNote( *pUndoDoc );
pUndoDoc->PutCell( aAdr, pUndoCell);
}
BOOL bRepeat = !rSearchItem.GetWordOnly();
@@ -216,22 +216,10 @@ BOOL ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
while (bRepeat);
if (rSearchItem.GetCellType() == SVX_SEARCHIN_NOTE)
{
- ScPostIt aNote(pDocument);
- if(pCell->GetNote( aNote ))
- {
- aNote.SetText( aString );
-
- // if note is visible - hide it to force a refresh of replaced text
- if (aNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow );
- aNote.SetShown(FALSE);
- }
-
- // NB: rich text format is lost.
- // This is also true of Cells.
- aCol[nCol].SetNote( nRow, aNote );
- }
+ // NB: rich text format is lost.
+ // This is also true of Cells.
+ if( ScPostIt* pNote = pCell->GetNote() )
+ pNote->SetText( aString );
}
else if ( cMatrixFlag != MM_NONE )
{ // #60558# Matrix nicht zerreissen
diff --git a/sc/source/core/data/userdat.cxx b/sc/source/core/data/userdat.cxx
index 33571b751640..66397700676c 100644
--- a/sc/source/core/data/userdat.cxx
+++ b/sc/source/core/data/userdat.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: userdat.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -71,20 +71,15 @@ IMPL_LINK_INLINE_END( ScDrawObjFactory, MakeUserData, SdrObjFactory *, pObjFacto
//------------------------------------------------------------------------
-ScDrawObjData::ScDrawObjData() : SdrObjUserData( SC_DRAWLAYER, SC_UD_OBJDATA, 0 )
+ScDrawObjData::ScDrawObjData() :
+ SdrObjUserData( SC_DRAWLAYER, SC_UD_OBJDATA, 0 ),
+ maStart( ScAddress::INITIALIZE_INVALID ),
+ maEnd( ScAddress::INITIALIZE_INVALID ),
+ mbNote( false )
{
- bValidEnd = FALSE;
}
-ScDrawObjData::ScDrawObjData( const ScDrawObjData& r )
- : SdrObjUserData( r ), aStt( r.aStt ), aEnd( r.aEnd ),
- bValidStart( r.bValidStart ), bValidEnd( r.bValidEnd )
-{}
-
-ScDrawObjData::~ScDrawObjData()
-{}
-
-SdrObjUserData* ScDrawObjData::Clone(SdrObject*) const
+ScDrawObjData* ScDrawObjData::Clone( SdrObject* ) const
{
return new ScDrawObjData( *this );
}
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index ac0dd1cbe9ef..78b63c8c4622 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: chgtrack.cxx,v $
- * $Revision: 1.31.28.5 $
+ * $Revision: 1.32.100.2 $
*
* This file is part of OpenOffice.org.
*
@@ -2303,12 +2303,8 @@ void ScChangeActionContent::SetValue( String& rStr, ScBaseCell*& pCell,
const ScAddress& rPos, const ScBaseCell* pOrgCell,
const ScDocument* pFromDoc, ScDocument* pToDoc )
{
- if ( ScChangeActionContent::NeedsNumberFormat( pOrgCell ) )
- ScChangeActionContent::SetValue( rStr, pCell,
- pFromDoc->GetNumberFormat( rPos ), pOrgCell, pFromDoc, pToDoc );
- else
- ScChangeActionContent::SetValue( rStr, pCell,
- 0, pOrgCell, pFromDoc, pToDoc );
+ ULONG nFormat = NeedsNumberFormat( pOrgCell ) ? pFromDoc->GetNumberFormat( rPos ) : 0;
+ SetValue( rStr, pCell, nFormat, pOrgCell, pFromDoc, pToDoc );
}
@@ -2322,7 +2318,7 @@ void ScChangeActionContent::SetValue( String& rStr, ScBaseCell*& pCell,
pCell->Delete();
if ( ScChangeActionContent::GetContentCellType( pOrgCell ) )
{
- pCell = pOrgCell->Clone( pToDoc );
+ pCell = pOrgCell->CloneWithoutNote( *pToDoc );
switch ( pOrgCell->GetCellType() )
{
case CELLTYPE_VALUE :
@@ -2418,8 +2414,7 @@ void ScChangeActionContent::GetFormulaString( String& rStr,
else
{
DBG_ERROR( "ScChangeActionContent::GetFormulaString: aPos != pCell->aPos" );
- ScFormulaCell* pNew = (ScFormulaCell*) pCell->Clone(
- pCell->GetDocument(), aPos, TRUE ); // TRUE: bNoListening
+ ScFormulaCell* pNew = new ScFormulaCell( *pCell, *pCell->GetDocument(), aPos );
pNew->GetFormula( rStr );
delete pNew;
}
@@ -2484,7 +2479,7 @@ void ScChangeActionContent::PutValueToDoc( ScBaseCell* pCell,
// nothing
break;
default:
- pDoc->PutCell( aPos, pCell->Clone( pDoc ) );
+ pDoc->PutCell( aPos, pCell->CloneWithoutNote( *pDoc ) );
}
}
}
@@ -5360,7 +5355,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
const ScBaseCell* pNewCell = pContent->GetNewCell();
if ( pNewCell )
{
- ScBaseCell* pClonedNewCell = pNewCell->Clone( pDocument );
+ ScBaseCell* pClonedNewCell = pNewCell->CloneWithoutNote( *pDocument );
String aNewValue;
pContent->GetNewString( aNewValue );
pClonedTrack->nGeneratedMin = pGenerated->GetActionNumber() + 1;
@@ -5444,7 +5439,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
const ScChangeActionContent* pContent = dynamic_cast< const ScChangeActionContent* >( pAction );
DBG_ASSERT( pContent, "ScChangeTrack::Clone: pContent is null!" );
const ScBaseCell* pOldCell = pContent->GetOldCell();
- ScBaseCell* pClonedOldCell = ( pOldCell ? pOldCell->Clone( pDocument ) : NULL );
+ ScBaseCell* pClonedOldCell = pOldCell ? pOldCell->CloneWithoutNote( *pDocument ) : 0;
String aOldValue;
pContent->GetOldString( aOldValue );
@@ -5463,7 +5458,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
const ScBaseCell* pNewCell = pContent->GetNewCell();
if ( pNewCell )
{
- ScBaseCell* pClonedNewCell = pNewCell->Clone( pDocument );
+ ScBaseCell* pClonedNewCell = pNewCell->CloneWithoutNote( *pDocument );
pClonedContent->SetNewValue( pClonedNewCell, pDocument );
}
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 06a48376c198..5316ef17d38b 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: compiler.cxx,v $
- * $Revision: 1.82.28.20 $
+ * $Revision: 1.82.18.2 $
*
* This file is part of OpenOffice.org.
*
@@ -3010,7 +3010,9 @@ BOOL ScCompiler::IsColRowName( const String& rName )
case CELLTYPE_VALUE:
case CELLTYPE_NOTE:
case CELLTYPE_SYMBOLS:
+#if DBG_UTIL
case CELLTYPE_DESTROYED:
+#endif
; // nothing, prevent compiler warning
break;
}
@@ -3137,7 +3139,9 @@ BOOL ScCompiler::IsColRowName( const String& rName )
case CELLTYPE_VALUE:
case CELLTYPE_NOTE:
case CELLTYPE_SYMBOLS:
+#if DBG_UTIL
case CELLTYPE_DESTROYED:
+#endif
; // nothing, prevent compiler warning
break;
}
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index cf3e9ba85d5b..20c534a0a556 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: detfunc.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.30.20.7 $
*
* This file is part of OpenOffice.org.
*
@@ -123,14 +123,14 @@ public:
class ScCommentData
{
-private:
- SfxItemSet aCaptionSet;
-
public:
- ScCommentData( ScDocument* pDoc, SdrModel* pModel );
+ ScCommentData( ScDocument& rDoc, SdrModel* pModel );
+
+ SfxItemSet& GetCaptionSet() { return aCaptionSet; }
+ void UpdateCaptionSet( const SfxItemSet& rItemSet );
- SfxItemSet& GetCaptionSet() { return aCaptionSet; }
- void UpdateCaptionSet(const SfxItemSet& UpdateSet);
+private:
+ SfxItemSet aCaptionSet;
};
//------------------------------------------------------------------------
@@ -211,9 +211,8 @@ ScDetectiveData::ScDetectiveData( SdrModel* pModel ) :
aCircleSet.Put( XLineWidthItem( nWidth ) );
}
-ScCommentData::ScCommentData( ScDocument* pDoc, SdrModel* pModel ) :
- aCaptionSet( pModel->GetItemPool(), SDRATTR_START, SDRATTR_END,
- EE_ITEMS_START, EE_ITEMS_END, 0,0 )
+ScCommentData::ScCommentData( ScDocument& rDoc, SdrModel* pModel ) :
+ aCaptionSet( pModel->GetItemPool(), SDRATTR_START, SDRATTR_END, EE_ITEMS_START, EE_ITEMS_END, 0, 0 )
{
basegfx::B2DPolygon aTriangle;
aTriangle.append(basegfx::B2DPoint(10.0, 0.0));
@@ -244,9 +243,12 @@ ScCommentData::ScCommentData( ScDocument* pDoc, SdrModel* pModel ) :
aCaptionSet.Put( SdrTextUpperDistItem( 100 ) );
aCaptionSet.Put( SdrTextLowerDistItem( 100 ) );
+ aCaptionSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
+ aCaptionSet.Put( SdrTextAutoGrowHeightItem( TRUE ) );
+
// #78943# do use the default cell style, so the user has a chance to
// modify the font for the annotations
- ((const ScPatternAttr&)pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)).
+ ((const ScPatternAttr&)rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN)).
FillEditItemSet( &aCaptionSet );
// support the best position for the tail connector now that
@@ -254,15 +256,14 @@ ScCommentData::ScCommentData( ScDocument* pDoc, SdrModel* pModel ) :
aCaptionSet.Put( SdrCaptionEscDirItem( SDRCAPT_ESCBESTFIT) );
}
-void ScCommentData::UpdateCaptionSet( const SfxItemSet& rSet)
+void ScCommentData::UpdateCaptionSet( const SfxItemSet& rItemSet )
{
- SfxWhichIter aWhichIter(rSet);
- sal_uInt16 nWhich(aWhichIter.FirstWhich());
- const SfxPoolItem* pPoolItem = NULL;
+ SfxWhichIter aWhichIter( rItemSet );
+ const SfxPoolItem* pPoolItem = 0;
- while(nWhich)
+ for( USHORT nWhich = aWhichIter.FirstWhich(); nWhich > 0; nWhich = aWhichIter.NextWhich() )
{
- if(rSet.GetItemState(nWhich, FALSE, &pPoolItem) == SFX_ITEM_SET)
+ if(rItemSet.GetItemState(nWhich, FALSE, &pPoolItem) == SFX_ITEM_SET)
{
switch(nWhich)
{
@@ -270,22 +271,20 @@ void ScCommentData::UpdateCaptionSet( const SfxItemSet& rSet)
// use existing Caption default - appears that setting this
// to true screws up the tail appearance. See also comment
// for default setting above.
- break;
+ break;
case SDRATTR_SHADOWXDIST:
// use existing Caption default - svx sets a value of 35
// but default 100 gives a better appearance.
- break;
+ break;
case SDRATTR_SHADOWYDIST:
// use existing Caption default - svx sets a value of 35
// but default 100 gives a better appearance.
- break;
+ break;
default:
- aCaptionSet.Put(*pPoolItem);
- break;
+ aCaptionSet.Put(*pPoolItem);
}
}
- nWhich = aWhichIter.NextWhich();
}
}
@@ -319,45 +318,69 @@ BOOL ScDetectiveFunc::HasError( const ScRange& rRange, ScAddress& rErrPos )
return (nError != 0);
}
-Point ScDetectiveFunc::GetDrawPos( SCCOL nCol, SCROW nRow, BOOL bArrow )
+Point ScDetectiveFunc::GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) const
{
- // MAXCOL/ROW+1 ist erlaubt fuer Ende von Rahmen
- if (nCol > MAXCOL+1)
- {
- DBG_ERROR("falsche Col in ScDetectiveFunc::GetDrawPos");
- nCol = MAXCOL+1;
- }
- if (nRow > MAXROW+1)
- {
- DBG_ERROR("falsche Row in ScDetectiveFunc::GetDrawPos");
- nRow = MAXROW+1;
- }
+ DBG_ASSERT( ValidColRow( nCol, nRow ), "ScDetectiveFunc::GetDrawPos - invalid cell address" );
+ SanitizeCol( nCol );
+ SanitizeRow( nRow );
Point aPos;
- SCTAB nLocalTab = nTab; // nicht ueber this
-
- for (SCCOL i=0; i<nCol; i++)
- aPos.X() += pDoc->GetColWidth( i,nLocalTab );
- aPos.Y() += pDoc->FastGetRowHeight( 0, nRow-1, nLocalTab );
- if (bArrow)
+ switch( eMode )
{
- if (ValidCol(nCol))
- aPos.X() += pDoc->GetColWidth( nCol, nLocalTab ) / 4;
- if (ValidRow(nRow))
- aPos.Y() += pDoc->GetRowHeight( nRow, nLocalTab ) / 2;
+ case DRAWPOS_TOPLEFT:
+ break;
+ case DRAWPOS_BOTTOMRIGHT:
+ ++nCol;
+ ++nRow;
+ break;
+ case DRAWPOS_DETARROW:
+ aPos.X() += pDoc->GetColWidth( nCol, nTab ) / 4;
+ aPos.Y() += pDoc->GetRowHeight( nRow, nTab ) / 2;
+ break;
+ case DRAWPOS_CAPTIONLEFT:
+ aPos.X() += 6;
+ break;
+ case DRAWPOS_CAPTIONRIGHT:
+ {
+ // find right end of passed cell position
+ const ScMergeAttr* pMerge = static_cast< const ScMergeAttr* >( pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE ) );
+ if ( pMerge->GetColMerge() > 1 )
+ nCol = nCol + pMerge->GetColMerge();
+ else
+ ++nCol;
+ aPos.X() -= 6;
+ }
+ break;
}
- aPos.X() = (long) ( aPos.X() * HMM_PER_TWIPS );
- aPos.Y() = (long) ( aPos.Y() * HMM_PER_TWIPS );
+ for ( SCCOL i = 0; i < nCol; ++i )
+ aPos.X() += pDoc->GetColWidth( i, nTab );
+ aPos.Y() += pDoc->FastGetRowHeight( 0, nRow - 1, nTab );
- BOOL bNegativePage = pDoc->IsNegativePage( nTab );
- if ( bNegativePage )
- aPos.X() = -aPos.X();
+ aPos.X() = static_cast< long >( aPos.X() * HMM_PER_TWIPS );
+ aPos.Y() = static_cast< long >( aPos.Y() * HMM_PER_TWIPS );
+
+ if ( pDoc->IsNegativePage( nTab ) )
+ aPos.X() *= -1;
return aPos;
}
+Rectangle ScDetectiveFunc::GetDrawRect( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const
+{
+ Rectangle aRect(
+ GetDrawPos( ::std::min( nCol1, nCol2 ), ::std::min( nRow1, nRow2 ), DRAWPOS_TOPLEFT ),
+ GetDrawPos( ::std::max( nCol1, nCol2 ), ::std::max( nRow1, nRow2 ), DRAWPOS_BOTTOMRIGHT ) );
+ aRect.Justify(); // reorder left/right in RTL sheets
+ return aRect;
+}
+
+Rectangle ScDetectiveFunc::GetDrawRect( SCCOL nCol, SCROW nRow ) const
+{
+ return GetDrawRect( nCol, nRow, nCol, nRow );
+}
+
BOOL lcl_IsOtherTab( const basegfx::B2DPolyPolygon& rPolyPolygon )
{
// test if rPolygon is the line end for "other table" (rectangle)
@@ -388,30 +411,12 @@ BOOL ScDetectiveFunc::HasArrow( const ScAddress& rStart,
return TRUE;
}
- BOOL bNegativePage = pDoc->IsNegativePage( nTab );
-
Rectangle aStartRect;
Rectangle aEndRect;
if (!bStartAlien)
- {
- Point aStartPos = GetDrawPos( rStart.Col(), rStart.Row(), FALSE );
- Size aStartSize = Size(
- (long) ( pDoc->GetColWidth( rStart.Col(), nTab) * HMM_PER_TWIPS ),
- (long) ( pDoc->GetRowHeight( rStart.Row(), nTab) * HMM_PER_TWIPS ) );
- if ( bNegativePage )
- aStartPos.X() -= aStartSize.Width();
- aStartRect = Rectangle( aStartPos, aStartSize );
- }
+ aStartRect = GetDrawRect( rStart.Col(), rStart.Row() );
if (!bEndAlien)
- {
- Point aEndPos = GetDrawPos( nEndCol, nEndRow, FALSE );
- Size aEndSize = Size(
- (long) ( pDoc->GetColWidth( nEndCol, nTab) * HMM_PER_TWIPS ),
- (long) ( pDoc->GetRowHeight( nEndRow, nTab) * HMM_PER_TWIPS ) );
- if ( bNegativePage )
- aEndPos.X() -= aEndSize.Width();
- aEndRect = Rectangle( aEndPos, aEndSize );
- }
+ aEndRect = GetDrawRect( nEndCol, nEndRow );
ScDrawLayer* pModel = pDoc->GetDrawLayer();
SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab));
@@ -482,10 +487,8 @@ BOOL ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
{
// insert the rectangle before the arrow - this is relied on in FindFrameForObject
- Point aStartCorner = GetDrawPos( nRefStartCol, nRefStartRow, FALSE );
- Point aEndCorner = GetDrawPos( nRefEndCol+1, nRefEndRow+1, FALSE );
-
- SdrRectObj* pBox = new SdrRectObj(Rectangle(aStartCorner,aEndCorner));
+ Rectangle aRect = GetDrawRect( nRefStartCol, nRefStartRow, nRefEndCol, nRefEndRow );
+ SdrRectObj* pBox = new SdrRectObj( aRect );
pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
@@ -495,14 +498,12 @@ BOOL ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
pModel->AddCalcUndo( new SdrUndoInsertObj( *pBox ) );
ScDrawObjData* pData = ScDrawLayer::GetObjData( pBox, TRUE );
- pData->aStt.Set( nRefStartCol, nRefStartRow, nTab);
- pData->aEnd.Set( nRefEndCol, nRefEndRow, nTab);
- pData->bValidStart = TRUE;
- pData->bValidEnd = TRUE;
+ pData->maStart.Set( nRefStartCol, nRefStartRow, nTab);
+ pData->maEnd.Set( nRefEndCol, nRefEndRow, nTab);
}
- Point aStartPos = GetDrawPos( nRefStartCol, nRefStartRow, TRUE );
- Point aEndPos = GetDrawPos( nCol, nRow, TRUE );
+ Point aStartPos = GetDrawPos( nRefStartCol, nRefStartRow, DRAWPOS_DETARROW );
+ Point aEndPos = GetDrawPos( nCol, nRow, DRAWPOS_DETARROW );
if (bFromOtherTab)
{
@@ -540,15 +541,11 @@ BOOL ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
ScDrawObjData* pData = ScDrawLayer::GetObjData( pArrow, TRUE );
if (bFromOtherTab)
- pData->bValidStart = FALSE;
+ pData->maStart.SetInvalid();
else
- {
- pData->aStt.Set( nRefStartCol, nRefStartRow, nTab);
- pData->bValidStart = TRUE;
- }
+ pData->maStart.Set( nRefStartCol, nRefStartRow, nTab);
- pData->aEnd.Set( nCol, nRow, nTab);
- pData->bValidEnd = TRUE;
+ pData->maEnd.Set( nCol, nRow, nTab);
return TRUE;
}
@@ -563,10 +560,8 @@ BOOL ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
BOOL bArea = ( nStartCol != nEndCol || nStartRow != nEndRow );
if (bArea)
{
- Point aStartCorner = GetDrawPos( nStartCol, nStartRow, FALSE );
- Point aEndCorner = GetDrawPos( nEndCol+1, nEndRow+1, FALSE );
-
- SdrRectObj* pBox = new SdrRectObj(Rectangle(aStartCorner,aEndCorner));
+ Rectangle aRect = GetDrawRect( nStartCol, nStartRow, nEndCol, nEndRow );
+ SdrRectObj* pBox = new SdrRectObj( aRect );
pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
@@ -576,16 +571,14 @@ BOOL ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
pModel->AddCalcUndo( new SdrUndoInsertObj( *pBox ) );
ScDrawObjData* pData = ScDrawLayer::GetObjData( pBox, TRUE );
- pData->aStt.Set( nStartCol, nStartRow, nTab);
- pData->aEnd.Set( nEndCol, nEndRow, nTab);
- pData->bValidStart = TRUE;
- pData->bValidEnd = TRUE;
+ pData->maStart.Set( nStartCol, nStartRow, nTab);
+ pData->maEnd.Set( nEndCol, nEndRow, nTab);
}
BOOL bNegativePage = pDoc->IsNegativePage( nTab );
long nPageSign = bNegativePage ? -1 : 1;
- Point aStartPos = GetDrawPos( nStartCol, nStartRow, TRUE );
+ Point aStartPos = GetDrawPos( nStartCol, nStartRow, DRAWPOS_DETARROW );
Point aEndPos = Point( aStartPos.X() + 1000 * nPageSign, aStartPos.Y() - 1000 );
if (aEndPos.Y() < 0)
aEndPos.Y() += 2000;
@@ -613,9 +606,8 @@ BOOL ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
pModel->AddCalcUndo( new SdrUndoInsertObj( *pArrow ) );
ScDrawObjData* pData = ScDrawLayer::GetObjData( pArrow, TRUE );
- pData->aStt.Set( nStartCol, nStartRow, nTab);
- pData->bValidStart = TRUE;
- pData->bValidEnd = FALSE;
+ pData->maStart.Set( nStartCol, nStartRow, nTab);
+ pData->maEnd.SetInvalid();
return TRUE;
}
@@ -665,15 +657,7 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData
ScDrawLayer* pModel = pDoc->GetDrawLayer();
SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab));
- Point aStartPos = GetDrawPos( nCol, nRow, FALSE );
- Size aSize( (long) ( pDoc->GetColWidth(nCol, nTab) * HMM_PER_TWIPS ),
- (long) ( pDoc->GetRowHeight(nRow, nTab) * HMM_PER_TWIPS ) );
-
- BOOL bNegativePage = pDoc->IsNegativePage( nTab );
- if ( bNegativePage )
- aStartPos.X() -= aSize.Width();
-
- Rectangle aRect( aStartPos, aSize );
+ Rectangle aRect = GetDrawRect( nCol, nRow );
aRect.Left() -= 250;
aRect.Right() += 250;
aRect.Top() -= 70;
@@ -690,241 +674,13 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData
pModel->AddCalcUndo( new SdrUndoInsertObj( *pCircle ) );
ScDrawObjData* pData = ScDrawLayer::GetObjData( pCircle, TRUE );
- pData->aStt.Set( nCol, nRow, nTab);
- pData->bValidStart = TRUE;
- pData->bValidEnd = FALSE;
-}
-
-BOOL lcl_MirrorCheckNoteRectangle(Rectangle& rRect, BOOL bNegativePage)
-{
- BOOL bMirrorChange = false;
-
- if ( bNegativePage )
- {
- if(rRect.Left() >= 0 && rRect.Right() > 0)
- bMirrorChange = true;
- }
- else
- {
- if(rRect.Left() < 0 && rRect.Right() <= 0)
- bMirrorChange = true;
- }
-
- if(bMirrorChange)
- {
- long nTemp = rRect.Left();
- rRect.Left() = -rRect.Right();
- rRect.Right() = -nTemp;
- }
- return bMirrorChange;
-}
-
-SdrObject* ScDetectiveFunc::DrawCaption( SCCOL nCol, SCROW nRow, const String& rText,
- ScCommentData& rData, SdrPage* pDestPage,
- BOOL bHasUserText, BOOL bLeft,
- const Rectangle& rVisible )
-{
- ScDrawLayer* pModel = NULL; // muss ScDrawLayer* sein wegen AddCalcUndo !!!
- SdrPage* pPage = pDestPage;
- if (!pPage) // keine angegeben?
- {
- pModel = pDoc->GetDrawLayer();
- pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab));
- }
-
- BOOL bNegativePage = pDoc->IsNegativePage( nTab );
- long nPageSign = bNegativePage ? -1 : 1;
-
- SCCOL nNextCol = nCol+1;
- const ScMergeAttr* pMerge = (const ScMergeAttr*) pDoc->GetAttr( nCol,nRow,nTab, ATTR_MERGE );
- if ( pMerge->GetColMerge() > 1 )
- nNextCol = nCol + pMerge->GetColMerge();
-
- Point aTailPos = GetDrawPos( nNextCol, nRow, FALSE );
- Point aRectPos = aTailPos;
- if ( bLeft )
- {
- aTailPos = GetDrawPos( nCol, nRow, FALSE );
- aTailPos.X() += 10 * nPageSign; // left, just inside the cell
- }
- else
- aTailPos.X() -= 10 * nPageSign; // point just before the next cell
-
- // arrow head should be visible (if visible rectangle is set)
- if ( bNegativePage )
- {
- if ( aTailPos.X() < rVisible.Left() && rVisible.Left() )
- aTailPos.X() = rVisible.Left();
- }
- else
- {
- if ( aTailPos.X() > rVisible.Right() && rVisible.Right() )
- aTailPos.X() = rVisible.Right();
- }
-
- aRectPos.X() += 600 * nPageSign;
- aRectPos.Y() -= 1500;
- if ( aRectPos.Y() < rVisible.Top() ) aRectPos.Y() = rVisible.Top();
-
- // links wird spaeter getestet
-
- // bei Textlaenge > SC_NOTE_SMALLTEXT wird die Breite verdoppelt...
- long nDefWidth = ( rText.Len() > SC_NOTE_SMALLTEXT ) ? 5800 : 2900;
- Size aRectSize( nDefWidth, 1800 );
-
- long nMaxWidth = 10000; //! oder wie?
- if ( !bHasUserText )
- nMaxWidth = aRectSize.Width(); // Notiz nicht zu gross
-
- if ( bNegativePage )
- {
- if ( rVisible.Left() )
- {
- nMaxWidth = aRectPos.X() - rVisible.Left() - 100;
- if (nMaxWidth < nDefWidth)
- {
- aRectPos.X() += nDefWidth - nMaxWidth;
- nMaxWidth = nDefWidth;
- }
- }
- if ( aRectPos.X() > rVisible.Right() )
- aRectPos.X() = rVisible.Right();
-
- aRectPos.X() -= aRectSize.Width();
- }
- else
- {
- if ( rVisible.Right() )
- {
- nMaxWidth = rVisible.Right() - aRectPos.X() - 100;
- if (nMaxWidth < nDefWidth)
- {
- aRectPos.X() -= nDefWidth - nMaxWidth;
- nMaxWidth = nDefWidth;
- }
- }
- if ( aRectPos.X() < rVisible.Left() )
- aRectPos.X() = rVisible.Left();
- }
-
- bool bNewNote = true;
- Rectangle aTextRect;
- ScPostIt aCellNote(pDoc);
- if(pDoc->GetNote( nCol, nRow, nTab, aCellNote ))
- {
- aTextRect = aCellNote.GetRectangle();
- if(lcl_MirrorCheckNoteRectangle(aTextRect,bNegativePage))
- {
- aCellNote.SetRectangle(aTextRect);
- pDoc->SetNote( nCol, nRow, nTab, aCellNote );
- }
- bNewNote = false;
- }
- SdrCaptionObj* pCaption;
- //if no rectangle dimensions stored then default to our calculated dimensions.
- if(aTextRect.IsEmpty())
- {
- pCaption = new SdrCaptionObj( Rectangle( aRectPos,aRectSize ), aTailPos );
- aTextRect = pCaption->GetLogicRect();
- aCellNote.SetRectangle(aTextRect);
- pDoc->SetNote( nCol, nRow, nTab, aCellNote );
- }
- else
- pCaption = new SdrCaptionObj( aTextRect, aTailPos );
-
- if(!bNewNote)
- {
- rData.UpdateCaptionSet(aCellNote.GetItemSet());
- }
- SfxItemSet& rAttrSet = rData.GetCaptionSet();
-
-
- if (bHasUserText)
- {
- rAttrSet.Put(SdrTextAutoGrowWidthItem(TRUE));
- rAttrSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
- rAttrSet.Put(SdrTextMaxFrameWidthItem(nMaxWidth));
- }
-
- ScDrawLayer::SetAnchor( pCaption, SCA_PAGE );
- pCaption->SetLayer( SC_LAYER_INTERN );
- pCaption->SetSpecialTextBoxShadow();
- pCaption->SetFixedTail();
-
-
- if(bHasUserText)
- {
- pPage->InsertObject( pCaption );
- // #78611# for SetText, the object must already be inserted
- pCaption->SetText( rText );
- // SetAttributes must be after SetText, because the font attributes
- // are applied to the text.
- pCaption->SetMergedItemSetAndBroadcast(rAttrSet);
- }
- else
- {
- pPage->InsertObject( pCaption );
-
- // To support different paragraph alignments using the
- // ScNoteEditEngine(), it is necessary to apply the
- // ItemSet of the container before the creation of the
- // EditTextObject(). But to support Vertical text, the opposite
- // is true.
- BOOL bVertical = static_cast<const SvxWritingModeItem&> (rAttrSet.Get (SDRATTR_TEXTDIRECTION)).GetValue() == com::sun::star::text::WritingMode_TB_RL;
- if(!bVertical)
- pCaption->SetMergedItemSetAndBroadcast(rAttrSet);
-
- // Keep the existing rectangle size.
- if(!bNewNote)
- pCaption->SetLogicRect(aTextRect);
-
- ScPostIt aNote(pDoc);
- if(pDoc->GetNote( nCol, nRow, nTab, aNote ))
- {
- if(const EditTextObject* pEditText = aNote.GetEditTextObject())
- {
- OutlinerParaObject* pOPO = new OutlinerParaObject( *pEditText );
- pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT );
- pCaption->NbcSetOutlinerParaObject( pOPO );
- }
- }
- if(bVertical)
- pCaption->SetMergedItemSetAndBroadcast(rAttrSet);
- }
-
- if (bHasUserText)
- {
- pCaption->AdjustTextFrameWidthAndHeight( aTextRect, TRUE, TRUE );
- aTextRect = pCaption->GetLogicRect();
- }
-
- aCellNote.SetRectangle(aTextRect);
- pDoc->SetNote( nCol, nRow, nTab, aCellNote );
-
- // Undo und UserData nur, wenn's im Dokument ist, also keine Page angegeben war
- if ( !pDestPage )
- {
- pModel->AddCalcUndo( new SdrUndoInsertObj( *pCaption ) );
-
- ScDrawObjData* pData = ScDrawLayer::GetObjData( pCaption, TRUE );
- pData->aStt.Set( nCol, nRow, nTab);
- pData->bValidStart = TRUE;
- pData->bValidEnd = FALSE;
- }
-
- return pCaption;
+ pData->maStart.Set( nCol, nRow, nTab);
+ pData->maEnd.SetInvalid();
}
void ScDetectiveFunc::DeleteArrowsAt( SCCOL nCol, SCROW nRow, BOOL bDestPnt )
{
- BOOL bNegativePage = pDoc->IsNegativePage( nTab );
-
- Point aPos = GetDrawPos( nCol, nRow, FALSE );
- Size aSize = Size( (long) ( pDoc->GetColWidth( nCol, nTab) * HMM_PER_TWIPS ),
- (long) ( pDoc->GetRowHeight( nRow, nTab) * HMM_PER_TWIPS ) );
- if ( bNegativePage )
- aPos.X() -= aSize.Width();
- Rectangle aRect( aPos, aSize );
+ Rectangle aRect = GetDrawRect( nCol, nRow );
ScDrawLayer* pModel = pDoc->GetDrawLayer();
SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab));
@@ -994,12 +750,9 @@ void ScDetectiveFunc::DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nR
InfoBox(0,aStr).Execute();
*/
- Point aStartCorner = GetDrawPos( nCol1, nRow1, FALSE );
- Point aEndCorner = GetDrawPos( nCol2+1, nRow2+1, FALSE );
- Rectangle aCornerRect( aStartCorner, aEndCorner );
- aCornerRect.Justify();
- aStartCorner = aCornerRect.TopLeft();
- aEndCorner = aCornerRect.BottomRight();
+ Rectangle aCornerRect = GetDrawRect( nCol1, nRow1, nCol2, nRow2 );
+ Point aStartCorner = aCornerRect.TopLeft();
+ Point aEndCorner = aCornerRect.BottomRight();
Rectangle aObjRect;
ScDrawLayer* pModel = pDoc->GetDrawLayer();
@@ -1553,13 +1306,11 @@ BOOL ScDetectiveFunc::DeleteAll( ScDetectiveDelete eWhat )
if ( eWhat != SC_DET_ALL )
{
BOOL bCircle = ( pObject->ISA(SdrCircObj) );
- BOOL bCaption = ( pObject->ISA(SdrCaptionObj) );
+ BOOL bCaption = ScDrawLayer::IsNoteCaption( pObject );
if ( eWhat == SC_DET_DETECTIVE ) // Detektiv, aus Menue
bDoThis = !bCaption; // auch Kreise
else if ( eWhat == SC_DET_CIRCLES ) // Kreise, wenn neue erzeugt werden
bDoThis = bCircle;
- else if ( eWhat == SC_DET_COMMENTS )
- bDoThis = bCaption;
else if ( eWhat == SC_DET_ARROWS ) // DetectiveRefresh
bDoThis = !bCaption && !bCircle; // don't include circles
else
@@ -1656,125 +1407,44 @@ BOOL ScDetectiveFunc::MarkInvalid(BOOL& rOverflow)
return ( bDeleted || nInsCount != 0 );
}
-SdrObject* ScDetectiveFunc::ShowCommentUser( SCCOL nCol, SCROW nRow, const String& rUserText,
- const Rectangle& rVisible, BOOL bLeft, BOOL bForce,
- SdrPage* pDestPage )
-{
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
- if (!pModel && !pDestPage)
- return NULL;
-
- SdrObject* pObject = NULL;
- ScPostIt aNote(pDoc);
- BOOL bFound = pDoc->GetNote( nCol, nRow, nTab, aNote );
- if ( bFound || bForce || rUserText.Len() )
- {
- SdrModel* pDestModel = pModel;
- if ( pDestPage )
- pDestModel = pDestPage->GetModel();
- ScCommentData aData( pDoc, pDestModel ); // richtigen Pool benutzen
-
- String aNoteText = aNote.GetText(); //! Author etc. of this Note?
-
- String aDisplay;
- BOOL bHasUser = ( rUserText.Len() != 0 );
- if ( bHasUser )
- {
- aDisplay += rUserText;
- if ( aNoteText.Len() )
- aDisplay.AppendAscii( RTL_CONSTASCII_STRINGPARAM("\n--------\n") );
- }
- aDisplay += aNoteText;
-
- pObject = DrawCaption( nCol, nRow, aDisplay, aData, pDestPage, bHasUser, bLeft, rVisible );
- }
-
- return pObject;
-}
-
-SdrObject* ScDetectiveFunc::ShowComment( SCCOL nCol, SCROW nRow, BOOL bForce, SdrPage* pDestPage )
-{
- return ShowCommentUser( nCol, nRow, String(), Rectangle(0,0,0,0), FALSE, bForce, pDestPage );
-}
-
-BOOL ScDetectiveFunc::HideComment( SCCOL nCol, SCROW nRow )
-{
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
- if (!pModel)
- return FALSE;
- SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab));
- DBG_ASSERT(pPage,"Page ?");
-
- pPage->RecalcObjOrdNums();
- BOOL bDone = FALSE;
-
- SdrObjListIter aIter( *pPage, IM_FLAT );
- SdrObject* pObject = aIter.Next();
- while (pObject && !bDone)
- {
- if ( pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA( SdrCaptionObj ) )
- {
- ScDrawObjData* pData = ScDrawLayer::GetObjData( pObject );
- if ( pData && nCol == pData->aStt.Col() && nRow == pData->aStt.Row() )
- {
- pModel->AddCalcUndo( new SdrUndoRemoveObj( *pObject ) );
- pPage->RemoveObject( pObject->GetOrdNum() );
- bDone = TRUE;
- }
- }
-
- pObject = aIter.Next();
- }
-
- return bDone;
-}
-
-void ScDetectiveFunc::UpdateAllComments()
+void ScDetectiveFunc::UpdateAllComments( ScDocument& rDoc )
{
// for all caption objects, update attributes and SpecialTextBoxShadow flag
// (on all tables - nTab is ignored!)
// no undo actions, this is refreshed after undo
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return;
- SCTAB nTabCount = pDoc->GetTableCount();
- for (SCTAB nObjTab=0; nObjTab<nTabCount; nObjTab++)
+ for( SCTAB nObjTab = 0, nTabCount = rDoc.GetTableCount(); nObjTab < nTabCount; ++nObjTab )
{
- SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nObjTab));
- DBG_ASSERT(pPage,"Page ?");
- if (pPage)
+ SdrPage* pPage = pModel->GetPage( static_cast< sal_uInt16 >( nObjTab ) );
+ DBG_ASSERT( pPage, "Page ?" );
+ if( pPage )
{
SdrObjListIter aIter( *pPage, IM_FLAT );
- SdrObject* pObject = aIter.Next();
- while (pObject)
+ for( SdrObject* pObject = aIter.Next(); pObject; pObject = aIter.Next() )
{
- if ( pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA( SdrCaptionObj ) )
+ if ( ScDrawObjData* pData = ScDrawLayer::GetNoteCaptionData( pObject, nObjTab ) )
{
- SdrCaptionObj* pCaption = (SdrCaptionObj*)pObject;
-
- ScDrawObjData* pData = ScDrawLayer::GetObjData( pCaption, TRUE );
-
- ScPostIt aCellNote(pDoc);
- if(pDoc->GetNote( pData->aStt.Col(), pData->aStt.Row(), nObjTab, aCellNote ))
+ ScPostIt* pNote = rDoc.GetNote( pData->maStart );
+ DBG_ASSERT( pNote && (pNote->GetCaption() == pObject), "ScDetectiveFunc::UpdateAllComments - invalid cell note" );
+ if( pNote )
{
- ScCommentData aData( pDoc, pModel );
- SfxItemSet rAttrColorSet(aCellNote.GetItemSet());
- Color aCommentColor( ScDetectiveFunc::GetCommentColor() );
- rAttrColorSet.Put( XFillColorItem( String(), aCommentColor ) );
- aData.UpdateCaptionSet(rAttrColorSet);
- SfxItemSet& rAttrSet = aData.GetCaptionSet();
- pCaption->SetMergedItemSetAndBroadcast(rAttrSet);
- pCaption->SetSpecialTextBoxShadow();
- pCaption->SetFixedTail();
- aCellNote.SetItemSet(rAttrSet);
- pDoc->SetNote( pData->aStt.Col(), pData->aStt.Row(), nObjTab, aCellNote );
+ ScCommentData aData( rDoc, pModel );
+ SfxItemSet aAttrColorSet = pObject->GetMergedItemSet();
+ aAttrColorSet.Put( XFillColorItem( String(), GetCommentColor() ) );
+ aData.UpdateCaptionSet( aAttrColorSet );
+ pObject->SetMergedItemSetAndBroadcast( aData.GetCaptionSet() );
+ if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
+ {
+ pCaption->SetSpecialTextBoxShadow();
+ pCaption->SetFixedTail();
+ }
}
}
-
- pObject = aIter.Next();
}
}
}
@@ -1788,16 +1458,14 @@ void ScDetectiveFunc::UpdateAllArrowColors()
if (!pModel)
return;
- SCTAB nTabCount = pDoc->GetTableCount();
- for (SCTAB nObjTab=0; nObjTab<nTabCount; nObjTab++)
+ for( SCTAB nObjTab = 0, nTabCount = pDoc->GetTableCount(); nObjTab < nTabCount; ++nObjTab )
{
- SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nObjTab));
- DBG_ASSERT(pPage,"Page ?");
- if (pPage)
+ SdrPage* pPage = pModel->GetPage( static_cast< sal_uInt16 >( nObjTab ) );
+ DBG_ASSERT( pPage, "Page ?" );
+ if( pPage )
{
SdrObjListIter aIter( *pPage, IM_FLAT );
- SdrObject* pObject = aIter.Next();
- while (pObject)
+ for( SdrObject* pObject = aIter.Next(); pObject; pObject = aIter.Next() )
{
if ( pObject->GetLayer() == SC_LAYER_INTERN )
{
@@ -1857,8 +1525,6 @@ void ScDetectiveFunc::UpdateAllArrowColors()
// pObject->SendRepaintBroadcast(pObject->GetBoundRect());
}
}
-
- pObject = aIter.Next();
}
}
}
@@ -1877,56 +1543,26 @@ BOOL ScDetectiveFunc::FindFrameForObject( SdrObject* pObject, ScRange& rRange )
if (!pPage) return FALSE;
// test if the object is a direct page member
- if(pObject
- && pObject->GetPage()
- && pObject->GetObjList()
- && pObject->GetPage() == pObject->GetObjList())
+ if( pObject && pObject->GetPage() && (pObject->GetPage() == pObject->GetObjList()) )
{
// Is there a previous object?
const sal_uInt32 nOrdNum(pObject->GetOrdNum());
- if(nOrdNum > 0L)
+ if(nOrdNum > 0)
{
- SdrObject* pPrevObj = pPage->GetObj(nOrdNum - 1L);
+ SdrObject* pPrevObj = pPage->GetObj(nOrdNum - 1);
if ( pPrevObj && pPrevObj->GetLayer() == SC_LAYER_INTERN && pPrevObj->ISA(SdrRectObj) )
{
ScDrawObjData* pPrevData = ScDrawLayer::GetObjDataTab( pPrevObj, rRange.aStart.Tab() );
- if ( pPrevData && pPrevData->bValidStart && pPrevData->bValidEnd )
+ if ( pPrevData && pPrevData->maStart.IsValid() && pPrevData->maEnd.IsValid() && (pPrevData->maStart == rRange.aStart) )
{
- if ( pPrevData->aStt == rRange.aStart )
- {
- rRange.aEnd = pPrevData->aEnd;
- return TRUE;
- }
+ rRange.aEnd = pPrevData->maEnd;
+ return TRUE;
}
}
}
}
-
- // GetContainer() no longer allowed, baaad style (!)
- //ULONG nPos = pPage->GetContainer().GetPos( pObject );
- //if ( nPos != CONTAINER_ENTRY_NOTFOUND && nPos > 0 )
- //{
- // SdrObject* pPrevObj = pPage->GetObj( nPos - 1 );
- // if ( pPrevObj && pPrevObj->GetLayer() == SC_LAYER_INTERN && pPrevObj->ISA(SdrRectObj) )
- // {
- // ScDrawObjData* pPrevData = ScDrawLayer::GetObjDataTab( pPrevObj, rRange.aStart.Tab() );
- // if ( pPrevData && pPrevData->bValidStart && pPrevData->bValidEnd )
- // {
- // if ( pPrevData->aStt.nCol == rRange.aStart.Col() &&
- // pPrevData->aStt.nRow == rRange.aStart.Row() &&
- // pPrevData->aStt.nTab == rRange.aStart.Tab() )
- // {
- // rRange.aEnd.Set( pPrevData->aEnd.nCol,
- // pPrevData->aEnd.nRow,
- // pPrevData->aEnd.nTab );
- // return TRUE;
- // }
- // }
- // }
- //}
-
return FALSE;
}
@@ -1940,21 +1576,24 @@ ScDetectiveObjType ScDetectiveFunc::GetDetectiveObjectType( SdrObject* pObject,
{
if ( ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObject, nObjTab ) )
{
+ bool bValidStart = pData->maStart.IsValid();
+ bool bValidEnd = pData->maEnd.IsValid();
+
if ( pObject->IsPolyObj() && pObject->GetPointCount() == 2 )
{
// line object -> arrow
- if ( pData->bValidStart )
- eType = ( pData->bValidEnd ) ? SC_DETOBJ_ARROW : SC_DETOBJ_TOOTHERTAB;
- else if ( pData->bValidEnd )
+ if ( bValidStart )
+ eType = bValidEnd ? SC_DETOBJ_ARROW : SC_DETOBJ_TOOTHERTAB;
+ else if ( bValidEnd )
eType = SC_DETOBJ_FROMOTHERTAB;
- if ( pData->bValidStart )
- rSource = pData->aStt;
- if ( pData->bValidEnd )
- rPosition = pData->aEnd;
+ if ( bValidStart )
+ rSource = pData->maStart;
+ if ( bValidEnd )
+ rPosition = pData->maEnd;
- if ( pData->bValidStart && lcl_HasThickLine( *pObject ) )
+ if ( bValidStart && lcl_HasThickLine( *pObject ) )
{
// thick line -> look for frame before this object
@@ -1967,11 +1606,11 @@ ScDetectiveObjType ScDetectiveFunc::GetDetectiveObjectType( SdrObject* pObject,
}
else if ( pObject->ISA(SdrCircObj) )
{
- if ( pData->bValidStart )
+ if ( bValidStart )
{
// cell position is returned in rPosition
- rPosition = pData->aStt;
+ rPosition = pData->maStart;
eType = SC_DETOBJ_CIRCLE;
}
}
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index e511e0876b71..a377a27e24a0 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: interpr2.cxx,v $
- * $Revision: 1.38 $
+ * $Revision: 1.37.88.3 $
*
* This file is part of OpenOffice.org.
*
@@ -1603,13 +1603,11 @@ void ScInterpreter::ScBackSolver()
{
ScRange aVRange( aValueAdr, aValueAdr ); // fuer SetDirty
double fSaveVal; // Original value to be restored later if necessary
- ScPostIt aNote(pDok);
- BOOL bHasNote = FALSE;
+ ScPostIt* pNote = 0;
if ( bTempCell )
{
- if ( ( bHasNote = (pVCell != NULL) ) != FALSE )
- bHasNote = pVCell->GetNote( aNote );
+ pNote = pVCell ? pVCell->ReleaseNote() : 0;
fSaveVal = 0.0;
pVCell = new ScValueCell( fSaveVal );
pDok->PutCell( aValueAdr, pVCell );
@@ -1759,10 +1757,7 @@ void ScInterpreter::ScBackSolver()
}
if ( bTempCell )
{
- if ( bHasNote )
- pVCell = new ScNoteCell( aNote, pDok );
- else
- pVCell = NULL;
+ pVCell = pNote ? new ScNoteCell( pNote ) : 0;
pDok->PutCell( aValueAdr, pVCell );
}
else
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 96e1ad36f1bf..a2c5e786abbe 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: impop.cxx,v $
- * $Revision: 1.95.4.4 $
+ * $Revision: 1.95.36.4 $
*
* This file is part of OpenOffice.org.
*
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 5d6fffc9f145..d40c0d91275c 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xeescher.cxx,v $
- * $Revision: 1.24.90.8 $
+ * $Revision: 1.24.128.6 $
*
* This file is part of OpenOffice.org.
*
@@ -41,6 +41,7 @@
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/form/binding/XBindableValue.hpp>
#include <com/sun/star/form/binding/XValueBinding.hpp>
#include <com/sun/star/form/binding/XListEntrySink.hpp>
@@ -50,6 +51,9 @@
#include <rtl/ustrbuf.h>
#include <vcl/bmpacc.hxx>
#include <svx/svdoole2.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/outlobj.hxx>
+#include <svx/editobj.hxx>
#include "editutil.hxx"
#include "unonames.hxx"
@@ -822,7 +826,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
XclExpRecord( EXC_ID_NOTE ),
maScPos( rScPos ),
mnObjId( EXC_OBJ_INVALID_ID ),
- mbVisible( pScNote && pScNote->IsShown() )
+ mbVisible( pScNote && pScNote->IsCaptionShown() )
{
// get the main note text
String aNoteText;
@@ -841,56 +845,11 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
case EXC_BIFF8:
{
- ::std::auto_ptr< EditTextObject > xObj;
- Rectangle aRect;
- ::std::auto_ptr< SdrCaptionObj > xCaption;
- ScDocument& rDoc = rRoot.GetDoc();
-
- // #i79416# create dummy note for cells without note but with content in rAddText
- ::std::auto_ptr< ScPostIt > xDummyNote;
- if( pScNote )
- {
- aRect = pScNote->GetRectangle();
- }
- else
- {
- xDummyNote.reset( new ScPostIt( rAddText, &rDoc ) );
- xDummyNote->SetItemSet( xDummyNote->DefaultItemSet() );
- aRect = xDummyNote->DefaultRectangle( rScPos );
- pScNote = xDummyNote.get();
- }
-
- // read strings from note object, if present
- if( const EditTextObject* pEditObj = pScNote->GetEditTextObject() )
- {
- xObj.reset( pEditObj->Clone() );
- // append additional text to original note if any
- if( pScNote->GetText() != aNoteText )
- {
- EditEngine& rEE = rRoot.GetEditEngine();
- rEE.SetText( aNoteText );
- ::std::auto_ptr< EditTextObject > xNewTextObj( rEE.CreateTextObject() );
- xObj->Insert( *xNewTextObj, pEditObj->GetParagraphCount() );
- }
- maAuthor.Assign( pScNote->GetAuthor() );
- const SfxItemSet& rSet = pScNote->GetItemSet();
- Point aDummyTailPos;
-
- // In order to transform the SfxItemSet to an EscherPropertyContainer
- // and export the properties, we need to recreate the drawing object and
- // pass this to XclObjComment() for processing.
- xCaption.reset( new SdrCaptionObj( aRect, aDummyTailPos ) );
-
- pScNote->InsertObject( xCaption.get(), rDoc, rScPos.Tab(), sal_True );
- xCaption->SetMergedItemSet( rSet );
- }
-
- // create the object record
- if( xObj.get() )
- mnObjId = rRoot.GetOldRoot().pObjRecs->Add( new XclObjComment( rRoot, aRect, *xObj, xCaption.get(), mbVisible ) );
-
+ // TODO: additional text
if( pScNote )
- pScNote->RemoveObject( xCaption.get(), rDoc, rScPos.Tab() );
+ if( SdrCaptionObj* pCaption = pScNote->GetCaption() )
+ if( const OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
+ mnObjId = rRoot.GetOldRoot().pObjRecs->Add( new XclObjComment( rRoot, pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible ) );
SetRecSize( 9 + maAuthor.GetSize() );
}
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index c186694375b5..5aa515b64578 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xetable.cxx,v $
- * $Revision: 1.18 $
+ * $Revision: 1.18.126.1 $
*
* This file is part of OpenOffice.org.
*
@@ -2487,7 +2487,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
maRowBfr.AppendCell( xCell, bIsMergedBase );
// notes
- const ScPostIt* pScNote = pScCell ? pScCell->GetNotePtr() : 0;
+ const ScPostIt* pScNote = pScCell ? pScCell->GetNote() : 0;
if( pScNote || (aAddNoteText.Len() > 0) )
mxNoteList->AppendNewRecord( new XclExpNote( GetRoot(), aScPos, pScNote, aAddNoteText ) );
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index a9a5c2dc0a14..c1fc0d14b4c6 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xiescher.cxx,v $
- * $Revision: 1.56.88.20 $
+ * $Revision: 1.57.52.8 $
*
* This file is part of OpenOffice.org.
*
@@ -69,7 +69,6 @@
#include <basic/sbmod.hxx>
#include <basic/sbmeth.hxx>
-#include <svx/svdobj.hxx>
#include <svx/svdopath.hxx>
#include <svx/svdocirc.hxx>
#include <svx/svdoedge.hxx>
@@ -77,6 +76,7 @@
#include <svx/svdoashp.hxx>
#include <svx/svdograf.hxx>
#include <svx/svdoole2.hxx>
+#include <svx/svdocapt.hxx>
#include <svx/svdouno.hxx>
#include <svx/svdpage.hxx>
#include <svx/editobj.hxx>
@@ -390,7 +390,6 @@ void XclImpDrawObjBase::SetDffData( const DffObjData& rDffObjData, const String&
maHyperlink = rHyperlink;
mbVisible = bVisible;
mbAutoMargin = bAutoMargin;
-
}
void XclImpDrawObjBase::SetAnchor( const XclObjAnchor& rAnchor )
@@ -968,10 +967,10 @@ sal_Size XclImpGroupObj::DoGetProgressSize() const
return XclImpDrawObjBase::DoGetProgressSize() + maChildren.GetProgressSize();
}
-SdrObject* XclImpGroupObj::DoCreateSdrObj( const Rectangle& rAnchorRect, ScfProgressBar& rProgress ) const
+SdrObject* XclImpGroupObj::DoCreateSdrObj( const Rectangle& /*rAnchorRect*/, ScfProgressBar& rProgress ) const
{
TSdrObjectPtr< SdrObjGroup > xSdrObj( new SdrObjGroup );
- xSdrObj->NbcSetSnapRect( rAnchorRect );
+ // child objects in BIFF2-BIFF5 have absolute size, not needed to pass own anchor rectangle
for( XclImpDrawObjVector::const_iterator aIt = maChildren.begin(), aEnd = maChildren.end(); aIt != aEnd; ++aIt )
GetObjectManager().GetDffManager().ProcessObject( xSdrObj->GetSubList(), **aIt );
rProgress.Progress();
@@ -1626,7 +1625,7 @@ XclImpNoteObj::XclImpNoteObj( const XclImpRoot& rRoot ) :
mnNoteFlags( 0 )
{
SetSimpleMacro( false );
- // note object will be processed, but not inserted into the draw page
+ // caption object will be created manually
SetInsertSdrObj( false );
}
@@ -1638,46 +1637,22 @@ void XclImpNoteObj::SetNoteData( const ScAddress& rScPos, sal_uInt16 nNoteFlags
void XclImpNoteObj::DoProcessSdrObj( SdrObject& rSdrObj ) const
{
- if( maScPos.IsValid() && maTextData.mxString.is() )
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( &rSdrObj );
+ if( pTextObj && maScPos.IsValid() )
{
- SCCOL nScCol = maScPos.Col();
- SCROW nScRow = maScPos.Row();
- SCTAB nScTab = GetScTab();
- bool bVisible = ::get_flag( mnNoteFlags, EXC_NOTE_VISIBLE );
-
- // create the note object
- ::std::auto_ptr< EditTextObject > pEditObj(
- XclImpStringHelper::CreateNoteObject( GetRoot(), *maTextData.mxString ) );
- // ScPostIt does not take ownership of the passed note
- ScPostIt aNote( pEditObj.get(), GetDocPtr() );
- aNote.SetRectangle( rSdrObj.GetSnapRect() );
- aNote.SetShown( bVisible );
-
- // get the actual container from this group object
- SdrObject* pBoxSdrObj = &rSdrObj;
- if( rSdrObj.IsGroupObject() && rSdrObj.GetSubList() )
- {
- SdrObjListIter aIt( *rSdrObj.GetSubList() );
- pBoxSdrObj = aIt.Next();
- }
-
- // set textbox properties
- if( pBoxSdrObj )
- {
- XclImpTextObj::DoProcessSdrObj( *pBoxSdrObj );
- pBoxSdrObj->SetMergedItem( SdrTextAutoGrowWidthItem( FALSE ) );
- pBoxSdrObj->SetMergedItem( SdrTextAutoGrowHeightItem( FALSE ) );
- aNote.SetAndApplyItemSet( pBoxSdrObj->GetMergedItemSet() );
- }
-
- // insert the note into the document
- GetDoc().SetNote( nScCol, nScRow, nScTab, aNote );
-
- // make the note visible via ScDetectiveFunc
- if( bVisible )
+ if( ScPostIt* pNote = GetDoc().GetOrCreateNote( maScPos ) )
{
- ScDetectiveFunc aDetFunc( GetDocPtr(), nScTab );
- aDetFunc.ShowComment( nScCol, nScRow, TRUE );
+ if( SdrCaptionObj* pCaption = pNote->GetCaption() )
+ {
+ // create formatted text
+ XclImpTextObj::DoProcessSdrObj( *pCaption );
+ // set textbox rectangle from imported object
+ pCaption->NbcSetLogicRect( pTextObj->GetLogicRect() );
+ // copy all items from imported object (resets shadow items)
+ pNote->SetCaptionItems( pTextObj->GetMergedItemSet() );
+ // move caption to correct layer (visible/hidden)
+ pNote->ShowCaption( ::get_flag( mnNoteFlags, EXC_NOTE_VISIBLE ) );
+ }
}
}
}
@@ -3003,18 +2978,39 @@ void XclImpSolverContainer::UpdateConnection( sal_uInt32 nDffShapeId, SdrObject*
// ----------------------------------------------------------------------------
+XclImpSimpleDffManager::XclImpSimpleDffManager( const XclImpRoot& rRoot, SvStream& rDffStrm ) :
+ SvxMSDffManager( rDffStrm, rRoot.GetBasePath(), 0, 0, rRoot.GetDoc().GetDrawLayer(), 1440, COL_DEFAULT, 24, 0, &rRoot.GetTracer().GetBaseTracer() ),
+ XclImpRoot( rRoot )
+{
+ SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS | SVXMSDFF_SETTINGS_IMPORT_EXCEL | SVXMSDFF_SETTINGS_IMPORT_IAS );
+}
+
+XclImpSimpleDffManager::~XclImpSimpleDffManager()
+{
+}
+
+FASTBOOL XclImpSimpleDffManager::GetColorFromPalette( USHORT nIndex, Color& rColor ) const
+{
+ ColorData nColor = GetPalette().GetColorData( static_cast< sal_uInt16 >( nIndex ) );
+
+ if( nColor == COL_AUTO )
+ return FALSE;
+
+ rColor.SetColor( nColor );
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+
XclImpDffManager::XclImpDffManager(
const XclImpRoot& rRoot, XclImpObjectManager& rObjManager, SvStream& rDffStrm ) :
- SvxMSDffManager( rDffStrm, rRoot.GetBasePath(), 0, 0, rRoot.GetDoc().GetDrawLayer(), 1440, COL_DEFAULT, 24, 0, &rRoot.GetTracer().GetBaseTracer() ),
+ XclImpSimpleDffManager( rRoot, rDffStrm ),
SvxMSConvertOCXControls( rRoot.GetDocShell(), 0 ),
- XclImpRoot( rRoot ),
mrObjManager( rObjManager ),
mnOleImpFlags( 0 ),
mnLastCtrlIndex( -1 ),
mnCurrFormScTab( -1 )
{
- SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS | SVXMSDFF_SETTINGS_IMPORT_EXCEL | SVXMSDFF_SETTINGS_IMPORT_IAS );
-
if( SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get() )
{
if( pFilterOpt->IsMathType2Math() )
@@ -3293,17 +3289,6 @@ ULONG XclImpDffManager::Calc_nBLIPPos( ULONG /*nOrgVal*/, ULONG nStreamPos ) con
return nStreamPos + 4;
}
-FASTBOOL XclImpDffManager::GetColorFromPalette( USHORT nIndex, Color& rColor ) const
-{
- ColorData nColor = GetPalette().GetColorData( static_cast< sal_uInt16 >( nIndex ) );
-
- if( nColor == COL_AUTO )
- return FALSE;
-
- rColor.SetColor( nColor );
- return TRUE;
-}
-
sal_Bool XclImpDffManager::InsertControl( const Reference< XFormComponent >& rxFormComp,
const ::com::sun::star::awt::Size& /*rSize*/, Reference< XShape >* pxShape,
BOOL /*bFloatingCtrl*/ )
@@ -3912,8 +3897,7 @@ void XclImpObjectManager::ReadNote3( XclImpStream& rStrm )
nTotalLen = 0;
}
}
- ScPostIt aScNote( aNoteText, GetDocPtr() );
- GetDoc().SetNote( aScNotePos.Col(), aScNotePos.Row(), aScNotePos.Tab(), aScNote );
+ ScNoteUtil::CreateNoteFromString( GetDoc(), aScNotePos, aNoteText, false );
}
}
@@ -3943,7 +3927,7 @@ sal_Size XclImpObjectManager::GetProgressSize() const
XclImpDffPropSet::XclImpDffPropSet( const XclImpRoot& rRoot ) :
XclImpRoot( rRoot ),
- maDffManager( maDummyStrm, rRoot.GetBasePath(), 0, 0, rRoot.GetDoc().GetDrawLayer(), 1440, COL_DEFAULT, 24, 0, &rRoot.GetTracer().GetBaseTracer() )
+ maDffManager( rRoot, maDummyStrm )
{
}
diff --git a/sc/source/filter/inc/xeescher.hxx b/sc/source/filter/inc/xeescher.hxx
index cbbad6ea71a3..1acb7ac08892 100644
--- a/sc/source/filter/inc/xeescher.hxx
+++ b/sc/source/filter/inc/xeescher.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xeescher.hxx,v $
- * $Revision: 1.10.90.4 $
+ * $Revision: 1.10.128.1 $
*
* This file is part of OpenOffice.org.
*
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index 68b5291bdc0e..5fd785992ae4 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -957,13 +957,29 @@ private:
// ----------------------------------------------------------------------------
+/** Simple implementation of the SVX DFF manager. Implements resolving palette
+ colors. Used by XclImpDffPropSet (as is), extended by XclImpDffManager.
+ */
+class XclImpSimpleDffManager : public SvxMSDffManager, protected XclImpRoot
+{
+public:
+ explicit XclImpSimpleDffManager( const XclImpRoot& rRoot, SvStream& rDffStrm );
+ virtual ~XclImpSimpleDffManager();
+
+protected:
+ /** Returns a color from the Excel color palette. */
+ virtual FASTBOOL GetColorFromPalette( USHORT nIndex, Color& rColor ) const;
+};
+
+// ----------------------------------------------------------------------------
+
class XclImpObjectManager;
class SdrObjList;
/** Derived from SvxMSDffManager and SvxMSConvertOCXControls, contains core
implementation of DFF stream import and OCX form control import.
*/
-class XclImpDffManager : protected SvxMSDffManager, protected SvxMSConvertOCXControls, protected XclImpRoot
+class XclImpDffManager : protected XclImpSimpleDffManager, protected SvxMSConvertOCXControls
{
public:
explicit XclImpDffManager(
@@ -1010,8 +1026,6 @@ protected:
SdrObject* pOldSdrObj = 0 );
/** Returns the BLIP stream position, based on the passed DFF stream position. */
virtual ULONG Calc_nBLIPPos( ULONG nOrgVal, ULONG nStreamPos ) const;
- /** Returns a color from the Excel color palette. */
- virtual FASTBOOL GetColorFromPalette( USHORT nIndex, Color& rColor ) const;
// virtual functions of SvxMSConvertOCXControls
@@ -1187,7 +1201,7 @@ private:
typedef ::std::auto_ptr< SvMemoryStream > SvMemoryStreamPtr;
SvMemoryStream maDummyStrm; /// Dummy stream for DFF manager.
- SvxMSDffManager maDffManager; /// DFF manager.
+ XclImpSimpleDffManager maDffManager;/// DFF manager used to resolve palette colors.
SvMemoryStreamPtr mxMemStrm; /// Helper stream.
};
diff --git a/sc/source/filter/lotus/expop.cxx b/sc/source/filter/lotus/expop.cxx
index 137659451bb3..8aabf12099a4 100644
--- a/sc/source/filter/lotus/expop.cxx
+++ b/sc/source/filter/lotus/expop.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: expop.cxx,v $
- * $Revision: 1.7.32.2 $
+ * $Revision: 1.7.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -399,7 +399,6 @@ FltError ExportWK1::Write()
break;
case CELLTYPE_NOTE:
case CELLTYPE_NONE:
- case CELLTYPE_DESTROYED:
break;
default:
DBG_ASSERT( FALSE, "ExportWK1::Write(): unbekannter Celltype!" );
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 6ab56fbdce6a..dab66815947e 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: op.cxx,v $
- * $Revision: 1.19 $
+ * $Revision: 1.18.126.4 $
*
* This file is part of OpenOffice.org.
*
@@ -462,12 +462,11 @@ void OP_Note123( SvStream& r, UINT16 n)
r.Read( pText, n );
pText[ n ] = 0;
- String aTmp(pText,pLotusRoot->eCharsetQ);
- ScPostIt *pNote = new ScPostIt(aTmp, pLotusRoot->pDoc);
-
- pDoc->SetNote( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), *pNote ) ;
-
+ String aNoteText(pText,pLotusRoot->eCharsetQ);
delete [] pText;
+
+ ScAddress aPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab) );
+ ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false );
}
void OP_HorAlign123( BYTE nAlignPattern, SfxItemSet& rPatternItemSet )
diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index bbbae5e89d5f..511c706abdfb 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: scflt.cxx,v $
- * $Revision: 1.25.30.2 $
+ * $Revision: 1.25.124.3 $
*
* This file is part of OpenOffice.org.
*
@@ -1707,10 +1707,10 @@ void Sc10Import::LoadCol(SCCOL Col, SCTAB Tab)
sal_Char* pNote = new sal_Char[NoteLen+1];
rStream.Read(pNote, NoteLen);
pNote[NoteLen] = 0;
- String aText( SC10TOSTRING(pNote));
- ScPostIt aNote(aText, pDoc);
- pDoc->SetNote(Col, static_cast<SCROW> (Row), Tab, aNote );
+ String aNoteText( SC10TOSTRING(pNote));
delete [] pNote;
+ ScAddress aPos( Col, static_cast<SCROW>(Row), Tab );
+ ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false );
}
}
pPrgrsBar->Progress();
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index fb5188e994b0..e618e5d91fd5 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xcl97esc.cxx,v $
- * $Revision: 1.26.90.3 $
+ * $Revision: 1.26.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -196,7 +196,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen
aStack.Push( pCurrXclObj );
aStack.Push( pCurrAppData );
pCurrAppData = new XclEscherHostAppData;
- const SdrObject* pObj = GetSdrObject( rShape );
+ SdrObject* pObj = GetSdrObjectFromXShape( rShape );
if ( !pObj )
pCurrXclObj = new XclObjAny( GetRoot() ); // just what is it?!?
else
@@ -228,7 +228,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen
if( !pCurrXclObj )
pCurrXclObj = new XclObjAny( GetRoot() ); // just a metafile
}
- else if( pObj->GetLayer() != SC_LAYER_INTERN )
+ else if( !ScDrawLayer::IsNoteCaption( pObj ) )
{
// #107540# ignore permanent note shapes
// #i12190# do not ignore callouts (do not filter by object type ID)
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index aec80af1bc8a..defb3402211d 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLChangeTrackingImportHelper.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.30.52.2 $
*
* This file is part of OpenOffice.org.
*
@@ -104,10 +104,7 @@ ScBaseCell* ScMyCellInfo::CreateCell(ScDocument* pDoc)
}
}
- if (pCell)
- return pCell->Clone(pDoc);
- else
- return NULL;
+ return pCell ? pCell->CloneWithoutNote( *pDoc ) : 0;
}
ScMyDeleted::ScMyDeleted()
@@ -688,7 +685,7 @@ void ScXMLChangeTrackingImportHelper::SetContentDependencies(ScMyContentAction*
const ScBaseCell* pOldCell = pActContent->GetOldCell();
if (pOldCell)
{
- ScBaseCell* pNewCell = pOldCell->Clone(pDoc);
+ ScBaseCell* pNewCell = pOldCell->CloneWithoutNote( *pDoc );
if (pNewCell)
{
pPrevActContent->SetNewCell(pNewCell, pDoc, EMPTY_STRING);
@@ -780,7 +777,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(ScMyContentAction* pAction)
{
ScBaseCell* pNewCell = NULL;
if (pCell->GetCellType() != CELLTYPE_FORMULA)
- pNewCell = pCell->Clone(pDoc);
+ pNewCell = pCell->CloneWithoutNote( *pDoc );
else
{
sal_uInt8 nMatrixFlag = static_cast<ScFormulaCell*>(pCell)->GetMatrixFlag();
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 1de87a103ffa..66e75857dea2 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmlcelli.cxx,v $
- * $Revision: 1.96.134.1 $
+ * $Revision: 1.96.128.4 $
*
* This file is part of OpenOffice.org.
*
@@ -65,7 +65,9 @@
#include <xmloff/numehelp.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <svtools/zforlist.hxx>
+#include <svx/svdocapt.hxx>
#include <svx/outlobj.hxx>
+#include <svx/editobj.hxx>
#include <svtools/languageoptions.hxx>
#include <com/sun/star/frame/XModel.hpp>
@@ -632,53 +634,36 @@ void ScXMLTableRowCellContext::SetAnnotation(const table::CellAddress& aCellAddr
Color* pColor = NULL;
Color** ppColor = &pColor;
pNumForm->GetOutputString(fDate, nfIndex, sDate, ppColor);
- ScPostIt aNote(String(pMyAnnotation->sText),pDoc);
- aNote.SetDate(sDate);
- aNote.SetAuthor(String(pMyAnnotation->sAuthor));
- aNote.SetShown(pMyAnnotation->bDisplay);
- if (pMyAnnotation->pRect)
- aNote.SetRectangle(*pMyAnnotation->pRect);
- else
- rXMLImport.AddDefaultNote(aCellAddress);
- if (pMyAnnotation->pItemSet)
- aNote.SetItemSet(*(pMyAnnotation->pItemSet));
- else
- aNote.SetItemSet(aNote.DefaultItemSet());
- if ( pMyAnnotation->pOPO )
+
+ ScAddress aPos;
+ ScUnoConversion::FillScAddress( aPos, aCellAddress );
+ if( ScPostIt* pNote = pDoc->GetOrCreateNote( aPos ) )
{
- ScNoteEditEngine& aEngine = pDoc->GetNoteEngine();
- aEngine.SetText(pMyAnnotation->pOPO->GetTextObject());
- // No ItemSet and Rectangle indicates notes with simple text.
- // i.e. created with calc 1.x sxc file format
- if (pMyAnnotation->pItemSet && pMyAnnotation->pRect)
+ pNote->SetDate( sDate );
+ pNote->SetAuthor( pMyAnnotation->sAuthor );
+ if( SdrCaptionObj* pCaption = pNote->GetCaption() )
{
- const EditTextObject& rTextObj = pMyAnnotation->pOPO->GetTextObject();
- sal_uInt16 nCount = aEngine.GetParagraphCount();
- for( sal_uInt16 nPara = 0; nPara < nCount; ++nPara )
+ if( pMyAnnotation->pOPO )
+ pCaption->SetOutlinerParaObject( pMyAnnotation->pOPO->Clone() );
+ else
+ pCaption->SetText( pMyAnnotation->sText );
+ // copy all items and reset shadow items
+ if( pMyAnnotation->pItemSet )
+ pNote->SetCaptionItems( *pMyAnnotation->pItemSet );
+ else
+ pNote->SetCaptionDefaultItems(); // default items need to be applied to text
+ if( pMyAnnotation->pRect )
+ pCaption->SetLogicRect( *pMyAnnotation->pRect );
+
+ uno::Reference<container::XIndexAccess> xShapesIndex (rXMLImport.GetTables().GetCurrentXShapes(), uno::UNO_QUERY); // make draw page
+ if (xShapesIndex.is())
{
- SfxItemSet aSet( rTextObj.GetParaAttribs( nPara));
- aEngine.SetParaAttribs(nPara, aSet);
+ sal_Int32 nShapes = xShapesIndex->getCount();
+ uno::Reference < drawing::XShape > xShape;
+ rXMLImport.GetShapeImport()->shapeWithZIndexAdded(xShape, nShapes);
}
}
- ::std::auto_ptr< EditTextObject > pEditText( aEngine.CreateTextObject());
- aNote.SetEditTextObject(pEditText.get()); // if pEditText is NULL, then aNote.mpEditObj will be reset().
- }
- if (pMyAnnotation->pRect)
- aNote.SetRectangle(*pMyAnnotation->pRect);
- else
- aNote.SetRectangle(aNote.MimicOldRectangle(ScAddress(static_cast<SCCOL>(aCellAddress.Column), static_cast<SCROW>(aCellAddress.Row), aCellAddress.Sheet)));
- pDoc->SetNote(static_cast<SCCOL>(aCellAddress.Column), static_cast<SCROW>(aCellAddress.Row), aCellAddress.Sheet, aNote);
- }
- if (pMyAnnotation->bDisplay)
- {
- ScDetectiveFunc aDetFunc(pDoc, aCellAddress.Sheet);
- aDetFunc.ShowComment(static_cast<SCCOL>(aCellAddress.Column), static_cast<SCROW>(aCellAddress.Row), sal_False);
- uno::Reference<container::XIndexAccess> xShapesIndex (rXMLImport.GetTables().GetCurrentXShapes(), uno::UNO_QUERY); // make draw page
- if (xShapesIndex.is())
- {
- sal_Int32 nShapes = xShapesIndex->getCount();
- uno::Reference < drawing::XShape > xShape;
- rXMLImport.GetShapeImport()->shapeWithZIndexAdded(xShape, nShapes);
+ pNote->ShowCaption( pMyAnnotation->bDisplay );
}
}
}
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 14d7fdb9786f..67b619a15ed3 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmlcelli.hxx,v $
- * $Revision: 1.26 $
+ * $Revision: 1.26.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -60,7 +60,7 @@ struct ScMyImportAnnotation
SfxItemSet* pItemSet;
OutlinerParaObject* pOPO;
- ScMyImportAnnotation() : pRect(NULL), pItemSet(NULL), pOPO(NULL) {}
+ ScMyImportAnnotation() : bDisplay(sal_False), pRect(NULL), pItemSet(NULL), pOPO(NULL) {}
~ScMyImportAnnotation();
};
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 4547d2f50f1a..4356bc423a07 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmlexprt.cxx,v $
- * $Revision: 1.212.28.3 $
+ * $Revision: 1.213.94.6 $
*
* This file is part of OpenOffice.org.
*
@@ -92,6 +92,7 @@
#include <svx/svdocapt.hxx>
#include <svx/outlobj.hxx>
#include <svx/svditer.hxx>
+#include <svx/svdpage.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/sheet/XUsedAreaCursor.hpp>
@@ -593,7 +594,7 @@ void ScXMLExport::CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCo
sal_Int16 nLayerID = 0;
if( xShapeProp->getPropertyValue(sLayerID) >>= nLayerID )
{
- if( nLayerID == SC_LAYER_INTERN )
+ if( (nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN) )
CollectInternalShape( xShape );
else
{
@@ -677,39 +678,6 @@ void ScXMLExport::CollectShapesAutoStyles(const sal_Int32 nTableCount)
uno::Reference<drawing::XDrawPage> xDrawPage(pSharedData->GetDrawPage(nTable));
uno::Reference<drawing::XShapes> xShapes (xDrawPage, uno::UNO_QUERY);
- uno::Reference<drawing::XShapes> xNoteShapes;
- ::std::vector < uno::Reference < drawing::XShape > > aNoteShapes;
- ScCellIterator aCellIter( pDoc, 0,0, nTable, MAXCOL,MAXROW, nTable );
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell)
- {
- const ScPostIt* pScNote = pCell->GetNotePtr();
- if (pScNote && !pScNote->IsShown())
- {
- const SfxItemSet& rSet = pScNote->GetItemSet();
-
- // In order to transform the SfxItemSet to an EscherPropertyContainer
- // and export the properties, we need to recreate the drawing object and
- // pass this to XclObjComment() for processing.
- SdrCaptionObj* pCaption = new SdrCaptionObj( pScNote->GetRectangle() );
- pCaption->SetMergedItemSet(rSet);
-
- if(const EditTextObject* pEditText = pScNote->GetEditTextObject())
- {
- OutlinerParaObject* pOPO = new OutlinerParaObject( *pEditText );
- pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT );
- pCaption->NbcSetOutlinerParaObject( pOPO );
- }
-
- pScNote->InsertObject(pCaption, *pDoc, aCellIter.GetTab(), sal_False);
-
- uno::Reference<drawing::XShape> xShape(pCaption->getUnoShape(), uno::UNO_QUERY);
- if (xShape.is())
- pSharedData->AddNoteObj(xShape, ScAddress(aCellIter.GetCol(), aCellIter.GetRow(), aCellIter.GetTab()));
- }
- pCell = aCellIter.GetNext();
- }
-
if (xShapes.is())
{
GetShapeExport()->seekShapes(xShapes);
@@ -1645,8 +1613,6 @@ void ScXMLExport::_ExportContent()
nEqualCells = 0;
}
}
- RemoveTempAnnotaionShape(nTable);
-
IncrementProgressBar(sal_False);
}
}
@@ -2099,27 +2065,23 @@ void ScXMLExport::_ExportMasterStyles()
void ScXMLExport::CollectInternalShape( uno::Reference< drawing::XShape > xShape )
{
// detective objects and notes
- SvxShape* pShapeImp(SvxShape::getImplementation( xShape ));
- if( pShapeImp )
+ if( SvxShape* pShapeImp = SvxShape::getImplementation( xShape ) )
{
- SdrObject *pObject(pShapeImp->GetSdrObject());
- if( pObject )
+ if( SdrObject* pObject = pShapeImp->GetSdrObject() )
{
- if (pObject->ISA( SdrCaptionObj ))
+ // collect note caption objects from all layers (internal or hidden)
+ if( ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObject, static_cast< SCTAB >( nCurrentTable ) ) )
{
- ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObject, static_cast<SCTAB>(nCurrentTable) );
- if (pData)
- {
- pSharedData->AddNoteObj(xShape, pData->aStt);
+ pSharedData->AddNoteObj( xShape, pCaptData->maStart );
- // #i60851# When the file is saved while editing a new note,
- // the cell is still empty -> last column/row must be updated
- DBG_ASSERT( pData->aStt.Tab() == nCurrentTable, "invalid table in object data" );
- pSharedData->SetLastColumn( nCurrentTable, pData->aStt.Col() );
- pSharedData->SetLastRow( nCurrentTable, pData->aStt.Row() );
- }
+ // #i60851# When the file is saved while editing a new note,
+ // the cell is still empty -> last column/row must be updated
+ DBG_ASSERT( pCaptData->maStart.Tab() == nCurrentTable, "invalid table in object data" );
+ pSharedData->SetLastColumn( nCurrentTable, pCaptData->maStart.Col() );
+ pSharedData->SetLastRow( nCurrentTable, pCaptData->maStart.Row() );
}
- else
+ // other objects from internal layer only (detective)
+ else if( pObject->GetLayer() == SC_LAYER_INTERN )
{
ScDetectiveFunc aDetFunc( pDoc, static_cast<SCTAB>(nCurrentTable) );
ScAddress aPosition;
@@ -2814,30 +2776,6 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell)
}
}
-void ScXMLExport::RemoveTempAnnotaionShape(const sal_Int32 nTable)
-{
- if (pDoc)
- {
- SdrPage* pPage = NULL;
- ScDrawLayer* pDrawModel = pDoc->GetDrawLayer();
- if(pDrawModel)
- pPage = pDrawModel->GetPage(sal::static_int_cast<sal_uInt16>(nTable));
- if(pPage)
- {
- SdrObjListIter aIter( *pPage, IM_FLAT );
- while (aIter.IsMore())
- {
- SdrObject* pObject = aIter.Next();
- if (pObject->GetLayer() == SC_LAYER_HIDDEN)
- {
- pPage->RemoveObject(pObject->GetOrdNum());
- SdrObject::Free( pObject );
- }
- }
- }
- }
-}
-
void ScXMLExport::WriteDetective( const ScMyCell& rMyCell )
{
if( rMyCell.bHasDetectiveObj || rMyCell.bHasDetectiveOp )
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 1d8e45dc48b6..0ed10a5ae476 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmlexprt.hxx,v $
- * $Revision: 1.83.32.3 $
+ * $Revision: 1.84.52.1 $
*
* This file is part of OpenOffice.org.
*
@@ -180,7 +180,6 @@ class ScXMLExport : public SvXMLExport
void WriteCell (ScMyCell& aCell);
void WriteAreaLink(const ScMyCell& rMyCell);
void WriteAnnotation(ScMyCell& rMyCell);
- void RemoveTempAnnotaionShape(const sal_Int32 nTable);
void WriteDetective(const ScMyCell& rMyCell);
void ExportShape(const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape, com::sun::star::awt::Point* pPoint);
void WriteShapes(const ScMyCell& rMyCell);
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 927dd3e74cf0..cd4aeac452b2 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -442,6 +442,7 @@ const SvXMLTokenMap& ScXMLImport::GetDocElemTokenMap()
return *pDocElemTokenMap;
}
+
const SvXMLTokenMap& ScXMLImport::GetBodyElemTokenMap()
{
if( !pBodyElemTokenMap )
@@ -1604,106 +1605,105 @@ SvXMLImportContext *ScXMLImport::CreateContext( USHORT nPrefix,
// #110680#
ScXMLImport::ScXMLImport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const sal_uInt16 nImportFlag)
- : SvXMLImport( xServiceFactory, nImportFlag ),
- pDoc( NULL ),
- pChangeTrackingImportHelper(NULL),
- pStylesImportHelper(NULL),
- sNumberFormat(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT)),
- sLocale(RTL_CONSTASCII_USTRINGPARAM(SC_LOCALE)),
- sCellStyle(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLSTYL)),
- sStandardFormat(RTL_CONSTASCII_USTRINGPARAM(SC_STANDARDFORMAT)),
- sType(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_TYPE)),
- // pScAutoStylePool(new SvXMLAutoStylePoolP),
- // pParaItemMapper( 0 ),
- // pI18NMap( new SvI18NMap ),
- pDocElemTokenMap( 0 ),
- pStylesElemTokenMap( 0 ),
- pStylesAttrTokenMap( 0 ),
- pStyleElemTokenMap( 0 ),
- pBodyElemTokenMap( 0 ),
- pContentValidationsElemTokenMap( 0 ),
- pContentValidationElemTokenMap( 0 ),
- pContentValidationAttrTokenMap( 0 ),
- pContentValidationMessageElemTokenMap( 0 ),
- pContentValidationHelpMessageAttrTokenMap( 0 ),
- pContentValidationErrorMessageAttrTokenMap( 0 ),
- pContentValidationErrorMacroAttrTokenMap( 0 ),
- pLabelRangesElemTokenMap( 0 ),
- pLabelRangeAttrTokenMap( 0 ),
- pTableElemTokenMap( 0 ),
- pTableRowsElemTokenMap( 0 ),
- pTableColsElemTokenMap( 0 ),
- pTableScenarioAttrTokenMap( 0 ),
- pTableAttrTokenMap( 0 ),
- pTableColAttrTokenMap( 0 ),
- pTableRowElemTokenMap( 0 ),
- pTableRowAttrTokenMap( 0 ),
- pTableRowCellElemTokenMap( 0 ),
- pTableRowCellAttrTokenMap( 0 ),
- pTableAnnotationAttrTokenMap( 0 ),
- pDetectiveElemTokenMap( 0 ),
- pDetectiveHighlightedAttrTokenMap( 0 ),
- pDetectiveOperationAttrTokenMap( 0 ),
- pTableCellRangeSourceAttrTokenMap( 0 ),
- pNamedExpressionsElemTokenMap( 0 ),
- pNamedRangeAttrTokenMap( 0 ),
- pNamedExpressionAttrTokenMap( 0 ),
- pDatabaseRangesElemTokenMap( 0 ),
- pDatabaseRangeElemTokenMap( 0 ),
- pDatabaseRangeAttrTokenMap( 0 ),
- pDatabaseRangeSourceSQLAttrTokenMap( 0 ),
- pDatabaseRangeSourceTableAttrTokenMap( 0 ),
- pDatabaseRangeSourceQueryAttrTokenMap( 0 ),
- pFilterElemTokenMap( 0 ),
- pFilterAttrTokenMap( 0 ),
- pFilterConditionAttrTokenMap( 0 ),
- pSortElemTokenMap( 0 ),
- pSortAttrTokenMap( 0 ),
- pSortSortByAttrTokenMap( 0 ),
- pDatabaseRangeSubTotalRulesElemTokenMap( 0 ),
- pDatabaseRangeSubTotalRulesAttrTokenMap( 0 ),
- pSubTotalRulesSortGroupsAttrTokenMap( 0 ),
- pSubTotalRulesSubTotalRuleElemTokenMap( 0 ),
- pSubTotalRulesSubTotalRuleAttrTokenMap( 0 ),
- pSubTotalRuleSubTotalFieldAttrTokenMap( 0 ),
- pDataPilotTablesElemTokenMap( 0 ),
- pDataPilotTableAttrTokenMap( 0 ),
- pDataPilotTableElemTokenMap( 0 ),
- pDataPilotTableSourceServiceAttrTokenMap( 0 ),
- pDataPilotTableSourceCellRangeElemTokenMap( 0 ),
- pDataPilotTableSourceCellRangeAttrTokenMap( 0 ),
- pDataPilotFieldAttrTokenMap( 0 ),
- pDataPilotFieldElemTokenMap( 0 ),
- pDataPilotLevelAttrTokenMap( 0 ),
- pDataPilotLevelElemTokenMap( 0 ),
- pDataPilotSubTotalsElemTokenMap( 0 ),
- pDataPilotSubTotalAttrTokenMap( 0 ),
- pDataPilotMembersElemTokenMap( 0 ),
- pDataPilotMemberAttrTokenMap( 0 ),
- pConsolidationAttrTokenMap( 0 ),
- aTables(*this),
- pMyNamedExpressions(NULL),
- pMyLabelRanges(NULL),
- pValidations(NULL),
- pDetectiveOpArray(NULL),
- pDefaultNotes(NULL),
- pScUnoGuard(NULL),
- pNumberFormatAttributesExportHelper(NULL),
- pStyleNumberFormats(NULL),
- sPrevStyleName(),
- sPrevCurrency(),
- nSolarMutexLocked(0),
- nProgressCount(0),
- nStyleFamilyMask( 0 ),
- nPrevCellType(0),
- bLoadDoc( sal_True ),
- bRemoveLastChar(sal_False),
- bNullDateSetted(sal_False),
- bSelfImportingXMLSet(sal_False),
- bLatinDefaultStyle(sal_False),
- bFromWrapper(sal_False)
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const sal_uInt16 nImportFlag)
+: SvXMLImport( xServiceFactory, nImportFlag ),
+ pDoc( NULL ),
+ pChangeTrackingImportHelper(NULL),
+ pStylesImportHelper(NULL),
+ sNumberFormat(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT)),
+ sLocale(RTL_CONSTASCII_USTRINGPARAM(SC_LOCALE)),
+ sCellStyle(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLSTYL)),
+ sStandardFormat(RTL_CONSTASCII_USTRINGPARAM(SC_STANDARDFORMAT)),
+ sType(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_TYPE)),
+// pScAutoStylePool(new SvXMLAutoStylePoolP),
+// pParaItemMapper( 0 ),
+// pI18NMap( new SvI18NMap ),
+ pDocElemTokenMap( 0 ),
+ pStylesElemTokenMap( 0 ),
+ pStylesAttrTokenMap( 0 ),
+ pStyleElemTokenMap( 0 ),
+ pBodyElemTokenMap( 0 ),
+ pContentValidationsElemTokenMap( 0 ),
+ pContentValidationElemTokenMap( 0 ),
+ pContentValidationAttrTokenMap( 0 ),
+ pContentValidationMessageElemTokenMap( 0 ),
+ pContentValidationHelpMessageAttrTokenMap( 0 ),
+ pContentValidationErrorMessageAttrTokenMap( 0 ),
+ pContentValidationErrorMacroAttrTokenMap( 0 ),
+ pLabelRangesElemTokenMap( 0 ),
+ pLabelRangeAttrTokenMap( 0 ),
+ pTableElemTokenMap( 0 ),
+ pTableRowsElemTokenMap( 0 ),
+ pTableColsElemTokenMap( 0 ),
+ pTableScenarioAttrTokenMap( 0 ),
+ pTableAttrTokenMap( 0 ),
+ pTableColAttrTokenMap( 0 ),
+ pTableRowElemTokenMap( 0 ),
+ pTableRowAttrTokenMap( 0 ),
+ pTableRowCellElemTokenMap( 0 ),
+ pTableRowCellAttrTokenMap( 0 ),
+ pTableAnnotationAttrTokenMap( 0 ),
+ pDetectiveElemTokenMap( 0 ),
+ pDetectiveHighlightedAttrTokenMap( 0 ),
+ pDetectiveOperationAttrTokenMap( 0 ),
+ pTableCellRangeSourceAttrTokenMap( 0 ),
+ pNamedExpressionsElemTokenMap( 0 ),
+ pNamedRangeAttrTokenMap( 0 ),
+ pNamedExpressionAttrTokenMap( 0 ),
+ pDatabaseRangesElemTokenMap( 0 ),
+ pDatabaseRangeElemTokenMap( 0 ),
+ pDatabaseRangeAttrTokenMap( 0 ),
+ pDatabaseRangeSourceSQLAttrTokenMap( 0 ),
+ pDatabaseRangeSourceTableAttrTokenMap( 0 ),
+ pDatabaseRangeSourceQueryAttrTokenMap( 0 ),
+ pFilterElemTokenMap( 0 ),
+ pFilterAttrTokenMap( 0 ),
+ pFilterConditionAttrTokenMap( 0 ),
+ pSortElemTokenMap( 0 ),
+ pSortAttrTokenMap( 0 ),
+ pSortSortByAttrTokenMap( 0 ),
+ pDatabaseRangeSubTotalRulesElemTokenMap( 0 ),
+ pDatabaseRangeSubTotalRulesAttrTokenMap( 0 ),
+ pSubTotalRulesSortGroupsAttrTokenMap( 0 ),
+ pSubTotalRulesSubTotalRuleElemTokenMap( 0 ),
+ pSubTotalRulesSubTotalRuleAttrTokenMap( 0 ),
+ pSubTotalRuleSubTotalFieldAttrTokenMap( 0 ),
+ pDataPilotTablesElemTokenMap( 0 ),
+ pDataPilotTableAttrTokenMap( 0 ),
+ pDataPilotTableElemTokenMap( 0 ),
+ pDataPilotTableSourceServiceAttrTokenMap( 0 ),
+ pDataPilotTableSourceCellRangeElemTokenMap( 0 ),
+ pDataPilotTableSourceCellRangeAttrTokenMap( 0 ),
+ pDataPilotFieldAttrTokenMap( 0 ),
+ pDataPilotFieldElemTokenMap( 0 ),
+ pDataPilotLevelAttrTokenMap( 0 ),
+ pDataPilotLevelElemTokenMap( 0 ),
+ pDataPilotSubTotalsElemTokenMap( 0 ),
+ pDataPilotSubTotalAttrTokenMap( 0 ),
+ pDataPilotMembersElemTokenMap( 0 ),
+ pDataPilotMemberAttrTokenMap( 0 ),
+ pConsolidationAttrTokenMap( 0 ),
+ aTables(*this),
+ pMyNamedExpressions(NULL),
+ pMyLabelRanges(NULL),
+ pValidations(NULL),
+ pDetectiveOpArray(NULL),
+ pScUnoGuard(NULL),
+ pNumberFormatAttributesExportHelper(NULL),
+ pStyleNumberFormats(NULL),
+ sPrevStyleName(),
+ sPrevCurrency(),
+ nSolarMutexLocked(0),
+ nProgressCount(0),
+ nStyleFamilyMask( 0 ),
+ nPrevCellType(0),
+ bLoadDoc( sal_True ),
+ bRemoveLastChar(sal_False),
+ bNullDateSetted(sal_False),
+ bSelfImportingXMLSet(sal_False),
+ bLatinDefaultStyle(sal_False),
+ bFromWrapper(sal_False)
{
pStylesImportHelper = new ScMyStylesImportHelper(*this);
@@ -1828,8 +1828,6 @@ ScXMLImport::~ScXMLImport() throw()
delete pMyLabelRanges;
if (pValidations)
delete pValidations;
- if (pDefaultNotes)
- delete pDefaultNotes;
if (pDetectiveOpArray)
delete pDetectiveOpArray;
}
@@ -2772,8 +2770,6 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE
pDoc->CompileXML();
aTables.UpdateRowHeights();
aTables.ResizeShapes();
-
- SetDefaultNotes();
}
if (GetModel().is())
{
@@ -2791,33 +2787,6 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE
UnlockSolarMutex();
}
-void ScXMLImport::AddDefaultNote(const table::CellAddress& aCell)
-{
- if (!pDefaultNotes)
- pDefaultNotes = new ScMyDefaultNotes();
-
- pDefaultNotes->push_back(aCell);
-}
-
-void ScXMLImport::SetDefaultNotes()
-{
- if (pDefaultNotes && pDoc)
- {
- ScMyDefaultNotes::iterator aItr(pDefaultNotes->begin());
- ScMyDefaultNotes::iterator aEndItr(pDefaultNotes->end());
- ScPostIt aNote(pDoc);
- while(aItr != aEndItr)
- {
- if (pDoc->GetNote(static_cast<SCCOL>(aItr->Column), static_cast<SCROW>(aItr->Row), aItr->Sheet, aNote))
- {
- aNote.SetRectangle(aNote.MimicOldRectangle(ScAddress(static_cast<SCCOL>(aItr->Column), static_cast<SCROW>(aItr->Row), aItr->Sheet)));
- pDoc->SetNote(static_cast<SCCOL>(aItr->Column), static_cast<SCROW>(aItr->Row), aItr->Sheet, aNote);
- }
- ++aItr;
- }
- }
-}
-
// XEventListener
void ScXMLImport::DisposingModel()
{
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index bf5f263d1875..052ef20c6022 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmlimprt.hxx,v $
- * $Revision: 1.96.32.3 $
+ * $Revision: 1.97.52.1 $
*
* This file is part of OpenOffice.org.
*
@@ -637,7 +637,6 @@ struct ScMyImportValidation
typedef std::vector<ScMyImportValidation> ScMyImportValidations;
typedef std::list<SvXMLImportContext*> ScMyViewContextList;
-typedef std::list<com::sun::star::table::CellAddress> ScMyDefaultNotes;
class ScMyStylesImportHelper;
class ScXMLImport: public SvXMLImport
@@ -738,7 +737,6 @@ class ScXMLImport: public SvXMLImport
ScMyLabelRanges* pMyLabelRanges;
ScMyImportValidations* pValidations;
ScMyImpDetectiveOpArray* pDetectiveOpArray;
- ScMyDefaultNotes* pDefaultNotes;
ScUnoGuard* pScUnoGuard;
std::vector<rtl::OUString> aTableStyles;
@@ -951,7 +949,6 @@ private:
void AddStyleRange(const com::sun::star::table::CellRangeAddress& rCellRange);
void SetStyleToRanges();
- void SetDefaultNotes();
void ExamineDefaultStyle();
public:
void SetStyleToRange(const ScRange& rRange, const rtl::OUString* pStyleName,
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 2a03d7ac8fca..616071be52d4 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: AccessibleDocument.cxx,v $
- * $Revision: 1.76 $
+ * $Revision: 1.76.40.1 $
*
* This file is part of OpenOffice.org.
*
@@ -1117,7 +1117,7 @@ void ScChildrenShapes::AddShape(const uno::Reference<drawing::XShape>& xShape, s
sal_Int16 nLayerID = 0;
if( aPropAny >>= nLayerID )
{
- if( nLayerID == SC_LAYER_INTERN )
+ if( (nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN) )
pShape->bSelectable = sal_False;
else
pShape->bSelectable = sal_True;
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index a82b86269857..7d66c19cfb79 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: AccessibleDocumentPagePreview.cxx,v $
- * $Revision: 1.38.32.2 $
+ * $Revision: 1.38.128.2 $
*
* This file is part of OpenOffice.org.
*
@@ -193,9 +193,8 @@ sal_Int32 ScNotesChilds::AddNotes(const ScPreviewLocationData& rData, const Rect
}
else
{
- ScPostIt aPostIt(pDoc);
- pDoc->GetNote(aNote.maNoteCell.Col(), aNote.maNoteCell.Row(), aNote.maNoteCell.Tab(), aPostIt);
- aNote.maNoteText = aPostIt.GetText();
+ if( ScPostIt* pNote = pDoc->GetNote( aNote.maNoteCell ) )
+ aNote.maNoteText = pNote->GetText();
aNote.mpTextHelper = CreateTextHelper(aNote.maNoteText, aNote.maRect, aNote.maNoteCell, aNote.mbMarkNote, nParagraphs + mnOffset);
if (aNote.mpTextHelper)
aNote.mnParaCount = aNote.mpTextHelper->GetChildCount();
@@ -371,9 +370,8 @@ sal_Int32 ScNotesChilds::CheckChanges(const ScPreviewLocationData& rData,
}
else
{
- ScPostIt aPostIt(pDoc);
- pDoc->GetNote(aNote.maNoteCell.Col(), aNote.maNoteCell.Row(), aNote.maNoteCell.Tab(), aPostIt);
- aNote.maNoteText = aPostIt.GetText();
+ if( ScPostIt* pNote = pDoc->GetNote( aNote.maNoteCell ) )
+ aNote.maNoteText = pNote->GetText();
}
sal_Int8 nCompare(-1); // if there are no more old childs it is always a new one
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 98885067c5b0..95de1fdd23a9 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: scmod.cxx,v $
- * $Revision: 1.58.172.1 $
+ * $Revision: 1.58.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -251,11 +251,10 @@ void ScModule::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( pObjSh->Type() == TYPE(ScDocShell) )
{
ScDocShell* pDocSh = ((ScDocShell*)pObjSh);
- ScDetectiveFunc aFunc( pDocSh->GetDocument(), 0 );
if ( bArrows )
- aFunc.UpdateAllArrowColors();
+ ScDetectiveFunc( pDocSh->GetDocument(), 0 ).UpdateAllArrowColors();
if ( bComments )
- aFunc.UpdateAllComments();
+ ScDetectiveFunc::UpdateAllComments( *pDocSh->GetDocument() );
}
pObjSh = SfxObjectShell::GetNext( *pObjSh );
}
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index 5f95733aed64..8f3402f51861 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -220,8 +220,6 @@ void ScDPFieldWindow::DrawBackground( OutputDevice& rDev )
rDev.DrawRect( Rectangle( aPos0, aSize ) );
rDev.SetTextColor( aWinTextColor );
- BOOL bOldRTL = rDev.IsRTLEnabled();
- rDev.EnableRTL( false );
/* Draw the caption text. This needs some special handling, because we
support hard line breaks here. This part will draw each line of the
@@ -236,8 +234,6 @@ void ScDPFieldWindow::DrawBackground( OutputDevice& rDev )
rDev.DrawCtrlText( aLinePos, aLine );
nY += rDev.GetTextHeight();
}
-
- rDev.EnableRTL( bOldRTL );
}
}
@@ -245,7 +241,8 @@ void ScDPFieldWindow::DrawField(
OutputDevice& rDev, const Rectangle& rRect, const String& rText, bool bFocus )
{
VirtualDevice aVirDev( rDev );
- aVirDev.EnableRTL( true );
+ // #i97623# VirtualDevice is always LTR while other windows derive direction from parent
+ aVirDev.EnableRTL( IsRTLEnabled() );
Size aDevSize( rRect.GetSize() );
long nWidth = aDevSize.Width();
@@ -261,7 +258,6 @@ void ScDPFieldWindow::DrawField(
DecorationView aDecoView( &aVirDev );
aDecoView.DrawButton( Rectangle( Point( 0, 0 ), aDevSize ), bFocus ? BUTTON_DRAW_DEFAULT : 0 );
aVirDev.SetTextColor( aTextColor );
- aVirDev.EnableRTL( false );
aVirDev.DrawText( aLabelPos, rText );
rDev.DrawBitmap( rRect.TopLeft(), aVirDev.GetBitmap( Point( 0, 0 ), aDevSize ) );
}
@@ -269,7 +265,8 @@ void ScDPFieldWindow::DrawField(
void ScDPFieldWindow::Redraw()
{
VirtualDevice aVirDev;
- aVirDev.EnableRTL( true );
+ // #i97623# VirtualDevice is always LTR while other windows derive direction from parent
+ aVirDev.EnableRTL( IsRTLEnabled() );
aVirDev.SetMapMode( MAP_PIXEL );
Point aPos0;
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 91f928391a01..1e85f3c01f3e 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dbdocfun.cxx,v $
- * $Revision: 1.20 $
+ * $Revision: 1.20.128.4 $
*
* This file is part of OpenOffice.org.
*
@@ -57,6 +57,7 @@
#include "cell.hxx" // for lcl_EmptyExcept
#include "editable.hxx"
#include "attrib.hxx"
+#include "drwlayer.hxx"
// -----------------------------------------------------------------
@@ -420,6 +421,7 @@ BOOL ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
SCTAB nSrcTab = nTab;
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rSortParam.nCol1, rSortParam.nRow1,
rSortParam.nCol2, rSortParam.nRow2 );
@@ -493,6 +495,7 @@ BOOL ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
bRepeatQuery = FALSE;
}
+ ScUndoSort* pUndoAction = 0;
if ( bRecord )
{
// Referenzen ausserhalb des Bereichs werden nicht veraendert !
@@ -501,20 +504,32 @@ BOOL ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
// Zeilenhoehen immer (wegen automatischer Anpassung)
//! auf ScBlockUndo umstellen
pUndoDoc->InitUndo( pDoc, nTab, nTab, FALSE, TRUE );
+
+ /* #i59745# Do not copy note captions to undo document. All existing
+ caption objects will be repositioned while sorting which is tracked
+ in drawing undo. When undo is executed, the old positions will be
+ restored, and the cells with the old notes (which still refer to the
+ existing captions) will be copied back into the source document. */
pDoc->CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ IDF_ALL|IDF_NOCAPTIONS, FALSE, pUndoDoc );
const ScRange* pR = 0;
if (pDestData)
{
- pDoc->CopyToDocument( aOldDest, IDF_ALL, FALSE, pUndoDoc );
+ /* #i59745# Do not copy note captions from destination range to
+ undo document. All existing caption objects will be removed
+ which is tracked in drawing undo. When undo is executed, the
+ caption objects are reinserted with drawing undo, and the cells
+ with the old notes (which still refer to the existing captions)
+ will be copied back into the source document. */
+ pDoc->CopyToDocument( aOldDest, IDF_ALL|IDF_NOCAPTIONS, FALSE, pUndoDoc );
pR = &aOldDest;
}
// Zeilenhoehen immer (wegen automatischer Anpassung)
//! auf ScBlockUndo umstellen
-// if (bRepeatQuery)
+// if (bRepeatQuery)
pDoc->CopyToDocument( 0, aLocalParam.nRow1, nTab, MAXCOL, aLocalParam.nRow2, nTab,
IDF_NONE, FALSE, pUndoDoc );
@@ -523,10 +538,12 @@ BOOL ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
if (pDocDB->GetCount())
pUndoDB = new ScDBCollection( *pDocDB );
+ pUndoAction = new ScUndoSort( &rDocShell, nTab, rSortParam, bRepeatQuery, pUndoDoc, pUndoDB, pR );
+ rDocShell.GetUndoManager()->AddUndoAction( pUndoAction );
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoSort( &rDocShell, nTab,
- rSortParam, bRepeatQuery, pUndoDoc, pUndoDB, pR ) );
+ // #i59745# collect all drawing undo actions affecting cell note captions
+ if( pDrawLayer )
+ pDrawLayer->BeginCalcUndo();
}
if ( bCopy )
@@ -620,9 +637,13 @@ BOOL ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
rDocShell.PostPaint( nStartX, nStartY, nTab, nEndX, nEndY, nTab, nPaint );
}
-// AdjustRowHeight( aLocalParam.nRow1, aLocalParam.nRow2, bPaint );
+ // AdjustRowHeight( aLocalParam.nRow1, aLocalParam.nRow2, bPaint );
rDocShell.AdjustRowHeight( aLocalParam.nRow1, aLocalParam.nRow2, nTab );
+ // #i59745# set collected drawing undo actions at sorting undo action
+ if( pUndoAction && pDrawLayer )
+ pUndoAction->SetDrawUndoAction( pDrawLayer->GetCalcUndo() );
+
aModificator.SetDocumentModified();
return TRUE;
@@ -1132,7 +1153,7 @@ BOOL lcl_EmptyExcept( ScDocument* pDoc, const ScRange& rRange, const ScRange& rE
ScBaseCell* pCell = aIter.GetFirst();
while (pCell)
{
- if ( pCell->GetCellType() != CELLTYPE_NOTE || pCell->GetNotePtr() ) // real content?
+ if ( !pCell->IsBlank() ) // real content?
{
if ( !rExcept.In( ScAddress( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ) ) )
return FALSE; // cell found
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 6e9010d7856b..5a3d6bd2703b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docfunc.cxx,v $
- * $Revision: 1.69.28.2 $
+ * $Revision: 1.70.100.10 $
*
* This file is part of OpenOffice.org.
*
@@ -577,11 +577,12 @@ BOOL ScDocFunc::DeleteContents( const ScMarkData& rMark, USHORT nFlags,
// 3) Inhalte fuer Undo kopieren und Undo-Aktion anlegen
// 4) Inhalte loeschen
+ bool bDrawUndo = bObjects || (nFlags & IDF_NOTE);
+ if (bRecord && bDrawUndo)
+ pDoc->BeginDrawUndo();
+
if (bObjects)
{
- if (bRecord)
- pDoc->BeginDrawUndo();
-
if (bMulti)
pDoc->DeleteObjectsInSelection( aMultiMark );
else
@@ -604,10 +605,9 @@ BOOL ScDocFunc::DeleteContents( const ScMarkData& rMark, USHORT nFlags,
nUndoDocFlags |= IDF_STRING; // -> Zellen werden geaendert
if (nFlags & IDF_NOTE)
nUndoDocFlags |= IDF_CONTENTS; // #68795# copy all cells with their notes
+ // note captions are handled in drawing undo
+ nUndoDocFlags |= IDF_NOCAPTIONS;
pDoc->CopyToDocument( aExtendedRange, nUndoDocFlags, bMulti, pUndoDoc, &aMultiMark );
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDeleteContents( &rDocShell, aMultiMark, aExtendedRange,
- pUndoDoc, bMulti, nFlags, bObjects ) );
}
//! HideAllCursors(); // falls Zusammenfassung aufgehoben wird
@@ -618,9 +618,15 @@ BOOL ScDocFunc::DeleteContents( const ScMarkData& rMark, USHORT nFlags,
else
{
pDoc->DeleteSelection( nFlags, aMultiMark );
- aMultiMark.MarkToSimple();
+// aMultiMark.MarkToSimple();
}
+ // add undo action after drawing undo is complete (objects and note captions)
+ if( bRecord )
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoDeleteContents( &rDocShell, aMultiMark, aExtendedRange,
+ pUndoDoc, bMulti, nFlags, bDrawUndo ) );
+
if (!AdjustRowHeight( aExtendedRange ))
rDocShell.PostPaint( aExtendedRange, PAINT_GRID, nExtFlags );
else if (nExtFlags & SC_PF_LINES)
@@ -727,7 +733,7 @@ BOOL ScDocFunc::SetNormalString( const ScAddress& rPos, const String& rText, BOO
pTabs = new SCTAB[1];
pTabs[0] = rPos.Tab();
ppOldCells = new ScBaseCell*[1];
- ppOldCells[0] = pDocCell ? pDocCell->Clone(pDoc) : NULL;
+ ppOldCells[0] = pDocCell ? pDocCell->CloneWithoutNote( *pDoc ) : 0;
pHasFormat = new BOOL[1];
pOldFormats = new ULONG[1];
@@ -755,7 +761,7 @@ BOOL ScDocFunc::SetNormalString( const ScAddress& rPos, const String& rText, BOO
if ( bEditDeleted || pDoc->HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) )
AdjustRowHeight( ScRange(rPos) );
- rDocShell.PostPaintCell( rPos.Col(), rPos.Row(), rPos.Tab() );
+ rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
// #107160# notify input handler here the same way as in PutCell
@@ -767,7 +773,6 @@ BOOL ScDocFunc::SetNormalString( const ScAddress& rPos, const String& rText, BOO
BOOL ScDocFunc::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, BOOL bApi )
{
-
ScDocShellModificator aModificator( rDocShell );
ScDocument* pDoc = rDocShell.GetDocument();
BOOL bUndo (pDoc->IsUndoEnabled());
@@ -791,13 +796,9 @@ BOOL ScDocFunc::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, BOOL bApi
BOOL bEditDeleted = (pDocCell && pDocCell->GetCellType() == CELLTYPE_EDIT);
BOOL bHeight = ( bEditDeleted || bEditCell ||
pDoc->HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) );
- ScBaseCell* pUndoCell = NULL;
- ScBaseCell* pRedoCell = NULL;
- if (bUndo)
- {
- pUndoCell = pDocCell ? pDocCell->Clone(pDoc) : NULL;
- pRedoCell = pNewCell ? pNewCell->Clone(pDoc) : NULL;
- }
+
+ ScBaseCell* pUndoCell = (bUndo && pDocCell) ? pDocCell->CloneWithoutNote( *pDoc, rPos ) : 0;
+ ScBaseCell* pRedoCell = (bUndo && pNewCell) ? pNewCell->CloneWithoutNote( *pDoc, rPos ) : 0;
pDoc->PutCell( rPos, pNewCell );
@@ -812,7 +813,7 @@ BOOL ScDocFunc::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, BOOL bApi
AdjustRowHeight( ScRange(rPos) );
if (!bXMLLoading)
- rDocShell.PostPaintCell( rPos.Col(), rPos.Row(), rPos.Tab() );
+ rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -1033,7 +1034,25 @@ BOOL ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText,
//------------------------------------------------------------------------
-BOOL ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bApi )
+bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
+{
+ ScDocument& rDoc = *rDocShell.GetDocument();
+ ScPostIt* pNote = rDoc.GetNote( rPos );
+ if( !pNote || (bShow == pNote->IsCaptionShown()) ) return false;
+
+ // move the caption to internal or hidden layer and create undo action
+ pNote->ShowCaption( bShow );
+ if( rDoc.IsUndoEnabled() )
+ rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideNote( rDocShell, rPos, bShow ) );
+
+ rDocShell.SetDocumentModified();
+
+ return true;
+}
+
+//------------------------------------------------------------------------
+
+bool ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bApi )
{
ScDocShellModificator aModificator( rDocShell );
@@ -1043,33 +1062,76 @@ BOOL ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bA
{
if (!bApi)
rDocShell.ErrorMessage(aTester.GetMessageId());
- return FALSE;
+ return false;
}
String aNewText = rText;
aNewText.ConvertLineEnd(); //! ist das noetig ???
- ScPostIt aNote(pDoc);
- pDoc->GetNote( rPos.Col(), rPos.Row(), rPos.Tab(), aNote );
- aNote.SetText( aNewText ); // setzt auch Author und Date
- pDoc->SetNote( rPos.Col(), rPos.Row(), rPos.Tab(), aNote );
+ if( ScPostIt* pNote = (aNewText.Len() > 0) ? pDoc->GetOrCreateNote( rPos ) : pDoc->GetNote( rPos ) )
+ pNote->SetText( aNewText );
- if ( aNote.IsShown() )
+ //! Undo !!!
+
+ rDocShell.PostPaintCell( rPos );
+ aModificator.SetDocumentModified();
+
+ return true;
+}
+
+//------------------------------------------------------------------------
+
+bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate, BOOL bApi )
+{
+ bool bDone = false;
+
+ ScDocShellModificator aModificator( rDocShell );
+ ScDocument& rDoc = *rDocShell.GetDocument();
+ ScEditableTester aTester( &rDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
+ if (aTester.IsEditable())
{
- // Zeichenobjekt updaten
- //! bei gelocktem Paint auch erst spaeter !!!
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+ SfxUndoManager* pUndoMgr = (pDrawLayer && rDoc.IsUndoEnabled()) ? rDocShell.GetUndoManager() : 0;
- ScDetectiveFunc aDetFunc( pDoc, rPos.Tab() );
- aDetFunc.HideComment( rPos.Col(), rPos.Row() );
- aDetFunc.ShowComment( rPos.Col(), rPos.Row(), FALSE ); // FALSE: nur wenn gefunden
- }
+ // collect drawing undo actions for deleting/inserting caption obejcts
+ if( pUndoMgr )
+ pDrawLayer->BeginCalcUndo();
- //! Undo !!!
+ // delete old note
+ ScNoteData aOldData;
+ if( ScPostIt* pOldNote = rDoc.ReleaseNote( rPos ) )
+ {
+ // rescue note data for undo
+ aOldData = pOldNote->GetNoteData();
+ // delete the note (creates drawing undo action for the caption object)
+ delete pOldNote;
+ }
- rDocShell.PostPaintCell( rPos.Col(), rPos.Row(), rPos.Tab() );
- aModificator.SetDocumentModified();
+ // create new note (creates drawing undo action for the new caption object)
+ ScNoteData aNewData;
+ if( ScPostIt* pNewNote = ScNoteUtil::CreateNoteFromString( rDoc, rPos, rNoteText, false ) )
+ {
+ if( pAuthor ) pNewNote->SetAuthor( *pAuthor );
+ if( pDate ) pNewNote->SetDate( *pDate );
+ // rescue note data for undo
+ aNewData = pNewNote->GetNoteData();
+ }
- return TRUE;
+ // create the undo action
+ if( pUndoMgr && (aOldData.mpCaption || aNewData.mpCaption) )
+ pUndoMgr->AddUndoAction( new ScUndoReplaceNote( rDocShell, rPos, aOldData, aNewData, pDrawLayer->GetCalcUndo() ) );
+
+ // repaint cell (to make note marker visible)
+ rDocShell.PostPaintCell( rPos );
+ aModificator.SetDocumentModified();
+ bDone = true;
+ }
+ else if (!bApi)
+ {
+ rDocShell.ErrorMessage(aTester.GetMessageId());
+ }
+
+ return bDone;
}
//------------------------------------------------------------------------
@@ -2008,6 +2070,7 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
{
BOOL bWholeCols = ( nStartRow == 0 && nEndRow == MAXROW );
BOOL bWholeRows = ( nStartCol == 0 && nEndCol == MAXCOL );
+ USHORT nUndoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
@@ -2015,7 +2078,7 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
if (bCut)
{
pDoc->CopyToDocument( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nUndoFlags, FALSE, pUndoDoc );
pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, FALSE, FALSE );
}
@@ -2024,7 +2087,7 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
pUndoDoc->AddUndoTab( nDestTab, nDestEndTab, bWholeCols, bWholeRows );
pDoc->CopyToDocument( nDestCol, nDestRow, nDestTab,
nDestEndCol, nDestEndRow, nDestEndTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nUndoFlags, FALSE, pUndoDoc );
pUndoData = new ScRefUndoData( pDoc );
@@ -2078,7 +2141,12 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
aDestMark.SelectTable( nTab, TRUE ); // Destination selektieren
aDestMark.SetMarkArea( aPasteDest );
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_ALL & ~IDF_OBJECTS,
+ /* Do not copy cell notes and drawing objects here. While pasting, the
+ function ScDocument::UpdateReference() is called which calls
+ ScDrawLayer::MoveCells() which may move away inserted objects to wrong
+ positions (e.g. if source and destination range overlaps). Cell notes
+ and drawing objects are pasted below after doing all adjusting. */
+ pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS),
pRefUndoDoc, pClipDoc, TRUE, FALSE, bIncludeFiltered );
// skipped rows and merged cells don't mix
@@ -2090,9 +2158,11 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScRange( 0,nDestRow,nDestTab, MAXCOL,nDestEndRow,nDestEndTab ),
FALSE );
- // paste drawing objects after adjusting row heights
+ /* Paste cell notes and drawing objects after adjusting formula references
+ and row heights. There are no cell notes or drawing objects, if the
+ clipdoc does not contain a drawing layer. */
if ( pClipDoc->GetDrawLayer() )
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_OBJECTS,
+ pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_NOTE | IDF_OBJECTS,
pRefUndoDoc, pClipDoc, TRUE, FALSE, bIncludeFiltered );
if (bRecord)
@@ -3347,8 +3417,7 @@ BOOL ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aCopyRange = aDestArea;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pUndoDoc, &aMark );
- pDoc->BeginDrawUndo();
+ pDoc->CopyToDocument( aCopyRange, IDF_AUTOFILL, FALSE, pUndoDoc, &aMark );
}
pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
@@ -3455,8 +3524,7 @@ BOOL ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
pDoc->CopyToDocument(
aDestArea.aStart.Col(), aDestArea.aStart.Row(), 0,
aDestArea.aEnd.Col(), aDestArea.aEnd.Row(), nTabCount-1,
- IDF_ALL, FALSE, pUndoDoc, &aMark );
- pDoc->BeginDrawUndo();
+ IDF_AUTOFILL, FALSE, pUndoDoc, &aMark );
}
if (aDestArea.aStart.Col() <= aDestArea.aEnd.Col() &&
@@ -3591,11 +3659,11 @@ BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
if (i != nDestStartTab && aMark.GetTableSelect(i))
pUndoDoc->AddUndoTab( i, i );
+ // do not clone note captions in undo document
pDoc->CopyToDocument(
aDestArea.aStart.Col(), aDestArea.aStart.Row(), 0,
aDestArea.aEnd.Col(), aDestArea.aEnd.Row(), nTabCount-1,
- IDF_ALL, FALSE, pUndoDoc, &aMark );
- pDoc->BeginDrawUndo();
+ IDF_AUTOFILL, FALSE, pUndoDoc, &aMark );
}
pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
@@ -3660,33 +3728,47 @@ BOOL ScDocFunc::MergeCells( const ScRange& rRange, BOOL bContents, BOOL bRecord,
}
BOOL bNeedContents = bContents &&
- ( !pDoc->IsBlockEmpty( nTab, nStartCol,nStartRow+1, nStartCol,nEndRow ) ||
- !pDoc->IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow ) );
+ ( !pDoc->IsBlockEmpty( nTab, nStartCol,nStartRow+1, nStartCol,nEndRow, true ) ||
+ !pDoc->IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ) );
+ ScDocument* pUndoDoc = 0;
if (bRecord)
{
- ScDocument* pUndoDoc = NULL;
- if (bNeedContents && bContents)
+ // test if the range contains other notes which also implies that we need an undo document
+ bool bHasNotes = false;
+ for( ScAddress aPos( nStartCol, nStartRow, nTab ); !bHasNotes && (aPos.Col() <= nEndCol); aPos.IncCol() )
+ for( aPos.SetRow( nStartRow ); !bHasNotes && (aPos.Row() <= nEndRow); aPos.IncRow() )
+ bHasNotes = ((aPos.Col() != nStartCol) || (aPos.Row() != nStartRow)) && (pDoc->GetNote( aPos ) != 0);
+
+ if (bNeedContents || bHasNotes)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nTab, nTab );
+ // note captions are collected by drawing undo
pDoc->CopyToDocument( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ IDF_ALL|IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoMerge( &rDocShell,
- nStartCol, nStartRow, nTab,
- nEndCol, nEndRow, nTab, TRUE, pUndoDoc ) );
+ if( bHasNotes )
+ pDoc->BeginDrawUndo();
}
- if (bNeedContents && bContents)
+ if (bNeedContents)
pDoc->DoMergeContents( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
pDoc->DoMerge( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ if( bRecord )
+ {
+ SdrUndoGroup* pDrawUndo = pDoc->GetDrawLayer() ? pDoc->GetDrawLayer()->GetCalcUndo() : 0;
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoMerge( &rDocShell,
+ nStartCol, nStartRow, nTab,
+ nEndCol, nEndRow, nTab, bNeedContents, pUndoDoc, pDrawUndo ) );
+ }
+
if ( !AdjustRowHeight( ScRange( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab ) ) )
rDocShell.PostPaint( nStartCol, nStartRow, nTab,
nEndCol, nEndRow, nTab, PAINT_GRID );
- if (bNeedContents && bContents)
+ if (bNeedContents)
pDoc->SetDirty( rRange );
aModificator.SetDocumentModified();
@@ -3752,41 +3834,6 @@ BOOL ScDocFunc::UnmergeCells( const ScRange& rRange, BOOL bRecord, BOOL bApi )
//------------------------------------------------------------------------
-BOOL ScDocFunc::SetNote( const ScAddress& rPos, const ScPostIt& rNote, BOOL bApi )
-{
- ScDocShellModificator aModificator( rDocShell );
-
- BOOL bDone = FALSE;
- SCCOL nCol = rPos.Col();
- SCROW nRow = rPos.Row();
- SCTAB nTab = rPos.Tab();
-
- ScDocument* pDoc = rDocShell.GetDocument();
- BOOL bUndo (pDoc->IsUndoEnabled());
- ScEditableTester aTester( pDoc, nTab, nCol,nRow, nCol,nRow );
- if (aTester.IsEditable())
- {
- if (bUndo)
- {
- ScPostIt aOld(pDoc);
- pDoc->GetNote( nCol, nRow, nTab, aOld );
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoEditNote( &rDocShell, rPos, aOld, rNote ) );
- }
- pDoc->SetNote( nCol, nRow, nTab, rNote );
-
- rDocShell.PostPaintCell( nCol, nRow, nTab );
- aModificator.SetDocumentModified();
- bDone = TRUE;
- }
- else if (!bApi)
- rDocShell.ErrorMessage(aTester.GetMessageId());
-
- return bDone;
-}
-
-//------------------------------------------------------------------------
-
BOOL ScDocFunc::ModifyRangeNames( const ScRangeName& rNewRanges, BOOL bApi )
{
return SetNewRangeNames( new ScRangeName( rNewRanges ), bApi );
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 2984b0f37e2f..7f1fb3b549cf 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docsh.cxx,v $
- * $Revision: 1.100.30.2 $
+ * $Revision: 1.103.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -261,13 +261,9 @@ sal_uInt16 ScDocShell::GetHiddenInformationState( sal_uInt16 nStates )
while ( nTable < nTableCount && !bFound )
{
ScCellIterator aCellIter( &aDocument, 0,0, nTable, MAXCOL,MAXROW, nTable );
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell && !bFound)
- {
- if (pCell->GetNotePtr())
+ for( ScBaseCell* pCell = aCellIter.GetFirst(); pCell && !bFound; pCell = aCellIter.GetNext() )
+ if (pCell->HasNote())
bFound = sal_True;
- pCell = aCellIter.GetNext();
- }
nTable++;
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 58c72458ba0a..6e4940f96fd3 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docsh3.cxx,v $
- * $Revision: 1.37.32.2 $
+ * $Revision: 1.38.52.2 $
*
* This file is part of OpenOffice.org.
*
@@ -199,6 +199,11 @@ void ScDocShell::PostPaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PAINT_GRID, SC_PF_TESTMERGE );
}
+void ScDocShell::PostPaintCell( const ScAddress& rPos )
+{
+ PostPaintCell( rPos.Col(), rPos.Row(), rPos.Tab() );
+}
+
void ScDocShell::PostPaintExtras()
{
PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_EXTRAS );
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 699cd86d705b..49f93a403f88 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drawsh.cxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.15.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -193,7 +193,6 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
pView->SetAttrToMarked( *rReq.GetArgs(), FALSE );
else
pView->SetDefaultAttr( *rReq.GetArgs(), FALSE);
- pView->StoreCaptionAttribs();
pView->InvalidateAttribs();
}
break;
@@ -278,7 +277,6 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
rReq.Done(*(pDlg->GetOutputItemSet()));
pView->SetAttributes(*pDlg->GetOutputItemSet());
pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
- pView->StoreCaptionDimensions();
}
delete pDlg;
@@ -405,7 +403,6 @@ void ScDrawShell::ExecuteLineDlg( SfxRequest& rReq, USHORT nTabPage )
else
pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), FALSE );
- pView->StoreCaptionAttribs();
pView->InvalidateAttribs();
rReq.Done();
}
@@ -454,7 +451,6 @@ void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq, USHORT nTabPage )
else
pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), FALSE );
- pView->StoreCaptionAttribs();
pView->InvalidateAttribs();
rReq.Done();
}
@@ -483,7 +479,6 @@ void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq, USHORT /* nTabPage */ )
else
pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), FALSE );
- pView->StoreCaptionAttribs();
pView->InvalidateAttribs();
rReq.Done();
}
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 356cf0b04f57..4507bc471ebc 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drawsh2.cxx,v $
- * $Revision: 1.26 $
+ * $Revision: 1.26.128.2 $
*
* This file is part of OpenOffice.org.
*
@@ -104,12 +104,12 @@ void ScDrawShell::GetState( SfxItemSet& rSet ) // Zustaende / Toggles
ULONG nMarkCount = rMarkList.GetMarkCount();
if ( nMarkCount == 1 )
{
- SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && pObj->GetObjIdentifier() == OBJ_CAPTION && pObj->GetLayer() == SC_LAYER_INTERN)
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ if( ScDrawLayer::IsNoteCaption( pObj ) )
{
- bDisableAnchor = true;
- rSet.DisableItem( SID_ANCHOR_PAGE );
- rSet.DisableItem( SID_ANCHOR_CELL );
+ bDisableAnchor = true;
+ rSet.DisableItem( SID_ANCHOR_PAGE );
+ rSet.DisableItem( SID_ANCHOR_CELL );
}
}
@@ -178,9 +178,10 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // Funktionen disabl
rSet.DisableItem( SID_ALIGN_ANY_BOTTOM );
}
- if ( !nMarkCount || pView->HasMarkedControl() )
+ // do not change layer of form controls
+ // #158385# #i83729# do not change layer of cell notes (on internal layer)
+ if ( !nMarkCount || pView->HasMarkedControl() || pView->HasMarkedInternal() )
{
- // Layer von Controls darf nicht veraendert werden
rSet.DisableItem( SID_OBJECT_HEAVEN );
rSet.DisableItem( SID_OBJECT_HELL );
}
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index 65619d623c0b..26e5e6cb9b2e 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drawsh5.cxx,v $
- * $Revision: 1.37 $
+ * $Revision: 1.37.128.2 $
*
* This file is part of OpenOffice.org.
*
@@ -372,41 +372,9 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
case SID_DELETE:
case SID_DELETE_CONTENTS:
- {
- const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList();
- if(rNoteMarkList.GetMarkCount() == 1)
- {
- SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if ( pObj && pObj->GetLayer() == SC_LAYER_INTERN && pObj->ISA(SdrCaptionObj) )
- {
- ScAddress aTabPos;
- ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObj, pViewData->GetTabNo() );
- if( pData )
- aTabPos = pData->aStt;
- ScDocument* pDoc = pViewData->GetDocument();
- ScPostIt aNote(pDoc);
- pViewData->GetViewShell()->SetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote ); // with Undo
-
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
- if (pModel)
- {
- SdrPage* pPage = pModel->GetPage( aTabPos.Tab() );
- if(pPage)
- {
- ScDocShell* pDocSh = pViewData->GetDocShell();
- pDocSh->GetUndoManager()->AddUndoAction( new SdrUndoRemoveObj( *pObj));
- pPage->RemoveObject( pObj->GetOrdNum() );
- }
- }
- if (!pTabView->IsDrawSelMode())
- pViewData->GetViewShell()->SetDrawShell( FALSE );
- break;
- }
- }
pView->DeleteMarked();
if (!pTabView->IsDrawSelMode())
pViewData->GetViewShell()->SetDrawShell( FALSE );
- }
break;
case SID_CUT:
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index a3fa86abd00d..dd7e1a114ef2 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drtxtob.cxx,v $
- * $Revision: 1.34.144.1 $
+ * $Revision: 1.34.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -315,6 +315,7 @@ void __EXPORT ScDrawTextObjectBar::Execute( SfxRequest &rReq )
case SID_ENABLE_HYPHENATION:
case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
+#if 0 // DR
if (IsNoteEdit())
{
pView->CaptionTextDirection( rReq.GetSlot()); // process Notes before we end the text edit.
@@ -322,6 +323,7 @@ void __EXPORT ScDrawTextObjectBar::Execute( SfxRequest &rReq )
pViewData->GetDispatcher().Execute(pViewData->GetView()->GetDrawFuncPtr()->GetSlotID(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
else
+#endif
{
pView->ScEndTextEdit(); // end text edit before switching direction
ExecuteGlobal( rReq );
@@ -350,7 +352,8 @@ void __EXPORT ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
if (IsNoteEdit())
{
- // issue 21255 - Notes now support rich text formatting.
+ // #i21255# notes now support rich text formatting (#i74140# but not fontwork)
+ bDisableFontWork = TRUE;
}
if ( bDisableFontWork )
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx
index 4eb8512a64b2..a011de6fa0e9 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drtxtob2.cxx,v $
- * $Revision: 1.19 $
+ * $Revision: 1.19.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,10 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//-------------------------------------------------------------------------
-
#include "scitems.hxx"
#include <svx/adjitem.hxx>
#include <svx/drawitem.hxx>
@@ -60,6 +56,7 @@
#include "docsh.hxx"
#include "transobj.hxx"
#include "drwtrans.hxx"
+#include "drwlayer.hxx"
//------------------------------------------------------------------------
@@ -70,10 +67,7 @@ USHORT ScGetFontWorkId()
BOOL ScDrawTextObjectBar::IsNoteEdit()
{
- ScTabView* pTabView = pViewData->GetView();
- SdrView* pSdrView = pTabView->GetSdrView();
- SdrObject* pObject = pSdrView->GetTextEditObject();
- return ( pObject && pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA( SdrCaptionObj ) );
+ return ScDrawLayer::IsNoteCaption( pViewData->GetView()->GetSdrView()->GetTextEditObject() );
}
// wenn kein Text editiert wird, Funktionen wie in drawsh
diff --git a/sc/source/ui/drawfunc/fuconarc.cxx b/sc/source/ui/drawfunc/fuconarc.cxx
index 5347125fd2b0..57d84879df52 100644
--- a/sc/source/ui/drawfunc/fuconarc.cxx
+++ b/sc/source/ui/drawfunc/fuconarc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconarc.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,32 +31,22 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------------
-#include <svx/svdobj.hxx>
-
-#include <svx/svdview.hxx>
-
#include "fuconarc.hxx"
#include "sc.hrc"
#include "tabvwsh.hxx"
+#include "drawview.hxx"
// #98185# Create default drawing objects via keyboard
#include <svx/svdocirc.hxx>
#include <svx/sxciaitm.hxx>
-
-//------------------------------------------------------------------------
-
-
/*************************************************************************
|*
|* Konstruktor
|*
\************************************************************************/
-FuConstArc::FuConstArc( ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuConstArc::FuConstArc( ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq )
: FuConstruct( pViewSh, pWin, pViewP, pDoc, rReq )
{
diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx
index 569177532af7..fd6fc1ff3e41 100644
--- a/sc/source/ui/drawfunc/fuconcustomshape.cxx
+++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconcustomshape.cxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.13.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,30 +31,27 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-//------------------------------------------------------------------------
-#include <fuconcustomshape.hxx>
+#include "fuconcustomshape.hxx"
#include <svx/svxenum.hxx>
#include <svx/gallery.hxx>
#include <sfx2/request.hxx>
-#ifndef _FM_FMMODEL_HXX
#include <svx/fmmodel.hxx>
-#endif
#include <svtools/itempool.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdoashp.hxx>
#include <svx/eeitem.hxx>
#include <svx/sdtagitm.hxx>
-#include <svx/svdview.hxx>
#include "fuconuno.hxx"
#include "tabvwsh.hxx"
#include "sc.hrc"
+#include "drawview.hxx"
#include <svx/adjitem.hxx>
#include <math.h>
//------------------------------------------------------------------------
-FuConstCustomShape::FuConstCustomShape( ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP, SdrModel* pDoc, SfxRequest& rReq )
+FuConstCustomShape::FuConstCustomShape( ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP, SdrModel* pDoc, SfxRequest& rReq )
: FuConstruct( pViewSh, pWin, pViewP, pDoc, rReq )
{
const SfxItemSet* pArgs = rReq.GetArgs();
diff --git a/sc/source/ui/drawfunc/fuconpol.cxx b/sc/source/ui/drawfunc/fuconpol.cxx
index 9ce7140e3f6e..b46fb5082c55 100644
--- a/sc/source/ui/drawfunc/fuconpol.cxx
+++ b/sc/source/ui/drawfunc/fuconpol.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconpol.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,114 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------------
-
-// TOOLS
-#define _BIGINT_HXX
-#define _SFXMULTISEL_HXX
-#define _STACK_HXX
-#define _QUEUE_HXX
-#define _DYNARR_HXX
-#define _TREELIST_HXX
-#define _CACHESTR_HXX
-#define _NEW_HXX
-//#define _SHL_HXX
-//#define _LINK_HXX
-//#define _ERRCODE_HXX
-//#define _GEN_HXX
-//#define _FRACT_HXX
-//#define _STRING_HXX
-//#define _MTF_HXX
-//#define _CONTNR_HXX
-//#define _LIST_HXX
-//#define _TABLE_HXX
-#define _DYNARY_HXX
-//#define _UNQIDX_HXX
-#define _SVMEMPOOL_HXX
-//#define _UNQID_HXX
-//#define _DEBUG_HXX
-//#define _DATE_HXX
-//#define _TIME_HXX
-//#define _DATETIME_HXX
-//#define _INTN_HXX
-//#define _WLDCRD_HXX
-//#define _FSYS_HXX
-//#define _STREAM_HXX
-#define _CACHESTR_HXX
-#define _SV_MULTISEL_HXX
-
-//SV
-//#define _CLIP_HXX ***
-#define _CONFIG_HXX
-#define _CURSOR_HXX
-#define _FONTDLG_HXX
-#define _PRVWIN_HXX
-//#define _COLOR_HXX
-//#define _PAL_HXX
-//#define _BITMAP_HXX
-//#define _GDIOBJ_HXX
-//#define _POINTR_HXX
-//#define _ICON_HXX
-//#define _IMAGE_HXX
-//#define _KEYCOD_HXX
-//#define _EVENT_HXX
-#define _HELP_HXX
-//#define _APP_HXX
-//#define _MDIAPP_HXX
-//#define _TIMER_HXX
-//#define _METRIC_HXX
-//#define _REGION_HXX
-//#define _OUTDEV_HXX
-//#define _SYSTEM_HXX
-//#define _VIRDEV_HXX
-//#define _JOBSET_HXX
-//#define _PRINT_HXX
-//#define _WINDOW_HXX
-//#define _SYSWIN_HXX
-//#define _WRKWIN_HXX
-#define _MDIWIN_HXX
-//#define _FLOATWIN_HXX
-//#define _DOCKWIN_HXX
-//#define _CTRL_HXX
-//#define _SCRBAR_HXX
-//#define _BUTTON_HXX
-//#define _IMAGEBTN_HXX
-//#define _FIXED_HXX
-//#define _GROUP_HXX
-//#define _EDIT_HXX
-//#define _COMBOBOX_HXX
-//#define _LSTBOX_HXX
-//#define _SELENG_HXX ***
-//#define _SPLIT_HXX
-#define _SPIN_HXX
-//#define _FIELD_HXX
-//#define _MOREBTN_HXX ***
-//#define _TOOLBOX_HXX
-//#define _STATUS_HXX ***
-//#define _DIALOG_HXX
-//#define _MSGBOX_HXX
-//#define _SYSDLG_HXX
-//#define _FILDLG_HXX
-//#define _PRNDLG_HXX
-#define _COLDLG_HXX
-//#define _TABDLG_HXX
-//#define _MENU_HXX
-//#define _GDIMTF_HXX
-//#define _POLY_HXX
-//#define _ACCEL_HXX
-//#define _GRAPH_HXX
-#define _SOUND_HXX
-
-//------------------------------------------------------------------------
-
-#include <svx/svdview.hxx>
-#include <svx/svdobj.hxx>
-
#include "fuconpol.hxx"
#include "tabvwsh.hxx"
#include "sc.hrc"
+#include "drawview.hxx"
// #98185# Create default drawing objects via keyboard
#include <svx/svdopath.hxx>
@@ -158,7 +54,7 @@
|*
\************************************************************************/
-FuConstPolygon::FuConstPolygon(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuConstPolygon::FuConstPolygon(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq)
: FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq)
{
diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx
index 06f4a7c96cdb..a62890f7a51c 100644
--- a/sc/source/ui/drawfunc/fuconrec.cxx
+++ b/sc/source/ui/drawfunc/fuconrec.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconrec.cxx,v $
- * $Revision: 1.14 $
+ * $Revision: 1.14.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,196 +31,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------------
-
-// TOOLS
-#define _BIGINT_HXX
-#define _SFXMULTISEL_HXX
-#define _STACK_HXX
-#define _QUEUE_HXX
-#define _DYNARR_HXX
-#define _TREELIST_HXX
-#define _CACHESTR_HXX
-#define _NEW_HXX
-//#define _SHL_HXX
-//#define _LINK_HXX
-//#define _ERRCODE_HXX
-//#define _GEN_HXX
-//#define _FRACT_HXX
-//#define _STRING_HXX
-//#define _MTF_HXX
-//#define _CONTNR_HXX
-//#define _LIST_HXX
-//#define _TABLE_HXX
-#define _DYNARY_HXX
-//#define _UNQIDX_HXX
-#define _SVMEMPOOL_HXX
-//#define _UNQID_HXX
-//#define _DEBUG_HXX
-//#define _DATE_HXX
-//#define _TIME_HXX
-//#define _DATETIME_HXX
-//#define _INTN_HXX
-//#define _WLDCRD_HXX
-//#define _FSYS_HXX
-//#define _STREAM_HXX
-#define _CACHESTR_HXX
-#define _SV_MULTISEL_HXX
-
-//SV
-//#define _CLIP_HXX ***
-#define _CONFIG_HXX
-#define _CURSOR_HXX
-#define _FONTDLG_HXX
-#define _PRVWIN_HXX
-//#define _COLOR_HXX
-//#define _PAL_HXX
-//#define _BITMAP_HXX
-//#define _GDIOBJ_HXX
-//#define _POINTR_HXX
-//#define _ICON_HXX
-//#define _IMAGE_HXX
-//#define _KEYCOD_HXX
-//#define _EVENT_HXX
-#define _HELP_HXX
-//#define _APP_HXX
-//#define _MDIAPP_HXX
-//#define _TIMER_HXX
-//#define _METRIC_HXX
-//#define _REGION_HXX
-//#define _OUTDEV_HXX
-//#define _SYSTEM_HXX
-//#define _VIRDEV_HXX
-//#define _JOBSET_HXX
-//#define _PRINT_HXX
-//#define _WINDOW_HXX
-//#define _SYSWIN_HXX
-//#define _WRKWIN_HXX
-#define _MDIWIN_HXX
-//#define _FLOATWIN_HXX
-//#define _DOCKWIN_HXX
-//#define _CTRL_HXX
-//#define _SCRBAR_HXX
-//#define _BUTTON_HXX
-//#define _IMAGEBTN_HXX
-//#define _FIXED_HXX
-//#define _GROUP_HXX
-//#define _EDIT_HXX
-//#define _COMBOBOX_HXX
-//#define _LSTBOX_HXX
-//#define _SELENG_HXX ***
-//#define _SPLIT_HXX
-#define _SPIN_HXX
-//#define _FIELD_HXX
-//#define _MOREBTN_HXX ***
-//#define _TOOLBOX_HXX
-//#define _STATUS_HXX ***
-//#define _DIALOG_HXX
-//#define _MSGBOX_HXX
-//#define _SYSDLG_HXX
-//#define _FILDLG_HXX
-//#define _PRNDLG_HXX
-#define _COLDLG_HXX
-//#define _TABDLG_HXX
-//#define _MENU_HXX
-//#define _GDIMTF_HXX
-//#define _POLY_HXX
-//#define _ACCEL_HXX
-//#define _GRAPH_HXX
-#define _SOUND_HXX
-
-//svtools
-#define _SCRWIN_HXX
-#define _RULER_HXX
-#define _TABBAR_HXX
-#define _VALUESET_HXX
-#define _STDMENU_HXX
-#define _STDCTRL_HXX
-#define _CTRLBOX_HXX
-#define _CTRLTOOL_HXX
-#define _EXTATTR_HXX
-#define _FRM3D_HXX
-//SVTOOLS
-#define _SVTREELIST_HXX
-#define _FILTER_HXX
-#define _SVLBOXITM_HXX
-#define _SVTREEBOX_HXX
-#define _SVICNVW_HXX
-#define _SVTABBX_HXX
-
-
-#define _BASE_DLGS_HXX
-#define _BIGINT_HXX
-#define _CACHESTR_HXX
-#define _CONFIG_HXX
-#define _CURSOR_HXX
-#define _CTRLBOX_HXX
-#define _CTRLTOOL_HXX
-#define _DLGCFG_HXX
-#define _DYNARR_HXX
-#define _EXTATTR_HXX
-//#define _FILDLG_HXX ***
-#define _FILTER_HXX
-#define _FONTDLG_HXX
-
-//xout.hxx
-//#define _XENUM_HXX
-//#define _XPOLY_HXX
-//#define _XATTR_HXH
-#define _XOUTX_HXX
-//#define _XPOOL_HXX
-#define _XTABLE_HXX
-
-
-//#define _SVDLAYER_HXX
-//#define _SVDATTR_HXX
-#define _SVDIO_HXX
-#define _SVBOXITM_HXX
-#define _SVDEC_HXX
-#define _SVDXOUT_HXX
-#define _SDR_NOVIEWMARKER
-#define _SDR_NODRAGMETHODS
-#define _SDR_NOUNDO
-#define _SDR_NOXOUTDEV
-#define _SDR_NOITEMS
-#define _SDR_NOTOUCH
-#define _SDR_NOTRANSFORM
-#define _SDR_NOOBJECTS
-//#define _SDR_NOVIEWS ***
-
-#define _SVDRAG_HXX
-#define _SVINCVW_HXX
-#define _SV_MULTISEL_HXX
-#define _SVRTV_HXX
-#define _SVTABBX_HXX
-
-#define _SVX_DAILDLL_HXX
-#define _SVX_HYPHEN_HXX
-#define _SVX_IMPGRF_HXX
-#define _SVX_OPTITEMS_HXX
-#define _SVX_OPTGERL_HXX
-#define _SVX_OPTSAVE_HXX
-#define _SVX_OPTSPELL_HXX
-#define _SVX_OPTPATH_HXX
-#define _SVX_OPTLINGU_HXX
-#define _SVX_RULER_HXX
-#define _SVX_RULRITEM_HXX
-#define _SVX_SPLWRAP_HXX
-#define _SVX_SPLDLG_HXX
-#define _SVX_THESDLG_HXX
-
-//------------------------------------------------------------------------
-
-#include <svx/svdview.hxx>
-#include <svx/svdobj.hxx>
-#include <svx/outlobj.hxx>
-
#include "fuconrec.hxx"
#include "tabvwsh.hxx"
#include "sc.hrc"
+#include "drawview.hxx"
+#include <svx/outlobj.hxx>
// #98185# Create default drawing objects via keyboard
#include <svx/svdopath.hxx>
#include <svx/svdocapt.hxx>
@@ -238,7 +54,7 @@
|*
\************************************************************************/
-FuConstRectangle::FuConstRectangle(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuConstRectangle::FuConstRectangle(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq)
: FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq)
{
diff --git a/sc/source/ui/drawfunc/fuconstr.cxx b/sc/source/ui/drawfunc/fuconstr.cxx
index 7efc74187299..aea0c7a1b804 100644
--- a/sc/source/ui/drawfunc/fuconstr.cxx
+++ b/sc/source/ui/drawfunc/fuconstr.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconstr.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,172 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------------
-
-// TOOLS
-#define _BIGINT_HXX
-#define _SFXMULTISEL_HXX
-#define _STACK_HXX
-#define _QUEUE_HXX
-#define _DYNARR_HXX
-#define _TREELIST_HXX
-#define _CACHESTR_HXX
-#define _NEW_HXX
-//#define _SHL_HXX
-//#define _LINK_HXX
-//#define _ERRCODE_HXX
-//#define _GEN_HXX
-//#define _FRACT_HXX
-//#define _STRING_HXX
-//#define _MTF_HXX
-//#define _CONTNR_HXX
-//#define _LIST_HXX
-//#define _TABLE_HXX
-#define _DYNARY_HXX
-//#define _UNQIDX_HXX
-#define _SVMEMPOOL_HXX
-//#define _UNQID_HXX
-//#define _DEBUG_HXX
-//#define _DATE_HXX
-//#define _TIME_HXX
-//#define _DATETIME_HXX
-//#define _INTN_HXX
-//#define _WLDCRD_HXX
-//#define _FSYS_HXX
-//#define _STREAM_HXX
-#define _CACHESTR_HXX
-#define _SV_MULTISEL_HXX
-
-
-//SV
-//#define _CLIP_HXX
-#define _CONFIG_HXX
-#define _CURSOR_HXX
-#define _FONTDLG_HXX
-#define _PRVWIN_HXX
-//#define _COLOR_HXX
-//#define _PAL_HXX
-//#define _BITMAP_HXX
-//#define _GDIOBJ_HXX
-//#define _POINTR_HXX
-//#define _ICON_HXX
-//#define _IMAGE_HXX
-//#define _KEYCOD_HXX
-//#define _EVENT_HXX
-#define _HELP_HXX
-//#define _APP_HXX
-//#define _MDIAPP_HXX
-//#define _TIMER_HXX
-//#define _METRIC_HXX
-//#define _REGION_HXX
-//#define _OUTDEV_HXX
-//#define _SYSTEM_HXX
-//#define _VIRDEV_HXX
-//#define _JOBSET_HXX
-//#define _PRINT_HXX
-//#define _WINDOW_HXX
-//#define _SYSWIN_HXX
-//#define _WRKWIN_HXX
-#define _MDIWIN_HXX
-//#define _FLOATWIN_HXX
-//#define _DOCKWIN_HXX
-//#define _CTRL_HXX
-//#define _SCRBAR_HXX
-//#define _BUTTON_HXX
-//#define _IMAGEBTN_HXX
-//#define _FIXED_HXX
-//#define _GROUP_HXX
-//#define _EDIT_HXX
-//#define _COMBOBOX_HXX
-//#define _LSTBOX_HXX
-//#define _SELENG_HXX
-//#define _SPLIT_HXX
-#define _SPIN_HXX
-//#define _FIELD_HXX
-//#define _MOREBTN_HXX
-//#define _TOOLBOX_HXX
-//#define _STATUS_HXX
-//#define _DIALOG_HXX
-//#define _MSGBOX_HXX
-//#define _SYSDLG_HXX
-//#define _PRNDLG_HXX
-#define _COLDLG_HXX
-//#define _TABDLG_HXX
-//#define _GDIMTF_HXX
-//#define _POLY_HXX
-//#define _ACCEL_HXX
-//#define _GRAPH_HXX
-#define _SOUND_HXX
-
-//svtools
-#define _SCRWIN_HXX
-#define _RULER_HXX
-//#define _TABBAR_HXX
-//#define _VALUESET_HXX
-#define _STDMENU_HXX
-//#define _STDCTRL_HXX
-//#define _CTRLBOX_HXX
-#define _CTRLTOOL_HXX
-#define _EXTATTR_HXX
-#define _FRM3D_HXX
-#define _EXTATTR_HXX
-
-//SVTOOLS
-//#define _SVTREELIST_HXX ***
-#define _FILTER_HXX
-//#define _SVLBOXITM_HXX ***
-//#define _SVTREEBOX_HXX ***
-#define _SVICNVW_HXX
-#define _SVTABBX_HXX
-
-//sfxcore.hxx
-//#define _SFXINIMGR_HXX ***
-//#define _SFXCFGITEM_HXX
-//#define _SFX_PRINTER_HXX
-#define _SFXGENLINK_HXX
-#define _SFXHINTPOST_HXX
-//#define _SFXDOCINF_HXX ***
-#define _SFXLINKHDL_HXX
-//#define _SFX_PROGRESS_HXX
-
-//sfxsh.hxx
-//#define _SFX_SHELL_HXX
-//#define _SFXAPP_HXX
-//#define _SFXDISPATCH_HXX
-//#define _SFXMSG_HXX ***
-//#define _SFXOBJFACE_HXX ***
-//#define _SFXREQUEST_HXX
-#define _SFXMACRO_HXX
-
-// SFX
-//#define _SFXAPPWIN_HXX ***
-#define _SFX_SAVEOPT_HXX
-//#define _SFX_CHILDWIN_HXX
-//#define _SFXCTRLITEM_HXX
-#define _SFXPRNMON_HXX
-#define _INTRO_HXX
-#define _SFXMSGDESCR_HXX
-#define _SFXMSGPOOL_HXX
-#define _SFXFILEDLG_HXX
-#define _PASSWD_HXX
-#define _SFXTBXCTRL_HXX
-#define _SFXSTBITEM_HXX
-#define _SFXMNUITEM_HXX
-#define _SFXIMGMGR_HXX
-#define _SFXTBXMGR_HXX
-#define _SFXSTBMGR_HXX
-#define _SFX_MINFITEM_HXX
-#define _SFXEVENT_HXX
-
-//------------------------------------------------------------------------
-
#include <svx/outliner.hxx>
#include <svx/outlobj.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdouno.hxx>
-#include <svx/svdview.hxx>
#include <sfx2/dispatch.hxx>
#include "fuconstr.hxx"
@@ -204,6 +42,7 @@
#include "tabvwsh.hxx"
#include "futext.hxx"
#include "sc.hrc"
+#include "drawview.hxx"
// Maximal erlaubte Mausbewegung um noch Drag&Drop zu starten
//! fusel,fuconstr,futext - zusammenfassen!
@@ -217,7 +56,7 @@
|*
\************************************************************************/
-FuConstruct::FuConstruct(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuConstruct::FuConstruct(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq) :
FuDraw(pViewSh, pWin, pViewP, pDoc, rReq)
{
diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx
index 88c45e8d8e8d..8022d101ddba 100644
--- a/sc/source/ui/drawfunc/fuconuno.cxx
+++ b/sc/source/ui/drawfunc/fuconuno.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconuno.cxx,v $
- * $Revision: 1.10 $
+ * $Revision: 1.10.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,294 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------------
-
-// TOOLS
-#define _BIGINT_HXX
-#define _SFXMULTISEL_HXX
-#define _STACK_HXX
-#define _QUEUE_HXX
-#define _DYNARR_HXX
-#define _TREELIST_HXX
-#define _CACHESTR_HXX
-#define _NEW_HXX
-//#define _SHL_HXX
-//#define _LINK_HXX
-//#define _ERRCODE_HXX
-//#define _GEN_HXX
-//#define _FRACT_HXX
-//#define _STRING_HXX
-//#define _MTF_HXX
-//#define _CONTNR_HXX
-//#define _LIST_HXX
-//#define _TABLE_HXX
-#define _DYNARY_HXX
-//#define _UNQIDX_HXX
-#define _SVMEMPOOL_HXX
-//#define _UNQID_HXX
-//#define _DEBUG_HXX
-//#define _DATE_HXX
-//#define _TIME_HXX
-//#define _DATETIME_HXX
-//#define _INTN_HXX
-//#define _WLDCRD_HXX
-//#define _FSYS_HXX
-//#define _STREAM_HXX
-#define _CACHESTR_HXX
-#define _SV_MULTISEL_HXX
-
-//SV
-//#define _CLIP_HXX ***
-#define _CONFIG_HXX
-#define _CURSOR_HXX
-#define _FONTDLG_HXX
-#define _PRVWIN_HXX
-//#define _COLOR_HXX
-//#define _PAL_HXX
-//#define _BITMAP_HXX
-//#define _GDIOBJ_HXX
-//#define _POINTR_HXX
-//#define _ICON_HXX
-//#define _IMAGE_HXX
-//#define _KEYCOD_HXX
-//#define _EVENT_HXX
-#define _HELP_HXX
-//#define _APP_HXX
-//#define _MDIAPP_HXX
-//#define _TIMER_HXX
-//#define _METRIC_HXX
-//#define _REGION_HXX
-//#define _OUTDEV_HXX
-//#define _SYSTEM_HXX
-//#define _VIRDEV_HXX
-//#define _JOBSET_HXX
-//#define _PRINT_HXX
-//#define _WINDOW_HXX
-//#define _SYSWIN_HXX
-//#define _WRKWIN_HXX
-#define _MDIWIN_HXX
-//#define _FLOATWIN_HXX
-//#define _DOCKWIN_HXX
-//#define _CTRL_HXX
-//#define _SCRBAR_HXX
-//#define _BUTTON_HXX
-//#define _IMAGEBTN_HXX
-//#define _FIXED_HXX
-//#define _GROUP_HXX
-//#define _EDIT_HXX
-//#define _COMBOBOX_HXX
-//#define _LSTBOX_HXX
-//#define _SELENG_HXX ***
-//#define _SPLIT_HXX
-#define _SPIN_HXX
-//#define _FIELD_HXX
-//#define _MOREBTN_HXX ***
-//#define _TOOLBOX_HXX
-//#define _STATUS_HXX ***
-//#define _DIALOG_HXX
-//#define _MSGBOX_HXX
-//#define _SYSDLG_HXX
-//#define _FILDLG_HXX ***
-//#define _PRNDLG_HXX
-#define _COLDLG_HXX
-//#define _TABDLG_HXX
-//#define _MENU_HXX ***
-//#define _GDIMTF_HXX
-//#define _POLY_HXX
-//#define _ACCEL_HXX
-//#define _GRAPH_HXX
-#define _SOUND_HXX
-
-//******************************+++
-//svtools
-#define _SCRWIN_HXX
-#define _RULER_HXX
-//#define _TABBAR_HXX
-//#define _VALUESET_HXX
-#define _STDMENU_HXX
-//#define _STDCTRL_HXX
-//#define _CTRLBOX_HXX
-#define _CTRLTOOL_HXX
-#define _EXTATTR_HXX
-#define _FRM3D_HXX
-#define _EXTATTR_HXX
-
-//SVTOOLS
-//#define _SVTREELIST_HXX ***
-#define _FILTER_HXX
-//#define _SVLBOXITM_HXX ***
-//#define _SVTREEBOX_HXX ***
-#define _SVICNVW_HXX
-#define _SVTABBX_HXX
-
-
-//************************
-
-//sfxcore.hxx
-//#define _SFXINIMGR_HXX ***
-//#define _SFXCFGITEM_HXX
-//#define _SFX_PRINTER_HXX
-#define _SFXGENLINK_HXX
-#define _SFXHINTPOST_HXX
-#define _SFXDOCINF_HXX
-#define _SFXLINKHDL_HXX
-//#define _SFX_PROGRESS_HXX
-
-//sfxsh.hxx
-//#define _SFX_SHELL_HXX
-//#define _SFXAPP_HXX
-#define _SFXDISPATCH_HXX //???
-//#define _SFXMSG_HXX ***
-//#define _SFXOBJFACE_HXX ***
-//#define _SFXREQUEST_HXX
-#define _SFXMACRO_HXX
-
-// SFX
-//#define _SFXAPPWIN_HXX ***
-#define _SFX_SAVEOPT_HXX
-//#define _SFX_CHILDWIN_HXX
-//#define _SFXCTRLITEM_HXX
-#define _SFXPRNMON_HXX
-#define _INTRO_HXX
-#define _SFXMSGDESCR_HXX
-#define _SFXMSGPOOL_HXX
-#define _SFXFILEDLG_HXX
-#define _PASSWD_HXX
-#define _SFXTBXCTRL_HXX
-#define _SFXSTBITEM_HXX
-#define _SFXMNUITEM_HXX
-#define _SFXIMGMGR_HXX
-#define _SFXTBXMGR_HXX
-#define _SFXSTBMGR_HXX
-#define _SFX_MINFITEM_HXX
-#define _SFXEVENT_HXX
-
-//sfxdoc.hxx
-//#define _SFX_OBJSH_HXX
-//#define _SFX_CLIENTSH_HXX
-//#define _SFXDOCINF_HXX
-//#define _SFX_OBJFAC_HXX
-#define _SFX_DOCFILT_HXX
-//#define _SFXDOCFILE_HXX ***
-//define _VIEWFAC_HXX
-//#define _SFXVIEWFRM_HXX
-//#define _SFXVIEWSH_HXX
-//#define _MDIFRM_HXX ***
-#define _SFX_IPFRM_HXX
-//#define _SFX_INTERNO_HXX
-
-//sfxdlg.hxx
-//#define _SFXTABDLG_HXX
-//#define _BASEDLGS_HXX ***
-#define _SFX_DINFDLG_HXX
-#define _SFXDINFEDT_HXX
-#define _SFX_MGETEMPL_HXX
-#define _SFX_TPLPITEM_HXX
-//#define _SFX_STYLEDLG_HXX
-#define _NEWSTYLE_HXX
-//#define _SFXDOCTEMPL_HXX ***
-//#define _SFXDOCTDLG_HXX ***
-//#define _SFX_TEMPLDLG_HXX ***
-//#define _SFXNEW_HXX ***
-#define _SFXDOCMAN_HXX
-//#define _SFXDOCKWIN_HXX ***
-
-//sfxitems.hxx
-#define _SFX_WHMAP_HXX
-#define _ARGS_HXX
-//#define _SFXPOOLITEM_HXX
-//#define _SFXINTITEM_HXX
-//#define _SFXENUMITEM_HXX
-#define _SFXFLAGITEM_HXX
-//#define _SFXSTRITEM_HXX
-#define _SFXPTITEM_HXX
-#define _SFXRECTITEM_HXX
-//#define _SFXITEMPOOL_HXX
-//#define _SFXITEMSET_HXX
-#define _SFXITEMITER_HXX
-#define _SFX_WHITER_HXX
-#define _SFXPOOLCACH_HXX
-//#define _AEITEM_HXX
-#define _SFXRNGITEM_HXX
-//#define _SFXSLSTITM_HXX
-//#define _SFXSTYLE_HXX
-
-
-
-//************************
-
-
-
-#define _BIGINT_HXX
-#define _SFXMULTISEL_HXX
-#define _STACK_HXX
-#define _QUEUE_HXX
-#define _DYNARR_HXX
-#define _TREELIST_HXX
-#define _CACHESTR_HXX
-#define _NEW_HXX
-//#define _SHL_HXX ***
-//#define _LINK_HXX ***
-//#define _ERRCODE_HXX ***
-//#define _GEN_HXX ***
-//#define _FRACT_HXX ***
-//#define _STRING_HXX ***
-//#define _MTF_HXX ***
-//#define _CONTNR_HXX ***
-//#define _LIST_HXX ***
-//#define _TABLE_HXX ***
-#define _DYNARY_HXX
-//#define _UNQIDX_HXX ***
-#define _SVMEMPOOL_HXX
-//#define _UNQID_HXX ***
-//#define _DEBUG_HXX ***
-//#define _DATE_HXX ***
-//#define _TIME_HXX ***
-//#define _DATETIME_HXX ***
-//#define _INTN_HXX ***
-//#define _WLDCRD_HXX ***
-//#define _FSYS_HXX ***
-//#define _STREAM_HXX ***
-#define _CACHESTR_HXX
-#define _SV_MULTISEL_HXX
-
-#ifdef WIN
-#define _SVDOUKWN_HXX
-#define _SVDORECT_HXX
-#define _SVDCAPT_HXX
-#define _SVDOCIRC_HXX
-#define _SVDOEDGE_HXX
-#define _SVDOGRAF_HXX
-#define _SVDRAW_HXX
-#define _SVDOGRP_HXX
-#define _SVDOMEAS_HXX
-#define _SVDOOLE2_HXX
-#define _SVDOPAGE_HXX
-#define _SVDOPATH_HXX
-
-#endif
-
-#define SI_DLL_HXX
-#define SIDLL_HXX
-//#define SI_NOITEMS
-//#define SI_NODRW
-#define SI_NOOTHERFORMS
-#define SI_NOSBXCONTROLS
-#define SINOSBXCONTROLS
-#define SI_NOCONTROL
-
-//------------------------------------------------------------------------
-
-#include <svx/svdview.hxx>
-
#include "fuconuno.hxx"
#include "tabvwsh.hxx"
#include "sc.hrc"
-
-//------------------------------------------------------------------------
-
+#include "drawview.hxx"
/*************************************************************************
|*
@@ -326,7 +42,7 @@
|*
\************************************************************************/
-FuConstUnoControl::FuConstUnoControl(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuConstUnoControl::FuConstUnoControl(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq)
: FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq)
{
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index c4c72edaa007..2dccd6edbfe0 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fudraw.cxx,v $
- * $Revision: 1.25 $
+ * $Revision: 1.25.128.4 $
*
* This file is part of OpenOffice.org.
*
@@ -38,9 +38,9 @@
#include <svx/svdobj.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdouno.hxx>
-#include <svx/svdview.hxx>
#include <svx/svdocapt.hxx>
#include <svx/svdpage.hxx>
+#include <svx/svditer.hxx>
#include <svx/svdundo.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
@@ -55,6 +55,7 @@
#include "docsh.hxx"
#include "postit.hxx"
#include "globstr.hrc"
+#include "drawview.hxx"
/*************************************************************************
|*
@@ -62,7 +63,7 @@
|*
\************************************************************************/
-FuDraw::FuDraw(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuDraw::FuDraw(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq) :
FuPoor (pViewSh, pWin, pViewP, pDoc, rReq),
aNewPointer ( POINTER_ARROW ),
@@ -166,8 +167,6 @@ BOOL __EXPORT FuDraw::MouseButtonDown(const MouseEvent& rMEvt)
SetMouseButtonCode(rMEvt.GetButtons());
DoModifiers( rMEvt );
- if( !IsSizingOrMovingNote( rMEvt ) )
- CheckVisibleNote();
return FALSE;
}
@@ -247,6 +246,7 @@ BOOL lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell* pViewShell, const KeyEven
BOOL __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt)
{
BOOL bReturn = FALSE;
+ ScViewData& rViewData = *pViewShell->GetViewData();
switch ( rKEvt.GetKeyCode().GetCode() )
{
@@ -273,33 +273,23 @@ BOOL __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt)
if ( pViewShell->IsDrawTextShell() || aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT )
{
// in normale Draw-Shell, wenn Objekt selektiert, sonst Zeichnen aus
- pViewShell->GetViewData()->GetDispatcher().
- Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
+ rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
bReturn = TRUE;
}
else if ( pViewShell->IsDrawSelMode() )
{
pView->UnmarkAll();
- pViewShell->GetViewData()->GetDispatcher().
- Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
+ rViewData.GetDispatcher().Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
bReturn = TRUE;
}
else if ( pView->AreObjectsMarked() )
{
-
// #97016# III
- const SdrHdlList& rHdlList = pView->GetHdlList();
- SdrHdl* pHdl = rHdlList.GetFocusHdl();
-
- if(pHdl)
- {
- ((SdrHdlList&)rHdlList).ResetFocusHdl();
- }
+ SdrHdlList& rHdlList = const_cast< SdrHdlList& >( pView->GetHdlList() );
+ if( rHdlList.GetFocusHdl() )
+ rHdlList.ResetFocusHdl();
else
- {
- CheckVisibleNote();
pView->UnmarkAll();
- }
// Beim Bezier-Editieren ist jetzt wieder das Objekt selektiert
if (!pView->AreObjectsMarked())
@@ -310,56 +300,9 @@ BOOL __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt)
break;
case KEY_DELETE: //! ueber Accelerator
- {
- const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList();
- if(rNoteMarkList.GetMarkCount() == 1)
- {
- SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if ( pObj && pObj->GetLayer() == SC_LAYER_INTERN && pObj->ISA(SdrCaptionObj) )
- {
- ScDocument* pDoc = pViewShell->GetViewData()->GetDocument();
- SfxUndoManager* pUndoMan = NULL;
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
- if (pModel)
- {
- SfxObjectShell* pObjSh = pViewShell->GetViewData()->GetSfxDocShell();
- if (pObjSh)
- pUndoMan = pObjSh->GetUndoManager();
- if (pUndoMan)
- {
- String aUndoStr(ScGlobal::GetRscString( STR_UNDO_EDITNOTE ));
- pUndoMan->EnterListAction( aUndoStr, aUndoStr );
- SdrUndoGroup* pShowUndo = pModel->GetCalcUndo();
- if (pShowUndo)
- pUndoMan->AddUndoAction( pShowUndo );
- }
- ScAddress aTabPos;
- ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObj, pViewShell->GetViewData()->GetTabNo() );
- if( pData )
- aTabPos = pData->aStt;
- ScPostIt aNote(pDoc);
- pViewShell->SetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote ); // with Undo
-
- SdrLayer* pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if (pLockLayer && !pView->IsLayerLocked(pLockLayer->GetName()))
- pView->SetLayerLocked( pLockLayer->GetName(), TRUE );
- SdrPage* pPage = pModel->GetPage( aTabPos.Tab() );
- if(pPage)
- {
- pDrDoc->AddUndo( new SdrUndoRemoveObj( *pObj ) );
- pPage->RemoveObject( pObj->GetOrdNum() );
- }
- if (pUndoMan)
- pUndoMan->LeaveListAction();
- }
- bReturn = TRUE;
- break;
- }
- }
pView->DeleteMarked();
bReturn = TRUE;
- }
- break;
+ break;
case KEY_RETURN:
{
@@ -524,10 +467,8 @@ BOOL __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt)
// disable cursor travelling on note objects as the tail connector position
// must not move.
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if(pObj && pObj->ISA(SdrCaptionObj) && pObj->GetLayer() == SC_LAYER_INTERN)
- {
- break;
- }
+ if( ScDrawLayer::IsNoteCaption( pObj ) )
+ break;
}
long nX = 0;
@@ -559,8 +500,7 @@ BOOL __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt)
nY = 0;
}
- ScViewData* pViewData = pViewShell->GetViewData();
- BOOL bReadOnly = pViewData ? pViewData->GetDocShell()->IsReadOnly() : FALSE;
+ BOOL bReadOnly = rViewData.GetDocShell()->IsReadOnly();
if(!rKEvt.GetKeyCode().IsMod1() && !bReadOnly)
{
@@ -913,7 +853,7 @@ BOOL FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const
if(rNoteMarkList.GetMarkCount() == 1)
{
SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if ( pObj && pObj->GetLayer() == SC_LAYER_INTERN && pObj->ISA(SdrCaptionObj) )
+ if ( ScDrawLayer::IsNoteCaption( pObj ) )
{
Point aMPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
bIsSizingOrMoving =
@@ -924,40 +864,3 @@ BOOL FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const
}
return bIsSizingOrMoving;
}
-
-// we can arrive here if a Note set to 'not shown' has changed its
-// text alignment leaving the note in resize/draw mode. The next mouse
-// button-down action or ESC should remove this note.
-void FuDraw::CheckVisibleNote() const
-{
- const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList();
- if(rNoteMarkList.GetMarkCount() == 1)
- {
- SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if ( pObj && pObj->GetLayer() == SC_LAYER_INTERN && pObj->ISA(SdrCaptionObj) )
- {
- ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObj, pViewShell->GetViewData()->GetTabNo() );
- if( pData )
- {
- ScAddress aTabPos = ScAddress( pData->aStt);
- ScDocument* pDoc = pViewShell->GetViewData()->GetDocument();
- ScPostIt aNote(pDoc);
- if(pDoc->GetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote ) && !aNote.IsShown())
- {
-
- SdrLayer* pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if (pLockLayer && !pView->IsLayerLocked(pLockLayer->GetName()))
- pView->SetLayerLocked( pLockLayer->GetName(), TRUE );
- if(ScDrawLayer* pModel = pDoc->GetDrawLayer())
- {
- if(SdrPage* pPage = pModel->GetPage( aTabPos.Tab()))
- {
- pDrDoc->AddUndo( new SdrUndoRemoveObj( *pObj ) );
- pPage->RemoveObject( pObj->GetOrdNum() );
- }
- }
- }
- }
- }
- }
-}
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index cb4332fca9c4..3274b6752c95 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuins1.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,10 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------------
-
#include <svx/impgrf.hxx>
#include <svx/opengrf.hxx>
#include <svx/svdograf.hxx>
@@ -256,7 +252,7 @@ void lcl_InsertMedia( const ::rtl::OUString& rMediaURL, bool bApi,
FuInsertGraphic::FuInsertGraphic( ScTabViewShell* pViewSh,
Window* pWin,
- SdrView* pViewP,
+ ScDrawView* pViewP,
SdrModel* pDoc,
SfxRequest& rReq )
: FuPoor(pViewSh, pWin, pViewP, pDoc, rReq)
@@ -377,7 +373,7 @@ void FuInsertGraphic::Deactivate()
FuInsertMedia::FuInsertMedia( ScTabViewShell* pViewSh,
Window* pWin,
- SdrView* pViewP,
+ ScDrawView* pViewP,
SdrModel* pDoc,
SfxRequest& rReq ) :
FuPoor(pViewSh, pWin, pViewP, pDoc, rReq)
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 6bc072420150..5dff4041bd22 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuins2.cxx,v $
- * $Revision: 1.31 $
+ * $Revision: 1.31.20.1 $
*
* This file is part of OpenOffice.org.
*
@@ -45,7 +45,6 @@
#include <sfx2/docfile.hxx>
#include <svtools/stritem.hxx>
#include <svx/svdoole2.hxx>
-#include <svx/svdview.hxx>
#include <svx/pfiledlg.hxx>
#include <tools/urlobj.hxx>
#include <vcl/msgbox.hxx>
@@ -94,6 +93,7 @@ using namespace ::com::sun::star;
#include "chartlis.hxx"
#include "uiitems.hxx"
#include "globstr.hrc"
+#include "drawview.hxx"
extern SdrObject* pSkipPaintObj; // output.cxx - dieses Objekt nicht zeichnen
@@ -217,7 +217,7 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
|*
\************************************************************************/
-FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq)
: FuPoor(pViewSh, pWin, pViewP, pDoc, rReq)
{
@@ -486,7 +486,7 @@ void FuInsertOLE::Deactivate()
|*
\************************************************************************/
-FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq)
: FuPoor(pViewSh, pWin, pViewP, pDoc, rReq)
{
diff --git a/sc/source/ui/drawfunc/fumark.cxx b/sc/source/ui/drawfunc/fumark.cxx
index 7b37ba3383f1..6cc1c70ff5cf 100644
--- a/sc/source/ui/drawfunc/fumark.cxx
+++ b/sc/source/ui/drawfunc/fumark.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fumark.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,11 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------
-
-#include <svx/svdview.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
@@ -46,6 +41,7 @@
#include "reffact.hxx"
#include "document.hxx"
#include "scresid.hxx"
+#include "drawview.hxx"
//------------------------------------------------------------------
@@ -55,7 +51,7 @@
|*
\************************************************************************/
-FuMarkRect::FuMarkRect(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuMarkRect::FuMarkRect(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq) :
FuPoor(pViewSh, pWin, pViewP, pDoc, rReq),
bVisible(FALSE),
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index 9c682bff97f9..c26d3fdcb5fc 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fupoor.cxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.13.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,194 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------------
-
-// TOOLS
-#define _BIGINT_HXX
-#define _SFXMULTISEL_HXX
-#define _STACK_HXX
-#define _QUEUE_HXX
-#define _DYNARR_HXX
-#define _TREELIST_HXX
-#define _CACHESTR_HXX
-#define _NEW_HXX
-//#define _SHL_HXX
-//#define _LINK_HXX
-//#define _ERRCODE_HXX
-//#define _GEN_HXX
-//#define _FRACT_HXX
-//#define _STRING_HXX
-//#define _MTF_HXX
-//#define _CONTNR_HXX
-//#define _LIST_HXX
-//#define _TABLE_HXX
-#define _DYNARY_HXX
-//#define _UNQIDX_HXX
-#define _SVMEMPOOL_HXX
-//#define _UNQID_HXX
-//#define _DEBUG_HXX
-//#define _DATE_HXX
-//#define _TIME_HXX
-//#define _DATETIME_HXX
-//#define _INTN_HXX
-//#define _WLDCRD_HXX
-//#define _FSYS_HXX
-//#define _STREAM_HXX
-#define _CACHESTR_HXX
-#define _SV_MULTISEL_HXX
-
-//SV
-//#define _CLIP_HXX ***
-#define _CONFIG_HXX
-#define _CURSOR_HXX
-#define _FONTDLG_HXX
-#define _PRVWIN_HXX
-//#define _COLOR_HXX
-//#define _PAL_HXX
-//#define _BITMAP_HXX
-//#define _GDIOBJ_HXX
-//#define _POINTR_HXX
-//#define _ICON_HXX
-//#define _IMAGE_HXX
-//#define _KEYCOD_HXX
-//#define _EVENT_HXX
-#define _HELP_HXX
-//#define _APP_HXX
-//#define _MDIAPP_HXX
-//#define _TIMER_HXX
-//#define _METRIC_HXX
-//#define _REGION_HXX
-//#define _OUTDEV_HXX
-//#define _SYSTEM_HXX
-//#define _VIRDEV_HXX
-//#define _JOBSET_HXX
-//#define _PRINT_HXX
-//#define _WINDOW_HXX
-//#define _SYSWIN_HXX
-//#define _WRKWIN_HXX
-#define _MDIWIN_HXX
-//#define _FLOATWIN_HXX
-//#define _DOCKWIN_HXX
-//#define _CTRL_HXX
-//#define _SCRBAR_HXX
-//#define _BUTTON_HXX
-//#define _IMAGEBTN_HXX
-//#define _FIXED_HXX
-//#define _GROUP_HXX
-//#define _EDIT_HXX
-//#define _COMBOBOX_HXX
-//#define _LSTBOX_HXX
-//#define _SELENG_HXX ***
-//#define _SPLIT_HXX
-#define _SPIN_HXX
-//#define _FIELD_HXX
-//#define _MOREBTN_HXX ***
-//#define _TOOLBOX_HXX ***
-//#define _STATUS_HXX ***
-//#define _DIALOG_HXX ***
-//#define _MSGBOX_HXX ***
-//#define _SYSDLG_HXX ***
-//#define _PRNDLG_HXX ***
-#define _COLDLG_HXX
-#define _TABDLG_HXX
-//#define _GDIMTF_HXX ***
-//#define _POLY_HXX ***
-#ifdef WIN
-#define _ACCEL_HXX
-#endif
-//#define _GRAPH_HXX ***
-#define _SOUND_HXX
-
-//svtools
-#define _SCRWIN_HXX
-#define _RULER_HXX
-#define _TABBAR_HXX
-#define _VALUESET_HXX
-#define _STDMENU_HXX
-#define _STDCTRL_HXX
-#define _CTRLBOX_HXX
-#define _CTRLTOOL_HXX
-#define _EXTATTR_HXX
-#define _FRM3D_HXX
-#define _EXTATTR_HXX
-
-//SVTOOLS
-//#define _SVTREELIST_HXX ***
-#define _FILTER_HXX
-//#define _SVLBOXITM_HXX ***
-//#define _SVTREEBOX_HXX ***
-#define _SVICNVW_HXX
-#define _SVTABBX_HXX
-
-//sfxcore.hxx
-//#define _SFXINIMGR_HXX ***
-//#define _SFXCFGITEM_HXX ***
-//#define _SFX_PRINTER_HXX ***
-#define _SFXGENLINK_HXX
-#define _SFXHINTPOST_HXX
-// #define _SFXDOCINF_HXX ***
-#define _SFXLINKHDL_HXX
-//#define _SFX_PROGRESS_HXX ***
-
-//sfxsh.hxx
-//#define _SFX_SHELL_HXX ***
-//#define _SFXAPP_HXX ***
-#define _SFXDISPATCH_HXX
-//#define _SFXMSG_HXX ***
-//#define _SFXOBJFACE_HXX ***
-//#define _SFXREQUEST_HXX ***
-#define _SFXMACRO_HXX
-
-// SFX
-//#define _SFXAPPWIN_HXX ***
-#define _SFX_SAVEOPT_HXX
-//#define _SFX_CHILDWIN_HXX ***
-#define _SFXCTRLITEM_HXX
-#define _SFXPRNMON_HXX
-#define _INTRO_HXX
-#define _SFXMSGDESCR_HXX
-#define _SFXMSGPOOL_HXX
-#define _SFXFILEDLG_HXX
-#define _PASSWD_HXX
-#define _SFXTBXCTRL_HXX
-#define _SFXSTBITEM_HXX
-#define _SFXMNUITEM_HXX
-#define _SFXIMGMGR_HXX
-#define _SFXTBXMGR_HXX
-#define _SFXSTBMGR_HXX
-#define _SFX_MINFITEM_HXX
-#define _SFXEVENT_HXX
-
-//sfxdoc.hxx
-//#define _SFX_OBJSH_HXX ***
-//#define _SFX_CLIENTSH_HXX ***
-//#define _SFXDOCINF_HXX ***
-//#define _SFX_OBJFAC_HXX ***
-#define _SFX_DOCFILT_HXX
-//#define _SFXDOCFILE_HXX ***
-//#define _VIEWFAC_HXX ***
-#define _SFXVIEWFRM_HXX
-//#define _SFXVIEWSH_HXX ***
-#define _MDIFRM_HXX
-#define _SFX_IPFRM_HXX
-#define _SFX_INTERNO_HXX
-
-
-//svdraw.hxx
-#define _SDR_NOVIEWMARKER
-#define _SDR_NODRAGMETHODS
-//#define _SDR_NOUNDO
-#define _SDR_NOXOUTDEV
-#define _SDR_NOITEMS
-#define _SDR_NOTOUCH
-#define _SDR_NOTRANSFORM
-#define _SDR_NOOBJECTS
-//#define _SDR_NOVIEWS
-
-//------------------------------------------------------------------------
-
#include <svx/outliner.hxx>
#include <svx/svditer.hxx>
#include <svx/svdobj.hxx>
@@ -237,7 +49,7 @@
|*
\************************************************************************/
-FuPoor::FuPoor(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuPoor::FuPoor(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq) :
pView(pViewP),
pViewShell(pViewSh),
@@ -504,7 +316,6 @@ IMPL_LINK( FuPoor, DragHdl, void *, EMPTYARG )
return 0;
}
-
// Detektiv-Linie
BOOL FuPoor::IsDetectiveHit( const Point& rLogicPos )
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 49ad82821303..02fc2e38b0f6 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fusel.cxx,v $
- * $Revision: 1.23 $
+ * $Revision: 1.23.128.3 $
*
* This file is part of OpenOffice.org.
*
@@ -41,7 +41,6 @@
#include <svx/svdotext.hxx>
#include <sfx2/dispatch.hxx>
#include <svtools/imapobj.hxx>
-#include <svx/svdview.hxx>
#include <svx/svdouno.hxx>
#include <svx/svdomedia.hxx>
#include <svx/svdpagv.hxx>
@@ -53,6 +52,7 @@
#include "sc.hrc"
#include "fudraw.hxx"
#include "futext.hxx"
+#include "drawview.hxx"
#include "tabvwsh.hxx"
#include "drawpage.hxx"
#include "globstr.hrc"
@@ -80,7 +80,7 @@ using namespace com::sun::star;
|*
\************************************************************************/
-FuSelection::FuSelection(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuSelection::FuSelection(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq ) :
FuDraw(pViewSh, pWin, pViewP, pDoc, rReq),
bVCAction(FALSE)
@@ -146,7 +146,7 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pMarkedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pMarkedObj && pMarkedObj->ISA( SdrCaptionObj )&& pMarkedObj->GetLayer() == SC_LAYER_INTERN)
+ if( ScDrawLayer::IsNoteCaption( pMarkedObj ) )
{
// move using the valid caption handles for note text box.
if(pHdl && (pHdl->GetKind() != HDL_POLY && pHdl->GetKind() != HDL_CIRC))
@@ -272,14 +272,18 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
// Markieren
- if ( !rMEvt.IsShift() )
+ // do not allow multiselection with note caption
+ bool bCaptionClicked = IsNoteCaptionClicked( aMDPos );
+ if ( !rMEvt.IsShift() || bCaptionClicked || IsNoteCaptionMarked() )
pView->UnmarkAll();
- // if a comment: unlock the internal layer here.
- // re-lock in ScDrawView::MarkListHasChanged()
- TestComment( pView->GetSdrPageView(), aMDPos );
+ /* Unlock internal layer, if a note caption is clicked. The
+ layer will be relocked in ScDrawView::MarkListHasChanged(). */
+ if( bCaptionClicked )
+ pView->UnlockInternalLayer();
- if ( pView->MarkObj(aMDPos, -2, FALSE, rMEvt.IsMod1()) )
+ // try to select the clicked object
+ if ( pView->MarkObj( aMDPos, -2, FALSE, rMEvt.IsMod1() ) )
{
//*********************************************************
//Objekt verschieben
@@ -421,9 +425,32 @@ BOOL __EXPORT FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
}
else if (pView->IsAction() )
{
+ // unlock internal layer to include note captions
+ pView->UnlockInternalLayer();
pView->EndAction();
if ( pView->AreObjectsMarked() )
+ {
bReturn = TRUE;
+
+ /* if multi-selection contains a note caption object, remove
+ all other objects from selection. */
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ ULONG nCount = rMarkList.GetMarkCount();
+ if( nCount > 1 )
+ {
+ bool bFound = false;
+ for( ULONG nIdx = 0; !bFound && (nIdx < nCount); ++nIdx )
+ {
+ SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj();
+ bFound = ScDrawLayer::IsNoteCaption( pObj );
+ if( bFound )
+ {
+ pView->UnMarkAll();
+ pView->MarkObj( pObj, pView->GetSdrPageView() );
+ }
+ }
+ }
+ }
}
}
diff --git a/sc/source/ui/drawfunc/fusel2.cxx b/sc/source/ui/drawfunc/fusel2.cxx
index 1ab8eab8a630..636a1b457f3c 100644
--- a/sc/source/ui/drawfunc/fusel2.cxx
+++ b/sc/source/ui/drawfunc/fusel2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fusel2.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.128.2 $
*
* This file is part of OpenOffice.org.
*
@@ -39,7 +39,6 @@
#include <svx/svdocapt.hxx>
#include <svx/svdpagv.hxx>
#include <sfx2/dispatch.hxx>
-#include <svx/svdview.hxx>
#include <svx/outliner.hxx>
#include "fusel.hxx"
@@ -52,6 +51,8 @@
#include "scitems.hxx"
#include "userdat.hxx"
#include "drwlayer.hxx"
+#include "docsh.hxx"
+#include "drawview.hxx"
// -----------------------------------------------------------------------
@@ -123,64 +124,61 @@ BOOL FuSelection::TestDetective( SdrPageView* pPV, const Point& rPos )
return bFound;
}
-BOOL FuSelection::TestComment( SdrPageView* pPV, const Point& rPos )
+bool FuSelection::IsNoteCaptionMarked() const
{
- if (!pPV)
- return FALSE;
-
- SdrObject* pFoundObj = NULL;
- ScAddress aTabPos;
-
- SdrObjListIter aIter( *pPV->GetObjList(), IM_FLAT );
- SdrObject* pObject = aIter.Next();
- while (pObject)
+ if( pView )
{
- if ( pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA(SdrCaptionObj)
- && pObject->GetLogicRect().IsInside( rPos ) )
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
{
- pFoundObj = pObject;
- ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObject, pViewShell->GetViewData()->GetTabNo() );
- if( pData )
- {
- aTabPos = ScAddress( pData->aStt);
- }
- // keep searching - use the last matching object (on top)
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ return ScDrawLayer::IsNoteCaption( pObj );
}
- pObject = aIter.Next();
}
+ return false;
+}
-
- if ( pFoundObj )
+bool FuSelection::IsNoteCaptionClicked( const Point& rPos ) const
+{
+ SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
+ if( pPageView )
{
- SdrLayer* pLockLayer = NULL;
- ScDocument* pDoc = pViewShell->GetViewData()->GetDocument();
- SfxObjectShell* pDocSh = pViewShell->GetViewData()->GetSfxDocShell();
- const ScProtectionAttr* pProtAttr = static_cast< const ScProtectionAttr* > (pDoc->GetAttr(aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), ATTR_PROTECTION ) );
- BOOL bProtectAttr = pProtAttr->GetProtection() || pProtAttr->GetHideCell() ;
- BOOL bProtectDoc = pDoc->IsTabProtected(aTabPos.Tab()) || pDocSh->IsReadOnly() ;
- BOOL bProtect = bProtectDoc && bProtectAttr ;
- pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if (pLockLayer && pView->IsLayerLocked(pLockLayer->GetName()))
- pView->SetLayerLocked( pLockLayer->GetName(), bProtect );
+ const ScViewData& rViewData = *pViewShell->GetViewData();
+ ScDocument& rDoc = *rViewData.GetDocument();
+ SCTAB nTab = rViewData.GetTabNo();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
+ bool bProtectDoc = rDoc.IsTabProtected( nTab ) || (pDocSh && pDocSh->IsReadOnly());
+
+ // search the last object (on top) in the object list
+ SdrObjListIter aIter( *pPageView->GetObjList(), IM_DEEPNOGROUPS, TRUE );
+ for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
+ {
+ if( pObj->GetLogicRect().IsInside( rPos ) )
+ {
+ // skip caption objects of notes in protected cells
+ bool bSkip = false;
+ if( const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab ) )
+ {
+ const ScAddress& rNotePos = pCaptData->maStart;
+ const ScProtectionAttr* pProtAttr = static_cast< const ScProtectionAttr* >( rDoc.GetAttr( rNotePos.Col(), rNotePos.Row(), nTab, ATTR_PROTECTION ) );
+ bool bProtectAttr = pProtAttr->GetProtection() || pProtAttr->GetHideCell();
+ bSkip = bProtectAttr && bProtectDoc;
+ }
+ if( !bSkip )
+ return true;
+ }
+ }
}
-
- return (pFoundObj != NULL);
+ return false;
}
-void FuSelection::ActivateNoteHandles(SdrObject* pObject) const
+void FuSelection::ActivateNoteHandles(SdrObject* pObject)
{
- if(!pObject && !pView)
- return;
- if ( pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA(SdrCaptionObj))
+ if( pView && ScDrawLayer::IsNoteCaption( pObject ) )
{
- SdrLayer* pLockLayer = NULL;
-
- // Leave the internal note object unlocked - re-lock in ScDrawView::MarkListHasChanged()
- pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if (pLockLayer && pView->IsLayerLocked(pLockLayer->GetName()))
- pView->SetLayerLocked( pLockLayer->GetName(), FALSE );
- SdrPageView* pPV = pView->GetSdrPageView();
- pView->MarkObj(pObject, pPV);
+ // Leave the internal layer unlocked - relock in ScDrawView::MarkListHasChanged()
+ pView->UnlockInternalLayer();
+ pView->MarkObj( pObject, pView->GetSdrPageView() );
}
}
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 5abb3f3b756c..ca9fc462b9df 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: futext.cxx,v $
- * $Revision: 1.28.144.1 $
+ * $Revision: 1.28.128.2 $
*
* This file is part of OpenOffice.org.
*
@@ -31,16 +31,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-//------------------------------------------------------------------
-
#include <svx/svddef.hxx>
#include <svx/svdoutl.hxx>
#include <svx/outlobj.hxx>
#include <svx/sdtaaitm.hxx>
#include <svx/sdtacitm.hxx>
#include <svx/svdotext.hxx>
-#include <svx/svdview.hxx>
#include <svx/unolingu.hxx>
#include <svx/svdocapt.hxx>
#include <sfx2/bindings.hxx>
@@ -52,6 +48,7 @@
#include "drwlayer.hxx"
#include "sc.hrc"
#include "tabvwsh.hxx"
+#include "drawview.hxx"
// #98185# Create default drawing objects via keyboard
#include "scresid.hxx"
@@ -111,7 +108,7 @@ void lcl_UpdateHyphenator( Outliner& rOutliner, SdrObject* pObj )
|*
\************************************************************************/
-FuText::FuText(ScTabViewShell* pViewSh, Window* pWin, SdrView* pViewP,
+FuText::FuText(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, SfxRequest& rReq) :
FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq),
pTextObj(NULL)
@@ -228,7 +225,7 @@ BOOL __EXPORT FuText::MouseButtonDown(const MouseEvent& rMEvt)
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pMarkedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pMarkedObj && pMarkedObj->ISA( SdrCaptionObj) && pMarkedObj->GetLayer() == SC_LAYER_INTERN)
+ if( ScDrawLayer::IsNoteCaption( pMarkedObj ) )
{
if(pHdl->GetKind() != HDL_POLY && pHdl->GetKind() != HDL_CIRC)
bDrag = true;
@@ -735,18 +732,11 @@ void FuText::SelectionHasChanged()
void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
BOOL bCursorToEnd, const KeyEvent* pInitialKey)
{
- // pObj != NULL, wenn ein spezielles (nicht markiertes) Objekt editiert werden soll
- // (-> Legendenobjekt von Notizen)
- // wenn pObj == NULL, markiertes Objekt nehmen
-
- SdrLayer* pLockLayer = NULL;
- if ( pObj && pObj->GetLayer() == SC_LAYER_INTERN )
- {
- // A Locked Layer cannot be edited.
- pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if (pLockLayer && pView->IsLayerLocked(pLockLayer->GetName()))
- pView->SetLayerLocked( pLockLayer->GetName(), FALSE );
- }
+ /* It is possible to pass a special (unselected) object in pObj, e.g. the
+ caption object of a cell note. If pObj is 0, then the selected object
+ is used. The layer will be relocked in FuText::StopEditMode(). */
+ if ( pObj && (pObj->GetLayer() == SC_LAYER_INTERN) )
+ pView->UnlockInternalLayer();
if ( !pObj && pView->AreObjectsMarked() )
{
@@ -824,9 +814,6 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
}
}
}
- // Leave the internal note object unlocked - re-lock in StopEditMode().
- if (pLockLayer && !pView->IsLayerLocked(pLockLayer->GetName()) && !pObj->ISA(SdrCaptionObj))
- pView->SetLayerLocked( pLockLayer->GetName(), TRUE );
}
// #98185# Create default drawing objects via keyboard
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index f4fedd69d00c..3fc99568e173 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: futext3.cxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.15.128.8 $
*
* This file is part of OpenOffice.org.
*
@@ -37,6 +37,7 @@
#include <svx/svdpage.hxx>
#include <svx/svdundo.hxx>
#include <svx/svdview.hxx>
+#include <svx/editobj.hxx>
#include <vcl/cursor.hxx>
#include <sfx2/objsh.hxx>
#include <svx/writingmodeitem.hxx>
@@ -54,6 +55,7 @@
#include "attrib.hxx"
#include "scitems.hxx"
#include "drawview.hxx"
+#include "undocell.hxx"
// ------------------------------------------------------------------------------------
// Editieren von Notiz-Legendenobjekten muss immer ueber StopEditMode beendet werden,
@@ -62,213 +64,181 @@
// bTextDirection=TRUE means that this function is called from SID_TEXTDIRECTION_XXX(drtxtob.cxx).
// ------------------------------------------------------------------------------------
-void FuText::StopEditMode(BOOL bTextDirection)
+void FuText::StopEditMode(BOOL /*bTextDirection*/)
{
- BOOL bComment = FALSE;
- ScAddress aTabPos;
- BOOL bVertical = FALSE;
-
SdrObject* pObject = pView->GetTextEditObject();
- if ( pObject && pObject->GetLayer()==SC_LAYER_INTERN && pObject->ISA(SdrCaptionObj) )
- {
- ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObject, pViewShell->GetViewData()->GetTabNo() );
- if( pData )
- {
- aTabPos = ScAddress( pData->aStt);
- bComment = TRUE;
- }
- const SfxItemSet& rSet = pObject->GetMergedItemSet();
- bVertical = static_cast<const SvxWritingModeItem&> (rSet.Get (SDRATTR_TEXTDIRECTION)).GetValue() == com::sun::star::text::WritingMode_TB_RL;
- }
+ if( !pObject ) return;
- ScDocument* pDoc = pViewShell->GetViewData()->GetDocument();
- BOOL bUndo (pDoc->IsUndoEnabled());
+ // relock the internal layer that has been unlocked in FuText::SetInEditMode()
+ if ( pObject->GetLayer() == SC_LAYER_INTERN )
+ pView->LockInternalLayer();
- SfxObjectShell* pObjSh = pViewShell->GetViewData()->GetSfxDocShell();
- SfxUndoManager* pUndoMan = NULL;
- if (bUndo)
- pUndoMan = pObjSh->GetUndoManager();
- if ( bComment && bUndo)
+ ScViewData& rViewData = *pViewShell->GetViewData();
+ ScDocument& rDoc = *rViewData.GetDocument();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+ DBG_ASSERT( pDrawLayer && (pDrawLayer == pDrDoc), "FuText::StopEditMode - missing or different drawing layers" );
+
+ ScAddress aNotePos;
+ ScPostIt* pNote = 0;
+ if( const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObject, rViewData.GetTabNo() ) )
{
- // fade in, edit, fade out, note change together into a ListAction
+ aNotePos = pCaptData->maStart;
+ pNote = rDoc.GetNote( aNotePos );
+ DBG_ASSERT( pNote && (pNote->GetCaption() == pObject), "FuText::StopEditMode - missing or invalid cell note" );
+ }
+ ScDocShell* pDocShell = rViewData.GetDocShell();
+ SfxUndoManager* pUndoMgr = rDoc.IsUndoEnabled() ? pDocShell->GetUndoManager() : 0;
+ bool bNewNote = false;
+ if( pNote && pUndoMgr )
+ {
+ /* Put all undo actions already collected (e.g. create caption object)
+ and all following undo actions (text changed) together into a ListAction. */
String aUndoStr = ScGlobal::GetRscString( STR_UNDO_EDITNOTE );
- pUndoMan->EnterListAction( aUndoStr, aUndoStr );
-
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
- SdrUndoGroup* pShowUndo = pModel->GetCalcUndo();
- if (pShowUndo)
- pUndoMan->AddUndoAction( pShowUndo );
+ pUndoMgr->EnterListAction( aUndoStr, aUndoStr );
+ if( SdrUndoGroup* pCalcUndo = pDrawLayer->GetCalcUndo() )
+ {
+ /* Note has been created before editing, if first undo action is
+ an insert action. Needed below to decide whether to drop the
+ undo if editing a new note has been cancelled. */
+ bNewNote = (pCalcUndo->GetActionCount() > 0) && pCalcUndo->GetAction( 0 )->ISA( SdrUndoNewObj );
+ // create a "insert note" undo action if needed
+ if( bNewNote )
+ pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, pNote->GetNoteData(), true, pCalcUndo ) );
+ else
+ pUndoMgr->AddUndoAction( pCalcUndo );
+ }
}
- SdrEndTextEditKind eResult = pView->SdrEndTextEdit();
- pViewShell->SetDrawTextUndo(NULL); // or ScEndTextEdit (with drawview.hxx)
+ /* SdrObjEditView::SdrEndTextEdit() may try to delete the entire drawing
+ object, if it does not contain text and has invisible border and fill.
+ This must not happen for note caption objects. They will be removed
+ below together with the cell note if the text is empty (independent of
+ border and area formatting). It is possible to prevent automatic
+ deletion by passing sal_True to this function. The return value changes
+ from SDRENDTEXTEDIT_DELETED to SDRENDTEXTEDIT_SHOULDBEDELETED in this
+ case. */
+ /*SdrEndTextEditKind eResult =*/ pView->SdrEndTextEdit( pNote != 0 );
+
+ // or ScEndTextEdit (with drawview.hxx)
+ pViewShell->SetDrawTextUndo( 0 );
Cursor* pCur = pWindow->GetCursor();
- if (pCur && pCur->IsVisible())
+ if( pCur && pCur->IsVisible() )
pCur->Hide();
- if ( bComment )
+ if( pNote )
{
- ScPostIt aNote(pDoc);
- BOOL bWas = pDoc->GetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote );
- if( bWas )
- {
- SdrLayer* pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if (pLockLayer && !pView->IsLayerLocked(pLockLayer->GetName()))
- pView->SetLayerLocked( pLockLayer->GetName(), TRUE );
- }
+ // hide the caption object if it is in hidden state
+ pNote->HideCaptionTemp();
- // Ignore if text unchanged. If called from a change in
- // TextDirection mode then always enter as we need to
- // store the new EditTextObject.
+ // update author and date
+ pNote->AutoStamp();
- if ( eResult != SDRENDTEXTEDIT_UNCHANGED || !bWas || !aNote.IsShown() || bTextDirection)
+ /* If the entire text has been cleared, the cell note and its caption
+ object have to be removed. */
+ SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >( pObject );
+ bool bDeleteNote = !pTextObject || !pTextObject->HasText();
+ if( bDeleteNote )
{
- ::std::auto_ptr<EditTextObject> pEditText ;
- if ( eResult != SDRENDTEXTEDIT_DELETED )
+ if( pUndoMgr )
{
- OutlinerParaObject* pParaObj = pObject->GetOutlinerParaObject();
- if ( pParaObj )
- {
- pParaObj->SetVertical(bVertical);
- ScNoteEditEngine& rEE = pDoc->GetNoteEngine();
- rEE.SetVertical(bVertical);
- const EditTextObject& rTextObj = pParaObj->GetTextObject();
- rEE.SetText(rTextObj);
- sal_uInt16 nCount = rEE.GetParagraphCount();
- for( sal_uInt16 nPara = 0; nPara < nCount; ++nPara )
- {
- String aParaText( rEE.GetText( nPara ) );
- if( aParaText.Len() )
- {
- SfxItemSet aSet( rTextObj.GetParaAttribs( nPara));
- rEE.SetParaAttribs(nPara, aSet);
- }
- }
- pEditText.reset(rEE.CreateTextObject());
- }
+ // collect the "remove object" drawing undo action created by DeleteNote()
+ pDrawLayer->BeginCalcUndo();
+ // rescue note data before deletion
+ ScNoteData aNoteData( pNote->GetNoteData() );
+ // delete note from document (removes caption, but does not delete it)
+ rDoc.DeleteNote( aNotePos );
+ // create undo action for removed note
+ pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
}
- Rectangle aNewRect;
- Rectangle aOldRect = aNote.GetRectangle();
- SdrCaptionObj* pCaption = static_cast<SdrCaptionObj*>(pObject);
- if(pCaption)
+ else
{
- aNewRect = pCaption->GetLogicRect();
- if(aOldRect != aNewRect)
- aNote.SetRectangle(aNewRect);
+ rDoc.DeleteNote( aNotePos );
}
- aNote.SetEditTextObject(pEditText.get()); // if pEditText is NULL, then aNote.mpEditObj will be reset().
- aNote.AutoStamp();
- aNote.SetItemSet(pCaption->GetMergedItemSet());
-
- BOOL bRemove = (!aNote.IsShown() || aNote.IsEmpty() || !bWas) && !bTextDirection;
- if ( bRemove )
- aNote.SetShown( FALSE );
- pViewShell->SetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote ); // with Undo
+ // ScDocument::DeleteNote has deleted the note that pNote points to
+ pNote = 0;
+ }
- if ( bRemove && eResult != SDRENDTEXTEDIT_DELETED ) // Object Delete ?
+ // finalize the undo list action
+ if( pUndoMgr )
+ {
+ pUndoMgr->LeaveListAction();
+
+ /* #i94039# Update the default name "Edit Note" of the undo action
+ if the note has been created before editing or is deleted due
+ to deleted text. If the note has been created *and* is deleted,
+ the last undo action can be removed completely. Note: The
+ function LeaveListAction() removes the last action by itself,
+ if it is empty (when result is SDRENDTEXTEDIT_UNCHANGED). */
+ if( bNewNote && bDeleteNote )
{
- // Lock the internal layer here - UnLocked in SetInEditMode().
- SdrLayer* pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if (pLockLayer && !pView->IsLayerLocked(pLockLayer->GetName()))
- pView->SetLayerLocked( pLockLayer->GetName(), TRUE );
-
- SdrPage* pPage = pDrDoc->GetPage( static_cast<sal_uInt16>(aTabPos.Tab()) );
- pDrDoc->AddUndo( new SdrUndoRemoveObj( *pObject ) );
- pPage->RemoveObject( pObject->GetOrdNum() );
- // #39351# RemoveObject loescht nicht (analog zu anderen Containern)
- // trotzden kein "delete pObject" mehr, das Objekt gehoert jetzt dem Undo
+ pUndoMgr->RemoveLastUndoAction();
+ }
+ else if( bNewNote || bDeleteNote )
+ {
+ SfxListUndoAction* pAction = dynamic_cast< SfxListUndoAction* >( pUndoMgr->GetUndoAction() );
+ DBG_ASSERT( pAction, "FuText::StopEditMode - list undo action expected" );
+ if( pAction )
+ pAction->SetComment( ScGlobal::GetRscString( bNewNote ? STR_UNDO_INSERTNOTE : STR_UNDO_DELETENOTE ) );
}
}
- if (pUndoMan)
- pUndoMan->LeaveListAction();
-
- // This repaint should not be necessary but it cleans
- // up the 'marks' left behind by the note handles and outline
- // now that notes can simultaineously have handles and edit active.
- ScRange aDrawRange(pDoc->GetRange(aTabPos.Tab(), aNote.GetRectangle()));
-
- // Set Start/End Row to previous/next row to allow for handles.
- SCROW aStartRow = aDrawRange.aStart.Row();
- if(aStartRow > 0)
- aDrawRange.aStart.SetRow(aStartRow - 1);
- SCROW aEndRow = aDrawRange.aEnd.Row();
- if(aEndRow < MAXROW)
- aDrawRange.aEnd.SetRow(aEndRow + 1);
- ScDocShell* pDocSh = pViewShell->GetViewData()->GetDocShell();
- pDocSh->PostPaint( aDrawRange, PAINT_GRID| PAINT_EXTRAS);
}
}
// Called following an EndDragObj() to update the new note rectangle position
-void FuText::StopDragMode(SdrObject* pObject)
+void FuText::StopDragMode(SdrObject* /*pObject*/)
{
- BOOL bComment = FALSE;
- ScAddress aTabPos;
-
- if ( pObject && pObject->GetLayer()==SC_LAYER_INTERN && pObject->ISA(SdrCaptionObj) )
- {
- ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObject, pViewShell->GetViewData()->GetTabNo() );
- if( pData )
- {
- aTabPos = pData->aStt;
- bComment = TRUE;
- }
- }
-
- if ( bComment )
+#if 0 // DR
+ ScViewData& rViewData = *pViewShell->GetViewData();
+ if( ScDrawObjData* pData = ScDrawLayer::GetNoteCaptionData( pObject, rViewData.GetTabNo() ) )
{
- ScDocument* pDoc = pViewShell->GetViewData()->GetDocument();
- if(pDoc)
+ ScDocument& rDoc = *rViewData.GetDocument();
+ const ScAddress& rPos = pData->maStart;
+ ScPostIt* pNote = rDoc.GetNote( rPos );
+ DBG_ASSERT( pNote && (pNote->GetCaption() == pObject), "FuText::StopDragMode - missing or invalid cell note" );
+ if( pNote )
{
- ScPostIt aNote(pDoc);
- if(pDoc->GetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote ))
+ Rectangle aOldRect = pNote->CalcRectangle( rDoc, rPos );
+ Rectangle aNewRect = pObject->GetLogicRect();
+ if( aOldRect != aNewRect )
{
- Rectangle aNewRect;
- Rectangle aOldRect = aNote.GetRectangle();
- SdrCaptionObj* pCaption = static_cast<SdrCaptionObj*>(pObject);
- if(pCaption)
- aNewRect = pCaption->GetLogicRect();
- if(pCaption && aOldRect != aNewRect)
+ pNote->UpdateFromRectangle( rDoc, rPos, aNewRect );
+ OutlinerParaObject* pPObj = pCaption->GetOutlinerParaObject();
+ bool bVertical = (pPObj && pPObj->IsVertical());
+ // The new height/width is honoured if property item is reset.
+ if(!bVertical && aNewRect.Bottom() - aNewRect.Top() > aOldRect.Bottom() - aOldRect.Top())
{
- aNote.SetRectangle(aNewRect);
- OutlinerParaObject* pPObj = pCaption->GetOutlinerParaObject();
- bool bVertical = (pPObj && pPObj->IsVertical());
- // The new height/width is honoured if property item is reset.
- if(!bVertical && aNewRect.Bottom() - aNewRect.Top() > aOldRect.Bottom() - aOldRect.Top())
+ if(pCaption->IsAutoGrowHeight() && !bVertical)
{
- if(pCaption->IsAutoGrowHeight() && !bVertical)
- {
- pCaption->SetMergedItem( SdrTextAutoGrowHeightItem( false ) );
- aNote.SetItemSet(pCaption->GetMergedItemSet());
- }
+ pCaption->SetMergedItem( SdrTextAutoGrowHeightItem( false ) );
+ aNote.SetItemSet( *pDoc, pCaption->GetMergedItemSet() );
}
- else if(bVertical && aNewRect.Right() - aNewRect.Left() > aOldRect.Right() - aOldRect.Left())
+ }
+ else if(bVertical && aNewRect.Right() - aNewRect.Left() > aOldRect.Right() - aOldRect.Left())
+ {
+ if(pCaption->IsAutoGrowWidth() && bVertical)
{
- if(pCaption->IsAutoGrowWidth() && bVertical)
- {
- pCaption->SetMergedItem( SdrTextAutoGrowWidthItem( false ) );
- aNote.SetItemSet(pCaption->GetMergedItemSet());
- }
+ pCaption->SetMergedItem( SdrTextAutoGrowWidthItem( false ) );
+ aNote.SetItemSet( *pDoc, pCaption->GetMergedItemSet() );
}
- pViewShell->SetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote );
- // This repaint should not be necessary but it cleans
- // up the 'marks' left behind by the note handles
- // now that notes can simultaineously have handles and edit active.
- ScRange aDrawRange(pDoc->GetRange(aTabPos.Tab(), aOldRect));
- // Set Start/End Row to previous/next row to allow for handles.
- SCROW aStartRow = aDrawRange.aStart.Row();
- if(aStartRow > 0)
- aDrawRange.aStart.SetRow(aStartRow - 1);
- SCROW aEndRow = aDrawRange.aEnd.Row();
- if(aEndRow < MAXROW)
- aDrawRange.aEnd.SetRow(aEndRow + 1);
- ScDocShell* pDocSh = pViewShell->GetViewData()->GetDocShell();
- pDocSh->PostPaint( aDrawRange, PAINT_GRID| PAINT_EXTRAS);
}
+ pViewShell->SetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote );
+
+ // This repaint should not be necessary but it cleans
+ // up the 'marks' left behind by the note handles
+ // now that notes can simultaineously have handles and edit active.
+ ScRange aDrawRange = rDoc.GetRange( rPos.Tab(), aOldRect );
+ // Set Start/End Row to previous/next row to allow for handles.
+ if( aDrawRange.aStart.Row() > 0 )
+ aDrawRange.aStart.IncRow( -1 );
+ if( aDrawRange.aEnd.Row() < MAXROW )
+ aDrawRange.aEnd.IncRow( 1 );
+ ScDocShell* pDocSh = rViewData.GetDocShell();
+ pDocSh->PostPaint( aDrawRange, PAINT_GRID| PAINT_EXTRAS);
}
}
}
+#endif
}
diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx
index 88fb9f479087..1eaf2200de10 100644
--- a/sc/source/ui/inc/dbdocfun.hxx
+++ b/sc/source/ui/inc/dbdocfun.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dbdocfun.hxx,v $
- * $Revision: 1.10 $
+ * $Revision: 1.10.128.1 $
*
* This file is part of OpenOffice.org.
*
diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx
index d5a3ba864395..82739bfdd274 100644
--- a/sc/source/ui/inc/dbfunc.hxx
+++ b/sc/source/ui/inc/dbfunc.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dbfunc.hxx,v $
- * $Revision: 1.11.30.2 $
+ * $Revision: 1.12.100.1 $
*
* This file is part of OpenOffice.org.
*
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index 103d17c9dd8d..101caae8d999 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docfunc.hxx,v $
- * $Revision: 1.18.30.2 $
+ * $Revision: 1.19.100.3 $
*
* This file is part of OpenOffice.org.
*
@@ -96,7 +96,11 @@ public:
ScBaseCell* InterpretEnglishString( const ScAddress& rPos, const String& rText,
const formula::FormulaGrammar::Grammar eGrammar );
- BOOL SetNoteText( const ScAddress& rPos, const String& rText, BOOL bApi );
+ bool ShowNote( const ScAddress& rPos, bool bShow = true );
+ inline bool HideNote( const ScAddress& rPos ) { return ShowNote( rPos, false ); }
+
+ bool SetNoteText( const ScAddress& rPos, const String& rNoteText, BOOL bApi );
+ bool ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate, BOOL bApi );
BOOL ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
BOOL bRecord, BOOL bApi );
@@ -163,8 +167,6 @@ public:
BOOL bRecord, BOOL bApi );
BOOL UnmergeCells( const ScRange& rRange, BOOL bRecord, BOOL bApi );
- BOOL SetNote( const ScAddress& rPos, const ScPostIt& rNote, BOOL bApi );
-
BOOL SetNewRangeNames( ScRangeName* pNewRanges, BOOL bApi ); // takes ownership of pNewRanges
BOOL ModifyRangeNames( const ScRangeName& rNewRanges, BOOL bApi );
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 86228bde58be..8a9dd449686d 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docsh.hxx,v $
- * $Revision: 1.50.32.2 $
+ * $Revision: 1.50.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -321,6 +321,7 @@ public:
void PostPaint( const ScRange& rRange, USHORT nPart, USHORT nExtFlags = 0 );
void PostPaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
+ void PostPaintCell( const ScAddress& rPos );
void PostPaintGridAll();
void PostPaintExtras();
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 85dfd59d5ba9..33d0f4adf95d 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drawview.hxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.12.126.4 $
*
* This file is part of OpenOffice.org.
*
@@ -39,6 +39,7 @@ namespace com { namespace sun { namespace star { namespace datatransfer { class
class ScDocument;
class ScViewData;
+class ScDrawObjData;
class ScDrawView: public FmFormView
{
@@ -58,7 +59,6 @@ class ScDrawView: public FmFormView
protected:
virtual void ModelHasChanged();
- virtual void MakeVisible( const Rectangle& rRect, Window& rWin );
// add custom handles (used by other apps, e.g. AnchorPos)
virtual void AddCustomHdl();
@@ -74,6 +74,10 @@ public:
virtual void DoConnect(SdrOle2Obj* pOleObj);
+ virtual void MakeVisible( const Rectangle& rRect, Window& rWin );
+
+ virtual void DeleteMarked();
+
void DrawMarks( OutputDevice* pOut ) const;
void MarkDropObj( SdrObject* pObj );
@@ -111,13 +115,34 @@ public:
BOOL SelectObject( const String& rName );
//UNUSED2008-05 String GetSelectedChartName() const;
- BOOL HasMarkedControl() const;
+ bool HasMarkedControl() const;
+ bool HasMarkedInternal() const;
FASTBOOL InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, ULONG nOptions=0);
+ /** Returns the selected object, if it is the caption object of a cell note.
+ @param ppCaptData (out-param) If not null, returns the pointer to the caption object data. */
+ SdrObject* GetMarkedNoteCaption( ScDrawObjData** ppCaptData = 0 );
+
+ /** Locks/unlocks the specified layer in the draw page.
+ Unlocked layer is required to be able to edit the contained objects. */
+ void LockCalcLayer( SdrLayerID nLayer, bool bLock = true );
+ /** Unlocks the specified layer in the draw page. */
+ inline void UnlockCalcLayer( SdrLayerID nLayer ) { LockCalcLayer( nLayer, false ); }
+
+ /** Locks/unlocks the background layer that contains background objects.
+ Unlocked layer is required to be able to edit the objects. */
+ inline void LockBackgroundLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
+ /** Unlocks the background layer that contains background objects. */
+ inline void UnlockBackgroundLayer() { LockBackgroundLayer( false ); }
+
+ /** Locks/unlocks the internal layer that contains caption objects of cell notes.
+ Unlocked layer is required to be able to edit the contained objects. */
+ inline void LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
+ /** Unlocks the internal layer that contains caption objects of cell notes. */
+ inline void UnlockInternalLayer() { LockInternalLayer( false ); }
+
SdrEndTextEditKind ScEndTextEdit(); // ruft SetDrawTextUndo(0)
- void StoreCaptionAttribs();
- void StoreCaptionDimensions();
void CaptionTextDirection(USHORT nSlot);
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
};
diff --git a/sc/source/ui/inc/fuconarc.hxx b/sc/source/ui/inc/fuconarc.hxx
index 35b429af9a14..cfd21532cc6e 100644
--- a/sc/source/ui/inc/fuconarc.hxx
+++ b/sc/source/ui/inc/fuconarc.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconarc.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,12 +31,8 @@
#ifndef SC_FUCONARC_HXX
#define SC_FUCONARC_HXX
-#ifndef _SV_HXX
-#endif
-
#include "fuconstr.hxx"
-
/*************************************************************************
|*
|* Rechteck zeichnen
@@ -46,7 +42,7 @@
class FuConstArc : public FuConstruct
{
public:
- FuConstArc( ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuConstArc( ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuConstArc();
diff --git a/sc/source/ui/inc/fuconcustomshape.hxx b/sc/source/ui/inc/fuconcustomshape.hxx
index 385327b0a028..085cad8d7815 100644
--- a/sc/source/ui/inc/fuconcustomshape.hxx
+++ b/sc/source/ui/inc/fuconcustomshape.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconcustomshape.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -40,7 +40,7 @@ class FuConstCustomShape : public FuConstruct
void SetAttributes( SdrObject* pObj );
public:
- FuConstCustomShape(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuConstCustomShape(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuConstCustomShape();
diff --git a/sc/source/ui/inc/fuconpol.hxx b/sc/source/ui/inc/fuconpol.hxx
index a531387922b9..bcfb20aa6896 100644
--- a/sc/source/ui/inc/fuconpol.hxx
+++ b/sc/source/ui/inc/fuconpol.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconpol.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,13 +31,8 @@
#ifndef SC_FUCONPOL_HXX
#define SC_FUCONPOL_HXX
-#ifndef _SV_HXX
-#endif
-
#include "fuconstr.hxx"
-
-
/*************************************************************************
|*
|* Basisklasse fuer alle Funktionen
@@ -49,7 +44,7 @@ class FuConstPolygon : public FuConstruct
Point aLastPos;
public:
- FuConstPolygon(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuConstPolygon(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuConstPolygon();
diff --git a/sc/source/ui/inc/fuconrec.hxx b/sc/source/ui/inc/fuconrec.hxx
index d57c386cd69e..ddd7579782a7 100644
--- a/sc/source/ui/inc/fuconrec.hxx
+++ b/sc/source/ui/inc/fuconrec.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconrec.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,12 +31,8 @@
#ifndef SC_FUCONREC_HXX
#define SC_FUCONREC_HXX
-#ifndef _SV_HXX
-#endif
-
#include "fuconstr.hxx"
-
/*************************************************************************
|*
|* Rechteck zeichnen
@@ -46,7 +42,7 @@
class FuConstRectangle : public FuConstruct
{
public:
- FuConstRectangle(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuConstRectangle(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuConstRectangle();
diff --git a/sc/source/ui/inc/fuconstr.hxx b/sc/source/ui/inc/fuconstr.hxx
index 08f5127a1835..daae26dd84ed 100644
--- a/sc/source/ui/inc/fuconstr.hxx
+++ b/sc/source/ui/inc/fuconstr.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconstr.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,9 +31,6 @@
#ifndef SC_FUCONSTR_HXX
#define SC_FUCONSTR_HXX
-#ifndef _SV_HXX
-#endif
-
#include "fudraw.hxx"
@@ -51,7 +48,7 @@
class FuConstruct : public FuDraw
{
public:
- FuConstruct(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuConstruct(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuConstruct();
diff --git a/sc/source/ui/inc/fuconuno.hxx b/sc/source/ui/inc/fuconuno.hxx
index d3d9102e5816..b5ff2bcce5e0 100644
--- a/sc/source/ui/inc/fuconuno.hxx
+++ b/sc/source/ui/inc/fuconuno.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuconuno.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -47,7 +47,7 @@ protected:
UINT16 nIdentifier;
public:
- FuConstUnoControl(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuConstUnoControl(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuConstUnoControl();
diff --git a/sc/source/ui/inc/fudraw.hxx b/sc/source/ui/inc/fudraw.hxx
index c7789b4cebe7..24355c3a8560 100644
--- a/sc/source/ui/inc/fudraw.hxx
+++ b/sc/source/ui/inc/fudraw.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fudraw.hxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -32,10 +32,7 @@
#define SC_FUDRAW_HXX
#include "fupoor.hxx"
-
-#ifndef _SV_POINTR_HXX //autogen
#include <vcl/pointr.hxx>
-#endif
/*************************************************************************
|*
@@ -50,7 +47,7 @@ class FuDraw : public FuPoor
Pointer aOldPointer;
public:
- FuDraw(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuDraw(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuDraw();
@@ -72,7 +69,6 @@ class FuDraw : public FuPoor
virtual void SelectionHasChanged();
BOOL IsSizingOrMovingNote( const MouseEvent& rMEvt ) const;
- void CheckVisibleNote() const;
private:
void DoModifiers(const MouseEvent& rMEvt);
diff --git a/sc/source/ui/inc/fuedipo.hxx b/sc/source/ui/inc/fuedipo.hxx
index 22d9c8634359..e2cdedef73fc 100644
--- a/sc/source/ui/inc/fuedipo.hxx
+++ b/sc/source/ui/inc/fuedipo.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuedipo.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,9 +31,6 @@
#ifndef SC_FUEDIPO_HXX
#define SC_FUEDIPO_HXX
-#ifndef _SV_HXX
-#endif
-
#include "fudraw.hxx"
@@ -46,7 +43,7 @@
class FuEditPoints : public FuDraw
{
public:
- FuEditPoints(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuEditPoints(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuEditPoints();
diff --git a/sc/source/ui/inc/fuinsert.hxx b/sc/source/ui/inc/fuinsert.hxx
index 8e40de9aa470..bef04f585794 100644
--- a/sc/source/ui/inc/fuinsert.hxx
+++ b/sc/source/ui/inc/fuinsert.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fuinsert.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -37,7 +37,7 @@
class FuInsertGraphic : public FuPoor
{
public:
- FuInsertGraphic( ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuInsertGraphic( ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuInsertGraphic();
@@ -50,7 +50,7 @@ class FuInsertGraphic : public FuPoor
class FuInsertOLE : public FuPoor
{
public:
- FuInsertOLE( ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuInsertOLE( ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuInsertOLE();
@@ -63,7 +63,7 @@ class FuInsertOLE : public FuPoor
class FuInsertChart : public FuPoor
{
public:
- FuInsertChart( ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuInsertChart( ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuInsertChart();
@@ -76,7 +76,7 @@ class FuInsertChart : public FuPoor
class FuInsertMedia : public FuPoor
{
public:
- FuInsertMedia( ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuInsertMedia( ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuInsertMedia();
diff --git a/sc/source/ui/inc/fumark.hxx b/sc/source/ui/inc/fumark.hxx
index 61896f7b8d6b..8983154562a0 100644
--- a/sc/source/ui/inc/fumark.hxx
+++ b/sc/source/ui/inc/fumark.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fumark.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -51,7 +51,7 @@ class FuMarkRect : public FuPoor
ScRangeListRef aSourceRange;
public:
- FuMarkRect(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuMarkRect(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuMarkRect();
diff --git a/sc/source/ui/inc/fupoor.hxx b/sc/source/ui/inc/fupoor.hxx
index 819eb56aa367..8411b1a3fbfc 100644
--- a/sc/source/ui/inc/fupoor.hxx
+++ b/sc/source/ui/inc/fupoor.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fupoor.hxx,v $
- * $Revision: 1.7.146.1 $
+ * $Revision: 1.7.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,13 +31,11 @@
#ifndef _SC_FUPOOR_HXX
#define _SC_FUPOOR_HXX
-#ifndef _EVENT_HXX //autogen
#include <vcl/event.hxx>
-#endif
#include <vcl/timer.hxx>
#include <sfx2/request.hxx>
-class SdrView;
+class ScDrawView;
class ScTabViewShell;
class Window;
class SdrModel;
@@ -59,8 +57,8 @@ class SdrObject;
class FuPoor
{
- protected:
- SdrView* pView;
+protected:
+ ScDrawView* pView;
ScTabViewShell* pViewShell;
Window* pWindow;
SdrModel* pDrDoc;
@@ -83,8 +81,8 @@ class FuPoor
private:
sal_uInt16 mnCode;
- public:
- FuPoor(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+public:
+ FuPoor(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuPoor();
@@ -126,6 +124,7 @@ private:
// #98185# Create default drawing objects via keyboard
virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
+
protected:
void ImpForceQuadratic(Rectangle& rRect);
diff --git a/sc/source/ui/inc/fusel.hxx b/sc/source/ui/inc/fusel.hxx
index b8f2481d3802..c0366292a2c0 100644
--- a/sc/source/ui/inc/fusel.hxx
+++ b/sc/source/ui/inc/fusel.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fusel.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -49,17 +49,8 @@ class SdrPageView;
class FuSelection : public FuDraw
{
- protected:
-// Outliner* pOutliner;
-// OutlinerView* pOutlinerView;
- BOOL bVCAction;
-
- private:
- BOOL TestDetective( SdrPageView* pPV, const Point& rPos ); // -> fusel2
- BOOL TestComment( SdrPageView* pPV, const Point& rPos ); // -> fusel2
-
- public:
- FuSelection(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+public:
+ FuSelection(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq );
virtual ~FuSelection();
@@ -73,7 +64,18 @@ class FuSelection : public FuDraw
virtual void Activate(); // Function aktivieren
virtual void Deactivate(); // Function deaktivieren
- void ActivateNoteHandles(SdrObject* pObj) const ;
+ void ActivateNoteHandles(SdrObject* pObj);
+
+protected:
+// Outliner* pOutliner;
+// OutlinerView* pOutlinerView;
+ BOOL bVCAction;
+
+private:
+ BOOL TestDetective( SdrPageView* pPV, const Point& rPos ); // -> fusel2
+
+ bool IsNoteCaptionMarked() const;
+ bool IsNoteCaptionClicked( const Point& rPos ) const;
};
diff --git a/sc/source/ui/inc/futext.hxx b/sc/source/ui/inc/futext.hxx
index 2f02a1075706..488b1ecf2508 100644
--- a/sc/source/ui/inc/futext.hxx
+++ b/sc/source/ui/inc/futext.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: futext.hxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -49,7 +49,7 @@ protected:
SdrTextObj* pTextObj;
public:
- FuText(ScTabViewShell* pViewSh, Window* pWin, SdrView* pView,
+ FuText(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
SdrModel* pDoc, SfxRequest& rReq);
virtual ~FuText();
diff --git a/sc/source/ui/inc/notemark.hxx b/sc/source/ui/inc/notemark.hxx
index 8a75f496c3d0..ccc173d299f5 100644
--- a/sc/source/ui/inc/notemark.hxx
+++ b/sc/source/ui/inc/notemark.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: notemark.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -51,6 +51,7 @@ private:
ScDocument* pDoc;
ScAddress aDocPos;
String aUserText;
+ Rectangle aVisRect;
Timer aTimer;
MapMode aMapMode;
BOOL bLeft;
@@ -64,11 +65,9 @@ private:
DECL_LINK( TimeHdl, Timer* );
public:
- ScNoteMarker( Window* pWin,
- Window* pRight, Window* pBottom, Window* pDiagonal,
- ScDocument* pD, ScAddress aPos,
- const String& rUser, const MapMode& rMap,
- BOOL bLeftEdge, BOOL bForce, BOOL bKeyboard );
+ ScNoteMarker( Window* pWin, Window* pRight, Window* pBottom, Window* pDiagonal,
+ ScDocument* pD, ScAddress aPos, const String& rUser,
+ const MapMode& rMap, BOOL bLeftEdge, BOOL bForce, BOOL bKeyboard );
~ScNoteMarker();
void Draw();
diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
index 15679ad7a6f3..2d3ee1d14dd7 100644
--- a/sc/source/ui/inc/undobase.hxx
+++ b/sc/source/ui/inc/undobase.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: undobase.hxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -100,12 +100,15 @@ class ScDBFuncUndo: public ScSimpleUndo
{
ScDBData* pAutoDBRange;
ScRange aOriginalRange;
+ SdrUndoAction* mpDrawUndo;
public:
TYPEINFO();
- ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal );
+ ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal, SdrUndoAction* pDrawUndo = 0 );
virtual ~ScDBFuncUndo();
+ void SetDrawUndoAction( SdrUndoAction* pDrawUndo );
+
void BeginUndo();
void EndUndo();
void BeginRedo();
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 99f0c7b5f16a..d357461d0f5e 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: undoblk.hxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.15.128.3 $
*
* This file is part of OpenOffice.org.
*
@@ -450,7 +450,7 @@ public:
ScUndoMerge( ScDocShell* pNewDocShell,
SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
- BOOL bNewDoMerge, ScDocument* pNewUndoDoc = NULL );
+ bool bMergeContents, ScDocument* pUndoDoc, SdrUndoAction* pDrawUndo );
virtual ~ScUndoMerge();
virtual void Undo();
@@ -461,11 +461,12 @@ public:
virtual String GetComment() const;
private:
- ScRange aRange;
- BOOL bDoMerge; // Merge oder aufheben
- ScDocument* pUndoDoc; // wenn Daten zusammengefasst
+ ScRange maRange;
+ bool mbMergeContents; // Merge contents in Redo().
+ ScDocument* mpUndoDoc; // wenn Daten zusammengefasst
+ SdrUndoAction* mpDrawUndo;
- void DoChange( const BOOL bUndo ) const;
+ void DoChange( bool bUndo ) const;
};
diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx
index 50b77729ddad..f6b218fdfb44 100644
--- a/sc/source/ui/inc/undocell.hxx
+++ b/sc/source/ui/inc/undocell.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: undocell.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.128.3 $
*
* This file is part of OpenOffice.org.
*
@@ -248,53 +248,73 @@ private:
void SetChangeTrack( ScBaseCell* pOldCell );
};
+// ============================================================================
-class ScUndoNote: public ScSimpleUndo
+/** Undo action for inserting, removing, and replacing a cell note. */
+class ScUndoReplaceNote : public ScSimpleUndo
{
public:
TYPEINFO();
- ScUndoNote( ScDocShell* pNewDocShell,
- BOOL bShow, const ScAddress& rNewPos,
- SdrUndoAction* pDraw );
- virtual ~ScUndoNote();
+
+ /** Constructs an undo action for inserting or removing a cell note. */
+ ScUndoReplaceNote(
+ ScDocShell& rDocShell,
+ const ScAddress& rPos,
+ const ScNoteData& rNoteData,
+ bool bInsert,
+ SdrUndoAction* pDrawUndo );
+
+ /** Constructs an undo action for replacing a cell note with another. */
+ ScUndoReplaceNote(
+ ScDocShell& rDocShell,
+ const ScAddress& rPos,
+ const ScNoteData& rOldData,
+ const ScNoteData& rNewData,
+ SdrUndoAction* pDrawUndo );
+
+ virtual ~ScUndoReplaceNote();
virtual void Undo();
virtual void Redo();
- virtual void Repeat(SfxRepeatTarget& rTarget);
- virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
+ virtual void Repeat( SfxRepeatTarget& rTarget );
+ virtual BOOL CanRepeat( SfxRepeatTarget& rTarget ) const;
virtual String GetComment() const;
private:
- BOOL bIsShow;
- ScAddress aPos;
- SdrUndoAction* pDrawUndo;
+ void DoInsertNote( const ScNoteData& rNoteData );
+ void DoRemoveNote( const ScNoteData& rNoteData );
+
+private:
+ ScAddress maPos;
+ ScNoteData maOldData;
+ ScNoteData maNewData;
+ SdrUndoAction* mpDrawUndo;
};
+// ============================================================================
-class ScUndoEditNote: public ScSimpleUndo
+/** Undo action for showing or hiding a cell note caption. */
+class ScUndoShowHideNote : public ScSimpleUndo
{
public:
TYPEINFO();
- ScUndoEditNote( ScDocShell* pNewDocShell,
- const ScAddress& rNewPos,
- const ScPostIt& rOld,
- const ScPostIt& rNew );
- virtual ~ScUndoEditNote();
+ ScUndoShowHideNote( ScDocShell& rDocShell, const ScAddress& rPos, bool bShow );
+ virtual ~ScUndoShowHideNote();
virtual void Undo();
virtual void Redo();
- virtual void Repeat(SfxRepeatTarget& rTarget);
- virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
+ virtual void Repeat( SfxRepeatTarget& rTarget );
+ virtual BOOL CanRepeat( SfxRepeatTarget& rTarget ) const;
virtual String GetComment() const;
private:
- ScAddress aPos;
- ScPostIt aOldNote;
- ScPostIt aNewNote;
+ ScAddress maPos;
+ bool mbShown;
};
+// ============================================================================
class ScUndoDetective: public ScSimpleUndo
{
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index b3a4af0b3aac..0759d1fe2893 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewfunc.hxx,v $
- * $Revision: 1.34.32.3 $
+ * $Revision: 1.34.128.3 $
*
* This file is part of OpenOffice.org.
*
@@ -99,7 +99,7 @@ public:
void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
BOOL bRecord = TRUE, const EditTextObject* pData = NULL );
- void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue );
+ void EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue );
void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextObject* pData,
BOOL bRecord = TRUE, BOOL bTestSimple = FALSE );
@@ -298,7 +298,9 @@ public:
void SetSelectionFrameLines( const SvxBorderLine* pLine,
BOOL bColorOnly );
- void SetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPostIt& rNote );
+ void SetNoteText( const ScAddress& rPos, const String& rNoteText );
+ void ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate );
+
//UNUSED2008-05 void DoSpellingChecker( BOOL bRecord = TRUE );
void DoHangulHanjaConversion( BOOL bRecord = TRUE );
void DoThesaurus( BOOL bRecord = TRUE );
@@ -321,9 +323,9 @@ public:
void DetectiveDelAll();
void DetectiveRefresh();
- void ShowNote();
+ void ShowNote( bool bShow = true );
+ inline void HideNote() { ShowNote( false ); }
void EditNote();
- void HideNote();
void ForgetFormatArea() { bFormatValid = FALSE; }
BOOL SelectionEditable( BOOL* pOnlyNotBecauseOfMatrix = NULL );
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index c1e27664ded6..a2db7e4e48f0 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: content.cxx,v $
- * $Revision: 1.25.30.2 $
+ * $Revision: 1.26.102.2 $
*
* This file is part of OpenOffice.org.
*
@@ -872,9 +872,8 @@ const ScAreaLink* ScContentTree::GetLink( ULONG nIndex )
String lcl_NoteString( const ScPostIt& rNote )
{
String aText = rNote.GetText();
- aText.ConvertLineEnd( LINEEND_CR );
xub_StrLen nAt;
- while ( (nAt = aText.Search( CHAR_CR )) != STRING_NOTFOUND )
+ while ( (nAt = aText.Search( '\n' )) != STRING_NOTFOUND )
aText.SetChar( nAt, ' ' );
return aText;
}
@@ -892,15 +891,9 @@ void ScContentTree::GetNoteStrings()
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
{
ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
- ScBaseCell* pCell = aIter.GetFirst();
- while (pCell)
- {
- const ScPostIt* pNote = pCell->GetNotePtr();
- if (pNote)
- InsertContent( SC_CONTENT_NOTE, lcl_NoteString(*pNote) );
-
- pCell = aIter.GetNext();
- }
+ for( ScBaseCell* pCell = aIter.GetFirst(); pCell; pCell = aIter.GetNext() )
+ if( const ScPostIt* pNote = pCell->GetNote() )
+ InsertContent( SC_CONTENT_NOTE, lcl_NoteString( *pNote ) );
}
}
@@ -918,8 +911,7 @@ ScAddress ScContentTree::GetNotePos( ULONG nIndex )
ScBaseCell* pCell = aIter.GetFirst();
while (pCell)
{
- const ScPostIt* pNote = pCell->GetNotePtr();
- if (pNote)
+ if( pCell->HasNote() )
{
if (nFound == nIndex)
return ScAddress( aIter.GetCol(), aIter.GetRow(), nTab ); // gefunden
@@ -953,14 +945,13 @@ BOOL ScContentTree::NoteStringsChanged()
ScBaseCell* pCell = aIter.GetFirst();
while (pCell && bEqual)
{
- const ScPostIt* pNote = pCell->GetNotePtr();
- if (pNote)
+ if( const ScPostIt* pNote = pCell->GetNote() )
{
if ( !pEntry )
bEqual = FALSE;
else
{
- if ( lcl_NoteString(*pNote) != GetEntryText(pEntry) )
+ if ( lcl_NoteString( *pNote ) != GetEntryText(pEntry) )
bEqual = FALSE;
pEntry = NextSibling( pEntry );
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index f121f61393aa..5166340b189e 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: globstr.src,v $
- * $Revision: 1.74 $
+ * $Revision: 1.74.96.1 $
*
* This file is part of OpenOffice.org.
*
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 4e2d400d827f..200db8673cd2 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: undobase.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -50,9 +50,9 @@
// STATIC DATA -----------------------------------------------------------
TYPEINIT1(ScSimpleUndo, SfxUndoAction);
-TYPEINIT1(ScBlockUndo, SfxUndoAction);
-TYPEINIT1(ScMoveUndo, SfxUndoAction);
-TYPEINIT1(ScDBFuncUndo, SfxUndoAction);
+TYPEINIT1(ScBlockUndo, ScSimpleUndo);
+TYPEINIT1(ScMoveUndo, ScSimpleUndo);
+TYPEINIT1(ScDBFuncUndo, ScSimpleUndo);
TYPEINIT1(ScUndoWrapper, SfxUndoAction);
// -----------------------------------------------------------------------
@@ -345,21 +345,30 @@ void ScMoveUndo::EndRedo()
// -----------------------------------------------------------------------
-ScDBFuncUndo::ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal ) :
+ScDBFuncUndo::ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal, SdrUndoAction* pDrawUndo ) :
ScSimpleUndo( pDocSh ),
- aOriginalRange( rOriginal )
+ aOriginalRange( rOriginal ),
+ mpDrawUndo( pDrawUndo )
{
pAutoDBRange = pDocSh->GetOldAutoDBRange();
}
ScDBFuncUndo::~ScDBFuncUndo()
{
+ DeleteSdrUndoAction( mpDrawUndo );
delete pAutoDBRange;
}
+void ScDBFuncUndo::SetDrawUndoAction( SdrUndoAction* pDrawUndo )
+{
+ DeleteSdrUndoAction( mpDrawUndo );
+ mpDrawUndo = pDrawUndo;
+}
+
void ScDBFuncUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
+ DoSdrUndoAction( mpDrawUndo, pDocShell->GetDocument() );
}
void ScDBFuncUndo::EndUndo()
@@ -398,6 +407,7 @@ void ScDBFuncUndo::EndUndo()
void ScDBFuncUndo::BeginRedo()
{
+ RedoSdrUndoAction( mpDrawUndo );
if ( pAutoDBRange )
{
// move the database range to this function's position again (see ScDocShell::GetDBData)
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index fd5e13ee805d..00bc7dd96709 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: undoblk.cxx,v $
- * $Revision: 1.27 $
+ * $Revision: 1.27.128.4 $
*
* This file is part of OpenOffice.org.
*
@@ -806,6 +806,9 @@ void ScUndoCut::DoChange( const BOOL bUndo )
ScDocument* pDoc = pDocShell->GetDocument();
USHORT nExtFlags = 0;
+ // do not undo/redo objects and note captions, they are handled via drawing undo
+ USHORT nUndoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
+
if (bUndo) // nur bei Undo
{
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
@@ -813,7 +816,7 @@ void ScUndoCut::DoChange( const BOOL bUndo )
ScRange aCopyRange = aExtendedRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc );
+ pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, FALSE, pDoc );
ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -822,7 +825,7 @@ void ScUndoCut::DoChange( const BOOL bUndo )
{
pDocShell->UpdatePaintExt( nExtFlags, aExtendedRange );
pDoc->DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
- aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(), aMarkData, IDF_ALL );
+ aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(), aMarkData, nUndoFlags );
SetChangeTrack();
}
@@ -830,7 +833,7 @@ void ScUndoCut::DoChange( const BOOL bUndo )
if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
/*A*/ pDocShell->PostPaint( aExtendedRange, PAINT_GRID, nExtFlags );
- if ( !bUndo ) // draw redo after updating row heights
+ if ( !bUndo ) // draw redo after updating row heights
RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
pDocShell->PostDataChanged();
@@ -948,6 +951,9 @@ void ScUndoPaste::DoChange( const BOOL bUndo )
if (nFlags & IDF_ATTRIB)
nUndoFlags |= IDF_ATTRIB;
+ // do not undo/redo objects and note captions, they are handled via drawing undo
+ (nUndoFlags &= ~IDF_OBJECTS) |= IDF_NOCAPTIONS;
+
BOOL bPaintAll = FALSE;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1069,7 +1075,7 @@ void ScUndoPaste::DoChange( const BOOL bUndo )
pDocShell->UpdatePaintExt( nExtFlags, aDrawRange );
}
- if ( !bUndo ) // draw redo after updating row heights
+ if ( !bUndo ) // draw redo after updating row heights
RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
pDocShell->PostPaint( aDrawRange, nPaint, nExtFlags );
@@ -1254,8 +1260,11 @@ void ScUndoDragDrop::DoUndo( ScRange aRange ) const
USHORT nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aPaintRange );
- pDoc->DeleteAreaTab( aRange, IDF_ALL );
- pRefUndoDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pDoc );
+ // do not undo objects and note captions, they are handled via drawing undo
+ USHORT nUndoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
+
+ pDoc->DeleteAreaTab( aRange, nUndoFlags );
+ pRefUndoDoc->CopyToDocument( aRange, nUndoFlags, FALSE, pDoc );
if ( pDoc->HasAttrib( aRange, HASATTR_MERGED ) )
pDoc->ExtendMerge( aRange, TRUE );
@@ -1285,13 +1294,31 @@ void __EXPORT ScUndoDragDrop::Redo()
EnableDrawAdjust( pDoc, FALSE ); //! include in ScBlockUndo?
+ // do not undo/redo objects and note captions, they are handled via drawing undo
+ USHORT nRedoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
+
+ /* TODO: Redoing note captions is quite tricky due to the fact that a
+ helper clip document is used. While (re-)pasting the contents to the
+ destination area, the original pointers to the captions created while
+ dropping have to be restored. A simple CopyFromClip() would create new
+ caption objects that are not tracked by drawing undo, and the captions
+ restored by drawing redo would live without cell note objects pointing
+ to them. So, first, CopyToClip() and CopyFromClip() are called without
+ cloning the caption objects. This leads to cell notes pointing to the
+ wrong captions from source area that will be removed by drawing redo
+ later. Second, the pointers to the new captions have to be restored.
+ Sadly, currently these pointers are not stored anywhere but in the list
+ of drawing undo actions. */
+
SCTAB nTab;
ScMarkData aSourceMark;
for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
aSourceMark.SelectTable( nTab, TRUE );
+
+ // do not clone objects and note captions into clipdoc (see above)
pDoc->CopyToClip( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(),
aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(),
- bCut, pClipDoc, FALSE, &aSourceMark, bKeepScenarioFlags );
+ bCut, pClipDoc, FALSE, &aSourceMark, bKeepScenarioFlags, FALSE, FALSE );
if (bCut)
{
@@ -1299,7 +1326,7 @@ void __EXPORT ScUndoDragDrop::Redo()
pDoc->ExtendMerge( aSrcPaintRange ); // before deleting
USHORT nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aSrcPaintRange );
- pDoc->DeleteAreaTab( aSrcRange, IDF_ALL );
+ pDoc->DeleteAreaTab( aSrcRange, nRedoFlags );
PaintArea( aSrcPaintRange, nExtFlags );
}
@@ -1308,6 +1335,7 @@ void __EXPORT ScUndoDragDrop::Redo()
aDestMark.SelectTable( nTab, TRUE );
BOOL bIncludeFiltered = bCut;
+ // TODO: restore old note captions instead of cloning new captions...
pDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL & ~IDF_OBJECTS, NULL, pClipDoc, TRUE, FALSE, bIncludeFiltered );
if (bCut)
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 581204e6b64a..f12dcda35c8f 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: undoblk3.cxx,v $
- * $Revision: 1.22.32.1 $
+ * $Revision: 1.22.128.6 $
*
* This file is part of OpenOffice.org.
*
@@ -165,6 +165,8 @@ void ScUndoDeleteContents::DoChange( const BOOL bUndo )
nUndoFlags |= IDF_ATTRIB;
if (nFlags & IDF_EDITATTR) // Edit-Engine-Attribute
nUndoFlags |= IDF_STRING; // -> Zellen werden geaendert
+ // do not create clones of note captions, they will be restored via drawing undo
+ nUndoFlags |= IDF_NOCAPTIONS;
ScRange aCopyRange = aRange;
SCTAB nTabCount = pDoc->GetTableCount();
@@ -186,9 +188,10 @@ void ScUndoDeleteContents::DoChange( const BOOL bUndo )
pDocShell->UpdatePaintExt( nExtFlags, aRange ); // content before the change
aMarkData.MarkToMulti();
- if (pDrawUndo)
- pDoc->DeleteObjectsInSelection( aMarkData );
- pDoc->DeleteSelection( nFlags, aMarkData );
+ RedoSdrUndoAction( pDrawUndo );
+ // do not delete objects and note captions, they have been removed via drawing undo
+ USHORT nRedoFlags = (nFlags & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
+ pDoc->DeleteSelection( nRedoFlags, aMarkData );
aMarkData.MarkToSimple();
SetChangeTrack();
@@ -642,8 +645,8 @@ void __EXPORT ScUndoAutoFill::Undo()
USHORT nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
- pDoc->DeleteAreaTab( aWorkRange, IDF_ALL );
- pUndoDoc->CopyToDocument( aWorkRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aWorkRange, IDF_AUTOFILL );
+ pUndoDoc->CopyToDocument( aWorkRange, IDF_AUTOFILL, FALSE, pDoc );
pDoc->ExtendMerge( aWorkRange, TRUE );
pDocShell->PostPaint( aWorkRange, PAINT_GRID, nExtFlags );
@@ -774,122 +777,123 @@ BOOL __EXPORT ScUndoAutoFill::CanRepeat(SfxRepeatTarget& rTarget) const
ScUndoMerge::ScUndoMerge( ScDocShell* pNewDocShell,
SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
- BOOL bNewDoMerge, ScDocument* pNewUndoDoc )
+ bool bMergeContents, ScDocument* pUndoDoc, SdrUndoAction* pDrawUndo )
//
: ScSimpleUndo( pNewDocShell ),
//
- aRange ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
- bDoMerge( bNewDoMerge ),
- pUndoDoc( pNewUndoDoc )
+ maRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
+ mbMergeContents( bMergeContents ),
+ mpUndoDoc( pUndoDoc ),
+ mpDrawUndo( pDrawUndo )
{
}
//----------------------------------------------------------------------------
-__EXPORT ScUndoMerge::~ScUndoMerge()
+ScUndoMerge::~ScUndoMerge()
{
- delete pUndoDoc;
+ delete mpUndoDoc;
+ DeleteSdrUndoAction( mpDrawUndo );
}
//----------------------------------------------------------------------------
-String __EXPORT ScUndoMerge::GetComment() const
+String ScUndoMerge::GetComment() const
{
- // "Zusammenfassen" "Zusammenfassung aufheben"
- return bDoMerge ?
- ScGlobal::GetRscString( STR_UNDO_MERGE ) :
- ScGlobal::GetRscString( STR_UNDO_REMERGE );
+ return ScGlobal::GetRscString( STR_UNDO_MERGE );
}
//----------------------------------------------------------------------------
-void ScUndoMerge::DoChange( const BOOL bUndo ) const
+void ScUndoMerge::DoChange( bool bUndo ) const
{
ScDocument* pDoc = pDocShell->GetDocument();
- ScUndoUtil::MarkSimpleBlock( pDocShell, aRange );
+ ScUndoUtil::MarkSimpleBlock( pDocShell, maRange );
- if (bDoMerge == bUndo)
- pDoc->RemoveMerge( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab() );
-//! pDoc->RemoveMerge( aRange.aStart );
+ if (bUndo)
+ // remove merge (contents are copied back below from undo document)
+ pDoc->RemoveMerge( maRange.aStart.Col(), maRange.aStart.Row(), maRange.aStart.Tab() );
else
-/*!*/ pDoc->DoMerge( aRange.aStart.Tab(),
- aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row() );
+ // repeat merge, but do not remove note captions (will be done by drawing redo below)
+/*!*/ pDoc->DoMerge( maRange.aStart.Tab(),
+ maRange.aStart.Col(), maRange.aStart.Row(),
+ maRange.aEnd.Col(), maRange.aEnd.Row(), false );
- if (pUndoDoc)
+ // undo -> copy back deleted contents
+ if (bUndo && mpUndoDoc)
{
- if (bUndo)
- {
- pDoc->DeleteAreaTab( aRange, IDF_CONTENTS );
- 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() );
+ pDoc->DeleteAreaTab( maRange, IDF_CONTENTS|IDF_NOCAPTIONS );
+ mpUndoDoc->CopyToDocument( maRange, IDF_ALL|IDF_NOCAPTIONS, FALSE, pDoc );
+ }
+
+ // redo -> merge contents again
+ else if (!bUndo && mbMergeContents)
+ {
+/*!*/ pDoc->DoMergeContents( maRange.aStart.Tab(),
+ maRange.aStart.Col(), maRange.aStart.Row(),
+ maRange.aEnd.Col(), maRange.aEnd.Row() );
}
+ if (bUndo)
+ DoSdrUndoAction( mpDrawUndo, pDoc );
+ else
+ RedoSdrUndoAction( mpDrawUndo );
+
BOOL bDidPaint = FALSE;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( pViewShell )
{
- pViewShell->SetTabNo( aRange.aStart.Tab() );
- bDidPaint = pViewShell->AdjustRowHeight( aRange.aStart.Row(), aRange.aEnd.Row() );
+ pViewShell->SetTabNo( maRange.aStart.Tab() );
+ bDidPaint = pViewShell->AdjustRowHeight( maRange.aStart.Row(), maRange.aEnd.Row() );
}
if (!bDidPaint)
- ScUndoUtil::PaintMore( pDocShell, aRange );
+ ScUndoUtil::PaintMore( pDocShell, maRange );
- ShowTable( aRange );
+ ShowTable( maRange );
}
//----------------------------------------------------------------------------
-void __EXPORT ScUndoMerge::Undo()
+void ScUndoMerge::Undo()
{
BeginUndo();
- DoChange( TRUE );
+ DoChange( true );
EndUndo();
}
//----------------------------------------------------------------------------
-void __EXPORT ScUndoMerge::Redo()
+void ScUndoMerge::Redo()
{
BeginRedo();
- DoChange( FALSE );
+ DoChange( false );
EndRedo();
}
//----------------------------------------------------------------------------
-void __EXPORT ScUndoMerge::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoMerge::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
ScTabViewShell& rViewShell = *((ScTabViewTarget&)rTarget).GetViewShell();
-
- if (bDoMerge)
- {
- BOOL bCont = FALSE;
- rViewShell.MergeCells( FALSE, bCont, TRUE );
- }
- else
- rViewShell.RemoveMerge( TRUE );
+ BOOL bCont = FALSE;
+ rViewShell.MergeCells( FALSE, bCont, TRUE );
}
}
//----------------------------------------------------------------------------
-BOOL __EXPORT ScUndoMerge::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoMerge::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -1193,13 +1197,9 @@ void __EXPORT ScUndoReplace::Undo()
}
else if (pSearchItem->GetCellType() == SVX_SEARCHIN_NOTE)
{
- ScPostIt aNote(pDoc);
- if (pDoc->GetNote(aCursorPos.Col(), aCursorPos.Row(),
- aCursorPos.Tab(), aNote))
+ if (ScPostIt* pNote = pDoc->GetNote(aCursorPos))
{
- aNote.SetText(aUndoStr);
- pDoc->SetNote(aCursorPos.Col(), aCursorPos.Row(),
- aCursorPos.Tab(), aNote);
+ pNote->SetText( aUndoStr );
}
else
{
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 026123eab417..d1a59e65fdb0 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: undocell.cxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.15.128.8 $
*
* This file is part of OpenOffice.org.
*
@@ -31,14 +31,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-// INCLUDE ---------------------------------------------------------------
-
#include "scitems.hxx"
#include <svx/eeitem.hxx>
-
#include <svx/editobj.hxx>
#include <svtools/zforlist.hxx>
#include <sfx2/app.hxx>
@@ -71,8 +66,8 @@ TYPEINIT1(ScUndoPutCell, ScSimpleUndo);
TYPEINIT1(ScUndoPageBreak, ScSimpleUndo);
TYPEINIT1(ScUndoPrintZoom, ScSimpleUndo);
TYPEINIT1(ScUndoThesaurus, ScSimpleUndo);
-TYPEINIT1(ScUndoNote, ScSimpleUndo);
-TYPEINIT1(ScUndoEditNote, ScSimpleUndo);
+TYPEINIT1(ScUndoReplaceNote, ScSimpleUndo);
+TYPEINIT1(ScUndoShowHideNote, ScSimpleUndo);
TYPEINIT1(ScUndoDetective, ScSimpleUndo);
TYPEINIT1(ScUndoRangeNames, ScSimpleUndo);
@@ -269,18 +264,7 @@ void __EXPORT ScUndoEnterData::Undo()
ScDocument* pDoc = pDocShell->GetDocument();
for (USHORT i=0; i<nCount; i++)
{
- ScBaseCell* pNewCell;
- if ( ppOldCells[i] )
- {
- // Formelzelle mit CompileTokenArray() !
- if ( ppOldCells[i]->GetCellType() == CELLTYPE_FORMULA )
- pNewCell = ((ScFormulaCell*)ppOldCells[i])->Clone( pDoc,
- ScAddress( nCol, nRow, pTabs[i] ) );
- else
- pNewCell = ppOldCells[i]->Clone(pDoc);
- }
- else
- pNewCell = NULL;
+ ScBaseCell* pNewCell = ppOldCells[i] ? ppOldCells[i]->CloneWithoutNote( *pDoc, SC_CLONECELL_STARTLISTENING ) : 0;
pDoc->PutCell( nCol, nRow, pTabs[i], pNewCell );
if (pHasFormat && pOldFormats)
@@ -413,21 +397,11 @@ void __EXPORT ScUndoEnterValue::Undo()
BeginUndo();
ScDocument* pDoc = pDocShell->GetDocument();
- ScBaseCell* pNewCell;
- if ( pOldCell )
- {
- // Formelzelle mit CompileTokenArray() !
- if ( pOldCell->GetCellType() == CELLTYPE_FORMULA )
- pNewCell = ((ScFormulaCell*)pOldCell)->Clone( pDoc, aPos );
- else
- pNewCell = pOldCell->Clone(pDoc);
- }
- else
- pNewCell = NULL;
+ ScBaseCell* pNewCell = pOldCell ? pOldCell->CloneWithoutNote( *pDoc, SC_CLONECELL_STARTLISTENING ) : 0;
- pDoc->PutCell( aPos.Col(), aPos.Row(), aPos.Tab(), pNewCell );
+ pDoc->PutCell( aPos, pNewCell );
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
+ pDocShell->PostPaintCell( aPos );
ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
if ( pChangeTrack )
@@ -442,7 +416,7 @@ void __EXPORT ScUndoEnterValue::Redo()
ScDocument* pDoc = pDocShell->GetDocument();
pDoc->SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
+ pDocShell->PostPaintCell( aPos );
SetChangeTrack();
@@ -509,21 +483,11 @@ void __EXPORT ScUndoPutCell::Undo()
BeginUndo();
ScDocument* pDoc = pDocShell->GetDocument();
- ScBaseCell* pNewCell;
- if ( pOldCell )
- {
- // Formelzelle mit CompileTokenArray() !
- if ( pOldCell->GetCellType() == CELLTYPE_FORMULA )
- pNewCell = ((ScFormulaCell*)pOldCell)->Clone( pDoc, aPos );
- else
- pNewCell = pOldCell->Clone(pDoc);
- }
- else
- pNewCell = NULL;
+ ScBaseCell* pNewCell = pOldCell ? pOldCell->CloneWithoutNote( *pDoc, aPos, SC_CLONECELL_STARTLISTENING ) : 0;
pDoc->PutCell( aPos.Col(), aPos.Row(), aPos.Tab(), pNewCell );
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
+ pDocShell->PostPaintCell( aPos );
ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
if ( pChangeTrack )
@@ -537,23 +501,11 @@ void __EXPORT ScUndoPutCell::Redo()
BeginRedo();
ScDocument* pDoc = pDocShell->GetDocument();
-// pDoc->SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
-
- ScBaseCell* pNewCell;
- if ( pEnteredCell )
- {
- // Formelzelle mit CompileTokenArray() !
- if ( pEnteredCell->GetCellType() == CELLTYPE_FORMULA )
- pNewCell = ((ScFormulaCell*)pEnteredCell)->Clone( pDoc, aPos );
- else
- pNewCell = pEnteredCell->Clone(pDoc);
- }
- else
- pNewCell = NULL;
+ ScBaseCell* pNewCell = pEnteredCell ? pEnteredCell->CloneWithoutNote( *pDoc, aPos, SC_CLONECELL_STARTLISTENING ) : 0;
pDoc->PutCell( aPos.Col(), aPos.Row(), aPos.Tab(), pNewCell );
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
+ pDocShell->PostPaintCell( aPos );
SetChangeTrack();
@@ -856,142 +808,145 @@ BOOL __EXPORT ScUndoThesaurus::CanRepeat(SfxRepeatTarget& rTarget) const
}
-// -----------------------------------------------------------------------
-//
-// Notizen ein-/ausblenden
-//
-
-ScUndoNote::ScUndoNote( ScDocShell* pNewDocShell, BOOL bShow,
- const ScAddress& rNewPos, SdrUndoAction* pDraw ) :
- ScSimpleUndo( pNewDocShell ),
- bIsShow ( bShow ),
- aPos ( rNewPos ),
- pDrawUndo ( pDraw )
+// ============================================================================
+ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rPos,
+ const ScNoteData& rNoteData, bool bInsert, SdrUndoAction* pDrawUndo ) :
+ ScSimpleUndo( &rDocShell ),
+ maPos( rPos ),
+ mpDrawUndo( pDrawUndo )
{
+ DBG_ASSERT( rNoteData.mpCaption, "ScUndoReplaceNote::ScUndoReplaceNote - missing note caption" );
+ (bInsert ? maNewData : maOldData) = rNoteData;
}
-__EXPORT ScUndoNote::~ScUndoNote()
+ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rPos,
+ const ScNoteData& rOldData, const ScNoteData& rNewData, SdrUndoAction* pDrawUndo ) :
+ ScSimpleUndo( &rDocShell ),
+ maPos( rPos ),
+ maOldData( rOldData ),
+ maNewData( rNewData ),
+ mpDrawUndo( pDrawUndo )
{
- DeleteSdrUndoAction( pDrawUndo );
+ DBG_ASSERT( maOldData.mpCaption || maNewData.mpCaption, "ScUndoReplaceNote::ScUndoReplaceNote - missing note captions" );
}
-String __EXPORT ScUndoNote::GetComment() const
+ScUndoReplaceNote::~ScUndoReplaceNote()
{
- if ( bIsShow )
- return ScGlobal::GetRscString( STR_UNDO_SHOWNOTE ); // Notiz anzeigen
- else
- return ScGlobal::GetRscString( STR_UNDO_HIDENOTE ); // Notiz ausblenden
+ DeleteSdrUndoAction( mpDrawUndo );
}
-
-void __EXPORT ScUndoNote::Undo()
+void ScUndoReplaceNote::Undo()
{
BeginUndo();
-
- ScDocument* pDoc = pDocShell->GetDocument();
- DoSdrUndoAction(pDrawUndo, pDoc);
-
- ScPostIt aNote(pDoc);
- pDoc->GetNote( aPos.Col(), aPos.Row(), aPos.Tab(), aNote );
- aNote.SetShown( !bIsShow );
- pDoc->SetNote( aPos.Col(), aPos.Row(), aPos.Tab(), aNote );
-
+ DoSdrUndoAction( mpDrawUndo, pDocShell->GetDocument() );
+ /* Undo insert -> remove new note.
+ Undo remove -> insert old note.
+ Undo replace -> remove new note, insert old note. */
+ DoRemoveNote( maNewData );
+ DoInsertNote( maOldData );
+ pDocShell->PostPaintCell( maPos );
EndUndo();
}
-void __EXPORT ScUndoNote::Redo()
+void ScUndoReplaceNote::Redo()
{
BeginRedo();
-
- RedoSdrUndoAction(pDrawUndo);
-
- ScDocument* pDoc = pDocShell->GetDocument();
- ScPostIt aNote(pDoc);
- pDoc->GetNote( aPos.Col(), aPos.Row(), aPos.Tab(), aNote );
- aNote.SetShown( bIsShow );
- pDoc->SetNote( aPos.Col(), aPos.Row(), aPos.Tab(), aNote );
-
+ RedoSdrUndoAction( mpDrawUndo );
+ /* Redo insert -> insert new note.
+ Redo remove -> remove old note.
+ Redo replace -> remove old note, insert new note. */
+ DoRemoveNote( maOldData );
+ DoInsertNote( maNewData );
+ pDocShell->PostPaintCell( maPos );
EndRedo();
}
-void __EXPORT ScUndoNote::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoReplaceNote::Repeat( SfxRepeatTarget& /*rTarget*/ )
{
- // hammanich
}
-BOOL __EXPORT ScUndoNote::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoReplaceNote::CanRepeat( SfxRepeatTarget& /*rTarget*/ ) const
{
return FALSE;
}
+String ScUndoReplaceNote::GetComment() const
+{
+ return ScGlobal::GetRscString( maNewData.mpCaption ?
+ (maOldData.mpCaption ? STR_UNDO_EDITNOTE : STR_UNDO_INSERTNOTE) : STR_UNDO_DELETENOTE );
+}
-// -----------------------------------------------------------------------
-//
-// Text von Notiz aendern (ohne Drawing-Krempel)
-//
+void ScUndoReplaceNote::DoInsertNote( const ScNoteData& rNoteData )
+{
+ if( rNoteData.mpCaption )
+ {
+ ScDocument& rDoc = *pDocShell->GetDocument();
+ DBG_ASSERT( !rDoc.GetNote( maPos ), "ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
+ ScPostIt* pNote = new ScPostIt( rDoc, rNoteData );
+ rDoc.TakeNote( maPos, pNote );
+ }
+}
-ScUndoEditNote::ScUndoEditNote( ScDocShell* pNewDocShell, const ScAddress& rNewPos,
- const ScPostIt& rOld, const ScPostIt& rNew ) :
- ScSimpleUndo( pNewDocShell ),
- aPos ( rNewPos ),
- aOldNote ( rOld ),
- aNewNote ( rNew )
+void ScUndoReplaceNote::DoRemoveNote( const ScNoteData& rNoteData )
{
+ if( rNoteData.mpCaption )
+ {
+ ScDocument& rDoc = *pDocShell->GetDocument();
+ DBG_ASSERT( rDoc.GetNote( maPos ), "ScUndoReplaceNote::DoRemoveNote - missing cell note" );
+ if( ScPostIt* pNote = rDoc.ReleaseNote( maPos ) )
+ {
+ // forget caption (already handled in drawing undo)
+ pNote->ForgetCaption();
+ delete pNote;
+ }
+ }
}
-__EXPORT ScUndoEditNote::~ScUndoEditNote()
+// ============================================================================
+
+ScUndoShowHideNote::ScUndoShowHideNote( ScDocShell& rDocShell, const ScAddress& rPos, bool bShow ) :
+ ScSimpleUndo( &rDocShell ),
+ maPos( rPos ),
+ mbShown( bShow )
{
}
-String __EXPORT ScUndoEditNote::GetComment() const
+ScUndoShowHideNote::~ScUndoShowHideNote()
{
- return ScGlobal::GetRscString( STR_UNDO_SHOWNOTE );
}
-void __EXPORT ScUndoEditNote::Undo()
+void ScUndoShowHideNote::Undo()
{
BeginUndo();
-
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->SetNote( aPos.Col(), aPos.Row(), aPos.Tab(), aOldNote );
-
- // This repaint should not be neccessary but it solves a problem
- // where following a removal of all the text the undo would only
- // refresh the note to the source cell position.
- ScRange aDrawRange(pDoc->GetRange(aPos.Tab(), aOldNote.GetRectangle()));
- // Set Start/End Row to previous/next row to allow for handles.
- SCROW aStartRow = aDrawRange.aStart.Row();
- if(aStartRow > 0)
- aDrawRange.aStart.SetRow(aStartRow - 1);
- SCROW aEndRow = aDrawRange.aEnd.Row();
- if(aEndRow < MAXROW)
- aDrawRange.aEnd.SetRow(aEndRow + 1);
- pDocShell->PostPaint( aDrawRange, PAINT_GRID| PAINT_EXTRAS);
-
+ if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( maPos ) )
+ pNote->ShowCaption( !mbShown );
EndUndo();
}
-void __EXPORT ScUndoEditNote::Redo()
+void ScUndoShowHideNote::Redo()
{
BeginRedo();
-
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->SetNote( aPos.Col(), aPos.Row(), aPos.Tab(), aNewNote );
-
+ if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( maPos ) )
+ pNote->ShowCaption( mbShown );
EndRedo();
}
-void __EXPORT ScUndoEditNote::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoShowHideNote::Repeat( SfxRepeatTarget& /*rTarget*/ )
{
- // hammanich
}
-BOOL __EXPORT ScUndoEditNote::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoShowHideNote::CanRepeat( SfxRepeatTarget& /*rTarget*/ ) const
{
return FALSE;
}
+String ScUndoShowHideNote::GetComment() const
+{
+ return ScGlobal::GetRscString( mbShown ? STR_UNDO_SHOWNOTE : STR_UNDO_HIDENOTE );
+}
+
+// ============================================================================
// -----------------------------------------------------------------------
//
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 513cdaa0dd10..f16409b37239 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: undodat.cxx,v $
- * $Revision: 1.12.32.2 $
+ * $Revision: 1.12.128.2 $
*
* This file is part of OpenOffice.org.
*
@@ -31,10 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-// System - Includes -----------------------------------------------------
-
-
-
// INCLUDE ---------------------------------------------------------------
#include <sfx2/app.hxx>
@@ -61,23 +57,23 @@
// -----------------------------------------------------------------------
-TYPEINIT1(ScUndoDoOutline, SfxUndoAction);
-TYPEINIT1(ScUndoMakeOutline, SfxUndoAction);
-TYPEINIT1(ScUndoOutlineLevel, SfxUndoAction);
-TYPEINIT1(ScUndoOutlineBlock, SfxUndoAction);
-TYPEINIT1(ScUndoRemoveAllOutlines, SfxUndoAction);
-TYPEINIT1(ScUndoAutoOutline, SfxUndoAction);
-TYPEINIT1(ScUndoSubTotals, SfxUndoAction);
-TYPEINIT1(ScUndoSort, SfxUndoAction);
-TYPEINIT1(ScUndoQuery, SfxUndoAction);
-TYPEINIT1(ScUndoAutoFilter, SfxUndoAction);
-TYPEINIT1(ScUndoDBData, SfxUndoAction);
-TYPEINIT1(ScUndoImportData, SfxUndoAction);
-TYPEINIT1(ScUndoRepeatDB, SfxUndoAction);
-//UNUSED2008-05 TYPEINIT1(ScUndoPivot, SfxUndoAction);
-TYPEINIT1(ScUndoDataPilot, SfxUndoAction);
-TYPEINIT1(ScUndoConsolidate, SfxUndoAction);
-TYPEINIT1(ScUndoChartData, SfxUndoAction);
+TYPEINIT1(ScUndoDoOutline, ScSimpleUndo);
+TYPEINIT1(ScUndoMakeOutline, ScSimpleUndo);
+TYPEINIT1(ScUndoOutlineLevel, ScSimpleUndo);
+TYPEINIT1(ScUndoOutlineBlock, ScSimpleUndo);
+TYPEINIT1(ScUndoRemoveAllOutlines, ScSimpleUndo);
+TYPEINIT1(ScUndoAutoOutline, ScSimpleUndo);
+TYPEINIT1(ScUndoSubTotals, ScDBFuncUndo);
+TYPEINIT1(ScUndoSort, ScDBFuncUndo);
+TYPEINIT1(ScUndoQuery, ScDBFuncUndo);
+TYPEINIT1(ScUndoAutoFilter, ScDBFuncUndo);
+TYPEINIT1(ScUndoDBData, ScSimpleUndo);
+TYPEINIT1(ScUndoImportData, ScSimpleUndo);
+TYPEINIT1(ScUndoRepeatDB, ScSimpleUndo);
+//UNUSED2008-05 TYPEINIT1(ScUndoPivot, ScSimpleUndo);
+TYPEINIT1(ScUndoDataPilot, ScSimpleUndo);
+TYPEINIT1(ScUndoConsolidate, ScSimpleUndo);
+TYPEINIT1(ScUndoChartData, ScSimpleUndo);
// -----------------------------------------------------------------------
@@ -858,15 +854,16 @@ void __EXPORT ScUndoSort::Undo()
ScUndoUtil::MarkSimpleBlock( pDocShell, nStartCol, nStartRow, nSortTab,
nEndCol, nEndRow, nSortTab );
- pDoc->DeleteAreaTab( nStartCol,nStartRow, nEndCol,nEndRow, nSortTab, IDF_ALL );
-
+ // do not delete/copy note captions, they are handled in drawing undo (ScDBFuncUndo::mpDrawUndo)
+ pDoc->DeleteAreaTab( nStartCol,nStartRow, nEndCol,nEndRow, nSortTab, IDF_ALL|IDF_NOCAPTIONS );
pUndoDoc->CopyToDocument( nStartCol, nStartRow, nSortTab, nEndCol, nEndRow, nSortTab,
- IDF_ALL, FALSE, pDoc );
+ IDF_ALL|IDF_NOCAPTIONS, FALSE, pDoc );
if (bDestArea)
{
- pDoc->DeleteAreaTab( aDestRange, IDF_ALL );
- pUndoDoc->CopyToDocument( aDestRange, IDF_ALL, FALSE, pDoc );
+ // do not delete/copy note captions, they are handled in drawing undo (ScDBFuncUndo::mpDrawUndo)
+ pDoc->DeleteAreaTab( aDestRange, IDF_ALL|IDF_NOCAPTIONS );
+ pUndoDoc->CopyToDocument( aDestRange, IDF_ALL|IDF_NOCAPTIONS, FALSE, pDoc );
}
// Zeilenhoehen immer (wegen automatischer Anpassung)
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 2fe7c6d72348..9e6eb0cb0c39 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cellsuno.cxx,v $
- * $Revision: 1.113.132.2 $
+ * $Revision: 1.113.126.2 $
*
* This file is part of OpenOffice.org.
*
@@ -3488,7 +3488,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCel
while (pCell)
{
// Notizen zaehlen als nicht-leer
- if ( pCell->GetCellType() != CELLTYPE_NOTE || pCell->GetNotePtr() )
+ if ( !pCell->IsBlank() )
aMarkData.SetMultiMarkArea(
ScRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ),
FALSE );
@@ -3530,7 +3530,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC
while (pCell)
{
BOOL bAdd = FALSE;
- if ( pCell->GetNotePtr() && ( nContentFlags & sheet::CellFlags::ANNOTATION ) )
+ if ( pCell->HasNote() && ( nContentFlags & sheet::CellFlags::ANNOTATION ) )
bAdd = TRUE;
else
switch ( pCell->GetCellType() )
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 23cca80d5da1..d16156c0945c 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docuno.cxx,v $
- * $Revision: 1.67.30.3 $
+ * $Revision: 1.68.52.3 $
*
* This file is part of OpenOffice.org.
*
@@ -2986,34 +2986,30 @@ void ScAnnotationsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
}
-BOOL ScAnnotationsObj::GetAddressByIndex_Impl( ULONG nIndex, ScAddress& rPos ) const
+bool ScAnnotationsObj::GetAddressByIndex_Impl( sal_Int32 nIndex, ScAddress& rPos ) const
{
if (pDocShell)
{
- ULONG nFound = 0;
+ sal_Int32 nFound = 0;
ScDocument* pDoc = pDocShell->GetDocument();
ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell)
+ for( ScBaseCell* pCell = aCellIter.GetFirst(); pCell; pCell = aCellIter.GetNext() )
{
- if (pCell->GetNotePtr())
+ if (pCell->HasNote())
{
if (nFound == nIndex)
{
rPos = ScAddress( aCellIter.GetCol(), aCellIter.GetRow(), aCellIter.GetTab() );
- return TRUE;
+ return true;
}
++nFound;
}
- pCell = aCellIter.GetNext();
}
}
- return FALSE; // nicht gefunden
+ return false;
}
-// XSheetAnnotations
-
-ScAnnotationObj* ScAnnotationsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
+ScAnnotationObj* ScAnnotationsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const
{
if (pDocShell)
{
@@ -3024,8 +3020,10 @@ ScAnnotationObj* ScAnnotationsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
return NULL;
}
-void SAL_CALL ScAnnotationsObj::insertNew( const table::CellAddress& aPosition,
- const ::rtl::OUString& aText )
+// XSheetAnnotations
+
+void SAL_CALL ScAnnotationsObj::insertNew(
+ const table::CellAddress& aPosition, const ::rtl::OUString& rText )
throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
@@ -3034,8 +3032,8 @@ void SAL_CALL ScAnnotationsObj::insertNew( const table::CellAddress& aPosition,
DBG_ASSERT( aPosition.Sheet == nTab, "addAnnotation mit falschem Sheet" );
ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
- ScDocFunc aFunc(*pDocShell);
- aFunc.SetNoteText( aPos, String(aText), TRUE );
+ ScDocFunc aFunc( *pDocShell );
+ aFunc.ReplaceNote( aPos, rText, 0, 0, TRUE );
}
}
@@ -3076,15 +3074,10 @@ sal_Int32 SAL_CALL ScAnnotationsObj::getCount() throw(uno::RuntimeException)
ULONG nCount = 0;
if (pDocShell)
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell)
- {
- if (pCell->GetNotePtr())
+ ScCellIterator aCellIter( pDocShell->GetDocument(), 0,0, nTab, MAXCOL,MAXROW, nTab );
+ for( ScBaseCell* pCell = aCellIter.GetFirst(); pCell; pCell = aCellIter.GetNext() )
+ if (pCell->HasNote())
++nCount;
- pCell = aCellIter.GetNext();
- }
}
return nCount;
}
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index 3f5ebe50b82d..80f77998fe44 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: editsrc.cxx,v $
- * $Revision: 1.26.32.1 $
+ * $Revision: 1.26.128.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,14 +31,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
+#include "editsrc.hxx"
#include "scitems.hxx"
#include <svx/eeitem.hxx>
-
#include <svx/unofored.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/outlobj.hxx>
+#include <svx/editobj.hxx>
-#include "editsrc.hxx"
#include "textuno.hxx"
#include "editutil.hxx"
#include "docsh.hxx"
@@ -49,8 +52,6 @@
#include "drwlayer.hxx"
#include "userdat.hxx"
#include "AccessibleText.hxx"
-#include <svx/svditer.hxx>
-#include <svx/outlobj.hxx>
//------------------------------------------------------------------------
@@ -221,33 +222,8 @@ SvxEditSource* ScAnnotationEditSource::Clone() const
SdrObject* ScAnnotationEditSource::GetCaptionObj()
{
- SdrObject* pRet = NULL;
-
- ScDrawLayer* pModel = pDocShell->GetDocument()->GetDrawLayer();
- if (!pModel)
- return FALSE;
- SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(aCellPos.Tab()));
- DBG_ASSERT(pPage,"Page ?");
-
- pPage->RecalcObjOrdNums();
-
- SdrObjListIter aIter( *pPage, IM_FLAT );
- SdrObject* pObject = aIter.Next();
- while (pObject && !pRet)
- {
- if ( pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA( SdrCaptionObj ) )
- {
- ScDrawObjData* pData = ScDrawLayer::GetObjData( pObject );
- if ( pData && aCellPos.Col() == pData->aStt.Col() && aCellPos.Row() == pData->aStt.Row() )
- {
- pRet = pObject;
- }
- }
-
- pObject = aIter.Next();
- }
-
- return pRet;
+ ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos );
+ return pNote ? pNote->GetCaption() : 0;
}
SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder()
@@ -272,16 +248,9 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder()
return pForwarder;
if ( pDocShell )
- {
- ScDocument* pDoc = pDocShell->GetDocument();
- ScPostIt aNote(pDoc);
- pDoc->GetNote( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote );
-
- if (aNote.GetEditTextObject())
- pEditEngine->SetText( *aNote.GetEditTextObject() ); // incl. Umbrueche
- else
- pEditEngine->SetText( aNote.GetText() );
- }
+ if ( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) )
+ if ( const EditTextObject* pEditObj = pNote->GetEditTextObject() )
+ pEditEngine->SetText( *pEditObj ); // incl. Umbrueche
bDataValid = TRUE;
return pForwarder;
@@ -293,26 +262,14 @@ void ScAnnotationEditSource::UpdateData()
{
ScDocShellModificator aModificator( *pDocShell );
- ScDocument* pDoc = pDocShell->GetDocument();
- ScPostIt aNote(pDoc);
- pDoc->GetNote( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote );
-
- aNote.SetEditTextObject(pEditEngine->CreateTextObject());
-
- pDoc->SetNote(aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote);
-
- if (aNote.IsShown())
+ if( SdrObject* pObj = GetCaptionObj() )
{
- SdrObject* pObj = GetCaptionObj();
- if (pObj)
- {
- OutlinerParaObject* pOPO = new OutlinerParaObject( *aNote.GetEditTextObject() );
- pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT );
- pObj->NbcSetOutlinerParaObject( pOPO );
- pOPO->SetVertical( FALSE ); // notes are always horizontal
-
- pObj->ActionChanged();
- }
+ EditTextObject* pEditObj = pEditEngine->CreateTextObject();
+ OutlinerParaObject* pOPO = new OutlinerParaObject( *pEditObj );
+ delete pEditObj;
+ pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT );
+ pObj->NbcSetOutlinerParaObject( pOPO );
+ pObj->ActionChanged();
}
//! Undo !!!
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index d50fcba244f4..b7d836007935 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: notesuno.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.128.4 $
*
* This file is part of OpenOffice.org.
*
@@ -54,8 +54,9 @@
#include "userdat.hxx"
#include <svx/outlobj.hxx>
#include <svx/unoshape.hxx>
-#include <svx/svdobj.hxx>
+#include <svx/svdocapt.hxx>
#include <svx/svditer.hxx>
+#include <svx/svdpage.hxx>
#include <com/sun/star/drawing/XShapeDescriptor.hpp>
using namespace com::sun::star;
@@ -90,18 +91,6 @@ ScAnnotationObj::ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos) :
// can't be aggregated because getString/setString is handled here
}
-SvxUnoText& ScAnnotationObj::GetUnoText()
-{
- if (!pUnoText)
- {
- ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
- pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertyMap(),
- uno::Reference<text::XText>() );
- pUnoText->acquire();
- }
- return *pUnoText;
-}
-
ScAnnotationObj::~ScAnnotationObj()
{
if (pDocShell)
@@ -229,93 +218,30 @@ table::CellAddress SAL_CALL ScAnnotationObj::getPosition() throw(uno::RuntimeExc
rtl::OUString SAL_CALL ScAnnotationObj::getAuthor() throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- String aAuthor;
- if ( pDocShell )
- {
- ScDocument* pDoc = pDocShell->GetDocument();
- ScPostIt aNote(pDoc);
- pDoc->GetNote( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote );
- aAuthor = aNote.GetAuthor();
- }
- return aAuthor;
+ const ScPostIt* pNote = ImplGetNote();
+ return pNote ? pNote->GetAuthor() : EMPTY_STRING;
}
rtl::OUString SAL_CALL ScAnnotationObj::getDate() throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- String aDate;
- if ( pDocShell )
- {
- ScDocument* pDoc = pDocShell->GetDocument();
- ScPostIt aNote(pDoc);
- pDoc->GetNote( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote );
- aDate = aNote.GetDate();
- }
- return aDate;
+ const ScPostIt* pNote = ImplGetNote();
+ return pNote ? pNote->GetDate() : EMPTY_STRING;
}
sal_Bool SAL_CALL ScAnnotationObj::getIsVisible() throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- BOOL bShown = FALSE;
- if ( pDocShell )
- {
- ScDocument* pDoc = pDocShell->GetDocument();
- ScPostIt aNote(pDoc);
- pDoc->GetNote( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote );
- bShown = aNote.IsShown();
- }
- return bShown;
+ const ScPostIt* pNote = ImplGetNote();
+ return pNote && pNote->IsCaptionShown();
}
void SAL_CALL ScAnnotationObj::setIsVisible( sal_Bool bIsVisible ) throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- BOOL bDone = FALSE;
- if ( pDocShell )
- {
- //! Funktion an docfunc oder so
-
- BOOL bSet = bIsVisible ? TRUE : FALSE;
- ScDocument* pDoc = pDocShell->GetDocument();
- BOOL bUndo(pDoc->IsUndoEnabled());
- SCCOL nCol = aCellPos.Col();
- SCROW nRow = aCellPos.Row();
- SCTAB nTab = aCellPos.Tab();
- ScPostIt aNote(pDoc);
- if ( pDoc->GetNote( nCol, nRow, nTab, aNote ) )
- {
- BOOL bHad = pDoc->HasNoteObject( nCol, nRow, nTab );
- if ( bHad != bSet )
- {
- pDocShell->MakeDrawLayer();
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
-
- if (bUndo)
- pModel->BeginCalcUndo();
- ScDetectiveFunc aFunc( pDoc,nTab );
- if ( bSet )
- bDone = ( aFunc.ShowComment( nCol, nRow, FALSE ) != NULL );
- else
- bDone = aFunc.HideComment( nCol, nRow );
- SdrUndoGroup* pUndo = NULL;
- if (bUndo)
- pUndo = pModel->GetCalcUndo();
- if (bDone)
- {
- aNote.SetShown( bSet );
- pDoc->SetNote( nCol, nRow, nTab, aNote );
- if (pUndo)
- pDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoNote( pDocShell, bSet, aCellPos, pUndo ) );
-
- pDocShell->SetDocumentModified();
- }
- else
- delete pUndo;
- }
- }
- }
+ // show/hide note with undo action
+ if( pDocShell )
+ pDocShell->GetDocFunc().ShowNote( aCellPos, bIsVisible );
}
// XSheetAnnotationShapeSupplier
@@ -326,6 +252,23 @@ uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape(
return new ScAnnotationShapeObj(pDocShell, aCellPos);
}
+SvxUnoText& ScAnnotationObj::GetUnoText()
+{
+ if (!pUnoText)
+ {
+ ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
+ pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertyMap(),
+ uno::Reference<text::XText>() );
+ pUnoText->acquire();
+ }
+ return *pUnoText;
+}
+
+const ScPostIt* ScAnnotationObj::ImplGetNote() const
+{
+ return pDocShell ? pDocShell->GetDocument()->GetNote( aCellPos ) : 0;
+}
+
//------------------------------------------------------------------------
ScAnnotationShapeObj::ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos) :
@@ -354,139 +297,16 @@ SvxUnoText& ScAnnotationShapeObj::GetUnoText()
uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape()
{
if (!xShape.is())
- {
- ScPostIt aNote(pDocShell->GetDocument());
- if ( pDocShell->GetDocument()->GetNote( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote ) )
- {
- const SfxItemSet& rSet = aNote.GetItemSet();
-
- // In order to transform the SfxItemSet to an EscherPropertyContainer
- // and export the properties, we need to recreate the drawing object and
- // pass this to XclObjComment() for processing.
- SdrCaptionObj* pCaption = new SdrCaptionObj( aNote.GetRectangle() );
- pCaption->SetMergedItemSet(rSet);
-
- if(const EditTextObject* pEditText = aNote.GetEditTextObject())
- {
- OutlinerParaObject* pOPO = new OutlinerParaObject( *pEditText );
- pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT );
- pCaption->NbcSetOutlinerParaObject( pOPO );
- pOPO->SetVertical( FALSE ); // notes are always horizontal
- }
-
- aNote.InsertObject(pCaption, *pDocShell->GetDocument(), aCellPos.Tab(), sal_False);
-
- xShape.set(pCaption->getUnoShape(), uno::UNO_QUERY);
- }
- }
+ if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) )
+ if( SdrObject* pCaption = pNote->GetCaption() )
+ xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
return xShape;
}
-SdrObject* ScAnnotationShapeObj::GetCaptionObj()
-{
- SdrObject* pRet = NULL;
-
- ScDrawLayer* pModel = pDocShell->GetDocument()->GetDrawLayer();
- if (!pModel)
- return FALSE;
- SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(aCellPos.Tab()));
- DBG_ASSERT(pPage,"Page ?");
-
- pPage->RecalcObjOrdNums();
-
- SdrObjListIter aIter( *pPage, IM_FLAT );
- SdrObject* pObject = aIter.Next();
- while (pObject && !pRet)
- {
- if ( pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA( SdrCaptionObj ) )
- {
- ScDrawObjData* pData = ScDrawLayer::GetObjData( pObject );
- if ( pData && aCellPos.Col() == pData->aStt.Col() && aCellPos.Row() == pData->aStt.Row() )
- {
- pRet = pObject;
- }
- }
-
- pObject = aIter.Next();
- }
-
- return pRet;
-}
-
-void ScAnnotationShapeObj::UpdateData()
-{
- if (xShape.is())
- {
- SvxShape* pShapeImp = SvxShape::getImplementation(xShape);
- if (pShapeImp)
- {
- SdrObject *pSdrObj = pShapeImp->GetSdrObject();
- if (pSdrObj)
- {
- ScPostIt aNote(pDocShell->GetDocument());
- if ( pDocShell->GetDocument()->GetNote( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote ) )
- {
- aNote.SetItemSet(pSdrObj->GetMergedItemSet());
- awt::Point aPos = xShape->getPosition();
- awt::Size aSize = xShape->getSize();
- Rectangle aRect(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height));
- aNote.SetRectangle(aRect);
-
- pDocShell->GetDocument()->SetNote(aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote);
-
- if (aNote.IsShown())
- {
- SdrObject* pObj = GetCaptionObj();
- if (pObj)
- {
- uno::Reference<drawing::XShape> xCaptionShape(pObj->getUnoShape(), uno::UNO_QUERY);
- if (xCaptionShape.is())
- {
- xCaptionShape->setSize(aSize);
- xCaptionShape->setPosition(aPos);
- }
- pObj->SetMergedItemSet(aNote.GetItemSet());
- pObj->ActionChanged();
- }
- // not neccessary, because it should not be possible to change the text in the shape directly
-// if((pSdrObj->GetOutlinerParaObject()))
-// pMyAnnotation->pOPO = new OutlinerParaObject( *(pSdrObj->GetOutlinerParaObject()) );
- }
- }
- }
- }
- }
-}
-
ScAnnotationShapeObj::~ScAnnotationShapeObj()
{
if (pDocShell)
pDocShell->GetDocument()->RemoveUnoObject(*this);
-
- if (xShape.is() && pDocShell)
- {
- SvxShape* pShapeImp = SvxShape::getImplementation(xShape);
- if (pShapeImp)
- {
- SdrObject *pSdrObj = pShapeImp->GetSdrObject();
- if (pSdrObj)
- {
- if (pSdrObj->ISA( SdrCaptionObj ))
- {
- ScPostIt aNote(pDocShell->GetDocument());
- if ( pDocShell->GetDocument()->GetNote( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), aNote ) )
- {
- aNote.RemoveObject(static_cast< SdrCaptionObj* >(pSdrObj), *pDocShell->GetDocument(), aCellPos.Tab());
- }
- }
- else
- {
- DBG_ERROR("should be a Caption Shape");
- }
- }
- }
- }
-
if (pUnoText)
pUnoText->release();
}
@@ -662,29 +482,34 @@ awt::Point SAL_CALL ScAnnotationShapeObj::getPosition( )
throw (uno::RuntimeException)
{
ScUnoGuard aGuard;
- return GetXShape()->getPosition();
+ GetXShape();
+ return xShape.is() ? xShape->getPosition() : awt::Point();
}
void SAL_CALL ScAnnotationShapeObj::setPosition( const awt::Point& aPosition )
throw (uno::RuntimeException)
{
ScUnoGuard aGuard;
- GetXShape()->setPosition(aPosition);
- UpdateData();
+ GetXShape();
+ if( xShape.is() )
+ xShape->setPosition(aPosition);
}
awt::Size SAL_CALL ScAnnotationShapeObj::getSize( )
throw (uno::RuntimeException)
{
ScUnoGuard aGuard;
- return GetXShape()->getSize();
+ GetXShape();
+ return xShape.is() ? xShape->getSize() : awt::Size();
}
void SAL_CALL ScAnnotationShapeObj::setSize( const awt::Size& aSize )
throw (beans::PropertyVetoException, uno::RuntimeException)
{
ScUnoGuard aGuard;
- GetXShape()->setSize(aSize);
+ GetXShape();
+ if( xShape.is() )
+ xShape->setSize(aSize);
}
// XPropertyState
@@ -718,10 +543,7 @@ void SAL_CALL ScAnnotationShapeObj::setPropertyToDefault( const ::rtl::OUString&
ScUnoGuard aGuard;
uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
if (xState.is())
- {
xState->setPropertyToDefault( PropertyName );
- UpdateData();
- }
}
uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyDefault( const rtl::OUString& aPropertyName )
@@ -756,10 +578,7 @@ void SAL_CALL ScAnnotationShapeObj::setPropertyValue( const rtl::OUString& aProp
ScUnoGuard aGuard;
uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
if (xProp.is())
- {
xProp->setPropertyValue( aPropertyName, aValue );
- UpdateData();
- }
}
uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyValue( const rtl::OUString& PropertyName )
@@ -833,10 +652,7 @@ void SAL_CALL ScAnnotationShapeObj::setPropertyValues( const uno::Sequence< rtl:
ScUnoGuard aGuard;
uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
if (xProp.is())
- {
xProp->setPropertyValues( aPropertyNames, aValues );
- UpdateData();
- }
}
uno::Sequence< uno::Any > SAL_CALL ScAnnotationShapeObj::getPropertyValues(
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index eeed366dca54..54c8ff12e189 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cellsh.cxx,v $
- * $Revision: 1.48 $
+ * $Revision: 1.48.126.3 $
*
* This file is part of OpenOffice.org.
*
@@ -563,32 +563,11 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_RANGE_NOTETEXT:
{
- SCCOL nNoteCol;
- SCROW nNoteRow;
- SCTAB nNoteTab;
-
- // #43343# immer Cursorposition
-#if 0
- ScRange aRange;
- if (GetViewData()->GetSimpleArea(aRange,TRUE) == SC_MARK_SIMPLE)
- {
- nNoteCol = aRange.aStart.Col();
- nNoteRow = aRange.aStart.Row();
- nNoteTab = aRange.aStart.Tab();
- }
- else // Cursor bei Mehrfachselektion
-#endif
- {
- nNoteCol = nPosX;
- nNoteRow = nPosY;
- nNoteTab = nTab;
- }
-
+ // #43343# always take cursor position, do not use top-left cell of selection
+ ScAddress aPos( nPosX, nPosY, nTab );
String aNoteText;
- ScPostIt aNote(pDoc);
- if ( pDoc->GetNote( nNoteCol, nNoteRow, nNoteTab, aNote ) )
- aNoteText = aNote.GetText();
-
+ if ( const ScPostIt* pNote = pDoc->GetNote( aPos ) )
+ aNoteText = pNote->GetText();
rSet.Put( SfxStringItem( nWhich, aNoteText ) );
}
break;
@@ -926,14 +905,9 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case FID_NOTE_VISIBLE:
{
- ScPostIt aNote(pDoc);
- if ( pDoc->IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) &&
- pDoc->GetNote( nPosX, nPosY, nTab, aNote ) )
- {
- BOOL bShown = aNote.IsShown() &&
- pDoc->HasNoteObject( nPosX, nPosY, nTab );
- rSet.Put( SfxBoolItem( nWhich, bShown ) );
- }
+ const ScPostIt* pNote = pDoc->GetNote( ScAddress( nPosX, nPosY, nTab ) );
+ if ( pNote && pDoc->IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) )
+ rSet.Put( SfxBoolItem( nWhich, pNote->IsCaptionShown() ) );
else
rSet.DisableItem( nWhich );
}
@@ -953,21 +927,16 @@ void ScCellShell::GetState(SfxItemSet &rSet)
for (ULONG nPos=0; nPos<nCount && !bEnable; nPos++)
{
ScCellIterator aCellIter( pDoc, *aRanges.GetObject(nPos) );
- ScBaseCell* pCell = aCellIter.GetFirst();
- while ( pCell && !bEnable )
- {
- if ( pCell->GetNotePtr() )
+ for( ScBaseCell* pCell = aCellIter.GetFirst(); pCell && !bEnable; pCell = aCellIter.GetNext() )
+ if ( pCell->HasNote() )
bEnable = TRUE; // note found
- pCell = aCellIter.GetNext();
- }
}
}
}
else
{
- ScPostIt aNote(pDoc);
bEnable = pDoc->IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) &&
- pDoc->GetNote( nPosX, nPosY, nTab, aNote );
+ pDoc->GetNote( ScAddress( nPosX, nPosY, nTab ) );
}
if ( !bEnable )
rSet.DisableItem( nWhich );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index e5c133598b5b..5a5eba4d8d72 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cellsh1.cxx,v $
- * $Revision: 1.54 $
+ * $Revision: 1.54.102.5 $
*
* This file is part of OpenOffice.org.
*
@@ -1936,75 +1936,46 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_RANGE_NOTETEXT:
if (pReqArgs)
{
-
- ScDocument* pDoc = GetViewData()->GetDocument();
- String aNoteStr = ((const SfxStringItem&)pReqArgs->
- Get( SID_RANGE_NOTETEXT )).GetValue();
- ScPostIt aNote( aNoteStr, pDoc);
-
- SCCOL nCol;
- SCROW nRow;
- SCTAB nTab;
+ const SfxStringItem& rTextItem = (const SfxStringItem&)pReqArgs->Get( SID_RANGE_NOTETEXT );
// #43343# immer Cursorposition
- nCol = GetViewData()->GetCurX();
- nRow = GetViewData()->GetCurY();
- nTab = GetViewData()->GetTabNo();
-
- pTabViewShell->SetNote( nCol, nRow, nTab, aNote );
+ ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+ pTabViewShell->SetNoteText( aPos, rTextItem.GetValue() );
rReq.Done();
}
break;
case SID_INSERT_POSTIT:
+ if ( pReqArgs )
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- SCCOL nCol = GetViewData()->GetCurX();
- SCROW nRow = GetViewData()->GetCurY();
- SCTAB nTab = GetViewData()->GetTabNo();
- ScPostIt aNote(pDoc);
+ const SvxPostItAuthorItem& rAuthorItem = (const SvxPostItAuthorItem&)pReqArgs->Get( SID_ATTR_POSTIT_AUTHOR );
+ const SvxPostItDateItem& rDateItem = (const SvxPostItDateItem&) pReqArgs->Get( SID_ATTR_POSTIT_DATE );
+ const SvxPostItTextItem& rTextItem = (const SvxPostItTextItem&) pReqArgs->Get( SID_ATTR_POSTIT_TEXT );
- if ( pReqArgs )
- {
- const SvxPostItAuthorItem& rAuthorItem = (const SvxPostItAuthorItem&)pReqArgs->Get( SID_ATTR_POSTIT_AUTHOR );
- const SvxPostItDateItem& rDateItem = (const SvxPostItDateItem&) pReqArgs->Get( SID_ATTR_POSTIT_DATE );
- const SvxPostItTextItem& rTextItem = (const SvxPostItTextItem&) pReqArgs->Get( SID_ATTR_POSTIT_TEXT );
- aNote.SetText( rTextItem.GetValue() );
- aNote.SetDate( rDateItem.GetValue() );
- aNote.SetAuthor( rAuthorItem.GetValue() );
-
- pTabViewShell->SetNote( nCol, nRow, nTab, aNote );
- rReq.Done();
- }
- else
- {
- pTabViewShell->EditNote(); // Zeichenobjekt zum Editieren
- }
+ ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+ pTabViewShell->ReplaceNote( aPos, rTextItem.GetValue(), &rAuthorItem.GetValue(), &rDateItem.GetValue() );
+ rReq.Done();
+ }
+ else
+ {
+ pTabViewShell->EditNote(); // Zeichenobjekt zum Editieren
}
break;
case FID_NOTE_VISIBLE:
{
ScDocument* pDoc = GetViewData()->GetDocument();
- SCCOL nCol = GetViewData()->GetCurX();
- SCROW nRow = GetViewData()->GetCurY();
- SCTAB nTab = GetViewData()->GetTabNo();
- ScPostIt aNote(pDoc);
-
- if ( pDoc->GetNote( nCol, nRow, nTab, aNote ) )
+ ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+ if( ScPostIt* pNote = pDoc->GetNote( aPos ) )
{
- BOOL bShow;
+ bool bShow;
const SfxPoolItem* pItem;
- if ( pReqArgs && pReqArgs->GetItemState(
- FID_NOTE_VISIBLE, TRUE, &pItem ) == SFX_ITEM_SET )
+ if ( pReqArgs && (pReqArgs->GetItemState( FID_NOTE_VISIBLE, TRUE, &pItem ) == SFX_ITEM_SET) )
bShow = ((const SfxBoolItem*) pItem)->GetValue();
else
- bShow = !pDoc->HasNoteObject( nCol, nRow, nTab );
+ bShow = !pNote->IsCaptionShown();
- if ( bShow )
- pTabViewShell->ShowNote();
- else
- pTabViewShell->HideNote();
+ pTabViewShell->ShowNote( bShow );
if (!pReqArgs)
rReq.AppendItem( SfxBoolItem( FID_NOTE_VISIBLE, bShow ) );
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 4a5e54d19f31..297b81de8125 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dbfunc.cxx,v $
- * $Revision: 1.15.24.1 $
+ * $Revision: 1.15.126.1 $
*
* This file is part of OpenOffice.org.
*
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index eebc01136186..0c59e083f0fe 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: drawview.cxx,v $
- * $Revision: 1.50.142.2 $
+ * $Revision: 1.50.126.8 $
*
* This file is part of OpenOffice.org.
*
@@ -65,6 +65,7 @@
#include "viewuno.hxx"
#include "userdat.hxx"
#include "postit.hxx"
+#include "undocell.hxx"
#include "sc.hrc"
@@ -276,7 +277,7 @@ void ScDrawView::SetMarkedToLayer( BYTE nLayerNo )
for (ULONG i=0; i<nCount; i++)
{
SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
- if ( !pObj->ISA(SdrUnoObj) )
+ if ( !pObj->ISA(SdrUnoObj) && (pObj->GetLayer() != SC_LAYER_INTERN) )
{
AddUndo( new SdrUndoObjectLayerChange( *pObj, pObj->GetLayer(), (SdrLayerID)nLayerNo) );
pObj->SetLayer( nLayerNo );
@@ -295,32 +296,23 @@ void ScDrawView::SetMarkedToLayer( BYTE nLayerNo )
}
}
-BOOL ScDrawView::HasMarkedControl() const
+bool ScDrawView::HasMarkedControl() const
{
- if (AreObjectsMarked())
- {
- const SdrMarkList& rMark = GetMarkedObjectList();
- ULONG nCount = rMark.GetMarkCount();
- for (ULONG i=0; i<nCount; i++)
- {
- SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
- if ( pObj->ISA(SdrUnoObj) )
- return TRUE;
- else if ( pObj->ISA(SdrObjGroup) )
- {
- SdrObjListIter aIter( *pObj, IM_DEEPWITHGROUPS );
- SdrObject* pSubObj = aIter.Next();
- while (pSubObj)
- {
- if ( pSubObj->ISA(SdrUnoObj) )
- return TRUE;
- pSubObj = aIter.Next();
- }
- }
+ SdrObjListIter aIter( GetMarkedObjectList() );
+ for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
+ if( pObj->ISA( SdrUnoObj ) )
+ return true;
+ return false;
+}
- }
- }
- return FALSE; // war nix
+bool ScDrawView::HasMarkedInternal() const
+{
+ // internal objects should not be inside a group, but who knows...
+ SdrObjListIter aIter( GetMarkedObjectList() );
+ for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
+ if( pObj->GetLayer() == SC_LAYER_INTERN )
+ return true;
+ return false;
}
void ScDrawView::UpdateWorkArea()
@@ -400,7 +392,7 @@ void ScDrawView::DoConnect(SdrOle2Obj* pOleObj)
pViewData->GetViewShell()->ConnectObject( pOleObj );
}
-void __EXPORT ScDrawView::MarkListHasChanged()
+void ScDrawView::MarkListHasChanged()
{
FmFormView::MarkListHasChanged();
@@ -443,14 +435,9 @@ void __EXPORT ScDrawView::MarkListHasChanged()
if ( nMarkCount == 0 && !pViewData->GetViewShell()->IsDrawSelMode() && !bInConstruct )
{
- // re-lock background layer if it was unlocked in SelectObject
- SdrLayer* pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK);
- if ( pLayer && !IsLayerLocked( pLayer->GetName() ) )
- SetLayerLocked( pLayer->GetName(), TRUE );
- // re-lock this internal note object.
- pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if ( pLayer && !IsLayerLocked( pLayer->GetName() ) )
- SetLayerLocked( pLayer->GetName(), TRUE );
+ // relock layers that may have been unlocked before
+ LockBackgroundLayer();
+ LockInternalLayer();
}
BOOL bSubShellSet = FALSE;
@@ -696,18 +683,15 @@ BOOL ScDrawView::SelectObject( const String& rName )
pView->ScrollToObject( pFound );
- // #61585# to select an object on the background layer, the layer has to
- // be unlocked even if exclusive drawing selection mode is not active
- // (this is reversed in MarkListHasChanged when nothing is selected)
-
+ /* #61585# To select an object on the background layer, the layer has to
+ be unlocked even if exclusive drawing selection mode is not active
+ (this is reversed in MarkListHasChanged when nothing is selected) */
if ( pFound->GetLayer() == SC_LAYER_BACK &&
!pViewData->GetViewShell()->IsDrawSelMode() &&
!pDoc->IsTabProtected( nTab ) &&
!pViewData->GetSfxDocShell()->IsReadOnly() )
{
- SdrLayer* pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK);
- if (pLayer)
- SetLayerLocked( pLayer->GetName(), FALSE );
+ UnlockBackgroundLayer();
}
SdrPageView* pPV = GetSdrPageView();
@@ -749,6 +733,28 @@ FASTBOOL ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, ULONG n
return InsertObjectAtView( pObj, rPV, nOptions );
}
+SdrObject* ScDrawView::GetMarkedNoteCaption( ScDrawObjData** ppCaptData )
+{
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ if( pViewData && (rMarkList.GetMarkCount() == 1) )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ if( ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, pViewData->GetTabNo() ) )
+ {
+ if( ppCaptData ) *ppCaptData = pCaptData;
+ return pObj;
+ }
+ }
+ return 0;
+}
+
+void ScDrawView::LockCalcLayer( SdrLayerID nLayer, bool bLock )
+{
+ SdrLayer* pLockLayer = GetModel()->GetLayerAdmin().GetLayerPerID( nLayer );
+ if( pLockLayer && (IsLayerLocked( pLockLayer->GetName() ) != bLock) )
+ SetLayerLocked( pLockLayer->GetName(), bLock );
+}
+
void __EXPORT ScDrawView::MakeVisible( const Rectangle& rRect, Window& rWin )
{
//! rWin richtig auswerten
@@ -758,6 +764,45 @@ void __EXPORT ScDrawView::MakeVisible( const Rectangle& rRect, Window& rWin )
pViewData->GetView()->MakeVisible( rRect );
}
+void ScDrawView::DeleteMarked()
+{
+ // try to delete a note caption object with its cell note in the Calc document
+ ScDrawObjData* pCaptData = 0;
+ if( SdrObject* pCaptObj = GetMarkedNoteCaption( &pCaptData ) )
+ {
+ (void)pCaptObj; // prevent 'unused variable' compiler warning in pro builds
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : 0;
+ SfxUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : 0;
+ bool bUndo = pDrawLayer && pDocShell && pUndoMgr && pDoc->IsUndoEnabled();
+
+ // remove the cell note from document, we are its owner now
+ ScPostIt* pNote = pDoc->ReleaseNote( pCaptData->maStart );
+ DBG_ASSERT( pNote, "ScDrawView::DeleteMarked - cell note missing in document" );
+ if( pNote )
+ {
+ // rescue note data for undo (with pointer to caption object)
+ ScNoteData aNoteData = pNote->GetNoteData();
+ DBG_ASSERT( aNoteData.mpCaption == pCaptObj, "ScDrawView::DeleteMarked - caption object does not match" );
+ // collect the drawing undo action created while deleting the note
+ if( bUndo )
+ pDrawLayer->BeginCalcUndo();
+ // delete the note (already removed from document above)
+ delete pNote;
+ // add the undo action for the note
+ if( bUndo )
+ pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, pCaptData->maStart, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
+ // repaint the cell to get rid of the note marker
+ if( pDocShell )
+ pDocShell->PostPaintCell( pCaptData->maStart );
+ // done, return now to skip call of FmFormView::DeleteMarked()
+ return;
+ }
+ }
+
+ FmFormView::DeleteMarked();
+}
+
SdrEndTextEditKind ScDrawView::ScEndTextEdit()
{
BOOL bIsTextEdit = IsTextEdit();
@@ -783,88 +828,15 @@ void ScDrawView::MarkDropObj( SdrObject* pObj )
}
}
-void ScDrawView::StoreCaptionAttribs()
-{
- SdrObject* pObj = NULL;
- const SdrMarkList& rMarkList = GetMarkedObjectList();
-
- if( rMarkList.GetMarkCount() == 1 )
- pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-
- if ( pObj && pObj->GetLayer() == SC_LAYER_INTERN && pObj->ISA(SdrCaptionObj) )
- {
- ScAddress aTabPos;
- ScDrawObjData* pData = ScDrawLayer::GetObjData( pObj );
- if( pData )
- aTabPos = pData->aStt;
- ScPostIt aNote(pDoc);
- if(pDoc->GetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote ))
- {
- aNote.SetItemSet(pObj->GetMergedItemSet());
- pDoc->SetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote );
- }
- }
-}
-
-void ScDrawView::StoreCaptionDimensions()
-{
- SdrObject* pObj = NULL;
- const SdrMarkList& rMarkList = GetMarkedObjectList();
-
- if( rMarkList.GetMarkCount() == 1 )
- pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-
- if ( pObj && pObj->GetLayer() == SC_LAYER_INTERN && pObj->ISA(SdrCaptionObj) )
- {
- ScAddress aTabPos;
- ScDrawObjData* pData = ScDrawLayer::GetObjData( pObj );
- if( pData )
- aTabPos = pData->aStt;
- ScPostIt aNote(pDoc);
- if(pDoc->GetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote ))
- {
- Rectangle aOldRect = aNote.GetRectangle();
- Rectangle aNewRect = pObj->GetLogicRect();
- if(aOldRect != aNewRect)
- {
- aNote.SetRectangle(aNewRect);
- // The new height/width is honoured if property item is reset.
- SdrCaptionObj* pCaption = static_cast<SdrCaptionObj*>(pObj);
- OutlinerParaObject* pPObj = pCaption->GetOutlinerParaObject();
- bool bVertical = (pPObj && pPObj->IsVertical());
- if(!bVertical && aNewRect.Bottom() - aNewRect.Top() > aOldRect.Bottom() - aOldRect.Top())
- {
- if(pCaption && pCaption->IsAutoGrowHeight())
- {
- pCaption->SetMergedItem( SdrTextAutoGrowHeightItem( false ) );
- aNote.SetItemSet(pCaption->GetMergedItemSet());
- }
- }
- else if(bVertical && aNewRect.Right() - aNewRect.Left() > aOldRect.Right() - aOldRect.Left())
- {
- if(pCaption && pCaption->IsAutoGrowWidth())
- {
- pCaption->SetMergedItem( SdrTextAutoGrowWidthItem( false ) );
- aNote.SetItemSet(pCaption->GetMergedItemSet());
- }
- }
- pDoc->SetNote( aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), aNote );
- }
- }
- }
-}
-
void ScDrawView::CaptionTextDirection( USHORT nSlot )
{
if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM)
return;
SdrObject* pObject = GetTextEditObject();
-
- if ( pObject && pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA(SdrCaptionObj) )
+ if ( ScDrawLayer::IsNoteCaption( pObject ) )
{
- SdrCaptionObj* pCaption = static_cast<SdrCaptionObj*>(pObject);
- if(pCaption)
+ if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
{
SfxItemSet aAttr(pCaption->GetMergedItemSet());
aAttr.Put( SvxWritingModeItem(
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 47b1e083e26f..d2c46e873e90 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gridwin.cxx,v $
- * $Revision: 1.94.20.2 $
+ * $Revision: 1.96.50.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,30 +31,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------
-
-//SV
-//#define _CLIP_HXX
-#define _CONFIG_HXX
-#define _CURSOR_HXX
-#define _FONTDLG_HXX
-#define _PRVWIN_HXX
-
-//svdraw.hxx
-#define _SDR_NOITEMS
-#define _SDR_NOTOUCH
-#define _SDR_NOTRANSFORM
-//#define _SDR_NOOBJECTS
-//#define _SDR_NOVIEWS
-
-
-// INCLUDE ---------------------------------------------------------------
-
#include "scitems.hxx"
-
#include <memory> //auto_ptr
#include <svx/adjitem.hxx>
#include <svx/algitem.hxx>
@@ -82,6 +60,7 @@
#include <svx/svdview.hxx> // fuer Command-Handler (COMMAND_INSERTTEXT)
#include <svx/outliner.hxx> // fuer Command-Handler (COMMAND_INSERTTEXT)
#include <svx/svditer.hxx>
+#include <svx/svdocapt.hxx>
#include <svx/svdpagv.hxx>
#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
@@ -353,47 +332,23 @@ BOOL lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange )
}
-void lcl_UnLockComment( SdrView* pView, SdrPageView* pPV, SdrModel* pDrDoc, const Point& rPos ,ScViewData* pViewData )
+void lcl_UnLockComment( ScDrawView* pView, SdrPageView* pPV, SdrModel* pDrDoc, const Point& rPos, ScViewData* pViewData )
{
if (!pView && !pPV && !pDrDoc && !pViewData)
- return ;
-
- SdrObject* pFoundObj = NULL;
- ScAddress aTabPos;
-
- SdrObjListIter aIter( *pPV->GetObjList(), IM_FLAT );
- SdrObject* pObject = aIter.Next();
- while (pObject && !pFoundObj)
- {
- if ( pObject->GetLayer() == SC_LAYER_INTERN && pObject->ISA(SdrCaptionObj)
- && pObject->GetLogicRect().IsInside( rPos ) )
- {
- pFoundObj = pObject;
- ScDrawObjData* pData = ScDrawLayer::GetObjDataTab( pObject, pViewData->GetTabNo() );
- if( pData )
- {
- aTabPos = ScAddress( pData->aStt);
- }
- }
- pObject = aIter.Next();
- }
+ return;
- if ( pFoundObj )
+ ScDocument& rDoc = *pViewData->GetDocument();
+ ScAddress aCellPos( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() );
+ ScPostIt* pNote = rDoc.GetNote( aCellPos );
+ SdrObject* pObj = pNote ? pNote->GetCaption() : 0;
+ if( pObj && pObj->GetLogicRect().IsInside( rPos ) && ScDrawLayer::IsNoteCaption( pObj ) )
{
- SdrLayer* pLockLayer = NULL;
- ScDocument* pDoc = pViewData->GetDocument();
- SfxObjectShell* pDocSh = pViewData->GetSfxDocShell();
- const ScProtectionAttr* pProtAttr = static_cast< const ScProtectionAttr* > (pDoc->GetAttr(aTabPos.Col(), aTabPos.Row(), aTabPos.Tab(), ATTR_PROTECTION ) );
- BOOL bProtectAttr = pProtAttr->GetProtection() || pProtAttr->GetHideCell() ;
- BOOL bProtectDoc = pDoc->IsTabProtected(aTabPos.Tab()) || pDocSh->IsReadOnly() ;
- BOOL bProtect = bProtectDoc && bProtectAttr ;
-
- // Leave the internal note object unlocked - re-lock in ScDrawView::MarkListHasChanged()
- pLockLayer = pDrDoc->GetLayerAdmin().GetLayerPerID(SC_LAYER_INTERN);
- if (pLockLayer)
- pView->SetLayerLocked( pLockLayer->GetName(), bProtect );
+ const ScProtectionAttr* pProtAttr = static_cast< const ScProtectionAttr* > (rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_PROTECTION ) );
+ bool bProtectAttr = pProtAttr->GetProtection() || pProtAttr->GetHideCell() ;
+ bool bProtectDoc = rDoc.IsTabProtected( aCellPos.Tab() ) || pViewData->GetSfxDocShell()->IsReadOnly() ;
+ // unlock internal layer (if not protected), will be relocked in ScDrawView::MarkListHasChanged()
+ pView->LockInternalLayer( bProtectDoc && bProtectAttr );
}
-
}
//==================================================================
@@ -2796,7 +2751,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel )
SCsROW nCellY;
pViewData->GetPosFromPixel( rPosPixel.X(), rPosPixel.Y(), eWhich, nCellX, nCellY );
ScTabView* pView = pViewData->GetView();
- SdrView* pDrawView = pView->GetSdrView();
+ ScDrawView* pDrawView = pView->GetScDrawView();
// check cell edit mode
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index 4122882468c2..5d87806076ab 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gridwin3.cxx,v $
- * $Revision: 1.21 $
+ * $Revision: 1.20.126.2 $
*
* This file is part of OpenOffice.org.
*
@@ -31,14 +31,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-// INCLUDE ---------------------------------------------------------------
-
#include "scitems.hxx"
#include <svx/eeitem.hxx>
-
#include <svx/svdoutl.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdpagv.hxx>
@@ -56,13 +51,11 @@
#include "drawutil.hxx"
#include "document.hxx"
+#include "drwlayer.hxx"
#include <vcl/svapp.hxx>
-// STATIC DATA -----------------------------------------------------------
-
// -----------------------------------------------------------------------
-
BOOL ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt)
{
BOOL bRet = FALSE;
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 9a4df66300f9..8739ee2b0b91 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gridwin5.cxx,v $
- * $Revision: 1.23 $
+ * $Revision: 1.23.128.2 $
*
* This file is part of OpenOffice.org.
*
@@ -99,7 +99,6 @@ BOOL ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, BOOL bKeyboard )
BOOL bDone = FALSE;
ScDocument* pDoc = pViewData->GetDocument();
- ScPostIt aNote(pDoc);
SCTAB nTab = pViewData->GetTabNo();
ScAddress aCellPos( nPosX, nPosY, nTab );
@@ -202,8 +201,8 @@ BOOL ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, BOOL bKeyboard )
}
// Notiz nur, wenn sie nicht schon auf dem Drawing-Layer angezeigt wird:
- if ( aTrackText.Len() || ( pDoc->GetNote( nPosX, nPosY, nTab, aNote ) &&
- !pDoc->HasNoteObject( nPosX, nPosY, nTab ) ) )
+ const ScPostIt* pNote = pDoc->GetNote( aCellPos );
+ if ( (aTrackText.Len() > 0) || (pNote && !pNote->IsCaptionShown()) )
{
BOOL bNew = TRUE;
BOOL bFast = FALSE;
@@ -225,27 +224,29 @@ BOOL ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, BOOL bKeyboard )
delete pNoteMarker;
- Window* pRight = NULL;
- Window* pBottom = NULL;
- Window* pDiagonal = NULL;
- if ( pViewData->GetHSplitMode() == SC_SPLIT_FIX && eHWhich == SC_SPLIT_LEFT )
- {
- ScSplitPos eRight = ( eVWhich == SC_SPLIT_TOP ) ?
- SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT;
- pRight = pViewData->GetView()->GetWindowByPos(eRight);
- }
- if ( pViewData->GetVSplitMode() == SC_SPLIT_FIX && eVWhich == SC_SPLIT_TOP )
- {
- ScSplitPos eBottom = ( eHWhich == SC_SPLIT_LEFT ) ?
- SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
- pBottom = pViewData->GetView()->GetWindowByPos(eBottom);
- }
- if ( pRight && pBottom )
- pDiagonal = pViewData->GetView()->GetWindowByPos(SC_SPLIT_BOTTOMRIGHT);
-
- pNoteMarker = new ScNoteMarker( this, pRight, pBottom, pDiagonal,
+ bool bHSplit = pViewData->GetHSplitMode() != SC_SPLIT_NONE;
+ bool bVSplit = pViewData->GetVSplitMode() != SC_SPLIT_NONE;
+
+ Window* pLeft = pViewData->GetView()->GetWindowByPos( bVSplit ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT );
+ Window* pRight = bHSplit ? pViewData->GetView()->GetWindowByPos( bVSplit ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT ) : 0;
+ Window* pBottom = bVSplit ? pViewData->GetView()->GetWindowByPos( SC_SPLIT_BOTTOMLEFT ) : 0;
+ Window* pDiagonal = (bHSplit && bVSplit) ? pViewData->GetView()->GetWindowByPos( SC_SPLIT_BOTTOMRIGHT ) : 0;
+ DBG_ASSERT( pLeft, "ScGridWindow::ShowNoteMarker - missing top-left grid window" );
+
+ /* If caption is shown from right or bottom windows, adjust
+ mapmode to include size of top-left window. */
+ MapMode aMapMode = GetDrawMapMode( TRUE );
+ Size aLeftSize = pLeft->PixelToLogic( pLeft->GetOutputSizePixel(), aMapMode );
+ Point aOrigin = aMapMode.GetOrigin();
+ if( (this == pRight) || (this == pDiagonal) )
+ aOrigin.X() += aLeftSize.Width();
+ if( (this == pBottom) || (this == pDiagonal) )
+ aOrigin.Y() += aLeftSize.Height();
+ aMapMode.SetOrigin( aOrigin );
+
+ pNoteMarker = new ScNoteMarker( pLeft, pRight, pBottom, pDiagonal,
pDoc, aCellPos, aTrackText,
- GetDrawMapMode(TRUE), bLeftEdge, bFast, bKeyboard );
+ aMapMode, bLeftEdge, bFast, bKeyboard );
}
bDone = TRUE; // something is shown (old or new)
diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx
index ac94459500d7..2c50a8eb0a81 100644
--- a/sc/source/ui/view/notemark.cxx
+++ b/sc/source/ui/view/notemark.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: notemark.cxx,v $
- * $Revision: 1.13 $
+ * $Revision: 1.12.126.5 $
*
* This file is part of OpenOffice.org.
*
@@ -31,13 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-// INCLUDE ---------------------------------------------------------------
-
#include <svx/svdoutl.hxx>
#include <svx/svdmodel.hxx>
-#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdocapt.hxx>
#include <sfx2/printer.hxx>
#include <svtools/pathoptions.hxx>
#include <svtools/itempool.hxx>
@@ -45,13 +42,11 @@
#include "notemark.hxx"
#include "document.hxx"
-#include "detfunc.hxx"
+#include "postit.hxx"
#define SC_NOTEMARK_TIME 800
#define SC_NOTEMARK_SHORT 70
-// STATIC DATA -----------------------------------------------------------
-
// -----------------------------------------------------------------------
ScNoteMarker::ScNoteMarker( Window* pWin, Window* pRight, Window* pBottom, Window* pDiagonal,
@@ -71,6 +66,14 @@ ScNoteMarker::ScNoteMarker( Window* pWin, Window* pRight, Window* pBottom, Windo
pObject( NULL ),
bVisible( FALSE )
{
+ Size aSizePixel = pWindow->GetOutputSizePixel();
+ if( pRightWin )
+ aSizePixel.Width() += pRightWin->GetOutputSizePixel().Width();
+ if( pBottomWin )
+ aSizePixel.Height() += pBottomWin->GetOutputSizePixel().Height();
+ Rectangle aVisPixel( Point( 0, 0 ), aSizePixel );
+ aVisRect = pWindow->PixelToLogic( aVisPixel, aMapMode );
+
aTimer.SetTimeoutHdl( LINK( this, ScNoteMarker, TimeHdl ) );
aTimer.SetTimeout( bForce ? SC_NOTEMARK_SHORT : SC_NOTEMARK_TIME );
aTimer.Start();
@@ -104,24 +107,16 @@ IMPL_LINK( ScNoteMarker, TimeHdl, Timer*, EMPTYARG )
rOutliner.SetRefDevice(pPrinter);
}
- SdrPage* pPage = pModel->AllocPage(FALSE);
-
- Size aSizePixel = pWindow->GetOutputSizePixel();
- Rectangle aVisPixel( Point(0,0), aSizePixel );
- Rectangle aVisible = pWindow->PixelToLogic( aVisPixel, aMapMode );
-
- SCCOL nCol = aDocPos.Col();
- SCROW nRow = aDocPos.Row();
- SCTAB nTab = aDocPos.Tab();
- pObject = ScDetectiveFunc( pDoc,nTab ).
- ShowCommentUser( nCol, nRow, aUserText, aVisible, bLeft, FALSE, pPage );
-
- if (pObject)
- aRect = pObject->GetCurrentBoundRect();
+ if( SdrPage* pPage = pModel->AllocPage( FALSE ) )
+ {
+ pObject = ScNoteUtil::CreateTempCaption( *pDoc, aDocPos, *pPage, aUserText, aVisRect, bLeft );
+ if( pObject )
+ aRect = pObject->GetCurrentBoundRect();
- // #39351# Page einfuegen damit das Model sie kennt und auch deleted
- pModel->InsertPage( pPage );
+ // #39351# Page einfuegen damit das Model sie kennt und auch deleted
+ pModel->InsertPage( pPage );
+ }
bVisible = TRUE;
}
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index cca56901dfa5..b600600acb6b 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: output.cxx,v $
- * $Revision: 1.36 $
+ * $Revision: 1.35.100.3 $
*
* This file is part of OpenOffice.org.
*
@@ -2196,7 +2196,7 @@ void ScOutputData::DrawNoteMarks()
// use origin's pCell for NotePtr test below
}
- if ( pCell && pCell->GetNotePtr() && ( bIsMerged ||
+ if ( pCell && pCell->HasNote() && ( bIsMerged ||
( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
{
if (bFirst)
@@ -2274,7 +2274,7 @@ void ScOutputData::AddPDFNotes()
// use origin's pCell for NotePtr test below
}
- if ( pCell && pCell->GetNotePtr() && ( bIsMerged ||
+ if ( pCell && pCell->HasNote() && ( bIsMerged ||
( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
{
long nNoteWidth = (long)( SC_CLIPMARK_SIZE * nPPTX );
@@ -2294,7 +2294,7 @@ void ScOutputData::AddPDFNotes()
if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrW ) )
{
Rectangle aNoteRect( nMarkX, nPosY, nMarkX+nNoteWidth*nLayoutSign, nPosY+nNoteHeight );
- const ScPostIt* pNote = pCell->GetNotePtr();
+ const ScPostIt* pNote = pCell->GetNote();
// Note title is the cell address (as on printed note pages)
String aTitle;
@@ -2303,7 +2303,6 @@ void ScOutputData::AddPDFNotes()
// Content has to be a simple string without line breaks
String aContent = pNote->GetText();
- aContent.ConvertLineEnd(LINEEND_LF);
xub_StrLen nPos;
while ( (nPos=aContent.Search('\n')) != STRING_NOTFOUND )
aContent.SetChar( nPos, ' ' );
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index aaa6ebc2e256..4324b610dd0b 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: printfun.cxx,v $
- * $Revision: 1.59 $
+ * $Revision: 1.58.50.2 $
*
* This file is part of OpenOffice.org.
*
@@ -1964,8 +1964,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, BOOL bDoPrint, ScPreviewLocationData
if (pPos)
{
ScBaseCell* pCell = pDoc->GetCell( *pPos);
- const ScPostIt* pNote = pCell->GetNotePtr();
- if (pNote)
+ if( const ScPostIt* pNote = pCell->GetNote() )
{
if(const EditTextObject *pEditText = pNote->GetEditTextObject())
pEditEngine->SetText(*pEditText);
@@ -2600,7 +2599,7 @@ long ScPrintFunc::CountNotePages()
ScBaseCell* pCell = aIter.GetNext( nCol, nRow );
while (pCell)
{
- if (pCell->GetNotePtr())
+ if (pCell->HasNote())
{
aNotePosList.Insert( new ScAddress( nCol,nRow,nPrintTab ), LIST_APPEND );
++nCount;
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 2fa505ecd898..40b9ff5dbea7 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: spelleng.cxx,v $
- * $Revision: 1.18 $
+ * $Revision: 1.18.128.2 $
*
* This file is part of OpenOffice.org.
*
@@ -132,14 +132,14 @@ bool ScConversionEngineBase::FindNextConversionCell()
(bMultiTab && rMark.GetTableSelect( nTab ) &&
lclHasString( mrDoc, mnCurrCol, mnCurrRow, nTab, aVisibleStr )) )
{
- CellType eCellType;
- mrDoc.GetCellType( mnCurrCol, mnCurrRow, nTab, eCellType );
- mrDoc.GetCell( mnCurrCol, mnCurrRow, nTab, pCell );
+ ScAddress aPos( mnCurrCol, mnCurrRow, nTab );
+ CellType eCellType = mrDoc.GetCellType( aPos );
+ pCell = mrDoc.GetCell( aPos );
if( mpUndoDoc && pCell )
{
- ScBaseCell* pUndoCell = pCell->Clone( mpUndoDoc );
- mpUndoDoc->PutCell( mnCurrCol, mnCurrRow, nTab, pUndoCell );
+ ScBaseCell* pUndoCell = pCell->CloneWithoutNote( *mpUndoDoc );
+ mpUndoDoc->PutCell( aPos, pUndoCell );
}
if( eCellType == CELLTYPE_EDIT )
@@ -154,13 +154,13 @@ bool ScConversionEngineBase::FindNextConversionCell()
else
{
mrDoc.SetString( mnCurrCol, mnCurrRow, nTab, aNewStr );
- mrDoc.GetCell( mnCurrCol, mnCurrRow, nTab, pCell );
+ pCell = mrDoc.GetCell( aPos );
}
if( mpRedoDoc && pCell )
{
- ScBaseCell* pRedoCell = pCell->Clone( mpRedoDoc );
- mpRedoDoc->PutCell( mnCurrCol, mnCurrRow, nTab, pRedoCell );
+ ScBaseCell* pRedoCell = pCell->CloneWithoutNote( *mpRedoDoc );
+ mpRedoDoc->PutCell( aPos, pRedoCell );
}
mrDocShell.PostPaintCell( mnCurrCol, mnCurrRow, nTab );
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index d37d9fa3e2dc..12b9115a03cb 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -365,11 +365,7 @@ void ScTabControl::ActivateView(BOOL bActivate)
void ScTabControl::SetSheetLayoutRTL( BOOL bSheetRTL )
{
- /* #106948# mirror the tabbar control, if sheet RTL mode differs from UI RTL mode
- - In LTR Office the tabbar is mirrored for RTL sheets.
- - In RTL Office the tabbar is mirrored anyway, mirror it again for LTR sheets. */
- SetMirrored( bSheetRTL != GetSettings().GetLayoutRTL() );
- // forget last selected sheet also if not mirrored (Mirror() is not called then)
+ SetEffectiveRTL( bSheetRTL );
nSelPageIdByMouse = TAB_PAGE_NOTFOUND;
}
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 8154da744ce4..c51c81c36dd8 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1004,7 +1004,7 @@ IMPL_LINK( ScTabView, TabBarResize, void*, EMPTYARG )
if (aViewData.GetHSplitMode() != SC_SPLIT_FIX)
{
long nMax = pHSplitter->GetPosPixel().X();
- if( pTabControl->IsMirrored() != Application::GetSettings().GetLayoutRTL() )
+ if( pTabControl->IsEffectiveRTL() )
nMax = pFrameWin->GetSizePixel().Width() - nMax;
--nMax;
if (nSize>nMax) nSize = nMax;
@@ -1230,9 +1230,9 @@ IMPL_LINK( ScTabView, EndScrollHdl, ScrollBar*, pScroll )
if ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight )
{
- BOOL bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ BOOL bMirror = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ) != Application::GetSettings().GetLayoutRTL();
ScHSplitPos eWhich = (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
- long nDelta = GetScrollBarPos( *pScroll, bLayoutRTL ) + nScrollMin - aViewData.GetPosX(eWhich);
+ long nDelta = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin - aViewData.GetPosX(eWhich);
if (nDelta) ScrollX( nDelta, eWhich );
}
else // VScroll...
@@ -1260,7 +1260,8 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
nViewPos = aViewData.GetPosY( (pScroll == &aVScrollTop) ?
SC_SPLIT_TOP : SC_SPLIT_BOTTOM );
- BOOL bLayoutRTL = bHoriz && aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ BOOL bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ BOOL bMirror = bHoriz && (bLayoutRTL != Application::GetSettings().GetLayoutRTL());
ScrollType eType = pScroll->GetType();
if ( eType == SCROLL_DRAG )
@@ -1276,17 +1277,31 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
if (Help::IsQuickHelpEnabled())
{
- Point aMousePos = pScroll->OutputToNormalizedScreenPixel(pScroll->GetPointerPosPixel());
+ Size aSize = pScroll->GetSizePixel();
+
+ /* Convert scrollbar mouse position to screen position. If RTL
+ mode of scrollbar differs from RTL mode of its parent, then the
+ direct call to Window::OutputToNormalizedScreenPixel() will
+ give unusable results, because calcualtion of screen position
+ is based on parent orientation and expects equal orientation of
+ the child position. Need to mirror mouse position before. */
+ Point aMousePos = pScroll->GetPointerPosPixel();
+ if( pScroll->IsRTLEnabled() != pScroll->GetParent()->IsRTLEnabled() )
+ aMousePos.X() = aSize.Width() - aMousePos.X() - 1;
+ aMousePos = pScroll->OutputToNormalizedScreenPixel( aMousePos );
+
+ // convert top-left position of scrollbar to screen position
+ Point aPos = pScroll->OutputToNormalizedScreenPixel( Point() );
+
+ // get scrollbar scroll position for help text (row number/column name)
long nScrollMin = 0; // RangeMin simulieren
if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
nScrollMin = aViewData.GetFixPosX();
if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
nScrollMin = aViewData.GetFixPosY();
+ long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin;
String aHelpStr;
- long nScrollPos = GetScrollBarPos( *pScroll, bLayoutRTL ) + nScrollMin;
- Point aPos = pScroll->GetParent()->OutputToNormalizedScreenPixel(pScroll->GetPosPixel());
- Size aSize = pScroll->GetSizePixel();
Rectangle aRect;
USHORT nAlign;
if (bHoriz)
@@ -1305,9 +1320,10 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
aHelpStr += ' ';
aHelpStr += String::CreateFromInt32(nScrollPos + 1);
- aRect.Left() = aPos.X() - 8;
+ // show quicktext always inside sheet area
+ aRect.Left() = bLayoutRTL ? (aPos.X() + aSize.Width() + 8) : (aPos.X() - 8);
aRect.Top() = aMousePos.Y();
- nAlign = QUICKHELP_RIGHT|QUICKHELP_VCENTER;
+ nAlign = (bLayoutRTL ? QUICKHELP_LEFT : QUICKHELP_RIGHT) | QUICKHELP_VCENTER;
}
aRect.Right() = aRect.Left();
aRect.Bottom() = aRect.Top();
@@ -1318,7 +1334,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
if ( bOnlineScroll || eType != SCROLL_DRAG )
{
- if ( bLayoutRTL )
+ if ( bMirror )
{
// change scroll type so visible/previous cells calculation below remains the same
switch ( eType )
@@ -1367,7 +1383,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
nScrollMin = aViewData.GetFixPosY();
- long nScrollPos = GetScrollBarPos( *pScroll, bLayoutRTL ) + nScrollMin;
+ long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin;
nDelta = nScrollPos - nViewPos;
if ( nScrollPos > nPrevDragPos )
{
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index bd9b154f10b8..076a23c5e524 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -38,6 +38,7 @@
// INCLUDE ---------------------------------------------------------------
#include <vcl/help.hxx>
+#include <vcl/svapp.hxx>
#include "tabview.hxx"
#include "document.hxx"
@@ -413,7 +414,7 @@ void ScTabView::UpdateScrollBars()
BOOL bRight = ( aViewData.GetHSplitMode() != SC_SPLIT_NONE );
ScDocument* pDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
- BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ BOOL bMirror = pDoc->IsLayoutRTL( nTab ) != Application::GetSettings().GetLayoutRTL();
SCCOL nUsedX;
SCROW nUsedY;
pDoc->GetTableArea( nTab, nUsedX, nUsedY ); //! cachen !!!!!!!!!!!!!!!
@@ -432,7 +433,7 @@ void ScTabView::UpdateScrollBars()
nVisXL = aViewData.VisibleCellsX( SC_SPLIT_LEFT );
long nMaxXL = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_LEFT), nVisXL, MAXCOL, 0 );
- SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bLayoutRTL );
+ SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bMirror );
nVisYB = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM );
long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, MAXROW, nStartY );
@@ -442,7 +443,7 @@ void ScTabView::UpdateScrollBars()
{
nVisXR = aViewData.VisibleCellsX( SC_SPLIT_RIGHT );
long nMaxXR = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_RIGHT), nVisXR, MAXCOL, nStartX );
- SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bLayoutRTL );
+ SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bMirror );
}
if (bTop)
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 03f5892427a5..c27524c83542 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -77,8 +77,10 @@ using namespace com::sun::star;
void __EXPORT ScTabView::Init()
{
- // RTL layout of the view windows is done manually, because it depends on the
- // sheet orientation, not the UI setting
+ /* RTL layout of the view windows is done manually, because it depends on
+ the sheet orientation, not the UI setting. Note: controls that are
+ already constructed (e.g. scroll bars) have the RTL setting of the GUI.
+ Eventually this has to be disabled manually (see below). */
pFrameWin->EnableRTL( FALSE );
USHORT i;
@@ -113,28 +115,18 @@ void __EXPORT ScTabView::Init()
pVSplitter->SetKeyboardStepSize( 1 );
pTabControl = new ScTabControl( pFrameWin, &aViewData );
- //MI: nie! das war mal eine MUSS-Aenderung von MBA
- //if (!aViewData.IsBasicView())
- // pTabControl->ToTop(); // ueber dem Splitter
+ /* #i97900# The tab control has to remain in RTL mode if GUI is RTL, this
+ is needed to draw the 3D effect correctly. The base TabBar implementes
+ mirroring independent from the GUI direction. Have to set RTL mode
+ explicitly because the parent frame window is already RTL disabled. */
+ pTabControl->EnableRTL( Application::GetSettings().GetLayoutRTL() );
InitScrollBar( aHScrollLeft, MAXCOL+1 );
InitScrollBar( aHScrollRight, MAXCOL+1 );
InitScrollBar( aVScrollTop, MAXROW+1 );
InitScrollBar( aVScrollBottom, MAXROW+1 );
-
- // SSA: --- RTL --- no mirroring for horizontal scrollbars, otherwise
- // scroll direction will be wrong
- aHScrollLeft.EnableRTL ( FALSE );
- aHScrollRight.EnableRTL ( FALSE );
-
- // Mirroring is disabled for all scrollbars, completely handled manually.
- // The other windows in the view call EnableRTL in their ctors.
- aVScrollTop.EnableRTL( FALSE );
- aVScrollBottom.EnableRTL( FALSE );
- aScrollBarBox.EnableRTL( FALSE );
-
- // Tabbar initially left-to-right, done via SetMirrored(), not via EnableRTL()
- pTabControl->SetMirrored( Application::GetSettings().GetLayoutRTL() );
+ /* #i97900# scrollbars remain in correct RTL mode, needed mirroring etc.
+ is now handled correctly at the respective places. */
// Hier noch nichts anzeigen (Show), weil noch falsch angeordnet ist
// Show kommt dann aus UpdateShow beim ersten Resize
diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index f84031af23ec..db6ee302a792 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: tabvwsh2.cxx,v $
- * $Revision: 1.27.32.2 $
+ * $Revision: 1.27.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -106,7 +106,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
SfxBindings& rBindings = GetViewFrame()->GetBindings();
Window* pWin = pTabView->GetActiveWin();
- SdrView* pView = pTabView->GetSdrView();
+ ScDrawView* pView = pTabView->GetScDrawView();
SdrModel* pDoc = pView->GetModel();
const SfxItemSet *pArgs = rReq.GetArgs();
@@ -226,9 +226,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
SetDrawSelMode(bEx);
- SdrLayer* pLayer = pView->GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK);
- if (pLayer)
- pView->SetLayerLocked( pLayer->GetName(), !bEx );
+ pView->LockBackgroundLayer( !bEx );
if ( bSelectFirst )
{
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 778088ed2c47..f2bc65a66ba8 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: tabvwshb.cxx,v $
- * $Revision: 1.39 $
+ * $Revision: 1.39.128.1 $
*
* This file is part of OpenOffice.org.
*
@@ -288,7 +288,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
SfxBindings& rBindings = GetViewFrame()->GetBindings();
ScTabView* pTabView = GetViewData()->GetView();
Window* pWin = pTabView->GetActiveWin();
- SdrView* pView = pTabView->GetSdrView();
+ ScDrawView* pView = pTabView->GetScDrawView();
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDocument* pDoc = pDocSh->GetDocument();
// SdrModel* pDrModel = pDocSh->MakeDrawLayer();
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 814cc95fa189..a7b2f634bd6c 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewfun2.cxx,v $
- * $Revision: 1.40.20.3 $
+ * $Revision: 1.41.100.2 $
*
* This file is part of OpenOffice.org.
*
@@ -1125,12 +1125,10 @@ BOOL ScViewFunc::MergeCells( BOOL bApi, BOOL& rDoContents, BOOL bRecord )
}
BOOL bOk = TRUE;
- BOOL bNeedContents = FALSE;
- if ( !pDoc->IsBlockEmpty( nStartTab, nStartCol,nStartRow+1, nStartCol,nEndRow ) ||
- !pDoc->IsBlockEmpty( nStartTab, nStartCol+1,nStartRow, nEndCol,nEndRow ) )
+ if ( !pDoc->IsBlockEmpty( nStartTab, nStartCol,nStartRow+1, nStartCol,nEndRow, true ) ||
+ !pDoc->IsBlockEmpty( nStartTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ) )
{
- bNeedContents = TRUE;
if (!bApi)
{
MessBox aBox( GetViewData()->GetDialogParent(),
@@ -1919,7 +1917,7 @@ void ScViewFunc::Solve( const ScSolveParam& rParam )
USHORT nRetVal = aBox.Execute();
if ( RET_YES == nRetVal )
- EnterData( nDestCol, nDestRow, nDestTab, nSolveResult );
+ EnterValue( nDestCol, nDestRow, nDestTab, nSolveResult );
GetViewData()->GetViewShell()->UpdateInputHandler( TRUE );
}
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 3a06b3187b2b..0b43cfacbab3 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewfun3.cxx,v $
- * $Revision: 1.41 $
+ * $Revision: 1.41.126.3 $
*
* This file is part of OpenOffice.org.
*
@@ -265,7 +265,7 @@ void ScViewFunc::CutToClip( ScDocument* pClipDoc, BOOL bIncludeObjects )
ScRange aCopyRange = aRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(pDoc->GetTableCount()-1);
- pDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aCopyRange, (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS, FALSE, pUndoDoc );
pDoc->BeginDrawUndo();
}
@@ -758,11 +758,14 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
USHORT nUndoFlags = nContFlags;
if (nUndoExtraFlags & IDF_ATTRIB)
nUndoFlags |= IDF_ATTRIB;
+ // do not copy note captions into undo document
+ nUndoFlags |= IDF_NOCAPTIONS;
BOOL bCutMode = pClipDoc->IsCutMode(); // if transposing, take from original clipdoc
BOOL bIncludeFiltered = bCutMode;
- BOOL bPasteDraw = ( pClipDoc->GetDrawLayer() && ( nFlags & IDF_OBJECTS ) );
+ // paste drawing: also if IDF_NOTE is set (to create drawing layer for note captions)
+ BOOL bPasteDraw = ( pClipDoc->GetDrawLayer() && ( nFlags & (IDF_OBJECTS|IDF_NOTE) ) );
ScDocShellRef aTransShellRef; // for objects in xTransClip - must remain valid as long as xTransClip
ScDocument* pOrigClipDoc = NULL;
@@ -1125,6 +1128,15 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
}
+ /* Make draw layer and start drawing undo.
+ - Needed before AdjustBlockHeight to track moved drawing objects.
+ - Needed before pDoc->CopyFromClip to track inserted note caption objects.
+ */
+ if ( bPasteDraw )
+ pDocSh->MakeDrawLayer();
+ if ( bRecord )
+ pDoc->BeginDrawUndo();
+
USHORT nNoObjFlags = nFlags & ~IDF_OBJECTS;
if (!bAsLink)
{
@@ -1162,14 +1174,9 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
delete pMixDoc;
- if ( bPasteDraw )
- pDocSh->MakeDrawLayer(); // before AdjustBlockHeight, so BeginDrawUndo can be called
-
- if ( bRecord )
- pDoc->BeginDrawUndo();
AdjustBlockHeight(); // update row heights before pasting objects
- if ( bPasteDraw )
+ if ( nFlags & IDF_OBJECTS )
{
// Paste the drawing objects after the row heights have been updated.
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index 2da5e8fc1698..cb9d4eb0da72 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewfun6.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.128.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,69 +31,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-//------------------------------------------------------------------
-
-#ifdef WIN
-#define _MENUBTN_HXX
-#endif
-
-//#define _SFX_DOCFILT_HXX
-#define _SFX_PRNMON_HXX
-#define _SFX_RESMGR_HXX
-#define _SFX_TEMPLDLG_HXX
-#define _SFXAPPWIN_HXX
-#define _SFXBASIC_HXX
-#define _SFXCTRLITEM
-#define _SFXDLGCFG_HXX
-//#define _SFXDISPATCH_HXX
-#define _SFXDOCFILE_HXX
-#define _SFXDOCMAN_HXX
-#define _SFXDOCMGR_HXX
-#define _SFXDOCTDLG_HXX
-#define _SFXFILEDLG_HXX
-#define _SFXIMGMGR_HXX
-#define _SFXIPFRM_HXX
-#define _SFX_MACRO_HXX
-#define _SFXMNUITEM_HXX
-#define _SFXMNUMGR_HXX
-#define _SFXMULTISEL_HXX
-#define _SFXMSG_HXX
-#define _SFXMSGDESCR_HXX
-#define _SFXMSGPOOL_HXX
-#define _SFX_MINFITEM_HXX
-#define _SFXOBJFACE_HXX
-#define _SFXOBJFAC_HXX
-#define _SFX_SAVEOPT_HXX
-#define _SFXSTBITEM_HXX
-#define _SFXSTBMGR_HXX
-#define _SFXTBXCTRL_HXX
-#define _SFXTBXMGR_HXX
-
-#define _SI_DLL_HXX
-#define _SIDLL_HXX
-#define _SI_NOITEMS
-#define _SI_NOOTHERFORMS
-#define _SI_NOSBXCONTROLS
-#define _SINOSBXCONTROLS
-#define _SI_NOCONTROL
-#define _VCBRW_HXX
-#define _VCTRLS_HXX
-//#define _VCSBX_HXX
-#define _VCONT_HXX
-#define _VDRWOBJ_HXX
-#define _VCATTR_HXX
-#define _VCONT_HXX
-
-#define _SDR_NOTRANSFORM
-#define _SDR_NOITEMS
-#define _SDR_NOOBJECTS
-#define _SVDXOUT_HXX
-
-//------------------------------------------------------------------
-
#include <svx/svdundo.hxx>
+#include <svx/svdocapt.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <vcl/msgbox.hxx>
@@ -112,9 +51,6 @@
#include "sc.hrc"
#include "fusel.hxx"
-
-// STATIC DATA -----------------------------------------------------------
-
//==================================================================
void ScViewFunc::DetectiveAddPred()
@@ -206,105 +142,14 @@ void ScViewFunc::DetectiveRefresh()
//---------------------------------------------------------------------------
-void ScViewFunc::ShowNote()
+void ScViewFunc::ShowNote( bool bShow )
{
- // permanent einblenden
-
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
- SCCOL nCol = GetViewData()->GetCurX();
- SCROW nRow = GetViewData()->GetCurY();
- SCTAB nTab = GetViewData()->GetTabNo();
- BOOL bUndo (pDoc->IsUndoEnabled());
-
- ScPostIt aNote(pDoc);
- if ( pDoc->GetNote( nCol, nRow, nTab, aNote ) &&
- !pDoc->HasNoteObject( nCol, nRow, nTab ) )
- {
+ if( bShow )
HideNoteMarker();
-
- pDocSh->MakeDrawLayer();
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
-
- pModel->BeginCalcUndo();
- SdrObject* pObject = ScDetectiveFunc( pDoc,nTab ).ShowComment( nCol, nRow, FALSE );
- SdrUndoGroup* pUndo = NULL;
- if (bUndo)
- pUndo = pModel->GetCalcUndo();
- if (pObject)
- {
- aNote.SetShown( TRUE );
- pDoc->SetNote( nCol, nRow, nTab, aNote );
- // This repaint should not be neccessary.
- // But it solves a problem where following an
- // insertion of more note text, the note sometimes
- // displays the height to the previous note position.
- // A similar problem is also in ScUndoEditNote::Undo().
- ScRange aDrawRange(pDoc->GetRange(nTab, aNote.GetRectangle()));
- pDocSh->PostPaint( aDrawRange, PAINT_GRID| PAINT_EXTRAS);
- if (pUndo)
- pDocSh->GetUndoManager()->AddUndoAction( new ScUndoNote( pDocSh,
- TRUE, ScAddress(nCol,nRow,nTab), pUndo ) );
-
-
-
- pDocSh->SetDocumentModified();
- }
- else
- {
- delete pUndo;
- Sound::Beep();
- }
- }
-}
-
-void ScViewFunc::HideNote()
-{
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
- if (!pModel)
- return; // da is nix
- BOOL bUndo (pDoc->IsUndoEnabled());
-
- SCCOL nCol = GetViewData()->GetCurX();
- SCROW nRow = GetViewData()->GetCurY();
- SCTAB nTab = GetViewData()->GetTabNo();
-
- ScPostIt aNote(pDoc);
- if ( pDoc->GetNote( nCol, nRow, nTab, aNote ) &&
- pDoc->HasNoteObject( nCol, nRow, nTab ) )
- {
- pModel->BeginCalcUndo();
- BOOL bDone = ScDetectiveFunc( pDoc,nTab ).HideComment( nCol, nRow );
- SdrUndoGroup* pUndo = NULL;
- if (bUndo)
- pUndo = pModel->GetCalcUndo();
- if (bDone)
- {
- aNote.SetShown( FALSE );
- pDoc->SetNote( nCol, nRow, nTab, aNote );
- // This repaint should not be neccessary.
- // But it solves a problem where following an
- // insertion of more note text, the note sometimes
- // continues to displays the additional height to
- // the previous note height position - despite the fact
- // that we have chosen to hide the note.
- // A similar problem is also in ScUndoEditNote::Undo().
- ScRange aDrawRange(pDoc->GetRange(nTab, aNote.GetRectangle()));
- pDocSh->PostPaint( aDrawRange, PAINT_GRID| PAINT_EXTRAS);
- if (pUndo)
- pDocSh->GetUndoManager()->AddUndoAction( new ScUndoNote( pDocSh,
- FALSE, ScAddress(nCol,nRow,nTab), pUndo ) );
-
- pDocSh->SetDocumentModified();
- }
- else
- {
- delete pUndo;
- Sound::Beep();
- }
- }
+ const ScViewData& rViewData = *GetViewData();
+ ScAddress aPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
+ // show note moved to ScDocFunc, to be able to use it in notesuno.cxx
+ rViewData.GetDocShell()->GetDocFunc().ShowNote( aPos, bShow );
}
void ScViewFunc::EditNote()
@@ -316,46 +161,38 @@ void ScViewFunc::EditNote()
SCCOL nCol = GetViewData()->GetCurX();
SCROW nRow = GetViewData()->GetCurY();
SCTAB nTab = GetViewData()->GetTabNo();
+ ScAddress aPos( nCol, nRow, nTab );
- ScPostIt aNote(pDoc);
- BOOL bFound = pDoc->GetNote( nCol, nRow, nTab, aNote );
- if ( !bFound || !pDoc->HasNoteObject( nCol, nRow, nTab ) ) // neu oder versteckt
+ // start drawing undo to catch undo action for insertion of the caption object
+ pDocSh->MakeDrawLayer();
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ pDrawLayer->BeginCalcUndo();
+ // generated undo action is processed in FuText::StopEditMode
+
+ // get existing note or create a new note (including caption drawing object)
+ if( ScPostIt* pNote = pDoc->GetOrCreateNote( aPos ) )
{
+ // hide temporary note caption
HideNoteMarker();
+ // show caption object without changing internal visibility state
+ pNote->ShowCaptionTemp();
- pDocSh->MakeDrawLayer();
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
-
- pModel->BeginCalcUndo();
- // TRUE -> auch neu anlegen
- SdrObject* pObject = ScDetectiveFunc( pDoc,nTab ).ShowComment( nCol, nRow, TRUE );
-
- // Undo-Action (pModel->GetCalcUndo) wird beim StopEditMode abgeholt
-
- if (pObject)
+ // drawing object has been created in ScDocument::GetOrCreateNote
+ if( SdrCaptionObj* pCaption = pNote->GetCaption() )
{
- FuPoor* pDraw = GetDrawFuncPtr();
- if ( pDraw )
- {
- FuSelection* pSel = static_cast<FuSelection*>(pDraw);
- // #i33764# Enable the resize handles before editing.
- pSel->ActivateNoteHandles(pObject);
- }
- // Shown-Flag nicht veraendern
+ // #i33764# enable the resize handles before starting edit mode
+ if( FuPoor* pDraw = GetDrawFuncPtr() )
+ static_cast< FuSelection* >( pDraw )->ActivateNoteHandles( pCaption );
- // Objekt aktivieren (wie in FuSelection::TestComment)
- GetViewData()->GetDispatcher().Execute(SID_DRAW_NOTEEDIT, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
+ // activate object (as in FuSelection::TestComment)
+ GetViewData()->GetDispatcher().Execute( SID_DRAW_NOTEEDIT, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
// jetzt den erzeugten FuText holen und in den EditModus setzen
FuPoor* pPoor = GetDrawFuncPtr();
- if ( pPoor && pPoor->GetSlotID() == SID_DRAW_NOTEEDIT ) // hat keine RTTI
+ if ( pPoor && (pPoor->GetSlotID() == SID_DRAW_NOTEEDIT) ) // hat keine RTTI
{
- ScrollToObject( pObject ); // Objekt komplett sichtbar machen
- FuText* pText = (FuText*)pPoor;
- pText->SetInEditMode( pObject );
+ ScrollToObject( pCaption ); // Objekt komplett sichtbar machen
+ static_cast< FuText* >( pPoor )->SetInEditMode( pCaption );
}
}
}
}
-
-
-
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 72af71cf1b09..41682a0c5211 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewfunc.cxx,v $
- * $Revision: 1.44.22.2 $
+ * $Revision: 1.46.18.4 $
*
* This file is part of OpenOffice.org.
*
@@ -388,7 +388,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rS
pDoc->GetCell( nCol, nRow, i, pDocCell );
if ( pDocCell )
{
- ppOldCells[nUndoPos] = pDocCell->Clone(pDoc);
+ ppOldCells[nUndoPos] = pDocCell->CloneWithoutNote( *pDoc );
if ( pDocCell->GetCellType() == CELLTYPE_EDIT )
bEditDeleted = TRUE;
@@ -599,7 +599,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rS
}
else
{
- ScFormulaCell* pCell = new ScFormulaCell( pDoc, aPos, aCell );
+ ScFormulaCell* pCell = new ScFormulaCell( aCell, *pDoc, aPos );
if ( nError )
{
pCell->GetCode()->DelRPN();
@@ -683,9 +683,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rS
}
// Wert in einzele Zelle eintragen (nur auf nTab)
-//! umbenennen in EnterValue !!!!
-void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue )
+void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue )
{
ScDocument* pDoc = GetViewData()->GetDocument();
ScDocShell* pDocSh = GetViewData()->GetDocShell();
@@ -698,18 +697,14 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rV
ScEditableTester aTester( pDoc, nTab, nCol,nRow, nCol,nRow );
if (aTester.IsEditable())
{
- ScBaseCell* pOldCell;
- pDoc->GetCell( nCol, nRow, nTab, pOldCell );
+ ScAddress aPos( nCol, nRow, nTab );
+ ScBaseCell* pOldCell = pDoc->GetCell( aPos );
BOOL bNeedHeight = ( pOldCell && pOldCell->GetCellType() == CELLTYPE_EDIT )
|| pDoc->HasAttrib(
nCol,nRow,nTab, nCol,nRow,nTab, HASATTR_NEEDHEIGHT );
// Undo
- ScBaseCell* pUndoCell = NULL;
- if (bUndo)
- {
- pUndoCell = pOldCell ? pOldCell->Clone(pDoc) : NULL;
- }
+ ScBaseCell* pUndoCell = (bUndo && pOldCell) ? pOldCell->CloneWithoutNote( *pDoc ) : 0;
pDoc->SetValue( nCol, nRow, nTab, rValue );
@@ -717,8 +712,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rV
if (bUndo)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoEnterValue( pDocSh, ScAddress(nCol,nRow,nTab),
- pUndoCell, rValue, bNeedHeight ) );
+ new ScUndoEnterValue( pDocSh, aPos, pUndoCell, rValue, bNeedHeight ) );
}
/*! Zeilenhoehe anpassen? Dann auch bei Undo...
@@ -726,7 +720,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rV
AdjustRowHeight(nRow,nRow);
*/
- pDocSh->PostPaintCell( nCol, nRow, nTab );
+ pDocSh->PostPaintCell( aPos );
pDocSh->UpdateOle(GetViewData());
aModificator.SetDocumentModified();
}
@@ -811,10 +805,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextOb
pTabs[nPos] = i;
ScBaseCell* pDocCell;
pDoc->GetCell( nCol, nRow, i, pDocCell );
- if ( pDocCell )
- ppOldCells[nPos] = pDocCell->Clone( pDoc );
- else
- ppOldCells[nPos] = NULL;
+ ppOldCells[nPos] = pDocCell ? pDocCell->CloneWithoutNote( *pDoc ) : 0;
++nPos;
}
@@ -2054,6 +2045,8 @@ void ScViewFunc::DeleteContents( USHORT nFlags, BOOL bRecord )
nUndoDocFlags |= IDF_STRING; // -> Zellen werden geaendert
if (nFlags & IDF_NOTE)
nUndoDocFlags |= IDF_CONTENTS; // #68795# copy all cells with their notes
+ // do not copy note captions to undo document
+ nUndoDocFlags |= IDF_NOCAPTIONS;
pDoc->CopyToDocument( aCopyRange, nUndoDocFlags, bMulti, pUndoDoc, &aFuncMark );
}
@@ -2065,7 +2058,7 @@ void ScViewFunc::DeleteContents( USHORT nFlags, BOOL bRecord )
else
{
pDoc->DeleteSelection( nFlags, aFuncMark );
- aFuncMark.MarkToSimple();
+// aFuncMark.MarkToSimple();
}
if ( bRecord )
@@ -2654,10 +2647,14 @@ BOOL ScViewFunc::Unprotect( SCTAB nTab, const String& rPassword )
return bChanged;
}
-void ScViewFunc::SetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPostIt& rNote )
+void ScViewFunc::SetNoteText( const ScAddress& rPos, const String& rNoteText )
{
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
- pDocSh->GetDocFunc().SetNote( ScAddress(nCol,nRow,nTab), rNote, FALSE );
+ GetViewData()->GetDocShell()->GetDocFunc().SetNoteText( rPos, rNoteText, FALSE );
+}
+
+void ScViewFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate )
+{
+ GetViewData()->GetDocShell()->GetDocFunc().ReplaceNote( rPos, rNoteText, pAuthor, pDate, FALSE );
}
void ScViewFunc::SetNumberFormat( short nFormatType, ULONG nAdd )