summaryrefslogtreecommitdiff
path: root/sc/source/ui/Accessibility/AccessibleDocument.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-01-06 12:45:43 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-01-06 12:47:24 -0500
commitb4ea08def28a510212f4de355b384e8542c014d4 (patch)
treecee06017a26a862cf293230995088afebfccbc06 /sc/source/ui/Accessibility/AccessibleDocument.cxx
parent45c537a1185dfca7e51229dde9e9220e5174bd57 (diff)
Try not to use ScDocument as a "anything can go in" storage place.
There are things that shouldn't be stored in ScDocument believe it or not. Change-Id: I6a06327549851fae0fdc0defbc716285d8456aa2
Diffstat (limited to 'sc/source/ui/Accessibility/AccessibleDocument.cxx')
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx46
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 ===========================================