summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx11
-rw-r--r--sfx2/source/dialog/documentfontsdialog.cxx41
-rw-r--r--sfx2/source/doc/DocumentSigner.cxx9
-rw-r--r--sfx2/source/doc/docfile.cxx15
-rw-r--r--sfx2/source/doc/doctemplates.cxx13
-rw-r--r--sfx2/source/doc/guisaveas.cxx24
-rw-r--r--sfx2/source/doc/objserv.cxx5
-rw-r--r--sfx2/source/doc/objstor.cxx46
8 files changed, 99 insertions, 65 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 537206b3f98c..d752920ac490 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1294,10 +1294,13 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet )
{
try
{
- uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xFac->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY_THROW );
-
- xProps->getPropertyValue(u"ImagePreferredDPI"_ustr) >>= nImagePreferredDPI;
+ uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY );
+ if (xFac)
+ {
+ uno::Reference< beans::XPropertySet > xProps( xFac->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY );
+ if (xProps)
+ xProps->getPropertyValue(u"ImagePreferredDPI"_ustr) >>= nImagePreferredDPI;
+ }
}
catch( uno::Exception& )
{
diff --git a/sfx2/source/dialog/documentfontsdialog.cxx b/sfx2/source/dialog/documentfontsdialog.cxx
index 281baf5278ed..73918ca059d8 100644
--- a/sfx2/source/dialog/documentfontsdialog.cxx
+++ b/sfx2/source/dialog/documentfontsdialog.cxx
@@ -60,14 +60,19 @@ void SfxDocumentFontsPage::Reset( const SfxItemSet* )
{
try
{
- uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xFac->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY_THROW );
-
- xProps->getPropertyValue(u"EmbedFonts"_ustr) >>= bEmbedFonts;
- xProps->getPropertyValue(u"EmbedOnlyUsedFonts"_ustr) >>= bEmbedUsedFonts;
- xProps->getPropertyValue(u"EmbedLatinScriptFonts"_ustr) >>= bEmbedLatinScriptFonts;
- xProps->getPropertyValue(u"EmbedAsianScriptFonts"_ustr) >>= bEmbedAsianScriptFonts;
- xProps->getPropertyValue(u"EmbedComplexScriptFonts"_ustr) >>= bEmbedComplexScriptFonts;
+ uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY );
+ if (xFac)
+ {
+ uno::Reference< beans::XPropertySet > xProps( xFac->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY);
+ if (xProps)
+ {
+ xProps->getPropertyValue(u"EmbedFonts"_ustr) >>= bEmbedFonts;
+ xProps->getPropertyValue(u"EmbedOnlyUsedFonts"_ustr) >>= bEmbedUsedFonts;
+ xProps->getPropertyValue(u"EmbedLatinScriptFonts"_ustr) >>= bEmbedLatinScriptFonts;
+ xProps->getPropertyValue(u"EmbedAsianScriptFonts"_ustr) >>= bEmbedAsianScriptFonts;
+ xProps->getPropertyValue(u"EmbedComplexScriptFonts"_ustr) >>= bEmbedComplexScriptFonts;
+ }
+ }
}
catch( uno::Exception& )
{
@@ -95,13 +100,19 @@ bool SfxDocumentFontsPage::FillItemSet( SfxItemSet* )
{
try
{
- uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xFac->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY_THROW );
- xProps->setPropertyValue(u"EmbedFonts"_ustr, uno::Any(bEmbedFonts));
- xProps->setPropertyValue(u"EmbedOnlyUsedFonts"_ustr, uno::Any(bEmbedUsedFonts));
- xProps->setPropertyValue(u"EmbedLatinScriptFonts"_ustr, uno::Any(bEmbedLatinScriptFonts));
- xProps->setPropertyValue(u"EmbedAsianScriptFonts"_ustr, uno::Any(bEmbedAsianScriptFonts));
- xProps->setPropertyValue(u"EmbedComplexScriptFonts"_ustr, uno::Any(bEmbedComplexScriptFonts));
+ uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY );
+ if (xFac)
+ {
+ uno::Reference< beans::XPropertySet > xProps( xFac->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY );
+ if (xProps)
+ {
+ xProps->setPropertyValue(u"EmbedFonts"_ustr, uno::Any(bEmbedFonts));
+ xProps->setPropertyValue(u"EmbedOnlyUsedFonts"_ustr, uno::Any(bEmbedUsedFonts));
+ xProps->setPropertyValue(u"EmbedLatinScriptFonts"_ustr, uno::Any(bEmbedLatinScriptFonts));
+ xProps->setPropertyValue(u"EmbedAsianScriptFonts"_ustr, uno::Any(bEmbedAsianScriptFonts));
+ xProps->setPropertyValue(u"EmbedComplexScriptFonts"_ustr, uno::Any(bEmbedComplexScriptFonts));
+ }
+ }
}
catch( uno::Exception& )
{
diff --git a/sfx2/source/doc/DocumentSigner.cxx b/sfx2/source/doc/DocumentSigner.cxx
index 88dd7c3c3570..ae2db667ca75 100644
--- a/sfx2/source/doc/DocumentSigner.cxx
+++ b/sfx2/source/doc/DocumentSigner.cxx
@@ -98,9 +98,12 @@ bool DocumentSigner::signDocument(uno::Reference<security::XCertificate> const&
if (bSuccess)
{
uno::Reference<embed::XTransactedObject> xTransact(xWriteableZipStore,
- uno::UNO_QUERY_THROW);
- xTransact->commit();
- bResult = true;
+ uno::UNO_QUERY);
+ if (xTransact)
+ {
+ xTransact->commit();
+ bResult = true;
+ }
}
}
else
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 1674a41131df..c9631f64cbde 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -4676,12 +4676,15 @@ bool SfxMedium::SwitchDocumentToFile( const OUString& aURL )
{
try
{
- uno::Reference< io::XTruncate > xTruncate( pImpl->xStream, uno::UNO_QUERY_THROW );
- xTruncate->truncate();
- if ( xOptStorage.is() )
- xOptStorage->writeAndAttachToStream( pImpl->xStream );
- pImpl->xStorage = xStorage;
- bResult = true;
+ uno::Reference< io::XTruncate > xTruncate( pImpl->xStream, uno::UNO_QUERY );
+ if (xTruncate)
+ {
+ xTruncate->truncate();
+ if ( xOptStorage.is() )
+ xOptStorage->writeAndAttachToStream( pImpl->xStream );
+ pImpl->xStorage = xStorage;
+ bResult = true;
+ }
}
catch( const uno::Exception& )
{}
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 82826eb4c711..b5926871954e 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -674,11 +674,14 @@ void SfxDocTplService::getTitleFromURL( const OUString& rURL, OUString& aTitle,
if ( !aDocType.isEmpty() )
try
{
- uno::Reference< container::XNameAccess > xTypeDetection( mxType, uno::UNO_QUERY_THROW );
- SequenceAsHashMap aTypeProps( xTypeDetection->getByName( aDocType ) );
- aType = aTypeProps.getUnpackedValueOrDefault(
- u"MediaType"_ustr,
- OUString() );
+ uno::Reference< container::XNameAccess > xTypeDetection( mxType, uno::UNO_QUERY );
+ if (xTypeDetection)
+ {
+ SequenceAsHashMap aTypeProps( xTypeDetection->getByName( aDocType ) );
+ aType = aTypeProps.getUnpackedValueOrDefault(
+ u"MediaType"_ustr,
+ OUString() );
+ }
}
catch( uno::Exception& )
{}
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index bcbd7679bef5..8688abd73117 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -225,20 +225,20 @@ public:
{
try
{
- uno::Reference< lang::XMultiServiceFactory > xDocSettingsSupplier( xModel, uno::UNO_QUERY_THROW );
- m_xDocumentSettings.set(
- xDocSettingsSupplier->createInstance( u"com.sun.star.document.Settings"_ustr ),
- uno::UNO_QUERY_THROW );
-
- try
+ uno::Reference< lang::XMultiServiceFactory > xDocSettingsSupplier( xModel, uno::UNO_QUERY );
+ if (xModel)
{
- OUString aLoadReadonlyString( u"LoadReadonly"_ustr );
- m_xDocumentSettings->getPropertyValue( aLoadReadonlyString ) >>= m_bPreserveReadOnly;
- m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::Any( bReadOnly ) );
- m_bReadOnlySupported = true;
+ m_xDocumentSettings.set(
+ xDocSettingsSupplier->createInstance( u"com.sun.star.document.Settings"_ustr ),
+ uno::UNO_QUERY );
+ if (m_xDocumentSettings)
+ {
+ OUString aLoadReadonlyString( u"LoadReadonly"_ustr );
+ m_xDocumentSettings->getPropertyValue( aLoadReadonlyString ) >>= m_bPreserveReadOnly;
+ m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::Any( bReadOnly ) );
+ m_bReadOnlySupported = true;
+ }
}
- catch( const uno::Exception& )
- {}
}
catch( const uno::Exception& )
{}
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 26301eb1cb6d..ab43f0482492 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1839,8 +1839,9 @@ uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::GetDocum
OUString aVersion;
try
{
- uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
- xPropSet->getPropertyValue(u"Version"_ustr) >>= aVersion;
+ uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY );
+ if (xPropSet)
+ xPropSet->getPropertyValue(u"Version"_ustr) >>= aVersion;
}
catch( uno::Exception& )
{
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index fefea8c2969a..fe00764a6bee 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1532,8 +1532,9 @@ bool SfxObjectShell::SaveTo_Impl
OUString aODFVersion;
try
{
- uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
- xPropSet->getPropertyValue(u"Version"_ustr) >>= aODFVersion;
+ uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY );
+ if (xPropSet)
+ xPropSet->getPropertyValue(u"Version"_ustr) >>= aODFVersion;
}
catch( uno::Exception& )
{}
@@ -1769,9 +1770,10 @@ bool SfxObjectShell::SaveTo_Impl
try
{
- uno::Reference< beans::XPropertySet > xProps( rMedium.GetStorage(), uno::UNO_QUERY_THROW );
- xProps->setPropertyValue(u"MediaType"_ustr,
- uno::Any( aDataFlavor.MimeType ) );
+ uno::Reference< beans::XPropertySet > xProps( rMedium.GetStorage(), uno::UNO_QUERY );
+ if (xProps)
+ xProps->setPropertyValue(u"MediaType"_ustr,
+ uno::Any( aDataFlavor.MimeType ) );
}
catch( uno::Exception& )
{
@@ -1975,8 +1977,9 @@ bool SfxObjectShell::SaveTo_Impl
OUString aVersion;
try
{
- uno::Reference < beans::XPropertySet > xPropSet( rMedium.GetStorage(), uno::UNO_QUERY_THROW );
- xPropSet->getPropertyValue(u"Version"_ustr) >>= aVersion;
+ uno::Reference < beans::XPropertySet > xPropSet( rMedium.GetStorage(), uno::UNO_QUERY );
+ if (xPropSet)
+ xPropSet->getPropertyValue(u"Version"_ustr) >>= aVersion;
}
catch( uno::Exception& )
{
@@ -2289,15 +2292,17 @@ bool SfxObjectShell::ConnectTmpStorage_Impl(
// Get rid of this workaround after issue i113914 is fixed
try
{
- uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImpl->xBasicLibraries, uno::UNO_QUERY_THROW );
- xBasicLibraries->setRootStorage( xTmpStorage );
+ uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImpl->xBasicLibraries, uno::UNO_QUERY );
+ if (xBasicLibraries)
+ xBasicLibraries->setRootStorage( xTmpStorage );
}
catch( uno::Exception& )
{}
try
{
- uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImpl->xDialogLibraries, uno::UNO_QUERY_THROW );
- xDialogLibraries->setRootStorage( xTmpStorage );
+ uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImpl->xDialogLibraries, uno::UNO_QUERY );
+ if (xDialogLibraries)
+ xDialogLibraries->setRootStorage( xTmpStorage );
}
catch( uno::Exception& )
{}
@@ -2453,15 +2458,17 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed, bool bRegisterRecent )
// Get rid of this workaround after issue i113914 is fixed
try
{
- uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImpl->xBasicLibraries, uno::UNO_QUERY_THROW );
- xBasicLibraries->setRootStorage( xStorage );
+ uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImpl->xBasicLibraries, uno::UNO_QUERY );
+ if (xBasicLibraries)
+ xBasicLibraries->setRootStorage( xStorage );
}
catch( uno::Exception& )
{}
try
{
- uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImpl->xDialogLibraries, uno::UNO_QUERY_THROW );
- xDialogLibraries->setRootStorage( xStorage );
+ uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImpl->xDialogLibraries, uno::UNO_QUERY );
+ if (xDialogLibraries)
+ xDialogLibraries->setRootStorage( xStorage );
}
catch( uno::Exception& )
{}
@@ -4137,9 +4144,12 @@ bool SfxObjectShell::GenerateAndStoreThumbnail(bool bEncrypted, const uno::Refer
if (xStream.is() && WriteThumbnail(bEncrypted, xStream))
{
- uno::Reference<embed::XTransactedObject> xTransactedObject(xThumbnailStorage, uno::UNO_QUERY_THROW);
- xTransactedObject->commit();
- bResult = true;
+ uno::Reference<embed::XTransactedObject> xTransactedObject(xThumbnailStorage, uno::UNO_QUERY);
+ if (xTransactedObject)
+ {
+ xTransactedObject->commit();
+ bResult = true;
+ }
}
}
}