[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - include/sfx2 sc/source sd/source sfx2/source sw/source
Caolán McNamara
caolanm at redhat.com
Tue Jun 10 05:48:29 PDT 2014
include/sfx2/app.hxx | 3 --
include/sfx2/templdlg.hxx | 19 ++++--------------
sc/source/ui/view/formatsh.cxx | 17 ++++++++++------
sd/source/ui/view/drviewsf.cxx | 38 +++++++++++++++++++++++++------------
sd/source/ui/view/outlnvsh.cxx | 8 ++++---
sd/source/ui/view/viewshe3.cxx | 10 ++-------
sfx2/source/appl/appmisc.cxx | 11 ----------
sfx2/source/dialog/templdlg.cxx | 41 ++++++++++++++++++++--------------------
sfx2/source/inc/templdgi.hxx | 16 ---------------
sw/source/ui/app/docst.cxx | 11 +++++++---
10 files changed, 79 insertions(+), 95 deletions(-)
New commits:
commit f2ba5e290b6b751995427b7610ef75d67e674d75
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu May 29 11:16:47 2014 +0100
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 at redhat.com>
Reviewed-by: David Tardon <dtardon at redhat.com>
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index 6827ce6..ad48f2e 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -171,9 +171,6 @@ public:
SfxTemplateDialog* GetTemplateDialog();
Window* GetTopWindow() const;
- // TODO/CLEANUP: make currently selected family a view property and so we don't need to query the status from the "TemplateCommon"
- ISfxTemplateCommon* GetCurrentTemplateCommon( SfxBindings& );
-
// members
SfxFilterMatcher& GetFilterMatcher();
SfxProgress* GetProgress() const;
diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx
index 7373c23..ca494c6 100644
--- a/include/sfx2/templdlg.hxx
+++ b/include/sfx2/templdlg.hxx
@@ -30,20 +30,7 @@
class SfxTemplateDialog_Impl;
-// class ISfxTemplateCommon ----------------------------------------------
-
-class ISfxTemplateCommon
-{
-public:
- virtual SfxStyleFamily GetActualFamily() const = 0;
- virtual OUString GetSelectedEntry() const = 0;
-
-protected:
- ~ISfxTemplateCommon() {}
-};
-
// class SfxTemplateDialog -----------------------------------------------
-
class SfxTemplateDialog : public SfxDockingWindow
{
private:
@@ -63,8 +50,12 @@ public:
virtual void Update();
- ISfxTemplateCommon* GetISfxTemplateCommon();
void SetParagraphFamily();
+
+ // converts from SFX_STYLE_FAMILY Ids to 1-5
+ static sal_uInt16 SFX2_DLLPUBLIC SfxFamilyIdToNId(SfxStyleFamily nFamily);
+ // converts from 1-5 to SFX_STYLE_FAMILY Ids
+ static SfxStyleFamily SFX2_DLLPUBLIC NIdToSfxFamilyId(sal_uInt16 nId);
};
// class SfxTemplateDialogWrapper ----------------------------------------
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 3ddb49a..e357a44 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -213,9 +213,12 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet )
case SID_STYLE_UPDATE_BY_EXAMPLE:
{
- ISfxTemplateCommon* pDesigner = SFX_APP()->
- GetCurrentTemplateCommon(pTabViewShell->GetViewFrame()->GetBindings());
- bool bPage = pDesigner && SFX_STYLE_FAMILY_PAGE == pDesigner->GetActualFamily();
+ SfxPoolItem* pItem = NULL;
+ pTabViewShell->GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+
+ bool bPage = pFamilyItem && SFX_STYLE_FAMILY_PAGE == SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue());
+ delete pItem;
if ( bProtected || bPage )
rSet.DisableItem( nSlotId );
@@ -227,9 +230,11 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet )
case SID_STYLE_HIDE:
case SID_STYLE_SHOW:
{
- ISfxTemplateCommon* pDesigner = SFX_APP()->
- GetCurrentTemplateCommon(pTabViewShell->GetViewFrame()->GetBindings());
- bool bPage = pDesigner && SFX_STYLE_FAMILY_PAGE == pDesigner->GetActualFamily();
+ SfxPoolItem* pItem = NULL;
+ pTabViewShell->GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ bool bPage = pFamilyItem && SFX_STYLE_FAMILY_PAGE == SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue());
+ delete pItem;
if ( bProtected && !bPage )
rSet.DisableItem( nSlotId );
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 6ed5dbc..785f09d 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -485,30 +485,41 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
case SID_STYLE_WATERCAN:
{
- ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
- if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem && SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
rSet.Put(SfxBoolItem(nWhich,sal_False));
else
{
SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
aAllSet.Put( aItem, aItem.Which());
}
+ delete pItem;
}
break;
case SID_STYLE_NEW:
{
- ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
- if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem && SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
+ {
rSet.DisableItem(nWhich);
+ }
+ delete pItem;
}
break;
case SID_STYLE_DRAGHIERARCHIE:
{
- ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
- if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem && SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
rSet.DisableItem(nWhich);
+ delete pItem;
}
break;
@@ -516,14 +527,17 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
{
// It is not possible to create PseudoStyleSheets 'by Example';
// normal style sheets need a selected object for that
- ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
- if (pTemplCommon)
+
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem)
{
- if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ if (SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
{
rSet.DisableItem(nWhich);
}
- else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
+ else if (SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_GRAPHICS)
{
if (!mpDrawView->AreObjectsMarked())
{
@@ -531,7 +545,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
}
}
}
- // if there is no (yet) a designer, we have to go back into the
+ // if there is no (yet) a style designer, we have to go back into the
// view state; an actual set family can not be considered
else
{
@@ -540,7 +554,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
rSet.DisableItem(nWhich);
}
}
-
+ delete pItem;
}
break;
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index f787857..d54871c 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1563,9 +1563,10 @@ void OutlineViewShell::GetAttrState( SfxItemSet& rSet )
case SID_STYLE_EDIT:
{
- ISfxTemplateCommon* pTmplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
-
- if (pTmplCommon && pTmplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem && SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
{
SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
GetStatusBarState(aSet);
@@ -1576,6 +1577,7 @@ void OutlineViewShell::GetAttrState( SfxItemSet& rSet )
rSet.DisableItem(nWhich);
}
}
+ delete pItem;
}
break;
diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx
index 3c2b5d0..8e967d4 100644
--- a/sd/source/ui/view/viewshe3.cxx
+++ b/sd/source/ui/view/viewshe3.cxx
@@ -72,6 +72,7 @@
#include <svx/svxids.hrc>
#include <sfx2/request.hxx>
+#include <sfx2/templdlg.hxx>
#include <svl/aeitem.hxx>
#include <basic/sbstar.hxx>
@@ -102,17 +103,12 @@ void ViewShell::GetMenuState( SfxItemSet &rSet )
if( pStyleSheet )
{
SfxStyleFamily eFamily = pStyleSheet->GetFamily();
- if(eFamily == SD_STYLE_FAMILY_GRAPHICS)
- nFamily = 2;
- else if(eFamily == SD_STYLE_FAMILY_CELL )
- nFamily = 3;
- else // SD_STYLE_FAMILY_PSEUDO
- nFamily = 5;
-
+ nFamily = SfxTemplateDialog::SfxFamilyIdToNId(eFamily);
GetDocSh()->SetStyleFamily(nFamily);
}
}
}
+
rSet.Put(SfxUInt16Item(SID_STYLE_FAMILY, nFamily ));
}
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx
index 8b8c88c..63b9259 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 11b430c..d11a267 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 844acdb..e51cb94 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();
};
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index ff0a01f..4c05499 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -99,9 +99,14 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
else
{
SfxViewFrame* pFrame = pShell->GetView().GetViewFrame();
- const ISfxTemplateCommon* pCommon = SFX_APP()->GetCurrentTemplateCommon(pFrame->GetBindings());
- if( pCommon )
- nActualFamily = static_cast< sal_uInt16 >(pCommon->GetActualFamily());
+ SfxPoolItem* pItem = NULL;
+ pFrame->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem)
+ {
+ nActualFamily = static_cast<sal_uInt16>(SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()));
+ }
+ delete pItem;
}
while (nWhich)
More information about the Libreoffice-commits
mailing list