diff options
author | Noel Power <noel.power@suse.com> | 2013-08-29 17:15:33 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-08-29 21:42:05 +0100 |
commit | bcc51fb2ebdf77a1cc089857775fd742085b45b6 (patch) | |
tree | a828e81a8c283a99d991f695178c0db686b10f86 /sfx2 | |
parent | 9d7c5dcf448fed668cc772d3cffa31712b1834a3 (diff) |
add support for in-place style preview
selecting a style in the styles dialog ( without double clicking )
will apply the style to the currently selected cell(s) You can
with the keys navigate to other styles and they in turn will
also be applied. Preview will end when you click back onto the
document.
*FIXME* - the styles dialog isn't really suitable for previewing, a
new dialog ( possibly in the toolbar ) might be nicer ( see Excel )
*FIXME* - when there is a multiple selection the highlight colour
(applied as a transparent overlay) is most annoying ( and is mixed
with any background colour applied if part of a style )
see ( ScGridWindow::UpdateSelectionOverlay() ) However my puny
attempts to make the selection use a transparent colour made all the
borders of the selected cells dissappear. I guess maybe a box/border
around each selected cell ( or group of cells ) would also work
but I didn't try that
Change-Id: I0950e79085ffb75f60ee961835665df0c230172f
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/sdi/sfx.sdi | 47 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 28 | ||||
-rw-r--r-- | sfx2/source/inc/templdgi.hxx | 2 |
3 files changed, 75 insertions, 2 deletions
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index e77723084916..2bc4c48071d7 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -6390,6 +6390,53 @@ SfxVoidItem StoreModuleSource SID_BASICIDE_STOREMODULESOURCE GroupId = GID_MACRO; ] +SfxVoidItem StyleEndPreview SID_STYLE_END_PREVIEW +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_TEMPLATE; +] + +SfxVoidItem StylePreview SID_STYLE_PREVIEW +(SfxStringItem ParamName SID_STYLE_PREVIEW,SfxUInt16Item FamilyType SID_STYLE_FAMILY) +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_TEMPLATE; +] + //-------------------------------------------------------------------------- SfxTemplateItem StyleApplyState SID_STYLE_APPLY [ diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 2a55713a875f..5bb674a498c2 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -830,7 +830,7 @@ SvTreeListEntry* FillBox_Impl(SvTreeListBox *pBox, // Constructor SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window* pW, bool ) : - + mbIgnoreSelect( false ), aISfxTemplateCommon ( this ), pBindings ( pB ), pWindow ( pW ), @@ -1047,6 +1047,9 @@ void SfxCommonTemplateDialog_Impl::Initialize() SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl() { OUString aEmpty; + Execute_Impl(SID_STYLE_END_PREVIEW, + String(), String(), + 0, 0, 0, 0 ); if ( bIsWater ) Execute_Impl(SID_STYLE_WATERCAN, aEmpty, aEmpty, 0); GetWindow()->Hide(); @@ -1425,6 +1428,12 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) OUString aStyle; if(pState) aStyle = pState->GetStyleName(); + mbIgnoreSelect = true; // in case we get a selection change + // in anycase we should stop any preview + Execute_Impl(SID_STYLE_END_PREVIEW, + String(), String(), + 0, 0, 0, 0 ); + SelectStyle(aStyle); EnableDelete(); } @@ -2319,7 +2328,24 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox EnableDelete(); } if( pListBox ) + { SelectStyle( pListBox->GetEntryText( pListBox->GetHdlEntry() )); + sal_uInt16 nModifier = aFmtLb.GetModifier(); + if ( mbIgnoreSelect ) + { + Execute_Impl(SID_STYLE_END_PREVIEW, + String(), String(), + 0, 0, 0, 0 ); + mbIgnoreSelect = false; + } + else + { + Execute_Impl(SID_STYLE_PREVIEW, + GetSelectedEntry(), String(), + ( sal_uInt16 )GetFamilyItem_Impl()->GetFamily(), + 0, 0, &nModifier ); + } + } return 0; } diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 1f4175015718..4a81df5ea04f 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -94,7 +94,7 @@ class SfxCommonTemplateDialog_Impl : public SfxListener private: class DeletionWatcher; friend class DeletionWatcher; - + bool mbIgnoreSelect; class ISfxTemplateCommon_Impl : public ISfxTemplateCommon { private: |