Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f1a80a9f
Kaydet (Commit)
f1a80a9f
authored
Eyl 29, 2010
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Ported statusbar-fancy-modified-status-svx.diff from ooo-build.
üst
adc9cd84
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
29 deletions
+117
-29
modctrl.hxx
svx/inc/modctrl.hxx
+6
-6
dialogs.hrc
svx/inc/svx/dialogs.hrc
+4
-0
makefile.mk
svx/source/stbctrls/makefile.mk
+1
-0
modctrl.cxx
svx/source/stbctrls/modctrl.cxx
+80
-23
stbctrls.src
svx/source/stbctrls/stbctrls.src
+26
-0
No files found.
svx/inc/modctrl.hxx
Dosyayı görüntüle @
f1a80a9f
...
...
@@ -32,6 +32,8 @@
#include <sfx2/stbitem.hxx>
#include "svx/svxdllapi.h"
#include <boost/shared_ptr.hpp>
// class SvxModifyControl ------------------------------------------------
class
SVX_DLLPUBLIC
SvxModifyControl
:
public
SfxStatusBarControl
...
...
@@ -39,7 +41,8 @@ class SVX_DLLPUBLIC SvxModifyControl : public SfxStatusBarControl
public
:
virtual
void
StateChanged
(
USHORT
nSID
,
SfxItemState
eState
,
const
SfxPoolItem
*
pState
);
virtual
void
Paint
(
const
UserDrawEvent
&
rEvt
);
virtual
void
Paint
(
const
UserDrawEvent
&
rUsrEvt
);
virtual
void
DoubleClick
();
SFX_DECL_STATUSBAR_CONTROL
();
...
...
@@ -48,11 +51,8 @@ public:
static
ULONG
GetDefItemWidth
(
const
StatusBar
&
rStb
);
private
:
BOOL
bState
;
#ifdef _SVX_MODCTRL_CXX
SVX_DLLPRIVATE
void
DrawItemText_Impl
();
#endif
struct
ImplData
;
::
boost
::
shared_ptr
<
ImplData
>
mpImpl
;
};
...
...
svx/inc/svx/dialogs.hrc
Dosyayı görüntüle @
f1a80a9f
...
...
@@ -1060,5 +1060,9 @@
#define SVX_OOO_BUILD_START (RID_SVX_START + 1200)
#define SID_SC_TP_FORMULA (SVX_OOO_BUILD_START + 1)
#define RID_SVXBMP_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 2)
#define RID_SVXBMP_DOC_MODIFIED_NO (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
svx/source/stbctrls/makefile.mk
Dosyayı görüntüle @
f1a80a9f
...
...
@@ -55,6 +55,7 @@ SLOFILES= \
$(SLO)$/
zoomsliderctrl.obj
EXCEPTIONSFILES
=
\
$(SLO)$/
modctrl.obj
\
$(SLO)$/
zoomsliderctrl.obj
HXX1TARGET
=
stbctrls
...
...
svx/source/stbctrls/modctrl.cxx
Dosyayı görüntüle @
f1a80a9f
...
...
@@ -30,29 +30,47 @@
// include ---------------------------------------------------------------
#ifndef _STATUS_HXX //autogen
#include "modctrl.hxx"
#include <vcl/status.hxx>
#
endif
#
include <vcl/image.hxx>
#include <svl/eitem.hxx>
#include <sfx2/app.hxx>
#define _SVX_MODCTRL_CXX
#include <svx/dialogs.hrc>
#include "modctrl.hxx"
#include <svx/dialmgr.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
using
::
com
::
sun
::
star
::
uno
::
Sequence
;
using
::
com
::
sun
::
star
::
beans
::
PropertyValue
;
using
::
rtl
::
OUString
;
SFX_IMPL_STATUSBAR_CONTROL
(
SvxModifyControl
,
SfxBoolItem
);
// class SvxModifyControl ------------------------------------------------
struct
SvxModifyControl
::
ImplData
{
Image
maModifiedButton
;
Image
maNonModifiedButton
;
bool
mbModified
;
ImplData
()
:
maModifiedButton
(
SVX_RES
(
RID_SVXBMP_DOC_MODIFIED_YES
)
),
maNonModifiedButton
(
SVX_RES
(
RID_SVXBMP_DOC_MODIFIED_NO
)
),
mbModified
(
false
)
{
}
};
SvxModifyControl
::
SvxModifyControl
(
USHORT
_nSlotId
,
USHORT
_nId
,
StatusBar
&
rStb
)
:
SfxStatusBarControl
(
_nSlotId
,
_nId
,
rStb
),
bState
(
TRUE
)
mpImpl
(
new
ImplData
)
{
}
...
...
@@ -62,32 +80,71 @@ void SvxModifyControl::StateChanged( USHORT, SfxItemState eState,
const
SfxPoolItem
*
pState
)
{
if
(
SFX_ITEM_AVAILABLE
!=
eState
)
GetStatusBar
().
SetItemText
(
GetId
(),
String
()
);
else
{
DBG_ASSERT
(
pState
->
ISA
(
SfxBoolItem
),
"invalid item type"
);
SfxBoolItem
*
pItem
=
(
SfxBoolItem
*
)
pState
;
bState
=
pItem
->
GetValue
();
DrawItemText_Impl
();
}
return
;
DBG_ASSERT
(
pState
->
ISA
(
SfxBoolItem
),
"invalid item type"
);
SfxBoolItem
*
pItem
=
(
SfxBoolItem
*
)
pState
;
mpImpl
->
mbModified
=
pItem
->
GetValue
();
if
(
GetStatusBar
().
AreItemsVisible
()
)
GetStatusBar
().
SetItemData
(
GetId
(),
0
);
// force repaint
int
nResId
=
mpImpl
->
mbModified
?
RID_SVXSTR_DOC_MODIFIED_YES
:
RID_SVXSTR_DOC_MODIFIED_NO
;
GetStatusBar
().
SetQuickHelpText
(
GetId
(),
SVX_RESSTR
(
nResId
));
}
// -----------------------------------------------------------------------
void
SvxModifyControl
::
Paint
(
const
UserDrawEvent
&
)
namespace
{
/**
* Given a bounding rectangle and an image, determine the top-left position
* of the image so that the image would look centered both horizontally and
* vertically.
*
* @param rBoundingRect bounding rectangle
* @param rImg image
*
* @return Point top-left corner of the centered image position
*/
Point
centerImage
(
const
Rectangle
&
rBoundingRect
,
const
Image
&
rImg
)
{
DrawItemText_Impl
();
Size
aImgSize
=
rImg
.
GetSizePixel
();
Size
aRectSize
=
rBoundingRect
.
GetSize
();
long
nXOffset
=
(
aRectSize
.
getWidth
()
-
aImgSize
.
getWidth
())
/
2
;
long
nYOffset
=
(
aRectSize
.
getHeight
()
-
aImgSize
.
getHeight
())
/
2
;
Point
aPt
=
rBoundingRect
.
TopLeft
();
aPt
+=
Point
(
nXOffset
,
nYOffset
);
return
aPt
;
}
// -----------------------------------------------------------------------
}
void
SvxModifyControl
::
Paint
(
const
UserDrawEvent
&
rUsrEvt
)
{
const
Rectangle
aControlRect
=
getControlRect
();
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
);
}
}
void
SvxModifyControl
::
D
rawItemText_Impl
()
void
SvxModifyControl
::
D
oubleClick
()
{
String
sMode
;
if
(
!
mpImpl
->
mbModified
)
// document not modified. nothing to do here.
return
;
if
(
bState
)
sMode
=
'*'
;
GetStatusBar
().
SetItemText
(
GetId
(),
sMode
);
Sequence
<
PropertyValue
>
aArgs
;
execute
(
OUString
::
createFromAscii
(
".uno:Save"
),
aArgs
);
}
ULONG
SvxModifyControl
::
GetDefItemWidth
(
const
StatusBar
&
rStb
)
...
...
svx/source/stbctrls/stbctrls.src
Dosyayı görüntüle @
f1a80a9f
...
...
@@ -89,6 +89,16 @@ String RID_SVXSTR_XMLSEC_SIG_CERT_OK_PARTIAL_SIG
Text [ en-US ] = "Digital Signature: The document signature and the certificate are OK, but not all parts of the document are signed.";
};
String RID_SVXSTR_DOC_MODIFIED_YES
{
Text [ en-US ] = "The document has been modified. Double-click to save the document.";
};
String RID_SVXSTR_DOC_MODIFIED_NO
{
Text [ en-US ] = "The document has not been modified since the last save.";
};
// PopupMenu -------------------------------------------------------------
Menu RID_SVXMNU_ZOOM
{
...
...
@@ -325,3 +335,19 @@ Image RID_SVXBMP_SLIDERINCREASE_HC
MaskColor = STD_MASKCOLOR;
};
Image RID_SVXBMP_DOC_MODIFIED_YES
{
ImageBitmap = Bitmap
{
File = "doc_modified_yes_14.png" ;
};
MaskColor = STD_MASKCOLOR;
};
Image RID_SVXBMP_DOC_MODIFIED_NO
{
ImageBitmap = Bitmap
{
File = "doc_modified_no_14.png" ;
};
MaskColor = STD_MASKCOLOR;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment