Hello!
I attached two patches (= 2 commits).
Improvement: #39430 (http://bugs.freedesktop.org/show_bug.cgi?id=39430)
Author: Dmitry Ashkadov
License: LGPLv3/MPL
Should I close bug #39430 ?
07.09.2011 18:10, Dmitry. A. Ashkadov пишет:
Hello!
Can I try to improve LibreOffice? I had found task «Improving Saving
Information Icon in the Status Bar»
(http://bugs.freedesktop.org/show_bug.cgi?id=39430). But I don't know
who can help me, who can give me icons.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
--
Best Regards,
Dmitry
From 3bd23342be1f14b428a96cfb2cdb81bc746c1e32 Mon Sep 17 00:00:00 2001
From: Dmitry Ashkadov <dmitry.ashkadov@gmail.com>
Date: Mon, 12 Sep 2011 18:57:42 +0400
Subject: [PATCH 1/2] #39430: Saving Information Icon in the Status Bar was
improved.
---
default_images/svx/res/doc_modified_feedback.png | Bin 0 -> 462 bytes
default_images/svx/res/doc_modified_no_14.png | Bin 429 -> 369 bytes
default_images/svx/res/doc_modified_yes_14.png | Bin 506 -> 462 bytes
svx/inc/svx/dialogs.hrc | 9 +-
svx/inc/svx/modctrl.hxx | 9 ++
svx/source/stbctrls/modctrl.cxx | 88 ++++++++++++++++------
svx/source/stbctrls/stbctrls.src | 10 ++-
7 files changed, 89 insertions(+), 27 deletions(-)
create mode 100644 default_images/svx/res/doc_modified_feedback.png
diff --git a/default_images/svx/res/doc_modified_feedback.png
b/default_images/svx/res/doc_modified_feedback.png
new file mode 100644
index 0000000000000000000000000000000000000000..1fa1f7421d48a207aa2a90957b8b8a49ed87296d
GIT binary patch
literal 462
zcmV;<0WtoGP)<h;3K|Lk000e1NJLTq000gE000XJ1^@s6Pldc<00004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10ZU0lK~yM_jgm1-LQxdQe_g#8`T~aroeZK71BaHTrXUnTFz_4H
z<qgr0Lj>*7ClKz|2WShV;6>0H1O|mo1rAb6b|3Y6=C#Q(Eb2F%!}<R>!#QL9ejfm>
zbpXWp;?7#T>bmZw*7^p>0&hyGae(MhFs79HY})PiRJ~q5)mkrEYuAJjbzovJ7yLph
zm7-WICZ&{~5aLw`u?#f-6bEvtR7y%IJ!@^Kl*;}~e13l-NW4%kmy=RTPis9tB8FiI
zfbI9VHVps{?rZEfcX1qtLZOiCcDsioqVM|v?A`8Cy;|e!@tBi`BQ~bD>2x}z(`k$`
zQzN1=27t}!9cE%Vwl3CjGgW4t9IaOCTLy;CVT_^I>k$c~?9bIWpY&KrEYfH+2!h~u
z(f55KkqGg49DwD_3IO?hp5e?-8{aCG%JAp>L@+2m0ACS-(yir=wEzGB07*qoM6N<$
Ef<T<VS^xk5
literal 0
HcmV?d00001
diff --git a/default_images/svx/res/doc_modified_no_14.png
b/default_images/svx/res/doc_modified_no_14.png
index cc9d6f58155cb66b140aa41415a0f04d16795e11..2fbd22e956f94a45157d8b6cb9e3c32ec1178d8f 100644
GIT binary patch
delta 335
zcmV-V0kHn91Mvco7a9u)1^@s6Pldc<00004b3#c}2nYxWd<bNSkw6%K8FWQhbW?9;
zba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10PaadK~yM_jnOe~gD@Bc;Af0b1`i%G
zxHs|z=oGb^k;oM~_6S|@*iKzLaU=$cDzK1cjNK(vGz7J8`Ypdt)-RJ7BLJYPswYAS
z#U+H0uW6dz%d%{=)@J~J#~9;W6vZ<Dq^lxTN-ak;O~dQDe$-mOdhb6dr6)p2w%jM!
zi4X!(%0rfA4{4fuO6ePb&p+Wc4k64+sh5AjYpk`t+d${sF6Nv=N_lY3-EW{VW*4??
z3n2uIF?<7uVc3OT*KImK-_iFyLI@bg5!PB*Yk$p4X9JBfNRk99j4?3AZoa%;XAS2(
h&*@EZNsQ4i^EaJmaj6owVRQfh002ovPDHLkV1hIFh{ON@
delta 395
zcmV;60d)TH0<8m(7by-11^@s6A4o0H00001b5ch_0Itp)=>Px#24YJ`L;(K){{a7>
zy{D6rF&KXbbV*G`2ipVz6aoiMY<pw?0013nR9JLFZ*6U5Zgc<u0000(a%Ew3Wn>_C
zX>@2HM@dakWG-a~00035Nkl<ZD9^ppy-tQO6b9h8rGcoit_-~$5(qPKPzM&m>J2z}
z0q(%~#lcJ9ei$4GL-`FMJx+YVAZlV_r<0ubNl$-&fd5`>E%H2nA|k%&^|o!F;y8ZK
zvg{GS4P(qCN%9N;VoebdPm<)Us;asw%Q7yC;>0<BTbAXXh%VPYKN>|Tg)j^qA;cZ$
z+!$kCiAetl0l;-#_`ZKZM6nQprD^)|E4bny2pr3@9*Uw+J2=ntA(m3Y^E_u9$J-s$
zS|3-!x~`#=Lff|2JJ|RAA#9pvmpMO2*L7Hy1;a34nkG!s^r>DmJE*mW5CT$4NGZSE
pd3zkO8P!Bl^zAJ(#>}7p>IWPwbD3qp&!GSS002ovPDHLkV1jr$p~(OM
diff --git a/default_images/svx/res/doc_modified_yes_14.png
b/default_images/svx/res/doc_modified_yes_14.png
index e78de2384c0201224f9223bf753baadd1524f567..8a111d6532d08d489b3f3ff33be7b259a16a1f77 100644
GIT binary patch
delta 429
zcmV;e0aE_@1I`1G7a9u)1^@s6Pldc<00004b3#c}2nYxWd<bNSkw6%K8FWQhbW?9;
zba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10ZU0lK~yM_ebT*313?sq;n&$LO2n*%
zKiMv6L=jOW7a$0dNGc(B5Qc!gMeOVZ+cbk0U}GT&sg(5obxIl|HbzT#z|F>)wFrrU
z7{BTq<~*F@%tRc=04Sw@LST~LyjW}ZDwWEEQtAm<20Bv8DS*V#;G~pt(6rm_Oub&e
zR!VJKYs*52Ixy3J7mP_dou*JI%(||7C4~4ALhJy||DpNr;rY1%w$?^c%H{F!^8-^|
zgYO7aT_c?o1FV$V9Dz|3^@`L2Vxx#XJ3wp{A+><#dF1o?*>1Ogdp-iS*2GT@%>E*A
z>z252O5D1|>@O1BT;lsaK@em{U=RdMtZd=b-XWVqY?UFK!>PUV<}D3o`bi8!V+`TP
zEAHI|9Nl9M*LlwD5{l$_sI|s%9H#v&96y4SfRiSx&hM$U)_-p7luD)HpYvD3e(?hy
X%Y*}$*7flK00008NkvXXu0mjfZfL|U
delta 473
zcmV;~0Ve*=1NsAy7by-11^@s6A4o0H00001b5ch_0Itp)=>Px#24YJ`L;(K){{a7>
zy{D6rF&KXbbV*G`2ipVz6ay<|uO`L-0013nR9JLFZ*6U5Zgc<u0000(a%Ew3Wn>_C
zX>@2HM@dakWG-a~0003|Nkl<ZD9^o;yGjF55Qe`!*<IA)fbkNM1hMl0gouKTMA>u}
zc>-ZKZzFb|m#`E}Cz!^{Cs5QhUXtdlaXr~RYh!<+7%zq3R5Q%~%?vXG|836DQA!N}
z_e1X9ah#nn3@?;YH$Vl*q9}6tBy__t90i?DXTH^Hohqfag%G>e+7n=Am>1uTQZARN
z*Xz>v{o_2(Giz-f====kDF6$lS%M%adY*SGgm9uLs(cGt^FX(~Mz6h2_pHj?bb%lU
zr0;+GEu~a-3^c|7(7!r>+#!9w1>w=Z+($}DtyYu9n4{4`hK|-6(`(beKE!b)*aZ7>
zNB>4)Sf#wOi`IH^tYaL<_{9w-D|-lk2E+uyD>Ajz<S|(uX~saUHEEiXmzrc*M()ls
zNK-DKwn&m>r1^4G*L9J_W#s1hTTRP?^L{1jFTpsDvqqy)_~p~mKmY10LfD1_=6;g~
P00000NkvXXu0mjfE?3WO
diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc
index b10c4b3..d8e79ea 100755
--- a/svx/inc/svx/dialogs.hrc
+++ b/svx/inc/svx/dialogs.hrc
@@ -1156,9 +1156,10 @@
#define SVX_OOO_BUILD_START (RID_SVX_START + 1200)
-#define RID_SVXBMP_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 1)
-#define RID_SVXBMP_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 2)
-#define RID_SVXSTR_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 3)
-#define RID_SVXSTR_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 4)
+#define RID_SVXBMP_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 1)
+#define RID_SVXBMP_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 2)
+#define RID_SVXBMP_DOC_MODIFIED_FEEDBACK (SVX_OOO_BUILD_START + 3)
+#define RID_SVXSTR_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 4)
+#define RID_SVXSTR_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 5)
#endif
diff --git a/svx/inc/svx/modctrl.hxx b/svx/inc/svx/modctrl.hxx
index ef2859e..bbfec1f 100644
--- a/svx/inc/svx/modctrl.hxx
+++ b/svx/inc/svx/modctrl.hxx
@@ -35,6 +35,9 @@
#include <boost/shared_ptr.hpp>
+// Forward declarations
+class Timer;
+
// class SvxModifyControl ------------------------------------------------
class SVX_DLLPUBLIC SvxModifyControl : public SfxStatusBarControl
@@ -51,6 +54,12 @@ public:
static sal_uIntPtr GetDefItemWidth(const StatusBar& rStb);
+private: // Links
+ DECL_LINK( OnTimer, Timer * );
+
+private: // Functions
+ void _repaint();
+
private:
struct ImplData;
::boost::shared_ptr<ImplData> mpImpl;
diff --git a/svx/source/stbctrls/modctrl.cxx b/svx/source/stbctrls/modctrl.cxx
index 8239aa8..6ab2689 100644
--- a/svx/source/stbctrls/modctrl.cxx
+++ b/svx/source/stbctrls/modctrl.cxx
@@ -33,6 +33,7 @@
#include <vcl/status.hxx>
#include <vcl/image.hxx>
+#include <vcl/timer.hxx>
#include <svl/eitem.hxx>
#include <sfx2/app.hxx>
@@ -48,20 +49,37 @@ using ::rtl::OUString;
SFX_IMPL_STATUSBAR_CONTROL(SvxModifyControl, SfxBoolItem);
+
+namespace
+{
+const unsigned _FEEDBACK_TIMEOUT = 3000;
+}
+
+
// class SvxModifyControl ------------------------------------------------
struct SvxModifyControl::ImplData
{
- Image maModifiedButton;
- Image maNonModifiedButton;
+ enum ModificationState
+ {
+ MODIFICATION_STATE_NO = 0,
+ MODIFICATION_STATE_YES,
+ MODIFICATION_STATE_FEEDBACK,
+ MODIFICATION_STATE_SIZE
+ };
+
+ Timer maTimer;
+ Image maImages[MODIFICATION_STATE_SIZE];
- bool mbModified;
+ ModificationState mnModState;
- ImplData() :
- maModifiedButton( SVX_RES(RID_SVXBMP_DOC_MODIFIED_YES) ),
- maNonModifiedButton( SVX_RES(RID_SVXBMP_DOC_MODIFIED_NO) ),
- mbModified(false)
+ ImplData():
+ mnModState(MODIFICATION_STATE_NO)
{
+ maImages[MODIFICATION_STATE_NO] = Image(SVX_RES(RID_SVXBMP_DOC_MODIFIED_NO));
+ maImages[MODIFICATION_STATE_YES] = Image(SVX_RES(RID_SVXBMP_DOC_MODIFIED_YES));
+ maImages[MODIFICATION_STATE_FEEDBACK] = Image(SVX_RES(RID_SVXBMP_DOC_MODIFIED_FEEDBACK));
+ maTimer.SetTimeout(_FEEDBACK_TIMEOUT);
}
};
@@ -72,6 +90,7 @@ SvxModifyControl::SvxModifyControl( sal_uInt16 _nSlotId,
SfxStatusBarControl( _nSlotId, _nId, rStb ),
mpImpl(new ImplData)
{
+ mpImpl->maTimer.SetTimeoutHdl( LINK(this, SvxModifyControl, OnTimer) );
}
// -----------------------------------------------------------------------
@@ -84,13 +103,43 @@ void SvxModifyControl::StateChanged( sal_uInt16, SfxItemState eState,
DBG_ASSERT( pState->ISA( SfxBoolItem ), "invalid item type" );
SfxBoolItem* pItem = (SfxBoolItem*)pState;
- mpImpl->mbModified = pItem->GetValue();
+ mpImpl->maTimer.Stop();
- if ( GetStatusBar().AreItemsVisible() )
- GetStatusBar().SetItemData( GetId(), 0 ); // force repaint
+ bool modified = pItem->GetValue();
+ bool start = ( !modified && mpImpl->mnModState == ImplData::MODIFICATION_STATE_YES); //
should timer be started and feedback image displayed ?
- int nResId = mpImpl->mbModified ? RID_SVXSTR_DOC_MODIFIED_YES : RID_SVXSTR_DOC_MODIFIED_NO;
+ mpImpl->mnModState = (start ? ImplData::MODIFICATION_STATE_FEEDBACK : (modified ?
ImplData::MODIFICATION_STATE_YES : ImplData::MODIFICATION_STATE_NO));
+
+ _repaint();
+
+ int nResId = modified ? RID_SVXSTR_DOC_MODIFIED_YES : RID_SVXSTR_DOC_MODIFIED_NO;
GetStatusBar().SetQuickHelpText(GetId(), SVX_RESSTR(nResId));
+
+ if ( start )
+ mpImpl->maTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxModifyControl, OnTimer, Timer *, pTimer )
+{
+ if (pTimer == 0)
+ return 0;
+
+ pTimer->Stop();
+ mpImpl->mnModState = ImplData::MODIFICATION_STATE_NO;
+
+ _repaint();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxModifyControl::_repaint()
+{
+ if ( GetStatusBar().AreItemsVisible() )
+ GetStatusBar().SetItemData( GetId(), 0 ); // force repaint
}
// -----------------------------------------------------------------------
@@ -119,26 +168,21 @@ Point centerImage(const Rectangle& rBoundingRect, const Image& rImg)
}
}
+
+
void SvxModifyControl::Paint( const UserDrawEvent& rUsrEvt )
{
OutputDevice* pDev = rUsrEvt.GetDevice();
Rectangle aRect = rUsrEvt.GetRect();
- if (mpImpl->mbModified)
- {
- Point aPt = centerImage(aRect, mpImpl->maModifiedButton);
- pDev->DrawImage(aPt, mpImpl->maModifiedButton);
- }
- else
- {
- Point aPt = centerImage(aRect, mpImpl->maNonModifiedButton);
- pDev->DrawImage(aPt, mpImpl->maNonModifiedButton);
- }
+ ImplData::ModificationState state = mpImpl->mnModState;
+ Point aPt = centerImage(aRect, mpImpl->maImages[state]);
+ pDev->DrawImage(aPt, mpImpl->maImages[state]);
}
void SvxModifyControl::DoubleClick()
{
- if (!mpImpl->mbModified)
+ if (mpImpl->mnModState != ImplData::MODIFICATION_STATE_YES)
// document not modified. nothing to do here.
return;
diff --git a/svx/source/stbctrls/stbctrls.src b/svx/source/stbctrls/stbctrls.src
index cd129d1..b000149 100644
--- a/svx/source/stbctrls/stbctrls.src
+++ b/svx/source/stbctrls/stbctrls.src
@@ -1,4 +1,4 @@
-/*************************************************************************
+/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -302,3 +302,11 @@ Image RID_SVXBMP_DOC_MODIFIED_NO
};
MaskColor = STD_MASKCOLOR;
};
+Image RID_SVXBMP_DOC_MODIFIED_FEEDBACK
+{
+ ImageBitmap = Bitmap
+ {
+ File = "doc_modified_feedback.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
--
1.7.6.1
From 50c5aa0d31daf6dde636caecb7ff90143e0037b9 Mon Sep 17 00:00:00 2001
From: Dmitry Ashkadov <dmitry.ashkadov@gmail.com>
Date: Mon, 12 Sep 2011 19:00:06 +0400
Subject: [PATCH 2/2] Removed unused some code related to #39430.
---
svx/inc/svx/modctrl.hxx | 2 --
svx/source/stbctrls/modctrl.cxx | 4 ----
unusedcode.easy | 1 -
3 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/svx/inc/svx/modctrl.hxx b/svx/inc/svx/modctrl.hxx
index bbfec1f..e7ddd13 100644
--- a/svx/inc/svx/modctrl.hxx
+++ b/svx/inc/svx/modctrl.hxx
@@ -52,8 +52,6 @@ public:
SvxModifyControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
- static sal_uIntPtr GetDefItemWidth(const StatusBar& rStb);
-
private: // Links
DECL_LINK( OnTimer, Timer * );
diff --git a/svx/source/stbctrls/modctrl.cxx b/svx/source/stbctrls/modctrl.cxx
index 6ab2689..4d56d80 100644
--- a/svx/source/stbctrls/modctrl.cxx
+++ b/svx/source/stbctrls/modctrl.cxx
@@ -190,10 +190,6 @@ void SvxModifyControl::DoubleClick()
execute(OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Save")), aArgs);
}
-sal_uIntPtr SvxModifyControl::GetDefItemWidth(const StatusBar& rStb)
-{
- return rStb.GetTextWidth(String::CreateFromAscii("XX"));
-}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unusedcode.easy b/unusedcode.easy
index 118e7a2..42d1cfe 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -1167,7 +1167,6 @@ SvxMSDffShapeTxBxSort::Insert(SvxMSDffShapeOrder* const*, unsigned short)
SvxMSDffShapeTxBxSort::Insert(SvxMSDffShapeTxBxSort const*, unsigned short, unsigned short)
SvxMSDffShapeTxBxSort::Remove(SvxMSDffShapeOrder* const&, unsigned short)
SvxMSDffShapeTxBxSort::Remove(unsigned short, unsigned short)
-SvxModifyControl::GetDefItemWidth(StatusBar const&)
SvxNumRule::SetLevel(unsigned short, SvxNumberFormat const*)
SvxNumberFormatShell::GetCurCurrencyEntry()
SvxNumberFormatShell::GetCurrencyFormats(SvStrings&)
--
1.7.6.1
begin:vcard
fn:Dmitry Ashkadov
n:Ashkadov;Dmitry
email;internet:dmitry.ashkadov@gmail.com
note:JID: dmitryash@jabber.mipt.ru
version:2.1
end:vcard
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.