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();
294 if (pAPos && (RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId()) &&
302 nEnd = pEnd->nNode.GetIndex();
303 while( nStart <= nEnd )
305 if( !
GetNodes()[ nStart++ ]->IsTextNode() )
315 SwPaM* pRedlPam =
nullptr;
373 std::multiset<SwSortTextElement> aSortSet;
374 while( aStart <= pEnd->nNode )
385 if( bUndo && !pRedlUndo )
394 for (
const auto& rElem : aSortSet)
407 pUndoSort->
Insert(rElem.nOrg, nBeg +
n);
471 OSL_ENSURE( !rBoxes.
empty(),
"no valid Box list" );
478 FndBox_ aFndBox(
nullptr,
nullptr );
480 FndPara aPara( rBoxes, &aFndBox );
490 FndLines_t::size_type nStart = 0;
496 while( nStart < rLines.size() )
510 if( nStart == rLines.size() )
539 pUndoSort =
new SwUndoSort( rBoxes[0]->GetSttIdx(),
540 rBoxes.
back()->GetSttIdx(),
552 std::multiset<SwSortBoxElement> aSortList;
555 for( sal_uInt16
i = o3tl::narrowing<sal_uInt16>(nStart);
i <
nCount; ++
i)
563 for (
const auto& rElem : aSortList)
567 MoveRow(
this, aFlatBox, rElem.nRow,
i+nStart, aMovedList, pUndoSort);
571 MoveCol(
this, aFlatBox, rElem.nRow,
i+nStart, aMovedList, pUndoSort);
597 for( sal_uInt16
i=0;
i < rBox.
GetCols(); ++
i )
607 bool bMoved = rMovedList.
GetPos(pT) != USHRT_MAX;
624 pTFormat =
const_cast<SwTableBox*
>(pT)->ClaimFrameFormat();
653 bool bMoved = rMovedList.
GetPos(pT) != USHRT_MAX;
668 pTFormat =
const_cast<SwTableBox*
>(pT)->ClaimFrameFormat();
685 OSL_ENSURE(pSource && pTar,
"Source or target missing");
711 bool bDelFirst =
false;
764 FndBoxes_t::size_type nBoxes {0};
766 for (FndLines_t::size_type
i=0;
i < rLines.size(); ++
i)
772 if(
i && nBoxes != rBoxes.size())
775 nBoxes = rBoxes.size();
786 FndLines_t::size_type nLines {0};
788 for (FndBoxes_t::size_type
i = 0;
i < rBoxes.size(); ++
i)
790 FndBox_ const*
const pBox = rBoxes[
i].get();
794 if(
i && nLines != rLines.size() )
797 nLines = rLines.size();
813 for (
const auto & pLine : rLines)
818 for (
const auto &rpB : rBoxes)
836 sal_uInt16 nLines = 0;
837 for (
const auto & pLine : rLines)
841 for (
const auto &rpB : rBoxes)
843 if (!rpB->GetLines().empty())
849 nLines = nLines + nLn;
857 bool bModRow =
false;
861 sal_uInt16 nOldRow =
m_nRow;
862 for (
const auto & pLine : rLines)
866 sal_uInt16 nOldCol =
m_nCol;
867 for( FndBoxes_t::size_type j = 0; j < rBoxes.size(); ++j )
870 const FndBox_ *
const pBox = rBoxes[j].get();
902 FillFlat( *pBox, ( j+1 == rBoxes.size() ) );
917 sal_uInt16 nOff = n_Row *
m_nCols + n_Col;
920 OSL_ENSURE(n_Col <
m_nCols && n_Row <
m_nRows && pTmp,
"invalid array access");
932 return el ? &*el :
nullptr;
937 std::vector<const SwTableBox*>::const_iterator it = std::find(
mBoxes.begin(),
mBoxes.end(), pTableBox);
938 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 &, SwNodeIndex &, SwMoveFlags)=0
virtual void UpdateTableFields(SfxPoolItem *pHt)=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.
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual bool DoesUndo() const =0
Is Undo enabled?
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
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()
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
const SwTextFormatColl * GetDfltTextFormatColl() const
const SwAttrPool & GetAttrPool() const
const SwFrameFormats * GetSpzFrameFormats() const
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
SwIndex & Assign(SwIndexReg *, sal_Int32)
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.
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset)
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
void Copy_(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, bool bNewFrames=true) const
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
delete nodes
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
SwContentNode * GoNext(SwNodeIndex *) const
void SectionDown(SwNodeRange *pRange, SwStartNodeType=SwNormalStartNode)
create a start/end section pair
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwContentNode * GetContentNode(bool bPoint=true) const
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() 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()
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(152)
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(151)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
LanguageType GetAppLanguage()
#define LANGUAGE_DONTKNOW
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
static LanguageType nLang
Marks a position in the document model.
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