LibreOffice Module sc (master)  1
editutil.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 <scitems.hxx>
22 #include <editeng/eeitem.hxx>
23 
24 #include <svx/algitem.hxx>
25 #include <svtools/colorcfg.hxx>
26 #include <editeng/editstat.hxx>
27 #include <editeng/flditem.hxx>
28 #include <editeng/numitem.hxx>
29 #include <editeng/justifyitem.hxx>
30 #include <editeng/editobj.hxx>
31 #include <vcl/outdev.hxx>
32 #include <svl/numformat.hxx>
33 #include <svl/inethist.hxx>
34 #include <sfx2/objsh.hxx>
35 #include <comphelper/lok.hxx>
36 #include <osl/diagnose.h>
37 
38 #include <com/sun/star/text/textfield/Type.hpp>
39 #include <com/sun/star/document/XDocumentProperties.hpp>
40 
41 #include <editutil.hxx>
42 #include <global.hxx>
43 #include <attrib.hxx>
44 #include <document.hxx>
45 #include <docpool.hxx>
46 #include <patattr.hxx>
47 #include <scmod.hxx>
48 #include <inputopt.hxx>
49 #include <compiler.hxx>
50 #include <mutex>
51 
52 using namespace com::sun::star;
53 
54 // delimiters additionally to EditEngine default:
55 
57  const Point& rCellPos,
58  OutputDevice* pDevice, double nScaleX, double nScaleY,
59  const Fraction& rX, const Fraction& rY, bool bPrintTwips ) :
60  pDoc(pDocument),nCol(nX),nRow(nY),nTab(nZ),
61  aCellPos(rCellPos),pDev(pDevice),
62  nPPTX(nScaleX),nPPTY(nScaleY),aZoomX(rX),aZoomY(rY),
63  bInPrintTwips(bPrintTwips) {}
64 
65 OUString ScEditUtil::ModifyDelimiters( const OUString& rOld )
66 {
67  // underscore is used in function argument names
68  OUString aRet = rOld.replaceAll("_", "") +
69  "=()+-*/^&<>" +
70  ScCompiler::GetNativeSymbol(ocSep); // argument separator is localized.
71  return aRet;
72 }
73 
74 static OUString lcl_GetDelimitedString( const EditEngine& rEngine, const char c )
75 {
76  sal_Int32 nParCount = rEngine.GetParagraphCount();
77  // avoid creating a new string if possible
78  if (nParCount == 0)
79  return OUString();
80  else if (nParCount == 1)
81  return rEngine.GetText(0);
82  OUStringBuffer aRet( nParCount * 80 );
83  for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
84  {
85  if (nPar > 0)
86  aRet.append(c);
87  aRet.append( rEngine.GetText( nPar ));
88  }
89  return aRet.makeStringAndClear();
90 }
91 
92 static OUString lcl_GetDelimitedString( const EditTextObject& rEdit, const char c )
93 {
94  sal_Int32 nParCount = rEdit.GetParagraphCount();
95  OUStringBuffer aRet( nParCount * 80 );
96  for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
97  {
98  if (nPar > 0)
99  aRet.append(c);
100  aRet.append( rEdit.GetText( nPar ));
101  }
102  return aRet.makeStringAndClear();
103 }
104 
106 {
107  return lcl_GetDelimitedString(rEngine, ' ');
108 }
109 OUString ScEditUtil::GetMultilineString( const EditEngine& rEngine )
110 {
111  return lcl_GetDelimitedString(rEngine, '\n');
112 }
113 
115 {
116  return lcl_GetDelimitedString(rEdit, '\n');
117 }
118 
119 OUString ScEditUtil::GetString( const EditTextObject& rEditText, const ScDocument* pDoc )
120 {
121  if( !rEditText.HasField())
122  return GetMultilineString( rEditText );
123 
124  static std::mutex aMutex;
125  std::scoped_lock aGuard( aMutex);
126  // ScFieldEditEngine is needed to resolve field contents.
127  if (pDoc)
128  {
129  /* TODO: make ScDocument::GetEditEngine() const? Most likely it's only
130  * not const because of the pointer assignment, make that mutable, and
131  * then remove the ugly const_cast here. */
132  EditEngine& rEE = const_cast<ScDocument*>(pDoc)->GetEditEngine();
133  rEE.SetText( rEditText);
134  return GetMultilineString( rEE);
135  }
136  else
137  {
139  rEE.SetText( rEditText);
140  return GetMultilineString( rEE);
141  }
142 }
143 
144 std::unique_ptr<EditTextObject> ScEditUtil::CreateURLObjectFromURL( ScDocument& rDoc, const OUString& rURL, const OUString& rText )
145 {
146  SvxURLField aUrlField( rURL, rText, SvxURLFormat::AppDefault);
147  EditEngine& rEE = rDoc.GetEditEngine();
148  rEE.SetText( OUString() );
151 
152  return rEE.CreateTextObject();
153 }
154 
156 {
157  static const struct {
158  sal_uInt16 nAttrType;
159  sal_uInt16 nCharType;
160  } AttrTypeMap[] = {
178  };
179 
180  const SfxItemSet& rSet = rAttr.GetItemSet();
181  const SfxPoolItem* pItem;
182  for (size_t i = 0; i < SAL_N_ELEMENTS(AttrTypeMap); ++i)
183  {
184  if ( rSet.GetItemState(AttrTypeMap[i].nAttrType, false, &pItem) == SfxItemState::SET )
185  rEditText.RemoveCharAttribs(AttrTypeMap[i].nCharType);
186  }
187 }
188 
189 std::unique_ptr<EditTextObject> ScEditUtil::Clone( const EditTextObject& rObj, ScDocument& rDestDoc )
190 {
191  std::unique_ptr<EditTextObject> pNew;
192 
193  EditEngine& rEngine = rDestDoc.GetEditEngine();
194  if (rObj.HasOnlineSpellErrors())
195  {
196  EEControlBits nControl = rEngine.GetControlWord();
197  const EEControlBits nSpellControl = EEControlBits::ONLINESPELLING | EEControlBits::ALLOWBIGOBJS;
198  bool bNewControl = ( (nControl & nSpellControl) != nSpellControl );
199  if (bNewControl)
200  rEngine.SetControlWord(nControl | nSpellControl);
201  rEngine.SetText(rObj);
202  pNew = rEngine.CreateTextObject();
203  if (bNewControl)
204  rEngine.SetControlWord(nControl);
205  }
206  else
207  {
208  rEngine.SetText(rObj);
209  pNew = rEngine.CreateTextObject();
210  }
211 
212  return pNew;
213 }
214 
216  const SvxFieldData& rFieldData, const ScDocument* pDoc, std::optional<Color>* ppTextColor )
217 {
218  OUString aRet;
219  switch (rFieldData.GetClassId())
220  {
221  case text::textfield::Type::URL:
222  {
223  const SvxURLField& rField = static_cast<const SvxURLField&>(rFieldData);
224  const OUString& aURL = rField.GetURL();
225 
226  switch (rField.GetFormat())
227  {
228  case SvxURLFormat::AppDefault: //TODO: configurable with App???
229  case SvxURLFormat::Repr:
230  aRet = rField.GetRepresentation();
231  break;
232  case SvxURLFormat::Url:
233  aRet = aURL;
234  break;
235  default:
236  ;
237  }
238 
241 
242  if (ppTextColor)
243  *ppTextColor = SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor;
244  }
245  break;
246  case text::textfield::Type::EXTENDED_TIME:
247  {
248  const SvxExtTimeField& rField = static_cast<const SvxExtTimeField&>(rFieldData);
249  if (pDoc)
250  aRet = rField.GetFormatted(*pDoc->GetFormatTable(), ScGlobal::eLnge);
251  else
252  {
253  /* TODO: quite expensive, we could have a global formatter? */
255  aRet = rField.GetFormatted(aFormatter, ScGlobal::eLnge);
256  }
257  }
258  break;
260  {
261  Date aDate(Date::SYSTEM);
262  aRet = ScGlobal::getLocaleData().getDate(aDate);
263  }
264  break;
265  case text::textfield::Type::DOCINFO_TITLE:
266  {
267  if (pDoc)
268  {
269  SfxObjectShell* pDocShell = pDoc->GetDocumentShell();
270  if (pDocShell)
271  {
272  aRet = pDocShell->getDocProperties()->getTitle();
273  if (aRet.isEmpty())
274  aRet = pDocShell->GetTitle();
275  }
276  }
277  if (aRet.isEmpty())
278  aRet = "?";
279  }
280  break;
282  {
283  const SvxTableField& rField = static_cast<const SvxTableField&>(rFieldData);
284  SCTAB nTab = rField.GetTab();
285  OUString aName;
286  if (pDoc && pDoc->GetName(nTab, aName))
287  aRet = aName;
288  else
289  aRet = "?";
290  }
291  break;
292  default:
293  aRet = "?";
294  }
295 
296  if (aRet.isEmpty()) // empty is yuck
297  aRet = " "; // space is default of EditEngine
298 
299  return aRet;
300 }
301 
303 {
304  if (!pPattern)
305  pPattern = pDoc->GetPattern( nCol, nRow, nTab );
306 
307  if ( pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue() ==
308  SvxCellHorJustify::Left )
309  {
310  tools::Long nIndent = pPattern->GetItem(ATTR_INDENT).GetValue();
311  if (!bInPrintTwips)
312  nIndent = static_cast<tools::Long>(nIndent * nPPTX);
313  return nIndent;
314  }
315 
316  return 0;
317 }
318 
319 void ScEditUtil::GetMargins(const ScPatternAttr* pPattern, tools::Long& nLeftMargin, tools::Long& nTopMargin,
320  tools::Long& nRightMargin, tools::Long& nBottomMargin) const
321 {
322  if (!pPattern)
323  pPattern = pDoc->GetPattern( nCol, nRow, nTab );
324 
325  const SvxMarginItem* pMargin = &pPattern->GetItem(ATTR_MARGIN);
326  if (!pMargin)
327  return;
328 
329  nLeftMargin = bInPrintTwips ? pMargin->GetLeftMargin() : static_cast<tools::Long>(pMargin->GetLeftMargin() * nPPTX);
330  nRightMargin = bInPrintTwips ? pMargin->GetRightMargin() : static_cast<tools::Long>(pMargin->GetRightMargin() * nPPTX);
331  nTopMargin = bInPrintTwips ? pMargin->GetTopMargin() : static_cast<tools::Long>(pMargin->GetTopMargin() * nPPTY);
332  nBottomMargin = bInPrintTwips ? pMargin->GetBottomMargin() : static_cast<tools::Long>(pMargin->GetBottomMargin() * nPPTY);
333 }
334 
335 tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bForceToTop )
336 {
337  // bForceToTop = always align to top, for editing
338  // (sal_False for querying URLs etc.)
339 
340  if (!pPattern)
341  pPattern = pDoc->GetPattern( nCol, nRow, nTab );
342 
343  Point aStartPos = aCellPos;
344  bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
345 
346  bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
347  tools::Long nLayoutSign = (bLayoutRTL && !bIsTiledRendering) ? -1 : 1;
348 
349  const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE);
350  tools::Long nCellX = pDoc->GetColWidth(nCol,nTab);
351  if (!bInPrintTwips)
352  nCellX = static_cast<tools::Long>( nCellX * nPPTX );
353  if ( pMerge->GetColMerge() > 1 )
354  {
355  SCCOL nCountX = pMerge->GetColMerge();
356  for (SCCOL i=1; i<nCountX; i++)
357  {
358  tools::Long nColWidth = pDoc->GetColWidth(nCol+i,nTab);
359  nCellX += (bInPrintTwips ? nColWidth : static_cast<tools::Long>( nColWidth * nPPTX ));
360  }
361  }
363  if (!bInPrintTwips)
364  nCellY = static_cast<tools::Long>( nCellY * nPPTY );
365  if ( pMerge->GetRowMerge() > 1 )
366  {
367  SCROW nCountY = pMerge->GetRowMerge();
368  if (bInPrintTwips)
369  nCellY += pDoc->GetRowHeight(nRow + 1, nRow + nCountY - 1, nTab);
370  else
371  nCellY += pDoc->GetScaledRowHeight( nRow+1, nRow+nCountY-1, nTab, nPPTY);
372  }
373 
377  tools::Long nDifX = 0;
378  {
380  bool bInPrintTwipsOrig = bInPrintTwips;
381  bInPrintTwips = true;
382  tools::Long nIndent = GetIndent(pPattern);
383  GetMargins(pPattern, nLeftMargin, nTopMargin, nRightMargin, nBottomMargin);
384  bInPrintTwips = bInPrintTwipsOrig;
385  // Here rounding may be done only on the sum, ie nDifX,
386  // so need to get margin and indent in twips.
387  nDifX = nLeftMargin + nIndent;
388  if (!bInPrintTwips)
389  {
390  nDifX = static_cast<tools::Long>(nDifX * nPPTX);
391  nRightMargin = static_cast<tools::Long>(nRightMargin * nPPTX);
392  nTopMargin = static_cast<tools::Long>(nTopMargin * nPPTY);
393  nBottomMargin = static_cast<tools::Long>(nBottomMargin * nPPTY);
394  }
395  }
396 
397 
398  aStartPos.AdjustX(nDifX * nLayoutSign );
399  nCellX -= nDifX + nRightMargin; // due to line feed, etc.
400 
401  // align vertical position to the one in the table
402 
403  tools::Long nDifY;
404  SvxCellVerJustify eJust = pPattern->GetItem(ATTR_VER_JUSTIFY).GetValue();
405 
406  // asian vertical is always edited top-aligned
407  bool bAsianVertical = pPattern->GetItem( ATTR_STACKED ).GetValue() &&
408  pPattern->GetItem( ATTR_VERTICAL_ASIAN ).GetValue();
409 
410  if ( eJust == SvxCellVerJustify::Top ||
411  ( bForceToTop && ( SC_MOD()->GetInputOptions().GetTextWysiwyg() || bAsianVertical ) ) )
412  nDifY = nTopMargin;
413  else
414  {
415  MapMode aMode = pDev->GetMapMode();
416  pDev->SetMapMode(MapMode(bInPrintTwips ? MapUnit::MapTwip : MapUnit::MapPixel));
417 
418  tools::Long nTextHeight = pDoc->GetNeededSize( nCol, nRow, nTab,
419  pDev, nPPTX, nPPTY, aZoomX, aZoomY, false /* bWidth */,
420  false /* bTotalSize */, bInPrintTwips );
421  if (!nTextHeight)
422  { // empty cell
423  vcl::Font aFont;
424  // font color doesn't matter here
425  pPattern->GetFont( aFont, SC_AUTOCOL_BLACK, pDev, &aZoomY );
426  pDev->SetFont(aFont);
427  nTextHeight = pDev->GetTextHeight() + nTopMargin + nBottomMargin;
428  }
429 
430  pDev->SetMapMode(aMode);
431 
432  if ( nTextHeight > nCellY + nTopMargin || bForceToTop )
433  nDifY = 0; // too large -> begin at the top
434  else
435  {
436  if ( eJust == SvxCellVerJustify::Center )
437  nDifY = nTopMargin + ( nCellY - nTextHeight ) / 2;
438  else
439  nDifY = nCellY - nTextHeight + nTopMargin; // JUSTIFY_BOTTOM
440  }
441  }
442 
443  aStartPos.AdjustY(nDifY );
444  nCellY -= nDifY;
445 
446  if ( bLayoutRTL && !bIsTiledRendering )
447  aStartPos.AdjustX( -(nCellX - 2) ); // excluding grid on both sides
448 
449  // -1 -> don't overwrite grid
450  return tools::Rectangle( aStartPos, Size(nCellX-1,nCellY-1) );
451 }
452 
454  bNeedsObject( false ),
455  bNeedsCellAttr( false )
456 {
457  if ( pEngine->GetParagraphCount() > 1 )
458  {
459  bNeedsObject = true; //TODO: find cell attributes ?
460  }
461  else
462  {
463  const SfxPoolItem* pItem = nullptr;
464  pEditAttrs.reset( new SfxItemSet( pEngine->GetAttribs(
465  ESelection(0,0,0,pEngine->GetTextLen(0)), EditEngineAttribs::OnlyHard ) ) );
466  const SfxItemSet& rEditDefaults = pEngine->GetDefaults();
467 
468  for (sal_uInt16 nId = EE_CHAR_START; nId <= EE_CHAR_END && !bNeedsObject; nId++)
469  {
470  SfxItemState eState = pEditAttrs->GetItemState( nId, false, &pItem );
471  if (eState == SfxItemState::DONTCARE)
472  bNeedsObject = true;
473  else if (eState == SfxItemState::SET)
474  {
477  {
478  // Escapement and kerning are kept in EditEngine because there are no
479  // corresponding cell format items. User defined attributes are kept in
480  // EditEngine because "user attributes applied to all the text" is different
481  // from "user attributes applied to the cell".
482 
483  if ( *pItem != rEditDefaults.Get(nId) )
484  bNeedsObject = true;
485  }
486  else
487  if (!bNeedsCellAttr)
488  if ( *pItem != rEditDefaults.Get(nId) )
489  bNeedsCellAttr = true;
490  // rEditDefaults contains the defaults from the cell format
491  }
492  }
493 
494  // contains field commands?
495 
496  SfxItemState eFieldState = pEditAttrs->GetItemState( EE_FEATURE_FIELD, false );
497  if ( eFieldState == SfxItemState::DONTCARE || eFieldState == SfxItemState::SET )
498  bNeedsObject = true;
499 
500  // not converted characters?
501 
502  SfxItemState eConvState = pEditAttrs->GetItemState( EE_FEATURE_NOTCONV, false );
503  if ( eConvState == SfxItemState::DONTCARE || eConvState == SfxItemState::SET )
504  bNeedsObject = true;
505  }
506 }
507 
509 {
510 }
511 
513  bool bDeleteEnginePoolP )
514  :
515  pEnginePool( pEnginePoolP ),
516  pDefaults( nullptr ),
517  bDeleteEnginePool( bDeleteEnginePoolP ),
518  bDeleteDefaults( false )
519 {
520 }
521 
523  :
524  pEnginePool( rOrg.bDeleteEnginePool ? rOrg.pEnginePool->Clone() : rOrg.pEnginePool ),
525  pDefaults( nullptr ),
526  bDeleteEnginePool( rOrg.bDeleteEnginePool ),
527  bDeleteDefaults( false )
528 {
529 }
530 
532 {
533  if ( bDeleteDefaults )
534  delete pDefaults;
535 }
536 
538  bool bDeleteEnginePoolP )
539  :
540  ScEnginePoolHelper( pEnginePoolP, bDeleteEnginePoolP ),
541  EditEngine( pEnginePoolP )
542 {
543  // All EditEngines use ScGlobal::GetEditDefaultLanguage as DefaultLanguage.
544  // DefaultLanguage for InputHandler's EditEngine is updated later.
545 
547 }
548 
550  :
551  ScEnginePoolHelper( rOrg ),
552  EditEngine( pEnginePool.get() )
553 {
555 }
556 
558 {
559 }
560 
561 void ScEditEngineDefaulter::SetDefaults( const SfxItemSet& rSet, bool bRememberCopy )
562 {
563  if ( bRememberCopy )
564  {
565  if ( bDeleteDefaults )
566  delete pDefaults;
567  pDefaults = new SfxItemSet( rSet );
568  bDeleteDefaults = true;
569  }
570  const SfxItemSet& rNewSet = bRememberCopy ? *pDefaults : rSet;
571  bool bUndo = IsUndoEnabled();
572  EnableUndo( false );
573  bool bUpdateMode = SetUpdateLayout( false );
574  sal_Int32 nPara = GetParagraphCount();
575  for ( sal_Int32 j=0; j<nPara; j++ )
576  {
577  SetParaAttribs( j, rNewSet );
578  }
579  if ( bUpdateMode )
580  SetUpdateLayout( true );
581  if ( bUndo )
582  EnableUndo( true );
583 }
584 
585 void ScEditEngineDefaulter::SetDefaults( std::unique_ptr<SfxItemSet> pSet )
586 {
587  if ( bDeleteDefaults )
588  delete pDefaults;
589  pDefaults = pSet.release();
590  bDeleteDefaults = true;
591  if ( pDefaults )
592  SetDefaults( *pDefaults, false );
593 }
594 
596 {
597  if ( !pDefaults )
598  {
600  bDeleteDefaults = true;
601  }
602  pDefaults->Put( rItem );
603  SetDefaults( *pDefaults, false );
604 }
605 
607 {
608  if ( !pDefaults )
609  {
611  bDeleteDefaults = true;
612  }
613  return *pDefaults;
614 }
615 
617 {
618  bool bUpdateMode = SetUpdateLayout( false );
619  SetText( rTextObject );
620  if ( pDefaults )
621  SetDefaults( *pDefaults, false );
622  if ( bUpdateMode )
623  SetUpdateLayout( true );
624 }
625 
627  const SfxItemSet& rSet, bool bRememberCopy )
628 {
629  bool bUpdateMode = SetUpdateLayout( false );
630  SetText( rTextObject );
631  SetDefaults( rSet, bRememberCopy );
632  if ( bUpdateMode )
633  SetUpdateLayout( true );
634 }
635 
637 {
638  bool bUpdateMode = SetUpdateLayout( false );
639  SetText( rText );
640  if ( pDefaults )
641  SetDefaults( *pDefaults, false );
642  if ( bUpdateMode )
643  SetUpdateLayout( true );
644 }
645 
646 void ScEditEngineDefaulter::SetTextNewDefaults( const OUString& rText,
647  const SfxItemSet& rSet )
648 {
649  bool bUpdateMode = SetUpdateLayout( false );
650  SetText( rText );
651  SetDefaults( rSet );
652  if ( bUpdateMode )
653  SetUpdateLayout( true );
654 }
655 
657 {
658  if ( pDefaults )
659  {
660  sal_Int32 nPara = GetParagraphCount();
661  for ( sal_Int32 j=0; j<nPara; j++ )
662  SetParaAttribs( j, *pDefaults );
663  }
664 }
665 
667 {
668  std::optional<SfxItemSet> pCharItems;
669  bool bUpdateMode = SetUpdateLayout( false );
670  sal_Int32 nParCount = GetParagraphCount();
671  for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
672  {
673  const SfxItemSet& rParaAttribs = GetParaAttribs( nPar );
674  sal_uInt16 nWhich;
675  for (nWhich = EE_CHAR_START; nWhich <= EE_CHAR_END; nWhich ++)
676  {
677  const SfxPoolItem* pParaItem;
678  if ( rParaAttribs.GetItemState( nWhich, false, &pParaItem ) == SfxItemState::SET )
679  {
680  // if defaults are set, use only items that are different from default
681  if ( !pDefaults || *pParaItem != pDefaults->Get(nWhich) )
682  {
683  if (!pCharItems)
684  pCharItems.emplace( GetEmptyItemSet() );
685  pCharItems->Put( *pParaItem );
686  }
687  }
688  }
689 
690  if ( pCharItems )
691  {
692  std::vector<sal_Int32> aPortions;
693  GetPortions( nPar, aPortions );
694 
695  // loop through the portions of the paragraph, and set only those items
696  // that are not overridden by existing character attributes
697 
698  sal_Int32 nStart = 0;
699  for ( const sal_Int32 nEnd : aPortions )
700  {
701  ESelection aSel( nPar, nStart, nPar, nEnd );
702  SfxItemSet aOldCharAttrs = GetAttribs( aSel );
703  SfxItemSet aNewCharAttrs = *pCharItems;
704  for (nWhich = EE_CHAR_START; nWhich <= EE_CHAR_END; nWhich ++)
705  {
706  // Clear those items that are different from existing character attributes.
707  // Where no character attributes are set, GetAttribs returns the paragraph attributes.
708  const SfxPoolItem* pItem;
709  if ( aNewCharAttrs.GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
710  *pItem != aOldCharAttrs.Get(nWhich) )
711  {
712  aNewCharAttrs.ClearItem(nWhich);
713  }
714  }
715  if ( aNewCharAttrs.Count() )
716  QuickSetAttribs( aNewCharAttrs, aSel );
717 
718  nStart = nEnd;
719  }
720 
721  pCharItems.reset();
722  }
723 
724  if ( rParaAttribs.Count() )
725  {
726  // clear all paragraph attributes (including defaults),
727  // so they are not contained in resulting EditTextObjects
728 
729  SetParaAttribs( nPar, SfxItemSet( *rParaAttribs.GetPool(), rParaAttribs.GetRanges() ) );
730  }
731  }
732  if ( bUpdateMode )
733  SetUpdateLayout( true );
734 }
735 
737  : ScFieldEditEngine( pDoc, pDoc->GetEnginePool() )
738 {
741 }
742 
744  SfxItemPool* pEngineItemPool, ScDocument* pDoc, SfxItemPool* pTextObjectPool )
745  : ScFieldEditEngine( pDoc, pEngineItemPool, pTextObjectPool )
746 {
747  if ( pTextObjectPool )
748  SetEditTextObjectPool( pTextObjectPool );
749  Init( rPattern );
750 }
751 
752 void ScTabEditEngine::Init( const ScPatternAttr& rPattern )
753 {
754  SetRefMapMode(MapMode(MapUnit::Map100thMM));
755  auto pEditDefaults = std::make_unique<SfxItemSet>( GetEmptyItemSet() );
756  rPattern.FillEditItemSet( pEditDefaults.get() );
757  SetDefaults( std::move(pEditDefaults) );
758  // we have no StyleSheets for text
759  SetControlWord( GetControlWord() & ~EEControlBits::RTFSTYLESHEETS );
760 }
761 
762 // field commands for header and footer
763 
764 // numbers from \sw\source\core\doc\numbers.cxx
765 
766 static OUString lcl_GetCharStr( sal_Int32 nNo )
767 {
768  OSL_ENSURE( nNo, "0 is an invalid number !!" );
769  OUString aStr;
770 
771  const sal_Int32 coDiff = 'Z' - 'A' +1;
772  sal_Int32 nCalc;
773 
774  do {
775  nCalc = nNo % coDiff;
776  if( !nCalc )
777  nCalc = coDiff;
778  aStr = OUStringChar( sal_Unicode('a' - 1 + nCalc) ) + aStr;
779  nNo = sal::static_int_cast<sal_Int32>( nNo - nCalc );
780  if( nNo )
781  nNo /= coDiff;
782  } while( nNo );
783  return aStr;
784 }
785 
786 static OUString lcl_GetNumStr(sal_Int32 nNo, SvxNumType eType)
787 {
788  OUString aTmpStr('0');
789  if( nNo )
790  {
791  switch( eType )
792  {
793  case css::style::NumberingType::CHARS_UPPER_LETTER:
794  case css::style::NumberingType::CHARS_LOWER_LETTER:
795  aTmpStr = lcl_GetCharStr( nNo );
796  break;
797 
798  case css::style::NumberingType::ROMAN_UPPER:
799  case css::style::NumberingType::ROMAN_LOWER:
800  if( nNo < 4000 )
801  aTmpStr = SvxNumberFormat::CreateRomanString( nNo, ( eType == css::style::NumberingType::ROMAN_UPPER ) );
802  else
803  aTmpStr.clear();
804  break;
805 
806  case css::style::NumberingType::NUMBER_NONE:
807  aTmpStr.clear();
808  break;
809 
810 // CHAR_SPECIAL:
811 // ????
812 
813 // case ARABIC: is default now
814  default:
815  aTmpStr = OUString::number(nNo);
816  break;
817  }
818 
819  if( css::style::NumberingType::CHARS_UPPER_LETTER == eType )
820  aTmpStr = aTmpStr.toAsciiUpperCase();
821  }
822  return aTmpStr;
823 }
824 
826  : aDateTime ( DateTime::EMPTY )
827 {
828  nPageNo = nTotalPages = 0;
830 }
831 
833  : ScEditEngineDefaulter( pEnginePoolP,true/*bDeleteEnginePoolP*/ )
834 {
835 }
836 
838  sal_Int32 /* nPara */, sal_Int32 /* nPos */,
839  std::optional<Color>& /* rTxtColor */, std::optional<Color>& /* rFldColor */ )
840 {
841  const SvxFieldData* pFieldData = rField.GetField();
842  if (!pFieldData)
843  return "?";
844 
845  OUString aRet;
846  sal_Int32 nClsId = pFieldData->GetClassId();
847  switch (nClsId)
848  {
849  case text::textfield::Type::PAGE:
851  break;
852  case text::textfield::Type::PAGES:
854  break;
855  case text::textfield::Type::EXTENDED_TIME:
856  case text::textfield::Type::TIME:
857  // For now, time field in the header / footer is always dynamic.
859  break;
860  case text::textfield::Type::DOCINFO_TITLE:
861  aRet = aData.aTitle;
862  break;
863  case text::textfield::Type::EXTENDED_FILE:
864  {
865  switch (static_cast<const SvxExtFileField*>(pFieldData)->GetFormat())
866  {
867  case SvxFileFormat::PathFull :
868  aRet = aData.aLongDocName;
869  break;
870  default:
871  aRet = aData.aShortDocName;
872  }
873  }
874  break;
876  aRet = aData.aTabName;
877  break;
880  break;
881  default:
882  aRet = "?";
883  }
884 
885  return aRet;
886 }
887 
888 // field data
889 
891  ScDocument* pDoc, SfxItemPool* pEnginePoolP,
892  SfxItemPool* pTextObjectPool, bool bDeleteEnginePoolP) :
893  ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ),
894  mpDoc(pDoc), bExecuteURL(true)
895 {
896  if ( pTextObjectPool )
897  SetEditTextObjectPool( pTextObjectPool );
898  SetControlWord( EEControlBits(GetControlWord() | EEControlBits::MARKFIELDS) & ~EEControlBits::RTFSTYLESHEETS );
899 }
900 
902  sal_Int32 /* nPara */, sal_Int32 /* nPos */,
903  std::optional<Color>& rTxtColor, std::optional<Color>& /* rFldColor */ )
904 {
905  const SvxFieldData* pFieldData = rField.GetField();
906 
907  if (!pFieldData)
908  return " ";
909 
910  return ScEditUtil::GetCellFieldValue(*pFieldData, mpDoc, &rTxtColor);
911 }
912 
914 {
915  if (!bExecuteURL)
916  return false;
917 
918  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(rField.GetField()))
919  {
920  ScGlobal::OpenURL(pURLField->GetURL(), pURLField->GetTargetFrame());
921  return true;
922  }
923  return false;
924 }
925 
927  SfxItemPool* pTextObjectPool ) :
928  ScEditEngineDefaulter( pEnginePoolP, false/*bDeleteEnginePoolP*/ )
929 {
930  if ( pTextObjectPool )
931  SetEditTextObjectPool( pTextObjectPool );
932  SetControlWord( EEControlBits(GetControlWord() | EEControlBits::MARKFIELDS) & ~EEControlBits::RTFSTYLESHEETS );
933 }
934 
935 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long const nBottomMargin
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
tools::Rectangle GetEditArea(const ScPatternAttr *pPattern, bool bForceToTop)
Definition: editutil.cxx:335
std::unique_ptr< SfxItemSet > pEditAttrs
Definition: editutil.hxx:94
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
virtual ~ScEditEngineDefaulter() override
Definition: editutil.cxx:557
OUString aLongDocName
Definition: editutil.hxx:202
constexpr double nPPTY
SCCOL GetColMerge() const
Definition: attrib.hxx:68
OUString GetText(LineEnd eEnd=LINEEND_LF) const
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
EEControlBits GetControlWord() const
URL aURL
Fraction aZoomX
Definition: editutil.hxx:46
Fraction aZoomY
Definition: editutil.hxx:47
void SetDefaults(const SfxItemSet &rDefaults, bool bRememberCopy=true)
Creates a copy of SfxItemSet if bRememberCopy set.
Definition: editutil.cxx:561
constexpr TypedWhichId< SvxAutoKernItem > EE_CHAR_PAIRKERNING(EE_CHAR_START+11)
SCTAB nTab
Definition: editutil.hxx:41
SCROW nRow
Definition: editutil.hxx:40
SfxItemSet * pDefaults
Definition: editutil.hxx:112
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
OUString GetTitle(sal_uInt16 nMaxLen=0) const
const SfxItemSet & GetEmptyItemSet() const
constexpr TypedWhichId< SfxBoolItem > ATTR_VERTICAL_ASIAN(137)
Point aCellPos
Definition: editutil.hxx:42
ScEditEngineDefaulter(SfxItemPool *pEnginePool, bool bDeleteEnginePool=false)
bDeleteEnginePool: Engine becomes the owner of the pool and deletes it on destruction ...
Definition: editutil.cxx:537
tools::Long const nLeftMargin
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor) override
Definition: editutil.cxx:901
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
long Long
const WhichRangesContainer & GetRanges() const
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
static void OpenURL(const OUString &rURL, const OUString &rTarget, bool bIgnoreSettings=false)
Open the specified URL.
Definition: global.cxx:770
sal_Int16 nId
const MapMode & GetMapMode() const
ScFieldEditEngine(ScDocument *pDoc, SfxItemPool *pEnginePool, SfxItemPool *pTextObjectPool=nullptr, bool bDeleteEnginePool=false)
Definition: editutil.cxx:890
double nPPTY
Definition: editutil.hxx:45
sal_Int16 GetRightMargin() const
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
EEControlBits
static std::unique_ptr< EditTextObject > CreateURLObjectFromURL(ScDocument &rDoc, const OUString &rURL, const OUString &rText)
Definition: editutil.cxx:144
void SetMapMode()
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
SfxItemSet GetAttribs(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags=GetAttribsFlags::ALL) const
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4211
SvxNumType
ScHeaderFieldData aData
Definition: editutil.hxx:217
constexpr TypedWhichId< ScIndentItem > ATTR_INDENT(131)
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6156
ScDocument * pDoc
Definition: editutil.hxx:38
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor) override
Definition: editutil.cxx:837
sal_uInt16 sal_Unicode
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
Definition: global.cxx:1015
virtual ~ScEnginePoolHelper()
Definition: editutil.cxx:531
SvxCellVerJustify
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
ScNoteEditEngine(SfxItemPool *pEnginePool, SfxItemPool *pTextObjectPool)
Definition: editutil.cxx:926
void SetText(const OUString &rStr)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
void SetControlWord(EEControlBits nWord)
SVX_NUM_ARABIC
Mutex aMutex
void Init(const ScPatternAttr &rPattern)
Definition: editutil.cxx:752
ScEditAttrTester(ScEditEngineDefaulter *pEng)
Definition: editutil.cxx:453
OUString aShortDocName
Definition: editutil.hxx:203
virtual bool RemoveCharAttribs(sal_uInt16 nWhich)=0
static OUString lcl_GetDelimitedString(const EditEngine &rEngine, const char c)
Definition: editutil.cxx:74
virtual bool FieldClicked(const SvxFieldItem &rField) override
Definition: editutil.cxx:913
sal_Int32 GetTextLen() const
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4799
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:72
ocSep
#define SAL_N_ELEMENTS(arr)
bool IsUndoEnabled() const
constexpr double nPPTX
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:460
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
static void GetFont(vcl::Font &rFont, const SfxItemSet &rItemSet, ScAutoFontColorMode eAutoMode, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE, const Color *pBackConfigColor=nullptr, const Color *pTextConfigColor=nullptr)
Static helper function to fill a font object from the passed item set.
Definition: patattr.cxx:251
static const OUString & GetNativeSymbol(OpCode eOp)
tools::Long nTotalPages
Definition: editutil.hxx:207
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:616
static ScFieldEditEngine & GetStaticFieldEditEngine()
A static instance of ScFieldEditEngine not capable of resolving document specific fields...
Definition: global.cxx:1087
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void SetDefaultItem(const SfxPoolItem &rItem)
Set the item in the default ItemSet which is created if it doesn't exist yet.
Definition: editutil.cxx:595
static INetURLHistory * GetOrCreate()
int i
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
sal_Int16 SCCOL
Definition: types.hxx:21
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
#define SC_MOD()
Definition: scmod.hxx:249
void RepeatDefaults()
Re-apply existing defaults if set, same as in SetText, but without EnableUndo/SetUpdateMode.
Definition: editutil.cxx:656
bool bInPrintTwips
Definition: editutil.hxx:48
sal_uInt16 Count() const
virtual OUString GetText(sal_Int32 nPara) const =0
OUString aTabName
Definition: editutil.hxx:204
std::unique_ptr< EditTextObject > CreateTextObject()
ScHeaderEditEngine(SfxItemPool *pEnginePool)
Definition: editutil.cxx:832
constexpr sal_uInt16 EE_CHAR_START(EE_PARA_END+1)
OUString GetFormatted(SvNumberFormatter &rFormatter, LanguageType eLanguage) const
SfxItemSet & GetItemSet()
Definition: patattr.hxx:155
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
virtual bool HasField(sal_Int32 nType=css::text::textfield::Type::UNSPECIFIED) const =0
const OUString & GetRepresentation() const
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
constexpr sal_uInt16 EE_CHAR_END(EE_CHAR_START+32)
static OUString lcl_GetNumStr(sal_Int32 nNo, SvxNumType eType)
Definition: editutil.cxx:786
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:545
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
void SetDefaultLanguage(LanguageType eLang)
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
sal_Int16 GetBottomMargin() const
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
static LanguageType GetEditDefaultLanguage()
Definition: global.cxx:869
sal_Int32 GetParagraphCount() const
bool SetUpdateLayout(bool bUpdate, bool bRestoring=false)
static OUString GetCellFieldValue(const SvxFieldData &rFieldData, const ScDocument *pDoc, std::optional< Color > *ppTextColor)
Definition: editutil.cxx:215
ScEditUtil(ScDocument *pDocument, SCCOL nX, SCROW nY, SCTAB nZ, const Point &rCellPos, OutputDevice *pDevice, double nScaleX, double nScaleY, const Fraction &rX, const Fraction &rY, bool bPrintTwips=false)
Definition: editutil.cxx:56
const OUString & GetURL() const
virtual sal_Int32 GetClassId() const
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
constexpr sal_uInt16 EE_FEATURE_NOTCONV(EE_FEATURE_LINEBR+1)
OUString getDate(const Date &rDate) const
void SetRefMapMode(const MapMode &rMapMode)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:17
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
constexpr OUStringLiteral EMPTY
tools::Long GetIndent(const ScPatternAttr *pPattern) const
Definition: editutil.cxx:302
void GetMargins(const ScPatternAttr *pPattern, tools::Long &nLeftMargin, tools::Long &nTopMargin, tools::Long &nRightMargin, tools::Long &BottomMargin) const
Definition: editutil.cxx:319
tools::Long const nTopMargin
constexpr TypedWhichId< SvxPostureItem > ATTR_CTL_FONT_POSTURE(119)
SfxItemState
static OUString CreateRomanString(sal_Int32 nNo, bool bUpper)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
void SetFont(const vcl::Font &rNewFont)
double nPPTX
Definition: editutil.hxx:44
virtual sal_Int32 GetParagraphCount() const =0
tools::Long GetTextHeight() const
OUString aName
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
void EnableUndo(bool bEnable)
void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList)
static OUString ModifyDelimiters(const OUString &rOld)
Definition: editutil.cxx:65
sal_Int16 GetLeftMargin() const
const SfxItemSet & GetDefaults()
Returns the stored defaults, used to find non-default character attributes.
Definition: editutil.cxx:606
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
ScEnginePoolHelper(SfxItemPool *pEnginePool, bool bDeleteEnginePool)
Definition: editutil.cxx:512
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
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:4303
Reference< XComponentContext > getProcessComponentContext()
#define EE_TEXTPOS_MAX_COUNT
ScTabEditEngine(ScDocument *pDoc)
Definition: editutil.cxx:736
static OUString lcl_GetCharStr(sal_Int32 nNo)
Definition: editutil.cxx:766
DateTime aDateTime
Definition: editutil.hxx:205
tools::Long const nRightMargin
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
static OUString GetSpaceDelimitedString(const EditEngine &rEngine)
Retrieves string with paragraphs delimited by spaces.
Definition: editutil.cxx:105
static void RemoveCharAttribs(EditTextObject &rEditText, const ScPatternAttr &rAttr)
Definition: editutil.cxx:155
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:466
int GetTab() const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:989
tools::Long nPageNo
Definition: editutil.hxx:206
virtual bool HasOnlineSpellErrors() const =0
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
static SC_DLLPUBLIC OUString GetString(const EditTextObject &rEditText, const ScDocument *pDoc)
Retrieves string with paragraphs delimited by new lines (' ').
Definition: editutil.cxx:119
virtual void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &rSet)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
ScDocument * mpDoc
Definition: editutil.hxx:173
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1081
bool QueryUrl(const INetURLObject &rUrl) const
static std::unique_ptr< EditTextObject > Clone(const EditTextObject &rSrc, ScDocument &rDestDoc)
Definition: editutil.cxx:189
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
VclPtr< OutputDevice > pDev
Definition: editutil.hxx:43
SCCOL nCol
Definition: editutil.hxx:39
SCROW GetRowMerge() const
Definition: attrib.hxx:69
SvxNumType eNumType
Definition: editutil.hxx:208
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
#define EE_PARA_MAX_COUNT
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4170
constexpr TypedWhichId< SvxColorItem > ATTR_FONT_COLOR(109)
void SetTextNewDefaults(const EditTextObject &rTextObject, const SfxItemSet &rDefaults, bool bRememberCopy=true)
Current defaults are not applied, new defaults are applied.
Definition: editutil.cxx:626
constexpr TypedWhichId< SvxWeightItem > ATTR_CJK_FONT_WEIGHT(113)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
void RemoveParaAttribs()
Paragraph attributes that are not defaults are copied to character attributes and all paragraph attri...
Definition: editutil.cxx:666
static OUString GetMultilineString(const EditEngine &rEngine)
Retrieves string with paragraphs delimited by new lines (' ').
Definition: editutil.cxx:109
aStr
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:215
tools::Long GetScaledRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale, const tools::Long *pnMaxHeight=nullptr) const
Definition: document.cxx:4248
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
void SetEditTextObjectPool(SfxItemPool *pPool)
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
Definition: documen2.cxx:476
const SfxItemSet & GetParaAttribs(sal_Int32 nPara) const
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_CHAR_XMLATTRIBS(EE_CHAR_START+28)
sal_Int16 SCTAB
Definition: types.hxx:22
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
const SvxFieldData * GetField() const
bool m_bDetectedRangeSegmentation false
void FillEditItemSet(SfxItemSet *pEditSet, const SfxItemSet *pCondSet=nullptr) const
Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSe...
Definition: patattr.cxx:827
SvxURLFormat GetFormat() const
sal_Int16 GetTopMargin() const