26 , mxScroll(rBuilder.weld_scrolled_window(
"scrolledwindow", true))
27 , mxRulerWeld(new
weld::CustomWeld(rBuilder,
"csvruler", *mxRuler))
28 , mxGridWeld(new
weld::CustomWeld(rBuilder,
"csvgrid", *mxGrid))
29 , maEndScrollIdle(
"ScCsvTableBox maEndScrollIdle")
42 mxGrid->SetCmdHdl( aLink );
105 mxGrid->UpdateLayoutData();
132 int nUpper =
mxGrid->GetPosCount() + 2;
133 int nPageSize =
mxGrid->GetVisPosCount();
140 1,
mxGrid->GetVisPosCount() * 3 / 4,
147 1,
mxGrid->GetVisLineCount() - 2,
148 mxGrid->GetVisLineCount());
153 if( (0 <=
nPos) && (nPos < mxGrid->GetPosCount()) )
165 const OUString* pTextLines,
const OUString& rSepChars,
166 sal_Unicode cTextSep,
bool bMergeSep,
bool bRemoveSpace )
172 const OUString* pString = pTextLines;
173 for( sal_Int32 nLine =
mxGrid->GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString )
176 mxGrid->ImplSetTextLineFix( nLine, *pString );
178 mxGrid->ImplSetTextLineSep( nLine, *pString, rSepChars, cTextSep, bMergeSep, bRemoveSpace );
187 const sal_Int32 nTypeCount = rListBox.
get_count();
188 std::vector<OUString> aTypeNames( nTypeCount );
191 mxGrid->SetTypeNames( std::move(aTypeNames) );
197 mxGrid->FillColumnDataFix( rOptions );
199 mxGrid->FillColumnDataSep( rOptions );
206 const ScCsvCmd& rCmd = rCtrl.GetCmd();
215 if( !mxGrid->IsNoRepaint() )
217 mxGrid->Invalidate();
218 mxRuler->Invalidate();
224 MakePosVisible( nParam1 );
232 mxGrid->DisableRepaint();
234 sal_Int32
nPos = mxGrid->GetFirstVisPos();
238 mxGrid->SetColumnStates( std::move(aStates) );
239 mxGrid->EnableRepaint();
243 maUpdateTextHdl.Call( *
this );
246 mxGrid->SetSelColumnType( nParam1 );
249 maColTypeHdl.Call( *
this );
252 mxGrid->SetFirstImportedLine( nParam1 );
256 OSL_ENSURE( mbFixedMode,
"ScCsvTableBox::CsvCmdHdl::InsertSplit - invalid call" );
257 if( mxRuler->GetSplitCount() + 1 < sal::static_int_cast<sal_uInt32>(
CSV_MAXCOLCOUNT) )
259 mxRuler->InsertSplit( nParam1 );
260 mxGrid->InsertSplit( nParam1 );
264 OSL_ENSURE( mbFixedMode,
"ScCsvTableBox::CsvCmdHdl::RemoveSplit - invalid call" );
265 mxRuler->RemoveSplit( nParam1 );
266 mxGrid->RemoveSplit( nParam1 );
272 OSL_ENSURE( mbFixedMode,
"ScCsvTableBox::CsvCmdHdl::MoveSplit - invalid call" );
273 mxRuler->MoveSplit( nParam1, nParam2 );
274 mxGrid->MoveSplit( nParam1, nParam2 );
277 OSL_ENSURE( mbFixedMode,
"ScCsvTableBox::CsvCmdHdl::RemoveAllSplits - invalid call" );
278 mxRuler->RemoveAllSplits();
279 mxGrid->RemoveAllSplits();
291 maData.mnPosCount = std::max( nParam1, sal_Int32( 1 ) );
292 ImplSetPosOffset( mxGrid->GetFirstVisPos() );
295 ImplSetPosOffset( nParam1 );
298 maData.mnHdrWidth = std::max( nParam1, sal_Int32( 0 ) );
299 ImplSetPosOffset( mxGrid->GetFirstVisPos() );
302 maData.mnCharWidth = std::max( nParam1, sal_Int32( 1 ) );
303 ImplSetPosOffset( mxGrid->GetFirstVisPos() );
306 maData.mnLineCount = std::max( nParam1, sal_Int32( 1 ) );
307 ImplSetLineOffset( mxGrid->GetFirstVisLine() );
310 ImplSetLineOffset( nParam1 );
313 maData.mnHdrHeight = std::max( nParam1, sal_Int32( 0 ) );
314 ImplSetLineOffset( mxGrid->GetFirstVisLine() );
317 maData.mnLineHeight = std::max( nParam1, sal_Int32( 1 ) );
318 ImplSetLineOffset( mxGrid->GetFirstVisLine() );
324 maData.mnColCursor = ((0 <= nParam1) && (nParam1 < mxGrid->GetPosCount())) ? nParam1 :
CSV_POS_INVALID;
334 mxGrid->DisableRepaint();
335 mxRuler->ApplyLayout( aOldData );
336 mxGrid->ApplyLayout( aOldData );
337 mxGrid->EnableRepaint();
344 int nValue = rScroll.hadjustment_get_value();
345 int nUpper = mxGrid->GetPosCount() + 2;
346 int nPageSize = mxGrid->GetVisPosCount();
353 maEndScrollIdle.Start();
static bool GetLayoutRTL()
Data for a CSV control command.
sal_Int32 GetParam1() const
ScCsvCmdType GetType() const
sal_Int32 GetParam2() const
Base class for the CSV ruler and the data grid control.
A data grid control for the CSV import dialog.
A ruler control for the CSV import dialog.
The control in the CSV import dialog that contains a ruler and a data grid to visualize and modify th...
void SetUniStrings(const OUString *pTextLines, const OUString &rSepChars, sal_Unicode cTextSep, bool bMergeSep, bool bRemoveSpace)
Fills all cells of all lines with the passed texts (Unicode strings).
Idle maEndScrollIdle
Handler for exporting the column type.
SAL_DLLPRIVATE void InitHScrollBar()
Initializes size and position data of horizontal scrollbar.
void InitTypes(const weld::ComboBox &rListBox)
Reads UI strings for data types from the list box.
void FillColumnData(ScAsciiOptions &rOptions) const
Fills the options object with current column data.
ScCsvTableBox(weld::Builder &rBuilder)
false = Separators, true = Fixed width.
void SetFixedWidthMode()
Sets the control to fixed width mode.
bool mbFixedMode
Cached total width for fixed width mode.
sal_Int32 mnFixedWidth
Column states in separators mode.
SAL_DLLPRIVATE void InitVScrollBar()
Initializes size and position data of vertical scrollbar.
ScCsvColStateVec maFixColStates
Called when horizontal scrolling has ended.
std::unique_ptr< ScCsvRuler > mxRuler
Current layout data of the controls.
ScCsvColStateVec maSepColStates
Column states in fixed width mode.
std::unique_ptr< ScCsvGrid > mxGrid
The ruler for fixed width mode.
SAL_DLLPRIVATE void InitControls()
Initializes the children controls (pos/size, scroll bars, ...).
void Init()
Finishes initialization.
SAL_DLLPRIVATE void MakePosVisible(sal_Int32 nPos)
Moves controls (not cursors!) so that nPos becomes visible.
std::unique_ptr< weld::ScrolledWindow > mxScroll
Calc-like data table for fixed width mode.
void SetSeparatorsMode()
Sets the control to separators mode.
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual OUString get_text(int pos) const=0
virtual int get_count() const=0
const sal_Int32 CSV_SCROLL_DIST
Minimum distance to border for auto scroll.
const sal_Int32 CSV_PREVIEW_LINES
TODO make string array dynamic.
const sal_Int32 CSV_MAXCOLCOUNT
Maximum count of columns.
ScCsvCmdType
Enumeration of possible commands to change any settings of the CSV controls.
@ CSVCMD_SETCOLUMNTYPE
Update cell texts with current split settings. [-].
@ CSVCMD_SETLINECOUNT
Change character pixel width. [width in pixel].
@ CSVCMD_SETFIRSTIMPORTLINE
Send selected column type to external controls. [-].
@ CSVCMD_SETHDRWIDTH
Change position offset (scroll pos). [position].
@ CSVCMD_SETLINEHEIGHT
Change height of top header line. [height in pixel].
@ CSVCMD_MOVEGRIDCURSOR
Move ruler cursor to new position. [position].
@ CSVCMD_SETPOSCOUNT
Repaint all controls. [-].
@ CSVCMD_REPAINT
No command. [-].
@ CSVCMD_EXPORTCOLUMNTYPE
Change data type of selected columns. [column type].
@ CSVCMD_MOVESPLIT
Inserts or removes a split. [position].
@ CSVCMD_UPDATECELLTEXTS
Recalculate splits and cell texts. [-].
@ CSVCMD_NEWCELLTEXTS
Move to make passed position visible (for mouse tracking). [position].
@ CSVCMD_SETPOSOFFSET
Change position/column count. [character count].
@ CSVCMD_REMOVESPLIT
Insert a split. [position].
@ CSVCMD_SETCHARWIDTH
Change width of the header column. [width in pixel].
@ CSVCMD_MAKEPOSVISIBLE
Move data grid cursor to new column. [position].
@ CSVCMD_INSERTSPLIT
Set number of first imported line. [line index].
@ CSVCMD_MOVERULERCURSOR
Change data line pixel height. [height in pixel}.
@ CSVCMD_SETHDRHEIGHT
Change first visible line. [line index].
@ CSVCMD_SETLINEOFFSET
Change number of data lines. [line count].
@ CSVCMD_TOGGLESPLIT
Remove a split. [position].
@ CSVCMD_REMOVEALLSPLITS
Move a split. [old position, new position].
::std::vector< ScCsvColState > ScCsvColStateVec
const sal_Int32 CSV_POS_INVALID
Constant for an invalid ruler position.
IMPL_LINK(ScCsvTableBox, CsvCmdHdl, ScCsvControl &, rCtrl, void)
IMPL_LINK_NOARG(ScCsvTableBox, ScrollEndHdl, Timer *, void)
#define LINK(Instance, Class, Member)
std::vector< sal_Int8, boost::noinit_adaptor< std::allocator< sal_Int8 > > > maData
A structure containing all layout data valid for both ruler and data grid (i.e.
sal_Int32 mnWinHeight
Index of first visible line (0-based).
sal_Int32 mnWinWidth
Horizontal scroll offset.