LibreOffice Module svx (master)  1
cell.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 
21 #include <com/sun/star/drawing/BitmapMode.hpp>
22 #include <com/sun/star/style/XStyle.hpp>
23 #include <com/sun/star/text/WritingMode.hpp>
24 #include <com/sun/star/table/TableBorder.hpp>
25 #include <com/sun/star/table/BorderLine2.hpp>
26 #include <com/sun/star/lang/Locale.hpp>
27 
28 #include <comphelper/sequence.hxx>
31 #include <o3tl/any.hxx>
32 #include <svl/style.hxx>
33 #include <svl/itemset.hxx>
34 
35 #include <vcl/svapp.hxx>
36 #include <libxml/xmlwriter.h>
37 
39 #include <editeng/outlobj.hxx>
41 #include <svx/svdotable.hxx>
42 #include <svx/svdoutl.hxx>
43 #include <svx/unoshtxt.hxx>
44 #include <svx/svdmodel.hxx>
45 #include <svx/sdooitm.hxx>
46 #include <svx/sdtagitm.hxx>
47 #include <svx/sdmetitm.hxx>
48 #include <svx/xit.hxx>
49 #include <getallcharpropids.hxx>
50 #include "tableundo.hxx"
51 #include <cell.hxx>
52 #include <svx/unoshprp.hxx>
53 #include <svx/unoshape.hxx>
54 #include <editeng/editobj.hxx>
55 #include <editeng/borderline.hxx>
56 #include <editeng/boxitem.hxx>
58 #include <svx/xflbstit.hxx>
59 #include <svx/xflbmtit.hxx>
60 #include <svx/svdpool.hxx>
61 
62 
63 using ::editeng::SvxBorderLine;
64 using namespace ::com::sun::star::uno;
65 using namespace ::com::sun::star::beans;
66 using namespace ::com::sun::star::lang;
67 using namespace ::com::sun::star::text;
68 using namespace ::com::sun::star::table;
69 using namespace ::com::sun::star::drawing;
70 using namespace ::com::sun::star::style;
71 using namespace ::com::sun::star::container;
72 
73 
75 {
76  // property map for an outliner text
77  static const SfxItemPropertyMapEntry aSvxCellPropertyMap[] =
78  {
80 // { "HasLevels", OWN_ATTR_HASLEVELS, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY, 0},
81  { OUString("Style"), OWN_ATTR_STYLE, cppu::UnoType< css::style::XStyle >::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
84  { OUString(UNO_NAME_TEXT_LEFTDIST), SDRATTR_TEXT_LEFTDIST, cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM},
85  { OUString(UNO_NAME_TEXT_LOWERDIST), SDRATTR_TEXT_LOWERDIST, cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM},
86  { OUString(UNO_NAME_TEXT_RIGHTDIST), SDRATTR_TEXT_RIGHTDIST, cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM},
87  { OUString(UNO_NAME_TEXT_UPPERDIST), SDRATTR_TEXT_UPPERDIST, cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM},
90 
91  { OUString("TableBorder"), OWN_ATTR_TABLEBORDER, cppu::UnoType<TableBorder>::get(), 0, 0 },
92  { OUString("TopBorder"), SDRATTR_TABLE_BORDER, cppu::UnoType<BorderLine>::get(), 0, TOP_BORDER },
93  { OUString("BottomBorder"), SDRATTR_TABLE_BORDER, cppu::UnoType<BorderLine>::get(), 0, BOTTOM_BORDER },
94  { OUString("LeftBorder"), SDRATTR_TABLE_BORDER, cppu::UnoType<BorderLine>::get(), 0, LEFT_BORDER },
95  { OUString("RightBorder"), SDRATTR_TABLE_BORDER, cppu::UnoType<BorderLine>::get(), 0, RIGHT_BORDER },
96  { OUString("RotateAngle"), SDRATTR_TABLE_TEXT_ROTATION, cppu::UnoType<sal_Int32>::get(), 0, 0 },
97 
101  { OUString(), 0, css::uno::Type(), 0, 0 }
102  };
103 
104  static SvxItemPropertySet aSvxCellPropertySet( aSvxCellPropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
105  return &aSvxCellPropertySet;
106 }
107 
108 namespace
109 {
110 
111 class CellTextProvider : public svx::ITextProvider
112 {
113 public:
114  explicit CellTextProvider(const sdr::table::CellRef& rCell);
115  virtual ~CellTextProvider();
116 
117 private:
118  virtual sal_Int32 getTextCount() const override;
119  virtual SdrText* getText(sal_Int32 nIndex) const override;
120 
121 private:
122  const sdr::table::CellRef m_xCell;
123 };
124 
125 CellTextProvider::CellTextProvider(const sdr::table::CellRef& rCell)
126  : m_xCell(rCell)
127 {
128 }
129 
130 CellTextProvider::~CellTextProvider()
131 {
132 }
133 
134 sal_Int32 CellTextProvider::getTextCount() const
135 {
136  return 1;
137 }
138 
139 SdrText* CellTextProvider::getText(sal_Int32 nIndex) const
140 {
141  (void) nIndex;
142  assert(nIndex == 0);
143  return m_xCell.get();
144 }
145 
146 }
147 
148 namespace sdr::properties
149 {
151  {
152  protected:
153  // create a new itemset
154  std::unique_ptr<SfxItemSet> CreateObjectSpecificItemSet(SfxItemPool& rPool) override;
155 
156  const svx::ITextProvider& getTextProvider() const override;
157 
158  public:
159  // basic constructor
160  CellProperties(SdrObject& rObj, sdr::table::Cell* pCell );
161 
162  // constructor for copying, but using new object
163  CellProperties(const CellProperties& rProps, SdrObject& rObj, sdr::table::Cell* pCell);
164 
165  // Clone() operator, normally just calls the local copy constructor
166  std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
167 
168  void ForceDefaultAttributes() override;
169 
170  void ItemSetChanged(const SfxItemSet& rSet) override;
171 
172  void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override;
173 
175 
176  private:
177  const CellTextProvider maTextProvider;
178  };
179 
180  // create a new itemset
181  std::unique_ptr<SfxItemSet> CellProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
182  {
183  return std::make_unique<SfxItemSet>(rPool,
184 
185  // range from SdrAttrObj
189 
190  // range for SdrTableObj
192 
193  // range from SdrTextObj
195  }
196 
198  {
199  return maTextProvider;
200  }
201 
203  : TextProperties(rObj)
204  , mxCell(pCell)
205  , maTextProvider(mxCell)
206  {
207  }
208 
210  : TextProperties(rProps, rObj)
211  , mxCell( pCell )
212  , maTextProvider(mxCell)
213  {
214  }
215 
216  std::unique_ptr<BaseProperties> CellProperties::Clone(SdrObject& rObj) const
217  {
218  OSL_FAIL("CellProperties::Clone(), does not work yet!");
219  return std::unique_ptr<BaseProperties>(new CellProperties(*this, rObj,nullptr));
220  }
221 
223  {
224  }
225 
227  {
228  SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
229 
230  if( mxCell.is() )
231  {
232  OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
233 
234  const bool bOwnParaObj = pParaObj != nullptr;
235 
236  if( pParaObj == nullptr )
237  pParaObj = mxCell->GetOutlinerParaObject();
238 
239  if(pParaObj)
240  {
241  // handle outliner attributes
242  Outliner* pOutliner = nullptr;
243 
244  if(mxCell->IsTextEditActive())
245  {
246  pOutliner = rObj.GetTextEditOutliner();
247  }
248  else
249  {
250  pOutliner = &rObj.ImpGetDrawOutliner();
251  pOutliner->SetText(*pParaObj);
252  }
253 
254  sal_Int32 nParaCount(pOutliner->GetParagraphCount());
255 
256  // if the user sets character attributes to the complete
257  // cell we want to remove all hard set character attributes
258  // with same which ids from the text
259  std::vector<sal_uInt16> aCharWhichIds(GetAllCharPropIds(rSet));
260 
261  for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
262  {
263  SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
264  aSet.Put(rSet);
265 
266  for (const auto& rWhichId : aCharWhichIds)
267  {
268  pOutliner->RemoveCharAttribs(nPara, rWhichId);
269  }
270 
271  pOutliner->SetParaAttribs(nPara, aSet);
272  }
273 
274  if(!mxCell->IsTextEditActive())
275  {
276  if(nParaCount)
277  {
278  // force ItemSet
280 
281  SfxItemSet aNewSet(pOutliner->GetParaAttribs(0));
282  mpItemSet->Put(aNewSet);
283  }
284 
285  std::unique_ptr<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount);
286  pOutliner->Clear();
287  mxCell->SetOutlinerParaObject(std::move(pTemp));
288  }
289 
290  if( bOwnParaObj )
291  delete pParaObj;
292  }
293  }
294 
295  // call parent
297 
298  if( mxCell.is() )
299  mxCell->notifyModified();
300  }
301 
302  void CellProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
303  {
304  if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
305  {
306  bool bVertical(css::text::WritingMode_TB_RL == static_cast<const SvxWritingModeItem*>(pNewItem)->GetValue());
307 
309  rObj.SetVerticalWriting(bVertical);
310 
311  // Set a cell vertical property
312  OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
313 
314  const bool bOwnParaObj = pParaObj != nullptr;
315 
316  if( pParaObj == nullptr )
317  pParaObj = mxCell->GetOutlinerParaObject();
318 
319  if(pParaObj)
320  {
321  pParaObj->SetVertical(bVertical);
322 
323  if( bOwnParaObj )
324  delete pParaObj;
325  }
326  }
327 
328  if (pNewItem && (SDRATTR_TABLE_TEXT_ROTATION == nWhich))
329  {
330  const SvxTextRotateItem* pRotateItem = static_cast<const SvxTextRotateItem*>(pNewItem);
331 
332  // Set a cell vertical property
333  OutlinerParaObject* pParaObj = mxCell->CreateEditOutlinerParaObject().release();
334 
335  const bool bOwnParaObj = pParaObj != nullptr;
336 
337  if (pParaObj == nullptr)
338  pParaObj = mxCell->GetOutlinerParaObject();
339 
340  if (pParaObj)
341  {
342  if(pRotateItem->IsVertical() && pRotateItem->IsTopToBottom())
343  pParaObj->SetRotation(TextRotation::TOPTOBOTTOM);
344  else if (pRotateItem->IsVertical())
345  pParaObj->SetRotation(TextRotation::BOTTOMTOTOP);
346  else
347  pParaObj->SetRotation(TextRotation::NONE);
348 
349  if (bOwnParaObj)
350  delete pParaObj;
351  }
352 
353  // Change autogrow direction
354  SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
355 
356  // rescue object size
357  tools::Rectangle aObjectRect = rObj.GetSnapRect();
358 
359  const SfxItemSet& rSet = rObj.GetObjectItemSet();
360  bool bAutoGrowWidth = rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue();
361  bool bAutoGrowHeight = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
362 
363  // prepare ItemSet to set exchanged width and height items
364  SfxItemSet aNewSet(*rSet.GetPool(),
366 
367  aNewSet.Put(rSet);
368  aNewSet.Put(makeSdrTextAutoGrowWidthItem(bAutoGrowHeight));
369  aNewSet.Put(makeSdrTextAutoGrowHeightItem(bAutoGrowWidth));
370  rObj.SetObjectItemSet(aNewSet);
371 
372  // restore object size
373  rObj.SetSnapRect(aObjectRect);
374  }
375 
376  // call parent
377  AttributeProperties::ItemChange( nWhich, pNewItem );
378  }
379 
380 } // end of namespace sdr::properties
381 
382 namespace sdr::table {
383 
384 
385 // Cell
386 
387 
389 {
390  rtl::Reference< Cell > xCell( new Cell( rTableObj ) );
391  if( xCell->mxTable.is() )
392  {
393  Reference< XEventListener > xListener( xCell.get() );
394  xCell->mxTable->addEventListener( xListener );
395  }
396  return xCell;
397 }
398 
399 
401  SdrTableObj& rTableObj)
402 : SdrText(rTableObj)
404  ,mpPropSet( ImplGetSvxCellPropertySet() )
405  ,mpProperties( new sdr::properties::CellProperties( rTableObj, this ) )
406  ,mnCellContentType( CellContentType_EMPTY )
407  ,mfValue( 0.0 )
408  ,mnError( 0 )
409  ,mbMerged( false )
410  ,mnRowSpan( 1 )
411  ,mnColSpan( 1 )
412  ,mxTable( rTableObj.getTable() )
413 {
414  // Caution: Old SetModel() indirectly did a very necessary thing here,
415  // it created a valid SvxTextEditSource which is needed to bind contained
416  // Text to the UNO API and thus to save/load and more. Added version without
417  // model change.
418  // Also done was (not needed, for reference):
419  // SetStyleSheet( nullptr, true );
420  // ForceOutlinerParaObject( OutlinerMode::TextObject );
421  if(nullptr == GetEditSource())
422  {
424  }
425 }
426 
427 
428 Cell::~Cell() throw()
429 {
430  dispose();
431 }
432 
433 
435 {
436  if( mxTable.is() )
437  {
438  try
439  {
440  Reference< XEventListener > xThis( this );
441  mxTable->removeEventListener( xThis );
442  }
443  catch( Exception& )
444  {
445  OSL_FAIL("Cell::dispose(), exception caught!");
446  }
447  mxTable.clear();
448  }
449 
450  // tdf#118199 avoid double dispose, detect by using mpProperties
451  // as indicator. Only use SetOutlinerParaObject once
452  if( mpProperties )
453  {
454  mpProperties.reset();
455  SetOutlinerParaObject( nullptr );
456  }
457 }
458 
459 void Cell::merge( sal_Int32 nColumnSpan, sal_Int32 nRowSpan )
460 {
461  if ((mnColSpan != nColumnSpan) || (mnRowSpan != nRowSpan) || mbMerged)
462  {
463  mnColSpan = nColumnSpan;
464  mnRowSpan = nRowSpan;
465  mbMerged = false;
466  notifyModified();
467  }
468 }
469 
470 
471 void Cell::mergeContent( const CellRef& xSourceCell )
472 {
473  SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
474 
475  if( xSourceCell->hasText() )
476  {
477  SdrOutliner& rOutliner=rTableObj.ImpGetDrawOutliner();
478  rOutliner.SetUpdateMode(true);
479 
480  if( hasText() )
481  {
482  rOutliner.SetText(*GetOutlinerParaObject());
483  rOutliner.AddText(*xSourceCell->GetOutlinerParaObject());
484  }
485  else
486  {
487  rOutliner.SetText(*xSourceCell->GetOutlinerParaObject());
488  }
489 
491  rOutliner.Clear();
492  xSourceCell->SetOutlinerParaObject(rOutliner.CreateParaObject());
493  rOutliner.Clear();
494  SetStyleSheet( GetStyleSheet(), true );
495  }
496 }
497 
498 
499 void Cell::cloneFrom( const CellRef& xCell )
500 {
501  if( xCell.is() )
502  {
504 
505  mnCellContentType = xCell->mnCellContentType;
506 
507  msFormula = xCell->msFormula;
508  mfValue = xCell->mfValue;
509  mnError = xCell->mnError;
510 
511  mbMerged = xCell->mbMerged;
512  mnRowSpan = xCell->mnRowSpan;
513  mnColSpan = xCell->mnColSpan;
514 
515  }
516  notifyModified();
517 }
518 
519 void Cell::replaceContentAndFormating( const CellRef& xSourceCell )
520 {
521  if( xSourceCell.is() && mpProperties )
522  {
523  mpProperties->SetMergedItemSet( xSourceCell->GetObjectItemSet() );
524 
525  // tdf#118354 OutlinerParaObject may be nullptr, do not dereference when
526  // not set (!)
527  if(nullptr != xSourceCell->GetOutlinerParaObject())
528  {
529  SetOutlinerParaObject( std::make_unique<OutlinerParaObject>(*xSourceCell->GetOutlinerParaObject()) );
530  }
531 
532  SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
533  SdrTableObj& rSourceTableObj = dynamic_cast< SdrTableObj& >( xSourceCell->GetObject() );
534 
535  if(&rSourceTableObj.getSdrModelFromSdrObject() != &rTableObj.getSdrModelFromSdrObject())
536  {
537  // TTTT should not happen - if, then a clone may be needed
538  // Maybe add an assertion here later
539  SetStyleSheet( nullptr, true );
540  }
541  }
542 }
543 
544 
546 {
547  if( !mbMerged )
548  {
549  mbMerged = true;
550  notifyModified();
551  }
552 }
553 
554 
555 void Cell::copyFormatFrom( const CellRef& xSourceCell )
556 {
557  if( xSourceCell.is() && mpProperties )
558  {
559  mpProperties->SetMergedItemSet( xSourceCell->GetObjectItemSet() );
560  SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
561  SdrTableObj& rSourceTableObj = dynamic_cast< SdrTableObj& >( xSourceCell->GetObject() );
562 
563  if(&rSourceTableObj.getSdrModelFromSdrObject() != &rTableObj.getSdrModelFromSdrObject())
564  {
565  // TTTT should not happen - if, then a clone may be needed
566  // Maybe add an assertion here later
567  SetStyleSheet( nullptr, true );
568  }
569 
570  notifyModified();
571  }
572 }
573 
574 
576 {
577  if( mxTable.is() )
578  mxTable->setModified( true );
579 }
580 
581 
582 // SdrTextShape proxy
583 
584 
585 bool Cell::IsActiveCell() const
586 {
587  bool isActive = false;
588  SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
589  if( rTableObj.getActiveCell().get() == this )
590  isActive = true;
591 
592  return isActive;
593 }
594 
596 {
597  bool isActive = false;
598  SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
599  if(rTableObj.getActiveCell().get() == this )
600  {
601  if( rTableObj.CanCreateEditOutlinerParaObject() )
602  {
603  isActive = true;
604  }
605  }
606  return isActive;
607 }
608 
609 
610 bool Cell::hasText() const
611 {
613  if( pParaObj )
614  {
615  const EditTextObject& rTextObj = pParaObj->GetTextObject();
616  if( rTextObj.GetParagraphCount() >= 1 )
617  {
618  if( rTextObj.GetParagraphCount() == 1 )
619  {
620  if( rTextObj.GetText(0).isEmpty() )
621  return false;
622  }
623  return true;
624  }
625  }
626 
627  return false;
628 }
629 
631 {
632  SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
633  if( rTableObj.getActiveCell().get() == this )
634  return rTableObj.CanCreateEditOutlinerParaObject();
635  return false;
636 }
637 
638 std::unique_ptr<OutlinerParaObject> Cell::CreateEditOutlinerParaObject() const
639 {
640  SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
641  if( rTableObj.getActiveCell().get() == this )
642  return rTableObj.CreateEditOutlinerParaObject();
643  return nullptr;
644 }
645 
646 
647 void Cell::SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr )
648 {
649  // only allow cell styles for cells
650  if( pStyleSheet && pStyleSheet->GetFamily() != SfxStyleFamily::Frame )
651  return;
652 
653  if( mpProperties && (mpProperties->GetStyleSheet() != pStyleSheet) )
654  {
655  mpProperties->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr );
656  }
657 }
658 
659 
661 {
662  if( mpProperties )
663  {
664  return mpProperties->GetObjectItemSet();
665  }
666  else
667  {
668  OSL_FAIL("Cell::GetObjectItemSet(), called without properties!");
669  return GetObject().GetObjectItemSet();
670  }
671 }
672 
674 {
675  if( mpProperties )
676  {
677  mpProperties->SetObjectItem( rItem );
678  notifyModified();
679  }
680 }
681 
683 {
684  SetObjectItem(rItem);
685 }
686 
688 {
689  if( mpProperties )
690  return mpProperties->GetStyleSheet();
691  else
692  return nullptr;
693 }
694 
696 {
697  rAnchorRect.SetLeft( maCellRect.Left() + GetTextLeftDistance() );
698  rAnchorRect.SetRight( maCellRect.Right() - GetTextRightDistance() );
699  rAnchorRect.SetTop( maCellRect.Top() + GetTextUpperDistance() );
700  rAnchorRect.SetBottom( maCellRect.Bottom() - GetTextLowerDistance() );
701 }
702 
703 
704 void Cell::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems)
705 {
706  if( mpProperties )
707  {
708  mpProperties->SetMergedItemSetAndBroadcast(rSet, bClearAllItems);
709  notifyModified();
710  }
711 }
712 
713 
714 sal_Int32 Cell::calcPreferredWidth( const Size aSize )
715 {
716  if ( !hasText() )
717  return getMinimumWidth();
718 
719  Outliner& rOutliner=static_cast< SdrTableObj& >( GetObject() ).ImpGetDrawOutliner();
720  rOutliner.SetPaperSize(aSize);
721  rOutliner.SetUpdateMode(true);
722  ForceOutlinerParaObject( OutlinerMode::TextObject );
723 
724  if( GetOutlinerParaObject() )
725  rOutliner.SetText(*GetOutlinerParaObject());
726 
727  sal_Int32 nPreferredWidth = const_cast<EditEngine&>(rOutliner.GetEditEngine()).CalcTextWidth();
728  rOutliner.Clear();
729 
730  return GetTextLeftDistance() + GetTextRightDistance() + nPreferredWidth;
731 }
732 
733 sal_Int32 Cell::getMinimumWidth() const
734 {
735  return GetTextLeftDistance() + GetTextRightDistance() + 100;
736 }
737 
738 
740 {
741  if( !mpProperties )
742  return 0;
743 
744  SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
745  sal_Int32 nMinimumHeight = 0;
746 
747  tools::Rectangle aTextRect;
748  TakeTextAnchorRect( aTextRect );
749  Size aSize( aTextRect.GetSize() );
750  aSize.setHeight(0x0FFFFFFF );
751 
752  SdrOutliner* pEditOutliner = rTableObj.GetCellTextEditOutliner( *this );
753  if(pEditOutliner)
754  {
755  pEditOutliner->SetMaxAutoPaperSize(aSize);
756  nMinimumHeight = pEditOutliner->GetTextHeight()+1;
757  }
758  else
759  {
760  Outliner& rOutliner=rTableObj.ImpGetDrawOutliner();
761  rOutliner.SetPaperSize(aSize);
762  rOutliner.SetUpdateMode(true);
763  ForceOutlinerParaObject( OutlinerMode::TextObject );
764 
765  if( GetOutlinerParaObject() )
766  {
767  rOutliner.SetText(*GetOutlinerParaObject());
768  }
769  nMinimumHeight=rOutliner.GetTextHeight()+1;
770  rOutliner.Clear();
771  }
772 
773  nMinimumHeight += GetTextUpperDistance() + GetTextLowerDistance();
774  return nMinimumHeight;
775 }
776 
777 
779 {
780  return GetItemSet().Get(SDRATTR_TEXT_LEFTDIST).GetValue();
781 }
782 
783 
785 {
786  return GetItemSet().Get(SDRATTR_TEXT_RIGHTDIST).GetValue();
787 }
788 
789 
791 {
792  return GetItemSet().Get(SDRATTR_TEXT_UPPERDIST).GetValue();
793 }
794 
795 
797 {
798  return GetItemSet().Get(SDRATTR_TEXT_LOWERDIST).GetValue();
799 }
800 
801 
803 {
804  return GetItemSet().Get(SDRATTR_TEXT_VERTADJUST).GetValue();
805 }
806 
807 
809 {
810  return GetItemSet().Get(SDRATTR_TEXT_HORZADJUST).GetValue();
811 }
812 
813 
814 void Cell::SetOutlinerParaObject( std::unique_ptr<OutlinerParaObject> pTextObject )
815 {
816  bool bNullTextObject = pTextObject == nullptr;
817  SdrText::SetOutlinerParaObject( std::move(pTextObject) );
819 
820  if( bNullTextObject )
821  ForceOutlinerParaObject( OutlinerMode::TextObject );
822 }
823 
824 
826 {
827  SdrObject& rObj = GetObject();
828 
829  if( rObj.IsInserted() && rObj.getSdrModelFromSdrObject().IsUndoEnabled() )
830  {
831  CellRef xCell( this );
832  rObj.getSdrModelFromSdrObject().AddUndo( std::make_unique<CellUndo>( &rObj, xCell ) );
833 
834  // Undo action for the after-text-edit-ended stack.
835  SdrTableObj* pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(&rObj);
836  if (pTableObj && pTableObj->IsTextEditActive())
837  pTableObj->AddUndo(new CellUndo(pTableObj, xCell));
838  }
839 }
840 
841 
843 {
844  if( pProperties )
845  return new sdr::properties::CellProperties( *static_cast<sdr::properties::CellProperties const *>(pProperties), rNewObj, &rNewCell );
846  else
847  return nullptr;
848 }
849 
850 
852 {
853  return CloneProperties(mpProperties.get(),rNewObj,rNewCell);
854 }
855 
856 
857 // XInterface
858 
859 
860 Any SAL_CALL Cell::queryInterface( const Type & rType )
861 {
862  if( rType == cppu::UnoType<XMergeableCell>::get() )
863  return Any( Reference< XMergeableCell >( this ) );
864 
865  if( rType == cppu::UnoType<XCell>::get() )
866  return Any( Reference< XCell >( this ) );
867 
869  return Any( Reference< XLayoutConstrains >( this ) );
870 
871  if( rType == cppu::UnoType<XEventListener>::get() )
872  return Any( Reference< XEventListener >( this ) );
873 
874  Any aRet( SvxUnoTextBase::queryAggregation( rType ) );
875  if( aRet.hasValue() )
876  return aRet;
877 
878  return ::cppu::OWeakObject::queryInterface( rType );
879 }
880 
881 
882 void SAL_CALL Cell::acquire() throw ()
883 {
885 }
886 
887 
888 void SAL_CALL Cell::release() throw ()
889 {
891 }
892 
893 
894 // XTypeProvider
895 
896 
897 Sequence< Type > SAL_CALL Cell::getTypes( )
898 {
900  Sequence {
903 }
904 
905 
907 {
908  return css::uno::Sequence<sal_Int8>();
909 }
910 
911 // XLayoutConstrains
912 css::awt::Size SAL_CALL Cell::getMinimumSize()
913 {
914  return css::awt::Size( getMinimumWidth(), getMinimumHeight() );
915 }
916 
917 
918 css::awt::Size SAL_CALL Cell::getPreferredSize()
919 {
920  return getMinimumSize();
921 }
922 
923 
924 css::awt::Size SAL_CALL Cell::calcAdjustedSize( const css::awt::Size& aNewSize )
925 {
926  return aNewSize;
927 }
928 
929 
930 // XMergeableCell
931 
932 
933 sal_Int32 SAL_CALL Cell::getRowSpan()
934 {
935  return mnRowSpan;
936 }
937 
938 
939 sal_Int32 SAL_CALL Cell::getColumnSpan()
940 {
941  return mnColSpan;
942 }
943 
944 
946 {
947  return mbMerged;
948 }
949 
950 
951 // XCell
952 
953 
954 OUString SAL_CALL Cell::getFormula( )
955 {
956  return msFormula;
957 }
958 
959 
960 void SAL_CALL Cell::setFormula( const OUString& aFormula )
961 {
962  if( msFormula != aFormula )
963  {
964  msFormula = aFormula;
965  }
966 }
967 
968 
969 double SAL_CALL Cell::getValue( )
970 {
971  return mfValue;
972 }
973 
974 
975 void SAL_CALL Cell::setValue( double nValue )
976 {
977  if( mfValue != nValue )
978  {
979  mfValue = nValue;
980  mnCellContentType = CellContentType_VALUE;
981  }
982 }
983 
984 
985 CellContentType SAL_CALL Cell::getType()
986 {
987  return mnCellContentType;
988 }
989 
990 
991 sal_Int32 SAL_CALL Cell::getError( )
992 {
993  return mnError;
994 }
995 
996 
997 // XPropertySet
998 
999 
1001 {
1002  Any aAny( SvxItemPropertySet_getPropertyValue( pMap, aSet ) );
1003 
1004  if( pMap->aType != aAny.getValueType() )
1005  {
1006  // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
1007  if( ( pMap->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
1008  {
1009  sal_Int32 nValue = 0;
1010  aAny >>= nValue;
1011  aAny <<= static_cast<sal_Int16>(nValue);
1012  }
1013  else
1014  {
1015  OSL_FAIL("GetAnyForItem() Returnvalue has wrong Type!" );
1016  }
1017  }
1018 
1019  return aAny;
1020 }
1021 
1022 Reference< XPropertySetInfo > SAL_CALL Cell::getPropertySetInfo()
1023 {
1024  return mpPropSet->getPropertySetInfo();
1025 }
1026 
1027 
1028 void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
1029 {
1030  ::SolarMutexGuard aGuard;
1031 
1032  if(mpProperties == nullptr)
1033  throw DisposedException();
1034 
1035  const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
1036  if( pMap )
1037  {
1038  if( (pMap->nFlags & PropertyAttribute::READONLY ) != 0 )
1039  throw PropertyVetoException();
1040 
1041  switch( pMap->nWID )
1042  {
1043  case OWN_ATTR_STYLE:
1044  {
1045  Reference< XStyle > xStyle;
1046  if( !( rValue >>= xStyle ) )
1047  throw IllegalArgumentException();
1048 
1050  SetStyleSheet( pStyle, true );
1051  return;
1052  }
1053  case OWN_ATTR_TABLEBORDER:
1054  {
1055  auto pBorder = o3tl::tryAccess<TableBorder>(rValue);
1056  if(!pBorder)
1057  break;
1058 
1061  SvxBorderLine aLine;
1062 
1063  bool bSet = SvxBoxItem::LineToSvxLine(pBorder->TopLine, aLine, false);
1064  aBox.SetLine(bSet ? &aLine : nullptr, SvxBoxItemLine::TOP);
1065  aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::TOP, pBorder->IsTopLineValid);
1066 
1067  bSet = SvxBoxItem::LineToSvxLine(pBorder->BottomLine, aLine, false);
1068  aBox.SetLine(bSet ? &aLine : nullptr, SvxBoxItemLine::BOTTOM);
1069  aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::BOTTOM, pBorder->IsBottomLineValid);
1070 
1071  bSet = SvxBoxItem::LineToSvxLine(pBorder->LeftLine, aLine, false);
1072  aBox.SetLine(bSet ? &aLine : nullptr, SvxBoxItemLine::LEFT);
1073  aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::LEFT, pBorder->IsLeftLineValid);
1074 
1075  bSet = SvxBoxItem::LineToSvxLine(pBorder->RightLine, aLine, false);
1076  aBox.SetLine(bSet ? &aLine : nullptr, SvxBoxItemLine::RIGHT);
1077  aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::RIGHT, pBorder->IsRightLineValid);
1078 
1079  bSet = SvxBoxItem::LineToSvxLine(pBorder->HorizontalLine, aLine, false);
1080  aBoxInfo.SetLine(bSet ? &aLine : nullptr, SvxBoxInfoItemLine::HORI);
1081  aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::HORI, pBorder->IsHorizontalLineValid);
1082 
1083  bSet = SvxBoxItem::LineToSvxLine(pBorder->VerticalLine, aLine, false);
1084  aBoxInfo.SetLine(bSet ? &aLine : nullptr, SvxBoxInfoItemLine::VERT);
1085  aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT, pBorder->IsVerticalLineValid);
1086 
1087  aBox.SetAllDistances(pBorder->Distance); //TODO
1088  aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::DISTANCE, pBorder->IsDistanceValid);
1089 
1090  mpProperties->SetObjectItem(aBox);
1091  mpProperties->SetObjectItem(aBoxInfo);
1092  return;
1093  }
1094  case OWN_ATTR_FILLBMP_MODE:
1095  {
1096  BitmapMode eMode;
1097  if(!(rValue >>= eMode) )
1098  {
1099  sal_Int32 nMode = 0;
1100  if(!(rValue >>= nMode))
1101  throw IllegalArgumentException();
1102 
1103  eMode = static_cast<BitmapMode>(nMode);
1104  }
1105 
1106  mpProperties->SetObjectItem( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
1107  mpProperties->SetObjectItem( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
1108  return;
1109  }
1111  {
1112  sal_Int32 nRotVal = 0;
1113  if (!(rValue >>= nRotVal))
1114  throw IllegalArgumentException();
1115 
1116  if (nRotVal != 27000 && nRotVal != 9000 && nRotVal != 0)
1117  throw IllegalArgumentException();
1118 
1119  mpProperties->SetObjectItem(SvxTextRotateItem(nRotVal/10, SDRATTR_TABLE_TEXT_ROTATION));
1120  return;
1121  }
1122  default:
1123  {
1124  SfxItemSet aSet(GetObject().getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}});
1125  aSet.Put(mpProperties->GetItem(pMap->nWID));
1126 
1127  bool bSpecial = false;
1128 
1129  switch( pMap->nWID )
1130  {
1131  case XATTR_FILLBITMAP:
1132  case XATTR_FILLGRADIENT:
1133  case XATTR_FILLHATCH:
1135  case XATTR_LINEEND:
1136  case XATTR_LINESTART:
1137  case XATTR_LINEDASH:
1138  {
1139  if( pMap->nMemberId == MID_NAME )
1140  {
1141  OUString aApiName;
1142  if( rValue >>= aApiName )
1143  {
1144  if(SvxShape::SetFillAttribute(pMap->nWID, aApiName, aSet, &GetObject().getSdrModelFromSdrObject()))
1145  bSpecial = true;
1146  }
1147  }
1148  }
1149  break;
1150  }
1151 
1152  if( !bSpecial )
1153  {
1154 
1155  if( !SvxUnoTextRangeBase::SetPropertyValueHelper( pMap, rValue, aSet ))
1156  {
1157  if( aSet.GetItemState( pMap->nWID ) != SfxItemState::SET )
1158  {
1159  // fetch the default from ItemPool
1160  if(SfxItemPool::IsWhich(pMap->nWID))
1161  aSet.Put(GetObject().getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
1162  }
1163 
1164  if( aSet.GetItemState( pMap->nWID ) == SfxItemState::SET )
1165  {
1166  SvxItemPropertySet_setPropertyValue( pMap, rValue, aSet );
1167  }
1168  }
1169  }
1170 
1172  mpProperties->SetMergedItemSetAndBroadcast( aSet );
1173  return;
1174  }
1175  }
1176  }
1177  throw UnknownPropertyException( rPropertyName, static_cast<cppu::OWeakObject*>(this));
1178 }
1179 
1180 
1181 Any SAL_CALL Cell::getPropertyValue( const OUString& PropertyName )
1182 {
1183  ::SolarMutexGuard aGuard;
1184 
1185  if(mpProperties == nullptr)
1186  throw DisposedException();
1187 
1188  const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1189  if( pMap )
1190  {
1191  switch( pMap->nWID )
1192  {
1193  case OWN_ATTR_STYLE:
1194  {
1195  return Any( Reference< XStyle >( dynamic_cast< SfxUnoStyleSheet* >( GetStyleSheet() ) ) );
1196  }
1197  case OWN_ATTR_TABLEBORDER:
1198  {
1200  const SvxBoxItem& rBox = mpProperties->GetItem(SDRATTR_TABLE_BORDER);
1201 
1202  TableBorder aTableBorder;
1203  aTableBorder.TopLine = SvxBoxItem::SvxLineToLine(rBox.GetTop(), false);
1204  aTableBorder.IsTopLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::TOP);
1205  aTableBorder.BottomLine = SvxBoxItem::SvxLineToLine(rBox.GetBottom(), false);
1206  aTableBorder.IsBottomLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::BOTTOM);
1207  aTableBorder.LeftLine = SvxBoxItem::SvxLineToLine(rBox.GetLeft(), false);
1208  aTableBorder.IsLeftLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::LEFT);
1209  aTableBorder.RightLine = SvxBoxItem::SvxLineToLine(rBox.GetRight(), false);
1210  aTableBorder.IsRightLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::RIGHT );
1211  aTableBorder.HorizontalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetHori(), false);
1212  aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::HORI);
1213  aTableBorder.VerticalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), false);
1214  aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::VERT);
1215  aTableBorder.Distance = rBox.GetSmallestDistance();
1216  aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::DISTANCE);
1217 
1218  return Any( aTableBorder );
1219  }
1220  case OWN_ATTR_FILLBMP_MODE:
1221  {
1222  const XFillBmpStretchItem& rStretchItem = mpProperties->GetItem(XATTR_FILLBMP_STRETCH);
1223  const XFillBmpTileItem& rTileItem = mpProperties->GetItem(XATTR_FILLBMP_TILE);
1224  if( rTileItem.GetValue() )
1225  {
1226  return Any( BitmapMode_REPEAT );
1227  }
1228  else if( rStretchItem.GetValue() )
1229  {
1230  return Any( BitmapMode_STRETCH );
1231  }
1232  else
1233  {
1234  return Any( BitmapMode_NO_REPEAT );
1235  }
1236  }
1238  {
1239  const SvxTextRotateItem& rTextRotate = mpProperties->GetItem(SDRATTR_TABLE_TEXT_ROTATION);
1240  return Any(sal_Int32(rTextRotate.GetValue() * 10));
1241  }
1242  default:
1243  {
1244  SfxItemSet aSet(GetObject().getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}});
1245  aSet.Put(mpProperties->GetItem(pMap->nWID));
1246 
1247  Any aAny;
1248  if(!SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny ))
1249  {
1250  if(!aSet.Count())
1251  {
1252  // fetch the default from ItemPool
1253  if(SfxItemPool::IsWhich(pMap->nWID))
1254  aSet.Put(GetObject().getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
1255  }
1256 
1257  if( aSet.Count() )
1258  aAny = GetAnyForItem( aSet, pMap );
1259  }
1260 
1261  return aAny;
1262  }
1263  }
1264  }
1265  throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
1266 }
1267 
1268 
1269 void SAL_CALL Cell::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ )
1270 {
1271 }
1272 
1273 
1274 void SAL_CALL Cell::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*aListener*/ )
1275 {
1276 }
1277 
1278 
1279 void SAL_CALL Cell::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ )
1280 {
1281 }
1282 
1283 
1284 void SAL_CALL Cell::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ )
1285 {
1286 }
1287 
1288 
1289 // XMultiPropertySet
1290 
1291 
1292 void SAL_CALL Cell::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues )
1293 {
1294  ::SolarMutexGuard aSolarGuard;
1295 
1296  if(mpProperties == nullptr)
1297  throw DisposedException();
1298 
1299  const sal_Int32 nCount = aPropertyNames.getLength();
1300 
1301  const OUString* pNames = aPropertyNames.getConstArray();
1302  const Any* pValues = aValues.getConstArray();
1303 
1304  for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1305  {
1306  try
1307  {
1308  setPropertyValue( *pNames, *pValues );
1309  }
1310  catch( UnknownPropertyException& )
1311  {
1312  OSL_FAIL("svx::Cell::setPropertyValues(), unknown property!" );
1313  }
1314  catch( Exception& )
1315  {
1316  OSL_FAIL("svx::Cell::setPropertyValues(), Exception caught!" );
1317  }
1318  }
1319 }
1320 
1321 
1322 Sequence< Any > SAL_CALL Cell::getPropertyValues( const Sequence< OUString >& aPropertyNames )
1323 {
1324  ::SolarMutexGuard aSolarGuard;
1325 
1326  if(mpProperties == nullptr)
1327  throw DisposedException();
1328 
1329  const sal_Int32 nCount = aPropertyNames.getLength();
1330  Sequence< Any > aRet( nCount );
1331  Any* pValue = aRet.getArray();
1332 
1333  for( const OUString& rName : aPropertyNames )
1334  {
1335  try
1336  {
1337  *pValue = getPropertyValue( rName );
1338  }
1339  catch( UnknownPropertyException& )
1340  {
1341  OSL_FAIL("svx::Cell::setPropertyValues(), unknown property!" );
1342  }
1343  catch( Exception& )
1344  {
1345  OSL_FAIL( "svx::Cell::getPropertyValues(), Exception caught!" );
1346  }
1347  pValue++;
1348  }
1349 
1350  return aRet;
1351 }
1352 
1353 
1354 void SAL_CALL Cell::addPropertiesChangeListener( const Sequence< OUString >& /*aPropertyNames*/, const Reference< XPropertiesChangeListener >& /*xListener*/ )
1355 {
1356 }
1357 
1358 
1359 void SAL_CALL Cell::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& /*xListener*/ )
1360 {
1361 }
1362 
1363 
1364 void SAL_CALL Cell::firePropertiesChangeEvent( const Sequence< OUString >& /*aPropertyNames*/, const Reference< XPropertiesChangeListener >& /*xListener*/ )
1365 {
1366 }
1367 
1368 
1369 // XPropertyState
1370 
1371 
1372 PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName )
1373 {
1374  ::SolarMutexGuard aGuard;
1375 
1376  if(mpProperties == nullptr)
1377  throw DisposedException();
1378 
1379  const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1380 
1381  if( pMap )
1382  {
1383  PropertyState eState;
1384  switch( pMap->nWID )
1385  {
1386  case OWN_ATTR_FILLBMP_MODE:
1387  {
1388  const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
1389 
1390  const bool bStretch = rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET;
1391  const bool bTile = rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET;
1392  if( bStretch || bTile )
1393  {
1394  eState = PropertyState_DIRECT_VALUE;
1395  }
1396  else
1397  {
1398  eState = PropertyState_DEFAULT_VALUE;
1399  }
1400  break;
1401  }
1402  case OWN_ATTR_STYLE:
1403  {
1404  return PropertyState_DIRECT_VALUE;
1405  }
1406  case OWN_ATTR_TABLEBORDER:
1407  {
1408  const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
1409  if( (rSet.GetItemState( SDRATTR_TABLE_BORDER_INNER, false ) == SfxItemState::DEFAULT) && (rSet.GetItemState( SDRATTR_TABLE_BORDER, false ) == SfxItemState::DEFAULT) )
1410  return PropertyState_DEFAULT_VALUE;
1411 
1412  return PropertyState_DIRECT_VALUE;
1413  }
1414  default:
1415  {
1416  const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
1417 
1418  switch( rSet.GetItemState( pMap->nWID, false ) )
1419  {
1420  case SfxItemState::READONLY:
1421  case SfxItemState::SET:
1422  eState = PropertyState_DIRECT_VALUE;
1423  break;
1424  case SfxItemState::DEFAULT:
1425  eState = PropertyState_DEFAULT_VALUE;
1426  break;
1427  default:
1428  eState = PropertyState_AMBIGUOUS_VALUE;
1429  break;
1430  }
1431 
1432  // if an item is set, this doesn't mean we want it :)
1433  if( PropertyState_DIRECT_VALUE == eState )
1434  {
1435  switch( pMap->nWID )
1436  {
1437  // the following items are disabled by changing the
1438  // fill style or the line style. so there is no need
1439  // to export items without names which should be empty
1440  case XATTR_FILLBITMAP:
1441  case XATTR_FILLGRADIENT:
1442  case XATTR_FILLHATCH:
1443  case XATTR_LINEDASH:
1444  {
1445  const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
1446  if( ( pItem == nullptr ) || pItem->GetName().isEmpty() )
1447  eState = PropertyState_DEFAULT_VALUE;
1448  }
1449  break;
1450 
1451  // #i36115#
1452  // If e.g. the LineStart is on NONE and thus the string has length 0, it still
1453  // may be a hard attribute covering the set LineStart of the parent (Style).
1454  // #i37644#
1455  // same is for fill float transparency
1456  case XATTR_LINEEND:
1457  case XATTR_LINESTART:
1459  {
1460  const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
1461  if( pItem == nullptr )
1462  eState = PropertyState_DEFAULT_VALUE;
1463  }
1464  break;
1465  }
1466  }
1467  }
1468  }
1469  return eState;
1470  }
1471  throw UnknownPropertyException(PropertyName);
1472 }
1473 
1474 
1475 Sequence< PropertyState > SAL_CALL Cell::getPropertyStates( const Sequence< OUString >& aPropertyName )
1476 {
1477  ::SolarMutexGuard aGuard;
1478 
1479  if(mpProperties == nullptr)
1480  throw DisposedException();
1481 
1482  const sal_Int32 nCount = aPropertyName.getLength();
1483  Sequence< PropertyState > aRet( nCount );
1484 
1485  std::transform(aPropertyName.begin(), aPropertyName.end(), aRet.begin(),
1486  [this](const OUString& rName) -> PropertyState {
1487  try
1488  {
1489  return getPropertyState( rName );
1490  }
1491  catch( Exception& )
1492  {
1493  return PropertyState_AMBIGUOUS_VALUE;
1494  }
1495  });
1496 
1497  return aRet;
1498 }
1499 
1500 
1501 void SAL_CALL Cell::setPropertyToDefault( const OUString& PropertyName )
1502 {
1503  ::SolarMutexGuard aGuard;
1504 
1505  if(mpProperties == nullptr)
1506  throw DisposedException();
1507 
1508  const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1509  if( pMap )
1510  {
1511  switch( pMap->nWID )
1512  {
1513  case OWN_ATTR_FILLBMP_MODE:
1514  {
1515  mpProperties->ClearObjectItem( XATTR_FILLBMP_STRETCH );
1516  mpProperties->ClearObjectItem( XATTR_FILLBMP_TILE );
1517  break;
1518  }
1519  case OWN_ATTR_STYLE:
1520  break;
1521 
1522  case OWN_ATTR_TABLEBORDER:
1523  {
1524  mpProperties->ClearObjectItem( SDRATTR_TABLE_BORDER_INNER );
1525  mpProperties->ClearObjectItem( SDRATTR_TABLE_BORDER );
1526  break;
1527  }
1528 
1529  default:
1530  {
1531  mpProperties->ClearObjectItem( pMap->nWID );
1532  }
1533  }
1534 
1536  return;
1537  }
1538  throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
1539 }
1540 
1541 
1542 Any SAL_CALL Cell::getPropertyDefault( const OUString& aPropertyName )
1543 {
1544  ::SolarMutexGuard aGuard;
1545 
1546  if(mpProperties == nullptr)
1547  throw DisposedException();
1548 
1549  const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
1550  if( pMap )
1551  {
1552  switch( pMap->nWID )
1553  {
1554  case OWN_ATTR_FILLBMP_MODE:
1555  return Any( BitmapMode_NO_REPEAT );
1556 
1557  case OWN_ATTR_STYLE:
1558  {
1559  Reference< XStyle > xStyle;
1560  return Any( xStyle );
1561  }
1562 
1563  case OWN_ATTR_TABLEBORDER:
1564  {
1565  TableBorder aBorder;
1566  return Any( aBorder );
1567  }
1568 
1569  default:
1570  {
1571  if( SfxItemPool::IsWhich(pMap->nWID) )
1572  {
1573  SfxItemSet aSet(GetObject().getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}});
1574  aSet.Put(GetObject().getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
1575  return GetAnyForItem( aSet, pMap );
1576  }
1577  }
1578  }
1579  }
1580  throw UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
1581 }
1582 
1583 
1584 // XMultiPropertyStates
1585 
1586 
1588 {
1589  mpProperties.reset(new sdr::properties::CellProperties( static_cast< SdrTableObj& >( GetObject() ), this ));
1590 
1591  SdrOutliner& rOutliner = GetObject().ImpGetDrawOutliner();
1592 
1594  if( pParaObj )
1595  {
1596  rOutliner.SetText(*pParaObj);
1597  sal_Int32 nParaCount(rOutliner.GetParagraphCount());
1598 
1599  if(nParaCount)
1600  {
1601  ESelection aSelection( 0, 0, EE_PARA_ALL, EE_TEXTPOS_ALL);
1602  rOutliner.RemoveAttribs(aSelection, true, 0);
1603 
1604  std::unique_ptr<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
1605  rOutliner.Clear();
1606 
1607  SetOutlinerParaObject(std::move(pTemp));
1608  }
1609  }
1610 }
1611 
1612 
1613 void SAL_CALL Cell::setPropertiesToDefault( const Sequence< OUString >& aPropertyNames )
1614 {
1615  for(const OUString& rName : aPropertyNames)
1616  setPropertyToDefault( rName );
1617 }
1618 
1619 
1620 Sequence< Any > SAL_CALL Cell::getPropertyDefaults( const Sequence< OUString >& aPropertyNames )
1621 {
1622  sal_Int32 nCount = aPropertyNames.getLength();
1623  Sequence< Any > aDefaults( nCount );
1624 
1625  std::transform(aPropertyNames.begin(), aPropertyNames.end(), aDefaults.begin(),
1626  [this](const OUString& rName) -> Any { return getPropertyDefault(rName); });
1627 
1628  return aDefaults;
1629 }
1630 
1631 
1632 // XText
1633 
1634 
1635 void SAL_CALL Cell::insertTextContent( const Reference< XTextRange >& xRange, const Reference< XTextContent >& xContent, sal_Bool bAbsorb )
1636 {
1637  SvxUnoTextBase::insertTextContent( xRange, xContent, bAbsorb );
1638  notifyModified();
1639 }
1640 
1641 
1642 void SAL_CALL Cell::removeTextContent( const Reference< XTextContent >& xContent )
1643 {
1645  notifyModified();
1646 }
1647 
1648 
1649 // XSimpleText
1650 
1651 
1652 void SAL_CALL Cell::insertString( const Reference< XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb )
1653 {
1654  SvxUnoTextBase::insertString( xRange, aString, bAbsorb );
1655  notifyModified();
1656 }
1657 
1658 
1659 void SAL_CALL Cell::insertControlCharacter( const Reference< XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb )
1660 {
1661  SvxUnoTextBase::insertControlCharacter( xRange, nControlCharacter, bAbsorb );
1662  notifyModified();
1663 }
1664 
1665 
1666 // XTextRange
1667 
1668 
1669 OUString SAL_CALL Cell::getString( )
1670 {
1672  return SvxUnoTextBase::getString();
1673 }
1674 
1675 
1676 void SAL_CALL Cell::setString( const OUString& aString )
1677 {
1678  SvxUnoTextBase::setString( aString );
1679  notifyModified();
1680 }
1681 
1682 // XEventListener
1683 void SAL_CALL Cell::disposing( const EventObject& /*Source*/ )
1684 {
1685  mxTable.clear();
1686  dispose();
1687 }
1688 
1689 void Cell::dumpAsXml(xmlTextWriterPtr pWriter, sal_Int32 nRow, sal_Int32 nCol) const
1690 {
1691  xmlTextWriterStartElement(pWriter, BAD_CAST("Cell"));
1692  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("row"), "%" SAL_PRIdINT32, nRow);
1693  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("col"), "%" SAL_PRIdINT32, nCol);
1694  SdrText::dumpAsXml(pWriter);
1695  //SvxUnoTextBase::dumpAsXml(pWriter);
1696  //mpPropSet->dumpAsXml(pWriter);
1697  mpProperties->dumpAsXml(pWriter);
1698  xmlTextWriterEndElement(pWriter);
1699 }
1700 
1701 }
1702 
1703 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GetValue() const
virtual SVX_DLLPRIVATE void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: cell.cxx:1359
virtual SVX_DLLPRIVATE void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: cell.cxx:1274
Type
static SVX_DLLPRIVATE css::uno::Any GetAnyForItem(SfxItemSet const &aSet, const SfxItemPropertySimpleEntry *pMap)
Definition: cell.cxx:1000
virtual SVX_DLLPRIVATE css::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId() override
Definition: cell.cxx:906
virtual SVX_DLLPRIVATE css::table::CellContentType SAL_CALL getType() override
Definition: cell.cxx:985
#define UNO_NAME_TEXT_WORDWRAP
#define EE_ITEMS_START
static css::table::BorderLine2 SvxLineToLine(const editeng::SvxBorderLine *pLine, bool bConvert)
virtual SVX_DLLPRIVATE double SAL_CALL getValue() override
Definition: cell.cxx:969
sal_Int32 nStartPara
#define XATTR_FILLHATCH
Definition: xdef.hxx:110
const SfxItemSet & GetItemSet() const
Definition: svdtext.cxx:69
virtual SVX_DLLPRIVATE css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: cell.cxx:897
virtual SVX_DLLPRIVATE css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: cell.cxx:1022
#define SDRATTR_TEXT_WORDWRAP
Definition: svddef.hxx:218
SVX_DLLPRIVATE void SetObjectItem(const SfxPoolItem &rItem)
Definition: cell.cxx:673
struct _xmlTextWriter * xmlTextWriterPtr
SVX_DLLPRIVATE long GetTextLowerDistance() const
Definition: cell.cxx:796
#define SDRATTR_TABLE_BORDER
Definition: svddef.hxx:399
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
#define UNO_NAME_TEXT_RIGHTDIST
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
virtual SVX_DLLPRIVATE void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: cell.cxx:1501
::sal_Int32 mnError
Definition: cell.hxx:208
virtual SVX_DLLPRIVATE css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: cell.cxx:1322
std::string GetValue
#define MID_NAME
virtual SVX_DLLPRIVATE void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange,::sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: cell.cxx:1659
void SetPaperSize(const Size &rSize)
#define SDRATTR_TABLE_TEXT_ROTATION
Definition: svddef.hxx:403
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
virtual SVX_DLLPRIVATE void SAL_CALL setFormula(const OUString &aFormula) override
Definition: cell.cxx:960
SVX_DLLPRIVATE void notifyModified()
Definition: cell.cxx:575
const editeng::SvxBorderLine * GetVert() const
#define UNO_NAME_TEXT_LOWERDIST
#define XATTR_FILLGRADIENT
Definition: xdef.hxx:109
SvxBoxInfoItem & rBoxInfoItem
bool IsInserted() const
Definition: svdobj.hxx:792
virtual SVX_DLLPRIVATE void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: cell.cxx:1364
sdr::table::CellRef mxCell
Definition: cell.cxx:174
#define XATTR_FILLFLOATTRANSPARENCE
Definition: xdef.hxx:118
SdrOutliner * GetCellTextEditOutliner(const sdr::table::Cell &rCell) const
Definition: svdotable.cxx:1383
virtual SVX_DLLPRIVATE const SfxItemSet & GetObjectItemSet() override
Definition: cell.cxx:660
virtual SVX_DLLPRIVATE sal_Int32 SAL_CALL getError() override
Definition: cell.cxx:991
#define SVX_UNOEDIT_OUTLINER_PROPERTIES
sal_Int32 GetParagraphCount() const
virtual const SfxItemSet & GetObjectItemSet() const override
#define SDRATTR_MISC_LAST
Definition: svddef.hxx:220
virtual void SAL_CALL setString(const OUString &aString) override
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
virtual SVX_DLLPRIVATE SfxStyleSheet * GetStyleSheet() const override
Definition: cell.cxx:687
#define UNO_NAME_TEXT_UPPERDIST
const editeng::SvxBorderLine * GetRight() const
SfxStyleFamily GetFamily() const
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:91
::sal_Int32 mnRowSpan
Definition: cell.hxx:210
virtual sal_Int32 getTextCount() const =0
Return the number of texts available for this object.
#define OWN_ATTR_FILLBMP_MODE
Definition: unoshprp.hxx:113
SVX_DLLPRIVATE void dispose()
Definition: cell.cxx:434
std::unique_ptr< SfxItemSet > mpItemSet
const svx::ITextProvider & getTextProvider() const override
Get the TextProvider related to our SdrObject.
Definition: cell.cxx:197
SVX_DLLPRIVATE sal_Int32 calcPreferredWidth(const Size aSize)
Definition: cell.cxx:714
#define LEFT_BORDER
#define XATTR_FILLBMP_STRETCH
Definition: xdef.hxx:123
virtual SVX_DLLPRIVATE::sal_Int32 SAL_CALL getRowSpan() override
Definition: cell.cxx:933
std::unique_ptr< SfxItemSet > CreateObjectSpecificItemSet(SfxItemPool &rPool) override
Definition: cell.cxx:181
OUString msFormula
Definition: cell.hxx:206
bool IsTextEditActive() const
Definition: cell.cxx:595
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
Definition: sdtagitm.hxx:25
virtual SVX_DLLPRIVATE void SAL_CALL release() override
Definition: cell.cxx:888
SVX_DLLPRIVATE void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: cell.cxx:647
SVX_DLLPRIVATE void cloneFrom(const CellRef &rCell)
Definition: cell.cxx:499
#define SDRATTR_TABLE_BORDER_INNER
Definition: svddef.hxx:400
long Right() const
virtual SVX_DLLPRIVATE void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: cell.cxx:1354
sal_Int32 mnColSpan
virtual void SAL_CALL acquire() SAL_OVERRIDE
#define SDRATTR_SHADOW_LAST
Definition: svddef.hxx:178
#define OWN_ATTR_TABLEBORDER
Definition: unoshprp.hxx:144
virtual SVX_DLLPRIVATE void SAL_CALL setAllPropertiesToDefault() override
Definition: cell.cxx:1587
virtual SVX_DLLPRIVATE css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: cell.cxx:1372
virtual SVX_DLLPRIVATE css::uno::Any SAL_CALL queryInterface(const css::uno::Type &Type) override
Definition: cell.cxx:860
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdmodel.cxx:559
int nCount
sal_Int16 const nValue
Definition: fmsrccfg.cxx:82
void dumpAsXml(xmlTextWriterPtr pWriter, sal_Int32 nRow, sal_Int32 nCol) const
Definition: cell.cxx:1689
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1903
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &rType)
void RemoveCharAttribs(sal_Int32 nPara, sal_uInt16 nWhich=0)
This interface provides access to text object(s) in an SdrObject.
SVX_DLLPRIVATE void setMerged()
Definition: cell.cxx:545
Mode eMode
virtual SVX_DLLPRIVATE css::awt::Size SAL_CALL calcAdjustedSize(const css::awt::Size &aNewSize) override
Definition: cell.cxx:924
long Top() const
void SetAllDistances(sal_uInt16 nNew)
SfxItemSet const & GetParaAttribs(sal_Int32 nPara)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
Definition: sdtagitm.hxx:29
virtual SVX_DLLPRIVATE void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: cell.cxx:1279
#define UNO_NAME_TEXT_WRITINGMODE
SVX_DLLPRIVATE SdrOutliner * GetTextEditOutliner() const
Definition: svdotext.hxx:157
virtual void SetChanged(bool bFlg=true)
Definition: svdmodel.cxx:1274
virtual SVX_DLLPRIVATE void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: cell.cxx:1683
void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &)
static bool GetPropertyValueHelper(SfxItemSet const &rSet, const SfxItemPropertySimpleEntry *pMap, css::uno::Any &aAny, const ESelection *pSelection=nullptr, SvxEditSource *pEditSource=nullptr)
OUString GetText(sal_Int32 nPara) const
SdrTextHorzAdjust GetTextHorizontalAdjust() const
Definition: cell.cxx:808
bool IsActiveCell() const
Definition: cell.cxx:585
void SetRotation(TextRotation nRotation)
void RemoveAttribs(const ESelection &rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich)
std::unique_ptr< BaseProperties > Clone(SdrObject &rObj) const override
Definition: cell.cxx:216
std::unique_ptr< OutlinerParaObject > CreateEditOutlinerParaObject() const
Definition: svdotext.cxx:817
void ItemSetChanged(const SfxItemSet &rSet) override
Definition: cell.cxx:226
const editeng::SvxBorderLine * GetHori() const
#define SDRATTR_TEXT_HORZADJUST
Definition: svddef.hxx:207
const editeng::SvxBorderLine * GetTop() const
std::vector< sal_uInt16 > GetAllCharPropIds(const SfxItemSet &rSet)
Definition: svdedtv1.cxx:1033
const EditTextObject & GetTextObject() const
SVX_DLLPRIVATE sal_Int32 getMinimumWidth() const
Definition: cell.cxx:733
void SetTop(long v)
SVX_DLLPRIVATE void mergeContent(const CellRef &xSourceCell)
Definition: cell.cxx:471
void SetText(const OutlinerParaObject &)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const editeng::SvxBorderLine * GetLeft() const
#define EE_PARA_ALL
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
Definition: svdmodel.cxx:590
void SetVertical(bool bNew)
virtual SVX_DLLPRIVATE css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: cell.cxx:1475
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
#define SDRATTR_TEXT_VERTADJUST
Definition: svddef.hxx:202
#define SDRATTR_TABLE_FIRST
Definition: svddef.hxx:398
SdrTextObj & GetObject() const
Definition: svdtext.hxx:64
virtual SVX_DLLPRIVATE void SAL_CALL setPropertiesToDefault(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: cell.cxx:1613
virtual SVX_DLLPRIVATE::sal_Int32 SAL_CALL getColumnSpan() override
Definition: cell.cxx:939
#define TOP_BORDER
virtual SVX_DLLPRIVATE void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: cell.cxx:1284
#define SDRATTR_MISC_FIRST
Definition: svddef.hxx:193
void SetRight(long v)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
const SfxItemPropertySimpleEntry * getPropertyMapEntry(const OUString &rName) const
unsigned char sal_Bool
static SVX_DLLPRIVATE rtl::Reference< Cell > create(SdrTableObj &rTableObj)
Definition: cell.cxx:388
long Bottom() const
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:297
void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem *pNewItem=nullptr) override
Definition: cell.cxx:302
#define SDRATTR_TEXTDIRECTION
Definition: svddef.hxx:302
virtual SVX_DLLPRIVATE OUString SAL_CALL getString() override
Definition: cell.cxx:1669
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
css::uno::Type const & get()
virtual SVX_DLLPRIVATE css::awt::Size SAL_CALL getMinimumSize() override
Definition: cell.cxx:912
#define SDRATTR_START
Definition: svddef.hxx:168
CellProperties(SdrObject &rObj, sdr::table::Cell *pCell)
Definition: cell.cxx:202
double mfValue
Definition: cell.hxx:207
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
Abstract DrawObject.
Definition: svdobj.hxx:312
SfxItemPool * GetPool() const
void ForceOutlinerParaObject(OutlinerMode nOutlMode)
Definition: svdtext.cxx:112
#define XATTR_LINEDASH
Definition: xdef.hxx:91
const EditEngine & GetEditEngine() const
SVX_DLLPRIVATE long GetTextRightDistance() const
Definition: cell.cxx:784
Size GetSize() const
virtual SVX_DLLPRIVATE void SAL_CALL setString(const OUString &aString) override
Definition: cell.cxx:1676
virtual void ItemSetChanged(const SfxItemSet &rSet) override
bool IsValid(SvxBoxInfoItemValidFlags nValid) const
#define SDRATTR_TEXT_UPPERDIST
Definition: svddef.hxx:200
virtual SVX_DLLPRIVATE void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: cell.cxx:1642
bool CanCreateEditOutlinerParaObject() const
Definition: svdotext.cxx:808
virtual SVX_DLLPRIVATE void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
Definition: cell.cxx:1635
static SfxUnoStyleSheet * getUnoStyleSheet(const css::uno::Reference< css::style::XStyle > &xStyle)
sal_Int32 GetParagraphCount() const
void SetEditSource(SvxEditSource *_pEditSource)
virtual SVX_DLLPRIVATE void SetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject) override
Definition: cell.cxx:814
void SetMergedItem(const SfxPoolItem &rItem)
Definition: cell.cxx:682
const PropertyValue * pValues
#define SDRATTR_TEXT_RIGHTDIST
Definition: svddef.hxx:199
void AddUndo(SdrUndoAction *pUndo)
Add an undo action that should be on the undo stack after ending text edit.
Definition: svdotable.cxx:2063
SVX_DLLPRIVATE void replaceContentAndFormating(const CellRef &xSourceCell)
Definition: cell.cxx:519
static const SvxItemPropertySet * ImplGetSvxCellPropertySet()
Definition: cell.cxx:74
std::unique_ptr< OutlinerParaObject > CreateParaObject(sal_Int32 nStartPara=0, sal_Int32 nParaCount=EE_PARA_ALL) const
#define XATTR_FILLBMP_TILE
Definition: xdef.hxx:114
bool IsTextEditActive() const
Definition: svdotable.hxx:179
SVX_DLLPRIVATE void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems)
Definition: cell.cxx:704
virtual SVX_DLLPRIVATE void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: cell.cxx:1269
virtual SVX_DLLPRIVATE void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
Definition: cell.cxx:1292
void SetMaxAutoPaperSize(const Size &rSz)
sal_Int32 mnRowSpan
#define BOTTOM_BORDER
bool CanCreateEditOutlinerParaObject() const
Definition: cell.cxx:630
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
static SdrItemPool & GetGlobalDrawObjectItemPool()
Definition: svdobj.cxx:502
SVX_DLLPRIVATE void TakeTextAnchorRect(tools::Rectangle &rAnchorRect) const
Definition: cell.cxx:695
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual OUString SAL_CALL getString() override
void SetObjectItemSet(const SfxItemSet &rSet)
Definition: svdobj.cxx:1928
void SvxItemPropertySet_setPropertyValue(const SfxItemPropertySimpleEntry *pMap, const uno::Any &rVal, SfxItemSet &rSet)
Definition: unoshape.cxx:3985
#define UNO_NAME_TEXT_LEFTDIST
static bool SetPropertyValueHelper(const SfxItemPropertySimpleEntry *pMap, const css::uno::Any &aValue, SfxItemSet &rNewSet, const ESelection *pSelection=nullptr, SvxEditSource *pEditSource=nullptr)
#define XATTR_LINEEND
Definition: xdef.hxx:95
SVX_DLLPRIVATE SdrTextVertAdjust GetTextVerticalAdjust() const
Definition: cell.cxx:802
#define SVX_UNOEDIT_PARA_PROPERTIES
css::table::CellContentType mnCellContentType
Definition: cell.hxx:204
::sal_Int32 mnColSpan
Definition: cell.hxx:211
bool isActive()
virtual void SetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject)
Definition: svdtext.cxx:74
SVX_DLLPRIVATE bool hasText() const
Definition: cell.cxx:610
#define SDRATTR_TEXT_AUTOGROWWIDTH
Definition: svddef.hxx:206
SVX_DLLPRIVATE void merge(sal_Int32 nColumnSpan, sal_Int32 nRowSpan)
Definition: cell.cxx:459
bool IsTopToBottom() const
#define FILL_PROPERTIES
Definition: unoshprp.hxx:258
void AddText(const OutlinerParaObject &, bool bAppend=false)
void SetBottom(long v)
std::unique_ptr< sdr::properties::TextProperties > mpProperties
Definition: cell.hxx:202
virtual void SAL_CALL release() SAL_OVERRIDE
SVX_DLLPRIVATE void copyFormatFrom(const CellRef &xSourceCell)
Definition: cell.cxx:555
#define OWN_ATTR_STYLE
Definition: unoshprp.hxx:175
void SetUpdateMode(bool bUpdate)
long Left() const
const CellTextProvider maTextProvider
Definition: cell.cxx:177
#define SDRATTR_TABLE_LAST
Definition: svddef.hxx:405
SVX_DLLPRIVATE void AddUndo()
Definition: cell.cxx:825
SVX_DLLPRIVATE Cell(SdrTableObj &rTableObj)
Definition: cell.cxx:400
SVX_DLLPRIVATE sdr::properties::TextProperties * CloneProperties(SdrObject &rNewObj, Cell &rNewCell)
Definition: cell.cxx:851
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1646
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: svdtext.cxx:141
#define UNO_NAME_TEXT_HORZADJUST
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
double mfValue
virtual SVX_DLLPRIVATE css::awt::Size SAL_CALL getPreferredSize() override
Definition: cell.cxx:918
#define XATTR_FILLBITMAP
Definition: xdef.hxx:111
void SetLeft(long v)
OUString const & GetName() const
Definition: xit.hxx:52
std::unique_ptr< OutlinerParaObject > CreateEditOutlinerParaObject() const
Definition: cell.cxx:638
bool IsVertical() const
SvxEditSource * GetEditSource() const
#define SDRATTR_TEXT_AUTOGROWHEIGHT
Definition: svddef.hxx:196
#define RIGHT_BORDER
const SdrObject & GetSdrObject() const
Definition: properties.cxx:60
const SvxItemPropertySet * mpPropSet
Definition: cell.hxx:200
SVX_DLLPRIVATE sal_Int32 getMinimumHeight()
Definition: cell.cxx:739
virtual SVX_DLLPRIVATE OUString SAL_CALL getFormula() override
Definition: cell.cxx:954
bool SetFillAttribute(sal_uInt16 nWID, const OUString &rName)
Definition: unoshape.cxx:1413
const SvxItemPropertySet * ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
void Clear()
OutlinerParaObject * GetOutlinerParaObject() const
Definition: svdtext.cxx:90
void ForceDefaultAttributes() override
Definition: cell.cxx:222
#define SDRATTR_TEXT_LOWERDIST
Definition: svddef.hxx:201
virtual SVX_DLLPRIVATE void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: cell.cxx:1028
uno::Any SvxItemPropertySet_getPropertyValue(const SfxItemPropertySimpleEntry *pMap, const SfxItemSet &rSet)
Definition: unoshape.cxx:3975
virtual SVX_DLLPRIVATE ~Cell() override
Definition: cell.cxx:428
#define EE_PARA_MAX_COUNT
virtual void SetVerticalWriting(bool bVertical) override
Definition: svdotable.cxx:2028
sal_uLong GetTextHeight() const
sal_uInt16 GetSmallestDistance() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
virtual SVX_DLLPRIVATE void SAL_CALL setValue(double nValue) override
Definition: cell.cxx:975
virtual SVX_DLLPRIVATE sal_Bool SAL_CALL isMerged() override
Definition: cell.cxx:945
#define EE_TEXTPOS_ALL
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1161
const editeng::SvxBorderLine * GetBottom() const
virtual SVX_DLLPRIVATE css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: cell.cxx:1181
virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem *pNewItem=nullptr) override
SdrTextVertAdjust
Definition: sdtaitm.hxx:29
ESelection maSelection
#define SDRATTR_TEXT_LEFTDIST
Definition: svddef.hxx:198
#define SVX_UNOEDIT_CHAR_PROPERTIES
const sdr::table::CellRef & getActiveCell() const
The active table has the focus or is currently edited.
Definition: svdotable.cxx:1550
css::uno::Reference< css::table::XTable > mxTable
Definition: cell.hxx:215
tools::Rectangle maCellRect
Definition: cell.hxx:213
static bool IsWhich(sal_uInt16 nId)
static bool LineToSvxLine(const css::table::BorderLine &rLine, editeng::SvxBorderLine &rSvxLine, bool bConvert)
virtual SVX_DLLPRIVATE css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: cell.cxx:1542
virtual SVX_DLLPRIVATE css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: cell.cxx:1620
virtual SVX_DLLPRIVATE void SAL_CALL acquire() override
Definition: cell.cxx:882
virtual SVX_DLLPRIVATE void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: cell.cxx:1652
#define XATTR_LINESTART
Definition: xdef.hxx:94
virtual SdrText * getText(sal_Int32 nIndex) const =0
Return the nth available text.
SVX_DLLPRIVATE long GetTextLeftDistance() const
Definition: cell.cxx:778
SVX_DLLPRIVATE long GetTextUpperDistance() const
Definition: cell.cxx:790
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
void setHeight(long nHeight)
#define EE_ITEMS_END
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
#define UNO_NAME_TEXT_VERTADJUST