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