2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-30 12:23:25 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-03-27 11:35:40 +02:00
|
|
|
#include <config_features.h>
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#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/virdev.hxx>
|
|
|
|
#include <vcl/waitobj.hxx>
|
|
|
|
#include <vcl/wrkwin.hxx>
|
2013-10-22 15:58:57 +03:00
|
|
|
#include <stdlib.h>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#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"
|
2011-05-13 23:11:42 -04:00
|
|
|
#include "dbdata.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "olinetab.hxx"
|
|
|
|
#include "rangeutl.hxx"
|
|
|
|
#include "rangenam.hxx"
|
|
|
|
#include "globstr.hrc"
|
|
|
|
#include "global.hxx"
|
|
|
|
#include "stlsheet.hxx"
|
|
|
|
#include "editutil.hxx"
|
2013-03-28 15:20:14 -04:00
|
|
|
#include "formulacell.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#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"
|
2013-03-28 15:52:57 -04:00
|
|
|
#include "tokenarray.hxx"
|
2014-02-01 20:51:29 -05:00
|
|
|
#include <rowheightcontext.hxx>
|
2014-10-08 20:01:58 -04:00
|
|
|
#include <docfuncutil.hxx>
|
|
|
|
|
2014-05-09 18:24:02 +09:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2013-04-15 20:35:47 +01:00
|
|
|
|
2011-01-06 15:35:57 +05:30
|
|
|
static void lcl_PostRepaintCondFormat( const ScConditionalFormat *pCondFmt, ScDocShell *pDocSh )
|
|
|
|
{
|
|
|
|
if( pCondFmt )
|
|
|
|
{
|
2012-06-04 10:24:45 +02:00
|
|
|
const ScRangeList& rRanges = pCondFmt->GetRange();
|
2011-05-04 15:29:53 -04:00
|
|
|
|
2012-06-25 02:46:32 +02:00
|
|
|
pDocSh->PostPaint( rRanges, PAINT_ALL );
|
2011-01-06 15:35:57 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
ScViewFunc::ScViewFunc( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
|
2000-09-18 16:07:07 +00:00
|
|
|
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()
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// anything to do?
|
2000-09-18 16:07:07 +00:00
|
|
|
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;
|
2014-06-18 12:14:29 +02:00
|
|
|
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)
|
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bFormatValid = 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-11-11 14:50:52 +00:00
|
|
|
bFormatValid = false; // discard old range
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool ScViewFunc::TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrChanged )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// anything to do?
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SC_MOD()->GetInputOptions().GetExtendFormat() )
|
2011-03-10 16:55:21 -05:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// Test: treat input with numberformat (bAttrChanged) always as new Attribute
|
2014-11-10 15:05:25 +01:00
|
|
|
// (discard old Area ). If not wanted, discard if-statement
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bAttrChanged )
|
|
|
|
{
|
|
|
|
StartFormatArea();
|
2011-03-10 16:55:21 -05:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
//! Test if cell empty ???
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
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() )
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// within range?
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nCol >= aFormatArea.aStart.Col() && nCol <= aFormatArea.aEnd.Col() )
|
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bFound = true; // do not change range
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-11-11 14:50:52 +00:00
|
|
|
// left ?
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nCol+1 == aFormatArea.aStart.Col() )
|
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bFound = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
aNewRange.aStart.SetCol( nCol );
|
|
|
|
}
|
2011-11-11 14:50:52 +00:00
|
|
|
// right ?
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nCol == aFormatArea.aEnd.Col()+1 )
|
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bFound = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
aNewRange.aEnd.SetCol( nCol );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( nCol >= aFormatArea.aStart.Col() && nCol <= aFormatArea.aEnd.Col() )
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// top ?
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nRow+1 == aFormatArea.aStart.Row() )
|
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bFound = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
aNewRange.aStart.SetRow( nRow );
|
|
|
|
}
|
2011-11-11 14:50:52 +00:00
|
|
|
// bottom ?
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nRow == aFormatArea.aEnd.Row()+1 )
|
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bFound = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
aNewRange.aEnd.SetRow( nRow );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bFound)
|
2011-11-11 14:50:52 +00:00
|
|
|
aFormatArea = aNewRange; // extend
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-03-25 13:49:59 +00:00
|
|
|
bFormatValid = false; // outside of range -> break
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return bFound;
|
|
|
|
}
|
|
|
|
|
2004-06-04 11:11:19 +00:00
|
|
|
void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab,
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bAttrChanged, bool bAddUndo )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
|
|
|
if (bAddUndo && !rDoc.IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bAddUndo = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
const ScPatternAttr* pSource = rDoc.GetPattern(
|
2000-09-18 16:07:07 +00:00
|
|
|
aFormatSource.Col(), aFormatSource.Row(), nTab );
|
2014-10-27 14:18:59 +02:00
|
|
|
if ( !static_cast<const ScMergeAttr&>(pSource->GetItem(ATTR_MERGE)).IsMerged() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-03-21 18:21:23 +00:00
|
|
|
ScRange aRange( nCol, nRow, nTab, nCol, nRow, nTab );
|
|
|
|
ScMarkData aMark;
|
|
|
|
aMark.SetMarkArea( aRange );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocFunc &rFunc = GetViewData().GetDocFunc();
|
2012-07-17 12:47:29 +02:00
|
|
|
|
|
|
|
// pOldPattern is only valid until call to ApplyAttributes!
|
2014-06-18 12:14:29 +02:00
|
|
|
const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab );
|
2012-07-17 12:47:29 +02:00
|
|
|
const ScStyleSheet* pSrcStyle = pSource->GetStyleSheet();
|
|
|
|
if ( pSrcStyle && pSrcStyle != pOldPattern->GetStyleSheet() )
|
2013-10-10 19:26:07 +02:00
|
|
|
rFunc.ApplyStyle( aMark, pSrcStyle->GetName(), true, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
rFunc.ApplyAttributes( aMark, *pSource, true, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
if ( bAttrChanged ) // value entered with number format?
|
|
|
|
aFormatSource.Set( nCol, nRow, nTab ); // then set a new source
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// additional routines
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
|
|
|
ScMarkData& rMark = GetViewData().GetMarkData();
|
2001-10-31 14:59:24 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
double nPPTX = GetViewData().GetPPTX();
|
|
|
|
double nPPTY = GetViewData().GetPPTY();
|
2014-10-23 17:41:47 +02:00
|
|
|
Fraction aZoomX = GetViewData().GetZoomX();
|
|
|
|
Fraction aZoomY = GetViewData().GetZoomY();
|
2001-10-31 14:59:24 +00:00
|
|
|
|
|
|
|
ScSizeDeviceProvider aProv(pDocSh);
|
|
|
|
if (aProv.IsPrinter())
|
|
|
|
{
|
|
|
|
nPPTX = aProv.GetPPTX();
|
|
|
|
nPPTY = aProv.GetPPTY();
|
2014-10-23 17:41:47 +02:00
|
|
|
aZoomX = aZoomY = Fraction( 1, 1 );
|
2001-10-31 14:59:24 +00:00
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
sal_uInt16 nTwips = rDoc.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;
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool ScViewFunc::SelectionEditable( bool* pOnlyNotBecauseOfMatrix /* = NULL */ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bRet;
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
|
|
|
ScMarkData& rMark = GetViewData().GetMarkData();
|
2000-09-18 16:07:07 +00:00
|
|
|
if (rMark.IsMarked() || rMark.IsMultiMarked())
|
|
|
|
bRet = pDoc->IsSelectionEditable( rMark, pOnlyNotBecauseOfMatrix );
|
|
|
|
else
|
|
|
|
{
|
2014-06-18 12:14:29 +02: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
|
|
|
|
|
2014-04-23 11:08:48 +02:00
|
|
|
static 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 )
|
2014-04-23 11:08:48 +02:00
|
|
|
return 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
|
|
|
}
|
|
|
|
|
2014-04-23 11:08:48 +02:00
|
|
|
static 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;
|
|
|
|
|
2014-04-23 11:08:48 +02:00
|
|
|
return 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
|
|
|
|
2013-04-11 00:21:40 -03:00
|
|
|
sal_uInt16 nNewCount = std::min( (sal_uInt16)(nOldCount + 1), (sal_uInt16)LRU_MAX );
|
2011-01-17 13:20:22 +01:00
|
|
|
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 );
|
|
|
|
|
2014-04-23 11:08:48 +02:00
|
|
|
return true; // list has changed
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-10-15 13:23:28 +01:00
|
|
|
namespace HelperNotifyChanges
|
|
|
|
{
|
|
|
|
void NotifyIfChangesListeners(ScDocShell &rDocShell, ScMarkData& rMark, SCCOL nCol, SCROW nRow,
|
|
|
|
const OUString &rType = OUString("cell-change"))
|
|
|
|
{
|
|
|
|
if (ScModelObj *pModelObj = getMustPropagateChangesModel(rDocShell))
|
|
|
|
{
|
|
|
|
ScRangeList aChangeRanges;
|
|
|
|
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
aChangeRanges.Append( ScRange( nCol, nRow, *itr ) );
|
|
|
|
|
|
|
|
HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, rType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// actual functions
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// input - undo OK
|
2012-03-21 15:57:35 +00:00
|
|
|
void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
|
2013-09-19 17:11:28 +02:00
|
|
|
const OUString& rString,
|
2012-03-21 15:57:35 +00:00
|
|
|
const EditTextObject* pData )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
2014-12-09 16:03:39 +00:00
|
|
|
ScMarkData rMark(GetViewData().GetMarkData());
|
2012-03-21 15:57:35 +00:00
|
|
|
bool bRecord = pDoc->IsUndoEnabled();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB i;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocFunc &rFunc = GetViewData().GetDocFunc();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2002-11-20 13:36:29 +00:00
|
|
|
ScEditableTester aTester( pDoc, nCol,nRow, nCol,nRow, rMark );
|
2014-03-08 13:23:12 -05:00
|
|
|
if (!aTester.IsEditable())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
ErrorMessage(aTester.GetMessageId());
|
|
|
|
PaintArea(nCol, nRow, nCol, nRow); // possibly the edit-engine is still painted there
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
rFunc.EnterListAction( STR_UNDO_ENTERDATA );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
bool bFormula = false;
|
2007-10-02 14:22:22 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
// a single '=' character is handled as string (needed for special filters)
|
|
|
|
if ( rString.getLength() > 1 )
|
|
|
|
{
|
|
|
|
if ( rString[0] == '=' )
|
|
|
|
{
|
|
|
|
// handle as formula
|
|
|
|
bFormula = true;
|
|
|
|
}
|
|
|
|
else if ( rString[0] == '+' || rString[0] == '-' )
|
2007-10-02 14:22:22 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
// if there is more than one leading '+' or '-' character, remove the additional ones
|
|
|
|
sal_Int32 nIndex = 1;
|
|
|
|
sal_Int32 nLen = rString.getLength();
|
|
|
|
while ( nIndex < nLen && ( rString[ nIndex ] == '+' || rString[ nIndex ] == '-' ) )
|
2007-10-02 14:22:22 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
++nIndex;
|
2007-10-02 14:22:22 +00:00
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
OUString aString = rString.replaceAt( 1, nIndex - 1, "" );
|
2007-10-02 14:22:22 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
// if the remaining part without the leading '+' or '-' character
|
|
|
|
// is non-empty and not a number, handle as formula
|
|
|
|
if ( aString.getLength() > 1 )
|
|
|
|
{
|
|
|
|
sal_uInt32 nFormat = 0;
|
|
|
|
pDoc->GetNumberFormat( nCol, nRow, nTab, nFormat );
|
|
|
|
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
|
|
|
|
double fNumber = 0;
|
|
|
|
if ( !pFormatter->IsNumberFormat( aString, nFormat, fNumber ) )
|
2007-10-02 14:22:22 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
bFormula = true;
|
2007-10-02 14:22:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
}
|
2007-10-02 14:22:22 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
bool bNumFmtChanged = false;
|
|
|
|
if ( bFormula )
|
|
|
|
{ // formula, compile with autoCorrection
|
|
|
|
i = rMark.GetFirstSelected();
|
|
|
|
ScAddress aPos( nCol, nRow, i );
|
|
|
|
ScCompiler aComp( pDoc, aPos);
|
|
|
|
aComp.SetGrammar(pDoc->GetGrammar());
|
2011-11-11 14:50:52 +00:00
|
|
|
//2do: enable/disable autoCorrection via calcoptions
|
2014-03-08 13:23:12 -05:00
|
|
|
aComp.SetAutoCorrection( true );
|
|
|
|
if ( rString[0] == '+' || rString[0] == '-' )
|
|
|
|
{
|
|
|
|
aComp.SetExtendedErrorDetection( ScCompiler::EXTENDED_ERROR_DETECTION_NAME_BREAK );
|
|
|
|
}
|
|
|
|
OUString aFormula( rString );
|
|
|
|
ScTokenArray* pArr;
|
|
|
|
bool bAgain;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
bAgain = false;
|
|
|
|
bool bAddEqual = false;
|
|
|
|
ScTokenArray* pArrFirst = pArr = aComp.CompileString( aFormula );
|
|
|
|
bool bCorrected = aComp.IsCorrected();
|
|
|
|
if ( bCorrected )
|
|
|
|
{ // try to parse with first parser-correction
|
|
|
|
pArr = aComp.CompileString( aComp.GetCorrectedFormula() );
|
|
|
|
}
|
|
|
|
if ( !pArr->GetCodeError() )
|
2008-07-22 13:45:24 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
bAddEqual = true;
|
|
|
|
aComp.CompileTokenArray();
|
|
|
|
bCorrected |= aComp.IsCorrected();
|
2008-07-22 13:45:24 +00:00
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
if ( bCorrected )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
OUString aCorrectedFormula;
|
|
|
|
if ( bAddEqual )
|
|
|
|
{
|
|
|
|
aCorrectedFormula = "=" + aComp.GetCorrectedFormula();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
else
|
|
|
|
aCorrectedFormula = aComp.GetCorrectedFormula();
|
|
|
|
short nResult;
|
|
|
|
if ( aCorrectedFormula.getLength() == 1 )
|
|
|
|
nResult = RET_NO; // empty formula, just '='
|
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
OUString aMessage( ScResId( SCSTR_FORMULA_AUTOCORRECTION ) );
|
|
|
|
aMessage += aCorrectedFormula;
|
2015-05-28 21:35:43 +01:00
|
|
|
nResult = ScopedVclPtr<QueryBox>::Create( GetViewData().GetDialogParent(),
|
2014-03-08 13:23:12 -05:00
|
|
|
WinBits(WB_YES_NO | WB_DEF_YES),
|
2015-05-28 21:35:43 +01:00
|
|
|
aMessage )->Execute();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
if ( nResult == RET_YES )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
aFormula = aCorrectedFormula;
|
|
|
|
if ( pArr != pArrFirst )
|
|
|
|
delete pArrFirst;
|
|
|
|
bAgain = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( pArr != pArrFirst )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
delete pArr;
|
|
|
|
pArr = pArrFirst;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
}
|
|
|
|
} while ( bAgain );
|
|
|
|
// to be used in multiple tabs, the formula must be compiled anew
|
|
|
|
// via ScFormulaCell copy-ctor because of RangeNames,
|
|
|
|
// the same code-array for all cells is not possible.
|
|
|
|
// If the array has an error, (it) must be RPN-erased in the newly generated
|
2015-06-22 14:31:42 +02:00
|
|
|
// cells and the error be set explicitly, so that
|
2014-03-08 13:23:12 -05:00
|
|
|
// via FormulaCell copy-ctor and Interpreter it will be, when possible,
|
|
|
|
// ironed out again, too intelligent.. e.g.: =1))
|
|
|
|
sal_uInt16 nError = pArr->GetCodeError();
|
|
|
|
if ( !nError )
|
|
|
|
{
|
|
|
|
// update list of recent functions with all functions that
|
|
|
|
// are not within parentheses
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
ScModule* pScMod = SC_MOD();
|
|
|
|
ScAppOptions aAppOpt = pScMod->GetAppOptions();
|
|
|
|
bool bOptChanged = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
formula::FormulaToken** ppToken = pArr->GetArray();
|
|
|
|
sal_uInt16 nTokens = pArr->GetLen();
|
|
|
|
sal_uInt16 nLevel = 0;
|
|
|
|
for (sal_uInt16 nTP=0; nTP<nTokens; nTP++)
|
|
|
|
{
|
|
|
|
formula::FormulaToken* pTok = ppToken[nTP];
|
|
|
|
OpCode eOp = pTok->GetOpCode();
|
|
|
|
if ( eOp == ocOpen )
|
|
|
|
++nLevel;
|
|
|
|
else if ( eOp == ocClose && nLevel )
|
|
|
|
--nLevel;
|
|
|
|
if ( nLevel == 0 && pTok->IsFunction() &&
|
|
|
|
lcl_AddFunction( aAppOpt, sal::static_int_cast<sal_uInt16>( eOp ) ) )
|
|
|
|
bOptChanged = true;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
if ( bOptChanged )
|
|
|
|
{
|
|
|
|
pScMod->SetAppOptions(aAppOpt);
|
2015-04-29 15:57:22 +02:00
|
|
|
ScModule::RecentFunctionsChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
ScFormulaCell aCell(pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE);
|
|
|
|
delete pArr;
|
2012-03-21 18:21:23 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
|
|
|
|
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
{
|
|
|
|
i = *itr;
|
|
|
|
aPos.SetTab( i );
|
2014-10-27 14:18:59 +02:00
|
|
|
sal_uLong nIndex = (sal_uLong) static_cast<const SfxUInt32Item*>( pDoc->GetAttr(
|
2014-03-08 13:23:12 -05:00
|
|
|
nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
|
2015-02-25 09:49:59 +02:00
|
|
|
if ( pFormatter->GetType( nIndex ) == css::util::NumberFormat::TEXT ||
|
2014-03-08 13:23:12 -05:00
|
|
|
( ( rString[0] == '+' || rString[0] == '-' ) && nError && rString == aFormula ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
if ( pData )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
// A clone of pData will be stored in the cell.
|
|
|
|
rFunc.SetEditCell(aPos, *pData, true);
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
|
|
|
else
|
2014-03-08 13:23:12 -05:00
|
|
|
rFunc.SetStringCell(aPos, aFormula, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScFormulaCell* pCell = new ScFormulaCell( aCell, *pDoc, aPos );
|
|
|
|
if ( nError )
|
2011-07-05 00:41:08 +02:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
pCell->GetCode()->DelRPN();
|
|
|
|
pCell->SetErrCode( nError );
|
|
|
|
if(pCell->GetCode()->IsHyperLink())
|
|
|
|
pCell->GetCode()->SetHyperLink(false);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
rFunc.SetFormulaCell(aPos, pCell, true);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
|
|
|
|
for ( ; itr != itrEnd; ++itr )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
bool bNumFmtSet = false;
|
|
|
|
rFunc.SetNormalString( bNumFmtSet, ScAddress( nCol, nRow, *itr ), rString, false );
|
|
|
|
if (bNumFmtSet)
|
2012-07-17 11:28:22 +02:00
|
|
|
{
|
2014-03-08 13:23:12 -05:00
|
|
|
/* FIXME: if set on any sheet results in changed only on
|
|
|
|
* sheet nTab for TestFormatArea() and DoAutoAttributes() */
|
|
|
|
bNumFmtChanged = true;
|
2012-07-17 11:28:22 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-03-08 13:23:12 -05:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
bool bAutoFormat = TestFormatArea(nCol, nRow, nTab, bNumFmtChanged);
|
2012-03-21 18:21:23 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
if (bAutoFormat)
|
|
|
|
DoAutoAttributes(nCol, nRow, nTab, bNumFmtChanged, bRecord);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2009-02-17 09:19:30 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow);
|
2009-02-17 09:19:30 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
if ( bRecord )
|
|
|
|
rFunc.EndListAction();
|
2012-03-21 18:21:23 +00:00
|
|
|
|
2014-03-08 13:23:12 -05:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
lcl_PostRepaintCondFormat( pDoc->GetCondFormat( nCol, nRow, nTab ), pDocSh );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// enter value in single cell (on nTab only)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
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
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pDoc && pDocSh )
|
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bUndo(pDoc->IsUndoEnabled());
|
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
|
|
|
{
|
2009-03-02 14:19:13 +00:00
|
|
|
ScAddress aPos( nCol, nRow, nTab );
|
2013-03-25 23:22:18 -04:00
|
|
|
ScCellValue aUndoCell;
|
|
|
|
if (bUndo)
|
|
|
|
aUndoCell.assign(*pDoc, aPos);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pDoc->SetValue( nCol, nRow, nTab, rValue );
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// because of ChangeTrack after change in document
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bUndo)
|
|
|
|
{
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2013-03-25 23:22:18 -04:00
|
|
|
new ScUndoEnterValue(pDocSh, aPos, aUndoCell, rValue));
|
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 );
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
}
|
|
|
|
else
|
2002-11-20 13:36:29 +00:00
|
|
|
ErrorMessage(aTester.GetMessageId());
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-21 15:57:35 +00:00
|
|
|
void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
|
2013-02-12 11:23:26 -05:00
|
|
|
const EditTextObject& rData, bool bTestSimple )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScMarkData& rMark = GetViewData().GetMarkData();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
|
|
|
bool bRecord = rDoc.IsUndoEnabled();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScEditableTester aTester( &rDoc, nTab, nCol,nRow, nCol,nRow );
|
2002-11-20 13:36:29 +00:00
|
|
|
if (aTester.IsEditable())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// test for attribute
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bSimple = false;
|
|
|
|
bool bCommon = false;
|
2014-05-09 18:24:02 +09:00
|
|
|
boost::scoped_ptr<ScPatternAttr> pCellAttrs;
|
2013-10-04 16:14:14 +02:00
|
|
|
OUString aString;
|
2009-07-28 10:04:47 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab );
|
|
|
|
ScTabEditEngine aEngine( *pOldPattern, rDoc.GetEnginePool() );
|
2013-02-12 11:23:26 -05:00
|
|
|
aEngine.SetText(rData);
|
2009-07-28 10:04:47 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
if (bTestSimple) // test, if simple string without attribute
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
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
|
2015-06-15 12:17:57 +02:00
|
|
|
// (but common attributes are still collected)
|
2000-10-13 14:45:51 +00:00
|
|
|
|
|
|
|
if ( !bSimple && aEngine.GetParagraphCount() == 1 )
|
|
|
|
{
|
2013-10-10 10:42:18 +02:00
|
|
|
OUString aParStr(aEngine.GetText( 0 ));
|
2013-10-04 16:14:14 +02:00
|
|
|
if ( aParStr[0] == '=' )
|
2013-10-10 10:42:18 +02:00
|
|
|
bSimple = true;
|
2000-10-13 14:45:51 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
if (bCommon) // attribute for tab
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-05-09 18:24:02 +09:00
|
|
|
pCellAttrs.reset(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);
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// undo
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
EditTextObject* pUndoData = NULL;
|
2013-03-21 16:36:57 -04:00
|
|
|
ScUndoEnterData::ValuesType aOldValues;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bRecord && !bSimple)
|
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
{
|
2013-03-21 16:36:57 -04:00
|
|
|
ScUndoEnterData::Value aOldValue;
|
|
|
|
aOldValue.mnTab = *itr;
|
2014-06-18 12:14:29 +02:00
|
|
|
aOldValue.maCell.assign(rDoc, ScAddress(nCol, nRow, *itr));
|
2013-03-21 16:36:57 -04:00
|
|
|
aOldValues.push_back(aOldValue);
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-02-12 11:23:26 -05:00
|
|
|
pUndoData = rData.Clone();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// enter data
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bCommon)
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.ApplyPattern(nCol,nRow,nTab,*pCellAttrs); //! undo
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (bSimple)
|
|
|
|
{
|
|
|
|
if (bCommon)
|
|
|
|
AdjustRowHeight(nRow,nRow);
|
|
|
|
|
2012-03-21 15:57:35 +00:00
|
|
|
EnterData(nCol,nRow,nTab,aString);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2013-03-21 23:36:50 -04:00
|
|
|
{
|
|
|
|
ScAddress aPos(nCol, nRow, *itr);
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.SetEditText(aPos, rData, rDoc.GetEditPool());
|
2013-03-21 23:36:50 -04:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bRecord )
|
2011-11-11 14:50:52 +00:00
|
|
|
{ // because of ChangeTrack current first
|
2000-09-18 16:07:07 +00:00
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2013-03-21 16:36:57 -04:00
|
|
|
new ScUndoEnterData(pDocSh, ScAddress(nCol,nRow,nTab), aOldValues, aString, pUndoData));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HideAllCursors();
|
|
|
|
|
|
|
|
AdjustRowHeight(nRow,nRow);
|
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
itr = rMark.begin();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
pDocSh->PostPaintCell( nCol, nRow, *itr );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ShowAllCursors();
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2009-02-17 09:19:30 +00:00
|
|
|
|
2013-10-15 13:23:28 +01:00
|
|
|
HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
}
|
2014-06-18 12:14:29 +02:00
|
|
|
lcl_PostRepaintCondFormat( rDoc.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());
|
2011-11-11 14:50:52 +00:00
|
|
|
PaintArea( nCol, nRow, nCol, nRow ); // possibly the edit-engine is still painted there
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-19 17:11:28 +02:00
|
|
|
void ScViewFunc::EnterDataAtCursor( const OUString& rString )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02: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 );
|
|
|
|
}
|
|
|
|
|
2013-09-19 17:11:28 +02:00
|
|
|
void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar::Grammar eGram )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rData = GetViewData();
|
|
|
|
const ScMarkData& rMark = rData.GetMarkData();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// nothing marked -> temporarily calculate block
|
|
|
|
// with size of result formula to get the size
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = rData.GetDocument();
|
|
|
|
SCCOL nCol = rData.GetCurX();
|
|
|
|
SCROW nRow = rData.GetCurY();
|
|
|
|
SCTAB nTab = rData.GetTabNo();
|
2011-04-20 17:07:41 -04:00
|
|
|
ScFormulaCell aFormCell( pDoc, ScAddress(nCol,nRow,nTab), rString, eGram, 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;
|
2014-06-18 12:14:29 +02:00
|
|
|
if (rData.GetSimpleArea(aRange) == SC_MARK_SIMPLE)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = rData.GetDocShell();
|
2011-04-20 17:07:41 -04:00
|
|
|
bool bSuccess = pDocSh->GetDocFunc().EnterMatrix(
|
2013-10-16 14:27:58 +02:00
|
|
|
aRange, &rMark, NULL, rString, false, false, EMPTY_OUSTRING, eGram );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bSuccess)
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ErrorMessage(STR_NOMULTISELECT);
|
|
|
|
}
|
|
|
|
|
2015-04-15 09:36:39 +02:00
|
|
|
SvtScriptType ScViewFunc::GetSelectionScriptType()
|
2000-11-24 17:07:45 +00:00
|
|
|
{
|
2015-04-15 09:36:39 +02:00
|
|
|
SvtScriptType nScript = SvtScriptType::NONE;
|
2000-11-24 17:07:45 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
|
|
|
const ScMarkData& rMark = GetViewData().GetMarkData();
|
2000-11-24 17:07:45 +00:00
|
|
|
if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
|
|
|
|
{
|
|
|
|
// no selection -> cursor
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
nScript = pDoc->GetScriptType( GetViewData().GetCurX(),
|
|
|
|
GetViewData().GetCurY(), GetViewData().GetTabNo());
|
2000-11-24 17:07:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScRangeList aRanges;
|
2011-03-10 16:55:21 -05:00
|
|
|
rMark.FillRangeListWithMarks( &aRanges, false );
|
2013-05-16 18:37:12 -04:00
|
|
|
nScript = pDoc->GetRangeScriptType(aRanges);
|
2000-11-24 17:07:45 +00:00
|
|
|
}
|
|
|
|
|
2015-04-15 09:36:39 +02:00
|
|
|
if (nScript == SvtScriptType::NONE)
|
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.
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
const ScMarkData& rMark = GetViewData().GetMarkData();
|
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
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
|
|
|
|
{
|
2014-06-18 12:14:29 +02: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 )
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
|
|
|
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 =
|
2014-06-18 12:14:29 +02:00
|
|
|
pDoc->GetPattern( GetViewData().GetCurX(),
|
|
|
|
GetViewData().GetCurY(),
|
|
|
|
GetViewData().GetTabNo() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-10-27 14:18:59 +02:00
|
|
|
rLineOuter = static_cast<const SvxBoxItem&> (pAttrs->GetItem( ATTR_BORDER ));
|
|
|
|
rLineInner = static_cast<const SvxBoxInfoItem&>(pAttrs->GetItem( ATTR_BORDER_INNER ));
|
2011-03-10 16:55:21 -05:00
|
|
|
rLineInner.SetTable(false);
|
2013-10-10 19:26:07 +02:00
|
|
|
rLineInner.SetDist(true);
|
2011-03-10 16:55:21 -05:00
|
|
|
rLineInner.SetMinDist(false);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// apply attribute - undo OK
|
2000-09-18 16:07:07 +00:00
|
|
|
//
|
2011-11-11 14:50:52 +00:00
|
|
|
// complete set ( ATTR_STARTINDEX, ATTR_ENDINDEX )
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
|
|
|
|
const SfxItemSet* pOldSet,
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// not editable because of matrix only? attribute OK nonetheless
|
2011-08-25 11:33:20 +02:00
|
|
|
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 );
|
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( pDialogSet->GetItemState( ATTR_VALUE_FORMAT ) == SfxItemState::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 =
|
2014-10-27 14:18:59 +02:00
|
|
|
static_cast<const SfxUInt32Item&>(pOldSet->Get( ATTR_VALUE_FORMAT )).GetValue();
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nNewFormat =
|
2014-10-27 14:18:59 +02:00
|
|
|
static_cast<const SfxUInt32Item&>(pDialogSet->Get( ATTR_VALUE_FORMAT )).GetValue();
|
2001-01-11 17:31:08 +00:00
|
|
|
if ( nNewFormat != nOldFormat )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-11 17:31:08 +00:00
|
|
|
SvNumberFormatter* pFormatter =
|
2014-06-18 12:14:29 +02:00
|
|
|
GetViewData().GetDocument()->GetFormatTable();
|
2001-01-11 17:31:08 +00:00
|
|
|
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-11-11 14:50:52 +00:00
|
|
|
// only the language has changed -> do not touch numberformat-attribute
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-27 14:18:59 +02:00
|
|
|
const SvxBoxItem* pOldOuter = static_cast<const SvxBoxItem*> (&pOldSet->Get( ATTR_BORDER ));
|
|
|
|
const SvxBoxItem* pNewOuter = static_cast<const SvxBoxItem*> (&pDialogSet->Get( ATTR_BORDER ));
|
|
|
|
const SvxBoxInfoItem* pOldInner = static_cast<const SvxBoxInfoItem*> (&pOldSet->Get( ATTR_BORDER_INNER ));
|
|
|
|
const SvxBoxInfoItem* pNewInner = static_cast<const SvxBoxInfoItem*> (&pDialogSet->Get( ATTR_BORDER_INNER ));
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
|
|
|
|
SfxItemPool* pNewPool = rNewSet.GetPool();
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
pNewPool->Put( *pNewOuter ); // don't delete yet
|
2000-09-18 16:07:07 +00:00
|
|
|
pNewPool->Put( *pNewInner );
|
|
|
|
rNewSet.ClearItem( ATTR_BORDER );
|
|
|
|
rNewSet.ClearItem( ATTR_BORDER_INNER );
|
|
|
|
|
|
|
|
/*
|
2011-11-11 14:50:52 +00:00
|
|
|
* establish whether border attribute is to be set:
|
|
|
|
* 1. new != old
|
|
|
|
* 2. is one of the borders not-DontCare (since 238.f: IsxxValid())
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
bool bFrame = (pDialogSet->GetItemState( ATTR_BORDER ) != SfxItemState::DEFAULT)
|
|
|
|
|| (pDialogSet->GetItemState( ATTR_BORDER_INNER ) != SfxItemState::DEFAULT);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pNewOuter==pOldOuter && pNewInner==pOldInner )
|
2011-03-10 16:55:21 -05:00
|
|
|
bFrame = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// this should be intercepted by the pool: ?!??!??
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
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
|
2015-03-24 14:15:45 +02:00
|
|
|
&& ( pNewInner->IsValid(SvxBoxInfoItemValidFlags::LEFT)
|
|
|
|
|| pNewInner->IsValid(SvxBoxInfoItemValidFlags::RIGHT)
|
|
|
|
|| pNewInner->IsValid(SvxBoxInfoItemValidFlags::TOP)
|
|
|
|
|| pNewInner->IsValid(SvxBoxInfoItemValidFlags::BOTTOM)
|
|
|
|
|| pNewInner->IsValid(SvxBoxInfoItemValidFlags::HORI)
|
|
|
|
|| pNewInner->IsValid(SvxBoxInfoItemValidFlags::VERT) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2011-03-10 16:55:21 -05:00
|
|
|
bFrame = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (!bFrame)
|
2011-11-11 14:50:52 +00:00
|
|
|
ApplySelectionPattern( aNewAttrs, bRecord ); // standard only
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// if new items are default-items, overwrite the old items:
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bDefNewOuter = ( SFX_ITEMS_STATICDEFAULT == pNewOuter->GetKind() );
|
|
|
|
bool bDefNewInner = ( SFX_ITEMS_STATICDEFAULT == pNewInner->GetKind() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ApplyPatternLines( aNewAttrs,
|
|
|
|
bDefNewOuter ? pOldOuter : pNewOuter,
|
|
|
|
bDefNewInner ? pOldInner : pNewInner,
|
|
|
|
bRecord );
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
pNewPool->Remove( *pNewOuter ); // release
|
2000-09-18 16:07:07 +00:00
|
|
|
pNewPool->Remove( *pNewInner );
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// adjust height
|
2000-09-18 16:07:07 +00:00
|
|
|
AdjustBlockHeight();
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// CellContentChanged is called in ApplySelectionPattern / ApplyPatternLines
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem )
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// not editable because of matrix only? attribute OK nonetheless
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScPatternAttr aNewAttrs( new SfxItemSet( *GetViewData().GetDocument()->GetPool(),
|
2000-09-18 16:07:07 +00:00
|
|
|
ATTR_PATTERN_START, ATTR_PATTERN_END ) );
|
|
|
|
|
|
|
|
aNewAttrs.GetItemSet().Put( rAttrItem );
|
2011-11-11 14:50:52 +00:00
|
|
|
// if justify is set (with Buttons), always indentation 0
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( rAttrItem.Which() == ATTR_HOR_JUSTIFY )
|
|
|
|
aNewAttrs.GetItemSet().Put( SfxUInt16Item( ATTR_INDENT, 0 ) );
|
|
|
|
ApplySelectionPattern( aNewAttrs );
|
|
|
|
|
|
|
|
AdjustBlockHeight();
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// CellContentChanged is called in ApplySelectionPattern
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// patterns and borders
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem* pNewOuter,
|
2013-10-10 19:26:07 +02:00
|
|
|
const SvxBoxInfoItem* pNewInner, bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
|
|
|
ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
|
2009-06-15 10:46:14 +00:00
|
|
|
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();
|
2013-10-10 19:26:07 +02:00
|
|
|
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
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
aMarkRange = ScRange( GetViewData().GetCurX(),
|
|
|
|
GetViewData().GetCurY(), GetViewData().GetTabNo() );
|
2009-06-15 10:46:14 +00:00
|
|
|
DoneBlockMode();
|
|
|
|
InitOwnBlockMode();
|
|
|
|
aFuncMark.SetMarkArea(aMarkRange);
|
|
|
|
MarkDataChanged();
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02: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 );
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
if (*itr != nStartTab)
|
|
|
|
pUndoDoc->AddUndoTab( *itr, *itr );
|
2009-06-15 10:46:14 +00:00
|
|
|
|
|
|
|
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 );
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2009-06-15 10:46:14 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
CellContentChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
StartFormatArea();
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// pattern only
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bRecord, bool bCursorOnly )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
ScDocShell* pDocSh = rViewData.GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
|
|
|
ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered
|
|
|
|
ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc );
|
2004-09-09 08:31:12 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
if (bRecord && !rDoc.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
|
2014-09-10 17:53:41 +02:00
|
|
|
// from SfxItemState::SET in the new ItemSet (default is ignored in ApplyPattern).
|
2004-02-03 12:08:40 +00:00
|
|
|
// New alignment is checked (check in PostPaint isn't enough) in case a right
|
|
|
|
// alignment is changed to left.
|
|
|
|
const SfxItemSet& rNewSet = rAttr.GetItemSet();
|
2014-09-10 17:53:41 +02:00
|
|
|
bool bSetLines = rNewSet.GetItemState( ATTR_BORDER, true ) == SfxItemState::SET ||
|
|
|
|
rNewSet.GetItemState( ATTR_SHADOW, true ) == SfxItemState::SET;
|
|
|
|
bool bSetAlign = rNewSet.GetItemState( ATTR_HOR_JUSTIFY, true ) == SfxItemState::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
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bMulti = aFuncMark.IsMultiMarked();
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToMulti();
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bOnlyTab = (!aFuncMark.IsMultiMarked() && !bCursorOnly && aFuncMark.GetSelectCount() > 1);
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bOnlyTab)
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
SCCOL nCol = rViewData.GetCurX();
|
|
|
|
SCROW nRow = rViewData.GetCurY();
|
|
|
|
SCTAB nTab = rViewData.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 );
|
2014-06-18 12:14:29 +02:00
|
|
|
SCTAB nTabCount = rDoc.GetTableCount();
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
ScRange aChangeRange( aMarkRange );
|
|
|
|
aChangeRange.aStart.SetTab( *itr );
|
|
|
|
aChangeRange.aEnd.SetTab( *itr );
|
|
|
|
aChangeRanges.Append( aChangeRange );
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
|
|
|
|
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 );
|
2014-06-18 12:14:29 +02:00
|
|
|
pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
|
2011-07-05 00:41:08 +02:00
|
|
|
itr = aFuncMark.begin();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
if (*itr != nStartTab)
|
|
|
|
pUndoDoc->AddUndoTab( *itr, *itr );
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.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
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.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 );
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
CellContentChanged();
|
|
|
|
}
|
2011-11-11 14:50:52 +00:00
|
|
|
else // single cell - simpler undo
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
SCCOL nCol = rViewData.GetCurX();
|
|
|
|
SCROW nRow = rViewData.GetCurY();
|
|
|
|
SCTAB nTab = rViewData.GetTabNo();
|
2010-09-15 12:28:47 +02:00
|
|
|
|
|
|
|
EditTextObject* pOldEditData = NULL;
|
|
|
|
EditTextObject* pNewEditData = NULL;
|
2013-03-27 12:44:33 -04:00
|
|
|
ScAddress aPos(nCol, nRow, nTab);
|
2014-06-18 12:14:29 +02:00
|
|
|
if (rDoc.GetCellType(aPos) == CELLTYPE_EDIT)
|
2010-09-15 12:28:47 +02:00
|
|
|
{
|
2014-07-18 14:49:39 +01:00
|
|
|
const EditTextObject* pEditObj = rDoc.GetEditText(aPos);
|
|
|
|
pOldEditData = pEditObj ? pEditObj->Clone() : NULL;
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.RemoveEditTextCharAttribs(aPos, rAttr);
|
2014-07-18 14:49:39 +01:00
|
|
|
pEditObj = rDoc.GetEditText(aPos);
|
|
|
|
pNewEditData = pEditObj ? pEditObj->Clone() : NULL;
|
2010-09-15 12:28:47 +02:00
|
|
|
}
|
|
|
|
|
2013-03-27 12:44:33 -04:00
|
|
|
aChangeRanges.Append(aPos);
|
2014-06-18 12:14:29 +02:00
|
|
|
boost::scoped_ptr<ScPatternAttr> pOldPat(new ScPatternAttr(*rDoc.GetPattern( nCol, nRow, nTab )));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.ApplyPattern( nCol, nRow, nTab, rAttr );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
const ScPatternAttr* pNewPat = rDoc.GetPattern( nCol, nRow, nTab );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (bRecord)
|
|
|
|
{
|
2010-09-15 12:28:47 +02:00
|
|
|
ScUndoCursorAttr* pUndo = new ScUndoCursorAttr(
|
2014-05-09 18:24:02 +09:00
|
|
|
pDocSh, nCol, nRow, nTab, pOldPat.get(), pNewPat, &rAttr, false );
|
2010-09-15 12:28:47 +02:00
|
|
|
pUndo->SetEditData(pOldEditData, pNewEditData);
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(pUndo);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-05-09 18:24:02 +09:00
|
|
|
pOldPat.reset(); // is copied in undo (Pool)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-02-03 12:08:40 +00:00
|
|
|
pDocSh->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PAINT_GRID, nExtFlags | SC_PF_TESTMERGE );
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
CellContentChanged();
|
|
|
|
}
|
|
|
|
|
2013-10-15 13:23:28 +01:00
|
|
|
ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh);
|
|
|
|
if (pModelObj)
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aProperties;
|
|
|
|
sal_Int32 nCount = 0;
|
2012-01-05 21:30:06 +00:00
|
|
|
const SfxItemPropertyMap& rMap = ScCellObj::GetCellPropertyMap();
|
|
|
|
PropertyEntryVector_t aPropVector = rMap.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;
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( rNewSet.GetItemState( nWhich, true, &pItem ) == SfxItemState::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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-10-15 13:23:28 +01:00
|
|
|
HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "attribute", aProperties);
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
2013-10-15 13:23:28 +01:00
|
|
|
|
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-08-25 11:33:20 +02:00
|
|
|
bool bOnlyNotBecauseOfMatrix;
|
2000-11-24 17:07:45 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScPatternAttr aNewAttrs( GetViewData().GetDocument()->GetPool() );
|
2000-11-24 17:07:45 +00:00
|
|
|
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;
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = rViewData.GetDocument();
|
|
|
|
ScMarkData& rMark = rViewData.GetMarkData();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
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
|
2014-06-18 12:14:29 +02:00
|
|
|
pSheet = pDoc->GetStyle( rViewData.GetCurX(),
|
|
|
|
rViewData.GetCurY(),
|
|
|
|
rViewData.GetTabNo() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return pSheet;
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// not editable because of matrix only? attribute OK nonetheless
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !pStyleSheet) return;
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
ScDocShell* pDocSh = rViewData.GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
|
|
|
ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered
|
|
|
|
ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc );
|
|
|
|
SCTAB nTabCount = rDoc.GetTableCount();
|
|
|
|
if (bRecord && !rDoc.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 )
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
SCTAB nTab = rViewData.GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
2014-06-18 12:14:29 +02:00
|
|
|
pUndoDoc->InitUndo( &rDoc, nTab, nTab );
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
if (*itr != nTab)
|
|
|
|
pUndoDoc->AddUndoTab( *itr, *itr );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScRange aCopyRange = aMarkRange;
|
|
|
|
aCopyRange.aStart.SetTab(0);
|
|
|
|
aCopyRange.aEnd.SetTab(nTabCount-1);
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, &aFuncMark );
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToMulti();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-04 16:14:14 +02:00
|
|
|
OUString aName = pStyleSheet->GetName();
|
2000-09-18 16:07:07 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2014-10-27 14:18:59 +02:00
|
|
|
rDoc.ApplySelectionStyle( static_cast<ScStyleSheet&>(*pStyleSheet), aFuncMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (!AdjustBlockHeight())
|
2014-06-18 12:14:29 +02:00
|
|
|
rViewData.GetDocShell()->PostPaint( aMarkRange, PAINT_GRID );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-09-09 08:31:12 +00:00
|
|
|
aFuncMark.MarkToSimple();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
SCCOL nCol = rViewData.GetCurX();
|
|
|
|
SCROW nRow = rViewData.GetCurY();
|
|
|
|
SCTAB nTab = rViewData.GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{
|
|
|
|
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
2014-06-18 12:14:29 +02:00
|
|
|
pUndoDoc->InitUndo( &rDoc, nTab, nTab );
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
if (*itr != nTab)
|
|
|
|
pUndoDoc->AddUndoTab( *itr, *itr );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScRange aCopyRange( nCol, nRow, 0, nCol, nRow, nTabCount-1 );
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.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 );
|
|
|
|
|
2013-10-04 16:14:14 +02:00
|
|
|
OUString aName = pStyleSheet->GetName();
|
2000-09-18 16:07:07 +00:00
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
|
|
|
new ScUndoSelectionStyle( pDocSh, aUndoMark, aMarkRange, aName, pUndoDoc ) );
|
|
|
|
}
|
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2014-10-27 14:18:59 +02:00
|
|
|
rDoc.ApplyStyle( nCol, nRow, *itr, static_cast<ScStyleSheet&>(*pStyleSheet) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (!AdjustBlockHeight())
|
2014-06-18 12:14:29 +02:00
|
|
|
rViewData.GetDocShell()->PostPaintCell( nCol, nRow, nTab );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = rViewData.GetDocument();
|
|
|
|
ScDocShell* pDocSh = rViewData.GetDocShell();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2015-03-31 23:04:14 +01:00
|
|
|
ScopedVclPtrInstance< VirtualDevice > pVirtDev;
|
2015-03-19 15:39:43 +00:00
|
|
|
pVirtDev->SetMapMode(MAP_PIXEL);
|
|
|
|
pDoc->StyleSheetChanged( pStyleSheet, true, pVirtDev,
|
2014-06-18 12:14:29 +02:00
|
|
|
rViewData.GetPPTX(),
|
|
|
|
rViewData.GetPPTY(),
|
|
|
|
rViewData.GetZoomX(),
|
|
|
|
rViewData.GetZoomY() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
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;
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = rViewData.GetDocument();
|
|
|
|
ScDocShell* pDocSh = rViewData.GetDocShell();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2015-03-31 23:04:14 +01:00
|
|
|
ScopedVclPtrInstance< VirtualDevice > pVirtDev;
|
2015-03-19 15:39:43 +00:00
|
|
|
pVirtDev->SetMapMode(MAP_PIXEL);
|
|
|
|
pDoc->StyleSheetChanged( pStyleSheet, false, pVirtDev,
|
2014-06-18 12:14:29 +02:00
|
|
|
rViewData.GetPPTX(),
|
|
|
|
rViewData.GetPPTY(),
|
|
|
|
rViewData.GetZoomX(),
|
|
|
|
rViewData.GetZoomY() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
|
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
|
|
|
|
ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
|
|
|
|
if (pHdl)
|
|
|
|
pHdl->ForgetLastPattern();
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// insert cells - undo OK
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScRange aRange;
|
2014-06-18 12:14:29 +02:00
|
|
|
if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
const ScMarkData& rMark = GetViewData().GetMarkData();
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bSuccess = pDocSh->GetDocFunc().InsertCells( aRange, &rMark, eCmd, bRecord, false, bPartOfPaste );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bSuccess)
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2000-09-18 16:07:07 +00:00
|
|
|
CellContentChanged();
|
2013-09-01 14:31:36 -04:00
|
|
|
ResetAutoSpell();
|
2009-02-17 09:19:30 +00:00
|
|
|
|
2015-05-20 17:27:08 +02:00
|
|
|
if ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSROWS_AFTER || eCmd == INS_INSCOLS_AFTER )
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2015-05-20 17:27:08 +02:00
|
|
|
OUString aOperation = ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER ) ?
|
2013-09-28 14:48:59 +02:00
|
|
|
OUString("insert-rows"):
|
|
|
|
OUString("insert-columns");
|
2013-10-15 13:23:28 +01:00
|
|
|
HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, aRange, aOperation);
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// delete cells - undo OK
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
void ScViewFunc::DeleteCells( DelCellCmd eCmd, bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScRange aRange;
|
2014-06-18 12:14:29 +02:00
|
|
|
if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
const ScMarkData& rMark = GetViewData().GetMarkData();
|
2009-02-11 15:19:01 +00:00
|
|
|
|
2013-03-27 11:35:40 +02:00
|
|
|
#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
|
2011-11-11 14:50:52 +00:00
|
|
|
// #i94841# [Collaboration] if deleting rows is rejected, the content is sometimes wrong
|
2009-02-11 15:19:01 +00:00
|
|
|
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
|
2013-03-23 17:17:20 +02:00
|
|
|
#endif
|
2009-02-11 15:19:01 +00:00
|
|
|
{
|
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
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2000-09-18 16:07:07 +00:00
|
|
|
CellContentChanged();
|
2013-09-01 14:31:36 -04:00
|
|
|
ResetAutoSpell();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-28 14:48:59 +02:00
|
|
|
if ( eCmd == DEL_DELROWS || eCmd == DEL_DELCOLS )
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2013-09-28 14:48:59 +02:00
|
|
|
OUString aOperation = ( eCmd == DEL_DELROWS) ?
|
|
|
|
OUString("delete-rows"):
|
|
|
|
OUString("delete-columns");
|
2013-10-15 13:23:28 +01:00
|
|
|
HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, aRange, aOperation);
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// put cursor directly behind deleted range
|
2014-06-18 12:14:29 +02: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)
|
2013-10-10 19:26:07 +02:00
|
|
|
DeleteMulti( true, bRecord );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
ErrorMessage(STR_NOMULTISELECT);
|
|
|
|
}
|
|
|
|
|
|
|
|
Unmark();
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
void ScViewFunc::DeleteMulti( bool bRows, bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
2000-09-18 16:07:07 +00:00
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
2014-06-18 12:14:29 +02:00
|
|
|
SCTAB nTab = GetViewData().GetTabNo();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
|
|
|
ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
|
|
|
|
ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc );
|
2004-09-09 08:31:12 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
if (!rDoc.IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2014-02-05 00:07:21 -05:00
|
|
|
|
|
|
|
std::vector<sc::ColRowSpan> aSpans;
|
|
|
|
if (bRows)
|
|
|
|
aSpans = aFuncMark.GetMarkedRowSpans();
|
|
|
|
else
|
|
|
|
aSpans = aFuncMark.GetMarkedColSpans();
|
|
|
|
|
|
|
|
if (aSpans.empty())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
SCCOLROW nCurPos = bRows ? GetViewData().GetCurY() : GetViewData().GetCurX();
|
2014-02-05 00:07:21 -05:00
|
|
|
aSpans.push_back(sc::ColRowSpan(nCurPos, nCurPos));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// test if allowed
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nErrorId = 0;
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bNeedRefresh = false;
|
2014-02-05 00:07:21 -05:00
|
|
|
for (size_t i = 0, n = aSpans.size(); i < n && !nErrorId; ++i)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-05 00:07:21 -05:00
|
|
|
SCCOLROW nStart = aSpans[i].mnStart;
|
|
|
|
SCCOLROW nEnd = aSpans[i].mnEnd;
|
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)
|
2014-02-05 00:07:21 -05:00
|
|
|
if (i == 0)
|
2005-10-21 11:10:08 +00:00
|
|
|
{
|
|
|
|
// test to the end of the sheet
|
2014-06-18 12:14:29 +02:00
|
|
|
ScEditableTester aTester( &rDoc, nTab, nStartCol, nStartRow, MAXCOL, MAXROW );
|
2005-10-21 11:10:08 +00:00
|
|
|
if (!aTester.IsEditable())
|
|
|
|
nErrorId = aTester.GetMessageId();
|
|
|
|
}
|
|
|
|
|
|
|
|
// merged cells
|
|
|
|
SCCOL nMergeStartX = nStartCol;
|
|
|
|
SCROW nMergeStartY = nStartRow;
|
|
|
|
SCCOL nMergeEndX = nEndCol;
|
|
|
|
SCROW nMergeEndY = nEndRow;
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
|
|
|
|
rDoc.ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
|
2005-10-21 11:10:08 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bNeedRefresh = true;
|
2005-10-21 11:10:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nErrorId )
|
|
|
|
{
|
|
|
|
ErrorMessage( nErrorId );
|
|
|
|
return;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// proceed
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
WaitObject aWait( GetFrameWin() ); // important for TrackFormulas in UpdateReference
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocument* pUndoDoc = NULL;
|
|
|
|
ScRefUndoData* pUndoData = NULL;
|
|
|
|
if (bRecord)
|
|
|
|
{
|
|
|
|
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
2014-06-18 12:14:29 +02:00
|
|
|
pUndoDoc->InitUndo( &rDoc, nTab, nTab, !bRows, bRows ); // row height
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-05 00:07:21 -05:00
|
|
|
for (size_t i = 0, n = aSpans.size(); i < n; ++i)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-05 00:07:21 -05:00
|
|
|
SCCOLROW nStart = aSpans[i].mnStart;
|
|
|
|
SCCOLROW nEnd = aSpans[i].mnEnd;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bRows)
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, IDF_ALL,false,pUndoDoc );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.CopyToDocument( static_cast<SCCOL>(nStart),0,nTab,
|
2004-06-04 11:11:19 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// all Formulas because of references
|
2014-06-18 12:14:29 +02:00
|
|
|
SCTAB nTabCount = rDoc.GetTableCount();
|
2011-03-10 16:55:21 -05:00
|
|
|
pUndoDoc->AddUndoTab( 0, nTabCount-1, false, false );
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.CopyToDocument( 0,0,0, MAXCOL,MAXROW,MAXTAB, IDF_FORMULA,false,pUndoDoc );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
pUndoData = new ScRefUndoData( &rDoc );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.BeginDrawUndo();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-05 00:07:21 -05:00
|
|
|
std::vector<sc::ColRowSpan>::const_reverse_iterator ri = aSpans.rbegin(), riEnd = aSpans.rend();
|
|
|
|
for (; ri != riEnd; ++ri)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-05 00:07:21 -05:00
|
|
|
SCCOLROW nEnd = ri->mnEnd;
|
|
|
|
SCCOLROW nStart = ri->mnStart;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (bRows)
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, nStart, static_cast<SCSIZE>(nEnd-nStart+1) );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.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)
|
|
|
|
{
|
2014-02-05 00:07:21 -05:00
|
|
|
SCCOLROW nFirstStart = aSpans[0].mnStart;
|
2005-10-21 11:10:08 +00:00
|
|
|
SCCOL nStartCol = bRows ? 0 : static_cast<SCCOL>(nFirstStart);
|
|
|
|
SCROW nStartRow = bRows ? static_cast<SCROW>(nFirstStart) : 0;
|
|
|
|
SCCOL nEndCol = MAXCOL;
|
|
|
|
SCROW nEndRow = MAXROW;
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER );
|
|
|
|
rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true );
|
2005-10-21 11:10:08 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bRecord)
|
|
|
|
{
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2014-02-05 00:07:21 -05:00
|
|
|
new ScUndoDeleteMulti(
|
|
|
|
pDocSh, bRows, bNeedRefresh, nTab, aSpans, pUndoDoc, pUndoData));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!AdjustRowHeight(0, MAXROW))
|
2008-12-11 07:05:03 +00:00
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bRows)
|
2014-02-05 00:07:21 -05:00
|
|
|
{
|
|
|
|
pDocSh->PostPaint(
|
|
|
|
0, aSpans[0].mnStart, nTab,
|
|
|
|
MAXCOL, MAXROW, nTab, (PAINT_GRID | PAINT_LEFT));
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-02-05 00:07:21 -05:00
|
|
|
{
|
|
|
|
pDocSh->PostPaint(
|
|
|
|
static_cast<SCCOL>(aSpans[0].mnStart), 0, nTab,
|
|
|
|
MAXCOL, MAXROW, nTab, (PAINT_GRID | PAINT_TOP));
|
|
|
|
}
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
2013-09-01 14:31:36 -04:00
|
|
|
|
|
|
|
ResetAutoSpell();
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
|
|
|
|
|
|
|
CellContentChanged();
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// put cursor directly behind the first deleted range
|
2014-06-18 12:14:29 +02:00
|
|
|
SCCOL nCurX = GetViewData().GetCurX();
|
|
|
|
SCROW nCurY = GetViewData().GetCurY();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bRows )
|
2014-02-05 00:07:21 -05:00
|
|
|
nCurY = aSpans[0].mnStart;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-02-05 00:07:21 -05:00
|
|
|
nCurX = static_cast<SCCOL>(aSpans[0].mnStart);
|
2000-09-18 16:07:07 +00:00
|
|
|
SetCursor( nCurX, nCurY );
|
2005-09-28 11:20:28 +00:00
|
|
|
|
2014-06-27 10:26:55 +02:00
|
|
|
SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// delete contents
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-08-22 15:15:17 +02:00
|
|
|
void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags, bool bRecord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
rViewData.SetPasteMode( SC_PASTE_NONE );
|
|
|
|
rViewData.GetViewShell()->UpdateCopySourceOverlay();
|
2010-09-28 11:13:12 -04:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// not editable because of matrix only? attribute OK nonetheless
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bOnlyNotBecauseOfMatrix;
|
2013-10-10 19:26:07 +02:00
|
|
|
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;
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bSimple = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
|
2004-09-09 08:31:12 +00:00
|
|
|
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-09-09 08:31:12 +00:00
|
|
|
if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
aMarkRange.aStart.SetCol(GetViewData().GetCurX());
|
|
|
|
aMarkRange.aStart.SetRow(GetViewData().GetCurY());
|
|
|
|
aMarkRange.aStart.SetTab(GetViewData().GetTabNo());
|
2000-09-18 16:07:07 +00:00
|
|
|
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
|
2013-10-10 19:26:07 +02:00
|
|
|
bSimple = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
HideAllCursors(); // for if summary is cancelled
|
2014-10-10 20:07:54 -04:00
|
|
|
|
|
|
|
ScDocFunc& rDocFunc = pDocSh->GetDocFunc();
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bSimple)
|
2014-10-10 20:07:54 -04:00
|
|
|
rDocFunc.DeleteCell(aMarkRange.aStart, aFuncMark, nFlags, bRecord, false);
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-10-10 20:07:54 -04:00
|
|
|
rDocFunc.DeleteContents(aFuncMark, nFlags, bRecord, false);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2009-02-17 09:19:30 +00:00
|
|
|
|
2013-10-15 13:23:28 +01:00
|
|
|
if (ScModelObj *pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh))
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2013-10-15 13:23:28 +01:00
|
|
|
ScRangeList aChangeRanges;
|
2009-02-17 09:19:30 +00:00
|
|
|
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
|
|
|
}
|
2013-10-15 13:23:28 +01:00
|
|
|
HelperNotifyChanges::Notify(*pModelObj, aChangeRanges);
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
CellContentChanged();
|
|
|
|
ShowAllCursors();
|
|
|
|
|
|
|
|
if ( nFlags & IDF_ATTRIB )
|
|
|
|
{
|
|
|
|
if ( nFlags & IDF_CONTENTS )
|
|
|
|
ForgetFormatArea();
|
|
|
|
else
|
2011-11-11 14:50:52 +00:00
|
|
|
StartFormatArea(); // delete attribute is also attribute-change
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// column width/row height (via header) - undo OK
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-27 21:29:30 -05:00
|
|
|
void ScViewFunc::SetWidthOrHeight(
|
|
|
|
bool bWidth, const std::vector<sc::ColRowSpan>& rRanges, ScSizeMode eMode,
|
|
|
|
sal_uInt16 nSizeTwips, bool bRecord, bool bPaint, ScMarkData* pMarkData )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-27 21:29:30 -05:00
|
|
|
if (rRanges.empty())
|
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 )
|
2014-06-18 12:14:29 +02:00
|
|
|
pMarkData = &GetViewData().GetMarkData();
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nFirstTab = pMarkData->GetFirstSelected();
|
2014-06-18 12:14:29 +02:00
|
|
|
SCTAB nCurTab = GetViewData().GetTabNo();
|
2004-06-04 11:11:19 +00:00
|
|
|
SCTAB nTab;
|
2014-06-18 12:14:29 +02:00
|
|
|
if (bRecord && !rDoc.IsUndoEnabled())
|
2011-03-10 16:55:21 -05:00
|
|
|
bRecord = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bAllowed = true;
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = pMarkData->begin(), itrEnd = pMarkData->end();
|
|
|
|
for (; itr != itrEnd && bAllowed; ++itr)
|
2014-02-27 21:29:30 -05:00
|
|
|
{
|
|
|
|
for (size_t i = 0, n = rRanges.size(); i < n && bAllowed; ++i)
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bOnlyMatrix;
|
2011-07-05 00:41:08 +02:00
|
|
|
if (bWidth)
|
2014-02-27 21:29:30 -05:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
bAllowed = rDoc.IsBlockEditable(
|
2014-02-27 21:29:30 -05:00
|
|
|
*itr, rRanges[i].mnStart, 0, rRanges[i].mnEnd, MAXROW,
|
2011-07-05 00:41:08 +02:00
|
|
|
&bOnlyMatrix ) || bOnlyMatrix;
|
2014-02-27 21:29:30 -05:00
|
|
|
}
|
2011-07-05 00:41:08 +02:00
|
|
|
else
|
2014-02-27 21:29:30 -05:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
bAllowed = rDoc.IsBlockEditable(
|
2014-02-27 21:29:30 -05:00
|
|
|
*itr, 0, rRanges[i].mnStart, MAXCOL,rRanges[i].mnEnd, &bOnlyMatrix) || bOnlyMatrix;
|
|
|
|
}
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
2014-02-27 21:29:30 -05: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;
|
|
|
|
}
|
|
|
|
|
2014-02-27 21:29:30 -05:00
|
|
|
SCCOLROW nStart = rRanges[0].mnStart;
|
|
|
|
SCCOLROW nEnd = rRanges[0].mnEnd;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bFormula = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( eMode == SC_SIZE_OPTIMAL )
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
const ScViewOptions& rOpts = GetViewData().GetOptions();
|
2000-09-18 16:07:07 +00:00
|
|
|
bFormula = rOpts.GetOption( VOPT_FORMULAS );
|
|
|
|
}
|
|
|
|
|
|
|
|
ScDocument* pUndoDoc = NULL;
|
|
|
|
ScOutlineTable* pUndoTab = NULL;
|
2014-02-27 21:29:30 -05:00
|
|
|
std::vector<sc::ColRowSpan> aUndoRanges;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bRecord )
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.BeginDrawUndo(); // Drawing Updates
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
|
2011-07-05 00:41:08 +02:00
|
|
|
itr = pMarkData->begin();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
{
|
|
|
|
if (bWidth)
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
if ( *itr == nFirstTab )
|
2014-06-18 12:14:29 +02:00
|
|
|
pUndoDoc->InitUndo( &rDoc, *itr, *itr, true, false );
|
2000-11-16 12:13:46 +00:00
|
|
|
else
|
2011-07-05 00:41:08 +02:00
|
|
|
pUndoDoc->AddUndoTab( *itr, *itr, true, false );
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, *itr,
|
2011-07-05 00:41:08 +02:00
|
|
|
static_cast<SCCOL>(nEnd), MAXROW, *itr, IDF_NONE,
|
|
|
|
false, pUndoDoc );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( *itr == nFirstTab )
|
2014-06-18 12:14:29 +02:00
|
|
|
pUndoDoc->InitUndo( &rDoc, *itr, *itr, false, true );
|
2011-07-05 00:41:08 +02:00
|
|
|
else
|
|
|
|
pUndoDoc->AddUndoTab( *itr, *itr, false, true );
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.CopyToDocument( 0, nStart, *itr, MAXCOL, nEnd, *itr, IDF_NONE, false, pUndoDoc );
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-27 21:29:30 -05:00
|
|
|
aUndoRanges = rRanges;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
//! outlines from all tab?
|
2014-06-18 12:14:29 +02:00
|
|
|
ScOutlineTable* pTable = rDoc.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
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bShow = nSizeTwips > 0 || eMode != SC_SIZE_DIRECT;
|
|
|
|
bool bOutline = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
itr = pMarkData->begin();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
{
|
|
|
|
nTab = *itr;
|
|
|
|
|
2014-02-27 21:29:30 -05:00
|
|
|
for (size_t i = 0, n = rRanges.size(); i < n; ++i)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-27 21:29:30 -05:00
|
|
|
SCCOLROW nStartNo = rRanges[i].mnStart;
|
|
|
|
SCCOLROW nEndNo = rRanges[i].mnEnd;
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
if ( !bWidth ) // height always blockwise
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bAll = ( eMode==SC_SIZE_OPTIMAL );
|
2011-07-05 00:41:08 +02:00
|
|
|
if (!bAll)
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// delete CR_MANUALSIZE for all in range,
|
|
|
|
// then SetOptimalHeight with bShrink = FALSE
|
2011-07-05 00:41:08 +02:00
|
|
|
for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow)
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
SCROW nLastRow = nRow;
|
2014-06-18 12:14:29 +02:00
|
|
|
if (rDoc.RowHidden(nRow, nTab, NULL, &nLastRow))
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
nRow = nLastRow;
|
|
|
|
continue;
|
2010-06-23 13:38:34 +02:00
|
|
|
}
|
2001-05-11 16:11:53 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
sal_uInt8 nOld = rDoc.GetRowFlags(nRow, nTab);
|
2011-07-05 00:41:08 +02:00
|
|
|
if (nOld & CR_MANUALSIZE)
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.SetRowFlags(nRow, nTab, nOld & ~CR_MANUALSIZE);
|
2001-05-11 16:11:53 +00:00
|
|
|
}
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
2001-05-11 16:11:53 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
double nPPTX = GetViewData().GetPPTX();
|
|
|
|
double nPPTY = GetViewData().GetPPTY();
|
2014-10-23 17:41:47 +02:00
|
|
|
Fraction aZoomX = GetViewData().GetZoomX();
|
|
|
|
Fraction aZoomY = GetViewData().GetZoomY();
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
ScSizeDeviceProvider aProv(pDocSh);
|
|
|
|
if (aProv.IsPrinter())
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
nPPTX = aProv.GetPPTX();
|
|
|
|
nPPTY = aProv.GetPPTY();
|
2014-10-23 17:41:47 +02:00
|
|
|
aZoomX = aZoomY = Fraction( 1, 1 );
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
2011-07-05 00:41:08 +02:00
|
|
|
|
2014-02-01 20:51:29 -05:00
|
|
|
sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
|
|
|
|
aCxt.setForceAutoSize(bAll);
|
|
|
|
aCxt.setExtraHeight(nSizeTwips);
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);
|
2011-07-05 00:41:08 +02:00
|
|
|
if (bAll)
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.ShowRows( nStartNo, nEndNo, nTab, true );
|
2011-07-05 00:41:08 +02:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// Manual-Flag already (re)set in SetOptimalHeight in case of bAll=sal_True
|
|
|
|
// (set for Extra-Height, else reset).
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
|
|
|
else if ( eMode==SC_SIZE_DIRECT )
|
|
|
|
{
|
|
|
|
if (nSizeTwips)
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.SetRowHeightRange( nStartNo, nEndNo, nTab, nSizeTwips );
|
|
|
|
rDoc.SetManualHeight( nStartNo, nEndNo, nTab, true ); // height was set manually
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.ShowRows( nStartNo, nEndNo, nTab, nSizeTwips != 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2011-07-05 00:41:08 +02:00
|
|
|
else if ( eMode==SC_SIZE_SHOW )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.ShowRows( nStartNo, nEndNo, nTab, true );
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
|
|
|
}
|
2011-11-11 14:50:52 +00:00
|
|
|
else // column width
|
2011-07-05 00:41:08 +02:00
|
|
|
{
|
|
|
|
for (SCCOL nCol=static_cast<SCCOL>(nStartNo); nCol<=static_cast<SCCOL>(nEndNo); nCol++)
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
if ( eMode != SC_SIZE_VISOPT || !rDoc.ColHidden(nCol, nTab) )
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
sal_uInt16 nThisSize = nSizeTwips;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
|
|
|
|
nThisSize = nSizeTwips + GetOptimalColWidth( nCol, nTab, bFormula );
|
|
|
|
if ( nThisSize )
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.SetColWidth( nCol, nTab, nThisSize );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.ShowCol( nCol, nTab, bShow );
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// adjust outline
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
if (bWidth)
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
if ( rDoc.UpdateOutlineCol( static_cast<SCCOL>(nStartNo),
|
2011-07-05 00:41:08 +02:00
|
|
|
static_cast<SCCOL>(nEndNo), nTab, bShow ) )
|
2013-10-10 19:26:07 +02:00
|
|
|
bOutline = true;
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
if ( rDoc.UpdateOutlineRow( nStartNo, nEndNo, nTab, bShow ) )
|
2013-10-10 19:26:07 +02:00
|
|
|
bOutline = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.SetDrawPageSize(nTab);
|
2011-07-05 00:41:08 +02:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (!bOutline)
|
|
|
|
DELETEZ(pUndoTab);
|
|
|
|
|
|
|
|
if (bRecord)
|
|
|
|
{
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(
|
2014-02-27 21:29:30 -05:00
|
|
|
new ScUndoWidthOrHeight(
|
|
|
|
pDocSh, *pMarkData, nStart, nCurTab, nEnd, nCurTab,
|
|
|
|
pUndoDoc, aUndoRanges, pUndoTab, eMode, nSizeTwips, bWidth));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-10 14:29:22 +01:00
|
|
|
// fdo#36247 Ensure that the drawing layer's map mode scaling factors match
|
|
|
|
// the new heights and widths.
|
2014-06-18 12:14:29 +02:00
|
|
|
GetViewData().GetView()->RefreshZoom();
|
2011-11-10 14:29:22 +01:00
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
itr = pMarkData->begin();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.UpdatePageBreaks( *itr );
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
GetViewData().GetView()->UpdateScrollBars();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (bPaint)
|
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
itr = pMarkData->begin();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
{
|
|
|
|
nTab = *itr;
|
|
|
|
if (bWidth)
|
2000-11-16 12:13:46 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
if (rDoc.HasAttrib( static_cast<SCCOL>(nStart),0,nTab,
|
2011-07-05 00:41:08 +02:00
|
|
|
static_cast<SCCOL>(nEnd),MAXROW,nTab,
|
|
|
|
HASATTR_MERGED | HASATTR_OVERLAPPED ))
|
|
|
|
nStart = 0;
|
2011-11-11 14:50:52 +00:00
|
|
|
if (nStart > 0) // go upwards because of Lines and cursor
|
2011-07-05 00:41:08 +02:00
|
|
|
--nStart;
|
|
|
|
pDocSh->PostPaint( static_cast<SCCOL>(nStart), 0, nTab,
|
|
|
|
MAXCOL, MAXROW, nTab, PAINT_GRID | PAINT_TOP );
|
2000-11-16 12:13:46 +00:00
|
|
|
}
|
2011-07-05 00:41:08 +02:00
|
|
|
else
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
if (rDoc.HasAttrib( 0,nStart,nTab, MAXCOL,nEnd,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED ))
|
2011-07-05 00:41:08 +02:00
|
|
|
nStart = 0;
|
|
|
|
if (nStart != 0)
|
|
|
|
--nStart;
|
|
|
|
pDocSh->PostPaint( 0, nStart, nTab, MAXCOL, MAXROW, nTab, PAINT_GRID | PAINT_LEFT );
|
|
|
|
}
|
|
|
|
}
|
2000-11-16 12:13:46 +00:00
|
|
|
|
2014-06-18 12:14:29 +02: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();
|
|
|
|
}
|
2009-02-17 09:19:30 +00:00
|
|
|
|
|
|
|
if ( bWidth )
|
|
|
|
{
|
2013-10-15 13:23:28 +01:00
|
|
|
if (ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh))
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2013-10-15 13:23:28 +01:00
|
|
|
ScRangeList aChangeRanges;
|
2011-07-05 00:41:08 +02:00
|
|
|
itr = pMarkData->begin();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
nTab = *itr;
|
2014-02-27 21:29:30 -05:00
|
|
|
for (size_t i = 0, n = rRanges.size(); i < n; ++i)
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2014-02-27 21:29:30 -05:00
|
|
|
SCCOL nStartCol = rRanges[i].mnStart;
|
|
|
|
SCCOL nEndCol = rRanges[i].mnEnd;
|
2011-07-05 00:41:08 +02:00
|
|
|
for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
|
2009-02-17 09:19:30 +00:00
|
|
|
{
|
2011-07-05 00:41:08 +02:00
|
|
|
aChangeRanges.Append( ScRange( nCol, 0, nTab ) );
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-10-15 13:23:28 +01:00
|
|
|
HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "column-resize");
|
2009-02-17 09:19:30 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// column width/row height (via marked range)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
void ScViewFunc::SetMarkedWidthOrHeight( bool bWidth, ScSizeMode eMode, sal_uInt16 nSizeTwips,
|
|
|
|
bool bRecord, bool bPaint )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScMarkData& rMark = GetViewData().GetMarkData();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
rMark.MarkToMulti();
|
|
|
|
if (!rMark.IsMultiMarked())
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
SCCOL nCol = GetViewData().GetCurX();
|
|
|
|
SCROW nRow = GetViewData().GetCurY();
|
|
|
|
SCTAB nTab = GetViewData().GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
DoneBlockMode();
|
|
|
|
InitOwnBlockMode();
|
2013-10-10 19:26:07 +02:00
|
|
|
rMark.SetMultiMarkArea( ScRange( nCol,nRow,nTab ), true );
|
2008-02-19 14:42:20 +00:00
|
|
|
MarkDataChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 21:29:30 -05:00
|
|
|
std::vector<sc::ColRowSpan> aRanges =
|
|
|
|
bWidth ? rMark.GetMarkedColSpans() : rMark.GetMarkedRowSpans();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-27 21:29:30 -05:00
|
|
|
SetWidthOrHeight(bWidth, aRanges, eMode, nSizeTwips, bRecord, bPaint);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
rMark.MarkToSimple();
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
//! step size adjustable
|
2014-11-10 15:05:25 +01:00
|
|
|
// step size is also 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();
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bAnyEdit = pScMod->IsInputMode();
|
2014-06-18 12:14:29 +02:00
|
|
|
SCCOL nCol = GetViewData().GetCurX();
|
|
|
|
SCROW nRow = GetViewData().GetCurY();
|
|
|
|
SCTAB nTab = GetViewData().GetTabNo();
|
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bAllowed, bOnlyMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( eDir == DIR_LEFT || eDir == DIR_RIGHT )
|
2014-06-18 12:14:29 +02:00
|
|
|
bAllowed = rDoc.IsBlockEditable( nTab, nCol,0, nCol,MAXROW, &bOnlyMatrix );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-06-18 12:14:29 +02:00
|
|
|
bAllowed = rDoc.IsBlockEditable( nTab, 0,nRow, MAXCOL,nRow, &bOnlyMatrix );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !bAllowed && !bOnlyMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
HideAllCursors();
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
sal_uInt16 nWidth = rDoc.GetColWidth( nCol, nTab );
|
|
|
|
sal_uInt16 nHeight = rDoc.GetRowHeight( nRow, nTab );
|
2014-02-27 21:29:30 -05:00
|
|
|
std::vector<sc::ColRowSpan> aRange(1, sc::ColRowSpan(0,0));
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( eDir == DIR_LEFT || eDir == DIR_RIGHT )
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
if (bOptimal) // width of this single cell
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( bAnyEdit )
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// when editing the actual entered width
|
2014-06-18 12:14:29 +02:00
|
|
|
ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData().GetViewShell() );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (pHdl)
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
long nEdit = pHdl->GetTextSize().Width(); // in 0.01 mm
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab );
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvxMarginItem& rMItem =
|
2014-10-27 14:18:59 +02:00
|
|
|
static_cast<const SvxMarginItem&>(pPattern->GetItem(ATTR_MARGIN));
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nMargin = rMItem.GetLeftMargin() + rMItem.GetRightMargin();
|
2014-10-27 14:18:59 +02:00
|
|
|
if ( static_cast<const SvxHorJustifyItem&>( pPattern->
|
2000-09-18 16:07:07 +00:00
|
|
|
GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_LEFT )
|
2011-01-17 13:20:22 +01:00
|
|
|
nMargin = sal::static_int_cast<sal_uInt16>(
|
2014-10-27 14:18:59 +02:00
|
|
|
nMargin + static_cast<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
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
double nPPTX = GetViewData().GetPPTX();
|
|
|
|
double nPPTY = GetViewData().GetPPTY();
|
2014-10-23 17:41:47 +02:00
|
|
|
Fraction aZoomX = GetViewData().GetZoomX();
|
|
|
|
Fraction aZoomY = GetViewData().GetZoomY();
|
2001-10-31 14:59:24 +00:00
|
|
|
|
|
|
|
ScSizeDeviceProvider aProv(pDocSh);
|
|
|
|
if (aProv.IsPrinter())
|
|
|
|
{
|
|
|
|
nPPTX = aProv.GetPPTX();
|
|
|
|
nPPTY = aProv.GetPPTY();
|
2014-10-23 17:41:47 +02:00
|
|
|
aZoomX = aZoomY = Fraction( 1, 1 );
|
2001-10-31 14:59:24 +00:00
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
long nPixel = rDoc.GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(),
|
2013-10-10 19:26:07 +02:00
|
|
|
nPPTX, nPPTY, aZoomX, aZoomY, true );
|
2011-01-17 13:20:22 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2011-11-11 14:50:52 +00:00
|
|
|
else // increment / decrement
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2014-02-27 21:29:30 -05:00
|
|
|
aRange[0].mnStart = nCol;
|
|
|
|
aRange[0].mnEnd = nCol;
|
|
|
|
SetWidthOrHeight(true, aRange, SC_SIZE_DIRECT, nWidth);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// adjust height of this row if width demands/allows this
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (!bAnyEdit)
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab );
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bNeedHeight =
|
2014-10-27 14:18:59 +02:00
|
|
|
static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_LINEBREAK )).GetValue() ||
|
|
|
|
static_cast<const SvxHorJustifyItem&>(pPattern->
|
2000-09-18 16:07:07 +00:00
|
|
|
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;
|
2011-11-11 14:50:52 +00:00
|
|
|
if ( nHeight > MAX_ROW_HEIGHT ) nHeight = MAX_ROW_HEIGHT;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-02-27 21:29:30 -05:00
|
|
|
aRange[0].mnStart = nRow;
|
|
|
|
aRange[0].mnEnd = nRow;
|
|
|
|
SetWidthOrHeight(false, aRange, eMode, nHeight);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bAnyEdit )
|
|
|
|
{
|
|
|
|
UpdateEditView();
|
2014-06-18 12:14:29 +02:00
|
|
|
if ( rDoc.HasAttrib( nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_NEEDHEIGHT ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData().GetViewShell() );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (pHdl)
|
2011-11-11 14:50:52 +00:00
|
|
|
pHdl->SetModified(); // so that the height is adjusted with Enter
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScMarkData& rMark = GetViewData().GetMarkData();
|
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
2012-04-02 16:50:15 +01:00
|
|
|
ScDocFunc &rFunc = pDocSh->GetDocFunc();
|
2014-06-18 12:14:29 +02:00
|
|
|
bool bUndo(rDoc.IsUndoEnabled());
|
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
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// modifying several tabs is handled here
|
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
|
|
|
|
|
|
|
if (bUndo)
|
|
|
|
{
|
2013-10-04 16:14:14 +02:00
|
|
|
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_PROTECT_TAB );
|
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
|
|
|
pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
|
|
|
|
}
|
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2012-04-02 16:50:15 +01:00
|
|
|
rFunc.ProtectSheet(*itr, rProtect);
|
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
|
|
|
|
|
|
|
if (bUndo)
|
|
|
|
pDocSh->GetUndoManager()->LeaveListAction();
|
|
|
|
|
|
|
|
UpdateLayerLocks(); //! broadcast to all views
|
|
|
|
}
|
|
|
|
|
2013-09-19 17:11:28 +02:00
|
|
|
void ScViewFunc::Protect( SCTAB nTab, const OUString& rPassword )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScMarkData& rMark = GetViewData().GetMarkData();
|
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
2012-04-02 16:50:15 +01:00
|
|
|
ScDocFunc &rFunc = pDocSh->GetDocFunc();
|
2014-06-18 12:14:29 +02:00
|
|
|
bool bUndo(rDoc.IsUndoEnabled());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 )
|
2012-04-02 16:50:15 +01:00
|
|
|
rFunc.Protect( nTab, rPassword, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// modifying several tabs is handled here
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bUndo)
|
|
|
|
{
|
2013-10-04 16:14:14 +02:00
|
|
|
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_PROTECT_TAB );
|
2001-02-14 14:34:08 +00:00
|
|
|
pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2012-04-02 16:50:15 +01:00
|
|
|
rFunc.Protect( *itr, 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
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool ScViewFunc::Unprotect( SCTAB nTab, const OUString& rPassword )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScMarkData& rMark = GetViewData().GetMarkData();
|
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
2012-04-02 16:50:15 +01:00
|
|
|
ScDocFunc &rFunc = pDocSh->GetDocFunc();
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bChanged = false;
|
2014-06-18 12:14:29 +02:00
|
|
|
bool bUndo (rDoc.IsUndoEnabled());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 )
|
2012-04-02 16:50:15 +01:00
|
|
|
bChanged = rFunc.Unprotect( nTab, rPassword, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// modifying several tabs is handled here
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-14 14:34:08 +00:00
|
|
|
if (bUndo)
|
|
|
|
{
|
2013-10-04 16:14:14 +02:00
|
|
|
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_UNPROTECT_TAB );
|
2001-02-14 14:34:08 +00:00
|
|
|
pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-07-05 00:41:08 +02:00
|
|
|
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2012-04-02 16:50:15 +01:00
|
|
|
if ( rFunc.Unprotect( *itr, rPassword, false ) )
|
2013-10-10 19:26:07 +02:00
|
|
|
bChanged = 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;
|
|
|
|
}
|
|
|
|
|
2013-09-19 17:11:28 +02:00
|
|
|
void ScViewFunc::SetNoteText( const ScAddress& rPos, const OUString& rNoteText )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
GetViewData().GetDocShell()->GetDocFunc().SetNoteText( rPos, rNoteText, false );
|
2009-03-02 14:19:13 +00:00
|
|
|
}
|
|
|
|
|
2013-02-22 11:13:35 +00:00
|
|
|
void ScViewFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, const OUString* pAuthor, const OUString* pDate )
|
2009-03-02 14:19:13 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02: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
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// not editable because of matrix only? attribute OK nonetheless
|
2011-08-25 11:33:20 +02:00
|
|
|
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;
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = rViewData.GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
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;
|
2014-06-18 12:14:29 +02:00
|
|
|
pDoc->GetNumberFormat( rViewData.GetCurX(),
|
|
|
|
rViewData.GetCurY(),
|
|
|
|
rViewData.GetTabNo(),
|
2000-09-18 16:07:07 +00:00
|
|
|
nCurrentNumberFormat );
|
|
|
|
const SvNumberformat* pEntry = pNumberFormatter->GetEntry( nCurrentNumberFormat );
|
|
|
|
if (pEntry)
|
2011-11-11 14:50:52 +00:00
|
|
|
eLanguage = pEntry->GetLanguage(); // else keep ScGlobal::eLnge
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
nNumberFormat = pNumberFormatter->GetStandardFormat( nFormatType, eLanguage ) + nAdd;
|
|
|
|
|
|
|
|
SfxItemSet& rSet = aNewAttrs.GetItemSet();
|
|
|
|
rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumberFormat ) );
|
2011-11-11 14:50:52 +00:00
|
|
|
// ATTR_LANGUAGE_FORMAT not
|
2013-10-10 19:26:07 +02:00
|
|
|
ApplySelectionPattern( aNewAttrs, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-09-19 17:11:28 +02:00
|
|
|
void ScViewFunc::SetNumFmtByStr( const OUString& rCode )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// not editable because of matrix only? attribute OK nonetheless
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
ScDocument* pDoc = rViewData.GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// language always from cursor position
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nCurrentNumberFormat;
|
2014-06-18 12:14:29 +02:00
|
|
|
pDoc->GetNumberFormat( rViewData.GetCurX(), rViewData.GetCurY(),
|
|
|
|
rViewData.GetTabNo(), nCurrentNumberFormat );
|
2000-09-18 16:07:07 +00:00
|
|
|
const SvNumberformat* pEntry = pFormatter->GetEntry( nCurrentNumberFormat );
|
|
|
|
LanguageType eLanguage = pEntry ? pEntry->GetLanguage() : ScGlobal::eLnge;
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// determine index for String
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bOk = 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 )
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// enter new
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-11-27 22:58:50 -06:00
|
|
|
OUString aFormat = rCode; // will be changed
|
|
|
|
sal_Int32 nErrPos = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
short nType = 0; //! ???
|
|
|
|
bOk = pFormatter->PutEntry( aFormat, nErrPos, nType, nNumberFormat, eLanguage );
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
if ( bOk ) // valid format?
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScPatternAttr aNewAttrs( pDoc->GetPool() );
|
|
|
|
SfxItemSet& rSet = aNewAttrs.GetItemSet();
|
|
|
|
rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumberFormat ) );
|
|
|
|
rSet.Put( SvxLanguageItem( eLanguage, ATTR_LANGUAGE_FORMAT ) );
|
2013-10-10 19:26:07 +02:00
|
|
|
ApplySelectionPattern( aNewAttrs, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
//! else return error / issue warning ???
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// not editable because of matrix only? attribute OK nonetheless
|
2011-08-25 11:33:20 +02:00
|
|
|
bool bOnlyNotBecauseOfMatrix;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
|
|
|
|
{
|
|
|
|
ErrorMessage(STR_PROTECTIONERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
2000-09-18 16:07:07 +00:00
|
|
|
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
|
|
|
|
|
2014-06-18 12:14:29 +02: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-11-15 08:03:24 +01:00
|
|
|
OSL_FAIL("numberformat not found !!!");
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// what have we got here?
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-12-14 14:12:16 +00:00
|
|
|
sal_uInt32 nNewFormat = nOldFormat;
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bError = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
LanguageType eLanguage = pOldEntry->GetLanguage();
|
2011-08-10 01:32:41 +02:00
|
|
|
bool bThousand, bNegRed;
|
2011-01-17 13:20:22 +01:00
|
|
|
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 & (
|
2015-02-25 09:49:59 +02:00
|
|
|
css::util::NumberFormat::NUMBER | css::util::NumberFormat::CURRENCY | css::util::NumberFormat::PERCENT | css::util::NumberFormat::SCIENTIFIC ) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// date, time, fraction, logical, text can not be changed
|
2013-10-10 19:26:07 +02:00
|
|
|
bError = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
//! SvNumberformat has a Member bStandard, but doesn't disclose it
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bWasStandard = ( nOldFormat == pFormatter->GetStandardIndex( eLanguage ) );
|
2015-01-31 16:47:28 +01:00
|
|
|
OUString sExponentialStandardFormat = "";
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bWasStandard)
|
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// with "Standard" the decimal places depend on cell content
|
|
|
|
// 0 if empty or text -> no decimal places
|
2000-09-18 16:07:07 +00:00
|
|
|
double nVal = pDoc->GetValue( ScAddress( nCol, nRow, nTab ) );
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// the ways of the Numberformatters are unfathomable, so try:
|
2012-11-24 19:01:58 -06:00
|
|
|
OUString aOut;
|
2000-09-18 16:07:07 +00:00
|
|
|
Color* pCol;
|
2015-03-26 15:30:25 +01:00
|
|
|
const_cast<SvNumberformat*>(pOldEntry)->GetOutputString( nVal, aOut, &pCol );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
nPrecision = 0;
|
2011-11-11 14:50:52 +00:00
|
|
|
// 'E' for exponential is fixed in Numberformatter
|
2015-01-31 16:47:28 +01:00
|
|
|
sal_Int32 nIndexE = aOut.indexOf((sal_Unicode)'E');
|
|
|
|
if ( nIndexE >= 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-01-31 16:47:28 +01:00
|
|
|
sExponentialStandardFormat = aOut.copy( nIndexE ).replace( '-', '+' );
|
|
|
|
for ( sal_Int32 i=1 ; i<sExponentialStandardFormat.getLength() ; i++ )
|
|
|
|
{
|
|
|
|
if ( sExponentialStandardFormat[i] >= '1' && sExponentialStandardFormat[i] <= '9' )
|
|
|
|
sExponentialStandardFormat = sExponentialStandardFormat.replaceAt( i, 1, OUString( "0" ) );
|
|
|
|
}
|
|
|
|
aOut = aOut.copy( 0, nIndexE ); // remove exponential part
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2015-01-31 16:47:28 +01:00
|
|
|
OUString aDecSep( pFormatter->GetFormatDecimalSep( nOldFormat ) );
|
|
|
|
sal_Int32 nPos = aOut.indexOf( aDecSep );
|
|
|
|
if ( nPos >= 0 )
|
|
|
|
nPrecision = aOut.getLength() - nPos - aDecSep.getLength();
|
|
|
|
// else keep 0
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!bError)
|
|
|
|
{
|
|
|
|
if (bIncrement)
|
|
|
|
{
|
|
|
|
if (nPrecision<20)
|
2011-11-11 14:50:52 +00:00
|
|
|
++nPrecision; // increment
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2013-10-10 19:26:07 +02:00
|
|
|
bError = true; // 20 is maximum
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (nPrecision)
|
2011-11-11 14:50:52 +00:00
|
|
|
--nPrecision; // decrement
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-11-10 15:05:25 +01:00
|
|
|
bError = true; // 0 is minimum
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bError)
|
|
|
|
{
|
2012-11-27 22:58:50 -06:00
|
|
|
OUString aNewPicture = pFormatter->GenerateFormat(nOldFormat, eLanguage,
|
|
|
|
bThousand, bNegRed,
|
2015-01-31 16:47:28 +01:00
|
|
|
nPrecision, nLeading)
|
|
|
|
+ sExponentialStandardFormat;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
nNewFormat = pFormatter->GetEntryKey( aNewPicture, eLanguage );
|
|
|
|
if ( nNewFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
|
|
|
|
{
|
2012-11-27 22:58:50 -06:00
|
|
|
sal_Int32 nErrPos = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
short nNewType = 0;
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bOk = pFormatter->PutEntry( aNewPicture, nErrPos,
|
2000-09-18 16:07:07 +00:00
|
|
|
nNewType, nNewFormat, eLanguage );
|
2011-11-15 08:03:24 +01:00
|
|
|
OSL_ENSURE( bOk, "incorrect numberformat generated" );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (!bOk)
|
2013-10-10 19:26:07 +02:00
|
|
|
bError = 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 ) );
|
2011-11-11 14:50:52 +00:00
|
|
|
// ATTR_LANGUAGE_FORMAT not
|
2013-10-10 19:26:07 +02:00
|
|
|
ApplySelectionPattern( aNewAttrs, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
void ScViewFunc::ChangeIndent( bool bIncrement )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewData& rViewData = GetViewData();
|
|
|
|
ScDocShell* pDocSh = rViewData.GetDocShell();
|
|
|
|
ScMarkData& rMark = rViewData.GetMarkData();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScMarkData aWorkMark = rMark;
|
2014-06-18 12:14:29 +02:00
|
|
|
ScViewUtil::UnmarkFiltered( aWorkMark, &pDocSh->GetDocument() );
|
2000-09-18 16:07:07 +00:00
|
|
|
aWorkMark.MarkToMulti();
|
|
|
|
if (!aWorkMark.IsMultiMarked())
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
SCCOL nCol = rViewData.GetCurX();
|
|
|
|
SCROW nRow = rViewData.GetCurY();
|
|
|
|
SCTAB nTab = rViewData.GetTabNo();
|
2000-09-18 16:07:07 +00:00
|
|
|
aWorkMark.SetMultiMarkArea( ScRange(nCol,nRow,nTab) );
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bSuccess = pDocSh->GetDocFunc().ChangeIndent( aWorkMark, bIncrement, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
if (bSuccess)
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&rViewData);
|
2000-09-18 16:07:07 +00:00
|
|
|
StartFormatArea();
|
2013-04-10 08:20:16 +00:00
|
|
|
|
|
|
|
// stuff for sidebar panels
|
2014-06-18 12:14:29 +02:00
|
|
|
SfxBindings& rBindings = GetViewData().GetBindings();
|
2013-04-10 08:20:16 +00:00
|
|
|
rBindings.Invalidate( SID_H_ALIGNCELL );
|
|
|
|
rBindings.Invalidate( SID_ATTR_ALIGN_INDENT );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol,
|
2013-08-29 20:44:22 +01:00
|
|
|
const OUString& rType )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-11-11 14:50:52 +00:00
|
|
|
// Type = P,R,C,F (and combinations)
|
|
|
|
//! undo...
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bOk = false;
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocSh = GetViewData().GetDocShell();
|
|
|
|
ScDocument& rDoc = pDocSh->GetDocument();
|
|
|
|
SCTAB nTab = GetViewData().GetTabNo();
|
|
|
|
ScRangeName* pList = rDoc.GetRangeName();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
RangeType nType = RT_NAME;
|
2014-06-18 12:14:29 +02:00
|
|
|
ScRangeData* pNewEntry = new ScRangeData( &rDoc, rName, rSymbol,
|
|
|
|
ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(),
|
2002-11-28 15:16:44 +00:00
|
|
|
nTab), nType );
|
2013-10-04 16:14:14 +02:00
|
|
|
OUString aUpType = rType.toAsciiUpperCase();
|
|
|
|
if ( aUpType.indexOf( 'P' ) != -1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
nType |= RT_PRINTAREA;
|
2013-10-04 16:14:14 +02:00
|
|
|
if ( aUpType.indexOf( 'R' ) != -1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
nType |= RT_ROWHEADER;
|
2013-10-04 16:14:14 +02:00
|
|
|
if ( aUpType.indexOf( 'C' ) != -1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
nType |= RT_COLHEADER;
|
2013-10-04 16:14:14 +02:00
|
|
|
if ( aUpType.indexOf( 'F' ) != -1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
nType |= RT_CRITERIA;
|
|
|
|
pNewEntry->AddType(nType);
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
if ( !pNewEntry->GetErrCode() ) // text valid?
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ScDocShellModificator aModificator( *pDocSh );
|
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
rDoc.PreprocessRangeNameUpdate();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
// input available yet? Then remove beforehand (=change)
|
2012-01-06 23:00:40 +00:00
|
|
|
ScRangeData* pData = pList->findByUpperName(ScGlobal::pCharClass->uppercase(rName));
|
2011-03-04 17:48:32 -05:00
|
|
|
if (pData)
|
2011-11-11 14:50:52 +00:00
|
|
|
{ // take old Index
|
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 ) )
|
2013-10-10 19:26:07 +02:00
|
|
|
bOk = true;
|
2011-08-25 01:59:46 +02:00
|
|
|
pNewEntry = NULL; // never delete, insert took ownership
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-07-28 21:34:40 -04:00
|
|
|
rDoc.CompileHybridFormula();
|
2014-04-07 14:13:20 -04:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
aModificator.SetDocumentModified();
|
2014-06-27 10:26:55 +02:00
|
|
|
SfxGetpApp()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-11 14:50:52 +00:00
|
|
|
delete pNewEntry; // if it wasn't inserted
|
2000-09-18 16:07:07 +00:00
|
|
|
return bOk;
|
|
|
|
}
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
void ScViewFunc::CreateNames( sal_uInt16 nFlags )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bDone = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
ScRange aRange;
|
2014-06-18 12:14:29 +02:00
|
|
|
if ( GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE )
|
|
|
|
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;
|
2014-06-18 12:14:29 +02:00
|
|
|
if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nDummy,nEndCol,nEndRow,nDummy) == SC_MARK_SIMPLE)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocument* pDoc = GetViewData().GetDocument();
|
|
|
|
SCTAB nTab = GetViewData().GetTabNo();
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bOk;
|
2004-06-04 11:11:19 +00:00
|
|
|
SCCOL i;
|
|
|
|
SCROW j;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bOk = 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;
|
2011-11-11 14:50:52 +00:00
|
|
|
else // Bottom only if not Top
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bOk = 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;
|
|
|
|
}
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bOk = 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;
|
2011-11-11 14:50:52 +00:00
|
|
|
else // Right only if not Left
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-10-10 19:26:07 +02:00
|
|
|
bOk = 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()
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
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 ) )
|
2014-06-18 12:14:29 +02:00
|
|
|
pDocSh->UpdateOle(&GetViewData());
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-04-15 20:35:47 +01:00
|
|
|
void ScViewFunc::UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* pAttr )
|
|
|
|
{
|
2014-06-18 12:14:29 +02:00
|
|
|
ScDocShell* pDocShell = GetViewData().GetDocShell();
|
2013-04-15 20:35:47 +01:00
|
|
|
ScRange aMarkRange;
|
|
|
|
if (rSel.IsMultiMarked() )
|
|
|
|
rSel.GetMultiMarkArea( aMarkRange );
|
|
|
|
else
|
|
|
|
rSel.GetMarkArea( aMarkRange );
|
|
|
|
|
2013-10-10 19:26:07 +02:00
|
|
|
bool bSetLines = false;
|
|
|
|
bool bSetAlign = false;
|
2013-04-15 20:35:47 +01:00
|
|
|
if ( pAttr )
|
|
|
|
{
|
|
|
|
const SfxItemSet& rNewSet = pAttr->GetItemSet();
|
2014-09-10 17:53:41 +02:00
|
|
|
bSetLines = rNewSet.GetItemState( ATTR_BORDER, true ) == SfxItemState::SET ||
|
|
|
|
rNewSet.GetItemState( ATTR_SHADOW, true ) == SfxItemState::SET;
|
|
|
|
bSetAlign = rNewSet.GetItemState( ATTR_HOR_JUSTIFY, true ) == SfxItemState::SET;
|
2013-04-15 20:35:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt16 nExtFlags = 0;
|
|
|
|
if ( bSetLines )
|
|
|
|
nExtFlags |= SC_PF_LINES;
|
|
|
|
if ( bSetAlign )
|
|
|
|
nExtFlags |= SC_PF_WHOLEROWS;
|
|
|
|
|
|
|
|
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();
|
|
|
|
pDocShell->PostPaint( nStartCol, nStartRow, nStartTab,
|
|
|
|
nEndCol, nEndRow, nEndTab,
|
|
|
|
PAINT_GRID, nExtFlags | SC_PF_TESTMERGE );
|
2014-06-18 12:14:29 +02:00
|
|
|
ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
|
2014-01-14 10:55:02 -05:00
|
|
|
pTabViewShell->AdjustBlockHeight(false, const_cast<ScMarkData*>(&rSel));
|
2013-04-15 20:35:47 +01:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-10-12 15:59:00 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|