Kaydet (Commit) e039978b authored tarafından Michael Stahl's avatar Michael Stahl

turns out nobody calls those SfxObjectShell methods, remove them

Change-Id: Ic04fc47e88f0d12a0889fd9e28ff0fc42c6556aa
üst c7dd322b
......@@ -526,19 +526,6 @@ public:
virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily);
virtual sal_Bool InsertStuffWithIndexes( SfxObjectShell &rSource,
sal_uInt16 nSourceIdx1,
sal_uInt16 nSourceIdx2,
sal_uInt16 nSourceIdx3,
sal_uInt16 &nIdx1,
sal_uInt16 &nIdx2,
sal_uInt16 &nIdx3,
sal_uInt16 &rIdxDeleted);
virtual sal_Bool RemoveStuffWithIndexes( sal_uInt16 nIdx1,
sal_uInt16 nIdx2 = INDEX_IGNORE,
sal_uInt16 nIdx3 = INDEX_IGNORE);
virtual void LoadStyles( SfxObjectShell &rSource );
void ReadNote( INote * );
void UpdateNote( INote * );
......
......@@ -340,19 +340,6 @@ void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellS
}
sal_Bool ScDocShell::InsertStuffWithIndexes( SfxObjectShell &rSource,
sal_uInt16 nSourceIdx1, sal_uInt16 nSourceIdx2, sal_uInt16 nSourceIdx3,
sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted )
{
sal_Bool bRet = SfxObjectShell::InsertStuffWithIndexes(
rSource, nSourceIdx1, nSourceIdx2, nSourceIdx3,
nIdx1, nIdx2, nIdx3, rIdxDeleted );
if (bRet)
lcl_AdjustPool( GetStyleSheetPool() ); // SetItems anpassen
return bRet;
}
void ScDocShell::ReconnectDdeLink(SfxObjectShell& rServer)
{
::sfx2::LinkManager* pLinkManager = aDocument.GetLinkManager();
......
......@@ -209,9 +209,6 @@ public:
virtual void PrepareReload();
virtual sal_Bool IsInformationLost();
virtual void LoadStyles( SfxObjectShell &rSource );
virtual sal_Bool InsertStuffWithIndexes( SfxObjectShell &rSource,
sal_uInt16 nSourceIdx1, sal_uInt16 nSourceIdx2, sal_uInt16 nSourceIdx3,
sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted ) SAL_OVERRIDE;
virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); // SfxInPlaceObject
virtual sal_Bool DoSaveCompleted( SfxMedium * pNewStor); // SfxObjectShell
......
......@@ -416,190 +416,6 @@ Bitmap SfxObjectShell::GetStyleFamilyBitmap(SfxStyleFamily eFamily)
return Bitmap();
}
//--------------------------------------------------------------------
sal_Bool SfxObjectShell::InsertStuffWithIndexes(SfxObjectShell &rSource,
sal_uInt16 nSourceIdx1,
sal_uInt16 nSourceIdx2,
sal_uInt16 /*nSourceIdx3*/,
sal_uInt16 &nIdx1,
sal_uInt16 &nIdx2,
sal_uInt16 &/*nIdx3*/,
sal_uInt16 &/*nDeleted*/)
{
sal_Bool bRet = sal_False;
if (INDEX_IGNORE == nIdx1 && CONTENT_STYLE == nSourceIdx1)
nIdx1 = CONTENT_STYLE;
if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == nIdx1)
{
SfxStyleSheetBasePool* pHisPool = rSource.GetStyleSheetPool();
SfxStyleSheetBasePool* pMyPool = GetStyleSheetPool();
SetOrganizerSearchMask(pHisPool);
SetOrganizerSearchMask(pMyPool);
SfxStyleSheetBase* pHisSheet = NULL;
if ( pHisPool && pHisPool->Count() > nSourceIdx2 )
pHisSheet = (*pHisPool)[nSourceIdx2];
// Pasting is only needed if a style sheet is moved between
// different (!) Pools
if ( pHisSheet && pMyPool != pHisPool )
{
if (INDEX_IGNORE == nIdx2)
{
nIdx2 = pMyPool->Count();
}
// if such a template already exists: delete!
OUString aOldName(pHisSheet->GetName());
SfxStyleFamily eOldFamily = pHisSheet->GetFamily();
SfxStyleSheetBase* pExist = pMyPool->Find(aOldName, eOldFamily);
sal_Bool bUsedOrUserDefined;
if( pExist )
{
bUsedOrUserDefined =
pExist->IsUsed() || pExist->IsUserDefined();
if( ErrorHandler::HandleError(
*new MessageInfo( ERRCODE_SFXMSG_STYLEREPLACE, aOldName ) )
!= ERRCODE_BUTTON_OK )
return sal_False;
else
{
pMyPool->Replace( *pHisSheet, *pExist );
SetModified( sal_True );
nIdx2 = nIdx1 = INDEX_IGNORE;
return sal_True;
}
}
SfxStyleSheetBase& rNewSheet = pMyPool->Make(
aOldName, eOldFamily,
pHisSheet->GetMask(), nIdx2);
// Fill the Itemset of the new template
rNewSheet.GetItemSet().Set(pHisSheet->GetItemSet());
// Who gets the new one as a Parent?
// Who is using the new one as Follow?
SfxStyleSheetBase* pTestSheet = pMyPool->First();
while (pTestSheet)
{
if (pTestSheet->GetFamily() == eOldFamily &&
pTestSheet->HasParentSupport() &&
pTestSheet->GetParent() == aOldName)
{
pTestSheet->SetParent(aOldName);
// Rebuild Link
}
if (pTestSheet->GetFamily() == eOldFamily &&
pTestSheet->HasFollowSupport() &&
pTestSheet->GetFollow() == aOldName)
{
pTestSheet->SetFollow(aOldName);
// Rebuild Link
}
pTestSheet = pMyPool->Next();
}
bUsedOrUserDefined =
rNewSheet.IsUsed() || rNewSheet.IsUserDefined();
// has a New Parent? if so, start search with the same name
if (pHisSheet->HasParentSupport())
{
const String& rParentName = pHisSheet->GetParent();
if (0 != rParentName.Len())
{
SfxStyleSheetBase* pParentOfNew =
pMyPool->Find(rParentName, eOldFamily);
if (pParentOfNew)
rNewSheet.SetParent(rParentName);
}
}
// Has the new got a Follow? if so start search
// with the same name.
if (pHisSheet->HasFollowSupport())
{
const String& rFollowName = pHisSheet->GetFollow();
if (0 != rFollowName.Len())
{
SfxStyleSheetBase* pFollowOfNew =
pMyPool->Find(rFollowName, eOldFamily);
if (pFollowOfNew)
rNewSheet.SetFollow(rFollowName);
}
}
SetModified( sal_True );
if( !bUsedOrUserDefined ) nIdx2 = nIdx1 = INDEX_IGNORE;
bRet = sal_True;
}
else
bRet = sal_False;
}
return bRet;
}
//--------------------------------------------------------------------
sal_Bool SfxObjectShell::RemoveStuffWithIndexes
(
sal_uInt16 nIdx1,
sal_uInt16 nIdx2,
sal_uInt16 /*nIdx3*/
)
{
sal_Bool bRet = sal_False;
if (CONTENT_STYLE == nIdx1)
{
SfxStyleSheetBasePool* pMyPool = GetStyleSheetPool();
SetOrganizerSearchMask(pMyPool);
SfxStyleSheetBase* pMySheet = (*pMyPool)[nIdx2];
OUString aName(pMySheet->GetName());
OUString aEmpty;
SfxStyleFamily eFamily = pMySheet->GetFamily();
pMyPool->Remove(pMySheet);
bRet = sal_True;
SfxStyleSheetBase* pTestSheet = pMyPool->First();
while (pTestSheet)
{
if (pTestSheet->GetFamily() == eFamily &&
pTestSheet->HasParentSupport() &&
pTestSheet->GetParent() == aName)
{
pTestSheet->SetParent(aEmpty); // Remove link
}
if (pTestSheet->GetFamily() == eFamily &&
pTestSheet->HasFollowSupport() &&
pTestSheet->GetFollow() == aName)
{
pTestSheet->SetFollow(aEmpty); // Remove link
}
pTestSheet = pMyPool->Next();
}
SetModified( sal_True );
}
return bRet;
}
void SfxObjectShell::LoadStyles
(
SfxObjectShell &rSource /* the document template from which
......
......@@ -200,19 +200,6 @@ public:
virtual SfxStyleSheetBasePool* GetStyleSheetPool();
/// For Organizer.
virtual sal_Bool InsertStuffWithIndexes(SfxObjectShell &rSource,
sal_uInt16 nSourceIdx1,
sal_uInt16 nSourceIdx2,
sal_uInt16 nSourceIdx3,
sal_uInt16& nIdx1,
sal_uInt16& nIdx2,
sal_uInt16& nIdx3,
sal_uInt16& nRemovedIdx) SAL_OVERRIDE;
virtual sal_Bool RemoveStuffWithIndexes(sal_uInt16 nIdx1,
sal_uInt16 nIdx2 = INDEX_IGNORE,
sal_uInt16 nIdx3 = INDEX_IGNORE) SAL_OVERRIDE;
virtual Bitmap GetStyleFamilyBitmap( SfxStyleFamily eFamily );
/// Set View for actions via Shell.
......
......@@ -323,284 +323,6 @@ sal_uInt16 SwDocShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
return nRet;
}
// Organizer
sal_Bool SwDocShell::InsertStuffWithIndexes( SfxObjectShell &rSource,
sal_uInt16 nSourceIdx1, // SourcePool: uppermost content level (templates/macros)
sal_uInt16 nSourceIdx2, // Index in the content
sal_uInt16 nSourceIdx3, // Index in the content level
sal_uInt16 &rIdx1, // and the same for the DestinationPool
sal_uInt16 &rIdx2, // ""
sal_uInt16 &rIdx3, // ""
sal_uInt16 &rRemovedIdx ) // if doubles are being deleted, Pos back
{
// #i48949# - actions aren't undoable. Thus, allow no undo
// actions
// Note: The undo action stack is cleared at the end of this method.
::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
sal_Bool bRet = sal_False;
if (INDEX_IGNORE == rIdx1 && CONTENT_STYLE == nSourceIdx1)
rIdx1 = CONTENT_STYLE;
if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == rIdx1)
{
SfxStyleSheetBasePool* pHisPool = rSource.GetStyleSheetPool();
SwDocStyleSheetPool* pMyPool =
(SwDocStyleSheetPool*)GetStyleSheetPool();
// we can't move back and forth within ourselves
if( pHisPool == pMyPool )
return sal_False;
if( INDEX_IGNORE == rIdx2 )
rIdx2 = pMyPool->Count();
// firstly "position" to the search-mask
pHisPool->First();
SfxStyleSheetBase* pHisSheet = (*pHisPool)[nSourceIdx2];
// when such a template already exists: delete!
const String& rOldName = pHisSheet->GetName();
SfxStyleFamily eOldFamily( pHisSheet->GetFamily() );
// never delete default PageDesc and Standard Charactertemplate !!!
if( ( SFX_STYLE_FAMILY_PAGE == eOldFamily &&
pDoc->GetPageDesc(0).GetName() ==
rOldName ) ||
( SFX_STYLE_FAMILY_CHAR == eOldFamily &&
rOldName == SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
RES_POOLCOLL_TEXT_BEGIN ] ))
return sal_False;
SfxStyleFamily eMyOldFamily( pMyPool->GetSearchFamily() );
sal_uInt16 nMySrchMask = pMyPool->GetSearchMask();
SfxStyleSheetBase* pExist;
if( ::FindPhyStyle( *pDoc, rOldName, eOldFamily ) )
{
// only take over, if desired!
if( ERRCODE_BUTTON_OK != ErrorHandler::HandleError(
*new MessageInfo( ERRCODE_SFXMSG_STYLEREPLACE, rOldName )) )
{
return sal_False;
}
// Because Replace needs the aStyleSheet-Member itself, the result
// has to be copied from Find (see below))
rtl::Reference< SwDocStyleSheet > xExist( new SwDocStyleSheet(
*(SwDocStyleSheet*)pMyPool->Find( rOldName, eOldFamily ) ) );
pMyPool->Replace( *pHisSheet, *xExist.get() );
// The ordering of the templates in the Pool is not changed.
rIdx2 = rIdx1 = INDEX_IGNORE;
GetDoc()->SetModified();
return sal_True;
}
pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
// SwDocStyleSheetPool::Make returns a pointer to
// SwDocStyleSheetPool::aStyleSheet that uses same members of
// SwDocStyleSheetPool::Find. Therefore a copy has to be used
// here. Attention: SfxStylessheetBase::SetFollow calls itself
// a SwDocStyleSheetPool::Find, so that it's not sufficient to
// to eliminate the Find-calls in this method.
rtl::Reference< SwDocStyleSheet > xNewSheet( new SwDocStyleSheet( (SwDocStyleSheet&)pMyPool
->Make(rOldName, eOldFamily, pHisSheet->GetMask() ) ) );
if( SFX_STYLE_FAMILY_PAGE == eOldFamily && rSource.ISA(SwDocShell) )
{
// to deal with separately!!
SwPageDesc* pDestDsc = (SwPageDesc*)xNewSheet->GetPageDesc();
SwPageDesc* pCpyDsc = (SwPageDesc*)((SwDocStyleSheet*)pHisSheet)->GetPageDesc();
pDoc->CopyPageDesc( *pCpyDsc, *pDestDsc );
}
else
// populate the new templates with the attributes
xNewSheet->SetItemSet( pHisSheet->GetItemSet() );
pMyPool->SetSearchMask( SFX_STYLE_FAMILY_ALL, nMySrchMask );
if( xNewSheet->IsUserDefined() || xNewSheet->IsUsed() )
{
// Used and User-defined templates are being showed. That's why
// the Index of the template in the pool has to be found out.
pExist = pMyPool->First();
sal_uInt16 nIdx = 0;
while( pExist )
{
if( pExist->GetName() == rOldName &&
eOldFamily == pExist->GetFamily() )
{
rIdx2 = nIdx;
break;
}
pExist = pMyPool->Next();
nIdx++;
}
}
else
{
// Other templates are not being showed.
rIdx1 = rIdx2 = INDEX_IGNORE;
}
// who gets the new one as parent? who uses the new one as Follow?
// (always using the instanciated!!!)
pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
pMyPool->SetOrganizerMode( sal_True );
SfxStyleSheetBase* pTestSheet = pMyPool->First();
while (pTestSheet)
{
if (pTestSheet->GetFamily() == eOldFamily &&
pTestSheet->HasParentSupport() &&
pTestSheet->GetParent() == rOldName)
{
pTestSheet->SetParent(rOldName); // establish the link newly
}
if (pTestSheet->GetFamily() == eOldFamily &&
pTestSheet->HasFollowSupport() &&
pTestSheet->GetFollow() == rOldName)
{
pTestSheet->SetFollow(rOldName); // establish the link newly
}
pTestSheet = pMyPool->Next();
}
pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
// does the new one have a parent? if yes, search with the same name at our place.
if (pHisSheet->HasParentSupport())
{
const String& rParentName = pHisSheet->GetParent();
if (0 != rParentName.Len())
{
SfxStyleSheetBase* pParentOfNew = pMyPool->Find(rParentName,
eOldFamily);
if (pParentOfNew)
{
xNewSheet->SetParent(rParentName);
}
pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
}
}
// does the new one have a Follow? if yes, search with the same name at our place.
if (pHisSheet->HasFollowSupport())
{
const String& rFollowName = pHisSheet->GetFollow();
if (0 != rFollowName.Len())
{
SfxStyleSheetBase* pFollowOfNew = pMyPool->Find(rFollowName,
eOldFamily);
if (pFollowOfNew)
{
xNewSheet->SetFollow(rFollowName);
}
pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
}
}
// set old settings again
pMyPool->SetSearchMask( eMyOldFamily, nMySrchMask );
// Model changed
OSL_ENSURE(pDoc, "Doc missing");
GetDoc()->SetModified();
bRet = sal_True;
}
else
bRet = SfxObjectShell::InsertStuffWithIndexes( rSource,
nSourceIdx1,
nSourceIdx2,
nSourceIdx3,
rIdx1,
rIdx2,
rIdx3,
rRemovedIdx);
// #i48949# - actions aren't undoable and could have change
// the document node array. Thus, clear the undo action stack.
if (undoGuard.UndoWasEnabled())
{
GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
}
return bRet;
}
// template Remove
sal_Bool SwDocShell::RemoveStuffWithIndexes(sal_uInt16 nIdx1, // see Insert
sal_uInt16 nIdx2,
sal_uInt16 nIdx3)
{
sal_Bool bRet = sal_False;
if (CONTENT_STYLE == nIdx1)
{
SwDocStyleSheetPool* pMyPool = (SwDocStyleSheetPool*)GetStyleSheetPool();
pMyPool->First(); // update Pool before access!!
SfxStyleSheetBase* pMySheet = (*pMyPool)[nIdx2];
String aName( pMySheet->GetName() );
SfxStyleFamily eFamily( pMySheet->GetFamily() );
// never delete default PageDesc and Standard Character template!!!
if( ( SFX_STYLE_FAMILY_PAGE == eFamily &&
pDoc->GetPageDesc(0).GetName()
== aName ) ||
( SFX_STYLE_FAMILY_CHAR == eFamily &&
aName == SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
RES_POOLCOLL_TEXT_BEGIN ] ))
return sal_False;
// so delete
pMyPool->Remove( pMySheet );
// now correct the Parents/Follows of all instanciated
pMyPool->SetOrganizerMode( sal_True );
SfxStyleSheetBase* pTestSheet = pMyPool->First();
while (pTestSheet)
{
if (pTestSheet->GetFamily() == eFamily &&
pTestSheet->HasParentSupport() &&
pTestSheet->GetParent() == aName)
{
pTestSheet->SetParent( aEmptyStr ); // resolve link
}
if (pTestSheet->GetFamily() == eFamily &&
pTestSheet->HasFollowSupport() &&
pTestSheet->GetFollow() == aName)
{
pTestSheet->SetFollow( aEmptyStr ); // resolve link
}
pTestSheet = pMyPool->Next();
}
pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
bRet = sal_True;
}
else
bRet = SfxObjectShell::RemoveStuffWithIndexes( nIdx1,
nIdx2,
nIdx3 );
// Model changed
OSL_ENSURE(pDoc, "Doc missing");
GetDoc()->SetModified();
return bRet;
}
void SwDocShell::Execute(SfxRequest& rReq)
{
const SfxItemSet* pArgs = rReq.GetArgs();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment