summaryrefslogtreecommitdiff
path: root/sfx2/source/doc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-18 13:03:28 +0200
committerNoel Grandin <noel@peralex.com>2015-03-19 08:25:03 +0200
commit48bb2913a7459edb17a5f62c2f6e6fbc4f1051e2 (patch)
tree7e2f09fc8998bc1016f4d2ba7fa09e3125663361 /sfx2/source/doc
parentbdad6d0fe492a2334cb27ef54fc5d1cba17d1970 (diff)
convert SFX_FILTER_ constants to enum class
Change-Id: I7e53cfc90cefd9da7d6ecd795b09214bd44b1613
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r--sfx2/source/doc/docfile.cxx5
-rw-r--r--sfx2/source/doc/docfilt.cxx10
-rw-r--r--sfx2/source/doc/guisaveas.cxx58
-rw-r--r--sfx2/source/doc/objserv.cxx2
-rw-r--r--sfx2/source/doc/objstor.cxx26
5 files changed, 49 insertions, 52 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 5d3edd3dc156..41d8097c0294 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3173,10 +3173,7 @@ bool SfxMedium::SaveVersionList_Impl( bool /*bUseXML*/ )
bool SfxMedium::IsReadOnly() const
{
// a) ReadOnly filter can't produce read/write contents!
- bool bReadOnly = (
- (pImp->m_pFilter ) &&
- ((pImp->m_pFilter->GetFilterFlags() & SFX_FILTER_OPENREADONLY) == SFX_FILTER_OPENREADONLY)
- );
+ bool bReadOnly = pImp->m_pFilter && (pImp->m_pFilter->GetFilterFlags() & SfxFilterFlags::OPENREADONLY);
// b) if filter allow read/write contents .. check open mode of the storage
if (!bReadOnly)
diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx
index 2599f3528919..ad597513f8b0 100644
--- a/sfx2/source/doc/docfilt.cxx
+++ b/sfx2/source/doc/docfilt.cxx
@@ -39,7 +39,7 @@ using namespace ::com::sun::star;
SfxFilter::SfxFilter( const OUString& rProvider, const OUString &rFilterName ) :
maFilterName(rFilterName),
maProvider(rProvider),
- nFormatType(0),
+ nFormatType(SfxFilterFlags::NONE),
nVersion(0),
lFormat(SotClipboardFormatId::NONE),
nDocIcon(0)
@@ -134,7 +134,7 @@ const SfxFilter* SfxFilter::GetDefaultFilterFromFactory( const OUString& rFact )
const SfxFilter* SfxFilter::GetFilterByName( const OUString& rName )
{
SfxFilterMatcher aMatch;
- return aMatch.GetFilter4FilterName( rName, 0, 0 );
+ return aMatch.GetFilter4FilterName( rName, SfxFilterFlags::NONE, SfxFilterFlags::NONE );
}
OUString SfxFilter::GetTypeFromStorage( const SotStorage& rStg )
@@ -201,13 +201,13 @@ OUString SfxFilter::GetTypeFromStorage(
SotClipboardFormatId nClipId = SotExchange::GetFormat( aDataFlavor );
if ( nClipId != SotClipboardFormatId::NONE )
{
- SfxFilterFlags nMust = SFX_FILTER_IMPORT, nDont = SFX_FILTER_NOTINSTALLED;
+ SfxFilterFlags nMust = SfxFilterFlags::IMPORT, nDont = SFX_FILTER_NOTINSTALLED;
if ( bTemplate )
// template filter was preselected, try to verify
- nMust |= SFX_FILTER_TEMPLATEPATH;
+ nMust |= SfxFilterFlags::TEMPLATEPATH;
else
// template filters shouldn't be detected if not explicitly asked for
- nDont |= SFX_FILTER_TEMPLATEPATH;
+ nDont |= SfxFilterFlags::TEMPLATEPATH;
const SfxFilter* pFilter = 0;
if (!aName.isEmpty())
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 4d51f8e9f6d0..b4beffb9c7ef 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -167,18 +167,18 @@ static sal_uInt8 getStoreModeFromSlotName( const OUString& aSlotName )
}
-static sal_Int32 getMustFlags( sal_Int8 nStoreMode )
+static SfxFilterFlags getMustFlags( sal_Int8 nStoreMode )
{
- return ( SFX_FILTER_EXPORT
- | ( ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) ? 0 : SFX_FILTER_IMPORT ) );
+ return ( SfxFilterFlags::EXPORT
+ | ( ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) ? SfxFilterFlags::NONE : SfxFilterFlags::IMPORT ) );
}
-static sal_Int32 getDontFlags( sal_Int8 nStoreMode )
+static SfxFilterFlags getDontFlags( sal_Int8 nStoreMode )
{
- return ( SFX_FILTER_INTERNAL
- | SFX_FILTER_NOTINFILEDLG
- | ( ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) ? SFX_FILTER_IMPORT : 0 ) );
+ return ( SfxFilterFlags::INTERNAL
+ | SfxFilterFlags::NOTINFILEDLG
+ | ( ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) ? SfxFilterFlags::IMPORT : SfxFilterFlags::NONE ) );
}
@@ -290,8 +290,8 @@ public:
OUString GetDocServiceName();
- uno::Sequence< beans::PropertyValue > GetDocServiceDefaultFilterCheckFlags( sal_Int32 nMust, sal_Int32 nDont );
- uno::Sequence< beans::PropertyValue > GetDocServiceAnyFilter( sal_Int32 nMust, sal_Int32 nDont );
+ uno::Sequence< beans::PropertyValue > GetDocServiceDefaultFilterCheckFlags( SfxFilterFlags nMust, SfxFilterFlags nDont );
+ uno::Sequence< beans::PropertyValue > GetDocServiceAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont );
uno::Sequence< beans::PropertyValue > GetPreselectedFilter_Impl( sal_Int8 nStoreMode );
uno::Sequence< beans::PropertyValue > GetDocServiceDefaultFilter();
@@ -510,16 +510,16 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilter
}
-uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilterCheckFlags( sal_Int32 nMust,
- sal_Int32 nDont )
+uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilterCheckFlags( SfxFilterFlags nMust,
+ SfxFilterFlags nDont )
{
uno::Sequence< beans::PropertyValue > aFilterProps;
uno::Sequence< beans::PropertyValue > aProps = GetDocServiceDefaultFilter();
if ( aProps.getLength() )
{
::comphelper::SequenceAsHashMap aFiltHM( aProps );
- sal_Int32 nFlags = aFiltHM.getUnpackedValueOrDefault("Flags",
- (sal_Int32)0 );
+ SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aFiltHM.getUnpackedValueOrDefault("Flags",
+ (sal_Int32)0 ));
if ( ( ( nFlags & nMust ) == nMust ) && !( nFlags & nDont ) )
aFilterProps = aProps;
}
@@ -529,7 +529,7 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilter
-uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceAnyFilter( sal_Int32 nMust, sal_Int32 nDont )
+uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont )
{
uno::Sequence< beans::NamedValue > aSearchRequest( 1 );
aSearchRequest[0].Name = "DocumentService";
@@ -543,8 +543,8 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetPreselectedFilter_Impl(
{
uno::Sequence< beans::PropertyValue > aFilterProps;
- sal_Int32 nMust = getMustFlags( nStoreMode );
- sal_Int32 nDont = getDontFlags( nStoreMode );
+ SfxFilterFlags nMust = getMustFlags( nStoreMode );
+ SfxFilterFlags nDont = getDontFlags( nStoreMode );
if ( nStoreMode & PDFEXPORT_REQUESTED )
{
@@ -749,7 +749,7 @@ bool hasMacros( const uno::Reference< frame::XModel >& xModel )
sal_Int8 ModelData_Impl::CheckFilter( const OUString& aFilterName )
{
::comphelper::SequenceAsHashMap aFiltPropsHM;
- sal_Int32 nFiltFlags = 0;
+ SfxFilterFlags nFiltFlags = SfxFilterFlags::NONE;
if ( !aFilterName.isEmpty() )
{
// get properties of filter
@@ -758,29 +758,29 @@ sal_Int8 ModelData_Impl::CheckFilter( const OUString& aFilterName )
m_pOwner->GetFilterConfiguration()->getByName( aFilterName ) >>= aFilterProps;
aFiltPropsHM = ::comphelper::SequenceAsHashMap( aFilterProps );
- nFiltFlags = aFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 );
+ nFiltFlags = static_cast<SfxFilterFlags>(aFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 ));
}
// only a temporary solution until default filter retrieving feature is implemented
// then GetDocServiceDefaultFilter() must be used
- ::comphelper::SequenceAsHashMap aDefFiltPropsHM = GetDocServiceDefaultFilterCheckFlags( 3, 0 );
- sal_Int32 nDefFiltFlags = aDefFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 );
+ ::comphelper::SequenceAsHashMap aDefFiltPropsHM = GetDocServiceDefaultFilterCheckFlags( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT, SfxFilterFlags::NONE );
+ SfxFilterFlags nDefFiltFlags = static_cast<SfxFilterFlags>(aDefFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 ));
// if the old filter is not acceptable
// and there is no default filter or it is not acceptable for requested parameters then proceed with saveAs
- if ( ( !aFiltPropsHM.size() || !( nFiltFlags & SFX_FILTER_EXPORT ) )
- && ( !aDefFiltPropsHM.size() || !( nDefFiltFlags & SFX_FILTER_EXPORT ) || nDefFiltFlags & SFX_FILTER_INTERNAL ) )
+ if ( ( !aFiltPropsHM.size() || !( nFiltFlags & SfxFilterFlags::EXPORT ) )
+ && ( !aDefFiltPropsHM.size() || !( nDefFiltFlags & SfxFilterFlags::EXPORT ) || nDefFiltFlags & SfxFilterFlags::INTERNAL ) )
return STATUS_SAVEAS;
// so at this point there is either an acceptable old filter or default one
- if ( !aFiltPropsHM.size() || !( nFiltFlags & SFX_FILTER_EXPORT ) )
+ if ( !aFiltPropsHM.size() || !( nFiltFlags & SfxFilterFlags::EXPORT ) )
{
// so the default filter must be acceptable
return STATUS_SAVEAS_STANDARDNAME;
}
- else if ( ( !( nFiltFlags & SFX_FILTER_OWN ) || ( nFiltFlags & SFX_FILTER_ALIEN ) )
+ else if ( ( !( nFiltFlags & SfxFilterFlags::OWN ) || ( nFiltFlags & SfxFilterFlags::ALIEN ) )
&& aDefFiltPropsHM.size()
- && ( nDefFiltFlags & SFX_FILTER_EXPORT ) && !( nDefFiltFlags & SFX_FILTER_INTERNAL ))
+ && ( nDefFiltFlags & SfxFilterFlags::EXPORT ) && !( nDefFiltFlags & SfxFilterFlags::INTERNAL ))
{
// the default filter is acceptable and the old filter is alien one
// so ask to make a saveAs operation
@@ -926,8 +926,8 @@ bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
OUString aDocServiceName = GetDocServiceName();
DBG_ASSERT( !aDocServiceName.isEmpty(), "No document service for this module set!" );
- sal_Int32 nMust = getMustFlags( nStoreMode );
- sal_Int32 nDont = getDontFlags( nStoreMode );
+ SfxFilterFlags nMust = getMustFlags( nStoreMode );
+ SfxFilterFlags nDont = getDontFlags( nStoreMode );
sfx2::FileDialogHelper::Context eCtxt = sfx2::FileDialogHelper::UNKNOWN_CONTEXT;
if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) )
@@ -1008,9 +1008,9 @@ bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
m_pOwner->GetFilterConfiguration()->getByName( aOldFilterName ) >>= aOldFilterProps;
::comphelper::SequenceAsHashMap aOldFiltPropsHM( aOldFilterProps );
- sal_Int32 nOldFiltFlags = aOldFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 );
+ SfxFilterFlags nOldFiltFlags = static_cast<SfxFilterFlags>(aOldFiltPropsHM.getUnpackedValueOrDefault("Flags", (sal_Int32)0 ));
- if ( bSetStandardName || ( nOldFiltFlags & nMust ) != nMust || nOldFiltFlags & nDont )
+ if ( bSetStandardName || ( nOldFiltFlags & nMust ) != nMust || bool(nOldFiltFlags & nDont) )
{
// the suggested type will be changed, the extension should be adjusted
aAdjustToType = aPreselectedFilterPropsHM.getUnpackedValueOrDefault(
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 98bf20deb44e..03b4e3a10bc7 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -286,7 +286,7 @@ bool SfxObjectShell::APISaveAs_Impl
SFX_ITEMSET_ARG( aParams, pContentTypeItem, SfxStringItem, SID_CONTENTTYPE, false );
if ( pContentTypeItem )
{
- const SfxFilter* pFilter = SfxFilterMatcher( OUString::createFromAscii(GetFactory().GetShortName()) ).GetFilter4Mime( pContentTypeItem->GetValue(), SFX_FILTER_EXPORT );
+ const SfxFilter* pFilter = SfxFilterMatcher( OUString::createFromAscii(GetFactory().GetShortName()) ).GetFilter4Mime( pContentTypeItem->GetValue(), SfxFilterFlags::EXPORT );
if ( pFilter )
aFilterName = pFilter->GetName();
}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 2129913c5137..55f73c05d01e 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -669,14 +669,14 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
if ( nError != ERRCODE_NONE )
SetError( nError, OUString( OSL_LOG_PREFIX ) );
- if (pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_STARTPRESENTATION)
+ if (pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARTPRESENTATION)
pSet->Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, true) );
}
EnableSetModified( false );
pMedium->LockOrigFileOnDemand( true, false );
- if ( GetError() == ERRCODE_NONE && bOwnStorageFormat && ( !pFilter || !( pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) ) )
+ if ( GetError() == ERRCODE_NONE && bOwnStorageFormat && ( !pFilter || !( pFilter->GetFilterFlags() & SfxFilterFlags::STARONEFILTER ) ) )
{
uno::Reference< embed::XStorage > xStorage;
if ( pMedium->GetError() == ERRCODE_NONE )
@@ -750,7 +750,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
{
pImp->nLoadedFlags = 0;
pImp->bModelInitialized = false;
- if ( pMedium->GetFilter() && ( pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) )
+ if ( pMedium->GetFilter() && ( pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER ) )
{
uno::Reference < beans::XPropertySet > xSet( GetModel(), uno::UNO_QUERY );
OUString sLockUpdates("LockUpdates");
@@ -1130,7 +1130,7 @@ bool SfxObjectShell::SaveTo_Impl
// if no filter was set, use the default filter
// this should be changed in the feature, it should be an error!
SAL_WARN( "sfx.doc","No filter set!");
- pFilter = GetFactory().GetFilterContainer()->GetAnyFilter( SFX_FILTER_IMPORT | SFX_FILTER_EXPORT );
+ pFilter = GetFactory().GetFilterContainer()->GetAnyFilter( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT );
rMedium.SetFilter(pFilter);
}
@@ -1385,7 +1385,7 @@ bool SfxObjectShell::SaveTo_Impl
bool bOk = false;
// TODO/LATER: get rid of bOk
- if (bOwnTarget && pFilter && !(pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER))
+ if (bOwnTarget && pFilter && !(pFilter->GetFilterFlags() & SfxFilterFlags::STARONEFILTER))
{
AddLog( OUString( OSL_LOG_PREFIX "Storing in own format." ) );
uno::Reference< embed::XStorage > xMedStorage = rMedium.GetStorage();
@@ -1554,7 +1554,7 @@ bool SfxObjectShell::SaveTo_Impl
{
AddLog( OUString( OSL_LOG_PREFIX "Storing in alien format." ) );
// it's a "SaveAs" in an alien format
- if ( rMedium.GetFilter() && ( rMedium.GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) )
+ if ( rMedium.GetFilter() && ( rMedium.GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER ) )
bOk = ExportTo( rMedium );
else
bOk = ConvertTo( rMedium );
@@ -2129,13 +2129,13 @@ bool SfxObjectShell::ConvertFrom
/* [Description]
This method is called for loading of documents over all filters which are
- not SFX_FILTER_OWN or for which no clipboard format has been registered
+ not SfxFilterFlags::OWN or for which no clipboard format has been registered
(thus no storage format that is used). In other words, with this method
it is imported.
Files which are to be opened here should be opened through 'rMedium'
to guarantee the right open modes. Especially if the format is retained
- (only possible with SFX_FILTER_SIMULATE or SFX_FILTER_ONW) file which must
+ (only possible with SfxFilterFlags::SIMULATE or SfxFilterFlags::ONW) file which must
be opened STREAM_SHARE_DENYWRITE.
[Return value]
@@ -2167,7 +2167,7 @@ bool SfxObjectShell::ConvertFrom
[Cross-references]
<SfxObjectShell::ConvertTo(SfxMedium&)>
- <SFX_FILTER_REGISTRATION>
+ <SfxFilterFlags::REGISTRATION>
*/
{
return false;
@@ -2433,13 +2433,13 @@ bool SfxObjectShell::ConvertTo
/* [Description]
This method is called for saving of documents over all filters which are
- not SFX_FILTER_OWN or for which no clipboard format has been registered
+ not SfxFilterFlags::OWN or for which no clipboard format has been registered
(thus no storage format that is used). In other words, with this method
it is exported.
Files which are to be opened here should be opened through 'rMedium'
to guarantee the right open modes. Especially if the format is retained
- (only possible with SFX_FILTER_SIMULATE or SFX_FILTER_ONW) file which must
+ (only possible with SfxFilterFlags::SIMULATE or SfxFilterFlags::ONW) file which must
be opened STREAM_SHARE_DENYWRITE.
[Return value]
@@ -2471,7 +2471,7 @@ bool SfxObjectShell::ConvertTo
[Cross-references]
<SfxObjectShell::ConvertFrom(SfxMedium&)>
- <SFX_FILTER_REGISTRATION>
+ <SfxFilterFlags::REGISTRATION>
*/
{
@@ -2806,7 +2806,7 @@ bool SfxObjectShell::PreDoSaveAs_Impl
if ( !aFilterName.isEmpty() )
pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName ) );
else
- pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetAnyFilter( SFX_FILTER_IMPORT | SFX_FILTER_EXPORT ) );
+ pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetAnyFilter( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT ) );
if ( pNewFile->GetErrorCode() != ERRCODE_NONE )
{