LibreOffice Module svx (master) 1
svdotable.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <memory>
21#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
22#include <com/sun/star/container/XNamed.hpp>
23#include <com/sun/star/container/XNameAccess.hpp>
24#include <com/sun/star/container/XIndexAccess.hpp>
26#include <vcl/canvastools.hxx>
27#include <vcl/ptrstyle.hxx>
28#include <com/sun/star/style/XStyle.hpp>
29#include <com/sun/star/beans/XPropertySet.hpp>
33#include <svl/style.hxx>
34#include <editeng/editstat.hxx>
35#include <editeng/outlobj.hxx>
37#include <svx/svdmodel.hxx>
38#include <svx/svdotable.hxx>
39#include <svx/svdhdl.hxx>
41#include <svx/svdoutl.hxx>
42#include <svx/svddrag.hxx>
43#include <tablemodel.hxx>
44#include <cell.hxx>
45#include "tablelayouter.hxx"
46#include "tablehandles.hxx"
48#include <svx/svdundo.hxx>
49#include <svx/strings.hrc>
50#include <svx/dialmgr.hxx>
53#include <libxml/xmlwriter.h>
55
56#include <boost/property_tree/ptree.hpp>
57
58#include "sdrtableobjimpl.hxx"
59
60using ::com::sun::star::uno::Any;
61using ::com::sun::star::uno::Reference;
62using ::com::sun::star::uno::UNO_QUERY;
63using ::com::sun::star::uno::UNO_QUERY_THROW;
64using ::com::sun::star::uno::Exception;
65using ::com::sun::star::container::XIndexAccess;
66using ::com::sun::star::style::XStyle;
67using ::com::sun::star::table::XTableRows;
68using ::com::sun::star::table::XTableColumns;
69using ::com::sun::star::table::XTable;
71using ::com::sun::star::util::XModifyBroadcaster;
74using namespace ::com::sun::star;
75using namespace ::com::sun::star::text;
76using namespace ::com::sun::star::container;
77using namespace ::com::sun::star::style;
78
79namespace sdr::table {
80
81namespace {
82
83class TableProperties : public TextProperties
84{
85protected:
86 // create a new itemset
87 SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override;
88
89public:
90 // basic constructor
91 explicit TableProperties(SdrObject& rObj );
92
93 // constructor for copying, but using new object
94 TableProperties(const TableProperties& rProps, SdrObject& rObj );
95
96 // Clone() operator, normally just calls the local copy constructor
97 std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
98
99 virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override;
100};
101
102}
103
104TableProperties::TableProperties(SdrObject& rObj)
105: TextProperties(rObj)
106{
107}
108
109TableProperties::TableProperties(const TableProperties& rProps, SdrObject& rObj)
110: TextProperties(rProps, rObj)
111{
112}
113
114std::unique_ptr<BaseProperties> TableProperties::Clone(SdrObject& rObj) const
115{
116 return std::unique_ptr<BaseProperties>(new TableProperties(*this, rObj));
117}
118
119void TableProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
120{
121 if( nWhich == SDRATTR_TEXTDIRECTION )
122 AttributeProperties::ItemChange( nWhich, pNewItem );
123 else
124 TextProperties::ItemChange( nWhich, pNewItem );
125}
126
127// create a new itemset
128SfxItemSet TableProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
129{
130 return SfxItemSet(rPool,
131
132 // range from SdrAttrObj
136
137 // range for SdrTableObj
139
140 // range from SdrTextObj
141 EE_ITEMS_START, EE_ITEMS_END>);
142}
143
144namespace {
145
146class TableObjectGeoData : public SdrTextObjGeoData
147{
148public:
150};
151
152}
153
154TableStyleSettings::TableStyleSettings()
155: mbUseFirstRow(true)
156, mbUseLastRow(false)
157, mbUseFirstColumn(false)
158, mbUseLastColumn(false)
159, mbUseRowBanding(true)
160, mbUseColumnBanding(false)
161{
162}
163
165{
166 (*this) = rStyle;
167}
168
170{
172 mbUseLastRow = rStyle.mbUseLastRow;
177 return *this;
178}
179
181{
182 return
183 (mbUseFirstRow == rStyle.mbUseFirstRow) &&
184 (mbUseLastRow == rStyle.mbUseLastRow) &&
186 (mbUseLastColumn == rStyle.mbUseLastColumn) &&
187 (mbUseRowBanding == rStyle.mbUseRowBanding) &&
189}
190
191
201std::vector<sal_Int32> SdrTableObjImpl::lastColWidths;
202
204: mpTableObj( nullptr )
205, mbSkipChangeLayout(false)
206{
207}
208
209
211{
212 if( lastLayoutTable == this )
213 lastLayoutTable = nullptr;
214}
215
216
218{
219 if(!mxTable.is())
220 {
221 return;
222 }
223
224 const sal_Int32 nColumns(rEnd.mnCol - rStart.mnCol + 1);
225 const sal_Int32 nRows(rEnd.mnRow - rStart.mnRow + 1);
226
227 if(nColumns < 1 || nRows < 1 || nColumns > getColumnCount() || nRows > getRowCount())
228 {
229 return;
230 }
231
232 // tdf#116977 First thought was to create the new TableModel, copy data to it and then exchange
233 // mxTable and dispose old one. This does *not* work, even when all stuff looks nicely referenced
234 // and safe *because* Cell::create gets handed over the current SdrTableObj, hands it to
235 // ::Cell and there the local mxTable is initialized using rTableObj.getTable() (!). Due to This,
236 // the new created Cells in a new created TableModel based on given mpTableObj *will be disposed*
237 // when the old mxTable gets disposed - ARGH!
238 // To avoid, change strategy: Remember old TableModel, reset mxTable immediately - this is the
239 // SdrTableObjImpl of the current SdrTableObj anyways. Luckily, this works as intended...
240
241 // remember old TableModel
242 TableModelRef xOldTable(mxTable);
243
244 // immediately create new one and initialize. This creates ::Cell's which then will use
245 // the correct TableModel (accessed through SdrTableObj, but using local mxTable)
247 mxTable->init(nColumns, nRows);
248
249 // copy cells
250 for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
251 {
252 for( sal_Int32 nCol = 0; nCol < nColumns; ++nCol ) try
253 {
254 CellRef xTargetCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
255 if( xTargetCell.is() )
256 xTargetCell->cloneFrom( dynamic_cast< Cell* >( xOldTable->getCellByPosition( rStart.mnCol + nCol, rStart.mnRow + nRow ).get() ) );
257 }
258 catch( Exception& )
259 {
260 TOOLS_WARN_EXCEPTION("svx.table", "");
261 }
262 }
263
264 // copy row heights
265 Reference< XTableRows > xNewRows(mxTable->getRows(), css::uno::UNO_SET_THROW );
266 static constexpr OUStringLiteral sHeight( u"Height" );
267 for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
268 {
269 Reference< XPropertySet > xNewSet( xNewRows->getByIndex( nRow ), UNO_QUERY_THROW );
270 xNewSet->setPropertyValue( sHeight, Any( mpLayouter->getRowHeight( rStart.mnRow + nRow ) ) );
271 }
272
273 // copy column widths
274 Reference< XTableColumns > xNewColumns( mxTable->getColumns(), css::uno::UNO_SET_THROW );
275 static constexpr OUStringLiteral sWidth( u"Width" );
276 for( sal_Int32 nCol = 0; nCol < nColumns; ++nCol )
277 {
278 Reference< XPropertySet > xNewSet( xNewColumns->getByIndex( nCol ), UNO_QUERY_THROW );
279 xNewSet->setPropertyValue( sWidth, Any( mpLayouter->getColumnWidth( rStart.mnCol + nCol ) ) );
280 }
281
282 // reset layouter which still holds a copy to old TableModel
283 mpLayouter.reset();
284
285 // cleanup old TableModel
286 {
287 Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
288 xOldTable->removeModifyListener( xListener );
289 xOldTable->dispose();
290 xOldTable.clear();
291 }
292
293 // create and hand over to new TableLayouter
294 mpLayouter.reset(new TableLayouter( mxTable ));
295
296 // add needed listener to react on changes
297 Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
298 mxTable->addModifyListener( xListener );
299
300 // Apply Style to Cells
302
303 // layout cropped table
304 auto aRectangle = mpTableObj->getRectangle();
305 LayoutTable(aRectangle, false, false);
306 mpTableObj->setRectangle(aRectangle);
307}
308
309void SdrTableObjImpl::init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 nRows )
310{
311 mpTableObj = pTable;
312 mxTable = new TableModel( pTable );
313 mxTable->init( nColumns, nRows );
314 Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
315 mxTable->addModifyListener( xListener );
316 mpLayouter.reset(new TableLayouter( mxTable ));
317 auto aRectangle = mpTableObj->getRectangle();
318 LayoutTable(aRectangle, true, true);
319 mpTableObj->setRectangle(aRectangle);
320 mpTableObj->maLogicRect = aRectangle;
321}
322
323
325{
326 if(this == &rSource)
327 {
328 return *this;
329 }
330
331 if(nullptr == mpTableObj || nullptr == rSource.mpTableObj)
332 {
333 // error: need both SdrObjects to successfully copy data
334 return *this;
335 }
336
337 // remove evtl. listeners from local
339
340 // reset layouter which holds a copy
341 mpLayouter.reset();
342
343 // cleanup local mxTable if used
344 if( mxTable.is() )
345 {
346 Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
347 mxTable->removeModifyListener( xListener );
348 mxTable->dispose();
349 mxTable.clear();
350 }
351
352 // tdf#127481: reset active cell reference
353 mxActiveCell.clear();
354
355 // copy TableStyle (short internal data)
356 maTableStyle = rSource.maTableStyle;
357
358 // create/copy new mxTable. This will copy all needed cells, too
359 mxTable = new TableModel( mpTableObj, rSource.mxTable );
360
361 // create and hand over to new TableLayouter
362 mpLayouter.reset(new TableLayouter( mxTable ));
363
364 // add needed listener to react on changes
365 Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
366 mxTable->addModifyListener( xListener );
367
368 // handle TableStyle
369 Reference< XIndexAccess > xNewTableStyle;
370 SdrModel& rSourceSdrModel(rSource.mpTableObj->getSdrModelFromSdrObject());
371 SdrModel& rTargetSdrModel(mpTableObj->getSdrModelFromSdrObject());
372
373 if(rSource.mxTableStyle.is() && &rSourceSdrModel == &rTargetSdrModel)
374 {
375 // source and target model the same -> keep current TableStyle
376 xNewTableStyle = rSource.mxTableStyle;
377 }
378
379 if(!xNewTableStyle.is() && rSource.mxTableStyle.is()) try
380 {
381 // search in target SdrModel for that TableStyle
382 const OUString sStyleName( Reference< XNamed >( rSource.mxTableStyle, UNO_QUERY_THROW )->getName() );
383 Reference< XStyleFamiliesSupplier > xSFS(rTargetSdrModel.getUnoModel(), UNO_QUERY_THROW );
384 Reference< XNameAccess > xFamilyNameAccess( xSFS->getStyleFamilies(), css::uno::UNO_SET_THROW );
385 Reference< XNameAccess > xTableFamilyAccess( xFamilyNameAccess->getByName( "table" ), UNO_QUERY_THROW );
386
387 if( xTableFamilyAccess->hasByName( sStyleName ) )
388 {
389 // found table style with the same name
390 xTableFamilyAccess->getByName( sStyleName ) >>= xNewTableStyle;
391 }
392 else
393 {
394 // copy or? Not found, use 1st existing TableStyle (or none)
395 Reference< XIndexAccess > xIndexAccess( xTableFamilyAccess, UNO_QUERY_THROW );
396 xIndexAccess->getByIndex( 0 ) >>= xNewTableStyle;
397 }
398 }
399 catch( Exception& )
400 {
401 TOOLS_WARN_EXCEPTION("svx.table", "");
402 }
403
404 // set that TableStyle
405 mxTableStyle = xNewTableStyle;
406
407 // Apply Style to Cells
409
410 // copy geometry
412
413 // layout cloned table
414 auto aRectangle = mpTableObj->getRectangle();
415 LayoutTable(aRectangle, false, false);
416 mpTableObj->setRectangle(aRectangle);
417
418 // re-connect to styles (evtl. in new SdrModel)
420
421 return *this;
422}
423
425{
426 if( !mxTable.is() || !mxTableStyle.is() )
427 return;
428
429 const sal_Int32 nColCount = getColumnCount();
430 const sal_Int32 nRowCount = getRowCount();
431
432 const TableStyleSettings& rStyle = maTableStyle;
433
434 CellPos aPos;
435 for( aPos.mnRow = 0; aPos.mnRow < nRowCount; ++aPos.mnRow )
436 {
437 const bool bFirstRow = (aPos.mnRow == 0) && rStyle.mbUseFirstRow;
438 const bool bLastRow = (aPos.mnRow == nRowCount-1) && rStyle.mbUseLastRow;
439
440 for( aPos.mnCol = 0; aPos.mnCol < nColCount; ++aPos.mnCol )
441 {
442 Reference< XStyle > xStyle;
443
444 // first and last row win first, if used and available
445 if( bFirstRow )
446 {
447 mxTableStyle->getByIndex(first_row_style) >>= xStyle;
448 }
449 else if( bLastRow )
450 {
451 mxTableStyle->getByIndex(last_row_style) >>= xStyle;
452 }
453
454 if( !xStyle.is() )
455 {
456 // next come first and last column, if used and available
457 if( rStyle.mbUseFirstColumn && (aPos.mnCol == 0) )
458 {
459 mxTableStyle->getByIndex(first_column_style) >>= xStyle;
460 }
461 else if( rStyle.mbUseLastColumn && (aPos.mnCol == nColCount-1) )
462 {
463 mxTableStyle->getByIndex(last_column_style) >>= xStyle;
464 }
465 }
466
467 if( !xStyle.is() && rStyle.mbUseRowBanding )
468 {
469 if( (aPos.mnRow & 1) == 0 )
470 {
471 mxTableStyle->getByIndex(even_rows_style) >>= xStyle;
472 }
473 else
474 {
475 mxTableStyle->getByIndex(odd_rows_style) >>= xStyle;
476 }
477 }
478
479 if( !xStyle.is() && rStyle.mbUseColumnBanding )
480 {
481 if( (aPos.mnCol & 1) == 0 )
482 {
483 mxTableStyle->getByIndex(even_columns_style) >>= xStyle;
484 }
485 else
486 {
487 mxTableStyle->getByIndex(odd_columns_style) >>= xStyle;
488 }
489 }
490
491 if( !xStyle.is() )
492 {
493 // use default cell style if non found yet
494 mxTableStyle->getByIndex(body_style) >>= xStyle;
495 }
496
497
498 if( xStyle.is() )
499 {
501
502 if( pStyle )
503 {
504 CellRef xCell( getCell( aPos ) );
505 if( xCell.is() && ( xCell->GetStyleSheet() != pStyle ) )
506 {
507 xCell->SetStyleSheet( pStyle, true );
508 }
509 }
510 }
511 }
512 }
513}
514
515
517{
519 mxTableStyle.clear();
520
521 mpLayouter.reset();
522
523 if( mxTable.is() )
524 {
525 Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
526 mxTable->removeModifyListener( xListener );
527 mxTable->dispose();
528 mxTable.clear();
529 }
530}
531
532
533void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset )
534{
535 if( !((nEdge >= 0) && mxTable.is()))
536 return;
537
538 try
539 {
540 static constexpr OUStringLiteral sSize( u"Size" );
541 if( mbHorizontal )
542 {
543 if (nEdge <= getRowCount())
544 {
545 sal_Int32 nHeight = mpLayouter->getRowHeight( (!nEdge)?nEdge:(nEdge-1) );
546 if(nEdge==0)
547 nHeight -= nOffset;
548 else
549 nHeight += nOffset;
550 Reference< XIndexAccess > xRows( mxTable->getRows(), UNO_QUERY_THROW );
551 Reference< XPropertySet > xRowSet( xRows->getByIndex( (!nEdge)?nEdge:(nEdge-1) ), UNO_QUERY_THROW );
552 xRowSet->setPropertyValue( sSize, Any( nHeight ) );
553 rowSizeChanged = true;
554 }
555 }
556 else
557 {
558 /*
559 fixes fdo#59889 and resizing of table in edge dragging
560 Total vertical edges in a NxN table is N+1, indexed from 0 to N and total Columns is N, indexed from 0 to N-1
561 In LTR table vertical edge responsible for dragging of column x(x=0 to N-1) is, Edge x+1
562 But in RTL table vertical edge responsible for dragging of column x(x=0 to N-1, but from right to left)is, Edge x
563 In LTR table dragging of edge 0(for RTL table edge N) does nothing.
564 */
565 //Todo: Implement Dragging functionality for leftmost edge of table.
566 if (nEdge <= getColumnCount())
567 {
568 const bool bRTL = mpTableObj != nullptr && (mpTableObj->GetWritingMode() == WritingMode_RL_TB);
569 sal_Int32 nWidth;
570 if(bRTL)
571 {
572 nWidth = mpLayouter->getColumnWidth( nEdge );
573 }
574 else
575 {
576 nWidth = mpLayouter->getColumnWidth( (!nEdge)?nEdge:(nEdge-1) );
577 }
578 Reference< XIndexAccess > xCols( mxTable->getColumns(), UNO_QUERY_THROW );
579 nWidth += nOffset;
580 if(bRTL && nEdge<getColumnCount())
581 {
582 Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
583 xColSet->setPropertyValue( sSize, Any( nWidth ) );
584 }
585 else if(!bRTL && nEdge>0)
586 {
587 Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge-1 ), UNO_QUERY_THROW );
588 xColSet->setPropertyValue( sSize, Any( nWidth ) );
589 }
590 /* To prevent the table resizing on edge dragging */
591 if( nEdge > 0 && nEdge < mxTable->getColumnCount() )
592 {
593 if( bRTL )
594 nEdge--;
595
596 nWidth = mpLayouter->getColumnWidth(nEdge);
597 nWidth = std::max(static_cast<sal_Int32>(nWidth - nOffset), sal_Int32(0));
598
599 Reference<XPropertySet> xColSet(xCols->getByIndex(nEdge), UNO_QUERY_THROW);
600 xColSet->setPropertyValue(sSize, Any(nWidth));
601 }
602 }
603 }
604 }
605 catch( Exception& )
606 {
607 TOOLS_WARN_EXCEPTION("svx.table", "");
608 }
609}
610
611
612// XModifyListener
613
614
615void SAL_CALL SdrTableObjImpl::modified( const css::lang::EventObject& aEvent )
616{
617 if (aEvent.Source == mxTableStyle && mpTableObj)
618 static_cast<TextProperties&>(mpTableObj->GetProperties()).increaseVersion();
619
620 update();
621}
622
624{
625 // source can be the table model itself or the assigned table template
626 TableModelNotifyGuard aGuard( mxTable.get() );
627 if( !mpTableObj )
628 return;
629
631 {
634
637
639 }
640
642
644 auto aRectangle = mpTableObj->getRectangle();
645 LayoutTable(aRectangle, false, false);
646 mpTableObj->setRectangle(aRectangle);
647
651}
652
653
655{
656 if( mxTableStyle.is() )
657 {
658 Reference< XModifyBroadcaster > xBroadcaster( mxTableStyle, UNO_QUERY );
659 if( xBroadcaster.is() )
660 {
661 Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
662 xBroadcaster->addModifyListener( xListener );
663 }
664 }
665}
666
667
669{
670 if( mxTableStyle.is() )
671 {
672 Reference< XModifyBroadcaster > xBroadcaster( mxTableStyle, UNO_QUERY );
673 if( xBroadcaster.is() )
674 {
675 Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
676 xBroadcaster->removeModifyListener( xListener );
677 }
678 }
679}
680
681
683{
684 return mpTableObj && mpTableObj->IsInserted();
685}
686
688{
689 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrTableObjImpl"));
690 if (mpLayouter)
691 mpLayouter->dumpAsXml(pWriter);
692 mxTable->dumpAsXml(pWriter);
693 (void)xmlTextWriterEndElement(pWriter);
694}
695
696
697// XEventListener
698
699
700void SAL_CALL SdrTableObjImpl::disposing( const css::lang::EventObject& Source )
701{
702 assert(Source.Source == mxTableStyle);
703 (void)Source;
704
705 Reference<XIndexAccess> xDefaultStyle;
706 try
707 {
708 Reference<XStyleFamiliesSupplier> xSupplier(mpTableObj->getSdrModelFromSdrObject().getUnoModel(), UNO_QUERY_THROW);
709 Reference<XNameAccess> xTableFamily(xSupplier->getStyleFamilies()->getByName("table"), UNO_QUERY_THROW);
710 xDefaultStyle.set(xTableFamily->getByName("default"), UNO_QUERY_THROW);
711 }
712 catch( Exception& )
713 {
714 TOOLS_WARN_EXCEPTION("svx.table", "");
715 }
716
717 mpTableObj->setTableStyle(xDefaultStyle);
718}
719
720
722{
723 CellRef xCell;
724 if( mxTable.is() ) try
725 {
726 xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) );
727 }
728 catch( Exception& )
729 {
730 TOOLS_WARN_EXCEPTION("svx.table", "");
731 }
732 return xCell;
733}
734
735
737{
738 return mxTable.is() ? mxTable->getColumnCount() : 0;
739}
740
741std::vector<sal_Int32> SdrTableObjImpl::getColumnWidths() const
742{
743 std::vector<sal_Int32> aRet;
744
745 if (mxTable.is())
746 aRet = mxTable->getColumnWidths();
747
748 return aRet;
749}
750
752{
753 return mxTable.is() ? mxTable->getRowCount() : 0;
754}
755
756void SdrTableObjImpl::LayoutTable( tools::Rectangle& rArea, bool bFitWidth, bool bFitHeight )
757{
759 return;
760 if(!mpLayouter)
761 return;
762
763 // Optimization: SdrTableObj::SetChanged() can call this very often, repeatedly
764 // with the same settings, noticeably increasing load time. Skip if already done.
765 bool bInteractiveMightGrowBecauseTextChanged =
767 WritingMode writingMode = mpTableObj->GetWritingMode();
768 if( bInteractiveMightGrowBecauseTextChanged
769 || lastLayoutTable != this || lastLayoutInputRectangle != rArea
770 || lastLayoutFitWidth != bFitWidth || lastLayoutFitHeight != bFitHeight
771 || lastLayoutMode != writingMode
775 || rowSizeChanged )
776 {
777 lastLayoutTable = this;
779 lastLayoutFitWidth = bFitWidth;
780 lastLayoutFitHeight = bFitHeight;
781 lastLayoutMode = writingMode;
784 // Column resize, when the total width and column count of the
785 // table is unchanged, but re-layout is still needed.
787 TableModelNotifyGuard aGuard( mxTable.get() );
788 mpLayouter->LayoutTable( rArea, bFitWidth, bFitHeight );
790 rowSizeChanged = false;
791 }
792 else
793 {
795 mpLayouter->UpdateBorderLayout();
796 }
797}
798
800{
801 if( mpLayouter && mxTable.is() )
802 {
803 TableModelNotifyGuard aGuard( mxTable.get() );
804 mpLayouter->updateCells( rArea );
805 mxTable->setModified(true);
806 }
807}
808
809
810// BaseProperties section
811
812
813std::unique_ptr<sdr::properties::BaseProperties> SdrTableObj::CreateObjectSpecificProperties()
814{
815 return std::make_unique<TableProperties>(*this);
816}
817
818
819// DrawContact section
820
821
822std::unique_ptr<sdr::contact::ViewContact> SdrTableObj::CreateObjectSpecificViewContact()
823{
824 return std::make_unique<sdr::contact::ViewContactOfTableObj>(*this);
825}
826
828: SdrTextObj(rSdrModel)
829{
830 osl_atomic_increment(&m_refCount); // other I get deleted during construction
831 init( 1, 1 );
832 osl_atomic_decrement(&m_refCount);
833}
834
836: SdrTextObj(rSdrModel, rSource)
837{
838 osl_atomic_increment(&m_refCount);
839
840 init( 1, 1 );
841
842 TableModelNotifyGuard aGuard( mpImpl.is() ? mpImpl->mxTable.get() : nullptr );
843
844 maLogicRect = rSource.maLogicRect;
845 maRectangle = rSource.maRectangle;
846 maGeo = rSource.maGeo;
847 meTextKind = rSource.meTextKind;
848 mbTextFrame = rSource.mbTextFrame;
849 maTextSize = rSource.maTextSize;
851 mbNoShear = rSource.mbNoShear;
853
854 // use SdrTableObjImpl::operator= now to
855 // copy model data and other stuff (see there)
856 *mpImpl = *rSource.mpImpl;
857
858 osl_atomic_decrement(&m_refCount);
859}
860
862 SdrModel& rSdrModel,
863 const ::tools::Rectangle& rNewRect,
864 sal_Int32 nColumns,
865 sal_Int32 nRows)
866: SdrTextObj(rSdrModel, rNewRect)
867 ,maLogicRect(rNewRect)
868{
869 osl_atomic_increment(&m_refCount);
870
871 if( nColumns <= 0 )
872 nColumns = 1;
873
874 if( nRows <= 0 )
875 nRows = 1;
876
877 init( nColumns, nRows );
878
879 osl_atomic_decrement(&m_refCount);
880}
881
882
883void SdrTableObj::init( sal_Int32 nColumns, sal_Int32 nRows )
884{
885 m_bClosedObj = true;
886
888 mpImpl->init( this, nColumns, nRows );
889
890 // Stuff done from old SetModel:
891 if( !maLogicRect.IsEmpty() )
892 {
894 auto aRectangle = getRectangle();
895 mpImpl->LayoutTable(aRectangle, false, false);
896 setRectangle(aRectangle);
897 }
898}
899
900
902{
903 mpImpl->dispose();
904}
905
906
907// table stuff
908
909
910Reference< XTable > SdrTableObj::getTable() const
911{
912 return mpImpl->mxTable;
913}
914
915
916bool SdrTableObj::isValid( const CellPos& rPos ) const
917{
918 return (rPos.mnCol >= 0) && (rPos.mnCol < mpImpl->getColumnCount()) && (rPos.mnRow >= 0) && (rPos.mnRow < mpImpl->getRowCount());
919}
920
921
923{
924 return CellPos( 0,0 );
925}
926
927
929{
930 CellPos aPos;
931 if( mpImpl->mxTable.is() )
932 {
933 aPos.mnCol = mpImpl->getColumnCount()-1;
934 aPos.mnRow = mpImpl->getRowCount()-1;
935 }
936 return aPos;
937}
938
939
940CellPos SdrTableObj::getLeftCell( const CellPos& rPos, bool bEdgeTravel ) const
941{
942 switch( GetWritingMode() )
943 {
944 default:
945 case WritingMode_LR_TB:
946 return getPreviousCell( rPos, bEdgeTravel );
947 case WritingMode_RL_TB:
948 return getNextCell( rPos, bEdgeTravel );
949 case WritingMode_TB_RL:
950 return getPreviousRow( rPos, bEdgeTravel );
951 }
952}
953
954
955CellPos SdrTableObj::getRightCell( const CellPos& rPos, bool bEdgeTravel ) const
956{
957 switch( GetWritingMode() )
958 {
959 default:
960 case WritingMode_LR_TB:
961 return getNextCell( rPos, bEdgeTravel );
962 case WritingMode_RL_TB:
963 return getPreviousCell( rPos, bEdgeTravel );
964 case WritingMode_TB_RL:
965 return getNextRow( rPos, bEdgeTravel );
966 }
967}
968
969
970CellPos SdrTableObj::getUpCell( const CellPos& rPos, bool bEdgeTravel ) const
971{
972 switch( GetWritingMode() )
973 {
974 default:
975 case WritingMode_LR_TB:
976 case WritingMode_RL_TB:
977 return getPreviousRow( rPos, bEdgeTravel );
978 case WritingMode_TB_RL:
979 return getPreviousCell( rPos, bEdgeTravel );
980 }
981}
982
983
984CellPos SdrTableObj::getDownCell( const CellPos& rPos, bool bEdgeTravel ) const
985{
986 switch( GetWritingMode() )
987 {
988 default:
989 case WritingMode_LR_TB:
990 case WritingMode_RL_TB:
991 return getNextRow( rPos, bEdgeTravel );
992 case WritingMode_TB_RL:
993 return getNextCell( rPos, bEdgeTravel );
994 }
995}
996
997
998CellPos SdrTableObj::getPreviousCell( const CellPos& rPos, bool bEdgeTravel ) const
999{
1000 CellPos aPos( rPos );
1001 if( mpImpl.is() )
1002 {
1003 CellRef xCell( mpImpl->getCell( aPos ) );
1004 if( xCell.is() && xCell->isMerged() )
1005 {
1006 sal_Int32 nTemp = 0;
1007 findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, aPos.mnCol, nTemp );
1008 }
1009
1010 if( aPos.mnCol > 0 )
1011 {
1012 --aPos.mnCol;
1013 }
1014
1015 else if( bEdgeTravel && (aPos.mnRow > 0) )
1016 {
1017 aPos.mnCol = mpImpl->mxTable->getColumnCount()-1;
1018 --aPos.mnRow;
1019 }
1020 }
1021 return aPos;
1022}
1023
1024
1025CellPos SdrTableObj::getNextCell( const CellPos& rPos, bool bEdgeTravel ) const
1026{
1027 CellPos aPos( rPos );
1028 if( mpImpl.is() )
1029 {
1030 CellRef xCell( mpImpl->getCell( aPos ) );
1031 if( xCell.is() )
1032 {
1033 if( xCell->isMerged() )
1034 {
1035 findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, aPos.mnCol, aPos.mnRow );
1036
1037 xCell = mpImpl->getCell(aPos);
1038
1039 if( xCell.is() )
1040 {
1041 aPos.mnCol += xCell->getColumnSpan();
1042 aPos.mnRow = rPos.mnRow;
1043 }
1044 }
1045 else
1046 {
1047 aPos.mnCol += xCell->getColumnSpan();
1048 }
1049
1050 if( aPos.mnCol < mpImpl->mxTable->getColumnCount() )
1051 return aPos;
1052
1053 if( bEdgeTravel && ((aPos.mnRow + 1) < mpImpl->getRowCount()) )
1054 {
1055 aPos.mnCol = 0;
1056 aPos.mnRow += 1;
1057 return aPos;
1058 }
1059 }
1060 }
1061
1062 // last cell reached, no traveling possible
1063 return rPos;
1064}
1065
1066
1067CellPos SdrTableObj::getPreviousRow( const CellPos& rPos, bool bEdgeTravel ) const
1068{
1069 CellPos aPos( rPos );
1070 if( mpImpl.is() )
1071 {
1072 CellRef xCell( mpImpl->getCell( aPos ) );
1073 if( xCell.is() && xCell->isMerged() )
1074 {
1075 sal_Int32 nTemp = 0;
1076 findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, nTemp, aPos.mnRow );
1077 }
1078
1079 if( aPos.mnRow > 0 )
1080 {
1081 --aPos.mnRow;
1082 }
1083 else if( bEdgeTravel && (aPos.mnCol > 0) )
1084 {
1085 aPos.mnRow = mpImpl->mxTable->getRowCount()-1;
1086 --aPos.mnCol;
1087 }
1088 }
1089 return aPos;
1090}
1091
1092
1093CellPos SdrTableObj::getNextRow( const CellPos& rPos, bool bEdgeTravel ) const
1094{
1095 CellPos aPos( rPos );
1096
1097 if( mpImpl.is() )
1098 {
1099 CellRef xCell( mpImpl->getCell( rPos ) );
1100 if( xCell.is() )
1101 {
1102 if( xCell->isMerged() )
1103 {
1104 findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, aPos.mnCol, aPos.mnRow );
1105 xCell = mpImpl->getCell(aPos);
1106 aPos.mnCol = rPos.mnCol;
1107 }
1108
1109 if( xCell.is() )
1110 aPos.mnRow += xCell->getRowSpan();
1111
1112 if( aPos.mnRow < mpImpl->mxTable->getRowCount() )
1113 return aPos;
1114
1115 if( bEdgeTravel && (aPos.mnCol + 1) < mpImpl->mxTable->getColumnCount() )
1116 {
1117 aPos.mnRow = 0;
1118 aPos.mnCol += 1;
1119
1120 while( aPos.mnCol < mpImpl->mxTable->getColumnCount() )
1121 {
1122 xCell = mpImpl->getCell( aPos );
1123 if( xCell.is() && !xCell->isMerged() )
1124 return aPos;
1125 aPos.mnCol += 1;
1126 }
1127 }
1128 }
1129 }
1130
1131 // last position reached, no more traveling possible
1132 return rPos;
1133}
1134
1135
1137{
1138 if( mpImpl.is())
1139 {
1140 return mpImpl->maTableStyle;
1141 }
1142 else
1143 {
1144 static TableStyleSettings aTmp;
1145 return aTmp;
1146 }
1147}
1148
1149
1151{
1152 if( mpImpl.is() )
1153 {
1154 mpImpl->maTableStyle = rStyle;
1155 mpImpl->update();
1156 }
1157}
1158
1159
1160TableHitKind SdrTableObj::CheckTableHit( const Point& rPos, sal_Int32& rnX, sal_Int32& rnY, const sal_uInt16 aTol ) const
1161{
1162 if( !mpImpl.is() || !mpImpl->mxTable.is() )
1163 return TableHitKind::NONE;
1164
1165 rnX = 0;
1166 rnY = 0;
1167
1168 const sal_Int32 nColCount = mpImpl->getColumnCount();
1169 const sal_Int32 nRowCount = mpImpl->getRowCount();
1170
1171 sal_Int32 nX = rPos.X() - getRectangle().Left();
1172 sal_Int32 nY = rPos.Y() - getRectangle().Top();
1173
1174 if( (nX < 0) || (nX > getRectangle().GetWidth()) || (nY < 0) || (nY > getRectangle().GetHeight() ) )
1175 return TableHitKind::NONE;
1176
1177 // get vertical edge number and check for a hit
1178 const bool bRTL = (GetWritingMode() == WritingMode_RL_TB);
1179 bool bVrtHit = false;
1180 if( !bRTL )
1181 {
1182 while( rnX <= nColCount )
1183 {
1184 if( nX - aTol <= 0 )
1185 {
1186 bVrtHit = true;
1187 break;
1188 }
1189
1190 if( rnX == nColCount )
1191 break;
1192
1193 nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
1194 if( nX < 0 )
1195 break;
1196 rnX++;
1197 }
1198 }
1199 else
1200 {
1201 rnX = nColCount;
1202 while( rnX >= 0 )
1203 {
1204 if( nX - aTol <= 0 )
1205 {
1206 bVrtHit = true;
1207 break;
1208 }
1209
1210 if( rnX == 0 )
1211 break;
1212
1213 rnX--;
1214 nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
1215 if( nX < 0 )
1216 break;
1217 }
1218 }
1219
1220 // rnX is now the edge number left to the pointer, if it was hit bHrzHit is also true
1221
1222 // get vertical edge number and check for a hit
1223 bool bHrzHit = false;
1224 while( rnY <= nRowCount )
1225 {
1226 if( nY - aTol <= 0 )
1227 {
1228 bHrzHit = true;
1229 break;
1230 }
1231
1232 if( rnY == nRowCount )
1233 break;
1234
1235 nY -= mpImpl->mpLayouter->getRowHeight(rnY);
1236 if( nY < 0 )
1237 break;
1238 rnY++;
1239 }
1240
1241 // rnY is now the edge number above the pointer, if it was hit bVrtHit is also true
1242
1243 if( bVrtHit && mpImpl->mpLayouter->isEdgeVisible( rnX, rnY, false ) )
1245
1246 if( bHrzHit && mpImpl->mpLayouter->isEdgeVisible( rnX, rnY, true ) )
1248
1249 CellRef xCell( mpImpl->getCell( CellPos( rnX, rnY ) ) );
1250 if( xCell.is() && xCell->isMerged() )
1251 findMergeOrigin( mpImpl->mxTable, rnX, rnY, rnX, rnY );
1252
1253 if( xCell.is() )
1254 {
1255 nX += mpImpl->mpLayouter->getColumnWidth( rnX );
1256 //Fix for fdo#62673 : non-editable cell in table on cell merge
1257 sal_Int32 i=0;
1258 while(xCell.is() && xCell->isMerged())
1259 {
1260 nX += mpImpl->mpLayouter->getColumnWidth( rnX+i );
1261 i++;
1262 if(rnX+i < nColCount)
1263 xCell=mpImpl->getCell( CellPos( rnX+i, rnY) );
1264 else
1265 break;
1266 }
1267
1268 if( nX < xCell->GetTextLeftDistance() )
1269 return TableHitKind::Cell;
1270 }
1271
1273}
1274
1276{
1277 return getActiveCell()->GetItemSet();
1278}
1279
1280void SdrTableObj::setTableStyle( const Reference< XIndexAccess >& xTableStyle )
1281{
1282 if( mpImpl.is() && (mpImpl->mxTableStyle != xTableStyle) )
1283 {
1284 mpImpl->disconnectTableStyle();
1285 mpImpl->mxTableStyle = xTableStyle;
1286 mpImpl->connectTableStyle();
1287 mpImpl->update();
1288 }
1289}
1290
1291
1292const Reference< XIndexAccess >& SdrTableObj::getTableStyle() const
1293{
1294 if( mpImpl.is() )
1295 {
1296 return mpImpl->mxTableStyle;
1297 }
1298 else
1299 {
1300 static Reference< XIndexAccess > aTmp;
1301 return aTmp;
1302 }
1303}
1304
1305
1306// text stuff
1307
1308
1311{
1312 return getActiveCell().get();
1313}
1314
1315
1317SdrText* SdrTableObj::getText( sal_Int32 nIndex ) const
1318{
1319 if( mpImpl->mxTable.is() )
1320 {
1321 const sal_Int32 nColCount = mpImpl->getColumnCount();
1322 if( nColCount )
1323 {
1324 CellPos aPos( nIndex % nColCount, nIndex / nColCount );
1325
1326 CellRef xCell( mpImpl->getCell( aPos ) );
1327 return xCell.get();
1328 }
1329 }
1330 return nullptr;
1331}
1332
1333
1336{
1337 if( mpImpl->mxTable.is() )
1338 {
1339 const sal_Int32 nColCount = mpImpl->getColumnCount();
1340 const sal_Int32 nRowCount = mpImpl->getRowCount();
1341
1342 return nColCount * nRowCount;
1343 }
1344 else
1345 {
1346 return 0;
1347 }
1348}
1349
1350
1352void SdrTableObj::setActiveText( sal_Int32 nIndex )
1353{
1354 if( mpImpl.is() && mpImpl->mxTable.is() )
1355 {
1356 const sal_Int32 nColCount = mpImpl->mxTable->getColumnCount();
1357 if( nColCount )
1358 {
1359 CellPos aPos( nIndex % nColCount, nIndex / nColCount );
1360 if( isValid( aPos ) )
1361 setActiveCell( aPos );
1362 }
1363 }
1364}
1365
1366
1368sal_Int32 SdrTableObj::CheckTextHit(const Point& rPnt) const
1369{
1370 if( mpImpl.is() && mpImpl->mxTable.is() )
1371 {
1372 CellPos aPos;
1373 if( CheckTableHit( rPnt, aPos.mnCol, aPos.mnRow ) == TableHitKind::CellTextArea )
1374 return aPos.mnRow * mpImpl->mxTable->getColumnCount() + aPos.mnCol;
1375 }
1376
1377 return 0;
1378}
1379
1381{
1382 if( mpImpl.is() && (mpImpl->getCell( mpImpl->maEditPos ).get() == &rCell) )
1383 return mpEditingOutliner;
1384 else
1385 return nullptr;
1386}
1387
1389{
1390 assert(mpImpl.is() && mpImpl->mpLayouter && "getTableLayouter() error: no mpImpl or mpLayouter (!)");
1391 return *(mpImpl->mpLayouter);
1392}
1393
1395{
1396 return true;
1397}
1398
1400{
1401 return true;
1402}
1403
1405{
1406 return true;
1407}
1408
1410{
1411 return mpEditingOutliner && mpImpl.is() && (rPos == mpImpl->maEditPos);
1412}
1413
1414
1416{
1417 if( (pEditStatus->GetStatusWord() & EditStatusFlags::TextHeightChanged) && mpImpl.is() && mpImpl->mpLayouter )
1418 {
1421 auto aRectangle = getRectangle();
1422 mpImpl->LayoutTable(aRectangle, false, false);
1423 setRectangle(aRectangle);
1425 ActionChanged();
1427 if (aRect0 != getRectangle())
1429 }
1430}
1431
1432
1434{
1435 rInfo.bResizeFreeAllowed=true;
1436 rInfo.bResizePropAllowed=true;
1437 rInfo.bRotateFreeAllowed=false;
1438 rInfo.bRotate90Allowed =false;
1439 rInfo.bMirrorFreeAllowed=false;
1440 rInfo.bMirror45Allowed =false;
1441 rInfo.bMirror90Allowed =false;
1442
1443 // allow transparence
1444 rInfo.bTransparenceAllowed = true;
1445
1446 rInfo.bShearAllowed =false;
1447 rInfo.bEdgeRadiusAllowed=false;
1448 rInfo.bCanConvToPath =false;
1449 rInfo.bCanConvToPoly =false;
1450 rInfo.bCanConvToPathLineToArea=false;
1451 rInfo.bCanConvToPolyLineToArea=false;
1452 rInfo.bCanConvToContour = false;
1453}
1454
1456{
1457 return SdrObjKind::Table;
1458}
1459
1460void SdrTableObj::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText, tools::Rectangle* pAnchorRect, bool /*bLineWidth*/ ) const
1461{
1462 if( mpImpl.is() )
1463 TakeTextRect( mpImpl->maEditPos, rOutliner, rTextRect, bNoEditText, pAnchorRect );
1464}
1465
1466
1467void SdrTableObj::TakeTextRect( const CellPos& rPos, SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText, tools::Rectangle* pAnchorRect ) const
1468{
1469 if( !mpImpl.is())
1470 return;
1471
1472 CellRef xCell( mpImpl->getCell( rPos ) );
1473 if( !xCell.is() )
1474 return;
1475
1476 tools::Rectangle aAnkRect;
1477 TakeTextAnchorRect( rPos, aAnkRect );
1478
1479 SdrTextVertAdjust eVAdj=xCell->GetTextVerticalAdjust();
1480
1481 EEControlBits nStat0=rOutliner.GetControlWord();
1482 nStat0 |= EEControlBits::AUTOPAGESIZE;
1483 rOutliner.SetControlWord(nStat0);
1484 rOutliner.SetMinAutoPaperSize(Size());
1485 rOutliner.SetMaxAutoPaperSize(aAnkRect.GetSize());
1486 rOutliner.SetPaperSize(aAnkRect.GetSize());
1487
1488 // #103516# New try with _BLOCK for hor and ver after completely
1489 // supporting full width for vertical text.
1490// if( SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
1491// {
1492 rOutliner.SetMinAutoPaperSize(Size(aAnkRect.GetWidth(), 0));
1493// }
1494// else if(SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting())
1495// {
1496// rOutliner.SetMinAutoPaperSize(Size(0, aAnkRect.GetHeight()));
1497// }
1498
1499
1500 // set text at outliner, maybe from edit outliner
1502 if (xCell->GetOutlinerParaObject())
1503 pPara = *xCell->GetOutlinerParaObject();
1504 if (mpEditingOutliner && !bNoEditText && mpImpl->mxActiveCell == xCell )
1506
1507 if (pPara)
1508 {
1509 const bool bHitTest(&getSdrModelFromSdrObject().GetHitTestOutliner() == &rOutliner);
1510 const SdrTextObj* pTestObj(rOutliner.GetTextObj());
1511
1512 if( !pTestObj || !bHitTest || (pTestObj != this) || (pTestObj->GetOutlinerParaObject() != xCell->GetOutlinerParaObject()) )
1513 {
1514 if( bHitTest ) // #i33696# take back fix #i27510#
1515 rOutliner.SetTextObj( this );
1516
1517 rOutliner.SetUpdateLayout(true);
1518 rOutliner.SetText(*pPara);
1519 }
1520 }
1521 else
1522 {
1523 rOutliner.SetTextObj( nullptr );
1524 }
1525
1526 rOutliner.SetUpdateLayout(true);
1527 rOutliner.SetControlWord(nStat0);
1528
1529 Point aTextPos(aAnkRect.TopLeft());
1530 Size aTextSiz(rOutliner.GetPaperSize());
1532 {
1533 tools::Long nFreeHgt=aAnkRect.GetHeight()-aTextSiz.Height();
1534 if (eVAdj==SDRTEXTVERTADJUST_CENTER)
1535 aTextPos.AdjustY(nFreeHgt/2 );
1536 if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
1537 aTextPos.AdjustY(nFreeHgt );
1538 }
1539
1540 if (pAnchorRect)
1541 *pAnchorRect=aAnkRect;
1542
1543 rTextRect=tools::Rectangle(aTextPos,aTextSiz);
1544}
1545
1547{
1548 if( mpImpl.is() )
1549 {
1550 if( !mpImpl->mxActiveCell.is() )
1551 {
1552 CellPos aPos;
1553 const_cast< SdrTableObj* >(this)->setActiveCell( aPos );
1554 }
1555 return mpImpl->mxActiveCell;
1556 }
1557 else
1558 {
1559 static CellRef xCell;
1560 return xCell;
1561 }
1562}
1563
1564
1566{
1567 return mpImpl.is() ? mpImpl->getColumnCount() : 0;
1568}
1569
1571{
1572 return mpImpl.is() ? mpImpl->getRowCount() : 0;
1573}
1574
1575void SdrTableObj::changeEdge(bool bHorizontal, int nEdge, sal_Int32 nOffset)
1576{
1577 if (mpImpl.is())
1578 mpImpl->DragEdge(bHorizontal, nEdge, nOffset);
1579}
1580
1582{
1583 if( !(mpImpl.is() && mpImpl->mxTable.is()) )
1584 return;
1585
1586 try
1587 {
1588 mpImpl->mxActiveCell.set( dynamic_cast< Cell* >( mpImpl->mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) );
1589 if( mpImpl->mxActiveCell.is() && mpImpl->mxActiveCell->isMerged() )
1590 {
1591 CellPos aOrigin;
1592 findMergeOrigin( mpImpl->mxTable, rPos.mnCol, rPos.mnRow, aOrigin.mnCol, aOrigin.mnRow );
1593 mpImpl->mxActiveCell.set( dynamic_cast< Cell* >( mpImpl->mxTable->getCellByPosition( aOrigin.mnCol, aOrigin.mnRow ).get() ) );
1594 mpImpl->maEditPos = aOrigin;
1595 }
1596 else
1597 {
1598 mpImpl->maEditPos = rPos;
1599 }
1600 }
1601 catch( Exception& )
1602 {
1603 TOOLS_WARN_EXCEPTION("svx.table", "");
1604 }
1605}
1606
1607
1609{
1610 rPos = mpImpl->maEditPos;
1611}
1612
1613
1615{
1616 if( mpImpl.is() )
1617 {
1618 CellRef xCell( mpImpl->getCell( rPos ) );
1619 if( xCell.is() )
1620 rCellRect = xCell->getCellRect();
1621 }
1622}
1623
1624
1626{
1627 if( mpImpl.is() )
1628 TakeTextAnchorRect( mpImpl->maEditPos, rAnchorRect );
1629}
1630
1631
1632void SdrTableObj::TakeTextAnchorRect( const CellPos& rPos, tools::Rectangle& rAnchorRect ) const
1633{
1634 tools::Rectangle aAnkRect(getRectangle());
1635
1636 if( mpImpl.is() )
1637 {
1638 CellRef xCell( mpImpl->getCell( rPos ) );
1639 if( xCell.is() )
1640 xCell->TakeTextAnchorRect( aAnkRect );
1641 }
1642
1643 ImpJustifyRect(aAnkRect);
1644 rAnchorRect=aAnkRect;
1645}
1646
1647
1648void SdrTableObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const
1649{
1650 if( mpImpl.is() )
1651 TakeTextEditArea( mpImpl->maEditPos, pPaperMin, pPaperMax, pViewInit, pViewMin );
1652}
1653
1654
1655void SdrTableObj::TakeTextEditArea( const CellPos& rPos, Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin ) const
1656{
1657 Size aPaperMin,aPaperMax;
1658 tools::Rectangle aViewInit;
1659 TakeTextAnchorRect( rPos, aViewInit );
1660
1661 Size aAnkSiz(aViewInit.GetSize());
1662 aAnkSiz.AdjustWidth( -1 ); aAnkSiz.AdjustHeight( -1 ); // because GetSize() increments by one
1663
1664 Size aMaxSiz(aAnkSiz.Width(),1000000);
1665 Size aTmpSiz(getSdrModelFromSdrObject().GetMaxObjSize());
1666 if (aTmpSiz.Height()!=0)
1667 aMaxSiz.setHeight(aTmpSiz.Height() );
1668
1669 CellRef xCell( mpImpl->getCell( rPos ) );
1670 SdrTextVertAdjust eVAdj = xCell.is() ? xCell->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_TOP;
1671
1672 aPaperMax=aMaxSiz;
1673
1674 aPaperMin.setWidth( aAnkSiz.Width() );
1675
1676 if (pViewMin!=nullptr)
1677 {
1678 *pViewMin=aViewInit;
1679 tools::Long nYFree=aAnkSiz.Height()-aPaperMin.Height();
1680
1681 if (eVAdj==SDRTEXTVERTADJUST_TOP)
1682 {
1683 pViewMin->AdjustBottom( -nYFree );
1684 }
1685 else if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
1686 {
1687 pViewMin->AdjustTop(nYFree );
1688 }
1689 else
1690 {
1691 pViewMin->AdjustTop(nYFree/2 );
1692 pViewMin->SetBottom(pViewMin->Top()+aPaperMin.Height() );
1693 }
1694 }
1695
1696
1697 if(IsVerticalWriting())
1698 aPaperMin.setWidth( 0 );
1699 else
1700 aPaperMin.setHeight( 0 );
1701
1702 if (pPaperMin!=nullptr) *pPaperMin=aPaperMin;
1703 if (pPaperMax!=nullptr) *pPaperMax=aPaperMax;
1704 if (pViewInit!=nullptr) *pViewInit=aViewInit;
1705}
1706
1707
1709{
1710 EEAnchorMode eRet=EEAnchorMode::TopLeft;
1711 CellRef xCell( getActiveCell() );
1712 if( xCell.is() )
1713 {
1714 SdrTextVertAdjust eV=xCell->GetTextVerticalAdjust();
1715
1716 {
1717 if (eV==SDRTEXTVERTADJUST_TOP)
1718 {
1719 eRet=EEAnchorMode::TopLeft;
1720 }
1721 else if (eV==SDRTEXTVERTADJUST_BOTTOM)
1722 {
1723 eRet=EEAnchorMode::BottomLeft;
1724 }
1725 else
1726 {
1727 eRet=EEAnchorMode::VCenterLeft;
1728 }
1729 }
1730 }
1731 return eRet;
1732}
1733
1734
1736{
1737 OUString sName(SvxResId(STR_ObjNameSingulTable));
1738
1739 OUString aName(GetName());
1740 if (!aName.isEmpty())
1741 sName += " '" + aName + "'";
1742
1743 return sName;
1744}
1745
1746
1748{
1749 return SvxResId(STR_ObjNamePluralTable);
1750}
1751
1752
1754{
1755 return new SdrTableObj(rTargetModel, *this);
1756}
1757
1758
1760{
1761 return getRectangle();
1762}
1763
1764
1766{
1767 NbcSetLogicRect( rRect );
1768}
1769
1770
1772{
1773 return maLogicRect;
1774}
1775
1776
1778{
1779}
1780
1781
1783{
1784 if( mpEditingOutliner != nullptr )
1785 return false;
1786
1787 mpEditingOutliner=&rOutl;
1788
1789 mbInEditMode = true;
1790
1791 rOutl.Init( OutlinerMode::TextObject );
1792 rOutl.SetRefDevice(getSdrModelFromSdrObject().GetRefDevice());
1793
1794 bool bUpdateMode = rOutl.SetUpdateLayout(false);
1795 Size aPaperMin;
1796 Size aPaperMax;
1797 tools::Rectangle aEditArea;
1798 TakeTextEditArea(&aPaperMin,&aPaperMax,&aEditArea,nullptr);
1799
1800 rOutl.SetMinAutoPaperSize(aPaperMin);
1801 rOutl.SetMaxAutoPaperSize(aPaperMax);
1802 rOutl.SetPaperSize(aPaperMax);
1803
1804 if (bUpdateMode) rOutl.SetUpdateLayout(true);
1805
1806 EEControlBits nStat=rOutl.GetControlWord();
1807 nStat |= EEControlBits::AUTOPAGESIZE;
1808 nStat &=~EEControlBits::STRETCHING;
1809 rOutl.SetControlWord(nStat);
1810
1812 if(pPara)
1813 rOutl.SetText(*pPara);
1814
1815 rOutl.UpdateFields();
1816 rOutl.ClearModifyFlag();
1817
1818 return true;
1819}
1820
1821
1823{
1824
1825 if (getSdrModelFromSdrObject().IsUndoEnabled() && !mpImpl->maUndos.empty())
1826 {
1827 // These actions should be on the undo stack after text edit.
1828 for (std::unique_ptr<SdrUndoAction>& pAction : mpImpl->maUndos)
1829 getSdrModelFromSdrObject().AddUndo( std::move(pAction));
1830 mpImpl->maUndos.clear();
1831
1832 getSdrModelFromSdrObject().AddUndo(getSdrModelFromSdrObject().GetSdrUndoFactory().CreateUndoGeoObject(*this));
1833 }
1834
1835 if(rOutl.IsModified())
1836 {
1838 Paragraph* p1stPara = rOutl.GetParagraph( 0 );
1839 sal_Int32 nParaCnt = rOutl.GetParagraphCount();
1840
1841 if(p1stPara)
1842 {
1843 // to remove the grey field background
1844 rOutl.UpdateFields();
1845
1846 // create new text object
1847 pNewText = rOutl.CreateParaObject( 0, nParaCnt );
1848 }
1849 SetOutlinerParaObject(std::move(pNewText));
1850 }
1851
1852 mpEditingOutliner = nullptr;
1853 rOutl.Clear();
1854 EEControlBits nStat = rOutl.GetControlWord();
1855 nStat &= ~EEControlBits::AUTOPAGESIZE;
1856 rOutl.SetControlWord(nStat);
1857
1858 mbInEditMode = false;
1859}
1860
1861
1863{
1864 CellRef xCell( getActiveCell() );
1865 if( xCell.is() )
1866 return xCell->GetOutlinerParaObject();
1867 else
1868 return nullptr;
1869}
1870
1871
1873{
1874 CellRef xCell( getActiveCell() );
1875 if( !xCell.is() )
1876 return;
1877
1878 // Update HitTestOutliner
1879 const SdrTextObj* pTestObj(getSdrModelFromSdrObject().GetHitTestOutliner().GetTextObj());
1880
1881 if(pTestObj && pTestObj->GetOutlinerParaObject() == xCell->GetOutlinerParaObject())
1882 {
1884 }
1885
1886 xCell->SetOutlinerParaObject( std::move(pTextObject) );
1889}
1890
1891
1893{
1894 maLogicRect=rRect;
1896 const bool bWidth = maLogicRect.getOpenWidth() != getRectangle().getOpenWidth();
1897 const bool bHeight = maLogicRect.getOpenHeight() != getRectangle().getOpenHeight();
1899 if (mpImpl->mbSkipChangeLayout)
1900 // Avoid distributing newly available space between existing cells.
1902 else
1903 NbcAdjustTextFrameWidthAndHeight(!bHeight, !bWidth);
1905}
1906
1907
1908void SdrTableObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool /* bShrinkOnly = false */ )
1909{
1910 tools::Rectangle aAdjustRect( rMaxRect );
1911 aAdjustRect.setHeight( GetLogicRect().getOpenHeight() );
1912 SetLogicRect( aAdjustRect );
1913}
1914
1915
1917{
1918 maLogicRect.Move(rSiz);
1919 SdrTextObj::NbcMove( rSiz );
1920 if( mpImpl.is() )
1921 mpImpl->UpdateCells(getRectangle());
1922}
1923
1924
1925void SdrTableObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
1926{
1927 tools::Rectangle aOldRect( maLogicRect );
1928 ResizeRect(maLogicRect,rRef,xFact,yFact);
1929
1933}
1934
1935
1937{
1938 tools::Rectangle aNewRect(maLogicRect);
1939 bool bRet=AdjustTextFrameWidthAndHeight(aNewRect);
1940 if (bRet)
1941 {
1942 tools::Rectangle aBoundRect0;
1943 if (m_pUserCall!=nullptr)
1944 aBoundRect0=GetLastBoundRect();
1945 setRectangle(aNewRect);
1947 SetChanged();
1950 }
1951 return bRet;
1952}
1953
1954
1955bool SdrTableObj::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool bHeight, bool bWidth) const
1956{
1957 if(rR.IsEmpty() || !mpImpl.is() || !mpImpl->mxTable.is())
1958 return false;
1959
1960 tools::Rectangle aRectangle( rR );
1961 mpImpl->LayoutTable( aRectangle, !bWidth, !bHeight );
1962
1963 if( aRectangle != rR )
1964 {
1965 rR = aRectangle;
1966 return true;
1967 }
1968 else
1969 {
1970 return false;
1971 }
1972}
1973
1974
1976{
1978}
1979
1980
1982{
1984 return rModeItem.GetValue() == css::text::WritingMode_TB_RL;
1985}
1986
1987
1989{
1990 if(bVertical != IsVerticalWriting() )
1991 {
1992 SvxWritingModeItem aModeItem( css::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION );
1993 SetObjectItem( aModeItem );
1994 }
1995}
1996
1997
1999{
2000 SfxStyleSheet* pStyle = GetStyleSheet();
2001 if ( !pStyle )
2002 return WritingMode_LR_TB;
2003
2004 WritingMode eWritingMode = WritingMode_LR_TB;
2005 const SfxItemSet &rSet = pStyle->GetItemSet();
2006
2008 eWritingMode = pItem->GetValue();
2009
2010 if ( const SvxFrameDirectionItem *pItem;
2011 ( eWritingMode != WritingMode_TB_RL ) &&
2012 ( pItem = rSet.GetItemIfSet( EE_PARA_WRITINGDIR, false ) ) )
2013 {
2014 if ( pItem->GetValue() == SvxFrameDirection::Horizontal_LR_TB )
2015 eWritingMode = WritingMode_LR_TB;
2016 else
2017 eWritingMode = WritingMode_RL_TB;
2018 }
2019
2020 return eWritingMode;
2021}
2022
2024{
2025 mpImpl->maUndos.push_back(std::unique_ptr<SdrUndoAction>(pUndo));
2026}
2027
2028void SdrTableObj::SetSkipChangeLayout(bool bSkipChangeLayout)
2029{
2030 mpImpl->mbSkipChangeLayout = bSkipChangeLayout;
2031}
2032
2034{
2036}
2037
2039{
2040 return false;
2041}
2042
2044{
2045 sal_uInt32 nCount = SdrTextObj::GetHdlCount();
2046 const sal_Int32 nRowCount = mpImpl->getRowCount();
2047 const sal_Int32 nColCount = mpImpl->getColumnCount();
2048
2049 if( nRowCount && nColCount )
2050 nCount += nRowCount + nColCount + 2 + 1;
2051
2052 return nCount;
2053}
2054
2056{
2057 const sal_Int32 nRowCount = mpImpl->getRowCount();
2058 const sal_Int32 nColCount = mpImpl->getColumnCount();
2059
2060 // first add row handles
2061 std::vector<TableEdgeHdl*> aRowEdges(nRowCount + 1);
2062 for (auto const & rEdge : mpImpl->mpLayouter->getHorizontalEdges())
2063 {
2064 Point aPoint(getRectangle().TopLeft());
2065 aPoint.AdjustY(rEdge.nPosition);
2066
2067 std::unique_ptr<TableEdgeHdl> pHdl(new TableEdgeHdl(aPoint, true, rEdge.nMin, rEdge.nMax, nColCount + 1));
2068 pHdl->SetPointNum(rEdge.nIndex);
2069 aRowEdges[rEdge.nIndex] = pHdl.get();
2070 rHdlList.AddHdl(std::move(pHdl));
2071 }
2072
2073 // second add column handles
2074 std::vector<TableEdgeHdl*> aColEdges(nColCount + 1);
2075 for (auto const & rEdge : mpImpl->mpLayouter->getVerticalEdges())
2076 {
2077 Point aPoint(getRectangle().TopLeft());
2078 aPoint.AdjustX(rEdge.nPosition);
2079
2080 std::unique_ptr<TableEdgeHdl> pHdl(new TableEdgeHdl(aPoint, false, rEdge.nMin, rEdge.nMax, nRowCount + 1));
2081 pHdl->SetPointNum(rEdge.nIndex);
2082 aColEdges[rEdge.nIndex] = pHdl.get();
2083 rHdlList.AddHdl(std::move(pHdl));
2084 }
2085
2086 // now add visible edges to row and column handles
2087 if( mpImpl->mpLayouter )
2088 {
2089 TableLayouter& rLayouter = *mpImpl->mpLayouter;
2090
2091 sal_Int32 nY = 0;
2092
2093 for( sal_Int32 nRow = 0; nRow <= nRowCount; ++nRow )
2094 {
2095 const sal_Int32 nRowHeight = (nRow == nRowCount) ? 0 : rLayouter.getRowHeight(nRow);
2096 sal_Int32 nX = 0;
2097
2098 for( sal_Int32 nCol = 0; nCol <= nColCount; ++nCol )
2099 {
2100 const sal_Int32 nColWidth = (nCol == nColCount) ? 0 : rLayouter.getColumnWidth(nCol);
2101
2102 if( nRowHeight > 0 )
2103 {
2104 if( rLayouter.isEdgeVisible( nCol, nRow, false ) )
2105 aColEdges[nCol]->SetEdge( nRow, nY, nY + nRowHeight, (rLayouter.getBorderLine( nCol, nRow, false ) == nullptr) ? Visible : Invisible);
2106 }
2107
2108 if( nColWidth > 0 )
2109 {
2110 if( rLayouter.isEdgeVisible( nCol, nRow, true ) )
2111 aRowEdges[nRow]->SetEdge( nCol, nX, nX + nColWidth, (rLayouter.getBorderLine( nCol, nRow, true ) == nullptr) ? Visible : Invisible);
2112 }
2113
2114 nX += nColWidth;
2115 }
2116
2117 nY += nRowHeight;
2118 }
2119 }
2120
2121 // add remaining handles
2122 SdrHdlList tempList(nullptr);
2123 auto aRectangle = getRectangle();
2124 tempList.AddHdl( std::make_unique<TableBorderHdl>(aRectangle, !IsTextEditActive() ) );
2125 tempList.AddHdl( std::make_unique<SdrHdl>(aRectangle.TopLeft(),SdrHdlKind::UpperLeft) );
2126 tempList.AddHdl( std::make_unique<SdrHdl>(aRectangle.TopCenter(),SdrHdlKind::Upper) );
2127 tempList.AddHdl( std::make_unique<SdrHdl>(aRectangle.TopRight(),SdrHdlKind::UpperRight) );
2128 tempList.AddHdl( std::make_unique<SdrHdl>(aRectangle.LeftCenter(),SdrHdlKind::Left) );
2129 tempList.AddHdl( std::make_unique<SdrHdl>(aRectangle.RightCenter(),SdrHdlKind::Right) );
2130 tempList.AddHdl( std::make_unique<SdrHdl>(aRectangle.BottomLeft(),SdrHdlKind::LowerLeft) );
2131 tempList.AddHdl( std::make_unique<SdrHdl>(aRectangle.BottomCenter(),SdrHdlKind::Lower) );
2132 tempList.AddHdl( std::make_unique<SdrHdl>(aRectangle.BottomRight(),SdrHdlKind::LowerRight) );
2133 for( size_t nHdl = 0; nHdl < tempList.GetHdlCount(); ++nHdl )
2134 tempList.GetHdl(nHdl)->SetMoveOutside(true);
2135 tempList.MoveTo(rHdlList);
2136
2137 const size_t nHdlCount = rHdlList.GetHdlCount();
2138 for( size_t nHdl = 0; nHdl < nHdlCount; ++nHdl )
2139 rHdlList.GetHdl(nHdl)->SetObj(const_cast<SdrTableObj*>(this));
2140}
2141
2142// Dragging
2143
2145{
2146 return true;
2147}
2148
2150{
2151 const SdrHdl* pHdl = rDrag.GetHdl();
2152 const SdrHdlKind eHdl((pHdl == nullptr) ? SdrHdlKind::Move : pHdl->GetKind());
2153
2154 switch( eHdl )
2155 {
2157 case SdrHdlKind::Upper:
2159 case SdrHdlKind::Left:
2160 case SdrHdlKind::Right:
2162 case SdrHdlKind::Lower:
2164 case SdrHdlKind::Move:
2165 {
2166 break;
2167 }
2168
2169 case SdrHdlKind::User:
2170 {
2171 rDrag.SetEndDragChangesAttributes(false);
2172 rDrag.SetNoSnap();
2173 break;
2174 }
2175
2176 default:
2177 {
2178 return false;
2179 }
2180 }
2181
2182 return true;
2183}
2184
2186{
2187 bool bRet(true);
2188 const SdrHdl* pHdl = rDrag.GetHdl();
2189 const SdrHdlKind eHdl((pHdl == nullptr) ? SdrHdlKind::Move : pHdl->GetKind());
2190
2191 switch( eHdl )
2192 {
2194 case SdrHdlKind::Upper:
2196 case SdrHdlKind::Left:
2197 case SdrHdlKind::Right:
2199 case SdrHdlKind::Lower:
2201 {
2202 const tools::Rectangle aNewRectangle(ImpDragCalcRect(rDrag));
2203
2204 if (aNewRectangle != getRectangle())
2205 {
2206 NbcSetLogicRect(aNewRectangle);
2207 }
2208
2209 break;
2210 }
2211
2212 case SdrHdlKind::Move:
2213 {
2214 NbcMove( Size( rDrag.GetDX(), rDrag.GetDY() ) );
2215 break;
2216 }
2217
2218 case SdrHdlKind::User:
2219 {
2220 rDrag.SetEndDragChangesAttributes(false);
2221 rDrag.SetNoSnap();
2222 const TableEdgeHdl* pEdgeHdl = dynamic_cast< const TableEdgeHdl* >( pHdl );
2223
2224 if( pEdgeHdl )
2225 {
2226 if( IsInserted() )
2227 {
2228 rDrag.SetEndDragChangesAttributes(true);
2229 rDrag.SetEndDragChangesLayout(true);
2230 }
2231
2232 mpImpl->DragEdge( pEdgeHdl->IsHorizontalEdge(), pEdgeHdl->GetPointNum(), pEdgeHdl->GetValidDragOffset( rDrag ) );
2233 }
2234 break;
2235 }
2236
2237 default:
2238 {
2239 bRet = false;
2240 }
2241 }
2242
2243 return bRet;
2244}
2245
2247{
2249 const SdrHdl* pHdl = rDrag.GetHdl();
2250
2251 if( pHdl && (SdrHdlKind::User == pHdl->GetKind()) )
2252 {
2253 const TableEdgeHdl* pEdgeHdl = dynamic_cast< const TableEdgeHdl* >( pHdl );
2254
2255 if( pEdgeHdl )
2256 {
2257 aRetval = pEdgeHdl->getSpecialDragPoly( rDrag );
2258 }
2259 }
2260
2261 return aRetval;
2262}
2263
2264
2265// Create
2266
2267
2269{
2270 rStat.SetOrtho4Possible();
2271 tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
2272 aRect1.Normalize();
2273 rStat.SetActionRect(aRect1);
2274 setRectangle(aRect1);
2275 return true;
2276}
2277
2278
2280{
2281 tools::Rectangle aRect1;
2282 rStat.TakeCreateRect(aRect1);
2283 ImpJustifyRect(aRect1);
2284 rStat.SetActionRect(aRect1);
2285 setRectangle(aRect1); // for ObjName
2287 m_bSnapRectDirty=true;
2288 return true;
2289}
2290
2291
2293{
2294 auto aRectangle = getRectangle();
2295 rStat.TakeCreateRect(aRectangle);
2296 ImpJustifyRect(aRectangle);
2297 setRectangle(aRectangle);
2298 return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2);
2299}
2300
2302{
2303}
2304
2305
2307{
2308 return true;
2309}
2310
2311
2313{
2314 tools::Rectangle aRect1;
2315 rDrag.TakeCreateRect(aRect1);
2316 aRect1.Normalize();
2317
2321 return aRetval;
2322}
2323
2324
2326{
2327 return PointerStyle::Cross;
2328}
2329
2330
2332{
2333 xNewCell = Cell::create( *this );
2334}
2335
2336
2337std::unique_ptr<SdrObjGeoData> SdrTableObj::NewGeoData() const
2338{
2339 return std::make_unique<TableObjectGeoData>();
2340}
2341
2342
2344{
2345 DBG_ASSERT( dynamic_cast< TableObjectGeoData* >( &rGeo ), "svx::SdrTableObj::SaveGeoData(), illegal geo data!" );
2347
2348 static_cast<TableObjectGeoData &>(rGeo).maLogicRect = maLogicRect;
2349}
2350
2351
2353{
2354 DBG_ASSERT( dynamic_cast< const TableObjectGeoData* >( &rGeo ), "svx::SdrTableObj::RestoreGeoData(), illegal geo data!" );
2355
2356 maLogicRect = static_cast<const TableObjectGeoData &>(rGeo).maLogicRect;
2357
2359
2360 if( mpImpl.is() )
2361 {
2362 auto aRectangle = getRectangle();
2363 mpImpl->LayoutTable(aRectangle, false, false);
2364 setRectangle(aRectangle);
2365 }
2366 ActionChanged();
2367}
2368
2370{
2371 if(!mpImpl.is())
2372 {
2373 return;
2374 }
2375
2376 mpImpl->CropTableModelToSelection(rStart, rEnd);
2377}
2378
2380{
2381 if( mpImpl.is() && mpImpl->mpLayouter)
2382 {
2383 mpImpl->mpLayouter->LayoutTableHeight(rArea, /*bFit*/false);
2384 }
2385}
2386
2387void SdrTableObj::DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn, const bool bOptimize, const bool bMinimize )
2388{
2389 if( mpImpl.is() && mpImpl->mpLayouter )
2390 {
2391 TableModelNotifyGuard aGuard( mpImpl->mxTable.get() );
2392 auto aRectangle = getRectangle();
2393 mpImpl->mpLayouter->DistributeColumns(aRectangle, nFirstColumn, nLastColumn, bOptimize, bMinimize);
2394 setRectangle(aRectangle);
2395 }
2396}
2397
2398
2399void SdrTableObj::DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize )
2400{
2401 if( mpImpl.is() && mpImpl->mpLayouter )
2402 {
2403 TableModelNotifyGuard aGuard( mpImpl->mxTable.get() );
2404 auto aRectangle = getRectangle();
2405 mpImpl->mpLayouter->DistributeRows(aRectangle, nFirstRow, nLastRow, bOptimize, bMinimize);
2406 setRectangle(aRectangle);
2407 }
2408}
2409
2410
2412{
2413 if( mpImpl.is() )
2414 {
2415 auto aRectangle = getRectangle();
2416 mpImpl->LayoutTable(aRectangle, false, false);
2417 setRectangle(aRectangle);
2418 }
2419
2421}
2422
2423
2425{
2426 if( mpImpl.is() && mpImpl->mxTable.is() )
2427 mpImpl->mxTable->lockBroadcasts();
2428}
2429
2430
2432{
2433 if( mpImpl.is() && mpImpl->mxTable.is() )
2434 mpImpl->mxTable->unlockBroadcasts();
2435}
2436
2438{
2439 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrTableObj"));
2440 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
2441
2442 SdrObject::dumpAsXml(pWriter);
2443
2444 mpImpl->dumpAsXml(pWriter);
2445
2446 (void)xmlTextWriterEndElement(pWriter);
2447}
2448
2449bool SdrTableObj::createTableEdgesJson(boost::property_tree::ptree & rJsonRoot)
2450{
2451 if (!mpImpl.is() || !mpImpl->mxTable.is())
2452 return false;
2453
2455 boost::property_tree::ptree aTableColumns;
2456 {
2457 aTableColumns.put("tableOffset", o3tl::toTwips(aRect.Left(), o3tl::Length::mm100));
2458
2459 boost::property_tree::ptree aEntries;
2460 auto const & aEdges = mpImpl->mpLayouter->getVerticalEdges();
2461 for (auto & rEdge : aEdges)
2462 {
2463 if (rEdge.nIndex == 0)
2464 {
2465 aTableColumns.put("left", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
2466 }
2467 else if (rEdge.nIndex == sal_Int32(aEdges.size() - 1))
2468 {
2469 aTableColumns.put("right", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
2470 }
2471 else
2472 {
2473 boost::property_tree::ptree aEntry;
2474 aEntry.put("position", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
2475 aEntry.put("min", o3tl::toTwips(rEdge.nPosition + rEdge.nMin, o3tl::Length::mm100));
2476 aEntry.put("max", o3tl::toTwips(rEdge.nPosition + rEdge.nMax, o3tl::Length::mm100));
2477 aEntry.put("hidden", false);
2478 aEntries.push_back(std::make_pair("", aEntry));
2479 }
2480 }
2481 aTableColumns.push_back(std::make_pair("entries", aEntries));
2482 }
2483 rJsonRoot.add_child("columns", aTableColumns);
2484
2485 boost::property_tree::ptree aTableRows;
2486 {
2487 aTableRows.put("tableOffset", o3tl::toTwips(aRect.Top(), o3tl::Length::mm100));
2488
2489 boost::property_tree::ptree aEntries;
2490 auto const & aEdges = mpImpl->mpLayouter->getHorizontalEdges();
2491 for (auto & rEdge : aEdges)
2492 {
2493 if (rEdge.nIndex == 0)
2494 {
2495 aTableRows.put("left", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
2496 }
2497 else if (rEdge.nIndex == sal_Int32(aEdges.size() - 1))
2498 {
2499 aTableRows.put("right", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
2500 }
2501 else
2502 {
2503 boost::property_tree::ptree aEntry;
2504 aEntry.put("position", o3tl::toTwips(rEdge.nPosition, o3tl::Length::mm100));
2505 aEntry.put("min", o3tl::toTwips(rEdge.nPosition + rEdge.nMin, o3tl::Length::mm100));
2506 aEntry.put("max", o3tl::toTwips(rEdge.nPosition + rEdge.nMax, o3tl::Length::mm100));
2507 aEntry.put("hidden", false);
2508 aEntries.push_back(std::make_pair("", aEntry));
2509 }
2510 }
2511 aTableRows.push_back(std::make_pair("entries", aEntries));
2512 }
2513 rJsonRoot.add_child("rows", aTableRows);
2514 return true;
2515}
2516
2517}
2518
2519/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
EditStatusFlags GetStatusWord() const
void SetMaxAutoPaperSize(const Size &rSz)
void SetText(const OutlinerParaObject &)
const Size & GetPaperSize() const
Paragraph * GetParagraph(sal_Int32 nAbsPos) const
void SetMinAutoPaperSize(const Size &rSz)
std::optional< OutlinerParaObject > CreateParaObject(sal_Int32 nStartPara=0, sal_Int32 nParaCount=EE_PARA_ALL) const
void SetPaperSize(const Size &rSize)
void Clear()
bool SetUpdateLayout(bool bUpdate)
EEControlBits GetControlWord() const
void SetControlWord(EEControlBits nWord)
bool UpdateFields()
void SetRefDevice(OutputDevice *pRefDev)
void ClearModifyFlag()
void Init(OutlinerMode nMode)
bool IsModified() const
sal_Int32 GetParagraphCount() const
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
void SetActionRect(const tools::Rectangle &rR)
Definition: svddrag.hxx:167
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:101
void TakeCreateRect(tools::Rectangle &rRect) const
Definition: svddrag.cxx:115
tools::Long GetDY() const
Definition: svddrag.hxx:159
void SetOrtho4Possible(bool bOn=true)
Definition: svddrag.hxx:136
const Point & GetStart() const
Definition: svddrag.hxx:102
const SdrHdl * GetHdl() const
Definition: svddrag.hxx:111
const Point & GetNow() const
Definition: svddrag.hxx:105
void SetNoSnap(bool bOn=true)
Definition: svddrag.hxx:131
void SetEndDragChangesAttributes(bool bOn)
Definition: svddrag.hxx:143
tools::Long GetDX() const
Definition: svddrag.hxx:158
void SetEndDragChangesLayout(bool bOn)
Definition: svddrag.hxx:147
void MoveTo(SdrHdlList &rOther)
Definition: svdhdl.cxx:2325
size_t GetHdlCount() const
Definition: svdhdl.hxx:459
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2291
SdrHdl * GetHdl(size_t nNum) const
Definition: svdhdl.hxx:460
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
void SetMoveOutside(bool bMoveOutside)
Definition: svdhdl.cxx:322
void SetObj(SdrObject *pNewObj)
Definition: svdhdl.cxx:380
sal_uInt32 GetPointNum() const
Definition: svdhdl.hxx:222
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdmodel.cxx:516
css::uno::Reference< css::uno::XInterface > const & getUnoModel()
Definition: svdmodel.cxx:1575
SdrOutliner & GetHitTestOutliner() const
Definition: svdmodel.hxx:323
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:174
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
Abstract DrawObject.
Definition: svdobj.hxx:260
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: svdobj.cxx:1771
void ActionChanged() const
Definition: svdobj.cxx:273
void SetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject)
Definition: svdobj.cxx:1798
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:220
void BroadcastObjectChange() const
Definition: svdobj.cxx:1018
void SetObjectItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1979
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:2004
bool m_bSnapRectDirty
Definition: svdobj.hxx:902
virtual const tools::Rectangle & GetCurrentBoundRect() const
Definition: svdobj.cxx:962
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:289
SdrObjUserCall * m_pUserCall
Definition: svdobj.hxx:897
virtual void SetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1696
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2244
virtual const OUString & GetName() const
Definition: svdobj.cxx:771
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2763
virtual void SetChanged()
Definition: svdobj.cxx:1042
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:977
bool IsInserted() const
Definition: svdobj.hxx:750
bool m_bClosedObj
Definition: svdobj.hxx:915
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:329
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:509
void SetTextObj(const SdrTextObj *pObj)
Definition: svdoutl.cxx:43
const SdrTextObj * GetTextObj() const
Definition: svdoutl.cxx:91
GeoStat maGeo
Definition: svdotext.hxx:196
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1499
tools::Rectangle const & getRectangle() const
Definition: svdotext.hxx:170
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdotext.cxx:1507
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdotxtr.cxx:95
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdotxdr.cxx:36
bool mbInEditMode
Definition: svdotext.hxx:246
SdrOutliner * mpEditingOutliner
Definition: svdotext.hxx:207
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1412
tools::Long GetTextLeftDistance() const
Left inner spacing to borders
Definition: svdotext.cxx:1819
tools::Rectangle maRectangle
Definition: svdotext.hxx:168
virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true)
Definition: svdotxat.cxx:241
static void ImpJustifyRect(tools::Rectangle &rRect)
Definition: svdotext.cxx:411
bool mbDisableAutoWidthOnDragging
Definition: svdotext.hxx:256
void SetTextSizeDirty()
Definition: svdotext.hxx:301
tools::Rectangle ImpDragCalcRect(const SdrDragStat &rDrag) const
Definition: svdotxdr.cxx:75
bool mbTextSizeDirty
Definition: svdotext.hxx:244
SdrObjKind meTextKind
Definition: svdotext.hxx:215
bool mbNoShear
Definition: svdotext.hxx:243
Size maTextSize
Definition: svdotext.hxx:202
void setRectangle(tools::Rectangle const &rRectangle)
Definition: svdotext.hxx:175
bool mbTextFrame
Definition: svdotext.hxx:242
Abstract base class (ABC) for all UndoActions of DrawingEngine.
Definition: svdundo.hxx:61
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
virtual SfxItemSet & GetItemSet()
static SfxUnoStyleSheet * getUnoStyleSheet(const css::uno::Reference< css::style::XStyle > &xStyle)
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
css::text::WritingMode GetValue() const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
oslInterlockedCount m_refCount
CellRef getCell(const CellPos &rPos) const
Definition: svdotable.cxx:721
SdrTableObjImpl & operator=(const SdrTableObjImpl &rSource)
Definition: svdotable.cxx:324
TableStyleSettings maTableStyle
std::unique_ptr< TableLayouter > mpLayouter
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: svdotable.cxx:687
static tools::Rectangle lastLayoutResultRectangle
void UpdateCells(tools::Rectangle const &rArea)
Definition: svdotable.cxx:799
sal_Int32 getRowCount() const
Definition: svdotable.cxx:751
static css::text::WritingMode lastLayoutMode
void CropTableModelToSelection(const CellPos &rStart, const CellPos &rEnd)
Definition: svdotable.cxx:217
std::vector< sal_Int32 > getColumnWidths() const
Get widths of the columns in the table.
Definition: svdotable.cxx:741
static SdrTableObjImpl * lastLayoutTable
void LayoutTable(tools::Rectangle &rArea, bool bFitWidth, bool bFitHeight)
Definition: svdotable.cxx:756
void DragEdge(bool mbHorizontal, int nEdge, sal_Int32 nOffset)
Definition: svdotable.cxx:533
static tools::Rectangle lastLayoutInputRectangle
virtual ~SdrTableObjImpl() override
Definition: svdotable.cxx:210
sal_Int32 getColumnCount() const
Definition: svdotable.cxx:736
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: svdotable.cxx:700
css::uno::Reference< css::container::XIndexAccess > mxTableStyle
static std::vector< sal_Int32 > lastColWidths
void init(SdrTableObj *pTable, sal_Int32 nColumns, sal_Int32 nRows)
Definition: svdotable.cxx:309
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
Definition: svdotable.cxx:615
CellPos getLastCell() const
Definition: svdotable.cxx:928
bool IsTextEditActive() const
Definition: svdotable.hxx:180
const TableLayouter & getTableLayouter() const
Definition: svdotable.cxx:1388
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdotable.cxx:1455
void TakeTextRect(const sdr::table::CellPos &rPos, SdrOutliner &rOutliner, ::tools::Rectangle &rTextRect, bool bNoEditText, ::tools::Rectangle *pAnchorRect) const
At the same time, we set the text in the outliner (if applicable the EditOutliners') as well as the P...
virtual void AdjustToMaxRect(const tools::Rectangle &rMaxRect, bool bShrinkOnly=false) override
Definition: svdotable.cxx:1908
void setTableStyleSettings(const sdr::table::TableStyleSettings &rStyle)
Definition: svdotable.cxx:1150
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotable.cxx:2343
void LayoutTableHeight(tools::Rectangle &rArea)
Definition: svdotable.cxx:2379
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdotable.cxx:2306
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotable.cxx:1862
CellPos getRightCell(const CellPos &rPos, bool bEdgeTravel) const
Definition: svdotable.cxx:955
virtual SdrText * getActiveText() const override
Returns the currently active text.
Definition: svdotable.cxx:1310
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdotable.cxx:2312
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdotable.cxx:1916
void changeEdge(bool bHorizontal, int nEdge, sal_Int32 nOffset)
Definition: svdotable.cxx:1575
SdrTableObj(SdrModel &rSdrModel)
Definition: svdotable.cxx:827
CellPos getDownCell(const CellPos &rPos, bool bEdgeTravel) const
Definition: svdotable.cxx:984
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdotable.cxx:2268
const css::uno::Reference< css::container::XIndexAccess > & getTableStyle() const
Definition: svdotable.cxx:1292
sal_Int32 getColumnCount() const
Definition: svdotable.cxx:1565
CellPos getPreviousCell(const CellPos &rPos, bool bEdgeTravel) const
Definition: svdotable.cxx:998
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdotable.cxx:822
CellPos getLeftCell(const CellPos &rPos, bool bEdgeTravel) const
Definition: svdotable.cxx:940
void AddUndo(SdrUndoAction *pUndo)
Add an undo action that should be on the undo stack after ending text edit.
Definition: svdotable.cxx:2023
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdotable.cxx:2149
void TakeTextAnchorRect(const sdr::table::CellPos &rPos, ::tools::Rectangle &rAnchorRect) const
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdotable.cxx:2185
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdotable.cxx:2279
const sdr::table::TableStyleSettings & getTableStyleSettings() const
Definition: svdotable.cxx:1136
static CellPos getFirstCell()
Definition: svdotable.cxx:922
virtual const tools::Rectangle & GetLogicRect() const override
Definition: svdotable.cxx:1771
virtual bool IsFontwork() const override
Definition: svdotable.cxx:2038
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdotable.cxx:1433
sal_Int32 getRowCount() const
Definition: svdotable.cxx:1570
virtual bool BegTextEdit(SdrOutliner &rOutl) override
Definition: svdotable.cxx:1782
virtual void SetVerticalWriting(bool bVertical) override
Definition: svdotable.cxx:1988
CellPos getUpCell(const CellPos &rPos, bool bEdgeTravel) const
Definition: svdotable.cxx:970
virtual ~SdrTableObj() override
Definition: svdotable.cxx:901
css::text::WritingMode GetWritingMode() const
Definition: svdotable.cxx:1998
virtual OUString TakeObjNameSingul() const override
Definition: svdotable.cxx:1735
void getActiveCellPos(sdr::table::CellPos &rPos) const
Definition: svdotable.cxx:1608
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: svdotable.cxx:1765
const SfxItemSet & GetActiveCellItemSet() const
Definition: svdotable.cxx:1275
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdotable.cxx:2144
virtual bool IsAutoGrowHeight() const override
Definition: svdotable.cxx:1394
bool createTableEdgesJson(boost::property_tree::ptree &rJsonRoot)
Definition: svdotable.cxx:2449
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdotable.cxx:2337
virtual void onEditOutlinerStatusEvent(EditStatus *pEditStatus) override
called from the SdrObjEditView during text edit when the status of the edit outliner changes
Definition: svdotable.cxx:1415
void DistributeColumns(sal_Int32 nFirstColumn, sal_Int32 nLastColumn, const bool bOptimize, const bool bMinimize)
Definition: svdotable.cxx:2387
CellPos getPreviousRow(const CellPos &rPos, bool bEdgeTravel) const
Definition: svdotable.cxx:1067
void CropTableModelToSelection(const CellPos &rStart, const CellPos &rEnd)
Definition: svdotable.cxx:2369
virtual void NbcReformatText() override
Definition: svdotable.cxx:1975
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdotable.cxx:1925
virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat &rDrag) const override
Definition: svdotable.cxx:2246
virtual void NbcSetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject) override
Definition: svdotable.cxx:1872
void createCell(sdr::table::CellRef &xCell)
Definition: svdotable.cxx:2331
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdotable.cxx:1777
virtual bool IsVerticalWriting() const override
Definition: svdotable.cxx:1981
void init(sal_Int32 nColumns, sal_Int32 nRows)
Definition: svdotable.cxx:883
virtual bool IsReallyEdited() const override
Returns true only if we are in edit mode and the user actually changed anything.
Definition: svdotable.cxx:2033
void SetSkipChangeLayout(bool bSkipChangeLayout)
Next time layouting would be done, skip it (to layout at the end of multiple actions).
Definition: svdotable.cxx:2028
friend class SdrTableObjImpl
Definition: svdotable.hxx:96
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdotable.cxx:1892
virtual bool HasText() const override
Definition: svdotable.cxx:1404
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdotable.cxx:2043
void setTableStyle(const css::uno::Reference< css::container::XIndexAccess > &xAutoFormatStyle)
Definition: svdotable.cxx:1280
void getCellBounds(const sdr::table::CellPos &rPos, ::tools::Rectangle &rCellRect)
Definition: svdotable.cxx:1614
virtual EEAnchorMode GetOutlinerViewAnchorMode() const override
Definition: svdotable.cxx:1708
virtual void TakeTextEditArea(Size *pPaperMin, Size *pPaperMax, tools::Rectangle *pViewInit, tools::Rectangle *pViewMin) const override
Definition: svdotable.cxx:1648
css::uno::Reference< css::table::XTable > getTable() const
Definition: svdotable.cxx:910
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdotable.cxx:2055
void setActiveCell(const sdr::table::CellPos &rPos)
Definition: svdotable.cxx:1581
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: svdotable.cxx:2437
virtual void setActiveText(sal_Int32 nIndex) override
Changes the current active text.
Definition: svdotable.cxx:1352
virtual void SetChanged() override
Definition: svdotable.cxx:2411
tools::Rectangle maLogicRect
Definition: svdotable.hxx:279
void DistributeRows(sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize)
Definition: svdotable.cxx:2399
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdotable.cxx:1759
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdotable.cxx:1753
SdrOutliner * GetCellTextEditOutliner(const sdr::table::Cell &rCell) const
Definition: svdotable.cxx:1380
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdotable.cxx:2325
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdotable.cxx:2352
bool isValid(const sdr::table::CellPos &rPos) const
Definition: svdotable.cxx:916
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdotable.cxx:2301
rtl::Reference< SdrTableObjImpl > mpImpl
Definition: svdotable.hxx:280
virtual OUString TakeObjNamePlural() const override
Definition: svdotable.cxx:1747
virtual sal_Int32 getTextCount() const override
Returns the number of texts available for this object.
Definition: svdotable.cxx:1335
virtual bool AdjustTextFrameWidthAndHeight() override
Definition: svdotable.cxx:1936
virtual SdrText * getText(sal_Int32 nIndex) const override
Returns the nth available text.
Definition: svdotable.cxx:1317
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdotable.cxx:813
TableHitKind CheckTableHit(const Point &rPos, sal_Int32 &rnX, sal_Int32 &rnY, const sal_uInt16 aTol=0) const
Definition: svdotable.cxx:1160
virtual void EndTextEdit(SdrOutliner &rOutl) override
Definition: svdotable.cxx:1822
virtual sal_Int32 CheckTextHit(const Point &rPnt) const override
Returns the index of the text that contains the given point or -1.
Definition: svdotable.cxx:1368
virtual bool IsAutoGrowWidth() const override
Definition: svdotable.cxx:1399
const sdr::table::CellRef & getActiveCell() const
The active table has the focus or is currently edited.
Definition: svdotable.cxx:1546
CellPos getNextCell(const CellPos &rPos, bool bEdgeTravel) const
Definition: svdotable.cxx:1025
CellPos getNextRow(const CellPos &rPos, bool bEdgeTravel) const
Definition: svdotable.cxx:1093
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdotable.cxx:2292
bool IsHorizontalEdge() const
sal_Int32 GetValidDragOffset(const SdrDragStat &rDrag) const
basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat &rDrag) const
bool isEdgeVisible(sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal) const
checks if the given edge is visible.
sal_Int32 getColumnWidth(sal_Int32 nColumn) const
editeng::SvxBorderLine * getBorderLine(sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal) const
returns the requested borderline in rpBorderLine or a null pointer if there is no border at this edge
sal_Int32 getRowHeight(sal_Int32 nRow) const
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
tools::Long getOpenHeight() const
constexpr Size GetSize() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
tools::Long AdjustTop(tools::Long nVertMoveDelta)
constexpr void SetBottom(tools::Long v)
constexpr tools::Long GetHeight() const
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
void setHeight(tools::Long n)
tools::Long getOpenWidth() const
constexpr tools::Long Left() const
constexpr bool IsEmpty() const
static bool IsFuzzing()
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
float u
ScXMLEditAttributeMap::Entry const aEntries[]
EEAnchorMode
EEControlBits
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
struct _xmlTextWriter * xmlTextWriterPtr
OUString sName
sal_Int32 nIndex
OUString aName
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
@ Exception
class SAL_NO_VTABLE XPropertySet
Definition: xmlexchg.hxx:29
int i
constexpr auto toTwips(N number, Length from)
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
bool findMergeOrigin(const TableModelRef &xTable, sal_Int32 nMergedX, sal_Int32 nMergedY, sal_Int32 &rOriginX, sal_Int32 &rOriginY)
returns true if the cell(nMergedX,nMergedY) is merged with other cells.
TableHitKind
SdrTableHitKind.
Definition: svdotable.hxx:51
const sal_Int32 last_column_style
Definition: tabledesign.hxx:32
rtl::Reference< Cell > CellRef
Definition: celltypes.hxx:33
const sal_Int32 first_column_style
Definition: tabledesign.hxx:31
const sal_Int32 odd_columns_style
Definition: tabledesign.hxx:36
const sal_Int32 body_style
Definition: tabledesign.hxx:37
const sal_Int32 even_rows_style
Definition: tabledesign.hxx:33
const sal_Int32 first_row_style
Definition: tabledesign.hxx:29
const sal_Int32 last_row_style
Definition: tabledesign.hxx:30
const sal_Int32 even_columns_style
Definition: tabledesign.hxx:35
const sal_Int32 odd_rows_style
Definition: tabledesign.hxx:34
static constexpr auto Items
long Long
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
PointerStyle
SdrTextVertAdjust
Definition: sdtaitm.hxx:29
@ SDRTEXTVERTADJUST_BOTTOM
Definition: sdtaitm.hxx:31
@ SDRTEXTVERTADJUST_CENTER
Definition: sdtaitm.hxx:30
@ SDRTEXTVERTADJUST_TOP
Definition: sdtaitm.hxx:29
static SfxItemSet & rSet
TableStyleSettings.
Definition: svdotable.hxx:75
TableStyleSettings & operator=(const TableStyleSettings &rStyle)
Definition: svdotable.cxx:169
bool operator==(const TableStyleSettings &r) const
Definition: svdotable.cxx:180
constexpr sal_uInt16 SDRATTR_TABLE_FIRST(SDRATTR_CUSTOMSHAPE_LAST+1)
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
constexpr sal_uInt16 SDRATTR_MISC_LAST(SDRATTR_TEXT_CLIPVERTOVERFLOW)
constexpr sal_uInt16 SDRATTR_MISC_FIRST(SDRATTR_CAPTION_LAST+1)
constexpr sal_uInt16 SDRATTR_TABLE_LAST(SDRATTR_TABLE_CELL_GRABBAG)
constexpr sal_uInt16 SDRATTR_SHADOW_LAST(SDRATTR_SHADOWALIGNMENT)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
SdrHdlKind
Definition: svdhdl.hxx:53
SdrObjKind
Definition: svdobjkind.hxx:25
@ Table
media shape
tools::Rectangle maLogicRect
Definition: svdotable.cxx:149
void ResizeRect(tools::Rectangle &rRect, const Point &rRef, const Fraction &rxFact, const Fraction &ryFact)
Definition: svdtrans.cxx:38
SdrCreateCmd
Definition: svdtypes.hxx:27