summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/NumberFormatControl.hxx2
-rw-r--r--sc/inc/sc.hrc6
-rw-r--r--sc/source/ui/app/inputwin.cxx143
-rw-r--r--sc/source/ui/cctrl/tbzoomsliderctrl.cxx4
-rw-r--r--sc/source/ui/inc/tbzoomsliderctrl.hxx2
-rw-r--r--sc/source/ui/sidebar/NumberFormatControl.cxx4
6 files changed, 79 insertions, 82 deletions
diff --git a/sc/inc/NumberFormatControl.hxx b/sc/inc/NumberFormatControl.hxx
index 77e3843613cd..55002b48d686 100644
--- a/sc/inc/NumberFormatControl.hxx
+++ b/sc/inc/NumberFormatControl.hxx
@@ -29,7 +29,7 @@ class ScNumberFormatControl final : public SfxToolBoxControl
public:
SFX_DECL_TOOLBOX_CONTROL();
- ScNumberFormatControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ ScNumberFormatControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual ~ScNumberFormatControl() override;
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 4e0001d3f1ff..d553c82e2cbe 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -94,11 +94,7 @@
#define SID_NUMBER_PERCENT (SC_VIEW_START + 46)
// "slot" IDs for input images:
-#define SID_INPUT_FUNCTION (SC_VIEW_START + 47)
-#define SID_INPUT_SUM (SC_VIEW_START + 48)
-#define SID_INPUT_EQUAL (SC_VIEW_START + 49)
-#define SID_INPUT_CANCEL (SC_VIEW_START + 50)
-#define SID_INPUT_OK (SC_VIEW_START + 51)
+// 47..51 are used for toolbox ids
#define SID_NUMBER_STANDARD (SC_VIEW_START + 52)
#define SID_NUMBER_DATE (SC_VIEW_START + 53)
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 8974bbc2cf2c..bc91f0c835b6 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -91,6 +91,12 @@ using com::sun::star::beans::XPropertySet;
namespace {
+constexpr ToolBoxItemId SID_INPUT_FUNCTION (SC_VIEW_START + 47);
+constexpr ToolBoxItemId SID_INPUT_SUM (SC_VIEW_START + 48);
+constexpr ToolBoxItemId SID_INPUT_EQUAL (SC_VIEW_START + 49);
+constexpr ToolBoxItemId SID_INPUT_CANCEL (SC_VIEW_START + 50);
+constexpr ToolBoxItemId SID_INPUT_OK (SC_VIEW_START + 51);
+
enum ScNameInputType
{
SC_NAME_INPUT_CELL,
@@ -178,7 +184,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) :
// Position window, 3 buttons, input window
if (!comphelper::LibreOfficeKit::isActive())
{
- InsertWindow (1, aWndPos.get(), ToolBoxItemBits::NONE, 0);
+ InsertWindow (ToolBoxItemId(1), aWndPos.get(), ToolBoxItemBits::NONE, 0);
InsertSeparator (1);
InsertItem (SID_INPUT_FUNCTION, Image(StockImage::Yes, RID_BMP_INPUT_FUNCTION), ToolBoxItemBits::NONE, 2);
}
@@ -194,7 +200,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) :
InsertItem (SID_INPUT_OK, Image(StockImage::Yes, RID_BMP_INPUT_OK), ToolBoxItemBits::NONE, 6);
}
- InsertWindow (7, mxTextWindow.get(), ToolBoxItemBits::NONE, 7);
+ InsertWindow (ToolBoxItemId(7), mxTextWindow.get(), ToolBoxItemBits::NONE, 7);
SetDropdownClickHdl( LINK( this, ScInputWindow, DropdownClickHdl ));
if (!comphelper::LibreOfficeKit::isActive())
@@ -332,87 +338,82 @@ void ScInputWindow::Select()
ScModule* pScMod = SC_MOD();
ToolBox::Select();
- switch ( GetCurItemId() )
+ ToolBoxItemId curItemId = GetCurItemId();
+ if (curItemId == SID_INPUT_FUNCTION)
{
- case SID_INPUT_FUNCTION:
- {
- //! new method at ScModule to query if function autopilot is open
- SfxViewFrame* pViewFrm = SfxViewFrame::Current();
- if ( pViewFrm && ( comphelper::LibreOfficeKit::isActive() || !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ) )
- {
- pViewFrm->GetDispatcher()->Execute( SID_OPENDLG_FUNCTION,
- SfxCallMode::SYNCHRON | SfxCallMode::RECORD );
+ //! new method at ScModule to query if function autopilot is open
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if ( pViewFrm && ( comphelper::LibreOfficeKit::isActive() || !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ) )
+ {
+ pViewFrm->GetDispatcher()->Execute( SID_OPENDLG_FUNCTION,
+ SfxCallMode::SYNCHRON | SfxCallMode::RECORD );
- // The Toolbox will be disabled anyways, so we don't need to switch here,
- // regardless whether it succeeded or not!
+ // The Toolbox will be disabled anyways, so we don't need to switch here,
+ // regardless whether it succeeded or not!
// SetOkCancelMode();
- }
- }
- break;
-
- case SID_INPUT_CANCEL:
- pScMod->InputCancelHandler();
- SetSumAssignMode();
- break;
-
- case SID_INPUT_OK:
- pScMod->InputEnterHandler();
- SetSumAssignMode();
- mxTextWindow->Invalidate(); // Or else the Selection remains
- break;
-
- case SID_INPUT_EQUAL:
+ }
+ }
+ else if (curItemId == SID_INPUT_CANCEL)
+ {
+ pScMod->InputCancelHandler();
+ SetSumAssignMode();
+ }
+ else if (curItemId == SID_INPUT_OK)
+ {
+ pScMod->InputEnterHandler();
+ SetSumAssignMode();
+ mxTextWindow->Invalidate(); // Or else the Selection remains
+ }
+ else if (curItemId == SID_INPUT_EQUAL)
+ {
+ mxTextWindow->StartEditEngine();
+ if ( pScMod->IsEditMode() ) // Isn't if e.g. protected
{
mxTextWindow->StartEditEngine();
- if ( pScMod->IsEditMode() ) // Isn't if e.g. protected
- {
- mxTextWindow->StartEditEngine();
- sal_Int32 nStartPos = 1;
- sal_Int32 nEndPos = 1;
+ sal_Int32 nStartPos = 1;
+ sal_Int32 nEndPos = 1;
- ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
- if ( pViewSh )
- {
- const OUString& rString = mxTextWindow->GetTextString();
- const sal_Int32 nLen = rString.getLength();
+ ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
+ if ( pViewSh )
+ {
+ const OUString& rString = mxTextWindow->GetTextString();
+ const sal_Int32 nLen = rString.getLength();
- ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
- CellType eCellType = rDoc.GetCellType( pViewSh->GetViewData().GetCurPos() );
- switch ( eCellType )
+ ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
+ CellType eCellType = rDoc.GetCellType( pViewSh->GetViewData().GetCurPos() );
+ switch ( eCellType )
+ {
+ case CELLTYPE_VALUE:
{
- case CELLTYPE_VALUE:
- {
- nEndPos = nLen + 1;
- mxTextWindow->SetTextString("=" + rString);
- break;
- }
- case CELLTYPE_STRING:
- case CELLTYPE_EDIT:
- nStartPos = 0;
- nEndPos = nLen;
- break;
- case CELLTYPE_FORMULA:
- nEndPos = nLen;
- break;
- default:
- mxTextWindow->SetTextString("=");
- break;
+ nEndPos = nLen + 1;
+ mxTextWindow->SetTextString("=" + rString);
+ break;
}
+ case CELLTYPE_STRING:
+ case CELLTYPE_EDIT:
+ nStartPos = 0;
+ nEndPos = nLen;
+ break;
+ case CELLTYPE_FORMULA:
+ nEndPos = nLen;
+ break;
+ default:
+ mxTextWindow->SetTextString("=");
+ break;
}
+ }
- EditView* pView = mxTextWindow->GetEditView();
- if (pView)
- {
- if (comphelper::LibreOfficeKit::isActive())
- TextGrabFocus();
- pView->SetSelection( ESelection(0, nStartPos, 0, nEndPos) );
- pScMod->InputChanged(pView);
- SetOkCancelMode();
- pView->SetEditEngineUpdateMode(true);
- }
+ EditView* pView = mxTextWindow->GetEditView();
+ if (pView)
+ {
+ if (comphelper::LibreOfficeKit::isActive())
+ TextGrabFocus();
+ pView->SetSelection( ESelection(0, nStartPos, 0, nEndPos) );
+ pScMod->InputChanged(pView);
+ SetOkCancelMode();
+ pView->SetEditEngineUpdateMode(true);
}
- break;
}
}
}
@@ -1026,7 +1027,7 @@ void ScInputWindow::MenuHdl(std::string_view command)
IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void)
{
- sal_uInt16 nCurID = GetCurItemId();
+ ToolBoxItemId nCurID = GetCurItemId();
EndSelection();
if (nCurID == SID_INPUT_SUM)
{
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 2b00ebea34d1..9c5bbb107ca7 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -36,7 +36,7 @@ SFX_IMPL_TOOLBOX_CONTROL( ScZoomSliderControl, SvxZoomSliderItem );
ScZoomSliderControl::ScZoomSliderControl(
sal_uInt16 nSlotId,
- sal_uInt16 nId,
+ ToolBoxItemId nId,
ToolBox& rTbx )
:SfxToolBoxControl( nSlotId, nId, rTbx )
{
@@ -51,7 +51,7 @@ ScZoomSliderControl::~ScZoomSliderControl()
void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState,
const SfxPoolItem* pState )
{
- sal_uInt16 nId = GetId();
+ ToolBoxItemId nId = GetId();
ToolBox& rTbx = GetToolBox();
ScZoomSliderWnd* pBox = static_cast<ScZoomSliderWnd*>(rTbx.GetItemWindow( nId ));
OSL_ENSURE( pBox ,"Control not found!" );
diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx
index 944f9c86335e..8fc4033cb978 100644
--- a/sc/source/ui/inc/tbzoomsliderctrl.hxx
+++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx
@@ -33,7 +33,7 @@ class ScZoomSliderControl : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- ScZoomSliderControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ScZoomSliderControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
virtual ~ScZoomSliderControl() override;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
diff --git a/sc/source/ui/sidebar/NumberFormatControl.cxx b/sc/source/ui/sidebar/NumberFormatControl.cxx
index 5f823f1b0b39..0337ec5cad04 100644
--- a/sc/source/ui/sidebar/NumberFormatControl.cxx
+++ b/sc/source/ui/sidebar/NumberFormatControl.cxx
@@ -26,7 +26,7 @@ using namespace sc;
SFX_IMPL_TOOLBOX_CONTROL(ScNumberFormatControl, SfxUInt16Item);
-ScNumberFormatControl::ScNumberFormatControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
+ScNumberFormatControl::ScNumberFormatControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx)
: SfxToolBoxControl(nSlotId, nId, rTbx)
{
}
@@ -38,7 +38,7 @@ ScNumberFormatControl::~ScNumberFormatControl()
void ScNumberFormatControl::StateChanged(sal_uInt16, SfxItemState eState,
const SfxPoolItem* pState)
{
- sal_uInt16 nId = GetId();
+ ToolBoxItemId nId = GetId();
ToolBox& rTbx = GetToolBox();
ScNumberFormat* pComboBox = static_cast<ScNumberFormat*>(rTbx.GetItemWindow(nId));