diff options
Diffstat (limited to 'sc/source/ui')
40 files changed, 533 insertions, 1240 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index fac3b1bb1a0f..33f6a279a40c 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -514,6 +514,13 @@ void ScInputHandler::UpdateRefDevice() return; sal_Bool bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg(); + bool bInPlace = pActiveViewSh && pActiveViewSh->GetViewFrame()->GetFrame().IsInPlace(); + sal_uInt32 nCtrl = pEngine->GetControlWord(); + if ( bTextWysiwyg || bInPlace ) + nCtrl |= EE_CNTRL_FORMAT100; // EditEngine default: always format for 100% + else + nCtrl &= ~EE_CNTRL_FORMAT100; // when formatting for screen, use the actual MapMode + pEngine->SetControlWord( nCtrl ); if ( bTextWysiwyg && pActiveViewSh ) pEngine->SetRefDevice( pActiveViewSh->GetViewData()->GetDocument()->GetPrinter() ); else @@ -601,9 +608,7 @@ void ScInputHandler::UpdateSpellSettings( sal_Bool bFromStartTab ) pEngine->SetControlWord(nCntrl); ScDocument* pDoc = pViewData->GetDocument(); - pEngine->SetForbiddenCharsTable( pDoc->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDoc->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDoc->GetAsianKerning() ); + pDoc->ApplyAsianEditSettings( *pEngine ); pEngine->SetDefaultHorizontalTextDirection( (EEHorizontalTextDirection)pDoc->GetEditTextDirection( pViewData->GetTabNo() ) ); pEngine->SetFirstWordCapitalization( sal_False ); diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx index 4450c00db807..73d0ac786971 100644 --- a/sc/source/ui/app/typemap.cxx +++ b/sc/source/ui/app/typemap.cxx @@ -124,6 +124,7 @@ #include <svl/aeitem.hxx> #include <avmedia/mediaitem.hxx> +#include <sfx2/frame.hxx> #include "attrib.hxx" #define SvxDrawToolItem SfxAllEnumItem diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx index b43779ffa62b..a1a90731cf0f 100644 --- a/sc/source/ui/dbgui/pvlaydlg.cxx +++ b/sc/source/ui/dbgui/pvlaydlg.cxx @@ -749,6 +749,14 @@ IMPL_LINK( ScPivotLayoutDlg, OkHdl, OKButton *, EMPTYARG ) } } + // also transfer grand total name + if (pOldSaveData) + { + const OUString* pGrandTotalName = pOldSaveData->GetGrandTotalName(); + if (pGrandTotalName) + aSaveData.SetGrandTotalName(*pGrandTotalName); + } + sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich( SID_PIVOT_TABLE ); ScPivotItem aOutItem( nWhichPivot, &aSaveData, &aOutRange, bToNewTable ); diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 2cf981a15ff3..d45b212b1208 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -201,7 +201,7 @@ static void save_Separators( // ---------------------------------------------------------------------------- ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, - SvStream* pInStream, sal_Unicode /*cSep*/ ) : + SvStream* pInStream, sal_Unicode cSep ) : ModalDialog ( pParent, ScResId( RID_SCDLG_ASCII ) ), mpDatStream ( pInStream ), mnStreamPos( pInStream ? pInStream->Tell() : 0 ), @@ -268,7 +268,6 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, } SetText( aName ); - OUString sFieldSeparators; OUString sTextSeparators; bool bMergeDelimiters = false; @@ -282,6 +281,12 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, // load separators only when importing csv files. load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage); + else + { + // #i115474# otherwise use sensible defaults + sFieldSeparators = OUString( cSep ); + sTextSeparators = OUString( ScAsciiOptions::cDefaultTextSep ); + } maFieldSeparators = String(sFieldSeparators); if( bMergeDelimiters ) diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index cf114cf8479e..f0378beced22 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -35,8 +35,9 @@ #include <sfx2/app.hxx> #include <vcl/msgbox.hxx> #include <vcl/waitobj.hxx> +#include <svx/dataaccessdescriptor.hxx> -#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdb/CommandType.hpp> #include "dbdocfun.hxx" #include "sc.hrc" @@ -58,6 +59,8 @@ #include "dpshttab.hxx" #include "hints.hxx" +using namespace ::com::sun::star; + // ----------------------------------------------------------------- sal_Bool ScDBDocFunc::AddDBRange( const String& rName, const ScRange& rRange, sal_Bool /* bApi */ ) @@ -1429,15 +1432,11 @@ sal_Bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pN //================================================================== // -// Datenbank-Import... +// database import -void ScDBDocFunc::UpdateImport( const String& rTarget, const String& rDBName, - const String& rTableName, const String& rStatement, sal_Bool bNative, - sal_uInt8 nType, const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XResultSet >& xResultSet, - const SbaSelectionList* pSelection ) +void ScDBDocFunc::UpdateImport( const String& rTarget, const svx::ODataAccessDescriptor& rDescriptor ) { - // Target ist jetzt einfach der Bereichsname + // rTarget is the name of a database range ScDocument* pDoc = rDocShell.GetDocument(); ScDBCollection& rDBColl = *pDoc->GetDBCollection(); @@ -1465,15 +1464,21 @@ void ScDBDocFunc::UpdateImport( const String& rTarget, const String& rDBName, pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow ); pData->GetImportParam( aImportParam ); - sal_Bool bSql = ( rStatement.Len() != 0 ); - - aImportParam.aDBName = rDBName; - aImportParam.bSql = bSql; - aImportParam.aStatement = bSql ? rStatement : rTableName; - aImportParam.bNative = bNative; - aImportParam.nType = nType; + rtl::OUString sDBName; + rtl::OUString sDBTable; + sal_Int32 nCommandType = 0; + rDescriptor[svx::daDataSource] >>= sDBName; + rDescriptor[svx::daCommand] >>= sDBTable; + rDescriptor[svx::daCommandType] >>= nCommandType; + + aImportParam.aDBName = sDBName; + aImportParam.bSql = ( nCommandType == sdb::CommandType::COMMAND ); + aImportParam.aStatement = sDBTable; + aImportParam.bNative = sal_False; + aImportParam.nType = static_cast<sal_uInt8>( ( nCommandType == sdb::CommandType::QUERY ) ? ScDbQuery : ScDbTable ); aImportParam.bImport = sal_True; - sal_Bool bContinue = DoImport( nTab, aImportParam, xResultSet, pSelection, sal_True ); + + sal_Bool bContinue = DoImport( nTab, aImportParam, &rDescriptor, sal_True ); // DB-Operationen wiederholen diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 2537bfa0be56..368850b40399 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XRowSet.hpp> #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbcx/XRowLocate.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -65,6 +66,7 @@ #include "dbdocutl.hxx" #include "editable.hxx" #include "hints.hxx" +#include "miscuno.hxx" using namespace com::sun::star; @@ -121,99 +123,22 @@ void ScDBDocFunc::ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFram sal_Bool ScDBDocFunc::DoImportUno( const ScAddress& rPos, const uno::Sequence<beans::PropertyValue>& aArgs ) { - sal_Bool bDone = sal_False; + svx::ODataAccessDescriptor aDesc( aArgs ); // includes selection and result set - ScImportParam aImParam; - aImParam.nCol1 = aImParam.nCol2 = rPos.Col(); - aImParam.nRow1 = aImParam.nRow2 = rPos.Row(); - aImParam.bImport = sal_True; + // create database range + ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); + DBG_ASSERT(pDBData, "can't create DB data"); + String sTarget = pDBData->GetName(); - uno::Reference<sdbc::XResultSet> xResSet; - uno::Sequence<uno::Any> aSelection; - - rtl::OUString aStrVal; - const beans::PropertyValue* pPropArray = aArgs.getConstArray(); - long nPropCount = aArgs.getLength(); - long i; - for (i = 0; i < nPropCount; i++) - { - const beans::PropertyValue& rProp = pPropArray[i]; - String aPropName = rProp.Name; - - if ( aPropName.EqualsAscii( SC_DBPROP_DATASOURCENAME )) - { - if ( rProp.Value >>= aStrVal ) - aImParam.aDBName = aStrVal; - } - else if ( aPropName.EqualsAscii( SC_DBPROP_COMMAND )) - { - if ( rProp.Value >>= aStrVal ) - aImParam.aStatement = aStrVal; - } - else if ( aPropName.EqualsAscii( SC_DBPROP_COMMANDTYPE )) - { - sal_Int32 nType = 0; - if ( rProp.Value >>= nType ) - { - aImParam.bSql = ( nType == sdb::CommandType::COMMAND ); - aImParam.nType = sal::static_int_cast<sal_uInt8>( ( nType == sdb::CommandType::QUERY ) ? ScDbQuery : ScDbTable ); - // nType is ignored if bSql is set - } - } - else if ( aPropName.EqualsAscii( SC_DBPROP_SELECTION )) - { - rProp.Value >>= aSelection; - } - else if ( aPropName.EqualsAscii( SC_DBPROP_CURSOR )) - { - rProp.Value >>= xResSet; - } - } - - SbaSelectionList aList; - long nSelLen = aSelection.getLength(); - for (i = 0; i < nSelLen; i++) - { - sal_Int32 nEntry = 0; - if ( aSelection[i] >>= nEntry ) - aList.Insert( (void*)nEntry, LIST_APPEND ); - } - - sal_Bool bAddrInsert = sal_False; //!??? - if ( bAddrInsert ) - { - bDone = DoImport( rPos.Tab(), aImParam, xResSet, &aList, sal_True, bAddrInsert ); - } - else - { - // create database range - //! merge this with SID_SBA_IMPORT execute in docsh4.cxx - - ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); - DBG_ASSERT(pDBData, "can't create DB data"); - String sTarget = pDBData->GetName(); - - //! change UpdateImport to use only one of rTableName, rStatement - - String aTableName, aStatement; - if ( aImParam.bSql ) - aStatement = aImParam.aStatement; - else - aTableName = aImParam.aStatement; + UpdateImport( sTarget, aDesc ); - UpdateImport( sTarget, aImParam.aDBName, aTableName, aStatement, - aImParam.bNative, aImParam.nType, xResSet, &aList ); - bDone = sal_True; - } - - return bDone; + return sal_True; } // ----------------------------------------------------------------- sal_Bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, - const uno::Reference< sdbc::XResultSet >& xResultSet, - const SbaSelectionList* pSelection, sal_Bool bRecord, sal_Bool bAddrInsert ) + const svx::ODataAccessDescriptor* pDescriptor, sal_Bool bRecord, sal_Bool bAddrInsert ) { ScDocument* pDoc = rDocShell.GetDocument(); @@ -251,17 +176,34 @@ sal_Bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, sal_Bool bDoSelection = sal_False; sal_Bool bRealSelection = sal_False; // sal_True if not everything is selected - sal_uLong nListPos = 0; - sal_uLong nRowsRead = 0; - sal_uLong nListCount = 0; + sal_Bool bBookmarkSelection = sal_False; + sal_Int32 nListPos = 0; + sal_Int32 nRowsRead = 0; + sal_Int32 nListCount = 0; - // -1 is special - if ( pSelection && pSelection->Count() && (long)pSelection->GetObject(0) != -1L ) + uno::Sequence<uno::Any> aSelection; + if ( pDescriptor && pDescriptor->has(svx::daSelection) ) { - bDoSelection = sal_True; - nListCount = pSelection->Count(); + (*pDescriptor)[svx::daSelection] >>= aSelection; + nListCount = aSelection.getLength(); + if ( nListCount > 0 ) + { + bDoSelection = sal_True; + if ( pDescriptor->has(svx::daBookmarkSelection) ) + bBookmarkSelection = ScUnoHelpFunctions::GetBoolFromAny( (*pDescriptor)[svx::daBookmarkSelection] ); + if ( bBookmarkSelection ) + { + // From bookmarks, there's no way to detect if all records are selected. + // Rely on base to pass no selection in that case. + bRealSelection = sal_True; + } + } } + uno::Reference<sdbc::XResultSet> xResultSet; + if ( pDescriptor && pDescriptor->has(svx::daCursor) ) + xResultSet.set((*pDescriptor)[svx::daCursor], uno::UNO_QUERY); + // ImportDoc - also used for Redo ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO ); pImportDoc->InitUndo( pDoc, nTab, nTab ); @@ -346,6 +288,17 @@ sal_Bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, //! error message } + uno::Reference<sdbcx::XRowLocate> xLocate; + if ( bBookmarkSelection ) + { + xLocate.set( xRowSet, uno::UNO_QUERY ); + if ( !xLocate.is() ) + { + DBG_ERRORFILE("can't get XRowLocate"); + bDoSelection = bRealSelection = bBookmarkSelection = sal_False; + } + } + uno::Reference<sdbc::XRow> xRow( xRowSet, uno::UNO_QUERY ); if ( nColCount > 0 && xRow.is() ) { @@ -388,16 +341,25 @@ sal_Bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, { if (nListPos < nListCount) { - sal_uLong nNextRow = (sal_uLong) pSelection->GetObject(nListPos); - if ( nRowsRead+1 < nNextRow ) - bRealSelection = sal_True; - bEnd = !xRowSet->absolute(nRowsRead = nNextRow); + if ( bBookmarkSelection ) + { + bEnd = !xLocate->moveToBookmark(aSelection[nListPos]); + } + else // use record numbers + { + sal_Int32 nNextRow = 0; + aSelection[nListPos] >>= nNextRow; + if ( nRowsRead+1 < nNextRow ) + bRealSelection = sal_True; + bEnd = !xRowSet->absolute(nRowsRead = nNextRow); + } ++nListPos; } else { - bRealSelection = xRowSet->next(); - bEnd = sal_True; // more data available but not used + if ( !bBookmarkSelection && xRowSet->next() ) + bRealSelection = sal_True; // more data available but not used + bEnd = sal_True; } } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 152f9f206cbe..6414119677bf 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4479,7 +4479,11 @@ sal_Bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, sal_Bool /* bApi pDoc->CompileNameFormula( sal_False ); // CompileFormulaString aModificator.SetDocumentModified(); - SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + + // #i114072# don't broadcast while loading a file + // (navigator and input line for other open documents would be notified) + if ( bCompile ) + SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); return sal_True; } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 734fd20a71d7..4d989158952b 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -120,6 +120,7 @@ #include "optsolver.hxx" #include "sheetdata.hxx" #include "tabprotection.hxx" +#include "dpobject.hxx" #include "docsh.hxx" #include "docshimp.hxx" @@ -2629,7 +2630,9 @@ void ScDocShell::SetDocumentModified( sal_Bool bIsModified /* = sal_True */ ) if ( pPaintLockData && bIsModified ) { - //! BCA_BRDCST_ALWAYS etc. also needed here? + // #i115009# broadcast BCA_BRDCST_ALWAYS, so a component can read recalculated results + // of RecalcModeAlways formulas (like OFFSET) after modifying cells + aDocument.Broadcast( SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL ); aDocument.InvalidateTableArea(); // #i105279# needed here aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index c64a65b25a55..6c799311a37b 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -59,6 +59,7 @@ using namespace ::com::sun::star; #include <vcl/msgbox.hxx> #include <vcl/waitobj.hxx> #include <tools/multisel.hxx> +#include <svx/dataaccessdescriptor.hxx> #include <svx/drawitem.hxx> #include <svx/fmview.hxx> #include <svx/pageitem.hxx> @@ -200,19 +201,21 @@ void ScDocShell::Execute( SfxRequest& rReq ) } break; - - // SID_SBA_QRY_CHANGETARGET gibts nicht mehr - auch in idl raus - case SID_SBA_IMPORT: { if (pReqArgs) { - const sal_Unicode cSbaSep = 11; // Trennzeichen - const SfxPoolItem* pItem; - String sSbaData, sTarget; + svx::ODataAccessDescriptor aDesc; if ( pReqArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET ) - sSbaData = ((const SfxStringItem*)pItem)->GetValue(); + { + uno::Any aAny = static_cast<const SfxUsrAnyItem*>(pItem)->GetValue(); + uno::Sequence<beans::PropertyValue> aProperties; + if ( aAny >>= aProperties ) + aDesc.initializeFrom( aProperties ); + } + + String sTarget; if ( pReqArgs->GetItemState( FN_PARAM_1, sal_True, &pItem ) == SFX_ITEM_SET ) sTarget = ((const SfxStringItem*)pItem)->GetValue(); @@ -220,33 +223,6 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( pReqArgs->GetItemState( FN_PARAM_2, sal_True, &pItem ) == SFX_ITEM_SET ) bIsNewArea = ((const SfxBoolItem*)pItem)->GetValue(); - ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XResultSet > xResultSet; - if ( pReqArgs->GetItemState( FN_PARAM_3, sal_False, &pItem ) == SFX_ITEM_SET && pItem ) - xResultSet.set(((const SfxUsrAnyItem*)pItem)->GetValue(),::com::sun::star::uno::UNO_QUERY); - - String sDBName = sSbaData.GetToken(0,cSbaSep); // Datenbankname - String sDBTable = sSbaData.GetToken(1,cSbaSep); // Tabellen- oder Query-Name - String sTabFlag = sSbaData.GetToken(2,cSbaSep); - String sDBSql = sSbaData.GetToken(3,cSbaSep); // SQL im Klartext - - sal_uInt8 nType = ScDbTable; // "0" oder "1" - if ( sTabFlag.EqualsAscii("0") ) // "0" = Query, "1" = Table (Default) - nType = ScDbQuery; - - SbaSelectionListRef pSelectionList = new SbaSelectionList; - xub_StrLen nCount = sSbaData.GetTokenCount(cSbaSep); - - for (xub_StrLen i = 4; i < nCount; i++) - { - String aSelItem = sSbaData.GetToken(i,cSbaSep); - if (aSelItem.Len()) - { - void *pPtr = (void*)aSelItem.ToInt32(); - pSelectionList->Insert( pPtr, LIST_APPEND ); - } - } - // bei Bedarf neuen Datenbankbereich anlegen sal_Bool bMakeArea = sal_False; if (bIsNewArea) @@ -287,9 +263,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) if (bDo) { - ScDBDocFunc(*this).UpdateImport( sTarget, sDBName, - sDBTable, sDBSql, sal_True, nType, xResultSet, - pSelectionList ); + ScDBDocFunc(*this).UpdateImport( sTarget, aDesc ); rReq.Done(); // UpdateImport aktualisiert auch die internen Operationen diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index fb5c30c5826e..60b872362004 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -41,8 +41,6 @@ #include <sfx2/bindings.hxx> #include <svl/smplhint.hxx> -#include <com/sun/star/sdbc/XResultSet.hpp> - // INCLUDE --------------------------------------------------------------- #include "docsh.hxx" @@ -980,8 +978,7 @@ IMPL_LINK( ScDocShell, RefreshDBDataHdl, ScRefreshTimer*, pRefreshTimer ) { ScRange aRange; pDBData->GetArea( aRange ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> xResultSet; - bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, xResultSet, NULL, sal_True, sal_False ); //! Api-Flag as parameter + bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, NULL, sal_True, sal_False ); //! Api-Flag as parameter // internal operations (sort, query, subtotal) only if no error if (bContinue) { diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 93101e802651..675f9ea109c0 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -251,6 +251,7 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet { sal_uLong nErr = eERR_OK; long i; + long nColCount = 0; try { @@ -262,14 +263,7 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet return nRet; ::utl::DisposableComponent aConnectionHelper(xConnection); - long nRowCount = 0; - if ( nRowCount < 0 ) - { - DBG_ERROR("can't get row count"); - nRowCount = 0; - } - - ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), nRowCount ); + ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), 0 ); uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory(); uno::Reference<sdbc::XRowSet> xRowSet( xFactory->createInstance( rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ), @@ -296,7 +290,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet xRowSet->execute(); - long nColCount = 0; uno::Reference<sdbc::XResultSetMetaData> xMeta; uno::Reference<sdbc::XResultSetMetaDataSupplier> xMetaSupp( xRowSet, uno::UNO_QUERY ); if ( xMetaSupp.is() ) @@ -310,10 +303,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet nErr = SCWARN_IMPORT_RANGE_OVERFLOW; // warning } - if ( nColCount > 0 ) - aDocument.DoColResize( 0, 0, static_cast<SCCOL>(nColCount) - 1, - static_cast<SCSIZE>(nRowCount) + 1 ); - uno::Reference<sdbc::XRow> xRow( xRowSet, uno::UNO_QUERY ); DBG_ASSERT( xRow.is(), "can't get Row" ); if (!xRow.is()) return SCERR_IMPORT_CONNECT; @@ -327,6 +316,9 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet // read column names //! add type descriptions + aProgress.SetState( 0 ); + ScColumn::bDoubleAlloc = sal_True; // row count isn't readily available in advance + for (i=0; i<nColCount; i++) { String aHeader = xMeta->getColumnLabel( i+1 ); @@ -384,9 +376,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet bEnd = sal_True; // don't continue nErr = SCWARN_IMPORT_RANGE_OVERFLOW; // warning message } - - if ( nRowCount ) - aProgress.SetStateOnPercent( nRow ); } } catch ( sdbc::SQLException& ) @@ -399,6 +388,10 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet nErr = ERRCODE_IO_GENERAL; } + ScColumn::bDoubleAlloc = sal_False; + if ( nColCount > 0 ) + aDocument.DoColResize( 0, 0, static_cast<SCCOL>(nColCount) - 1, 0 ); + return nErr; } diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 3130e39b79f1..70b5db6b5147 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -299,8 +299,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) rBindings.Invalidate(SID_OBJECT_HEAVEN); rBindings.Invalidate(SID_OBJECT_HELL); // leave draw shell if nothing selected (layer may be locked) - if ( pView->GetMarkedObjectList().GetMarkCount() == 0 ) - pViewData->GetViewShell()->SetDrawShell( sal_False ); + pViewData->GetViewShell()->UpdateDrawShell(); break; case SID_FRAME_TO_TOP: @@ -370,14 +369,12 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) case SID_DELETE: case SID_DELETE_CONTENTS: pView->DeleteMarked(); - if (!pTabView->IsDrawSelMode()) - pViewData->GetViewShell()->SetDrawShell( sal_False ); + pViewData->GetViewShell()->UpdateDrawShell(); break; case SID_CUT: pView->DoCut(); - if (!pTabView->IsDrawSelMode()) - pViewData->GetViewShell()->SetDrawShell( sal_False ); + pViewData->GetViewShell()->UpdateDrawShell(); break; case SID_COPY: diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx index 137ddfa654d2..2f898068399a 100644 --- a/sc/source/ui/drawfunc/drtxtob2.cxx +++ b/sc/source/ui/drawfunc/drtxtob2.cxx @@ -83,8 +83,7 @@ void __EXPORT ScDrawTextObjectBar::ExecuteGlobal( SfxRequest &rReq ) case SID_CUT: pView->DoCut(); - if (!pTabView->IsDrawSelMode()) - pViewData->GetViewShell()->SetDrawShell( sal_False ); + pViewData->GetViewShell()->UpdateDrawShell(); break; case SID_PASTE: diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx index c443be157f8c..d22dc4969cff 100644 --- a/sc/source/ui/inc/dbdocfun.hxx +++ b/sc/source/ui/inc/dbdocfun.hxx @@ -40,7 +40,6 @@ struct ScSortParam; struct ScSubTotalParam; class SfxViewFrame; -class SbaSelectionList; class ScDBData; class ScDocShell; class ScAddress; @@ -51,21 +50,14 @@ namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } - namespace sdbc { - class XResultSet; - } } } } +namespace svx { + class ODataAccessDescriptor; +} + // --------------------------------------------------------------------------- // ----------------------------------------------------------------- -class SbaSelectionList: public List , public SvRefBase -{ -public: - SbaSelectionList(): - List(CONTAINER_MAXBLOCKSIZE,100,100){} -}; - -SV_DECL_IMPL_REF(SbaSelectionList) class ScDBDocFunc @@ -79,29 +71,23 @@ public: ScDBDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {} ~ScDBDocFunc() {} - void UpdateImport( const String& rTarget, const String& rDBName, - const String& rTableName, const String& rStatement, - sal_Bool bNative, sal_uInt8 nType, - const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XResultSet >& xResultSet, - const SbaSelectionList* pSelection ); - - sal_Bool DoImport( SCTAB nTab, const ScImportParam& rParam, - const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XResultSet >& xResultSet, - const SbaSelectionList* pSelection, sal_Bool bRecord, + void UpdateImport( const String& rTarget, const svx::ODataAccessDescriptor& rDescriptor ); + + sal_Bool DoImport( SCTAB nTab, const ScImportParam& rParam, + const svx::ODataAccessDescriptor* pDescriptor, // used for selection and existing ResultSet + sal_Bool bRecord, sal_Bool bAddrInsert = sal_False ); - sal_Bool DoImportUno( const ScAddress& rPos, + sal_Bool DoImportUno( const ScAddress& rPos, const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue>& aArgs ); static void ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFrame ); - sal_Bool Sort( SCTAB nTab, const ScSortParam& rSortParam, + sal_Bool Sort( SCTAB nTab, const ScSortParam& rSortParam, sal_Bool bRecord, sal_Bool bPaint, sal_Bool bApi ); - SC_DLLPUBLIC sal_Bool Query( SCTAB nTab, const ScQueryParam& rQueryParam, + SC_DLLPUBLIC sal_Bool Query( SCTAB nTab, const ScQueryParam& rQueryParam, const ScRange* pAdvSource, sal_Bool bRecord, sal_Bool bApi ); sal_Bool DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index 26d2262b5a8e..1e3d64bf2f74 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -50,6 +50,7 @@ struct ScTableInfo; class ScTabViewShell; class ScPageBreakData; class FmFormView; +class ScFieldEditEngine; // #i74769# SdrPaintWindow predefine class SdrPaintWindow; @@ -182,6 +183,8 @@ private: void DrawRotatedFrame( const Color* pForceColor ); // pixel + ScFieldEditEngine* CreateOutputEditEngine(); + public: ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, ScTableInfo& rTabInfo, ScDocument* pNewDoc, diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx index e5f901720b36..3f23b830dea8 100644 --- a/sc/source/ui/inc/preview.hxx +++ b/sc/source/ui/inc/preview.hxx @@ -64,8 +64,9 @@ private: FmFormView* pDrawView; // intern: - sal_Bool bInPaint; - sal_Bool bInGetState; + bool bInPaint; + bool bInSetZoom; + sal_Bool bInGetState; ScDocShell* pDocShell; ScPreviewShell* pViewShell; diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx index 601496c315eb..264ec76d13b7 100644 --- a/sc/source/ui/inc/printfun.hxx +++ b/sc/source/ui/inc/printfun.hxx @@ -247,14 +247,6 @@ public: const ScPrintState& rState, const ScPrintOptions* pOptions ); - ScPrintFunc( ScDocShell* pShell, Window* pWindow, SCTAB nTab, - long nPage = 0, long nDocP = 0, - const ScRange* pArea = NULL, - const ScPrintOptions* pOptions = NULL ); - - ScPrintFunc( ScDocShell* pShell, Window* pWindow, - const ScPrintState& rState, - const ScPrintOptions* pOptions ); ~ScPrintFunc(); static void DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double nPrintFactor, @@ -276,10 +268,8 @@ public: void ApplyPrintSettings(); // aus DoPrint() schon gerufen long DoPrint( const MultiSelection& rPageRanges, - /*long nStartPage, long nDisplayStart, sal_Bool bDoPrint, - SfxProgress* pProgress, ScPreviewLocationData* pLocationData );*/ - long nStartPage, long nDisplayStart, sal_Bool bDoPrint = sal_True, - SfxProgress* pProgress = NULL, ScPreviewLocationData* pLocationData = NULL); + long nStartPage, long nDisplayStart, sal_Bool bDoPrint, + ScPreviewLocationData* pLocationData ); // Werte abfragen - sofort diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 241b1842ad07..b310eaa244b2 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -309,7 +309,7 @@ public: void ExecDrawOpt(SfxRequest& rReq); void GetDrawOptState(SfxItemSet &rSet); - + void UpdateDrawShell(); void SetDrawShell( sal_Bool bActive ); void SetDrawTextShell( sal_Bool bActive ); diff --git a/sc/source/ui/inc/undodraw.hxx b/sc/source/ui/inc/undodraw.hxx index 20db8643e3ca..cc2264807ace 100644 --- a/sc/source/ui/inc/undodraw.hxx +++ b/sc/source/ui/inc/undodraw.hxx @@ -37,6 +37,8 @@ class ScUndoDraw: public SfxUndoAction SfxUndoAction* pDrawUndo; ScDocShell* pDocShell; + void UpdateSubShell(); + public: TYPEINFO(); ScUndoDraw( SfxUndoAction* pUndo, ScDocShell* pDocSh ); diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index 4f99f90b8437..a63a897b007c 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -3468,6 +3468,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 Text [ en-US ] = "The value for the y coordinate." ; }; }; + // -=*# Resource for function DEG #*=- Resource SC_OPCODE_DEG { diff --git a/sc/source/ui/undo/undodraw.cxx b/sc/source/ui/undo/undodraw.cxx index 860796fc9a15..1c7a65d3563c 100644 --- a/sc/source/ui/undo/undodraw.cxx +++ b/sc/source/ui/undo/undodraw.cxx @@ -28,141 +28,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - -//------------------------------------------------------------------ - -// TOOLS -#define _BIGINT_HXX -#define _SFXMULTISEL_HXX -#define _STACK_HXX -#define _QUEUE_HXX -#define _DYNARR_HXX -#define _TREELIST_HXX -#define _CACHESTR_HXX -#define _NEW_HXX -//#define _SHL_HXX -//#define _LINK_HXX -//#define _ERRCODE_HXX -//#define _GEN_HXX -//#define _FRACT_HXX -//#define _STRING_HXX -//#define _MTF_HXX -//#define _CONTNR_HXX -//#define _LIST_HXX -//#define _TABLE_HXX -#define _DYNARY_HXX -//#define _UNQIDX_HXX -#define _SVMEMPOOL_HXX -//#define _UNQID_HXX -//#define _DEBUG_HXX -//#define _DATE_HXX -//#define _TIME_HXX -//#define _DATETIME_HXX -//#define _INTN_HXX -//#define _WLDCRD_HXX -//#define _FSYS_HXX -//#define _STREAM_HXX -#define _CACHESTR_HXX -#define _SV_MULTISEL_HXX - -//SV -//#define _CLIP_HXX -#define _CONFIG_HXX -#define _CURSOR_HXX -#define _FONTDLG_HXX -#define _PRVWIN_HXX -//#define _COLOR_HXX -//#define _PAL_HXX -//#define _BITMAP_HXX -//#define _GDIOBJ_HXX -//#define _POINTR_HXX -//#define _ICON_HXX -//#define _IMAGE_HXX -//#define _KEYCOD_HXX -//#define _EVENT_HXX -#define _HELP_HXX -//#define _APP_HXX -//#define _MDIAPP_HXX -//#define _TIMER_HXX -//#define _METRIC_HXX -//#define _REGION_HXX -//#define _OUTDEV_HXX -//#define _SYSTEM_HXX -//#define _VIRDEV_HXX -//#define _JOBSET_HXX -//#define _PRINT_HXX -//#define _WINDOW_HXX -//#define _SYSWIN_HXX -//#define _WRKWIN_HXX -#define _MDIWIN_HXX -//#define _FLOATWIN_HXX -//#define _DOCKWIN_HXX -//#define _CTRL_HXX -//#define _SCRBAR_HXX -//#define _BUTTON_HXX -//#define _IMAGEBTN_HXX -//#define _FIXED_HXX -//#define _GROUP_HXX -//#define _EDIT_HXX -//#define _COMBOBOX_HXX -//#define _LSTBOX_HXX -//#define _SELENG_HXX -//#define _SPLIT_HXX -#define _SPIN_HXX -//#define _FIELD_HXX -//#define _MOREBTN_HXX -//#define _TOOLBOX_HXX -//#define _STATUS_HXX -//#define _DIALOG_HXX -//#define _MSGBOX_HXX -//#define _SYSDLG_HXX -#define _FILDLG_HXX -//#define _PRNDLG_HXX -#define _COLDLG_HXX -//#define _TABDLG_HXX -//#define _MENU_HXX -//#define _GDIMTF_HXX -//#define _POLY_HXX -//#define _ACCEL_HXX -//#define _GRAPH_HXX -#define _SOUND_HXX - - -#define SI_NOITEMS -//#define SI_NODRW -#define _SI_NOSBXCONTROLS -#define _SI_NOOTHERFORMS -#define _SI_NOCONTROL -#define _SI_NOSBXCONTROLS -#define _SIDLL_HXX - -// SFX -#define _SFXAPPWIN_HXX -#define _SFX_SAVEOPT_HXX -//#define _SFX_CHILDWIN_HXX -//#define _SFXCTRLITEM_HXX -#define _SFXPRNMON_HXX -#define _INTRO_HXX -#define _SFXMSGDESCR_HXX -#define _SFXMSGPOOL_HXX -#define _SFXFILEDLG_HXX -#define _PASSWD_HXX -#define _SFXTBXCTRL_HXX -#define _SFXSTBITEM_HXX -#define _SFXMNUITEM_HXX -#define _SFXIMGMGR_HXX -#define _SFXTBXMGR_HXX -#define _SFXSTBMGR_HXX -#define _SFX_MINFITEM_HXX -#define _SFXEVENT_HXX - // INCLUDE --------------------------------------------------------------- #include <svx/svdundo.hxx> #include "undodraw.hxx" #include "docsh.hxx" +#include "tabvwsh.hxx" // ----------------------------------------------------------------------- @@ -233,12 +105,21 @@ sal_Bool __EXPORT ScUndoDraw::Merge( SfxUndoAction* pNextAction ) return sal_False; } +void ScUndoDraw::UpdateSubShell() +{ + // #i26822# remove the draw shell if the selected object has been removed + ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(); + if (pViewShell) + pViewShell->UpdateDrawShell(); +} + void __EXPORT ScUndoDraw::Undo() { if (pDrawUndo) { pDrawUndo->Undo(); pDocShell->SetDrawModified(); + UpdateSubShell(); } } @@ -248,6 +129,7 @@ void __EXPORT ScUndoDraw::Redo() { pDrawUndo->Redo(); pDocShell->SetDrawModified(); + UpdateSubShell(); } } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 3737e742b441..f5a94df0bfba 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1110,35 +1110,60 @@ sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, for (long nCol=0; nCol<nCols; nCol++) { const uno::Any& rElement = pColArr[nCol]; - uno::TypeClass eElemClass = rElement.getValueTypeClass(); - if ( eElemClass == uno::TypeClass_VOID ) - { - // void = "no value" - pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE ); - } - else if ( eElemClass == uno::TypeClass_BYTE || - eElemClass == uno::TypeClass_SHORT || - eElemClass == uno::TypeClass_UNSIGNED_SHORT || - eElemClass == uno::TypeClass_LONG || - eElemClass == uno::TypeClass_UNSIGNED_LONG || - eElemClass == uno::TypeClass_FLOAT || - eElemClass == uno::TypeClass_DOUBLE ) + switch( rElement.getValueTypeClass() ) { + case uno::TypeClass_VOID: + { + // void = "no value" + pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE ); + } + break; + // #87871# accept integer types because Basic passes a floating point // variable as byte, short or long if it's an integer number. - double fVal(0.0); - rElement >>= fVal; - pDoc->SetValue( nDocCol, nDocRow, nTab, fVal ); - } - else if ( eElemClass == uno::TypeClass_STRING ) - { - rtl::OUString aUStr; - rElement >>= aUStr; - if ( aUStr.getLength() ) - pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) ); + case uno::TypeClass_BYTE: + case uno::TypeClass_SHORT: + case uno::TypeClass_UNSIGNED_SHORT: + case uno::TypeClass_LONG: + case uno::TypeClass_UNSIGNED_LONG: + case uno::TypeClass_FLOAT: + case uno::TypeClass_DOUBLE: + { + double fVal(0.0); + rElement >>= fVal; + pDoc->SetValue( nDocCol, nDocRow, nTab, fVal ); + } + break; + + case uno::TypeClass_STRING: + { + rtl::OUString aUStr; + rElement >>= aUStr; + if ( aUStr.getLength() ) + pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) ); + } + break; + + // accept Sequence<FormulaToken> for formula cells + case uno::TypeClass_SEQUENCE: + { + uno::Sequence< sheet::FormulaToken > aTokens; + if ( rElement >>= aTokens ) + { + ScTokenArray aTokenArray; + ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokens ); + ScAddress aPos( nDocCol, nDocRow, nTab ); + ScBaseCell* pNewCell = new ScFormulaCell( pDoc, aPos, &aTokenArray ); + pDoc->PutCell( aPos, pNewCell ); + } + else + bError = true; + } + break; + + default: + bError = true; // invalid type } - else - bError = sal_True; // invalid type ++nDocCol; } @@ -5907,12 +5932,11 @@ void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue aParam.nRow2 = aRange.aEnd.Row(); //! TODO: could we get passed a valid result set by any means? - uno::Reference< sdbc::XResultSet > xResultSet; 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, sal_True, sal_False ); //! Api-Flag als Parameter + aFunc.DoImport( nTab, aParam, NULL, sal_True ); //! Api-Flag as parameter } } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index f72141717159..42ed9179e6aa 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -108,6 +108,7 @@ const SfxItemPropertyMapEntry* lcl_GetDataPilotDescriptorBaseMap() { {MAP_CHAR_LEN(SC_UNO_COLGRAND), 0, &getBooleanCppuType(), 0, 0 }, {MAP_CHAR_LEN(SC_UNO_DRILLDOWN), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNO_GRANDTOTAL_NAME),0,&getCppuType((rtl::OUString*)0), beans::PropertyAttribute::MAYBEVOID, 0 }, {MAP_CHAR_LEN(SC_UNO_IGNEMPROWS), 0, &getBooleanCppuType(), 0, 0 }, {MAP_CHAR_LEN(SC_UNO_IMPORTDESC), 0, &getCppuType((uno::Sequence<beans::PropertyValue>*)0), 0, 0 }, {MAP_CHAR_LEN(SC_UNO_RPTEMPTY), 0, &getBooleanCppuType(), 0, 0 }, @@ -343,8 +344,6 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd if ( pColl ) { // count tables on this sheet - // api only handles sheet data at this time - //! allow all data sources!!! sal_Int32 nFound = 0; sal_uInt16 nCount = pColl->GetCount(); for (sal_uInt16 i=0; i<nCount; i++) @@ -494,8 +493,6 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException) if ( pColl ) { // count tables on this sheet - // api only handles sheet data at this time - //! allow all data sources!!! sal_uInt16 nFound = 0; sal_uInt16 nCount = pColl->GetCount(); @@ -557,8 +554,6 @@ Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames() if ( pColl ) { // count tables on this sheet - // api only handles sheet data at this time - //! allow all data sources!!! sal_uInt16 nFound = 0; sal_uInt16 nCount = pColl->GetCount(); @@ -600,9 +595,6 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName ) sal_uInt16 nCount = pColl->GetCount(); for (sal_uInt16 i=0; i<nCount; i++) { - // api only handles sheet data at this time - //! allow all data sources!!! - ScDPObject* pDPObj = (*pColl)[i]; if ( pDPObj->GetOutRange().aStart.Tab() == nTab && pDPObj->GetName() == aNamStr ) @@ -824,6 +816,12 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp { aNewData.SetDrillDown(::cppu::any2bool( aValue )); } + else if ( aNameString.EqualsAscii( SC_UNO_GRANDTOTAL_NAME ) ) + { + rtl::OUString aStrVal; + if ( aValue >>= aStrVal ) + aNewData.SetGrandTotalName(aStrVal); + } else if ( aNameString.EqualsAscii( SC_UNO_IMPORTDESC ) ) { uno::Sequence<beans::PropertyValue> aArgSeq; @@ -967,6 +965,12 @@ Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPrope { aRet = ::cppu::bool2any( aNewData.GetDrillDown() ); } + else if ( aNameString.EqualsAscii( SC_UNO_GRANDTOTAL_NAME ) ) + { + const rtl::OUString* pGrandTotalName = aNewData.GetGrandTotalName(); + if (pGrandTotalName) + aRet <<= *pGrandTotalName; // same behavior as in ScDPSource + } else if ( aNameString.EqualsAscii( SC_UNO_IMPORTDESC ) ) { const ScImportSourceDesc* pImportDesc = pDPObject->GetImportSourceDesc(); diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 31ef83ee91db..10edb4f9d1aa 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -1893,8 +1893,7 @@ void SAL_CALL ScDatabaseRangeObj::refresh() throw(uno::RuntimeException) SCCOL nDummyCol; SCROW nDummyRow; pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow ); - uno::Reference< sdbc::XResultSet > xResultSet; - bContinue = aFunc.DoImport( nTab, aImportParam, xResultSet, NULL, sal_True, sal_False ); //! Api-Flag als Parameter + bContinue = aFunc.DoImport( nTab, aImportParam, NULL, sal_True ); //! Api-Flag as parameter } // interne Operationen (sort, query, subtotal) nur, wenn kein Fehler diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 23eb1abd2d82..b47c0aac3163 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -87,6 +87,7 @@ #include "rangeutl.hxx" #include "markdata.hxx" #include "docoptio.hxx" +#include "scextopt.hxx" #include "unoguard.hxx" #include "unonames.hxx" #include "shapeuno.hxx" @@ -903,6 +904,16 @@ sal_Bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, ScTabViewShell* pViewSh = pViewObj->GetViewShell(); if (pViewSh) { + // #i95280# when printing from the shell, the view is never activated, + // so Excel view settings must also be evaluated here. + ScExtDocOptions* pExtOpt = pDocShell->GetDocument()->GetExtDocOptions(); + if ( pExtOpt && pExtOpt->IsChanged() ) + { + pViewSh->GetViewData()->ReadExtOptions(*pExtOpt); // Excel view settings + pViewSh->SetTabNo( pViewSh->GetViewData()->GetTabNo(), sal_True ); + pExtOpt->SetChanged( false ); + } + const ScMarkData& rViewMark = pViewSh->GetViewData()->GetMarkData(); SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); for (SCTAB nTab = 0; nTab < nTabCount; nTab++) @@ -1052,7 +1063,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab ); long nTabStart = pPrintFuncCache->GetTabStart( nTab ); - (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_False, NULL, NULL ); + (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_False, NULL ); ScRange aCellRange; sal_Bool bWasCellRange = aFunc.GetLastSourceRange( aCellRange ); @@ -1076,11 +1087,6 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 pArray[2].Value <<= aRangeAddress; } - #if 0 - const ScPrintOptions& rPrintOpt = - #endif - // FIXME: is this for side effects ? - SC_MOD()->GetPrintOptions(); if( ! pPrinterOptions ) pPrinterOptions = new ScPrintUIOptions; else @@ -1186,7 +1192,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec //<---i56629 } - (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_True, NULL, NULL ); + (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_True, NULL ); // resolve the hyperlinks for PDF export @@ -1268,7 +1274,12 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec } if ( nPage >= 0 ) - pPDFData->SetLinkDest( aIter->nLinkId, pPDFData->CreateDest( aArea, nPage ) ); + { + if ( aIter->nLinkId != -1 ) + pPDFData->SetLinkDest( aIter->nLinkId, pPDFData->CreateDest( aArea, nPage ) ); + else + pPDFData->DescribeRegisteredDest( aIter->nDestId, aArea, nPage ); + } } } else diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx index c5dd11977478..eac95f94d779 100644 --- a/sc/source/ui/unoobj/notesuno.cxx +++ b/sc/source/ui/unoobj/notesuno.cxx @@ -27,35 +27,24 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" -#include <svl/smplhint.hxx> +#include "notesuno.hxx" -#include "rangelst.hxx" +#include <svl/smplhint.hxx> #include <editeng/unotext.hxx> #include <svx/svdpool.hxx> #include <svx/svdobj.hxx> -#include "notesuno.hxx" -#include "textuno.hxx" -#include "cellsuno.hxx" // getParent +#include <svx/unoshape.hxx> +#include <svx/svdocapt.hxx> + +#include "postit.hxx" +#include "cellsuno.hxx" #include "docsh.hxx" #include "docfunc.hxx" #include "hints.hxx" #include "editsrc.hxx" #include "miscuno.hxx" - -// setVisible: -#include <svx/svdundo.hxx> -#include "drwlayer.hxx" -#include "detfunc.hxx" -#include "undocell.hxx" #include "unoguard.hxx" -#include "userdat.hxx" -#include <editeng/outlobj.hxx> -#include <svx/unoshape.hxx> -#include <svx/svdocapt.hxx> -#include <svx/svditer.hxx> -#include <svx/svdpage.hxx> -#include <com/sun/star/drawing/XShapeDescriptor.hpp> using namespace com::sun::star; @@ -75,7 +64,7 @@ const SvxItemPropertySet* lcl_GetAnnotationPropertySet() //------------------------------------------------------------------------ SC_SIMPLE_SERVICE_INFO( ScAnnotationObj, "ScAnnotationObj", "com.sun.star.sheet.CellAnnotation" ) -SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" ) +//SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" ) //------------------------------------------------------------------------ @@ -248,7 +237,11 @@ uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape( throw(::com::sun::star::uno::RuntimeException) { ScUnoGuard aGuard; - return new ScAnnotationShapeObj(pDocShell, aCellPos); + uno::Reference < drawing::XShape > xShape; + if( const ScPostIt* pNote = ImplGetNote() ) + if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) ) + xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY ); + return xShape; } SvxUnoText& ScAnnotationObj::GetUnoText() @@ -267,463 +260,5 @@ const ScPostIt* ScAnnotationObj::ImplGetNote() const { return pDocShell ? pDocShell->GetDocument()->GetNote( aCellPos ) : 0; } -//------------------------------------------------------------------------ - -ScAnnotationShapeObj::ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos) : - pDocShell( pDocSh ), - aCellPos( rPos ), - pUnoText( NULL ) -{ - pDocShell->GetDocument()->AddUnoObject(*this); - - // pUnoText is allocated on demand (GetUnoText) - // can't be aggregated because getString/setString is handled here -} - -SvxUnoText& ScAnnotationShapeObj::GetUnoText() -{ - if (!pUnoText) - { - ScAnnotationEditSource aEditSource( pDocShell, aCellPos ); - pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(), - uno::Reference<text::XText>() ); - pUnoText->acquire(); - } - return *pUnoText; -} - -uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape() -{ - if (!xShape.is()) - if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) ) - if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) ) - xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY ); - return xShape; -} - -ScAnnotationShapeObj::~ScAnnotationShapeObj() -{ - if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); - if (pUnoText) - pUnoText->release(); -} - -void ScAnnotationShapeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - if ( rHint.ISA( ScUpdateRefHint ) ) - { -// const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint; - - //! Ref-Update - } - else if ( rHint.ISA( SfxSimpleHint ) && - ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING ) - { - pDocShell = NULL; // ungueltig geworden - } -} - - -// XChild - -uno::Reference<uno::XInterface> SAL_CALL ScAnnotationShapeObj::getParent() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - - // Parent der Notiz ist die zugehoerige Zelle - //! existierendes Objekt finden und zurueckgeben ??? - - if (pDocShell) - return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos ); - - return NULL; -} - -void SAL_CALL ScAnnotationShapeObj::setParent( const uno::Reference<uno::XInterface>& /* Parent */ ) - throw(lang::NoSupportException, uno::RuntimeException) -{ - // hamma nich - //! Exception oder so ??! -} - -// XElementAccess -uno::Type SAL_CALL ScAnnotationShapeObj::getElementType( ) throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - - return GetUnoText().getElementType(); -} - -sal_Bool SAL_CALL ScAnnotationShapeObj::hasElements( ) throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - - return GetUnoText().hasElements(); -} - -// XEnumerationAccess -uno::Reference< container::XEnumeration > SAL_CALL ScAnnotationShapeObj::createEnumeration( ) throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - - return GetUnoText().createEnumeration(); -} - -// XTextRangeMover -void SAL_CALL ScAnnotationShapeObj::moveTextRange( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nParagraphs ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - - GetUnoText().moveTextRange( xRange, nParagraphs ); -} - -// XText -void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< text::XTextRange >& xRange, - const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb ) - throw (lang::IllegalArgumentException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - - GetUnoText().insertTextContent( xRange, xContent, bAbsorb ); -} - -void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent ) - throw (container::NoSuchElementException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - - GetUnoText().removeTextContent( xContent ); -} - -// XSimpleText - -uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursor() - throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - // Notizen brauchen keine Extrawurst - return GetUnoText().createTextCursor(); -} - -uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursorByRange( - const uno::Reference<text::XTextRange>& aTextPosition ) - throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - // Notizen brauchen keine Extrawurst - return GetUnoText().createTextCursorByRange(aTextPosition); -} - -rtl::OUString SAL_CALL ScAnnotationShapeObj::getString() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - return GetUnoText().getString(); -} - -void SAL_CALL ScAnnotationShapeObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetUnoText().setString(aText); -} - -void SAL_CALL ScAnnotationShapeObj::insertString( const uno::Reference<text::XTextRange>& xRange, - const rtl::OUString& aString, sal_Bool bAbsorb ) - throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetUnoText().insertString( xRange, aString, bAbsorb ); -} - -void SAL_CALL ScAnnotationShapeObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange, - sal_Int16 nControlCharacter, sal_Bool bAbsorb ) - throw(lang::IllegalArgumentException, uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb ); -} - -uno::Reference<text::XText> SAL_CALL ScAnnotationShapeObj::getText() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - return GetUnoText().getText(); -} - -uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getStart() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - return GetUnoText().getStart(); -} - -uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getEnd() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - return GetUnoText().getEnd(); -} - -// XShapeDescriptor -::rtl::OUString SAL_CALL ScAnnotationShapeObj::getShapeType( ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < drawing::XShapeDescriptor > xDesc(GetXShape(), uno::UNO_QUERY); - if (xDesc.is()) - return xDesc->getShapeType(); - return rtl::OUString(); -} - -// XShape -awt::Point SAL_CALL ScAnnotationShapeObj::getPosition( ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetXShape(); - return xShape.is() ? xShape->getPosition() : awt::Point(); -} - -void SAL_CALL ScAnnotationShapeObj::setPosition( const awt::Point& aPosition ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetXShape(); - if( xShape.is() ) - xShape->setPosition(aPosition); -} - -awt::Size SAL_CALL ScAnnotationShapeObj::getSize( ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetXShape(); - return xShape.is() ? xShape->getSize() : awt::Size(); -} - -void SAL_CALL ScAnnotationShapeObj::setSize( const awt::Size& aSize ) - throw (beans::PropertyVetoException, uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetXShape(); - if( xShape.is() ) - xShape->setSize(aSize); -} - -// XPropertyState -beans::PropertyState SAL_CALL ScAnnotationShapeObj::getPropertyState( const rtl::OUString& PropertyName ) - throw (beans::UnknownPropertyException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY); - if (xState.is()) - return xState->getPropertyState( PropertyName ); - return beans::PropertyState(); -} - -uno::Sequence< beans::PropertyState > SAL_CALL ScAnnotationShapeObj::getPropertyStates( - const uno::Sequence< rtl::OUString >& aPropertyName ) - throw (beans::UnknownPropertyException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY); - if (xState.is()) - return xState->getPropertyStates( aPropertyName ); - return uno::Sequence< beans::PropertyState >(); -} - -void SAL_CALL ScAnnotationShapeObj::setPropertyToDefault( const ::rtl::OUString& PropertyName ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY); - if (xState.is()) - xState->setPropertyToDefault( PropertyName ); -} - -uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyDefault( const rtl::OUString& aPropertyName ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY); - if (xState.is()) - return xState->getPropertyDefault( aPropertyName ); - return uno::Any(); -} - -// XPropertySet -uno::Reference< beans::XPropertySetInfo > SAL_CALL ScAnnotationShapeObj::getPropertySetInfo( ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->getPropertySetInfo(); - return uno::Reference< beans::XPropertySetInfo >(); -} - -void SAL_CALL ScAnnotationShapeObj::setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue ) - throw (beans::UnknownPropertyException, - beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->setPropertyValue( aPropertyName, aValue ); -} - -uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyValue( const rtl::OUString& PropertyName ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->getPropertyValue( PropertyName ); - return uno::Any(); -} - -void SAL_CALL ScAnnotationShapeObj::addPropertyChangeListener( const rtl::OUString& aPropertyName, - const uno::Reference< beans::XPropertyChangeListener >& xListener ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->addPropertyChangeListener( aPropertyName, xListener ); -} - -void SAL_CALL ScAnnotationShapeObj::removePropertyChangeListener( const rtl::OUString& aPropertyName, - const uno::Reference< beans::XPropertyChangeListener >& aListener ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->removePropertyChangeListener( aPropertyName, aListener ); -} - -void SAL_CALL ScAnnotationShapeObj::addVetoableChangeListener( const rtl::OUString& PropertyName, - const uno::Reference< beans::XVetoableChangeListener >& aListener ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->addVetoableChangeListener( PropertyName, aListener ); -} - -void SAL_CALL ScAnnotationShapeObj::removeVetoableChangeListener( const rtl::OUString& PropertyName, - const uno::Reference< beans::XVetoableChangeListener >& aListener ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->removeVetoableChangeListener( PropertyName, aListener ); -} - - // XMultiPropertySet -void SAL_CALL ScAnnotationShapeObj::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames, - const uno::Sequence< uno::Any >& aValues ) - throw (beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->setPropertyValues( aPropertyNames, aValues ); -} - -uno::Sequence< uno::Any > SAL_CALL ScAnnotationShapeObj::getPropertyValues( - const uno::Sequence< rtl::OUString >& aPropertyNames ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->getPropertyValues( aPropertyNames ); - return uno::Sequence< uno::Any >(); -} - -void SAL_CALL ScAnnotationShapeObj::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames, - const uno::Reference< beans::XPropertiesChangeListener >& xListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->addPropertiesChangeListener( aPropertyNames, xListener ); -} - -void SAL_CALL ScAnnotationShapeObj::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& xListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->removePropertiesChangeListener( xListener ); -} - -void SAL_CALL ScAnnotationShapeObj::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames, - const uno::Reference< beans::XPropertiesChangeListener >& xListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->firePropertiesChangeEvent( aPropertyNames, xListener ); -} - - // XComponent -void SAL_CALL ScAnnotationShapeObj::dispose( ) throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY); - if (xComp.is()) - xComp->dispose(); - if (xShape.is()) - xShape.clear(); -} - -void SAL_CALL ScAnnotationShapeObj::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY); - if (xComp.is()) - xComp->addEventListener( xListener ); -} - -void SAL_CALL ScAnnotationShapeObj::removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY); - if (xComp.is()) - xComp->removeEventListener( aListener ); -} //------------------------------------------------------------------------ - - - - diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index fd31c233dc19..fe77e5ef32e6 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -102,7 +102,8 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) : pShapePropertySet(NULL), pShapePropertyState(NULL), pImplementationId(NULL), - bIsTextShape(sal_False), + bIsTextShape(false), + bIsNoteCaption(false), bInitializedNotifier(false) { comphelper::increment( m_refCount ); @@ -127,6 +128,7 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) : SdrObject* pObj = GetSdrObject(); if ( pObj ) { + bIsNoteCaption = ScDrawLayer::IsNoteCaption( pObj ); lcl_initializeNotifier( *pObj, *this ); bInitializedNotifier = true; } @@ -151,6 +153,9 @@ uno::Any SAL_CALL ScShapeObj::queryInterface( const uno::Type& rType ) if ( !aRet.hasValue() && bIsTextShape ) aRet = ScShapeObj_TextBase::queryInterface( rType ); + if ( !aRet.hasValue() && bIsNoteCaption ) + aRet = ScShapeObj_ChildBase::queryInterface( rType ); + if ( !aRet.hasValue() && mxShapeAgg.is() ) aRet = mxShapeAgg->queryAggregation( rType ); @@ -1261,6 +1266,48 @@ void SAL_CALL ScShapeObj::setString( const rtl::OUString& aText ) throw(uno::Run throw uno::RuntimeException(); } +// XChild + +uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent() throw (uno::RuntimeException) +{ + ScUnoGuard aGuard; + + // receive cell position from caption object (parent of a note caption is the note cell) + SdrObject* pObj = GetSdrObject(); + if( pObj ) + { + ScDrawLayer* pModel = (ScDrawLayer*)pObj->GetModel(); + SdrPage* pPage = pObj->GetPage(); + if ( pModel ) + { + ScDocument* pDoc = pModel->GetDocument(); + if ( pDoc ) + { + SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); + if ( pObjSh && pObjSh->ISA(ScDocShell) ) + { + ScDocShell* pDocSh = (ScDocShell*)pObjSh; + + SCTAB nTab = 0; + if ( lcl_GetPageNum( pPage, *pModel, nTab ) ) + { + const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab ); + if( pCaptData ) + return static_cast< ::cppu::OWeakObject* >( new ScCellObj( pDocSh, pCaptData->maStart ) ); + } + } + } + } + } + + return 0; +} + +void SAL_CALL ScShapeObj::setParent( const uno::Reference< uno::XInterface >& ) throw (lang::NoSupportException, uno::RuntimeException) +{ + throw lang::NoSupportException(); +} + // XTypeProvider uno::Sequence<uno::Type> SAL_CALL ScShapeObj::getTypes() throw(uno::RuntimeException) @@ -1517,5 +1564,12 @@ uno::Sequence< ::rtl::OUString > SAL_CALL ScShapeObj::getSupportedServiceNames( aSupported.realloc( aSupported.getLength() + 1 ); aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.Shape" ) ); + + if( bIsNoteCaption ) + { + aSupported.realloc( aSupported.getLength() + 1 ); + aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.CellAnnotationShape" ) ); + } + return aSupported; } diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 8db71ad9752f..4b6d14470063 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -504,8 +504,7 @@ sal_Bool ScDBFunc::ImportData( const ScImportParam& rParam, sal_Bool bRecord ) } ScDBDocFunc aDBDocFunc( *GetViewData()->GetDocShell() ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet; - return aDBDocFunc.DoImport( GetViewData()->GetTabNo(), rParam, xResultSet, NULL, bRecord ); + return aDBDocFunc.DoImport( GetViewData()->GetTabNo(), rParam, NULL, bRecord ); } diff --git a/sc/source/ui/view/drawutil.cxx b/sc/source/ui/view/drawutil.cxx index a5a4a7ee1c1d..89287a93e14b 100644 --- a/sc/source/ui/view/drawutil.cxx +++ b/sc/source/ui/view/drawutil.cxx @@ -81,6 +81,15 @@ void ScDrawUtil::CalcScale( ScDocument* pDoc, SCTAB nTab, nPixelY += ScViewData::ToPixel(nHeight, nPPTY); } + // #i116848# To get a large-enough number for PixelToLogic, multiply the integer values + // instead of using a larger number of rows + long nMultiply = 2000000 / nTwipsY; + if ( nMultiply > 1 ) + { + nTwipsY *= nMultiply; + nPixelY *= nMultiply; + } + MapMode aHMMMode( MAP_100TH_MM, Point(), rZoomX, rZoomY ); Point aPixelLog = pDev->PixelToLogic( Point( nPixelX,nPixelY ), aHMMMode ); diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 1c0d38ee18e5..76984b813063 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -283,7 +283,7 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const if (nEndCol<20) nEndCol = 20; if (nEndRow<20) - nEndRow = 1000; + nEndRow = 20; Fraction aZoom(1,1); ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom, diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index cc63f9b97a62..57b365eb228b 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -377,7 +377,7 @@ void ScDrawView::RecalcScale() if (nEndCol<20) nEndCol = 20; if (nEndRow<20) - nEndRow = 1000; + nEndRow = 20; // #i116848# instead of a large row number for an empty sheet, heights are multiplied in CalcScale ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev,aZoomX,aZoomY,nPPTX,nPPTY, aScaleX,aScaleY ); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index ecc6f19d43e5..c9ed04ce2db9 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1222,13 +1222,22 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) if( pSet ) { - const SvxUnderlineItem& rUnderline = (const SvxUnderlineItem&)pSet->Get( ATTR_FONT_UNDERLINE ); + const SfxPoolItem& rUnderline = pSet->Get( ATTR_FONT_UNDERLINE ); if( rUnderline.ISA(SvxUnderlineItem) ) { pTabViewShell->ApplyAttr( rUnderline ); pNewSet->Put( rUnderline,rUnderline.Which() ); } + else if ( rUnderline.ISA(SvxTextLineItem) ) + { + // #i106580# also allow SvxTextLineItem (base class of SvxUnderlineItem) + const SvxTextLineItem& rTextLineItem = static_cast<const SvxTextLineItem&>(rUnderline); + SvxUnderlineItem aNewItem( rTextLineItem.GetLineStyle(), rTextLineItem.Which() ); + aNewItem.SetColor( rTextLineItem.GetColor() ); + pTabViewShell->ApplyAttr( aNewItem ); + pNewSet->Put( aNewItem, aNewItem.Which() ); + } } else { diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index 295caae639af..e7d9e4e318b4 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -265,7 +265,7 @@ MapMode ScGridWindow::GetDrawMapMode( sal_Bool bForce ) SCROW nEndRow = 0; pDoc->GetTableArea( nTab, nEndCol, nEndRow ); if (nEndCol<20) nEndCol = 20; - if (nEndRow<20) nEndRow = 1000; + if (nEndRow<20) nEndRow = 20; ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, this, pViewData->GetZoomX(),pViewData->GetZoomY(), pViewData->GetPPTX(),pViewData->GetPPTY(), diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index b1d6787d3ce6..2df47d16e195 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -532,9 +532,9 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth ) if (eType == CELLTYPE_FORMULA) { ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell); - if (pFCell->GetErrCode() != 0) + if (pFCell->GetErrCode() != 0 || pOutput->bShowFormulas) { - SetHashText(); // If the error string doesn't fit, always use "###" + SetHashText(); // If the error string doesn't fit, always use "###". Also for "display formulas" (#i116691#) return; } // If it's formula, the result must be a value. @@ -1905,6 +1905,26 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic ) // ------------------------------------------------------------------------------- +ScFieldEditEngine* ScOutputData::CreateOutputEditEngine() +{ + ScFieldEditEngine* pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); + pEngine->SetUpdateMode( sal_False ); + // a RefDevice always has to be set, otherwise EditEngine would create a VirtualDevice + pEngine->SetRefDevice( pFmtDevice ); + sal_uInt32 nCtrl = pEngine->GetControlWord(); + if ( bShowSpellErrors ) + nCtrl |= EE_CNTRL_ONLINESPELLING; + if ( eType == OUTTYPE_PRINTER ) + nCtrl &= ~EE_CNTRL_MARKFIELDS; + if ( eType == OUTTYPE_WINDOW && pRefDevice == pFmtDevice ) + nCtrl &= ~EE_CNTRL_FORMAT100; // use the actual MapMode + pEngine->SetControlWord( nCtrl ); + pDoc->ApplyAsianEditSettings( *pEngine ); + pEngine->EnableAutoColor( bUseStyleColor ); + pEngine->SetDefaultHorizontalTextDirection( (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); + return pEngine; +} + void lcl_ClearEdit( EditEngine& rEngine ) // Text und Attribute { rEngine.SetUpdateMode( sal_False ); @@ -2221,29 +2241,10 @@ void ScOutputData::DrawEdit(sal_Bool bPixelToLogic) // if (!pEngine) - { - // Ein RefDevice muss auf jeden Fall gesetzt werden, - // sonst legt sich die EditEngine ein VirtualDevice an! - pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); - pEngine->SetUpdateMode( sal_False ); - pEngine->SetRefDevice( pFmtDevice ); // always set - sal_uLong nCtrl = pEngine->GetControlWord(); - if ( bShowSpellErrors ) - nCtrl |= EE_CNTRL_ONLINESPELLING; - if ( eType == OUTTYPE_PRINTER ) - nCtrl &= ~EE_CNTRL_MARKFIELDS; - pEngine->SetControlWord( nCtrl ); - pEngine->SetForbiddenCharsTable( pDoc->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDoc->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDoc->GetAsianKerning() ); - pEngine->EnableAutoColor( bUseStyleColor ); - pEngine->SetDefaultHorizontalTextDirection( - (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); - } + pEngine = CreateOutputEditEngine(); else lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False) - sal_Bool bCellIsValue = lcl_SafeIsValue(pCell); SvxCellHorJustify eHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&) @@ -2285,8 +2286,6 @@ void ScOutputData::DrawEdit(sal_Bool bPixelToLogic) eHorJust = SVX_HOR_JUSTIFY_RIGHT; } - - SvxCellHorJustify eOutHorJust = ( eHorJust != SVX_HOR_JUSTIFY_STANDARD ) ? eHorJust : ( bCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT ); @@ -3054,25 +3053,7 @@ void ScOutputData::DrawRotated(sal_Bool bPixelToLogic) if (!bHidden) { if (!pEngine) - { - // Ein RefDevice muss auf jeden Fall gesetzt werden, - // sonst legt sich die EditEngine ein VirtualDevice an! - pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); - pEngine->SetUpdateMode( sal_False ); - pEngine->SetRefDevice( pFmtDevice ); // always set - sal_uLong nCtrl = pEngine->GetControlWord(); - if ( bShowSpellErrors ) - nCtrl |= EE_CNTRL_ONLINESPELLING; - if ( eType == OUTTYPE_PRINTER ) - nCtrl &= ~EE_CNTRL_MARKFIELDS; - pEngine->SetControlWord( nCtrl ); - pEngine->SetForbiddenCharsTable( pDoc->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDoc->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDoc->GetAsianKerning() ); - pEngine->EnableAutoColor( bUseStyleColor ); - pEngine->SetDefaultHorizontalTextDirection( - (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); - } + pEngine = CreateOutputEditEngine(); else lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False) diff --git a/sc/source/ui/view/pfuncache.cxx b/sc/source/ui/view/pfuncache.cxx index 6bb14163b227..4105bfb98db5 100644 --- a/sc/source/ui/view/pfuncache.cxx +++ b/sc/source/ui/view/pfuncache.cxx @@ -64,6 +64,11 @@ ScPrintFuncCache::ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark, ScDocument* pDoc = pDocSh->GetDocument(); SCTAB nTabCount = pDoc->GetTableCount(); + + // avoid repeated progress bars if row heights for all sheets are needed + if ( nTabCount > 1 && rMark.GetSelectCount() == nTabCount ) + pDocSh->UpdatePendingRowHeights( nTabCount-1, true ); + SCTAB nTab; for ( nTab=0; nTab<nTabCount; nTab++ ) { @@ -72,8 +77,6 @@ ScPrintFuncCache::ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark, long nThisTab = 0; if ( rMark.GetTableSelect( nTab ) ) { - pDoc->InvalidatePageBreaks( nTab ); // user print area (selection) may be different - ScPrintFunc aFunc( pDocSh, pPrinter, nTab, nAttrPage, 0, pSelRange, &aSelection.GetOptions() ); nThisTab = aFunc.GetTotalPages(); nFirstAttr[nTab] = aFunc.GetFirstPageNo(); // from page style or previous sheet @@ -125,7 +128,7 @@ void ScPrintFuncCache::InitLocations( const ScMarkData& rMark, OutputDevice* pDe aPage.Select( aPageRange ); ScPreviewLocationData aLocData( pDoc, pDev ); - aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_False, NULL, &aLocData ); + aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_False, &aLocData ); ScRange aCellRange; Rectangle aPixRect; diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 4f3f1d753f32..8fc9c6037cbf 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -109,7 +109,8 @@ ScPreview::ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pView bLocationValid( sal_False ), pLocationData( NULL ), pDrawView( NULL ), - bInPaint( sal_False ), + bInPaint( false ), + bInSetZoom( false ), bInGetState( sal_False ), pDocShell( pDocSh ), pViewShell( pViewSh ), @@ -139,6 +140,9 @@ ScPreview::ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pView SetUniqueId( HID_SC_WIN_PREVIEW ); SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() ); + + for (SCCOL i=0; i<=MAXCOL; i++) + nRight[i] = 0; // initialized with actual positions when markers are drawn } @@ -367,6 +371,16 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) DrawRect(Rectangle( 0, 0, aWinSize.Width(), -aOffset.Y() )); } + long nLeftMargin = 0; + long nRightMargin = 0; + long nTopMargin = 0; + long nBottomMargin = 0; + sal_Bool bHeaderOn = sal_False; + sal_Bool bFooterOn = sal_False; + + ScDocument* pDoc = pDocShell->GetDocument(); + sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + Size aLocalPageSize; if ( bValidPage ) { @@ -392,17 +406,65 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) aPage.SetTotalRange( Range(0,RANGE_MAX) ); aPage.Select( aPageRange ); - long nPrinted = pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, bDoPrint, NULL, pFillLocation ); + long nPrinted = pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, bDoPrint, pFillLocation ); DBG_ASSERT(nPrinted<=1, "was'n nu los?"); SetMapMode(aMMMode); -// sal_uInt16 nPrintZoom = pPrintFunc->GetZoom(); + + //init nLeftMargin ... in the ScPrintFunc::InitParam!!! + nLeftMargin = pPrintFunc->GetLeftMargin(); + nRightMargin = pPrintFunc->GetRightMargin(); + nTopMargin = pPrintFunc->GetTopMargin(); + nBottomMargin = pPrintFunc->GetBottomMargin(); + nHeaderHeight = pPrintFunc->GetHeader().nHeight; + nFooterHeight = pPrintFunc->GetFooter().nHeight; + bHeaderOn = pPrintFunc->GetHeader().bEnable; + bFooterOn = pPrintFunc->GetFooter().bEnable; + mnScale = pPrintFunc->GetZoom(); + + if ( bDoPrint && bPageMargin && pLocationData ) // don't make use of pLocationData while filling it + { + Rectangle aPixRect; + Rectangle aRectCellPosition; + Rectangle aRectPosition; + pLocationData->GetMainCellRange( aPageArea, aPixRect ); + if( !bLayoutRTL ) + { + pLocationData->GetCellPosition( aPageArea.aStart, aRectPosition ); + nLeftPosition = aRectPosition.Left(); + for( SCCOL i = aPageArea.aStart.Col(); i <= aPageArea.aEnd.Col(); i++ ) + { + pLocationData->GetCellPosition( ScAddress( i,aPageArea.aStart.Row(),aPageArea.aStart.Tab()),aRectCellPosition ); + nRight[i] = aRectCellPosition.Right(); + } + } + else + { + pLocationData->GetCellPosition( aPageArea.aEnd, aRectPosition ); + nLeftPosition = aRectPosition.Right()+1; + + pLocationData->GetCellPosition( aPageArea.aStart,aRectCellPosition ); + nRight[ aPageArea.aEnd.Col() ] = aRectCellPosition.Left(); + for( SCCOL i = aPageArea.aEnd.Col(); i > aPageArea.aStart.Col(); i-- ) + { + pLocationData->GetCellPosition( ScAddress( i,aPageArea.aEnd.Row(),aPageArea.aEnd.Tab()),aRectCellPosition ); + nRight[ i-1 ] = nRight[ i ] + aRectCellPosition.Right() - aRectCellPosition.Left() + 1; + } + } + } if (nPrinted) // wenn nichts, alles grau zeichnen { aLocalPageSize = pPrintFunc->GetPageSize(); aLocalPageSize.Width() = (long) (aLocalPageSize.Width() * HMM_PER_TWIPS ); aLocalPageSize.Height() = (long) (aLocalPageSize.Height() * HMM_PER_TWIPS ); + + nLeftMargin = (long) ( nLeftMargin * HMM_PER_TWIPS ); + nRightMargin = (long) ( nRightMargin * HMM_PER_TWIPS ); + nTopMargin = (long) ( nTopMargin * HMM_PER_TWIPS ); + nBottomMargin = (long) ( nBottomMargin * HMM_PER_TWIPS ); + nHeaderHeight = (long) ( nHeaderHeight * HMM_PER_TWIPS * mnScale / 100 + nTopMargin ); + nFooterHeight = (long) ( nFooterHeight * HMM_PER_TWIPS * mnScale / 100 + nBottomMargin ); } if (!bStateValid) @@ -425,8 +487,39 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) Point aWinEnd( aWinSize.Width(), aWinSize.Height() ); sal_Bool bRight = nPageEndX <= aWinEnd.X(); sal_Bool bBottom = nPageEndY <= aWinEnd.Y(); + + if( bPageMargin && bValidPage ) + { + SetMapMode(aMMMode); + SetLineColor( COL_BLACK ); + DrawInvert( (long)( nTopMargin - aOffset.Y() ), POINTER_VSIZEBAR ); + DrawInvert( (long)(nPageEndY - nBottomMargin ), POINTER_VSIZEBAR ); + DrawInvert( (long)( nLeftMargin - aOffset.X() ), POINTER_HSIZEBAR ); + DrawInvert( (long)( nPageEndX - nRightMargin ) , POINTER_HSIZEBAR ); + if( bHeaderOn ) + { + DrawInvert( nHeaderHeight - aOffset.Y(), POINTER_VSIZEBAR ); + } + if( bFooterOn ) + { + DrawInvert( nPageEndY - nFooterHeight, POINTER_VSIZEBAR ); + } + + SetMapMode( MapMode( MAP_PIXEL ) ); + for( int i= aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ ) + { + Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode ); + SetLineColor( COL_BLACK ); + SetFillColor( COL_BLACK ); + DrawRect( Rectangle( Point( nRight[i] - 2, aColumnTop.Y() ),Point( nRight[i] + 2 , 4 + aColumnTop.Y()) )); + DrawLine( Point( nRight[i], aColumnTop.Y() ), Point( nRight[i], 10 + aColumnTop.Y()) ); + } + SetMapMode( aMMMode ); + } + if (bRight || bBottom) { + SetMapMode(aMMMode); SetLineColor(); SetFillColor(aBackColor); if (bRight) @@ -482,189 +575,15 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) //Issue51656 Add resizeable margin on page preview from maoyg void __EXPORT ScPreview::Paint( const Rectangle& /* rRect */ ) { - if (!bValid) - { - CalcPages(0); - RecalcPages(); - UpdateDrawView(); // Table possibly amended - } - - Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); - MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); - - ScModule* pScMod = SC_MOD(); - const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig(); - Color aBackColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor ); - - if ( aOffset.X() < 0 || aOffset.Y() < 0 ) - { - SetMapMode( aMMMode ); - SetLineColor(); - SetFillColor(aBackColor); + bool bWasInPaint = bInPaint; // nested calls shouldn't be necessary, but allow for now + bInPaint = true; - Size aWinSize = GetOutputSize(); - if ( aOffset.X() < 0 ) - DrawRect(Rectangle( 0, 0, -aOffset.X(), aWinSize.Height() )); - if ( aOffset.Y() < 0 ) - DrawRect(Rectangle( 0, 0, aWinSize.Width(), -aOffset.Y() )); - } - - long nLeftMargin = 0; - long nRightMargin = 0; - long nTopMargin = 0; - long nBottomMargin = 0; - sal_Bool bHeaderOn = sal_False; - sal_Bool bFooterOn = sal_False; - - ScDocument* pDoc = pDocShell->GetDocument(); - sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); - - Size aPaintPageSize; - if ( nPageNo < nTotalPages ) - { - ScPrintOptions aOptions = SC_MOD()->GetPrintOptions(); - - ScPrintFunc* pPrintFunc; - if ( bStateValid ) - pPrintFunc = new ScPrintFunc( pDocShell, this, aState, &aOptions ); - else - pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); - - pPrintFunc->SetOffset(aOffset); - pPrintFunc->SetManualZoom(nZoom); - pPrintFunc->SetDateTime(aDate,aTime); - pPrintFunc->SetClearFlag(sal_True); - pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() ); - pPrintFunc->SetDrawView( pDrawView ); - - // Multi Selection for one side must be something umstaendlich generated ... - Range aPageRange( nPageNo+1, nPageNo+1 ); - MultiSelection aPage( aPageRange ); - aPage.SetTotalRange( Range(0,RANGE_MAX) ); - aPage.Select( aPageRange ); - - long nPrinted = pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart ); - DBG_ASSERT(nPrinted<=1, "was'n nu los?"); - - SetMapMode(aMMMode); - - //init nLeftMargin ... in the ScPrintFunc::InitParam!!! - nLeftMargin = pPrintFunc->GetLeftMargin(); - nRightMargin = pPrintFunc->GetRightMargin(); - nTopMargin = pPrintFunc->GetTopMargin(); - nBottomMargin = pPrintFunc->GetBottomMargin(); - nHeaderHeight = pPrintFunc->GetHeader().nHeight; - nFooterHeight = pPrintFunc->GetFooter().nHeight; - bHeaderOn = pPrintFunc->GetHeader().bEnable; - bFooterOn = pPrintFunc->GetFooter().bEnable; - mnScale = pPrintFunc->GetZoom(); - - Rectangle aPixRect; - Rectangle aRectCellPosition; - Rectangle aRectPosition; - GetLocationData().GetMainCellRange( aPageArea, aPixRect ); - if( !bLayoutRTL ) - { - GetLocationData().GetCellPosition( aPageArea.aStart, aRectPosition ); - nLeftPosition = aRectPosition.Left(); - for( SCCOL i = aPageArea.aStart.Col(); i <= aPageArea.aEnd.Col(); i++ ) - { - GetLocationData().GetCellPosition( ScAddress( i,aPageArea.aStart.Row(),aPageArea.aStart.Tab()),aRectCellPosition ); - nRight[i] = aRectCellPosition.Right(); - } - } - else - { - GetLocationData().GetCellPosition( aPageArea.aEnd, aRectPosition ); - nLeftPosition = aRectPosition.Right()+1; - - GetLocationData().GetCellPosition( aPageArea.aStart,aRectCellPosition ); - nRight[ aPageArea.aEnd.Col() ] = aRectCellPosition.Left(); - for( SCCOL i = aPageArea.aEnd.Col(); i > aPageArea.aStart.Col(); i-- ) - { - GetLocationData().GetCellPosition( ScAddress( i,aPageArea.aEnd.Row(),aPageArea.aEnd.Tab()),aRectCellPosition ); - nRight[ i-1 ] = nRight[ i ] + aRectCellPosition.Right() - aRectCellPosition.Left() + 1; - } - } - - if ( nPrinted ) // If nothing, all gray draw - { - aPaintPageSize = pPrintFunc->GetPageSize(); - aPaintPageSize.Width() = (long) (aPaintPageSize.Width() * HMM_PER_TWIPS ); - aPaintPageSize.Height() = (long) (aPaintPageSize.Height() * HMM_PER_TWIPS ); - - nLeftMargin = (long) ( nLeftMargin * HMM_PER_TWIPS ); - nRightMargin = (long) ( nRightMargin * HMM_PER_TWIPS ); - nTopMargin = (long) ( nTopMargin * HMM_PER_TWIPS ); - nBottomMargin = (long) ( nBottomMargin * HMM_PER_TWIPS ); - nHeaderHeight = (long) ( nHeaderHeight * HMM_PER_TWIPS * mnScale / 100 + nTopMargin ); - nFooterHeight = (long) ( nFooterHeight * HMM_PER_TWIPS * mnScale / 100 + nBottomMargin ); - } - - if ( !bStateValid ) - { - pPrintFunc->GetPrintState( aState ); - aState.nDocPages = nTotalPages; - bStateValid = sal_True; - } - - delete pPrintFunc; - } - - - long nPageEndX = aPaintPageSize.Width() - aOffset.X(); - long nPageEndY = aPaintPageSize.Height() - aOffset.Y(); - Size aWinSize = GetOutputSize(); - Point aWinEnd( aWinSize.Width(), aWinSize.Height() ); - sal_Bool bRight = nPageEndX <= aWinEnd.X(); - sal_Bool bBottom = nPageEndY <= aWinEnd.Y(); - - if( bPageMargin ) - { - SetMapMode(aMMMode); - SetLineColor( COL_BLACK ); - DrawInvert( (long)( nTopMargin - aOffset.Y() ), POINTER_VSIZEBAR ); - DrawInvert( (long)(nPageEndY - nBottomMargin ), POINTER_VSIZEBAR ); - DrawInvert( (long)( nLeftMargin - aOffset.X() ), POINTER_HSIZEBAR ); - DrawInvert( (long)( nPageEndX - nRightMargin ) , POINTER_HSIZEBAR ); - if( bHeaderOn ) - { - DrawInvert( nHeaderHeight - aOffset.Y(), POINTER_VSIZEBAR ); - } - if( bFooterOn ) - { - DrawInvert( nPageEndY - nFooterHeight, POINTER_VSIZEBAR ); - } - - SetMapMode( MapMode( MAP_PIXEL ) ); - for( int i= aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ ) - { - Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode ); - SetLineColor( COL_BLACK ); - SetFillColor( COL_BLACK ); - DrawRect( Rectangle( Point( nRight[i] - 2, aColumnTop.Y() ),Point( nRight[i] + 2 , 4 + aColumnTop.Y()) )); - DrawLine( Point( nRight[i], aColumnTop.Y() ), Point( nRight[i], 10 + aColumnTop.Y()) ); - } - SetMapMode( aMMMode ); - } - - if (bRight || bBottom) - { - SetMapMode(aMMMode); - SetLineColor(); - SetFillColor(aBackColor); - if (bRight) - DrawRect(Rectangle(nPageEndX,0, aWinEnd.X(),aWinEnd.Y())); - if (bBottom) - { - if (bRight) - DrawRect(Rectangle(0,nPageEndY, nPageEndX,aWinEnd.Y())); // Ecke nicht doppelt - else - DrawRect(Rectangle(0,nPageEndY, aWinEnd.X(),aWinEnd.Y())); - } - } + if (bPageMargin) + GetLocationData(); // fill location data for column positions + DoPrint( NULL ); pViewShell->UpdateScrollBars(); + + bInPaint = bWasInPaint; } //Issue51656 Add resizeable margin on page preview from maoyg @@ -783,9 +702,9 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom) MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); - bInPaint = sal_True; // don't scroll during SetYOffset in UpdateScrollBars + bInSetZoom = true; // don't scroll during SetYOffset in UpdateScrollBars pViewShell->UpdateScrollBars(); - bInPaint = sal_False; + bInSetZoom = false; bStateValid = sal_False; InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -892,7 +811,7 @@ void ScPreview::SetXOffset( long nX ) { long nDif = LogicToPixel(aOffset).X() - LogicToPixel(Point(nX,0)).X(); aOffset.X() = nX; - if (nDif && !bInPaint) + if (nDif && !bInSetZoom) { MapMode aOldMode = GetMapMode(); SetMapMode(MAP_PIXEL); Scroll( nDif, 0 ); @@ -902,7 +821,7 @@ void ScPreview::SetXOffset( long nX ) else { aOffset.X() = nX; - if (!bInPaint) + if (!bInSetZoom) Invalidate(); } InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -919,7 +838,7 @@ void ScPreview::SetYOffset( long nY ) { long nDif = LogicToPixel(aOffset).Y() - LogicToPixel(Point(0,nY)).Y(); aOffset.Y() = nY; - if (nDif && !bInPaint) + if (nDif && !bInSetZoom) { MapMode aOldMode = GetMapMode(); SetMapMode(MAP_PIXEL); Scroll( 0, nDif ); @@ -929,7 +848,7 @@ void ScPreview::SetYOffset( long nY ) else { aOffset.Y() = nY; - if (!bInPaint) + if (!bInSetZoom) Invalidate(); } InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -993,15 +912,20 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt ) if ( rDCEvt.GetType() == DATACHANGED_FONTS ) pDocShell->UpdateFontList(); - if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + // #i114518# Paint of form controls may modify the window's settings. + // Ignore the event if it is called from within Paint. + if ( !bInPaint ) { - // scroll bar size may have changed - pViewShell->InvalidateBorder(); // calls OuterResizePixel - } + if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + // scroll bar size may have changed + pViewShell->InvalidateBorder(); // calls OuterResizePixel + } - Invalidate(); - InvalidateLocationData( SC_HINT_DATACHANGED ); + Invalidate(); + InvalidateLocationData( SC_HINT_DATACHANGED ); + } } } @@ -1144,6 +1068,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) } if( bMoveRulerAction ) { + ScDocShellModificator aModificator( *pDocShell ); if( bLeftRulerChange && bLeftRulerMove ) { aLRItem.SetLeft( (long)( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS )); @@ -1166,12 +1091,13 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( pDocShell, this, nTab ); + ScPrintFunc aPrintFunc( this, pDocShell, nTab ); aPrintFunc.UpdatePages(); } Rectangle aRect(0,0,10000,10000); Paint( aRect ); + aModificator.SetDocumentModified(); bLeftRulerChange = sal_False; bRightRulerChange = sal_False; } @@ -1204,6 +1130,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) DBG_ASSERT( pStyleSheet, "PageStyle not found" ); if ( pStyleSheet ) { + ScDocShellModificator aModificator( *pDocShell ); ScStyleSaveData aOldData; if( bUndo ) aOldData.InitFromStyle( pStyleSheet ); @@ -1262,12 +1189,13 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( pDocShell, this, nTab ); + ScPrintFunc aPrintFunc( this, pDocShell, nTab ); aPrintFunc.UpdatePages(); } Rectangle aRect(0,0,10000,10000); Paint( aRect ); + aModificator.SetDocumentModified(); bTopRulerChange = sal_False; bBottomRulerChange = sal_False; bHeaderRulerChange = sal_False; @@ -1318,7 +1246,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) } if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( pDocShell, this, nTab ); + ScPrintFunc aPrintFunc( this, pDocShell, nTab ); aPrintFunc.UpdatePages(); } Rectangle nRect(0,0,10000,10000); @@ -1352,9 +1280,9 @@ void __EXPORT ScPreview::MouseMove( const MouseEvent& rMEvt ) ScPrintFunc* pPrintFunc; if (bStateValid) - pPrintFunc = new ScPrintFunc( pDocShell, this, aState, &aOptions ); + pPrintFunc = new ScPrintFunc( this, pDocShell, aState, &aOptions ); else - pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); + pPrintFunc = new ScPrintFunc( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); nLeftMargin = (long)( pPrintFunc->GetLeftMargin() * HMM_PER_TWIPS - aOffset.X() ); nRightMargin = (long)( pPrintFunc->GetRightMargin() * HMM_PER_TWIPS ); diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index c7cc92246536..2c4a5f855112 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -52,7 +52,6 @@ #include <editeng/ulspitem.hxx> #include <sfx2/app.hxx> #include <sfx2/printer.hxx> -#include <sfx2/progress.hxx> #include <tools/multisel.hxx> #include <sfx2/docfile.hxx> #include <tools/urlobj.hxx> @@ -304,54 +303,6 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, Construct( pOptions ); } -ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, SCTAB nTab, - long nPage, long nDocP, const ScRange* pArea, - const ScPrintOptions* pOptions ) - : pDocShell ( pShell ), - pPrinter ( NULL ), - pDrawView ( NULL ), - nPrintTab ( nTab ), - nPageStart ( nPage ), - nDocPages ( nDocP ), - pUserArea ( pArea ), - bState ( sal_False ), - bPrintCurrentTable ( sal_False ), - bMultiArea ( sal_False ), - nTabPages ( 0 ), - nTotalPages ( 0 ), - pPageData ( NULL ) -{ - pDev = pWindow; - Construct( pOptions ); -} -ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, - const ScPrintState& rState, const ScPrintOptions* pOptions ) - : pDocShell ( pShell ), - pPrinter ( NULL ), - pDrawView ( NULL ), - pUserArea ( NULL ), - bPrintCurrentTable ( sal_False ), - bMultiArea ( sal_False ), - pPageData ( NULL ) -{ - pDev = pWindow; - - nPrintTab = rState.nPrintTab; - nStartCol = rState.nStartCol; - nStartRow = rState.nStartRow; - nEndCol = rState.nEndCol; - nEndRow = rState.nEndRow; - nZoom = rState.nZoom; - nPagesX = rState.nPagesX; - nPagesY = rState.nPagesY; - nTabPages = rState.nTabPages; - nTotalPages = rState.nTotalPages; - nPageStart = rState.nPageStart; - nDocPages = rState.nDocPages; - bState = sal_True; - - Construct( pOptions ); -} void ScPrintFunc::GetPrintState( ScPrintState& rState ) { @@ -1768,6 +1719,7 @@ void ScPrintFunc::MakeEditEngine() pEditEngine->SetWordDelimiters( ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) ); pEditEngine->SetControlWord( pEditEngine->GetControlWord() & ~EE_CNTRL_RTFSTYLESHEETS ); + pDoc->ApplyAsianEditSettings( *pEditEngine ); pEditEngine->EnableAutoColor( bUseStyleColor ); // Default-Set fuer Ausrichtung @@ -2460,9 +2412,8 @@ void ScPrintFunc::SetExclusivelyDrawOleAndDrawObjects() aTableParam.bNotes = false; aTableParam.bGrid = false; aTableParam.bHeaders = false; - aTableParam.bFormulas = false;; - aTableParam.bNullVals = false;; - aTableParam.bNullVals = false;; + aTableParam.bFormulas = false; + aTableParam.bNullVals = false; } // @@ -2715,7 +2666,7 @@ void ScPrintFunc::ApplyPrintSettings() long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, long nStartPage, long nDisplayStart, sal_Bool bDoPrint, - SfxProgress* pProgress, ScPreviewLocationData* pLocationData ) + ScPreviewLocationData* pLocationData ) { DBG_ASSERT(pDev,"Device == NULL"); if (!pParamSet) @@ -2735,9 +2686,6 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, MakeTableString(); - if ( pProgress ) - pProgress->SetText( String( ScResId( SCSTR_STAT_PRINT ) ) ); - //-------------------------------------------------------------------- long nPageNo = 0; @@ -2778,12 +2726,6 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, { PrintPage( nPageNo+nDisplayStart, nX1, nY1, nX2, nY2, bDoPrint, pLocationData ); - - if ( pProgress ) - { - pProgress->SetState( nPageNo+nStartPage+1, nEndPage ); - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? - } ++nPrinted; } ++nPageNo; @@ -2808,12 +2750,6 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, { PrintPage( nPageNo+nDisplayStart, nX1, nY1, nX2, nY2, bDoPrint, pLocationData ); - - if ( pProgress ) - { - pProgress->SetState( nPageNo+nStartPage+1, nEndPage ); - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? - } ++nPrinted; } ++nPageNo; @@ -2838,11 +2774,6 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, if ( nNoteAdd ) { nNoteNr += nNoteAdd; - if ( pProgress && bPageSelected ) - { - pProgress->SetState( nPageNo+nStartPage+1, nEndPage ); - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? - } if (bPageSelected) { ++nPrinted; diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 3710fca85e33..b93fe814a4a2 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -638,24 +638,15 @@ void ScTabViewShell::DoReadUserData( const String& rData ) //------------------------------------------------------------------ -//UNUSED2008-05 void ScTabViewShell::ExecuteShowNIY( SfxRequest& /* rReq */ ) -//UNUSED2008-05 { -//UNUSED2008-05 ErrorMessage(STR_BOX_YNI); -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 //------------------------------------------------------------------ -//UNUSED2008-05 -//UNUSED2008-05 void ScTabViewShell::StateDisabled( SfxItemSet& rSet ) -//UNUSED2008-05 { -//UNUSED2008-05 SfxWhichIter aIter( rSet ); -//UNUSED2008-05 sal_uInt16 nWhich = aIter.FirstWhich(); -//UNUSED2008-05 -//UNUSED2008-05 while ( nWhich ) -//UNUSED2008-05 { -//UNUSED2008-05 rSet.DisableItem( nWhich ); -//UNUSED2008-05 nWhich = aIter.NextWhich(); -//UNUSED2008-05 } -//UNUSED2008-05 } +void ScTabViewShell::UpdateDrawShell() +{ + // Called after user interaction that may delete the selected drawing object. + // Remove DrawShell if nothing is selected. + + SdrView* pDrView = GetSdrView(); + if ( pDrView && !pDrView->AreObjectsMarked() && !IsDrawSelMode() ) + SetDrawShell( sal_False ); +} void ScTabViewShell::SetDrawShellOrSub() { diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 2001ba165531..944e2b938de2 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -181,6 +181,8 @@ sal_Bool ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) bErrorShown = sal_True; // SfxViewShell::DoVerb zeigt seine Fehlermeldungen selber an + SetNewVisArea(); + // attach listener to selection changes in chart that affect cell // ranges, so those can be highlighted // note: do that after DoVerb, so that the chart controller exists diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 205a0532eb3a..fff42faecb51 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -374,10 +374,15 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, { // import of database data into table - String sDataDesc; - if ( aDataHelper.GetString( nFormatId, sDataDesc ) ) + const DataFlavorExVector& rVector = aDataHelper.GetDataFlavorExVector(); + if ( svx::ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) ) { - SfxStringItem aDataDesc(SID_SBA_IMPORT, sDataDesc); + // transport the whole ODataAccessDescriptor as slot parameter + svx::ODataAccessDescriptor aDesc = svx::ODataAccessObjectTransferable::extractObjectDescriptor(aDataHelper); + uno::Any aDescAny; + uno::Sequence<beans::PropertyValue> aProperties = aDesc.createPropertyValueSequence(); + aDescAny <<= aProperties; + SfxUsrAnyItem aDataDesc(SID_SBA_IMPORT, aDescAny); ScDocShell* pDocSh = GetViewData()->GetDocShell(); SCTAB nTab = GetViewData()->GetTabNo(); @@ -401,20 +406,10 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, sal_Bool bAreaIsNew = !pDBData; SfxBoolItem aAreaNew(FN_PARAM_2, bAreaIsNew); - ::svx::ODataAccessDescriptor aDesc; - DataFlavorExVector& rVector = aDataHelper.GetDataFlavorExVector(); - ::std::auto_ptr<SfxUsrAnyItem> pCursorItem; - if ( ::svx::ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) ) - { - aDesc = ::svx::ODataAccessObjectTransferable::extractObjectDescriptor(aDataHelper); - if ( aDesc.has(::svx::daCursor) ) - pCursorItem.reset(new SfxUsrAnyItem(FN_PARAM_3, aDesc[::svx::daCursor])); - } - // asynchronous, to avoid doing the whole import in drop handler SfxDispatcher& rDisp = GetViewData()->GetDispatcher(); rDisp.Execute(SID_SBA_IMPORT, SFX_CALLMODE_ASYNCHRON, - &aDataDesc, &aTarget, &aAreaNew, pCursorItem.get(), (void*)0 ); + &aDataDesc, &aTarget, &aAreaNew, (void*)0 ); bRet = sal_True; } |