24#include <com/sun/star/uno/Any.hxx>
25#include <com/sun/star/uno/Sequence.hxx>
35constexpr OUStringLiteral
SEP_PATH =
u"Office.Calc/Dialogs/CSVImport";
41 const Any *pProperties;
46 pProperties = aValues.getConstArray();
48 if( !pProperties[0].hasValue() )
53 OUString sFixedWidthLists;
54 pProperties[0] >>= sFixedWidthLists;
72 OUStringBuffer sSplits;
74 sal_uInt32
n = rSplits.
Count();
75 for (sal_uInt32
i = 0;
i <
n; ++
i)
77 sSplits.append(OUString::number(rSplits[
i]) +
";");
80 OUString sFixedWidthLists = sSplits.makeStringAndClear();
87 pProperties = aValues.getArray();
88 pProperties[0] <<= sFixedWidthLists;
95 , mpTableBox(pTableBox)
269 sal_Int32 nNewPos =
nPos;
280 nNewPos = std::min( nNewPos,
GetLastVisPos() - nScroll - sal_Int32( 1 ) );
308 if( bRemove || bInsert )
324 sal_Int32 nNewPos =
nPos;
454 sal_uInt16 nCode = rKCode.
GetCode();
579 sal_Int32 nFirstPos = std::max(
GetPosFromX( 0 ) - 1, sal_Int32(0) );
594 for(
nPos = ((nFirstPos + 9) / 10) * 10;
nPos <= nLastPos;
nPos += 10 )
596 OUString aText( OUString::number(
nPos ) );
597 sal_Int32 nTextWidth =
maBackgrDev->GetTextWidth( aText );
598 sal_Int32 nTextX =
GetX(
nPos ) - nTextWidth / 2;
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
const vcl::KeyCode & GetKeyCode() const
const Point & GetPosPixel() const
bool IsModifierChanged() const
const vcl::Font & GetFont() const
SAL_DLLPRIVATE void DrawOutDev(const Point &, const Size &, const Point &, const Size &, const Printer &)=delete
constexpr tools::Long X() const
Accessible class representing the CSV ruler control.
Base class for the CSV ruler and the data grid control.
void EnableRepaint()
Decreases no-repaint counter and repaints if counter reaches 0.
void Execute(ScCsvCmdType eType, sal_Int32 nParam1=CSV_POS_INVALID, sal_Int32 nParam2=CSV_POS_INVALID)
Executes a command by calling command handler.
void DisableRepaint()
Increases no-repaint counter (controls do not repaint until the last EnableRepaint()).
sal_Int32 GetFirstVisPos() const
Returns the first visible position.
static ScMoveMode GetVertDirection(sal_uInt16 nCode, bool bHomeEnd)
Returns direction code for the keys UP, DOWN, HOME, END, PAGE UP, PAGE DOWN.
static void ImplInvertRect(OutputDevice &rOutDev, const tools::Rectangle &rRect)
Inverts a rectangle in the specified output device.
sal_Int32 GetPosCount() const
Returns the number of available positions.
virtual void GetFocus() override
sal_Int32 GetPosFromX(sal_Int32 nX) const
Returns position from output coordinate.
sal_Int32 GetRulerCursorPos() const
Returns the ruler cursor position.
void InvalidateGfx()
Sets the graphic invalid (next Redraw() will not use cached graphic).
sal_Int32 GetCharWidth() const
Returns the width of one character column.
void ValidateGfx()
Sets the graphic valid (next Redraw() will use cached graphic).
sal_Int32 GetFirstVisLine() const
Returns index of first visible line.
virtual void LoseFocus() override
bool IsValidGfx() const
Returns true, if cached graphic is valid.
void AccSendCaretEvent()
Sends a caret changed event to the accessibility object.
sal_Int32 GetHdrWidth() const
Returns the width of the header column.
void AccSendVisibleEvent()
Sends a visible area changed event to the accessibility object.
sal_Int32 GetVisLineCount() const
Returns the number of visible lines (including partly visible bottom line).
sal_Int32 GetX(sal_Int32 nPos) const
Returns output X coordinate of the specified position.
rtl::Reference< ScAccessibleCsvControl > mxAccessible
Content of virtual devices valid?
sal_Int32 GetLastVisPos() const
Returns the last visible position.
bool IsVisibleSplitPos(sal_Int32 nPos) const
Returns true, if nPos is an allowed AND visible split position.
sal_Int32 GetLastX() const
Returns the X position of the last pixel of the data area.
const ScCsvLayoutData & GetLayoutData() const
Returns a reference to the current layout data.
void Repaint(bool bInvalidate=false)
Repaints all controls.
sal_Int32 GetMaxPosOffset() const
Returns highest possible position for first visible character.
sal_Int32 GetFirstX() const
Returns the X position of the first pixel of the data area.
static ScMoveMode GetHorzDirection(sal_uInt16 nCode, bool bHomeEnd)
Returns direction code for the keys LEFT, RIGHT, HOME, END.
bool IsValidSplitPos(sal_Int32 nPos) const
Returns true, if it is allowed to set a split at nPos.
void ImplDrawArea(sal_Int32 nPosX, sal_Int32 nWidth)
Draws the background and active area to maBackgrDev (only the given X range).
sal_Int32 mnPosCursorLast
Old state for cancellation.
void MoveCursor(sal_Int32 nPos, bool bScroll=true)
Moves cursor to a new position.
void UpdateSplitSize()
Update the split size depending on the last width set by CSVCMD_SETCHARWIDTH.
void MoveMouseTracking(sal_Int32 nPos)
Moves tracking to a new position.
virtual void StyleUpdated() override
void EndMouseTracking()
Applies tracking action for the current tracking position.
ScCsvSplits maOldSplits
Vector with split positions.
void ApplyLayout(const ScCsvLayoutData &rOldData)
Apply current layout data to the ruler.
sal_Int32 GetSplitPos(sal_uInt32 nIndex) const
Returns the position of the specified split.
sal_Int32 FindEmptyPos(sal_Int32 nPos, ScMoveMode eDir) const
Finds next position without a split.
sal_Int32 mnPosMTCurr
Start position of mouse tracking.
void StartMouseTracking(sal_Int32 nPos)
Starts tracking at the specified position.
void ScrollVertRel(ScMoveMode eDir)
Scrolls data grid vertically.
bool HasSplit(sal_Int32 nPos) const
Returns true if at position nPos is a split.
virtual void GetFocus() override
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
sal_Int32 GetWidth() const
Returns the width of the control.
sal_Int32 mnPosMTStart
Last valid position of cursor.
void ImplDrawRulerDev()
Draws the ruler background, all splits and the cursor to maRulerDev.
virtual tools::Rectangle GetFocusRect() override
tools::Rectangle maActiveRect
Size of the control.
ScopedVclPtrInstance< VirtualDevice > maRulerDev
Ruler background, scaling.
Color maTextColor
Color for active part of ruler.
virtual ~ScCsvRuler() override
void ImplDrawSplit(sal_Int32 nPos)
Draws a split to maRulerDev.
ScopedVclPtrInstance< VirtualDevice > maBackgrDev
Grid Parent.
Color maSplitColor
Text and scale color.
virtual bool KeyInput(const KeyEvent &rKEvt) override
void MoveCurrSplitRel(ScMoveMode eDir)
Moves split and cursor to the given direction and commits event.
void MoveCursorToSplit(ScMoveMode eDir)
Sets cursor to an existing split, according to eDir.
void ImplRedraw(vcl::RenderContext &rRenderContext)
Redraws the entire ruler.
Size maWinSize
Tracking: Anytime moved to another position?
void RemoveSplit(sal_Int32 nPos)
Removes a split.
void InitColors()
Reads colors from system settings.
ScCsvRuler(const ScCsvLayoutData &rData, ScCsvTableBox *pTableBox)
If currently mouse tracking.
bool mbTracking
Size of a split circle.
virtual bool MouseMove(const MouseEvent &rMEvt) override
void RemoveAllSplits()
Removes all splits of the ruler.
Color maActiveColor
Background color.
sal_Int32 mnSplitSize
The active area of the ruler.
Color maBackColor
Ruler with splits and cursor.
sal_Int32 GetHeight() const
Returns the height of the control.
void InsertSplit(sal_Int32 nPos)
Inserts a split.
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Creates a new accessible object.
virtual void LoseFocus() override
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
void ImplEraseSplit(sal_Int32 nPos)
Erases a split from maRulerDev.
void MoveCurrSplit(sal_Int32 nNewPos)
Moves split and cursor to nNewPos and commits event.
void ImplInvertCursor(sal_Int32 nPos)
Inverts the cursor bar at the specified position in maRulerDev.
sal_Int32 GetNoScrollPos(sal_Int32 nPos) const
Finds a position nearest to nPos which does not cause scrolling the visible area.
void ImplDrawBackgrDev()
Draws the entire ruler background with scaling to maBackgrDev.
void MoveCursorRel(ScMoveMode eDir)
Moves cursor to the given direction.
void MoveSplit(sal_Int32 nPos, sal_Int32 nNewPos)
Moves a split from nPos to nNewPos.
void InitSizeData()
Initializes all data dependent from the control's size.
bool mbPosMTMoved
Current position of mouse tracking.
virtual void Resize() override
ScCsvSplits maSplits
Split area color.
void ImplSetMousePointer(sal_Int32 nPos)
Sets arrow or horizontal split pointer.
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
A vector of column splits that supports inserting, removing and moving splits.
bool Remove(sal_Int32 nPos)
Removes a split by position.
sal_uInt32 Count() const
Returns the number of splits.
bool Insert(sal_Int32 nPos)
The split container.
sal_uInt32 LowerBound(sal_Int32 nPos) const
Returns index of the first split greater than or equal to nPos.
void Clear()
Removes all elements from the vector.
sal_uInt32 UpperBound(sal_Int32 nPos) const
Returns index of the last split less than or equal to nPos.
bool HasSplit(sal_Int32 nPos) const
Returns true if at position nPos is a split.
The control in the CSV import dialog that contains a ruler and a data grid to visualize and modify th...
void PutProperties(const css::uno::Sequence< OUString > &rNames, const css::uno::Sequence< css::uno::Any > &rValues)
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetWindowColor() const
const Color & GetLabelTextColor() const
const Color & GetFaceColor() const
sal_uInt16 GetGroup() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
virtual OutputDevice & get_ref_device()=0
constexpr ::Color COL_LIGHTRED(0xFF, 0x00, 0x00)
ScMoveMode
Specifies which element should be used to perform an action.
@ MOVE_NEXTPAGE
Previous page relative to current context.
@ MOVE_LAST
First element in current context.
@ MOVE_PREVPAGE
Successor of current element in current context.
@ MOVE_NEXT
Predecessor of current element in current context.
@ MOVE_PREV
Last element in current context.
const sal_Int32 CSV_SCROLL_DIST
Minimum distance to border for auto scroll.
ScCsvDiff
Flags for comparison of old and new control layout data.
@ CSVCMD_MOVESPLIT
Inserts or removes a split. [position].
@ CSVCMD_REMOVESPLIT
Insert a split. [position].
@ 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_SETLINEOFFSET
Change number of data lines. [line count].
@ CSVCMD_TOGGLESPLIT
Remove a split. [position].
@ CSVCMD_REMOVEALLSPLITS
Move a split. [old position, new position].
static void load_FixedWidthList(ScCsvSplits &rSplits)
constexpr OUStringLiteral FIXED_WIDTH_LIST
static void save_FixedWidthList(const ScCsvSplits &rSplits)
constexpr OUStringLiteral SEP_PATH
const sal_uInt32 CSV_VEC_NOTFOUND
Constant for an invalid vector index.
const sal_Int32 CSV_POS_INVALID
Constant for an invalid ruler position.
constexpr sal_uInt16 KEY_MOD1
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEY_SPACE
constexpr sal_uInt16 KEY_SHIFT
constexpr sal_uInt16 KEY_INSERT
constexpr sal_uInt16 KEYGROUP_CURSOR
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
A structure containing all layout data valid for both ruler and data grid (i.e.
sal_Int32 mnPosCursor
Height of a data line.
ScCsvDiff GetDiff(const ScCsvLayoutData &rData) const
Returns differences to rData.