Resolves tdf#127937 - Feedback for AutoCalculate
Shows an icon in the statusbar if autocalc is off; clicking the icon toggles autocalc on Change-Id: I7fb3296281647583f6f761427d35dcd79282f06c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177418 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
parent
e99ef8f347
commit
a0db0bd2e8
10 changed files with 133 additions and 0 deletions
BIN
icon-themes/colibre/sc/res/calculator_red.png
Normal file
BIN
icon-themes/colibre/sc/res/calculator_red.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 448 B |
1
icon-themes/colibre_svg/sc/res/calculator_red.svg
Normal file
1
icon-themes/colibre_svg/sc/res/calculator_red.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><rect fill="none" height="16" ry="1" stroke="#ff9198" stroke-width="1" width="11" x="2.473253" y=".473253"/><rect fill="none" height="3.01156" ry=".98462" stroke="#ff9198" stroke-width=".98844" width="7.51156" x="4.19422" y="2.19422"/><g fill="#ff9198"><circle cx="5" cy="7.5" r="1"/><circle cx="8" cy="7.5" r="1"/><circle cx="11" cy="7.5" r="1"/><circle cx="5" cy="10.25" r="1"/><circle cx="8" cy="10.25" r="1"/><circle cx="11" cy="10.25" r="1"/><path d="m5.0002116 11.999784a1 1 0 0 0 -1.0004557 1.000456 1 1 0 0 0 1.0004557.999939 1 1 0 0 0 .2930054-.044958c.0630218.028554.1327786.044958.2067057.044958h1.9998779c.073972 0 .1441709-.016371.2072225-.044958a1 1 0 0 0 .2930054.044958 1 1 0 0 0 .9999389-.999939 1 1 0 0 0 -.9999389-1.000456 1 1 0 0 0 -.2930054.044959c-.0630516-.028588-.1332505-.044959-.2072225-.044959h-1.9998779c-.0736821 0-.1433293.016066-.206189.044442a1 1 0 0 0 -.2935221-.044442z"/><circle cx="11" cy="13" r="1"/></g></svg>
|
After Width: | Height: | Size: 1 KiB |
|
@ -378,6 +378,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
|
||||||
sc/source/ui/Accessibility/AccessibleTableBase \
|
sc/source/ui/Accessibility/AccessibleTableBase \
|
||||||
sc/source/ui/Accessibility/AccessibleText \
|
sc/source/ui/Accessibility/AccessibleText \
|
||||||
sc/source/ui/Accessibility/DrawModelBroadcaster \
|
sc/source/ui/Accessibility/DrawModelBroadcaster \
|
||||||
|
sc/source/ui/app/acctrl \
|
||||||
sc/source/ui/app/client \
|
sc/source/ui/app/client \
|
||||||
sc/source/ui/app/drwtrans \
|
sc/source/ui/app/drwtrans \
|
||||||
sc/source/ui/app/inputhdl \
|
sc/source/ui/app/inputhdl \
|
||||||
|
|
|
@ -124,4 +124,6 @@ inline constexpr OUString RID_SVXBMP_SLIDERBUTTON = u"svx/res/slidezoombutton_10
|
||||||
inline constexpr OUString RID_SVXBMP_SLIDERDECREASE = u"svx/res/slidezoomout_10.png"_ustr;
|
inline constexpr OUString RID_SVXBMP_SLIDERDECREASE = u"svx/res/slidezoomout_10.png"_ustr;
|
||||||
inline constexpr OUString RID_SVXBMP_SLIDERINCREASE = u"svx/res/slidezoomin_10.png"_ustr;
|
inline constexpr OUString RID_SVXBMP_SLIDERINCREASE = u"svx/res/slidezoomin_10.png"_ustr;
|
||||||
|
|
||||||
|
inline constexpr OUString RID_BMP_CALCULATOR_RED = u"sc/res/calculator_red.png"_ustr;
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||||
|
|
|
@ -447,5 +447,6 @@
|
||||||
|
|
||||||
#define STR_CONTENT_WITH_UNKNOWN_ENCRYPTION NC_("STR_CONTENT_WITH_UNKNOWN_ENCRYPTION", "Document contains DRM content that is encrypted with an unknown encryption method. Only the un-encrypted content will be shown.")
|
#define STR_CONTENT_WITH_UNKNOWN_ENCRYPTION NC_("STR_CONTENT_WITH_UNKNOWN_ENCRYPTION", "Document contains DRM content that is encrypted with an unknown encryption method. Only the un-encrypted content will be shown.")
|
||||||
|
|
||||||
|
#define STR_AUTOCALC_OFF NC_("STR_AUTOCALC_OFF", "AutoCalculate: Off\nClick to enable.")
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
|
83
sc/source/ui/app/acctrl.cxx
Normal file
83
sc/source/ui/app/acctrl.cxx
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* This file is part of the LibreOffice project.
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* This file incorporates work covered by the following license notice:
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed
|
||||||
|
* with this work for additional information regarding copyright
|
||||||
|
* ownership. The ASF licenses this file to you under the Apache
|
||||||
|
* License, Version 2.0 (the "License"); you may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
|
*/
|
||||||
|
#include <tools/debug.hxx>
|
||||||
|
|
||||||
|
#include <svl/eitem.hxx>
|
||||||
|
#include <vcl/event.hxx>
|
||||||
|
#include <vcl/image.hxx>
|
||||||
|
#include <vcl/status.hxx>
|
||||||
|
|
||||||
|
#include <acctrl.hxx>
|
||||||
|
#include <bitmaps.hlst>
|
||||||
|
#include <scresid.hxx>
|
||||||
|
#include <strings.hrc>
|
||||||
|
|
||||||
|
SFX_IMPL_STATUSBAR_CONTROL(ScAutoCalculateControl, SfxBoolItem);
|
||||||
|
|
||||||
|
ScAutoCalculateControl::ScAutoCalculateControl(sal_uInt16 _nSlotId, sal_uInt16 _nId,
|
||||||
|
StatusBar& rStb)
|
||||||
|
: SfxStatusBarControl(_nSlotId, _nId, rStb)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ScAutoCalculateControl::~ScAutoCalculateControl() {}
|
||||||
|
|
||||||
|
void ScAutoCalculateControl::StateChangedAtStatusBarControl(sal_uInt16, SfxItemState eState,
|
||||||
|
const SfxPoolItem* pState)
|
||||||
|
{
|
||||||
|
if (eState != SfxItemState::DEFAULT || SfxItemState::DISABLED == eState)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto pItem = static_cast<const SfxBoolItem*>(pState);
|
||||||
|
if (!pItem)
|
||||||
|
{
|
||||||
|
SAL_WARN("sc", "Item wasn't a SfxBoolItem");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_bIsActive = pItem->GetValue();
|
||||||
|
|
||||||
|
GetStatusBar().SetQuickHelpText(GetId(), m_bIsActive ? "" : ScResId(STR_AUTOCALC_OFF));
|
||||||
|
GetStatusBar().Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScAutoCalculateControl::Paint(const UserDrawEvent& rUsrEvt)
|
||||||
|
{
|
||||||
|
vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
|
||||||
|
tools::Rectangle aRect(rUsrEvt.GetRect());
|
||||||
|
pDev->Erase();
|
||||||
|
|
||||||
|
if (!m_bIsActive)
|
||||||
|
{
|
||||||
|
const Image aImage(StockImage::Yes, RID_BMP_CALCULATOR_RED);
|
||||||
|
|
||||||
|
Point aPt = aRect.TopLeft();
|
||||||
|
aPt += Point((aRect.GetSize().getWidth() - aImage.GetSizePixel().getWidth()) / 2,
|
||||||
|
(aRect.GetSize().getHeight() - aImage.GetSizePixel().getHeight()) / 2);
|
||||||
|
|
||||||
|
pDev->DrawImage(aPt, aImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScAutoCalculateControl::Click()
|
||||||
|
{
|
||||||
|
if (!m_bIsActive)
|
||||||
|
SfxStatusBarControl::Click(); // exec FID_AUTO_CALC and toggle AutoCalc on
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -86,6 +86,7 @@
|
||||||
|
|
||||||
#include <filter.hxx>
|
#include <filter.hxx>
|
||||||
#include <scabstdlg.hxx>
|
#include <scabstdlg.hxx>
|
||||||
|
#include <acctrl.hxx>
|
||||||
|
|
||||||
OUString ScResId(TranslateId aId)
|
OUString ScResId(TranslateId aId)
|
||||||
{
|
{
|
||||||
|
@ -173,6 +174,7 @@ void ScDLL::Init()
|
||||||
SvxZoomSliderControl ::RegisterControl(SID_ATTR_ZOOMSLIDER, pMod);
|
SvxZoomSliderControl ::RegisterControl(SID_ATTR_ZOOMSLIDER, pMod);
|
||||||
SvxModifyControl ::RegisterControl(SID_DOC_MODIFIED, pMod);
|
SvxModifyControl ::RegisterControl(SID_DOC_MODIFIED, pMod);
|
||||||
XmlSecStatusBarControl ::RegisterControl( SID_SIGNATURE, pMod );
|
XmlSecStatusBarControl ::RegisterControl( SID_SIGNATURE, pMod );
|
||||||
|
ScAutoCalculateControl ::RegisterControl(FID_AUTO_CALC, pMod);
|
||||||
|
|
||||||
SvxPosSizeStatusBarControl ::RegisterControl(SID_ATTR_SIZE, pMod);
|
SvxPosSizeStatusBarControl ::RegisterControl(SID_ATTR_SIZE, pMod);
|
||||||
|
|
||||||
|
|
41
sc/source/ui/inc/acctrl.hxx
Normal file
41
sc/source/ui/inc/acctrl.hxx
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* This file is part of the LibreOffice project.
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* This file incorporates work covered by the following license notice:
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed
|
||||||
|
* with this work for additional information regarding copyright
|
||||||
|
* ownership. The ASF licenses this file to you under the Apache
|
||||||
|
* License, Version 2.0 (the "License"); you may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <sfx2/stbitem.hxx>
|
||||||
|
|
||||||
|
class ScAutoCalculateControl final : public SfxStatusBarControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScAutoCalculateControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb);
|
||||||
|
virtual ~ScAutoCalculateControl() override;
|
||||||
|
|
||||||
|
virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState,
|
||||||
|
const SfxPoolItem* pState) override;
|
||||||
|
virtual void Paint(const UserDrawEvent& rUsrEvt) override;
|
||||||
|
virtual void Click() override;
|
||||||
|
|
||||||
|
SFX_DECL_STATUSBAR_CONTROL();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_bIsActive;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -896,6 +896,7 @@ void ScPreview::StaticInvalidate()
|
||||||
|
|
||||||
SfxBindings& rBindings = pViewFrm->GetBindings();
|
SfxBindings& rBindings = pViewFrm->GetBindings();
|
||||||
rBindings.Invalidate(SID_STATUS_DOCPOS);
|
rBindings.Invalidate(SID_STATUS_DOCPOS);
|
||||||
|
rBindings.Invalidate(FID_AUTO_CALC);
|
||||||
rBindings.Invalidate(SID_ROWCOL_SELCOUNT);
|
rBindings.Invalidate(SID_ROWCOL_SELCOUNT);
|
||||||
rBindings.Invalidate(SID_STATUS_PAGESTYLE);
|
rBindings.Invalidate(SID_STATUS_PAGESTYLE);
|
||||||
rBindings.Invalidate(SID_PREVIEW_PREVIOUS);
|
rBindings.Invalidate(SID_PREVIEW_PREVIOUS);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100"/>
|
<statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:mandatory="false" statusbar:width="55"/>
|
<statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:mandatory="false" statusbar:width="55"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:StatusSelectionMode" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="32"/>
|
<statusbar:statusbaritem xlink:href=".uno:StatusSelectionMode" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="32"/>
|
||||||
|
<statusbar:statusbaritem xlink:href=".uno:AutomaticCalculation" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
<statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:autosize="true" statusbar:mandatory="false" statusbar:ownerdraw="true" statusbar:width="200"/>
|
<statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:autosize="true" statusbar:mandatory="false" statusbar:ownerdraw="true" statusbar:width="200"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130"/>
|
<statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130"/>
|
||||||
|
|
Loading…
Reference in a new issue