26 , mxScroll(rBuilder.weld_scrolled_window(
"scrolledwindow", true))
27 , mxRulerWeld(new
weld::CustomWeld(rBuilder,
"csvruler", *mxRuler))
28 , mxGridWeld(new
weld::CustomWeld(rBuilder,
"csvgrid", *mxGrid))
34 mxScroll->set_size_request(aSize.Width(), aSize.Height());
41 mxGrid->SetCmdHdl( aLink );
104 mxGrid->UpdateLayoutData();
131 int nUpper =
mxGrid->GetPosCount() + 2;
132 int nPageSize =
mxGrid->GetVisPosCount();
136 nValue = nUpper - (nValue - nLower + nPageSize);
138 mxScroll->hadjustment_configure(nValue, nLower, nUpper,
139 1,
mxGrid->GetVisPosCount() * 3 / 4,
146 1,
mxGrid->GetVisLineCount() - 2,
147 mxGrid->GetVisLineCount());
152 if( (0 <= nPos) && (nPos < mxGrid->GetPosCount()) )
164 const OUString* pTextLines,
const OUString& rSepChars,
165 sal_Unicode cTextSep,
bool bMergeSep,
bool bRemoveSpace )
171 const OUString* pString = pTextLines;
172 for( sal_Int32 nLine =
mxGrid->GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString )
175 mxGrid->ImplSetTextLineFix( nLine, *pString );
177 mxGrid->ImplSetTextLineSep( nLine, *pString, rSepChars, cTextSep, bMergeSep, bRemoveSpace );
186 const sal_Int32 nTypeCount = rListBox.
get_count();
187 std::vector<OUString> aTypeNames( nTypeCount );
190 mxGrid->SetTypeNames( aTypeNames );
196 mxGrid->FillColumnDataFix( rOptions );
198 mxGrid->FillColumnDataSep( rOptions );
205 const ScCsvCmd& rCmd = rCtrl.GetCmd();
214 if( !mxGrid->IsNoRepaint() )
216 mxGrid->Invalidate();
217 mxRuler->Invalidate();
223 MakePosVisible( nParam1 );
231 mxGrid->DisableRepaint();
233 sal_Int32
nPos = mxGrid->GetFirstVisPos();
237 mxGrid->SetColumnStates( aStates );
238 mxGrid->EnableRepaint();
242 maUpdateTextHdl.Call( *
this );
245 mxGrid->SetSelColumnType( nParam1 );
248 maColTypeHdl.Call( *
this );
251 mxGrid->SetFirstImportedLine( nParam1 );
255 OSL_ENSURE( mbFixedMode,
"ScCsvTableBox::CsvCmdHdl::InsertSplit - invalid call" );
256 if( mxRuler->GetSplitCount() + 1 < sal::static_int_cast<sal_uInt32>(
CSV_MAXCOLCOUNT) )
258 mxRuler->InsertSplit( nParam1 );
259 mxGrid->InsertSplit( nParam1 );
263 OSL_ENSURE( mbFixedMode,
"ScCsvTableBox::CsvCmdHdl::RemoveSplit - invalid call" );
264 mxRuler->RemoveSplit( nParam1 );
265 mxGrid->RemoveSplit( nParam1 );
271 OSL_ENSURE( mbFixedMode,
"ScCsvTableBox::CsvCmdHdl::MoveSplit - invalid call" );
272 mxRuler->MoveSplit( nParam1, nParam2 );
273 mxGrid->MoveSplit( nParam1, nParam2 );
276 OSL_ENSURE( mbFixedMode,
"ScCsvTableBox::CsvCmdHdl::RemoveAllSplits - invalid call" );
277 mxRuler->RemoveAllSplits();
278 mxGrid->RemoveAllSplits();
290 maData.mnPosCount = std::max( nParam1, sal_Int32( 1 ) );
291 ImplSetPosOffset( mxGrid->GetFirstVisPos() );
294 ImplSetPosOffset( nParam1 );
297 maData.mnHdrWidth = std::max( nParam1, sal_Int32( 0 ) );
298 ImplSetPosOffset( mxGrid->GetFirstVisPos() );
301 maData.mnCharWidth = std::max( nParam1, sal_Int32( 1 ) );
302 ImplSetPosOffset( mxGrid->GetFirstVisPos() );
305 maData.mnLineCount = std::max( nParam1, sal_Int32( 1 ) );
306 ImplSetLineOffset( mxGrid->GetFirstVisLine() );
309 ImplSetLineOffset( nParam1 );
312 maData.mnHdrHeight = std::max( nParam1, sal_Int32( 0 ) );
313 ImplSetLineOffset( mxGrid->GetFirstVisLine() );
316 maData.mnLineHeight = std::max( nParam1, sal_Int32( 1 ) );
317 ImplSetLineOffset( mxGrid->GetFirstVisLine() );
323 maData.mnColCursor = ((0 <= nParam1) && (nParam1 < mxGrid->GetPosCount())) ? nParam1 :
CSV_POS_INVALID;
333 mxGrid->DisableRepaint();
334 mxRuler->ApplyLayout( aOldData );
335 mxGrid->ApplyLayout( aOldData );
336 mxGrid->EnableRepaint();
343 int nValue = rScroll.hadjustment_get_value();
344 int nUpper = mxGrid->GetPosCount() + 2;
345 int nPageSize = mxGrid->GetVisPosCount();
349 nValue = nUpper - (nValue - nLower + nPageSize);
352 maEndScrollIdle.Start();
#define LINK(Instance, Class, Member)
Change data line pixel height. [height in pixel}.
ScCsvCmdType
Enumeration of possible commands to change any settings of the CSV controls.
bool mbFixedMode
Cached total width for fixed width mode.
Repaint all controls. [-].
sal_Int32 mnWinHeight
Index of first visible line (0-based).
std::unique_ptr< ScCsvRuler > mxRuler
Current layout data of the controls.
sal_Int32 GetParam2() const
const sal_Int32 CSV_POS_INVALID
Constant for an invalid ruler position.
IMPL_LINK_NOARG(ScCsvTableBox, ScrollEndHdl, Timer *, void)
SAL_DLLPRIVATE void MakePosVisible(sal_Int32 nPos)
Moves controls (not cursors!) so that nPos becomes visible.
Set number of first imported line. [line index].
virtual OUString get_text(int pos) const =0
Change position/column count. [character count].
Update cell texts with current split settings. [-].
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).
SAL_DLLPRIVATE void InitHScrollBar()
Initializes size and position data of horizontal scrollbar.
sal_Int32 mnWinWidth
Horizontal scroll offset.
Data for a CSV control command.
Change width of the header column. [width in pixel].
Change height of top header line. [height in pixel].
Base class for the CSV ruler and the data grid control.
A ruler control for the CSV import dialog.
std::vector< sal_Int8 > maData
virtual int get_count() const =0
Move ruler cursor to new position. [position].
constexpr tools::Long Width() const
void InitTypes(const weld::ComboBox &rListBox)
Reads UI strings for data types from the list box.
const sal_Int32 CSV_SCROLL_DIST
Minimum distance to border for auto scroll.
void Init()
Finishes initialization.
SAL_DLLPRIVATE void InitVScrollBar()
Initializes size and position data of vertical scrollbar.
Inserts or removes a split. [position].
Change number of data lines. [line count].
Remove a split. [position].
Send selected column type to external controls. [-].
Idle maEndScrollIdle
Handler for exporting the column type.
void SetSeparatorsMode()
Sets the control to separators mode.
SAL_DLLPRIVATE void InitControls()
Initializes the children controls (pos/size, scroll bars, ...).
void SetFixedWidthMode()
Sets the control to fixed width mode.
Move data grid cursor to new column. [position].
static bool GetLayoutRTL()
Change data type of selected columns. [column type].
std::unique_ptr< weld::ScrolledWindow > mxScroll
Calc-like data table for fixed width mode.
void FillColumnData(ScAsciiOptions &rOptions) const
Fills the options object with current column data.
::std::vector< ScCsvColState > ScCsvColStateVec
The control in the CSV import dialog that contains a ruler and a data grid to visualize and modify th...
Change position offset (scroll pos). [position].
Move to make passed position visible (for mouse tracking). [position].
Change first visible line. [line index].
constexpr tools::Long Height() const
IMPL_LINK(ScCsvTableBox, CsvCmdHdl, ScCsvControl &, rCtrl, void)
ScCsvColStateVec maFixColStates
Called when horizontal scrolling has ended.
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Change character pixel width. [width in pixel].
sal_Int32 mnFixedWidth
Column states in separators mode.
const sal_Int32 CSV_MAXCOLCOUNT
Maximum count of columns.
sal_Int32 GetParam1() const
Insert a split. [position].
void SetPriority(TaskPriority ePriority)
ScCsvTableBox(weld::Builder &rBuilder)
false = Separators, true = Fixed width.
ScCsvCmdType GetType() const
ScCsvColStateVec maSepColStates
Column states in fixed width mode.
Move a split. [old position, new position].
Recalculate splits and cell texts. [-].
std::unique_ptr< ScCsvGrid > mxGrid
The ruler for fixed width mode.
const sal_Int32 CSV_PREVIEW_LINES
TODO make string array dynamic.
A data grid control for the CSV import dialog.
A structure containing all layout data valid for both ruler and data grid (i.e.