diff options
Diffstat (limited to 'sc/source/ui/Accessibility/AccessibleDocument.cxx')
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleDocument.cxx | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 47a5177c9b39..993da134ce57 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -69,6 +69,7 @@ #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <sfx2/viewfrm.hxx> +#include <sfx2/docfile.hxx> #include <svx/unoshcol.hxx> #include <svx/unoshape.hxx> #include <unotools/accessiblerelationsethelper.hxx> @@ -1859,30 +1860,33 @@ OUString SAL_CALL ScAccessibleDocument::getAccessibleName(void) throw (::com::sun::star::uno::RuntimeException) { - OUString sName = ScResId(STR_ACC_DOC_SPREADSHEET); + OUString aName = ScResId(STR_ACC_DOC_SPREADSHEET); ScDocument* pScDoc = 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 ); - } - } - OUString sReadOnly; - if (pScDoc->getDocReadOnly()) - { - sReadOnly = ScResId(STR_ACC_DOC_SPREADSHEET_READONLY); - } - if ( sFileName.getLength() ) - { - sName = sFileName + sReadOnly + " - " + sName; - } + OUString aReadOnly; + if (pObjSh->IsReadOnly()) + aReadOnly = ScResId(STR_ACC_DOC_SPREADSHEET_READONLY); + + aName = aFileName + aReadOnly + " - " + aName; } - return sName; + return aName; } ///===== XAccessibleSelection =========================================== |