Kaydet (Commit) cb64bcb4 authored tarafından Caolán McNamara's avatar Caolán McNamara

callcatcher: ditch some more methods

üst 8a3cdcdc
......@@ -276,9 +276,6 @@ public:
void SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
sal_uInt16 GetSearchMask() const;
SfxStyleFamily GetSearchFamily() const { return nSearchFamily; }
sal_Bool Load( SvStream& );
sal_Bool Store( SvStream&, sal_Bool bUsed = sal_True );
};
//=========================================================================
......
......@@ -894,112 +894,6 @@ void SfxStyleSheetBase::Store( SvStream& )
{
}
sal_Bool SfxStyleSheetBasePool::Load( SvStream& rStream )
{
// alte Version?
if ( !rPool.IsVer2_Impl() )
return Load1_Impl( rStream );
// gesamten StyleSheetPool in neuer Version aus einem MiniRecord lesen
SfxMiniRecordReader aPoolRec( &rStream, SFX_STYLES_REC );
// Header-Record lesen
short nCharSet = 0;
if ( !rStream.GetError() )
{
SfxSingleRecordReader aHeaderRec( &rStream, SFX_STYLES_REC_HEADER );
if ( !aHeaderRec.IsValid() )
return sal_False;
aAppName = rPool.GetName();
rStream >> nCharSet;
}
// Styles-Record lesen
if ( !rStream.GetError() )
{
SfxMultiRecordReader aStylesRec( &rStream, SFX_STYLES_REC_STYLES );
if ( !aStylesRec.IsValid() )
return sal_False;
rtl_TextEncoding eEnc = GetSOLoadTextEncoding(
(rtl_TextEncoding)nCharSet,
sal::static_int_cast< sal_uInt16 >(rStream.GetVersion()) );
rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet();
rStream.SetStreamCharSet( eEnc );
sal_uInt16 nStyles;
for ( nStyles = 0; aStylesRec.GetContent(); nStyles++ )
{
// kann nicht mehr weiterlesen?
if ( rStream.GetError() )
break;
// Globale Teile
XubString aName, aParent, aFollow;
String aHelpFile;
sal_uInt16 nFamily, nStyleMask,nCount;
sal_uInt32 nHelpId;
rStream.ReadByteString(aName, eEnc );
rStream.ReadByteString(aParent, eEnc );
rStream.ReadByteString(aFollow, eEnc );
rStream >> nFamily >> nStyleMask;
SfxPoolItem::readByteString(rStream, aHelpFile);
rStream >> nHelpId;
SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask);
rSheet.SetHelpId( aHelpFile, nHelpId );
// Hier erst einmal Parent und Follow zwischenspeichern
rSheet.aParent = aParent;
rSheet.aFollow = aFollow;
sal_uInt32 nPos = rStream.Tell();
rStream >> nCount;
if(nCount)
{
rStream.Seek( nPos );
// Das Laden des ItemSets bedient sich der Methode GetItemSet(),
// damit eigene ItemSets untergeschoben werden koennen
SfxItemSet& rSet = rSheet.GetItemSet();
rSet.ClearItem();
//! SfxItemSet aTmpSet( *pTmpPool );
/*!aTmpSet*/ rSet.Load( rStream );
//! rSet.Put( aTmpSet );
}
// Lokale Teile
sal_uInt32 nSize;
sal_uInt16 nVer;
rStream >> nVer >> nSize;
nPos = rStream.Tell() + nSize;
rSheet.Load( rStream, nVer );
rStream.Seek( nPos );
}
// #72939# only loop through the styles that were really inserted
sal_uLong n = aStyles.size();
//! delete pTmpPool;
// Jetzt Parent und Follow setzen. Alle Sheets sind geladen.
// Mit Setxxx() noch einmal den String eintragen, da diese
// virtuellen Methoden evtl. ueberlagert sind.
for ( sal_uLong i = 0; i < n; i++ )
{
SfxStyleSheetBase* p = aStyles[ i ].get();
XubString aText = p->aParent;
p->aParent.Erase();
p->SetParent( aText );
aText = p->aFollow;
p->aFollow.Erase();
p->SetFollow( aText );
}
rStream.SetStreamCharSet( eOldEnc );
}
// alles klar?
return sal_Bool( rStream.GetError() == SVSTREAM_OK );
}
sal_Bool SfxStyleSheetBasePool::Load1_Impl( SvStream& rStream )
{
aAppName = rPool.GetName();
......@@ -1095,150 +989,6 @@ sal_Bool SfxStyleSheetBasePool::Load1_Impl( SvStream& rStream )
return sal_Bool( rStream.GetError() == SVSTREAM_OK );
}
sal_Bool SfxStyleSheetBasePool::Store( SvStream& rStream, sal_Bool bUsed )
{
// den ganzen StyleSheet-Pool in einen Mini-Record
SfxMiniRecordWriter aPoolRec( &rStream, SFX_STYLES_REC );
// Erst einmal die Dummies rauszaehlen; die werden nicht gespeichert
sal_uInt16 nCount = 0;
for( SfxStyleSheetBase* p = First(); p; p = Next() )
{
if(!bUsed || p->IsUsed())
nCount++;
}
// einen Header-Record vorweg
rtl_TextEncoding eEnc
= ::GetSOStoreTextEncoding(
rStream.GetStreamCharSet(),
sal::static_int_cast< sal_uInt16 >(rStream.GetVersion()) );
rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet();
rStream.SetStreamCharSet( eEnc );
{
SfxSingleRecordWriter aHeaderRec( &rStream,
SFX_STYLES_REC_HEADER,
STYLESTREAM_VERSION );
rStream << (short) eEnc;
}
// die StyleSheets in einen MultiVarRecord
{
// Bug 79478:
// make a check loop, to be shure, that the converted names are also
// unique like the originals! In other cases we get a loop.
SvStringsSortDtor aSortOrigNames( 0, 128 );
SvStrings aOrigNames( 0, 128 );
SvByteStringsSortDtor aSortConvNames( 0, 128 );
SvByteStrings aConvNames( 0, 128 );
{
for( SfxStyleSheetBase* p = First(); p; p = Next() )
{
if(!bUsed || p->IsUsed())
{
sal_uInt16 nFamily = (sal_uInt16)p->GetFamily();
String* pName = new String( p->GetName() );
ByteString* pConvName = new ByteString( *pName, eEnc );
pName->Insert( (sal_Unicode)nFamily, 0 );
pConvName->Insert( " ", 0 );
pConvName->SetChar(
0,
sal::static_int_cast< char >(0xff & (nFamily >> 8)) );
pConvName->SetChar(
1, sal::static_int_cast< char >(0xff & nFamily) );
sal_uInt16 nInsPos, nAdd = aSortConvNames.Count();
while( !aSortConvNames.Insert( pConvName, nInsPos ) )
(pConvName->Append( '_' )).Append(ByteString(
rtl::OString::valueOf(static_cast<sal_Int32>(nAdd++))));
aOrigNames.Insert( pName, nInsPos );
}
}
// now we have the list of the names, sorted by convertede names
// But now we need the sorted list of orignames.
{
sal_uInt16 nInsPos, nEnd = aOrigNames.Count();
const ByteStringPtr* ppB = aSortConvNames.GetData();
for( sal_uInt16 n = 0; n < nEnd; ++n, ++ppB )
{
String* p = aOrigNames.GetObject( n );
aSortOrigNames.Insert( p, nInsPos );
aConvNames.Insert( *ppB, nInsPos );
}
}
}
ByteString sEmpty;
sal_uInt16 nFndPos;
String sNm;
SfxMultiVarRecordWriter aStylesRec( &rStream, SFX_STYLES_REC_STYLES, 0 );
for( SfxStyleSheetBase* p = First(); p; p = Next() )
{
if(!bUsed || p->IsUsed())
{
aStylesRec.NewContent();
// Globale Teile speichern
String aHelpFile;
sal_uInt32 nHelpId = p->GetHelpId( aHelpFile );
sal_uInt16 nFamily = sal::static_int_cast< sal_uInt16 >(p->GetFamily());
String sFamily( (sal_Unicode)nFamily );
(sNm = sFamily) += p->GetName();
if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
else
rStream.WriteByteString( sEmpty );
(sNm = sFamily) += p->GetParent();
if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
else
rStream.WriteByteString( sEmpty );
(sNm = sFamily) += p->GetFollow();
if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
else
rStream.WriteByteString( sEmpty );
rStream << nFamily << p->GetMask();
SfxPoolItem::writeByteString(rStream, aHelpFile);
rStream << nHelpId;
if(p->pSet)
p->pSet->Store( rStream );
else
rStream << (sal_uInt16)0;
// Lokale Teile speichern
// Vor dem lokalen Teil wird die Laenge der lokalen Daten
// als sal_uInt32 sowie die Versionsnummer gespeichert.
rStream << (sal_uInt16) p->GetVersion();
sal_uLong nPos1 = rStream.Tell();
rStream << (sal_uInt32) 0;
p->Store( rStream );
sal_uLong nPos2 = rStream.Tell();
rStream.Seek( nPos1 );
rStream << (sal_uInt32) ( nPos2 - nPos1 - sizeof( sal_uInt32 ) );
rStream.Seek( nPos2 );
if( rStream.GetError() != SVSTREAM_OK )
break;
}
}
}
rStream.SetStreamCharSet( eOldEnc );
return sal_Bool( rStream.GetError() == SVSTREAM_OK );
}
SfxItemPool& SfxStyleSheetBasePool::GetPool()
{
return rPool;
......
......@@ -396,14 +396,8 @@ public:
FSysError ExecuteExact( FSysAction nActions = FSYS_ACTION_STANDARD,
FSysExact eExact = FSYS_NOTEXACT);
const DirEntry* GetErrorSource() const;
const DirEntry* GetErrorTarget() const;
ErrCode GetError() const;
void SetProgressHdl( const Link& rLink ) { aProgressLink = rLink; }
const Link& GetProgressHdl() const { return aProgressLink; }
void SetErrorHdl( const Link& rLink );
const Link& GetErrorHdl() const;
};
// -------
......
......@@ -149,41 +149,6 @@ ErrCode FileCopier::Error( ErrCode eErr, const DirEntry* pSource, const DirEntry
return eRet;
}
//---------------------------------------------------------------------------
const DirEntry* FileCopier::GetErrorSource() const
{
return pImp->pErrSource;
}
//---------------------------------------------------------------------------
const DirEntry* FileCopier::GetErrorTarget() const
{
return pImp->pErrTarget;
}
//---------------------------------------------------------------------------
ErrCode FileCopier::GetError() const
{
return pImp->eErr;
}
//---------------------------------------------------------------------------
void FileCopier::SetErrorHdl( const Link &rLink )
{
pImp->aErrorLink = rLink;
}
//---------------------------------------------------------------------------
const Link& FileCopier::GetErrorHdl() const
{
return pImp->aErrorLink ;
}
/*************************************************************************
|*
|* FileCopier::Execute()
......
......@@ -112,20 +112,6 @@ namespace utl {
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::util::AtomDescription > SAL_CALL getRecentAtoms( sal_Int32 atomClass, sal_Int32 atom ) throw();
virtual sal_Int32 SAL_CALL getAtom( sal_Int32 atomClass, const ::rtl::OUString& description, sal_Bool create ) throw();
};
class AtomClient
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::util::XAtomServer > m_xServer;
MultiAtomProvider m_aProvider;
public:
AtomClient( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XAtomServer >& );
~AtomClient();
void updateAtomClasses( const ::com::sun::star::uno::Sequence< sal_Int32 >& atomClasses );
int getAtom( int atomClass, const ::rtl::OUString& description, sal_Bool bCreate );
const ::rtl::OUString& getString( int atomClass, int atom );
};
}
#endif
......
......@@ -117,7 +117,6 @@ namespace utl
protected:
ConfigItem(const rtl::OUString &rSubTree,
sal_Int16 nMode = CONFIG_MODE_DELAYED_UPDATE);
ConfigItem(utl::ConfigManager& rManager, const rtl::OUString rSubTree);
void SetModified (); // mark item as modified
void ClearModified(); // reset state after commit!
......@@ -189,11 +188,6 @@ namespace utl
/** is called from the ConfigManager if it is destroyed before the ConfigItem. */
void ReleaseConfigMgr();
/** enable locking of the XHierarchicalNameAccess if CONFIG_MODE_RELEASE_TREE is set to
prevent multiple calls ConfigManager::AcquireTree() from a single Commit() operation*/
void LockTree();
void UnlockTree();
const rtl::OUString& GetSubTreeName() const {return sSubTree;}
sal_Bool IsModified() const;
......
......@@ -237,15 +237,6 @@ ConfigItem::ConfigItem(const OUString &rSubTree, sal_Int16 nSetMode ) :
pImpl->nMode &= ~CONFIG_MODE_PROPAGATE_ERRORS;
}
ConfigItem::ConfigItem(utl::ConfigManager& rManager, const rtl::OUString rSubTree) :
sSubTree(rSubTree),
pImpl(new ConfigItem_Impl)
{
pImpl->pManager = &rManager;
pImpl->nMode = CONFIG_MODE_IMMEDIATE_UPDATE; // does not allow exceptions
m_xHierarchyAccess = pImpl->pManager->AddConfigItem(*this);
}
sal_Bool ConfigItem::IsValidConfigMgr() const
{
return ( pImpl->pManager && pImpl->pManager->GetConfigurationProvider().is() );
......@@ -1327,18 +1318,4 @@ Reference< XHierarchicalNameAccess> ConfigItem::GetTree()
return xRet;
}
void ConfigItem::LockTree()
{
OSL_ENSURE(0 != (pImpl->nMode&CONFIG_MODE_RELEASE_TREE), "call LockTree in CONFIG_MODE_RELEASE_TREE mode, only");
m_xHierarchyAccess = GetTree();
}
void ConfigItem::UnlockTree()
{
OSL_ENSURE(0 != (pImpl->nMode&CONFIG_MODE_RELEASE_TREE), "call UnlockTree in CONFIG_MODE_RELEASE_TREE mode, only");
if(0 != (pImpl->nMode&CONFIG_MODE_RELEASE_TREE))
m_xHierarchyAccess = 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -287,100 +287,4 @@ Sequence< ::rtl::OUString > AtomServer::getAtomDescriptions( const Sequence< Ato
return aRet;
}
// -----------------------------------------------------------------------
AtomClient::AtomClient( const Reference< XAtomServer >& xServer ) :
m_xServer( xServer )
{
}
AtomClient::~AtomClient()
{
}
int AtomClient::getAtom( int atomClass, const ::rtl::OUString& description, sal_Bool bCreate )
{
int nAtom = m_aProvider.getAtom( atomClass, description, sal_False );
if( nAtom == INVALID_ATOM && bCreate )
{
try
{
nAtom = m_xServer->getAtom( atomClass, description, bCreate );
}
catch( RuntimeException& )
{
return INVALID_ATOM;
}
if( nAtom != INVALID_ATOM )
m_aProvider.overrideAtom( atomClass, nAtom, description );
}
return nAtom;
}
const ::rtl::OUString& AtomClient::getString( int atomClass, int atom )
{
static ::rtl::OUString aEmpty;
if( ! m_aProvider.hasAtom( atomClass, atom ) )
{
Sequence< NMSP_UTIL::AtomDescription > aSeq;
try
{
aSeq = m_xServer->getRecentAtoms( atomClass, m_aProvider.getLastAtom( atomClass ) );
}
catch( RuntimeException& )
{
return aEmpty;
}
const NMSP_UTIL::AtomDescription* pDescriptions = aSeq.getConstArray();
for( int i = 0; i < aSeq.getLength(); i++ )
m_aProvider.overrideAtom( atomClass,
pDescriptions[i].atom,
pDescriptions[i].description
);
if( ! m_aProvider.hasAtom( atomClass, atom ) )
{
// holes may occur by the above procedure!
Sequence< AtomClassRequest > aReq( 1 );
aReq.getArray()[0].atomClass = atomClass;
aReq.getArray()[0].atoms.realloc( 1 );
aReq.getArray()[0].atoms.getArray()[0] = atom;
Sequence< ::rtl::OUString > aRet;
try
{
aRet = m_xServer->getAtomDescriptions( aReq );
}
catch( RuntimeException& )
{
return aEmpty;
}
if( aRet.getLength() == 1 )
m_aProvider.overrideAtom( atomClass, atom, aRet.getConstArray()[0] );
}
}
return m_aProvider.getString( atomClass, atom );
}
void AtomClient::updateAtomClasses( const Sequence< sal_Int32 >& atomClasses )
{
Sequence< Sequence< NMSP_UTIL::AtomDescription > > aUpdate;
try
{
aUpdate = m_xServer->getClasses( atomClasses );
}
catch( RuntimeException& )
{
return;
}
for( int i = 0; i < atomClasses.getLength(); i++ )
{
int nClass = atomClasses.getConstArray()[i];
const Sequence< NMSP_UTIL::AtomDescription >& rClass = aUpdate.getConstArray()[i];
const NMSP_UTIL::AtomDescription* pDesc = rClass.getConstArray();
for( int n = 0; n < rClass.getLength(); n++, pDesc++ )
m_aProvider.overrideAtom( nClass, pDesc->atom, pDesc->description );
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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