2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 00:47:54 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:47:54 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:47:54 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:47:54 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:47:54 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:47:54 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-07-21 14:26:39 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sc.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
// INCLUDE ---------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "scitems.hxx"
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
2007-05-10 16:04:32 +00:00
|
|
|
|
2006-05-02 14:54:05 +00:00
|
|
|
#include <sfx2/app.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svx/algitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/boxitem.hxx>
|
|
|
|
#include <editeng/editobj.hxx>
|
|
|
|
#include <editeng/editview.hxx>
|
|
|
|
#include <editeng/langitem.hxx>
|
|
|
|
#include <editeng/scripttypeitem.hxx>
|
2010-10-05 11:19:10 -04:00
|
|
|
#include <editeng/justifyitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <sfx2/bindings.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/zforlist.hxx>
|
|
|
|
#include <svl/zformat.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#include <vcl/sound.hxx>
|
|
|
|
#include <vcl/virdev.hxx>
|
|
|
|
#include <vcl/waitobj.hxx>
|
|
|
|
#include <vcl/wrkwin.hxx>
|
|
|
|
#include <stdlib.h> // qsort
|
|
|
|
|
|
|
|
#include "viewfunc.hxx"
|
|
|
|
#include "tabvwsh.hxx"
|
|
|
|
#include "docsh.hxx"
|
|
|
|
#include "attrib.hxx"
|
|
|
|
#include "patattr.hxx"
|
|
|
|
#include "docpool.hxx"
|
|
|
|
#include "uiitems.hxx"
|
|
|
|
#include "sc.hrc"
|
|
|
|
#include "undocell.hxx"
|
|
|
|
#include "undoblk.hxx"
|
|
|
|
#include "undotab.hxx"
|
|
|
|
#include "refundo.hxx"
|
|
|
|
#include "dbcolect.hxx"
|
|
|
|
#include "olinetab.hxx"
|
|
|
|
#include "rangeutl.hxx"
|
|
|
|
#include "rangenam.hxx"
|
|
|
|
#include "globstr.hrc"
|
|
|
|
#include "global.hxx"
|
|
|
|
#include "stlsheet.hxx"
|
|
|
|
#include "editutil.hxx"
|
|
|
|
#include "cell.hxx"
|
|
|
|
#include "scresid.hxx"
|
|
|
|
#include "inputhdl.hxx"
|
|
|
|
#include "scmod.hxx"
|
|
|
|
#include "inputopt.hxx"
|
|
|
|
#include "compiler.hxx"
|
|
|
|
#include "docfunc.hxx"
|
|
|
|
#include "appoptio.hxx"
|
2000-11-24 17:07:45 +00:00
|
|
|
#include "dociter.hxx"
|
2001-05-11 16:11:53 +00:00
|
|
|
#include "sizedev.hxx"
|
2002-11-20 13:36:29 +00:00
|
|
|
#include "editable.hxx"
|
2010-10-01 17:50:24 +13:00
|
|
|
#include "scui_def.hxx"
|
2008-03-07 10:23:12 +00:00
|
|
|
#include "funcdesc.hxx"
|
2009-02-17 09:19:30 +00:00
|
|
|
#include "docuno.hxx"
|
|
|
|
#include "cellsuno.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
//==================================================================
|
|
|
|
|
2011-01-06 15:35:57 +05:30
|
|
|
static void lcl_PostRepaintCondFormat( const ScConditionalFormat *pCondFmt, ScDocShell *pDocSh )
|
|
|
|
{
|
|
|
|
if( pCondFmt )
|
|
|
|
{
|
2011-05-04 15:29:53 -04:00
|
|
|
const ScRangeListRef& xRanges = pCondFmt->GetRangeInfo();
|
|
|
|
if (!xRanges)
|
|
|
|
return;
|
|
|
|
|
|
|
|
size_t nCount = xRanges->size();
|
2011-01-06 12:19:43 +00:00
|
|
|
for( size_t n = 0 ; n < nCount; n++ )
|
2011-05-04 15:29:53 -04:00
|
|
|
pDocSh->PostPaint( *((*xRanges)[n]), PAINT_ALL );
|
2011-01-06 15:35:57 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==================================================================
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ScViewFunc::ScViewFunc( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
|
|
|
|
ScTabView( pParent, rDocSh, pViewShell ),
|
2011-03-10 16:55:21 -05:00
|
|
|
bFormatValid( false )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScViewFunc::~ScViewFunc()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ScViewFunc::StartFormatArea()
|
|
|
|
{
|
|
|
|
// ueberhaupt aktiviert?
|
|
|
|
if ( !SC_MOD()->GetInputOptions().GetExtendFormat() )
|
|
|
|
return;
|
|
|
|
|
2003-03-26 17:07:02 +00:00
|
|
|
// start only with single cell (marked or cursor position)
|
|
|
|
ScRange aMarkRange;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOk = (GetViewData()->GetSimpleArea( aMarkRange ) == SC_MARK_SIMPLE);
|
2003-03-26 17:07:02 +00:00
|
|
|
if ( bOk && aMarkRange.aStart != aMarkRange.aEnd )
|
2011-03-10 16:55:21 -05:00
|
|
|
bOk = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (bOk)
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bFormatValid = sal_True;
|
2003-03-26 17:07:02 +00:00
|
|
|
aFormatSource = aMarkRange.aStart;
|
|
|
|
aFormatArea = ScRange( aFormatSource );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2011-03-10 16:55:21 -05:00
|
|
|
bFormatValid = false; // keinen alten Bereich behalten
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool ScViewFunc::TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bAttrChanged )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// ueberhaupt aktiviert?
|
|
|
|
if ( !SC_MOD()->GetInputOptions().GetExtendFormat() )
|
2011-03-10 16:55:21 -05:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Test: Eingabe mit Zahlformat (bAttrChanged) immer als neue Attributierung behandeln
|
|
|
|
// (alte Area verwerfen). Wenn das nicht gewollt ist, den if-Teil weglassen:
|
|
|
|
if ( bAttrChanged )
|
|
|
|
{
|
|
|
|
StartFormatArea();
|
2011-03-10 16:55:21 -05:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//! Abfrage, ob Zelle leer war ???
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bFound = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScRange aNewRange = aFormatArea;
|
|
|
|
if ( bFormatValid && nTab == aFormatSource.Tab() )
|
|
|
|
{
|
|
|
|
if ( nRow >= aFormatArea.aStart.Row() && nRow <= aFormatArea.aEnd.Row() )
|
|
|
|
{
|
|
|
|
// innerhalb ?
|
|
|
|
if ( nCol >= aFormatArea.aStart.Col() && nCol <= aFormatArea.aEnd.Col() )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bFound = sal_True; // Bereich nicht aendern
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
// links ?
|
|
|
|
if ( nCol+1 == aFormatArea.aStart.Col() )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bFound = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
aNewRange.aStart.SetCol( nCol );
|
|
|
|
}
|
|
|
|
// rechts ?
|
|
|
|
if ( nCol == aFormatArea.aEnd.Col()+1 )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bFound = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
aNewRange.aEnd.SetCol( nCol );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( nCol >= aFormatArea.aStart.Col() && nCol <= aFormatArea.aEnd.Col() )
|
|
|
|
{
|
|
|
|
// oben ?
|
|
|
|
if ( nRow+1 == aFormatArea.aStart.Row() )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bFound = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
aNewRange.aStart.SetRow( nRow );
|
|
|
|
}
|
|
|
|
// unten ?
|
|
|
|
if ( nRow == aFormatArea.aEnd.Row()+1 )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bFound = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
aNewRange.aEnd.SetRow( nRow );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bFound)
|
|
|
|
aFormatArea = aNewRange; // erweitern
|
|
|
|
else
|
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
bFormatValid = false; // ausserhalb -> abbrechen
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bAttrChanged ) // Wert mit Zahlformat eingegeben?
|
|
|
|
StartFormatArea(); // dann ggf. neu starten
|
|
|
|
}
|
|
|
|
|
|
|
|
return bFound;
|
|
|
|
}
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab,
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bAttrChanged, sal_Bool bAddUndo )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bAddUndo && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bAddUndo = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
const ScPatternAttr* pSource = pDoc->GetPattern(
|
|
|
|
aFormatSource.Col(), aFormatSource.Row(), nTab );
|
|
|
|
if ( !((const ScMergeAttr&)pSource->GetItem(ATTR_MERGE)).IsMerged() )
|
|
|
|
{
|
|
|
|
const ScPatternAttr* pDocOld = pDoc->GetPattern( nCol, nRow, nTab );
|
|
|
|
// pDocOld ist nur bis zum Apply... gueltig!
|
|
|
|
|
|
|
|
ScPatternAttr* pOldPattern = NULL;
|
|
|
|
if ( bAddUndo )
|
|
|
|
pOldPattern = new ScPatternAttr( *pDocOld );
|
|
|
|
|
|
|
|
const ScStyleSheet* pSrcStyle = pSource->GetStyleSheet();
|
|
|
|
if ( pSrcStyle && pSrcStyle != pDocOld->GetStyleSheet() )
|
|
|
|
pDoc->ApplyStyle( nCol, nRow, nTab, *pSrcStyle );
|
|
|
|
pDoc->ApplyPattern( nCol, nRow, nTab, *pSource );
|
2011-01-17 13:20:22 +01:00
|
|
|
AdjustRowHeight( nRow, nRow, sal_True ); //! nicht doppelt ?
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bAddUndo )
|
|
|
|
{
|
|
|
|
const ScPatternAttr* pNewPattern = pDoc->GetPattern( nCol, nRow, nTab );
|
|
|
|
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
|
|
|
new ScUndoCursorAttr( pDocSh, nCol, nRow, nTab,
|
|
|
|
pOldPattern, pNewPattern, pSource,
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_True ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
delete pOldPattern; // wird im Undo kopiert (Pool)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bAttrChanged ) // Wert mit Zahlformat eingegeben?
|
|
|
|
aFormatSource.Set( nCol, nRow, nTab ); // dann als neue Quelle
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Hilfsroutinen
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, sal_Bool bFormula )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-10-31 14:59:24 +00:00
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScMarkData& rMark = GetViewData()->GetMarkData();
|
2001-10-31 14:59:24 +00:00
|
|
|
|
|
|
|
double nPPTX = GetViewData()->GetPPTX();
|
|
|
|
double nPPTY = GetViewData()->GetPPTY();
|
|
|
|
Fraction aZoomX = GetViewData()->GetZoomX();
|
|
|
|
Fraction aZoomY = GetViewData()->GetZoomY();
|
|
|
|
|
|
|
|
ScSizeDeviceProvider aProv(pDocSh);
|
|
|
|
if (aProv.IsPrinter())
|
|
|
|
{
|
|
|
|
nPPTX = aProv.GetPPTX();
|
|
|
|
nPPTY = aProv.GetPPTY();
|
|
|
|
aZoomX = aZoomY = Fraction( 1, 1 );
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nTwips = pDoc->GetOptimalColWidth( nCol, nTab, aProv.GetDevice(),
|
2001-10-31 14:59:24 +00:00
|
|
|
nPPTX, nPPTY, aZoomX, aZoomY, bFormula, &rMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
return nTwips;
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool ScViewFunc::SelectionEditable( sal_Bool* pOnlyNotBecauseOfMatrix /* = NULL */ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bRet;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
|
|
|
ScMarkData& rMark = GetViewData()->GetMarkData();
|
|
|
|
if (rMark.IsMarked() || rMark.IsMultiMarked())
|
|
|
|
bRet = pDoc->IsSelectionEditable( rMark, pOnlyNotBecauseOfMatrix );
|
|
|
|
else
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = GetViewData()->GetCurX();
|
|
|
|
SCROW nRow = GetViewData()->GetCurY();
|
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
bRet = pDoc->IsBlockEditable( nTab, nCol, nRow, nCol, nRow,
|
|
|
|
pOnlyNotBecauseOfMatrix );
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef LRU_MAX
|
|
|
|
#define LRU_MAX 10
|
|
|
|
#endif
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool lcl_FunctionKnown( sal_uInt16 nOpCode )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
|
|
|
|
if ( pFuncList )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uLong nCount = pFuncList->GetCount();
|
|
|
|
for (sal_uLong i=0; i<nCount; i++)
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pFuncList->GetFunction(i)->nFIndex == nOpCode )
|
2011-01-17 13:20:22 +01:00
|
|
|
return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-03-10 16:55:21 -05:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool lcl_AddFunction( ScAppOptions& rAppOpt, sal_uInt16 nOpCode )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nOldCount = rAppOpt.GetLRUFuncListCount();
|
|
|
|
sal_uInt16* pOldList = rAppOpt.GetLRUFuncList();
|
|
|
|
sal_uInt16 nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
for (nPos=0; nPos<nOldCount; nPos++)
|
|
|
|
if (pOldList[nPos] == nOpCode) // is the function already in the list?
|
|
|
|
{
|
|
|
|
if ( nPos == 0 )
|
2011-03-10 16:55:21 -05:00
|
|
|
return false; // already at the top -> no change
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// count doesn't change, so the original array is modified
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
for (sal_uInt16 nCopy=nPos; nCopy>0; nCopy--)
|
2000-09-18 16:07:07 +00:00
|
|
|
pOldList[nCopy] = pOldList[nCopy-1];
|
|
|
|
pOldList[0] = nOpCode;
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
return sal_True; // list has changed
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !lcl_FunctionKnown( nOpCode ) )
|
2011-03-10 16:55:21 -05:00
|
|
|
return false; // not in function list -> no change
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nNewCount = Min( (sal_uInt16)(nOldCount + 1), (sal_uInt16)LRU_MAX );
|
|
|
|
sal_uInt16 nNewList[LRU_MAX];
|
2000-09-18 16:07:07 +00:00
|
|
|
nNewList[0] = nOpCode;
|
|
|
|
for (nPos=1; nPos<nNewCount; nPos++)
|
|
|
|
nNewList[nPos] = pOldList[nPos-1];
|
|
|
|
rAppOpt.SetLRUFuncList( nNewList, nNewCount );
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
return sal_True; // list has changed
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// eigentliche Funktionen
|
|
|
|
|
|
|
|
// Eingabe - Undo OK
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bRecord, const EditTextObject* pData )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
|
|
|
ScMarkData& rMark = GetViewData()->GetMarkData();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
|
|
|
SCTAB nSelCount = rMark.GetSelectCount();
|
|
|
|
SCTAB i;
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bRecord && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2002-11-20 13:36:29 +00:00
|
|
|
ScEditableTester aTester( pDoc, nCol,nRow, nCol,nRow, rMark );
|
|
|
|
if (aTester.IsEditable())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bEditDeleted = false;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt8 nOldScript = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScBaseCell** ppOldCells = NULL;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool* pHasFormat = NULL;
|
|
|
|
sal_uLong* pOldFormats = NULL;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB* pTabs = NULL;
|
|
|
|
SCTAB nUndoPos = 0;
|
2009-02-11 15:19:01 +00:00
|
|
|
EditTextObject* pUndoData = NULL;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bRecord )
|
|
|
|
{
|
|
|
|
ppOldCells = new ScBaseCell*[nSelCount];
|
2011-01-17 13:20:22 +01:00
|
|
|
pHasFormat = new sal_Bool[nSelCount];
|
|
|
|
pOldFormats = new sal_uLong[nSelCount];
|
2004-06-04 11:11:19 +00:00
|
|
|
pTabs = new SCTAB[nSelCount];
|
2000-09-18 16:07:07 +00:00
|
|
|
nUndoPos = 0;
|
|
|
|
|
|
|
|
for (i=0; i<nTabCount; i++)
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
{
|
|
|
|
pTabs[nUndoPos] = i;
|
|
|
|
ScBaseCell* pDocCell;
|
|
|
|
pDoc->GetCell( nCol, nRow, i, pDocCell );
|
|
|
|
if ( pDocCell )
|
|
|
|
{
|
2009-03-02 14:19:13 +00:00
|
|
|
ppOldCells[nUndoPos] = pDocCell->CloneWithoutNote( *pDoc );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pDocCell->GetCellType() == CELLTYPE_EDIT )
|
2011-01-17 13:20:22 +01:00
|
|
|
bEditDeleted = sal_True;
|
2000-11-24 17:07:45 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt8 nDocScript = pDoc->GetScriptType( nCol, nRow, i, pDocCell );
|
2000-11-24 17:07:45 +00:00
|
|
|
if ( nOldScript == 0 )
|
|
|
|
nOldScript = nDocScript;
|
|
|
|
else if ( nDocScript != nOldScript )
|
2011-01-17 13:20:22 +01:00
|
|
|
bEditDeleted = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ppOldCells[nUndoPos] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
const ScPatternAttr* pPattern = pDoc->GetPattern(nCol, nRow, i);
|
|
|
|
if ( SFX_ITEM_SET == pPattern->GetItemSet().GetItemState(
|
2011-03-10 16:55:21 -05:00
|
|
|
ATTR_VALUE_FORMAT,false,&pItem) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
pHasFormat[nUndoPos] = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
pOldFormats[nUndoPos] = ((const SfxUInt32Item*)pItem)->GetValue();
|
|
|
|
}
|
|
|
|
else
|
2011-03-10 16:55:21 -05:00
|
|
|
pHasFormat[nUndoPos] = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
++nUndoPos;
|
|
|
|
}
|
|
|
|
|
2010-11-03 12:33:38 -04:00
|
|
|
OSL_ENSURE( nUndoPos==nSelCount, "nUndoPos!=nSelCount" );
|
2009-02-11 15:19:01 +00:00
|
|
|
|
|
|
|
pUndoData = ( pData ? pData->Clone() : NULL );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2007-10-02 14:22:22 +00:00
|
|
|
bool bFormula = false;
|
|
|
|
|
|
|
|
// a single '=' character is handled as string (needed for special filters)
|
|
|
|
if ( rString.Len() > 1 )
|
|
|
|
{
|
|
|
|
if ( rString.GetChar(0) == '=' )
|
|
|
|
{
|
|
|
|
// handle as formula
|
|
|
|
bFormula = true;
|
|
|
|
}
|
|
|
|
else if ( rString.GetChar(0) == '+' || rString.GetChar(0) == '-' )
|
|
|
|
{
|
|
|
|
// if there is more than one leading '+' or '-' character, remove the additional ones
|
|
|
|
String aString( rString );
|
|
|
|
xub_StrLen nIndex = 1;
|
|
|
|
xub_StrLen nLen = aString.Len();
|
|
|
|
while ( nIndex < nLen && ( aString.GetChar( nIndex ) == '+' || aString.GetChar( nIndex ) == '-' ) )
|
|
|
|
{
|
|
|
|
++nIndex;
|
|
|
|
}
|
|
|
|
aString.Erase( 1, nIndex - 1 );
|
|
|
|
|
|
|
|
// if the remaining part without the leading '+' or '-' character
|
|
|
|
// is non-empty and not a number, handle as formula
|
|
|
|
if ( aString.Len() > 1 )
|
|
|
|
{
|
|
|
|
sal_uInt32 nFormat = 0;
|
|
|
|
pDoc->GetNumberFormat( nCol, nRow, nTab, nFormat );
|
|
|
|
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
|
|
|
|
double fNumber = 0;
|
|
|
|
if ( !pFormatter->IsNumberFormat( aString, nFormat, fNumber ) )
|
|
|
|
{
|
|
|
|
bFormula = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bNumFmtChanged = false;
|
2007-10-02 14:22:22 +00:00
|
|
|
if ( bFormula )
|
2000-09-18 16:07:07 +00:00
|
|
|
{ // Formel, compile mit AutoCorrection
|
|
|
|
for (i=0; i<nTabCount; i++)
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
break;
|
|
|
|
ScAddress aPos( nCol, nRow, i );
|
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05
2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF:
Add GAMMA, CHISQDIST, CHISQINV.
Make the 'cumulative' parameter of GAMMADIST optional.
Adapt the domain of CHIDIST to allow negative x.
Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV.
Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and
ODFF if omitted, for backwards compatibility.
2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37)
2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula
2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula
2008-12-12 13:22:00 +0100 msc r265413 : #i97089#
2008-12-12 13:20:25 +0100 msc r265412 : #i97089#
2008-12-12 12:35:12 +0100 msc r265406 : #i97089#
2008-12-12 12:34:16 +0100 msc r265405 : #i97089#
2008-12-12 12:33:05 +0100 msc r265404 : #i97089#
2008-12-12 12:31:11 +0100 msc r265403 : #i97089#
2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG
2008-12-08 11:50:17 +0100 oj r264980 : some small changes
2008-12-05 12:57:57 +0100 oj r264902 : eof changed
2008-12-05 12:56:46 +0100 oj r264901 : eof changed
2008-12-05 12:28:47 +0100 oj r264899 : wrong var used
2008-12-05 10:08:57 +0100 oj r264890 : token order reversed
2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage
2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id
2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button
2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button
2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends
2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends
2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends
2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set
2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category
2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids
2008-12-01 14:36:43 +0100 oj r264604 : use temp var
2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula
2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula
2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc
2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select
2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void
2008-11-28 11:16:48 +0100 oj r264532 : add help ids
2008-11-28 10:16:56 +0100 oj r264529 : set help id
2008-11-28 10:16:43 +0100 oj r264528 : set help id
2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes
2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug
2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them
2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code
2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code
2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline
2008-11-21 12:35:27 +0100 oj r264124 : hold symbols
2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost
2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove
2008-11-19 20:37:41 +0100 oj r264021 : removed unused var
2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token
2008-11-19 10:59:47 +0100 oj r263967 : deleted
2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files
2008-11-18 15:27:36 +0100 oj r263777 : unused para removed
2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg
2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting
2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef
2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling
2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file
2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula
2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction
2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35
2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35
2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35
2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35
2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35
2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35
2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35
2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35
2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35
2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35
2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved
2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target
2008-10-07 10:08:39 +0200 oj r262077 : copy
2008-10-07 09:45:31 +0200 oj r262076 : #i94535#
2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class
2008-10-07 09:43:21 +0200 oj r262074 : moved to formula
2008-10-07 09:41:51 +0200 oj r262073 : new images
2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula
2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula
2008-10-02 08:08:54 +0200 oj r262023 : #i94535#
2008-10-02 08:06:28 +0200 oj r262022 : #i94535#
2008-10-02 08:05:52 +0200 oj r262021 : #i94535#
2008-10-01 17:15:29 +0200 oj r262014 : #i94535#
2008-10-01 17:12:40 +0200 oj r262013 : new module formula
2008-10-01 17:04:55 +0200 oj r262012 : #i94535#
2008-10-01 16:49:03 +0200 oj r262010 : #i94535#
2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
|
|
|
ScCompiler aComp( pDoc, aPos);
|
|
|
|
aComp.SetGrammar(pDoc->GetGrammar());
|
2000-09-18 16:07:07 +00:00
|
|
|
//2do: AutoCorrection via CalcOptions abschaltbar machen
|
2011-01-17 13:20:22 +01:00
|
|
|
aComp.SetAutoCorrection( sal_True );
|
2008-07-22 13:45:24 +00:00
|
|
|
if ( rString.GetChar(0) == '+' || rString.GetChar(0) == '-' )
|
|
|
|
{
|
|
|
|
aComp.SetExtendedErrorDetection( true );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
String aFormula( rString );
|
|
|
|
ScTokenArray* pArr;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bAgain;
|
2000-09-18 16:07:07 +00:00
|
|
|
do
|
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
bAgain = false;
|
|
|
|
sal_Bool bAddEqual = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScTokenArray* pArrFirst = pArr = aComp.CompileString( aFormula );
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bCorrected = aComp.IsCorrected();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bCorrected )
|
|
|
|
{ // probieren, mit erster Parser-Korrektur neu zu parsen
|
|
|
|
pArr = aComp.CompileString( aComp.GetCorrectedFormula() );
|
|
|
|
}
|
2008-03-06 15:22:50 +00:00
|
|
|
if ( !pArr->GetCodeError() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bAddEqual = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
aComp.CompileTokenArray();
|
|
|
|
bCorrected |= aComp.IsCorrected();
|
|
|
|
}
|
|
|
|
if ( bCorrected )
|
|
|
|
{
|
|
|
|
String aCorrectedFormula;
|
|
|
|
if ( bAddEqual )
|
|
|
|
{
|
|
|
|
aCorrectedFormula = '=';
|
|
|
|
aCorrectedFormula += aComp.GetCorrectedFormula();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aCorrectedFormula = aComp.GetCorrectedFormula();
|
|
|
|
short nResult;
|
|
|
|
if ( aCorrectedFormula.Len() == 1 )
|
|
|
|
nResult = RET_NO; // leere Formel, nur '='
|
|
|
|
else
|
|
|
|
{
|
|
|
|
String aMessage( ScResId( SCSTR_FORMULA_AUTOCORRECTION ) );
|
|
|
|
aMessage += aCorrectedFormula;
|
|
|
|
nResult = QueryBox( GetViewData()->GetDialogParent(),
|
|
|
|
WinBits(WB_YES_NO | WB_DEF_YES),
|
|
|
|
aMessage ).Execute();
|
|
|
|
}
|
|
|
|
if ( nResult == RET_YES )
|
|
|
|
{
|
|
|
|
aFormula = aCorrectedFormula;
|
|
|
|
if ( pArr != pArrFirst )
|
|
|
|
delete pArrFirst;
|
2011-01-17 13:20:22 +01:00
|
|
|
bAgain = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( pArr != pArrFirst )
|
|
|
|
{
|
|
|
|
delete pArr;
|
|
|
|
pArr = pArrFirst;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while ( bAgain );
|
|
|
|
// um in mehreren Tabellen eingesetzt zu werden, muss die Formel
|
|
|
|
// via ScFormulaCell copy-ctor evtl. wegen RangeNames neu kompiliert
|
|
|
|
// werden, gleiches Code-Array fuer alle Zellen geht nicht.
|
|
|
|
// Wenn das Array einen Fehler enthaelt, muss in den neu erzeugten
|
|
|
|
// Zellen RPN geloescht und der Fehler explizit gesetzt werden, da
|
|
|
|
// via FormulaCell copy-ctor und Interpreter das, wenn moeglich,
|
|
|
|
// wieder glattgebuegelt wird, zu intelligent.. z.B.: =1))
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nError = pArr->GetCodeError();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !nError )
|
|
|
|
{
|
2011-03-02 21:32:00 +01:00
|
|
|
// update list of recent functions with all functions that
|
2000-09-18 16:07:07 +00:00
|
|
|
// are not within parentheses
|
|
|
|
|
|
|
|
ScModule* pScMod = SC_MOD();
|
|
|
|
ScAppOptions aAppOpt = pScMod->GetAppOptions();
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bOptChanged = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05
2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF:
Add GAMMA, CHISQDIST, CHISQINV.
Make the 'cumulative' parameter of GAMMADIST optional.
Adapt the domain of CHIDIST to allow negative x.
Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV.
Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and
ODFF if omitted, for backwards compatibility.
2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37)
2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula
2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula
2008-12-12 13:22:00 +0100 msc r265413 : #i97089#
2008-12-12 13:20:25 +0100 msc r265412 : #i97089#
2008-12-12 12:35:12 +0100 msc r265406 : #i97089#
2008-12-12 12:34:16 +0100 msc r265405 : #i97089#
2008-12-12 12:33:05 +0100 msc r265404 : #i97089#
2008-12-12 12:31:11 +0100 msc r265403 : #i97089#
2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG
2008-12-08 11:50:17 +0100 oj r264980 : some small changes
2008-12-05 12:57:57 +0100 oj r264902 : eof changed
2008-12-05 12:56:46 +0100 oj r264901 : eof changed
2008-12-05 12:28:47 +0100 oj r264899 : wrong var used
2008-12-05 10:08:57 +0100 oj r264890 : token order reversed
2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage
2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id
2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button
2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button
2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends
2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends
2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends
2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set
2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category
2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids
2008-12-01 14:36:43 +0100 oj r264604 : use temp var
2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula
2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula
2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc
2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select
2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void
2008-11-28 11:16:48 +0100 oj r264532 : add help ids
2008-11-28 10:16:56 +0100 oj r264529 : set help id
2008-11-28 10:16:43 +0100 oj r264528 : set help id
2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes
2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug
2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them
2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code
2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code
2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline
2008-11-21 12:35:27 +0100 oj r264124 : hold symbols
2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost
2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove
2008-11-19 20:37:41 +0100 oj r264021 : removed unused var
2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token
2008-11-19 10:59:47 +0100 oj r263967 : deleted
2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files
2008-11-18 15:27:36 +0100 oj r263777 : unused para removed
2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg
2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting
2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef
2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling
2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file
2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula
2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction
2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35
2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35
2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35
2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35
2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35
2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35
2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35
2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35
2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35
2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35
2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved
2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target
2008-10-07 10:08:39 +0200 oj r262077 : copy
2008-10-07 09:45:31 +0200 oj r262076 : #i94535#
2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class
2008-10-07 09:43:21 +0200 oj r262074 : moved to formula
2008-10-07 09:41:51 +0200 oj r262073 : new images
2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula
2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula
2008-10-02 08:08:54 +0200 oj r262023 : #i94535#
2008-10-02 08:06:28 +0200 oj r262022 : #i94535#
2008-10-02 08:05:52 +0200 oj r262021 : #i94535#
2008-10-01 17:15:29 +0200 oj r262014 : #i94535#
2008-10-01 17:12:40 +0200 oj r262013 : new module formula
2008-10-01 17:04:55 +0200 oj r262012 : #i94535#
2008-10-01 16:49:03 +0200 oj r262010 : #i94535#
2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
|
|
|
formula::FormulaToken** ppToken = pArr->GetArray();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nTokens = pArr->GetLen();
|
|
|
|
sal_uInt16 nLevel = 0;
|
|
|
|
for (sal_uInt16 nTP=0; nTP<nTokens; nTP++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05
2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF:
Add GAMMA, CHISQDIST, CHISQINV.
Make the 'cumulative' parameter of GAMMADIST optional.
Adapt the domain of CHIDIST to allow negative x.
Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV.
Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and
ODFF if omitted, for backwards compatibility.
2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37)
2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula
2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula
2008-12-12 13:22:00 +0100 msc r265413 : #i97089#
2008-12-12 13:20:25 +0100 msc r265412 : #i97089#
2008-12-12 12:35:12 +0100 msc r265406 : #i97089#
2008-12-12 12:34:16 +0100 msc r265405 : #i97089#
2008-12-12 12:33:05 +0100 msc r265404 : #i97089#
2008-12-12 12:31:11 +0100 msc r265403 : #i97089#
2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG
2008-12-08 11:50:17 +0100 oj r264980 : some small changes
2008-12-05 12:57:57 +0100 oj r264902 : eof changed
2008-12-05 12:56:46 +0100 oj r264901 : eof changed
2008-12-05 12:28:47 +0100 oj r264899 : wrong var used
2008-12-05 10:08:57 +0100 oj r264890 : token order reversed
2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage
2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id
2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button
2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button
2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends
2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends
2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends
2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set
2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category
2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids
2008-12-01 14:36:43 +0100 oj r264604 : use temp var
2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula
2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula
2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc
2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select
2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void
2008-11-28 11:16:48 +0100 oj r264532 : add help ids
2008-11-28 10:16:56 +0100 oj r264529 : set help id
2008-11-28 10:16:43 +0100 oj r264528 : set help id
2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes
2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug
2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them
2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code
2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code
2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline
2008-11-21 12:35:27 +0100 oj r264124 : hold symbols
2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost
2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove
2008-11-19 20:37:41 +0100 oj r264021 : removed unused var
2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token
2008-11-19 10:59:47 +0100 oj r263967 : deleted
2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files
2008-11-18 15:27:36 +0100 oj r263777 : unused para removed
2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg
2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting
2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef
2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling
2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file
2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula
2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction
2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35
2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35
2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35
2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35
2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35
2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35
2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35
2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35
2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35
2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35
2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved
2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target
2008-10-07 10:08:39 +0200 oj r262077 : copy
2008-10-07 09:45:31 +0200 oj r262076 : #i94535#
2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class
2008-10-07 09:43:21 +0200 oj r262074 : moved to formula
2008-10-07 09:41:51 +0200 oj r262073 : new images
2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula
2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula
2008-10-02 08:08:54 +0200 oj r262023 : #i94535#
2008-10-02 08:06:28 +0200 oj r262022 : #i94535#
2008-10-02 08:05:52 +0200 oj r262021 : #i94535#
2008-10-01 17:15:29 +0200 oj r262014 : #i94535#
2008-10-01 17:12:40 +0200 oj r262013 : new module formula
2008-10-01 17:04:55 +0200 oj r262012 : #i94535#
2008-10-01 16:49:03 +0200 oj r262010 : #i94535#
2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
|
|
|
formula::FormulaToken* pTok = ppToken[nTP];
|
2000-09-18 16:07:07 +00:00
|
|
|
OpCode eOp = pTok->GetOpCode();
|
|
|
|
if ( eOp == ocOpen )
|
|
|
|
++nLevel;
|
|
|
|
else if ( eOp == ocClose && nLevel )
|
|
|
|
--nLevel;
|
2007-02-27 13:01:43 +00:00
|
|
|
if ( nLevel == 0 && pTok->IsFunction() &&
|
2011-01-17 13:20:22 +01:00
|
|
|
lcl_AddFunction( aAppOpt, sal::static_int_cast<sal_uInt16>( eOp ) ) )
|
|
|
|
bOptChanged = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bOptChanged )
|
|
|
|
{
|
|
|
|
pScMod->SetAppOptions(aAppOpt);
|
|
|
|
pScMod->RecentFunctionsChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05
2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF:
Add GAMMA, CHISQDIST, CHISQINV.
Make the 'cumulative' parameter of GAMMADIST optional.
Adapt the domain of CHIDIST to allow negative x.
Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV.
Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and
ODFF if omitted, for backwards compatibility.
2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37)
2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula
2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula
2008-12-12 13:22:00 +0100 msc r265413 : #i97089#
2008-12-12 13:20:25 +0100 msc r265412 : #i97089#
2008-12-12 12:35:12 +0100 msc r265406 : #i97089#
2008-12-12 12:34:16 +0100 msc r265405 : #i97089#
2008-12-12 12:33:05 +0100 msc r265404 : #i97089#
2008-12-12 12:31:11 +0100 msc r265403 : #i97089#
2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG
2008-12-08 11:50:17 +0100 oj r264980 : some small changes
2008-12-05 12:57:57 +0100 oj r264902 : eof changed
2008-12-05 12:56:46 +0100 oj r264901 : eof changed
2008-12-05 12:28:47 +0100 oj r264899 : wrong var used
2008-12-05 10:08:57 +0100 oj r264890 : token order reversed
2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage
2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id
2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button
2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button
2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends
2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends
2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends
2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set
2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category
2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids
2008-12-01 14:36:43 +0100 oj r264604 : use temp var
2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula
2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula
2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc
2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select
2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void
2008-11-28 11:16:48 +0100 oj r264532 : add help ids
2008-11-28 10:16:56 +0100 oj r264529 : set help id
2008-11-28 10:16:43 +0100 oj r264528 : set help id
2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes
2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug
2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them
2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code
2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code
2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline
2008-11-21 12:35:27 +0100 oj r264124 : hold symbols
2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost
2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove
2008-11-19 20:37:41 +0100 oj r264021 : removed unused var
2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token
2008-11-19 10:59:47 +0100 oj r263967 : deleted
2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files
2008-11-18 15:27:36 +0100 oj r263777 : unused para removed
2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg
2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting
2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef
2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling
2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file
2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula
2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction
2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35
2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35
2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35
2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35
2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35
2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35
2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35
2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35
2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35
2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35
2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved
2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target
2008-10-07 10:08:39 +0200 oj r262077 : copy
2008-10-07 09:45:31 +0200 oj r262076 : #i94535#
2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class
2008-10-07 09:43:21 +0200 oj r262074 : moved to formula
2008-10-07 09:41:51 +0200 oj r262073 : new images
2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula
2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula
2008-10-02 08:08:54 +0200 oj r262023 : #i94535#
2008-10-02 08:06:28 +0200 oj r262022 : #i94535#
2008-10-02 08:05:52 +0200 oj r262021 : #i94535#
2008-10-01 17:15:29 +0200 oj r262014 : #i94535#
2008-10-01 17:12:40 +0200 oj r262013 : new module formula
2008-10-01 17:04:55 +0200 oj r262012 : #i94535#
2008-10-01 16:49:03 +0200 oj r262010 : #i94535#
2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
|
|
|
ScFormulaCell aCell( pDoc, aPos, pArr,formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE );
|
2000-09-18 16:07:07 +00:00
|
|
|
delete pArr;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bAutoCalc = pDoc->GetAutoCalc();
|
2000-09-18 16:07:07 +00:00
|
|
|
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
|
|
|
|
for ( ; i<nTabCount; i++)
|
|
|
|
{
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
{
|
|
|
|
aPos.SetTab( i );
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uLong nIndex = (sal_uLong) ((SfxUInt32Item*) pDoc->GetAttr(
|
2000-09-18 16:07:07 +00:00
|
|
|
nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
|
2007-10-02 14:22:22 +00:00
|
|
|
if ( pFormatter->GetType( nIndex ) == NUMBERFORMAT_TEXT ||
|
|
|
|
( ( rString.GetChar(0) == '+' || rString.GetChar(0) == '-' ) && nError && rString.Equals( aFormula ) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-02-11 15:19:01 +00:00
|
|
|
if ( pData )
|
|
|
|
{
|
|
|
|
ScEditCell* pCell = new ScEditCell( pData, pDoc, NULL );
|
|
|
|
pDoc->PutCell( aPos, pCell );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScStringCell* pCell = new ScStringCell( aFormula );
|
|
|
|
pDoc->PutCell( aPos, pCell );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-28 10:04:47 +00:00
|
|
|
DELETEZ(pUndoData);
|
2009-03-02 14:19:13 +00:00
|
|
|
ScFormulaCell* pCell = new ScFormulaCell( aCell, *pDoc, aPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nError )
|
|
|
|
{
|
|
|
|
pCell->GetCode()->DelRPN();
|
|
|
|
pCell->SetErrCode( nError );
|
2004-06-28 15:54:09 +00:00
|
|
|
if(pCell->GetCode()->IsHyperLink())
|
2011-03-10 16:55:21 -05:00
|
|
|
pCell->GetCode()->SetHyperLink(false);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
pDoc->PutCell( aPos, pCell );
|
|
|
|
if ( !bAutoCalc )
|
|
|
|
{ // einmal nur die Zelle berechnen und wieder dirty setzen
|
|
|
|
pCell->Interpret();
|
|
|
|
pCell->SetDirtyVar();
|
|
|
|
pDoc->PutInFormulaTree( pCell );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i=0; i<nTabCount; i++)
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
if (pDoc->SetString( nCol, nRow, i, rString ))
|
2011-01-17 13:20:22 +01:00
|
|
|
bNumFmtChanged = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2000-11-24 17:07:45 +00:00
|
|
|
// row height must be changed if new text has a different script type
|
|
|
|
for (i=0; i<nTabCount && !bEditDeleted; i++)
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
if ( pDoc->GetScriptType( nCol, nRow, i ) != nOldScript )
|
2011-01-17 13:20:22 +01:00
|
|
|
bEditDeleted = sal_True;
|
2000-11-24 17:07:45 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
HideAllCursors();
|
|
|
|
|
|
|
|
if (bEditDeleted || pDoc->HasAttrib( nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_NEEDHEIGHT ))
|
|
|
|
AdjustRowHeight(nRow,nRow);
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bAutoFormat = TestFormatArea(nCol, nRow, nTab, bNumFmtChanged);
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bAutoFormat)
|
|
|
|
DoAutoAttributes(nCol, nRow, nTab, bNumFmtChanged, bRecord);
|
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{ // wg. ChangeTrack erst jetzt
|
2009-02-11 15:19:01 +00:00
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2000-09-18 16:07:07 +00:00
|
|
|
new ScUndoEnterData( pDocSh, nCol, nRow, nTab, nUndoPos, pTabs,
|
|
|
|
ppOldCells, pHasFormat, pOldFormats,
|
2009-02-11 15:19:01 +00:00
|
|
|
rString, pUndoData ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<nTabCount; i++)
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
pDocSh->PostPaintCell( nCol, nRow, i );
|
|
|
|
|
|
|
|
ShowAllCursors();
|
|
|
|
|
|
|
|
pDocSh->UpdateOle(GetViewData());
|
2009-02-17 09:19:30 +00:00
|
|
|
|
|
|
|
// #i97876# Spreadsheet data changes are not notified
|
|
|
|
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
|
|
|
|
if ( pModelObj && pModelObj->HasChangesListeners() )
|
|
|
|
{
|
|
|
|
ScRangeList aChangeRanges;
|
|
|
|
for ( i = 0; i < nTabCount; ++i )
|
|
|
|
{
|
|
|
|
if ( rMark.GetTableSelect( i ) )
|
|
|
|
{
|
|
|
|
aChangeRanges.Append( ScRange( nCol, nRow, i ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
2011-01-06 15:35:57 +05:30
|
|
|
lcl_PostRepaintCondFormat( pDoc->GetCondFormat( nCol, nRow, nTab ), pDocSh );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-20 13:36:29 +00:00
|
|
|
ErrorMessage(aTester.GetMessageId());
|
2000-09-18 16:07:07 +00:00
|
|
|
PaintArea( nCol, nRow, nCol, nRow ); // da steht evtl. noch die Edit-Engine
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wert in einzele Zelle eintragen (nur auf nTab)
|
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bUndo (pDoc->IsUndoEnabled());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pDoc && pDocSh )
|
|
|
|
{
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2002-11-20 13:36:29 +00:00
|
|
|
ScEditableTester aTester( pDoc, nTab, nCol,nRow, nCol,nRow );
|
|
|
|
if (aTester.IsEditable())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-03-02 14:19:13 +00:00
|
|
|
ScAddress aPos( nCol, nRow, nTab );
|
|
|
|
ScBaseCell* pOldCell = pDoc->GetCell( aPos );
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bNeedHeight = ( pOldCell && pOldCell->GetCellType() == CELLTYPE_EDIT )
|
2000-09-18 16:07:07 +00:00
|
|
|
|| pDoc->HasAttrib(
|
|
|
|
nCol,nRow,nTab, nCol,nRow,nTab, HASATTR_NEEDHEIGHT );
|
|
|
|
|
|
|
|
// Undo
|
2009-03-02 14:19:13 +00:00
|
|
|
ScBaseCell* pUndoCell = (bUndo && pOldCell) ? pOldCell->CloneWithoutNote( *pDoc ) : 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pDoc->SetValue( nCol, nRow, nTab, rValue );
|
|
|
|
|
|
|
|
// wg. ChangeTrack nach Aenderung im Dokument
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bUndo)
|
|
|
|
{
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2009-03-02 14:19:13 +00:00
|
|
|
new ScUndoEnterValue( pDocSh, aPos, pUndoCell, rValue, bNeedHeight ) );
|
2001-02-14 14:34:08 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
pDocSh->PostPaintCell( aPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
pDocSh->UpdateOle(GetViewData());
|
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
}
|
|
|
|
else
|
2002-11-20 13:36:29 +00:00
|
|
|
ErrorMessage(aTester.GetMessageId());
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextObject* pData,
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bRecord, sal_Bool bTestSimple )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScMarkData& rMark = GetViewData()->GetMarkData();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bRecord && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2002-11-20 13:36:29 +00:00
|
|
|
ScEditableTester aTester( pDoc, nTab, nCol,nRow, nCol,nRow );
|
|
|
|
if (aTester.IsEditable())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
//
|
|
|
|
// Test auf Attribute
|
|
|
|
//
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bSimple = false;
|
|
|
|
sal_Bool bCommon = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScPatternAttr* pCellAttrs = NULL;
|
|
|
|
EditTextObject* pNewData = NULL;
|
|
|
|
String aString;
|
2009-07-28 10:04:47 +00:00
|
|
|
|
|
|
|
const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
|
|
|
|
ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() );
|
|
|
|
aEngine.SetText(*pData);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bTestSimple) // Testen, ob einfacher String ohne Attribute
|
|
|
|
{
|
2007-02-27 13:01:43 +00:00
|
|
|
ScEditAttrTester aAttrTester( &aEngine );
|
|
|
|
bSimple = !aAttrTester.NeedsObject();
|
|
|
|
bCommon = aAttrTester.NeedsCellAttr();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-13 14:45:51 +00:00
|
|
|
// formulas have to be recognized even if they're formatted
|
|
|
|
// (but commmon attributes are still collected)
|
|
|
|
|
|
|
|
if ( !bSimple && aEngine.GetParagraphCount() == 1 )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
String aParStr = aEngine.GetText( (sal_uInt16) 0 );
|
2000-10-13 14:45:51 +00:00
|
|
|
if ( aParStr.GetChar(0) == '=' )
|
2011-01-17 13:20:22 +01:00
|
|
|
bSimple = sal_True;
|
2000-10-13 14:45:51 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bCommon) // Attribute fuer Tabelle
|
|
|
|
{
|
|
|
|
pCellAttrs = new ScPatternAttr( *pOldPattern );
|
2007-02-27 13:01:43 +00:00
|
|
|
pCellAttrs->GetFromEditItemSet( &aAttrTester.GetAttribs() );
|
2000-09-18 16:07:07 +00:00
|
|
|
//! remove common attributes from EditEngine?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-28 10:04:47 +00:00
|
|
|
// #i97726# always get text for "repeat" of undo action
|
|
|
|
aString = ScEditUtil::GetSpaceDelimitedString(aEngine);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
//
|
|
|
|
// Undo
|
|
|
|
//
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
|
|
|
SCTAB nSelCount = rMark.GetSelectCount();
|
|
|
|
SCTAB i;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScBaseCell** ppOldCells = NULL;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB* pTabs = NULL;
|
|
|
|
SCTAB nPos = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
EditTextObject* pUndoData = NULL;
|
|
|
|
if (bRecord && !bSimple)
|
|
|
|
{
|
|
|
|
ppOldCells = new ScBaseCell*[nSelCount];
|
2004-06-04 11:11:19 +00:00
|
|
|
pTabs = new SCTAB[nSelCount];
|
2000-09-18 16:07:07 +00:00
|
|
|
nPos = 0;
|
|
|
|
|
|
|
|
for (i=0; i<nTabCount; i++)
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
{
|
|
|
|
pTabs[nPos] = i;
|
|
|
|
ScBaseCell* pDocCell;
|
|
|
|
pDoc->GetCell( nCol, nRow, i, pDocCell );
|
2009-03-02 14:19:13 +00:00
|
|
|
ppOldCells[nPos] = pDocCell ? pDocCell->CloneWithoutNote( *pDoc ) : 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
++nPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_ASSERT( nPos==nSelCount, "nPos!=nSelCount" );
|
|
|
|
|
|
|
|
pUndoData = pData->Clone();
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Daten eintragen
|
|
|
|
//
|
|
|
|
|
|
|
|
if (bCommon)
|
|
|
|
pDoc->ApplyPattern(nCol,nRow,nTab,*pCellAttrs); //! Undo
|
|
|
|
|
|
|
|
if (bSimple)
|
|
|
|
{
|
|
|
|
if (bCommon)
|
|
|
|
AdjustRowHeight(nRow,nRow);
|
|
|
|
|
|
|
|
EnterData(nCol,nRow,nTab,aString,bRecord);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i=0; i<nTabCount; i++)
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
pDoc->PutCell( nCol, nRow, i, new ScEditCell( pData, pDoc, NULL ) );
|
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{ // wg. ChangeTrack erst jetzt
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
|
|
|
new ScUndoEnterData( pDocSh, nCol, nRow, nTab, nPos, pTabs,
|
2009-07-28 10:04:47 +00:00
|
|
|
ppOldCells, NULL, NULL, aString,
|
2000-09-18 16:07:07 +00:00
|
|
|
pUndoData ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
HideAllCursors();
|
|
|
|
|
|
|
|
AdjustRowHeight(nRow,nRow);
|
|
|
|
|
|
|
|
for (i=0; i<nTabCount; i++)
|
|
|
|
if (rMark.GetTableSelect(i))
|
|
|
|
pDocSh->PostPaintCell( nCol, nRow, i );
|
|
|
|
|
|
|
|
ShowAllCursors();
|
|
|
|
|
|
|
|
pDocSh->UpdateOle(GetViewData());
|
2009-02-17 09:19:30 +00:00
|
|
|
|
|
|
|
// #i97876# Spreadsheet data changes are not notified
|
|
|
|
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
|
|
|
|
if ( pModelObj && pModelObj->HasChangesListeners() )
|
|
|
|
{
|
|
|
|
ScRangeList aChangeRanges;
|
|
|
|
for ( i = 0; i < nTabCount; ++i )
|
|
|
|
{
|
|
|
|
if ( rMark.GetTableSelect( i ) )
|
|
|
|
{
|
|
|
|
aChangeRanges.Append( ScRange( nCol, nRow, i ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
}
|
2011-01-06 15:35:57 +05:30
|
|
|
lcl_PostRepaintCondFormat( pDoc->GetCondFormat( nCol, nRow, nTab ), pDocSh );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
delete pCellAttrs;
|
|
|
|
delete pNewData;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-20 13:36:29 +00:00
|
|
|
ErrorMessage(aTester.GetMessageId());
|
2000-09-18 16:07:07 +00:00
|
|
|
PaintArea( nCol, nRow, nCol, nRow ); // da steht evtl. noch die Edit-Engine
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScViewFunc::EnterDataAtCursor( const String& rString )
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nPosX = GetViewData()->GetCurX();
|
|
|
|
SCROW nPosY = GetViewData()->GetCurY();
|
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
EnterData( nPosX, nPosY, nTab, rString );
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScViewFunc::EnterMatrix( const String& rString )
|
|
|
|
{
|
|
|
|
ScViewData* pData = GetViewData();
|
|
|
|
const ScMarkData& rMark = pData->GetMarkData();
|
|
|
|
if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
|
|
|
|
{
|
|
|
|
// nichts markiert -> automatisch Block mit Groesse des Ergebnisses
|
|
|
|
// Formel temporaer berechnen, um an die Groesse heranzukommen
|
|
|
|
|
|
|
|
ScDocument* pDoc = pData->GetDocument();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = pData->GetCurX();
|
|
|
|
SCROW nRow = pData->GetCurY();
|
|
|
|
SCTAB nTab = pData->GetTabNo();
|
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05
2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF:
Add GAMMA, CHISQDIST, CHISQINV.
Make the 'cumulative' parameter of GAMMADIST optional.
Adapt the domain of CHIDIST to allow negative x.
Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV.
Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and
ODFF if omitted, for backwards compatibility.
2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37)
2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C'
CWS: frmdlg
New MWS: DEV300
New milestone: m37
2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula
2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula
2008-12-12 13:22:00 +0100 msc r265413 : #i97089#
2008-12-12 13:20:25 +0100 msc r265412 : #i97089#
2008-12-12 12:35:12 +0100 msc r265406 : #i97089#
2008-12-12 12:34:16 +0100 msc r265405 : #i97089#
2008-12-12 12:33:05 +0100 msc r265404 : #i97089#
2008-12-12 12:31:11 +0100 msc r265403 : #i97089#
2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG
2008-12-08 11:50:17 +0100 oj r264980 : some small changes
2008-12-05 12:57:57 +0100 oj r264902 : eof changed
2008-12-05 12:56:46 +0100 oj r264901 : eof changed
2008-12-05 12:28:47 +0100 oj r264899 : wrong var used
2008-12-05 10:08:57 +0100 oj r264890 : token order reversed
2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard
2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage
2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id
2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button
2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button
2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends
2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends
2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends
2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set
2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category
2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids
2008-12-01 14:36:43 +0100 oj r264604 : use temp var
2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula
2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula
2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc
2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select
2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void
2008-11-28 11:16:48 +0100 oj r264532 : add help ids
2008-11-28 10:16:56 +0100 oj r264529 : set help id
2008-11-28 10:16:43 +0100 oj r264528 : set help id
2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes
2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug
2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them
2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code
2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code
2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline
2008-11-21 12:35:27 +0100 oj r264124 : hold symbols
2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost
2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove
2008-11-19 20:37:41 +0100 oj r264021 : removed unused var
2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token
2008-11-19 10:59:47 +0100 oj r263967 : deleted
2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files
2008-11-18 15:27:36 +0100 oj r263777 : unused para removed
2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg
2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting
2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef
2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling
2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file
2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula
2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction
2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35
2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35
2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35
2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35
2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35
2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35
2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35
2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35
2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35
2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35
2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved
2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target
2008-10-07 10:08:39 +0200 oj r262077 : copy
2008-10-07 09:45:31 +0200 oj r262076 : #i94535#
2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class
2008-10-07 09:43:21 +0200 oj r262074 : moved to formula
2008-10-07 09:41:51 +0200 oj r262073 : new images
2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula
2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula
2008-10-02 08:08:54 +0200 oj r262023 : #i94535#
2008-10-02 08:06:28 +0200 oj r262022 : #i94535#
2008-10-02 08:05:52 +0200 oj r262021 : #i94535#
2008-10-01 17:15:29 +0200 oj r262014 : #i94535#
2008-10-01 17:12:40 +0200 oj r262013 : new module formula
2008-10-01 17:04:55 +0200 oj r262012 : #i94535#
2008-10-01 16:49:03 +0200 oj r262010 : #i94535#
2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
2009-01-08 10:47:13 +00:00
|
|
|
ScFormulaCell aFormCell( pDoc, ScAddress(nCol,nRow,nTab), rString,formula::FormulaGrammar::GRAM_DEFAULT, MM_FORMULA );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCSIZE nSizeX;
|
|
|
|
SCSIZE nSizeY;
|
2000-09-18 16:07:07 +00:00
|
|
|
aFormCell.GetResultDimensions( nSizeX, nSizeY );
|
2007-02-27 13:01:43 +00:00
|
|
|
if ( nSizeX != 0 && nSizeY != 0 &&
|
|
|
|
nCol+nSizeX-1 <= sal::static_int_cast<SCSIZE>(MAXCOL) &&
|
|
|
|
nRow+nSizeY-1 <= sal::static_int_cast<SCSIZE>(MAXROW) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2007-02-27 13:01:43 +00:00
|
|
|
ScRange aResult( nCol, nRow, nTab,
|
|
|
|
sal::static_int_cast<SCCOL>(nCol+nSizeX-1),
|
|
|
|
sal::static_int_cast<SCROW>(nRow+nSizeY-1), nTab );
|
2011-03-10 16:55:21 -05:00
|
|
|
MarkRange( aResult, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ScRange aRange;
|
2008-04-18 10:50:48 +00:00
|
|
|
if (pData->GetSimpleArea(aRange) == SC_MARK_SIMPLE)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocShell* pDocSh = pData->GetDocShell();
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bSuccess = pDocSh->GetDocFunc().EnterMatrix( aRange, &rMark, NULL, rString, false, false, EMPTY_STRING, formula::FormulaGrammar::GRAM_DEFAULT );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bSuccess)
|
|
|
|
pDocSh->UpdateOle(GetViewData());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ErrorMessage(STR_NOMULTISELECT);
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt8 ScViewFunc::GetSelectionScriptType()
|
2000-11-24 17:07:45 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt8 nScript = 0;
|
2000-11-24 17:07:45 +00:00
|
|
|
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
|
|
|
const ScMarkData& rMark = GetViewData()->GetMarkData();
|
|
|
|
if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
|
|
|
|
{
|
|
|
|
// no selection -> cursor
|
|
|
|
|
|
|
|
nScript = pDoc->GetScriptType( GetViewData()->GetCurX(),
|
|
|
|
GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScRangeList aRanges;
|
2011-03-10 16:55:21 -05:00
|
|
|
rMark.FillRangeListWithMarks( &aRanges, false );
|
2010-12-08 22:38:24 -08:00
|
|
|
size_t nCount = aRanges.size();
|
|
|
|
for ( size_t i=0; i < nCount; i++ )
|
2000-11-24 17:07:45 +00:00
|
|
|
{
|
2010-12-10 16:07:50 -05:00
|
|
|
ScRange aRange = *aRanges[i];
|
2000-11-24 17:07:45 +00:00
|
|
|
ScCellIterator aIter( pDoc, aRange );
|
|
|
|
ScBaseCell* pCell = aIter.GetFirst();
|
|
|
|
while ( pCell )
|
|
|
|
{
|
|
|
|
nScript |= pDoc->GetScriptType( aIter.GetCol(), aIter.GetRow(), aIter.GetTab(), pCell );
|
|
|
|
pCell = aIter.GetNext();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nScript == 0)
|
2001-11-12 19:04:36 +00:00
|
|
|
nScript = ScGlobal::GetDefaultScriptType();
|
2000-11-24 17:07:45 +00:00
|
|
|
|
|
|
|
return nScript;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
const ScPatternAttr* ScViewFunc::GetSelectionPattern()
|
|
|
|
{
|
2004-09-09 08:31:12 +00:00
|
|
|
// Don't use UnmarkFiltered in slot state functions, for performance reasons.
|
|
|
|
// The displayed state is always that of the whole selection including filtered rows.
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
const ScMarkData& rMark = GetViewData()->GetMarkData();
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
|
|
|
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
|
|
|
|
{
|
2004-09-09 08:31:12 +00:00
|
|
|
// MarkToMulti is no longer necessary for pDoc->GetSelectionPattern
|
2000-09-18 16:07:07 +00:00
|
|
|
const ScPatternAttr* pAttr = pDoc->GetSelectionPattern( rMark );
|
|
|
|
return pAttr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = GetViewData()->GetCurX();
|
|
|
|
SCROW nRow = GetViewData()->GetCurY();
|
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-09-09 08:31:12 +00:00
|
|
|
ScMarkData aTempMark( rMark ); // copy sheet selection
|
2000-09-18 16:07:07 +00:00
|
|
|
aTempMark.SetMarkArea( ScRange( nCol, nRow, nTab ) );
|
|
|
|
const ScPatternAttr* pAttr = pDoc->GetSelectionPattern( aTempMark );
|
|
|
|
return pAttr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScViewFunc::GetSelectionFrame( SvxBoxItem& rLineOuter,
|
|
|
|
SvxBoxInfoItem& rLineInner )
|
|
|
|
{
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
2002-09-05 09:31:03 +00:00
|
|
|
const ScMarkData& rMark = GetViewData()->GetMarkData();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
|
|
|
|
{
|
2002-09-05 09:31:03 +00:00
|
|
|
if ( rMark.IsMultiMarked() )
|
|
|
|
{
|
|
|
|
ScMarkData aNewMark( rMark ); // use local copy for MarkToSimple
|
|
|
|
aNewMark.MarkToSimple(); // simple block is needed for GetSelectionFrame
|
|
|
|
pDoc->GetSelectionFrame( aNewMark, rLineOuter, rLineInner );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pDoc->GetSelectionFrame( rMark, rLineOuter, rLineInner );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const ScPatternAttr* pAttrs =
|
|
|
|
pDoc->GetPattern( GetViewData()->GetCurX(),
|
|
|
|
GetViewData()->GetCurY(),
|
|
|
|
GetViewData()->GetTabNo() );
|
|
|
|
|
|
|
|
rLineOuter = (const SvxBoxItem&) (pAttrs->GetItem( ATTR_BORDER ));
|
|
|
|
rLineInner = (const SvxBoxInfoItem&)(pAttrs->GetItem( ATTR_BORDER_INNER ));
|
2011-03-10 16:55:21 -05:00
|
|
|
rLineInner.SetTable(false);
|
2011-01-17 13:20:22 +01:00
|
|
|
rLineInner.SetDist(sal_True);
|
2011-03-10 16:55:21 -05:00
|
|
|
rLineInner.SetMinDist(false);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Attribute anwenden - Undo OK
|
|
|
|
//
|
|
|
|
// kompletter Set ( ATTR_STARTINDEX, ATTR_ENDINDEX )
|
|
|
|
//
|
|
|
|
|
|
|
|
void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
|
|
|
|
const SfxItemSet* pOldSet,
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// nur wegen Matrix nicht editierbar? Attribute trotzdem ok
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScPatternAttr aOldAttrs( new SfxItemSet(*pOldSet) );
|
|
|
|
ScPatternAttr aNewAttrs( new SfxItemSet(*pDialogSet) );
|
|
|
|
aNewAttrs.DeleteUnchanged( &aOldAttrs );
|
|
|
|
|
2001-01-11 17:31:08 +00:00
|
|
|
if ( pDialogSet->GetItemState( ATTR_VALUE_FORMAT ) == SFX_ITEM_SET )
|
2011-03-02 21:32:00 +01:00
|
|
|
{ // don't reset to default SYSTEM GENERAL if not intended
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nOldFormat =
|
2001-01-11 17:31:08 +00:00
|
|
|
((const SfxUInt32Item&)pOldSet->Get( ATTR_VALUE_FORMAT )).GetValue();
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nNewFormat =
|
2001-01-11 17:31:08 +00:00
|
|
|
((const SfxUInt32Item&)pDialogSet->Get( ATTR_VALUE_FORMAT )).GetValue();
|
|
|
|
if ( nNewFormat != nOldFormat )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-11 17:31:08 +00:00
|
|
|
SvNumberFormatter* pFormatter =
|
|
|
|
GetViewData()->GetDocument()->GetFormatTable();
|
|
|
|
const SvNumberformat* pOldEntry = pFormatter->GetEntry( nOldFormat );
|
|
|
|
LanguageType eOldLang =
|
|
|
|
pOldEntry ? pOldEntry->GetLanguage() : LANGUAGE_DONTKNOW;
|
|
|
|
const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
|
|
|
|
LanguageType eNewLang =
|
|
|
|
pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
|
|
|
|
if ( eNewLang != eOldLang )
|
|
|
|
{
|
|
|
|
aNewAttrs.GetItemSet().Put(
|
|
|
|
SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );
|
|
|
|
|
2011-03-02 21:32:00 +01:00
|
|
|
// nur die Sprache geaendert -> Zahlformat-Attribut nicht anfassen
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nNewMod = nNewFormat % SV_COUNTRY_LANGUAGE_OFFSET;
|
2001-01-11 17:31:08 +00:00
|
|
|
if ( nNewMod == ( nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET ) &&
|
|
|
|
nNewMod <= SV_MAX_ANZ_STANDARD_FORMATE )
|
|
|
|
aNewAttrs.GetItemSet().ClearItem( ATTR_VALUE_FORMAT );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvxBoxItem* pOldOuter = (const SvxBoxItem*) &pOldSet->Get( ATTR_BORDER );
|
|
|
|
const SvxBoxItem* pNewOuter = (const SvxBoxItem*) &pDialogSet->Get( ATTR_BORDER );
|
|
|
|
const SvxBoxInfoItem* pOldInner = (const SvxBoxInfoItem*) &pOldSet->Get( ATTR_BORDER_INNER );
|
|
|
|
const SvxBoxInfoItem* pNewInner = (const SvxBoxInfoItem*) &pDialogSet->Get( ATTR_BORDER_INNER );
|
|
|
|
SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
|
|
|
|
SfxItemPool* pNewPool = rNewSet.GetPool();
|
|
|
|
|
|
|
|
pNewPool->Put( *pNewOuter ); // noch nicht loeschen
|
|
|
|
pNewPool->Put( *pNewInner );
|
|
|
|
rNewSet.ClearItem( ATTR_BORDER );
|
|
|
|
rNewSet.ClearItem( ATTR_BORDER_INNER );
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Feststellen, ob Rahmenattribute zu setzen sind:
|
|
|
|
* 1. Neu != Alt
|
|
|
|
* 2. Ist eine der Linien nicht-DontCare (seit 238.f: IsxxValid())
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bFrame = (pDialogSet->GetItemState( ATTR_BORDER ) != SFX_ITEM_DEFAULT)
|
2000-09-18 16:07:07 +00:00
|
|
|
|| (pDialogSet->GetItemState( ATTR_BORDER_INNER ) != SFX_ITEM_DEFAULT);
|
|
|
|
|
|
|
|
if ( pNewOuter==pOldOuter && pNewInner==pOldInner )
|
2011-03-10 16:55:21 -05:00
|
|
|
bFrame = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// das sollte doch der Pool abfangen: ?!??!??
|
|
|
|
|
|
|
|
if ( bFrame && pNewOuter && pNewInner )
|
|
|
|
if ( *pNewOuter == *pOldOuter && *pNewInner == *pOldInner )
|
2011-03-10 16:55:21 -05:00
|
|
|
bFrame = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pNewInner )
|
|
|
|
{
|
|
|
|
bFrame = bFrame
|
|
|
|
&& ( pNewInner->IsValid(VALID_LEFT)
|
|
|
|
|| pNewInner->IsValid(VALID_RIGHT)
|
|
|
|
|| pNewInner->IsValid(VALID_TOP)
|
|
|
|
|| pNewInner->IsValid(VALID_BOTTOM)
|
|
|
|
|| pNewInner->IsValid(VALID_HORI)
|
|
|
|
|| pNewInner->IsValid(VALID_VERT) );
|
|
|
|
}
|
|
|
|
else
|
2011-03-10 16:55:21 -05:00
|
|
|
bFrame = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (!bFrame)
|
|
|
|
ApplySelectionPattern( aNewAttrs, bRecord ); // nur normale
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// wenn neue Items Default-Items sind, so muessen die
|
|
|
|
// alten Items geputtet werden:
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bDefNewOuter = ( SFX_ITEMS_STATICDEFAULT == pNewOuter->GetKind() );
|
|
|
|
sal_Bool bDefNewInner = ( SFX_ITEMS_STATICDEFAULT == pNewInner->GetKind() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ApplyPatternLines( aNewAttrs,
|
|
|
|
bDefNewOuter ? pOldOuter : pNewOuter,
|
|
|
|
bDefNewInner ? pOldInner : pNewInner,
|
|
|
|
bRecord );
|
|
|
|
}
|
|
|
|
|
|
|
|
pNewPool->Remove( *pNewOuter ); // freigeben
|
|
|
|
pNewPool->Remove( *pNewInner );
|
|
|
|
|
|
|
|
// Hoehen anpassen
|
|
|
|
AdjustBlockHeight();
|
|
|
|
|
|
|
|
// CellContentChanged wird von ApplySelectionPattern / ApplyPatternLines gerufen
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem )
|
|
|
|
{
|
|
|
|
// nur wegen Matrix nicht editierbar? Attribute trotzdem ok
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScPatternAttr aNewAttrs( new SfxItemSet( *GetViewData()->GetDocument()->GetPool(),
|
|
|
|
ATTR_PATTERN_START, ATTR_PATTERN_END ) );
|
|
|
|
|
|
|
|
aNewAttrs.GetItemSet().Put( rAttrItem );
|
|
|
|
// Wenn Ausrichtung eingestellt wird (ueber Buttons), immer Einzug 0
|
|
|
|
if ( rAttrItem.Which() == ATTR_HOR_JUSTIFY )
|
|
|
|
aNewAttrs.GetItemSet().Put( SfxUInt16Item( ATTR_INDENT, 0 ) );
|
|
|
|
ApplySelectionPattern( aNewAttrs );
|
|
|
|
|
|
|
|
AdjustBlockHeight();
|
|
|
|
|
|
|
|
// CellContentChanged wird von ApplySelectionPattern gerufen
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Pattern und Rahmen
|
|
|
|
|
|
|
|
void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem* pNewOuter,
|
2011-01-17 13:20:22 +01:00
|
|
|
const SvxBoxInfoItem* pNewInner, sal_Bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
2009-06-15 10:46:14 +00:00
|
|
|
ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered
|
|
|
|
ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bRecord && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-15 10:46:14 +00:00
|
|
|
ScRange aMarkRange;
|
|
|
|
aFuncMark.MarkToSimple();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bMulti = aFuncMark.IsMultiMarked();
|
2009-06-15 10:46:14 +00:00
|
|
|
if (bMulti)
|
|
|
|
aFuncMark.GetMultiMarkArea( aMarkRange );
|
|
|
|
else if (aFuncMark.IsMarked())
|
|
|
|
aFuncMark.GetMarkArea( aMarkRange );
|
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-06-15 10:46:14 +00:00
|
|
|
aMarkRange = ScRange( GetViewData()->GetCurX(),
|
|
|
|
GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
|
|
|
|
DoneBlockMode();
|
|
|
|
InitOwnBlockMode();
|
|
|
|
aFuncMark.SetMarkArea(aMarkRange);
|
|
|
|
MarkDataChanged();
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-15 10:46:14 +00:00
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-15 10:46:14 +00:00
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-15 10:46:14 +00:00
|
|
|
if (bRecord)
|
|
|
|
{
|
|
|
|
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
|
|
|
SCTAB nStartTab = aMarkRange.aStart.Tab();
|
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
|
|
|
pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
|
|
|
|
for (SCTAB i=0; i<nTabCount; i++)
|
|
|
|
if (i != nStartTab && aFuncMark.GetTableSelect(i))
|
|
|
|
pUndoDoc->AddUndoTab( i, i );
|
|
|
|
|
|
|
|
ScRange aCopyRange = aMarkRange;
|
|
|
|
aCopyRange.aStart.SetTab(0);
|
|
|
|
aCopyRange.aEnd.SetTab(nTabCount-1);
|
|
|
|
pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &aFuncMark );
|
|
|
|
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
|
|
|
new ScUndoSelectionAttr(
|
|
|
|
pDocSh, aFuncMark,
|
|
|
|
aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), aMarkRange.aStart.Tab(),
|
|
|
|
aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), aMarkRange.aEnd.Tab(),
|
|
|
|
pUndoDoc, bMulti, &rAttr, pNewOuter, pNewInner ) );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nExt = SC_PF_TESTMERGE;
|
2009-06-15 10:46:14 +00:00
|
|
|
pDocSh->UpdatePaintExt( nExt, aMarkRange ); // content before the change
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-15 10:46:14 +00:00
|
|
|
pDoc->ApplySelectionFrame( aFuncMark, pNewOuter, pNewInner );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-15 10:46:14 +00:00
|
|
|
pDocSh->UpdatePaintExt( nExt, aMarkRange ); // content after the change
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-15 10:46:14 +00:00
|
|
|
aFuncMark.MarkToMulti();
|
|
|
|
pDoc->ApplySelectionPattern( rAttr, aFuncMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-15 10:46:14 +00:00
|
|
|
pDocSh->PostPaint( aMarkRange, PAINT_GRID, nExt );
|
|
|
|
pDocSh->UpdateOle(GetViewData());
|
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
CellContentChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
StartFormatArea();
|
|
|
|
}
|
|
|
|
|
|
|
|
// nur Pattern
|
|
|
|
|
|
|
|
void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bRecord, sal_Bool bCursorOnly )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
ScDocShell* pDocSh = pViewData->GetDocShell();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2004-09-09 08:31:12 +00:00
|
|
|
ScMarkData aFuncMark( pViewData->GetMarkData() ); // local copy for UnmarkFiltered
|
|
|
|
ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
|
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bRecord && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-02-03 12:08:40 +00:00
|
|
|
// State from old ItemSet doesn't matter for paint flags, as any change will be
|
|
|
|
// from SFX_ITEM_SET in the new ItemSet (default is ignored in ApplyPattern).
|
|
|
|
// New alignment is checked (check in PostPaint isn't enough) in case a right
|
|
|
|
// alignment is changed to left.
|
|
|
|
const SfxItemSet& rNewSet = rAttr.GetItemSet();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bSetLines = rNewSet.GetItemState( ATTR_BORDER, sal_True ) == SFX_ITEM_SET ||
|
|
|
|
rNewSet.GetItemState( ATTR_SHADOW, sal_True ) == SFX_ITEM_SET;
|
|
|
|
sal_Bool bSetAlign = rNewSet.GetItemState( ATTR_HOR_JUSTIFY, sal_True ) == SFX_ITEM_SET;
|
2004-02-03 12:08:40 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nExtFlags = 0;
|
2004-02-03 12:08:40 +00:00
|
|
|
if ( bSetLines )
|
|
|
|
nExtFlags |= SC_PF_LINES;
|
|
|
|
if ( bSetAlign )
|
|
|
|
nExtFlags |= SC_PF_WHOLEROWS;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-02-03 12:08:40 +00:00
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bMulti = aFuncMark.IsMultiMarked();
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToMulti();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyTab = (!aFuncMark.IsMultiMarked() && !bCursorOnly && aFuncMark.GetSelectCount() > 1);
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bOnlyTab)
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = pViewData->GetCurX();
|
|
|
|
SCROW nRow = pViewData->GetCurY();
|
|
|
|
SCTAB nTab = pViewData->GetTabNo();
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.SetMarkArea(ScRange(nCol,nRow,nTab));
|
|
|
|
aFuncMark.MarkToMulti();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2009-02-17 09:19:30 +00:00
|
|
|
ScRangeList aChangeRanges;
|
|
|
|
|
2004-09-09 08:31:12 +00:00
|
|
|
if (aFuncMark.IsMultiMarked() && !bCursorOnly)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-02-03 12:08:40 +00:00
|
|
|
ScRange aMarkRange;
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.GetMultiMarkArea( aMarkRange );
|
2009-02-17 09:19:30 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
|
|
|
for ( SCTAB i = 0; i < nTabCount; ++i )
|
|
|
|
{
|
|
|
|
if ( aFuncMark.GetTableSelect( i ) )
|
|
|
|
{
|
|
|
|
ScRange aChangeRange( aMarkRange );
|
|
|
|
aChangeRange.aStart.SetTab( i );
|
|
|
|
aChangeRange.aEnd.SetTab( i );
|
|
|
|
aChangeRanges.Append( aChangeRange );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nStartCol = aMarkRange.aStart.Col();
|
|
|
|
SCROW nStartRow = aMarkRange.aStart.Row();
|
|
|
|
SCTAB nStartTab = aMarkRange.aStart.Tab();
|
|
|
|
SCCOL nEndCol = aMarkRange.aEnd.Col();
|
|
|
|
SCROW nEndRow = aMarkRange.aEnd.Row();
|
|
|
|
SCTAB nEndTab = aMarkRange.aEnd.Tab();
|
2004-02-03 12:08:40 +00:00
|
|
|
|
2010-09-15 12:28:47 +02:00
|
|
|
ScUndoSelectionAttr* pUndoAttr = NULL;
|
|
|
|
ScEditDataArray* pEditDataArray = NULL;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bRecord)
|
|
|
|
{
|
|
|
|
ScRange aCopyRange = aMarkRange;
|
|
|
|
aCopyRange.aStart.SetTab(0);
|
|
|
|
aCopyRange.aEnd.SetTab(nTabCount-1);
|
|
|
|
|
|
|
|
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
|
|
|
pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
|
2004-06-04 11:11:19 +00:00
|
|
|
for (SCTAB i=0; i<nTabCount; i++)
|
2004-09-09 08:31:12 +00:00
|
|
|
if (i != nStartTab && aFuncMark.GetTableSelect(i))
|
2000-09-18 16:07:07 +00:00
|
|
|
pUndoDoc->AddUndoTab( i, i );
|
2004-09-09 08:31:12 +00:00
|
|
|
pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &aFuncMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToMulti();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-09-15 12:28:47 +02:00
|
|
|
pUndoAttr = new ScUndoSelectionAttr(
|
|
|
|
pDocSh, aFuncMark, nStartCol, nStartRow, nStartTab,
|
|
|
|
nEndCol, nEndRow, nEndTab, pUndoDoc, bMulti, &rAttr );
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(pUndoAttr);
|
|
|
|
pEditDataArray = pUndoAttr->GetDataArray();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2010-09-15 12:28:47 +02:00
|
|
|
pDoc->ApplySelectionPattern( rAttr, aFuncMark, pEditDataArray );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
|
|
|
|
nEndCol, nEndRow, nEndTab,
|
2004-02-03 12:08:40 +00:00
|
|
|
PAINT_GRID, nExtFlags | SC_PF_TESTMERGE );
|
2000-09-18 16:07:07 +00:00
|
|
|
pDocSh->UpdateOle(GetViewData());
|
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
CellContentChanged();
|
|
|
|
}
|
|
|
|
else // einzelne Zelle - Undo einfacher
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = pViewData->GetCurX();
|
|
|
|
SCROW nRow = pViewData->GetCurY();
|
|
|
|
SCTAB nTab = pViewData->GetTabNo();
|
2010-09-15 12:28:47 +02:00
|
|
|
|
|
|
|
ScBaseCell* pCell;
|
|
|
|
pDoc->GetCell(nCol, nRow, nTab, pCell);
|
|
|
|
EditTextObject* pOldEditData = NULL;
|
|
|
|
EditTextObject* pNewEditData = NULL;
|
|
|
|
if (pCell && pCell->GetCellType() == CELLTYPE_EDIT)
|
|
|
|
{
|
|
|
|
ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
|
|
|
|
pOldEditData = pEditCell->GetData()->Clone();
|
|
|
|
pEditCell->RemoveCharAttribs(rAttr);
|
|
|
|
pNewEditData = pEditCell->GetData()->Clone();
|
|
|
|
}
|
|
|
|
|
2009-02-17 09:19:30 +00:00
|
|
|
aChangeRanges.Append( ScRange( nCol, nRow, nTab ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
ScPatternAttr* pOldPat = new ScPatternAttr(*pDoc->GetPattern( nCol, nRow, nTab ));
|
|
|
|
|
|
|
|
pDoc->ApplyPattern( nCol, nRow, nTab, rAttr );
|
|
|
|
|
|
|
|
const ScPatternAttr* pNewPat = pDoc->GetPattern( nCol, nRow, nTab );
|
|
|
|
|
|
|
|
if (bRecord)
|
|
|
|
{
|
2010-09-15 12:28:47 +02:00
|
|
|
ScUndoCursorAttr* pUndo = new ScUndoCursorAttr(
|
|
|
|
pDocSh, nCol, nRow, nTab, pOldPat, pNewPat, &rAttr, false );
|
|
|
|
pUndo->SetEditData(pOldEditData, pNewEditData);
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(pUndo);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
delete pOldPat; // wird im Undo kopiert (Pool)
|
|
|
|
|
2004-02-03 12:08:40 +00:00
|
|
|
pDocSh->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PAINT_GRID, nExtFlags | SC_PF_TESTMERGE );
|
2000-09-18 16:07:07 +00:00
|
|
|
pDocSh->UpdateOle(GetViewData());
|
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
CellContentChanged();
|
|
|
|
}
|
|
|
|
|
2009-02-17 09:19:30 +00:00
|
|
|
// #i97876# Spreadsheet data changes are not notified
|
|
|
|
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
|
|
|
|
if ( pModelObj && pModelObj->HasChangesListeners() )
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aProperties;
|
|
|
|
sal_Int32 nCount = 0;
|
2009-06-03 11:26:39 +00:00
|
|
|
const SfxItemPropertyMap* pMap = ScCellObj::GetCellPropertyMap();
|
|
|
|
PropertyEntryVector_t aPropVector = pMap->getPropertyEntries();
|
2011-01-17 13:20:22 +01:00
|
|
|
for ( sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; ++nWhich )
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem = 0;
|
2011-01-17 13:20:22 +01:00
|
|
|
if ( rNewSet.GetItemState( nWhich, sal_True, &pItem ) == SFX_ITEM_SET && pItem )
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
|
|
|
|
while ( aIt != aPropVector.end())
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
if ( aIt->nWID == nWhich )
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
|
|
|
::com::sun::star::uno::Any aVal;
|
2009-06-03 11:26:39 +00:00
|
|
|
pItem->QueryValue( aVal, aIt->nMemberId );
|
2009-02-17 09:19:30 +00:00
|
|
|
aProperties.realloc( nCount + 1 );
|
2009-06-03 11:26:39 +00:00
|
|
|
aProperties[ nCount ].Name = aIt->sName;
|
2009-02-17 09:19:30 +00:00
|
|
|
aProperties[ nCount ].Value <<= aVal;
|
|
|
|
++nCount;
|
|
|
|
}
|
2009-06-03 11:26:39 +00:00
|
|
|
++aIt;
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "attribute" ) ), aChangeRanges, aProperties );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
StartFormatArea();
|
|
|
|
}
|
|
|
|
|
2000-11-24 17:07:45 +00:00
|
|
|
void ScViewFunc::ApplyUserItemSet( const SfxItemSet& rItemSet )
|
|
|
|
{
|
|
|
|
// ItemSet from UI, may have different pool
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyNotBecauseOfMatrix;
|
2000-11-24 17:07:45 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScPatternAttr aNewAttrs( GetViewData()->GetDocument()->GetPool() );
|
|
|
|
SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
|
2011-03-10 16:55:21 -05:00
|
|
|
rNewSet.Put( rItemSet, false );
|
2000-11-24 17:07:45 +00:00
|
|
|
ApplySelectionPattern( aNewAttrs );
|
|
|
|
|
|
|
|
AdjustBlockHeight();
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
const SfxStyleSheet* ScViewFunc::GetStyleSheetFromMarked()
|
|
|
|
{
|
2004-09-09 08:31:12 +00:00
|
|
|
// Don't use UnmarkFiltered in slot state functions, for performance reasons.
|
|
|
|
// The displayed state is always that of the whole selection including filtered rows.
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
const ScStyleSheet* pSheet = NULL;
|
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = pViewData->GetDocument();
|
|
|
|
ScMarkData& rMark = pViewData->GetMarkData();
|
|
|
|
|
|
|
|
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
|
2004-09-09 08:31:12 +00:00
|
|
|
pSheet = pDoc->GetSelectionStyle( rMark ); // MarkToMulti isn't necessary
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
pSheet = pDoc->GetStyle( pViewData->GetCurX(),
|
|
|
|
pViewData->GetCurY(),
|
|
|
|
pViewData->GetTabNo() );
|
|
|
|
|
|
|
|
return pSheet;
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, sal_Bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// nur wegen Matrix nicht editierbar? Attribute trotzdem ok
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !pStyleSheet) return;
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
ScDocShell* pDocSh = pViewData->GetDocShell();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2004-09-09 08:31:12 +00:00
|
|
|
ScMarkData aFuncMark( pViewData->GetMarkData() ); // local copy for UnmarkFiltered
|
|
|
|
ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bRecord && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2004-09-09 08:31:12 +00:00
|
|
|
if ( aFuncMark.IsMarked() || aFuncMark.IsMultiMarked() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScRange aMarkRange;
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToMulti();
|
|
|
|
aFuncMark.GetMultiMarkArea( aMarkRange );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTab = pViewData->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
|
|
|
pUndoDoc->InitUndo( pDoc, nTab, nTab );
|
2004-06-04 11:11:19 +00:00
|
|
|
for (SCTAB i=0; i<nTabCount; i++)
|
2004-09-09 08:31:12 +00:00
|
|
|
if (i != nTab && aFuncMark.GetTableSelect(i))
|
2000-09-18 16:07:07 +00:00
|
|
|
pUndoDoc->AddUndoTab( i, i );
|
|
|
|
|
|
|
|
ScRange aCopyRange = aMarkRange;
|
|
|
|
aCopyRange.aStart.SetTab(0);
|
|
|
|
aCopyRange.aEnd.SetTab(nTabCount-1);
|
2011-01-17 13:20:22 +01:00
|
|
|
pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, sal_True, pUndoDoc, &aFuncMark );
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToMulti();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
String aName = pStyleSheet->GetName();
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2004-09-09 08:31:12 +00:00
|
|
|
new ScUndoSelectionStyle( pDocSh, aFuncMark, aMarkRange, aName, pUndoDoc ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 08:31:12 +00:00
|
|
|
pDoc->ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, aFuncMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (!AdjustBlockHeight())
|
|
|
|
pViewData->GetDocShell()->PostPaint( aMarkRange, PAINT_GRID );
|
|
|
|
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToSimple();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = pViewData->GetCurX();
|
|
|
|
SCROW nRow = pViewData->GetCurY();
|
|
|
|
SCTAB nTab = pViewData->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{
|
|
|
|
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
|
|
|
pUndoDoc->InitUndo( pDoc, nTab, nTab );
|
2004-06-04 11:11:19 +00:00
|
|
|
for (SCTAB i=0; i<nTabCount; i++)
|
2004-09-09 08:31:12 +00:00
|
|
|
if (i != nTab && aFuncMark.GetTableSelect(i))
|
2000-09-18 16:07:07 +00:00
|
|
|
pUndoDoc->AddUndoTab( i, i );
|
|
|
|
|
|
|
|
ScRange aCopyRange( nCol, nRow, 0, nCol, nRow, nTabCount-1 );
|
2011-03-10 16:55:21 -05:00
|
|
|
pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, false, pUndoDoc );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScRange aMarkRange ( nCol, nRow, nTab );
|
2004-09-09 08:31:12 +00:00
|
|
|
ScMarkData aUndoMark = aFuncMark;
|
2000-09-18 16:07:07 +00:00
|
|
|
aUndoMark.SetMultiMarkArea( aMarkRange );
|
|
|
|
|
|
|
|
String aName = pStyleSheet->GetName();
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
|
|
|
new ScUndoSelectionStyle( pDocSh, aUndoMark, aMarkRange, aName, pUndoDoc ) );
|
|
|
|
}
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
for (SCTAB i=0; i<nTabCount; i++)
|
2004-09-09 08:31:12 +00:00
|
|
|
if (aFuncMark.GetTableSelect(i))
|
2000-09-18 16:07:07 +00:00
|
|
|
pDoc->ApplyStyle( nCol, nRow, i, (ScStyleSheet&)*pStyleSheet );
|
|
|
|
|
|
|
|
if (!AdjustBlockHeight())
|
|
|
|
pViewData->GetDocShell()->PostPaintCell( nCol, nRow, nTab );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
|
|
|
|
StartFormatArea();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-03 12:37:26 +01:00
|
|
|
void ScViewFunc::RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !pStyleSheet) return;
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = pViewData->GetDocument();
|
|
|
|
ScDocShell* pDocSh = pViewData->GetDocShell();
|
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
|
|
|
VirtualDevice aVirtDev;
|
|
|
|
aVirtDev.SetMapMode(MAP_PIXEL);
|
2011-01-17 13:20:22 +01:00
|
|
|
pDoc->StyleSheetChanged( pStyleSheet, sal_True, &aVirtDev,
|
2000-09-18 16:07:07 +00:00
|
|
|
pViewData->GetPPTX(),
|
|
|
|
pViewData->GetPPTY(),
|
|
|
|
pViewData->GetZoomX(),
|
|
|
|
pViewData->GetZoomY() );
|
|
|
|
|
|
|
|
pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
|
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
|
|
|
|
ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
|
|
|
|
if (pHdl)
|
|
|
|
pHdl->ForgetLastPattern();
|
|
|
|
}
|
|
|
|
|
2010-11-03 12:37:26 +01:00
|
|
|
void ScViewFunc::UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !pStyleSheet) return;
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = pViewData->GetDocument();
|
|
|
|
ScDocShell* pDocSh = pViewData->GetDocShell();
|
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
|
|
|
VirtualDevice aVirtDev;
|
|
|
|
aVirtDev.SetMapMode(MAP_PIXEL);
|
2011-03-10 16:55:21 -05:00
|
|
|
pDoc->StyleSheetChanged( pStyleSheet, false, &aVirtDev,
|
2000-09-18 16:07:07 +00:00
|
|
|
pViewData->GetPPTX(),
|
|
|
|
pViewData->GetPPTY(),
|
|
|
|
pViewData->GetZoomX(),
|
|
|
|
pViewData->GetZoomY() );
|
|
|
|
|
|
|
|
pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
|
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
|
|
|
|
ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
|
|
|
|
if (pHdl)
|
|
|
|
pHdl->ForgetLastPattern();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Zellen einfuegen - Undo OK
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool ScViewFunc::InsertCells( InsCellCmd eCmd, sal_Bool bRecord, sal_Bool bPartOfPaste )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScRange aRange;
|
2008-04-18 10:50:48 +00:00
|
|
|
if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
2008-12-11 08:36:38 +00:00
|
|
|
const ScMarkData& rMark = GetViewData()->GetMarkData();
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bSuccess = pDocSh->GetDocFunc().InsertCells( aRange, &rMark, eCmd, bRecord, false, bPartOfPaste );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bSuccess)
|
|
|
|
{
|
|
|
|
pDocSh->UpdateOle(GetViewData());
|
|
|
|
CellContentChanged();
|
2009-02-17 09:19:30 +00:00
|
|
|
|
|
|
|
// #i97876# Spreadsheet data changes are not notified
|
|
|
|
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
|
|
|
|
if ( pModelObj && pModelObj->HasChangesListeners() )
|
|
|
|
{
|
|
|
|
if ( eCmd == INS_INSROWS || eCmd == INS_INSCOLS )
|
|
|
|
{
|
|
|
|
ScRangeList aChangeRanges;
|
|
|
|
aChangeRanges.Append( aRange );
|
|
|
|
::rtl::OUString aOperation = ( eCmd == INS_INSROWS ?
|
|
|
|
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert-rows" ) ) :
|
|
|
|
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert-columns" ) ) );
|
|
|
|
pModelObj->NotifyChanges( aOperation, aChangeRanges );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_NOMULTISELECT);
|
2011-03-10 16:55:21 -05:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Zellen loeschen - Undo OK
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::DeleteCells( DelCellCmd eCmd, sal_Bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScRange aRange;
|
2008-04-18 10:50:48 +00:00
|
|
|
if ( GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
2008-12-11 08:36:38 +00:00
|
|
|
const ScMarkData& rMark = GetViewData()->GetMarkData();
|
2009-02-11 15:19:01 +00:00
|
|
|
|
|
|
|
// #i94841# [Collaboration] When deleting rows is rejected, the content is sometimes wrong
|
|
|
|
if ( pDocSh->IsDocShared() && ( eCmd == DEL_DELROWS || eCmd == DEL_DELCOLS ) )
|
|
|
|
{
|
|
|
|
ScRange aDelRange( aRange.aStart );
|
|
|
|
SCCOLROW nCount = 0;
|
|
|
|
if ( eCmd == DEL_DELROWS )
|
|
|
|
{
|
|
|
|
nCount = sal::static_int_cast< SCCOLROW >( aRange.aEnd.Row() - aRange.aStart.Row() + 1 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nCount = sal::static_int_cast< SCCOLROW >( aRange.aEnd.Col() - aRange.aStart.Col() + 1 );
|
|
|
|
}
|
|
|
|
while ( nCount > 0 )
|
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
pDocSh->GetDocFunc().DeleteCells( aDelRange, &rMark, eCmd, bRecord, false );
|
2009-02-11 15:19:01 +00:00
|
|
|
--nCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
pDocSh->GetDocFunc().DeleteCells( aRange, &rMark, eCmd, bRecord, false );
|
2009-02-11 15:19:01 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pDocSh->UpdateOle(GetViewData());
|
|
|
|
CellContentChanged();
|
|
|
|
|
2009-02-17 09:19:30 +00:00
|
|
|
// #i97876# Spreadsheet data changes are not notified
|
|
|
|
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
|
|
|
|
if ( pModelObj && pModelObj->HasChangesListeners() )
|
|
|
|
{
|
|
|
|
if ( eCmd == DEL_DELROWS || eCmd == DEL_DELCOLS )
|
|
|
|
{
|
|
|
|
ScRangeList aChangeRanges;
|
|
|
|
aChangeRanges.Append( aRange );
|
|
|
|
::rtl::OUString aOperation = ( eCmd == DEL_DELROWS ?
|
|
|
|
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete-rows" ) ) :
|
|
|
|
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete-columns" ) ) );
|
|
|
|
pModelObj->NotifyChanges( aOperation, aChangeRanges );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-02 21:32:00 +01:00
|
|
|
// Cursor direkt hinter den geloeschten Bereich setzen
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCurX = GetViewData()->GetCurX();
|
|
|
|
SCROW nCurY = GetViewData()->GetCurY();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( eCmd==DEL_CELLSLEFT || eCmd==DEL_DELCOLS )
|
|
|
|
nCurX = aRange.aStart.Col();
|
|
|
|
else
|
|
|
|
nCurY = aRange.aStart.Row();
|
|
|
|
SetCursor( nCurX, nCurY );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (eCmd == DEL_DELCOLS)
|
2011-03-10 16:55:21 -05:00
|
|
|
DeleteMulti( false, bRecord );
|
2000-09-18 16:07:07 +00:00
|
|
|
else if (eCmd == DEL_DELROWS)
|
2011-01-17 13:20:22 +01:00
|
|
|
DeleteMulti( sal_True, bRecord );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
ErrorMessage(STR_NOMULTISELECT);
|
|
|
|
}
|
|
|
|
|
|
|
|
Unmark();
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::DeleteMulti( sal_Bool bRows, sal_Bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2004-09-09 08:31:12 +00:00
|
|
|
ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered
|
|
|
|
ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
|
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bRecord && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW* pRanges = new SCCOLROW[MAXCOLROWCOUNT];
|
2004-09-09 08:31:12 +00:00
|
|
|
SCCOLROW nRangeCnt = bRows ? aFuncMark.GetMarkRowRanges( pRanges ) :
|
|
|
|
aFuncMark.GetMarkColumnRanges( pRanges );
|
2004-06-04 11:11:19 +00:00
|
|
|
if (nRangeCnt == 0)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
pRanges[0] = pRanges[1] = bRows ? static_cast<SCCOLROW>(GetViewData()->GetCurY()) : static_cast<SCCOLROW>(GetViewData()->GetCurX());
|
2000-09-18 16:07:07 +00:00
|
|
|
nRangeCnt = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test ob erlaubt
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW* pOneRange = pRanges;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nErrorId = 0;
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bNeedRefresh = false;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW nRangeNo;
|
2005-10-21 11:10:08 +00:00
|
|
|
for (nRangeNo=0; nRangeNo<nRangeCnt && !nErrorId; nRangeNo++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW nStart = *(pOneRange++);
|
|
|
|
SCCOLROW nEnd = *(pOneRange++);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-10-21 11:10:08 +00:00
|
|
|
SCCOL nStartCol, nEndCol;
|
|
|
|
SCROW nStartRow, nEndRow;
|
|
|
|
if ( bRows )
|
|
|
|
{
|
|
|
|
nStartCol = 0;
|
|
|
|
nEndCol = MAXCOL;
|
|
|
|
nStartRow = static_cast<SCROW>(nStart);
|
|
|
|
nEndRow = static_cast<SCROW>(nEnd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nStartCol = static_cast<SCCOL>(nStart);
|
|
|
|
nEndCol = static_cast<SCCOL>(nEnd);
|
|
|
|
nStartRow = 0;
|
|
|
|
nEndRow = MAXROW;
|
|
|
|
}
|
|
|
|
|
|
|
|
// cell protection (only needed for first range, as all following cells are moved)
|
|
|
|
if ( nRangeNo == 0 )
|
|
|
|
{
|
|
|
|
// test to the end of the sheet
|
|
|
|
ScEditableTester aTester( pDoc, nTab, nStartCol, nStartRow, MAXCOL, MAXROW );
|
|
|
|
if (!aTester.IsEditable())
|
|
|
|
nErrorId = aTester.GetMessageId();
|
|
|
|
}
|
|
|
|
|
|
|
|
// merged cells
|
|
|
|
SCCOL nMergeStartX = nStartCol;
|
|
|
|
SCROW nMergeStartY = nStartRow;
|
|
|
|
SCCOL nMergeEndX = nEndCol;
|
|
|
|
SCROW nMergeEndY = nEndRow;
|
|
|
|
pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
|
|
|
|
pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
|
|
|
|
|
|
|
|
if ( nMergeStartX != nStartCol || nMergeStartY != nStartRow )
|
|
|
|
{
|
|
|
|
// Disallow deleting parts of a merged cell.
|
|
|
|
// Deleting the start is allowed (merge is removed), so the end doesn't have to be checked.
|
|
|
|
|
|
|
|
nErrorId = STR_MSSG_DELETECELLS_0;
|
|
|
|
}
|
|
|
|
if ( nMergeEndX != nEndCol || nMergeEndY != nEndRow )
|
|
|
|
{
|
|
|
|
// detect if the start of a merged cell is deleted, so the merge flags can be refreshed
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
bNeedRefresh = sal_True;
|
2005-10-21 11:10:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nErrorId )
|
|
|
|
{
|
|
|
|
ErrorMessage( nErrorId );
|
|
|
|
delete[] pRanges;
|
|
|
|
return;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ausfuehren
|
|
|
|
|
|
|
|
WaitObject aWait( GetFrameWin() ); // wichtig wegen TrackFormulas bei UpdateReference
|
|
|
|
|
|
|
|
ScDocument* pUndoDoc = NULL;
|
|
|
|
ScRefUndoData* pUndoData = NULL;
|
|
|
|
if (bRecord)
|
|
|
|
{
|
|
|
|
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
|
|
|
pUndoDoc->InitUndo( pDoc, nTab, nTab, !bRows, bRows ); // Zeilenhoehen
|
|
|
|
|
|
|
|
pOneRange = pRanges;
|
|
|
|
for (nRangeNo=0; nRangeNo<nRangeCnt; nRangeNo++)
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW nStart = *(pOneRange++);
|
|
|
|
SCCOLROW nEnd = *(pOneRange++);
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bRows)
|
2011-03-10 16:55:21 -05:00
|
|
|
pDoc->CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, IDF_ALL,false,pUndoDoc );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2004-06-04 11:11:19 +00:00
|
|
|
pDoc->CopyToDocument( static_cast<SCCOL>(nStart),0,nTab,
|
|
|
|
static_cast<SCCOL>(nEnd),MAXROW,nTab,
|
2011-03-10 16:55:21 -05:00
|
|
|
IDF_ALL,false,pUndoDoc );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// alle Formeln wegen Referenzen
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
2011-03-10 16:55:21 -05:00
|
|
|
pUndoDoc->AddUndoTab( 0, nTabCount-1, false, false );
|
|
|
|
pDoc->CopyToDocument( 0,0,0, MAXCOL,MAXROW,MAXTAB, IDF_FORMULA,false,pUndoDoc );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pUndoData = new ScRefUndoData( pDoc );
|
|
|
|
|
|
|
|
pDoc->BeginDrawUndo();
|
|
|
|
}
|
|
|
|
|
|
|
|
pOneRange = &pRanges[2*nRangeCnt]; // rueckwaerts
|
2005-10-21 11:10:08 +00:00
|
|
|
for (nRangeNo=0; nRangeNo<nRangeCnt; nRangeNo++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW nEnd = *(--pOneRange);
|
|
|
|
SCCOLROW nStart = *(--pOneRange);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (bRows)
|
2004-06-04 11:11:19 +00:00
|
|
|
pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, nStart, static_cast<SCSIZE>(nEnd-nStart+1) );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2004-06-04 11:11:19 +00:00
|
|
|
pDoc->DeleteCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2005-10-21 11:10:08 +00:00
|
|
|
if (bNeedRefresh)
|
|
|
|
{
|
|
|
|
SCCOLROW nFirstStart = pRanges[0];
|
|
|
|
SCCOL nStartCol = bRows ? 0 : static_cast<SCCOL>(nFirstStart);
|
|
|
|
SCROW nStartRow = bRows ? static_cast<SCROW>(nFirstStart) : 0;
|
|
|
|
SCCOL nEndCol = MAXCOL;
|
|
|
|
SCROW nEndRow = MAXROW;
|
|
|
|
|
|
|
|
pDoc->RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER );
|
2011-01-17 13:20:22 +01:00
|
|
|
pDoc->ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, sal_True );
|
2005-10-21 11:10:08 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bRecord)
|
|
|
|
{
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2005-10-21 11:10:08 +00:00
|
|
|
new ScUndoDeleteMulti( pDocSh, bRows, bNeedRefresh, nTab, pRanges, nRangeCnt,
|
2000-09-18 16:07:07 +00:00
|
|
|
pUndoDoc, pUndoData ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!AdjustRowHeight(0, MAXROW))
|
2008-12-11 07:05:03 +00:00
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bRows)
|
|
|
|
pDocSh->PostPaint( 0,pRanges[0],nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT );
|
|
|
|
else
|
2004-06-04 11:11:19 +00:00
|
|
|
pDocSh->PostPaint( static_cast<SCCOL>(pRanges[0]),0,nTab,
|
|
|
|
MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_TOP );
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
|
|
|
|
CellContentChanged();
|
|
|
|
|
2011-03-02 21:32:00 +01:00
|
|
|
// Cursor direkt hinter den ersten geloeschten Bereich setzen
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCurX = GetViewData()->GetCurX();
|
|
|
|
SCROW nCurY = GetViewData()->GetCurY();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bRows )
|
|
|
|
nCurY = pRanges[0];
|
|
|
|
else
|
2004-06-04 11:11:19 +00:00
|
|
|
nCurX = static_cast<SCCOL>(pRanges[0]);
|
2000-09-18 16:07:07 +00:00
|
|
|
SetCursor( nCurX, nCurY );
|
|
|
|
|
|
|
|
delete[] pRanges;
|
2005-09-28 11:20:28 +00:00
|
|
|
|
|
|
|
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Inhalte loeschen
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::DeleteContents( sal_uInt16 nFlags, sal_Bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-28 11:13:12 -04:00
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
pViewData->SetPasteMode( SC_PASTE_NONE );
|
|
|
|
pViewData->GetViewShell()->UpdateCopySourceOverlay();
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// nur wegen Matrix nicht editierbar? Attribute trotzdem ok
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyNotBecauseOfMatrix;
|
|
|
|
sal_Bool bEditable = SelectionEditable( &bOnlyNotBecauseOfMatrix );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !bEditable )
|
|
|
|
{
|
|
|
|
if ( !(bOnlyNotBecauseOfMatrix &&
|
|
|
|
((nFlags & (IDF_ATTRIB | IDF_EDITATTR)) == nFlags)) )
|
|
|
|
{
|
2002-11-20 13:36:29 +00:00
|
|
|
ErrorMessage(bOnlyNotBecauseOfMatrix ? STR_MATRIXFRAGMENTERR : STR_PROTECTIONERR);
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ScRange aMarkRange;
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bSimple = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
2004-09-09 08:31:12 +00:00
|
|
|
ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered
|
|
|
|
ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
|
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bRecord && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2004-09-09 08:31:12 +00:00
|
|
|
if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
aMarkRange.aStart.SetCol(GetViewData()->GetCurX());
|
|
|
|
aMarkRange.aStart.SetRow(GetViewData()->GetCurY());
|
|
|
|
aMarkRange.aStart.SetTab(GetViewData()->GetTabNo());
|
|
|
|
aMarkRange.aEnd = aMarkRange.aStart;
|
|
|
|
if ( pDoc->HasAttrib( aMarkRange, HASATTR_MERGED ) )
|
|
|
|
{
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.SetMarkArea( aMarkRange );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2011-01-17 13:20:22 +01:00
|
|
|
bSimple = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
aFuncMark.SetMarking(false); // for MarkToMulti
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToSimple(); // before bMulti test below
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT( aFuncMark.IsMarked() || aFuncMark.IsMultiMarked() || bSimple, "delete what?" );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocument* pUndoDoc = NULL;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bMulti = !bSimple && aFuncMark.IsMultiMarked();
|
2000-09-18 16:07:07 +00:00
|
|
|
if (!bSimple)
|
|
|
|
{
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToMulti();
|
|
|
|
aFuncMark.GetMultiMarkArea( aMarkRange );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
ScRange aExtendedRange(aMarkRange);
|
|
|
|
if (!bSimple)
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
if ( pDoc->ExtendMerge( aExtendedRange, sal_True ) )
|
2011-03-10 16:55:21 -05:00
|
|
|
bMulti = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// keine Objekte auf geschuetzten Tabellen
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bObjects = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nFlags & IDF_OBJECTS )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bObjects = sal_True;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
|
|
|
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
|
2004-09-09 08:31:12 +00:00
|
|
|
if (aFuncMark.GetTableSelect(nTab) && pDoc->IsTabProtected(nTab))
|
2011-03-10 16:55:21 -05:00
|
|
|
bObjects = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nExtFlags = 0; // extra flags are needed only if attributes are deleted
|
2004-02-03 12:08:40 +00:00
|
|
|
if ( nFlags & IDF_ATTRIB )
|
|
|
|
pDocSh->UpdatePaintExt( nExtFlags, aMarkRange );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Reihenfolge:
|
|
|
|
// 1) BeginDrawUndo
|
|
|
|
// 2) Objekte loeschen (DrawUndo wird gefuellt)
|
|
|
|
// 3) Inhalte fuer Undo kopieren
|
|
|
|
// 4) Inhalte loeschen
|
|
|
|
// 5) Undo-Aktion anlegen
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bDrawUndo = bObjects || ( nFlags & IDF_NOTE ); // needed for shown notes
|
2006-10-27 14:29:41 +00:00
|
|
|
if ( bDrawUndo && bRecord )
|
|
|
|
pDoc->BeginDrawUndo();
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bObjects)
|
|
|
|
{
|
|
|
|
if (bMulti)
|
2004-09-09 08:31:12 +00:00
|
|
|
pDoc->DeleteObjectsInSelection( aFuncMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
pDoc->DeleteObjectsInArea( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
|
|
|
|
/*!*/ aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(),
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{
|
|
|
|
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTab = aMarkRange.aStart.Tab();
|
2000-09-18 16:07:07 +00:00
|
|
|
pUndoDoc->InitUndo( pDoc, nTab, nTab );
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
|
|
|
for (SCTAB i=0; i<nTabCount; i++)
|
2004-09-09 08:31:12 +00:00
|
|
|
if (i != nTab && aFuncMark.GetTableSelect(i))
|
2000-09-18 16:07:07 +00:00
|
|
|
pUndoDoc->AddUndoTab( i, i );
|
|
|
|
ScRange aCopyRange = aExtendedRange;
|
|
|
|
aCopyRange.aStart.SetTab(0);
|
|
|
|
aCopyRange.aEnd.SetTab(nTabCount-1);
|
|
|
|
|
|
|
|
// bei "Format/Standard" alle Attribute kopieren, weil CopyToDocument
|
|
|
|
// nur mit IDF_HARDATTR zu langsam ist:
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nUndoDocFlags = nFlags;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (nFlags & IDF_ATTRIB)
|
|
|
|
nUndoDocFlags |= IDF_ATTRIB;
|
|
|
|
if (nFlags & IDF_EDITATTR) // Edit-Engine-Attribute
|
|
|
|
nUndoDocFlags |= IDF_STRING; // -> Zellen werden geaendert
|
|
|
|
if (nFlags & IDF_NOTE)
|
2011-03-02 21:32:00 +01:00
|
|
|
nUndoDocFlags |= IDF_CONTENTS; // copy all cells with their notes
|
2009-03-02 14:19:13 +00:00
|
|
|
// do not copy note captions to undo document
|
|
|
|
nUndoDocFlags |= IDF_NOCAPTIONS;
|
2004-09-09 08:31:12 +00:00
|
|
|
pDoc->CopyToDocument( aCopyRange, nUndoDocFlags, bMulti, pUndoDoc, &aFuncMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HideAllCursors(); // falls Zusammenfassung aufgehoben wird
|
|
|
|
if (bSimple)
|
|
|
|
pDoc->DeleteArea( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
|
|
|
|
aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(),
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark, nFlags );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2004-09-09 08:31:12 +00:00
|
|
|
pDoc->DeleteSelection( nFlags, aFuncMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2004-09-09 08:31:12 +00:00
|
|
|
new ScUndoDeleteContents( pDocSh, aFuncMark, aExtendedRange,
|
2006-10-27 14:29:41 +00:00
|
|
|
pUndoDoc, bMulti, nFlags, bDrawUndo ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!AdjustRowHeight( aExtendedRange.aStart.Row(), aExtendedRange.aEnd.Row() ))
|
|
|
|
pDocSh->PostPaint( aExtendedRange, PAINT_GRID, nExtFlags );
|
|
|
|
|
|
|
|
pDocSh->UpdateOle(GetViewData());
|
2009-02-17 09:19:30 +00:00
|
|
|
|
|
|
|
// #i97876# Spreadsheet data changes are not notified
|
|
|
|
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
|
|
|
|
if ( pModelObj && pModelObj->HasChangesListeners() )
|
|
|
|
{
|
|
|
|
ScRangeList aChangeRanges;
|
|
|
|
if ( bSimple )
|
|
|
|
{
|
|
|
|
aChangeRanges.Append( aMarkRange );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
aFuncMark.FillRangeListWithMarks( &aChangeRanges, false );
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
|
|
|
pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
CellContentChanged();
|
|
|
|
ShowAllCursors();
|
|
|
|
|
|
|
|
if ( nFlags & IDF_ATTRIB )
|
|
|
|
{
|
|
|
|
if ( nFlags & IDF_CONTENTS )
|
|
|
|
ForgetFormatArea();
|
|
|
|
else
|
|
|
|
StartFormatArea(); // Attribute loeschen ist auch Attributierung
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Spaltenbreiten/Zeilenhoehen (ueber Header) - Undo OK
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::SetWidthOrHeight( sal_Bool bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges,
|
|
|
|
ScSizeMode eMode, sal_uInt16 nSizeTwips,
|
|
|
|
sal_Bool bRecord, sal_Bool bPaint, ScMarkData* pMarkData )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
if (nRangeCnt == 0)
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
2000-11-16 12:13:46 +00:00
|
|
|
// use view's mark if none specified
|
|
|
|
if ( !pMarkData )
|
|
|
|
pMarkData = &GetViewData()->GetMarkData();
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
|
|
|
SCTAB nFirstTab = pMarkData->GetFirstSelected();
|
|
|
|
SCTAB nCurTab = GetViewData()->GetTabNo();
|
|
|
|
SCTAB nTab;
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bRecord && !pDoc->IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bAllowed = sal_True;
|
2000-11-16 12:13:46 +00:00
|
|
|
for (nTab=0; nTab<nTabCount && bAllowed; nTab++)
|
|
|
|
if (pMarkData->GetTableSelect(nTab))
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
for ( SCCOLROW i=0; i<nRangeCnt && bAllowed; i++ )
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyMatrix;
|
2000-11-16 12:13:46 +00:00
|
|
|
if (bWidth)
|
|
|
|
bAllowed = pDoc->IsBlockEditable( nTab,
|
2004-06-04 11:11:19 +00:00
|
|
|
static_cast<SCCOL>(pRanges[2*i]),0,
|
|
|
|
static_cast<SCCOL>(pRanges[2*i+1]),MAXROW,
|
|
|
|
&bOnlyMatrix ) || bOnlyMatrix;
|
2000-11-16 12:13:46 +00:00
|
|
|
else
|
2004-06-04 11:11:19 +00:00
|
|
|
bAllowed = pDoc->IsBlockEditable( nTab, 0,pRanges[2*i],
|
|
|
|
MAXCOL,pRanges[2*i+1], &bOnlyMatrix ) ||
|
|
|
|
bOnlyMatrix;
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
|
|
|
}
|
2010-09-15 11:44:06 +02:00
|
|
|
|
|
|
|
// Allow users to resize cols/rows in readonly docs despite the r/o state.
|
|
|
|
// It is frustrating to be unable to see content in mis-sized cells.
|
|
|
|
if( !bAllowed && !pDocSh->IsReadOnly() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW nStart = pRanges[0];
|
|
|
|
SCCOLROW nEnd = pRanges[2*nRangeCnt-1];
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bFormula = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( eMode == SC_SIZE_OPTIMAL )
|
|
|
|
{
|
|
|
|
const ScViewOptions& rOpts = GetViewData()->GetOptions();
|
|
|
|
bFormula = rOpts.GetOption( VOPT_FORMULAS );
|
|
|
|
}
|
|
|
|
|
|
|
|
ScDocument* pUndoDoc = NULL;
|
|
|
|
ScOutlineTable* pUndoTab = NULL;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW* pUndoRanges = NULL;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{
|
|
|
|
pDoc->BeginDrawUndo(); // Drawing Updates
|
|
|
|
|
|
|
|
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
2000-11-16 12:13:46 +00:00
|
|
|
for (nTab=0; nTab<nTabCount; nTab++)
|
|
|
|
if (pMarkData->GetTableSelect(nTab))
|
|
|
|
{
|
|
|
|
if (bWidth)
|
|
|
|
{
|
|
|
|
if ( nTab == nFirstTab )
|
2011-03-10 16:55:21 -05:00
|
|
|
pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, false );
|
2000-11-16 12:13:46 +00:00
|
|
|
else
|
2011-03-10 16:55:21 -05:00
|
|
|
pUndoDoc->AddUndoTab( nTab, nTab, sal_True, false );
|
2004-06-04 11:11:19 +00:00
|
|
|
pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
|
|
|
|
static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE,
|
2011-03-10 16:55:21 -05:00
|
|
|
false, pUndoDoc );
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( nTab == nFirstTab )
|
2011-03-10 16:55:21 -05:00
|
|
|
pUndoDoc->InitUndo( pDoc, nTab, nTab, false, sal_True );
|
2000-11-16 12:13:46 +00:00
|
|
|
else
|
2011-03-10 16:55:21 -05:00
|
|
|
pUndoDoc->AddUndoTab( nTab, nTab, false, sal_True );
|
|
|
|
pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
pUndoRanges = new SCCOLROW[ 2*nRangeCnt ];
|
|
|
|
memmove( pUndoRanges, pRanges, 2*nRangeCnt*sizeof(SCCOLROW) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-16 12:13:46 +00:00
|
|
|
//! outlines from all tables?
|
|
|
|
ScOutlineTable* pTable = pDoc->GetOutlineTable( nCurTab );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (pTable)
|
|
|
|
pUndoTab = new ScOutlineTable( *pTable );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
|
2000-11-16 12:13:46 +00:00
|
|
|
pMarkData->MarkToMulti();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bShow = nSizeTwips > 0 || eMode != SC_SIZE_DIRECT;
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bOutline = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-16 12:13:46 +00:00
|
|
|
for (nTab=0; nTab<nTabCount; nTab++)
|
|
|
|
if (pMarkData->GetTableSelect(nTab))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
const SCCOLROW* pTabRanges = pRanges;
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2009-07-03 12:42:53 +00:00
|
|
|
pDoc->InitializeNoteCaptions( nTab );
|
2004-06-04 11:11:19 +00:00
|
|
|
for (SCCOLROW nRangeNo=0; nRangeNo<nRangeCnt; nRangeNo++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW nStartNo = *(pTabRanges++);
|
|
|
|
SCCOLROW nEndNo = *(pTabRanges++);
|
2000-11-16 12:13:46 +00:00
|
|
|
|
|
|
|
if ( !bWidth ) // Hoehen immer blockweise
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-11-16 12:13:46 +00:00
|
|
|
if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bAll = ( eMode==SC_SIZE_OPTIMAL );
|
2000-11-16 12:13:46 +00:00
|
|
|
if (!bAll)
|
|
|
|
{
|
|
|
|
// fuer alle eingeblendeten CR_MANUALSIZE loeschen,
|
|
|
|
// dann SetOptimalHeight mit bShrink = FALSE
|
2010-06-23 13:38:34 +02:00
|
|
|
for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow)
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2010-06-23 13:38:34 +02:00
|
|
|
SCROW nLastRow = nRow;
|
|
|
|
if (pDoc->RowHidden(nRow, nTab, NULL, &nLastRow))
|
2004-08-20 08:19:24 +00:00
|
|
|
{
|
2010-06-23 13:38:34 +02:00
|
|
|
nRow = nLastRow;
|
|
|
|
continue;
|
2004-08-20 08:19:24 +00:00
|
|
|
}
|
2010-06-23 13:38:34 +02:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt8 nOld = pDoc->GetRowFlags(nRow, nTab);
|
2010-06-23 13:38:34 +02:00
|
|
|
if (nOld & CR_MANUALSIZE)
|
|
|
|
pDoc->SetRowFlags(nRow, nTab, nOld & ~CR_MANUALSIZE);
|
|
|
|
}
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
2001-05-11 16:11:53 +00:00
|
|
|
|
|
|
|
double nPPTX = GetViewData()->GetPPTX();
|
|
|
|
double nPPTY = GetViewData()->GetPPTY();
|
|
|
|
Fraction aZoomX = GetViewData()->GetZoomX();
|
|
|
|
Fraction aZoomY = GetViewData()->GetZoomY();
|
|
|
|
|
|
|
|
ScSizeDeviceProvider aProv(pDocSh);
|
|
|
|
if (aProv.IsPrinter())
|
|
|
|
{
|
|
|
|
nPPTX = aProv.GetPPTX();
|
|
|
|
nPPTY = aProv.GetPPTY();
|
|
|
|
aZoomX = aZoomY = Fraction( 1, 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
pDoc->SetOptimalHeight( nStartNo, nEndNo, nTab, nSizeTwips, aProv.GetDevice(),
|
|
|
|
nPPTX, nPPTY, aZoomX, aZoomY, bAll );
|
2000-11-16 12:13:46 +00:00
|
|
|
if (bAll)
|
2011-01-17 13:20:22 +01:00
|
|
|
pDoc->ShowRows( nStartNo, nEndNo, nTab, sal_True );
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
// Manual-Flag wird bei bAll=sal_True schon in SetOptimalHeight gesetzt
|
2000-11-16 12:13:46 +00:00
|
|
|
// (an bei Extra-Height, sonst aus).
|
|
|
|
}
|
|
|
|
else if ( eMode==SC_SIZE_DIRECT )
|
|
|
|
{
|
|
|
|
if (nSizeTwips)
|
2003-04-08 15:34:56 +00:00
|
|
|
{
|
2000-11-16 12:13:46 +00:00
|
|
|
pDoc->SetRowHeightRange( nStartNo, nEndNo, nTab, nSizeTwips );
|
2011-01-17 13:20:22 +01:00
|
|
|
pDoc->SetManualHeight( nStartNo, nEndNo, nTab, sal_True ); // height was set manually
|
2003-04-08 15:34:56 +00:00
|
|
|
}
|
2000-11-16 12:13:46 +00:00
|
|
|
pDoc->ShowRows( nStartNo, nEndNo, nTab, nSizeTwips != 0 );
|
|
|
|
}
|
|
|
|
else if ( eMode==SC_SIZE_SHOW )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
pDoc->ShowRows( nStartNo, nEndNo, nTab, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2000-11-16 12:13:46 +00:00
|
|
|
else // Spaltenbreiten
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
for (SCCOL nCol=static_cast<SCCOL>(nStartNo); nCol<=static_cast<SCCOL>(nEndNo); nCol++)
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2010-06-23 13:38:34 +02:00
|
|
|
if ( eMode != SC_SIZE_VISOPT || !pDoc->ColHidden(nCol, nTab) )
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nThisSize = nSizeTwips;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-16 12:13:46 +00:00
|
|
|
if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
|
|
|
|
nThisSize = nSizeTwips + GetOptimalColWidth( nCol, nTab, bFormula );
|
|
|
|
if ( nThisSize )
|
|
|
|
pDoc->SetColWidth( nCol, nTab, nThisSize );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-16 12:13:46 +00:00
|
|
|
pDoc->ShowCol( nCol, nTab, bShow );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Outline anpassen
|
|
|
|
|
|
|
|
if (bWidth)
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
if ( pDoc->UpdateOutlineCol( static_cast<SCCOL>(nStartNo),
|
|
|
|
static_cast<SCCOL>(nEndNo), nTab, bShow ) )
|
2011-01-17 13:20:22 +01:00
|
|
|
bOutline = sal_True;
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( pDoc->UpdateOutlineRow( nStartNo, nEndNo, nTab, bShow ) )
|
2011-01-17 13:20:22 +01:00
|
|
|
bOutline = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-15 17:33:06 -05:00
|
|
|
pDoc->SetDrawPageSize(nTab);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!bOutline)
|
|
|
|
DELETEZ(pUndoTab);
|
|
|
|
|
|
|
|
if (bRecord)
|
|
|
|
{
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2000-11-16 12:13:46 +00:00
|
|
|
new ScUndoWidthOrHeight( pDocSh, *pMarkData,
|
|
|
|
nStart, nCurTab, nEnd, nCurTab,
|
2000-09-18 16:07:07 +00:00
|
|
|
pUndoDoc, nRangeCnt, pUndoRanges,
|
|
|
|
pUndoTab, eMode, nSizeTwips, bWidth ) );
|
|
|
|
}
|
|
|
|
|
2000-11-16 12:13:46 +00:00
|
|
|
for (nTab=0; nTab<nTabCount; nTab++)
|
|
|
|
if (pMarkData->GetTableSelect(nTab))
|
|
|
|
pDoc->UpdatePageBreaks( nTab );
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
GetViewData()->GetView()->UpdateScrollBars();
|
|
|
|
|
|
|
|
if (bPaint)
|
|
|
|
{
|
|
|
|
HideCursor();
|
|
|
|
|
2000-11-16 12:13:46 +00:00
|
|
|
for (nTab=0; nTab<nTabCount; nTab++)
|
|
|
|
if (pMarkData->GetTableSelect(nTab))
|
|
|
|
{
|
|
|
|
if (bWidth)
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
if (pDoc->HasAttrib( static_cast<SCCOL>(nStart),0,nTab,
|
|
|
|
static_cast<SCCOL>(nEnd),MAXROW,nTab,
|
|
|
|
HASATTR_MERGED | HASATTR_OVERLAPPED ))
|
2000-11-16 12:13:46 +00:00
|
|
|
nStart = 0;
|
2004-06-04 11:11:19 +00:00
|
|
|
if (nStart > 0) // weiter oben anfangen wegen Linien und Cursor
|
2000-11-16 12:13:46 +00:00
|
|
|
--nStart;
|
2004-06-04 11:11:19 +00:00
|
|
|
pDocSh->PostPaint( static_cast<SCCOL>(nStart), 0, nTab,
|
|
|
|
MAXCOL, MAXROW, nTab, PAINT_GRID | PAINT_TOP );
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pDoc->HasAttrib( 0,nStart,nTab, MAXCOL,nEnd,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED ))
|
|
|
|
nStart = 0;
|
2004-06-04 11:11:19 +00:00
|
|
|
if (nStart != 0)
|
2000-11-16 12:13:46 +00:00
|
|
|
--nStart;
|
|
|
|
pDocSh->PostPaint( 0, nStart, nTab, MAXCOL, MAXROW, nTab, PAINT_GRID | PAINT_LEFT );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
pDocSh->UpdateOle(GetViewData());
|
2010-09-15 11:44:06 +02:00
|
|
|
if( !pDocSh->IsReadOnly() )
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
|
|
|
|
ShowCursor();
|
|
|
|
}
|
2009-02-17 09:19:30 +00:00
|
|
|
|
|
|
|
// #i97876# Spreadsheet data changes are not notified
|
|
|
|
if ( bWidth )
|
|
|
|
{
|
|
|
|
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
|
|
|
|
if ( pModelObj && pModelObj->HasChangesListeners() )
|
|
|
|
{
|
|
|
|
ScRangeList aChangeRanges;
|
|
|
|
for ( nTab = 0; nTab < nTabCount; ++nTab )
|
|
|
|
{
|
|
|
|
if ( pMarkData->GetTableSelect( nTab ) )
|
|
|
|
{
|
|
|
|
const SCCOLROW* pTabRanges = pRanges;
|
|
|
|
for ( SCCOLROW nRange = 0; nRange < nRangeCnt; ++nRange )
|
|
|
|
{
|
|
|
|
SCCOL nStartCol = static_cast< SCCOL >( *(pTabRanges++) );
|
|
|
|
SCCOL nEndCol = static_cast< SCCOL >( *(pTabRanges++) );
|
|
|
|
for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
|
|
|
|
{
|
|
|
|
aChangeRanges.Append( ScRange( nCol, 0, nTab ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "column-resize" ) ), aChangeRanges );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Spaltenbreiten/Zeilenhoehen (ueber Blockmarken)
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::SetMarkedWidthOrHeight( sal_Bool bWidth, ScSizeMode eMode, sal_uInt16 nSizeTwips,
|
|
|
|
sal_Bool bRecord, sal_Bool bPaint )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScMarkData& rMark = GetViewData()->GetMarkData();
|
|
|
|
|
|
|
|
rMark.MarkToMulti();
|
|
|
|
if (!rMark.IsMultiMarked())
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = GetViewData()->GetCurX();
|
|
|
|
SCROW nRow = GetViewData()->GetCurY();
|
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
DoneBlockMode();
|
|
|
|
InitOwnBlockMode();
|
2011-01-17 13:20:22 +01:00
|
|
|
rMark.SetMultiMarkArea( ScRange( nCol,nRow,nTab ), sal_True );
|
2008-02-19 14:42:20 +00:00
|
|
|
MarkDataChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW* pRanges = new SCCOLROW[MAXCOLROWCOUNT];
|
|
|
|
SCCOLROW nRangeCnt = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bWidth )
|
|
|
|
nRangeCnt = rMark.GetMarkColumnRanges( pRanges );
|
|
|
|
else
|
|
|
|
nRangeCnt = rMark.GetMarkRowRanges( pRanges );
|
|
|
|
|
|
|
|
SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nSizeTwips, bRecord, bPaint );
|
|
|
|
|
|
|
|
delete[] pRanges;
|
|
|
|
rMark.MarkToSimple();
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::ModifyCellSize( ScDirection eDir, sal_Bool bOptimal )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
//! Schrittweiten einstellbar
|
|
|
|
// Schrittweite ist auch Minimum
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nStepX = STD_COL_WIDTH / 5;
|
|
|
|
sal_uInt16 nStepY = ScGlobal::nStdRowHeight;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScModule* pScMod = SC_MOD();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bAnyEdit = pScMod->IsInputMode();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = GetViewData()->GetCurX();
|
|
|
|
SCROW nRow = GetViewData()->GetCurY();
|
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2001-10-31 14:59:24 +00:00
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bAllowed, bOnlyMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( eDir == DIR_LEFT || eDir == DIR_RIGHT )
|
|
|
|
bAllowed = pDoc->IsBlockEditable( nTab, nCol,0, nCol,MAXROW, &bOnlyMatrix );
|
|
|
|
else
|
|
|
|
bAllowed = pDoc->IsBlockEditable( nTab, 0,nRow, MAXCOL,nRow, &bOnlyMatrix );
|
|
|
|
if ( !bAllowed && !bOnlyMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
HideAllCursors();
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nWidth = pDoc->GetColWidth( nCol, nTab );
|
|
|
|
sal_uInt16 nHeight = pDoc->GetRowHeight( nRow, nTab );
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOLROW nRange[2];
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( eDir == DIR_LEFT || eDir == DIR_RIGHT )
|
|
|
|
{
|
|
|
|
if (bOptimal) // Breite dieser einen Zelle
|
|
|
|
{
|
|
|
|
if ( bAnyEdit )
|
|
|
|
{
|
|
|
|
// beim Editieren die aktuelle Breite der Eingabe
|
|
|
|
ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData()->GetViewShell() );
|
|
|
|
if (pHdl)
|
|
|
|
{
|
|
|
|
long nEdit = pHdl->GetTextSize().Width(); // in 1/100mm
|
|
|
|
|
|
|
|
const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab );
|
|
|
|
const SvxMarginItem& rMItem =
|
|
|
|
(const SvxMarginItem&)pPattern->GetItem(ATTR_MARGIN);
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nMargin = rMItem.GetLeftMargin() + rMItem.GetRightMargin();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( ((const SvxHorJustifyItem&) pPattern->
|
|
|
|
GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_LEFT )
|
2011-01-17 13:20:22 +01:00
|
|
|
nMargin = sal::static_int_cast<sal_uInt16>(
|
2007-02-27 13:01:43 +00:00
|
|
|
nMargin + ((const SfxUInt16Item&)pPattern->GetItem(ATTR_INDENT)).GetValue() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
nWidth = (sal_uInt16)(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS)
|
2000-09-18 16:07:07 +00:00
|
|
|
+ nMargin + STD_EXTRA_WIDTH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-10-31 14:59:24 +00:00
|
|
|
double nPPTX = GetViewData()->GetPPTX();
|
|
|
|
double nPPTY = GetViewData()->GetPPTY();
|
|
|
|
Fraction aZoomX = GetViewData()->GetZoomX();
|
|
|
|
Fraction aZoomY = GetViewData()->GetZoomY();
|
|
|
|
|
|
|
|
ScSizeDeviceProvider aProv(pDocSh);
|
|
|
|
if (aProv.IsPrinter())
|
|
|
|
{
|
|
|
|
nPPTX = aProv.GetPPTX();
|
|
|
|
nPPTY = aProv.GetPPTY();
|
|
|
|
aZoomX = aZoomY = Fraction( 1, 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
long nPixel = pDoc->GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(),
|
2011-01-17 13:20:22 +01:00
|
|
|
nPPTX, nPPTY, aZoomX, aZoomY, sal_True );
|
|
|
|
sal_uInt16 nTwips = (sal_uInt16)( nPixel / nPPTX );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (nTwips != 0)
|
|
|
|
nWidth = nTwips + STD_EXTRA_WIDTH;
|
|
|
|
else
|
|
|
|
nWidth = STD_COL_WIDTH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // vergroessern / verkleinern
|
|
|
|
{
|
|
|
|
if ( eDir == DIR_RIGHT )
|
2011-01-17 13:20:22 +01:00
|
|
|
nWidth = sal::static_int_cast<sal_uInt16>( nWidth + nStepX );
|
2000-09-18 16:07:07 +00:00
|
|
|
else if ( nWidth > nStepX )
|
2011-01-17 13:20:22 +01:00
|
|
|
nWidth = sal::static_int_cast<sal_uInt16>( nWidth - nStepX );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nWidth < nStepX ) nWidth = nStepX;
|
|
|
|
if ( nWidth > MAX_COL_WIDTH ) nWidth = MAX_COL_WIDTH;
|
|
|
|
}
|
|
|
|
nRange[0] = nRange[1] = nCol;
|
2011-01-17 13:20:22 +01:00
|
|
|
SetWidthOrHeight( sal_True, 1, nRange, SC_SIZE_DIRECT, nWidth );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// hier bei Breite auch Hoehe anpassen (nur die eine Zeile)
|
|
|
|
|
|
|
|
if (!bAnyEdit)
|
|
|
|
{
|
|
|
|
const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab );
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bNeedHeight =
|
2000-09-18 16:07:07 +00:00
|
|
|
((const SfxBoolItem&)pPattern->GetItem( ATTR_LINEBREAK )).GetValue() ||
|
|
|
|
((const SvxHorJustifyItem&)pPattern->
|
|
|
|
GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_BLOCK;
|
|
|
|
if (bNeedHeight)
|
|
|
|
AdjustRowHeight( nRow, nRow );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScSizeMode eMode;
|
|
|
|
if (bOptimal)
|
|
|
|
{
|
|
|
|
eMode = SC_SIZE_OPTIMAL;
|
|
|
|
nHeight = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eMode = SC_SIZE_DIRECT;
|
|
|
|
if ( eDir == DIR_BOTTOM )
|
2011-01-17 13:20:22 +01:00
|
|
|
nHeight = sal::static_int_cast<sal_uInt16>( nHeight + nStepY );
|
2000-09-18 16:07:07 +00:00
|
|
|
else if ( nHeight > nStepY )
|
2011-01-17 13:20:22 +01:00
|
|
|
nHeight = sal::static_int_cast<sal_uInt16>( nHeight - nStepY );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nHeight < nStepY ) nHeight = nStepY;
|
|
|
|
if ( nHeight > MAX_COL_HEIGHT ) nHeight = MAX_COL_HEIGHT;
|
|
|
|
//! MAX_COL_HEIGHT umbenennen in MAX_ROW_HEIGHT in global.hxx !!!!!!
|
|
|
|
}
|
|
|
|
nRange[0] = nRange[1] = nRow;
|
2011-03-10 16:55:21 -05:00
|
|
|
SetWidthOrHeight( false, 1, nRange, eMode, nHeight );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bAnyEdit )
|
|
|
|
{
|
|
|
|
UpdateEditView();
|
|
|
|
if ( pDoc->HasAttrib( nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_NEEDHEIGHT ) )
|
|
|
|
{
|
|
|
|
ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData()->GetViewShell() );
|
|
|
|
if (pHdl)
|
|
|
|
pHdl->SetModified(); // damit bei Enter die Hoehe angepasst wird
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ShowAllCursors();
|
|
|
|
}
|
|
|
|
|
CWS-TOOLING: integrate CWS scsheetprotection02
2009-06-18 16:48:14 +0200 kohei r273124 : #i102906# Fix a crasher when loading an xls document with unsupported
encrytpion.
2009-06-15 14:02:00 +0200 dr r272982 : #i10000# compiler warnings
2009-04-13 23:06:21 +0200 kohei r270740 : Renamed SetData() to SetDataFromDocument(), in order to resolve name clash
with the method of the same name in class Window. This caused a compiler
warning on Solaris Intel.
2009-04-13 04:09:59 +0200 kohei r270729 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@270723 (milestone: DEV300:m46)
2009-02-23 16:13:45 +0100 kohei r268361 : added tabprotection.obj to the exception file list. Apparently the older
versions of boost::shared_ptr rely on C++ exceptions for its implementation.
2009-02-18 19:59:05 +0100 kohei r268253 : Switched to using ::boost::shared_ptr to wrap a pimpl class, because using
::std::auto_ptr in this header breaks the build on win32. The MSVC
implementation of ::std::auto_ptr has some weird quirks...
2009-02-17 21:47:13 +0100 kohei r268192 : fixed linkage issue due to library split.
2009-02-17 04:50:34 +0100 kohei r267842 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@267171 (milestone: DEV300:m41)
2009-02-17 02:36:10 +0100 kohei r267841 : reverted the last commit, to re-surrect the removed src files.
2009-02-03 22:02:34 +0100 kohei r267342 : removed the src files to prevent them from being entered into the translation
process. The dialogs that need the strings are not yet enabled in the code,
so their removal will not cause any harm.
2009-01-14 12:24:29 +0100 dr r266280 : #i10000# wntmsci12 compiler warnings #4
2009-01-14 09:35:46 +0100 dr r266267 : #i10000# wntmsci12 compiler warnings #3
2009-01-13 15:42:07 +0100 dr r266231 : #i10000# wntmsci12 compiler warnings #2
2009-01-13 13:18:28 +0100 dr r266216 : #i10000# wntmsci12 compiler warnings
2009-01-07 03:59:11 +0100 kohei r265943 : remove the fscking compiler warnings.
2009-01-06 15:55:32 +0100 kohei r265925 : removed compiler warnings that caused the buildbot build to fail....
2009-01-05 23:24:59 +0100 kohei r265888 : Undoing my own local build fix to work around the libmoz... issue.
2008-12-30 21:39:58 +0100 kohei r265833 : Duh! Sheet protection was supposed to be disabled. :-/
2008-12-23 20:25:55 +0100 kohei r265792 : recovered the code block that was accidentally removed during cws rebase.
2008-12-23 19:03:19 +0100 kohei r265791 : fixed breakage in ods export filter due to rebase to m38.
2008-12-23 16:41:49 +0100 kohei r265787 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@265758 (milestone: DEV300:m38)
2008-12-23 05:37:47 +0100 kohei r265768 : deliberately forget document and sheet passwords when importing from or
exporting to excel, to emulate the current behavior.
2008-12-23 05:12:59 +0100 kohei r265767 : removed commented-out unused method ScDocument::SetAutoFilterFlags().
2008-12-23 05:05:19 +0100 kohei r265766 : removed one duplicate method and made associated changes with the removal,
and a little more code cleanup.
2008-12-23 04:24:58 +0100 kohei r265765 : a typo in in-line comment
2008-12-23 04:23:08 +0100 kohei r265764 : remove fprintf statement that blatantly prints out document encryption
password to stdout. not a good practice.
2008-12-23 04:14:21 +0100 kohei r265763 : we actually don't want to clear all options, because if we do, then
we would no longer be able to select any cells on a protected sheet.
2008-12-23 04:07:10 +0100 kohei r265762 : * minor code cleanup (indentation inconsistencies & use of tab)
* fixed unprotecting a sheet with password to make it work again.
2008-12-23 03:22:50 +0100 kohei r265761 : reverted all the new functionalities to the existing ones, while keeping the new code in
as much as I could.
2008-12-22 23:11:08 +0100 kohei r265760 : in xls export filter, renamed two unknown records into records of known name.
2008-12-22 22:34:50 +0100 kohei r265759 : temporarily disable password capability on file export for MS Excel 97.
2008-12-22 17:01:21 +0100 kohei r265754 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@264807 (milestone: DEV300:m37)
2008-11-26 03:12:58 +0100 kohei r264335 : recovered a method that was actually used.
2008-11-25 21:51:10 +0100 kohei r264334 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@264325 (milestone: DEV300:m36)
2008-10-08 19:57:35 +0200 kohei r262094 : changed description string to make it less technical.
2008-10-01 05:56:58 +0200 kohei r261986 : migrated from the cvs-based cws.
2008-10-01 05:55:19 +0200 kohei r261985 : migrated from the cvs-based cws.
2008-10-01 05:55:00 +0200 kohei r261984 : migrated from the cvs-based cws.
2009-07-01 08:58:41 +00:00
|
|
|
void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
|
|
|
|
{
|
|
|
|
if (nTab == TABLEID_DOC)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ScMarkData& rMark = GetViewData()->GetMarkData();
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
|
|
|
ScDocFunc aFunc(*pDocSh);
|
|
|
|
bool bUndo(pDoc->IsUndoEnabled());
|
|
|
|
|
|
|
|
// modifying several tables is handled here
|
|
|
|
|
|
|
|
if (bUndo)
|
|
|
|
{
|
|
|
|
String aUndo = ScGlobal::GetRscString( STR_UNDO_PROTECT_TAB );
|
|
|
|
pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
|
|
|
|
}
|
|
|
|
|
|
|
|
SCTAB nCount = pDocSh->GetDocument()->GetTableCount();
|
|
|
|
for ( SCTAB i=0; i<nCount; i++ )
|
|
|
|
if ( rMark.GetTableSelect(i) )
|
|
|
|
aFunc.ProtectSheet(i, rProtect);
|
|
|
|
|
|
|
|
if (bUndo)
|
|
|
|
pDocSh->GetUndoManager()->LeaveListAction();
|
|
|
|
|
|
|
|
UpdateLayerLocks(); //! broadcast to all views
|
|
|
|
}
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
void ScViewFunc::Protect( SCTAB nTab, const String& rPassword )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScMarkData& rMark = GetViewData()->GetMarkData();
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
2001-02-14 14:34:08 +00:00
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocFunc aFunc(*pDocSh);
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bUndo(pDoc->IsUndoEnabled());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 )
|
2011-03-10 16:55:21 -05:00
|
|
|
aFunc.Protect( nTab, rPassword, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// modifying several tables is handled here
|
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bUndo)
|
|
|
|
{
|
|
|
|
String aUndo = ScGlobal::GetRscString( STR_UNDO_PROTECT_TAB );
|
|
|
|
pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nCount = pDocSh->GetDocument()->GetTableCount();
|
|
|
|
for ( SCTAB i=0; i<nCount; i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( rMark.GetTableSelect(i) )
|
2011-03-10 16:55:21 -05:00
|
|
|
aFunc.Protect( i, rPassword, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bUndo)
|
|
|
|
pDocSh->GetUndoManager()->LeaveListAction();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UpdateLayerLocks(); //! broadcast to all views
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool ScViewFunc::Unprotect( SCTAB nTab, const String& rPassword )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScMarkData& rMark = GetViewData()->GetMarkData();
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
2001-02-14 14:34:08 +00:00
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocFunc aFunc(*pDocSh);
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bChanged = false;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bUndo (pDoc->IsUndoEnabled());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 )
|
2011-03-10 16:55:21 -05:00
|
|
|
bChanged = aFunc.Unprotect( nTab, rPassword, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// modifying several tables is handled here
|
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bUndo)
|
|
|
|
{
|
|
|
|
String aUndo = ScGlobal::GetRscString( STR_UNDO_UNPROTECT_TAB );
|
|
|
|
pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nCount = pDocSh->GetDocument()->GetTableCount();
|
|
|
|
for ( SCTAB i=0; i<nCount; i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( rMark.GetTableSelect(i) )
|
2011-03-10 16:55:21 -05:00
|
|
|
if ( aFunc.Unprotect( i, rPassword, false ) )
|
2011-01-17 13:20:22 +01:00
|
|
|
bChanged = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bUndo)
|
|
|
|
pDocSh->GetUndoManager()->LeaveListAction();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bChanged)
|
|
|
|
UpdateLayerLocks(); //! broadcast to all views
|
|
|
|
|
|
|
|
return bChanged;
|
|
|
|
}
|
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
void ScViewFunc::SetNoteText( const ScAddress& rPos, const String& rNoteText )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
GetViewData()->GetDocShell()->GetDocFunc().SetNoteText( rPos, rNoteText, false );
|
2009-03-02 14:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScViewFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate )
|
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
GetViewData()->GetDocShell()->GetDocFunc().ReplaceNote( rPos, rNoteText, pAuthor, pDate, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::SetNumberFormat( short nFormatType, sal_uLong nAdd )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// nur wegen Matrix nicht editierbar? Attribute trotzdem ok
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nNumberFormat = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = pViewData->GetDocument();
|
|
|
|
SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable();
|
|
|
|
LanguageType eLanguage = ScGlobal::eLnge;
|
|
|
|
ScPatternAttr aNewAttrs( pDoc->GetPool() );
|
|
|
|
|
2011-03-02 21:32:00 +01:00
|
|
|
// always take language from cursor position, even if there is a selection
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nCurrentNumberFormat;
|
2000-09-18 16:07:07 +00:00
|
|
|
pDoc->GetNumberFormat( pViewData->GetCurX(),
|
|
|
|
pViewData->GetCurY(),
|
|
|
|
pViewData->GetTabNo(),
|
|
|
|
nCurrentNumberFormat );
|
|
|
|
const SvNumberformat* pEntry = pNumberFormatter->GetEntry( nCurrentNumberFormat );
|
|
|
|
if (pEntry)
|
|
|
|
eLanguage = pEntry->GetLanguage(); // sonst ScGlobal::eLnge behalten
|
|
|
|
|
|
|
|
nNumberFormat = pNumberFormatter->GetStandardFormat( nFormatType, eLanguage ) + nAdd;
|
|
|
|
|
|
|
|
SfxItemSet& rSet = aNewAttrs.GetItemSet();
|
|
|
|
rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumberFormat ) );
|
|
|
|
// ATTR_LANGUAGE_FORMAT nicht
|
2011-01-17 13:20:22 +01:00
|
|
|
ApplySelectionPattern( aNewAttrs, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScViewFunc::SetNumFmtByStr( const String& rCode )
|
|
|
|
{
|
|
|
|
// nur wegen Matrix nicht editierbar? Attribute trotzdem ok
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = pViewData->GetDocument();
|
|
|
|
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
|
|
|
|
|
|
|
|
// Sprache immer von Cursorposition
|
|
|
|
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nCurrentNumberFormat;
|
2000-09-18 16:07:07 +00:00
|
|
|
pDoc->GetNumberFormat( pViewData->GetCurX(), pViewData->GetCurY(),
|
|
|
|
pViewData->GetTabNo(), nCurrentNumberFormat );
|
|
|
|
const SvNumberformat* pEntry = pFormatter->GetEntry( nCurrentNumberFormat );
|
|
|
|
LanguageType eLanguage = pEntry ? pEntry->GetLanguage() : ScGlobal::eLnge;
|
|
|
|
|
|
|
|
// Index fuer String bestimmen
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOk = sal_True;
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nNumberFormat = pFormatter->GetEntryKey( rCode, eLanguage );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nNumberFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
|
|
|
|
{
|
|
|
|
// neu eintragen
|
|
|
|
|
|
|
|
String aFormat = rCode; // wird veraendert
|
|
|
|
xub_StrLen nErrPos = 0;
|
|
|
|
short nType = 0; //! ???
|
|
|
|
bOk = pFormatter->PutEntry( aFormat, nErrPos, nType, nNumberFormat, eLanguage );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bOk ) // gueltiges Format?
|
|
|
|
{
|
|
|
|
ScPatternAttr aNewAttrs( pDoc->GetPool() );
|
|
|
|
SfxItemSet& rSet = aNewAttrs.GetItemSet();
|
|
|
|
rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumberFormat ) );
|
|
|
|
rSet.Put( SvxLanguageItem( eLanguage, ATTR_LANGUAGE_FORMAT ) );
|
2011-01-17 13:20:22 +01:00
|
|
|
ApplySelectionPattern( aNewAttrs, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//! sonst Fehler zuerueckgeben / Meldung ausgeben ???
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::ChangeNumFmtDecimals( sal_Bool bIncrement )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// nur wegen Matrix nicht editierbar? Attribute trotzdem ok
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
|
|
|
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = GetViewData()->GetCurX();
|
|
|
|
SCROW nRow = GetViewData()->GetCurY();
|
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nOldFormat;
|
2000-09-18 16:07:07 +00:00
|
|
|
pDoc->GetNumberFormat( nCol, nRow, nTab, nOldFormat );
|
|
|
|
const SvNumberformat* pOldEntry = pFormatter->GetEntry( nOldFormat );
|
|
|
|
if (!pOldEntry)
|
|
|
|
{
|
2011-03-01 19:05:02 +01:00
|
|
|
OSL_FAIL("Zahlformat nicht gefunden !!!");
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// was haben wir denn da?
|
|
|
|
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nNewFormat = nOldFormat;
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bError = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
LanguageType eLanguage = pOldEntry->GetLanguage();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bThousand, bNegRed;
|
|
|
|
sal_uInt16 nPrecision, nLeading;
|
2001-01-26 16:50:11 +00:00
|
|
|
pOldEntry->GetFormatSpecialInfo( bThousand, bNegRed, nPrecision, nLeading );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
short nOldType = pOldEntry->GetType();
|
|
|
|
if ( 0 == ( nOldType & (
|
|
|
|
NUMBERFORMAT_NUMBER | NUMBERFORMAT_CURRENCY | NUMBERFORMAT_PERCENT ) ) )
|
|
|
|
{
|
|
|
|
// Datum, Zeit, Bruch, logisch, Text kann nicht angepasst werden
|
|
|
|
//! bei Wisssenschaftlich kann es der Numberformatter auch nicht
|
2011-01-17 13:20:22 +01:00
|
|
|
bError = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//! Das SvNumberformat hat einen Member bStandard, verraet ihn aber nicht
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bWasStandard = ( nOldFormat == pFormatter->GetStandardIndex( eLanguage ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bWasStandard)
|
|
|
|
{
|
|
|
|
// bei "Standard" die Nachkommastellen abhaengig vom Zellinhalt
|
|
|
|
// 0 bei leer oder Text -> keine Nachkommastellen
|
|
|
|
double nVal = pDoc->GetValue( ScAddress( nCol, nRow, nTab ) );
|
|
|
|
|
|
|
|
// Die Wege des Numberformatters sind unergruendlich, darum ausprobieren:
|
|
|
|
String aOut;
|
|
|
|
Color* pCol;
|
|
|
|
((SvNumberformat*)pOldEntry)->GetOutputString( nVal, aOut, &pCol );
|
|
|
|
|
|
|
|
nPrecision = 0;
|
|
|
|
// 'E' fuer Exponential ist fest im Numberformatter
|
|
|
|
if ( aOut.Search('E') != STRING_NOTFOUND )
|
2011-01-17 13:20:22 +01:00
|
|
|
bError = sal_True; // Exponential nicht veraendern
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2001-01-30 14:20:03 +00:00
|
|
|
String aDecSep( pFormatter->GetFormatDecimalSep( nOldFormat ) );
|
|
|
|
xub_StrLen nPos = aOut.Search( aDecSep );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nPos != STRING_NOTFOUND )
|
2001-01-30 14:20:03 +00:00
|
|
|
nPrecision = aOut.Len() - nPos - aDecSep.Len();
|
2000-09-18 16:07:07 +00:00
|
|
|
// sonst 0 behalten
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bError)
|
|
|
|
{
|
|
|
|
if (bIncrement)
|
|
|
|
{
|
|
|
|
if (nPrecision<20)
|
|
|
|
++nPrecision; // erhoehen
|
|
|
|
else
|
2011-01-17 13:20:22 +01:00
|
|
|
bError = sal_True; // 20 ist Maximum
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (nPrecision)
|
|
|
|
--nPrecision; // vermindern
|
|
|
|
else
|
2011-01-17 13:20:22 +01:00
|
|
|
bError = sal_True; // weniger als 0 geht nicht
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bError)
|
|
|
|
{
|
|
|
|
String aNewPicture;
|
|
|
|
pFormatter->GenerateFormat( aNewPicture, nOldFormat, eLanguage,
|
|
|
|
bThousand, bNegRed, nPrecision, nLeading );
|
|
|
|
|
|
|
|
nNewFormat = pFormatter->GetEntryKey( aNewPicture, eLanguage );
|
|
|
|
if ( nNewFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
|
|
|
|
{
|
|
|
|
xub_StrLen nErrPos = 0;
|
|
|
|
short nNewType = 0;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOk = pFormatter->PutEntry( aNewPicture, nErrPos,
|
2000-09-18 16:07:07 +00:00
|
|
|
nNewType, nNewFormat, eLanguage );
|
|
|
|
DBG_ASSERT( bOk, "falsches Zahlformat generiert" );
|
|
|
|
if (!bOk)
|
2011-01-17 13:20:22 +01:00
|
|
|
bError = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bError)
|
|
|
|
{
|
|
|
|
ScPatternAttr aNewAttrs( pDoc->GetPool() );
|
|
|
|
SfxItemSet& rSet = aNewAttrs.GetItemSet();
|
|
|
|
rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
|
|
|
|
// ATTR_LANGUAGE_FORMAT nicht
|
2011-01-17 13:20:22 +01:00
|
|
|
ApplySelectionPattern( aNewAttrs, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
Sound::Beep(); // war nix
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::ChangeIndent( sal_Bool bIncrement )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScViewData* pViewData = GetViewData();
|
|
|
|
ScDocShell* pDocSh = pViewData->GetDocShell();
|
|
|
|
ScMarkData& rMark = pViewData->GetMarkData();
|
|
|
|
|
|
|
|
ScMarkData aWorkMark = rMark;
|
2004-09-09 08:31:12 +00:00
|
|
|
ScViewUtil::UnmarkFiltered( aWorkMark, pDocSh->GetDocument() );
|
2000-09-18 16:07:07 +00:00
|
|
|
aWorkMark.MarkToMulti();
|
|
|
|
if (!aWorkMark.IsMultiMarked())
|
|
|
|
{
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nCol = pViewData->GetCurX();
|
|
|
|
SCROW nRow = pViewData->GetCurY();
|
|
|
|
SCTAB nTab = pViewData->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
aWorkMark.SetMultiMarkArea( ScRange(nCol,nRow,nTab) );
|
|
|
|
}
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bSuccess = pDocSh->GetDocFunc().ChangeIndent( aWorkMark, bIncrement, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bSuccess)
|
|
|
|
{
|
|
|
|
pDocSh->UpdateOle(pViewData);
|
|
|
|
StartFormatArea();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool ScViewFunc::InsertName( const String& rName, const String& rSymbol,
|
2000-09-18 16:07:07 +00:00
|
|
|
const String& rType )
|
|
|
|
{
|
|
|
|
// Type = P,R,C,F (und Kombinationen)
|
|
|
|
//! Undo...
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bOk = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
|
|
|
ScDocument* pDoc = pDocSh->GetDocument();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScRangeName* pList = pDoc->GetRangeName();
|
|
|
|
|
|
|
|
RangeType nType = RT_NAME;
|
|
|
|
ScRangeData* pNewEntry = new ScRangeData( pDoc, rName, rSymbol,
|
2002-11-28 15:16:44 +00:00
|
|
|
ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(),
|
|
|
|
nTab), nType );
|
2000-09-18 16:07:07 +00:00
|
|
|
String aUpType = rType;
|
|
|
|
aUpType.ToUpperAscii();
|
|
|
|
if ( aUpType.Search( 'P' ) != STRING_NOTFOUND )
|
|
|
|
nType |= RT_PRINTAREA;
|
|
|
|
if ( aUpType.Search( 'R' ) != STRING_NOTFOUND )
|
|
|
|
nType |= RT_ROWHEADER;
|
|
|
|
if ( aUpType.Search( 'C' ) != STRING_NOTFOUND )
|
|
|
|
nType |= RT_COLHEADER;
|
|
|
|
if ( aUpType.Search( 'F' ) != STRING_NOTFOUND )
|
|
|
|
nType |= RT_CRITERIA;
|
|
|
|
pNewEntry->AddType(nType);
|
|
|
|
|
|
|
|
if ( !pNewEntry->GetErrCode() ) // Text gueltig?
|
|
|
|
{
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
pDoc->CompileNameFormula( sal_True ); // CreateFormulaString
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Eintrag bereits vorhanden? Dann vorher entfernen (=Aendern)
|
2011-03-04 17:48:32 -05:00
|
|
|
ScRangeData* pData = pList->findByName(rName);
|
|
|
|
if (pData)
|
2000-09-18 16:07:07 +00:00
|
|
|
{ // alten Index uebernehmen
|
2011-03-04 17:48:32 -05:00
|
|
|
pNewEntry->SetIndex(pData->GetIndex());
|
|
|
|
pList->erase(*pData);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-03-05 14:07:14 -05:00
|
|
|
if ( pList->insert( pNewEntry ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pNewEntry = NULL; // nicht loeschen
|
2011-01-17 13:20:22 +01:00
|
|
|
bOk = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
pDoc->CompileNameFormula( false ); // CompileFormulaString
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
delete pNewEntry; // wenn er nicht eingefuegt wurde
|
|
|
|
return bOk;
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::CreateNames( sal_uInt16 nFlags )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
sal_Bool bDone = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScRange aRange;
|
2008-04-18 10:50:48 +00:00
|
|
|
if ( GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE )
|
2011-03-10 16:55:21 -05:00
|
|
|
bDone = GetViewData()->GetDocShell()->GetDocFunc().CreateNames( aRange, nFlags, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (!bDone)
|
|
|
|
ErrorMessage(STR_CREATENAME_MARKERR);
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 ScViewFunc::GetCreateNameFlags()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nFlags = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nStartCol, nEndCol;
|
|
|
|
SCROW nStartRow, nEndRow;
|
|
|
|
SCTAB nDummy;
|
2008-04-18 10:50:48 +00:00
|
|
|
if (GetViewData()->GetSimpleArea(nStartCol,nStartRow,nDummy,nEndCol,nEndRow,nDummy) == SC_MARK_SIMPLE)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocument* pDoc = GetViewData()->GetDocument();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTab = GetViewData()->GetTabNo();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bOk;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL i;
|
|
|
|
SCROW j;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
bOk = sal_True;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL nFirstCol = nStartCol;
|
|
|
|
SCCOL nLastCol = nEndCol;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (nStartCol+1 < nEndCol) { ++nFirstCol; --nLastCol; }
|
|
|
|
for (i=nFirstCol; i<=nLastCol && bOk; i++)
|
|
|
|
if (!pDoc->HasStringData( i,nStartRow,nTab ))
|
2011-03-10 16:55:21 -05:00
|
|
|
bOk = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bOk)
|
|
|
|
nFlags |= NAME_TOP;
|
|
|
|
else // Bottom nur wenn nicht Top
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bOk = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
for (i=nFirstCol; i<=nLastCol && bOk; i++)
|
|
|
|
if (!pDoc->HasStringData( i,nEndRow,nTab ))
|
2011-03-10 16:55:21 -05:00
|
|
|
bOk = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bOk)
|
|
|
|
nFlags |= NAME_BOTTOM;
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
bOk = sal_True;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCROW nFirstRow = nStartRow;
|
|
|
|
SCROW nLastRow = nEndRow;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (nStartRow+1 < nEndRow) { ++nFirstRow; --nLastRow; }
|
2004-06-04 11:11:19 +00:00
|
|
|
for (j=nFirstRow; j<=nLastRow && bOk; j++)
|
|
|
|
if (!pDoc->HasStringData( nStartCol,j,nTab ))
|
2011-03-10 16:55:21 -05:00
|
|
|
bOk = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bOk)
|
|
|
|
nFlags |= NAME_LEFT;
|
|
|
|
else // Right nur wenn nicht Left
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
bOk = sal_True;
|
2004-06-04 11:11:19 +00:00
|
|
|
for (j=nFirstRow; j<=nLastRow && bOk; j++)
|
|
|
|
if (!pDoc->HasStringData( nEndCol,j,nTab ))
|
2011-03-10 16:55:21 -05:00
|
|
|
bOk = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bOk)
|
|
|
|
nFlags |= NAME_RIGHT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nStartCol == nEndCol)
|
|
|
|
nFlags &= ~( NAME_LEFT | NAME_RIGHT );
|
|
|
|
if (nStartRow == nEndRow)
|
|
|
|
nFlags &= ~( NAME_TOP | NAME_BOTTOM );
|
|
|
|
|
|
|
|
return nFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScViewFunc::InsertNameList()
|
|
|
|
{
|
|
|
|
ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
|
|
|
|
ScDocShell* pDocSh = GetViewData()->GetDocShell();
|
2011-03-10 16:55:21 -05:00
|
|
|
if ( pDocSh->GetDocFunc().InsertNameList( aPos, false ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
pDocSh->UpdateOle(GetViewData());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-12 15:59:00 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|