Kaydet (Commit) b4ea08de authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst 45c537a1
...@@ -443,18 +443,7 @@ private: ...@@ -443,18 +443,7 @@ private:
bool mbUseEmbedFonts; bool mbUseEmbedFonts;
OUString msDocAccTitle;
public:
void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
const OUString getDocAccTitle() const { return msDocAccTitle; }
private:
bool mbReadOnly;
public: public:
void setDocReadOnly(bool b){ mbReadOnly = b; }
bool getDocReadOnly() const { return mbReadOnly; }
sal_Bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder); sal_Bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder);
void GetCellChangeTrackNote(const ScAddress &cell, OUString &strTrackText, sal_Bool &pbLeftEdge); void GetCellChangeTrackNote(const ScAddress &cell, OUString &strTrackText, sal_Bool &pbLeftEdge);
bool IsUsingEmbededFonts() { return mbUseEmbedFonts; } bool IsUsingEmbededFonts() { return mbUseEmbedFonts; }
......
...@@ -220,8 +220,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : ...@@ -220,8 +220,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
mbStreamValidLocked( false ), mbStreamValidLocked( false ),
mbUserInteractionEnabled(true), mbUserInteractionEnabled(true),
mnNamedRangesLockCount(0), mnNamedRangesLockCount(0),
mbUseEmbedFonts(false), mbUseEmbedFonts(false)
mbReadOnly(false)
{ {
SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT); SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT);
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <comphelper/sequence.hxx> #include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <sfx2/docfile.hxx>
#include <svx/unoshcol.hxx> #include <svx/unoshcol.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <unotools/accessiblerelationsethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx>
...@@ -1859,30 +1860,33 @@ OUString SAL_CALL ...@@ -1859,30 +1860,33 @@ OUString SAL_CALL
ScAccessibleDocument::getAccessibleName(void) ScAccessibleDocument::getAccessibleName(void)
throw (::com::sun::star::uno::RuntimeException) throw (::com::sun::star::uno::RuntimeException)
{ {
OUString sName = ScResId(STR_ACC_DOC_SPREADSHEET); OUString aName = ScResId(STR_ACC_DOC_SPREADSHEET);
ScDocument* pScDoc = GetDocument(); 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(); OUString aReadOnly;
if ( !sFileName.getLength() ) if (pObjSh->IsReadOnly())
{ aReadOnly = ScResId(STR_ACC_DOC_SPREADSHEET_READONLY);
SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
if ( pObjSh ) aName = aFileName + aReadOnly + " - " + aName;
{
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;
}
} }
return sName; return aName;
} }
///===== XAccessibleSelection =========================================== ///===== XAccessibleSelection ===========================================
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <unotools/accessiblerelationsethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <sfx2/docfile.hxx>
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include <vector> #include <vector>
...@@ -1699,28 +1700,31 @@ ScShapeChildren* ScAccessibleDocumentPagePreview::GetShapeChildren() ...@@ -1699,28 +1700,31 @@ ScShapeChildren* ScAccessibleDocumentPagePreview::GetShapeChildren()
OUString ScAccessibleDocumentPagePreview::getAccessibleName(void) OUString ScAccessibleDocumentPagePreview::getAccessibleName(void)
throw (::com::sun::star::uno::RuntimeException) throw (::com::sun::star::uno::RuntimeException)
{ {
OUString sName = ScResId(STR_ACC_DOC_SPREADSHEET); OUString aName = ScResId(STR_ACC_DOC_SPREADSHEET);
ScDocument* pScDoc = mpViewShell->GetDocument(); 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(); aName = aFileName + " - " + aName;
if ( !sFileName.getLength() ) aName += ScResId(STR_ACC_DOC_PREVIEW_SUFFIX);
{
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);
}
} }
return sName; return aName;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -1606,7 +1606,6 @@ sal_Bool ScDocShell::Save() ...@@ -1606,7 +1606,6 @@ sal_Bool ScDocShell::Save()
PrepareSaveGuard aPrepareGuard( *this); PrepareSaveGuard aPrepareGuard( *this);
aDocument.setDocAccTitle(OUString());
SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this ); SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
if (pFrame1) if (pFrame1)
{ {
......
...@@ -423,11 +423,6 @@ public: ...@@ -423,11 +423,6 @@ public:
void SetSolverSaveData( const ScOptSolverSave& rData ); void SetSolverSaveData( const ScOptSolverSave& rData );
ScSheetSaveData* GetSheetSaveData(); ScSheetSaveData* GetSheetSaveData();
void setDocAccTitle( const OUString& rTitle ) { aDocument.setDocAccTitle( rTitle ); }
const OUString getDocAccTitle() const { return aDocument.getDocAccTitle(); }
void setDocReadOnly(bool b) { aDocument.setDocReadOnly(b); }
bool getDocReadOnly() const { return aDocument.getDocReadOnly(); }
void ResetKeyBindings( ScOptionsUtil::KeyBindingType eType ); void ResetKeyBindings( ScOptionsUtil::KeyBindingType eType );
// password protection for Calc (derived from SfxObjectShell) // password protection for Calc (derived from SfxObjectShell)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment