summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx113
1 files changed, 58 insertions, 55 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index e4ce4a985098..865d00e5b6ce 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -508,7 +508,7 @@ Reference< XText > SwXTextDocument::getText()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!xBodyText.is())
{
pBodyText = new SwXBodyText(pDocShell->GetDoc());
@@ -521,7 +521,7 @@ void SwXTextDocument::reformat()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
}
void SwXTextDocument::lockControllers()
@@ -533,7 +533,7 @@ void SwXTextDocument::lockControllers()
aActionArr.push_front(pContext);
}
else
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
}
void SwXTextDocument::unlockControllers()
@@ -546,7 +546,7 @@ void SwXTextDocument::unlockControllers()
delete pContext;
}
else
- throw RuntimeException();
+ throw RuntimeException("Nothing to unlock");
}
sal_Bool SwXTextDocument::hasControllersLocked()
@@ -644,7 +644,7 @@ Reference< XPropertySet > SwXTextDocument::getLineNumberingProperties()
}
}
else
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
return mxXLineNumberingProperties;
}
@@ -652,7 +652,7 @@ Reference< XIndexReplace > SwXTextDocument::getChapterNumberingRules()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXChapterNumbering.is())
{
mxXChapterNumbering = new SwXChapterNumbering(*pDocShell);
@@ -664,7 +664,7 @@ Reference< XIndexAccess > SwXTextDocument::getNumberingRules()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXNumberingRules.is() )
{
mxXNumberingRules = new SwXNumberingRulesCollection( pDocShell->GetDoc() );
@@ -676,7 +676,7 @@ Reference< XIndexAccess > SwXTextDocument::getFootnotes()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXFootnotes.is())
{
mxXFootnotes = new SwXFootnotes(false, pDocShell->GetDoc());
@@ -689,7 +689,7 @@ Reference< XPropertySet > SAL_CALL
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXFootnoteSettings.is())
{
mxXFootnoteSettings = new SwXFootnoteProperties(pDocShell->GetDoc());
@@ -701,7 +701,7 @@ Reference< XIndexAccess > SwXTextDocument::getEndnotes()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXEndnotes.is())
{
mxXEndnotes = new SwXFootnotes(true, pDocShell->GetDoc());
@@ -713,7 +713,7 @@ Reference< XPropertySet > SwXTextDocument::getEndnoteSettings()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXEndnoteSettings.is())
{
mxXEndnoteSettings = new SwXEndnoteProperties(pDocShell->GetDoc());
@@ -746,7 +746,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
SolarMutexGuard aGuard;
Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY_THROW);
if(!IsValid() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()))
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
Reference< XTextCursor > xCursor;
auto pUnoCursor(CreateCursorForSearch(xCursor));
@@ -949,7 +949,7 @@ Reference< XIndexAccess >
Reference< XTextCursor > xCursor;
auto pResultCursor(FindAny(xDesc, xCursor, true, nResult, xTmp));
if(!pResultCursor)
- throw RuntimeException();
+ throw RuntimeException("No result cursor");
Reference< XIndexAccess > xRet;
xRet = SwXTextRanges::Create( (nResult) ? &(*pResultCursor) : nullptr );
return xRet;
@@ -963,7 +963,7 @@ Reference< XInterface > SwXTextDocument::findFirst(const Reference< util::XSear
Reference< XTextCursor > xCursor;
auto pResultCursor(FindAny(xDesc, xCursor, false, nResult, xTmp));
if(!pResultCursor)
- throw RuntimeException();
+ throw RuntimeException("No result cursor");
Reference< XInterface > xRet;
if(nResult)
{
@@ -982,10 +982,10 @@ Reference< XInterface > SwXTextDocument::findNext(const Reference< XInterface >
sal_Int32 nResult = 0;
Reference< XTextCursor > xCursor;
if(!xStartAt.is())
- throw RuntimeException();
+ throw RuntimeException("xStartAt missing");
auto pResultCursor(FindAny(xDesc, xCursor, false, nResult, xStartAt));
if(!pResultCursor)
- throw RuntimeException();
+ throw RuntimeException("No result cursor");
Reference< XInterface > xRet;
if(nResult)
{
@@ -1030,7 +1030,7 @@ Sequence< beans::PropertyValue > SwXTextDocument::getPagePrintSettings()
pArray[8] = beans::PropertyValue("IsLandscape", -1, aVal, PropertyState_DIRECT_VALUE);
}
else
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
return aSeq;
}
@@ -1096,13 +1096,13 @@ void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue
if( sName == "PageRows" )
{
if(!nVal || nVal > 0xff)
- throw RuntimeException();
+ throw RuntimeException("Invalid value");
aData.SetRow((sal_uInt8)nVal);
}
else if(sName == "PageColumns")
{
if(!nVal || nVal > 0xff)
- throw RuntimeException();
+ throw RuntimeException("Invalid value");
aData.SetCol((sal_uInt8)nVal);
}
else if(sName == "LeftMargin")
@@ -1146,7 +1146,7 @@ void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue
pDocShell->GetDoc()->SetPreviewPrtData(&aData);
}
else
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
}
void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOptions)
@@ -1226,14 +1226,14 @@ void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOption
}
else
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
}
Reference< XNameAccess > SwXTextDocument::getReferenceMarks()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXReferenceMarks.is())
{
mxXReferenceMarks = new SwXReferenceMarks(pDocShell->GetDoc());
@@ -1245,7 +1245,7 @@ Reference< XEnumerationAccess > SwXTextDocument::getTextFields()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXTextFieldTypes.is())
{
mxXTextFieldTypes = new SwXTextFieldTypes(pDocShell->GetDoc());
@@ -1257,7 +1257,7 @@ Reference< XNameAccess > SwXTextDocument::getTextFieldMasters()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXTextFieldMasters.is())
{
mxXTextFieldMasters = new SwXTextFieldMasters(pDocShell->GetDoc());
@@ -1269,7 +1269,7 @@ Reference< XNameAccess > SwXTextDocument::getEmbeddedObjects()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXEmbeddedObjects.is())
{
mxXEmbeddedObjects = new SwXTextEmbeddedObjects(pDocShell->GetDoc());
@@ -1281,7 +1281,7 @@ Reference< XNameAccess > SwXTextDocument::getBookmarks()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXBookmarks.is())
{
mxXBookmarks = new SwXBookmarks(pDocShell->GetDoc());
@@ -1293,7 +1293,7 @@ Reference< XNameAccess > SwXTextDocument::getTextSections()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXTextSections.is())
{
mxXTextSections = new SwXTextSections(pDocShell->GetDoc());
@@ -1305,7 +1305,7 @@ Reference< XNameAccess > SwXTextDocument::getTextTables()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXTextTables.is())
{
mxXTextTables = new SwXTextTables(pDocShell->GetDoc());
@@ -1317,7 +1317,7 @@ Reference< XNameAccess > SwXTextDocument::getGraphicObjects()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXGraphicObjects.is())
{
mxXGraphicObjects = new SwXTextGraphicObjects(pDocShell->GetDoc());
@@ -1329,7 +1329,7 @@ Reference< XNameAccess > SwXTextDocument::getTextFrames()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXTextFrames.is())
{
mxXTextFrames = new SwXTextFrames(pDocShell->GetDoc());
@@ -1341,7 +1341,7 @@ Reference< XNameAccess > SwXTextDocument::getStyleFamilies()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXStyleFamilies.is())
{
mxXStyleFamilies = new SwXStyleFamilies(*pDocShell);
@@ -1353,7 +1353,7 @@ uno::Reference< style::XAutoStyles > SwXTextDocument::getAutoStyles( )
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXAutoStyles.is())
{
mxXAutoStyles = new SwXAutoStyles(*pDocShell);
@@ -1366,7 +1366,7 @@ Reference< drawing::XDrawPage > SwXTextDocument::getDrawPage()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
if(!mxXDrawPage.is())
{
pDrawPage = new SwXDrawPage(pDocShell->GetDoc());
@@ -1602,9 +1602,8 @@ css::uno::Reference<css::uno::XInterface> SwXTextDocument::create(
{
SolarMutexGuard aGuard;
if (!IsValid())
- {
- throw RuntimeException();
- }
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
const SwServiceType nType = SwXServiceProvider::GetProviderType(rServiceName);
if (nType != SwServiceType::Invalid)
{
@@ -1772,7 +1771,8 @@ Reference< XIndexAccess > SwXTextDocument::getDocumentIndexes()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
if(!mxXDocumentIndexes.is())
{
mxXDocumentIndexes = new SwXDocumentIndexes(pDocShell->GetDoc());
@@ -1790,10 +1790,8 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException(
- "invalid SwXTextDocument",
- static_cast< cppu::OWeakObject * >(
- static_cast< SwXTextDocumentBaseClass * >(this)));
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap().getByName( rPropertyName);
if(!pEntry)
@@ -1969,7 +1967,8 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap().getByName( rPropertyName);
if(!pEntry)
@@ -2172,7 +2171,8 @@ void SwXTextDocument::refresh()
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
SwViewShell *pViewShell = pDocShell->GetWrtShell();
NotifyRefreshListeners();
if(pViewShell)
@@ -2197,7 +2197,8 @@ void SwXTextDocument::updateLinks( )
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
SwDoc* pDoc = pDocShell->GetDoc();
sfx2::LinkManager& rLnkMan = pDoc->getIDocumentLinksAdministration().GetLinkManager();
if( !rLnkMan.GetLinks().empty() )
@@ -2212,7 +2213,8 @@ PropertyState SAL_CALL SwXTextDocument::getPropertyState( const OUString& rPrope
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap().getByName( rPropertyName);
if(!pEntry)
throw UnknownPropertyException();
@@ -2236,7 +2238,8 @@ void SAL_CALL SwXTextDocument::setPropertyToDefault( const OUString& rPropertyNa
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap().getByName( rPropertyName);
if(!pEntry)
throw UnknownPropertyException();
@@ -2250,7 +2253,8 @@ Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
+
const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap().getByName( rPropertyName);
if(!pEntry)
throw UnknownPropertyException();
@@ -2618,8 +2622,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
SolarMutexGuard aGuard;
if(!IsValid())
{
- throw DisposedException( OUString(),
- static_cast< XTextDocument* >(this) );
+ throw DisposedException("", static_cast< XTextDocument* >(this));
}
const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
@@ -3060,7 +3063,7 @@ uno::Reference< util::XCloneable > SwXTextDocument::createClone( )
{
SolarMutexGuard aGuard;
if(!IsValid())
- throw RuntimeException();
+ throw DisposedException("", static_cast< XTextDocument* >(this));
// create a new document - hidden - copy the storage and return it
// SfxObjectShellRef is used here, since the model should control object lifetime after creation
@@ -3864,7 +3867,7 @@ Any SwXLinkTargetSupplier::getByName(const OUString& rName)
{
Any aRet;
if(!pxDoc)
- throw RuntimeException();
+ throw RuntimeException("No document available");
OUString sSuffix("|");
if(rName == sTables)
{
@@ -4015,7 +4018,7 @@ Any SwXLinkNameAccessWrapper::getByName(const OUString& rName)
{
sParam = sParam.copy(0, sParam.getLength() - sSuffix.getLength());
if(!pxDoc->GetDocShell())
- throw RuntimeException();
+ throw RuntimeException("No document shell available");
SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
const size_t nOutlineCount = pDoc->GetNodes().GetOutLineNds().size();
@@ -4036,7 +4039,7 @@ Any SwXLinkNameAccessWrapper::getByName(const OUString& rName)
aRet = xRealAccess->getByName(sParam.copy(0, sParam.getLength() - sSuffix.getLength()));
Reference< XInterface > xInt;
if(!(aRet >>= xInt))
- throw RuntimeException();
+ throw RuntimeException("Could not retrieve property");
Reference< XPropertySet > xProp(xInt, UNO_QUERY);
aRet <<= xProp;
bFound = true;
@@ -4054,7 +4057,7 @@ Sequence< OUString > SwXLinkNameAccessWrapper::getElementNames()
if(pxDoc)
{
if(!pxDoc->GetDocShell())
- throw RuntimeException();
+ throw RuntimeException("No document shell available");
SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds();
@@ -4097,7 +4100,7 @@ sal_Bool SwXLinkNameAccessWrapper::hasByName(const OUString& rName)
if(pxDoc)
{
if(!pxDoc->GetDocShell())
- throw RuntimeException();
+ throw RuntimeException("No document shell available");
SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
const size_t nOutlineCount = pDoc->GetNodes().GetOutLineNds().size();