diff options
Diffstat (limited to 'sfx2/source/doc')
28 files changed, 1234 insertions, 847 deletions
diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc index 7e8fd688af52..c3cbf01cfc9a 100644 --- a/sfx2/source/doc/doc.hrc +++ b/sfx2/source/doc/doc.hrc @@ -146,11 +146,6 @@ #define RID_CNT_STR_WAITING (RID_SFX_DOC_START+ 83) #define STR_OBJECT (RID_SFX_DOC_START+ 84) -#define STR_EDITOBJECT (RID_SFX_DOC_START+ 85) -// --> PB 2004-08-20 #i33095# -/* obsolete -#define STR_OPENOBJECT (RID_SFX_DOC_START+ 86) -*/ #define DLOAD_URL 1 #define DLOAD_STATUS 2 diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src index 497d4ccd7c97..bbf3ccb33253 100644 --- a/sfx2/source/doc/doc.src +++ b/sfx2/source/doc/doc.src @@ -371,19 +371,6 @@ String STR_OBJECT Text [ en-US ] = "Object" ; }; -String STR_EDITOBJECT -{ - Text [ en-US ] = "~Edit"; -}; - -// --> PB 2004-08-20 #i33095# -/* obsolete -String STR_OPENOBJECT -{ - Text [ en-US ] = "~Open"; -}; -*/ - QueryBox DLG_MACROQUERY { Buttons = WB_OK_CANCEL; diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index ff0a15e20088..1ef90b67b173 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -381,7 +381,7 @@ const SfxObjectFactory* SfxObjectFactory::GetFactory( const String& rFactoryURL const SfxFilter* SfxObjectFactory::GetTemplateFilter() const { - USHORT nVersion=0; + sal_uInt16 nVersion=0; SfxFilterMatcher aMatcher ( String::CreateFromAscii( pShortName ) ); SfxFilterMatcherIter aIter( &aMatcher ); const SfxFilter *pFilter = 0; @@ -391,7 +391,7 @@ const SfxFilter* SfxObjectFactory::GetTemplateFilter() const if( pTemp->IsOwnFormat() && pTemp->IsOwnTemplateFormat() && ( pTemp->GetVersion() > nVersion ) ) { pFilter = pTemp; - nVersion = (USHORT) pTemp->GetVersion(); + nVersion = (sal_uInt16) pTemp->GetVersion(); } pTemp = aIter.Next(); @@ -476,7 +476,7 @@ sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const s SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rViewName ) const { - for ( USHORT nViewNo = 0; + for ( sal_uInt16 nViewNo = 0; nViewNo < GetViewFactoryCount(); ++nViewNo ) diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 434553bdb226..63b116ef75e8 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -727,7 +727,7 @@ const String& SfxMedium::GetPhysicalName() const //------------------------------------------------------------------ void SfxMedium::CreateFileStream() { - ForceSynchronStream_Impl( TRUE ); + ForceSynchronStream_Impl( sal_True ); GetInStream(); if( pInStream ) { @@ -767,7 +767,7 @@ sal_Bool SfxMedium::Commit() sal_Bool SfxMedium::IsStorage() { if ( pImp->xStorage.is() ) - return TRUE; + return sal_True; if ( bTriedStorage ) return pImp->bIsStorage; @@ -781,13 +781,13 @@ sal_Bool SfxMedium::IsStorage() } pImp->bIsStorage = SotStorage::IsStorageFile( aURL ) && !SotStorage::IsOLEStorage( aURL); if ( !pImp->bIsStorage ) - bTriedStorage = TRUE; + bTriedStorage = sal_True; } else if ( GetInStream() ) { pImp->bIsStorage = SotStorage::IsStorageFile( pInStream ) && !SotStorage::IsOLEStorage( pInStream ); if ( !pInStream->GetError() && !pImp->bIsStorage ) - bTriedStorage = TRUE; + bTriedStorage = sal_True; } return pImp->bIsStorage; @@ -1225,7 +1225,7 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) // the error should be set in case it is storing process // or the document has been opened for editing explicitly - SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); + SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, sal_False ); if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); else @@ -1337,7 +1337,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf SFX_ITEMSET_ARG( pSet, pVersion, SfxInt16Item, SID_VERSION, sal_False); - BOOL bResetStorage = FALSE; + sal_Bool bResetStorage = sal_False; if ( pVersion && pVersion->GetValue() ) { // Alle verf"ugbaren Versionen einlesen @@ -1388,11 +1388,11 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf pImp->aVersions.realloc(0); } else - bResetStorage = TRUE; + bResetStorage = sal_True; } } else - bResetStorage = TRUE; + bResetStorage = sal_True; } if ( bResetStorage ) @@ -1645,7 +1645,7 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, sal_Bool bTransactStarted = sal_False; SFX_ITEMSET_ARG( GetItemSet(), pOverWrite, SfxBoolItem, SID_OVERWRITE, sal_False ); SFX_ITEMSET_ARG( GetItemSet(), pRename, SfxBoolItem, SID_RENAME, sal_False ); - sal_Bool bRename = pRename ? pRename->GetValue() : FALSE; + sal_Bool bRename = pRename ? pRename->GetValue() : sal_False; sal_Bool bOverWrite = pOverWrite ? pOverWrite->GetValue() : !bRename; try @@ -2269,7 +2269,7 @@ void SfxMedium::GetMedium_Impl() { GetItemSet()->Put( SfxStringItem( SID_FILE_NAME, aFileName ) ); if( !(nStorOpenMode & STREAM_WRITE ) ) - GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, TRUE ) ); + GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); if (xInteractionHandler.is()) GetItemSet()->Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, makeAny(xInteractionHandler) ) ); } @@ -2413,7 +2413,7 @@ void SfxMedium::Init_Impl() Reference< XOutputStream > rOutStream; // TODO/LATER: handle lifetime of storages - pImp->bDisposeStorage = FALSE; + pImp->bDisposeStorage = sal_False; SFX_ITEMSET_ARG( pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False); if ( pSalvageItem && !pSalvageItem->GetValue().Len() ) @@ -2469,7 +2469,7 @@ void SfxMedium::Init_Impl() if ( aLogicName.Len() ) { // if the logic name is set it should be set in MediaDescriptor as well - SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE ); + SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False ); if ( !pFileNameItem ) { // let the ItemSet be created if necessary @@ -2515,7 +2515,7 @@ SfxMedium::SfxMedium( const SfxMedium& rMedium, sal_Bool bTemporary ) //------------------------------------------------------------------ -void SfxMedium::UseInteractionHandler( BOOL bUse ) +void SfxMedium::UseInteractionHandler( sal_Bool bUse ) { pImp->bAllowDefaultIntHdl = bUse; } @@ -2649,12 +2649,12 @@ void SfxMedium::Close() pImp->xLockBytes.Clear(); if ( pSet ) pSet->ClearItem( SID_INPUTSTREAM ); - aStorage->SetDeleteStream( TRUE ); + aStorage->SetDeleteStream( sal_True ); } else if ( pStream && pStream == pOutStream ) { pOutStream = NULL; - aStorage->SetDeleteStream( TRUE ); + aStorage->SetDeleteStream( sal_True ); } */ CloseStorage(); @@ -2682,12 +2682,12 @@ void SfxMedium::CloseAndRelease() pImp->xLockBytes.Clear(); if ( pSet ) pSet->ClearItem( SID_INPUTSTREAM ); - aStorage->SetDeleteStream( TRUE ); + aStorage->SetDeleteStream( sal_True ); } else if ( pStream && pStream == pOutStream ) { pOutStream = NULL; - aStorage->SetDeleteStream( TRUE ); + aStorage->SetDeleteStream( sal_True ); } */ CloseStorage(); @@ -2811,7 +2811,7 @@ void SfxMedium::SetIsRemote_Impl() case INET_PROT_IMAP: // case INET_PROT_OUT: case INET_PROT_VIM: - bRemote = TRUE; break; + bRemote = sal_True; break; default: bRemote = ( GetName().CompareToAscii( "private:msgid", 13 ) == COMPARE_EQUAL ); break; @@ -2888,8 +2888,8 @@ sal_Bool SfxMedium::Exists( sal_Bool /*bForceSession*/ ) void SfxMedium::ReOpen() { - BOOL bUseInteractionHandler = pImp->bUseInteractionHandler; - pImp->bUseInteractionHandler = FALSE; + sal_Bool bUseInteractionHandler = pImp->bUseInteractionHandler; + pImp->bUseInteractionHandler = sal_False; GetMedium_Impl(); pImp->bUseInteractionHandler = bUseInteractionHandler; } @@ -2899,8 +2899,8 @@ void SfxMedium::ReOpen() void SfxMedium::CompleteReOpen() { // do not use temporary file for reopen and in case of success throw the temporary file away - BOOL bUseInteractionHandler = pImp->bUseInteractionHandler; - pImp->bUseInteractionHandler = FALSE; + sal_Bool bUseInteractionHandler = pImp->bUseInteractionHandler; + pImp->bUseInteractionHandler = sal_False; ::utl::TempFile* pTmpFile = NULL; if ( pImp->pTempFile ) @@ -2978,7 +2978,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b // if an URL is provided in SalvageItem that means that the FileName refers to a temporary file // that must be copied here - SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE ); + SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False ); if (!pFileNameItem) throw uno::RuntimeException(); ::rtl::OUString aNewTempFileURL = SfxMedium::CreateTempCopyWithExt( pFileNameItem->GetValue() ); if ( aNewTempFileURL.getLength() ) @@ -2995,16 +2995,16 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b } } - BOOL bReadOnly = FALSE; - SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); + sal_Bool bReadOnly = sal_False; + SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, sal_False ); if ( pReadOnlyItem && pReadOnlyItem->GetValue() ) - bReadOnly = TRUE; + bReadOnly = sal_True; - SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE ); + SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False ); if (!pFileNameItem) throw uno::RuntimeException(); aLogicName = pFileNameItem->GetValue(); nStorOpenMode = bReadOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE; - bDirect = FALSE; + bDirect = sal_False; Init_Impl(); } @@ -3022,7 +3022,7 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str Init_Impl(); pImp->xStorage = rStor; - pImp->bDisposeStorage = FALSE; + pImp->bDisposeStorage = sal_False; // always take BaseURL first, could be overwritten by ItemSet GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, rBaseURL ) ); @@ -3104,7 +3104,7 @@ sal_uInt32 SfxMedium::GetMIMEAndRedirect( String& /*rName*/ ) if( eProt == INET_PROT_FTP && SvBinding::ShouldUseFtpProxy( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) { Any aAny( UCB_Helper::GetProperty( GetContent(), WID_FLAG_IS_FOLDER ) ); - sal_Bool bIsFolder = FALSE; + sal_Bool bIsFolder = sal_False; if ( ( aAny >>= bIsFolder ) && bIsFolder ) return ERRCODE_NONE; } @@ -3304,7 +3304,7 @@ sal_uInt16 SfxMedium::AddVersion_Impl( util::RevisionTag& rRevision ) sal_uInt16 nKey; for ( nKey=0; nKey<aLongs.Count(); nKey++ ) - if ( aLongs[nKey] > ( ULONG ) nKey+1 ) + if ( aLongs[nKey] > ( sal_uIntPtr ) nKey+1 ) break; String aRevName = DEFINE_CONST_UNICODE( "Version" ); @@ -3595,7 +3595,7 @@ void SfxMedium::SetCharset( ::rtl::OUString aChs ) sal_Bool SfxMedium::SignContents_Impl( sal_Bool bScriptingContent, const ::rtl::OUString& aODFVersion, sal_Bool bHasValidDocumentSignature ) { - sal_Bool bChanges = FALSE; + sal_Bool bChanges = sal_False; // the medium should be closed to be able to sign, the caller is responsible to close it if ( !IsOpen() && !GetError() ) @@ -3658,7 +3658,7 @@ sal_Bool SfxMedium::SignContents_Impl( sal_Bool bScriptingContent, const ::rtl:: // the temporary file has been written, commit it to the original file Commit(); - bChanges = TRUE; + bChanges = sal_True; } } else @@ -3677,7 +3677,7 @@ sal_Bool SfxMedium::SignContents_Impl( sal_Bool bScriptingContent, const ::rtl:: // the temporary file has been written, commit it to the original file Commit(); - bChanges = TRUE; + bChanges = sal_True; } } } @@ -3722,12 +3722,12 @@ void SfxMedium::SetCachedSignatureState_Impl( sal_uInt16 nState ) pImp->m_nSignatureState = nState; } -BOOL SfxMedium::HasStorage_Impl() const +sal_Bool SfxMedium::HasStorage_Impl() const { return pImp->xStorage.is(); } -BOOL SfxMedium::IsOpen() const +sal_Bool SfxMedium::IsOpen() const { return pInStream || pOutStream || pImp->xStorage.is(); } @@ -3834,7 +3834,7 @@ sal_Bool SfxMedium::CallApproveHandler( const uno::Reference< task::XInteraction // remove the readonly state sal_Bool bWasReadonly = sal_False; nStorOpenMode = SFX_STREAM_READWRITE; - SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); + SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, sal_False ); if ( pReadOnlyItem && pReadOnlyItem->GetValue() ) bWasReadonly = sal_True; GetItemSet()->ClearItem( SID_DOC_READONLY ); diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index 1219d30d7b27..516f6c549b4b 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -177,7 +177,7 @@ String SfxFilter::GetTypeFromStorage( const SotStorage& rStg ) return pType ? String::CreateFromAscii(pType) : String(); } -String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, BOOL bTemplate, +String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, sal_Bool bTemplate, String* pFilterName ) throw ( beans::UnknownPropertyException, lang::WrappedTargetException, diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx index d0f6678d8641..bd23bf5659d0 100644 --- a/sfx2/source/doc/docinf.cxx +++ b/sfx2/source/doc/docinf.cxx @@ -290,7 +290,7 @@ uno::Sequence<sal_uInt8> SFX2_DLLPUBLIC convertMetaFile(GDIMetaFile* i_pThumb) SvMemoryStream aStream; // magic value 160 taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() if( i_pThumb->CreateThumbnail( 160, aBitmap ) ) { - aBitmap.GetBitmap().Write( aStream, FALSE, FALSE ); + aBitmap.GetBitmap().Write( aStream, sal_False, sal_False ); // uno::Sequence<sal_uInt8> aSeq(aStream.GetSize()); // WRONG aStream.Seek(STREAM_SEEK_TO_END); uno::Sequence<sal_uInt8> aSeq(aStream.Tell()); diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index 360854dc3dbf..e03f18691a09 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -111,9 +111,9 @@ SfxMedium* DocumentInserter::CreateMedium() DBG_ASSERT( m_pURLList->Count() == 1, "DocumentInserter::CreateMedium(): invalid URL list count" ); String sURL = *( m_pURLList->GetObject(0) ); pMedium = new SfxMedium( - sURL, SFX_STREAM_READONLY, FALSE, + sURL, SFX_STREAM_READONLY, sal_False, SFX_APP()->GetFilterMatcher().GetFilter4FilterName( m_sFilter ), m_pItemSet ); - pMedium->UseInteractionHandler( TRUE ); + pMedium->UseInteractionHandler( sal_True ); SfxFilterMatcher* pMatcher = NULL; if ( m_sDocFactory.Len() ) pMatcher = new SfxFilterMatcher( m_sDocFactory ); @@ -121,7 +121,7 @@ SfxMedium* DocumentInserter::CreateMedium() pMatcher = new SfxFilterMatcher(); const SfxFilter* pFilter = NULL; - sal_uInt32 nError = pMatcher->DetectFilter( *pMedium, &pFilter, FALSE ); + sal_uInt32 nError = pMatcher->DetectFilter( *pMedium, &pFilter, sal_False ); if ( nError == ERRCODE_NONE && pFilter ) pMedium->SetFilter( pFilter ); else @@ -145,16 +145,16 @@ SfxMediumList* DocumentInserter::CreateMediumList() sal_Int32 nCount = m_pURLList->Count(); for ( ; i < nCount; ++i ) { - String sURL = *( m_pURLList->GetObject( static_cast< USHORT >(i) ) ); + String sURL = *( m_pURLList->GetObject( static_cast< sal_uInt16 >(i) ) ); SfxMedium* pMedium = new SfxMedium( - sURL, SFX_STREAM_READONLY, FALSE, + sURL, SFX_STREAM_READONLY, sal_False, SFX_APP()->GetFilterMatcher().GetFilter4FilterName( m_sFilter ), m_pItemSet ); - pMedium->UseInteractionHandler( TRUE ); + pMedium->UseInteractionHandler( sal_True ); SfxFilterMatcher aMatcher( m_sDocFactory ); const SfxFilter* pFilter = NULL; - sal_uInt32 nError = aMatcher.DetectFilter( *pMedium, &pFilter, FALSE ); + sal_uInt32 nError = aMatcher.DetectFilter( *pMedium, &pFilter, sal_False ); if ( nError == ERRCODE_NONE && pFilter ) pMedium->SetFilter( pFilter ); else @@ -180,7 +180,7 @@ void impl_FillURLList( sfx2::FileDialogHelper* _pFileDlg, SvStringsDtor*& _rpURL { _rpURLList = new SvStringsDtor; - for ( USHORT i = 0; i < aPathSeq.getLength(); ++i ) + for ( sal_uInt16 i = 0; i < aPathSeq.getLength(); ++i ) { INetURLObject aPathObj( aPathSeq[i] ); String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) ); diff --git a/sfx2/source/doc/doctdlg.cxx b/sfx2/source/doc/doctdlg.cxx index e6726e97e96d..7a3c4a66f443 100644 --- a/sfx2/source/doc/doctdlg.cxx +++ b/sfx2/source/doc/doctdlg.cxx @@ -112,8 +112,8 @@ void SfxDocumentTemplateDlg::Init() if(!pTemplates->IsConstructed()) pTemplates->Construct(); - const USHORT nCount = pTemplates->GetRegionCount(); - for(USHORT i = 0; i < nCount; ++i) + const sal_uInt16 nCount = pTemplates->GetRegionCount(); + for(sal_uInt16 i = 0; i < nCount; ++i) aRegionLb.InsertEntry(pTemplates->GetFullRegionName(i)); if(!nCount) aRegionLb.InsertEntry(String(SfxResId(STR_STANDARD))); @@ -144,10 +144,10 @@ IMPL_LINK( SfxDocumentTemplateDlg, OrganizeHdl, Button *, pButton ) if(RET_OK == nRet) { // View aktualisieren - aRegionLb.SetUpdateMode( FALSE ); + aRegionLb.SetUpdateMode( sal_False ); aRegionLb.Clear(); Init(); - aRegionLb.SetUpdateMode( TRUE ); + aRegionLb.SetUpdateMode( sal_True ); aRegionLb.Invalidate(); aRegionLb.Update(); aCancelBt.SetText(String(SfxResId(STR_CLOSE))); @@ -177,14 +177,14 @@ IMPL_LINK( SfxDocumentTemplateDlg, OkHdl, Control *, pControl ) IMPL_LINK( SfxDocumentTemplateDlg, RegionSelect, ListBox *, pBox ) { - const USHORT nRegion = pBox->GetSelectEntryPos(); - const USHORT nCount = pTemplates->GetCount(nRegion); - aTemplateLb.SetUpdateMode(FALSE); + const sal_uInt16 nRegion = pBox->GetSelectEntryPos(); + const sal_uInt16 nCount = pTemplates->GetCount(nRegion); + aTemplateLb.SetUpdateMode(sal_False); aTemplateLb.Clear(); - for(USHORT i = 0; i < nCount; ++i) + for(sal_uInt16 i = 0; i < nCount; ++i) aTemplateLb.InsertEntry(pTemplates->GetName(nRegion, i)); aTemplateLb.SelectEntryPos(0); - aTemplateLb.SetUpdateMode(TRUE); + aTemplateLb.SetUpdateMode(sal_True); aTemplateLb.Invalidate(); aTemplateLb.Update(); return 0; diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index f962542aac10..5b9b03f4b673 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -197,7 +197,7 @@ public: void SetTargetURL( const OUString& rURL ) { maTargetURL = rURL; } void SetHierarchyURL( const OUString& rURL) { maOwnURL = rURL; } - DocTempl_EntryData_Impl* GetEntry( ULONG nIndex ) const; + DocTempl_EntryData_Impl* GetEntry( sal_uIntPtr nIndex ) const; DocTempl_EntryData_Impl* GetEntry( const OUString& rName ) const; DocTempl_EntryData_Impl* GetByTargetURL( const OUString& rName ) const; @@ -205,14 +205,14 @@ public: const OUString& GetTargetURL(); const OUString& GetHierarchyURL(); - ULONG GetCount() const; + sal_uIntPtr GetCount() const; void SetTitle( const OUString& rTitle ) { maTitle = rTitle; } void AddEntry( const OUString& rTitle, const OUString& rTargetURL, - USHORT *pPos = NULL ); - void DeleteEntry( ULONG nIndex ); + sal_uInt16 *pPos = NULL ); + void DeleteEntry( sal_uIntPtr nIndex ); int Compare( const OUString& rTitle ) const { return maTitle.compareTo( rTitle ); } @@ -258,12 +258,12 @@ public: void Rescan(); - void DeleteRegion( ULONG nIndex ); + void DeleteRegion( sal_uIntPtr nIndex ); - ULONG GetRegionCount() const + sal_uIntPtr GetRegionCount() const { return maRegions.Count(); } RegionData_Impl* GetRegion( const OUString& rName ) const; - RegionData_Impl* GetRegion( ULONG nIndex ) const; + RegionData_Impl* GetRegion( sal_uIntPtr nIndex ) const; void GetTemplates( Content& rTargetFolder, Content& rParentFolder, RegionData_Impl* pRegion ); @@ -272,7 +272,7 @@ public: sal_Bool& rFound ) const; sal_Bool GetTitleFromURL( const OUString& rURL, OUString& aTitle ); - sal_Bool InsertRegion( RegionData_Impl *pData, ULONG nPos = LIST_APPEND ); + sal_Bool InsertRegion( RegionData_Impl *pData, sal_uIntPtr nPos = LIST_APPEND ); OUString GetRootURL() const { return maRootURL; } uno::Reference< XDocumentTemplates > getDocTemplates() { return mxTemplates; } @@ -321,7 +321,7 @@ static sal_Bool getTextProperty_Impl( Content& rContent, String SfxDocumentTemplates::GetFullRegionName ( - USHORT nIdx // Index des Bereiches + sal_uInt16 nIdx // Index des Bereiches ) const /* [Beschreibung] @@ -358,7 +358,7 @@ String SfxDocumentTemplates::GetFullRegionName const String& SfxDocumentTemplates::GetRegionName ( - USHORT nIdx // Index des Bereiches + sal_uInt16 nIdx // Index des Bereiches ) const /* [Beschreibung] @@ -394,7 +394,7 @@ const String& SfxDocumentTemplates::GetRegionName //------------------------------------------------------------------------ -USHORT SfxDocumentTemplates::GetRegionNo +sal_uInt16 SfxDocumentTemplates::GetRegionNo ( const String &rRegion // Name der Region ) const @@ -406,7 +406,7 @@ USHORT SfxDocumentTemplates::GetRegionNo [R"uckgabewert] - USHORT Index von 'rRegion' oder USHRT_MAX falls unbekannt + sal_uInt16 Index von 'rRegion' oder USHRT_MAX falls unbekannt */ { @@ -416,10 +416,10 @@ USHORT SfxDocumentTemplates::GetRegionNo return USHRT_MAX; sal_Bool bFound; - ULONG nIndex = pImp->GetRegionPos( rRegion, bFound ); + sal_uIntPtr nIndex = pImp->GetRegionPos( rRegion, bFound ); if ( bFound ) - return (USHORT) nIndex; + return (sal_uInt16) nIndex; else return USHRT_MAX; } @@ -427,7 +427,7 @@ USHORT SfxDocumentTemplates::GetRegionNo //------------------------------------------------------------------------ -USHORT SfxDocumentTemplates::GetRegionCount() const +sal_uInt16 SfxDocumentTemplates::GetRegionCount() const /* [Beschreibung] @@ -436,7 +436,7 @@ USHORT SfxDocumentTemplates::GetRegionCount() const [R"uckgabewert] - USHORT Anzahl der Bereiche + sal_uInt16 Anzahl der Bereiche */ { @@ -445,14 +445,14 @@ USHORT SfxDocumentTemplates::GetRegionCount() const if ( !pImp->Construct() ) return 0; - ULONG nCount = pImp->GetRegionCount(); + sal_uIntPtr nCount = pImp->GetRegionCount(); - return (USHORT) nCount; + return (sal_uInt16) nCount; } //------------------------------------------------------------------------ -sal_Bool SfxDocumentTemplates::IsRegionLoaded( USHORT nIdx ) const +sal_Bool SfxDocumentTemplates::IsRegionLoaded( sal_uInt16 nIdx ) const { DocTemplLocker_Impl aLocker( *pImp ); @@ -469,7 +469,7 @@ sal_Bool SfxDocumentTemplates::IsRegionLoaded( USHORT nIdx ) const //------------------------------------------------------------------------ -USHORT SfxDocumentTemplates::GetCount +sal_uInt16 SfxDocumentTemplates::GetCount ( const String& rName /* Name des Bereiches, dessen Eintrags- anzahl ermittelt werden soll */ @@ -494,19 +494,19 @@ USHORT SfxDocumentTemplates::GetCount return 0; RegionData_Impl *pData = pImp->GetRegion( rName ); - ULONG nCount = 0; + sal_uIntPtr nCount = 0; if ( pData ) nCount = pData->GetCount(); - return (USHORT) nCount; + return (sal_uInt16) nCount; } //------------------------------------------------------------------------ -USHORT SfxDocumentTemplates::GetCount +sal_uInt16 SfxDocumentTemplates::GetCount ( - USHORT nRegion /* Index des Bereiches, dessen Eintrags- + sal_uInt16 nRegion /* Index des Bereiches, dessen Eintrags- anzahl ermittelt werden soll */ ) const @@ -527,20 +527,20 @@ USHORT SfxDocumentTemplates::GetCount return 0; RegionData_Impl *pData = pImp->GetRegion( nRegion ); - ULONG nCount = 0; + sal_uIntPtr nCount = 0; if ( pData ) nCount = pData->GetCount(); - return (USHORT) nCount; + return (sal_uInt16) nCount; } //------------------------------------------------------------------------ const String& SfxDocumentTemplates::GetName ( - USHORT nRegion, // Index des Bereiches, in dem der Eintrag liegt - USHORT nIdx // Index des Eintrags + sal_uInt16 nRegion, // Index des Bereiches, in dem der Eintrag liegt + sal_uInt16 nIdx // Index des Eintrags ) const /* [Beschreibung] @@ -582,8 +582,8 @@ const String& SfxDocumentTemplates::GetName String SfxDocumentTemplates::GetFileName ( - USHORT nRegion, // Index des Bereiches, in dem der Eintrag liegt - USHORT nIdx // Index des Eintrags + sal_uInt16 nRegion, // Index des Bereiches, in dem der Eintrag liegt + sal_uInt16 nIdx // Index des Eintrags ) const /* [Beschreibung] @@ -619,8 +619,8 @@ String SfxDocumentTemplates::GetFileName String SfxDocumentTemplates::GetPath ( - USHORT nRegion, // Index des Bereiches, in dem der Eintrag liegt - USHORT nIdx // Index des Eintrags + sal_uInt16 nRegion, // Index des Bereiches, in dem der Eintrag liegt + sal_uInt16 nIdx // Index des Eintrags ) const /* [Beschreibung] @@ -656,7 +656,7 @@ String SfxDocumentTemplates::GetPath String SfxDocumentTemplates::GetTemplatePath ( - USHORT nRegion, // Index des Bereiches, in dem der Eintrag liegt + sal_uInt16 nRegion, // Index des Bereiches, in dem der Eintrag liegt const String& rLongName // logischer Name des Eintrags ) const @@ -845,7 +845,7 @@ sal_Bool SfxDocumentTemplates::SaveDir void SfxDocumentTemplates::NewTemplate ( - USHORT nRegion, /* Index des Bereiches, in dem die Vorlage + sal_uInt16 nRegion, /* Index des Bereiches, in dem die Vorlage angelegt werden soll */ const String& rLongName, // logischer Name der neuen Vorlage @@ -889,10 +889,10 @@ void SfxDocumentTemplates::NewTemplate sal_Bool SfxDocumentTemplates::CopyOrMove ( - USHORT nTargetRegion, // Index des Zielbereiches - USHORT nTargetIdx, // Index Zielposition - USHORT nSourceRegion, // Index des Quellbereiches - USHORT nSourceIdx, /* Index der zu kopierenden / zu verschiebenden + sal_uInt16 nTargetRegion, // Index des Zielbereiches + sal_uInt16 nTargetIdx, // Index Zielposition + sal_uInt16 nSourceRegion, // Index des Quellbereiches + sal_uInt16 nSourceIdx, /* Index der zu kopierenden / zu verschiebenden Dokumentvorlage */ sal_Bool bMove // kopieren / verschieben ) @@ -910,8 +910,8 @@ sal_Bool SfxDocumentTemplates::CopyOrMove Aktion konnte nicht ausgef2uhrt werden [Querverweise] - <SfxDocumentTemplates::Move(USHORT,USHORT,USHORT,USHORT)> - <SfxDocumentTemplates::Copy(USHORT,USHORT,USHORT,USHORT)> + <SfxDocumentTemplates::Move(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16)> + <SfxDocumentTemplates::Copy(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16)> */ { @@ -1014,10 +1014,10 @@ sal_Bool SfxDocumentTemplates::CopyOrMove sal_Bool SfxDocumentTemplates::Move ( - USHORT nTargetRegion, // Index des Zielbereiches - USHORT nTargetIdx, // Index Zielposition - USHORT nSourceRegion, // Index des Quellbereiches - USHORT nSourceIdx /* Index der zu kopierenden / zu verschiebenden + sal_uInt16 nTargetRegion, // Index des Zielbereiches + sal_uInt16 nTargetIdx, // Index Zielposition + sal_uInt16 nSourceRegion, // Index des Quellbereiches + sal_uInt16 nSourceIdx /* Index der zu kopierenden / zu verschiebenden Dokumentvorlage */ ) @@ -1036,7 +1036,7 @@ sal_Bool SfxDocumentTemplates::Move [Querverweise] - <SfxDocumentTemplates::CopyOrMove(USHORT,USHORT,USHORT,USHORT,sal_Bool)> + <SfxDocumentTemplates::CopyOrMove(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16,sal_Bool)> */ { DocTemplLocker_Impl aLocker( *pImp ); @@ -1049,10 +1049,10 @@ sal_Bool SfxDocumentTemplates::Move sal_Bool SfxDocumentTemplates::Copy ( - USHORT nTargetRegion, // Index des Zielbereiches - USHORT nTargetIdx, // Index Zielposition - USHORT nSourceRegion, // Index des Quellbereiches - USHORT nSourceIdx /* Index der zu kopierenden / zu verschiebenden + sal_uInt16 nTargetRegion, // Index des Zielbereiches + sal_uInt16 nTargetIdx, // Index Zielposition + sal_uInt16 nSourceRegion, // Index des Quellbereiches + sal_uInt16 nSourceIdx /* Index der zu kopierenden / zu verschiebenden Dokumentvorlage */ ) @@ -1071,7 +1071,7 @@ sal_Bool SfxDocumentTemplates::Copy [Querverweise] - <SfxDocumentTemplates::CopyOrMove(USHORT,USHORT,USHORT,USHORT,sal_Bool)> + <SfxDocumentTemplates::CopyOrMove(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16,sal_Bool)> */ { @@ -1085,9 +1085,9 @@ sal_Bool SfxDocumentTemplates::Copy sal_Bool SfxDocumentTemplates::CopyTo ( - USHORT nRegion, /* Bereich der Vorlage, die exportiert werden + sal_uInt16 nRegion, /* Bereich der Vorlage, die exportiert werden soll */ - USHORT nIdx, /* Index der Vorlage, die exportiert werden + sal_uInt16 nIdx, /* Index der Vorlage, die exportiert werden soll */ const String& rName /* Dateiname, unter dem die Vorlage angelegt werden soll */ @@ -1109,7 +1109,7 @@ sal_Bool SfxDocumentTemplates::CopyTo [Querverweise] - <SfxDocumentTemplates::CopyFrom(USHORT,USHORT,String&)> + <SfxDocumentTemplates::CopyFrom(sal_uInt16,sal_uInt16,String&)> */ { @@ -1164,9 +1164,9 @@ sal_Bool SfxDocumentTemplates::CopyTo sal_Bool SfxDocumentTemplates::CopyFrom ( - USHORT nRegion, /* Bereich, in den die Vorlage importiert + sal_uInt16 nRegion, /* Bereich, in den die Vorlage importiert werden soll */ - USHORT nIdx, // Index der neuen Vorlage in diesem Bereich + sal_uInt16 nIdx, // Index der neuen Vorlage in diesem Bereich String& rName /* Dateiname der Vorlage, die importiert werden soll, als out-Parameter der (auto- matisch aus dem Dateinamen generierte) @@ -1188,7 +1188,7 @@ sal_Bool SfxDocumentTemplates::CopyFrom [Querverweise] - <SfxDocumentTemplates::CopyTo(USHORT,USHORT,const String&)> + <SfxDocumentTemplates::CopyTo(sal_uInt16,sal_uInt16,const String&)> */ { @@ -1313,8 +1313,8 @@ sal_Bool SfxDocumentTemplates::CopyFrom sal_Bool SfxDocumentTemplates::Delete ( - USHORT nRegion, // Index des Bereiches - USHORT nIdx /* Index des Eintrags oder USHRT_MAX, + sal_uInt16 nRegion, // Index des Bereiches + sal_uInt16 nIdx /* Index des Eintrags oder USHRT_MAX, wenn ein Verzeichnis gemeint ist. */ ) @@ -1334,7 +1334,7 @@ sal_Bool SfxDocumentTemplates::Delete [Querverweise] - <SfxDocumentTemplates::InsertDir(const String&,USHORT)> + <SfxDocumentTemplates::InsertDir(const String&,sal_uInt16)> <SfxDocumentTemplates::KillDir(SfxTemplateDir&)> <SfxDocumentTemplates::SaveDir(SfxTemplateDir&)> */ @@ -1384,7 +1384,7 @@ sal_Bool SfxDocumentTemplates::Delete sal_Bool SfxDocumentTemplates::InsertDir ( const String& rText, // der logische Name des neuen Bereiches - USHORT nRegion // Index des Bereiches + sal_uInt16 nRegion // Index des Bereiches ) /* [Beschreibung] @@ -1438,8 +1438,8 @@ sal_Bool SfxDocumentTemplates::InsertDir sal_Bool SfxDocumentTemplates::SetName ( const String& rName, // Der zu setzende Name - USHORT nRegion, // Index des Bereiches - USHORT nIdx /* Index des Eintrags oder USHRT_MAX, + sal_uInt16 nRegion, // Index des Bereiches + sal_uInt16 nIdx /* Index des Eintrags oder USHRT_MAX, wenn ein Verzeichnis gemeint ist. */ ) @@ -1550,8 +1550,8 @@ sal_Bool SfxDocumentTemplates::Rescan() SfxObjectShellRef SfxDocumentTemplates::CreateObjectShell ( - USHORT nRegion, // Index des Bereiches - USHORT nIdx // Index des Eintrags + sal_uInt16 nRegion, // Index des Bereiches + sal_uInt16 nIdx // Index des Eintrags ) /* [Beschreibung] @@ -1567,7 +1567,7 @@ SfxObjectShellRef SfxDocumentTemplates::CreateObjectShell [Querverweise] <SfxTemplateDirEntry::CreateObjectShell()> - <SfxDocumentTemplates::DeleteObjectShell(USHORT, USHORT)> + <SfxDocumentTemplates::DeleteObjectShell(sal_uInt16, sal_uInt16)> */ { @@ -1592,8 +1592,8 @@ SfxObjectShellRef SfxDocumentTemplates::CreateObjectShell sal_Bool SfxDocumentTemplates::DeleteObjectShell ( - USHORT nRegion, // Index des Bereiches - USHORT nIdx // Index des Eintrags + sal_uInt16 nRegion, // Index des Bereiches + sal_uInt16 nIdx // Index des Eintrags ) /* [Beschreibung] @@ -1612,7 +1612,7 @@ sal_Bool SfxDocumentTemplates::DeleteObjectShell [Querverweise] <SfxTemplateDirEntry::DeleteObjectShell()> - <SfxDocumentTemplates::CreateObjectShell(USHORT, USHORT)> + <SfxDocumentTemplates::CreateObjectShell(sal_uInt16, sal_uInt16)> */ { @@ -1673,9 +1673,9 @@ sal_Bool SfxDocumentTemplates::GetFull return sal_False; DocTempl_EntryData_Impl* pEntry = NULL; - const USHORT nCount = GetRegionCount(); + const sal_uInt16 nCount = GetRegionCount(); - for ( USHORT i = 0; i < nCount; ++i ) + for ( sal_uInt16 i = 0; i < nCount; ++i ) { RegionData_Impl *pRegion = pImp->GetRegion( i ); @@ -1739,16 +1739,16 @@ sal_Bool SfxDocumentTemplates::GetLogicNames DocTempl_EntryData_Impl *pEntry = NULL; sal_Bool bFound = sal_False; - ULONG nCount = GetRegionCount(); + sal_uIntPtr nCount = GetRegionCount(); - for ( ULONG i=0; !bFound && (i<nCount); i++ ) + for ( sal_uIntPtr i=0; !bFound && (i<nCount); i++ ) { pData = pImp->GetRegion( i ); if ( pData ) { - ULONG nChildCount = pData->GetCount(); + sal_uIntPtr nChildCount = pData->GetCount(); - for ( ULONG j=0; !bFound && (j<nChildCount); j++ ) + for ( sal_uIntPtr j=0; !bFound && (j<nChildCount); j++ ) { pEntry = pData->GetEntry( j ); if ( pEntry->GetTargetURL() == aPath ) @@ -1913,7 +1913,7 @@ SfxObjectShellRef DocTempl_EntryData_Impl::CreateObjectShell() SfxMedium *pMed=new SfxMedium( aTargetURL,(STREAM_STD_READWRITE | STREAM_SHARE_DENYALL), sal_False, 0 ); const SfxFilter* pFilter = NULL; - pMed->UseInteractionHandler(TRUE); + pMed->UseInteractionHandler(sal_True); if( pSfxApp->GetFilterMatcher().GuessFilter( *pMed, &pFilter, SFX_FILTER_TEMPLATE, 0 ) || (pFilter && !pFilter->IsOwnFormat()) || @@ -1923,7 +1923,7 @@ SfxObjectShellRef DocTempl_EntryData_Impl::CreateObjectShell() aTargetURL ); delete pMed; mbDidConvert=sal_True; - ULONG lErr; + sal_uIntPtr lErr; if ( mxObjShell.Is() ) { lErr = pSfxApp->LoadTemplate( mxObjShell,aTargetURL); if( lErr != ERRCODE_NONE ) @@ -1954,7 +1954,7 @@ SfxObjectShellRef DocTempl_EntryData_Impl::CreateObjectShell() } //------------------------------------------------------------------------ -BOOL DocTempl_EntryData_Impl::DeleteObjectShell() +sal_Bool DocTempl_EntryData_Impl::DeleteObjectShell() { sal_Bool bRet = sal_True; @@ -2072,8 +2072,8 @@ long RegionData_Impl::GetEntryPos( const OUString& rTitle, sal_Bool& rFound ) const { #if 1 // Don't use binary search today - ULONG i; - ULONG nCount = maEntries.Count(); + sal_uIntPtr i; + sal_uIntPtr nCount = maEntries.Count(); for ( i=0; i<nCount; i++ ) { @@ -2132,7 +2132,7 @@ long RegionData_Impl::GetEntryPos( const OUString& rTitle, // ----------------------------------------------------------------------- void RegionData_Impl::AddEntry( const OUString& rTitle, const OUString& rTargetURL, - USHORT *pPos ) + sal_uInt16 *pPos ) { INetURLObject aLinkObj( GetHierarchyURL() ); aLinkObj.insertName( rTitle, false, @@ -2161,7 +2161,7 @@ void RegionData_Impl::AddEntry( const OUString& rTitle, } // ----------------------------------------------------------------------- -ULONG RegionData_Impl::GetCount() const +sal_uIntPtr RegionData_Impl::GetCount() const { return maEntries.Count(); } @@ -2227,9 +2227,9 @@ DocTempl_EntryData_Impl* RegionData_Impl::GetByTargetURL( const OUString& rName { DocTempl_EntryData_Impl *pEntry; - ULONG nCount = maEntries.Count(); + sal_uIntPtr nCount = maEntries.Count(); - for ( ULONG i=0; i<nCount; i++ ) + for ( sal_uIntPtr i=0; i<nCount; i++ ) { pEntry = maEntries.GetObject( i ); if ( pEntry && ( pEntry->GetTargetURL() == rName ) ) @@ -2240,20 +2240,20 @@ DocTempl_EntryData_Impl* RegionData_Impl::GetByTargetURL( const OUString& rName } // ----------------------------------------------------------------------- -DocTempl_EntryData_Impl* RegionData_Impl::GetEntry( ULONG nIndex ) const +DocTempl_EntryData_Impl* RegionData_Impl::GetEntry( sal_uIntPtr nIndex ) const { return maEntries.GetObject( nIndex ); } // ----------------------------------------------------------------------- -void RegionData_Impl::DeleteEntry( ULONG nIndex ) +void RegionData_Impl::DeleteEntry( sal_uIntPtr nIndex ) { DocTempl_EntryData_Impl *pEntry = maEntries.GetObject( nIndex ); if ( pEntry ) { delete pEntry; - maEntries.Remove( (ULONG) nIndex ); + maEntries.Remove( (sal_uIntPtr) nIndex ); } } @@ -2299,7 +2299,7 @@ void SfxDocTemplate_Impl::DecrementLock() } // ----------------------------------------------------------------------- -RegionData_Impl* SfxDocTemplate_Impl::GetRegion( ULONG nIndex ) const +RegionData_Impl* SfxDocTemplate_Impl::GetRegion( sal_uIntPtr nIndex ) const { return maRegions.GetObject( nIndex ); } @@ -2308,10 +2308,10 @@ RegionData_Impl* SfxDocTemplate_Impl::GetRegion( ULONG nIndex ) const RegionData_Impl* SfxDocTemplate_Impl::GetRegion( const OUString& rName ) const { - ULONG nCount = maRegions.Count(); + sal_uIntPtr nCount = maRegions.Count(); RegionData_Impl *pData; - for ( ULONG i=0; i<nCount; i++ ) + for ( sal_uIntPtr i=0; i<nCount; i++ ) { pData = maRegions.GetObject( i ); @@ -2323,14 +2323,14 @@ RegionData_Impl* SfxDocTemplate_Impl::GetRegion( const OUString& rName ) } // ----------------------------------------------------------------------- -void SfxDocTemplate_Impl::DeleteRegion( ULONG nIndex ) +void SfxDocTemplate_Impl::DeleteRegion( sal_uIntPtr nIndex ) { RegionData_Impl* pRegion = maRegions.GetObject( nIndex ); if ( pRegion ) { delete pRegion; - maRegions.Remove( (ULONG) nIndex ); + maRegions.Remove( (sal_uIntPtr) nIndex ); } } @@ -2587,7 +2587,7 @@ long SfxDocTemplate_Impl::GetRegionPos( const OUString& rTitle, // ----------------------------------------------------------------------- sal_Bool SfxDocTemplate_Impl::InsertRegion( RegionData_Impl *pNew, - ULONG nPos ) + sal_uIntPtr nPos ) { ::osl::MutexGuard aGuard( maMutex ); RegionData_Impl *pData = maRegions.First(); @@ -2601,7 +2601,7 @@ sal_Bool SfxDocTemplate_Impl::InsertRegion( RegionData_Impl *pNew, // first if ( pNew->GetTitle() == maStandardGroup ) - maRegions.Insert( pNew, (ULONG) 0 ); + maRegions.Insert( pNew, (sal_uIntPtr) 0 ); else maRegions.Insert( pNew, nPos ); } diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 8644e79f611d..dd6218034bc7 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -31,6 +31,7 @@ #include "doctemplates.hxx" #include <vos/mutex.hxx> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> @@ -42,6 +43,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <unotools/pathoptions.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> @@ -59,7 +61,6 @@ #include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/uno/Exception.hpp> -#include <com/sun/star/util/XOfficeInstallationDirectories.hpp> #include <svtools/templatefoldercache.hxx> #include <unotools/configmgr.hxx> @@ -128,7 +129,7 @@ using namespace ::comphelper; class WaitWindow_Impl : public WorkWindow { Rectangle _aRect; - USHORT _nTextStyle; + sal_uInt16 _nTextStyle; String _aText; public: @@ -386,8 +387,8 @@ public: const OUString& rTargetURL, const OUString& rType, const OUString& rHierURL ); - ULONG count() { return maEntries.Count(); } - DocTemplates_EntryData_Impl* getEntry( ULONG nPos ) { return maEntries.GetObject( nPos ); } + sal_uIntPtr count() { return maEntries.Count(); } + DocTemplates_EntryData_Impl* getEntry( sal_uIntPtr nPos ) { return maEntries.GetObject( nPos ); } }; DECLARE_LIST( GroupList_Impl, GroupData_Impl* ) @@ -549,9 +550,9 @@ void SfxDocTplService_Impl::readFolderList() NamePair_Impl* pPair; - USHORT nCount = (USHORT)( Min( aShortNames.Count(), aLongNames.Count() ) ); + sal_uInt16 nCount = (sal_uInt16)( Min( aShortNames.Count(), aLongNames.Count() ) ); - for ( USHORT i=0; i<nCount; i++ ) + for ( sal_uInt16 i=0; i<nCount; i++ ) { pPair = new NamePair_Impl; pPair->maShortName = aShortNames.GetString( i ); @@ -594,11 +595,11 @@ void SfxDocTplService_Impl::getDirList() // TODO/LATER: let use service, register listener INetURLObject aURL; String aDirs = SvtPathOptions().GetTemplatePath(); - USHORT nCount = aDirs.GetTokenCount( C_DELIM ); + sal_uInt16 nCount = aDirs.GetTokenCount( C_DELIM ); maTemplateDirs = Sequence< OUString >( nCount ); - for ( USHORT i=0; i<nCount; i++ ) + for ( sal_uInt16 i=0; i<nCount; i++ ) { aURL.SetSmartProtocol( INET_PROT_FILE ); aURL.SetURL( aDirs.GetToken( i, C_DELIM ) ); @@ -1248,8 +1249,8 @@ void SfxDocTplService_Impl::doUpdate() OUString( RTL_CONSTASCII_USTRINGPARAM( TARGET_DIR_URL ) ), makeAny( pGroup->getTargetURL() ) ); - ULONG nCount = pGroup->count(); - for ( ULONG i=0; i<nCount; i++ ) + sal_uIntPtr nCount = pGroup->count(); + for ( sal_uIntPtr i=0; i<nCount; i++ ) { DocTemplates_EntryData_Impl *pData = pGroup->getEntry( i ); if ( ! pData->getInUse() ) @@ -2462,7 +2463,7 @@ void SfxDocTplService_Impl::addHierGroup( GroupList_Impl& rList, { while ( xResultSet->next() ) { - BOOL bUpdateType = sal_False; + sal_Bool bUpdateType = sal_False; DocTemplates_EntryData_Impl *pData; OUString aTitle( xRow->getString( 1 ) ); @@ -2727,8 +2728,8 @@ void SfxDocTplService_Impl::addGroupToHierarchy( GroupData_Impl *pGroup ) setProperty( aGroup, aAdditionalProp, makeAny( pGroup->getTargetURL() ) ); pGroup->setHierarchyURL( aNewGroupURL ); - ULONG nCount = pGroup->count(); - for ( ULONG i=0; i<nCount; i++ ) + sal_uIntPtr nCount = pGroup->count(); + for ( sal_uIntPtr i=0; i<nCount; i++ ) { DocTemplates_EntryData_Impl *pData = pGroup->getEntry( i ); addToHierarchy( pGroup, pData ); // add entry to hierarchy @@ -2876,11 +2877,35 @@ void SfxURLRelocator_Impl::initOfficeInstDirs() } // ----------------------------------------------------------------------- +void SfxURLRelocator_Impl::implExpandURL( ::rtl::OUString& io_url ) +{ + const INetURLObject aParser( io_url ); + if ( aParser.GetProtocol() != INET_PROT_VND_SUN_STAR_EXPAND ) + return; + + io_url = aParser.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ); + try + { + if ( !mxMacroExpander.is() ) + { + ::comphelper::ComponentContext aContext( mxFactory ); + mxMacroExpander.set( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY_THROW ); + } + io_url = mxMacroExpander->expandMacros( io_url ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +// ----------------------------------------------------------------------- void SfxURLRelocator_Impl::makeRelocatableURL( rtl::OUString & rURL ) { if ( rURL.getLength() > 0 ) { initOfficeInstDirs(); + implExpandURL( rURL ); rURL = mxOfficeInstDirs->makeRelocatableURL( rURL ); } } @@ -2891,6 +2916,7 @@ void SfxURLRelocator_Impl::makeAbsoluteURL( rtl::OUString & rURL ) if ( rURL.getLength() > 0 ) { initOfficeInstDirs(); + implExpandURL( rURL ); rURL = mxOfficeInstDirs->makeAbsoluteURL( rURL ); } } diff --git a/sfx2/source/doc/docundomanager.cxx b/sfx2/source/doc/docundomanager.cxx new file mode 100755 index 000000000000..8fa7dd29ac39 --- /dev/null +++ b/sfx2/source/doc/docundomanager.cxx @@ -0,0 +1,457 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "docundomanager.hxx" +#include "sfx2/sfxbasemodel.hxx" +#include "sfx2/objsh.hxx" +#include "sfx2/viewfrm.hxx" +#include "sfx2/viewsh.hxx" +#include "sfx2/bindings.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/XComponent.hpp> +/** === end UNO includes === **/ + +#include <comphelper/anytostring.hxx> +#include <comphelper/flagguard.hxx> +#include <svl/undo.hxx> +#include <tools/diagnose_ex.h> +#include <framework/undomanagerhelper.hxx> + +#include <boost/noncopyable.hpp> +#include <stack> + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::util::InvalidStateException; + using ::com::sun::star::document::EmptyUndoStackException; + using ::com::sun::star::util::NotLockedException; + using ::com::sun::star::document::UndoContextNotClosedException; + using ::com::sun::star::document::XUndoAction; + using ::com::sun::star::document::XUndoManagerSupplier; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::lang::NotInitializedException; + using ::com::sun::star::lang::EventObject; + using ::com::sun::star::document::UndoManagerEvent; + using ::com::sun::star::document::XUndoManagerListener; + using ::com::sun::star::document::UndoFailedException; + using ::com::sun::star::document::XUndoManager; + using ::com::sun::star::lang::NoSupportException; + using ::com::sun::star::frame::XModel; + /** === end UNO using === **/ + + using ::svl::IUndoManager; + + //================================================================================================================== + //= DocumentUndoManager_Impl + //================================================================================================================== + struct DocumentUndoManager_Impl : public ::framework::IUndoManagerImplementation + { + DocumentUndoManager& rAntiImpl; + IUndoManager* pUndoManager; + ::framework::UndoManagerHelper aUndoHelper; + + DocumentUndoManager_Impl( DocumentUndoManager& i_antiImpl ) + :rAntiImpl( i_antiImpl ) + ,pUndoManager( impl_retrieveUndoManager( i_antiImpl.getBaseModel() ) ) + // do this *before* the construction of aUndoHelper (which actually means: put pUndoManager before + // aUndoHelper in the member list)! + ,aUndoHelper( *this ) + { + } + + const SfxObjectShell* getObjectShell() const { return rAntiImpl.getBaseModel().GetObjectShell(); } + SfxObjectShell* getObjectShell() { return rAntiImpl.getBaseModel().GetObjectShell(); } + + // IUndoManagerImplementation + virtual ::svl::IUndoManager& getImplUndoManager(); + virtual Reference< XUndoManager > getThis(); + + void disposing() + { + aUndoHelper.disposing(); + ENSURE_OR_RETURN_VOID( pUndoManager, "DocumentUndoManager_Impl::disposing: already disposed!" ); + pUndoManager = NULL; + } + + void invalidateXDo_nolck(); + + private: + static IUndoManager* impl_retrieveUndoManager( SfxBaseModel& i_baseModel ) + { + IUndoManager* pUndoManager( NULL ); + SfxObjectShell* pObjectShell = i_baseModel.GetObjectShell(); + if ( pObjectShell != NULL ) + pUndoManager = pObjectShell->GetUndoManager(); + if ( !pUndoManager ) + throw NotInitializedException( ::rtl::OUString(), *&i_baseModel ); + return pUndoManager; + } + }; + + //------------------------------------------------------------------------------------------------------------------ + ::svl::IUndoManager& DocumentUndoManager_Impl::getImplUndoManager() + { + ENSURE_OR_THROW( pUndoManager != NULL, "DocumentUndoManager_Impl::getImplUndoManager: no access to the doc's UndoManager implementation!" ); + +#if OSL_DEBUG_LEVEL > 0 + // in a non-product build, assert if the current UndoManager at the shell is not the same we obtained + // (and cached) at construction time + SfxObjectShell* pObjectShell = rAntiImpl.getBaseModel().GetObjectShell(); + OSL_ENSURE( ( pObjectShell != NULL ) && ( pUndoManager == pObjectShell->GetUndoManager() ), + "DocumentUndoManager_Impl::getImplUndoManager: the UndoManager changed meanwhile - what about our listener?" ); +#endif + + return *pUndoManager; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XUndoManager > DocumentUndoManager_Impl::getThis() + { + return static_cast< XUndoManager* >( &rAntiImpl ); + } + + //------------------------------------------------------------------------------------------------------------------ + void DocumentUndoManager_Impl::invalidateXDo_nolck() + { + SfxModelGuard aGuard( rAntiImpl ); + + const SfxObjectShell* pDocShell = getObjectShell(); + ENSURE_OR_THROW( pDocShell != NULL, "lcl_invalidateUndo: no access to the doc shell!" ); + SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst( pDocShell ); + while ( pViewFrame ) + { + pViewFrame->GetBindings().Invalidate( SID_UNDO ); + pViewFrame->GetBindings().Invalidate( SID_REDO ); + pViewFrame = SfxViewFrame::GetNext( *pViewFrame, pDocShell ); + } + } + + //================================================================================================================== + //= SolarMutexFacade + //================================================================================================================== + /** a facade for the SolarMutex, implementing ::framework::IMutex (as opposed to ::vos::IMutex) + */ + class SolarMutexFacade : public ::framework::IMutex + { + public: + SolarMutexFacade() + { + } + + virtual void acquire() + { + Application::GetSolarMutex().acquire(); + } + + virtual void release() + { + Application::GetSolarMutex().release(); + } + }; + + //================================================================================================================== + //= UndoManagerGuard + //================================================================================================================== + class UndoManagerGuard :public ::framework::IMutexGuard + ,public ::boost::noncopyable + { + public: + UndoManagerGuard( DocumentUndoManager& i_undoManager ) + :m_guard( i_undoManager ) + ,m_solarMutexFacade() + { + } + + ~UndoManagerGuard() + { + } + + virtual void reset() + { + m_guard.reset(); + } + + virtual void clear() + { + m_guard.clear(); + } + + virtual ::framework::IMutex& getGuardedMutex() + { + // note that this means that we *know* that SfxModelGuard also locks the SolarMutex (nothing more, nothing less). + // If this ever changes, we need to adjust this code here, too. + return m_solarMutexFacade; + } + + private: + SfxModelGuard m_guard; + SolarMutexFacade m_solarMutexFacade; + }; + + //================================================================================================================== + //= DocumentUndoManager + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + DocumentUndoManager::DocumentUndoManager( SfxBaseModel& i_document ) + :SfxModelSubComponent( i_document ) + ,m_pImpl( new DocumentUndoManager_Impl( *this ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + DocumentUndoManager::~DocumentUndoManager() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void DocumentUndoManager::disposing() + { + m_pImpl->disposing(); + } + + //------------------------------------------------------------------------------------------------------------------ + bool DocumentUndoManager::isInContext() const + { + // No mutex locking within this method, no disposal check - this is the responsibility of the owner. + return m_pImpl->getImplUndoManager().IsInListAction(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::acquire( ) throw () + { + SfxModelSubComponent::acquire(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::release( ) throw () + { + SfxModelSubComponent::release(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::enterUndoContext( const ::rtl::OUString& i_title ) throw (RuntimeException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.enterUndoContext( i_title, aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::enterHiddenUndoContext( ) throw (EmptyUndoStackException, RuntimeException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.enterHiddenUndoContext( aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::leaveUndoContext( ) throw (InvalidStateException, RuntimeException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.leaveUndoContext( aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::addUndoAction( const Reference< XUndoAction >& i_action ) throw (RuntimeException, IllegalArgumentException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.addUndoAction( i_action, aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::undo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.undo( aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::redo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.redo( aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL DocumentUndoManager::isUndoPossible( ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.isUndoPossible(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL DocumentUndoManager::isRedoPossible( ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.isRedoPossible(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL DocumentUndoManager::getCurrentUndoActionTitle( ) throw (EmptyUndoStackException, RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.getCurrentUndoActionTitle(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL DocumentUndoManager::getCurrentRedoActionTitle( ) throw (EmptyUndoStackException, RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.getCurrentRedoActionTitle(); + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL DocumentUndoManager::getAllUndoActionTitles( ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.getAllUndoActionTitles(); + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL DocumentUndoManager::getAllRedoActionTitles( ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.getAllRedoActionTitles(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::clear( ) throw (UndoContextNotClosedException, RuntimeException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.clear( aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::clearRedo( ) throw (UndoContextNotClosedException, RuntimeException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.clearRedo( aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::reset() throw (RuntimeException) + { + // SYNCHRONIZED ---> + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.reset( aGuard ); + // <--- SYNCHRONIZED + m_pImpl->invalidateXDo_nolck(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::lock( ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.lock(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::unlock( ) throw (RuntimeException, NotLockedException) + { + UndoManagerGuard aGuard( *this ); + m_pImpl->aUndoHelper.unlock(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL DocumentUndoManager::isLocked( ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.isLocked(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.addUndoManagerListener( i_listener ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::removeUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return m_pImpl->aUndoHelper.removeUndoManagerListener( i_listener ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XInterface > SAL_CALL DocumentUndoManager::getParent( ) throw (RuntimeException) + { + UndoManagerGuard aGuard( *this ); + return static_cast< XModel* >( &getBaseModel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DocumentUndoManager::setParent( const Reference< XInterface >& i_parent ) throw (NoSupportException, RuntimeException) + { + (void)i_parent; + throw NoSupportException( ::rtl::OUString(), m_pImpl->getThis() ); + } + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx index c017a5779cdd..9b67da63ab74 100644 --- a/sfx2/source/doc/docvor.cxx +++ b/sfx2/source/doc/docvor.cxx @@ -81,7 +81,7 @@ #include <svl/svstdarr.hxx> static const char cDelim = ':'; -BOOL SfxOrganizeListBox_Impl::bDropMoveOk = TRUE; +sal_Bool SfxOrganizeListBox_Impl::bDropMoveOk = sal_True; using namespace ::com::sun::star; @@ -145,8 +145,8 @@ friend class SfxOrganizeListBox_Impl; bool bExecDropFinished; // save some variables for the asynchronous file dialog - USHORT m_nRegion; - USHORT m_nIndex; + sal_uInt16 m_nRegion; + sal_uInt16 m_nIndex; String m_sExtension4Save; SfxOrganizeListBox_Impl aLeftLb; @@ -169,8 +169,8 @@ friend class SfxOrganizeListBox_Impl; SvStringsDtor* GetAllFactoryURLs_Impl() const; sal_Bool GetServiceName_Impl( String& rFactoryURL, String& rFileURL ) const; - long Dispatch_Impl( USHORT nId, Menu* _pMenu ); - String GetPath_Impl( BOOL bOpen, const String& rFileName ); + long Dispatch_Impl( sal_uInt16 nId, Menu* _pMenu ); + String GetPath_Impl( sal_Bool bOpen, const String& rFileName ); ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPaths_Impl( const String& rFileName ); void InitBitmaps( void ); @@ -188,7 +188,7 @@ friend class SfxOrganizeListBox_Impl; DECL_LINK( ExportHdl, sfx2::FileDialogHelper* ); DECL_LINK( AddFilesHdl, sfx2::FileDialogHelper* ); - BOOL DontDelete_Impl( SvLBoxEntry* pEntry ); + sal_Bool DontDelete_Impl( SvLBoxEntry* pEntry ); void OkHdl( Button* ); public: @@ -307,8 +307,8 @@ SfxOrganizeDlg_Impl::SfxOrganizeDlg_Impl( SfxTemplateOrganizeDlg* pParent, aLeftLb.Show(); aRightLb.Show(); - aLeftLb.SelectAll( FALSE ); - aRightLb.SelectAll( FALSE ); + aLeftLb.SelectAll( sal_False ); + aRightLb.SelectAll( sal_False ); aRightLb.GrabFocus(); } @@ -341,8 +341,8 @@ void SfxOrganizeDlg_Impl::InitBitmaps( void ) //========================================================================= -BOOL QueryDelete_Impl(Window *pParent, // Parent der QueryBox - USHORT nId, // Resource Id +sal_Bool QueryDelete_Impl(Window *pParent, // Parent der QueryBox + sal_uInt16 nId, // Resource Id const String &rTemplateName) // Name der zu l"oschenden Vorlage /* [Beschreibung] @@ -392,7 +392,7 @@ void ErrorDelete_Impl(Window *pParent, const String &rName, sal_Bool bFolder = s struct ImpPath_Impl { SvUShorts aUS; - USHORT nRef; + sal_uInt16 nRef; ImpPath_Impl(); ImpPath_Impl( const ImpPath_Impl& rCopy ); @@ -408,13 +408,13 @@ ImpPath_Impl::ImpPath_Impl() : aUS(5), nRef(1) ImpPath_Impl::ImpPath_Impl( const ImpPath_Impl& rCopy ) : - aUS ( (BYTE)rCopy.aUS.Count() ), + aUS ( (sal_uInt8)rCopy.aUS.Count() ), nRef( 1 ) { - const USHORT nCount = rCopy.aUS.Count(); + const sal_uInt16 nCount = rCopy.aUS.Count(); - for ( USHORT i = 0; i < nCount; ++i ) + for ( sal_uInt16 i = 0; i < nCount; ++i ) aUS.Insert( rCopy.aUS[i], i ); } @@ -423,7 +423,7 @@ ImpPath_Impl::ImpPath_Impl( const ImpPath_Impl& rCopy ) : /* [Beschreibung] Implementierungsklasse; Darstellung einer Position in der Outline- - Listbox als USHORT-Array; dieses beschreibt die Position jeweil + Listbox als sal_uInt16-Array; dieses beschreibt die Position jeweil als relative Postion zum "ubergeordneten Eintrag */ @@ -454,8 +454,8 @@ public: if(!--pData->nRef) delete pData; } - USHORT Count() const { return pData->aUS.Count(); } - USHORT operator[]( USHORT i ) const + sal_uInt16 Count() const { return pData->aUS.Count(); } + sal_uInt16 operator[]( sal_uInt16 i ) const { return i < Count()? pData->aUS[i]: INDEX_IGNORE; } @@ -471,7 +471,7 @@ Path::Path(SvLBox *pBox, SvLBoxEntry *pEntry) : return; SvLBoxEntry *pParent = pBox->GetParent(pEntry); do { - pData->aUS.Insert((USHORT)pBox->GetModel()->GetRelPos(pEntry), 0); + pData->aUS.Insert((sal_uInt16)pBox->GetModel()->GetRelPos(pEntry), 0); if(0 == pParent) break; pEntry = pParent; @@ -494,8 +494,8 @@ void Path::NewImp() SvLBoxEntry *GetIndices_Impl(SvLBox *pBox, SvLBoxEntry *pEntry, - USHORT &rRegion, - USHORT &rOffset) + sal_uInt16 &rRegion, + sal_uInt16 &rOffset) /* [Beschreibung] Bereich und Position innerhalb eines Bereiches f"ur eine @@ -505,9 +505,9 @@ SvLBoxEntry *GetIndices_Impl(SvLBox *pBox, SvLBox *pBox Listbox, an der das Ereignis auftrat SvLBoxEntry *pEntry Eintrag, dessen Position ermittelt werden soll - USHORT &rRegion der Bereich innerhalb der Bereiche der + sal_uInt16 &rRegion der Bereich innerhalb der Bereiche der Dokumentvorlagen (Out-Parameter) - USHORT &rOffset die Position innerhalb des Bereiches + sal_uInt16 &rOffset die Position innerhalb des Bereiches Dokumentvorlagen (Out-Parameter) [Querverweise] @@ -525,23 +525,23 @@ SvLBoxEntry *GetIndices_Impl(SvLBox *pBox, } if(0 == pBox->GetModel()->GetDepth(pEntry)) { - rRegion = (USHORT)pBox->GetModel()->GetRelPos(pEntry); + rRegion = (sal_uInt16)pBox->GetModel()->GetRelPos(pEntry); rOffset = USHRT_MAX; return pEntry; } SvLBoxEntry *pParent = pBox->GetParent(pEntry); - rRegion = (USHORT)pBox->GetModel()->GetRelPos(pParent); - rOffset = (USHORT)pBox->GetModel()->GetRelPos(pEntry); + rRegion = (sal_uInt16)pBox->GetModel()->GetRelPos(pParent); + rOffset = (sal_uInt16)pBox->GetModel()->GetRelPos(pEntry); return pEntry; } //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, BOOL bSelect ) +sal_Bool SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) { if(!bSelect) return SvTreeListBox::Select(pEntry,bSelect); - USHORT nLevel = GetDocLevel(); + sal_uInt16 nLevel = GetDocLevel(); if(GetModel()->GetDepth(pEntry)+nLevel<3) return SvTreeListBox::Select(pEntry,bSelect); @@ -556,12 +556,12 @@ BOOL SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, BOOL bSelect ) //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, +sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, SvLBoxEntry *pSource, SvLBoxEntry* pTarget, SvLBoxEntry *&pNewParent, - ULONG &rIdx, - BOOL bCopy) + sal_uIntPtr &rIdx, + sal_Bool bCopy) /* [Beschreibung] Verschieben oder Kopieren von Dokumentvorlagen @@ -573,11 +573,11 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, SvLBoxEntry* pTarget Ziel-Eintrag, auf den verschoben werden soll SvLBoxEntry *&pNewParent der Parent der an der Zielposition erzeugten Eintrags (Out-Parameter) - ULONG &rIdx Index des Zieleintrags - BOOL bCopy Flag f"ur Kopieren / Verschieben + sal_uIntPtr &rIdx Index des Zieleintrags + sal_Bool bCopy Flag f"ur Kopieren / Verschieben - [Returnwert] BOOL: Erfolg oder Mi"serfolg + [Returnwert] sal_Bool: Erfolg oder Mi"serfolg [Querverweise] @@ -585,27 +585,27 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, SvLBoxEntry *pSource, SvLBoxEntry* pTarget, SvLBoxEntry *&pNewParent, - ULONG &rIdx, - BOOL bCopy)> - <BOOL SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, + sal_uIntPtr &rIdx, + sal_Bool bCopy)> + <sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, - ULONG &rIdx)> - <BOOL SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, + sal_uIntPtr &rIdx)> + <sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, - ULONG &rIdx)> + sal_uIntPtr &rIdx)> */ { - BOOL bOk = FALSE; + sal_Bool bOk = sal_False; if(pSource) { - USHORT nTargetRegion = 0, nTargetIndex = 0; + sal_uInt16 nTargetRegion = 0, nTargetIndex = 0; GetIndices_Impl(this, pTarget, nTargetRegion, nTargetIndex); - USHORT nSourceRegion = 0, nSourceIndex = 0; + sal_uInt16 nSourceRegion = 0, nSourceIndex = 0; GetIndices_Impl(pSourceBox, pSource, nSourceRegion, nSourceIndex); bOk = bCopy ? @@ -647,12 +647,12 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, +sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, SvLBoxEntry *pSource, SvLBoxEntry* pTarget, SvLBoxEntry *&pNewParent, - ULONG &rIdx, - BOOL bCopy) + sal_uIntPtr &rIdx, + sal_Bool bCopy) /* [Beschreibung] Verschieben oder Kopieren von Dokumentinhalten @@ -664,11 +664,11 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, SvLBoxEntry* pTarget Ziel-Eintrag, auf den verschoben werden soll SvLBoxEntry *&pNewParent der Parent der an der Zielposition erzeugten Eintrags (Out-Parameter) - ULONG &rIdx Index des Zieleintrags - BOOL bCopy Flag f"ur Kopieren / Verschieben + sal_uIntPtr &rIdx Index des Zieleintrags + sal_Bool bCopy Flag f"ur Kopieren / Verschieben - [Returnwert] BOOL: Erfolg oder Mi"serfolg + [Returnwert] sal_Bool: Erfolg oder Mi"serfolg [Querverweise] @@ -676,22 +676,22 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, SvLBoxEntry *pSource, SvLBoxEntry* pTarget, SvLBoxEntry *&pNewParent, - ULONG &rIdx, - BOOL bCopy)> - <BOOL SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, + sal_uIntPtr &rIdx, + sal_Bool bCopy)> + <sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, - ULONG &rIdx)> - <BOOL SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, + sal_uIntPtr &rIdx)> + <sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, - ULONG &rIdx)> + sal_uIntPtr &rIdx)> */ { SfxErrorContext aEc( ERRCTX_SFX_MOVEORCOPYCONTENTS, this); - BOOL bOk = FALSE, bKeepExpansion = FALSE; - BOOL bRemovedFromSource = FALSE; + sal_Bool bOk = sal_False, bKeepExpansion = sal_False; + sal_Bool bRemovedFromSource = sal_False; Path aSource(pSourceBox, pSource); Path aTarget(this, pTarget); @@ -700,9 +700,9 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, SfxObjectShellRef aSourceDoc = ((SfxOrganizeListBox_Impl *)pSourceBox)->GetObjectShell(aSource); SfxObjectShellRef aTargetDoc = GetObjectShell(aTarget); - const USHORT nSLevel = + const sal_uInt16 nSLevel = ((SfxOrganizeListBox_Impl *)pSourceBox)->GetDocLevel(); - const USHORT nTLevel = GetDocLevel(); + const sal_uInt16 nTLevel = GetDocLevel(); if(aSourceDoc.Is() && aTargetDoc.Is()) { @@ -713,8 +713,8 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, if (aTargetDoc->GetStyleSheetPool()) aTargetDoc->GetStyleSheetPool()->SetSearchMask( SFX_STYLE_FAMILY_ALL, SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED); - USHORT p[3]; - USHORT nIdxDeleted = INDEX_IGNORE; + sal_uInt16 p[3]; + sal_uInt16 nIdxDeleted = INDEX_IGNORE; p[0]=aTarget[nTLevel+1]; p[1]=aTarget[nTLevel+2]; if(p[1]!=INDEX_IGNORE)p[1]++; @@ -741,12 +741,12 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, RequestingChilds(pParentIter); SvLBoxEntry *pChildIter = 0; - USHORT i = 0; + sal_uInt16 i = 0; while(i < 2 && p[i+1] != INDEX_IGNORE) { pChildIter = FirstChild(pParentIter); // bis zum Index der aktuellen Ebene - for(USHORT j = 0; j < p[i]; ++j) + for(sal_uInt16 j = 0; j < p[i]; ++j) pChildIter = NextSibling(pChildIter); // gfs Fuellen bei Items onDemand ++i; @@ -762,7 +762,7 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, pNewParent->HasChildsOnDemand() && !GetModel()->HasChilds(pNewParent)) { - bOk = FALSE; + bOk = sal_False; if(!bCopy) pSourceBox->GetModel()->Remove(pSource); } @@ -771,7 +771,7 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, if(nIdxDeleted != INDEX_IGNORE) { pChildIter = FirstChild(pParentIter); - for(USHORT j = 0; j < nIdxDeleted; ++j) + for(sal_uInt16 j = 0; j < nIdxDeleted; ++j) pChildIter = NextSibling(pChildIter); if( pChildIter && pChildIter != pSource ) { @@ -779,7 +779,7 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, GetModel()->Remove(pChildIter); } else - bOk = FALSE; + bOk = sal_False; } if(!bCopy && &aSourceDoc != &aTargetDoc) { @@ -794,15 +794,15 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, } // rIdx++; return (((rIdx != INDEX_IGNORE)|| bRemovedFromSource) && bOk ) - ? bKeepExpansion? (BOOL)2: TRUE: FALSE; + ? bKeepExpansion? (sal_Bool)2: sal_True: sal_False; } //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, +sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, - ULONG &rIdx) + sal_uIntPtr &rIdx) /* [Beschreibung] @@ -815,10 +815,10 @@ BOOL SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, SvLBoxEntry *pSource Quell-Eintrag, der verschoben werden soll SvLBoxEntry *&pNewParent der Parent der an der Zielposition erzeugten Eintrags (Out-Parameter) - ULONG &rIdx Index des Zieleintrags + sal_uIntPtr &rIdx Index des Zieleintrags - [Returnwert] BOOL: Erfolg oder Mi"serfolg + [Returnwert] sal_Bool: Erfolg oder Mi"serfolg [Querverweise] @@ -826,22 +826,22 @@ BOOL SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, SvLBoxEntry *pSource, SvLBoxEntry* pTarget, SvLBoxEntry *&pNewParent, - ULONG &rIdx, - BOOL bCopy)> + sal_uIntPtr &rIdx, + sal_Bool bCopy)> <SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, SvLBoxEntry *pSource, SvLBoxEntry* pTarget, SvLBoxEntry *&pNewParent, - ULONG &rIdx, - BOOL bCopy)> - <BOOL SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, + sal_uIntPtr &rIdx, + sal_Bool bCopy)> + <sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, - ULONG &rIdx)> + sal_uIntPtr &rIdx)> */ { - BOOL bOk = FALSE; + sal_Bool bOk = sal_False; SvLBox* pSourceBox = GetSourceView(); if ( !pSourceBox ) pSourceBox = pDlg->pSourceView; @@ -851,19 +851,19 @@ BOOL SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, if ( pSourceBox->GetModel()->GetDepth( pSource ) <= GetDocLevel() && GetModel()->GetDepth( pTarget ) <= GetDocLevel() ) - bOk = MoveOrCopyTemplates( pSourceBox, pSource, pTarget, pNewParent, rIdx, FALSE ); + bOk = MoveOrCopyTemplates( pSourceBox, pSource, pTarget, pNewParent, rIdx, sal_False ); else - bOk = MoveOrCopyContents(pSourceBox, pSource, pTarget, pNewParent, rIdx, FALSE ); + bOk = MoveOrCopyContents(pSourceBox, pSource, pTarget, pNewParent, rIdx, sal_False ); return bOk; } //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, +sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, - ULONG &rIdx) + sal_uIntPtr &rIdx) /* [Beschreibung] Benachrichtigung, da"s ein Eintrag kopiert werden soll @@ -875,10 +875,10 @@ BOOL SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, SvLBoxEntry *pSource Quell-Eintrag, der kopiert werden soll SvLBoxEntry *&pNewParent der Parent der an der Zielposition erzeugten Eintrags (Out-Parameter) - ULONG &rIdx Index des Zieleintrags + sal_uIntPtr &rIdx Index des Zieleintrags - [Returnwert] BOOL: Erfolg oder Mi"serfolg + [Returnwert] sal_Bool: Erfolg oder Mi"serfolg [Querverweise] @@ -886,21 +886,21 @@ BOOL SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, SvLBoxEntry *pSource, SvLBoxEntry* pTarget, SvLBoxEntry *&pNewParent, - ULONG &rIdx, - BOOL bCopy)> + sal_uIntPtr &rIdx, + sal_Bool bCopy)> <SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, SvLBoxEntry *pSource, SvLBoxEntry* pTarget, SvLBoxEntry *&pNewParent, - ULONG &rIdx, - BOOL bCopy)> - <BOOL SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, + sal_uIntPtr &rIdx, + sal_Bool bCopy)> + <sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, - ULONG &rIdx)> + sal_uIntPtr &rIdx)> */ { - BOOL bOk = FALSE; + sal_Bool bOk = sal_False; SvLBox* pSourceBox = GetSourceView(); if ( !pSourceBox ) pSourceBox = pDlg->pSourceView; @@ -909,16 +909,16 @@ BOOL SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, pTarget = pDlg->pTargetEntry; if ( pSourceBox->GetModel()->GetDepth( pSource ) <= GetDocLevel() && GetModel()->GetDepth( pTarget ) <= GetDocLevel() ) - bOk = MoveOrCopyTemplates( pSourceBox, pSource, pTarget, pNewParent, rIdx, TRUE ); + bOk = MoveOrCopyTemplates( pSourceBox, pSource, pTarget, pNewParent, rIdx, sal_True ); else - bOk = MoveOrCopyContents( pSourceBox, pSource, pTarget, pNewParent, rIdx, TRUE ); + bOk = MoveOrCopyContents( pSourceBox, pSource, pTarget, pNewParent, rIdx, sal_True ); return bOk; } //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::EditingEntry( SvLBoxEntry* pEntry, Selection& ) +sal_Bool SfxOrganizeListBox_Impl::EditingEntry( SvLBoxEntry* pEntry, Selection& ) /* [Beschreibung] @@ -934,14 +934,14 @@ BOOL SfxOrganizeListBox_Impl::EditingEntry( SvLBoxEntry* pEntry, Selection& ) GetModel()->GetDepth(pEntry) < 2 ) { pDlg->pSuspend = new SuspendAccel( &pDlg->aEditAcc ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rText) +sal_Bool SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rText) /* [Beschreibung] @@ -951,8 +951,8 @@ BOOL SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rTe [Returnwert] - BOOL TRUE: der Name soll in der Anzeige ge"andert werden - FALSE:der Name soll nicht ge"andert werden + sal_Bool sal_True: der Name soll in der Anzeige ge"andert werden + sal_False:der Name soll nicht ge"andert werden [Querverweise] <SfxOrganizeListBox_Impl::EditingEntry(SvLBoxEntry* pEntry, const String& rText)> @@ -968,16 +968,16 @@ BOOL SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rTe ErrorBox aBox( this, SfxResId( MSG_ERROR_EMPTY_NAME ) ); aBox.GrabFocus(); aBox.Execute(); - return FALSE; + return sal_False; } if ( !IsUniqName_Impl( rText, pParent, pEntry ) ) { ErrorBox aBox( this, SfxResId( MSG_ERROR_UNIQ_NAME ) ); aBox.GrabFocus(); aBox.Execute(); - return FALSE; + return sal_False; } - USHORT nRegion = 0, nIndex = 0; + sal_uInt16 nRegion = 0, nIndex = 0; GetIndices_Impl( this, pEntry, nRegion, nIndex ); String aOldName; if ( USHRT_MAX != nIndex ) @@ -990,7 +990,7 @@ BOOL SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rTe SfxResId aResId( USHRT_MAX != nIndex ? MSG_ERROR_RENAME_TEMPLATE : MSG_ERROR_RENAME_TEMPLATE_REGION ); ErrorBox( this, aResId ).Execute(); - return FALSE; + return sal_False; } /* else @@ -998,44 +998,44 @@ BOOL SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rTe SfxTemplateOrganizeDlg* pDlg = (SfxTemplateOrganizeDlg*)Window::GetParent(); } */ - return TRUE; + return sal_True; } //------------------------------------------------------------------------- DragDropMode SfxOrganizeListBox_Impl::NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* pEntry ) { - USHORT nSourceLevel = GetModel()->GetDepth( pEntry ); + sal_uInt16 nSourceLevel = GetModel()->GetDepth( pEntry ); if ( VIEW_FILES == GetViewType() ) ++nSourceLevel; if ( nSourceLevel >= 2 ) - bDropMoveOk = FALSE; + bDropMoveOk = sal_False; else - bDropMoveOk = TRUE; + bDropMoveOk = sal_True; return GetDragDropMode(); } //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::NotifyAcceptDrop( SvLBoxEntry* pEntry ) +sal_Bool SfxOrganizeListBox_Impl::NotifyAcceptDrop( SvLBoxEntry* pEntry ) { if(!pEntry) - return FALSE; + return sal_False; SvLBox *pSource = GetSourceView(); SvLBoxEntry *pSourceEntry = pSource->FirstSelected(); if(pEntry == pSourceEntry) - return FALSE; - USHORT nSourceLevel = pSource->GetModel()->GetDepth(pSourceEntry); + return sal_False; + sal_uInt16 nSourceLevel = pSource->GetModel()->GetDepth(pSourceEntry); if(VIEW_FILES == ((SfxOrganizeListBox_Impl *)pSource)->GetViewType()) ++nSourceLevel; - USHORT nTargetLevel = GetModel()->GetDepth(pEntry); + sal_uInt16 nTargetLevel = GetModel()->GetDepth(pEntry); if(VIEW_FILES == GetViewType()) ++nTargetLevel; Path aSource(pSource, pSourceEntry); Path aTarget(this, pEntry); - const USHORT SL = ((SfxOrganizeListBox_Impl *)pSource)->GetDocLevel(); - const USHORT TL = GetDocLevel(); + const sal_uInt16 SL = ((SfxOrganizeListBox_Impl *)pSource)->GetDocLevel(); + const sal_uInt16 TL = GetDocLevel(); return( (nSourceLevel == 1 && nTargetLevel == 0 && VIEW_TEMPLATES == @@ -1074,7 +1074,7 @@ sal_Int8 SfxOrganizeListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt ) { TransferableDataHelper aHelper( rEvt.maDropEvent.Transferable ); sal_uInt32 nFormatCount = aHelper.GetFormatCount(); - BOOL bSuccess = FALSE; + sal_Bool bSuccess = sal_False; for ( sal_uInt32 i = 0; i < nFormatCount; ++i ) { String aFileName; @@ -1086,7 +1086,7 @@ sal_Int8 SfxOrganizeListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt ) bSuccess |= pMgr->InsertFile( this, aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) ); } } - bDropMoveOk = TRUE; + bDropMoveOk = sal_True; sal_Int8 nRet = rEvt.mnAction; if ( !bSuccess ) { @@ -1119,7 +1119,7 @@ void SfxOrganizeListBox_Impl::DragFinished( sal_Int8 nDropAction ) //------------------------------------------------------------------------- -inline USHORT SfxOrganizeListBox_Impl::GetDocLevel() const +inline sal_uInt16 SfxOrganizeListBox_Impl::GetDocLevel() const /* [Beschreibung] @@ -1128,7 +1128,7 @@ inline USHORT SfxOrganizeListBox_Impl::GetDocLevel() const [Returnwert] - USHORT Die Ebene der Dokumente + sal_uInt16 Die Ebene der Dokumente */ @@ -1206,14 +1206,14 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry ) SfxErrorContext aEc(ERRCTX_SFX_CREATEOBJSH, pDlg->pDialog); if(VIEW_TEMPLATES == GetViewType() && 0 == GetModel()->GetDepth(pEntry)) { - USHORT i = (USHORT)GetModel()->GetRelPos(pEntry); - const USHORT nEntryCount = pMgr->GetTemplates()->GetCount(i); - for(USHORT j = 0; j < nEntryCount; ++j) - InsertEntryByBmpType( pMgr->GetTemplates()->GetName( i, j ), BMPTYPE_DOC, pEntry, TRUE ); + sal_uInt16 i = (sal_uInt16)GetModel()->GetRelPos(pEntry); + const sal_uInt16 nEntryCount = pMgr->GetTemplates()->GetCount(i); + for(sal_uInt16 j = 0; j < nEntryCount; ++j) + InsertEntryByBmpType( pMgr->GetTemplates()->GetName( i, j ), BMPTYPE_DOC, pEntry, sal_True ); } else { - const USHORT nDocLevel = GetDocLevel(); + const sal_uInt16 nDocLevel = GetDocLevel(); Path aPath(this, pEntry); // it is ok to use the SfxObjectShellRef here since the object that @@ -1221,16 +1221,16 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry ) SfxObjectShellRef aRef = GetObjectShell(aPath); if(aRef.Is()) { - const USHORT nCount = aRef->GetContentCount( + const sal_uInt16 nCount = aRef->GetContentCount( aPath[nDocLevel+1], aPath[nDocLevel+2]); String aText; Bitmap aClosedBmp, aOpenedBmp; - const BOOL bCanHaveChilds = + const sal_Bool bCanHaveChilds = aRef->CanHaveChilds(aPath[nDocLevel+1], aPath[nDocLevel+2]); - for(USHORT i = 0; i < nCount; ++i) + for(sal_uInt16 i = 0; i < nCount; ++i) { - BOOL bDeletable; + sal_Bool bDeletable; aRef->GetContent( aText, aClosedBmp, aOpenedBmp, eColorMode, bDeletable, i, aPath[nDocLevel+1], aPath[nDocLevel+2]); @@ -1267,7 +1267,7 @@ long SfxOrganizeListBox_Impl::ExpandingHdl() if ( !(nImpFlags & SVLBOX_IS_EXPANDING) ) { SvLBoxEntry* pEntry = GetHdlEntry(); - const USHORT nLevel = GetModel()->GetDepth(pEntry); + const sal_uInt16 nLevel = GetModel()->GetDepth(pEntry); if((eViewType == VIEW_FILES && nLevel == 0) || (eViewType == VIEW_TEMPLATES && nLevel == 1)) { @@ -1286,12 +1286,12 @@ long SfxOrganizeListBox_Impl::ExpandingHdl() } } } - return TRUE; + return sal_True; } //------------------------------------------------------------------------- -BOOL SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, +sal_Bool SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, SvLBoxEntry* pParent, SvLBoxEntry *pEntry) const /* [Beschreibung] @@ -1305,7 +1305,7 @@ BOOL SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, [Returnwert] - BOOL TRUE, wenn der Name eindeutig ist, sonst FALSE + sal_Bool sal_True, wenn der Name eindeutig ist, sonst sal_False */ { @@ -1313,18 +1313,18 @@ BOOL SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, while(pChild) { const String aEntryText(GetEntryText(pChild)); if(COMPARE_EQUAL == aEntryText.CompareIgnoreCaseToAscii(rText)&&(!pEntry || pEntry!=pChild)) - return FALSE; + return sal_False; pChild = NextSibling(pChild); } - return TRUE; + return sal_True; } //------------------------------------------------------------------------- -USHORT SfxOrganizeListBox_Impl::GetLevelCount_Impl(SvLBoxEntry* pParent) const +sal_uInt16 SfxOrganizeListBox_Impl::GetLevelCount_Impl(SvLBoxEntry* pParent) const { SvLBoxEntry* pChild = FirstChild(pParent); - USHORT nCount = 0; + sal_uInt16 nCount = 0; while(pChild) { pChild = NextSibling(pChild); ++nCount; @@ -1335,7 +1335,7 @@ USHORT SfxOrganizeListBox_Impl::GetLevelCount_Impl(SvLBoxEntry* pParent) const //------------------------------------------------------------------------- SvLBoxEntry* SfxOrganizeListBox_Impl::InsertEntryByBmpType( const XubString& rText, BMPTYPE eBmpType, - SvLBoxEntry* pParent, BOOL bChildsOnDemand, ULONG nPos, void* pUserData ) + SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uIntPtr nPos, void* pUserData ) { SvLBoxEntry* pEntry = NULL; const Image* pExp = NULL; @@ -1444,30 +1444,30 @@ void SfxOrganizeListBox_Impl::Reset() { DBG_ASSERT( pMgr != 0, "kein Manager" ); // Inhalte l"oschen - SetUpdateMode(FALSE); + SetUpdateMode(sal_False); Clear(); if ( VIEW_TEMPLATES == eViewType ) { - const USHORT nCount = pMgr->GetTemplates()->GetRegionCount(); - for ( USHORT i = 0; i < nCount; ++i ) - InsertEntryByBmpType( pMgr->GetTemplates()->GetFullRegionName(i), BMPTYPE_FOLDER, 0, TRUE ); + const sal_uInt16 nCount = pMgr->GetTemplates()->GetRegionCount(); + for ( sal_uInt16 i = 0; i < nCount; ++i ) + InsertEntryByBmpType( pMgr->GetTemplates()->GetFullRegionName(i), BMPTYPE_FOLDER, 0, sal_True ); } else { const SfxObjectList& rList = pMgr->GetObjectList(); - const USHORT nCount = rList.Count(); - for ( USHORT i = 0; i < nCount; ++i ) - InsertEntryByBmpType( rList.GetBaseName(i), BMPTYPE_DOC, 0, TRUE ); + const sal_uInt16 nCount = rList.Count(); + for ( sal_uInt16 i = 0; i < nCount; ++i ) + InsertEntryByBmpType( rList.GetBaseName(i), BMPTYPE_DOC, 0, sal_True ); } - SetUpdateMode(TRUE); + SetUpdateMode(sal_True); Invalidate(); Update(); } //------------------------------------------------------------------------- -const Image &SfxOrganizeListBox_Impl::GetClosedBmp(USHORT nLevel) const +const Image &SfxOrganizeListBox_Impl::GetClosedBmp(sal_uInt16 nLevel) const /* [Beschreibung] @@ -1476,7 +1476,7 @@ const Image &SfxOrganizeListBox_Impl::GetClosedBmp(USHORT nLevel) const [Parameter] - USHORT nLevel Angabe der Ebene, 2 Ebenen sind erlaubt + sal_uInt16 nLevel Angabe der Ebene, 2 Ebenen sind erlaubt [Returnwert] @@ -1485,7 +1485,7 @@ const Image &SfxOrganizeListBox_Impl::GetClosedBmp(USHORT nLevel) const */ { - BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); const Image* pRet = NULL; switch( nLevel ) @@ -1501,7 +1501,7 @@ const Image &SfxOrganizeListBox_Impl::GetClosedBmp(USHORT nLevel) const //------------------------------------------------------------------------- -const Image &SfxOrganizeListBox_Impl::GetOpenedBmp(USHORT nLevel) const +const Image &SfxOrganizeListBox_Impl::GetOpenedBmp(sal_uInt16 nLevel) const /* [Beschreibung] @@ -1510,7 +1510,7 @@ const Image &SfxOrganizeListBox_Impl::GetOpenedBmp(USHORT nLevel) const [Parameter] - USHORT nLevel Angabe der Ebene, 2 Ebenen sind erlaubt + sal_uInt16 nLevel Angabe der Ebene, 2 Ebenen sind erlaubt [Returnwert] @@ -1519,7 +1519,7 @@ const Image &SfxOrganizeListBox_Impl::GetOpenedBmp(USHORT nLevel) const */ { - BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); const Image* pRet = NULL; switch( nLevel ) @@ -1544,7 +1544,7 @@ PopupMenu* SfxOrganizeListBox_Impl::CreateContextMenu() //------------------------------------------------------------------------- -String SfxOrganizeDlg_Impl::GetPath_Impl( BOOL bOpen, const String& rFileName ) +String SfxOrganizeDlg_Impl::GetPath_Impl( sal_Bool bOpen, const String& rFileName ) /* [Beschreibung] @@ -1553,7 +1553,7 @@ String SfxOrganizeDlg_Impl::GetPath_Impl( BOOL bOpen, const String& rFileName ) [Parameter] - BOOL bOpen Flag: "Offnen / Speichern + sal_Bool bOpen Flag: "Offnen / Speichern const String& rFileName aktueller Dateiname als Vorschlag [R"uckgabewert] Dateiname mit Pfad oder Leerstring, wenn @@ -1734,9 +1734,9 @@ String SfxOrganizeDlg_Impl::GetPath_Impl( BOOL bOpen, const String& rFileName ) //------------------------------------------------------------------------- -BOOL SfxOrganizeDlg_Impl::DontDelete_Impl( SvLBoxEntry* pEntry ) +sal_Bool SfxOrganizeDlg_Impl::DontDelete_Impl( SvLBoxEntry* pEntry ) { - USHORT nDepth = pFocusBox->GetModel()->GetDepth(pEntry); + sal_uInt16 nDepth = pFocusBox->GetModel()->GetDepth(pEntry); if(SfxOrganizeListBox_Impl::VIEW_FILES == pFocusBox->GetViewType()) nDepth++; @@ -1748,16 +1748,16 @@ BOOL SfxOrganizeDlg_Impl::DontDelete_Impl( SvLBoxEntry* pEntry ) (0 == nDepth && pFocusBox->GetLevelCount_Impl(0) < 2)) //Mindestens eine Vorlage behalten { - return TRUE; + return sal_True; } - USHORT nRegion = 0, nIndex = 0; + sal_uInt16 nRegion = 0, nIndex = 0; GetIndices_Impl( pFocusBox, pEntry, nRegion, nIndex ); const SfxDocumentTemplates* pTemplates = aMgr.GetTemplates(); if ( !pTemplates || !pTemplates->HasUserContents( nRegion, nIndex ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } SvStringsDtor* SfxOrganizeDlg_Impl::GetAllFactoryURLs_Impl( ) const @@ -1785,7 +1785,7 @@ sal_Bool SfxOrganizeDlg_Impl::GetServiceName_Impl( String& rName, String& rFileU sal_Bool bRet = sal_False; const SfxDocumentTemplates* pTemplates = aMgr.GetTemplates(); SvLBoxEntry* pEntry = pFocusBox ? pFocusBox->FirstSelected() : NULL; - USHORT nRegion = 0, nIndex = 0; + sal_uInt16 nRegion = 0, nIndex = 0; GetIndices_Impl( pFocusBox, pEntry, nRegion, nIndex ); rFileURL = pTemplates->GetPath( nRegion, nIndex ); if ( rFileURL.Len() > 0 ) @@ -1795,13 +1795,13 @@ sal_Bool SfxOrganizeDlg_Impl::GetServiceName_Impl( String& rName, String& rFileU uno::Reference< embed::XStorage > xStorage = ::comphelper::OStorageHelper::GetStorageFromURL( rFileURL, embed::ElementModes::READ ); - ULONG nFormat = SotStorage::GetFormatID( xStorage ); + sal_uIntPtr nFormat = SotStorage::GetFormatID( xStorage ); const SfxFilter* pFilter = SFX_APP()->GetFilterMatcher().GetFilter4ClipBoardId( nFormat ); if ( pFilter ) { rName = pFilter->GetServiceName(); - bRet = TRUE; + bRet = sal_True; } } catch( uno::Exception& ) @@ -1811,7 +1811,7 @@ sal_Bool SfxOrganizeDlg_Impl::GetServiceName_Impl( String& rName, String& rFileU return bRet; } -long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) +long SfxOrganizeDlg_Impl::Dispatch_Impl( sal_uInt16 nId, Menu* _pMenu ) /* [Beschreibung] @@ -1819,7 +1819,7 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) [Parameter] - USHORT nId ID des Events + sal_uInt16 nId ID des Events [R"uckgabewert] 1: Event wurde verarbeitet, 0: Event wurde nicht verarbeitet (SV-Menu) @@ -1843,14 +1843,14 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) const String aNoName( SfxResId(STR_NONAME) ); SvLBoxEntry* pParent = pFocusBox->GetParent(pEntry); String aName(aNoName); - USHORT n = 1; + sal_uInt16 n = 1; while(!pFocusBox->IsUniqName_Impl(aName, pParent)) { aName = aNoName; aName += String::CreateFromInt32( n++ ); } aMgr.InsertDir( pFocusBox, aName, - (USHORT)pFocusBox->GetModel()->GetRelPos(pEntry)+1); + (sal_uInt16)pFocusBox->GetModel()->GetRelPos(pEntry)+1); } } break; @@ -1860,13 +1860,13 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) { if(!pEntry || DontDelete_Impl(pEntry)) return 1; - const USHORT nDepth = pFocusBox->GetModel()->GetDepth(pEntry); + const sal_uInt16 nDepth = pFocusBox->GetModel()->GetDepth(pEntry); if(nDepth < 2) { if(0 == nDepth && pFocusBox->GetLevelCount_Impl(0) < 2) return 1; if(SfxOrganizeListBox_Impl::VIEW_TEMPLATES == pFocusBox->GetViewType()) { - USHORT nResId = nDepth? STR_DELETE_TEMPLATE : + sal_uInt16 nResId = nDepth? STR_DELETE_TEMPLATE : STR_DELETE_REGION; if( !QueryDelete_Impl( pDialog, nResId, pFocusBox->GetEntryText(pEntry))) @@ -1878,10 +1878,10 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) if(RET_NO == aQBox.Execute()) return 1; } - USHORT nRegion = 0, nIndex = 0; + sal_uInt16 nRegion = 0, nIndex = 0; GetIndices_Impl(pFocusBox, pEntry, nRegion, nIndex); - USHORT nDeleteInd = ( STR_DELETE_REGION == nResId? USHRT_MAX: nIndex ); + sal_uInt16 nDeleteInd = ( STR_DELETE_REGION == nResId? USHRT_MAX: nIndex ); if ( !aMgr.Delete( pFocusBox, nRegion, nDeleteInd ) ) ErrorDelete_Impl( pDialog, @@ -1914,7 +1914,7 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) { if(!pEntry) return 1; - USHORT nRegion = 0, nIndex = 0; + sal_uInt16 nRegion = 0, nIndex = 0; GetIndices_Impl( pFocusBox, pEntry, nRegion, nIndex ); const SfxStringItem aName( SID_FILE_NAME, aMgr.GetTemplates()->GetPath( nRegion, nIndex ) ); const SfxStringItem aLongName( SID_FILE_LONGNAME, pFocusBox->GetEntryText( pEntry ) ); @@ -1946,7 +1946,7 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) m_nRegion = 0; m_nIndex = 0; GetIndices_Impl( pFocusBox, pEntry, m_nRegion, m_nIndex ); - GetPath_Impl( FALSE, aMgr.GetTemplates()->GetFileName( m_nRegion, m_nIndex ) ); + GetPath_Impl( sal_False, aMgr.GetTemplates()->GetFileName( m_nRegion, m_nIndex ) ); break; } @@ -1970,7 +1970,7 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) SfxObjectShellRef aRef = pFocusBox->GetObjectShell( aPath ); if ( aRef.Is() ) { - const USHORT nDocLevel = pFocusBox->GetDocLevel(); + const sal_uInt16 nDocLevel = pFocusBox->GetDocLevel(); if ( !pPrt ) pPrt = new Printer; SvLBoxEntry *pDocEntry = pEntry; @@ -2071,7 +2071,7 @@ IMPL_LINK( SfxOrganizeDlg_Impl, AccelSelect_Impl, Accelerator *, pAccel ) void SfxOrganizeDlg_Impl::OkHdl(Button *pButton) { if(pFocusBox && pFocusBox->IsEditingActive()) - pFocusBox->EndEditing(FALSE); + pFocusBox->EndEditing(sal_False); pButton->Click(); } @@ -2093,12 +2093,12 @@ IMPL_LINK( SfxOrganizeDlg_Impl, MenuActivate_Impl, Menu *, pMenu ) */ { if ( pFocusBox && pFocusBox->IsEditingActive() ) - pFocusBox->EndEditing( FALSE ); - BOOL bEnable = ( pFocusBox && pFocusBox->GetSelectionCount() ); + pFocusBox->EndEditing( sal_False ); + sal_Bool bEnable = ( pFocusBox && pFocusBox->GetSelectionCount() ); SvLBoxEntry* pEntry = bEnable ? pFocusBox->FirstSelected() : NULL; - const USHORT nDepth = + const sal_uInt16 nDepth = ( bEnable && pFocusBox->GetSelectionCount() ) ? pFocusBox->GetModel()->GetDepth( pEntry ) : 0; - const USHORT nDocLevel = bEnable ? pFocusBox->GetDocLevel() : 0; + const sal_uInt16 nDocLevel = bEnable ? pFocusBox->GetDocLevel() : 0; int eVT = pFocusBox ? pFocusBox->GetViewType() : 0; // nur Vorlagen anlegen pMenu->EnableItem( ID_NEW, bEnable && 0 == nDepth && SfxOrganizeListBox_Impl::VIEW_TEMPLATES == eVT ); @@ -2119,14 +2119,14 @@ IMPL_LINK( SfxOrganizeDlg_Impl, MenuActivate_Impl, Menu *, pMenu ) pMenu->EnableItem( ID_RESCAN, SfxOrganizeListBox_Impl::VIEW_TEMPLATES == aRightLb.GetViewType() || SfxOrganizeListBox_Impl::VIEW_TEMPLATES == aLeftLb.GetViewType() ); - BOOL bPrint = bEnable && nDepth > pFocusBox->GetDocLevel(); + sal_Bool bPrint = bEnable && nDepth > pFocusBox->GetDocLevel(); if ( bPrint && pPrt ) bPrint = !pPrt->IsPrinting() && !pPrt->IsJobActive(); if ( bPrint && bEnable ) { // only styles printable Path aPath( pFocusBox, pFocusBox->FirstSelected() ); - USHORT nIndex = aPath[ nDocLevel + 1 ]; + sal_uInt16 nIndex = aPath[ nDocLevel + 1 ]; bPrint = ( nIndex == CONTENT_STYLE ); } pMenu->EnableItem( ID_PRINT, bPrint ); @@ -2137,17 +2137,17 @@ IMPL_LINK( SfxOrganizeDlg_Impl, MenuActivate_Impl, Menu *, pMenu ) bEnable = GetServiceName_Impl( aFactoryURL, aFileURL ); } else if ( bEnable ) - bEnable = FALSE; + bEnable = sal_False; pMenu->EnableItem( ID_DEFAULT_TEMPLATE, bEnable ); bEnable = sal_True; SvStringsDtor* pList = GetAllFactoryURLs_Impl(); - USHORT nCount = pList->Count(); + sal_uInt16 nCount = pList->Count(); if ( nCount > 0 ) { PopupMenu* pSubMenu = new PopupMenu; - USHORT nItemId = ID_RESET_DEFAULT_TEMPLATE + 1; - for ( USHORT i = 0; i < nCount; ++i ) + sal_uInt16 nItemId = ID_RESET_DEFAULT_TEMPLATE + 1; + for ( sal_uInt16 i = 0; i < nCount; ++i ) { String aObjFacURL( *pList->GetObject(i) ); String aTitle = SvFileInformationManager::GetDescription( @@ -2187,7 +2187,7 @@ IMPL_LINK( SfxOrganizeDlg_Impl, GetFocus_Impl, SfxOrganizeListBox_Impl *, pBox ) { if(pFocusBox && pFocusBox != pBox) - pFocusBox->SelectAll(FALSE); + pFocusBox->SelectAll(sal_False); pFocusBox = pBox; aFilesBtn.Enable( SfxOrganizeListBox_Impl::VIEW_FILES == pFocusBox->GetViewType() ); @@ -2392,7 +2392,7 @@ IMPL_LINK( SfxOrganizeDlg_Impl, ExportHdl, sfx2::FileDialogHelper *, EMPTYARG ) { INetURLObject aPathObj( aPaths[0] ); aPathObj.setFinalSlash(); - for ( USHORT i = 1; i < nCount; ++i ) + for ( sal_uInt16 i = 1; i < nCount; ++i ) { if ( 1 == i ) aPathObj.Append( aPaths[i] ); diff --git a/sfx2/source/doc/frmdescr.cxx b/sfx2/source/doc/frmdescr.cxx index 04c3e78a7e7b..848e042daa45 100644 --- a/sfx2/source/doc/frmdescr.cxx +++ b/sfx2/source/doc/frmdescr.cxx @@ -40,15 +40,15 @@ DBG_NAME(SfxFrameDescriptor); -#define VERSION (USHORT) 3 +#define VERSION (sal_uInt16) 3 struct SfxFrameDescriptor_Impl { Wallpaper* pWallpaper; SfxItemSet* pArgs; - BOOL bEditable; + sal_Bool bEditable; - SfxFrameDescriptor_Impl() : pWallpaper( NULL ), pArgs( NULL ), bEditable( TRUE ) {} + SfxFrameDescriptor_Impl() : pWallpaper( NULL ), pArgs( NULL ), bEditable( sal_True ) {} ~SfxFrameDescriptor_Impl() { delete pWallpaper; @@ -63,10 +63,10 @@ SfxFrameDescriptor::SfxFrameDescriptor() : eSizeSelector( SIZE_ABS ), nHasBorder( BORDER_YES ), nItemId( 0 ), - bResizeHorizontal( TRUE ), - bResizeVertical( TRUE ), - bHasUI( TRUE ), - bReadOnly( FALSE ) + bResizeHorizontal( sal_True ), + bResizeVertical( sal_True ), + bHasUI( sal_True ), + bReadOnly( sal_False ) { DBG_CTOR(SfxFrameDescriptor, 0); @@ -110,31 +110,31 @@ void SfxFrameDescriptor::SetActualURL( const INetURLObject& rURL ) SetActualURL(String(rURL.GetMainURL( INetURLObject::DECODE_TO_IURI ))); } -void SfxFrameDescriptor::SetEditable( BOOL bSet ) +void SfxFrameDescriptor::SetEditable( sal_Bool bSet ) { pImp->bEditable = bSet; } -BOOL SfxFrameDescriptor::IsEditable() const +sal_Bool SfxFrameDescriptor::IsEditable() const { return pImp->bEditable; } -BOOL SfxFrameDescriptor::CompareOriginal( SfxFrameDescriptor& rDescr ) const +sal_Bool SfxFrameDescriptor::CompareOriginal( SfxFrameDescriptor& rDescr ) const { if( aURL != rDescr.aURL ) - return FALSE; + return sal_False; else - return TRUE; + return sal_True; } -BOOL SfxFrameDescriptor::CheckContent() const +sal_Bool SfxFrameDescriptor::CheckContent() const { - BOOL bRet = !( aURL == aActualURL ); + sal_Bool bRet = !( aURL == aActualURL ); return bRet; } -void SfxFrameDescriptor::UnifyContent( BOOL bTakeActual ) +void SfxFrameDescriptor::UnifyContent( sal_Bool bTakeActual ) { if ( bTakeActual ) aURL = aActualURL; @@ -142,7 +142,7 @@ void SfxFrameDescriptor::UnifyContent( BOOL bTakeActual ) aActualURL = aURL; } -SfxFrameDescriptor* SfxFrameDescriptor::Clone( BOOL bWithIds ) const +SfxFrameDescriptor* SfxFrameDescriptor::Clone( sal_Bool bWithIds ) const { SfxFrameDescriptor *pFrame = new SfxFrameDescriptor; @@ -176,9 +176,9 @@ SfxFrameDescriptor* SfxFrameDescriptor::Clone( BOOL bWithIds ) const return pFrame; } -USHORT SfxFrameDescriptor::GetWinBits() const +sal_uInt16 SfxFrameDescriptor::GetWinBits() const { - USHORT nBits = 0; + sal_uInt16 nBits = 0; if ( eSizeSelector == SIZE_REL ) nBits |= SWIB_RELATIVESIZE; if ( eSizeSelector == SIZE_PERCENT ) @@ -190,7 +190,7 @@ USHORT SfxFrameDescriptor::GetWinBits() const return nBits; } -BOOL SfxFrameDescriptor::HasFrameBorder() const +sal_Bool SfxFrameDescriptor::HasFrameBorder() const { return (nHasBorder & BORDER_YES) != 0; } @@ -228,7 +228,7 @@ const Wallpaper* SfxFrameDescriptor::GetWallpaper() const return pImp->pWallpaper; } -USHORT SfxFrameDescriptor::GetItemPos() const +sal_uInt16 SfxFrameDescriptor::GetItemPos() const { return USHRT_MAX; } @@ -249,13 +249,13 @@ SfxFrameProperties::SfxFrameProperties( const SfxFrameDescriptor *pD ) , bHasBorder( pD->HasFrameBorder() ) , bBorderSet( pD->IsFrameBorderSet() ) , bResizable( pD->IsResizable() ) - , bSetResizable( FALSE ) - , bIsRootSet( FALSE ) - , bIsInColSet( FALSE ) - , bHasBorderInherited( FALSE ) + , bSetResizable( sal_False ) + , bIsRootSet( sal_False ) + , bIsInColSet( sal_False ) + , bHasBorderInherited( sal_False ) , pFrame( pD->Clone() ) { - bBorderSet = TRUE; + bBorderSet = sal_True; } SfxFrameProperties& SfxFrameProperties::operator =( diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index bceb7477a61e..2ccf5fa7a849 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -747,7 +747,7 @@ sal_Int8 ModelData_Impl::CheckFilter( const ::rtl::OUString& aFilterName ) return STATUS_SAVEAS_STANDARDNAME; } else if ( ( !( nFiltFlags & SFX_FILTER_OWN ) || ( nFiltFlags & SFX_FILTER_ALIEN ) ) - && !( nFiltFlags & SFX_FILTER_SILENTEXPORT ) && aDefFiltPropsHM.size() + && aDefFiltPropsHM.size() && ( nDefFiltFlags & SFX_FILTER_EXPORT ) && !( nDefFiltFlags & SFX_FILTER_INTERNAL )) { // the default filter is acceptable and the old filter is alian one diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index f7df58ffd397..0bd63da878a3 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -185,10 +185,10 @@ throw( uno::RuntimeException ) if ( xDisp.is() ) xDisp->dispatch( aTargetURL, aProps ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } void SAL_CALL IFrameObject::cancel() throw( com::sun::star::uno::RuntimeException ) @@ -275,7 +275,7 @@ void SAL_CALL IFrameObject::setPropertyValue(const ::rtl::OUString& aPropertyNam sal_Bool bIsAutoBorder = sal_Bool(); if ( (aAny >>= bIsAutoBorder) ) { - BOOL bBorder = maFrmDescr.IsFrameBorderOn(); + sal_Bool bBorder = maFrmDescr.IsFrameBorderOn(); maFrmDescr.ResetBorder(); if ( bIsAutoBorder ) maFrmDescr.SetFrameBorder( bBorder ); diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 932f6f10ecb0..955d231898f9 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -134,13 +134,13 @@ void SfxPreviewWin_Impl::ImpPaint( Point aPoint; if (dRatio>dRatioPreV) { - aSize=Size(nWidth, (USHORT)(nWidth/dRatio)); - aPoint=Point( 0, (USHORT)((nHeight-aSize.Height())/2)); + aSize=Size(nWidth, (sal_uInt16)(nWidth/dRatio)); + aPoint=Point( 0, (sal_uInt16)((nHeight-aSize.Height())/2)); } else { - aSize=Size((USHORT)(nHeight*dRatio), nHeight); - aPoint=Point((USHORT)((nWidth-aSize.Width())/2),0); + aSize=Size((sal_uInt16)(nHeight*dRatio), nHeight); + aPoint=Point((sal_uInt16)((nWidth-aSize.Width())/2),0); } Point bPoint=Point(nWidth,nHeight)-aPoint; @@ -181,7 +181,7 @@ SfxPreviewWin::SfxPreviewWin( // #107818# This preview window is for document previews. Therefore // right-to-left mode should be off - EnableRTL( FALSE ); + EnableRTL( sal_False ); } void SfxPreviewWin::Paint( const Rectangle& rRect ) @@ -201,7 +201,7 @@ void SfxPreviewWin::Paint( const Rectangle& rRect ) DBG_ASSERT( aTmpSize.Height() * aTmpSize.Width(), "size of first page is 0, overload GetFirstPageSize or set vis-area!" ); aMtf.SetPrefSize( aTmpSize ); - aDevice.EnableOutput( FALSE ); + aDevice.EnableOutput( sal_False ); aDevice.SetMapMode( rDocShell->GetMapUnit() ); aDevice.SetDrawMode( GetDrawMode() ); aMtf.Record( &aDevice ); @@ -265,7 +265,7 @@ class SfxNewFileDialog_Impl String aNone; String sLoadTemplate; - USHORT nFlags; + sal_uInt16 nFlags; SfxDocumentTemplates aTemplates; SfxObjectShellLock xDocShell; SfxNewFileDialog* pAntiImpl; @@ -280,23 +280,23 @@ class SfxNewFileDialog_Impl DECL_LINK( Expand, MoreButton * ); DECL_LINK( PreviewClick, CheckBox * ); DECL_LINK( LoadFile, PushButton* ); - USHORT GetSelectedTemplatePos() const; + sal_uInt16 GetSelectedTemplatePos() const; public: - SfxNewFileDialog_Impl( SfxNewFileDialog* pAntiImplP, USHORT nFlags ); + SfxNewFileDialog_Impl( SfxNewFileDialog* pAntiImplP, sal_uInt16 nFlags ); ~SfxNewFileDialog_Impl(); - // Liefert FALSE, wenn '- Keine -' als Vorlage eingestellt ist - // Nur wenn IsTemplate() TRUE liefert, koennen Vorlagennamen + // Liefert sal_False, wenn '- Keine -' als Vorlage eingestellt ist + // Nur wenn IsTemplate() sal_True liefert, koennen Vorlagennamen // erfragt werden - BOOL IsTemplate() const; + sal_Bool IsTemplate() const; String GetTemplateRegion() const; String GetTemplateName() const; String GetTemplateFileName() const; - USHORT GetTemplateFlags()const; - void SetTemplateFlags(USHORT nSet); + sal_uInt16 GetTemplateFlags()const; + void SetTemplateFlags(sal_uInt16 nSet); }; @@ -318,11 +318,11 @@ IMPL_LINK( SfxNewFileDialog_Impl, Update, void *, EMPTYARG ) if ( xDocShell.Is() ) { if ( xDocShell->GetProgress() ) - return FALSE; + return sal_False; xDocShell.Clear(); } - const USHORT nEntry = GetSelectedTemplatePos(); + const sal_uInt16 nEntry = GetSelectedTemplatePos(); if(!nEntry) { ClearInfo(); @@ -366,24 +366,24 @@ IMPL_LINK( SfxNewFileDialog_Impl, Update, void *, EMPTYARG ) Application::SetDefDialogParent( pAntiImpl ); SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,pAntiImpl); SfxApplication *pSfxApp = SFX_APP(); - ULONG lErr; + sal_uIntPtr lErr; SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() ); - pSet->Put( SfxBoolItem( SID_TEMPLATE, TRUE ) ); - pSet->Put( SfxBoolItem( SID_PREVIEW, TRUE ) ); - lErr = pSfxApp->LoadTemplate( xDocShell, aFileName, TRUE, pSet ); + pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); + pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) ); + lErr = pSfxApp->LoadTemplate( xDocShell, aFileName, sal_True, pSet ); if( lErr ) ErrorHandler::HandleError(lErr); Application::SetDefDialogParent( pParent ); if ( !xDocShell.Is() ) { aPreviewWin.SetObjectShell( 0 ); - return FALSE; + return sal_False; } } aPreviewWin.SetObjectShell( xDocShell ); } - return TRUE; + return sal_True; } //------------------------------------------------------------------------- @@ -393,20 +393,20 @@ IMPL_LINK( SfxNewFileDialog_Impl, RegionSelect, ListBox *, pBox ) if ( xDocShell.Is() && xDocShell->GetProgress() ) return 0; - const USHORT nRegion = pBox->GetSelectEntryPos(); - const USHORT nCount = aTemplates.GetRegionCount()? aTemplates.GetCount(nRegion): 0; - aTemplateLb.SetUpdateMode(FALSE); + const sal_uInt16 nRegion = pBox->GetSelectEntryPos(); + const sal_uInt16 nCount = aTemplates.GetRegionCount()? aTemplates.GetCount(nRegion): 0; + aTemplateLb.SetUpdateMode(sal_False); aTemplateLb.Clear(); String aSel=aRegionLb.GetSelectEntry(); - USHORT nc=aSel.Search('('); + sal_uInt16 nc=aSel.Search('('); if (nc-1&&nc!=STRING_NOTFOUND) aSel.Erase(nc-1); if (aSel.CompareIgnoreCaseToAscii( String(SfxResId(STR_STANDARD)) )==COMPARE_EQUAL) aTemplateLb.InsertEntry(aNone); - for (USHORT i = 0; i < nCount; ++i) + for (sal_uInt16 i = 0; i < nCount; ++i) aTemplateLb.InsertEntry(aTemplates.GetName(nRegion, i)); aTemplateLb.SelectEntryPos(0); - aTemplateLb.SetUpdateMode(TRUE); + aTemplateLb.SetUpdateMode(sal_True); aTemplateLb.Invalidate(); aTemplateLb.Update(); return 0; @@ -428,7 +428,7 @@ IMPL_LINK( SfxNewFileDialog_Impl, PreviewClick, CheckBox *, pBox ) if ( xDocShell.Is() && xDocShell->GetProgress() ) return 0; - USHORT nEntry = GetSelectedTemplatePos(); + sal_uInt16 nEntry = GetSelectedTemplatePos(); if ( nEntry && pBox->IsChecked() ) { if(!Update(0)) @@ -481,11 +481,11 @@ IMPL_LINK_INLINE_START( SfxNewFileDialog_Impl, LoadFile, PushButton *, EMPTYARG IMPL_LINK_INLINE_END( SfxNewFileDialog_Impl, LoadFile, PushButton *, EMPTYARG ) //------------------------------------------------------------------------- -USHORT SfxNewFileDialog_Impl::GetSelectedTemplatePos() const +sal_uInt16 SfxNewFileDialog_Impl::GetSelectedTemplatePos() const { - USHORT nEntry=aTemplateLb.GetSelectEntryPos(); + sal_uInt16 nEntry=aTemplateLb.GetSelectEntryPos(); String aSel=aRegionLb.GetSelectEntry().Copy(); - USHORT nc=aSel.Search('('); + sal_uInt16 nc=aSel.Search('('); if (nc-1&&nc!=STRING_NOTFOUND) aSel.Erase(nc-1); if (aSel.CompareIgnoreCaseToAscii(String(SfxResId(STR_STANDARD)))!=COMPARE_EQUAL) @@ -497,7 +497,7 @@ USHORT SfxNewFileDialog_Impl::GetSelectedTemplatePos() const //------------------------------------------------------------------------- -BOOL SfxNewFileDialog_Impl::IsTemplate() const +sal_Bool SfxNewFileDialog_Impl::IsTemplate() const { return GetSelectedTemplatePos()!=0; @@ -542,9 +542,9 @@ void AdjustPosSize_Impl(Window *pWin, short nMoveOffset, short nSizeOffset) pWin->SetPosSizePixel(aPos, aSize); } //------------------------------------------------------------------------- -USHORT SfxNewFileDialog_Impl::GetTemplateFlags()const +sal_uInt16 SfxNewFileDialog_Impl::GetTemplateFlags()const { - USHORT nRet = aTextStyleCB.IsChecked() ? SFX_LOAD_TEXT_STYLES : 0; + sal_uInt16 nRet = aTextStyleCB.IsChecked() ? SFX_LOAD_TEXT_STYLES : 0; if(aFrameStyleCB.IsChecked()) nRet |= SFX_LOAD_FRAME_STYLES; if(aPageStyleCB.IsChecked()) @@ -556,7 +556,7 @@ USHORT SfxNewFileDialog_Impl::GetTemplateFlags()const return nRet; } //------------------------------------------------------------------------- -void SfxNewFileDialog_Impl::SetTemplateFlags(USHORT nSet) +void SfxNewFileDialog_Impl::SetTemplateFlags(sal_uInt16 nSet) { aTextStyleCB.Check( 0 != (nSet&SFX_LOAD_TEXT_STYLES )); aFrameStyleCB.Check( 0 != (nSet&SFX_LOAD_FRAME_STYLES)); @@ -568,7 +568,7 @@ void SfxNewFileDialog_Impl::SetTemplateFlags(USHORT nSet) //------------------------------------------------------------------------- SfxNewFileDialog_Impl::SfxNewFileDialog_Impl( - SfxNewFileDialog* pAntiImplP, USHORT nFl) + SfxNewFileDialog* pAntiImplP, sal_uInt16 nFl) : aRegionFt( pAntiImplP, SfxResId( FT_REGION ) ), aRegionLb( pAntiImplP, SfxResId( LB_REGION ) ), aTemplateFt( pAntiImplP, SfxResId( FT_TEMPLATE ) ), @@ -654,7 +654,7 @@ SfxNewFileDialog_Impl::SfxNewFileDialog_Impl( } String &rExtra = pAntiImplP->GetExtraData(); - USHORT nTokCount = rExtra.GetTokenCount( '|' ); + sal_uInt16 nTokCount = rExtra.GetTokenCount( '|' ); if( nTokCount > 0 && nFlags ) MORE_BTN(SetState( rExtra.GetToken( 0, '|' ) == 'Y' )); if( nTokCount > 1 && nFlags ) @@ -668,10 +668,10 @@ SfxNewFileDialog_Impl::SfxNewFileDialog_Impl( aTemplates.Update( sal_True /* be smart */ ); } // fill the list boxes - const USHORT nCount = aTemplates.GetRegionCount(); + const sal_uInt16 nCount = aTemplates.GetRegionCount(); if (nCount) { - for(USHORT i = 0; i < nCount; ++i) + for(sal_uInt16 i = 0; i < nCount; ++i) aRegionLb.InsertEntry(aTemplates.GetFullRegionName(i)); aRegionLb.SetSelectHdl(LINK(this, SfxNewFileDialog_Impl, RegionSelect)); } @@ -697,7 +697,7 @@ SfxNewFileDialog_Impl::~SfxNewFileDialog_Impl() delete pMoreBt; } //------------------------------------------------------------------------- -SfxNewFileDialog::SfxNewFileDialog(Window *pParent, USHORT nFlags) +SfxNewFileDialog::SfxNewFileDialog(Window *pParent, sal_uInt16 nFlags) : SfxModalDialog( pParent, SfxResId( DLG_NEW_FILE ) ) { pImpl = new SfxNewFileDialog_Impl( this, nFlags ); @@ -708,7 +708,7 @@ SfxNewFileDialog::~SfxNewFileDialog() delete pImpl; } //------------------------------------------------------------------------- -BOOL SfxNewFileDialog::IsTemplate() const +sal_Bool SfxNewFileDialog::IsTemplate() const { return pImpl->IsTemplate(); } @@ -728,13 +728,13 @@ String SfxNewFileDialog::GetTemplateFileName() const return pImpl->GetTemplateFileName(); } //------------------------------------------------------------------------- -USHORT SfxNewFileDialog::GetTemplateFlags()const +sal_uInt16 SfxNewFileDialog::GetTemplateFlags()const { return pImpl->GetTemplateFlags(); } //------------------------------------------------------------------------- -void SfxNewFileDialog::SetTemplateFlags(USHORT nSet) +void SfxNewFileDialog::SetTemplateFlags(sal_uInt16 nSet) { pImpl->SetTemplateFlags(nSet); } diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 4aea842e44e9..b389f980185d 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -140,7 +140,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig ::boost::shared_ptr<GDIMetaFile> pFile(new GDIMetaFile); VirtualDevice aDevice; - aDevice.EnableOutput( FALSE ); + aDevice.EnableOutput( sal_False ); // adjust the output device if HC-metafile is requested if ( bHighContrast ) @@ -252,7 +252,7 @@ void SfxObjectShell::UpdateTime_Impl( // Initialize some local member! Its neccessary for wollow operations! DateTime aNow ; // Date and time at current moment Time n24Time (24,0,0,0) ; // Time-value for 24 hours - see follow calculation - ULONG nDays = 0 ; // Count of days between now and last editing + sal_uIntPtr nDays = 0 ; // Count of days between now and last editing Time nAddTime (0) ; // Value to add on aOldTime // Safe impossible cases! @@ -328,9 +328,9 @@ void SfxObjectShell::SetOrganizerSearchMask( //-------------------------------------------------------------------- -USHORT SfxObjectShell::GetContentCount( - USHORT nIdx1, - USHORT /*nIdx2*/) +sal_uInt16 SfxObjectShell::GetContentCount( + sal_uInt16 nIdx1, + sal_uInt16 /*nIdx2*/) { switch(nIdx1) { @@ -359,7 +359,7 @@ USHORT SfxObjectShell::GetContentCount( //-------------------------------------------------------------------- //TODO/CLEANUP: remove this method (it's virtual) -void SfxObjectShell::TriggerHelpPI(USHORT nIdx1, USHORT nIdx2, USHORT) +void SfxObjectShell::TriggerHelpPI(sal_uInt16 nIdx1, sal_uInt16 nIdx2, sal_uInt16) { if(nIdx1==CONTENT_STYLE && nIdx2 != INDEX_IGNORE) //StyleSheets { @@ -368,23 +368,23 @@ void SfxObjectShell::TriggerHelpPI(USHORT nIdx1, USHORT nIdx2, USHORT) } } -BOOL SfxObjectShell::CanHaveChilds(USHORT nIdx1, - USHORT nIdx2) +sal_Bool SfxObjectShell::CanHaveChilds(sal_uInt16 nIdx1, + sal_uInt16 nIdx2) { switch(nIdx1) { case INDEX_IGNORE: - return TRUE; + return sal_True; case CONTENT_STYLE: - return INDEX_IGNORE == nIdx2 || !GetStyleSheetPool()? FALSE: TRUE; + return INDEX_IGNORE == nIdx2 || !GetStyleSheetPool()? sal_False: sal_True; case CONTENT_MACRO: -//!! return INDEX_IGNORE == nIdx2? FALSE: TRUE; - return FALSE; +//!! return INDEX_IGNORE == nIdx2? sal_False: sal_True; + return sal_False; /* case CONTENT_CONFIG: - return INDEX_IGNORE == nIdx2 ? FALSE : TRUE; + return INDEX_IGNORE == nIdx2 ? sal_False : sal_True; */ } - return FALSE; + return sal_False; } //-------------------------------------------------------------------- @@ -392,10 +392,10 @@ BOOL SfxObjectShell::CanHaveChilds(USHORT nIdx1, void SfxObjectShell::GetContent(String &rText, Bitmap &rClosedBitmap, Bitmap &rOpenedBitmap, - BOOL &bCanDel, - USHORT i, - USHORT nIdx1, - USHORT nIdx2 ) + sal_Bool &bCanDel, + sal_uInt16 i, + sal_uInt16 nIdx1, + sal_uInt16 nIdx2 ) { DBG_ERRORFILE( "Non high contrast method called. Please update calling code!" ); SfxObjectShell::GetContent( rText, rClosedBitmap, rOpenedBitmap, BMP_COLOR_NORMAL, bCanDel, i, nIdx1, nIdx2 ); @@ -407,20 +407,20 @@ void SfxObjectShell::GetContent(String &rText, Bitmap &rClosedBitmap, Bitmap &rOpenedBitmap, BmpColorMode eColorMode, - BOOL &bCanDel, - USHORT i, - USHORT nIdx1, - USHORT /*nIdx2*/ ) + sal_Bool &bCanDel, + sal_uInt16 i, + sal_uInt16 nIdx1, + sal_uInt16 /*nIdx2*/ ) { - bCanDel=TRUE; + bCanDel=sal_True; switch(nIdx1) { case INDEX_IGNORE: { - USHORT nTextResId = 0; - USHORT nClosedBitmapResId = 0; // evtl. sp"ater mal unterschiedliche - USHORT nOpenedBitmapResId = 0; // " " " " + sal_uInt16 nTextResId = 0; + sal_uInt16 nClosedBitmapResId = 0; // evtl. sp"ater mal unterschiedliche + sal_uInt16 nOpenedBitmapResId = 0; // " " " " switch(i) { case CONTENT_STYLE: @@ -508,7 +508,7 @@ Bitmap SfxObjectShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily ) Bitmap SfxObjectShell::GetStyleFamilyBitmap(SfxStyleFamily eFamily, BmpColorMode eColorMode ) { - USHORT nResId = 0; + sal_uInt16 nResId = 0; switch(eFamily) { case SFX_STYLE_FAMILY_CHAR: @@ -537,16 +537,16 @@ Bitmap SfxObjectShell::GetStyleFamilyBitmap(SfxStyleFamily eFamily, BmpColorMode //-------------------------------------------------------------------- -BOOL SfxObjectShell::Insert(SfxObjectShell &rSource, - USHORT nSourceIdx1, - USHORT nSourceIdx2, - USHORT /*nSourceIdx3*/, - USHORT &nIdx1, - USHORT &nIdx2, - USHORT &/*nIdx3*/, - USHORT &/*nDeleted*/) +sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, + sal_uInt16 nSourceIdx1, + sal_uInt16 nSourceIdx2, + sal_uInt16 /*nSourceIdx3*/, + sal_uInt16 &nIdx1, + sal_uInt16 &nIdx2, + sal_uInt16 &/*nIdx3*/, + sal_uInt16 &/*nDeleted*/) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if (INDEX_IGNORE == nIdx1 && CONTENT_STYLE == nSourceIdx1) nIdx1 = CONTENT_STYLE; @@ -577,8 +577,8 @@ BOOL SfxObjectShell::Insert(SfxObjectShell &rSource, SfxStyleFamily eOldFamily = pHisSheet->GetFamily(); SfxStyleSheetBase* pExist = pMyPool->Find(aOldName, eOldFamily); - // USHORT nOldHelpId = pExist->GetHelpId(??? VB ueberlegt sich was); - BOOL bUsedOrUserDefined; + // sal_uInt16 nOldHelpId = pExist->GetHelpId(??? VB ueberlegt sich was); + sal_Bool bUsedOrUserDefined; if( pExist ) { bUsedOrUserDefined = @@ -586,13 +586,13 @@ BOOL SfxObjectShell::Insert(SfxObjectShell &rSource, if( ErrorHandler::HandleError( *new MessageInfo( ERRCODE_SFXMSG_STYLEREPLACE, aOldName ) ) != ERRCODE_BUTTON_OK ) - return FALSE; + return sal_False; else { pMyPool->Replace( *pHisSheet, *pExist ); - SetModified( TRUE ); + SetModified( sal_True ); nIdx2 = nIdx1 = INDEX_IGNORE; - return TRUE; + return sal_True; } } @@ -656,13 +656,13 @@ BOOL SfxObjectShell::Insert(SfxObjectShell &rSource, } } - SetModified( TRUE ); + SetModified( sal_True ); if( !bUsedOrUserDefined ) nIdx2 = nIdx1 = INDEX_IGNORE; - bRet = TRUE; + bRet = sal_True; } else - bRet = FALSE; + bRet = sal_False; } /* else if (nSourceIdx1 == CONTENT_CONFIG) @@ -673,7 +673,7 @@ BOOL SfxObjectShell::Insert(SfxObjectShell &rSource, if ( !GetConfigManager() ) { SetConfigManager(new SfxConfigManager(0, pCfgMgr)); - SetTemplateConfig(FALSE); + SetTemplateConfig(sal_False); if (this == Current()) GetConfigManager()->Activate(pCfgMgr); } @@ -681,9 +681,9 @@ BOOL SfxObjectShell::Insert(SfxObjectShell &rSource, if (GetConfigManager()->CopyItem( nSourceIdx2, nIdx2, rSource.GetConfigManager())) { - SetModified(TRUE); - bRet = TRUE; - SFX_APP()->GetDispatcher_Impl()->Update_Impl(TRUE); + SetModified(sal_True); + bRet = sal_True; + SFX_APP()->GetDispatcher_Impl()->Update_Impl(sal_True); } } */ @@ -692,14 +692,14 @@ BOOL SfxObjectShell::Insert(SfxObjectShell &rSource, //-------------------------------------------------------------------- -BOOL SfxObjectShell::Remove +sal_Bool SfxObjectShell::Remove ( - USHORT nIdx1, - USHORT nIdx2, - USHORT /*nIdx3*/ + sal_uInt16 nIdx1, + sal_uInt16 nIdx2, + sal_uInt16 /*nIdx3*/ ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if (CONTENT_STYLE == nIdx1) { @@ -712,7 +712,7 @@ BOOL SfxObjectShell::Remove String aEmpty; SfxStyleFamily eFamily = pMySheet->GetFamily(); pMyPool->Remove(pMySheet); - bRet = TRUE; + bRet = sal_True; SfxStyleSheetBase* pTestSheet = pMyPool->First(); while (pTestSheet) @@ -734,7 +734,7 @@ BOOL SfxObjectShell::Remove pTestSheet = pMyPool->Next(); } - SetModified( TRUE ); + SetModified( sal_True ); } return bRet; @@ -742,12 +742,12 @@ BOOL SfxObjectShell::Remove //-------------------------------------------------------------------- -BOOL SfxObjectShell::Print +sal_Bool SfxObjectShell::Print ( Printer& rPrt, - USHORT nIdx1, - USHORT /*nIdx2*/, - USHORT /*nIdx3*/, + sal_uInt16 nIdx1, + sal_uInt16 /*nIdx2*/, + sal_uInt16 /*nIdx3*/, const String* pObjectName ) @@ -763,10 +763,10 @@ BOOL SfxObjectShell::Print SetOrganizerSearchMask(pStylePool); SfxStyleSheetIterator* pIter = pStylePool->CreateIterator( pStylePool->GetSearchFamily(), pStylePool->GetSearchMask() ); - USHORT nStyles = pIter->Count(); + sal_uInt16 nStyles = pIter->Count(); SfxStyleSheetBase *pStyle = pIter->First(); if ( !pStyle ) - return TRUE; + return sal_True; // pepare adaptor for old style StartPage/EndPage printing boost::shared_ptr< Printer > pPrinter( new Printer( rPrt.GetJobSetup() ) ); @@ -780,8 +780,8 @@ BOOL SfxObjectShell::Print aFont.SetWeight(WEIGHT_BOLD); pPrinter->SetFont(aFont); const Size aPageSize(pPrinter->GetOutputSize()); - const USHORT nXIndent = 200; - USHORT nYIndent = 200; + const sal_uInt16 nXIndent = 200; + sal_uInt16 nYIndent = 200; Point aOutPos(nXIndent, nYIndent); String aHeader(SfxResId(STR_PRINT_STYLES_HEADER)); if ( pObjectName ) @@ -817,13 +817,13 @@ BOOL SfxObjectShell::Print pPrinter->SetFont(aFont); aStr = pStyle->GetDescription(); const char cDelim = ' '; - USHORT nStart = 0, nIdx = 0; + sal_uInt16 nStart = 0, nIdx = 0; nTextHeight = pPrinter->GetTextHeight(); // break text into lines while(nIdx < aStr.Len()) { - USHORT nOld = nIdx; + sal_uInt16 nOld = nIdx; long nTextWidth; nIdx = aStr.Search(cDelim, nStart); nTextWidth = pPrinter->GetTextWidth(aStr, nStart, nIdx-nStart); @@ -844,7 +844,7 @@ BOOL SfxObjectShell::Print } else { - USHORT nChar = 1; + sal_uInt16 nChar = 1; while( nStart + nChar < aStr.Len() && aOutPos.X() + pPrinter->GetTextWidth( @@ -875,9 +875,9 @@ BOOL SfxObjectShell::Print break; } default: - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } //-------------------------------------------------------------------- @@ -912,7 +912,7 @@ void SfxObjectShell::LoadStyles DBG_ASSERT(pMyPool, "Dest-DocumentShell ohne StyleSheetPool"); pSourcePool->SetSearchMask(SFX_STYLE_FAMILY_ALL, 0xffff); Styles_Impl *pFound = new Styles_Impl[pSourcePool->Count()]; - USHORT nFound = 0; + sal_uInt16 nFound = 0; SfxStyleSheetBase *pSource = pSourcePool->First(); while ( pSource ) @@ -931,7 +931,7 @@ void SfxObjectShell::LoadStyles pSource = pSourcePool->Next(); } - for ( USHORT i = 0; i < nFound; ++i ) + for ( sal_uInt16 i = 0; i < nFound; ++i ) { pFound[i].pDest->GetItemSet().PutExtended(pFound[i].pSource->GetItemSet(), SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT); // pFound[i].pDest->SetHelpId(pFound[i].pSource->GetHelpId()); @@ -1005,13 +1005,13 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) { // check existence of template storage aTemplURL = aFoundName; - BOOL bLoad = FALSE; + sal_Bool bLoad = sal_False; // should the document checked against changes in the template ? if ( IsQueryLoadTemplate() ) { // load document info of template - BOOL bOK = FALSE; + sal_Bool bOK = sal_False; util::DateTime aTemplDate; try { @@ -1028,7 +1028,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) if ( aAny >>= aTemplDate ) { // get modify date from document info - bOK = TRUE; + bOK = sal_True; } } catch ( Exception& ) @@ -1045,21 +1045,21 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) // ask user if( bCanUpdateFromTemplate == document::UpdateDocMode::QUIET_UPDATE || bCanUpdateFromTemplate == document::UpdateDocMode::FULL_UPDATE ) - bLoad = TRUE; + bLoad = sal_True; else if ( bCanUpdateFromTemplate == document::UpdateDocMode::ACCORDING_TO_CONFIG ) { String sMessage( SfxResId( STR_QRYTEMPL_MESSAGE ) ); sMessage.SearchAndReplace( String::CreateFromAscii("$(ARG1)"), aTemplName ); sfx2::QueryTemplateBox aBox( GetDialogParent(), sMessage ); if ( RET_YES == aBox.Execute() ) - bLoad = TRUE; + bLoad = sal_True; } if( !bLoad ) { // user refuses, so don't ask again for this document - SetQueryLoadTemplate(FALSE); - SetModified( TRUE ); + SetQueryLoadTemplate(sal_False); + SetModified( sal_True ); } } } @@ -1146,14 +1146,14 @@ sal_Bool SfxObjectShell::IsUseUserData() const void SfxObjectShell::SetQueryLoadTemplate( sal_Bool bNew ) { if ( pImp->bQueryLoadTemplate != bNew ) - SetModified( TRUE ); + SetModified( sal_True ); pImp->bQueryLoadTemplate = bNew; } void SfxObjectShell::SetUseUserData( sal_Bool bNew ) { if ( pImp->bUseUserData != bNew ) - SetModified( TRUE ); + SetModified( sal_True ); pImp->bUseUserData = bNew; } @@ -1170,14 +1170,14 @@ sal_Bool SfxObjectShell::IsSaveVersionOnClose() const void SfxObjectShell::SetLoadReadonly( sal_Bool bNew ) { if ( pImp->bLoadReadonly != bNew ) - SetModified( TRUE ); + SetModified( sal_True ); pImp->bLoadReadonly = bNew; } void SfxObjectShell::SetSaveVersionOnClose( sal_Bool bNew ) { if ( pImp->bSaveVersionOnClose != bNew ) - SetModified( TRUE ); + SetModified( sal_True ); pImp->bSaveVersionOnClose = bNew; } diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index 1c2105c210b9..a83335ea9fcd 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -101,7 +101,7 @@ void SfxObjectShell::OnDocumentPrinterChanged( Printer* /*pNewPrinter*/ ) } // ----------------------------------------------------------------------- -Rectangle SfxObjectShell::GetVisArea( USHORT nAspect ) const +Rectangle SfxObjectShell::GetVisArea( sal_uInt16 nAspect ) const { if( nAspect == ASPECT_CONTENT ) return pImp->m_aVisArea; @@ -131,7 +131,7 @@ void SfxObjectShell::SetVisArea( const Rectangle & rVisArea ) if ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) { if ( IsEnableSetModified() ) - SetModified( TRUE ); + SetModified( sal_True ); SFX_APP()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(STR_EVENT_VISAREACHANGED), this)); @@ -184,7 +184,7 @@ void SfxObjectShell::SetVisAreaSize( const Size & rVisSize ) } // ----------------------------------------------------------------------- -ULONG SfxObjectShell::GetMiscStatus() const +sal_uIntPtr SfxObjectShell::GetMiscStatus() const { return 0; } @@ -213,7 +213,7 @@ void SfxObjectShell::FillTransferableObjectDescriptor( TransferableObjectDescrip rDesc.maSize = OutputDevice::LogicToLogic( GetVisArea().GetSize(), GetMapUnit(), MAP_100TH_MM ); rDesc.maDragStartPos = Point(); rDesc.maDisplayName = String(); - rDesc.mbCanLink = FALSE; + rDesc.mbCanLink = sal_False; } // ----------------------------------------------------------------------- @@ -221,7 +221,7 @@ void SfxObjectShell::DoDraw( OutputDevice* pDev, const Point & rObjPos, const Size & rSize, const JobSetup & rSetup, - USHORT nAspect ) + sal_uInt16 nAspect ) { MapMode aMod = pDev->GetMapMode(); Size aSize = GetVisArea( nAspect ).GetSize(); @@ -245,7 +245,7 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, const Fraction & rScaleX, const Fraction & rScaleY, const JobSetup & rSetup, - USHORT nAspect ) + sal_uInt16 nAspect ) { Rectangle aVisArea = GetVisArea( nAspect ); // MapUnit des Ziels diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx index 2980d984fd78..01fb87f29eac 100644 --- a/sfx2/source/doc/objitem.cxx +++ b/sfx2/source/doc/objitem.cxx @@ -64,7 +64,7 @@ SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const //-------------------------------------------------------------------- -sal_Bool SfxObjectShellItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const +sal_Bool SfxObjectShellItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { if ( pObjSh ) { @@ -76,12 +76,12 @@ sal_Bool SfxObjectShellItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /* { rVal <<= ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >(); } - return TRUE; + return sal_True; } //-------------------------------------------------------------------- -sal_Bool SfxObjectShellItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) +sal_Bool SfxObjectShellItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { // This item MUST have a model. Please don't change this, there are UNO-based // implementations which need it!! @@ -100,21 +100,21 @@ sal_Bool SfxObjectShellItem::PutValue( const com::sun::star::uno::Any& rVal, BYT if ( nHandle ) { pObjSh = reinterpret_cast< SfxObjectShell* >(sal::static_int_cast<sal_IntPtr>( nHandle )); - return TRUE; + return sal_True; } } } pObjSh = 0; - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } //========================================================================= -SfxObjectItem::SfxObjectItem( USHORT nWhichId, SfxShell *pSh ) +SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId, SfxShell *pSh ) : SfxPoolItem( nWhichId ), _pSh( pSh ) {} diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 71c7e0e78383..d961c2df3aef 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -118,6 +118,7 @@ using namespace ::com::sun::star::container; #include <rtl/bootstrap.hxx> #include <vcl/svapp.hxx> #include <framework/interaction.hxx> +#include <framework/documentundoguard.hxx> #include <comphelper/interaction.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/documentconstants.hxx> @@ -141,7 +142,6 @@ using namespace ::com::sun::star::container; #include <sfx2/ctrlitem.hxx> #include "arrdecl.hxx" #include <sfx2/module.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/docfac.hxx> #include "helper.hxx" #include "doc.hrc" @@ -1652,15 +1652,8 @@ SfxModule* SfxObjectShell::GetModule() const return GetFactory().GetModule(); } -sal_Bool SfxObjectShell::IsBasic( - const String & rCode, SbxObject * pVCtrl ) -{ - if( !rCode.Len() ) return sal_False; - return SfxMacroConfig::IsBasic( pVCtrl, rCode, GetBasicManager() ); -} - ErrCode SfxObjectShell::CallBasic( const String& rMacro, - const String& rBasic, SbxObject* pVCtrl, SbxArray* pArgs, + const String& rBasic, SbxArray* pArgs, SbxValue* pRet ) { SfxApplication* pApp = SFX_APP(); @@ -1670,23 +1663,13 @@ ErrCode SfxObjectShell::CallBasic( const String& rMacro, return ERRCODE_IO_ACCESSDENIED; } - pApp->EnterBasicCall(); BasicManager *pMgr = GetBasicManager(); if( pApp->GetName() == rBasic ) pMgr = pApp->GetBasicManager(); - ErrCode nRet = SfxMacroConfig::Call( pVCtrl, rMacro, pMgr, pArgs, pRet ); - pApp->LeaveBasicCall(); + ErrCode nRet = SfxApplication::CallBasic( rMacro, pMgr, pArgs, pRet ); return nRet; } -ErrCode SfxObjectShell::Call( const String & rCode, sal_Bool bIsBasicReturn, SbxObject * pVCtrl ) -{ - ErrCode nErr = ERRCODE_NONE; - if ( bIsBasicReturn ) - CallBasic( rCode, String(), pVCtrl ); - return nErr; -} - namespace { static bool lcl_isScriptAccessAllowed_nothrow( const Reference< XInterface >& _rxScriptContext ) @@ -1740,15 +1723,17 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon xScriptProvider.set( xScriptProviderFactory->createScriptProvider( makeAny( _rxScriptContext ) ), UNO_SET_THROW ); } + // ry to protect the invocation context's undo manager (if present), just in case the script tampers with it + ::framework::DocumentUndoGuard aUndoGuard( _rxScriptContext.get() ); + // obtain the script, and execute it Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW ); - aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam ); } catch ( const uno::Exception& ) { aException = ::cppu::getCaughtException(); - bCaughtException = TRUE; + bCaughtException = sal_True; nErr = ERRCODE_BASIC_INTERNAL_ERROR; } @@ -1782,118 +1767,6 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL, } //------------------------------------------------------------------------- -namespace { - using namespace ::com::sun::star::uno; - - //..................................................................... - static SbxArrayRef lcl_translateUno2Basic( const void* _pAnySequence ) - { - SbxArrayRef xReturn; - if ( _pAnySequence ) - { - // in real it's a sequence of Any (by convention) - const Sequence< Any >* pArguments = static_cast< const Sequence< Any >* >( _pAnySequence ); - - // do we have arguments ? - if ( pArguments->getLength() ) - { - // yep - xReturn = new SbxArray; - String sEmptyName; - - // loop through the sequence - const Any* pArg = pArguments->getConstArray(); - const Any* pArgEnd = pArg + pArguments->getLength(); - - for ( sal_uInt16 nArgPos=1; pArg != pArgEnd; ++pArg, ++nArgPos ) - // and create a Sb object for every Any - xReturn->Put( GetSbUnoObject( sEmptyName, *pArg ), nArgPos ); - } - } - return xReturn; - } - //..................................................................... - void lcl_translateBasic2Uno( const SbxVariableRef& _rBasicValue, void* _pAny ) - { - if ( _pAny ) - *static_cast< Any* >( _pAny ) = sbxToUnoValue( _rBasicValue ); - } -} -//------------------------------------------------------------------------- -ErrCode SfxObjectShell::CallStarBasicScript( const String& _rMacroName, const String& _rLocation, - const void* _pArguments, void* _pReturn ) -{ - OSL_TRACE("in CallSBS"); - ::vos::OClearableGuard aGuard( Application::GetSolarMutex() ); - - // the arguments for the call - SbxArrayRef xMacroArguments = lcl_translateUno2Basic( _pArguments ); - - // the return value - SbxVariableRef xReturn = _pReturn ? new SbxVariable : NULL; - - // the location (document or application) - String sMacroLocation; - if ( _rLocation.EqualsAscii( "application" ) ) - sMacroLocation = SFX_APP()->GetName(); -#ifdef DBG_UTIL - else - DBG_ASSERT( _rLocation.EqualsAscii( "document" ), - "SfxObjectShell::CallStarBasicScript: invalid (unknown) location!" ); -#endif - - // call the script - ErrCode eError = CallBasic( _rMacroName, sMacroLocation, NULL, xMacroArguments, xReturn ); - - // translate the return value - lcl_translateBasic2Uno( xReturn, _pReturn ); - - // outta here - return eError; -} - -//------------------------------------------------------------------------- -ErrCode SfxObjectShell::CallScript( - const String & rScriptType, - const String & rCode, - const void *pArgs, - void *pRet -) -{ - ::vos::OClearableGuard aGuard( Application::GetSolarMutex() ); - ErrCode nErr = ERRCODE_NONE; - if( rScriptType.EqualsAscii( "StarBasic" ) ) - { - // the arguments for the call - SbxArrayRef xMacroArguments = lcl_translateUno2Basic( pArgs ); - - // the return value - SbxVariableRef xReturn = pRet ? new SbxVariable : NULL; - - // call the script - nErr = CallBasic( rCode, String(), NULL, xMacroArguments, xReturn ); - - // translate the return value - lcl_translateBasic2Uno( xReturn, pRet ); - - // did this fail because the method was not found? - if ( nErr == ERRCODE_BASIC_PROC_UNDEFINED ) - { // yep-> look in the application BASIC module - nErr = CallBasic( rCode, SFX_APP()->GetName(), NULL, xMacroArguments, xReturn ); - } - } - else if( rScriptType.EqualsAscii( "JavaScript" ) ) - { - DBG_ERROR( "JavaScript not allowed" ); - return 0; - } - else - { - DBG_ERROR( "StarScript not allowed" ); - } - return nErr; -} - SfxFrame* SfxObjectShell::GetSmartSelf( SfxFrame* pSelf, SfxMedium& /*rMedium*/ ) { return pSelf; @@ -1911,51 +1784,6 @@ void SfxObjectShell::SetFlags( SfxObjectShellFlags eFlags ) pImp->eFlags = eFlags; } -/* -void SfxObjectShell::SetBaseURL( const String& rURL ) -{ - pImp->aBaseURL = rURL; - pImp->bNoBaseURL = FALSE; -} - -const String& SfxObjectShell::GetBaseURLForSaving() const -{ - if ( pImp->bNoBaseURL ) - return String(); - return GetBaseURL(); -} - -const String& SfxObjectShell::GetBaseURL() const -{ - if ( pImp->aBaseURL.Len() ) - return pImp->aBaseURL; - return pMedium->GetBaseURL(); -} - -void SfxObjectShell::SetEmptyBaseURL() -{ - pImp->bNoBaseURL = TRUE; -} -*/ -String SfxObjectShell::QueryTitle( SfxTitleQuery eType ) const -{ - String aRet; - - switch( eType ) - { - case SFX_TITLE_QUERY_SAVE_NAME_PROPOSAL: - { - SfxMedium* pMed = GetMedium(); - const INetURLObject aObj( pMed->GetName() ); - aRet = aObj.GetMainURL( INetURLObject::DECODE_TO_IURI ); - if ( !aRet.Len() ) - aRet = GetTitle( SFX_TITLE_CAPTION ); - break; - } - } - return aRet; -} - void SfxHeaderAttributes_Impl::SetAttributes() { bAlert = sal_True; @@ -2106,7 +1934,7 @@ sal_Bool SfxObjectShell::IsSecure() if ( GetMedium()->GetContent().is() ) { Any aAny( ::utl::UCBContentHelper::GetProperty( aURL.GetMainURL( INetURLObject::NO_DECODE ), String( RTL_CONSTASCII_USTRINGPARAM("IsProtected")) ) ); - sal_Bool bIsProtected = FALSE; + sal_Bool bIsProtected = sal_False; if ( ( aAny >>= bIsProtected ) && bIsProtected ) return sal_False; else @@ -2119,7 +1947,7 @@ sal_Bool SfxObjectShell::IsSecure() return sal_False; } -void SfxObjectShell::SetWaitCursor( BOOL bSet ) const +void SfxObjectShell::SetWaitCursor( sal_Bool bSet ) const { for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, this ) ) { @@ -2141,7 +1969,7 @@ String SfxObjectShell::GetAPIName() const return aName; } -void SfxObjectShell::Invalidate( USHORT nId ) +void SfxObjectShell::Invalidate( sal_uInt16 nId ) { for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, this ) ) Invalidate_Impl( pFrame->GetBindings(), nId ); @@ -2164,7 +1992,7 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) { Window* pWindow = 0; SfxItemSet* pSet = pLoadingMedium ? pLoadingMedium->GetItemSet() : GetMedium()->GetItemSet(); - SFX_ITEMSET_ARG( pSet, pUnoItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); + SFX_ITEMSET_ARG( pSet, pUnoItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False ); if ( pUnoItem ) { uno::Reference < frame::XFrame > xFrame( pUnoItem->GetFrame() ); @@ -2174,7 +2002,7 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) if ( !pWindow ) { SfxFrame* pFrame = 0; - SFX_ITEMSET_ARG( pSet, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE ); + SFX_ITEMSET_ARG( pSet, pFrameItem, SfxFrameItem, SID_DOCFRAME, sal_False ); if( pFrameItem && pFrameItem->GetFrame() ) // get target frame from ItemSet pFrame = pFrameItem->GetFrame(); @@ -2208,7 +2036,7 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) return pWindow; } -String SfxObjectShell::UpdateTitle( SfxMedium* pMed, USHORT nDocViewNumber ) +String SfxObjectShell::UpdateTitle( SfxMedium* pMed, sal_uInt16 nDocViewNumber ) { // Titel des Fensters String aTitle; @@ -2249,29 +2077,29 @@ void SfxObjectShell::SetCreateMode_Impl( SfxObjectCreateMode nMode ) eCreateMode = nMode; } -BOOL SfxObjectShell::IsInPlaceActive() +sal_Bool SfxObjectShell::IsInPlaceActive() { if ( eCreateMode != SFX_CREATE_MODE_EMBEDDED ) - return FALSE; + return sal_False; SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); return pFrame && pFrame->GetFrame().IsInPlace(); } -BOOL SfxObjectShell::IsUIActive() +sal_Bool SfxObjectShell::IsUIActive() { if ( eCreateMode != SFX_CREATE_MODE_EMBEDDED ) - return FALSE; + return sal_False; SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); return pFrame && pFrame->GetFrame().IsInPlace() && pFrame->GetFrame().GetWorkWindow_Impl()->IsVisible_Impl(); } -void SfxObjectShell::UIActivate( BOOL ) +void SfxObjectShell::UIActivate( sal_Bool ) { } -void SfxObjectShell::InPlaceActivate( BOOL ) +void SfxObjectShell::InPlaceActivate( sal_Bool ) { } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index c9b5e6f37293..73d836938183 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -295,7 +295,7 @@ sal_Bool SfxObjectShell::APISaveAs_Impl SfxItemSet* aParams ) { - BOOL bOk = sal_False; + sal_Bool bOk = sal_False; {DBG_CHKTHIS(SfxObjectShell, 0);} @@ -345,7 +345,7 @@ sal_Bool SfxObjectShell::APISaveAs_Impl } // prevent picklist-entry - GetMedium()->SetUpdatePickList( FALSE ); + GetMedium()->SetUpdatePickList( sal_False ); } return bOk; @@ -357,7 +357,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) { {DBG_CHKTHIS(SfxObjectShell, 0);} - USHORT nId = rReq.GetSlot(); + sal_uInt16 nId = rReq.GetSlot(); if( SID_SIGNATURE == nId || SID_MACRO_SIGNATURE == nId ) { @@ -406,7 +406,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_DOCINFO: { - SFX_REQUEST_ARG(rReq, pDocInfItem, SfxDocumentInfoItem, SID_DOCINFO, FALSE); + SFX_REQUEST_ARG(rReq, pDocInfItem, SfxDocumentInfoItem, SID_DOCINFO, sal_False); if ( pDocInfItem ) { // parameter, e.g. from replayed macro @@ -416,8 +416,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) else { // no argument containing DocInfo; check optional arguments - BOOL bReadOnly = IsReadOnly(); - SFX_REQUEST_ARG(rReq, pROItem, SfxBoolItem, SID_DOC_READONLY, FALSE); + sal_Bool bReadOnly = IsReadOnly(); + SFX_REQUEST_ARG(rReq, pROItem, SfxBoolItem, SID_DOC_READONLY, sal_False); if ( pROItem ) // override readonly attribute of document // e.g. if a readonly document is saved elsewhere and user asks for editing DocInfo before @@ -442,7 +442,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) IsUseUserData() ); if ( !GetSlotState( SID_DOCTEMPLATE ) ) // templates not supported - aDocInfoItem.SetTemplate(FALSE); + aDocInfoItem.SetTemplate(sal_False); SfxItemSet aSet(GetPool(), SID_DOCINFO, SID_DOCINFO, SID_DOC_READONLY, SID_DOC_READONLY, SID_EXPLORER_PROPS_START, SID_EXPLORER_PROPS_START, SID_BASEURL, SID_BASEURL, @@ -456,7 +456,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) SfxDocumentInfoDialog *pDlg = CreateDocumentInfoDialog(0, aSet); if ( RET_OK == pDlg->Execute() ) { - SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pDocInfoItem, SfxDocumentInfoItem, SID_DOCINFO, FALSE); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pDocInfoItem, SfxDocumentInfoItem, SID_DOCINFO, sal_False); if ( pDocInfoItem ) { // user has done some changes to DocumentInfo @@ -492,7 +492,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // derived class may decide to abort this if( !QuerySlotExecutable( nId ) ) { - rReq.SetReturnValue( SfxBoolItem( 0, FALSE ) ); + rReq.SetReturnValue( SfxBoolItem( 0, sal_False ) ); return; } @@ -517,7 +517,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( nId == SID_SAVEASDOC ) { // in case of plugin mode the SaveAs operation means SaveTo - SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY, FALSE ); + SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY, sal_False ); if ( pViewOnlyItem && pViewOnlyItem->GetValue() ) rReq.AppendItem( SfxBoolItem( SID_SAVETO, sal_True ) ); } @@ -525,7 +525,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // TODO/LATER: do the following GUI related actions in standalown method // ======================================================================================================== // Introduce a status indicator for GUI operation - SFX_REQUEST_ARG( rReq, pStatusIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, FALSE ); + SFX_REQUEST_ARG( rReq, pStatusIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False ); if ( !pStatusIndicatorItem ) { // get statusindicator @@ -564,7 +564,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } // Introduce an interaction handler for GUI operation - SFX_REQUEST_ARG( rReq, pInteractionHandlerItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, FALSE ); + SFX_REQUEST_ARG( rReq, pInteractionHandlerItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, sal_False ); if ( !pInteractionHandlerItem ) { uno::Reference< task::XInteractionHandler > xInteract; @@ -599,8 +599,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // ======================================================================================================== sal_Bool bPreselectPassword = sal_False; - SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, FALSE ); - SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldPasswordItem, SfxStringItem, SID_PASSWORD, FALSE ); + SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldPasswordItem, SfxStringItem, SID_PASSWORD, sal_False ); if ( pOldEncryptionDataItem || pOldPasswordItem ) bPreselectPassword = sal_True; @@ -643,7 +643,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) NULL ); rReq.SetArgs( aResultParams ); - SFX_REQUEST_ARG( rReq, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, FALSE ); + SFX_REQUEST_ARG( rReq, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, sal_False ); ::rtl::OUString aFilterName = pFilterNameItem ? ::rtl::OUString( pFilterNameItem->GetValue() ) : ::rtl::OUString(); const SfxFilter* pFilt = GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName ); @@ -680,14 +680,14 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // by default versions should be preserved always except in case of an explicit // SaveAs via GUI, so the flag must be reset to guarantee this pImp->bPreserveVersions = sal_True; - ULONG lErr=GetErrorCode(); + sal_uIntPtr lErr=GetErrorCode(); if ( !lErr && nErrorCode ) lErr = nErrorCode; if ( lErr && nErrorCode == ERRCODE_NONE ) { - SFX_REQUEST_ARG( rReq, pWarnItem, SfxBoolItem, SID_FAIL_ON_WARNING, FALSE ); + SFX_REQUEST_ARG( rReq, pWarnItem, SfxBoolItem, SID_FAIL_ON_WARNING, sal_False ); if ( pWarnItem && pWarnItem->GetValue() ) nErrorCode = lErr; } @@ -730,8 +730,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) return; } - BOOL bInFrameSet = FALSE; - USHORT nFrames=0; + sal_Bool bInFrameSet = sal_False; + sal_uInt16 nFrames=0; pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { @@ -740,7 +740,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // Auf dieses Dokument existiert noch eine Sicht, die // in einem FrameSet liegt; diese darf nat"urlich nicht // geclosed werden - bInFrameSet = TRUE; + bInFrameSet = sal_True; } else nFrames++; @@ -761,8 +761,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } // Parameter auswerten - SFX_REQUEST_ARG(rReq, pSaveItem, SfxBoolItem, SID_CLOSEDOC_SAVE, FALSE); - SFX_REQUEST_ARG(rReq, pNameItem, SfxStringItem, SID_CLOSEDOC_FILENAME, FALSE); + SFX_REQUEST_ARG(rReq, pSaveItem, SfxBoolItem, SID_CLOSEDOC_SAVE, sal_False); + SFX_REQUEST_ARG(rReq, pNameItem, SfxStringItem, SID_CLOSEDOC_FILENAME, sal_False); if ( pSaveItem ) { if ( pSaveItem->GetValue() ) @@ -785,22 +785,22 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } } else - SetModified(FALSE); + SetModified(sal_False); } // Benutzer bricht ab? if ( !PrepareClose( 2 ) ) { - rReq.SetReturnValue( SfxBoolItem(0, FALSE) ); + rReq.SetReturnValue( SfxBoolItem(0, sal_False) ); rReq.Done(); return; } - SetModified( FALSE ); - ULONG lErr = GetErrorCode(); + SetModified( sal_False ); + sal_uIntPtr lErr = GetErrorCode(); ErrorHandler::HandleError(lErr); - rReq.SetReturnValue( SfxBoolItem(0, TRUE) ); + rReq.SetReturnValue( SfxBoolItem(0, sal_True) ); rReq.Done(); rReq.ReleaseArgs(); // da der Pool in Close zerst"ort wird DoClose(); @@ -833,9 +833,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } } - SFX_REQUEST_ARG(rReq, pRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, FALSE); - SFX_REQUEST_ARG(rReq, pNameItem, SfxStringItem, SID_TEMPLATE_NAME, FALSE); - SFX_REQUEST_ARG(rReq, pRegionNrItem, SfxUInt16Item, SID_TEMPLATE_REGION, FALSE); + SFX_REQUEST_ARG(rReq, pRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, sal_False); + SFX_REQUEST_ARG(rReq, pNameItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False); + SFX_REQUEST_ARG(rReq, pRegionNrItem, SfxUInt16Item, SID_TEMPLATE_REGION, sal_False); if ( (!pRegionItem && !pRegionNrItem ) || !pNameItem ) { DBG_ASSERT( rReq.IsAPI(), "non-API call without Arguments" ); @@ -891,10 +891,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // Picklisten-Eintrag verhindern if ( rReq.IsAPI() ) - GetMedium()->SetUpdatePickList( FALSE ); + GetMedium()->SetUpdatePickList( sal_False ); else if ( rReq.GetArgs() ) { - SFX_ITEMSET_GET( *rReq.GetArgs(), pPicklistItem, SfxBoolItem, SID_PICKLIST, FALSE ); + SFX_ITEMSET_GET( *rReq.GetArgs(), pPicklistItem, SfxBoolItem, SID_PICKLIST, sal_False ); if ( pPicklistItem ) GetMedium()->SetUpdatePickList( pPicklistItem->GetValue() ); } @@ -910,7 +910,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) DBG_CHKTHIS(SfxObjectShell, 0); SfxWhichIter aIter( rSet ); - for ( USHORT nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich() ) + for ( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich() ) { switch ( nWhich ) { @@ -944,7 +944,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) } case SID_SAVEDOC: { - BOOL bMediumRO = IsReadOnlyMedium(); + sal_Bool bMediumRO = IsReadOnlyMedium(); if ( !bMediumRO && GetMedium() && IsModified() ) rSet.Put(SfxStringItem( nWhich, String(SfxResId(STR_SAVEDOC)))); @@ -1089,13 +1089,6 @@ void SfxObjectShell::ExecProps_Impl(SfxRequest &rReq) rReq.Done(); break; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_PLAYMACRO: - { - SFX_APP()->PlayMacro_Impl( rReq, GetBasic() ); - break; - } - case SID_DOCINFO_AUTHOR : { ::rtl::OUString aStr = ( (SfxStringItem&)rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); @@ -1125,7 +1118,7 @@ void SfxObjectShell::ExecProps_Impl(SfxRequest &rReq) void SfxObjectShell::StateProps_Impl(SfxItemSet &rSet) { SfxWhichIter aIter(rSet); - for ( USHORT nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() ) + for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() ) { switch ( nSID ) { @@ -1207,7 +1200,7 @@ void SfxObjectShell::ExecView_Impl(SfxRequest &rReq) { case SID_ACTIVATE: { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, TRUE ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, sal_True ); if ( pFrame ) pFrame->GetFrame().Appear(); rReq.SetReturnValue( SfxObjectItem( 0, pFrame ) ); @@ -1226,7 +1219,7 @@ void SfxObjectShell::ExecView_Impl(SfxRequest &rReq) if ( aFileName.Len() ) { SfxStringItem aName( SID_FILE_NAME, aFileName ); - SfxBoolItem aCreateView( SID_OPEN_NEW_VIEW, TRUE ); + SfxBoolItem aCreateView( SID_OPEN_NEW_VIEW, sal_True ); SFX_APP()->GetAppDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aName, &aCreateView, 0L); @@ -1391,7 +1384,7 @@ void SfxObjectShell::ImplSign( sal_Bool bScriptingContent ) if ( (bHasSign && QueryBox( NULL, SfxResId( MSG_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN ) ).Execute() == RET_YES) || (!bHasSign && QueryBox( NULL, SfxResId( RID_XMLSEC_QUERY_SAVEBEFORESIGN ) ).Execute() == RET_YES) ) { - USHORT nId = SID_SAVEDOC; + sal_uInt16 nId = SID_SAVEDOC; if ( !GetMedium() || !GetMedium()->GetName().Len() ) nId = SID_SAVEASDOC; SfxRequest aSaveRequest( nId, 0, GetPool() ); @@ -1479,22 +1472,22 @@ void SfxObjectShell::ImplSign( sal_Bool bScriptingContent ) sal_uInt16 SfxObjectShell::GetDocumentSignatureState() { - return ImplGetSignatureState( FALSE ); + return ImplGetSignatureState( sal_False ); } void SfxObjectShell::SignDocumentContent() { - ImplSign( FALSE ); + ImplSign( sal_False ); } sal_uInt16 SfxObjectShell::GetScriptingSignatureState() { - return ImplGetSignatureState( TRUE ); + return ImplGetSignatureState( sal_True ); } void SfxObjectShell::SignScriptingContent() { - ImplSign( TRUE ); + ImplSign( sal_True ); } // static diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 0575660877a3..9a86e962cac6 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -195,7 +195,7 @@ sal_Bool SfxObjectShell::SaveAs( SfxMedium& rMedium ) //------------------------------------------------------------------------- -sal_Bool SfxObjectShell::QuerySlotExecutable( USHORT /*nSlotId*/ ) +sal_Bool SfxObjectShell::QuerySlotExecutable( sal_uInt16 /*nSlotId*/ ) { return sal_True; } @@ -889,7 +889,7 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo if( xFilterCFG.is() ) { - BOOL bAbort = FALSE; + sal_Bool bAbort = sal_False; try { const SfxFilter* pFilter = pMedium->GetFilter(); Sequence < PropertyValue > aProps; @@ -949,7 +949,7 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo pSet->Put( *pFilterData ); } else - bAbort = TRUE; + bAbort = sal_True; } } @@ -1081,7 +1081,7 @@ sal_Bool SfxObjectShell::DoSave() return bOk; } -void Lock_Impl( SfxObjectShell* pDoc, BOOL bLock ) +void Lock_Impl( SfxObjectShell* pDoc, sal_Bool bLock ) { SfxViewFrame *pFrame= SfxViewFrame::GetFirst( pDoc ); while ( pFrame ) @@ -1569,7 +1569,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl if( bOk && !bCopyTo ) // we also don't touch any graphical replacements here - bOk = SaveChildren( TRUE ); + bOk = SaveChildren( sal_True ); } if ( bOk ) @@ -1769,8 +1769,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl #define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer // Header for a single-valued ASCII EA data item typedef struct _EA_ASCII_header { - USHORT usAttr; /* value: EAT_ASCII */ - USHORT usLen; /* length of data */ + sal_uInt16 usAttr; /* value: EAT_ASCII */ + sal_uInt16 usLen; /* length of data */ CHAR szType[_MAX_PATH]; /* ASCII data fits in here ... */ } EA_ASCII_HEADER; char filePath[_MAX_PATH]; @@ -1812,7 +1812,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl eaAscii.usLen = strlen( eaAscii.szType); // fill libc EA data structure eaType.flags = 0; - eaType.size = sizeof(USHORT)*2 + eaAscii.usLen; + eaType.size = sizeof(sal_uInt16)*2 + eaAscii.usLen; eaType.value = &eaAscii; // put EA to file rc = _ea_put( &eaType, filePath, 0, ".TYPE"); @@ -1966,7 +1966,7 @@ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl( //------------------------------------------------------------------------- -sal_Bool SfxObjectShell::DoSaveObjectAs( SfxMedium& rMedium, BOOL bCommit ) +sal_Bool SfxObjectShell::DoSaveObjectAs( SfxMedium& rMedium, sal_Bool bCommit ) { sal_Bool bOk = sal_False; { @@ -2293,7 +2293,7 @@ sal_Bool SfxObjectShell::InsertFrom( SfxMedium& rMedium ) const OUString sInputStream ( RTL_CONSTASCII_USTRINGPARAM ( "InputStream" ) ); sal_Bool bHasInputStream = sal_False; - BOOL bHasBaseURL = FALSE; + sal_Bool bHasBaseURL = sal_False; sal_Int32 i; sal_Int32 nEnd = lDescriptor.getLength(); @@ -2388,7 +2388,7 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium ) const OUString sInputStream ( RTL_CONSTASCII_USTRINGPARAM ( "InputStream" ) ); sal_Bool bHasInputStream = sal_False; - BOOL bHasBaseURL = FALSE; + sal_Bool bHasBaseURL = sal_False; sal_Int32 i; sal_Int32 nEnd = lDescriptor.getLength(); @@ -2479,9 +2479,9 @@ sal_Bool SfxObjectShell::ExportTo( SfxMedium& rMedium ) // put in the REAL file name, and copy all PropertyValues const OUString sOutputStream ( RTL_CONSTASCII_USTRINGPARAM ( "OutputStream" ) ); const OUString sStream ( RTL_CONSTASCII_USTRINGPARAM ( "StreamForOutput" ) ); - BOOL bHasOutputStream = FALSE; - BOOL bHasStream = FALSE; - BOOL bHasBaseURL = FALSE; + sal_Bool bHasOutputStream = sal_False; + sal_Bool bHasStream = sal_False; + sal_Bool bHasBaseURL = sal_False; sal_Int32 i; sal_Int32 nEnd = aOldArgs.getLength(); @@ -2678,7 +2678,7 @@ sal_Bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet ) DBG_CHKTHIS(SfxObjectShell, 0); pImp->bIsSaving = sal_True; - sal_Bool bSaved = FALSE; + sal_Bool bSaved = sal_False; SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False); if ( pSalvageItem ) { @@ -2772,7 +2772,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl SfxMedium *pActMed = GetMedium(); const INetURLObject aActName(pActMed->GetName()); - BOOL bWasReadonly = IsReadOnly(); + sal_Bool bWasReadonly = IsReadOnly(); if ( aURL == aActName && aURL != INetURLObject( OUString::createFromAscii( "private:stream" ) ) && IsReadOnly() ) @@ -2968,7 +2968,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl if ( !bCopyTo ) { // reconnect to the old medium - BOOL bRet( FALSE ); + sal_Bool bRet( sal_False ); bRet = DoSaveCompleted( pMedium ); DBG_ASSERT( bRet, "Error in DoSaveCompleted, can't be handled!"); } @@ -3025,7 +3025,7 @@ sal_Bool SfxObjectShell::IsInformationLost() { const SfxFilter *pFilt = GetMedium()->GetFilter(); DBG_ASSERT( pFilt && aFilterName.equals( pFilt->GetName() ), "MediaDescriptor contains wrong filter!\n" ); - return ( pFilt && pFilt->IsAlienFormat() && !(pFilt->GetFilterFlags() & SFX_FILTER_SILENTEXPORT ) ); + return ( pFilt && pFilt->IsAlienFormat() ); } return sal_False; @@ -3062,7 +3062,7 @@ sal_uInt16 SfxObjectShell::GetHiddenInformationState( sal_uInt16 nStates ) sal_Int16 SfxObjectShell::QueryHiddenInformation( HiddenWarningFact eFact, Window* pParent ) { sal_Int16 nRet = RET_YES; - USHORT nResId = 0; + sal_uInt16 nResId = 0; SvtSecurityOptions::EOption eOption = static_cast< SvtSecurityOptions::EOption >( -1 ); switch ( eFact ) @@ -3242,7 +3242,7 @@ uno::Reference< embed::XStorage > SfxObjectShell::GetStorage() } -sal_Bool SfxObjectShell::SaveChildren( BOOL bObjectsOnly ) +sal_Bool SfxObjectShell::SaveChildren( sal_Bool bObjectsOnly ) { RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mv76033) SfxObjectShell::SaveChildren" ); @@ -3348,7 +3348,7 @@ sal_Bool SfxObjectShell::SaveCompleted( const uno::Reference< embed::XStorage >& #ifdef DBG_UTIL // check for wrong creation of object container - BOOL bHasContainer = ( pImp->mpObjectContainer != 0 ); + sal_Bool bHasContainer = ( pImp->mpObjectContainer != 0 ); #endif if ( !xStorage.is() || xStorage == GetStorage() ) @@ -3496,7 +3496,7 @@ sal_Bool SfxObjectShell::SwitchPersistance( const uno::Reference< embed::XStorag sal_Bool bResult = sal_False; #ifdef DBG_UTIL // check for wrong creation of object container - BOOL bHasContainer = ( pImp->mpObjectContainer != 0 ); + sal_Bool bHasContainer = ( pImp->mpObjectContainer != 0 ); #endif if ( xStorage.is() ) { diff --git a/sfx2/source/doc/objuno.cxx b/sfx2/source/doc/objuno.cxx index 32d50de40d51..8573c4afc0f4 100644 --- a/sfx2/source/doc/objuno.cxx +++ b/sfx2/source/doc/objuno.cxx @@ -128,10 +128,10 @@ const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap() return aDocInfoPropertyMap_Impl; } -static USHORT aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30, +static sal_uInt16 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -inline USHORT DaysInMonth( USHORT nMonth, USHORT nYear ) +inline sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear ) { if ( nMonth != 2 ) return aDaysInMonth[nMonth-1]; @@ -708,7 +708,7 @@ void SAL_CALL SfxDocumentInfoObject::removeProperty(const ::rtl::OUString& sName return xPropSet->removeProperty(sName); } -BOOL equalsDateTime( const util::DateTime& D1, const util::DateTime& D2 ) +sal_Bool equalsDateTime( const util::DateTime& D1, const util::DateTime& D2 ) { return D1.HundredthSeconds == D2.HundredthSeconds && D1.Seconds == D2.Seconds && diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index a5141662fa3d..4255e9bd2939 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -815,7 +815,7 @@ void SfxObjectShell::InitBasicManager_Impl() changed to return the Basic manager currently under construction, when called repeatedly. - The variable pImp->bBasicInitialized will be set to TRUE after + The variable pImp->bBasicInitialized will be set to sal_True after construction now, to ensure that the recursive call of the function lcl_getBasicManagerForDocument() will be routed into this function too. @@ -826,7 +826,7 @@ void SfxObjectShell::InitBasicManager_Impl() DBG_ASSERT( !pImp->bBasicInitialized && !pImp->pBasicManager->isValid(), "Lokaler BasicManager bereits vorhanden"); pImp->pBasicManager->reset( BasicManagerRepository::getDocumentBasicManager( GetModel() ) ); DBG_ASSERT( pImp->pBasicManager->isValid(), "SfxObjectShell::InitBasicManager_Impl: did not get a BasicManager!" ); - pImp->bBasicInitialized = TRUE; + pImp->bBasicInitialized = sal_True; } //-------------------------------------------------------------------- @@ -941,7 +941,7 @@ String SfxObjectShell::GetServiceNameFromFactory( const String& rFact ) String aPrefix = String::CreateFromAscii( "private:factory/" ); if ( aPrefix.Len() == aFact.Match( aPrefix ) ) aFact.Erase( 0, aPrefix.Len() ); - USHORT nPos = aFact.Search( '?' ); + sal_uInt16 nPos = aFact.Search( '?' ); String aParam; if ( nPos != STRING_NOTFOUND ) { @@ -1034,8 +1034,8 @@ SfxObjectShell* SfxObjectShell::CreateAndLoadObject( const SfxItemSet& rSet, Sfx { uno::Sequence < beans::PropertyValue > aProps; TransformItems( SID_OPENDOC, rSet, aProps ); - SFX_ITEMSET_ARG(&rSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE); - SFX_ITEMSET_ARG(&rSet, pTargetItem, SfxStringItem, SID_TARGETNAME, FALSE); + SFX_ITEMSET_ARG(&rSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False); + SFX_ITEMSET_ARG(&rSet, pTargetItem, SfxStringItem, SID_TARGETNAME, sal_False); ::rtl::OUString aURL; ::rtl::OUString aTarget = rtl::OUString::createFromAscii("_blank"); if ( pFileNameItem ) diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index d6192542d1a1..2e0df56ba141 100755 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -590,14 +590,14 @@ void SfxOleFileTimeProperty::ImplSave( SvStream& rStrm ) { DateTime aDateTimeUtc( Date( - static_cast< USHORT >( maDateTime.Day ), - static_cast< USHORT >( maDateTime.Month ), - static_cast< USHORT >( maDateTime.Year ) ), + static_cast< sal_uInt16 >( maDateTime.Day ), + static_cast< sal_uInt16 >( maDateTime.Month ), + static_cast< sal_uInt16 >( maDateTime.Year ) ), Time( - static_cast< ULONG >( maDateTime.Hours ), - static_cast< ULONG >( maDateTime.Minutes ), - static_cast< ULONG >( maDateTime.Seconds ), - static_cast< ULONG >( maDateTime.HundredthSeconds ) ) ); + static_cast< sal_uIntPtr >( maDateTime.Hours ), + static_cast< sal_uIntPtr >( maDateTime.Minutes ), + static_cast< sal_uIntPtr >( maDateTime.Seconds ), + static_cast< sal_uIntPtr >( maDateTime.HundredthSeconds ) ) ); // invalid time stamp is not converted to UTC // heuristic to detect editing durations (which we assume to be < 1 year): // check only the year, not the entire date diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx index 9ff8c73acbf6..8c731845554f 100644 --- a/sfx2/source/doc/plugin.cxx +++ b/sfx2/source/doc/plugin.cxx @@ -105,7 +105,7 @@ throw( uno::RuntimeException ) { uno::Reference< plugin::XPluginManager > xPMgr( mxFact->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.plugin.PluginManager") ), uno::UNO_QUERY ); if (!xPMgr.is() ) - return FALSE; + return sal_False; if ( SvtMiscOptions().IsPluginsEnabled() ) { @@ -115,10 +115,10 @@ throw( uno::RuntimeException ) pWin->SetBackground(); pWin->Show(); - ULONG nCount = maCmdList.Count(); + sal_uIntPtr nCount = maCmdList.Count(); uno::Sequence < ::rtl::OUString > aCmds( nCount ), aArgs( nCount ); ::rtl::OUString *pCmds = aCmds.getArray(), *pArgs = aArgs.getArray(); - for( ULONG i = 0; i < nCount; i++ ) + for( sal_uIntPtr i = 0; i < nCount; i++ ) { SvCommand & rCmd = maCmdList.GetObject( i ); pCmds[i] = rCmd.GetCommand(); @@ -136,7 +136,7 @@ throw( uno::RuntimeException ) { pWin->xWindow = xWindow; pWin->Resize(); - xWindow->setVisible( TRUE ); + xWindow->setVisible( sal_True ); } try @@ -165,10 +165,10 @@ throw( uno::RuntimeException ) // we must destroy the plugin before the parent is destroyed xWindow->addEventListener( this ); xFrame->setComponent( xWindow, uno::Reference < frame::XController >() ); - return mxPlugin.is() ? TRUE : FALSE; + return mxPlugin.is() ? sal_True : sal_False; } - return FALSE; + return sal_False; } void SAL_CALL PluginObject::cancel() throw( com::sun::star::uno::RuntimeException ) diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index d088f6981f49..8bf97ba5b435 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -422,8 +422,8 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > rtl::OUString aTmp; if ( ( rProp.Value >>= aTmp ) == sal_False ) throw ::com::sun::star::lang::IllegalArgumentException(); - USHORT nCount = pPrinter->GetPaperBinCount(); - for (USHORT nBin=0; nBin<nCount; nBin++) + sal_uInt16 nCount = pPrinter->GetPaperBinCount(); + for (sal_uInt16 nBin=0; nBin<nCount; nBin++) { ::rtl::OUString aName( pPrinter->GetPaperBinName(nBin) ); if ( aName == aTmp ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index d24a95332b58..32b46bb67e4d 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -127,6 +127,7 @@ #include "sfx2/docstoragemodifylistener.hxx" #include "sfx2/brokenpackageint.hxx" #include "graphhelp.hxx" +#include "docundomanager.hxx" #include <sfx2/msgpool.hxx> #include <sfx2/DocumentMetadataAccess.hxx> @@ -153,6 +154,10 @@ using ::com::sun::star::lang::WrappedTargetException; using ::com::sun::star::uno::Type; using ::com::sun::star::uno::Sequence; using ::com::sun::star::document::XDocumentRecovery; +using ::com::sun::star::document::XUndoManager; +using ::com::sun::star::document::XUndoAction; +using ::com::sun::star::document::UndoFailedException; +using ::com::sun::star::frame::XModel; /** This Listener is used to get notified when the XDocumentProperties of the XModel change. @@ -221,15 +226,17 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument sal_Bool m_bSaving ; sal_Bool m_bSuicide ; sal_Bool m_bInitialized ; + sal_Bool m_bExternalTitle ; sal_Bool m_bModifiedSinceLastSave; uno::Reference< com::sun::star::view::XPrintable> m_xPrintable ; uno::Reference< script::provider::XScriptProvider > m_xScriptProvider; uno::Reference< ui::XUIConfigurationManager > m_xUIConfigurationManager; ::rtl::Reference< ::sfx2::DocumentStorageModifyListener > m_pStorageModifyListen; - ::rtl::OUString m_sModuleIdentifier; + ::rtl::OUString m_sModuleIdentifier; css::uno::Reference< css::frame::XTitle > m_xTitleHelper; css::uno::Reference< css::frame::XUntitledNumbers > m_xNumberedControllers; - uno::Reference< rdf::XDocumentMetadataAccess> m_xDocumentMetadata; + uno::Reference< rdf::XDocumentMetadataAccess> m_xDocumentMetadata; + ::rtl::Reference< ::sfx2::DocumentUndoManager > m_pDocumentUndoManager; IMPL_SfxBaseModel_DataContainer( ::osl::Mutex& rMutex, SfxObjectShell* pObjectShell ) @@ -241,11 +248,13 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument , m_bSaving ( sal_False ) , m_bSuicide ( sal_False ) , m_bInitialized ( sal_False ) + , m_bExternalTitle ( sal_False ) , m_bModifiedSinceLastSave( sal_False ) , m_pStorageModifyListen ( NULL ) , m_xTitleHelper () , m_xNumberedControllers () , m_xDocumentMetadata () // lazy + , m_pDocumentUndoManager () { // increase global instance counter. ++g_nInstanceCounter; @@ -502,10 +511,10 @@ SfxSaveGuard::~SfxSaveGuard() m_pData->m_bSaving = sal_False; // m_bSuicide was set e.g. in case somewhere tried to close a document, while it was used for - // storing at the same time. Further m_bSuicide was set to TRUE only if close(TRUE) was called. + // storing at the same time. Further m_bSuicide was set to sal_True only if close(sal_True) was called. // So the owner ship was delegated to the place where a veto exception was thrown. // Now we have to call close() again and delegate the owner ship to the next one, which - // cant accept that. Close(FALSE) cant work in this case. Because then the document will may be never closed ... + // cant accept that. Close(sal_False) cant work in this case. Because then the document will may be never closed ... if ( m_pData->m_bSuicide ) { @@ -786,6 +795,12 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept m_pData->m_pStorageModifyListen = NULL; } + if ( m_pData->m_pDocumentUndoManager.is() ) + { + m_pData->m_pDocumentUndoManager->disposing(); + m_pData->m_pDocumentUndoManager = NULL; + } + lang::EventObject aEvent( (frame::XModel *)this ); m_pData->m_aInterfaceContainer.disposeAndClear( aEvent ); @@ -1183,6 +1198,51 @@ void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::X m_pData->m_xCurrent = uno::Reference< frame::XController > (); } +namespace +{ + typedef ::cppu::WeakImplHelper1< XUndoAction > ControllerLockUndoAction_Base; + class ControllerLockUndoAction : public ControllerLockUndoAction_Base + { + public: + ControllerLockUndoAction( const Reference< XModel >& i_model, const bool i_undoIsUnlock ) + :m_xModel( i_model ) + ,m_bUndoIsUnlock( i_undoIsUnlock ) + { + } + + // XUndoAction + virtual ::rtl::OUString SAL_CALL getTitle() throw (RuntimeException); + virtual void SAL_CALL undo( ) throw (UndoFailedException, RuntimeException); + virtual void SAL_CALL redo( ) throw (UndoFailedException, RuntimeException); + + private: + const Reference< XModel > m_xModel; + const bool m_bUndoIsUnlock; + }; + + ::rtl::OUString SAL_CALL ControllerLockUndoAction::getTitle() throw (RuntimeException) + { + // this action is intended to be used within an UndoContext only, so nobody will ever see this title ... + return ::rtl::OUString(); + } + + void SAL_CALL ControllerLockUndoAction::undo( ) throw (UndoFailedException, RuntimeException) + { + if ( m_bUndoIsUnlock ) + m_xModel->unlockControllers(); + else + m_xModel->lockControllers(); + } + + void SAL_CALL ControllerLockUndoAction::redo( ) throw (UndoFailedException, RuntimeException) + { + if ( m_bUndoIsUnlock ) + m_xModel->lockControllers(); + else + m_xModel->unlockControllers(); + } +} + //________________________________________________________________________________________________________ // frame::XModel //________________________________________________________________________________________________________ @@ -1192,6 +1252,14 @@ void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::Runti SfxModelGuard aGuard( *this ); ++m_pData->m_nControllerLockCount ; + + if ( m_pData->m_pDocumentUndoManager.is() + && m_pData->m_pDocumentUndoManager->isInContext() + && !m_pData->m_pDocumentUndoManager->isLocked() + ) + { + m_pData->m_pDocumentUndoManager->addUndoAction( new ControllerLockUndoAction( this, true ) ); + } } //________________________________________________________________________________________________________ @@ -1203,6 +1271,14 @@ void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::Run SfxModelGuard aGuard( *this ); --m_pData->m_nControllerLockCount ; + + if ( m_pData->m_pDocumentUndoManager.is() + && m_pData->m_pDocumentUndoManager->isInContext() + && !m_pData->m_pDocumentUndoManager->isLocked() + ) + { + m_pData->m_pDocumentUndoManager->addUndoAction( new ControllerLockUndoAction( this, false ) ); + } } //________________________________________________________________________________________________________ @@ -1644,6 +1720,17 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString& } //________________________________________________________________________________________________________ +// XUndoManagerSupplier +//________________________________________________________________________________________________________ +Reference< XUndoManager > SAL_CALL SfxBaseModel::getUndoManager( ) throw (RuntimeException) +{ + SfxModelGuard aGuard( *this ); + if ( !m_pData->m_pDocumentUndoManager.is() ) + m_pData->m_pDocumentUndoManager.set( new ::sfx2::DocumentUndoManager( *this ) ); + return m_pData->m_pDocumentUndoManager.get(); +} + +//________________________________________________________________________________________________________ // XStorable //________________________________________________________________________________________________________ @@ -1773,7 +1860,7 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& } // !TODO: currently not working - //SFX_ITEMSET_ARG( pParams, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE ); + //SFX_ITEMSET_ARG( pParams, pFrameItem, SfxFrameItem, SID_DOCFRAME, sal_False ); //if( pFrameItem && pFrameItem->GetFrame() ) //{ // SfxFrame* pFrame = pFrameItem->GetFrame(); @@ -1802,7 +1889,7 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& if ( nError == ERRCODE_IO_BROKENPACKAGE && xHandler.is() ) { ::rtl::OUString aDocName = pMedium->GetURLObject().getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - SFX_ITEMSET_ARG( pMedium->GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE, FALSE ); + SFX_ITEMSET_ARG( pMedium->GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE, sal_False ); if ( !pRepairItem || !pRepairItem->GetValue() ) { RequestPackageReparation aRequest( aDocName ); @@ -1861,12 +1948,12 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& if ( nError ) { - BOOL bSilent = FALSE; + sal_Bool bSilent = sal_False; SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSilentItem, SfxBoolItem, SID_SILENT, sal_False); if( pSilentItem ) bSilent = pSilentItem->GetValue(); - BOOL bWarning = ((nError & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK); + sal_Bool bWarning = ((nError & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK); if ( nError != ERRCODE_IO_BROKENPACKAGE && !bSilent ) { // broken package was handled already @@ -1892,7 +1979,7 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& } } - BOOL bHidden = FALSE; + sal_Bool bHidden = sal_False; SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); if ( pHidItem ) bHidden = pHidItem->GetValue(); @@ -1941,7 +2028,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) aDesc.maSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MAP_100TH_MM ); aDesc.maDragStartPos = Point(); aDesc.maDisplayName = String(); - aDesc.mbCanLink = FALSE; + aDesc.mbCanLink = sal_False; SvMemoryStream aMemStm( 1024, 1024 ); aMemStm << aDesc; @@ -1957,7 +2044,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) try { utl::TempFile aTmp; - aTmp.EnableKillingFile( TRUE ); + aTmp.EnableKillingFile( sal_True ); storeToURL( aTmp.GetURL(), uno::Sequence < beans::PropertyValue >() ); SvStream* pStream = aTmp.GetStream( STREAM_READ ); const sal_uInt32 nLen = pStream->Seek( STREAM_SEEK_TO_END ); @@ -3003,7 +3090,7 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, m_pData->m_pObjectShell ) ) { - BOOL bIsActive = ( pFrame == pActFrame ); + sal_Bool bIsActive = ( pFrame == pActFrame ); pFrame->GetViewShell()->WriteUserDataSequence( aSeq ); aAny <<= aSeq; xCont->insertByIndex( bIsActive ? 0 : nCount, aAny ); @@ -3274,7 +3361,7 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, uno::Reference< contai rtl::OUString aSlot( aCommand.copy( 5 )); // We have to replace the old "slot-Command" with our new ".uno:-Command" - const SfxSlot* pSlot = pModule->GetSlotPool()->GetSlot( USHORT( aSlot.toInt32() )); + const SfxSlot* pSlot = pModule->GetSlotPool()->GetSlot( sal_uInt16( aSlot.toInt32() )); if ( pSlot ) { rtl::OUStringBuffer aStrBuf( aUnoCmd ); @@ -3524,12 +3611,12 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const uno::Reference< XSTORAGE >& x pMedium->GetItemSet()->Put( aSet ); // allow to use an interactionhandler (if there is one) - pMedium->UseInteractionHandler( TRUE ); + pMedium->UseInteractionHandler( sal_True ); SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); - BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue(); + sal_Bool bTemplate = pTemplateItem && pTemplateItem->GetValue(); m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); - m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; + m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = sal_False; // load document if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) @@ -3582,11 +3669,11 @@ void SAL_CALL SfxBaseModel::storeToStorage( const uno::Reference< XSTORAGE >& xS // BaseURL is part of the ItemSet SfxMedium aMedium( xStorage, String(), &aSet ); - aMedium.CanDisposeStorage_Impl( FALSE ); + aMedium.CanDisposeStorage_Impl( sal_False ); if ( aMedium.GetFilter() ) { // storing without a valid filter will often crash - bSuccess = m_pData->m_pObjectShell->DoSaveObjectAs( aMedium, TRUE ); + bSuccess = m_pData->m_pObjectShell->DoSaveObjectAs( aMedium, sal_True ); m_pData->m_pObjectShell->DoSaveCompleted( NULL ); } } @@ -3625,7 +3712,7 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x nError ? nError : ERRCODE_IO_GENERAL ); } - m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; + m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = sal_False; } uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentStorage() @@ -3747,7 +3834,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl SfxModelGuard aGuard( *this ); ::rtl::OUString aResult = impl_getTitleHelper()->getTitle (); - if ( m_pData->m_pObjectShell ) + if ( !m_pData->m_bExternalTitle && m_pData->m_pObjectShell ) { SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); if ( pMedium ) @@ -3757,7 +3844,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl aResult += String( SfxResId(STR_REPAIREDDOCUMENT) ); } - if ( m_pData->m_pObjectShell->IsReadOnlyUI() || (m_pData->m_pObjectShell->GetMedium() && m_pData->m_pObjectShell->GetMedium()->IsReadOnly()) ) + if ( m_pData->m_pObjectShell->IsReadOnlyUI() || (pMedium && pMedium->IsReadOnly()) ) aResult += ::rtl::OUString( String( SfxResId(STR_READONLY) ) ); else if ( m_pData->m_pObjectShell->IsDocShared() ) aResult += ::rtl::OUString( String( SfxResId(STR_SHARED) ) ); @@ -3778,6 +3865,7 @@ void SAL_CALL SfxBaseModel::setTitle( const ::rtl::OUString& sTitle ) SfxModelGuard aGuard( *this ); impl_getTitleHelper()->setTitle (sTitle); + m_pData->m_bExternalTitle = sal_True; } //============================================================================= @@ -3949,9 +4037,9 @@ namespace sfx { namespace intern { SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const Reference< XFrame >& i_rFrame, ::sfx::intern::ViewCreationGuard& i_rGuard ) const { SfxViewFrame* pViewFrame = NULL; - for ( pViewFrame = SfxViewFrame::GetFirst( GetObjectShell(), FALSE ); + for ( pViewFrame = SfxViewFrame::GetFirst( GetObjectShell(), sal_False ); pViewFrame; - pViewFrame= SfxViewFrame::GetNext( *pViewFrame, GetObjectShell(), FALSE ) + pViewFrame= SfxViewFrame::GetNext( *pViewFrame, GetObjectShell(), sal_False ) ) { if ( pViewFrame->GetFrame().GetFrameInterface() == i_rFrame ) @@ -4058,18 +4146,18 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie // some initial view settings, coming from our most recent attachResource call ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs() ); if ( aDocumentLoadArgs.getOrDefault( "ViewOnly", false ) ) - pViewFrame->GetFrame().SetMenuBarOn_Impl( FALSE ); + pViewFrame->GetFrame().SetMenuBarOn_Impl( sal_False ); const sal_Int16 nPluginMode = aDocumentLoadArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); if ( nPluginMode == 1 ) { - pViewFrame->ForceOuterResize_Impl( FALSE ); - pViewFrame->GetBindings().HidePopups( TRUE ); + pViewFrame->ForceOuterResize_Impl( sal_False ); + pViewFrame->GetBindings().HidePopups( sal_True ); SfxFrame& rFrame = pViewFrame->GetFrame(); // MBA: layoutmanager of inplace frame starts locked and invisible - rFrame.GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); - rFrame.GetWorkWindow_Impl()->Lock_Impl( TRUE ); + rFrame.GetWorkWindow_Impl()->MakeVisible_Impl( sal_False ); + rFrame.GetWorkWindow_Impl()->Lock_Impl( sal_True ); rFrame.GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); @@ -4371,3 +4459,16 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, return xDMA->storeMetadataToMedium(i_rMedium); } +// ===================================================================================================================== +// = SfxModelSubComponent +// ===================================================================================================================== + +SfxModelSubComponent::~SfxModelSubComponent() +{ +} + +void SfxModelSubComponent::disposing() +{ + // nothing to do here +} + |