LibreOffice Module sw (master) 1
Classes | Macros | Functions
unotbl.cxx File Reference
#include <tuple>
#include <utility>
#include <memory>
#include <vector>
#include <algorithm>
#include <limits>
#include <comphelper/interfacecontainer4.hxx>
#include <o3tl/any.hxx>
#include <o3tl/safeint.hxx>
#include <tools/UnitConversion.hxx>
#include <editeng/memberids.h>
#include <float.h>
#include <swtypes.hxx>
#include <cmdid.h>
#include <unocoll.hxx>
#include <unomid.h>
#include <unomap.hxx>
#include <unotbl.hxx>
#include <section.hxx>
#include <unocrsr.hxx>
#include <hints.hxx>
#include <swtblfmt.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentContentOperations.hxx>
#include <IDocumentFieldsAccess.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <IDocumentState.hxx>
#include <IDocumentLayoutAccess.hxx>
#include <shellres.hxx>
#include <docary.hxx>
#include <ndole.hxx>
#include <ndtxt.hxx>
#include <frame.hxx>
#include <vcl/svapp.hxx>
#include <fmtfsize.hxx>
#include <tblafmt.hxx>
#include <tabcol.hxx>
#include <cellatr.hxx>
#include <fmtpdsc.hxx>
#include <pagedesc.hxx>
#include <viewsh.hxx>
#include <rootfrm.hxx>
#include <tabfrm.hxx>
#include <redline.hxx>
#include <unoport.hxx>
#include <unocrsrhelper.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/text/TableColumnSeparator.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/XTextSection.hpp>
#include <com/sun/star/table/TableBorder.hpp>
#include <com/sun/star/table/TableBorder2.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/table/TableBorderDistances.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart/XChartDataChangeEventListener.hpp>
#include <com/sun/star/chart/ChartDataChangeEvent.hpp>
#include <com/sun/star/table/CellContentType.hpp>
#include <unotextrange.hxx>
#include <unotextcursor.hxx>
#include <unoparagraph.hxx>
#include <svl/numformat.hxx>
#include <svl/zforlist.hxx>
#include <editeng/formatbreakitem.hxx>
#include <editeng/shaditem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
#include <fmtornt.hxx>
#include <editeng/keepitem.hxx>
#include <fmtlsplt.hxx>
#include <swundo.hxx>
#include <SwStyleNameMapper.hxx>
#include <frmatr.hxx>
#include <sortopt.hxx>
#include <sal/log.hxx>
#include <editeng/frmdiritem.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/string.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <swtable.hxx>
#include <docsh.hxx>
#include <fesh.hxx>
#include <itabenum.hxx>
#include <frameformats.hxx>
#include <o3tl/string_view.hxx>
Include dependency graph for unotbl.cxx:

Go to the source code of this file.

Classes

class  SwXTextTable::Impl
 
class  SwXCellRange::Impl
 
class  SwXTableRows::Impl
 
class  SwXTableColumns::Impl
 

Macros

#define UNO_TABLE_COLUMN_SUM   10000
 

Functions

static bool lcl_LineToSvxLine (const table::BorderLine &rLine, SvxBorderLine &rSvxLine)
 
static void lcl_SetSpecialProperty (SwFrameFormat *pFormat, const SfxItemPropertyMapEntry *pEntry, const uno::Any &aValue)
 
static uno::Any lcl_GetSpecialProperty (SwFrameFormat *pFormat, const SfxItemPropertyMapEntry *pEntry)
 
int sw_CompareCellsByRowFirst (std::u16string_view aCellName1, std::u16string_view aCellName2)
 compare position of two cells (check rows first) More...
 
int sw_CompareCellsByColFirst (std::u16string_view aCellName1, std::u16string_view aCellName2)
 compare position of two cells (check columns first) More...
 
int sw_CompareCellRanges (std::u16string_view aRange1StartCell, std::u16string_view aRange1EndCell, std::u16string_view aRange2StartCell, std::u16string_view aRange2EndCell, bool bCmpColsFirst)
 compare position of two cell ranges More...
 
OUString sw_GetCellName (sal_Int32 nColumn, sal_Int32 nRow)
 get cell name at a specified coordinate More...
 
static const SwTableBoxlcl_FindCornerTableBox (const SwTableLines &rTableLines, const bool i_bTopLeft)
 Find the top left or bottom right corner box in given table. More...
 
void sw_NormalizeRange (OUString &rCell1, OUString &rCell2)
 cleanup order in a range More...
 
static rtl::Reference< SwXCelllcl_CreateXCell (SwFrameFormat *pFormat, sal_Int32 nColumn, sal_Int32 nRow)
 
static void lcl_InspectLines (SwTableLines &rLines, std::vector< OUString > &rAllNames)
 
static bool lcl_FormatTable (SwFrameFormat const *pTableFormat)
 
static void lcl_CursorSelect (SwPaM &rCursor, bool bExpand)
 
static void lcl_GetTableSeparators (uno::Any &rRet, SwTable const *pTable, SwTableBox const *pBox, bool bRow)
 
static void lcl_SetTableSeparators (const uno::Any &rVal, SwTable *pTable, SwTableBox const *pBox, bool bRow, SwDoc *pDoc)
 
void sw_setString (SwXCell &rCell, const OUString &rText, bool bKeepNumberFormat=false)
 
void sw_setValue (SwXCell &rCell, double nVal)
 

Macro Definition Documentation

◆ UNO_TABLE_COLUMN_SUM

#define UNO_TABLE_COLUMN_SUM   10000

Definition at line 161 of file unotbl.cxx.

Function Documentation

◆ lcl_CreateXCell()

static rtl::Reference< SwXCell > lcl_CreateXCell ( SwFrameFormat pFormat,
sal_Int32  nColumn,
sal_Int32  nRow 
)
static

◆ lcl_CursorSelect()

static void lcl_CursorSelect ( SwPaM rCursor,
bool  bExpand 
)
static

◆ lcl_FindCornerTableBox()

static const SwTableBox * lcl_FindCornerTableBox ( const SwTableLines rTableLines,
const bool  i_bTopLeft 
)
static

Find the top left or bottom right corner box in given table.

Consider nested lines when finding the box.

Parameters
rTableLinesthe table
i_bTopLeftif true, find top left box, otherwise find bottom right box

Definition at line 496 of file unotbl.cxx.

References SwTableLines::back(), SwTableLines::empty(), SwTableLines::front(), SwTableBox::GetSttNd(), SwTableLine::GetTabBoxes(), and SwTableBox::GetTabLines().

Referenced by SwXTextTable::getPropertyValue(), and SwXTextTable::setPropertyValue().

◆ lcl_FormatTable()

static bool lcl_FormatTable ( SwFrameFormat const *  pTableFormat)
static

◆ lcl_GetSpecialProperty()

static uno::Any lcl_GetSpecialProperty ( SwFrameFormat pFormat,
const SfxItemPropertyMapEntry pEntry 
)
static

◆ lcl_GetTableSeparators()

static void lcl_GetTableSeparators ( uno::Any rRet,
SwTable const *  pTable,
SwTableBox const *  pBox,
bool  bRow 
)
static

◆ lcl_InspectLines()

static void lcl_InspectLines ( SwTableLines rLines,
std::vector< OUString > &  rAllNames 
)
static

Definition at line 555 of file unotbl.cxx.

References SwTableLines::empty(), and lcl_InspectLines().

Referenced by SwXTextTable::getCellNames(), and lcl_InspectLines().

◆ lcl_LineToSvxLine()

static bool lcl_LineToSvxLine ( const table::BorderLine &  rLine,
SvxBorderLine &  rSvxLine 
)
static

Definition at line 164 of file unotbl.cxx.

References ColorTransparency, o3tl::mm100, and o3tl::toTwips().

Referenced by SwXTextTable::setPropertyValue().

◆ lcl_SetSpecialProperty()

static void lcl_SetSpecialProperty ( SwFrameFormat pFormat,
const SfxItemPropertyMapEntry pEntry,
const uno::Any aValue 
)
static

◆ lcl_SetTableSeparators()

static void lcl_SetTableSeparators ( const uno::Any rVal,
SwTable pTable,
SwTableBox const *  pBox,
bool  bRow,
SwDoc pDoc 
)
static

◆ sw_CompareCellRanges()

int sw_CompareCellRanges ( std::u16string_view  aRange1StartCell,
std::u16string_view  aRange1EndCell,
std::u16string_view  aRange2StartCell,
std::u16string_view  aRange2EndCell,
bool  bCmpColsFirst 
)

compare position of two cell ranges

Note
this function probably also make sense only for cell names of non-complex tables
Parameters
rRange1StartCelle.g. "A1" (non-empty string with valid cell name)
rRange1EndCelle.g. "A1" (non-empty string with valid cell name)
rRange2StartCelle.g. "A1" (non-empty string with valid cell name)
rRange2EndCelle.g. "A1" (non-empty string with valid cell name)
bCmpColsFirstif <true> position in columns will be compared first before rows
Returns
-1 if cell_range_1 < cell_range_2; 0 if both cell ranges are equal; +1 if cell_range_1 > cell_range_2

Definition at line 454 of file unotbl.cxx.

References sw_CompareCellsByColFirst(), and sw_CompareCellsByRowFirst().

Referenced by SortSubranges().

◆ sw_CompareCellsByColFirst()

int sw_CompareCellsByColFirst ( std::u16string_view  aCellName1,
std::u16string_view  aCellName2 
)

compare position of two cells (check columns first)

Note
this function probably also make sense only for cell names of non-complex tables
Parameters
rCellName1e.g. "A1" (non-empty string with valid cell name)
rCellName2e.g. "A1" (non-empty string with valid cell name)
Returns
-1 if cell_1 < cell_2; 0 if both cells are equal; +1 if cell_1 > cell_2

Definition at line 427 of file unotbl.cxx.

References SwXTextTable::GetCellPosition(), nCol1, and nCol2.

Referenced by GetTableAndCellsFromRangeRep(), and sw_CompareCellRanges().

◆ sw_CompareCellsByRowFirst()

int sw_CompareCellsByRowFirst ( std::u16string_view  aCellName1,
std::u16string_view  aCellName2 
)

compare position of two cells (check rows first)

Note
this function probably also make sense only for cell names of non-complex tables
Parameters
rCellName1e.g. "A1" (non-empty string with valid cell name)
rCellName2e.g. "A1" (non-empty string with valid cell name)
Returns
-1 if cell_1 < cell_2; 0 if both cells are equal; +1 if cell_1 > cell_2

Definition at line 404 of file unotbl.cxx.

References SwXTextTable::GetCellPosition(), nCol1, and nCol2.

Referenced by sw_CompareCellRanges().

◆ sw_GetCellName()

OUString sw_GetCellName ( sal_Int32  nColumn,
sal_Int32  nRow 
)

◆ sw_NormalizeRange()

void sw_NormalizeRange ( OUString &  rCell1,
OUString &  rCell2 
)

cleanup order in a range

Sorts the input to a uniform format. I.e. for the four possible representation A1:C5, C5:A1, A5:C1, C1:A5 the result will be always A1:C5.

Parameters
[IN,OUT]rCell1 cell name (will be modified to upper-left corner), e.g. "A1" (non-empty string with valid cell name)
[IN,OUT]rCell2 cell name (will be modified to lower-right corner), e.g. "A1" (non-empty string with valid cell name)

Definition at line 525 of file unotbl.cxx.

References SwXTextTable::GetCellPosition(), min(), nCol1, nCol2, and sw_GetCellName().

Referenced by GetSubranges().

◆ sw_setString()

void sw_setString ( SwXCell rCell,
const OUString &  rText,
bool  bKeepNumberFormat = false 
)

Definition at line 668 of file unotbl.cxx.

Referenced by SwXCellRange::setDataArray().

◆ sw_setValue()

void sw_setValue ( SwXCell rCell,
double  nVal 
)

! do we need to set a new number format? Yes, if

Definition at line 686 of file unotbl.cxx.

Referenced by SwXCellRange::setDataArray().