sc/inc/document.hxx | 4 - sc/source/core/data/column2.cxx | 1 sc/source/filter/inc/workbookhelper.hxx | 2 sc/source/filter/inc/worksheethelper.hxx | 28 ++++++------- sc/source/filter/oox/workbookfragment.cxx | 6 +- sc/source/filter/oox/workbookhelper.cxx | 62 +++++++++++++++++------------- 6 files changed, 57 insertions(+), 46 deletions(-)
New commits: commit 6ec4c95955ba5aad4e7311a31371b69e80e7ba54 Author: Kohei Yoshida <[email protected]> Date: Thu Nov 21 15:08:48 2013 -0500 More removal of UNO API for setting document properties. Change-Id: I8c68308394a64eee0985d7d1f8c8b34637a6da74 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 80d724b..49fd571 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1126,7 +1126,7 @@ public: bool IsUndo() const { return bIsUndo; } bool IsClipboard() const { return bIsClip; } bool IsUndoEnabled() const { return mbUndoEnabled; } - void EnableUndo( bool bVal ); + SC_DLLPUBLIC void EnableUndo( bool bVal ); bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; } void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; } diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index 022f342..abafb20 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -56,6 +56,7 @@ namespace oox { namespace core { } } class ScDocument; +class ScDocShell; class ScDocumentImport; class ScEditEngineDefaulter; @@ -152,6 +153,7 @@ public: ScDocument& getScDocument(); const ScDocument& getScDocument() const; + ScDocShell& getDocShell(); ScDocumentImport& getDocImport(); ScEditEngineDefaulter& getEditEngine() const; diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index fc3c2aa..30f0f34 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -338,7 +338,7 @@ void WorkbookFragment::finalizeImport() // Recalculate formula cells. ScDocument& rDoc = getScDocument(); - ScDocShell* pDocSh = static_cast<ScDocShell*>(rDoc.GetDocumentShell()); + ScDocShell& rDocSh = getDocShell(); Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); ScRecalcOptions nRecalcMode = static_cast<ScRecalcOptions>(officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::get(xContext)); @@ -349,7 +349,7 @@ void WorkbookFragment::finalizeImport() { // Ask the user if full re-calculation is desired. QueryBox aBox( - pDocSh->GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), + rDocSh.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); aBox.SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED)); @@ -373,7 +373,7 @@ void WorkbookFragment::finalizeImport() bHardRecalc = true; if (bHardRecalc) - pDocSh->DoHardRecalc(false); + rDocSh.DoHardRecalc(false); else rDoc.CalcFormulaTree(false, true, false); } diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index a27998e..33270e5 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -72,6 +72,7 @@ #include "datauno.hxx" #include "globalnames.hxx" #include "documentimport.hxx" +#include "drwlayer.hxx" #include "formulabuffer.hxx" #include "vcl/mapmod.hxx" @@ -150,6 +151,7 @@ public: ScDocument& getScDocument() { return *mpDoc; } const ScDocument& getScDocument() const { return *mpDoc; } + ScDocShell& getDocShell(); ScDocumentImport& getDocImport(); /** Returns a reference to the source/target spreadsheet document model. */ @@ -305,6 +307,7 @@ private: rtl_TextEncoding meTextEnc; /// BIFF byte string text encoding. bool mbHasCodePage; /// True = CODEPAGE record exists in imported stream. ScDocument* mpDoc; + ScDocShell* mpDocShell; boost::scoped_ptr<ScDocumentImport> mxDocImport; }; @@ -316,7 +319,8 @@ WorkbookGlobals::WorkbookGlobals( ExcelFilter& rFilter ) : meFilterType( FILTER_OOXML ), mpOoxFilter( &rFilter ), meBiff( BIFF_UNKNOWN ), - mpDoc( NULL ) + mpDoc(NULL), + mpDocShell(NULL) { // register at the filter, needed for virtual callbacks (even during construction) mrExcelFilter.registerWorkbookGlobals( *this ); @@ -329,6 +333,11 @@ WorkbookGlobals::~WorkbookGlobals() mrExcelFilter.unregisterWorkbookGlobals(); } +ScDocShell& WorkbookGlobals::getDocShell() +{ + return *mpDocShell; +} + ScDocumentImport& WorkbookGlobals::getDocImport() { return *mxDocImport; @@ -534,11 +543,10 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) if (mxDoc.get()) { ScModelObj* pModel = dynamic_cast<ScModelObj*>(mxDoc.get()); - ScDocShell* pDocShell = NULL; if (pModel) - pDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject()); - if (pDocShell) - mpDoc = pDocShell->GetDocument(); + mpDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject()); + if (mpDocShell) + mpDoc = mpDocShell->GetDocument(); } if (!mpDoc) @@ -578,19 +586,16 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) // set some document properties needed during import if( mrBaseFilter.isImportFilter() ) { - PropertySet aPropSet( mxDoc ); // enable editing read-only documents (e.g. from read-only files) - aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, true ); + mpDoc->EnableChangeReadOnly(true); // #i76026# disable Undo while loading the document - aPropSet.setProperty( PROP_IsUndoEnabled, false ); + mpDoc->EnableUndo(false); // #i79826# disable calculating automatic row height while loading the document - aPropSet.setProperty( PROP_IsAdjustHeightEnabled, false ); + mpDoc->EnableAdjustHeight(true); // disable automatic update of linked sheets and DDE links - aPropSet.setProperty( PROP_IsExecuteLinkEnabled, false ); + mpDoc->EnableExecuteLink(false); // #i79890# disable automatic update of defined names - Reference< XActionLockable > xLockable( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY ); - if( xLockable.is() ) - xLockable->addActionLock(); + mpDoc->CompileNameFormula(true); //! TODO: localize progress bar text mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), "Loading..." ) ); @@ -598,7 +603,7 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) //prevent unnecessary broadcasts and "half way listeners" as //is done in ScDocShell::BeforeXMLLoading() for ods - getScDocument().SetInsertingFromOtherDoc(true); + mpDoc->SetInsertingFromOtherDoc(true); } else if( mrBaseFilter.isExportFilter() ) { @@ -625,26 +630,28 @@ void WorkbookGlobals::finalize() // set some document properties needed after import if( mrBaseFilter.isImportFilter() ) { - PropertySet aPropSet( mxDoc ); // #i74668# do not insert default sheets - aPropSet.setProperty( PROP_IsLoaded, true ); + mpDocShell->SetEmpty(false); // #i79890# Compile named ranges before re-enabling row height adjustment. (no idea why). mpDoc->CompileNameFormula(false); // enable automatic update of linked sheets and DDE links - aPropSet.setProperty( PROP_IsExecuteLinkEnabled, true ); + mpDoc->EnableExecuteLink(true); // #i79826# enable updating automatic row height after loading the document - aPropSet.setProperty( PROP_IsAdjustHeightEnabled, true ); + mpDoc->EnableAdjustHeight(true); // #i76026# enable Undo after loading the document - aPropSet.setProperty( PROP_IsUndoEnabled, true ); + mpDoc->EnableUndo(true); + // disable editing read-only documents (e.g. from read-only files) - aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, false ); + mpDoc->EnableChangeReadOnly(false); // #111099# open forms in alive mode (has no effect, if no controls in document) - aPropSet.setProperty( PROP_ApplyFormDesignMode, false ); + ScDrawLayer* pModel = mpDoc->GetDrawLayer(); + if (pModel) + pModel->SetOpenInDesignMode(false); //stop preventing establishment of listeners as is done in //ScDocShell::AfterXMLLoading() for ods - getScDocument().SetInsertingFromOtherDoc(false); + mpDoc->SetInsertingFromOtherDoc(false); getDocImport().finalize(); } } @@ -745,6 +752,11 @@ const ScDocument& WorkbookHelper::getScDocument() const return mrBookGlob.getScDocument(); } +ScDocShell& WorkbookHelper::getDocShell() +{ + return mrBookGlob.getDocShell(); +} + ScDocumentImport& WorkbookHelper::getDocImport() { return mrBookGlob.getDocImport(); commit e0a6ac44c74897c1f5ee024b1eabda908bedb195 Author: Kohei Yoshida <[email protected]> Date: Thu Nov 21 14:23:32 2013 -0500 Call the method directly via ScDocument, not via obscure UNO API. Change-Id: I27628314337ae4df31420d63d7c09148369a6759 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 68e57d2..80d724b 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1920,7 +1920,7 @@ public: void CompileDBFormula(); void CompileDBFormula( bool bCreateFormulaString ); - void CompileNameFormula( bool bCreateFormulaString ); + SC_DLLPUBLIC void CompileNameFormula( bool bCreateFormulaString ); void CompileColRowNameFormula(); /** Maximum string length of a column, e.g. for dBase export. diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 240677b..65d6c88 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -3198,7 +3198,6 @@ void ScColumn::CompileNameFormula( bool bCreateFormulaString ) { CompileNameFormulaHandler aFunc(bCreateFormulaString); sc::ProcessFormula(maCells, aFunc); - RegroupFormulaCells(); } void ScColumn::CompileColRowNameFormula() diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 31dd5bd..a27998e 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -628,10 +628,8 @@ void WorkbookGlobals::finalize() PropertySet aPropSet( mxDoc ); // #i74668# do not insert default sheets aPropSet.setProperty( PROP_IsLoaded, true ); - // #i79890# enable automatic update of defined names (before IsAdjustHeightEnabled!) - Reference< XActionLockable > xLockable( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY ); - if( xLockable.is() ) - xLockable->removeActionLock(); + // #i79890# Compile named ranges before re-enabling row height adjustment. (no idea why). + mpDoc->CompileNameFormula(false); // enable automatic update of linked sheets and DDE links aPropSet.setProperty( PROP_IsExecuteLinkEnabled, true ); // #i79826# enable updating automatic row height after loading the document commit 462b7ff38c04117c55fcd3056ff25e01748ac57d Author: Kohei Yoshida <[email protected]> Date: Thu Nov 21 13:44:45 2013 -0500 Shrink class sizes a bit. Change-Id: I2561ede5a42ad1f0f3bb74f7b9375f87010eddc3 diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx index 8cda876..bbcd152 100644 --- a/sc/source/filter/inc/worksheethelper.hxx +++ b/sc/source/filter/inc/worksheethelper.hxx @@ -83,9 +83,9 @@ struct ColumnModel double mfWidth; /// Column width in number of characters. sal_Int32 mnXfId; /// Column default formatting. sal_Int32 mnLevel; /// Column outline level. - bool mbShowPhonetic; /// True = cells in column show phonetic settings. - bool mbHidden; /// True = column is hidden. - bool mbCollapsed; /// True = column outline is collapsed. + bool mbShowPhonetic:1; /// True = cells in column show phonetic settings. + bool mbHidden:1; /// True = column is hidden. + bool mbCollapsed:1; /// True = column outline is collapsed. explicit ColumnModel(); @@ -103,13 +103,13 @@ struct RowModel double mfHeight; /// Row height in points. sal_Int32 mnXfId; /// Row default formatting (see mbIsFormatted). sal_Int32 mnLevel; /// Row outline level. - bool mbCustomHeight; /// True = row has custom height. - bool mbCustomFormat; /// True = cells in row have explicit formatting. - bool mbShowPhonetic; /// True = cells in row show phonetic settings. - bool mbHidden; /// True = row is hidden. - bool mbCollapsed; /// True = row outline is collapsed. - bool mbThickTop; /// True = row has extra space above text. - bool mbThickBottom; /// True = row has extra space below text. + bool mbCustomHeight:1; /// True = row has custom height. + bool mbCustomFormat:1; /// True = cells in row have explicit formatting. + bool mbShowPhonetic:1; /// True = cells in row show phonetic settings. + bool mbHidden:1; /// True = row is hidden. + bool mbCollapsed:1; /// True = row outline is collapsed. + bool mbThickTop:1; /// True = row has extra space above text. + bool mbThickBottom:1; /// True = row has extra space below text. explicit RowModel(); @@ -159,10 +159,10 @@ struct ValidationModel sal_Int32 mnType; sal_Int32 mnOperator; sal_Int32 mnErrorStyle; - bool mbShowInputMsg; - bool mbShowErrorMsg; - bool mbNoDropDown; - bool mbAllowBlank; + bool mbShowInputMsg:1; + bool mbShowErrorMsg:1; + bool mbNoDropDown:1; + bool mbAllowBlank:1; explicit ValidationModel(); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
