21#include <osl/diagnose.h>
109 rtl_math_ConversionStatus eStatus;
113 if( rtl_math_ConversionStatus_Ok != eStatus || nEnd == 0 )
141 nCmp =
n1 <
n2 ? -1 :
n1 ==
n2 ? 0 : 1;
182 : nOrg(rPos.GetIndex()), aPos(rPos)
193 const OUString& rStr = pTextNd->
GetText();
197 sal_Int32 nStart = 0;
200 while( nStart != -1 &&
i < nDCount)
202 nStart = rStr.indexOf( nDeli, nStart );
212 sal_Int32 nEnd = rStr.indexOf( nDeli, nStart+1 );
214 return rStr.copy( nStart );
215 return rStr.copy( nStart, nEnd-nStart );
236 OUStringBuffer aRetStr;
240 OSL_ENSURE(pMyBox,
"No atomic Box");
254 return aRetStr.makeStringAndClear();
286 auto [pStart, pEnd] = rPaM.
StartEnd();
294 if (pAnchorNode && (RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId()) &&
295 pStart->GetNode() <= *pAnchorNode && *pAnchorNode <= pEnd->
GetNode() )
302 nEnd = pEnd->GetNodeIndex();
303 while( nStart <= nEnd )
305 if( !
GetNodes()[ nStart++ ]->IsTextNode() )
315 SwPaM* pRedlPam =
nullptr;
372 std::multiset<SwSortTextElement> aSortSet;
373 while( aStart <= pEnd->
GetNode() )
384 if( bUndo && !pRedlUndo )
393 for (
const auto& rElem : aSortSet)
406 pUndoSort->
Insert(rElem.nOrg, nBeg +
n);
466 OSL_ENSURE( !rBoxes.
empty(),
"no valid Box list" );
473 FndBox_ aFndBox(
nullptr,
nullptr );
475 FndPara aPara( rBoxes, &aFndBox );
485 FndLines_t::size_type nStart = 0;
491 while( nStart < rLines.size() )
505 if( nStart == rLines.size() )
531 pUndoSort =
new SwUndoSort( rBoxes[0]->GetSttIdx(),
532 rBoxes.
back()->GetSttIdx(),
544 std::multiset<SwSortBoxElement> aSortList;
547 for( sal_uInt16
i = o3tl::narrowing<sal_uInt16>(nStart);
i <
nCount; ++
i)
555 for (
const auto& rElem : aSortList)
559 MoveRow(
this, aFlatBox, rElem.nRow,
i+nStart, aMovedList, pUndoSort);
563 MoveCol(
this, aFlatBox, rElem.nRow,
i+nStart, aMovedList, pUndoSort);
589 for( sal_uInt16
i=0;
i < rBox.
GetCols(); ++
i )
599 bool bMoved = rMovedList.
GetPos(pT) != USHRT_MAX;
616 pTFormat =
const_cast<SwTableBox*
>(pT)->ClaimFrameFormat();
617 pTFormat->LockModify();
623 pTFormat->UnlockModify();
645 bool bMoved = rMovedList.
GetPos(pT) != USHRT_MAX;
660 pTFormat =
const_cast<SwTableBox*
>(pT)->ClaimFrameFormat();
661 pTFormat->LockModify();
667 pTFormat->UnlockModify();
677 OSL_ENSURE(pSource && pTar,
"Source or target missing");
703 bool bDelFirst =
false;
756 FndBoxes_t::size_type nBoxes {0};
758 for (FndLines_t::size_type
i=0;
i < rLines.size(); ++
i)
764 if(
i && nBoxes != rBoxes.size())
767 nBoxes = rBoxes.size();
778 FndLines_t::size_type nLines {0};
780 for (FndBoxes_t::size_type
i = 0;
i < rBoxes.size(); ++
i)
782 FndBox_ const*
const pBox = rBoxes[
i].get();
786 if(
i && nLines != rLines.size() )
789 nLines = rLines.size();
805 for (
const auto & pLine : rLines)
810 for (
const auto &rpB : rBoxes)
828 sal_uInt16 nLines = 0;
829 for (
const auto & pLine : rLines)
833 for (
const auto &rpB : rBoxes)
835 if (!rpB->GetLines().empty())
841 nLines = nLines + nLn;
849 bool bModRow =
false;
853 sal_uInt16 nOldRow =
m_nRow;
854 for (
const auto & pLine : rLines)
858 sal_uInt16 nOldCol =
m_nCol;
859 for( FndBoxes_t::size_type j = 0; j < rBoxes.size(); ++j )
862 const FndBox_ *
const pBox = rBoxes[j].get();
894 FillFlat( *pBox, ( j+1 == rBoxes.size() ) );
909 sal_uInt16 nOff = n_Row *
m_nCols + n_Col;
912 OSL_ENSURE(n_Col <
m_nCols && n_Row <
m_nRows && pTmp,
"invalid array access");
924 return el ? &*el :
nullptr;
929 std::vector<const SwTableBox*>::const_iterator it = std::find(
mBoxes.begin(),
mBoxes.end(), pTableBox);
930 return it ==
mBoxes.end() ? USHRT_MAX : it -
mBoxes.begin();
sal_uInt32 GetValue() const
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
void loadCollatorAlgorithm(const OUString &rAlgorithm, const css::lang::Locale &rLocale, sal_Int32 nOption)
FlatFndBox(SwDoc *pDocPtr, const FndBox_ &rBox)
Generate two-dimensional array of FndBoxes.
sal_uInt16 GetColCount(const FndBox_ &rBox)
Maximum count of Columns (Boxes)
std::unique_ptr< FndBox_ const *[]> m_pArr
bool CheckLineSymmetry(const FndBox_ &rBox)
All Lines of a Box need to have same number of Boxes.
const SfxItemSet * GetItemSet(sal_uInt16 nCol, sal_uInt16 nRow) const
sal_uInt16 GetRowCount(const FndBox_ &rBox)
Maximum count of Rows (Lines)
void FillFlat(const FndBox_ &, bool bLastBox=false)
Create a linear array of atomic FndBoxes.
sal_uInt16 GetCols() const
sal_uInt16 GetRows() const
const FndBox_ * GetBox(sal_uInt16 nCol, sal_uInt16 nRow) const
Access a specific Cell.
std::vector< std::optional< SfxItemSet > > m_vItemSets
using optional because SfxItemSet has no default constructor
bool CheckBoxSymmetry(const FndLine_ &rLn)
Check Box for symmetry (All Boxes of a Line need to have same number of Lines)
const FndLines_t & GetLines() const
const SwTableBox * GetBox() const
const FndBoxes_t & GetBoxes() const
virtual bool MoveNodeRange(SwNodeRange &, SwNode &, SwMoveFlags)=0
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
static bool IsShowOriginal(const RedlineFlags eM)
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void SetModified()=0
Must be called manually at changes of format.
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
double stringToDouble(std::u16string_view aString, bool bUseGroupSep, rtl_math_ConversionStatus *pStatus, sal_Int32 *pParseEnd) const
virtual sal_Int32 Len() const
bool SortTable(const SwSelBoxes &rBoxes, const SwSortOptions &)
Sort Table in the Document.
void UpdateCharts(const OUString &rName) const
IDocumentState const & getIDocumentState() const
bool SortText(const SwPaM &, const SwSortOptions &)
Sort Text in the Document.
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
const SwTextFormatColl * GetDfltTextFormatColl() const
const SwAttrPool & GetAttrPool() const
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
sal_uInt16 GetPos(const SwTableBox *pTableBox) const
std::vector< const SwTableBox * > mBoxes
void push_back(const SwTableBox *&rpTableBox)
void RestoreUpperFrames(SwNodes &rNds, SwNodeOffset nStt, SwNodeOffset nEnd)
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
SwNodeOffset StartOfSectionIndex() const
const SwStartNode * StartOfSectionNode() const
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
const SwEndNode * EndOfSectionNode() const
SwTextNode * MakeTextNode(SwNode &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
SwContentNode * GoNext(SwNodeIndex *) const
void SectionDown(SwNodeRange *pRange, SwStartNodeType=SwNormalStartNode)
create a start/end section pair
void Copy_(const SwNodeRange &rRg, SwNode &rInsPos, bool bNewFrames=true) const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
SwContentNode * GetPointContentNode() const
SwContentNode * GetMarkContentNode() const
const SwPosition * GetPoint() const
SwTableBox is one table cell in the document model.
SwNodeOffset GetSttIdx() const
SwFrameFormat * GetFrameFormat()
const SwStartNode * GetSttNd() const
SwTableLine is one table row in the document model.
const SwTable & GetTable() const
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
void SetHTMLTableLayout(std::shared_ptr< SwHTMLTableLayout > const &r)
SwTableLines & GetTabLines()
bool IsHeadline(const SwTableLine &rLine) const
SwTableFormat * GetFrameFormat()
void SwitchFormulasToRelativeRepresentation()
sal_uInt16 GetRowsToRepeat() const
SwTextNode is a paragraph in the document model.
const OUString & GetText() const
void SetValues(const SwPaM &rPam)
void SetSaveRange(const SwPaM &rRange)
void Insert(const OUString &rOrgPos, const OUString &rNewPos)
const Value & back() const
void MoveCol(SwDoc *pDoc, const FlatFndBox &rBox, sal_uInt16 nS, sal_uInt16 nT, SwMovedBoxes &rMovedList, SwUndoSort *pUD)
Move a column.
void MoveRow(SwDoc *pDoc, const FlatFndBox &rBox, sal_uInt16 nS, sal_uInt16 nT, SwMovedBoxes &rMovedList, SwUndoSort *pUD)
Move a row.
void MoveCell(SwDoc *pDoc, const SwTableBox *pSource, const SwTableBox *pTar, bool bMovedBefore, SwUndoSort *pUD)
Move a single Cell.
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(158)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(157)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
LanguageType GetAppLanguage()
#define LANGUAGE_DONTKNOW
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
static LanguageType nLang
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
SwSortBoxElement(sal_uInt16 nRC)
SortingElement for Tables.
virtual double GetValue(sal_uInt16 nKey) const override
virtual OUString GetKey(sal_uInt16 nKey) const override
Get Key for a cell.
static double StrToDouble(std::u16string_view rStr)
static std::optional< OUString > xLastAlgorithm
bool operator<(const SwSortElement &) const
static SwSortOptions * pOptions
static css::lang::Locale * pLocale
static const FlatFndBox * pBox
int keycompare(const SwSortElement &rCmp, sal_uInt16 nKey) const
static void Init(SwDoc *, const SwSortOptions &rOpt, FlatFndBox const *=nullptr)
Construct a SortElement for the Sort.
virtual double GetValue(sal_uInt16 nKey) const
static CollatorWrapper * pSortCollator
virtual OUString GetKey(sal_uInt16 nKey) const =0
static LocaleDataWrapper * pLclData
std::vector< SwSortKey > aKeys
SwSortDirection eDirection
virtual OUString GetKey(sal_uInt16 nKey) const override
SwSortTextElement(const SwNodeIndex &rPos)
SortingElement for Text.
bool anyOf(strong_int v) const
#define SW_COLLATOR_IGNORES
void ForEach_FndLineCopyCol(SwTableLines &rLines, FndPara *pFndPara)
This creates a structure mirroring the SwTable structure that contains all rows and non-leaf boxes (a...
std::vector< std::unique_ptr< FndLine_ > > FndLines_t
std::vector< std::unique_ptr< FndBox_ > > FndBoxes_t