LibreOffice Module sc (master)  1
table6.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <unotools/textsearch.hxx>
21 #include <com/sun/star/util/SearchResult.hpp>
22 #include <svl/srchitem.hxx>
23 #include <editeng/editobj.hxx>
24 #include <osl/diagnose.h>
25 #include <sal/log.hxx>
26 
27 #include <table.hxx>
28 #include <formulacell.hxx>
29 #include <document.hxx>
30 #include <stlpool.hxx>
31 #include <stlsheet.hxx>
32 #include <markdata.hxx>
33 #include <editutil.hxx>
34 #include <postit.hxx>
35 
36 namespace {
37 
38 bool lcl_GetTextWithBreaks( const EditTextObject& rData, ScDocument* pDoc, OUString& rVal )
39 {
40  // true = more than 1 paragraph
41 
42  EditEngine& rEngine = pDoc->GetEditEngine();
43  rEngine.SetText(rData);
44  rVal = rEngine.GetText();
45  return ( rEngine.GetParagraphCount() > 1 );
46 }
47 
48 }
49 
50 bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
51  const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc)
52 {
53  if ( !IsColRowValid( nCol, nRow ) )
54  return false;
55 
56  bool bFound = false;
57  bool bDoSearch = true;
58  bool bDoBack = rSearchItem.GetBackward();
59  bool bSearchFormatted = rSearchItem.IsSearchFormatted();
60 
61  OUString aString;
62  ScRefCellValue aCell;
63  if (rSearchItem.GetSelection())
64  bDoSearch = rMark.IsCellMarked(nCol, nRow);
65 
66  if (!bDoSearch)
67  return false;
68 
69  ScPostIt* pNote;
70  if (rSearchItem.GetCellType() == SvxSearchCellType::NOTE)
71  {
72  pNote = aCol[nCol].GetCellNote(rBlockPos, nRow);
73  if (!pNote)
74  return false;
75  }
76  else
77  {
78  aCell = aCol[nCol].GetCellValue(rBlockPos, nRow);
79  if (aCell.isEmpty())
80  return false;
81  pNote = nullptr;
82  }
83 
84  bool bMultiLine = false;
85  CellType eCellType = aCell.meType;
86  switch (rSearchItem.GetCellType())
87  {
88  case SvxSearchCellType::FORMULA:
89  {
90  if ( eCellType == CELLTYPE_FORMULA )
91  aCell.mpFormula->GetFormula(aString, rDocument.GetGrammar());
92  else if ( eCellType == CELLTYPE_EDIT )
93  bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, &rDocument, aString);
94  else
95  {
96  if( !bSearchFormatted )
97  aCol[nCol].GetInputString( rBlockPos, nRow, aString );
98  else
99  aCol[nCol].GetString( rBlockPos, nRow, aString );
100  }
101  break;
102  }
103  case SvxSearchCellType::VALUE:
104  if ( eCellType == CELLTYPE_EDIT )
105  bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, &rDocument, aString);
106  else
107  {
108  if( !bSearchFormatted )
109  aCol[nCol].GetInputString( rBlockPos, nRow, aString );
110  else
111  aCol[nCol].GetString( rBlockPos, nRow, aString );
112  }
113  break;
114  case SvxSearchCellType::NOTE:
115  {
116  if (pNote)
117  {
118  aString = pNote->GetText();
119  bMultiLine = pNote->HasMultiLineText();
120  }
121  break;
122  }
123  default:
124  break;
125  }
126  sal_Int32 nStart = 0;
127  sal_Int32 nEnd = aString.getLength();
128  css::util::SearchResult aSearchResult;
129  if (pSearchText)
130  {
131  if ( bDoBack )
132  {
133  sal_Int32 nTemp=nStart; nStart=nEnd; nEnd=nTemp;
134  bFound = pSearchText->SearchBackward(aString, &nStart, &nEnd, &aSearchResult);
135  // change results to definition before 614:
136  --nEnd;
137  }
138  else
139  {
140  bFound = pSearchText->SearchForward(aString, &nStart, &nEnd, &aSearchResult);
141  // change results to definition before 614:
142  --nEnd;
143  }
144 
145  if (bFound && rSearchItem.GetWordOnly())
146  bFound = (nStart == 0 && nEnd == aString.getLength() - 1);
147  }
148  else
149  {
150  OSL_FAIL("pSearchText == NULL");
151  return bFound;
152  }
153 
154  if (!bFound)
155  return false;
156  if ( rSearchItem.GetCommand() != SvxSearchCmd::REPLACE
157  && rSearchItem.GetCommand() != SvxSearchCmd::REPLACE_ALL )
158  return bFound;
159 
160  if (!IsBlockEditable(nCol, nRow, nCol, nRow))
161  return bFound;
162 
163  ScMatrixMode cMatrixFlag = ScMatrixMode::NONE;
164 
165  // Don't split the matrix, only replace Matrix formulas
166  if (eCellType == CELLTYPE_FORMULA)
167  {
168  cMatrixFlag = aCell.mpFormula->GetMatrixFlag();
169  if(cMatrixFlag == ScMatrixMode::Reference)
170  return bFound;
171  }
172  // No UndoDoc => Matrix not restorable => don't replace
173  if (cMatrixFlag != ScMatrixMode::NONE && !pUndoDoc)
174  return bFound;
175 
176  if ( cMatrixFlag == ScMatrixMode::NONE && rSearchItem.GetCommand() == SvxSearchCmd::REPLACE )
177  rUndoStr = aString;
178  else if (pUndoDoc)
179  {
180  ScAddress aAdr( nCol, nRow, nTab );
181  aCell.commit(*pUndoDoc, aAdr);
182  }
183 
184  bool bRepeat = !rSearchItem.GetWordOnly();
185  do
186  {
187  // don't continue search if the found text is empty,
188  // otherwise it would never stop (#35410#)
189  if ( nEnd < nStart )
190  bRepeat = false;
191 
192  OUString sReplStr = rSearchItem.GetReplaceString();
193  if (rSearchItem.GetRegExp())
194  {
195  pSearchText->ReplaceBackReferences( sReplStr, aString, aSearchResult );
196  OUStringBuffer aStrBuffer(aString);
197  aStrBuffer.remove(nStart, nEnd-nStart+1);
198  aStrBuffer.insert(nStart, sReplStr);
199  aString = aStrBuffer.makeStringAndClear();
200  }
201  else
202  {
203  OUStringBuffer aStrBuffer(aString);
204  aStrBuffer.remove(nStart, nEnd-nStart+1);
205  aStrBuffer.insert(nStart, rSearchItem.GetReplaceString());
206  aString = aStrBuffer.makeStringAndClear();
207  }
208 
209  // Adjust index
210  if (bDoBack)
211  {
212  nEnd = nStart;
213  nStart = 0;
214  }
215  else
216  {
217  nStart = nStart + sReplStr.getLength();
218  nEnd = aString.getLength();
219  }
220 
221  // continue search ?
222  if (bRepeat)
223  {
224  if ( rSearchItem.GetCommand() != SvxSearchCmd::REPLACE_ALL || nStart >= nEnd )
225  bRepeat = false;
226  else if (bDoBack)
227  {
228  sal_Int32 nTemp=nStart; nStart=nEnd; nEnd=nTemp;
229  bRepeat = pSearchText->SearchBackward(aString, &nStart, &nEnd, &aSearchResult);
230  // change results to definition before 614:
231  --nEnd;
232  }
233  else
234  {
235  bRepeat = pSearchText->SearchForward(aString, &nStart, &nEnd, &aSearchResult);
236  // change results to definition before 614:
237  --nEnd;
238  }
239  }
240  }
241  while (bRepeat);
242  if (rSearchItem.GetCellType() == SvxSearchCellType::NOTE)
243  {
244  // NB: rich text format is lost.
245  // This is also true of Cells.
246  if (pNote)
247  pNote->SetText( ScAddress( nCol, nRow, nTab ), aString );
248  }
249  else if ( cMatrixFlag != ScMatrixMode::NONE )
250  { // don't split Matrix
251  if ( aString.getLength() > 2 )
252  { // remove {} here so that "{=" can be replaced by "{=..."
253  if ( aString[ aString.getLength()-1 ] == '}' )
254  aString = aString.copy( 0, aString.getLength()-1 );
255  if ( aString[0] == '{' )
256  aString = aString.copy( 1 );
257  }
258  ScAddress aAdr( nCol, nRow, nTab );
259  ScFormulaCell* pFCell = new ScFormulaCell( rDocument, aAdr,
260  aString, rDocument.GetGrammar(), cMatrixFlag );
261  SCCOL nMatCols;
262  SCROW nMatRows;
263  aCell.mpFormula->GetMatColsRows(nMatCols, nMatRows);
264  pFCell->SetMatColsRows( nMatCols, nMatRows );
265  aCol[nCol].SetFormulaCell(nRow, pFCell);
266  }
267  else if ( bMultiLine && aString.indexOf('\n') != -1 )
268  {
270  rEngine.SetTextCurrentDefaults(aString);
271  SetEditText(nCol, nRow, rEngine.CreateTextObject());
272  }
273  else
274  aCol[nCol].SetString(nRow, nTab, aString, rDocument.GetAddressConvention());
275  // pCell is invalid now (deleted)
276  aCol[nCol].InitBlockPosition( rBlockPos ); // invalidate also the cached position
277 
278  return bFound;
279 }
280 
281 void ScTable::SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bForward)
282 {
283  if (bForward)
284  {
285  // forward search
286 
287  if (rRow <= rLastNonFilteredRow)
288  return;
289 
290  SCROW nLastRow = rRow;
291  if (RowFiltered(rRow, nullptr, &nLastRow))
292  // move to the first non-filtered row.
293  rRow = nLastRow + 1;
294  else
295  // record the last non-filtered row to avoid checking
296  // the filtered state for each and every row.
297  rLastNonFilteredRow = nLastRow;
298  }
299  else
300  {
301  // backward search
302 
303  if (rRow >= rLastNonFilteredRow)
304  return;
305 
306  SCROW nFirstRow = rRow;
307  if (RowFiltered(rRow, &nFirstRow))
308  // move to the first non-filtered row.
309  rRow = nFirstRow - 1;
310  else
311  // record the last non-filtered row to avoid checking
312  // the filtered state for each and every row.
313  rLastNonFilteredRow = nFirstRow;
314  }
315 }
316 
317 bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
318  const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc)
319 {
320  SCCOL nLastCol;
321  SCROW nLastRow;
322  if (rSearchItem.GetCellType() == SvxSearchCellType::NOTE)
323  GetCellArea( nLastCol, nLastRow);
324  else
325  GetLastDataPos(nLastCol, nLastRow);
326  return Search(rSearchItem, rCol, rRow, nLastCol, nLastRow, rMark, rUndoStr, pUndoDoc);
327 }
328 
329 bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
330  SCCOL nLastCol, SCROW nLastRow,
331  const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc)
332 {
333  bool bFound = false;
334  bool bAll = (rSearchItem.GetCommand() == SvxSearchCmd::FIND_ALL)
335  ||(rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL);
336  SCCOL nCol = rCol;
337  SCROW nRow = rRow;
338 
339  bool bSkipFiltered = !rSearchItem.IsSearchFiltered();
340  bool bSearchNotes = (rSearchItem.GetCellType() == SvxSearchCellType::NOTE);
341  // We need to cache sc::ColumnBlockConstPosition per each column.
342  std::vector< sc::ColumnBlockConstPosition > blockPos( nLastCol + 1 );
343  for( SCCOL i = 0; i <= nLastCol; ++i )
344  aCol[ i ].InitBlockPosition( blockPos[ i ] );
345  if (!bAll && rSearchItem.GetBackward())
346  {
347  SCROW nLastNonFilteredRow = rDocument.MaxRow() + 1;
348  if (rSearchItem.GetRowDirection())
349  {
350  nCol--;
351  nCol = std::min(nCol, nLastCol);
352  nRow = std::min(nRow, nLastRow);
353  while (!bFound && (nRow >= 0))
354  {
355  if (bSkipFiltered)
356  SkipFilteredRows(nRow, nLastNonFilteredRow, false);
357 
358  while (!bFound && (nCol >= 0))
359  {
360  bFound = SearchCell(rSearchItem, nCol, blockPos[ nCol ], nRow,
361  rMark, rUndoStr, pUndoDoc);
362  if (!bFound)
363  {
364  bool bIsEmpty;
365  do
366  {
367  nCol--;
368  if (nCol >= 0)
369  {
370  if (bSearchNotes)
371  bIsEmpty = !aCol[nCol].HasCellNotes();
372  else
373  bIsEmpty = aCol[nCol].IsEmptyData();
374  }
375  else
376  bIsEmpty = true;
377  }
378  while ((nCol >= 0) && bIsEmpty);
379  }
380  }
381  if (!bFound)
382  {
383  nCol = nLastCol;
384  nRow--;
385  }
386  }
387  }
388  else
389  {
390  nRow--;
391  nCol = std::min(nCol, nLastCol);
392  nRow = std::min(nRow, nLastRow);
393  while (!bFound && (nCol >= 0))
394  {
395  while (!bFound && (nRow >= 0))
396  {
397  if (bSkipFiltered)
398  SkipFilteredRows(nRow, nLastNonFilteredRow, false);
399 
400  bFound = SearchCell(rSearchItem, nCol, blockPos[ nCol ],
401  nRow, rMark, rUndoStr, pUndoDoc);
402  if (!bFound)
403  {
404  if (bSearchNotes)
405  {
406  /* TODO: can we look for the previous cell note instead? */
407  --nRow;
408  }
409  else
410  {
411  if (!aCol[nCol].GetPrevDataPos(nRow))
412  nRow = -1;
413  }
414  }
415  }
416  if (!bFound)
417  {
418  // Not found in this column. Move to the next column.
419  bool bIsEmpty;
420  nRow = nLastRow;
421  nLastNonFilteredRow = rDocument.MaxRow() + 1;
422  do
423  {
424  nCol--;
425  if (nCol >= 0)
426  {
427  if (bSearchNotes)
428  bIsEmpty = !aCol[nCol].HasCellNotes();
429  else
430  bIsEmpty = aCol[nCol].IsEmptyData();
431  }
432  else
433  bIsEmpty = true;
434  }
435  while ((nCol >= 0) && bIsEmpty);
436  }
437  }
438  }
439  }
440  else
441  {
442  SCROW nLastNonFilteredRow = -1;
443  if (rSearchItem.GetRowDirection())
444  {
445  nCol++;
446  while (!bFound && (nRow <= nLastRow))
447  {
448  if (bSkipFiltered)
449  SkipFilteredRows(nRow, nLastNonFilteredRow, true);
450 
451  while (!bFound && (nCol <= nLastCol))
452  {
453  bFound = SearchCell(rSearchItem, nCol, blockPos[ nCol ],
454  nRow, rMark, rUndoStr, pUndoDoc);
455  if (!bFound)
456  {
457  nCol++;
458  while ((nCol <= nLastCol) &&
459  (bSearchNotes ? !aCol[nCol].HasCellNotes() : aCol[nCol].IsEmptyData()))
460  nCol++;
461  }
462  }
463  if (!bFound)
464  {
465  nCol = 0;
466  nRow++;
467  }
468  }
469  }
470  else
471  {
472  nRow++;
473  while (!bFound && (nCol <= nLastCol))
474  {
475  while (!bFound && (nRow <= nLastRow))
476  {
477  if (bSkipFiltered)
478  SkipFilteredRows(nRow, nLastNonFilteredRow, true);
479 
480  bFound = SearchCell(rSearchItem, nCol, blockPos[ nCol ],
481  nRow, rMark, rUndoStr, pUndoDoc);
482  if (!bFound)
483  {
484  if (bSearchNotes)
485  {
486  /* TODO: can we look for the next cell note instead? */
487  ++nRow;
488  }
489  else
490  {
491  if (!aCol[nCol].GetNextDataPos(nRow))
492  nRow = rDocument.MaxRow() + 1;
493  }
494  }
495  }
496  if (!bFound)
497  {
498  // Not found in this column. Move to the next column.
499  nRow = 0;
500  nLastNonFilteredRow = -1;
501  nCol++;
502  while ((nCol <= nLastCol) &&
503  (bSearchNotes ? !aCol[nCol].HasCellNotes() : aCol[nCol].IsEmptyData()))
504  nCol++;
505  }
506  }
507  }
508  }
509  if (bFound)
510  {
511  rCol = nCol;
512  rRow = nRow;
513  }
514  return bFound;
515 }
516 
517 bool ScTable::SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMark,
518  ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc)
519 {
520  bool bFound = true;
521  SCCOL nCol = 0;
522  SCROW nRow = -1;
523  bool bEverFound = false;
524 
525  SCCOL nLastCol;
526  SCROW nLastRow;
527  if (rSearchItem.GetCellType() == SvxSearchCellType::NOTE)
528  GetCellArea( nLastCol, nLastRow);
529  else
530  GetLastDataPos(nLastCol, nLastRow);
531 
532  do
533  {
534  bFound = Search(rSearchItem, nCol, nRow, nLastCol, nLastRow, rMark, rUndoStr, pUndoDoc);
535  if (bFound)
536  {
537  bEverFound = true;
538  rMatchedRanges.Join(ScRange(nCol, nRow, nTab));
539  }
540  }
541  while (bFound);
542 
543  return bEverFound;
544 }
545 
546 void ScTable::UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow )
547 {
548  if (rSearchItem.GetBackward())
549  {
550  if (rSearchItem.GetRowDirection())
551  rCol += 1;
552  else
553  rRow += 1;
554  }
555  else
556  {
557  if (rSearchItem.GetRowDirection())
558  rCol -= 1;
559  else
560  rRow -= 1;
561  }
562 }
563 
564 bool ScTable::Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
565  const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc)
566 {
567  SCCOL nCol = rCol;
568  SCROW nRow = rRow;
569 
570  UpdateSearchItemAddressForReplace( rSearchItem, nCol, nRow );
571  bool bFound = Search(rSearchItem, nCol, nRow, rMark, rUndoStr, pUndoDoc);
572  if (bFound)
573  {
574  rCol = nCol;
575  rRow = nRow;
576  }
577  return bFound;
578 }
579 
581  const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
582  OUString& rUndoStr, ScDocument* pUndoDoc)
583 {
584  SCCOL nCol = 0;
585  SCROW nRow = -1;
586 
587  SCCOL nLastCol;
588  SCROW nLastRow;
589  if (rSearchItem.GetCellType() == SvxSearchCellType::NOTE)
590  GetCellArea( nLastCol, nLastRow);
591  else
592  GetLastDataPos(nLastCol, nLastRow);
593 
594  // tdf#92160 - columnar replace is faster, and more memory efficient.
595  SvxSearchItem aCopyItem(rSearchItem);
596  aCopyItem.SetRowDirection(false);
597 
598  bool bEverFound = false;
599  while (true)
600  {
601  bool bFound = Search(aCopyItem, nCol, nRow, nLastCol, nLastRow, rMark, rUndoStr, pUndoDoc);
602 
603  if (bFound)
604  {
605  bEverFound = true;
606  rMatchedRanges.Join(ScRange(nCol, nRow, nTab));
607  }
608  else
609  break;
610  }
611  return bEverFound;
612 }
613 
614 bool ScTable::SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
615  const ScMarkData& rMark)
616 {
617  const ScStyleSheet* pSearchStyle = static_cast<const ScStyleSheet*>(
619  rSearchItem.GetSearchString(), SfxStyleFamily::Para ));
620 
621  SCCOL nCol = rCol;
622  SCROW nRow = rRow;
623  bool bFound = false;
624 
625  bool bSelect = rSearchItem.GetSelection();
626  bool bRows = rSearchItem.GetRowDirection();
627  bool bBack = rSearchItem.GetBackward();
628  short nAdd = bBack ? -1 : 1;
629 
630  if (bRows) // by row
631  {
632  if ( !IsColValid( nCol ) )
633  {
634  SAL_WARN( "sc.core", "SearchStyle: bad column " << nCol);
635  return false;
636  }
637  nRow += nAdd;
638  do
639  {
640  SCROW nNextRow = aCol[nCol].SearchStyle( nRow, pSearchStyle, bBack, bSelect, rMark );
641  if (!ValidRow(nNextRow))
642  {
643  nRow = bBack ? rDocument.MaxRow() : 0;
644  nCol = sal::static_int_cast<SCCOL>( nCol + nAdd );
645  }
646  else
647  {
648  nRow = nNextRow;
649  bFound = true;
650  }
651  }
652  while ( !bFound && IsColValid( nCol ) );
653  }
654  else // by column
655  {
656  SCCOL aColSize = aCol.size();
657  std::vector< SCROW > nNextRows ( aColSize );
658  SCCOL i;
659  for (i=0; i < aColSize; ++i)
660  {
661  SCROW nSRow = nRow;
662  if (bBack)
663  {
664  if (i>=nCol) --nSRow;
665  }
666  else
667  {
668  if (i<=nCol) ++nSRow;
669  }
670  nNextRows[i] = aCol[i].SearchStyle( nSRow, pSearchStyle, bBack, bSelect, rMark );
671  }
672  if (bBack) // backwards
673  {
674  nRow = -1;
675  for (i = aColSize - 1; i>=0; --i)
676  if (nNextRows[i]>nRow)
677  {
678  nCol = i;
679  nRow = nNextRows[i];
680  bFound = true;
681  }
682  }
683  else // forwards
684  {
685  nRow = rDocument.MaxRow()+1;
686  for (i=0; i < aColSize; ++i)
687  if (nNextRows[i]<nRow)
688  {
689  nCol = i;
690  nRow = nNextRows[i];
691  bFound = true;
692  }
693  }
694  }
695 
696  if (bFound)
697  {
698  rCol = nCol;
699  rRow = nRow;
700  }
701  return bFound;
702 }
703 
704 //TODO: return single Pattern for Undo
705 
706 bool ScTable::ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
707  const ScMarkData& rMark, bool bIsUndo)
708 {
709  bool bRet;
710  if (bIsUndo)
711  bRet = true;
712  else
713  bRet = SearchStyle(rSearchItem, rCol, rRow, rMark);
714  if (bRet)
715  {
716  const ScStyleSheet* pReplaceStyle = static_cast<const ScStyleSheet*>(
718  rSearchItem.GetReplaceString(), SfxStyleFamily::Para ));
719 
720  if (pReplaceStyle)
721  ApplyStyle( rCol, rRow, pReplaceStyle );
722  else
723  {
724  OSL_FAIL("pReplaceStyle==0");
725  }
726  }
727 
728  return bRet;
729 }
730 
732  const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges)
733 {
734  const ScStyleSheet* pSearchStyle = static_cast<const ScStyleSheet*>(
736  rSearchItem.GetSearchString(), SfxStyleFamily::Para ));
737  bool bSelect = rSearchItem.GetSelection();
738  bool bBack = rSearchItem.GetBackward();
739  bool bEverFound = false;
740 
741  for (SCCOL i=0; i < aCol.size(); ++i)
742  {
743  bool bFound = true;
744  SCROW nRow = 0;
745  SCROW nEndRow;
746  while (bFound && nRow <= rDocument.MaxRow())
747  {
748  bFound = aCol[i].SearchStyleRange( nRow, nEndRow, pSearchStyle, bBack, bSelect, rMark );
749  if (bFound)
750  {
751  if (nEndRow<nRow)
752  {
753  SCROW nTemp = nRow;
754  nRow = nEndRow;
755  nEndRow = nTemp;
756  }
757  rMatchedRanges.Join(ScRange(i, nRow, nTab, i, nEndRow, nTab));
758  nRow = nEndRow + 1;
759  bEverFound = true;
760  }
761  }
762  }
763 
764  return bEverFound;
765 }
766 
768  const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
769  ScDocument* pUndoDoc)
770 {
771  bool bRet = SearchAllStyle(rSearchItem, rMark, rMatchedRanges);
772  if (bRet)
773  {
774  const ScStyleSheet* pReplaceStyle = static_cast<const ScStyleSheet*>(
776  rSearchItem.GetReplaceString(), SfxStyleFamily::Para ));
777 
778  if (pReplaceStyle)
779  {
780  if (pUndoDoc)
782  InsertDeleteFlags::ATTRIB, true, *pUndoDoc, &rMark);
783  ApplySelectionStyle( *pReplaceStyle, rMark );
784  }
785  else
786  {
787  OSL_FAIL("pReplaceStyle==0");
788  }
789  }
790 
791  return bRet;
792 }
793 
795  const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
796  ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc)
797 {
798  SvxSearchCmd nCommand = rSearchItem.GetCommand();
799  bool bFound = false;
800  if ( ValidColRow(rCol, rRow) ||
801  ((nCommand == SvxSearchCmd::FIND || nCommand == SvxSearchCmd::REPLACE) &&
802  (((rCol == MAXCOLCOUNT || rCol == -1) && ValidRow(rRow)) ||
803  ((rRow == GetDoc().GetSheetLimits().GetMaxRowCount() || rRow == -1) && ValidCol(rCol))
804  )
805  )
806  )
807  {
808  bool bStyles = rSearchItem.GetPattern();
809  if (bStyles)
810  {
811  if (nCommand == SvxSearchCmd::FIND)
812  bFound = SearchStyle(rSearchItem, rCol, rRow, rMark);
813  else if (nCommand == SvxSearchCmd::REPLACE)
814  bFound = ReplaceStyle(rSearchItem, rCol, rRow, rMark, false);
815  else if (nCommand == SvxSearchCmd::FIND_ALL)
816  bFound = SearchAllStyle(rSearchItem, rMark, rMatchedRanges);
817  else if (nCommand == SvxSearchCmd::REPLACE_ALL)
818  bFound = ReplaceAllStyle(rSearchItem, rMark, rMatchedRanges, pUndoDoc);
819  }
820  else
821  {
822  // SearchParam no longer needed - SearchOptions contains all settings
823  i18nutil::SearchOptions2 aSearchOptions = rSearchItem.GetSearchOptions();
824  aSearchOptions.Locale = *ScGlobal::GetLocale();
825 
826  if (aSearchOptions.searchString.isEmpty() || ( rSearchItem.GetRegExp() && aSearchOptions.searchString == "^$" ) )
827  {
828  // Search for empty cells.
829  return SearchAndReplaceEmptyCells(rSearchItem, rCol, rRow, rMark, rMatchedRanges, rUndoStr, pUndoDoc);
830  }
831 
832  // reflect UseAsianOptions flag in SearchOptions
833  // (use only ignore case and width if asian options are disabled).
834  // This is also done in SvxSearchDialog CommandHdl, but not in API object.
835  if ( !rSearchItem.IsUseAsianOptions() )
836  aSearchOptions.transliterateFlags &=
837  TransliterationFlags::IGNORE_CASE |
838  TransliterationFlags::IGNORE_WIDTH;
839 
840  pSearchText.reset( new utl::TextSearch( aSearchOptions ) );
841 
842  if (nCommand == SvxSearchCmd::FIND)
843  bFound = Search(rSearchItem, rCol, rRow, rMark, rUndoStr, pUndoDoc);
844  else if (nCommand == SvxSearchCmd::FIND_ALL)
845  bFound = SearchAll(rSearchItem, rMark, rMatchedRanges, rUndoStr, pUndoDoc);
846  else if (nCommand == SvxSearchCmd::REPLACE)
847  bFound = Replace(rSearchItem, rCol, rRow, rMark, rUndoStr, pUndoDoc);
848  else if (nCommand == SvxSearchCmd::REPLACE_ALL)
849  bFound = ReplaceAll(rSearchItem, rMark, rMatchedRanges, rUndoStr, pUndoDoc);
850 
851  pSearchText.reset();
852  }
853  }
854  return bFound;
855 }
856 
858  const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
859  ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc)
860 {
861  SCCOL nColStart, nColEnd;
862  SCROW nRowStart, nRowEnd;
863  GetFirstDataPos(nColStart, nRowStart);
864  GetLastDataPos(nColEnd, nRowEnd);
865 
866  ScRangeList aRanges(ScRange(nColStart, nRowStart, nTab, nColEnd, nRowEnd, nTab));
867 
868  if (rSearchItem.GetSelection())
869  {
870  // current selection only.
871  if (!rMark.IsMarked() && !rMark.IsMultiMarked())
872  // There is no selection. Bail out.
873  return false;
874 
875  ScRangeList aMarkedRanges, aNewRanges;
876  rMark.FillRangeListWithMarks(&aMarkedRanges, true);
877  for ( size_t i = 0, n = aMarkedRanges.size(); i < n; ++i )
878  {
879  ScRange & rRange = aMarkedRanges[ i ];
880  if (rRange.aStart.Col() > nColEnd || rRange.aStart.Row() > nRowEnd || rRange.aEnd.Col() < nColStart || rRange.aEnd.Row() < nRowStart)
881  // This range is outside the data area. Skip it.
882  continue;
883 
884  // Shrink the range into data area only.
885  if (rRange.aStart.Col() < nColStart)
886  rRange.aStart.SetCol(nColStart);
887  if (rRange.aStart.Row() < nRowStart)
888  rRange.aStart.SetRow(nRowStart);
889 
890  if (rRange.aEnd.Col() > nColEnd)
891  rRange.aEnd.SetCol(nColEnd);
892  if (rRange.aEnd.Row() > nRowEnd)
893  rRange.aEnd.SetRow(nRowEnd);
894 
895  aNewRanges.push_back(rRange);
896  }
897  aRanges = aNewRanges;
898  }
899 
900  SvxSearchCmd nCommand = rSearchItem.GetCommand();
901  if (nCommand == SvxSearchCmd::FIND || nCommand == SvxSearchCmd::REPLACE)
902  {
903  if (rSearchItem.GetBackward())
904  {
905  for ( size_t i = aRanges.size(); i > 0; --i )
906  {
907  const ScRange & rRange = aRanges[ i - 1 ];
908  if (SearchRangeForEmptyCell(rRange, rSearchItem, rCol, rRow, rUndoStr))
909  return true;
910  }
911  }
912  else
913  {
914  for ( size_t i = 0, nListSize = aRanges.size(); i < nListSize; ++i )
915  {
916  const ScRange & rRange = aRanges[ i ];
917  if (SearchRangeForEmptyCell(rRange, rSearchItem, rCol, rRow, rUndoStr))
918  return true;
919  }
920  }
921  }
922  else if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL)
923  {
924  bool bFound = false;
925  for ( size_t i = 0, nListSize = aRanges.size(); i < nListSize; ++i )
926  {
927  ScRange const & rRange = aRanges[ i ];
928  bFound |= SearchRangeForAllEmptyCells(rRange, rSearchItem, rMatchedRanges, rUndoStr, pUndoDoc);
929  }
930  return bFound;
931  }
932  return false;
933 }
934 
935 namespace {
936 
937 bool lcl_maybeReplaceCellString(
938  ScColumn& rColObj, SCCOL& rCol, SCROW& rRow, OUString& rUndoStr, SCCOL nCol, SCROW nRow, const SvxSearchItem& rSearchItem)
939 {
940  ScRefCellValue aCell = rColObj.GetCellValue(nRow);
941  if (aCell.isEmpty())
942  {
943  // empty cell found.
944  rCol = nCol;
945  rRow = nRow;
946  if (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE &&
947  !rSearchItem.GetReplaceString().isEmpty())
948  {
949  rColObj.SetRawString(nRow, rSearchItem.GetReplaceString());
950  rUndoStr.clear();
951  }
952  return true;
953  }
954  return false;
955 }
956 
957 }
958 
960  const ScRange& rRange, const SvxSearchItem& rSearchItem,
961  SCCOL& rCol, SCROW& rRow, OUString& rUndoStr)
962 {
963  SvxSearchCmd nCmd = rSearchItem.GetCommand();
964  bool bSkipFiltered = rSearchItem.IsSearchFiltered();
965  if (rSearchItem.GetBackward())
966  {
967  // backward search
968  if (rSearchItem.GetRowDirection())
969  {
970  // row direction.
971  SCROW nLastNonFilteredRow = rDocument.MaxRow() + 1;
972  SCROW nBeginRow = std::min(rRange.aEnd.Row(), rRow);
973  for (SCROW nRow = nBeginRow; nRow >= rRange.aStart.Row(); --nRow)
974  {
975  if (bSkipFiltered)
976  SkipFilteredRows(nRow, nLastNonFilteredRow, false);
977  if (nRow < rRange.aStart.Row())
978  break;
979 
980  SCCOL nBeginCol = rRange.aEnd.Col();
981  if (nRow == rRow && nBeginCol >= rCol)
982  // always start from one cell before the cursor.
983  nBeginCol = rCol - (nCmd == SvxSearchCmd::FIND ? 1 : 0);
984 
985  for (SCCOL nCol = nBeginCol; nCol >= rRange.aStart.Col(); --nCol)
986  {
987  if (lcl_maybeReplaceCellString(aCol[nCol], rCol, rRow, rUndoStr, nCol, nRow, rSearchItem))
988  return true;
989  }
990  }
991  }
992  else
993  {
994  // column direction.
995  SCCOL nBeginCol = std::min(rRange.aEnd.Col(), rCol);
996  for (SCCOL nCol = nBeginCol; nCol >= rRange.aStart.Col(); --nCol)
997  {
998  SCROW nLastNonFilteredRow = rDocument.MaxRow() + 1;
999  SCROW nBeginRow = rRange.aEnd.Row();
1000  if (nCol == rCol && nBeginRow >= rRow)
1001  // always start from one cell before the cursor.
1002  nBeginRow = rRow - (nCmd == SvxSearchCmd::FIND ? 1 : 0);
1003  for (SCROW nRow = nBeginRow; nRow >= rRange.aStart.Row(); --nRow)
1004  {
1005  if (bSkipFiltered)
1006  SkipFilteredRows(nRow, nLastNonFilteredRow, false);
1007  if (nRow < rRange.aStart.Row())
1008  break;
1009 
1010  if (lcl_maybeReplaceCellString(aCol[nCol], rCol, rRow, rUndoStr, nCol, nRow, rSearchItem))
1011  return true;
1012  }
1013  }
1014  }
1015  }
1016  else
1017  {
1018  // forward search
1019  if (rSearchItem.GetRowDirection())
1020  {
1021  // row direction.
1022  SCROW nLastNonFilteredRow = -1;
1023  SCROW nBeginRow = rRange.aStart.Row() < rRow ? rRow : rRange.aStart.Row();
1024  for (SCROW nRow = nBeginRow; nRow <= rRange.aEnd.Row(); ++nRow)
1025  {
1026  if (bSkipFiltered)
1027  SkipFilteredRows(nRow, nLastNonFilteredRow, true);
1028  if (nRow > rRange.aEnd.Row())
1029  break;
1030 
1031  SCCOL nBeginCol = rRange.aStart.Col();
1032  if (nRow == rRow && nBeginCol <= rCol)
1033  // always start from one cell past the cursor.
1034  nBeginCol = rCol + (nCmd == SvxSearchCmd::FIND ? 1 : 0);
1035  for (SCCOL nCol = nBeginCol; nCol <= rRange.aEnd.Col(); ++nCol)
1036  {
1037  if (lcl_maybeReplaceCellString(aCol[nCol], rCol, rRow, rUndoStr, nCol, nRow, rSearchItem))
1038  return true;
1039  }
1040  }
1041  }
1042  else
1043  {
1044  // column direction.
1045  SCCOL nBeginCol = rRange.aStart.Col() < rCol ? rCol : rRange.aStart.Col();
1046  for (SCCOL nCol = nBeginCol; nCol <= rRange.aEnd.Col(); ++nCol)
1047  {
1048  SCROW nLastNonFilteredRow = -1;
1049  SCROW nBeginRow = rRange.aStart.Row();
1050  if (nCol == rCol && nBeginRow <= rRow)
1051  // always start from one cell past the cursor.
1052  nBeginRow = rRow + (nCmd == SvxSearchCmd::FIND ? 1 : 0);
1053  for (SCROW nRow = nBeginRow; nRow <= rRange.aEnd.Row(); ++nRow)
1054  {
1055  if (bSkipFiltered)
1056  SkipFilteredRows(nRow, nLastNonFilteredRow, true);
1057  if (nRow > rRange.aEnd.Row())
1058  break;
1059 
1060  if (lcl_maybeReplaceCellString(aCol[nCol], rCol, rRow, rUndoStr, nCol, nRow, rSearchItem))
1061  return true;
1062  }
1063  }
1064  }
1065  }
1066  return false;
1067 }
1068 
1070  const ScRange& rRange, const SvxSearchItem& rSearchItem,
1071  ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc)
1072 {
1073  bool bFound = false;
1074  bool bReplace = (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL) &&
1075  !rSearchItem.GetReplaceString().isEmpty();
1076  bool bSkipFiltered = rSearchItem.IsSearchFiltered();
1077 
1078  for (SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol)
1079  {
1080  SCROW nLastNonFilteredRow = -1;
1081  if (aCol[nCol].IsEmptyData())
1082  {
1083  // The entire column is empty.
1084  for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow)
1085  {
1086  SCROW nLastRow;
1087  if (!RowFiltered(nRow, nullptr, &nLastRow))
1088  {
1089  rMatchedRanges.Join(ScRange(nCol, nRow, nTab, nCol, nLastRow, nTab));
1090  if (bReplace)
1091  {
1092  const OUString& rNewStr = rSearchItem.GetReplaceString();
1093  for (SCROW i = nRow; i <= nLastRow; ++i)
1094  {
1095  aCol[nCol].SetRawString(i, rNewStr);
1096  if (pUndoDoc)
1097  {
1098  // TODO: I'm using a string cell with empty content to
1099  // trigger deletion of cell instance on undo. Maybe I
1100  // should create a new cell type for this?
1101  pUndoDoc->SetString(ScAddress(nCol, i, nTab), EMPTY_OUSTRING);
1102  }
1103  }
1104  rUndoStr.clear();
1105  }
1106  }
1107 
1108  nRow = nLastRow; // move to the last filtered row.
1109  }
1110  bFound = true;
1111  continue;
1112  }
1113 
1114  for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow)
1115  {
1116  if (bSkipFiltered)
1117  SkipFilteredRows(nRow, nLastNonFilteredRow, true);
1118  if (nRow > rRange.aEnd.Row())
1119  break;
1120 
1121  ScRefCellValue aCell = aCol[nCol].GetCellValue(nRow);
1122  if (aCell.isEmpty())
1123  {
1124  // empty cell found
1125  rMatchedRanges.Join(ScRange(nCol, nRow, nTab));
1126  bFound = true;
1127 
1128  if (bReplace)
1129  {
1130  aCol[nCol].SetRawString(nRow, rSearchItem.GetReplaceString());
1131  if (pUndoDoc)
1132  {
1133  // TODO: I'm using a string cell with empty content to
1134  // trigger deletion of cell instance on undo. Maybe I
1135  // should create a new cell type for this?
1136  pUndoDoc->SetString(ScAddress(nCol, nRow, nTab), EMPTY_OUSTRING);
1137  }
1138  }
1139  }
1140  }
1141  }
1142  return bFound;
1143 }
1144 
1145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCTAB nTab
Definition: table.hxx:201
OUString GetText(LineEnd eEnd=LINEEND_LF) const
ScAddress aStart
Definition: address.hxx:500
bool SearchCell(const SvxSearchItem &rSearchItem, SCCOL nCol, sc::ColumnBlockConstPosition &rBlockPos, SCROW nRow, const ScMarkData &rMark, OUString &rUndoStr, ScDocument *pUndoDoc)
Definition: table6.cxx:50
bool ReplaceStyle(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, const ScMarkData &rMark, bool bIsUndo)
Definition: table6.cxx:706
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
void SetText(const ScAddress &rPos, const OUString &rText)
Changes the caption text of this note.
Definition: postit.cxx:943
#define EMPTY_OUSTRING
Definition: global.hxx:215
bool ReplaceAll(const SvxSearchItem &rSearchItem, const ScMarkData &rMark, ScRangeList &rMatchedRanges, OUString &rUndoStr, ScDocument *pUndoDoc)
Definition: table6.cxx:580
SCROW Row() const
Definition: address.hxx:262
bool isEmpty() const
Definition: cellvalue.cxx:670
void GetFormula(OUString &rFormula, const formula::FormulaGrammar::Grammar=formula::FormulaGrammar::GRAM_DEFAULT, const ScInterpreterContext *pContext=nullptr) const
SCCOL size() const
sal_Int64 n
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
Definition: markdata.cxx:387
void GetFirstDataPos(SCCOL &rCol, SCROW &rRow) const
Definition: table2.cxx:1796
ScAddress aEnd
Definition: address.hxx:501
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:104
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:985
const SCCOL MAXCOLCOUNT
Definition: address.hxx:64
void SkipFilteredRows(SCROW &rRow, SCROW &rLastNonFilteredRow, bool bForward)
Definition: table6.cxx:281
bool GetRegExp() const
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:489
void ApplySelectionStyle(const ScStyleSheet &rStyle, const ScMarkData &rMark)
Definition: table2.cxx:2763
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
Definition: markdata.cxx:285
const i18nutil::SearchOptions2 & GetSearchOptions() const
Internal use only (d&d undo): do not delete caption objects of cell notes.
bool SearchAllStyle(const SvxSearchItem &rSearchItem, const ScMarkData &rMark, ScRangeList &rMatchedRanges)
Definition: table6.cxx:731
bool ValidRow(SCROW nRow) const
Definition: table.hxx:327
static css::lang::Locale * GetLocale()
Definition: global.cxx:1049
const EditTextObject * mpEditText
Definition: cellvalue.hxx:110
bool IsBlockEditable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool *pOnlyNotBecauseOfMatrix=nullptr, bool bNoMatrixAtAll=false) const
Definition: table2.cxx:2413
void SetText(const OUString &rStr)
ScRefCellValue GetCellValue(SCROW nRow) const
Definition: column.cxx:732
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:873
Additional class containing cell annotation data.
Definition: postit.hxx:160
bool IsMultiMarked() const
Definition: markdata.hxx:83
SvxSearchCellType GetCellType() const
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:2076
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1144
ScFormulaCell * mpFormula
Definition: cellvalue.hxx:111
void SetRow(SCROW nRowP)
Definition: address.hxx:275
void commit(ScDocument &rDoc, const ScAddress &rPos) const
Set cell value at specified position in specified document.
Definition: cellvalue.cxx:592
bool Search(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, const ScMarkData &rMark, OUString &rUndoStr, ScDocument *pUndoDoc)
Definition: table6.cxx:317
void SetCol(SCCOL nColP)
Definition: address.hxx:279
bool GetPattern() const
bool GetWordOnly() const
bool SearchAll(const SvxSearchItem &rSearchItem, const ScMarkData &rMark, ScRangeList &rMatchedRanges, OUString &rUndoStr, ScDocument *pUndoDoc)
Definition: table6.cxx:517
css::lang::Locale Locale
std::unique_ptr< utl::TextSearch > pSearchText
Definition: table.hxx:203
bool IsColValid(const SCCOL nScCol) const
Definition: table.hxx:314
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3363
void ApplyStyle(SCCOL nCol, SCROW nRow, const ScStyleSheet *rStyle)
Definition: table2.cxx:2725
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:872
bool ValidCol(SCCOL nCol) const
Definition: table.hxx:326
ScDocument & GetDoc()
Definition: table.hxx:275
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:559
bool IsMarked() const
Definition: markdata.hxx:82
int i
void SetRawString(SCROW nRow, const OUString &rStr)
Definition: column3.cxx:2827
SvxSearchCmd GetCommand() const
bool IsSearchFormatted() const
sal_Int16 SCCOL
Definition: types.hxx:22
static void UpdateSearchItemAddressForReplace(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow)
Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
Definition: table6.cxx:546
TransliterationFlags transliterateFlags
const OUString & GetReplaceString() const
std::unique_ptr< EditTextObject > CreateTextObject()
size_t size() const
Definition: rangelst.hxx:90
bool GetSelection() const
void GetLastDataPos(SCCOL &rCol, SCROW &rRow) const
Definition: table2.cxx:1811
OUString GetText() const
Returns the caption text of this note.
Definition: postit.cxx:913
bool GetBackward() const
ScColContainer aCol
Definition: table.hxx:156
void SetMatColsRows(SCCOL nCols, SCROW nRows)
bool IsSearchFiltered() const
SCCOL Col() const
Definition: address.hxx:267
sal_Int32 GetParagraphCount() const
bool SearchAndReplaceEmptyCells(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, const ScMarkData &rMark, ScRangeList &rMatchedRanges, OUString &rUndoStr, ScDocument *pUndoDoc)
Definition: table6.cxx:857
bool HasMultiLineText() const
Returns true, if the caption text of this note contains line breaks.
Definition: postit.cxx:934
bool ReplaceAllStyle(const SvxSearchItem &rSearchItem, const ScMarkData &rMark, ScRangeList &rMatchedRanges, ScDocument *pUndoDoc)
Definition: table6.cxx:767
CellType meType
Definition: cellvalue.hxx:106
bool GetRowDirection() const
sal_Int32 SCROW
Definition: types.hxx:18
bool IsColRowValid(const SCCOL nScCol, const SCROW nScRow) const
Definition: table.hxx:318
bool SearchStyle(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, const ScMarkData &rMark)
Definition: table6.cxx:614
void Join(const ScRange &, bool bIsInList=false)
Definition: rangelst.cxx:166
bool ValidColRow(SCCOL nCol, SCROW nRow) const
Definition: table.hxx:328
void GetMatColsRows(SCCOL &nCols, SCROW &nRows) const
CellType
Definition: global.hxx:282
const OUString & GetSearchString() const
bool GetCellArea(SCCOL &rEndCol, SCROW &rEndRow) const
Definition: table1.cxx:507
bool IsUseAsianOptions() const
ScMatrixMode
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6066
SvxSearchCmd
bool RowFiltered(SCROW nRow, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: table5.cxx:790
bool SetEditText(SCCOL nCol, SCROW nRow, std::unique_ptr< EditTextObject > pEditText)
Definition: table2.cxx:1490
#define SAL_WARN(area, stream)
bool Replace(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, const ScMarkData &rMark, OUString &rUndoStr, ScDocument *pUndoDoc)
Definition: table6.cxx:564
ScDocument & rDocument
Definition: table.hxx:202
ScMatrixMode GetMatrixFlag() const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
bool SearchAndReplace(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, const ScMarkData &rMark, ScRangeList &rMatchedRanges, OUString &rUndoStr, ScDocument *pUndoDoc)
Definition: table6.cxx:794
bool SearchRangeForAllEmptyCells(const ScRange &rRange, const SvxSearchItem &rSearchItem, ScRangeList &rMatchedRanges, OUString &rUndoStr, ScDocument *pUndoDoc)
Definition: table6.cxx:1069
void SetRowDirection(bool bNewRowDirection)
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
Definition: documen2.cxx:454
bool SearchRangeForEmptyCell(const ScRange &rRange, const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, OUString &rUndoStr)
Definition: table6.cxx:959