diff options
Diffstat (limited to 'sc/source/ui')
39 files changed, 331 insertions, 101 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index f43c09c814da..41447715024f 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -189,6 +189,14 @@ handle_r1c1: if ( (nFlags & SCA_TAB2_3D) == 0 ) aRange.aEnd.SetTab( aRange.aStart.Tab() ); + if ( ( nFlags & ( SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2 ) ) == 0 ) + { + // #i73766# if a single ref was parsed, set the same "abs" flags for ref2, + // so Format doesn't output a double ref because of different flags. + USHORT nAbsFlags = nFlags & ( SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE ); + nFlags |= nAbsFlags << 4; + } + if (!nCount) { pEngine->SetUpdateMode( FALSE ); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 5ea8c4d78e0f..f6fc2cb27b71 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -768,8 +768,9 @@ __EXPORT ScTextWnd::~ScTextWnd() { delete pEditView; delete pEditEngine; - for( AccTextDataVector::reverse_iterator aIt = maAccTextDatas.rbegin(), aEnd = maAccTextDatas.rend(); aIt != aEnd; ++aIt ) - (*aIt)->Dispose(); + while (!maAccTextDatas.empty()) { + maAccTextDatas.back()->Dispose(); + } } void __EXPORT ScTextWnd::Paint( const Rectangle& rRec ) diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 56878f623828..b5dd2f3242c2 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -448,24 +448,27 @@ void ScFilterDlg::UpdateValueList( USHORT nList ) SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1; if (!pEntryLists[nColumn]) { + USHORT nOffset = GetSliderPos(); SCTAB nTab = nSrcTab; SCROW nFirstRow = theQueryData.nRow1; SCROW nLastRow = theQueryData.nRow2; + mbHasDates[nOffset+nList-1] = false; // erstmal ohne die erste Zeile pEntryLists[nColumn] = new TypedScStrCollection( 128, 128 ); pEntryLists[nColumn]->SetCaseSensitive( aBtnCase.IsChecked() ); pDoc->GetFilterEntriesArea( nColumn, nFirstRow+1, nLastRow, - nTab, *pEntryLists[nColumn] ); + nTab, *pEntryLists[nColumn], mbHasDates[nOffset+nList-1] ); // Eintrag fuer die erste Zeile //! Eintrag (pHdrEntry) ohne Collection erzeugen? nHeaderPos[nColumn] = USHRT_MAX; TypedScStrCollection aHdrColl( 1, 1 ); + bool bDummy = false; pDoc->GetFilterEntriesArea( nColumn, nFirstRow, nFirstRow, - nTab, aHdrColl ); + nTab, aHdrColl, bDummy ); TypedStrData* pHdrEntry = aHdrColl[0]; if ( pHdrEntry ) { @@ -1061,7 +1064,8 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd ) static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0); ScQueryOp eOp = (ScQueryOp)pLbCond->GetSelectEntryPos(); - rEntry.eOp = eOp; + rEntry.eOp = eOp; + rEntry.bQueryByDate = mbHasDates[nQE]; } } diff --git a/sc/source/ui/dbgui/makefile.mk b/sc/source/ui/dbgui/makefile.mk index 2d4fa71f690e..1e7000d0cb07 100644 --- a/sc/source/ui/dbgui/makefile.mk +++ b/sc/source/ui/dbgui/makefile.mk @@ -106,7 +106,6 @@ LIB1OBJFILES = \ $(SLO)$/expftext.obj \ $(SLO)$/fieldwnd.obj \ $(SLO)$/pvlaydlg.obj \ - $(SLO)$/pvfundlg.obj \ $(SLO)$/consdlg.obj \ $(SLO)$/imoptdlg.obj \ $(SLO)$/csvsplits.obj \ diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index cde18fcc3b52..d590ffb83457 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -349,11 +349,12 @@ void ScPivotFilterDlg::UpdateValueList( USHORT nList ) SCROW nFirstRow = theQueryData.nRow1; SCROW nLastRow = theQueryData.nRow2; nFirstRow++; + bool bHasDates = false; pEntryLists[nColumn] = new TypedScStrCollection( 128, 128 ); pEntryLists[nColumn]->SetCaseSensitive( aBtnCase.IsChecked() ); pDoc->GetFilterEntriesArea( nColumn, nFirstRow, nLastRow, - nTab, *pEntryLists[nColumn] ); + nTab, *pEntryLists[nColumn], bHasDates ); } TypedScStrCollection* pColl = pEntryLists[nColumn]; diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index 03de0b8914a3..6b04993ba0bc 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -28,6 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" +#undef SC_DLLIMPLEMENTATION + #include "pvfundlg.hxx" #include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp> diff --git a/sc/source/ui/dbgui/pvfundlg.src b/sc/source/ui/dbgui/pvfundlg.src index 70bce3ed30e9..ed00f6a65fa5 100644 --- a/sc/source/ui/dbgui/pvfundlg.src +++ b/sc/source/ui/dbgui/pvfundlg.src @@ -227,8 +227,8 @@ ModalDialog RID_SCDLG_PIVOTSUBT }; CheckBox CB_SHOWALL { - Pos = MAP_APPFONT ( 12 , 127 ) ; - Size = MAP_APPFONT ( 140 , 10 ) ; + Pos = MAP_APPFONT ( 6 , 127 ) ; + Size = MAP_APPFONT ( 152 , 10 ) ; Text [ en-US ] = "Show it~ems without data"; TabStop = TRUE ; }; diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 5fdf386323d9..1ee02badefe1 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -581,7 +581,7 @@ void ScTPValidationValue::TidyListBoxes() pWnd = GetChild(0); - while( std::find( alstOrder.begin(), alstOrder.end(), pWnd ) != alstOrder.end() && NULL != ( pWnd = pWnd->GetWindow( WINDOW_NEXT) ) ); + while( std::find( alstOrder.begin(), alstOrder.end(), pWnd ) != alstOrder.end() && NULL != ( pWnd = pWnd->GetWindow( WINDOW_NEXT) ) ) ; if ( pWnd ) { diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 2053cebc8ce5..9895f0f43610 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -593,7 +593,7 @@ BOOL ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, if (pDestData) pNewData = pDestData; // Bereich vorhanden -> anpassen else // Bereich ab Cursor/Markierung wird angelegt - pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE, TRUE ); + pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); if (pNewData) { pNewData->SetArea( nTab, @@ -920,7 +920,7 @@ BOOL ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, pNewData = rDocShell.GetDBData( ScRange( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab, aLocalParam.nCol2, aLocalParam.nRow2, nDestTab ), - SC_DB_MAKE, TRUE ); + SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); if (pNewData) { diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index be856ec9240b..a073e50d105c 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -189,7 +189,7 @@ BOOL ScDBDocFunc::DoImportUno( const ScAddress& rPos, // create database range //! merge this with SID_SBA_IMPORT execute in docsh4.cxx - ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, FALSE ); + ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); DBG_ASSERT(pDBData, "can't create DB data"); String sTarget = pDBData->GetName(); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 821b2a6ad880..135bbcdace49 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -356,6 +356,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet) } else aDocument.SetInsertingFromOtherDoc( FALSE ); +#if 0 // disable load of vba related libraries // add vba globals ( if they are availabl ) uno::Any aGlobs; uno::Sequence< uno::Any > aArgs(1); @@ -376,7 +377,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet) BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); if ( pAppMgr ) pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] ); - +#endif aDocument.SetImportingXML( FALSE ); aDocument.EnableExecuteLink( true ); aDocument.EnableUndo( TRUE ); @@ -767,19 +768,38 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) if ( !bSuccess ) SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // this error code will produce no error message, but will break the further saving process } + if (pSheetSaveData) + pSheetSaveData->SetInSupportedSave(true); } break; + case SFX_EVENT_SAVEASDOC: + case SFX_EVENT_SAVETODOC: + // #i108978# If no event is sent before saving, there will also be no "...DONE" event, + // and SAVE/SAVEAS can't be distinguished from SAVETO. So stream copying is only enabled + // if there is a SAVE/SAVEAS/SAVETO event first. + if (pSheetSaveData) + pSheetSaveData->SetInSupportedSave(true); + break; case SFX_EVENT_SAVEDOCDONE: { if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() ) { } UseSheetSaveEntries(); // use positions from saved file for next saving + if (pSheetSaveData) + pSheetSaveData->SetInSupportedSave(false); } break; case SFX_EVENT_SAVEASDOCDONE: // new positions are used after "save" and "save as", but not "save to" UseSheetSaveEntries(); // use positions from saved file for next saving + if (pSheetSaveData) + pSheetSaveData->SetInSupportedSave(false); + break; + case SFX_EVENT_SAVETODOCDONE: + // only reset the flag, don't use the new positions + if (pSheetSaveData) + pSheetSaveData->SetInSupportedSave(false); break; default: { diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 4b76c18edbe6..9e3ed217382f 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -102,6 +102,7 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt InitItems(); CalcOutputFactor(); +#if 0 uno::Any aGlobs; uno::Sequence< uno::Any > aArgs(1); aArgs[ 0 ] <<= GetModel(); @@ -121,6 +122,7 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); if ( pAppMgr ) pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] ); +#endif return bRet; } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 7ff714c2cbdd..4709a065792f 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -1088,6 +1088,16 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck { aSourceRange = pDel->GetOverAllRange().MakeRange(); GetDocFunc().DeleteCells( aSourceRange, NULL, DEL_DELROWS, TRUE, FALSE ); + + // #i101099# [Collaboration] Changes are not correctly shown + if ( bShared ) + { + ScChangeAction* pAct = pThisTrack->GetLast(); + if ( pAct && pAct->GetType() == eSourceType && pAct->IsDeletedIn() && !pSourceAction->IsDeletedIn() ) + { + pAct->RemoveAllDeletedIn(); + } + } } } break; diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 26d61a82c6be..157b98497e83 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -264,7 +264,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) GetUndoManager()->EnterListAction( aStrImport, aStrImport ); } - ScDBData* pDBData = GetDBData( ScRange(aPos), SC_DB_IMPORT, FALSE ); + ScDBData* pDBData = GetDBData( ScRange(aPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); DBG_ASSERT(pDBData, "kann DB-Daten nicht anlegen"); sTarget = pDBData->GetName(); } diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 6fa6a5ac7863..061ece5efc90 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -97,8 +97,9 @@ void ScDocShell::ErrorMessage( USHORT nGlobStrId ) BOOL ScDocShell::IsEditable() const { // import into read-only document is possible - must be extended if other filters use api + // #i108547# MSOOXML filter uses "IsChangeReadOnlyEnabled" property - return !IsReadOnly() || aDocument.IsImportingXML(); + return !IsReadOnly() || aDocument.IsImportingXML() || aDocument.IsChangeReadOnlyEnabled(); } void ScDocShell::DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW /* nY2 */ ) @@ -148,7 +149,7 @@ ScDBData* lcl_GetDBNearCursor( ScDBCollection* pColl, SCCOL nCol, SCROW nRow, SC return pNoNameData; // "unbenannt" nur zurueck, wenn sonst nichts gefunden } -ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL bForceMark ) +ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ) { SCCOL nCol = rMarked.aStart.Col(); SCROW nRow = rMarked.aStart.Row(); @@ -169,7 +170,9 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL if (!pData) pData = lcl_GetDBNearCursor( aDocument.GetDBCollection(), nCol, nRow, nTab ); - BOOL bSelected = ( bForceMark || rMarked.aStart != rMarked.aEnd ); + BOOL bSelected = ( eSel == SC_DBSEL_FORCE_MARK || + (rMarked.aStart != rMarked.aEnd && eSel != SC_DBSEL_ROW_DOWN) ); + bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row()); BOOL bUseThis = FALSE; if (pData) @@ -189,12 +192,21 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL bUseThis = TRUE; if ( bIsNoName && eMode == SC_DB_MAKE ) { - // wenn nichts markiert, "unbenannt" auf zusammenhaengenden Bereich anpassen + // If nothing marked or only one row marked, adapt + // "unbenannt"/"unnamed" to contiguous area. nStartCol = nCol; nStartRow = nRow; - nEndCol = nStartCol; - nEndRow = nStartRow; - aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + if (bOnlyDown) + { + nEndCol = rMarked.aEnd.Col(); + nEndRow = rMarked.aEnd.Row(); + } + else + { + nEndCol = nStartCol; + nEndRow = nStartRow; + } + aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE, bOnlyDown ); if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow ) bUseThis = FALSE; // passt gar nicht else if ( nOldRow2 != nEndRow ) @@ -242,9 +254,17 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL { // zusammenhaengender Bereich nStartCol = nCol; nStartRow = nRow; - nEndCol = nStartCol; - nEndRow = nStartRow; - aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + if (bOnlyDown) + { + nEndCol = rMarked.aEnd.Col(); + nEndRow = rMarked.aEnd.Row(); + } + else + { + nEndCol = nStartCol; + nEndRow = nStartRow; + } + aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE, bOnlyDown ); } BOOL bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab ); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 836d6cdf98e6..e7b04afa9c4f 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -238,6 +238,26 @@ void ScExternalRefCache::Table::getAllRows(vector<SCROW>& rRows) const rRows.swap(aRows); } +::std::pair< SCROW, SCROW > ScExternalRefCache::Table::getRowRange() const +{ + ::std::pair< SCROW, SCROW > aRange( 0, 0 ); + if( !maRows.empty() ) + { + // iterate over entire container (hash map is not sorted by key) + RowsDataType::const_iterator itr = maRows.begin(), itrEnd = maRows.end(); + aRange.first = itr->first; + aRange.second = itr->first + 1; + while( ++itr != itrEnd ) + { + if( itr->first < aRange.first ) + aRange.first = itr->first; + else if( itr->first >= aRange.second ) + aRange.second = itr->first + 1; + } + } + return aRange; +} + void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols) const { RowsDataType::const_iterator itrRow = maRows.find(nRow); @@ -257,6 +277,33 @@ void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols) con rCols.swap(aCols); } +::std::pair< SCCOL, SCCOL > ScExternalRefCache::Table::getColRange( SCROW nRow ) const +{ + ::std::pair< SCCOL, SCCOL > aRange( 0, 0 ); + + RowsDataType::const_iterator itrRow = maRows.find( nRow ); + if (itrRow == maRows.end()) + // this table doesn't have the specified row. + return aRange; + + const RowDataType& rRowData = itrRow->second; + if( !rRowData.empty() ) + { + // iterate over entire container (hash map is not sorted by key) + RowDataType::const_iterator itr = rRowData.begin(), itrEnd = rRowData.end(); + aRange.first = itr->first; + aRange.second = itr->first + 1; + while( ++itr != itrEnd ) + { + if( itr->first < aRange.first ) + aRange.first = itr->first; + else if( itr->first >= aRange.second ) + aRange.second = itr->first + 1; + } + } + return aRange; +} + void ScExternalRefCache::Table::getAllNumberFormats(vector<sal_uInt32>& rNumFmts) const { RowsDataType::const_iterator itrRow = maRows.begin(), itrRowEnd = maRows.end(); @@ -1942,6 +1989,9 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri if (aOptions.Len()) pSet->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, aOptions)); + // make medium hidden to prevent assertion from progress bar + pSet->Put( SfxBoolItem( SID_HIDDEN, TRUE ) ); + auto_ptr<SfxMedium> pMedium(new SfxMedium(aFile, STREAM_STD_READ, false, pFilter, pSet)); if (pMedium->GetError() != ERRCODE_NONE) return NULL; diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx index be206b396733..baadae0a64dc 100644 --- a/sc/source/ui/inc/dbfunc.hxx +++ b/sc/source/ui/inc/dbfunc.hxx @@ -77,7 +77,7 @@ public: void GotoDBArea( const String& rDBName ); // DB-Bereich vom Cursor - ScDBData* GetDBData( BOOL bMarkArea = TRUE, ScGetDBMode eMode = SC_DB_MAKE, bool bShrinkToData = false ); + ScDBData* GetDBData( BOOL bMarkArea = TRUE, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = SC_DBSEL_KEEP ); void NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList ); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 88bbeb699539..09d34c661995 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -313,7 +313,7 @@ public: BOOL IsOle(); void DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ); - ScDBData* GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL bForceMark ); + ScDBData* GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ); ScDBData* GetOldAutoDBRange(); // has to be deleted by caller! void CancelAutoDBRange(); // called when dialog is cancelled diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx index 068a48b8d689..31e0e3a5d4b1 100644 --- a/sc/source/ui/inc/filtdlg.hxx +++ b/sc/source/ui/inc/filtdlg.hxx @@ -164,6 +164,7 @@ private: ListBox* aFieldLbArr[4]; ListBox* aCondLbArr[4]; ListBox* aConnLbArr[4]; + bool mbHasDates[MAXQUERY]; BOOL bRefreshExceptQuery[MAXQUERY]; USHORT nFieldCount; BOOL bRefInputMode; diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 149498a8314d..4d6ef782aed6 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -215,7 +215,7 @@ private: BOOL IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ); void ExecFilter( ULONG nSel, SCCOL nCol, SCROW nRow, - const String& aValue ); + const String& aValue, bool bCheckForDates ); void FilterSelect( ULONG nSel ); void ExecDataSelect( SCCOL nCol, SCROW nRow, const String& rStr ); diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index 79d7c502921f..b2f837db4cb4 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -369,7 +369,7 @@ IMPL_LINK( ScAutoFormatDlg, RenameHdl, void *, EMPTYARG ) aStrRename, aStrLabel, aFormatName, - HID_SC_RENAME_AUTOFMT ); + HID_SC_REN_AFMT_DLG ); if( pDlg->Execute() == RET_OK ) { BOOL bFmtRenamed = FALSE; diff --git a/sc/source/ui/miscdlgs/strindlg.cxx b/sc/source/ui/miscdlgs/strindlg.cxx index aa6db3075b64..b8dc2e13538e 100644 --- a/sc/source/ui/miscdlgs/strindlg.cxx +++ b/sc/source/ui/miscdlgs/strindlg.cxx @@ -72,25 +72,21 @@ ScStringInputDlg::ScStringInputDlg( Window* pParent, // HelpId for Edit different for different uses - DBG_ASSERT( nHelpId == FID_TAB_APPEND || nHelpId == FID_TAB_RENAME || - nHelpId == HID_SC_ADD_AUTOFMT || nHelpId == HID_SC_RENAME_AUTOFMT || - nHelpId == SID_RENAME_OBJECT || - // #i68101# - nHelpId == SID_TITLE_DESCRIPTION_OBJECT, - "unknown ID" ); if ( nHelpId == FID_TAB_APPEND ) aEdInput.SetHelpId( HID_SC_APPEND_NAME ); else if ( nHelpId == FID_TAB_RENAME ) aEdInput.SetHelpId( HID_SC_RENAME_NAME ); else if ( nHelpId == HID_SC_ADD_AUTOFMT ) aEdInput.SetHelpId( HID_SC_AUTOFMT_NAME ); - else if ( nHelpId == HID_SC_RENAME_AUTOFMT ) + else if ( nHelpId == HID_SC_REN_AFMT_DLG ) aEdInput.SetHelpId( HID_SC_REN_AFMT_NAME ); else if ( nHelpId == SID_RENAME_OBJECT ) aEdInput.SetHelpId( HID_SC_RENAME_OBJECT ); // #i68101# else if ( nHelpId == SID_TITLE_DESCRIPTION_OBJECT ) aEdInput.SetHelpId( HID_SC_TITLE_DESCRIPTION_OBJECT ); + else + DBG_ERRORFILE( "unknown ID" ); //------------- FreeResource(); diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index b08676bbe3db..1cc66ca13af6 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -1021,7 +1021,7 @@ Resource RID_GLOBSTR }; String STR_QUERY_DELTAB { - Text [ en-US ] = "Are you sure you want to permanently delete the current sheet(s)?" ; + Text [ en-US ] = "Are you sure you want to delete the selected sheet(s)?" ; }; String STR_QUERY_DELSCENARIO { diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src index d4aa01d436ce..8c9279a602c1 100644 --- a/sc/source/ui/src/miscdlgs.src +++ b/sc/source/ui/src/miscdlgs.src @@ -233,7 +233,7 @@ ModalDialog RID_SCDLG_DELCONT { Pos = MAP_APPFONT ( 12 , 86 ) ; Size = MAP_APPFONT ( 83 , 10 ) ; - Text [ en-US ] = "Not~es" ; + Text [ en-US ] = "~Comments" ; TabStop = TRUE ; }; CheckBox BTN_DELOBJECTS @@ -326,14 +326,14 @@ ModalDialog RID_SCDLG_INSCONT { Pos = MAP_APPFONT ( 12 , 114 ) ; Size = MAP_APPFONT ( 84 , 10 ) ; - Text [ en-US ] = "O~bjects" ; + Text [ en-US ] = "~Objects" ; TabStop = TRUE ; }; CheckBox BTN_INSNOTES { Pos = MAP_APPFONT ( 12 , 86 ) ; Size = MAP_APPFONT ( 84 , 10 ) ; - Text [ en-US ] = "N~otes" ; + Text [ en-US ] = "~Comments" ; TabStop = TRUE ; }; FixedLine FL_FRAME @@ -358,7 +358,7 @@ ModalDialog RID_SCDLG_INSCONT { Pos = MAP_APPFONT ( 111 , 44 ) ; Size = MAP_APPFONT ( 83 , 10 ) ; - Text [ en-US ] = "S~ubtract" ; + Text [ en-US ] = "~Subtract" ; }; RadioButton BTN_OP_MUL { diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index 18adf9883373..2f5a2d8c88fb 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -1024,7 +1024,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "An interger between 1583 and 9956, or 0 and 99 (19xx or 20xx depending on the option set)."; + Text [ en-US ] = "An integer between 1583 and 9956, or 0 and 99 (19xx or 20xx depending on the option set)."; }; }; // -=*# Resource for function BW #*=- @@ -1576,7 +1576,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 { String 1 // Description { - Text [ en-US ] = "Calulates the arithmetically declining value of an asset (depreciation) for a specified period." ; + Text [ en-US ] = "Calculates the arithmetically declining value of an asset (depreciation) for a specified period." ; }; ExtraData = { @@ -4064,7 +4064,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 { String 1 // Description { - Text [ en-US ] = "Array transposition. Exchanges the rows and columns of an aray." ; + Text [ en-US ] = "Array transposition. Exchanges the rows and columns of an array." ; }; ExtraData = { @@ -4724,7 +4724,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "Value 1; value 2;.. .are 1 to 30 arguments representing a sample taken from a basic total population."; + Text [ en-US ] = "Value 1; value 2; ... are 1 to 30 arguments representing a sample taken from a basic total population."; }; }; // -=*# Resource for function VARIANZEN #*=- @@ -4820,7 +4820,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "Value 1; value 2;.. .are 1 to 30 arguments representing a sample taken from a basic total population."; + Text [ en-US ] = "Value 1; value 2; ... are 1 to 30 arguments representing a sample taken from a basic total population."; }; }; // -=*# Resource for function STABWN #*=- @@ -4916,7 +4916,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "Value 1; value 2;.. .are 1 to 30 arguments representing a sample taken from a basic total population."; + Text [ en-US ] = "Value 1; value 2; ... are 1 to 30 arguments representing a sample taken from a basic total population."; }; }; // -=*# Resource for function SUMQUADABW #*=- @@ -6358,7 +6358,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 7 // Description of Parameter 3 { - Text [ en-US ] = "Mode = 1calculates the one-tailed test, 2 = two-tailed distribution." ; + Text [ en-US ] = "Mode = 1 calculates the one-tailed test, 2 = two-tailed distribution." ; }; }; // -=*# Resource for function TINV #*=- @@ -7525,7 +7525,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 9 // Description of Parameter 4 { - Text [ en-US ] = "if the value is TRUE or not given, the search column of the array must be sorted in ascending order." ; + Text [ en-US ] = "If the value is TRUE or not given, the search column of the array must be sorted in ascending order." ; }; }; // -=*# Resource for function INDEX #*=- @@ -8397,7 +8397,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 { String 1 // Description { - Text [ en-US ] = "Converts a value into text." ; + Text [ en-US ] = "Returns a value if it is text, otherwise an empty string." ; }; ExtraData = { @@ -8413,7 +8413,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "The value to be converted." ; + Text [ en-US ] = "The value to be checked and returned if it is text." ; }; }; // -=*# Resource for function ERSETZEN #*=- @@ -8709,7 +8709,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 9 // Description of Parameter 4 { - Text [ en-US ] = "Which occurence of the old text is to be replaced." ; + Text [ en-US ] = "Which occurrence of the old text is to be replaced." ; }; }; // -=*# Resource for function BASIS #*=- diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index c61a6443af99..d563dea095dd 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5515,7 +5515,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createSortDescripto if ( pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) { pData->GetSortParam(aParam); @@ -5546,7 +5546,7 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a { USHORT i; ScSortParam aParam; - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen if (pData) { // alten Einstellungen holen, falls nicht alles neu gesetzt wird @@ -5575,7 +5575,7 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein aFunc.Sort( nTab, aParam, TRUE, TRUE, TRUE ); @@ -5593,7 +5593,7 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) { ScQueryParam aParam; @@ -5675,7 +5675,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen //! keep source range in filter descriptor //! if created by createFilterDescriptorByObject ??? @@ -5762,7 +5762,7 @@ uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScCellRangeObj::createSubTot if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) { ScSubTotalParam aParam; @@ -5825,7 +5825,7 @@ void SAL_CALL ScCellRangeObj::applySubTotals( aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); aFunc.DoSubTotals( nTab, aParam, NULL, TRUE, TRUE ); // Bereich muss angelegt sein @@ -5840,7 +5840,7 @@ void SAL_CALL ScCellRangeObj::removeSubTotals() throw(uno::RuntimeException) if (pDocSh) { ScSubTotalParam aParam; - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) pData->GetSubTotalParam(aParam); // auch bei Remove die Feld-Eintraege behalten @@ -5852,7 +5852,7 @@ void SAL_CALL ScCellRangeObj::removeSubTotals() throw(uno::RuntimeException) aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); aFunc.DoSubTotals( nTab, aParam, NULL, TRUE, TRUE ); // Bereich muss angelegt sein @@ -5868,7 +5868,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createImportDescrip if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) pData->GetImportParam(aParam); } @@ -5897,7 +5897,7 @@ void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue //! TODO: could we get passed a valid result set by any means? uno::Reference< sdbc::XResultSet > xResultSet; - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein aFunc.DoImport( nTab, aParam, xResultSet, NULL, TRUE, FALSE ); //! Api-Flag als Parameter @@ -7912,7 +7912,8 @@ void SAL_CALL ScTableSheetObj::protect( const rtl::OUString& aPassword ) { ScUnoGuard aGuard; ScDocShell* pDocSh = GetDocShell(); - if ( pDocSh ) + // #i108245# if already protected, don't change anything + if ( pDocSh && !pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ) ) { String aString(aPassword); ScDocFunc aFunc(*pDocSh); @@ -7929,9 +7930,9 @@ void SAL_CALL ScTableSheetObj::unprotect( const rtl::OUString& aPassword ) { String aString(aPassword); ScDocFunc aFunc(*pDocSh); - aFunc.Unprotect( GetTab_Impl(), aString, TRUE ); - - //! Rueckgabewert auswerten, Exception oder so + BOOL bDone = aFunc.Unprotect( GetTab_Impl(), aString, TRUE ); + if (!bDone) + throw lang::IllegalArgumentException(); } } diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index 39ed859aa574..daf075964a3a 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -133,7 +133,7 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentRegion() throw(uno::RuntimeExcep SCTAB nTab = aOneRange.aStart.Tab(); pDocSh->GetDocument()->GetDataArea( - nTab, nStartCol, nStartRow, nEndCol, nEndRow, TRUE ); + nTab, nStartCol, nStartRow, nEndCol, nEndRow, TRUE, false ); ScRange aNew( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ); SetNewRange( aNew ); @@ -331,7 +331,7 @@ void SAL_CALL ScCellCursorObj::gotoStart() throw(uno::RuntimeException) SCTAB nTab = aOneRange.aStart.Tab(); pDocSh->GetDocument()->GetDataArea( - nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE, false ); ScRange aNew( nStartCol, nStartRow, nTab ); SetNewRange( aNew ); @@ -359,7 +359,7 @@ void SAL_CALL ScCellCursorObj::gotoEnd() throw(uno::RuntimeException) SCTAB nTab = aOneRange.aStart.Tab(); pDocSh->GetDocument()->GetDataArea( - nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE, false ); ScRange aNew( nEndCol, nEndRow, nTab ); SetNewRange( aNew ); diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 7e23d6b2f9f5..c7bf89671161 100755 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1891,9 +1891,10 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa String aNameString(aPropertyName); if ( aNameString.EqualsAscii( SC_UNONAME_FUNCTION ) ) { - GeneralFunction eFunction = GeneralFunction_NONE; - if( aValue >>= eFunction ) - setFunction( eFunction ); + // #i109350# use GetEnumFromAny because it also allows sal_Int32 + GeneralFunction eFunction = (GeneralFunction) + ScUnoHelpFunctions::GetEnumFromAny( aValue ); + setFunction( eFunction ); } else if ( aNameString.EqualsAscii( SC_UNONAME_SUBTOTALS ) ) { diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 8e857adca09c..85c17f868b0a 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1392,7 +1392,8 @@ void SAL_CALL ScModelObj::enableAutomaticCalculation( sal_Bool bEnabled ) void SAL_CALL ScModelObj::protect( const rtl::OUString& aPassword ) throw(uno::RuntimeException) { ScUnoGuard aGuard; - if (pDocShell) + // #i108245# if already protected, don't change anything + if ( pDocShell && !pDocShell->GetDocument()->IsDocProtected() ) { String aString(aPassword); @@ -1410,9 +1411,9 @@ void SAL_CALL ScModelObj::unprotect( const rtl::OUString& aPassword ) String aString(aPassword); ScDocFunc aFunc(*pDocShell); - aFunc.Unprotect( TABLEID_DOC, aString, TRUE ); - - //! Rueckgabewert auswerten, Exception oder so + BOOL bDone = aFunc.Unprotect( TABLEID_DOC, aString, TRUE ); + if (!bDone) + throw lang::IllegalArgumentException(); } } @@ -2074,6 +2075,13 @@ sal_Int64 SAL_CALL ScModelObj::getSomething( return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); } + if ( rId.getLength() == 16 && + 0 == rtl_compareMemory( SfxObjectShell::getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell )); + } + // aggregated number formats supplier has XUnoTunnel, too // interface from aggregated object must be obtained via queryAggregation diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 0c57963a4f12..956c659f9b15 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -65,6 +65,10 @@ #include <com/sun/star/form/XFormsSupplier.hpp> #include <svx/unomod.hxx> +#include <comphelper/processfactory.hxx> +#include <basic/basmgr.hxx> +#include <sfx2/app.hxx> + using namespace ::com::sun::star; class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery > @@ -183,6 +187,7 @@ static const ProvNamesId_Type __FAR_DATA aProvNamesId[] = { "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD }, { "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD }, { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD }, + { "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS }, }; // @@ -236,6 +241,7 @@ static const sal_Char* __FAR_DATA aOldNames[SC_SERVICE_COUNT] = "", // SC_SERVICE_FORMULAPARS "", // SC_SERVICE_OPCODEMAPPER "", // SC_SERVICE_VBACODENAMEPROVIDER + "", // SC_SERVICE_VBAGLOBALS }; @@ -453,6 +459,25 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( } break; } + case SC_SERVICE_VBAGLOBALS: + { + uno::Any aGlobs; + ScDocument* pDoc = pDocShell->GetDocument(); + if ( pDoc ) + { + if ( !pDocShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aGlobs ) ) + { + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= pDocShell->GetModel(); + aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); + pDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); + BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); + if ( pAppMgr ) + pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] ); + } + aGlobs >>= xRet; + } + } } return xRet; diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 6d3f10e2ec5e..a461c54f255e 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -42,6 +42,7 @@ #include <svx/hlnkitem.hxx> #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> +#include <sfx2/childwin.hxx> #include <sfx2/objface.hxx> #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> @@ -970,6 +971,29 @@ void ScCellShell::GetState(SfxItemSet &rSet) } break; + case SID_SPELL_DIALOG: + { + if ( pDoc && pData && pDoc->IsTabProtected( pData->GetTabNo() ) ) + { + bool bVisible = false; + SfxViewFrame* pViewFrame = ( pTabViewShell ? pTabViewShell->GetViewFrame() : NULL ); + if ( pViewFrame && pViewFrame->HasChildWindow( nWhich ) ) + { + SfxChildWindow* pChild = pViewFrame->GetChildWindow( nWhich ); + Window* pWin = ( pChild ? pChild->GetWindow() : NULL ); + if ( pWin && pWin->IsVisible() ) + { + bVisible = true; + } + } + if ( !bVisible ) + { + rSet.DisableItem( nWhich ); + } + } + } + break; + } // switch ( nWitch ) nWhich = aIter.NextWhich(); } // while ( nWitch ) diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index c082c6da375d..086160263739 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -161,7 +161,7 @@ BOOL lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam ) SCCOL nStartCol = aExternalRange.aStart.Col(); SCROW nEndRow = aExternalRange.aEnd.Row(); SCCOL nEndCol = aExternalRange.aEnd.Col(); - pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, FALSE, false ); aExternalRange.aStart.SetRow( nStartRow ); aExternalRange.aStart.SetCol( nStartCol ); aExternalRange.aEnd.SetRow( nEndRow ); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 6f6c7057bddf..ed391f154892 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -244,7 +244,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if (nSlot == FID_INPUTLINE_BLOCK) { - pTabViewShell->EnterBlock( String(), pData ); + pTabViewShell->EnterBlock( aString, pData ); } else if ( aString.Len() > 0 && ( aString.GetChar(0) == '=' || aString.GetChar(0) == '+' || aString.GetChar(0) == '-' ) ) { diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 02dfd77f7460..1e5a6b9da4ae 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -104,7 +104,7 @@ void ScDBFunc::GotoDBArea( const String& rDBName ) // aktuellen Datenbereich fuer Sortieren / Filtern suchen -ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, bool bShrinkToData ) +ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, ScGetDBSelection eSel ) { ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDBData* pData = NULL; @@ -112,27 +112,72 @@ ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, bool bShrinkToData ScMarkType eMarkType = GetViewData()->GetSimpleArea(aRange); if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED ) { - if (bShrinkToData) + bool bShrinkColumnsOnly = false; + if (eSel == SC_DBSEL_ROW_DOWN) { - // Shrink the range to only include data area. - ScDocument* pDoc = pDocSh->GetDocument(); - SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); - SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); - if (pDoc->ShrinkToDataArea(aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2)) + // Don't alter row range, additional rows may have been selected on + // purpose to append data, or to have a fake header row. + bShrinkColumnsOnly = true; + // Select further rows only if only one row or a portion thereof is + // selected. + if (aRange.aStart.Row() != aRange.aEnd.Row()) + { + // If an area is selected shrink that to the actual used + // columns, don't draw filter buttons for empty columns. + eSel = SC_DBSEL_SHRINK_TO_USED_DATA; + } + else if (aRange.aStart.Col() == aRange.aEnd.Col()) { - aRange.aStart.SetCol(nCol1); - aRange.aEnd.SetCol(nCol2); - aRange.aStart.SetRow(nRow1); - aRange.aEnd.SetRow(nRow2); + // One cell only, if it is not marked obtain entire used data + // area. + const ScMarkData& rMarkData = GetViewData()->GetMarkData(); + if (!(rMarkData.IsMarked() || rMarkData.IsMultiMarked())) + eSel = SC_DBSEL_KEEP; } } - pData = pDocSh->GetDBData( aRange, eMode, FALSE ); + switch (eSel) + { + case SC_DBSEL_SHRINK_TO_SHEET_DATA: + { + // Shrink the selection to sheet data area. + ScDocument* pDoc = pDocSh->GetDocument(); + SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); + SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); + if (pDoc->ShrinkToDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2)) + { + aRange.aStart.SetCol(nCol1); + aRange.aEnd.SetCol(nCol2); + aRange.aStart.SetRow(nRow1); + aRange.aEnd.SetRow(nRow2); + } + } + break; + case SC_DBSEL_SHRINK_TO_USED_DATA: + case SC_DBSEL_ROW_DOWN: + { + // Shrink the selection to actual used area. + ScDocument* pDoc = pDocSh->GetDocument(); + SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); + SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); + if (pDoc->ShrinkToUsedDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly)) + { + aRange.aStart.SetCol(nCol1); + aRange.aEnd.SetCol(nCol2); + aRange.aStart.SetRow(nRow1); + aRange.aEnd.SetRow(nRow2); + } + } + break; + default: + ; // nothing + } + pData = pDocSh->GetDBData( aRange, eMode, eSel ); } else if ( eMode != SC_DB_OLD ) pData = pDocSh->GetDBData( ScRange( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ), - eMode, FALSE ); + eMode, SC_DBSEL_KEEP ); if ( pData && bMark ) { @@ -290,7 +335,7 @@ void ScDBFunc::ToggleAutoFilter() ScQueryParam aParam; ScDocument* pDoc = GetViewData()->GetDocument(); - ScDBData* pDBData = GetDBData( FALSE ); + ScDBData* pDBData = GetDBData( FALSE, SC_DB_MAKE, SC_DBSEL_ROW_DOWN ); pDBData->SetByRow( TRUE ); //! Undo, vorher abfragen ?? pDBData->GetQueryParam( aParam ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index b8eeb868809e..87740a88e4df 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -165,6 +165,7 @@ private: BOOL bInit; BOOL bCancelled; BOOL bInSelect; + bool mbListHasDates; ULONG nSel; ScFilterBoxMode eMode; @@ -188,6 +189,8 @@ public: BOOL IsInInit() const { return bInit; } void SetCancelled() { bCancelled = TRUE; } BOOL IsInSelect() const { return bInSelect; } + void SetListHasDates(bool b) { mbListHasDates = b; } + bool HasDates() const { return mbListHasDates; } }; //------------------------------------------------------------------- @@ -203,6 +206,7 @@ ScFilterListBox::ScFilterListBox( Window* pParent, ScGridWindow* pGrid, bInit( TRUE ), bCancelled( FALSE ), bInSelect( FALSE ), + mbListHasDates(false), nSel( 0 ), eMode( eNewMode ) { @@ -907,7 +911,9 @@ void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect ) pFilterBox->SetSeparatorPos( nDefCount - 1 ); // get list entries - pDoc->GetFilterEntries( nCol, nRow, nTab, aStrings, true ); + bool bHasDates = false; + pDoc->GetFilterEntries( nCol, nRow, nTab, true, aStrings, bHasDates); + pFilterBox->SetListHasDates(bHasDates); // check widths of numerical entries (string entries are not included) // so all numbers are completely visible @@ -1117,7 +1123,7 @@ void ScGridWindow::FilterSelect( ULONG nSel ) ExecDataSelect( nCol, nRow, aString ); break; case SC_FILTERBOX_FILTER: - ExecFilter( nSel, nCol, nRow, aString ); + ExecFilter( nSel, nCol, nRow, aString, pFilterBox->HasDates() ); break; case SC_FILTERBOX_SCENARIO: pViewData->GetView()->UseScenario( aString ); @@ -1150,7 +1156,7 @@ void ScGridWindow::ExecDataSelect( SCCOL nCol, SCROW nRow, const String& rStr ) void ScGridWindow::ExecFilter( ULONG nSel, SCCOL nCol, SCROW nRow, - const String& aValue ) + const String& aValue, bool bCheckForDates ) { SCTAB nTab = pViewData->GetTabNo(); ScDocument* pDoc = pViewData->GetDocument(); @@ -1222,6 +1228,7 @@ void ScGridWindow::ExecFilter( ULONG nSel, rNewEntry.bDoQuery = TRUE; rNewEntry.bQueryByString = TRUE; rNewEntry.nField = nCol; + rNewEntry.bQueryByDate = bCheckForDates; if ( nSel == SC_AUTOFILTER_TOP10 ) { rNewEntry.eOp = SC_TOPVAL; diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index 8ff816263b4f..a178b0a0ada6 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -200,7 +200,12 @@ void ScSpellDialogChildWindow::Init() ScEditableTester aTester( mpDoc, rMarkData ); if( !aTester.IsEditable() ) { - mpViewShell->ErrorMessage( aTester.GetMessageId() ); + // #i85751# Don't show a ErrorMessage here, because the vcl + // parent of the InfoBox is not fully initialized yet. + // This leads to problems in the modality behaviour of the + // ScSpellDialogChildWindow. + + //mpViewShell->ErrorMessage( aTester.GetMessageId() ); return; } } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 304a858fa21f..750e49ec2334 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -1423,7 +1423,7 @@ void ScTabView::MarkDataArea( BOOL bIncludeCursor ) SCCOL nEndCol = nStartCol; SCROW nEndRow = nStartRow; - pDoc->GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, bIncludeCursor ); + pDoc->GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, bIncludeCursor, false ); HideAllCursors(); DoneBlockMode(); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 74a824a709d6..7d1cbb05761b 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -175,7 +175,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData(); + ScDBData* pDBData = GetDBData( TRUE, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); pDBData->GetQueryParam( aQueryParam ); ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam ); @@ -200,7 +200,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData(); + ScDBData* pDBData = GetDBData( TRUE, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); pDBData->GetQueryParam( aQueryParam ); aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 794ee488afed..9697cae3a57e 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -387,7 +387,7 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId, // Creation of database area "Import1" isn't here, but in the DocShell // slot execute, so it can be added to the undo action - ScDBData* pDBData = pDocSh->GetDBData( ScRange(nPosX,nPosY,nTab), SC_DB_OLD, FALSE ); + ScDBData* pDBData = pDocSh->GetDBData( ScRange(nPosX,nPosY,nTab), SC_DB_OLD, SC_DBSEL_KEEP ); String sTarget; if (pDBData) sTarget = pDBData->GetName(); |