summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-29 11:16:47 +0100
committerAndras Timar <andras.timar@collabora.com>2014-06-10 22:11:14 +0200
commit6132f01bce5c9bc5b00c99c290b4cc9d72e39922 (patch)
tree28cc639e227eba932b701a66ca64058ea67eb946 /sfx2
parentf7bb919ab014eb29fe77e287abf6eaf6c85750ce (diff)
Resolves: fdo#79360 impress hangs on using sidebar new style
because those styles are "pseudo-styles" and a new one cannot be added. The possibility is supposed to be disabled, and it is disabled in the floating stylelist. The old code assumes there can only be one of these stylelists and when a stylelist queries if the "new" should be disabled the callback asks the stylelist what family is selected, but only asks the floating one. So, floating closed, sidebar open, the new is not disabled. Implement the ancient TODO now that we have to. Instead of asking the stylelist what family is selected, query the frame for what is the current SID_STYLE_FAMILY as set by whatever is the active stylelist. What's disturbing is the SID_STYLE_FAMILY values are not SfxStyleFamily, but indexes that have to be mapped to SfxStyleFamily. I bet there are a pile of bugs around that, especially with little islands of different conversion codesites (cherry picked from commit 7a211e834fc271d3f28d7f8c49197c925242d862) Conflicts: sfx2/source/appl/appmisc.cxx convert from NId to FamilyId instead of FamilyId to NId should be equivalent for comparison purposes (cherry picked from commit f48f5138ecedd3bb9ec0b454b9fe216001610156) remove unused virtual method, slim this down initially (cherry picked from commit fa551c422426962194b6bff4234f12eb5bdf57ca) (cherry picked from commit 3988f17d14ee28b4bb117ca9961708ad3a867fb1) Conflicts: sd/source/ui/view/drviewsf.cxx sfx2/source/appl/appmisc.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/inc/templdgi.hxx sw/source/core/uibase/app/docst.cxx Change-Id: I85c8032d7c26ae6eea245685748f89b2a860e767 Reviewed-on: https://gerrit.libreoffice.org/9573 Tested-by: David Tardon <dtardon@redhat.com> Reviewed-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appmisc.cxx11
-rw-r--r--sfx2/source/dialog/templdlg.cxx41
-rw-r--r--sfx2/source/inc/templdgi.hxx16
3 files changed, 21 insertions, 47 deletions
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx
index 8b8c88c11219..63b9259dc747 100644
--- a/sfx2/source/appl/appmisc.cxx
+++ b/sfx2/source/appl/appmisc.cxx
@@ -141,17 +141,6 @@ SfxModule* SfxApplication::GetModule_Impl()
}
}
-ISfxTemplateCommon* SfxApplication::GetCurrentTemplateCommon( SfxBindings& rBindings )
-{
- if( pAppData_Impl->pTemplateCommon )
- return pAppData_Impl->pTemplateCommon;
- SfxChildWindow *pChild = rBindings.GetWorkWindow_Impl()->GetChildWindow_Impl(
- SfxTemplateDialogWrapper::GetChildWindowId() );
- if ( pChild )
- return ((SfxTemplateDialog*) pChild->GetWindow())->GetISfxTemplateCommon();
- return 0;
-}
-
sal_Bool SfxApplication::IsDowning() const { return pAppData_Impl->bDowning; }
SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return pAppData_Impl->pAppDispat; }
SfxSlotPool& SfxApplication::GetAppSlotPool_Impl() const { return *pAppData_Impl->pSlotPool; }
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 11b430cddaf2..d11a2672dd0b 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -149,18 +149,11 @@ SfxTemplateDialog::SfxTemplateDialog
pImpl->updateNonFamilyImages();
}
-//-------------------------------------------------------------------------
-
SfxTemplateDialog::~SfxTemplateDialog()
{
delete pImpl;
}
-ISfxTemplateCommon* SfxTemplateDialog::GetISfxTemplateCommon()
-{
- return pImpl->GetISfxTemplateCommon();
-}
-
void SfxTemplateDialog::SetParagraphFamily()
{
// first select the paragraph family
@@ -169,8 +162,6 @@ void SfxTemplateDialog::SetParagraphFamily()
pImpl->SetAutomaticFilter();
}
-// ------------------------------------------------------------------------
-
void SfxTemplateDialog::DataChanged( const DataChangedEvent& _rDCEvt )
{
if ( ( DATACHANGED_SETTINGS == _rDCEvt.GetType() ) &&
@@ -252,8 +243,8 @@ sal_Int8 DropListBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
{
// special case: page styles are allowed to create new styles by example
// but not allowed to be created by drag and drop
- if( pDialog->nActFamily == SfxCommonTemplateDialog_Impl::SfxFamilyIdToNId( SFX_STYLE_FAMILY_PAGE ) ||
- pDialog->bNewByExampleDisabled )
+ if (pDialog->GetActualFamily() == SFX_STYLE_FAMILY_PAGE ||
+ pDialog->bNewByExampleDisabled)
return DND_ACTION_NONE;
else
return DND_ACTION_COPY;
@@ -834,7 +825,6 @@ SvTreeListEntry* FillBox_Impl(SvTreeListBox *pBox,
SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window* pW, bool ) :
mbIgnoreSelect( false ),
- aISfxTemplateCommon ( this ),
pBindings ( pB ),
pWindow ( pW ),
pModule ( NULL ),
@@ -885,7 +875,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Win
sal_uInt16 SfxCommonTemplateDialog_Impl::StyleNrToInfoOffset(sal_uInt16 nId)
{
const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nId );
- return SfxFamilyIdToNId(pItem->GetFamily())-1;
+ return SfxTemplateDialog::SfxFamilyIdToNId(pItem->GetFamily())-1;
}
//-------------------------------------------------------------------------
@@ -982,7 +972,7 @@ void SfxCommonTemplateDialog_Impl::ReadResource()
for( ; nCount--; )
{
const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nCount );
- sal_uInt16 nId = SfxFamilyIdToNId( pItem->GetFamily() );
+ sal_uInt16 nId = SfxTemplateDialog::SfxFamilyIdToNId( pItem->GetFamily() );
InsertFamilyItem( nId, pItem );
}
@@ -1075,9 +1065,7 @@ SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl()
m_pDeletionWatcher->signal();
}
-//-------------------------------------------------------------------------
-
-sal_uInt16 SfxCommonTemplateDialog_Impl::SfxFamilyIdToNId( SfxStyleFamily nFamily )
+sal_uInt16 SfxTemplateDialog::SfxFamilyIdToNId(SfxStyleFamily nFamily)
{
switch ( nFamily )
{
@@ -1090,6 +1078,19 @@ sal_uInt16 SfxCommonTemplateDialog_Impl::SfxFamilyIdToNId( SfxStyleFamily nFamil
}
}
+SfxStyleFamily SfxTemplateDialog::NIdToSfxFamilyId(sal_uInt16 nId)
+{
+ switch (nId)
+ {
+ case 1: return SFX_STYLE_FAMILY_CHAR;
+ case 2: return SFX_STYLE_FAMILY_PARA;
+ case 3: return SFX_STYLE_FAMILY_FRAME;
+ case 4: return SFX_STYLE_FAMILY_PAGE;
+ case 5: return SFX_STYLE_FAMILY_PSEUDO;
+ default: return SFX_STYLE_FAMILY_ALL;
+ }
+}
+
void SfxCommonTemplateDialog_Impl::SetAutomaticFilter()
{
sal_uInt16 nCount = aFilterLb.GetEntryCount();
@@ -1115,7 +1116,7 @@ const SfxStyleFamilyItem *SfxCommonTemplateDialog_Impl::GetFamilyItem_Impl() con
for(size_t i = 0; i < nCount; ++i)
{
const SfxStyleFamilyItem *pItem = pStyleFamilies->at( i );
- sal_uInt16 nId = SfxFamilyIdToNId(pItem->GetFamily());
+ sal_uInt16 nId = SfxTemplateDialog::SfxFamilyIdToNId(pItem->GetFamily());
if(nId == nActFamily)
return pItem;
}
@@ -2544,7 +2545,7 @@ void SfxTemplateDialog_Impl::updateFamilyImages()
for( ; nLoop--; )
{
const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nLoop );
- sal_uInt16 nId = SfxFamilyIdToNId( pItem->GetFamily() );
+ sal_uInt16 nId = SfxTemplateDialog::SfxFamilyIdToNId( pItem->GetFamily() );
m_aActionTbL.SetItemImage( nId, pItem->GetImage() );
}
}
@@ -2942,7 +2943,7 @@ sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
}
// special case: page styles are allowed to create new styles by example
// but not allowed to be created by drag and drop
- if ( nItemId != SfxCommonTemplateDialog_Impl::SfxFamilyIdToNId( SFX_STYLE_FAMILY_PAGE )&&
+ if ( nItemId != SfxTemplateDialog::SfxFamilyIdToNId( SFX_STYLE_FAMILY_PAGE )&&
IsDropFormatSupported( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) &&
!rParent.bNewByExampleDisabled )
{
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 844acdb79eb0..e51cb94d6fbf 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -95,18 +95,6 @@ private:
class DeletionWatcher;
friend class DeletionWatcher;
bool mbIgnoreSelect;
- class ISfxTemplateCommon_Impl : public ISfxTemplateCommon
- {
- private:
- SfxCommonTemplateDialog_Impl* pDialog;
- public:
- ISfxTemplateCommon_Impl( SfxCommonTemplateDialog_Impl* pDialogP ) : pDialog( pDialogP ) {}
- virtual ~ISfxTemplateCommon_Impl() {}
- virtual SfxStyleFamily GetActualFamily() const { return pDialog->GetActualFamily(); }
- virtual OUString GetSelectedEntry() const { return pDialog->GetSelectedEntry(); }
- };
-
- ISfxTemplateCommon_Impl aISfxTemplateCommon;
void ReadResource();
void ClearResource();
@@ -242,7 +230,6 @@ public:
virtual void EnableHide( sal_Bool b = sal_True ) { bCanHide = b; }
virtual void EnableShow( sal_Bool b = sal_True ) { bCanShow = b; }
- ISfxTemplateCommon* GetISfxTemplateCommon() { return &aISfxTemplateCommon; }
Window* GetWindow() { return pWindow; }
void EnableTreeDrag( sal_Bool b = sal_True );
@@ -263,9 +250,6 @@ public:
// normaly for derivates from SvTreeListBoxes, but in this case the dialog handles context menus
virtual PopupMenu* CreateContextMenu( void );
- // converts from SFX_STYLE_FAMILY Ids to 1-5
- static sal_uInt16 SfxFamilyIdToNId( SfxStyleFamily nFamily );
-
void SetAutomaticFilter();
};