LibreOffice Module sc (master)  1
viewfunc.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <config_features.h>
21 
22 #include <scitems.hxx>
23 
24 #include <sfx2/app.hxx>
25 #include <svx/algitem.hxx>
26 #include <editeng/boxitem.hxx>
27 #include <editeng/editobj.hxx>
28 #include <editeng/langitem.hxx>
29 #include <editeng/justifyitem.hxx>
30 #include <o3tl/unit_conversion.hxx>
31 #include <sfx2/bindings.hxx>
32 #include <svl/zforlist.hxx>
33 #include <svl/zformat.hxx>
34 #include <vcl/svapp.hxx>
35 #include <vcl/weld.hxx>
36 #include <vcl/virdev.hxx>
37 #include <stdlib.h>
38 #include <unotools/charclass.hxx>
39 #include <vcl/uitest/logger.hxx>
41 #include <osl/diagnose.h>
42 
43 #include <viewfunc.hxx>
44 #include <tabvwsh.hxx>
45 #include <docsh.hxx>
46 #include <attrib.hxx>
47 #include <patattr.hxx>
48 #include <docpool.hxx>
49 #include <sc.hrc>
50 #include <strings.hrc>
51 #include <undocell.hxx>
52 #include <undoblk.hxx>
53 #include <refundo.hxx>
54 #include <olinetab.hxx>
55 #include <rangenam.hxx>
56 #include <globstr.hrc>
57 #include <global.hxx>
58 #include <stlsheet.hxx>
59 #include <editutil.hxx>
60 #include <formulacell.hxx>
61 #include <scresid.hxx>
62 #include <inputhdl.hxx>
63 #include <scmod.hxx>
64 #include <inputopt.hxx>
65 #include <compiler.hxx>
66 #include <docfunc.hxx>
67 #include <appoptio.hxx>
68 #include <sizedev.hxx>
69 #include <editable.hxx>
70 #include <scui_def.hxx>
71 #include <funcdesc.hxx>
72 #include <docuno.hxx>
73 #include <cellsuno.hxx>
74 #include <tokenarray.hxx>
75 #include <rowheightcontext.hxx>
76 #include <comphelper/lok.hxx>
77 #include <conditio.hxx>
78 #include <columnspanset.hxx>
79 
80 #include <memory>
81 
82 static void lcl_PostRepaintCondFormat( const ScConditionalFormat *pCondFmt, ScDocShell *pDocSh )
83 {
84  if( pCondFmt )
85  {
86  const ScRangeList& rRanges = pCondFmt->GetRange();
87 
88  pDocSh->PostPaint( rRanges, PaintPartFlags::All );
89  }
90 }
91 
92 ScViewFunc::ScViewFunc( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
93  ScTabView( pParent, rDocSh, pViewShell ),
94  bFormatValid( false )
95 {
96 }
97 
99 {
100 }
101 
102 namespace {
103 
104 void collectUIInformation(const std::map<OUString, OUString>& aParameters, const OUString& rAction)
105 {
106  EventDescription aDescription;
107  aDescription.aID = "grid_window";
108  aDescription.aAction = rAction;
109  aDescription.aParameters = aParameters;
110  aDescription.aParent = "MainWindow";
111  aDescription.aKeyWord = "ScGridWinUIObject";
112 
113  UITestLogger::getInstance().logEvent(aDescription);
114 }
115 
116 }
117 
119 {
120  // anything to do?
121  if ( !SC_MOD()->GetInputOptions().GetExtendFormat() )
122  return;
123 
124  // start only with single cell (marked or cursor position)
125  ScRange aMarkRange;
126  bool bOk = (GetViewData().GetSimpleArea( aMarkRange ) == SC_MARK_SIMPLE);
127  if ( bOk && aMarkRange.aStart != aMarkRange.aEnd )
128  bOk = false;
129 
130  if (bOk)
131  {
132  bFormatValid = true;
133  aFormatSource = aMarkRange.aStart;
135  }
136  else
137  bFormatValid = false; // discard old range
138 }
139 
140 bool ScViewFunc::TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrChanged )
141 {
142  // anything to do?
143  if ( !SC_MOD()->GetInputOptions().GetExtendFormat() )
144  return false;
145 
146  // Test: treat input with numberformat (bAttrChanged) always as new Attribute
147  // (discard old Area ). If not wanted, discard if-statement
148  if ( bAttrChanged )
149  {
150  StartFormatArea();
151  return false;
152  }
153 
155 
156  bool bFound = false;
157  ScRange aNewRange = aFormatArea;
158  if ( bFormatValid && nTab == aFormatSource.Tab() )
159  {
160  if ( nRow >= aFormatArea.aStart.Row() && nRow <= aFormatArea.aEnd.Row() )
161  {
162  // within range?
163  if ( nCol >= aFormatArea.aStart.Col() && nCol <= aFormatArea.aEnd.Col() )
164  {
165  bFound = true; // do not change range
166  }
167  // left ?
168  if ( nCol+1 == aFormatArea.aStart.Col() )
169  {
170  bFound = true;
171  aNewRange.aStart.SetCol( nCol );
172  }
173  // right ?
174  if ( nCol == aFormatArea.aEnd.Col()+1 )
175  {
176  bFound = true;
177  aNewRange.aEnd.SetCol( nCol );
178  }
179  }
180  if ( nCol >= aFormatArea.aStart.Col() && nCol <= aFormatArea.aEnd.Col() )
181  {
182  // top ?
183  if ( nRow+1 == aFormatArea.aStart.Row() )
184  {
185  bFound = true;
186  aNewRange.aStart.SetRow( nRow );
187  }
188  // bottom ?
189  if ( nRow == aFormatArea.aEnd.Row()+1 )
190  {
191  bFound = true;
192  aNewRange.aEnd.SetRow( nRow );
193  }
194  }
195  }
196 
197  if (bFound)
198  aFormatArea = aNewRange; // extend
199  else
200  bFormatValid = false; // outside of range -> break
201 
202  return bFound;
203 }
204 
206  bool bAttrChanged )
207 {
208  ScDocShell* pDocSh = GetViewData().GetDocShell();
209  ScDocument& rDoc = pDocSh->GetDocument();
210 
211  const ScPatternAttr* pSource = rDoc.GetPattern(
212  aFormatSource.Col(), aFormatSource.Row(), nTab );
213  if ( !pSource->GetItem(ATTR_MERGE).IsMerged() )
214  {
215  ScRange aRange( nCol, nRow, nTab, nCol, nRow, nTab );
216  ScMarkData aMark(rDoc.GetSheetLimits());
217  aMark.SetMarkArea( aRange );
218 
219  ScDocFunc &rFunc = GetViewData().GetDocFunc();
220 
221  // pOldPattern is only valid until call to ApplyAttributes!
222  const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab );
223  const ScStyleSheet* pSrcStyle = pSource->GetStyleSheet();
224  if ( pSrcStyle && pSrcStyle != pOldPattern->GetStyleSheet() )
225  rFunc.ApplyStyle( aMark, pSrcStyle->GetName(), false );
226 
227  rFunc.ApplyAttributes( aMark, *pSource, false );
228  }
229 
230  if ( bAttrChanged ) // value entered with number format?
231  aFormatSource.Set( nCol, nRow, nTab ); // then set a new source
232 }
233 
234 // additional routines
235 
236 sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula )
237 {
238  ScDocShell* pDocSh = GetViewData().GetDocShell();
239  ScDocument& rDoc = pDocSh->GetDocument();
240  ScMarkData& rMark = GetViewData().GetMarkData();
241 
242  double nPPTX = GetViewData().GetPPTX();
243  double nPPTY = GetViewData().GetPPTY();
244  Fraction aZoomX = GetViewData().GetZoomX();
245  Fraction aZoomY = GetViewData().GetZoomY();
246 
247  ScSizeDeviceProvider aProv(pDocSh);
248  if (aProv.IsPrinter())
249  {
250  nPPTX = aProv.GetPPTX();
251  nPPTY = aProv.GetPPTY();
252  aZoomX = aZoomY = Fraction( 1, 1 );
253  }
254 
255  sal_uInt16 nTwips = rDoc.GetOptimalColWidth( nCol, nTab, aProv.GetDevice(),
256  nPPTX, nPPTY, aZoomX, aZoomY, bFormula, &rMark );
257  return nTwips;
258 }
259 
260 bool ScViewFunc::SelectionEditable( bool* pOnlyNotBecauseOfMatrix /* = NULL */ )
261 {
262  bool bRet;
263  ScDocument& rDoc = GetViewData().GetDocument();
264  ScMarkData& rMark = GetViewData().GetMarkData();
265  if (rMark.IsMarked() || rMark.IsMultiMarked())
266  bRet = rDoc.IsSelectionEditable( rMark, pOnlyNotBecauseOfMatrix );
267  else
268  {
269  SCCOL nCol = GetViewData().GetCurX();
270  SCROW nRow = GetViewData().GetCurY();
271  SCTAB nTab = GetViewData().GetTabNo();
272  bRet = rDoc.IsBlockEditable( nTab, nCol, nRow, nCol, nRow,
273  pOnlyNotBecauseOfMatrix );
274  }
275  return bRet;
276 }
277 
278 static bool lcl_FunctionKnown( sal_uInt16 nOpCode )
279 {
281  if ( pFuncList )
282  {
283  sal_uLong nCount = pFuncList->GetCount();
284  for (sal_uLong i=0; i<nCount; i++)
285  if ( pFuncList->GetFunction(i)->nFIndex == nOpCode )
286  return true;
287  }
288  return false;
289 }
290 
291 static bool lcl_AddFunction( ScAppOptions& rAppOpt, sal_uInt16 nOpCode )
292 {
293  sal_uInt16 nOldCount = rAppOpt.GetLRUFuncListCount();
294  sal_uInt16* pOldList = rAppOpt.GetLRUFuncList();
295  sal_uInt16 nPos;
296  for (nPos=0; nPos<nOldCount; nPos++)
297  if (pOldList[nPos] == nOpCode) // is the function already in the list?
298  {
299  if ( nPos == 0 )
300  return false; // already at the top -> no change
301 
302  // count doesn't change, so the original array is modified
303 
304  for (sal_uInt16 nCopy=nPos; nCopy>0; nCopy--)
305  pOldList[nCopy] = pOldList[nCopy-1];
306  pOldList[0] = nOpCode;
307 
308  return true; // list has changed
309  }
310 
311  if ( !lcl_FunctionKnown( nOpCode ) )
312  return false; // not in function list -> no change
313 
314  sal_uInt16 nNewCount = std::min( static_cast<sal_uInt16>(nOldCount + 1), sal_uInt16(LRU_MAX) );
315  sal_uInt16 nNewList[LRU_MAX];
316  nNewList[0] = nOpCode;
317  for (nPos=1; nPos<nNewCount; nPos++)
318  nNewList[nPos] = pOldList[nPos-1];
319  rAppOpt.SetLRUFuncList( nNewList, nNewCount );
320 
321  return true; // list has changed
322 }
323 
324 namespace HelperNotifyChanges
325 {
326  static void NotifyIfChangesListeners(const ScDocShell &rDocShell, ScMarkData& rMark, SCCOL nCol, SCROW nRow)
327  {
328  if (ScModelObj *pModelObj = getMustPropagateChangesModel(rDocShell))
329  {
330  ScRangeList aChangeRanges;
331  for (const auto& rTab : rMark)
332  aChangeRanges.push_back( ScRange( nCol, nRow, rTab ) );
333 
334  HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "cell-change");
335  }
336  }
337 }
338 
339 // actual functions
340 
341 // input - undo OK
342 void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
343  const OUString& rString,
344  const EditTextObject* pData )
345 {
346  ScDocument& rDoc = GetViewData().GetDocument();
347  ScMarkData rMark(GetViewData().GetMarkData());
348  bool bRecord = rDoc.IsUndoEnabled();
349  SCTAB i;
350 
351  ScDocShell* pDocSh = GetViewData().GetDocShell();
352  ScDocFunc &rFunc = GetViewData().GetDocFunc();
353  ScDocShellModificator aModificator( *pDocSh );
354 
355  ScEditableTester aTester( rDoc, nCol,nRow, nCol,nRow, rMark );
356  if (!aTester.IsEditable())
357  {
358  ErrorMessage(aTester.GetMessageId());
359  PaintArea(nCol, nRow, nCol, nRow); // possibly the edit-engine is still painted there
360  return;
361  }
362 
363  if ( bRecord )
364  rFunc.EnterListAction( STR_UNDO_ENTERDATA );
365 
366  bool bFormula = false;
367 
368  // a single '=' character is handled as string (needed for special filters)
369  if ( rString.getLength() > 1 )
370  {
371  if ( rString[0] == '=' )
372  {
373  // handle as formula
374  bFormula = true;
375  }
376  else if ( rString[0] == '+' || rString[0] == '-' )
377  {
378  // if there is more than one leading '+' or '-' character, remove the additional ones
379  sal_Int32 nIndex = 1;
380  sal_Int32 nLen = rString.getLength();
381  while ( nIndex < nLen && ( rString[ nIndex ] == '+' || rString[ nIndex ] == '-' ) )
382  {
383  ++nIndex;
384  }
385  OUString aString = rString.replaceAt( 1, nIndex - 1, "" );
386 
387  // if the remaining part without the leading '+' or '-' character
388  // is non-empty and not a number, handle as formula
389  if ( aString.getLength() > 1 )
390  {
391  sal_uInt32 nFormat = 0;
392  rDoc.GetNumberFormat( nCol, nRow, nTab, nFormat );
393  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
394  double fNumber = 0;
395  if ( !pFormatter->IsNumberFormat( aString, nFormat, fNumber ) )
396  {
397  bFormula = true;
398  }
399  }
400  }
401  }
402 
403  bool bNumFmtChanged = false;
404  if ( bFormula )
405  { // formula, compile with autoCorrection
406  i = rMark.GetFirstSelected();
407  ScAddress aPos( nCol, nRow, i );
408  ScCompiler aComp( rDoc, aPos, rDoc.GetGrammar(), true, false );
409 //2do: enable/disable autoCorrection via calcoptions
410  aComp.SetAutoCorrection( true );
411  if ( rString[0] == '+' || rString[0] == '-' )
412  {
413  aComp.SetExtendedErrorDetection( ScCompiler::EXTENDED_ERROR_DETECTION_NAME_BREAK );
414  }
415  OUString aFormula( rString );
416  std::unique_ptr< ScTokenArray > pArr;
417  bool bAgain;
418  do
419  {
420  bAgain = false;
421  bool bAddEqual = false;
422  pArr = aComp.CompileString( aFormula );
423  bool bCorrected = aComp.IsCorrected();
424  std::unique_ptr< ScTokenArray > pArrFirst;
425  if ( bCorrected )
426  { // try to parse with first parser-correction
427  pArrFirst = std::move( pArr );
428  pArr = aComp.CompileString( aComp.GetCorrectedFormula() );
429  }
430  if ( pArr->GetCodeError() == FormulaError::NONE )
431  {
432  bAddEqual = true;
433  aComp.CompileTokenArray();
434  bCorrected |= aComp.IsCorrected();
435  }
436  if ( bCorrected )
437  {
438  OUString aCorrectedFormula;
439  if ( bAddEqual )
440  {
441  aCorrectedFormula = "=" + aComp.GetCorrectedFormula();
442  }
443  else
444  aCorrectedFormula = aComp.GetCorrectedFormula();
445  short nResult;
446  if ( aCorrectedFormula.getLength() == 1 )
447  nResult = RET_NO; // empty formula, just '='
448  else
449  {
450  OUString aMessage = ScResId( SCSTR_FORMULA_AUTOCORRECTION ) + aCorrectedFormula;
451 
452  std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(),
453  VclMessageType::Question, VclButtonsType::YesNo,
454  aMessage));
455  xQueryBox->set_default_response(RET_YES);
456  nResult = xQueryBox->run();
457  }
458  if ( nResult == RET_YES )
459  {
460  aFormula = aCorrectedFormula;
461  bAgain = true;
462  }
463  else
464  {
465  if ( pArrFirst )
466  pArr = std::move( pArrFirst );
467  }
468  }
469  } while ( bAgain );
470  // to be used in multiple tabs, the formula must be compiled anew
471  // via ScFormulaCell copy-ctor because of RangeNames,
472  // the same code-array for all cells is not possible.
473  // If the array has an error, (it) must be RPN-erased in the newly generated
474  // cells and the error be set explicitly, so that
475  // via FormulaCell copy-ctor and Interpreter it will be, when possible,
476  // ironed out again, too intelligent... e.g.: =1))
477  FormulaError nError = pArr->GetCodeError();
478  if ( nError == FormulaError::NONE )
479  {
480  // update list of recent functions with all functions that
481  // are not within parentheses
482 
483  ScModule* pScMod = SC_MOD();
484  ScAppOptions aAppOpt = pScMod->GetAppOptions();
485  bool bOptChanged = false;
486 
487  formula::FormulaToken** ppToken = pArr->GetArray();
488  sal_uInt16 nTokens = pArr->GetLen();
489  sal_uInt16 nLevel = 0;
490  for (sal_uInt16 nTP=0; nTP<nTokens; nTP++)
491  {
492  formula::FormulaToken* pTok = ppToken[nTP];
493  OpCode eOp = pTok->GetOpCode();
494  if ( eOp == ocOpen )
495  ++nLevel;
496  else if ( eOp == ocClose && nLevel )
497  --nLevel;
498  if ( nLevel == 0 && pTok->IsFunction() &&
499  lcl_AddFunction( aAppOpt, sal::static_int_cast<sal_uInt16>( eOp ) ) )
500  bOptChanged = true;
501  }
502 
503  if ( bOptChanged )
504  {
505  pScMod->SetAppOptions(aAppOpt);
506  }
507  }
508 
509  ScFormulaCell aCell(rDoc, aPos, std::move( pArr ), formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
510 
511  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
512  for (const auto& rTab : rMark)
513  {
514  i = rTab;
515  aPos.SetTab( i );
516  const sal_uInt32 nIndex = rDoc.GetAttr(
517  nCol, nRow, i, ATTR_VALUE_FORMAT )->GetValue();
518  const SvNumFormatType nType = pFormatter->GetType( nIndex);
519  if (nType == SvNumFormatType::TEXT ||
520  ((rString[0] == '+' || rString[0] == '-') && nError != FormulaError::NONE && rString == aFormula))
521  {
522  if ( pData )
523  {
524  // A clone of pData will be stored in the cell.
525  rFunc.SetEditCell(aPos, *pData, true);
526  }
527  else
528  rFunc.SetStringCell(aPos, aFormula, true);
529  }
530  else
531  {
532  ScFormulaCell* pCell = new ScFormulaCell( aCell, rDoc, aPos );
533  if ( nError != FormulaError::NONE )
534  {
535  pCell->GetCode()->DelRPN();
536  pCell->SetErrCode( nError );
537  if(pCell->GetCode()->IsHyperLink())
538  pCell->GetCode()->SetHyperLink(false);
539  }
540  if (nType == SvNumFormatType::LOGICAL)
541  {
542  // Reset to General so the actual format can be determined
543  // after the cell has been interpreted. A sticky boolean
544  // number format is highly likely unwanted... see tdf#75650.
545  // General of same locale as current number format.
546  const SvNumberformat* pEntry = pFormatter->GetEntry( nIndex);
547  const LanguageType nLang = (pEntry ? pEntry->GetLanguage() : ScGlobal::eLnge);
548  const sal_uInt32 nFormat = pFormatter->GetStandardFormat( SvNumFormatType::NUMBER, nLang);
549  ScPatternAttr aPattern( rDoc.GetPool());
550  aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nFormat));
551  ScMarkData aMark(rDoc.GetSheetLimits());
552  aMark.SelectTable( i, true);
553  aMark.SetMarkArea( ScRange( aPos));
554  rFunc.ApplyAttributes( aMark, aPattern, false);
555  bNumFmtChanged = true;
556  }
557  rFunc.SetFormulaCell(aPos, pCell, true);
558  }
559  }
560  }
561  else
562  {
563  for (const auto& rTab : rMark)
564  {
565  bool bNumFmtSet = false;
566  rFunc.SetNormalString( bNumFmtSet, ScAddress( nCol, nRow, rTab ), rString, false );
567  if (bNumFmtSet)
568  {
569  /* FIXME: if set on any sheet results in changed only on
570  * sheet nTab for TestFormatArea() and DoAutoAttributes() */
571  bNumFmtChanged = true;
572  }
573  }
574  }
575 
576  bool bAutoFormat = TestFormatArea(nCol, nRow, nTab, bNumFmtChanged);
577 
578  if (bAutoFormat)
579  DoAutoAttributes(nCol, nRow, nTab, bNumFmtChanged);
580 
581  pDocSh->UpdateOle(GetViewData());
582 
583  HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow);
584 
585  if ( bRecord )
586  rFunc.EndListAction();
587 
588  aModificator.SetDocumentModified();
589  lcl_PostRepaintCondFormat( rDoc.GetCondFormat( nCol, nRow, nTab ), pDocSh );
590 }
591 
592 // enter value in single cell (on nTab only)
593 
594 void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue )
595 {
596  ScDocument& rDoc = GetViewData().GetDocument();
597  ScDocShell* pDocSh = GetViewData().GetDocShell();
598 
599  if (!pDocSh)
600  return;
601 
602  bool bUndo(rDoc.IsUndoEnabled());
603  ScDocShellModificator aModificator( *pDocSh );
604 
605  ScEditableTester aTester( rDoc, nTab, nCol,nRow, nCol,nRow );
606  if (aTester.IsEditable())
607  {
608  ScAddress aPos( nCol, nRow, nTab );
609  ScCellValue aUndoCell;
610  if (bUndo)
611  aUndoCell.assign(rDoc, aPos);
612 
613  rDoc.SetValue( nCol, nRow, nTab, rValue );
614 
615  // because of ChangeTrack after change in document
616  if (bUndo)
617  {
618  pDocSh->GetUndoManager()->AddUndoAction(
619  std::make_unique<ScUndoEnterValue>(pDocSh, aPos, aUndoCell, rValue));
620  }
621 
622  pDocSh->PostPaintCell( aPos );
623  pDocSh->UpdateOle(GetViewData());
624  aModificator.SetDocumentModified();
625  }
626  else
627  ErrorMessage(aTester.GetMessageId());
628 }
629 
630 void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
631  const EditTextObject& rData, bool bTestSimple )
632 {
633  ScDocShell* pDocSh = GetViewData().GetDocShell();
634  ScMarkData& rMark = GetViewData().GetMarkData();
635  ScDocument& rDoc = pDocSh->GetDocument();
636  bool bRecord = rDoc.IsUndoEnabled();
637 
638  ScDocShellModificator aModificator( *pDocSh );
639 
640  ScEditableTester aTester( rDoc, nTab, nCol,nRow, nCol,nRow );
641  if (aTester.IsEditable())
642  {
643 
644  // test for attribute
645 
646  bool bSimple = false;
647  bool bCommon = false;
648  std::unique_ptr<ScPatternAttr> pCellAttrs;
649  OUString aString;
650 
651  const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab );
652  ScTabEditEngine aEngine( *pOldPattern, rDoc.GetEnginePool(), &rDoc );
653  aEngine.SetTextCurrentDefaults(rData);
654 
655  if (bTestSimple) // test, if simple string without attribute
656  {
657  ScEditAttrTester aAttrTester( &aEngine );
658  bSimple = !aAttrTester.NeedsObject();
659  bCommon = aAttrTester.NeedsCellAttr();
660 
661  // formulas have to be recognized even if they're formatted
662  // (but common attributes are still collected)
663 
664  if ( !bSimple && aEngine.GetParagraphCount() == 1 )
665  {
666  OUString aParStr(aEngine.GetText( 0 ));
667  if ( aParStr[0] == '=' )
668  bSimple = true;
669  }
670 
671  if (bCommon) // attribute for tab
672  {
673  pCellAttrs.reset(new ScPatternAttr( *pOldPattern ));
674  pCellAttrs->GetFromEditItemSet( &aAttrTester.GetAttribs() );
676  }
677  }
678 
679  // #i97726# always get text for "repeat" of undo action
680  aString = ScEditUtil::GetSpaceDelimitedString(aEngine);
681 
682  // undo
683 
684  std::unique_ptr<EditTextObject> pUndoData;
685  ScUndoEnterData::ValuesType aOldValues;
686 
687  if (bRecord && !bSimple)
688  {
689  for (const auto& rTab : rMark)
690  {
691  ScUndoEnterData::Value aOldValue;
692  aOldValue.mnTab = rTab;
693  aOldValue.maCell.assign(rDoc, ScAddress(nCol, nRow, rTab));
694  aOldValues.push_back(aOldValue);
695  }
696 
697  pUndoData = rData.Clone();
698  }
699 
700  // enter data
701 
702  if (bCommon)
703  rDoc.ApplyPattern(nCol,nRow,nTab,*pCellAttrs);
704 
705  if (bSimple)
706  {
707  if (bCommon)
708  AdjustRowHeight(nRow,nRow,true);
709 
710  EnterData(nCol,nRow,nTab,aString);
711  }
712  else
713  {
714  for (const auto& rTab : rMark)
715  {
716  ScAddress aPos(nCol, nRow, rTab);
717  rDoc.SetEditText(aPos, rData, rDoc.GetEditPool());
718  }
719 
720  if ( bRecord )
721  { // because of ChangeTrack current first
722  pDocSh->GetUndoManager()->AddUndoAction(
723  std::make_unique<ScUndoEnterData>(pDocSh, ScAddress(nCol,nRow,nTab), aOldValues, aString, std::move(pUndoData)));
724  }
725 
726  HideAllCursors();
727 
728  AdjustRowHeight(nRow,nRow,true);
729 
730  for (const auto& rTab : rMark)
731  pDocSh->PostPaintCell( nCol, nRow, rTab );
732 
733  ShowAllCursors();
734 
735  pDocSh->UpdateOle(GetViewData());
736 
737  HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow);
738 
739  aModificator.SetDocumentModified();
740  }
741  lcl_PostRepaintCondFormat( rDoc.GetCondFormat( nCol, nRow, nTab ), pDocSh );
742  }
743  else
744  {
745  ErrorMessage(aTester.GetMessageId());
746  PaintArea( nCol, nRow, nCol, nRow ); // possibly the edit-engine is still painted there
747  }
748 }
749 
750 void ScViewFunc::EnterDataAtCursor( const OUString& rString )
751 {
752  SCCOL nPosX = GetViewData().GetCurX();
753  SCROW nPosY = GetViewData().GetCurY();
754  SCTAB nTab = GetViewData().GetTabNo();
755 
756  EnterData( nPosX, nPosY, nTab, rString );
757 }
758 
759 void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar::Grammar eGram )
760 {
762  const SCCOL nCol = rData.GetCurX();
763  const SCROW nRow = rData.GetCurY();
764  const ScMarkData& rMark = rData.GetMarkData();
765  if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
766  {
767  // nothing marked -> temporarily calculate block
768  // with size of result formula to get the size
769 
770  ScDocument& rDoc = rData.GetDocument();
771  SCTAB nTab = rData.GetTabNo();
772  ScFormulaCell aFormCell( rDoc, ScAddress(nCol,nRow,nTab), rString, eGram, ScMatrixMode::Formula );
773 
774  SCSIZE nSizeX;
775  SCSIZE nSizeY;
776  aFormCell.GetResultDimensions( nSizeX, nSizeY );
777  if ( nSizeX != 0 && nSizeY != 0 &&
778  nCol+nSizeX-1 <= sal::static_int_cast<SCSIZE>(rDoc.MaxCol()) &&
779  nRow+nSizeY-1 <= sal::static_int_cast<SCSIZE>(rDoc.MaxRow()) )
780  {
781  ScRange aResult( nCol, nRow, nTab,
782  sal::static_int_cast<SCCOL>(nCol+nSizeX-1),
783  sal::static_int_cast<SCROW>(nRow+nSizeY-1), nTab );
784  MarkRange( aResult, false );
785  }
786  }
787 
788  ScRange aRange;
789  if (rData.GetSimpleArea(aRange) == SC_MARK_SIMPLE)
790  {
791  ScDocShell* pDocSh = rData.GetDocShell();
792  bool bSuccess = pDocSh->GetDocFunc().EnterMatrix(
793  aRange, &rMark, nullptr, rString, false, false, EMPTY_OUSTRING, eGram );
794  if (bSuccess)
795  pDocSh->UpdateOle(GetViewData());
796  else
797  PaintArea(nCol, nRow, nCol, nRow); // possibly the edit-engine is still painted there
798  }
799  else
800  ErrorMessage(STR_NOMULTISELECT);
801 }
802 
804 {
805  SvtScriptType nScript = SvtScriptType::NONE;
806 
807  ScDocument& rDoc = GetViewData().GetDocument();
808  const ScMarkData& rMark = GetViewData().GetMarkData();
809  if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
810  {
811  // no selection -> cursor
812 
813  nScript = rDoc.GetScriptType( GetViewData().GetCurX(),
814  GetViewData().GetCurY(), GetViewData().GetTabNo());
815  }
816  else
817  {
818  ScRangeList aRanges;
819  rMark.FillRangeListWithMarks( &aRanges, false );
820  nScript = rDoc.GetRangeScriptType(aRanges);
821  }
822 
823  if (nScript == SvtScriptType::NONE)
824  nScript = ScGlobal::GetDefaultScriptType();
825 
826  return nScript;
827 }
828 
830 {
831  // Don't use UnmarkFiltered in slot state functions, for performance reasons.
832  // The displayed state is always that of the whole selection including filtered rows.
833 
834  const ScMarkData& rMark = GetViewData().GetMarkData();
835  ScDocument& rDoc = GetViewData().GetDocument();
836  if ( rMark.IsMarked() || rMark.IsMultiMarked() )
837  {
838  // MarkToMulti is no longer necessary for rDoc.GetSelectionPattern
839  const ScPatternAttr* pAttr = rDoc.GetSelectionPattern( rMark );
840  return pAttr;
841  }
842  else
843  {
844  SCCOL nCol = GetViewData().GetCurX();
845  SCROW nRow = GetViewData().GetCurY();
846  SCTAB nTab = GetViewData().GetTabNo();
847 
848  ScMarkData aTempMark( rMark ); // copy sheet selection
849  aTempMark.SetMarkArea( ScRange( nCol, nRow, nTab ) );
850  const ScPatternAttr* pAttr = rDoc.GetSelectionPattern( aTempMark );
851  return pAttr;
852  }
853 }
854 
856  std::shared_ptr<SvxBoxItem>& rLineOuter,
857  std::shared_ptr<SvxBoxInfoItem>& rLineInner )
858 {
859  ScDocument& rDoc = GetViewData().GetDocument();
860  const ScMarkData& rMark = GetViewData().GetMarkData();
861 
862  if ( rMark.IsMarked() || rMark.IsMultiMarked() )
863  {
864  rDoc.GetSelectionFrame( rMark, *rLineOuter, *rLineInner );
865  }
866  else
867  {
868  const ScPatternAttr* pAttrs =
869  rDoc.GetPattern( GetViewData().GetCurX(),
870  GetViewData().GetCurY(),
871  GetViewData().GetTabNo() );
872 
873  rLineOuter.reset(pAttrs->GetItem(ATTR_BORDER).Clone());
874  rLineInner.reset(pAttrs->GetItem(ATTR_BORDER_INNER).Clone());
875 
876  rLineInner->SetTable(false);
877  rLineInner->SetDist(true);
878  rLineInner->SetMinDist(false);
879  }
880 }
881 
882 // apply attribute - undo OK
883 //
884 // complete set ( ATTR_STARTINDEX, ATTR_ENDINDEX )
885 
886 void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
887  const SfxItemSet* pOldSet,
888  bool bAdjustBlockHeight)
889 {
890  // not editable because of matrix only? attribute OK nonetheless
891  bool bOnlyNotBecauseOfMatrix;
892  if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
893  {
894  ErrorMessage(STR_PROTECTIONERR);
895  return;
896  }
897 
898  ScPatternAttr aOldAttrs( std::make_unique<SfxItemSet>(*pOldSet) );
899  ScPatternAttr aNewAttrs( std::make_unique<SfxItemSet>(*pDialogSet) );
900  aNewAttrs.DeleteUnchanged( &aOldAttrs );
901 
902  if ( pDialogSet->GetItemState( ATTR_VALUE_FORMAT ) == SfxItemState::SET )
903  { // don't reset to default SYSTEM GENERAL if not intended
904  sal_uInt32 nOldFormat =
905  pOldSet->Get( ATTR_VALUE_FORMAT ).GetValue();
906  sal_uInt32 nNewFormat =
907  pDialogSet->Get( ATTR_VALUE_FORMAT ).GetValue();
908  if ( nNewFormat != nOldFormat )
909  {
910  SvNumberFormatter* pFormatter =
912  const SvNumberformat* pOldEntry = pFormatter->GetEntry( nOldFormat );
913  LanguageType eOldLang =
914  pOldEntry ? pOldEntry->GetLanguage() : LANGUAGE_DONTKNOW;
915  const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
916  LanguageType eNewLang =
917  pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
918  if ( eNewLang != eOldLang )
919  {
920  aNewAttrs.GetItemSet().Put(
921  SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );
922 
923  // only the language has changed -> do not touch numberformat-attribute
924  sal_uInt32 nNewMod = nNewFormat % SV_COUNTRY_LANGUAGE_OFFSET;
925  if ( nNewMod == ( nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET ) &&
926  nNewMod <= SV_MAX_COUNT_STANDARD_FORMATS )
927  aNewAttrs.GetItemSet().ClearItem( ATTR_VALUE_FORMAT );
928  }
929  }
930  }
931 
932  if (pDialogSet->HasItem(ATTR_FONT_LANGUAGE))
933  // font language has changed. Redo the online spelling.
934  ResetAutoSpell();
935 
936  const SvxBoxItem& rOldOuter = pOldSet->Get(ATTR_BORDER);
937  const SvxBoxItem& rNewOuter = pDialogSet->Get(ATTR_BORDER);
938  const SvxBoxInfoItem& rOldInner = pOldSet->Get(ATTR_BORDER_INNER);
939  const SvxBoxInfoItem& rNewInner = pDialogSet->Get(ATTR_BORDER_INNER);
940  SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
941  SfxItemPool* pNewPool = rNewSet.GetPool();
942 
943  pNewPool->Put(rNewOuter); // don't delete yet
944  pNewPool->Put(rNewInner);
945  rNewSet.ClearItem( ATTR_BORDER );
946  rNewSet.ClearItem( ATTR_BORDER_INNER );
947 
948  /*
949  * establish whether border attribute is to be set:
950  * 1. new != old
951  * 2. is one of the borders not-DontCare (since 238.f: IsxxValid())
952  *
953  */
954 
955  bool bFrame = (pDialogSet->GetItemState( ATTR_BORDER ) != SfxItemState::DEFAULT)
956  || (pDialogSet->GetItemState( ATTR_BORDER_INNER ) != SfxItemState::DEFAULT);
957 
958  if (&rNewOuter == &rOldOuter && &rNewInner == &rOldInner)
959  bFrame = false;
960 
961  // this should be intercepted by the pool: ?!??!??
962 
963  if (bFrame && rNewOuter == rOldOuter && rNewInner == rOldInner)
964  bFrame = false;
965 
966  bFrame = bFrame
967  && ( rNewInner.IsValid(SvxBoxInfoItemValidFlags::LEFT)
968  || rNewInner.IsValid(SvxBoxInfoItemValidFlags::RIGHT)
969  || rNewInner.IsValid(SvxBoxInfoItemValidFlags::TOP)
970  || rNewInner.IsValid(SvxBoxInfoItemValidFlags::BOTTOM)
971  || rNewInner.IsValid(SvxBoxInfoItemValidFlags::HORI)
972  || rNewInner.IsValid(SvxBoxInfoItemValidFlags::VERT) );
973 
974  if (!bFrame)
975  ApplySelectionPattern( aNewAttrs ); // standard only
976  else
977  {
978  // if new items are default-items, overwrite the old items:
979 
980  bool bDefNewOuter = IsStaticDefaultItem(&rNewOuter);
981  bool bDefNewInner = IsStaticDefaultItem(&rNewInner);
982 
983  ApplyPatternLines( aNewAttrs,
984  bDefNewOuter ? rOldOuter : rNewOuter,
985  bDefNewInner ? &rOldInner : &rNewInner );
986  }
987 
988  pNewPool->Remove(rNewOuter); // release
989  pNewPool->Remove(rNewInner);
990 
991  // adjust height only if needed
992  if (bAdjustBlockHeight)
994 
995  // CellContentChanged is called in ApplySelectionPattern / ApplyPatternLines
996 }
997 
998 void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem, bool bAdjustBlockHeight )
999 {
1000  // not editable because of matrix only? attribute OK nonetheless
1001  bool bOnlyNotBecauseOfMatrix;
1002  if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
1003  {
1004  ErrorMessage(STR_PROTECTIONERR);
1005  return;
1006  }
1007 
1008  ScPatternAttr aNewAttrs( std::make_unique<SfxItemSet>( *GetViewData().GetDocument().GetPool(),
1010 
1011  aNewAttrs.GetItemSet().Put( rAttrItem );
1012  // if justify is set (with Buttons), always indentation 0
1013  if ( rAttrItem.Which() == ATTR_HOR_JUSTIFY )
1014  aNewAttrs.GetItemSet().Put( ScIndentItem( 0 ) );
1015  ApplySelectionPattern( aNewAttrs );
1016 
1017  // Prevent useless compute
1018  if (bAdjustBlockHeight)
1020 
1021  // CellContentChanged is called in ApplySelectionPattern
1022 }
1023 
1024 // patterns and borders
1025 
1026 void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem& rNewOuter,
1027  const SvxBoxInfoItem* pNewInner )
1028 {
1029  ScDocument& rDoc = GetViewData().GetDocument();
1030  ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
1031  ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
1032  bool bRecord = true;
1033  if (!rDoc.IsUndoEnabled())
1034  bRecord = false;
1035 
1036  bool bRemoveAdjCellBorder = rNewOuter.IsRemoveAdjacentCellBorder();
1037  ScRange aMarkRange, aMarkRangeWithEnvelope;
1038  aFuncMark.MarkToSimple();
1039  bool bMulti = aFuncMark.IsMultiMarked();
1040  if (bMulti)
1041  aFuncMark.GetMultiMarkArea( aMarkRange );
1042  else if (aFuncMark.IsMarked())
1043  aFuncMark.GetMarkArea( aMarkRange );
1044  else
1045  {
1046  aMarkRange = ScRange( GetViewData().GetCurX(),
1047  GetViewData().GetCurY(), GetViewData().GetTabNo() );
1048  DoneBlockMode();
1049  InitOwnBlockMode();
1050  aFuncMark.SetMarkArea(aMarkRange);
1051  MarkDataChanged();
1052  }
1053  if( bRemoveAdjCellBorder )
1054  aFuncMark.GetSelectionCover( aMarkRangeWithEnvelope );
1055  else
1056  aMarkRangeWithEnvelope = aMarkRange;
1057 
1058  ScDocShell* pDocSh = GetViewData().GetDocShell();
1059 
1060  ScDocShellModificator aModificator( *pDocSh );
1061 
1062  if (bRecord)
1063  {
1065  SCTAB nStartTab = aMarkRange.aStart.Tab();
1066  SCTAB nTabCount = rDoc.GetTableCount();
1067  bool bCopyOnlyMarked = false;
1068  if( !bRemoveAdjCellBorder )
1069  bCopyOnlyMarked = bMulti;
1070  pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
1071  for (const auto& rTab : aFuncMark)
1072  if (rTab != nStartTab)
1073  pUndoDoc->AddUndoTab( rTab, rTab );
1074 
1075  ScRange aCopyRange = aMarkRangeWithEnvelope;
1076  aCopyRange.aStart.SetTab(0);
1077  aCopyRange.aEnd.SetTab(nTabCount-1);
1078  rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, bCopyOnlyMarked, *pUndoDoc, &aFuncMark );
1079 
1080  pDocSh->GetUndoManager()->AddUndoAction(
1081  std::make_unique<ScUndoSelectionAttr>(
1082  pDocSh, aFuncMark,
1083  aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), aMarkRange.aStart.Tab(),
1084  aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), aMarkRange.aEnd.Tab(),
1085  std::move(pUndoDoc), bCopyOnlyMarked, &rAttr, &rNewOuter, pNewInner, &aMarkRangeWithEnvelope ) );
1086  }
1087 
1088  sal_uInt16 nExt = SC_PF_TESTMERGE;
1089  pDocSh->UpdatePaintExt( nExt, aMarkRangeWithEnvelope ); // content before the change
1090 
1091  rDoc.ApplySelectionFrame(aFuncMark, rNewOuter, pNewInner);
1092 
1093  pDocSh->UpdatePaintExt( nExt, aMarkRangeWithEnvelope ); // content after the change
1094 
1095  aFuncMark.MarkToMulti();
1096  rDoc.ApplySelectionPattern( rAttr, aFuncMark );
1097 
1098  pDocSh->PostPaint( aMarkRange, PaintPartFlags::Grid, nExt );
1099  pDocSh->UpdateOle(GetViewData());
1100  aModificator.SetDocumentModified();
1102 
1103  StartFormatArea();
1104 }
1105 
1106 // pattern only
1107 
1108 void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursorOnly )
1109 {
1110  ScViewData& rViewData = GetViewData();
1111  ScDocShell* pDocSh = rViewData.GetDocShell();
1112  ScDocument& rDoc = pDocSh->GetDocument();
1113  ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered
1114  ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
1115 
1116  bool bRecord = true;
1117  if (!rDoc.IsUndoEnabled())
1118  bRecord = false;
1119 
1120  // State from old ItemSet doesn't matter for paint flags, as any change will be
1121  // from SfxItemState::SET in the new ItemSet (default is ignored in ApplyPattern).
1122  // New alignment is checked (check in PostPaint isn't enough) in case a right
1123  // alignment is changed to left.
1124  const SfxItemSet& rNewSet = rAttr.GetItemSet();
1125  bool bSetLines = rNewSet.GetItemState( ATTR_BORDER ) == SfxItemState::SET ||
1126  rNewSet.GetItemState( ATTR_SHADOW ) == SfxItemState::SET;
1127  bool bSetAlign = rNewSet.GetItemState( ATTR_HOR_JUSTIFY ) == SfxItemState::SET;
1128 
1129  sal_uInt16 nExtFlags = 0;
1130  if ( bSetLines )
1131  nExtFlags |= SC_PF_LINES;
1132  if ( bSetAlign )
1133  nExtFlags |= SC_PF_WHOLEROWS;
1134 
1135  ScDocShellModificator aModificator( *pDocSh );
1136 
1137  bool bMulti = aFuncMark.IsMultiMarked();
1138  aFuncMark.MarkToMulti();
1139  bool bOnlyTab = (!aFuncMark.IsMultiMarked() && !bCursorOnly && aFuncMark.GetSelectCount() > 1);
1140  if (bOnlyTab)
1141  {
1142  SCCOL nCol = rViewData.GetCurX();
1143  SCROW nRow = rViewData.GetCurY();
1144  SCTAB nTab = rViewData.GetTabNo();
1145  aFuncMark.SetMarkArea(ScRange(nCol,nRow,nTab));
1146  aFuncMark.MarkToMulti();
1147  }
1148 
1149  ScRangeList aChangeRanges;
1150 
1151  if (aFuncMark.IsMultiMarked() && !bCursorOnly)
1152  {
1153  ScRange aMarkRange;
1154  aFuncMark.GetMultiMarkArea( aMarkRange );
1155  SCTAB nTabCount = rDoc.GetTableCount();
1156  for (const auto& rTab : aFuncMark)
1157  {
1158  ScRange aChangeRange( aMarkRange );
1159  aChangeRange.aStart.SetTab( rTab );
1160  aChangeRange.aEnd.SetTab( rTab );
1161  aChangeRanges.push_back( aChangeRange );
1162  }
1163 
1164  SCCOL nStartCol = aMarkRange.aStart.Col();
1165  SCROW nStartRow = aMarkRange.aStart.Row();
1166  SCTAB nStartTab = aMarkRange.aStart.Tab();
1167  SCCOL nEndCol = aMarkRange.aEnd.Col();
1168  SCROW nEndRow = aMarkRange.aEnd.Row();
1169  SCTAB nEndTab = aMarkRange.aEnd.Tab();
1170 
1171  ScEditDataArray* pEditDataArray = nullptr;
1172  if (bRecord)
1173  {
1174  ScRange aCopyRange = aMarkRange;
1175  aCopyRange.aStart.SetTab(0);
1176  aCopyRange.aEnd.SetTab(nTabCount-1);
1177 
1179  pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
1180  for (const auto& rTab : aFuncMark)
1181  if (rTab != nStartTab)
1182  pUndoDoc->AddUndoTab( rTab, rTab );
1183  rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, bMulti, *pUndoDoc, &aFuncMark );
1184 
1185  aFuncMark.MarkToMulti();
1186 
1187  ScUndoSelectionAttr* pUndoAttr = new ScUndoSelectionAttr(
1188  pDocSh, aFuncMark, nStartCol, nStartRow, nStartTab,
1189  nEndCol, nEndRow, nEndTab, std::move(pUndoDoc), bMulti, &rAttr );
1190  pDocSh->GetUndoManager()->AddUndoAction(std::unique_ptr<ScUndoSelectionAttr>(pUndoAttr));
1191  pEditDataArray = pUndoAttr->GetDataArray();
1192  }
1193 
1194  rDoc.ApplySelectionPattern( rAttr, aFuncMark, pEditDataArray );
1195 
1196  pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
1197  nEndCol, nEndRow, nEndTab,
1198  PaintPartFlags::Grid, nExtFlags | SC_PF_TESTMERGE );
1199  pDocSh->UpdateOle(GetViewData());
1200  aModificator.SetDocumentModified();
1202  }
1203  else // single cell - simpler undo
1204  {
1205  SCCOL nCol = rViewData.GetCurX();
1206  SCROW nRow = rViewData.GetCurY();
1207  SCTAB nTab = rViewData.GetTabNo();
1208 
1209  std::unique_ptr<EditTextObject> pOldEditData;
1210  std::unique_ptr<EditTextObject> pNewEditData;
1211  ScAddress aPos(nCol, nRow, nTab);
1212  ScRefCellValue aCell(rDoc, aPos);
1213  if (aCell.meType == CELLTYPE_EDIT)
1214  {
1215  const EditTextObject* pEditObj = aCell.mpEditText;
1216  pOldEditData = pEditObj->Clone();
1217  rDoc.RemoveEditTextCharAttribs(aPos, rAttr);
1218  pEditObj = rDoc.GetEditText(aPos);
1219  pNewEditData = pEditObj->Clone();
1220  }
1221 
1222  aChangeRanges.push_back(aPos);
1223  std::unique_ptr<ScPatternAttr> pOldPat(new ScPatternAttr(*rDoc.GetPattern( nCol, nRow, nTab )));
1224 
1225  rDoc.ApplyPattern( nCol, nRow, nTab, rAttr );
1226 
1227  const ScPatternAttr* pNewPat = rDoc.GetPattern( nCol, nRow, nTab );
1228 
1229  if (bRecord)
1230  {
1231  std::unique_ptr<ScUndoCursorAttr> pUndo(new ScUndoCursorAttr(
1232  pDocSh, nCol, nRow, nTab, pOldPat.get(), pNewPat, &rAttr ));
1233  pUndo->SetEditData(std::move(pOldEditData), std::move(pNewEditData));
1234  pDocSh->GetUndoManager()->AddUndoAction(std::move(pUndo));
1235  }
1236  pOldPat.reset(); // is copied in undo (Pool)
1237 
1238  pDocSh->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PaintPartFlags::Grid, nExtFlags | SC_PF_TESTMERGE );
1239  pDocSh->UpdateOle(GetViewData());
1240  aModificator.SetDocumentModified();
1242  }
1243 
1245  if (pModelObj)
1246  {
1247  css::uno::Sequence< css::beans::PropertyValue > aProperties;
1248  sal_Int32 nCount = 0;
1250  for ( sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; ++nWhich )
1251  {
1252  const SfxPoolItem* pItem = nullptr;
1253  if ( rNewSet.GetItemState( nWhich, true, &pItem ) == SfxItemState::SET && pItem )
1254  {
1255  for ( const auto pEntry : rMap.getPropertyEntries())
1256  {
1257  if ( pEntry->nWID == nWhich )
1258  {
1259  css::uno::Any aVal;
1260  pItem->QueryValue( aVal, pEntry->nMemberId );
1261  aProperties.realloc( nCount + 1 );
1262  aProperties[ nCount ].Name = pEntry->aName;
1263  aProperties[ nCount ].Value = aVal;
1264  ++nCount;
1265  }
1266  }
1267  }
1268  }
1269  HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "attribute", aProperties);
1270  }
1271 
1272  StartFormatArea();
1273 }
1274 
1276 {
1277  // ItemSet from UI, may have different pool
1278 
1279  bool bOnlyNotBecauseOfMatrix;
1280  if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
1281  {
1282  ErrorMessage(STR_PROTECTIONERR);
1283  return;
1284  }
1285 
1286  ScPatternAttr aNewAttrs( GetViewData().GetDocument().GetPool() );
1287  SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
1288  rNewSet.Put( rItemSet, false );
1289  ApplySelectionPattern( aNewAttrs );
1290 
1292 }
1293 
1295 {
1296  // Don't use UnmarkFiltered in slot state functions, for performance reasons.
1297  // The displayed state is always that of the whole selection including filtered rows.
1298 
1299  const ScStyleSheet* pSheet = nullptr;
1300  ScViewData& rViewData = GetViewData();
1301  ScDocument& rDoc = rViewData.GetDocument();
1302  ScMarkData& rMark = rViewData.GetMarkData();
1303 
1304  if ( rMark.IsMarked() || rMark.IsMultiMarked() )
1305  pSheet = rDoc.GetSelectionStyle( rMark ); // MarkToMulti isn't necessary
1306  else
1307  pSheet = rDoc.GetStyle( rViewData.GetCurX(),
1308  rViewData.GetCurY(),
1309  rViewData.GetTabNo() );
1310 
1311  return pSheet;
1312 }
1313 
1315 {
1316  // not editable because of matrix only? attribute OK nonetheless
1317  bool bOnlyNotBecauseOfMatrix;
1318  if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
1319  {
1320  ErrorMessage(STR_PROTECTIONERR);
1321  return;
1322  }
1323 
1324  if ( !pStyleSheet) return;
1325 
1326  ScViewData& rViewData = GetViewData();
1327  ScDocShell* pDocSh = rViewData.GetDocShell();
1328  ScDocument& rDoc = pDocSh->GetDocument();
1329  ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered
1330  ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
1331  SCTAB nTabCount = rDoc.GetTableCount();
1332  bool bRecord = true;
1333  if (!rDoc.IsUndoEnabled())
1334  bRecord = false;
1335 
1336  ScDocShellModificator aModificator( *pDocSh );
1337 
1338  if ( aFuncMark.IsMarked() || aFuncMark.IsMultiMarked() )
1339  {
1340  ScRange aMarkRange;
1341  aFuncMark.MarkToMulti();
1342  aFuncMark.GetMultiMarkArea( aMarkRange );
1343 
1344  if ( bRecord )
1345  {
1346  SCTAB nTab = rViewData.GetTabNo();
1348  pUndoDoc->InitUndo( rDoc, nTab, nTab );
1349  for (const auto& rTab : aFuncMark)
1350  if (rTab != nTab)
1351  pUndoDoc->AddUndoTab( rTab, rTab );
1352 
1353  ScRange aCopyRange = aMarkRange;
1354  aCopyRange.aStart.SetTab(0);
1355  aCopyRange.aEnd.SetTab(nTabCount-1);
1356  rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, true, *pUndoDoc, &aFuncMark );
1357  aFuncMark.MarkToMulti();
1358 
1359  OUString aName = pStyleSheet->GetName();
1360  pDocSh->GetUndoManager()->AddUndoAction(
1361  std::make_unique<ScUndoSelectionStyle>( pDocSh, aFuncMark, aMarkRange, aName, std::move(pUndoDoc) ) );
1362  }
1363 
1364  rDoc.ApplySelectionStyle( static_cast<const ScStyleSheet&>(*pStyleSheet), aFuncMark );
1365 
1366  if (!AdjustBlockHeight())
1367  rViewData.GetDocShell()->PostPaint( aMarkRange, PaintPartFlags::Grid );
1368 
1369  aFuncMark.MarkToSimple();
1370  }
1371  else
1372  {
1373  SCCOL nCol = rViewData.GetCurX();
1374  SCROW nRow = rViewData.GetCurY();
1375  SCTAB nTab = rViewData.GetTabNo();
1376 
1377  if ( bRecord )
1378  {
1380  pUndoDoc->InitUndo( rDoc, nTab, nTab );
1381  for (const auto& rTab : aFuncMark)
1382  if (rTab != nTab)
1383  pUndoDoc->AddUndoTab( rTab, rTab );
1384 
1385  ScRange aCopyRange( nCol, nRow, 0, nCol, nRow, nTabCount-1 );
1386  rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, false, *pUndoDoc );
1387 
1388  ScRange aMarkRange ( nCol, nRow, nTab );
1389  ScMarkData aUndoMark = aFuncMark;
1390  aUndoMark.SetMultiMarkArea( aMarkRange );
1391 
1392  OUString aName = pStyleSheet->GetName();
1393  pDocSh->GetUndoManager()->AddUndoAction(
1394  std::make_unique<ScUndoSelectionStyle>( pDocSh, aUndoMark, aMarkRange, aName, std::move(pUndoDoc) ) );
1395  }
1396 
1397  for (const auto& rTab : aFuncMark)
1398  rDoc.ApplyStyle( nCol, nRow, rTab, static_cast<const ScStyleSheet&>(*pStyleSheet) );
1399 
1400  if (!AdjustBlockHeight())
1401  rViewData.GetDocShell()->PostPaintCell( nCol, nRow, nTab );
1402 
1403  }
1404 
1405  aModificator.SetDocumentModified();
1406 
1407  StartFormatArea();
1408 }
1409 
1411 {
1412  if ( !pStyleSheet) return;
1413 
1414  ScViewData& rViewData = GetViewData();
1415  ScDocument& rDoc = rViewData.GetDocument();
1416  ScDocShell* pDocSh = rViewData.GetDocShell();
1417 
1418  ScDocShellModificator aModificator( *pDocSh );
1419 
1421  pVirtDev->SetMapMode(MapMode(MapUnit::MapPixel));
1422  rDoc.StyleSheetChanged( pStyleSheet, true, pVirtDev,
1423  rViewData.GetPPTX(),
1424  rViewData.GetPPTY(),
1425  rViewData.GetZoomX(),
1426  rViewData.GetZoomY() );
1427 
1428  pDocSh->PostPaint( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
1429  aModificator.SetDocumentModified();
1430 
1431  ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
1432  if (pHdl)
1433  pHdl->ForgetLastPattern();
1434 }
1435 
1437 {
1438  if ( !pStyleSheet) return;
1439 
1440  ScViewData& rViewData = GetViewData();
1441  ScDocument& rDoc = rViewData.GetDocument();
1442  ScDocShell* pDocSh = rViewData.GetDocShell();
1443 
1444  ScDocShellModificator aModificator( *pDocSh );
1445 
1447  pVirtDev->SetMapMode(MapMode(MapUnit::MapPixel));
1448  rDoc.StyleSheetChanged( pStyleSheet, false, pVirtDev,
1449  rViewData.GetPPTX(),
1450  rViewData.GetPPTY(),
1451  rViewData.GetZoomX(),
1452  rViewData.GetZoomY() );
1453 
1454  pDocSh->PostPaint( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
1455  aModificator.SetDocumentModified();
1456 
1457  ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
1458  if (pHdl)
1459  pHdl->ForgetLastPattern();
1460 }
1461 
1462 
1464 {
1465  if (!comphelper::LibreOfficeKit::isActive() || nOffset == 0)
1466  return;
1467 
1468  SCTAB nCurrentTabIndex = GetViewData().GetTabNo();
1469  SfxViewShell* pCurrentViewShell = GetViewData().GetViewShell();
1470  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1471  while (pViewShell)
1472  {
1473  ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1474  if (pTabViewShell && pTabViewShell->GetDocId() == pCurrentViewShell->GetDocId())
1475  {
1476  pTabViewShell->GetViewData().GetLOKWidthHelper(nCurrentTabIndex)->invalidateByIndex(nStartCol);
1477 
1478  // if we remove a column the cursor position and the current selection
1479  // in other views could need to be moved on the left by one column.
1480  if (pTabViewShell != this)
1481  {
1482  if (pTabViewShell->getPart() == nCurrentTabIndex)
1483  {
1484  SCCOL nX = pTabViewShell->GetViewData().GetCurX();
1485  if (nX > nStartCol || (nX == nStartCol && nOffset > 0))
1486  {
1487  ScInputHandler* pInputHdl = pTabViewShell->GetInputHandler();
1488  SCROW nY = pTabViewShell->GetViewData().GetCurY();
1489  pTabViewShell->SetCursor(nX + nOffset, nY);
1490  if (pInputHdl && pInputHdl->IsInputMode())
1491  {
1492  pInputHdl->SetModified();
1493  }
1494  }
1495 
1496  ScMarkData aMultiMark( pTabViewShell->GetViewData().GetMarkData() );
1497  aMultiMark.SetMarking( false );
1498  aMultiMark.MarkToMulti();
1499  if (aMultiMark.IsMultiMarked())
1500  {
1501  aMultiMark.ShiftCols(pTabViewShell->GetViewData().GetDocument(), nStartCol, nOffset);
1502  pTabViewShell->SetMarkData(aMultiMark);
1503  }
1504  }
1505  else
1506  {
1507  SCROW nX = pTabViewShell->GetViewData().GetCurXForTab(nCurrentTabIndex);
1508  if (nX > nStartCol || (nX == nStartCol && nOffset > 0))
1509  {
1510  pTabViewShell->GetViewData().SetCurXForTab(nX + nOffset, nCurrentTabIndex);
1511  }
1512  }
1513  }
1514  }
1515  pViewShell = SfxViewShell::GetNext(*pViewShell);
1516  }
1517 }
1518 
1520 {
1521  if (!comphelper::LibreOfficeKit::isActive() || nOffset == 0)
1522  return;
1523 
1524  SCTAB nCurrentTabIndex = GetViewData().GetTabNo();
1525  SfxViewShell* pCurrentViewShell = GetViewData().GetViewShell();
1526  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1527  while (pViewShell)
1528  {
1529  ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1530  if (pTabViewShell && pTabViewShell->GetDocId() == pCurrentViewShell->GetDocId())
1531  {
1532  pTabViewShell->GetViewData().GetLOKHeightHelper(nCurrentTabIndex)->invalidateByIndex(nStartRow);
1533 
1534  // if we remove a row the cursor position and the current selection
1535  // in other views could need to be moved up by one row.
1536  if (pTabViewShell != this)
1537  {
1538  if (pTabViewShell->getPart() == nCurrentTabIndex)
1539  {
1540  SCROW nY = pTabViewShell->GetViewData().GetCurY();
1541  if (nY > nStartRow || (nY == nStartRow && nOffset > 0))
1542  {
1543  ScInputHandler* pInputHdl = pTabViewShell->GetInputHandler();
1544  SCCOL nX = pTabViewShell->GetViewData().GetCurX();
1545  pTabViewShell->SetCursor(nX, nY + nOffset);
1546  if (pInputHdl && pInputHdl->IsInputMode())
1547  {
1548  pInputHdl->SetModified();
1549  }
1550  }
1551 
1552  ScMarkData aMultiMark( pTabViewShell->GetViewData().GetMarkData() );
1553  aMultiMark.SetMarking( false );
1554  aMultiMark.MarkToMulti();
1555  if (aMultiMark.IsMultiMarked())
1556  {
1557  aMultiMark.ShiftRows(pTabViewShell->GetViewData().GetDocument(), nStartRow, nOffset);
1558  pTabViewShell->SetMarkData(aMultiMark);
1559  }
1560  }
1561  else
1562  {
1563  SCROW nY = pTabViewShell->GetViewData().GetCurYForTab(nCurrentTabIndex);
1564  if (nY > nStartRow || (nY == nStartRow && nOffset > 0))
1565  {
1566  pTabViewShell->GetViewData().SetCurYForTab(nY + nOffset, nCurrentTabIndex);
1567  }
1568  }
1569  }
1570  }
1571  pViewShell = SfxViewShell::GetNext(*pViewShell);
1572  }
1573 }
1574 
1576 {
1578  return;
1579 
1580  SCTAB nCurTab = GetViewData().GetTabNo();
1581  SfxViewShell* pCurrentViewShell = GetViewData().GetViewShell();
1582  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1583  while (pViewShell)
1584  {
1585  ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1586  if (pTabViewShell && pTabViewShell->GetDocId() == pCurrentViewShell->GetDocId())
1587  {
1588  if (bWidth)
1589  pTabViewShell->GetViewData().GetLOKWidthHelper(nCurTab)->invalidateByIndex(nStart);
1590  else
1591  pTabViewShell->GetViewData().GetLOKHeightHelper(nCurTab)->invalidateByIndex(nStart);
1592  }
1593  pViewShell = SfxViewShell::GetNext(*pViewShell);
1594  }
1595 }
1596 
1597 // insert cells - undo OK
1598 
1599 bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste )
1600 {
1601  ScRange aRange;
1602  if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE)
1603  {
1604  ScDocShell* pDocSh = GetViewData().GetDocShell();
1605  const ScMarkData& rMark = GetViewData().GetMarkData();
1606  bool bSuccess = pDocSh->GetDocFunc().InsertCells( aRange, &rMark, eCmd, bRecord, false, bPartOfPaste );
1607  if (bSuccess)
1608  {
1610  bool bInsertCols = ( eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER);
1611  bool bInsertRows = ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER );
1612 
1613  pDocSh->UpdateOle(GetViewData());
1615 
1616  if ( bInsertCols || bInsertRows )
1617  {
1618  OUString aOperation = bInsertRows ?
1619  OUString("insert-rows"):
1620  OUString("insert-columns");
1621  HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, aRange, aOperation);
1622  }
1623 
1625  {
1626  if (bInsertCols)
1628 
1629  if (bInsertRows)
1631 
1633  bInsertCols, bInsertRows, true /* bSizes*/,
1634  true /* bHidden */, true /* bFiltered */,
1635  true /* bGroups */, GetViewData().GetTabNo());
1636  }
1637  }
1638  OUString aStartAddress = aRange.aStart.GetColRowString();
1639  OUString aEndAddress = aRange.aEnd.GetColRowString();
1640  collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "INSERT_CELLS");
1641  return bSuccess;
1642  }
1643  else
1644  {
1645  ErrorMessage(STR_NOMULTISELECT);
1646  return false;
1647  }
1648 }
1649 
1650 // delete cells - undo OK
1651 
1653 {
1654  ScRange aRange;
1655  if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
1656  {
1657  ScDocShell* pDocSh = GetViewData().GetDocShell();
1658  const ScMarkData& rMark = GetViewData().GetMarkData();
1659 
1660 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
1661  // #i94841# [Collaboration] if deleting rows is rejected, the content is sometimes wrong
1662  if ( pDocSh->IsDocShared() && ( eCmd == DelCellCmd::Rows || eCmd == DelCellCmd::Cols ) )
1663  {
1664  ScRange aDelRange( aRange.aStart );
1665  SCCOLROW nCount = 0;
1666  if ( eCmd == DelCellCmd::Rows )
1667  {
1668  nCount = sal::static_int_cast< SCCOLROW >( aRange.aEnd.Row() - aRange.aStart.Row() + 1 );
1669  }
1670  else
1671  {
1672  nCount = sal::static_int_cast< SCCOLROW >( aRange.aEnd.Col() - aRange.aStart.Col() + 1 );
1673  }
1674  while ( nCount > 0 )
1675  {
1676  pDocSh->GetDocFunc().DeleteCells( aDelRange, &rMark, eCmd, false );
1677  --nCount;
1678  }
1679  }
1680  else
1681 #endif
1682  {
1683  pDocSh->GetDocFunc().DeleteCells( aRange, &rMark, eCmd, false );
1684  }
1685 
1687  pDocSh->UpdateOle(GetViewData());
1689 
1690  if ( eCmd == DelCellCmd::Rows || eCmd == DelCellCmd::Cols )
1691  {
1692  OUString aOperation = ( eCmd == DelCellCmd::Rows) ?
1693  OUString("delete-rows"):
1694  OUString("delete-columns");
1695  HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, aRange, aOperation);
1696  }
1697 
1698  // put cursor directly behind deleted range
1699  SCCOL nCurX = GetViewData().GetCurX();
1700  SCROW nCurY = GetViewData().GetCurY();
1701  if ( eCmd==DelCellCmd::CellsLeft || eCmd==DelCellCmd::Cols )
1702  nCurX = aRange.aStart.Col();
1703  else
1704  nCurY = aRange.aStart.Row();
1705  SetCursor( nCurX, nCurY );
1706 
1708  {
1709  bool bColsDeleted = (eCmd == DelCellCmd::Cols);
1710  bool bRowsDeleted = (eCmd == DelCellCmd::Rows);
1711  if (bColsDeleted)
1713 
1714  if (bRowsDeleted)
1716 
1718  bColsDeleted, bRowsDeleted, true /* bSizes*/,
1719  true /* bHidden */, true /* bFiltered */,
1720  true /* bGroups */, GetViewData().GetTabNo());
1721  }
1722  }
1723  else
1724  {
1725  if (eCmd == DelCellCmd::Cols)
1726  DeleteMulti( false );
1727  else if (eCmd == DelCellCmd::Rows)
1728  DeleteMulti( true );
1729  else
1730  ErrorMessage(STR_NOMULTISELECT);
1731  }
1732 
1733  OUString aStartAddress = aRange.aStart.GetColRowString();
1734  OUString aEndAddress = aRange.aEnd.GetColRowString();
1735  collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "DELETE_CELLS");
1736 
1737  Unmark();
1738 }
1739 
1740 void ScViewFunc::DeleteMulti( bool bRows )
1741 {
1742  ScDocShell* pDocSh = GetViewData().GetDocShell();
1743  ScDocShellModificator aModificator( *pDocSh );
1744  SCTAB nTab = GetViewData().GetTabNo();
1745  ScDocument& rDoc = pDocSh->GetDocument();
1746  ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
1747  ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
1748 
1749  bool bRecord = true;
1750  if (!rDoc.IsUndoEnabled())
1751  bRecord = false;
1752 
1753  std::vector<sc::ColRowSpan> aSpans;
1754  if (bRows)
1755  aSpans = aFuncMark.GetMarkedRowSpans();
1756  else
1757  aSpans = aFuncMark.GetMarkedColSpans();
1758 
1759  if (aSpans.empty())
1760  {
1761  SCCOLROW nCurPos = bRows ? GetViewData().GetCurY() : GetViewData().GetCurX();
1762  aSpans.emplace_back(nCurPos, nCurPos);
1763  }
1764 
1765  // test if allowed
1766 
1767  const char* pErrorId = nullptr;
1768  bool bNeedRefresh = false;
1769  for (size_t i = 0, n = aSpans.size(); i < n && !pErrorId; ++i)
1770  {
1771  SCCOLROW nStart = aSpans[i].mnStart;
1772  SCCOLROW nEnd = aSpans[i].mnEnd;
1773 
1774  SCCOL nStartCol, nEndCol;
1775  SCROW nStartRow, nEndRow;
1776  if ( bRows )
1777  {
1778  nStartCol = 0;
1779  nEndCol = rDoc.MaxCol();
1780  nStartRow = static_cast<SCROW>(nStart);
1781  nEndRow = static_cast<SCROW>(nEnd);
1782  }
1783  else
1784  {
1785  nStartCol = static_cast<SCCOL>(nStart);
1786  nEndCol = static_cast<SCCOL>(nEnd);
1787  nStartRow = 0;
1788  nEndRow = rDoc.MaxRow();
1789  }
1790 
1791  // cell protection (only needed for first range, as all following cells are moved)
1792  if (i == 0)
1793  {
1794  // test to the end of the sheet
1795  ScEditableTester aTester( rDoc, nTab, nStartCol, nStartRow, rDoc.MaxCol(), rDoc.MaxRow() );
1796  if (!aTester.IsEditable())
1797  pErrorId = aTester.GetMessageId();
1798  }
1799 
1800  // merged cells
1801  SCCOL nMergeStartX = nStartCol;
1802  SCROW nMergeStartY = nStartRow;
1803  SCCOL nMergeEndX = nEndCol;
1804  SCROW nMergeEndY = nEndRow;
1805  rDoc.ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
1806  rDoc.ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
1807 
1808  if ( nMergeStartX != nStartCol || nMergeStartY != nStartRow )
1809  {
1810  // Disallow deleting parts of a merged cell.
1811  // Deleting the start is allowed (merge is removed), so the end doesn't have to be checked.
1812 
1813  pErrorId = STR_MSSG_DELETECELLS_0;
1814  }
1815  if ( nMergeEndX != nEndCol || nMergeEndY != nEndRow )
1816  {
1817  // detect if the start of a merged cell is deleted, so the merge flags can be refreshed
1818 
1819  bNeedRefresh = true;
1820  }
1821  }
1822 
1823  if (pErrorId)
1824  {
1825  ErrorMessage(pErrorId);
1826  return;
1827  }
1828 
1829  // proceed
1830 
1831  weld::WaitObject aWait(GetViewData().GetDialogParent()); // important for TrackFormulas in UpdateReference
1832 
1834 
1835  ScDocumentUniquePtr pUndoDoc;
1836  std::unique_ptr<ScRefUndoData> pUndoData;
1837  if (bRecord)
1838  {
1839  pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
1840  pUndoDoc->InitUndo( rDoc, nTab, nTab, !bRows, bRows ); // row height
1841 
1842  for (const sc::ColRowSpan & rSpan : aSpans)
1843  {
1844  SCCOLROW nStart = rSpan.mnStart;
1845  SCCOLROW nEnd = rSpan.mnEnd;
1846  if (bRows)
1847  rDoc.CopyToDocument( 0,nStart,nTab, rDoc.MaxCol(), nEnd,nTab, InsertDeleteFlags::ALL,false,*pUndoDoc );
1848  else
1849  rDoc.CopyToDocument( static_cast<SCCOL>(nStart),0,nTab,
1850  static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab,
1851  InsertDeleteFlags::ALL,false,*pUndoDoc );
1852  }
1853 
1854  // all Formulas because of references
1855  SCTAB nTabCount = rDoc.GetTableCount();
1856  pUndoDoc->AddUndoTab( 0, nTabCount-1 );
1857  rDoc.CopyToDocument( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, InsertDeleteFlags::FORMULA,false,*pUndoDoc );
1858 
1859  pUndoData.reset(new ScRefUndoData( &rDoc ));
1860 
1861  rDoc.BeginDrawUndo();
1862  }
1863 
1864  std::vector<sc::ColRowSpan>::const_reverse_iterator ri = aSpans.rbegin(), riEnd = aSpans.rend();
1865  aFuncMark.SelectOneTable(nTab);
1866  for (; ri != riEnd; ++ri)
1867  {
1868  SCCOLROW nEnd = ri->mnEnd;
1869  SCCOLROW nStart = ri->mnStart;
1870 
1871  if (bRows)
1872  {
1873  rDoc.DeleteObjectsInArea(0, nStart, rDoc.MaxCol(), nEnd, aFuncMark, true);
1874  rDoc.DeleteRow(0, nTab, rDoc.MaxCol(), nTab, nStart, static_cast<SCSIZE>(nEnd - nStart + 1));
1875  }
1876  else
1877  {
1878  rDoc.DeleteObjectsInArea(nStart, 0, nEnd, rDoc.MaxRow(), aFuncMark, true);
1879  rDoc.DeleteCol(0, nTab, rDoc.MaxRow(), nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd - nStart + 1));
1880  }
1881  }
1882 
1883  if (bNeedRefresh)
1884  {
1885  SCCOLROW nFirstStart = aSpans[0].mnStart;
1886  SCCOL nStartCol = bRows ? 0 : static_cast<SCCOL>(nFirstStart);
1887  SCROW nStartRow = bRows ? static_cast<SCROW>(nFirstStart) : 0;
1888  SCCOL nEndCol = rDoc.MaxCol();
1889  SCROW nEndRow = rDoc.MaxRow();
1890 
1891  rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver );
1892  rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true );
1893  }
1894 
1895  if (bRecord)
1896  {
1897  pDocSh->GetUndoManager()->AddUndoAction(
1898  std::make_unique<ScUndoDeleteMulti>(
1899  pDocSh, bRows, bNeedRefresh, nTab, aSpans, std::move(pUndoDoc), std::move(pUndoData)));
1900  }
1901 
1902  if (!AdjustRowHeight(0, rDoc.MaxRow(), true))
1903  {
1904  if (bRows)
1905  {
1906  pDocSh->PostPaint(
1907  0, aSpans[0].mnStart, nTab,
1908  rDoc.MaxCol(), rDoc.MaxRow(), nTab, (PaintPartFlags::Grid | PaintPartFlags::Left));
1909  }
1910  else
1911  {
1912  pDocSh->PostPaint(
1913  static_cast<SCCOL>(aSpans[0].mnStart), 0, nTab,
1914  rDoc.MaxCol(), rDoc.MaxRow(), nTab, (PaintPartFlags::Grid | PaintPartFlags::Top));
1915  }
1916  }
1917 
1918  aModificator.SetDocumentModified();
1919 
1921 
1922  // put cursor directly behind the first deleted range
1923  SCCOL nCurX = GetViewData().GetCurX();
1924  SCROW nCurY = GetViewData().GetCurY();
1925  if ( bRows )
1926  nCurY = aSpans[0].mnStart;
1927  else
1928  nCurX = static_cast<SCCOL>(aSpans[0].mnStart);
1929  SetCursor( nCurX, nCurY );
1930 
1931  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1932 }
1933 
1934 // delete contents
1935 
1937 {
1938  ScViewData& rViewData = GetViewData();
1939  rViewData.SetPasteMode( ScPasteFlags::NONE );
1940  rViewData.GetViewShell()->UpdateCopySourceOverlay();
1941 
1942  // not editable because of matrix only? attribute OK nonetheless
1943  bool bOnlyNotBecauseOfMatrix;
1944  bool bEditable = SelectionEditable( &bOnlyNotBecauseOfMatrix );
1945  if ( !bEditable )
1946  {
1947  if ( !(bOnlyNotBecauseOfMatrix &&
1948  ((nFlags & (InsertDeleteFlags::ATTRIB | InsertDeleteFlags::EDITATTR)) == nFlags)) )
1949  {
1950  ErrorMessage(bOnlyNotBecauseOfMatrix ? STR_MATRIXFRAGMENTERR : STR_PROTECTIONERR);
1951  return;
1952  }
1953  }
1954 
1955  ScRange aMarkRange;
1956  bool bSimple = false;
1957 
1958  ScDocument& rDoc = GetViewData().GetDocument();
1959  ScDocShell* pDocSh = GetViewData().GetDocShell();
1960  ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
1961  ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
1962 
1963  bool bRecord =true;
1964  if (!rDoc.IsUndoEnabled())
1965  bRecord = false;
1966 
1967  if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
1968  {
1969  aMarkRange.aStart.SetCol(GetViewData().GetCurX());
1970  aMarkRange.aStart.SetRow(GetViewData().GetCurY());
1971  aMarkRange.aStart.SetTab(GetViewData().GetTabNo());
1972  aMarkRange.aEnd = aMarkRange.aStart;
1973  if ( rDoc.HasAttrib( aMarkRange, HasAttrFlags::Merged ) )
1974  {
1975  aFuncMark.SetMarkArea( aMarkRange );
1976  }
1977  else
1978  bSimple = true;
1979  }
1980 
1981  HideAllCursors(); // for if summary is cancelled
1982 
1983  ScDocFunc& rDocFunc = pDocSh->GetDocFunc();
1984 
1985  // Can we really be sure that we can pass the bApi parameter as false to DeleteCell() and
1986  // DeleteContents() here? (Meaning that this is interactive use.) Is this never invoked from
1987  // scripting and whatnot?
1988  if (bSimple)
1989  rDocFunc.DeleteCell(aMarkRange.aStart, aFuncMark, nFlags, bRecord, /*bApi=*/ false);
1990  else
1991  rDocFunc.DeleteContents(aFuncMark, nFlags, bRecord, /*bApi=*/ false);
1992 
1993  pDocSh->UpdateOle(GetViewData());
1994 
1996  {
1997  ScRangeList aChangeRanges;
1998  if ( bSimple )
1999  {
2000  aChangeRanges.push_back( aMarkRange );
2001  }
2002  else
2003  {
2004  aFuncMark.FillRangeListWithMarks( &aChangeRanges, false );
2005  }
2006  HelperNotifyChanges::Notify(*pModelObj, aChangeRanges);
2007  }
2008 
2010  ShowAllCursors();
2011 
2012  if ( nFlags & InsertDeleteFlags::ATTRIB )
2013  {
2014  if ( nFlags & InsertDeleteFlags::CONTENTS )
2015  bFormatValid = false;
2016  else
2017  StartFormatArea(); // delete attribute is also attribute-change
2018  }
2019  OUString aStartAddress = aMarkRange.aStart.GetColRowString();
2020  OUString aEndAddress = aMarkRange.aEnd.GetColRowString();
2021  collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "DELETE");
2022 }
2023 
2024 // column width/row height (via header) - undo OK
2025 
2027  bool bWidth, const std::vector<sc::ColRowSpan>& rRanges, ScSizeMode eMode,
2028  sal_uInt16 nSizeTwips, bool bRecord, const ScMarkData* pMarkData )
2029 {
2030  if (rRanges.empty())
2031  return;
2032 
2033  // Use view's mark if none specified, but do not modify the original data,
2034  // i.e. no MarkToMulti() on that.
2035  ScMarkData aMarkData( pMarkData ? *pMarkData : GetViewData().GetMarkData());
2036 
2037  ScDocShell* pDocSh = GetViewData().GetDocShell();
2038  ScDocument& rDoc = pDocSh->GetDocument();
2039  SCCOL nCurX = GetViewData().GetCurX();
2040  SCROW nCurY = GetViewData().GetCurY();
2041  SCTAB nFirstTab = aMarkData.GetFirstSelected();
2042  SCTAB nCurTab = GetViewData().GetTabNo();
2043  if (bRecord && !rDoc.IsUndoEnabled())
2044  bRecord = false;
2045 
2046  ScDocShellModificator aModificator( *pDocSh );
2047 
2048  bool bAllowed = true;
2049  for (const SCTAB& nTab : aMarkData)
2050  {
2051  bAllowed = std::all_of(rRanges.begin(), rRanges.end(),
2052  [&bWidth, &rDoc, &nTab](const sc::ColRowSpan& rRange) {
2053  bool bOnlyMatrix;
2054  bool bIsBlockEditable;
2055  if (bWidth)
2056  bIsBlockEditable = rDoc.IsBlockEditable(nTab, rRange.mnStart, 0, rRange.mnEnd, rDoc.MaxRow(), &bOnlyMatrix);
2057  else
2058  bIsBlockEditable = rDoc.IsBlockEditable(nTab, 0, rRange.mnStart, rDoc.MaxCol(), rRange.mnEnd, &bOnlyMatrix);
2059  return bIsBlockEditable || bOnlyMatrix;
2060  });
2061  if (!bAllowed)
2062  break;
2063  }
2064 
2065  // Allow users to resize cols/rows in readonly docs despite the r/o state.
2066  // It is frustrating to be unable to see content in mis-sized cells.
2067  if( !bAllowed && !pDocSh->IsReadOnly() )
2068  {
2069  ErrorMessage(STR_PROTECTIONERR);
2070  return;
2071  }
2072 
2073  SCCOLROW nStart = rRanges.front().mnStart;
2074  SCCOLROW nEnd = rRanges.back().mnEnd;
2075 
2076  OnLOKSetWidthOrHeight(nStart, bWidth);
2077 
2078  bool bFormula = false;
2079  if ( eMode == SC_SIZE_OPTIMAL )
2080  {
2081  const ScViewOptions& rOpts = GetViewData().GetOptions();
2082  bFormula = rOpts.GetOption( VOPT_FORMULAS );
2083  }
2084 
2085  ScDocumentUniquePtr pUndoDoc;
2086  std::unique_ptr<ScOutlineTable> pUndoTab;
2087  std::vector<sc::ColRowSpan> aUndoRanges;
2088 
2089  if ( bRecord )
2090  {
2091  rDoc.BeginDrawUndo(); // Drawing Updates
2092 
2093  pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
2094  for (const SCTAB& nTab : aMarkData)
2095  {
2096  if (bWidth)
2097  {
2098  if ( nTab == nFirstTab )
2099  pUndoDoc->InitUndo( rDoc, nTab, nTab, true );
2100  else
2101  pUndoDoc->AddUndoTab( nTab, nTab, true );
2102  rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
2103  static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE,
2104  false, *pUndoDoc );
2105  }
2106  else
2107  {
2108  if ( nTab == nFirstTab )
2109  pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
2110  else
2111  pUndoDoc->AddUndoTab( nTab, nTab, false, true );
2112  rDoc.CopyToDocument( 0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
2113  }
2114  }
2115 
2116  aUndoRanges = rRanges;
2117 
2119  ScOutlineTable* pTable = rDoc.GetOutlineTable( nCurTab );
2120  if (pTable)
2121  pUndoTab.reset(new ScOutlineTable( *pTable ));
2122  }
2123 
2124  if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
2125  aMarkData.MarkToMulti();
2126 
2127  bool bShow = nSizeTwips > 0 || eMode != SC_SIZE_DIRECT;
2128  bool bOutline = false;
2129 
2130  for (const SCTAB& nTab : aMarkData)
2131  {
2132  for (const sc::ColRowSpan & rRange : rRanges)
2133  {
2134  SCCOLROW nStartNo = rRange.mnStart;
2135  SCCOLROW nEndNo = rRange.mnEnd;
2136 
2137  if ( !bWidth ) // height always blockwise
2138  {
2139  if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
2140  {
2141  bool bAll = ( eMode==SC_SIZE_OPTIMAL );
2142  if (!bAll)
2143  {
2144  // delete CRFlags::ManualSize for all in range,
2145  // then SetOptimalHeight with bShrink = FALSE
2146  for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow)
2147  {
2148  SCROW nLastRow = nRow;
2149  if (rDoc.RowHidden(nRow, nTab, nullptr, &nLastRow))
2150  {
2151  nRow = nLastRow;
2152  continue;
2153  }
2154 
2155  CRFlags nOld = rDoc.GetRowFlags(nRow, nTab);
2156  if (nOld & CRFlags::ManualSize)
2157  rDoc.SetRowFlags(nRow, nTab, nOld & ~CRFlags::ManualSize);
2158  }
2159  }
2160 
2161  double nPPTX = GetViewData().GetPPTX();
2162  double nPPTY = GetViewData().GetPPTY();
2163  Fraction aZoomX = GetViewData().GetZoomX();
2164  Fraction aZoomY = GetViewData().GetZoomY();
2165 
2166  ScSizeDeviceProvider aProv(pDocSh);
2167  if (aProv.IsPrinter())
2168  {
2169  nPPTX = aProv.GetPPTX();
2170  nPPTY = aProv.GetPPTY();
2171  aZoomX = aZoomY = Fraction( 1, 1 );
2172  }
2173 
2174  sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
2175  aCxt.setForceAutoSize(bAll);
2176  aCxt.setExtraHeight(nSizeTwips);
2177  rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab, true);
2178  if (bAll)
2179  {
2180  for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow)
2181  {
2182  SCROW nLastRow = nRow;
2183  // tdf#36383 skip consecutive rows hidden by AutoFilter
2184  if (rDoc.RowFiltered(nRow, nTab, nullptr, &nLastRow))
2185  nRow = nLastRow;
2186  else
2187  rDoc.ShowRow(nRow, nTab, true);
2188  }
2189  }
2190 
2191  // Manual-Flag already (re)set in SetOptimalHeight in case of bAll=sal_True
2192  // (set for Extra-Height, else reset).
2193  }
2194  else if ( eMode==SC_SIZE_DIRECT )
2195  {
2196  if (nSizeTwips)
2197  {
2198  rDoc.SetRowHeightRange( nStartNo, nEndNo, nTab, nSizeTwips );
2199  rDoc.SetManualHeight( nStartNo, nEndNo, nTab, true ); // height was set manually
2200  }
2201 
2202  for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow)
2203  {
2204  SCROW nLastRow = nRow;
2205  // tdf#36383 skip consecutive rows hidden by AutoFilter
2206  if (rDoc.RowFiltered(nRow, nTab, nullptr, &nLastRow))
2207  nRow = nLastRow;
2208  else
2209  rDoc.ShowRow(nRow, nTab, nSizeTwips != 0);
2210  }
2211 
2212  if (!bShow && nStartNo <= nCurY && nCurY <= nEndNo && nTab == nCurTab)
2213  {
2214  nCurY = -1;
2215  }
2216  }
2217  else if ( eMode==SC_SIZE_SHOW )
2218  {
2219  rDoc.ShowRows( nStartNo, nEndNo, nTab, true );
2220  }
2221  }
2222  else // column width
2223  {
2224  for (SCCOL nCol=static_cast<SCCOL>(nStartNo); nCol<=static_cast<SCCOL>(nEndNo); nCol++)
2225  {
2226  if ( eMode != SC_SIZE_VISOPT || !rDoc.ColHidden(nCol, nTab) )
2227  {
2228  sal_uInt16 nThisSize = nSizeTwips;
2229 
2230  if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
2231  nThisSize = nSizeTwips + GetOptimalColWidth( nCol, nTab, bFormula );
2232  if ( nThisSize )
2233  rDoc.SetColWidth( nCol, nTab, nThisSize );
2234 
2235  rDoc.ShowCol( nCol, nTab, bShow );
2236 
2237  if (!bShow && nCol == nCurX && nTab == nCurTab)
2238  {
2239  nCurX = -1;
2240  }
2241  }
2242  }
2243  }
2244 
2245  // adjust outline
2246  if (bWidth)
2247  {
2248  if ( rDoc.UpdateOutlineCol( static_cast<SCCOL>(nStartNo),
2249  static_cast<SCCOL>(nEndNo), nTab, bShow ) )
2250  bOutline = true;
2251  }
2252  else
2253  {
2254  if ( rDoc.UpdateOutlineRow( nStartNo, nEndNo, nTab, bShow ) )
2255  bOutline = true;
2256  }
2257  }
2258  rDoc.SetDrawPageSize(nTab);
2259  }
2260 
2261  if (!bOutline)
2262  pUndoTab.reset();
2263 
2264  if (bRecord)
2265  {
2266  pDocSh->GetUndoManager()->AddUndoAction(
2267  std::make_unique<ScUndoWidthOrHeight>(
2268  pDocSh, aMarkData, nStart, nCurTab, nEnd, nCurTab,
2269  std::move(pUndoDoc), aUndoRanges, std::move(pUndoTab), eMode, nSizeTwips, bWidth));
2270  }
2271 
2272  if (nCurX < 0)
2273  {
2274  MoveCursorRel( 1, 0, SC_FOLLOW_LINE, false );
2275  }
2276 
2277  if (nCurY < 0)
2278  {
2279  MoveCursorRel( 0, 1, SC_FOLLOW_LINE, false );
2280  }
2281 
2282  // fdo#36247 Ensure that the drawing layer's map mode scaling factors match
2283  // the new heights and widths.
2285 
2286  for (const SCTAB& nTab : aMarkData)
2287  rDoc.UpdatePageBreaks( nTab );
2288 
2289  bool bAffectsVisibility = (eMode != SC_SIZE_ORIGINAL && eMode != SC_SIZE_VISOPT);
2291  bWidth /* bColumns */, !bWidth /* bRows */,
2292  true /* bSizes*/, bAffectsVisibility /* bHidden */, bAffectsVisibility /* bFiltered */,
2293  false /* bGroups */, nCurTab);
2295 
2296  {
2297  for (const SCTAB& nTab : aMarkData)
2298  {
2299  if (bWidth)
2300  {
2301  if (rDoc.HasAttrib( static_cast<SCCOL>(nStart),0,nTab,
2302  static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab,
2304  nStart = 0;
2305  if (nStart > 0) // go upwards because of Lines and cursor
2306  --nStart;
2307  pDocSh->PostPaint( static_cast<SCCOL>(nStart), 0, nTab,
2308  rDoc.MaxCol(), rDoc.MaxRow(), nTab, PaintPartFlags::Grid | PaintPartFlags::Top );
2309  }
2310  else
2311  {
2312  if (rDoc.HasAttrib( 0,nStart,nTab, rDoc.MaxCol(), nEnd,nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped ))
2313  nStart = 0;
2314  if (nStart != 0)
2315  --nStart;
2316  pDocSh->PostPaint( 0, nStart, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab, PaintPartFlags::Grid | PaintPartFlags::Left );
2317  }
2318  }
2319 
2320  pDocSh->UpdateOle(GetViewData());
2321  if( !pDocSh->IsReadOnly() )
2322  aModificator.SetDocumentModified();
2323  }
2324 
2325  if ( !bWidth )
2326  return;
2327 
2329  if (!pModelObj)
2330  return;
2331 
2332  ScRangeList aChangeRanges;
2333  for (const SCTAB& nTab : aMarkData)
2334  {
2335  for (const sc::ColRowSpan & rRange : rRanges)
2336  {
2337  SCCOL nStartCol = rRange.mnStart;
2338  SCCOL nEndCol = rRange.mnEnd;
2339  for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
2340  {
2341  aChangeRanges.push_back( ScRange( nCol, 0, nTab ) );
2342  }
2343  }
2344  }
2345  HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "column-resize");
2346 }
2347 
2348 // column width/row height (via marked range)
2349 
2350 void ScViewFunc::SetMarkedWidthOrHeight( bool bWidth, ScSizeMode eMode, sal_uInt16 nSizeTwips )
2351 {
2352  ScMarkData& rMark = GetViewData().GetMarkData();
2353 
2354  rMark.MarkToMulti();
2355  if (!rMark.IsMultiMarked())
2356  {
2357  SCCOL nCol = GetViewData().GetCurX();
2358  SCROW nRow = GetViewData().GetCurY();
2359  SCTAB nTab = GetViewData().GetTabNo();
2360  DoneBlockMode();
2361  InitOwnBlockMode();
2362  rMark.SetMultiMarkArea( ScRange( nCol,nRow,nTab ) );
2363  MarkDataChanged();
2364  }
2365 
2366  std::vector<sc::ColRowSpan> aRanges =
2367  bWidth ? rMark.GetMarkedColSpans() : rMark.GetMarkedRowSpans();
2368 
2369  SetWidthOrHeight(bWidth, aRanges, eMode, nSizeTwips);
2370 
2371  rMark.MarkToSimple();
2372 }
2373 
2374 void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal )
2375 {
2377  // step size is also minimum
2378  constexpr sal_uInt16 nStepX = STD_COL_WIDTH / 5;
2379  sal_uInt16 nStepY = ScGlobal::nStdRowHeight;
2380 
2381  ScModule* pScMod = SC_MOD();
2382  bool bAnyEdit = pScMod->IsInputMode();
2383  SCCOL nCol = GetViewData().GetCurX();
2384  SCROW nRow = GetViewData().GetCurY();
2385  SCTAB nTab = GetViewData().GetTabNo();
2386  ScDocShell* pDocSh = GetViewData().GetDocShell();
2387  ScDocument& rDoc = pDocSh->GetDocument();
2388 
2389  bool bAllowed, bOnlyMatrix;
2390  if ( eDir == DIR_LEFT || eDir == DIR_RIGHT )
2391  bAllowed = rDoc.IsBlockEditable( nTab, nCol,0, nCol,rDoc.MaxRow(), &bOnlyMatrix );
2392  else
2393  bAllowed = rDoc.IsBlockEditable( nTab, 0,nRow, rDoc.MaxCol(), nRow, &bOnlyMatrix );
2394  if ( !bAllowed && !bOnlyMatrix )
2395  {
2396  ErrorMessage(STR_PROTECTIONERR);
2397  return;
2398  }
2399 
2400  HideAllCursors();
2401 
2402  sal_uInt16 nWidth = rDoc.GetColWidth( nCol, nTab );
2403  sal_uInt16 nHeight = rDoc.GetRowHeight( nRow, nTab );
2404  std::vector<sc::ColRowSpan> aRange(1, sc::ColRowSpan(0,0));
2405  if ( eDir == DIR_LEFT || eDir == DIR_RIGHT )
2406  {
2407  if (bOptimal) // width of this single cell
2408  {
2409  if ( bAnyEdit )
2410  {
2411  // when editing the actual entered width
2412  ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData().GetViewShell() );
2413  if (pHdl)
2414  {
2415  tools::Long nEdit = pHdl->GetTextSize().Width(); // in 0.01 mm
2416 
2417  const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab );
2418  const SvxMarginItem& rMItem = pPattern->GetItem(ATTR_MARGIN);
2419  sal_uInt16 nMargin = rMItem.GetLeftMargin() + rMItem.GetRightMargin();
2420  if ( pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue() == SvxCellHorJustify::Left )
2421  nMargin = sal::static_int_cast<sal_uInt16>(
2422  nMargin + pPattern->GetItem(ATTR_INDENT).GetValue() );
2423 
2424  nWidth = std::round(o3tl::convert(nEdit * pDocSh->GetOutputFactor(),
2426  + nMargin + STD_EXTRA_WIDTH;
2427  }
2428  }
2429  else
2430  {
2431  double nPPTX = GetViewData().GetPPTX();
2432  double nPPTY = GetViewData().GetPPTY();
2433  Fraction aZoomX = GetViewData().GetZoomX();
2434  Fraction aZoomY = GetViewData().GetZoomY();
2435 
2436  ScSizeDeviceProvider aProv(pDocSh);
2437  if (aProv.IsPrinter())
2438  {
2439  nPPTX = aProv.GetPPTX();
2440  nPPTY = aProv.GetPPTY();
2441  aZoomX = aZoomY = Fraction( 1, 1 );
2442  }
2443 
2444  tools::Long nPixel = rDoc.GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(),
2445  nPPTX, nPPTY, aZoomX, aZoomY, true );
2446  sal_uInt16 nTwips = static_cast<sal_uInt16>( nPixel / nPPTX );
2447  if (nTwips != 0)
2448  nWidth = nTwips + STD_EXTRA_WIDTH;
2449  else
2450  nWidth = STD_COL_WIDTH;
2451  }
2452  }
2453  else // increment / decrement
2454  {
2455  if ( eDir == DIR_RIGHT )
2456  nWidth = sal::static_int_cast<sal_uInt16>( nWidth + nStepX );
2457  else if ( nWidth > nStepX )
2458  nWidth = sal::static_int_cast<sal_uInt16>( nWidth - nStepX );
2459  if ( nWidth < nStepX ) nWidth = nStepX;
2460  if ( nWidth > MAX_COL_WIDTH ) nWidth = MAX_COL_WIDTH;
2461  }
2462  aRange[0].mnStart = nCol;
2463  aRange[0].mnEnd = nCol;
2464  SetWidthOrHeight(true, aRange, SC_SIZE_DIRECT, nWidth);
2465 
2466  // adjust height of this row if width demands/allows this
2467 
2468  if (!bAnyEdit)
2469  {
2470  const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab );
2471  bool bNeedHeight =
2472  pPattern->GetItem( ATTR_LINEBREAK ).GetValue() ||
2473  pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue() == SvxCellHorJustify::Block;
2474  if (bNeedHeight)
2475  AdjustRowHeight( nRow, nRow, true );
2476  }
2477  }
2478  else
2479  {
2480  ScSizeMode eMode;
2481  if (bOptimal)
2482  {
2483  eMode = SC_SIZE_OPTIMAL;
2484  nHeight = 0;
2485  }
2486  else
2487  {
2488  eMode = SC_SIZE_DIRECT;
2489  if ( eDir == DIR_BOTTOM )
2490  nHeight = sal::static_int_cast<sal_uInt16>( nHeight + nStepY );
2491  else if ( nHeight > nStepY )
2492  nHeight = sal::static_int_cast<sal_uInt16>( nHeight - nStepY );
2493  if ( nHeight < nStepY ) nHeight = nStepY;
2494  if ( nHeight > MAX_ROW_HEIGHT ) nHeight = MAX_ROW_HEIGHT;
2495  }
2496  aRange[0].mnStart = nRow;
2497  aRange[0].mnEnd = nRow;
2498  SetWidthOrHeight(false, aRange, eMode, nHeight);
2499  }
2500 
2501  if ( bAnyEdit )
2502  {
2503  UpdateEditView();
2504  if ( rDoc.HasAttrib( nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::NeedHeight ) )
2505  {
2506  ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData().GetViewShell() );
2507  if (pHdl)
2508  pHdl->SetModified(); // so that the height is adjusted with Enter
2509  }
2510  }
2511 
2512  ShowAllCursors();
2513 }
2514 
2515 void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
2516 {
2517  if (nTab == TABLEID_DOC)
2518  return;
2519 
2520  ScMarkData& rMark = GetViewData().GetMarkData();
2521  ScDocShell* pDocSh = GetViewData().GetDocShell();
2522  ScDocument& rDoc = pDocSh->GetDocument();
2523  ScDocFunc &rFunc = pDocSh->GetDocFunc();
2524  bool bUndo(rDoc.IsUndoEnabled());
2525 
2526  // modifying several tabs is handled here
2527 
2528  if (bUndo)
2529  {
2530  OUString aUndo = ScResId( STR_UNDO_PROTECT_TAB );
2531  pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, GetViewData().GetViewShell()->GetViewShellId() );
2532  }
2533 
2534  for (const auto& rTab : rMark)
2535  {
2536  rFunc.ProtectSheet(rTab, rProtect);
2537  }
2538 
2539  if (bUndo)
2540  pDocSh->GetUndoManager()->LeaveListAction();
2541 
2542  UpdateLayerLocks();
2543 }
2544 
2545 void ScViewFunc::ProtectDoc( const OUString& rPassword )
2546 {
2547  ScDocShell* pDocSh = GetViewData().GetDocShell();
2548  ScDocFunc &rFunc = pDocSh->GetDocFunc();
2549 
2550  rFunc.Protect( TABLEID_DOC, rPassword );
2551 
2552  UpdateLayerLocks();
2553 }
2554 
2555 bool ScViewFunc::Unprotect( SCTAB nTab, const OUString& rPassword )
2556 {
2557  ScMarkData& rMark = GetViewData().GetMarkData();
2558  ScDocShell* pDocSh = GetViewData().GetDocShell();
2559  ScDocument& rDoc = pDocSh->GetDocument();
2560  ScDocFunc &rFunc = pDocSh->GetDocFunc();
2561  bool bChanged = false;
2562  bool bUndo (rDoc.IsUndoEnabled());
2563 
2564  if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 )
2565  {
2566  bChanged = rFunc.Unprotect( nTab, rPassword, false );
2567  if (bChanged && nTab != TABLEID_DOC)
2568  SetTabProtectionSymbol(nTab, false);
2569  }
2570  else
2571  {
2572  // modifying several tabs is handled here
2573 
2574  if (bUndo)
2575  {
2576  OUString aUndo = ScResId( STR_UNDO_UNPROTECT_TAB );
2577  pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, GetViewData().GetViewShell()->GetViewShellId() );
2578  }
2579 
2580  for (const auto& rTab : rMark)
2581  {
2582  if ( rFunc.Unprotect( rTab, rPassword, false ) )
2583  {
2584  bChanged = true;
2585  SetTabProtectionSymbol( rTab, false);
2586  }
2587  }
2588 
2589  if (bUndo)
2590  pDocSh->GetUndoManager()->LeaveListAction();
2591  }
2592 
2593  if (bChanged)
2594  UpdateLayerLocks();
2595 
2596  return bChanged;
2597 }
2598 
2599 void ScViewFunc::SetNoteText( const ScAddress& rPos, const OUString& rNoteText )
2600 {
2601  GetViewData().GetDocShell()->GetDocFunc().SetNoteText( rPos, rNoteText, false );
2602 }
2603 
2604 void ScViewFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, const OUString* pAuthor, const OUString* pDate )
2605 {
2606  GetViewData().GetDocShell()->GetDocFunc().ReplaceNote( rPos, rNoteText, pAuthor, pDate, false );
2607 }
2608 
2610 {
2611  // not editable because of matrix only? attribute OK nonetheless
2612  bool bOnlyNotBecauseOfMatrix;
2613  if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
2614  {
2615  ErrorMessage(STR_PROTECTIONERR);
2616  return;
2617  }
2618 
2619  sal_uInt32 nNumberFormat = 0;
2620  ScViewData& rViewData = GetViewData();
2621  ScDocument& rDoc = rViewData.GetDocument();
2622  SvNumberFormatter* pNumberFormatter = rDoc.GetFormatTable();
2623  LanguageType eLanguage = ScGlobal::eLnge;
2624  ScPatternAttr aNewAttrs( rDoc.GetPool() );
2625 
2626  // always take language from cursor position, even if there is a selection
2627 
2628  sal_uInt32 nCurrentNumberFormat;
2629  rDoc.GetNumberFormat( rViewData.GetCurX(),
2630  rViewData.GetCurY(),
2631  rViewData.GetTabNo(),
2632  nCurrentNumberFormat );
2633  const SvNumberformat* pEntry = pNumberFormatter->GetEntry( nCurrentNumberFormat );
2634  if (pEntry)
2635  eLanguage = pEntry->GetLanguage(); // else keep ScGlobal::eLnge
2636 
2637  nNumberFormat = pNumberFormatter->GetStandardFormat( nFormatType, eLanguage ) + nAdd;
2638 
2639  SfxItemSet& rSet = aNewAttrs.GetItemSet();
2640  rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumberFormat ) );
2641  // ATTR_LANGUAGE_FORMAT not
2642  ApplySelectionPattern( aNewAttrs );
2643 }
2644 
2645 void ScViewFunc::SetNumFmtByStr( const OUString& rCode )
2646 {
2647  // not editable because of matrix only? attribute OK nonetheless
2648  bool bOnlyNotBecauseOfMatrix;
2649  if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
2650  {
2651  ErrorMessage(STR_PROTECTIONERR);
2652  return;
2653  }
2654 
2655  ScViewData& rViewData = GetViewData();
2656  ScDocument& rDoc = rViewData.GetDocument();
2657  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
2658 
2659  // language always from cursor position
2660 
2661  sal_uInt32 nCurrentNumberFormat;
2662  rDoc.GetNumberFormat( rViewData.GetCurX(), rViewData.GetCurY(),
2663  rViewData.GetTabNo(), nCurrentNumberFormat );
2664  const SvNumberformat* pEntry = pFormatter->GetEntry( nCurrentNumberFormat );
2665  LanguageType eLanguage = pEntry ? pEntry->GetLanguage() : ScGlobal::eLnge;
2666 
2667  // determine index for String
2668 
2669  bool bOk = true;
2670  sal_uInt32 nNumberFormat = pFormatter->GetEntryKey( rCode, eLanguage );
2671  if ( nNumberFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
2672  {
2673  // enter new
2674 
2675  OUString aFormat = rCode; // will be changed
2676  sal_Int32 nErrPos = 0;
2677  SvNumFormatType nType = SvNumFormatType::ALL;
2678  bOk = pFormatter->PutEntry( aFormat, nErrPos, nType, nNumberFormat, eLanguage );
2679  }
2680 
2681  if ( bOk ) // valid format?
2682  {
2683  ScPatternAttr aNewAttrs( rDoc.GetPool() );
2684  SfxItemSet& rSet = aNewAttrs.GetItemSet();
2685  rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumberFormat ) );
2686  rSet.Put( SvxLanguageItem( eLanguage, ATTR_LANGUAGE_FORMAT ) );
2687  ApplySelectionPattern( aNewAttrs );
2688  }
2689 
2691 }
2692 
2693 void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
2694 {
2695  // not editable because of matrix only? attribute OK nonetheless
2696  bool bOnlyNotBecauseOfMatrix;
2697  if ( !SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
2698  {
2699  ErrorMessage(STR_PROTECTIONERR);
2700  return;
2701  }
2702 
2703  ScDocument& rDoc = GetViewData().GetDocument();
2704  SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
2705 
2706  SCCOL nCol = GetViewData().GetCurX();
2707  SCROW nRow = GetViewData().GetCurY();
2708  SCTAB nTab = GetViewData().GetTabNo();
2709 
2710  sal_uInt32 nOldFormat;
2711  rDoc.GetNumberFormat( nCol, nRow, nTab, nOldFormat );
2712  const SvNumberformat* pOldEntry = pFormatter->GetEntry( nOldFormat );
2713  if (!pOldEntry)
2714  {
2715  OSL_FAIL("numberformat not found !!!");
2716  return;
2717  }
2718 
2719  // what have we got here?
2720 
2721  sal_uInt32 nNewFormat = nOldFormat;
2722  bool bError = false;
2723 
2724  LanguageType eLanguage = pOldEntry->GetLanguage();
2725  bool bThousand, bNegRed;
2726  sal_uInt16 nPrecision, nLeading;
2727  pOldEntry->GetFormatSpecialInfo( bThousand, bNegRed, nPrecision, nLeading );
2728 
2729  SvNumFormatType nOldType = pOldEntry->GetType();
2730  if ( SvNumFormatType::ALL == ( nOldType & (
2731  SvNumFormatType::NUMBER | SvNumFormatType::CURRENCY | SvNumFormatType::PERCENT | SvNumFormatType::SCIENTIFIC | SvNumFormatType::TIME ) ) )
2732  {
2733  // date, fraction, logical, text can not be changed
2734  bError = true;
2735  }
2736 
2738  bool bWasStandard = ( nOldFormat == pFormatter->GetStandardIndex( eLanguage ) );
2739  OUString sExponentialStandardFormat = "";
2740  if (bWasStandard)
2741  {
2742  // with "Standard" the decimal places depend on cell content
2743  // 0 if empty or text -> no decimal places
2744  double nVal = rDoc.GetValue( ScAddress( nCol, nRow, nTab ) );
2745 
2746  // the ways of the Numberformatters are unfathomable, so try:
2747  OUString aOut;
2748  const Color* pCol;
2749  const_cast<SvNumberformat*>(pOldEntry)->GetOutputString( nVal, aOut, &pCol );
2750 
2751  nPrecision = 0;
2752  // 'E' for exponential is fixed in Numberformatter
2753  sal_Int32 nIndexE = aOut.indexOf('E');
2754  if ( nIndexE >= 0 )
2755  {
2756  sExponentialStandardFormat = aOut.copy( nIndexE ).replace( '-', '+' );
2757  for ( sal_Int32 i=1 ; i<sExponentialStandardFormat.getLength() ; i++ )
2758  {
2759  if ( sExponentialStandardFormat[i] >= '1' && sExponentialStandardFormat[i] <= '9' )
2760  sExponentialStandardFormat = sExponentialStandardFormat.replaceAt( i, 1, "0" );
2761  }
2762  aOut = aOut.copy( 0, nIndexE ); // remove exponential part
2763  }
2764  OUString aDecSep( pFormatter->GetFormatDecimalSep( nOldFormat ) );
2765  sal_Int32 nPos = aOut.indexOf( aDecSep );
2766  if ( nPos >= 0 )
2767  nPrecision = aOut.getLength() - nPos - aDecSep.getLength();
2768  // else keep 0
2769  }
2770  else
2771  {
2772  if ( (nOldType & SvNumFormatType::SCIENTIFIC) && !bThousand &&
2773  (pOldEntry->GetFormatIntegerDigits()%3 == 0) && pOldEntry->GetFormatIntegerDigits() > 0 )
2774  bThousand = true;
2775  }
2776 
2777  if (!bError)
2778  {
2779  if (bIncrement)
2780  {
2781  if (nPrecision<20)
2782  ++nPrecision; // increment
2783  else
2784  bError = true; // 20 is maximum
2785  }
2786  else
2787  {
2788  if (nPrecision)
2789  --nPrecision; // decrement
2790  else
2791  bError = true; // 0 is minimum
2792  }
2793  }
2794 
2795  if (!bError)
2796  {
2797  OUString aNewPicture = pFormatter->GenerateFormat(nOldFormat, eLanguage,
2798  bThousand, bNegRed,
2799  nPrecision, nLeading)
2800  + sExponentialStandardFormat;
2801 
2802  nNewFormat = pFormatter->GetEntryKey( aNewPicture, eLanguage );
2803  if ( nNewFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
2804  {
2805  sal_Int32 nErrPos = 0;
2806  SvNumFormatType nNewType = SvNumFormatType::ALL;
2807  bool bOk = pFormatter->PutEntry( aNewPicture, nErrPos,
2808  nNewType, nNewFormat, eLanguage );
2809  OSL_ENSURE( bOk, "incorrect numberformat generated" );
2810  if (!bOk)
2811  bError = true;
2812  }
2813  }
2814 
2815  if (!bError)
2816  {
2817  ScPatternAttr aNewAttrs( rDoc.GetPool() );
2818  SfxItemSet& rSet = aNewAttrs.GetItemSet();
2819  rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
2820  // ATTR_LANGUAGE_FORMAT not
2821  ApplySelectionPattern( aNewAttrs );
2822  }
2823 }
2824 
2825 void ScViewFunc::ChangeIndent( bool bIncrement )
2826 {
2827  ScViewData& rViewData = GetViewData();
2828  ScDocShell* pDocSh = rViewData.GetDocShell();
2829  ScMarkData& rMark = rViewData.GetMarkData();
2830 
2831  ScMarkData aWorkMark = rMark;
2832  ScViewUtil::UnmarkFiltered( aWorkMark, pDocSh->GetDocument() );
2833  aWorkMark.MarkToMulti();
2834  if (!aWorkMark.IsMultiMarked())
2835  {
2836  SCCOL nCol = rViewData.GetCurX();
2837  SCROW nRow = rViewData.GetCurY();
2838  SCTAB nTab = rViewData.GetTabNo();
2839  aWorkMark.SetMultiMarkArea( ScRange(nCol,nRow,nTab) );
2840  }
2841 
2842  bool bSuccess = pDocSh->GetDocFunc().ChangeIndent( aWorkMark, bIncrement, false );
2843  if (bSuccess)
2844  {
2845  pDocSh->UpdateOle(rViewData);
2846  StartFormatArea();
2847 
2848  // stuff for sidebar panels
2849  SfxBindings& rBindings = GetViewData().GetBindings();
2850  rBindings.Invalidate( SID_H_ALIGNCELL );
2851  rBindings.Invalidate( SID_ATTR_ALIGN_INDENT );
2852  }
2853 }
2854 
2855 bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol,
2856  const OUString& rType )
2857 {
2858  // Type = P,R,C,F (and combinations)
2860 
2861  bool bOk = false;
2862  ScDocShell* pDocSh = GetViewData().GetDocShell();
2863  ScDocument& rDoc = pDocSh->GetDocument();
2864  SCTAB nTab = GetViewData().GetTabNo();
2865  ScRangeName* pList = rDoc.GetRangeName();
2866 
2868  auto pNewEntry = std::make_unique<ScRangeData>(
2869  rDoc, rName, rSymbol, ScAddress( GetViewData().GetCurX(),
2870  GetViewData().GetCurY(), nTab), nType );
2871  OUString aUpType = rType.toAsciiUpperCase();
2872  if ( aUpType.indexOf( 'P' ) != -1 )
2874  if ( aUpType.indexOf( 'R' ) != -1 )
2876  if ( aUpType.indexOf( 'C' ) != -1 )
2878  if ( aUpType.indexOf( 'F' ) != -1 )
2879  nType |= ScRangeData::Type::Criteria;
2880  pNewEntry->AddType(nType);
2881 
2882  if ( pNewEntry->GetErrCode() == FormulaError::NONE ) // text valid?
2883  {
2884  ScDocShellModificator aModificator( *pDocSh );
2885 
2886  rDoc.PreprocessRangeNameUpdate();
2887 
2888  // input available yet? Then remove beforehand (=change)
2889  ScRangeData* pData = pList->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(rName));
2890  if (pData)
2891  { // take old Index
2892  pNewEntry->SetIndex(pData->GetIndex());
2893  pList->erase(*pData);
2894  }
2895 
2896  // don't delete, insert took ownership, even on failure!
2897  if ( pList->insert( pNewEntry.release() ) )
2898  bOk = true;
2899 
2900  rDoc.CompileHybridFormula();
2901 
2902  aModificator.SetDocumentModified();
2903  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreasChanged ) );
2904  }
2905 
2906  return bOk;
2907 }
2908 
2910 {
2911  bool bDone = false;
2912  ScRange aRange;
2913  if ( GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE )
2914  bDone = GetViewData().GetDocShell()->GetDocFunc().CreateNames( aRange, nFlags, false );
2915 
2916  if (!bDone)
2917  ErrorMessage(STR_CREATENAME_MARKERR);
2918 }
2919 
2921 {
2923 
2924  SCCOL nStartCol, nEndCol;
2925  SCROW nStartRow, nEndRow;
2926  SCTAB nDummy;
2927  if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nDummy,nEndCol,nEndRow,nDummy) == SC_MARK_SIMPLE)
2928  {
2929  ScDocument& rDoc = GetViewData().GetDocument();
2930  SCTAB nTab = GetViewData().GetTabNo();
2931  bool bOk;
2932  SCCOL i;
2933  SCROW j;
2934 
2935  bOk = true;
2936  SCCOL nFirstCol = nStartCol;
2937  SCCOL nLastCol = nEndCol;
2938  if (nStartCol+1 < nEndCol) { ++nFirstCol; --nLastCol; }
2939  for (i=nFirstCol; i<=nLastCol && bOk; i++)
2940  if (!rDoc.HasStringData( i,nStartRow,nTab ))
2941  bOk = false;
2942  if (bOk)
2943  nFlags |= CreateNameFlags::Top;
2944  else // Bottom only if not Top
2945  {
2946  bOk = true;
2947  for (i=nFirstCol; i<=nLastCol && bOk; i++)
2948  if (!rDoc.HasStringData( i,nEndRow,nTab ))
2949  bOk = false;
2950  if (bOk)
2951  nFlags |= CreateNameFlags::Bottom;
2952  }
2953 
2954  bOk = true;
2955  SCROW nFirstRow = nStartRow;
2956  SCROW nLastRow = nEndRow;
2957  if (nStartRow+1 < nEndRow) { ++nFirstRow; --nLastRow; }
2958  for (j=nFirstRow; j<=nLastRow && bOk; j++)
2959  if (!rDoc.HasStringData( nStartCol,j,nTab ))
2960  bOk = false;
2961  if (bOk)
2962  nFlags |= CreateNameFlags::Left;
2963  else // Right only if not Left
2964  {
2965  bOk = true;
2966  for (j=nFirstRow; j<=nLastRow && bOk; j++)
2967  if (!rDoc.HasStringData( nEndCol,j,nTab ))
2968  bOk = false;
2969  if (bOk)
2970  nFlags |= CreateNameFlags::Right;
2971  }
2972  }
2973 
2974  if (nStartCol == nEndCol)
2976  if (nStartRow == nEndRow)
2978 
2979  return nFlags;
2980 }
2981 
2983 {
2984  ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
2985  ScDocShell* pDocSh = GetViewData().GetDocShell();
2986  if ( pDocSh->GetDocFunc().InsertNameList( aPos, false ) )
2987  pDocSh->UpdateOle(GetViewData());
2988 }
2989 
2991 {
2992  ScDocShell* pDocShell = GetViewData().GetDocShell();
2993  ScRange aMarkRange;
2994  if (rSel.IsMultiMarked() )
2995  rSel.GetMultiMarkArea( aMarkRange );
2996  else
2997  rSel.GetMarkArea( aMarkRange );
2998 
2999  bool bSetLines = false;
3000  bool bSetAlign = false;
3001  if ( pAttr )
3002  {
3003  const SfxItemSet& rNewSet = pAttr->GetItemSet();
3004  bSetLines = rNewSet.GetItemState( ATTR_BORDER ) == SfxItemState::SET ||
3005  rNewSet.GetItemState( ATTR_SHADOW ) == SfxItemState::SET;
3006  bSetAlign = rNewSet.GetItemState( ATTR_HOR_JUSTIFY ) == SfxItemState::SET;
3007  }
3008 
3009  sal_uInt16 nExtFlags = 0;
3010  if ( bSetLines )
3011  nExtFlags |= SC_PF_LINES;
3012  if ( bSetAlign )
3013  nExtFlags |= SC_PF_WHOLEROWS;
3014 
3015  SCCOL nStartCol = aMarkRange.aStart.Col();
3016  SCROW nStartRow = aMarkRange.aStart.Row();
3017  SCTAB nStartTab = aMarkRange.aStart.Tab();
3018  SCCOL nEndCol = aMarkRange.aEnd.Col();
3019  SCROW nEndRow = aMarkRange.aEnd.Row();
3020  SCTAB nEndTab = aMarkRange.aEnd.Tab();
3021  pDocShell->PostPaint( nStartCol, nStartRow, nStartTab,
3022  nEndCol, nEndRow, nEndTab,
3023  PaintPartFlags::Grid, nExtFlags | SC_PF_TESTMERGE );
3024  ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
3025  pTabViewShell->AdjustBlockHeight(false, const_cast<ScMarkData*>(&rSel));
3026 }
3027 
3028 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3047
#define SC_PF_TESTMERGE
Definition: docsh.hxx:75
void BeginDrawUndo()
Definition: documen9.cxx:60
bool IsBlockEditable(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool *pOnlyNotBecauseOfMatrix=nullptr, bool bNoMatrixAtAll=false) const
Definition: document.cxx:5314
CreateNameFlags GetCreateNameFlags()
Definition: viewfunc.cxx:2920
List of spreadsheet functions.
Definition: funcdesc.hxx:241
SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow)
Definition: document.cxx:4290
void DeleteCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1578
constexpr double nPPTY
void DeleteContents(InsertDeleteFlags nFlags)
Definition: viewfunc.cxx:1936
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6208
SC_DLLPUBLIC void ApplySelectionStyle(const ScStyleSheet &rStyle, const ScMarkData &rMark)
Definition: document.cxx:4851
void ApplyStyle(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScStyleSheet &rStyle)
Definition: document.cxx:4821
void DeleteRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1359
OUString GetColRowString() const
Create a human-readable string representation of the cell address.
Definition: address.cxx:2497
void MarkToSimple()
Definition: markdata.cxx:237
sal_Int32 nIndex
double GetPPTY() const
Definition: sizedev.hxx:42
SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, bool bShow)
Definition: document.cxx:4302
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
ScAddress aStart
Definition: address.hxx:499
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:113
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
constexpr TypedWhichId< SvxLanguageItem > ATTR_LANGUAGE_FORMAT(147)
bool Unprotect(SCTAB nTab, const OUString &rPassword, bool bApi)
Definition: docfunc.cxx:4023
bool IsPrinter() const
Definition: sizedev.hxx:43
#define EMPTY_OUSTRING
Definition: global.hxx:213
bool CreateNames(const ScRange &rRange, CreateNameFlags nFlags, bool bApi, SCTAB nTab=-1)
Definition: docfunc.cxx:5270
SC_DLLPUBLIC void RefreshZoom()
Definition: tabview5.cxx:427
SC_DLLPUBLIC bool DeleteContents(const ScMarkData &rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi)
Definition: docfunc.cxx:570
void CreateNames(CreateNameFlags nFlags)
Definition: viewfunc.cxx:2909
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
ScAddress aFormatSource
Definition: viewfunc.hxx:73
SCROW Row() const
Definition: address.hxx:261
ScCellValue maCell
Definition: undocell.hxx:79
void MarkToMulti()
Definition: markdata.cxx:224
bool UpdateOutlineCol(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bShow)
Adapt Outline.
Definition: documen3.cxx:1408
constexpr sal_uInt16 ATTR_PATTERN_START(100)
void SetModified()
Definition: inputhdl.hxx:244
std::unique_ptr< ContentProperties > pData
void GetResultDimensions(SCSIZE &rCols, SCSIZE &rRows)
const Fraction & GetZoomX() const
Definition: viewdata.hxx:458
void SetTabProtectionSymbol(SCTAB nTab, const bool bProtect)
Definition: tabview3.cxx:526
bool SetStringCell(const ScAddress &rPos, const OUString &rStr, bool bInteraction)
Definition: docfunc.cxx:927
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
void DeleteCells(DelCellCmd eCmd)
Definition: viewfunc.cxx:1652
void ApplyAttr(const SfxPoolItem &rAttrItem, bool bAdjustBlockHeight=true)
Definition: viewfunc.cxx:998
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1685
sheet protection state container
const SfxItemSet & GetAttribs() const
Definition: editutil.hxx:104
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: docsh3.cxx:187
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
Definition: documen9.cxx:195
SCCOL GetCurXForTab(SCTAB nTabIndex) const
Definition: viewdata.cxx:1370
void SetMultiMarkArea(const ScRange &rRange, bool bMark=true, bool bSetupMulti=false)
Definition: markdata.cxx:122
bool IsInputMode() const
Definition: inputhdl.hxx:184
int getPart() const override
See SfxViewShell::getPart().
Definition: tabvwshc.cxx:439
sal_uInt16 GetIndex() const
Definition: rangenam.hxx:116
sal_uInt16 GetLRUFuncListCount() const
Definition: appoptio.hxx:47
ScTokenArray * GetCode()
void InsertNameList()
Definition: viewfunc.cxx:2982
void SetLRUFuncList(const sal_uInt16 *pList, const sal_uInt16 nCount)
Definition: appoptio.cxx:107
sal_uIntPtr sal_uLong
long Long
constexpr TypedWhichId< SvxLanguageItem > ATTR_FONT_LANGUAGE(110)
void SetPasteMode(ScPasteFlags nFlags)
Definition: viewdata.hxx:447
SCROW GetCurY() const
Definition: viewdata.hxx:401
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
ScDocFunc & GetDocFunc() const
Definition: viewdata.cxx:3030
double GetOutputFactor() const
Definition: docsh.hxx:353
ocOpen
sal_Int64 n
ViewShellDocId GetDocId() const override
std::vector< sc::ColRowSpan > GetMarkedRowSpans() const
Definition: markdata.cxx:479
SvNumFormatType GetType(sal_uInt32 nFIndex) const
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
Definition: markdata.cxx:387
const SfxItemSet & GetItemSet() const
ScRange aFormatArea
Definition: viewfunc.hxx:74
const ContentProperties & rData
double GetPPTX() const
Definition: viewdata.hxx:467
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
SC_DLLPUBLIC void GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt32 &rFormat) const
Definition: document.cxx:3633
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
void Unmark()
Definition: tabview3.cxx:1721
ScAddress aEnd
Definition: address.hxx:500
void EnterValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rValue)
Definition: viewfunc.cxx:594
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
OpCode GetOpCode() const
void OnLOKInsertDeleteRow(SCROW nStartRow, tools::Long nOffset)
Definition: viewfunc.cxx:1519
sal_Int16 GetRightMargin() const
void ProtectSheet(SCTAB nTab, const ScTableProtection &rProtect)
Definition: docfunc.cxx:3938
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
Definition: document.cxx:3450
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:103
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:983
void EnterDataAtCursor(const OUString &rString)
Definition: viewfunc.cxx:750
void Invalidate(sal_uInt16 nId)
void Remove(const SfxPoolItem &)
CreateNameFlags
Definition: scui_def.hxx:50
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:361
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5166
bool InsertCells(const ScRange &rRange, const ScMarkData *pTabMark, InsCellCmd eCmd, bool bRecord, bool bApi, bool bPartOfPaste=false)
Definition: docfunc.cxx:1729
static void notifyAllViewsSheetGeomInvalidation(const SfxViewShell *pForViewShell, bool bColumns, bool bRows, bool bSizes, bool bHidden, bool bFiltered, bool bGroups, SCTAB nCurrentTabIndex)
Emits a LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY for all views whose current tab is equal to nCurrentTa...
Definition: tabvwshc.cxx:560
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4153
void ResetAutoSpell()
Definition: tabview.cxx:2259
SfxApplication * SfxGetpApp()
Internal use only (d&d undo): do not delete caption objects of cell notes.
constexpr TypedWhichId< ScIndentItem > ATTR_INDENT(131)
DelCellCmd
Definition: global.hxx:289
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6048
static void lcl_PostRepaintCondFormat(const ScConditionalFormat *pCondFmt, ScDocShell *pDocSh)
Definition: viewfunc.cxx:82
void GetMarkArea(ScRange &rRange) const
Definition: markdata.cxx:112
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2806
RET_NO
bool IsInputMode()
Definition: scmod.cxx:1348
constexpr tools::Long Width() const
static UITestLogger & getInstance()
void UpdateCopySourceOverlay()
Definition: tabview2.cxx:979
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:35
void logEvent(const EventDescription &rDescription)
const ScStyleSheet * GetStyle(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4890
const ScRangeList & GetRange() const
Definition: conditio.hxx:559
const SfxStyleSheet * GetStyleSheetFromMarked()
Definition: viewfunc.cxx:1294
bool InsertName(const OUString &rName, const OUString &rSymbol, const OUString &rType)
Definition: viewfunc.cxx:2855
bool TestFormatArea(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrChanged)
Definition: viewfunc.cxx:140
RET_YES
#define STD_COL_WIDTH
Definition: global.hxx:94
const OUString & GetName() const
bool SelectionEditable(bool *pOnlyNotBecauseOfMatrix=nullptr)
Definition: viewfunc.cxx:260
PropertiesInfo aProperties
void RemoveStyleSheetInUse(const SfxStyleSheetBase *pStyleSheet)
Definition: viewfunc.cxx:1410
const EditTextObject * mpEditText
Definition: cellvalue.hxx:109
void UpdatePaintExt(sal_uInt16 &rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab)
Definition: docsh3.cxx:227
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:871
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:313
SvtScriptType GetRangeScriptType(sc::ColumnBlockPosition &rBlockPos, const ScAddress &rPos, SCROW nLength)
Definition: documen6.cxx:183
bool Unprotect(SCTAB nTab, const OUString &rPassword)
Definition: viewfunc.cxx:2555
SC_DLLPUBLIC void SetColWidth(SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth)
Definition: document.cxx:4075
const ScPatternAttr * GetSelectionPattern(const ScMarkData &rMark)
Definition: document.cxx:5087
SCTAB GetSelectCount() const
Definition: markdata.cxx:195
bool IsMultiMarked() const
Definition: markdata.hxx:82
bool ChangeIndent(const ScMarkData &rMark, bool bIncrement, bool bApi)
Definition: docfunc.cxx:4126
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
OpCode
sal_uInt32 GetStandardIndex(LanguageType eLnge=LANGUAGE_DONTKNOW)
void MarkDataChanged()
Definition: tabview3.cxx:1744
int nCount
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
sal_uInt16 * GetLRUFuncList() const
Definition: appoptio.hxx:48
void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, InsertDeleteFlags nFlags, bool bMarked, ScDocument &rDestDoc, const ScMarkData *pMarks=nullptr, bool bColRowFlags=true)
Definition: document.cxx:2068
sal_uInt16 GetOptimalColWidth(SCCOL nCol, SCTAB nTab, OutputDevice *pDev, double nPPTX, double nPPTY, const Fraction &rZoomX, const Fraction &rZoomY, bool bFormula, const ScMarkData *pMarkData=nullptr, const ScColWidthParam *pParam=nullptr)
Definition: document.cxx:4232
#define STD_EXTRA_WIDTH
Definition: global.hxx:95
void ReplaceNote(const ScAddress &rPos, const OUString &rNoteText, const OUString *pAuthor, const OUString *pDate, bool bApi)
Definition: docfunc.cxx:1335
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1142
bool IsDocShared() const
void UpdateEditView()
Definition: tabview3.cxx:2146
Mode eMode
SCTAB Tab() const
Definition: address.hxx:270
void SetRow(SCROW nRowP)
Definition: address.hxx:274
bool DeleteCells(const ScRange &rRange, const ScMarkData *pTabMark, DelCellCmd eCmd, bool bApi)
Definition: docfunc.cxx:2264
void DeleteUnchanged(const ScPatternAttr *pOldAttrs)
Definition: patattr.cxx:918
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
ScViewFunc(vcl::Window *pParent, ScDocShell &rDocSh, ScTabViewShell *pViewShell)
Definition: viewfunc.cxx:92
void EndListAction()
Definition: docfunc.cxx:5766
bool SetEditCell(const ScAddress &rPos, const EditTextObject &rStr, bool bInteraction)
Definition: docfunc.cxx:964
const Fraction & GetZoomY() const
Definition: viewdata.hxx:459
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4727
bool SetNormalString(bool &o_rbNumFmtSet, const ScAddress &rPos, const OUString &rText, bool bApi)
Definition: docfunc.cxx:789
void SetCol(SCCOL nColP)
Definition: address.hxx:278
SvtScriptType GetSelectionScriptType()
Definition: viewfunc.cxx:803
ScViewData & GetViewData()
Definition: tabview.hxx:333
bool PutEntry(OUString &rString, sal_Int32 &nCheckPos, SvNumFormatType &nType, sal_uInt32 &nKey, LanguageType eLnge=LANGUAGE_DONTKNOW)
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4706
constexpr auto convert(N n, sal_Int64 mul, sal_Int64 div)
bool bFormatValid
Definition: viewfunc.hxx:75
bool Protect(SCTAB nTab, const OUString &rPassword)
Definition: docfunc.cxx:3999
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:70
OutputDevice * GetDevice() const
Definition: sizedev.hxx:40
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
Definition: document.cxx:3620
void PaintArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScUpdateMode eMode=ScUpdateMode::All)
Definition: tabview3.cxx:2304
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:356
void SetNoteText(const ScAddress &rPos, const OUString &rNoteText)
Definition: viewfunc.cxx:2599
constexpr double nPPTX
bool ApplyAttributes(const ScMarkData &rMark, const ScPatternAttr &rPattern, bool bApi)
Definition: docfunc.cxx:1419
SC_DLLPUBLIC bool SetEditText(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
This method manages the lifecycle of the passed edit text object.
Definition: document.cxx:3386
static SC_DLLPUBLIC sal_uInt16 nStdRowHeight
Definition: global.hxx:583
const char * GetMessageId() const
Definition: editable.cxx:152
SC_DLLPUBLIC void SetAppOptions(const ScAppOptions &rOpt)
Definition: scmod.cxx:715
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:97
void SetTab(SCTAB nTabP)
Definition: address.hxx:282
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:679
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:870
const ScStyleSheet * GetSelectionStyle(const ScMarkData &rMark) const
Definition: document.cxx:4898
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:440
SvNumFormatType GetType() const
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4437
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SvtScriptType
void OnLOKSetWidthOrHeight(SCCOLROW nStart, bool bWidth)
Definition: viewfunc.cxx:1575
#define SV_MAX_COUNT_STANDARD_FORMATS
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:598
bool IsMarked() const
Definition: markdata.hxx:81
#define nPixel
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
bool ApplyStyle(const ScMarkData &rMark, const OUString &rStyleName, bool bApi)
Definition: docfunc.cxx:1488
void GetSelectionCover(ScRange &rRange)
Definition: markdata.cxx:695
SC_DLLPUBLIC bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4491
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
Definition: docsh.hxx:478
void invalidateByIndex(index_type nIndex)
Definition: viewdata.cxx:158
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: address.hxx:405
SfxBindings & GetBindings()
Definition: viewdata.cxx:3035
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2616
sal_Int16 SCCOL
Definition: types.hxx:21
InsertDeleteFlags
Definition: global.hxx:157
#define SC_MOD()
Definition: scmod.hxx:249
void UpdateStyleSheetInUse(const SfxStyleSheetBase *pStyleSheet)
Definition: viewfunc.cxx:1436
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:872
void RemoveEditTextCharAttribs(const ScAddress &rPos, const ScPatternAttr &rAttr)
Definition: document.cxx:3612
bool IsStaticDefaultItem(const SfxPoolItem *pItem)
const ScStyleSheet * GetStyleSheet() const
Definition: patattr.hxx:126
SC_DLLPUBLIC const ScAppOptions & GetAppOptions()
Definition: scmod.cxx:728
static const SfxItemPropertyMap & GetCellPropertyMap()
Definition: cellsuno.cxx:5787
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
Definition: documen2.cxx:451
SC_DLLPUBLIC void ApplyPattern(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4755
void SelectOneTable(SCTAB nTab)
Definition: markdata.cxx:189
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1171
void SetNumFmtByStr(const OUString &rCode)
Definition: viewfunc.cxx:2645
bool IsNumberFormat(const OUString &sString, sal_uInt32 &F_Index, double &fOutNumber, SvNumInputOptions eInputOptions=SvNumInputOptions::NONE)
void ChangeIndent(bool bIncrement)
Definition: viewfunc.cxx:2825
void EnterListAction(const char *pNameResId)
Definition: docfunc.cxx:5757
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:87
#define LANGUAGE_DONTKNOW
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
SvNumFormatType
SC_DLLPUBLIC void SetRowHeightRange(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt16 nNewHeight)
Definition: document.cxx:4093
#define LRU_MAX
Definition: funcdesc.hxx:34
void ReplaceNote(const ScAddress &rPos, const OUString &rNoteText, const OUString *pAuthor, const OUString *pDate)
Definition: viewfunc.cxx:2604
void ApplySelectionPattern(const ScPatternAttr &rAttr, bool bCursorOnly=false)
Definition: viewfunc.cxx:1108
bool IsFunction() const
SC_DLLPUBLIC const EditTextObject * GetEditText(const ScAddress &rPos) const
Definition: document.cxx:3603
sal_uInt32 GetEntryKey(std::u16string_view sStr, LanguageType eLnge=LANGUAGE_DONTKNOW)
bool IsEditable() const
Definition: editable.hxx:83
void DeleteObjectsInArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData &rMark, bool bAnchored=false)
Definition: documen9.cxx:252
void InitOwnBlockMode()
Definition: tabview2.cxx:332
#define SV_COUNTRY_LANGUAGE_OFFSET
void erase(const ScRangeData &r)
Definition: rangenam.cxx:850
void SetNumberFormat(SvNumFormatType nFormatType, sal_uLong nAdd=0)
Definition: viewfunc.cxx:2609
static void UnmarkFiltered(ScMarkData &rMark, const ScDocument &rDoc)
Definition: viewutil.cxx:223
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:547
const SCTAB MAXTAB
Definition: address.hxx:70
void setForceAutoSize(bool b)
void StartFormatArea()
Definition: viewfunc.cxx:118
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static void notifyAllViewsHeaderInvalidation(const SfxViewShell *pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex)
Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab is equal to nCurrentTabIndex...
Definition: tabvwshc.cxx:502
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:100
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5555
SfxItemPool * GetPool() const
Size GetTextSize()
Definition: inputhdl.cxx:4299
const ScFuncDesc * GetFunction(sal_uInt32 nIndex) const
Definition: funcdesc.cxx:1015
std::vector< Value > ValuesType
Definition: undocell.hxx:84
void UpdateScrollBars(HeaderType eHeaderType=BOTH_HEADERS)
Definition: tabview4.cxx:390
ScSizeMode
Definition: global.hxx:359
const SCTAB TABLEID_DOC
Definition: address.hxx:84
FormulaError
SCCOL Col() const
Definition: address.hxx:266
static ScFunctionList * GetStarCalcFunctionList()
Definition: global.cxx:609
OUString GetFormatDecimalSep(sal_uInt32 nFormat) const
bool IsReadOnly() const
SC_DLLPUBLIC const ScPatternAttr * GetSelectionPattern()
Definition: viewfunc.cxx:829
SC_DLLPUBLIC bool HasStringData(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3748
size_t LeaveListAction()
static bool lcl_FunctionKnown(sal_uInt16 nOpCode)
Definition: viewfunc.cxx:278
ScDBFunc * GetView() const
Definition: viewdata.cxx:853
#define MAX_COL_WIDTH
Definition: global.hxx:101
bool IsValid(SvxBoxInfoItemValidFlags nValid) const
size_t mnStart
Definition: cellvalues.cxx:23
ScModelObj * getMustPropagateChangesModel(const ScDocShell &rDocShell)
Definition: docsh.hxx:470
void SetCurYForTab(SCCOL nNewCurY, SCTAB nTabIndex)
Definition: viewdata.cxx:1394
bool DeleteCell(const ScAddress &rPos, const ScMarkData &rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi)
Definition: docfunc.cxx:663
void EnterMatrix(const OUString &rString,::formula::FormulaGrammar::Grammar eGram)
Definition: viewfunc.cxx:759
CellType meType
Definition: cellvalue.hxx:105
bool InsertNameList(const ScAddress &rStartPos, bool bApi)
Definition: docfunc.cxx:5359
OUString GenerateFormat(sal_uInt32 nIndex, LanguageType eLnge=LANGUAGE_DONTKNOW, bool bThousand=false, bool IsRed=false, sal_uInt16 nPrecision=0, sal_uInt16 nLeadingCnt=1)
SC_DLLPUBLIC bool SetOptimalHeight(sc::RowHeightContext &rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bApi)
Definition: document.cxx:4258
CRFlags
Definition: global.hxx:134
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:17
static SC_DLLPUBLIC SvtScriptType GetDefaultScriptType()
Definition: global.cxx:849
#define SC_PF_LINES
Definition: docsh.hxx:74
void ApplyPatternLines(const ScPatternAttr &rAttr, const SvxBoxItem &rNewOuter, const SvxBoxInfoItem *pNewInner)
Definition: viewfunc.cxx:1026
void SetIndex(sal_uInt16 nInd)
Definition: rangenam.hxx:115
void StyleSheetChanged(const SfxStyleSheetBase *pStyleSheet, bool bRemoved, OutputDevice *pDev, double nPPTX, double nPPTY, const Fraction &rZoomX, const Fraction &rZoomY)
Definition: document.cxx:4948
void UpdateOle(const ScViewData &rViewData, bool bSnapSize=false)
Definition: docsh6.cxx:152
bool SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell, bool bInteraction)
Below two methods take ownership of the formula cell instance(s).
Definition: docfunc.cxx:1014
double GetPPTY() const
Definition: viewdata.hxx:468
void ResetAutoSpellForContentChange()
Definition: tabview.cxx:2270
void DoAutoAttributes(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrChanged)
Definition: viewfunc.cxx:205
void HideAllCursors()
Definition: tabview3.cxx:218
void SetNoteText(const ScAddress &rPos, const OUString &rNoteText, bool bApi)
Definition: docfunc.cxx:1309
sal_uInt16 GetFormatIntegerDigits(sal_uInt16 nIx=0) const
void ProtectSheet(SCTAB nTab, const ScTableProtection &rProtect)
Definition: viewfunc.cxx:2515
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define MAX_ROW_HEIGHT
Definition: global.hxx:102
void ErrorMessage(const char *pGlobStrId)
Definition: tabview2.cxx:1413
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
SCROW GetCurYForTab(SCTAB nTabIndex) const
Definition: viewdata.cxx:1378
void assign(const ScDocument &rDoc, const ScAddress &rPos)
Take cell value from specified position in specified document.
Definition: cellvalue.cxx:330
void ChangeNumFmtDecimals(bool bIncrement)
Definition: viewfunc.cxx:2693
void MoveCursorRel(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel=false)
Definition: tabview3.cxx:1263
OUString aName
SCTAB GetFirstSelected() const
Definition: markdata.cxx:200
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
void SetCurXForTab(SCCOL nNewCurX, SCTAB nTabIndex)
Definition: viewdata.cxx:1386
SC_DLLPUBLIC bool RemoveFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:5010
InsCellCmd
Definition: global.hxx:298
SC_DLLPUBLIC void ApplySelectionPattern(const ScPatternAttr &rAttr, const ScMarkData &rMark, ScEditDataArray *pDataArray=nullptr, bool *pIsChanged=nullptr)
Definition: document.cxx:5861
SC_DLLPUBLIC bool EnterMatrix(const ScRange &rRange, const ScMarkData *pTabMark, const ScTokenArray *pTokenArray, const OUString &rString, bool bApi, bool bEnglish, const OUString &rFormulaNmsp, const formula::FormulaGrammar::Grammar)
Definition: docfunc.cxx:4308
sal_Int16 GetLeftMargin() const
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
SC_DLLPUBLIC SvtScriptType GetScriptType(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScRefCellValue *pCell=nullptr)
Definition: documen6.cxx:132
SC_DLLPUBLIC ScOutlineTable * GetOutlineTable(SCTAB nTab, bool bCreate=false)
Definition: documen3.cxx:736
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
void SetStyleSheetToMarked(const SfxStyleSheet *pStyleSheet)
Definition: viewfunc.cxx:1314
const o3tl::sorted_vector< const SfxItemPropertyMapEntry *, SfxItemPropertyMapCompare > & getPropertyEntries() const
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:536
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
tools::Long GetNeededSize(SCCOL nCol, SCROW nRow, SCTAB nTab, OutputDevice *pDev, double nPPTX, double nPPTY, const Fraction &rZoomX, const Fraction &rZoomY, bool bWidth, bool bTotalSize=false, bool bInPrintTwips=false)
Definition: document.cxx:4245
void OnLOKInsertDeleteColumn(SCCOL nStartCol, tools::Long nOffset)
Definition: viewfunc.cxx:1463
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
Definition: global.cxx:1009
bool UpdateOutlineRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bShow)
Definition: documen3.cxx:1417
SC_DLLPUBLIC void SetManualHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bManual)
Definition: document.cxx:4106
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:400
constexpr sal_uInt16 ATTR_PATTERN_END(155)
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
sal_uInt16 nFIndex
Unique function index.
Definition: funcdesc.hxx:221
void SetWidthOrHeight(bool bWidth, const std::vector< sc::ColRowSpan > &rRanges, ScSizeMode eMode, sal_uInt16 nSizeTwips, bool bRecord=true, const ScMarkData *pMarkData=nullptr)
Definition: viewfunc.cxx:2026
static OUString GetSpaceDelimitedString(const EditEngine &rEngine)
Retrieves string with paragraphs delimited by spaces.
Definition: editutil.cxx:97
sal_uInt32 GetCount() const
Definition: funcdesc.hxx:247
ScPositionHelper & GetLOKWidthHelper()
Definition: viewdata.hxx:409
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:446
void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType=OUString("cell-change"))
Definition: docsh.hxx:486
void SetMarking(bool bFlag)
Definition: markdata.hxx:102
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4421
void UpdateSelectionArea(const ScMarkData &rSel, ScPatternAttr *pAttr=nullptr)
Definition: viewfunc.cxx:2990
static bool lcl_AddFunction(ScAppOptions &rAppOpt, sal_uInt16 nOpCode)
Definition: viewfunc.cxx:291
void SetDocumentModified()
Definition: docsh.cxx:3159
#define SC_PF_WHOLEROWS
Definition: docsh.hxx:76
void ApplyUserItemSet(const SfxItemSet &rItemSet)
Definition: viewfunc.cxx:1275
bool IsUndoEnabled() const
Definition: document.hxx:1533
void SetMarkedWidthOrHeight(bool bWidth, ScSizeMode eMode, sal_uInt16 nSizeTwips)
Definition: viewfunc.cxx:2350
ScDirection
Definition: global.hxx:351
void GetSelectionFrame(const ScMarkData &rMark, SvxBoxItem &rLineOuter, SvxBoxInfoItem &rLineInner)
Definition: document.cxx:5093
void ApplyAttributes(const SfxItemSet *pDialogSet, const SfxItemSet *pOldSet, bool bAdjustBlockHeight=true)
Definition: viewfunc.cxx:886
void GetMultiMarkArea(ScRange &rRange) const
Definition: markdata.cxx:117
bool NeedsCellAttr() const
Definition: editutil.hxx:103
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
Definition: scmod.cxx:1304
SC_DLLPUBLIC ScConditionalFormat * GetCondFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen4.cxx:835
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:218
bool NeedsObject() const
Definition: editutil.hxx:102
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, bool bApi)
Definition: viewfun2.cxx:191
ScPositionHelper & GetLOKHeightHelper()
Definition: viewdata.hxx:410
SC_DLLPUBLIC void SetRowFlags(SCROW nRow, SCTAB nTab, CRFlags nNewFlags)
Definition: document.cxx:4308
ScEditDataArray * GetDataArray()
Definition: undoblk3.cxx:379
void ProtectDoc(const OUString &rPassword)
Definition: viewfunc.cxx:2545
std::map< OUString, OUString > aParameters
void ApplySelectionFrame(const ScMarkData &rMark, const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner)
Definition: document.cxx:5740
void UpdateLayerLocks()
Definition: tabview5.cxx:347
SC_DLLPUBLIC void ExtendOverlapped(SCCOL &rStartCol, SCROW &rStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:5465
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4112
sal_uInt16 GetOptimalColWidth(SCCOL nCol, SCTAB nTab, bool bFormula)
Definition: viewfunc.cxx:236
std::vector< sc::ColRowSpan > GetMarkedColSpans() const
Definition: markdata.cxx:496
std::unique_ptr< EditTextObject > Clone() const
bool IsRemoveAdjacentCellBorder() const
void SetErrCode(FormulaError n)
const ScInputHandler * GetInputHandler() const
Definition: tabvwsh.hxx:231
void SetHyperLink(bool bVal)
void ModifyCellSize(ScDirection eDir, bool bOptimal)
Definition: viewfunc.cxx:2374
void DeleteMulti(bool bRows)
Definition: viewfunc.cxx:1740
SC_DLLPUBLIC void CellContentChanged()
Definition: tabview3.cxx:512
void SetAutoCorrection(bool bVal)
When auto correction is set, the jump command reorder must be enabled.
Definition: compiler.cxx:4026
double GetPPTX() const
Definition: sizedev.hxx:41
ocClose
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
Definition: rangenam.cxx:807
void GetSelectionFrame(std::shared_ptr< SvxBoxItem > &rLineOuter, std::shared_ptr< SvxBoxInfoItem > &rLineInner)
Definition: viewfunc.cxx:855
sal_uInt16 Which() const
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, bool bShow)
Definition: document.cxx:4296
Create before modifications of the document and destroy thereafter.
Definition: docsh.hxx:451
bool IsSelectionEditable(const ScMarkData &rMark, bool *pOnlyNotBecauseOfMatrix=nullptr) const
Definition: document.cxx:5338
LanguageType GetLanguage() const
void ForgetLastPattern()
Definition: inputhdl.cxx:2242
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
SC_DLLPUBLIC CRFlags GetRowFlags(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4328
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
bool InsertCells(InsCellCmd eCmd, bool bRecord=true, bool bPartOfPaste=false)
Definition: viewfunc.cxx:1599
void EnterData(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const EditTextObject *pData=nullptr)
Definition: viewfunc.cxx:342
void GetFormatSpecialInfo(bool &bThousand, bool &IsRed, sal_uInt16 &nPrecision, sal_uInt16 &nLeadingCnt) const
void ShowAllCursors()
Definition: tabview3.cxx:232
SCCOL GetCurX() const
Definition: viewdata.hxx:400
void SetMarkData(const ScMarkData &rNew)
Definition: tabview3.cxx:1735