summaryrefslogtreecommitdiff
path: root/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx')
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx38
1 files changed, 21 insertions, 17 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 94c28ecc4d53..d9abbb9c0fd8 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -51,6 +51,7 @@
#include <svx/unoshape.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <vcl/svapp.hxx>
+#include <sfx2/docfile.hxx>
#include <comphelper/servicehelper.hxx>
#include <vector>
@@ -1699,28 +1700,31 @@ ScShapeChildren* ScAccessibleDocumentPagePreview::GetShapeChildren()
OUString ScAccessibleDocumentPagePreview::getAccessibleName(void)
throw (::com::sun::star::uno::RuntimeException)
{
- OUString sName = ScResId(STR_ACC_DOC_SPREADSHEET);
+ OUString aName = ScResId(STR_ACC_DOC_SPREADSHEET);
ScDocument* pScDoc = mpViewShell->GetDocument();
- if ( pScDoc )
+ if (!pScDoc)
+ return aName;
+
+ SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
+ if (!pObjSh)
+ return aName;
+
+ OUString aFileName;
+ SfxMedium* pMed = pObjSh->GetMedium();
+ if (pMed)
+ aFileName = pMed->GetName();
+
+ if (aFileName.isEmpty())
+ aFileName = pObjSh->GetTitle(SFX_TITLE_APINAME);
+
+ if (!aFileName.isEmpty())
{
- OUString sFileName = pScDoc->getDocAccTitle();
- if ( !sFileName.getLength() )
- {
- SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
- if ( pObjSh )
- {
- sFileName = pObjSh->GetTitle( SFX_TITLE_APINAME );
- }
- }
- if ( sFileName.getLength() )
- {
- sName = sFileName + " - " + sName;
- sName += ScResId(STR_ACC_DOC_PREVIEW_SUFFIX);
+ aName = aFileName + " - " + aName;
+ aName += ScResId(STR_ACC_DOC_PREVIEW_SUFFIX);
- }
}
- return sName;
+ return aName;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */