summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-03-23 20:14:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-27 09:43:58 +0000
commitd615af618cc6a7152c76a49b3cd09db38eaa9e07 (patch)
treebc0d69070444dc687708de9a4a146c5c2d3b6852 /sfx2
parent6f968f00b1534406a2943be374fab924c3396482 (diff)
create SfxInterfaceId o3tl::strong_int
Change-Id: Ie52f63382a9fb36f9a472801be012b140bfb51f6 Reviewed-on: https://gerrit.libreoffice.org/35722 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appdata.cxx2
-rw-r--r--sfx2/source/appl/appinit.cxx3
-rw-r--r--sfx2/source/appl/appquit.cxx3
-rw-r--r--sfx2/source/control/objface.cxx2
-rw-r--r--sfx2/source/doc/docfac.cxx4
-rw-r--r--sfx2/source/inc/appdata.hxx3
-rw-r--r--sfx2/source/view/frame.cxx2
-rw-r--r--sfx2/source/view/frame2.cxx6
-rw-r--r--sfx2/source/view/frmload.cxx15
-rw-r--r--sfx2/source/view/impviewframe.hxx18
-rw-r--r--sfx2/source/view/viewfac.cxx9
-rw-r--r--sfx2/source/view/viewfrm.cxx32
12 files changed, 43 insertions, 56 deletions
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index b4a5ff441f4c..44f8843930fa 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -117,8 +117,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* )
, pViewFrame( nullptr )
, pSlotPool( nullptr )
, pAppDispat( nullptr )
- , pInterfaces( nullptr )
- , nInterfaces( 0 )
, bDowning( true )
, bInQuit( false )
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 3be03707ff3b..971b0a6d79fc 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -241,9 +241,6 @@ void SfxApplication::Initialize_Impl()
pImpl->pViewFrames = new SfxViewFrameArr_Impl;
pImpl->pViewShells = new SfxViewShellArr_Impl;
pImpl->pObjShells = new SfxObjectShellArr_Impl;
- pImpl->nInterfaces = SFX_INTERFACE_APP+8;
- pImpl->pInterfaces = new SfxInterface*[pImpl->nInterfaces];
- memset( pImpl->pInterfaces, 0, sizeof(SfxInterface*) * pImpl->nInterfaces );
Registrations_Impl();
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index 67264060a298..b33eb7819964 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -100,9 +100,6 @@ void SfxApplication::Deinitialize()
DBG_ASSERT( pImpl->pViewFrame == nullptr, "active foreign ViewFrame" );
- delete[] pImpl->pInterfaces;
- pImpl->pInterfaces = nullptr;
-
// free administration managers
DELETEZ(pImpl->pAppDispat);
SfxResId::DeleteResMgr();
diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx
index 68d229dbd470..0bf304903c19 100644
--- a/sfx2/source/control/objface.cxx
+++ b/sfx2/source/control/objface.cxx
@@ -481,7 +481,7 @@ sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const
sal_uInt32 nRet = pImplData->aChildWindows[nNo]->nResId;
if ( pImplData->aChildWindows[nNo]->bContext )
- nRet += sal_uInt32( nClassId ) << 16;
+ nRet += sal_uInt16( nClassId ) << 16;
return nRet;
}
diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index cfe4e5fdac7b..f5fa98958ad4 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -370,11 +370,11 @@ OUString SfxObjectFactory::GetModuleName() const
}
-sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const
+sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const SfxInterfaceId i_nViewId, const sal_uInt16 i_nFallback ) const
{
for ( sal_uInt16 curViewNo = 0; curViewNo < GetViewFactoryCount(); ++curViewNo )
{
- const sal_uInt16 curViewId = GetViewFactory( curViewNo ).GetOrdinal();
+ const SfxInterfaceId curViewId = GetViewFactory( curViewNo ).GetOrdinal();
if ( i_nViewId == curViewId )
return curViewNo;
}
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 4adc6d6cfcb5..8e9392160086 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -118,11 +118,8 @@ public:
SfxViewFrame* pViewFrame;
SfxSlotPool* pSlotPool;
SfxDispatcher* pAppDispat; // Dispatcher if no document
- SfxInterface** pInterfaces;
::rtl::Reference<sfx2::sidebar::Theme> m_pSidebarTheme;
- sal_uInt16 nInterfaces;
-
bool bDowning:1; // sal_True on Exit and afterwards
bool bInQuit : 1;
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index b66cebd154dd..c9872924cb58 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -352,7 +352,7 @@ void SfxFrame::GetViewData_Impl()
}
if ( pViewFrame->GetCurViewId() )
- pSet->Put( SfxUInt16Item( SID_VIEW_ID, pViewFrame->GetCurViewId() ) );
+ pSet->Put( SfxUInt16Item( SID_VIEW_ID, (sal_uInt16)pViewFrame->GetCurViewId() ) );
if ( pChildArr )
{
// For Framesets also the data from the ChildViews have to be processed
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 0b6fb83f1e68..c48711c8fcf2 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -218,7 +218,7 @@ Reference < XFrame > SfxFrame::CreateBlankFrame()
return xFrame;
}
-SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, vcl::Window& rWindow, sal_uInt16 nViewId, bool bHidden )
+SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, vcl::Window& rWindow, SfxInterfaceId nViewId, bool bHidden )
{
SfxFrame* pFrame = nullptr;
try
@@ -242,8 +242,8 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, vcl::Window& rWindow, sal_uInt
::comphelper::NamedValueCollection aArgs( aLoadArgs );
aArgs.put( "Model", rDoc.GetModel() );
aArgs.put( "Hidden", bHidden );
- if ( nViewId )
- aArgs.put( "ViewId", nViewId );
+ if ( nViewId != SfxInterfaceId(0) )
+ aArgs.put( "ViewId", (sal_uInt16)nViewId );
aLoadArgs = aArgs.getPropertyValues();
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 5efadcfd2b35..90c01dba7dc1 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -165,7 +165,7 @@ private:
::comphelper::NamedValueCollection& io_rDescriptor
);
- static sal_Int16 impl_determineEffectiveViewId_nothrow(
+ static SfxInterfaceId impl_determineEffectiveViewId_nothrow(
const SfxObjectShell& i_rDocument,
const ::comphelper::NamedValueCollection& i_rDescriptor
);
@@ -536,12 +536,13 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
}
-sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor )
+SfxInterfaceId SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor )
{
- sal_Int16 nViewId = i_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) );
+ SfxInterfaceId nViewId(i_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) ));
try
{
- if ( nViewId == 0 ) do
+ if ( nViewId == SfxInterfaceId(0) )
+ do
{
Reference< XViewDataSupplier > xViewDataSupplier( i_rDocument.GetModel(), UNO_QUERY );
Reference< XIndexAccess > xViewData;
@@ -567,7 +568,7 @@ sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxO
SfxViewFactory* pViewFactory = i_rDocument.GetFactory().GetViewFactoryByViewName( sViewId );
if ( pViewFactory )
- nViewId = sal_Int16( pViewFactory->GetOrdinal() );
+ nViewId = pViewFactory->GetOrdinal();
}
while ( false );
}
@@ -576,7 +577,7 @@ sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxO
DBG_UNHANDLED_EXCEPTION();
}
- if ( nViewId == 0 )
+ if ( nViewId == SfxInterfaceId(0) )
nViewId = i_rDocument.GetFactory().GetViewFactory().GetOrdinal();
return nViewId;
}
@@ -708,7 +709,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
ENSURE_OR_THROW( xDoc.is(), "no SfxObjectShell for the given model" );
// ensure the ID of the to-be-created view is in the descriptor, if possible
- const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor );
+ const SfxInterfaceId nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor );
const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 );
const OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() );
diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx
index 5238f2a4f50e..1ef39b8b4a19 100644
--- a/sfx2/source/view/impviewframe.hxx
+++ b/sfx2/source/view/impviewframe.hxx
@@ -38,15 +38,15 @@ struct SfxViewFrame_Impl
SfxViewFrame* pActiveChild;
VclPtr<vcl::Window> pFocusWin;
sal_uInt16 nDocViewNo;
- sal_uInt16 nCurViewId;
- bool bResizeInToOut:1;
- bool bObjLocked:1;
- bool bReloading:1;
- bool bIsDowning:1;
- bool bModal:1;
- bool bEnabled:1;
- bool bWindowWasEnabled:1;
- bool bActive;
+ SfxInterfaceId nCurViewId;
+ bool bResizeInToOut:1;
+ bool bObjLocked:1;
+ bool bReloading:1;
+ bool bIsDowning:1;
+ bool bModal:1;
+ bool bEnabled:1;
+ bool bWindowWasEnabled:1;
+ bool bActive;
OUString aFactoryName;
explicit SfxViewFrame_Impl(SfxFrame& i_rFrame)
diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx
index 6e778c67ba9a..255a1536887f 100644
--- a/sfx2/source/view/viewfac.cxx
+++ b/sfx2/source/view/viewfac.cxx
@@ -30,10 +30,7 @@ SfxViewShell *SfxViewFactory::CreateInstance(SfxViewFrame *pFrame, SfxViewShell
OUString SfxViewFactory::GetLegacyViewName() const
{
- OUStringBuffer aViewName;
- aViewName.append( "view" );
- aViewName.append( sal_Int32( GetOrdinal() ) );
- return aViewName.makeStringAndClear();
+ return "view" + OUString::number( sal_uInt16( GetOrdinal() ) );
}
OUString SfxViewFactory::GetAPIViewName() const
@@ -41,7 +38,7 @@ OUString SfxViewFactory::GetAPIViewName() const
if ( !m_sViewName.isEmpty() )
return m_sViewName;
- if ( GetOrdinal() == 0 )
+ if ( GetOrdinal() == SfxInterfaceId(0) )
return OUString( "Default" );
return GetLegacyViewName();
@@ -50,7 +47,7 @@ OUString SfxViewFactory::GetAPIViewName() const
// CTOR / DTOR -----------------------------------------------------------
SfxViewFactory::SfxViewFactory( SfxViewCtor fnC,
- sal_uInt16 nOrdinal, const sal_Char* asciiViewName ):
+ SfxInterfaceId nOrdinal, const sal_Char* asciiViewName ):
fnCreate(fnC),
nOrd(nOrdinal),
m_sViewName( OUString::createFromAscii( asciiViewName ) )
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index e1175e8cebc6..f7d3fe9bc749 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -563,7 +563,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
// collect the views of the document
// TODO: when UNO ViewFactories are available for SFX-based documents, the below code should
// be UNOized, too
- typedef ::std::pair< Reference< XFrame >, sal_uInt16 > ViewDescriptor;
+ typedef ::std::pair< Reference< XFrame >, SfxInterfaceId > ViewDescriptor;
::std::list< ViewDescriptor > aViewFrames;
SfxViewFrame *pView = GetFirst( xOldObj );
while ( pView )
@@ -1325,7 +1325,7 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh )
m_pImpl->bObjLocked = false;
m_pImpl->pFocusWin = nullptr;
m_pImpl->pActiveChild = nullptr;
- m_pImpl->nCurViewId = 0;
+ m_pImpl->nCurViewId = SfxInterfaceId(0);
m_pImpl->bReloading = false;
m_pImpl->bIsDowning = false;
m_pImpl->bModal = false;
@@ -1708,7 +1708,7 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const
}
SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame,
- const sal_uInt16 i_nViewId, const bool i_bHidden )
+ const SfxInterfaceId i_nViewId, const bool i_bHidden )
{
Reference< XFrame > xFrame( i_rFrame );
bool bOwnFrame = false;
@@ -1778,7 +1778,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell
}
SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame,
- const Sequence< PropertyValue >& i_rLoadArgs, const sal_uInt16 i_nViewId,
+ const Sequence< PropertyValue >& i_rLoadArgs, const SfxInterfaceId i_nViewId,
const bool i_bHidden )
{
Reference< XModel > xDocument( i_rDoc.GetModel(), UNO_SET_THROW );
@@ -1786,7 +1786,7 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc
::comphelper::NamedValueCollection aTransformLoadArgs( i_rLoadArgs.getLength() ? i_rLoadArgs : xDocument->getArgs() );
aTransformLoadArgs.put( "Model", xDocument );
if ( i_nViewId )
- aTransformLoadArgs.put( "ViewId", sal_Int16( i_nViewId ) );
+ aTransformLoadArgs.put( "ViewId", sal_uInt16( i_nViewId ) );
if ( i_bHidden )
aTransformLoadArgs.put( "Hidden", i_bHidden );
else
@@ -1806,22 +1806,22 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc
return pViewShell;
}
-SfxViewFrame* SfxViewFrame::LoadHiddenDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId )
+SfxViewFrame* SfxViewFrame::LoadHiddenDocument( SfxObjectShell& i_rDoc, SfxInterfaceId i_nViewId )
{
return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, true );
}
-SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId )
+SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, SfxInterfaceId i_nViewId )
{
return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, false );
}
SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rTargetFrame )
{
- return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_rTargetFrame, 0, false );
+ return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_rTargetFrame, SfxInterfaceId(0), false );
}
-SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const sal_uInt16 i_nViewId )
+SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, SfxInterfaceId i_nViewId )
{
return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_pFrameItem && i_pFrameItem->GetFrame() ? i_pFrameItem->GetFrame()->GetFrameInterface() : nullptr, i_nViewId, false );
}
@@ -1834,7 +1834,7 @@ SfxViewFrame* SfxViewFrame::DisplayNewDocument( SfxObjectShell& i_rDoc, const Sf
return LoadViewIntoFrame_Impl_NoThrow(
i_rDoc,
pFrameItem ? pFrameItem->GetFrame() : nullptr,
- 0,
+ SfxInterfaceId(0),
pHiddenItem && pHiddenItem->GetValue()
);
}
@@ -1871,7 +1871,7 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c
return pViewFrame;
}
-void SfxViewFrame::SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId )
+void SfxViewFrame::SaveCurrentViewData_Impl( const SfxInterfaceId i_nNewViewId )
{
SfxViewShell* pCurrentShell = GetViewShell();
ENSURE_OR_RETURN_VOID( pCurrentShell != nullptr, "SfxViewFrame::SaveCurrentViewData_Impl: no current view shell -> no current view data!" );
@@ -1990,7 +1990,7 @@ bool SfxViewFrame::SwitchToViewShell_Impl
// ID of the new view
SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory();
- const sal_uInt16 nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo;
+ const SfxInterfaceId nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : SfxInterfaceId(nViewIdOrNo);
// save the view data of the old view, so it can be restored later on (when needed)
SaveCurrentViewData_Impl( nViewId );
@@ -2025,12 +2025,12 @@ bool SfxViewFrame::SwitchToViewShell_Impl
return true;
}
-void SfxViewFrame::SetCurViewId_Impl( const sal_uInt16 i_nID )
+void SfxViewFrame::SetCurViewId_Impl( const SfxInterfaceId i_nID )
{
m_pImpl->nCurViewId = i_nID;
}
-sal_uInt16 SfxViewFrame::GetCurViewId() const
+SfxInterfaceId SfxViewFrame::GetCurViewId() const
{
return m_pImpl->nCurViewId;
}
@@ -2104,7 +2104,7 @@ void SfxViewFrame::ExecView_Impl
// the view ID (optional arg. TODO: this is currently not supported in the slot definition ...)
const SfxUInt16Item* pViewIdItem = rReq.GetArg<SfxUInt16Item>(SID_VIEW_ID);
- const sal_uInt16 nViewId = pViewIdItem ? pViewIdItem->GetValue() : GetCurViewId();
+ const SfxInterfaceId nViewId = pViewIdItem ? SfxInterfaceId(pViewIdItem->GetValue()) : GetCurViewId();
Reference < XFrame > xFrame;
// the frame (optional arg. TODO: this is currently not supported in the slot definition ...)
@@ -2216,7 +2216,7 @@ void SfxViewFrame::StateView_Impl
{
case SID_VIEWSHELL:
{
- rSet.Put( SfxUInt16Item( nWhich, m_pImpl->nCurViewId ) );
+ rSet.Put( SfxUInt16Item( nWhich, sal_uInt16(m_pImpl->nCurViewId )) );
break;
}