summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-25 21:47:16 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-25 21:47:16 +0200
commit6114aa444832a56d15f1f5783c674656652ef912 (patch)
tree7675869045fb47ac77cc0327efaa56b87828b2c8 /sc/source/ui
parent547af75e0ba1fdc9a3a3ea1e94ecb597f4059993 (diff)
parentc4c825af22a19fa4aeb17c86df03256a081cb83a (diff)
merge commit
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/scmod2.cxx9
-rw-r--r--sc/source/ui/dbgui/fieldwnd.cxx60
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx2
-rw-r--r--sc/source/ui/docshell/arealink.cxx14
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx17
-rw-r--r--sc/source/ui/docshell/docfunc.cxx29
-rw-r--r--sc/source/ui/docshell/docsh.cxx85
-rw-r--r--sc/source/ui/docshell/docsh3.cxx4
-rw-r--r--sc/source/ui/docshell/docsh4.cxx7
-rw-r--r--sc/source/ui/docshell/docsh5.cxx2
-rw-r--r--sc/source/ui/docshell/docsh8.cxx199
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx106
-rw-r--r--sc/source/ui/docshell/impex.cxx4
-rw-r--r--sc/source/ui/docshell/tablink.cxx2
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx6
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx2
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx8
-rw-r--r--sc/source/ui/inc/cellsh.hxx3
-rw-r--r--sc/source/ui/inc/docsh.hxx6
-rw-r--r--sc/source/ui/inc/fieldwnd.hxx9
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/inc/viewfunc.hxx5
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx2
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx2
-rw-r--r--sc/source/ui/navipi/content.cxx6
-rw-r--r--sc/source/ui/navipi/navipi.src2
-rw-r--r--sc/source/ui/pagedlg/pagedlg.src2
-rw-r--r--sc/source/ui/src/globstr.src14
-rw-r--r--sc/source/ui/src/hdrcont.src8
-rw-r--r--sc/source/ui/src/optdlg.src2
-rw-r--r--sc/source/ui/src/popup.src12
-rw-r--r--sc/source/ui/src/scfuncs.src42
-rw-r--r--sc/source/ui/undo/undoblk.cxx12
-rw-r--r--sc/source/ui/undo/undoblk3.cxx20
-rw-r--r--sc/source/ui/undo/undodat.cxx18
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx14
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx11
-rw-r--r--sc/source/ui/unoobj/docuno.cxx67
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx6
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx2
-rw-r--r--sc/source/ui/unoobj/textuno.cxx41
-rw-r--r--sc/source/ui/vba/makefile.mk7
-rw-r--r--sc/source/ui/view/cellsh.cxx19
-rw-r--r--sc/source/ui/view/cellsh1.cxx123
-rw-r--r--sc/source/ui/view/editsh.cxx6
-rw-r--r--sc/source/ui/view/formatsh.cxx5
-rw-r--r--sc/source/ui/view/output2.cxx27
-rw-r--r--sc/source/ui/view/tabcont.cxx4
-rw-r--r--sc/source/ui/view/tabview3.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx4
-rw-r--r--sc/source/ui/view/tabvwsha.cxx64
-rw-r--r--sc/source/ui/view/tabvwshb.cxx5
-rw-r--r--sc/source/ui/view/viewfun3.cxx382
-rw-r--r--sc/source/ui/view/viewfun4.cxx2
-rw-r--r--sc/source/ui/view/viewfun5.cxx9
56 files changed, 1031 insertions, 494 deletions
diff --git a/sc/source/ui/app/scmod2.cxx b/sc/source/ui/app/scmod2.cxx
index 2424b62c5414..4001ebe62036 100644
--- a/sc/source/ui/app/scmod2.cxx
+++ b/sc/source/ui/app/scmod2.cxx
@@ -37,7 +37,8 @@
#include <svx/unolingu.hxx>
#include <svtools/lingucfg.hxx>
-
+#include <i18npool/mslangid.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#include <com/sun/star/lang/Locale.hpp>
@@ -62,9 +63,9 @@ void ScModule::GetSpellSettings( USHORT& rDefLang, USHORT& rCjkLang, USHORT& rCt
SvtLinguOptions aOptions;
aConfig.GetOptions( aOptions );
- rDefLang = aOptions.nDefaultLanguage;
- rCjkLang = aOptions.nDefaultLanguage_CJK;
- rCtlLang = aOptions.nDefaultLanguage_CTL;
+ rDefLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN);
+ rCjkLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN);
+ rCtlLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
rAutoSpell = aOptions.bIsSpellAuto;
}
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index e20542bfedf6..4d3c478d9068 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -31,12 +31,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
#include <vcl/virdev.hxx>
#include <vcl/decoview.hxx>
#include <vcl/svapp.hxx>
-
+#include <vcl/mnemonic.hxx>
+#include <vcl/help.hxx>
#include <tools/debug.hxx>
#include "fieldwnd.hxx"
@@ -44,10 +43,7 @@
#include "pvglob.hxx"
#include "AccessibleDataPilotControl.hxx"
#include "scresid.hxx"
-#ifndef SC_SC_HRC
#include "sc.hrc"
-#endif
-#include <vcl/mnemonic.hxx>
const size_t INVALID_INDEX = static_cast< size_t >( -1 );
@@ -238,27 +234,44 @@ void ScDPFieldWindow::DrawBackground( OutputDevice& rDev )
}
void ScDPFieldWindow::DrawField(
- OutputDevice& rDev, const Rectangle& rRect, const String& rText, bool bFocus )
+ OutputDevice& rDev, const Rectangle& rRect, FieldString& rText, bool bFocus )
{
VirtualDevice aVirDev( rDev );
// #i97623# VirtualDevice is always LTR while other windows derive direction from parent
aVirDev.EnableRTL( IsRTLEnabled() );
+ String aText = rText.first;
Size aDevSize( rRect.GetSize() );
long nWidth = aDevSize.Width();
long nHeight = aDevSize.Height();
- long nLabelWidth = rDev.GetTextWidth( rText );
+ long nLabelWidth = rDev.GetTextWidth( aText );
long nLabelHeight = rDev.GetTextHeight();
- Point aLabelPos(
- ((nWidth > nLabelWidth + 6) ? (nWidth - nLabelWidth) / 2 : 3),
- ((nHeight > nLabelHeight + 6) ? (nHeight - nLabelHeight) / 2 : 3) );
+
+ // #i31600# if text is too long, cut and add ellipsis
+ rText.second = nLabelWidth + 6 <= nWidth;
+ if( !rText.second )
+ {
+ xub_StrLen nMinLen = 0;
+ xub_StrLen nMaxLen = aText.Len();
+ bool bFits = false;
+ do
+ {
+ xub_StrLen nCurrLen = (nMinLen + nMaxLen) / 2;
+ aText = String( rText.first, 0, nCurrLen ).AppendAscii( "..." );
+ nLabelWidth = rDev.GetTextWidth( aText );
+ bFits = nLabelWidth + 6 <= nWidth;
+ (bFits ? nMinLen : nMaxLen) = nCurrLen;
+ }
+ while( !bFits || (nMinLen + 1 < nMaxLen) );
+ }
+ Point aLabelPos( (nWidth - nLabelWidth) / 2, ::std::max< long >( (nHeight - nLabelHeight) / 2, 3 ) );
aVirDev.SetOutputSizePixel( aDevSize );
aVirDev.SetFont( rDev.GetFont() );
DecorationView aDecoView( &aVirDev );
aDecoView.DrawButton( Rectangle( Point( 0, 0 ), aDevSize ), bFocus ? BUTTON_DRAW_DEFAULT : 0 );
aVirDev.SetTextColor( aTextColor );
- aVirDev.DrawText( aLabelPos, rText );
+ aVirDev.DrawText( aLabelPos, aText );
rDev.DrawBitmap( rRect.TopLeft(), aVirDev.GetBitmap( Point( 0, 0 ), aDevSize ) );
}
@@ -292,7 +305,7 @@ void ScDPFieldWindow::Redraw()
if( HasFocus() && (nFieldSelected < aFieldArr.size()) )
{
long nFieldWidth = aFieldRect.GetWidth();
- long nSelectionWidth = Min( GetTextWidth( aFieldArr[ nFieldSelected ] ) + 4, nFieldWidth - 6 );
+ long nSelectionWidth = Min( GetTextWidth( aFieldArr[ nFieldSelected ].first ) + 4, nFieldWidth - 6 );
Rectangle aSelection(
GetFieldPosition( nFieldSelected ) + Point( (nFieldWidth - nSelectionWidth) / 2, 3 ),
Size( nSelectionWidth, aFieldRect.GetHeight() - 6 ) );
@@ -320,6 +333,11 @@ bool ScDPFieldWindow::IsExistingIndex( size_t nIndex ) const
return nIndex < aFieldArr.size();
}
+bool ScDPFieldWindow::IsShortenedText( size_t nIndex ) const
+{
+ return (nIndex < aFieldArr.size()) && !aFieldArr[ nIndex ].second;
+}
+
size_t ScDPFieldWindow::CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const
{
size_t nNewField = nFieldSelected;
@@ -513,6 +531,14 @@ void __EXPORT ScDPFieldWindow::MouseMove( const MouseEvent& rMEvt )
PointerStyle ePtr = pDlg->NotifyMouseMove( OutputToScreenPixel( rMEvt.GetPosPixel() ) );
SetPointer( Pointer( ePtr ) );
}
+ size_t nIndex = 0;
+ if( GetFieldIndex( rMEvt.GetPosPixel(), nIndex ) && IsShortenedText( nIndex ) )
+ {
+ Point aPos = OutputToScreenPixel( rMEvt.GetPosPixel() );
+ Rectangle aRect( aPos, GetSizePixel() );
+ String aHelpText = GetFieldText(nIndex);
+ Help::ShowQuickHelp( this, aRect, aHelpText );
+ }
}
void __EXPORT ScDPFieldWindow::KeyInput( const KeyEvent& rKEvt )
@@ -598,7 +624,7 @@ void ScDPFieldWindow::AddField( const String& rText, size_t nNewIndex )
DBG_ASSERT( nNewIndex == aFieldArr.size(), "ScDPFieldWindow::AddField - invalid index" );
if( IsValidIndex( nNewIndex ) )
{
- aFieldArr.push_back( rText );
+ aFieldArr.push_back( FieldString( rText, true ) );
if (pAccessible)
{
com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible;
@@ -646,7 +672,7 @@ void ScDPFieldWindow::SetFieldText( const String& rText, size_t nIndex )
{
if( IsExistingIndex( nIndex ) )
{
- aFieldArr[ nIndex ] = rText;
+ aFieldArr[ nIndex ] = FieldString( rText, true );
Redraw();
if (pAccessible)
@@ -663,7 +689,7 @@ void ScDPFieldWindow::SetFieldText( const String& rText, size_t nIndex )
const String& ScDPFieldWindow::GetFieldText( size_t nIndex ) const
{
if( IsExistingIndex( nIndex ) )
- return aFieldArr[ nIndex ];
+ return aFieldArr[ nIndex ].first;
return EMPTY_STRING;
}
@@ -680,7 +706,7 @@ bool ScDPFieldWindow::AddField( const String& rText, const Point& rPos, size_t&
if( nNewIndex > aFieldArr.size() )
nNewIndex = aFieldArr.size();
- aFieldArr.insert( aFieldArr.begin() + nNewIndex, rText );
+ aFieldArr.insert( aFieldArr.begin() + nNewIndex, FieldString( rText, true ) );
nFieldSelected = nNewIndex;
Redraw();
rnIndex = nNewIndex;
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 6bc96c13d5b6..773862088155 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -82,7 +82,7 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList )
xub_StrLen nCount = rList.GetTokenCount('\t');
for ( xub_StrLen i=0; i<nCount; i+=2 )
{
- if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) )//CHINA001 if ( ScGlobal::pTransliteration->isEqual( aStr, rList.GetToken(i,'\t') ) )
+ if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) )//CHINA001 if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) )
c = (sal_Unicode)rList.GetToken(i+1,'\t').ToInt32();
}
if (!c && aStr.Len())
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index a290a81d9078..fd3a562ecb42 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -63,6 +63,7 @@
#include "sc.hrc" //CHINA001
#include "scabstdlg.hxx" //CHINA001
+#include "clipparam.hxx"
struct AreaLink_Impl
{
@@ -354,12 +355,12 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
}
else
pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aOldRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
else // ohne Einfuegen
{
pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aMaxRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
}
@@ -369,7 +370,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
if (bDoInsert)
pDoc->FitBlock( aOldRange, aNewRange ); // incl. loeschen
else
- pDoc->DeleteAreaTab( aMaxRange, IDF_ALL );
+ pDoc->DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE );
// Daten kopieren
@@ -389,9 +390,8 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
aSourceMark.SelectOneTable( nSrcTab ); // selektieren fuer CopyToClip
aSourceMark.SetMarkArea( aTokenRange );
- pSrcDoc->CopyToClip( aTokenRange.aStart.Col(), aTokenRange.aStart.Row(),
- aTokenRange.aEnd.Col(), aTokenRange.aEnd.Row(),
- FALSE, &aClipDoc, FALSE, &aSourceMark );
+ ScClipParam aClipParam(aTokenRange, false);
+ pSrcDoc->CopyToClip(aClipParam, &aClipDoc, &aSourceMark);
if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
@@ -426,7 +426,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
{
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
pRedoDoc->InitUndo( pDoc, nDestTab, nDestTab );
- pDoc->CopyToDocument( aNewRange, IDF_ALL, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, FALSE, pRedoDoc );
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
new ScUndoUpdateAreaLink( pImpl->m_pDocSh,
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index ae176868162e..09e4dd7aa4af 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -576,18 +576,21 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if (bRecord)
{
+ // do not touch notes (ScUndoImportData does not support drawing undo)
+ sal_uInt16 nCopyFlags = IDF_ALL & ~IDF_NOTE;
+
// nFormulaCols is set only if column count is unchanged
pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
if ( rParam.nCol2 > nEndCol )
pDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
nUndoEndCol, nUndoEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
if ( rParam.nRow2 > nEndRow )
pDoc->CopyToDocument( rParam.nCol1, nEndRow+1, nTab,
nUndoEndCol+nFormulaCols, nUndoEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
}
//
@@ -601,7 +604,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
ScRange aDelRange( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2, rParam.nRow2, nTab );
- pDoc->DeleteAreaTab( aDelRange, IDF_ALL ); // ohne die Formeln
+ pDoc->DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln
ScRange aOld( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
@@ -611,10 +614,10 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
}
else if ( nEndCol < rParam.nCol2 ) // DeleteArea calls PutInOrder
pDoc->DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
- aNewMark, IDF_CONTENTS );
+ aNewMark, IDF_CONTENTS & ~IDF_NOTE );
// CopyToDocument doesn't remove contents
- pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS );
+ pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE );
// #41216# remove each column from ImportDoc after copying to reduce memory usage
BOOL bOldAutoCalc = pDoc->GetAutoCalc();
@@ -671,7 +674,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if (nFormulaCols > 0) // include filled formulas for redo
pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
- IDF_ALL, FALSE, pRedoDoc );
+ IDF_ALL & ~IDF_NOTE, FALSE, pRedoDoc );
ScDBData* pRedoDBData = pDBData ? new ScDBData( *pDBData ) : NULL;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 61bd4f7bf0e9..cb5d2ead509f 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -94,6 +94,7 @@
#include "compiler.hxx"
#include "scui_def.hxx" //CHINA001
#include "tabprotection.hxx"
+#include "clipparam.hxx"
#include <memory>
@@ -113,6 +114,14 @@ IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction )
else
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( pUndoAction, &rDocShell ) );
rDocShell.SetDrawModified();
+
+ // the affected sheet isn't known, so all stream positions are invalidated
+ ScDocument* pDoc = rDocShell.GetDocument();
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (pDoc->IsStreamValid(nTab))
+ pDoc->SetStreamValid(nTab, FALSE);
+
return 0;
}
@@ -1061,6 +1070,9 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
if( rDoc.IsUndoEnabled() )
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideNote( rDocShell, rPos, bShow ) );
+ if (rDoc.IsStreamValid(rPos.Tab()))
+ rDoc.SetStreamValid(rPos.Tab(), FALSE);
+
rDocShell.SetDocumentModified();
return true;
@@ -1089,6 +1101,9 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bA
//! Undo !!!
+ if (pDoc->IsStreamValid(rPos.Tab()))
+ pDoc->SetStreamValid(rPos.Tab(), FALSE);
+
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -1142,6 +1157,10 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con
// repaint cell (to make note marker visible)
rDocShell.PostPaintCell( rPos );
+
+ if (rDoc.IsStreamValid(rPos.Tab()))
+ rDoc.SetStreamValid(rPos.Tab(), FALSE);
+
aModificator.SetDocumentModified();
bDone = true;
}
@@ -1997,7 +2016,7 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nScenarioCount ++;
pDoc->CopyToDocument( nUndoStartX, nUndoStartY, i, nUndoEndX, nUndoEndY, i+nScenarioCount,
- IDF_ALL, FALSE, pUndoDoc );
+ IDF_ALL | IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
}
@@ -2258,8 +2277,8 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
}
ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
- pDoc->CopyToClip( nStartCol, nStartRow, nEndCol, nEndRow, bCut, pClipDoc,
- FALSE, &aSourceMark, bScenariosAdded, TRUE );
+ ScClipParam aClipParam(ScRange(nStartCol, nStartRow, 0, nEndCol, nEndRow, 0), bCut);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true);
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -3558,7 +3577,7 @@ BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
//! auch bei Undo selektierte Tabellen beruecksichtigen
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
// use TokenArray if given, string (and flags) otherwise
@@ -3646,7 +3665,7 @@ BOOL ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
//! auch bei Undo selektierte Tabellen beruecksichtigen
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoTabOp( &rDocShell,
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index c62c2dc41fdf..f7d1e2ccae2f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -120,6 +120,7 @@
#include "cfgids.hxx"
#include "warnpassword.hxx"
#include "optsolver.hxx"
+#include "sheetdata.hxx"
#include "tabprotection.hxx"
#include "docsh.hxx"
@@ -755,8 +756,13 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() )
{
}
+ UseSheetSaveEntries(); // use positions from saved file for next saving
}
break;
+ case SFX_EVENT_SAVEASDOCDONE:
+ // new positions are used after "save" and "save as", but not "save to"
+ UseSheetSaveEntries(); // use positions from saved file for next saving
+ break;
default:
{
}
@@ -1850,38 +1856,28 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
-#if ENABLE_SHEET_PROTECTION
- bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_XL);
- if (bNeedRetypePassDlg && !pViewShell->ExecuteRetypePassDlg(PASSHASH_XL))
+ /* #115980# #i104990# If the imported document contains a medium
+ password, determine if we can save it, otherwise ask the users
+ whether they want to save without it. */
+ if( !::sfx2::CheckMSPasswordCapabilityForExport( aFltName ) )
{
- SetError( ERRCODE_ABORT );
- return false;
- }
-#else
-
- do
- {
- SfxItemSet* pSet = rMed.GetItemSet();
- if (!pSet)
- break;
-
- const SfxPoolItem* pItem = NULL;
- if (SFX_ITEM_SET != pSet->GetItemState(SID_PASSWORD, sal_True, &pItem))
- // password is not set.
- break;
-
- /* #115980 #If the imported document contained an encrypted password -
- determine if we should save without it. */
- bDoSave = ScWarnPassword::WarningOnPassword( rMed );
-
- if (bDoSave)
+ SfxItemSet* pItemSet = rMed.GetItemSet();
+ const SfxPoolItem* pItem = 0;
+ if( pItemSet && pItemSet->GetItemState( SID_PASSWORD, sal_True, &pItem ) == SFX_ITEM_SET )
{
- // #i42858# warn only one time
- pSet->ClearItem(SID_PASSWORD);
+ bDoSave = ScWarnPassword::WarningOnPassword( rMed );
+ // #i42858# remove password from medium (warn only one time)
+ if( bDoSave )
+ pItemSet->ClearItem( SID_PASSWORD );
}
}
- while (false);
+#if ENABLE_SHEET_PROTECTION
+ if( bDoSave )
+ {
+ bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen( aDocument, PASSHASH_XL );
+ bDoSave = !bNeedRetypePassDlg || pViewShell->ExecuteRetypePassDlg( PASSHASH_XL );
+ }
#endif
}
@@ -2212,6 +2208,7 @@ BOOL ScDocShell::HasAutomaticTableName( const String& rFilter ) // static
pPaintLockData ( NULL ), \
pOldJobSetup ( NULL ), \
pSolverSaveData ( NULL ), \
+ pSheetSaveData ( NULL ), \
pModificator ( NULL )
//------------------------------------------------------------------
@@ -2305,6 +2302,7 @@ __EXPORT ScDocShell::~ScDocShell()
delete pOldJobSetup; // gesetzt nur bei Fehler in StartJob()
delete pSolverSaveData;
+ delete pSheetSaveData;
delete pOldAutoDBRange;
if (pModificator)
@@ -2475,6 +2473,39 @@ void ScDocShell::SetSolverSaveData( const ScOptSolverSave& rData )
pSolverSaveData = new ScOptSolverSave( rData );
}
+ScSheetSaveData* ScDocShell::GetSheetSaveData()
+{
+ if (!pSheetSaveData)
+ pSheetSaveData = new ScSheetSaveData;
+
+ return pSheetSaveData;
+}
+
+void ScDocShell::UseSheetSaveEntries()
+{
+ if (pSheetSaveData)
+ {
+ pSheetSaveData->UseSaveEntries(); // use positions from saved file for next saving
+
+ bool bHasEntries = false;
+ SCTAB nTabCount = aDocument.GetTableCount();
+ SCTAB nTab;
+ for (nTab = 0; nTab < nTabCount; ++nTab)
+ if (pSheetSaveData->HasStreamPos(nTab))
+ bHasEntries = true;
+
+ if (!bHasEntries)
+ {
+ // if no positions were set (for example, export to other format),
+ // reset all "valid" flags
+
+ for (nTab = 0; nTab < nTabCount; ++nTab)
+ if (aDocument.IsStreamValid(nTab))
+ aDocument.SetStreamValid(nTab, FALSE);
+ }
+ }
+}
+
// --- ScDocShellModificator ------------------------------------------
ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS )
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 812d0263a866..418dfa65fff2 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -483,6 +483,10 @@ OutputDevice* ScDocShell::GetRefDevice()
USHORT ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, USHORT nDiffFlags )
{
+ SfxPrinter *pOld = aDocument.GetPrinter( FALSE );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
if (nDiffFlags & SFX_PRINTER_PRINTER)
{
if ( aDocument.GetPrinter() != pNewPrinter )
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index d4df2863eec5..80b0c76a64be 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1300,6 +1300,13 @@ void ScDocShell::DoHardRecalc( BOOL /* bApi */ )
aDocument.BroadcastUno( SfxSimpleHint( SC_HINT_CALCALL ) );
aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ // use hard recalc also to disable stream-copying of all sheets
+ // (somewhat consistent with charts)
+ SCTAB nTabCount = aDocument.GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (aDocument.IsStreamValid(nTab))
+ aDocument.SetStreamValid(nTab, FALSE);
+
PostPaintGridAll();
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index b8d89a644fb4..b7c726deeb71 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -406,6 +406,7 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
{
BOOL bIsUndoEnabled = aDocument.IsUndoEnabled();
aDocument.EnableUndo( FALSE );
+ aDocument.LockStreamValid( true ); // ignore draw page size (but not formula results)
if ( bBefore ) // check all sheets up to nUpdateTab
{
SCTAB nTabCount = aDocument.GetTableCount();
@@ -437,6 +438,7 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
aDocument.SetPendingRowHeights( nUpdateTab, FALSE );
}
}
+ aDocument.LockStreamValid( false );
aDocument.EnableUndo( bIsUndoEnabled );
}
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 149856b4aa6b..d58777b9b5d5 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -43,13 +43,14 @@
#include <ucbhelper/content.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <comphelper/processfactory.hxx>
-#include <connectivity/dbcharset.hxx>
#include <svx/txenctab.hxx>
+#include <svx/dbcharsethelper.hxx>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdbc/XDriverAccess.hpp>
#include <com/sun/star/sdbc/XDriverManager.hpp>
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -104,6 +105,61 @@ using namespace com::sun::star;
#define SC_ROWCOUNT_ERROR (-1)
+namespace
+{
+ ULONG lcl_getDBaseConnection(uno::Reference<sdbc::XDriverManager>& _rDrvMgr,uno::Reference<sdbc::XConnection>& _rConnection,String& _rTabName,const String& rFullFileName,rtl_TextEncoding eCharSet)
+ {
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( rFullFileName );
+ _rTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
+ INetURLObject::DECODE_UNAMBIGUOUS );
+ String aExtension = aURL.getExtension();
+ aURL.removeSegment();
+ aURL.removeFinalSlash();
+ String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
+ if (!xFactory.is()) return SCERR_EXPORT_CONNECT;
+
+ _rDrvMgr.set( xFactory->createInstance(
+ rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
+ uno::UNO_QUERY);
+ DBG_ASSERT( _rDrvMgr.is(), "can't get DriverManager" );
+ if (!_rDrvMgr.is()) return SCERR_EXPORT_CONNECT;
+
+ // get connection
+
+ String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
+ aConnUrl += aPath;
+
+ svxform::ODataAccessCharsetHelper aHelper;
+ ::std::vector< rtl_TextEncoding > aEncodings;
+ aHelper.getSupportedTextEncodings( aEncodings );
+ ::std::vector< rtl_TextEncoding >::iterator aIter = ::std::find(aEncodings.begin(),aEncodings.end(),(rtl_TextEncoding) eCharSet);
+ if ( aIter == aEncodings.end() )
+ {
+ DBG_ERRORFILE( "DBaseImport: dbtools::OCharsetMap doesn't know text encoding" );
+ return SCERR_IMPORT_CONNECT;
+ } // if ( aIter == aMap.end() )
+ rtl::OUString aCharSetStr;
+ if ( RTL_TEXTENCODING_DONTKNOW != *aIter )
+ { // it's not the virtual "system charset"
+ const char* pIanaName = rtl_getMimeCharsetFromTextEncoding( *aIter );
+ OSL_ENSURE( pIanaName, "invalid mime name!" );
+ if ( pIanaName )
+ aCharSetStr = ::rtl::OUString::createFromAscii( pIanaName );
+ }
+
+ uno::Sequence<beans::PropertyValue> aProps(2);
+ aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
+ aProps[0].Value <<= rtl::OUString( aExtension );
+ aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
+ aProps[1].Value <<= aCharSetStr;
+
+ _rConnection = _rDrvMgr->getConnectionWithInfo( aConnUrl, aProps );
+ return 0L;
+ }
+}
// -----------------------------------------------------------------------
// MoveFile/KillFile/IsDocument: similar to SfxContentHelper
@@ -201,48 +257,13 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
try
{
- INetURLObject aURL;
- aURL.SetSmartProtocol( INET_PROT_FILE );
- aURL.SetSmartURL( rFullFileName );
- String aTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
- INetURLObject::DECODE_UNAMBIGUOUS );
- String aExtension = aURL.getExtension();
- aURL.removeSegment();
- aURL.removeFinalSlash();
- String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
-
- uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
- if (!xFactory.is())
- return ERRCODE_IO_GENERAL;
-
- uno::Reference<sdbc::XDriverManager> xDrvMan( xFactory->createInstance(
- rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
- uno::UNO_QUERY);
- DBG_ASSERT( xDrvMan.is(), "can't get DriverManager" );
- if (!xDrvMan.is()) return SCERR_IMPORT_CONNECT;
-
- String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
- aConnUrl += aPath;
-
- dbtools::OCharsetMap aMap;
- dbtools::OCharsetMap::CharsetIterator aIter = aMap.find( (rtl_TextEncoding) eCharSet );
- if ( aIter == aMap.end() )
- {
- DBG_ERRORFILE( "DBaseImport: dbtools::OCharsetMap doesn't know text encoding" );
- return SCERR_IMPORT_CONNECT;
- }
- rtl::OUString aCharSetStr = (*aIter).getIanaName();
-
- uno::Sequence<beans::PropertyValue> aProps(2);
- aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
- aProps[0].Value <<= rtl::OUString( aExtension );
- aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
- aProps[1].Value <<= aCharSetStr;
-
- uno::Reference<sdbc::XConnection> xConnection =
- xDrvMan->getConnectionWithInfo( aConnUrl, aProps );
- DBG_ASSERT( xConnection.is(), "can't get Connection" );
- if (!xConnection.is()) return SCERR_IMPORT_CONNECT;
+ String aTabName;
+ uno::Reference<sdbc::XDriverManager> xDrvMan;
+ uno::Reference<sdbc::XConnection> xConnection;
+ ULONG nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet);
+ if ( !xConnection.is() || !xDrvMan.is() )
+ return nRet;
+ ::utl::DisposableComponent aConnectionHelper(xConnection);
long nRowCount = 0;
if ( nRowCount < 0 )
@@ -252,10 +273,11 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
}
ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), nRowCount );
-
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
uno::Reference<sdbc::XRowSet> xRowSet( xFactory->createInstance(
rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ),
uno::UNO_QUERY);
+ ::utl::DisposableComponent aRowSetHelper(xRowSet);
uno::Reference<beans::XPropertySet> xRowProp( xRowSet, uno::UNO_QUERY );
DBG_ASSERT( xRowProp.is(), "can't get RowSet" );
if (!xRowProp.is()) return SCERR_IMPORT_CONNECT;
@@ -369,9 +391,6 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
if ( nRowCount )
aProgress.SetStateOnPercent( nRow );
}
-
- comphelper::disposeComponent( xRowSet );
- comphelper::disposeComponent( xConnection );
}
catch ( sdbc::SQLException& )
{
@@ -733,91 +752,29 @@ ULONG ScDocShell::DBaseExport( const String& rFullFileName, CharSet eCharSet, BO
aColNames.getArray(), aColTypes.getArray(),
aColLengths.getArray(), aColScales.getArray(),
bHasMemo, eCharSet );
-
- INetURLObject aURL;
- aURL.SetSmartProtocol( INET_PROT_FILE );
- aURL.SetSmartURL( rFullFileName );
- String aTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
- INetURLObject::DECODE_UNAMBIGUOUS );
- String aExtension = aURL.getExtension();
- aURL.removeSegment();
- aURL.removeFinalSlash();
- String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
-
// also needed for exception catch
SCROW nDocRow = 0;
ScFieldEditEngine aEditEngine( aDocument.GetEditPool() );
String aString;
+ String aTabName;
try
{
- uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
- if (!xFactory.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<sdbc::XDriverManager> xDrvMan( xFactory->createInstance(
- rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
- uno::UNO_QUERY);
- DBG_ASSERT( xDrvMan.is(), "can't get DriverManager" );
- if (!xDrvMan.is()) return SCERR_EXPORT_CONNECT;
-
- // get connection
-
- String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
- aConnUrl += aPath;
-
- dbtools::OCharsetMap aMap;
- dbtools::OCharsetMap::CharsetIterator aIter = aMap.find( (rtl_TextEncoding) eCharSet );
- if ( aIter == aMap.end() )
- {
- DBG_ERRORFILE( "DBaseExport: dbtools::OCharsetMap doesn't know text encoding" );
- return SCERR_EXPORT_CONNECT;
- }
- rtl::OUString aCharSetStr = (*aIter).getIanaName();
-
- uno::Sequence<beans::PropertyValue> aProps(2);
- aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
- aProps[0].Value <<= rtl::OUString( aExtension );
- aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
- aProps[1].Value <<= aCharSetStr;
-
- uno::Reference<sdbc::XConnection> xConnection =
- xDrvMan->getConnectionWithInfo( aConnUrl, aProps );
- DBG_ASSERT( xConnection.is(), "can't get Connection" );
- if (!xConnection.is()) return SCERR_EXPORT_CONNECT;
+ uno::Reference<sdbc::XDriverManager> xDrvMan;
+ uno::Reference<sdbc::XConnection> xConnection;
+ ULONG nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet);
+ if ( !xConnection.is() || !xDrvMan.is() )
+ return nRet;
::utl::DisposableComponent aConnectionHelper(xConnection);
// get dBase driver
-
- uno::Reference<sdbc::XDriver> xDriver;
- BOOL bDriverFound = FALSE;
-
- uno::Reference<container::XEnumerationAccess> xEnAcc( xDrvMan, uno::UNO_QUERY );
- DBG_ASSERT( xEnAcc.is(), "can't get DriverManager EnumerationAccess" );
- if (!xEnAcc.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<container::XEnumeration> xEnum = xEnAcc->createEnumeration();
- DBG_ASSERT( xEnum.is(), "can't get DriverManager Enumeration" );
- if (!xEnum.is()) return SCERR_EXPORT_CONNECT;
-
- while ( xEnum->hasMoreElements() && !bDriverFound )
- {
- uno::Any aElement = xEnum->nextElement();
- if ( aElement >>= xDriver )
- if ( xDriver.is() && xDriver->acceptsURL( aConnUrl ) )
- bDriverFound = TRUE;
- }
-
- DBG_ASSERT( bDriverFound, "can't get dBase driver" );
- if (!bDriverFound) return SCERR_EXPORT_CONNECT;
+ uno::Reference< sdbc::XDriverAccess> xAccess(xDrvMan,uno::UNO_QUERY);
+ uno::Reference< sdbcx::XDataDefinitionSupplier > xDDSup( xAccess->getDriverByURL( xConnection->getMetaData()->getURL() ), uno::UNO_QUERY );
+ if ( !xDDSup.is() )
+ return SCERR_EXPORT_CONNECT;
// create table
-
- uno::Reference<sdbcx::XDataDefinitionSupplier> xDDSup( xDriver, uno::UNO_QUERY );
- DBG_ASSERT( xDDSup.is(), "can't get XDataDefinitionSupplier" );
- if (!xDDSup.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<sdbcx::XTablesSupplier> xTablesSupp =
- xDDSup->getDataDefinitionByConnection( xConnection );
+ uno::Reference<sdbcx::XTablesSupplier> xTablesSupp =xDDSup->getDataDefinitionByConnection( xConnection );
DBG_ASSERT( xTablesSupp.is(), "can't get Data Definition" );
if (!xTablesSupp.is()) return SCERR_EXPORT_CONNECT;
@@ -893,7 +850,7 @@ ULONG ScDocShell::DBaseExport( const String& rFullFileName, CharSet eCharSet, BO
// if (!xConnection.is()) return SCERR_EXPORT_CONNECT;
// get row set for writing
-
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
uno::Reference<sdbc::XRowSet> xRowSet( xFactory->createInstance(
rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ),
uno::UNO_QUERY);
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 9cc0b274028e..5cfc833be5dd 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -950,9 +950,18 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex)
{
+ // In API, the index is transported as cached sheet ID of type sal_Int32 in
+ // sheet::SingleReference.Sheet or sheet::ComplexReference.Reference1.Sheet
+ // in a sheet::FormulaToken, choose a sensible value for N/A. Effectively
+ // being 0xffffffff
+ const size_t nNotAvailable = static_cast<size_t>( static_cast<sal_Int32>( -1));
+
DocItem* pDoc = getDocItem(nFileId);
if (!pDoc)
+ {
+ if (pnIndex) *pnIndex = nNotAvailable;
return TableTypeRef();
+ }
DocItem& rDoc = *pDoc;
@@ -966,7 +975,10 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF
}
if (!bCreateNew)
+ {
+ if (pnIndex) *pnIndex = nNotAvailable;
return TableTypeRef();
+ }
// Specified table doesn't exist yet. Create one.
nIndex = rDoc.maTables.size();
@@ -1045,7 +1057,7 @@ void ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rV
else
{
// The source document has changed.
- pMgr->switchSrcFile(mnFileId, aFile);
+ pMgr->switchSrcFile(mnFileId, aFile, aFilter);
maFilterName = aFilter;
}
}
@@ -1891,24 +1903,17 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
if (!pFileData)
return NULL;
+ // Always load the document by using the path created from the relative
+ // path. If the referenced document is not there, simply exit. The
+ // original file name should be used only when the relative path is not
+ // given.
String aFile = pFileData->maFileName;
- if (!isFileLoadable(aFile))
- {
- // The original file path is not loadable. Try the relative path.
- // Note that the path is relative to the content.xml substream which
- // is one-level higher than the file itself.
+ maybeCreateRealFileName(nFileId);
+ if (pFileData->maRealFileName.Len())
+ aFile = pFileData->maRealFileName;
- if (!pFileData->maRelativeName.Len())
- return NULL;
-
- INetURLObject aBaseURL(getOwnDocumentName());
- aBaseURL.insertName(OUString::createFromAscii("content.xml"));
- bool bWasAbs = false;
- aFile = aBaseURL.smartRel2Abs(pFileData->maRelativeName, bWasAbs).GetMainURL(INetURLObject::NO_DECODE);
- if (!isFileLoadable(aFile))
- // Ok, I've tried both paths but no success. Bail out.
- return NULL;
- }
+ if (!isFileLoadable(aFile))
+ return NULL;
String aOptions;
ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);
@@ -1960,6 +1965,9 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
bool ScExternalRefManager::isFileLoadable(const String& rFile) const
{
+ if (!rFile.Len())
+ return false;
+
if (isOwnDocument(rFile))
return false;
@@ -1994,6 +2002,32 @@ void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
maLinkedDocs.insert(LinkedDocMap::value_type(nFileId, true));
}
+void ScExternalRefManager::SrcFileData::maybeCreateRealFileName(const String& rOwnDocName)
+{
+ if (!maRelativeName.Len())
+ // No relative path given. Nothing to do.
+ return;
+
+ if (maRealFileName.Len())
+ // Real file name already created. Nothing to do.
+ return;
+
+ // Formulate the absolute file path from the relative path.
+ const String& rRelPath = maRelativeName;
+ INetURLObject aBaseURL(rOwnDocName);
+ aBaseURL.insertName(OUString::createFromAscii("content.xml"));
+ bool bWasAbs = false;
+ maRealFileName = aBaseURL.smartRel2Abs(rRelPath, bWasAbs).GetMainURL(INetURLObject::NO_DECODE);
+}
+
+void ScExternalRefManager::maybeCreateRealFileName(sal_uInt16 nFileId)
+{
+ if (nFileId >= maSrcFiles.size())
+ return;
+
+ maSrcFiles[nFileId].maybeCreateRealFileName(getOwnDocumentName());
+}
+
bool ScExternalRefManager::compileTokensByCell(const ScAddress& rCell)
{
ScBaseCell* pCell;
@@ -2064,12 +2098,20 @@ sal_uInt16 ScExternalRefManager::getExternalFileId(const String& rFile)
return static_cast<sal_uInt16>(maSrcFiles.size() - 1);
}
-const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId) const
+const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal)
{
if (nFileId >= maSrcFiles.size())
return NULL;
- return &maSrcFiles[nFileId].maFileName;
+ if (bForceOriginal)
+ return &maSrcFiles[nFileId].maFileName;
+
+ maybeCreateRealFileName(nFileId);
+
+ if (maSrcFiles[nFileId].maRealFileName.Len())
+ return &maSrcFiles[nFileId].maRealFileName;
+ else
+ return &maSrcFiles[nFileId].maFileName;
}
bool ScExternalRefManager::hasExternalFile(sal_uInt16 nFileId) const
@@ -2138,10 +2180,17 @@ void ScExternalRefManager::breakLink(sal_uInt16 nFileId)
notifyAllLinkListeners(nFileId, LINK_BROKEN);
}
-void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile)
+void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile, const String& rNewFilter)
{
maSrcFiles[nFileId].maFileName = rNewFile;
maSrcFiles[nFileId].maRelativeName.Erase();
+ maSrcFiles[nFileId].maRealFileName.Erase();
+ if (!maSrcFiles[nFileId].maFilterName.Equals(rNewFilter))
+ {
+ // Filter type has changed.
+ maSrcFiles[nFileId].maFilterName = rNewFilter;
+ maSrcFiles[nFileId].maFilterOptions.Erase();
+ }
refreshNames(nFileId);
}
@@ -2175,19 +2224,18 @@ bool ScExternalRefManager::hasExternalData() const
return !maSrcFiles.empty();
}
-void ScExternalRefManager::resetSrcFileData()
+void ScExternalRefManager::resetSrcFileData(const String& rBaseFileUrl)
{
- INetURLObject aBaseURL(getOwnDocumentName());
- aBaseURL.insertName(OUString::createFromAscii("content.xml"));
- String aBaseUrlStr = aBaseURL.GetMainURL(INetURLObject::NO_DECODE);
for (vector<SrcFileData>::iterator itr = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
itr != itrEnd; ++itr)
{
- if (!itr->maRelativeName.Len())
- {
- itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative(
- aBaseUrlStr, itr->maFileName);
- }
+ // Re-generate relative file name from the absolute file name.
+ String aAbsName = itr->maRealFileName;
+ if (!aAbsName.Len())
+ aAbsName = itr->maFileName;
+
+ itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative(
+ rBaseFileUrl, aAbsName);
}
}
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 67186f84a84a..1561e4c6efeb 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -253,7 +253,7 @@ BOOL ScImportExport::StartPaste()
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
- pDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aRange, IDF_ALL | IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
return TRUE;
}
@@ -270,7 +270,7 @@ void ScImportExport::EndPaste()
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
pRedoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
- pDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( aRange, IDF_ALL | IDF_NOCAPTIONS, FALSE, pRedoDoc );
ScMarkData aDestMark;
aDestMark.SelectOneTable( aRange.aStart.Tab() );
pDocSh->GetUndoManager()->AddUndoAction(
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 9f7c201c8aca..570d41f7885d 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -280,7 +280,7 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
{
String aName;
pDoc->GetName( nTab, aName );
- if ( ScGlobal::pTransliteration->isEqual(
+ if ( ScGlobal::GetpTransliteration()->isEqual(
ScGlobal::GetDocTabName( aFileName, aTabName ), aName ) )
{
pDoc->RenameTab( nTab,
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 8c175f0cd3a9..d241843f9745 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -201,7 +201,7 @@ void __EXPORT ScDrawTextObjectBar::Execute( SfxRequest &rReq )
}
break;
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
ExecutePasteContents( rReq );
break;
@@ -467,7 +467,7 @@ IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pData
SfxBindings& rBindings = pViewData->GetBindings();
rBindings.Invalidate( SID_PASTE );
- rBindings.Invalidate( FID_PASTE_CONTENTS );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
return 0;
@@ -502,7 +502,7 @@ void __EXPORT ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet )
switch (nWhich)
{
case SID_PASTE:
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
if( !bPastePossible )
rSet.DisableItem( nWhich );
break;
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx
index a011de6fa0e9..d05e0568c1ca 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -91,7 +91,7 @@ void __EXPORT ScDrawTextObjectBar::ExecuteGlobal( SfxRequest &rReq )
break;
case SID_PASTE:
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
case SID_CLIPBOARD_FORMAT_ITEMS:
case SID_HYPERLINK_SETLINK:
{
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index 701a53aecfcc..2152abfd4f8b 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -110,6 +110,9 @@ void FuText::StopEditMode(BOOL /*bTextDirection*/)
}
}
+ if( pNote )
+ rDoc.LockStreamValid(true); // only the affected sheet is invalidated below
+
/* SdrObjEditView::SdrEndTextEdit() may try to delete the entire drawing
object, if it does not contain text and has invisible border and fill.
This must not happen for note caption objects. They will be removed
@@ -183,6 +186,11 @@ void FuText::StopEditMode(BOOL /*bTextDirection*/)
pAction->SetComment( ScGlobal::GetRscString( bNewNote ? STR_UNDO_INSERTNOTE : STR_UNDO_DELETENOTE ) );
}
}
+
+ // invalidate stream positions only for the affected sheet
+ rDoc.LockStreamValid(false);
+ if (rDoc.IsStreamValid(aNotePos.Tab()))
+ rDoc.SetStreamValid(aNotePos.Tab(), FALSE);
}
}
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index 8e09b7350bb1..90adbe40d2d2 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -42,6 +42,7 @@ class SvxClipboardFmtItem;
class TransferableDataHelper;
class TransferableClipboardListener;
class AbstractScLinkedAreaDlg;
+class ScTabViewShell;
struct CellShell_Impl
{
@@ -101,6 +102,8 @@ public:
void ExecutePageSel( SfxRequest& rReq );
void ExecuteMove( SfxRequest& rReq );
void GetStateCursor( SfxItemSet& rSet );
+
+ static void PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog );
};
#endif
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 4e6cf05ddd0d..9556b4ad8138 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -72,6 +72,7 @@ class VirtualDevice;
class ScImportOptions;
class ScDocShellModificator;
class ScOptSolverSave;
+class ScSheetSaveData;
namespace sfx2 { class FileDialogHelper; }
struct DocShell_Impl;
@@ -123,6 +124,7 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
ScPaintLockData* pPaintLockData;
ScJobSetup* pOldJobSetup;
ScOptSolverSave* pSolverSaveData;
+ ScSheetSaveData* pSheetSaveData;
ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading)
@@ -167,6 +169,8 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
SC_DLLPRIVATE void EnableSharedSettings( bool bEnable );
SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument();
+ SC_DLLPRIVATE void UseSheetSaveEntries();
+
protected:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
@@ -414,6 +418,8 @@ public:
const ScOptSolverSave* GetSolverSaveData() const { return pSolverSaveData; } // may be null
void SetSolverSaveData( const ScOptSolverSave& rData );
+
+ ScSheetSaveData* GetSheetSaveData();
};
SO2_DECL_REF(ScDocShell)
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx
index 5b24b5fea3df..ae2dbf1ffb52 100644
--- a/sc/source/ui/inc/fieldwnd.hxx
+++ b/sc/source/ui/inc/fieldwnd.hxx
@@ -68,12 +68,14 @@ enum ScDPFieldType
class ScDPFieldWindow : public Control
{
private:
+ typedef ::std::pair< String, bool > FieldString; // true = text fits into button
+
String aName; /// name of the control, used in Accessibility
ScDPLayoutDlg* pDlg; /// Parent dialog.
Rectangle aWndRect; /// Area rectangle in pixels.
FixedText* pFtCaption; /// FixedText containing the name of the control.
Point aTextPos; /// Position of the caption text.
- std::vector< String > aFieldArr; /// Pointer to string array of the field names.
+ std::vector< FieldString > aFieldArr; /// String array of the field names and flags, if text fits into button.
ScDPFieldType eType; /// Type of this area.
Color aFaceColor; /// Color for dialog background.
Color aWinColor; /// Color for window background.
@@ -97,13 +99,16 @@ private:
void DrawField(
OutputDevice& rDev,
const Rectangle& rRect,
- const String& rText,
+ FieldString& rText,
bool bFocus );
/** @return TRUE, if the field index is inside of the control area. */
bool IsValidIndex( size_t nIndex ) const;
/** @return TRUE, if the field with the given index exists. */
bool IsExistingIndex( size_t nIndex ) const;
+ /** @return TRUE, if the field with the given index exists and the text is
+ too long for the button control. */
+ bool IsShortenedText( size_t nIndex ) const;
/** @return The new selection index after moving to the given direction. */
size_t CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const;
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 10224536bf0b..eede290aa8db 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -418,7 +418,7 @@ public:
void ExecuteCellFormatDlg ( SfxRequest& rReq, USHORT nTabPage = 0xffff );
- BOOL GetFunction( String& rFuncStr );
+ BOOL GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
void StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
BOOL bCloseOnButtonUp, BOOL bSingleCell, BOOL bMultiSelection );
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 228c4b4c1489..066aadca817a 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -348,6 +348,11 @@ private:
void PasteRTF( SCCOL nCol, SCROW nStartRow,
const ::com::sun::star::uno::Reference<
::com::sun::star::datatransfer::XTransferable >& rxTransferable );
+ bool PasteMultiRangesFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction,
+ bool bSkipEmpty, bool bTranspos, bool bAsLink, bool bAllowDialogs,
+ InsCellCmd eMoveMode, sal_uInt16 nCondFlags, sal_uInt16 nUndoFlags );
+ void PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark);
+
USHORT GetOptimalColWidth( SCCOL nCol, SCTAB nTab, BOOL bFormula );
void StartFormatArea();
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 2faf148e5ac1..76330036b1f5 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -2127,7 +2127,7 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData )
if(nRightKind == SV_ITEM_ID_LBOXSTRING &&
nLeftKind == SV_ITEM_ID_LBOXSTRING )
{
- eCompare= (StringCompare) ScGlobal::pCaseCollator->compareString(
+ eCompare= (StringCompare) ScGlobal::GetCaseCollator()->compareString(
((SvLBoxString*)pLeftItem)->GetText(),
((SvLBoxString*)pRightItem)->GetText());
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 5f38fbf5c049..08dbd00de0f9 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -66,7 +66,7 @@ struct ScSolverOptionsEntry
bool operator< (const ScSolverOptionsEntry& rOther) const
{
- return ( ScGlobal::pCollator->compareString( aDescription, rOther.aDescription ) == COMPARE_LESS );
+ return ( ScGlobal::GetCollator()->compareString( aDescription, rOther.aDescription ) == COMPARE_LESS );
}
};
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index a2db7e4e48f0..af3b5f0dee5e 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -71,6 +71,7 @@
#include "navicfg.hxx"
#include "navsett.hxx"
#include "postit.hxx"
+#include "clipparam.hxx"
using namespace com::sun::star;
@@ -1103,9 +1104,8 @@ void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, USHORT nFlag
aMark ) )
{
ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
- pSrcDoc->CopyToClip( rRange.aStart.Col(), rRange.aStart.Row(),
- rRange.aEnd.Col(), rRange.aEnd.Row(),
- FALSE, pClipDoc, FALSE, &aMark );
+ ScClipParam aClipParam(rRange, false);
+ pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark);
// pClipDoc->ExtendMerge( rRange, TRUE );
TransferableObjectDescriptor aObjDesc;
diff --git a/sc/source/ui/navipi/navipi.src b/sc/source/ui/navipi/navipi.src
index f5eaeb56bae1..6d5baba4d075 100644
--- a/sc/source/ui/navipi/navipi.src
+++ b/sc/source/ui/navipi/navipi.src
@@ -320,7 +320,7 @@ String SCSTR_CONTENT_OLEOBJECT
};
String SCSTR_CONTENT_NOTE
{
- Text [ en-US ] = "Notes" ;
+ Text [ en-US ] = "Comments" ;
};
String SCSTR_CONTENT_AREALINK
{
diff --git a/sc/source/ui/pagedlg/pagedlg.src b/sc/source/ui/pagedlg/pagedlg.src
index a031fbe464c9..6db6b1c06cc7 100644
--- a/sc/source/ui/pagedlg/pagedlg.src
+++ b/sc/source/ui/pagedlg/pagedlg.src
@@ -175,7 +175,7 @@ TabPage RID_SCPAGE_TABLE
{
Pos = MAP_APPFONT ( 12 , 101 ) ;
Size = MAP_APPFONT ( 142 , 10 ) ;
- Text [ en-US ] = "~Notes" ;
+ Text [ en-US ] = "~Comments" ;
TabStop = TRUE ;
};
CheckBox BTN_OBJECTS
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index c5b8cfd1a9e8..fb3890616aa0 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -304,23 +304,23 @@ Resource RID_GLOBSTR
};
String STR_UNDO_INSERTNOTE
{
- Text [ en-US ] = "Insert Note" ;
+ Text [ en-US ] = "Insert Comment" ;
};
String STR_UNDO_DELETENOTE
{
- Text [ en-US ] = "Delete Note" ;
+ Text [ en-US ] = "Delete Comment" ;
};
String STR_UNDO_SHOWNOTE
{
- Text [ en-US ] = "Show Note" ;
+ Text [ en-US ] = "Show Comment" ;
};
String STR_UNDO_HIDENOTE
{
- Text [ en-US ] = "Hide note" ;
+ Text [ en-US ] = "Hide Comment" ;
};
String STR_UNDO_EDITNOTE
{
- Text [ en-US ] = "Edit Note" ;
+ Text [ en-US ] = "Edit Comment" ;
};
String STR_UNDO_DEC_INDENT
{
@@ -1020,7 +1020,7 @@ Resource RID_GLOBSTR
};
String STR_NOTES
{
- Text [ en-US ] = "Notes" ;
+ Text [ en-US ] = "Comments" ;
};
String STR_QUERY_DELTAB
{
@@ -1260,7 +1260,7 @@ Resource RID_GLOBSTR
};
String STR_SCATTR_PAGE_NOTES
{
- Text [ en-US ] = "Notes" ;
+ Text [ en-US ] = "Comments" ;
};
String STR_SCATTR_PAGE_GRID
{
diff --git a/sc/source/ui/src/hdrcont.src b/sc/source/ui/src/hdrcont.src
index 6b80e2597b87..7ba7b6a1c8fe 100644
--- a/sc/source/ui/src/hdrcont.src
+++ b/sc/source/ui/src/hdrcont.src
@@ -136,8 +136,8 @@ Menu RID_POPUP_ROWHEADER
PART2
MenuItem
{
- Identifier = FID_PASTE_CONTENTS ;
- HelpId = FID_PASTE_CONTENTS ;
+ Identifier = SID_PASTE_SPECIAL ;
+ HelpId = SID_PASTE_SPECIAL ;
Text [ en-US ] = "P~aste Special..." ;
};
};
@@ -214,8 +214,8 @@ Menu RID_POPUP_COLHEADER
PART2
MenuItem
{
- Identifier = FID_PASTE_CONTENTS ;
- HelpId = FID_PASTE_CONTENTS ;
+ Identifier = SID_PASTE_SPECIAL ;
+ HelpId = SID_PASTE_SPECIAL ;
Text [ en-US ] = "Paste ~Special..." ;
};
};
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index ed84da38b742..66e42d08dcef 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -363,7 +363,7 @@ TabPage RID_SCPAGE_CONTENT
{
Pos = MAP_APPFONT ( 139 , 40 ) ;
Size = MAP_APPFONT ( 112 , 10 ) ;
- Text [ en-US ] = "~Note indicator" ;
+ Text [ en-US ] = "~Comment indicator" ;
};
CheckBox CB_VALUE
{
diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src
index 05d10b9813bd..b03c0c0ae135 100644
--- a/sc/source/ui/src/popup.src
+++ b/sc/source/ui/src/popup.src
@@ -86,19 +86,19 @@ Menu RID_POPUP_CELLS
{
Identifier = SID_INSERT_POSTIT ;
HelpId = SID_INSERT_POSTIT ;
- Text [ en-US ] = "Insert ~Note" ;
+ Text [ en-US ] = "Insert Co~mment" ;
};
MenuItem
{
Identifier = SID_DELETE_NOTE ;
HelpId = SID_DELETE_NOTE ;
- Text [ en-US ] = "D~elete Note" ;
+ Text [ en-US ] = "D~elete Comment" ;
};
MenuItem
{
Identifier = FID_NOTE_VISIBLE ;
HelpId = FID_NOTE_VISIBLE ;
- Text [ en-US ] = "Sho~w Note" ;
+ Text [ en-US ] = "Sho~w Comment" ;
};
//------------------------------
MenuItem { Separator = TRUE ; };
@@ -126,8 +126,8 @@ Menu RID_POPUP_CELLS
MenuItem
{
- Identifier = FID_PASTE_CONTENTS ;
- HelpId = FID_PASTE_CONTENTS ;
+ Identifier = SID_PASTE_SPECIAL ;
+ HelpId = SID_PASTE_SPECIAL ;
Text [ en-US ] = "P~aste Special..." ;
};
//------------------------------
@@ -524,7 +524,7 @@ Menu RID_POPUP_PAGEBREAK
{
Identifier = FID_NOTE_VISIBLE ;
HelpId = FID_NOTE_VISIBLE ;
- Text [ en-US ] = "Sho~w Note" ;
+ Text [ en-US ] = "Sho~w Comment" ;
};
};
};
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index ed6273e26ae4..f05793872d4c 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -2691,7 +2691,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
{
String 1 // Description
{
- Text [ en-US ] = "Raises a number to the power of another." ;
+ Text [ en-US ] = "Returns a^b, base a raised to the power of exponent b." ;
};
ExtraData =
{
@@ -2707,15 +2707,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "The number that is to be raised to the power of another." ;
+ Text [ en-US ] = "The base a of the power a^b." ;
};
String 4 // Name of Parameter 2
{
- Text [ en-US ] = "Power" ;
+ Text [ en-US ] = "Exponent" ;
};
String 5 // Description of Parameter 2
{
- Text [ en-US ] = "The power by which the number is to be raised." ;
+ Text [ en-US ] = "The exponent b of the power a^b." ;
};
};
// -=*# Resource for function ANZAHLLEEREZELLEN #*=-
@@ -5718,7 +5718,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
0;
ID_FUNCTION_GRP_STATISTIC;
U2S( HID_FUNC_NORMVERT );
- 4; 0; 0; 0; 0;
+ 4; 0; 0; 0; 1;
0;
};
String 2 // Name of Parameter 1
@@ -5731,7 +5731,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 4 // Name of Parameter 2
{
- Text [ en-US ] = "mean" ;
+ Text [ en-US ] = "Mean" ;
};
String 5 // Description of Parameter 2
{
@@ -5751,7 +5751,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 9 // Description of Parameter 4
{
- Text [ en-US ] = "Cumulated. C=0 calculates the density function, C=1 the distribution." ;
+ Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ;
};
};
// -=*# Resource for function NORMINV #*=-
@@ -5854,7 +5854,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
0;
ID_FUNCTION_GRP_STATISTIC;
U2S( HID_FUNC_LOGNORMVERT );
- 3; 0; 0; 0;
+ 4; 0; 1; 1; 1;
0;
};
String 2 // Name of Parameter 1
@@ -5871,7 +5871,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 5 // Description of Parameter 2
{
- Text [ en-US ] = "Mean value. The mean value of the log normal distribution." ;
+ Text [ en-US ] = "The mean value of the log normal distribution. It is set to 0 if omitted." ;
};
String 6 // Name of Parameter 3
{
@@ -5879,7 +5879,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 7 // Description of Parameter 3
{
- Text [ en-US ] = "Standard deviation. The standard deviation of the log normal distribution." ;
+ Text [ en-US ] = "The standard deviation of the log normal distribution. It is set to 1 if omitted." ;
+ };
+ String 8 // Name of Parameter 4
+ {
+ Text [ en-US] = "Cumulative";
+ };
+ String 9 // Description of Parameter 4
+ {
+ Text [ en-US] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ;
};
};
// -=*# Resource for function LOGINV #*=-
@@ -6758,7 +6766,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
{
String 1 // Description
{
- Text [ en-US ] = "Returns the two-tailed P value of a z test." ;
+ Text [ en-US ] = "Calculates the probability of observing a z-statistic greater than the one computed based on a sample." ;
};
ExtraData =
{
@@ -6774,15 +6782,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "The data array." ;
+ Text [ en-US ] = "The given sample, drawn from a normally distributed population." ;
};
String 4 // Name of Parameter 2
{
- Text [ en-US ] = "Number" ;
+ Text [ en-US ] = "mu" ;
};
String 5 // Description of Parameter 2
{
- Text [ en-US ] = "The value to be tested." ;
+ Text [ en-US ] = "The known mean of the population." ;
};
String 6 // Name of Parameter 3
{
@@ -6790,7 +6798,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 7 // Description of Parameter 3
{
- Text [ en-US ] = "The standard deviation of the population." ;
+ Text [ en-US ] = "The known standard deviation of the population. If omitted, the standard deviation of the given sample is used." ;
};
};
// -=*# Resource for function CHITEST #*=-
@@ -8906,7 +8914,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
ExtraData =
{
- 1; // TODO: implementation and unsuppress
+ 0;
ID_FUNCTION_GRP_TEXT;
U2S( HID_FUNC_UNICODE );
1; 0;
@@ -8929,7 +8937,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
ExtraData =
{
- 1; // TODO: implementation and unsuppress
+ 0;
ID_FUNCTION_GRP_TEXT;
U2S( HID_FUNC_UNICHAR );
1; 0;
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index e44f5e7a6478..8cc45d41a2e6 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -64,6 +64,7 @@
#include "transobj.hxx"
#include "refundo.hxx"
#include "undoolk.hxx"
+#include "clipparam.hxx"
#include "sc.hrc"
@@ -441,7 +442,7 @@ void ScUndoDeleteCells::DoChange( const BOOL bUndo )
for( i=0; i<nCount && bUndo; i++ )
{
pRefUndoDoc->CopyToDocument( aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
- IDF_ALL, FALSE, pDoc );
+ IDF_ALL | IDF_NOCAPTIONS, FALSE, pDoc );
}
ScRange aWorkRange( aEffRange );
@@ -1316,9 +1317,8 @@ void __EXPORT ScUndoDragDrop::Redo()
aSourceMark.SelectTable( nTab, TRUE );
// do not clone objects and note captions into clipdoc (see above)
- pDoc->CopyToClip( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(),
- aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(),
- bCut, pClipDoc, FALSE, &aSourceMark, bKeepScenarioFlags, FALSE, FALSE );
+ ScClipParam aClipParam(aSrcRange, bCut);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bKeepScenarioFlags, false, false);
if (bCut)
{
@@ -1729,8 +1729,8 @@ void __EXPORT ScUndoEnterMatrix::Undo()
ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aBlockRange, IDF_ALL );
- pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aBlockRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
pDocShell->PostPaint( aBlockRange, PAINT_GRID );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index ea1e303d6ae3..4a94827ed1ec 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -1340,8 +1340,8 @@ void __EXPORT ScUndoTabOp::Undo()
pDocShell->UpdatePaintExt( nExtFlags, aRange );
ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aRange,IDF_ALL );
- pUndoDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aRange,IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
pDocShell->PostPaint( aRange, PAINT_GRID, nExtFlags );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -2023,14 +2023,14 @@ void ScUndoUpdateAreaLink::DoChange( const BOOL bUndo ) const
if ( bWithInsert )
{
pDoc->FitBlock( aNewRange, aOldRange );
- pDoc->DeleteAreaTab( aOldRange, IDF_ALL );
- pUndoDoc->UndoToDocument( aOldRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aOldRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->UndoToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
else
{
ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
- pDoc->DeleteAreaTab( aCopyRange, IDF_ALL );
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
}
else
@@ -2038,14 +2038,14 @@ void ScUndoUpdateAreaLink::DoChange( const BOOL bUndo ) const
if ( bWithInsert )
{
pDoc->FitBlock( aOldRange, aNewRange );
- pDoc->DeleteAreaTab( aNewRange, IDF_ALL );
- pRedoDoc->CopyToDocument( aNewRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aNewRange, IDF_ALL & ~IDF_NOTE );
+ pRedoDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
else
{
ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
- pDoc->DeleteAreaTab( aCopyRange, IDF_ALL );
- pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
+ pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
}
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index f16409b37239..7ab321ac0c1d 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -1302,8 +1302,8 @@ void __EXPORT ScUndoImportData::Undo()
for (SCCOL nCopyCol = nCol1; nCopyCol <= nCol2; nCopyCol++)
{
pDoc->CopyToDocument( nCopyCol,nRow1,nTab, nCopyCol,nRow2,nTab,
- IDF_CONTENTS, FALSE, pRedoDoc );
- pDoc->DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS );
+ IDF_CONTENTS & ~IDF_NOTE, FALSE, pRedoDoc );
+ pDoc->DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS & ~IDF_NOTE );
pDoc->DoColResize( nTab, nCopyCol, nCopyCol, 0 );
}
pDoc->SetAutoCalc( bOldAutoCalc );
@@ -1321,7 +1321,7 @@ void __EXPORT ScUndoImportData::Undo()
pRedoDBData->GetArea( aNew );
pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
- aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL );
+ aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE );
aOld.aEnd.SetCol( aOld.aEnd.Col() + nFormulaCols ); // FitBlock auch fuer Formeln
aNew.aEnd.SetCol( aNew.aEnd.Col() + nFormulaCols );
@@ -1329,11 +1329,11 @@ void __EXPORT ScUndoImportData::Undo()
}
else
pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
- nEndCol,nEndRow, nTab, IDF_ALL );
+ nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE );
pUndoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab,
nEndCol+nFormulaCols,nEndRow,nTab,
- IDF_ALL, FALSE, pDoc );
+ IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
if (pCurrentData)
{
@@ -1395,16 +1395,16 @@ void __EXPORT ScUndoImportData::Redo()
pDoc->FitBlock( aOld, aNew );
pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
- aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL );
+ aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE );
- pRedoDoc->CopyToDocument( aNew, IDF_ALL, FALSE, pDoc ); // incl. Formeln
+ pRedoDoc->CopyToDocument( aNew, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); // incl. Formeln
}
else
{
pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
- nEndCol,nEndRow, nTab, IDF_ALL );
+ nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE );
pRedoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab,
- nEndCol,nEndRow,nTab, IDF_ALL, FALSE, pDoc );
+ nEndCol,nEndRow,nTab, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
if (pCurrentData)
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index cfe51aed6edc..f3418a84e2ef 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1093,7 +1093,7 @@ BOOL lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( rRange, IDF_CONTENTS, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index d63fbb837e44..bdf5317da1bc 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -500,6 +500,10 @@ void Chart2Positioner::glueState()
ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr);
SCCOLROW n1 = aData.Ref1.nCol;
SCCOLROW n2 = aData.Ref2.nCol;
+ if (n1 > MAXCOL)
+ n1 = MAXCOL;
+ if (n2 > MAXCOL)
+ n2 = MAXCOL;
SCCOLROW nTmp = n2 - n1 + 1;
if (n1 < mnStartCol)
mnStartCol = static_cast<SCCOL>(n1);
@@ -510,14 +514,18 @@ void Chart2Positioner::glueState()
n1 = aData.Ref1.nRow;
n2 = aData.Ref2.nRow;
+ if (n1 > MAXROW)
+ n1 = MAXROW;
+ if (n2 > MAXROW)
+ n2 = MAXROW;
nTmp = n2 - n1 + 1;
if (n1 < mnStartRow)
- mnStartRow = static_cast<SCCOL>(n1);
+ mnStartRow = static_cast<SCROW>(n1);
if (n2 > nEndRow)
- nEndRow = static_cast<SCCOL>(n2);
+ nEndRow = static_cast<SCROW>(n2);
if (nTmp > nMaxRows)
- nMaxRows = static_cast<SCCOL>(nTmp);
+ nMaxRows = static_cast<SCROW>(nTmp);
}
// total column size ?
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index d1c65e87ad9b..3c584a94a775 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -255,14 +255,19 @@ void SAL_CALL ScChartsObj::addNewByName( const rtl::OUString& aName,
xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
if( xReceiver.is())
{
+ String sRangeStr;
+ xNewRanges->Format(sRangeStr, SCR_ABS_3D, pDoc);
+
// connect
- xReceiver->attachDataProvider( xDataProvider );
+ if( sRangeStr.Len() )
+ xReceiver->attachDataProvider( xDataProvider );
+ else
+ sRangeStr = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "all" ) );
+
uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pDocShell->GetModel(), uno::UNO_QUERY );
xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
// set arguments
- String sRangeStr;
- xNewRanges->Format(sRangeStr, SCR_ABS_3D, pDoc);
uno::Sequence< beans::PropertyValue > aArgs( 4 );
aArgs[0] = beans::PropertyValue(
::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1,
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a4370f6665fb..cd63adc33989 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -60,6 +60,9 @@
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/reflection/XIdlClassProvider.hpp>
#include <comphelper/processfactory.hxx>
#include "docuno.hxx"
@@ -224,15 +227,30 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
if ( pDocShell )
{
pDocShell->GetDocument()->AddUnoObject(*this); // SfxModel is derived from SfxListener
+ }
+}
+
+ScModelObj::~ScModelObj()
+{
+ if (pDocShell)
+ pDocShell->GetDocument()->RemoveUnoObject(*this);
+
+ if (xNumberAgg.is())
+ xNumberAgg->setDelegator(uno::Reference<uno::XInterface>());
+ delete pPrintFuncCache;
+}
+
+uno::Reference< uno::XAggregation> ScModelObj::GetFormatter()
+{
+ if ( !xNumberAgg.is() )
+ {
// setDelegator veraendert den RefCount, darum eine Referenz selber halten
// (direkt am m_refCount, um sich beim release nicht selbst zu loeschen)
comphelper::increment( m_refCount );
-
// waehrend des queryInterface braucht man ein Ref auf das
// SvNumberFormatsSupplierObj, sonst wird es geloescht.
- uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(
- pDocShell->GetDocument()->GetFormatTable() ));
+ uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(pDocShell->GetDocument()->GetFormatTable() ));
{
xNumberAgg.set(uno::Reference<uno::XAggregation>( xFormatter, uno::UNO_QUERY ));
// extra block to force deletion of the temporary before setDelegator
@@ -243,20 +261,9 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
if (xNumberAgg.is())
xNumberAgg->setDelegator( (cppu::OWeakObject*)this );
-
comphelper::decrement( m_refCount );
- }
-}
-
-ScModelObj::~ScModelObj()
-{
- if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
-
- if (xNumberAgg.is())
- xNumberAgg->setDelegator(uno::Reference<uno::XInterface>());
-
- delete pPrintFuncCache;
+ } // if ( !xNumberAgg.is() )
+ return xNumberAgg;
}
ScDocument* ScModelObj::GetDocument() const
@@ -289,6 +296,13 @@ void ScModelObj::AfterXMLLoading(sal_Bool bRet)
pDocShell->AfterXMLLoading(bRet);
}
+ScSheetSaveData* ScModelObj::GetSheetSaveData()
+{
+ if (pDocShell)
+ return pDocShell->GetSheetSaveData();
+ return NULL;
+}
+
uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
throw(uno::RuntimeException)
{
@@ -309,8 +323,19 @@ uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
SC_QUERYINTERFACE( util::XChangesNotifier )
uno::Any aRet(SfxBaseModel::queryInterface( rType ));
- if ( !aRet.hasValue() && xNumberAgg.is() )
- aRet = xNumberAgg->queryAggregation( rType );
+ if ( !aRet.hasValue()
+ && rType != ::getCppuType((uno::Reference< com::sun::star::document::XDocumentEventBroadcaster>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::frame::XController>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::frame::XFrame>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::script::XInvocation>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::reflection::XIdlClassProvider>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::beans::XFastPropertySet>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::awt::XWindow>*)0))
+ {
+ GetFormatter();
+ if ( xNumberAgg.is() )
+ aRet = xNumberAgg->queryAggregation( rType );
+ }
return aRet;
}
@@ -335,7 +360,7 @@ uno::Sequence<uno::Type> SAL_CALL ScModelObj::getTypes() throw(uno::RuntimeExcep
const uno::Type* pParentPtr = aParentTypes.getConstArray();
uno::Sequence<uno::Type> aAggTypes;
- if ( xNumberAgg.is() )
+ if ( GetFormatter().is() )
{
const uno::Type& rProvType = ::getCppuType((uno::Reference<lang::XTypeProvider>*) 0);
uno::Any aNumProv(xNumberAgg->queryAggregation(rProvType));
@@ -426,7 +451,7 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
// NumberFormatter-Pointer am Uno-Objekt neu setzen
- if (xNumberAgg.is())
+ if (GetFormatter().is())
{
SvNumberFormatsSupplierObj* pNumFmt =
SvNumberFormatsSupplierObj::getImplementation(
@@ -1753,7 +1778,7 @@ sal_Int64 SAL_CALL ScModelObj::getSomething(
if ( nRet )
return nRet;
- if ( xNumberAgg.is() )
+ if ( GetFormatter().is() )
{
const uno::Type& rTunnelType = ::getCppuType((uno::Reference<lang::XUnoTunnel>*) 0);
uno::Any aNumTunnel(xNumberAgg->queryAggregation(rTunnelType));
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 1d9f3a1d9213..a50b4003b0ac 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -57,6 +57,7 @@
#include "patattr.hxx"
#include "docpool.hxx"
#include "attrib.hxx"
+#include "clipparam.hxx"
using namespace com::sun::star;
@@ -175,9 +176,8 @@ BOOL lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange,
ScMarkData aSourceMark;
aSourceMark.SelectOneTable( nSrcTab ); // for CopyToClip
aSourceMark.SetMarkArea( rSrcRange );
- pSrcDoc->CopyToClip( rSrcRange.aStart.Col(),rSrcRange.aStart.Row(),
- rSrcRange.aEnd.Col(),rSrcRange.aEnd.Row(),
- FALSE, pClipDoc, FALSE, &aSourceMark );
+ ScClipParam aClipParam(rSrcRange, false);
+ pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false);
if ( pClipDoc->HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 1b17c2e130ac..6ed8181091ac 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -350,7 +350,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
// maybe that IsStorage() already created an error!
if ( bIsStorage )
{
- uno::Reference < embed::XStorage > xStorage(aMedium.GetStorage());
+ uno::Reference < embed::XStorage > xStorage(aMedium.GetStorage( sal_False ));
if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE )
{
// error during storage creation means _here_ that the medium
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index bd481dfc49f0..a9e6a799e010 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -897,6 +897,47 @@ uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getEnd() throw(uno::
return xRange;
}
+// XUnoTunnel
+
+sal_Int64 SAL_CALL ScDrawTextCursor::getSomething(
+ const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
+{
+ if ( rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ }
+ return SvxUnoTextCursor::getSomething( rId );
+}
+
+// static
+const uno::Sequence<sal_Int8>& ScDrawTextCursor::getUnoTunnelId()
+{
+ static uno::Sequence<sal_Int8> * pSeq = 0;
+ if( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+// static
+ScDrawTextCursor* ScDrawTextCursor::getImplementation( const uno::Reference<uno::XInterface> xObj )
+{
+ ScDrawTextCursor* pRet = NULL;
+ uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
+ if (xUT.is())
+ pRet = reinterpret_cast<ScDrawTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
+ return pRet;
+}
+
//------------------------------------------------------------------------
ScSimpleEditSourceHelper::ScSimpleEditSourceHelper()
diff --git a/sc/source/ui/vba/makefile.mk b/sc/source/ui/vba/makefile.mk
index fb1cc00488b8..71727297d078 100644
--- a/sc/source/ui/vba/makefile.mk
+++ b/sc/source/ui/vba/makefile.mk
@@ -45,7 +45,7 @@ DLLPRE =
dummy:
@echo "not building vba..."
.ENDIF
-
+.IF "$(L10N_framework)"==""
INCPRE=$(INCCOM)$/$(TARGET)
# ------------------------------------------------------------------
@@ -135,11 +135,13 @@ SLOFILES= \
$(SLO)$/vbaspinbutton.obj \
$(SLO)$/vbaimage.obj \
$(SLO)$/service.obj
-
+.ENDIF
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+.IF "$(L10N_framework)"==""
+
ALLTAR : \
$(MISC)$/$(TARGET).don \
@@ -149,3 +151,4 @@ $(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
+$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
echo $@
+.ENDIF
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 54c8ff12e189..c2d0f68fc6ef 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -206,7 +206,6 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
break;
case SID_COPY: // Kopieren
- bDisable = (!bSimpleArea && eMarkType != SC_MARK_SIMPLE_FILTERED);
// nur wegen Matrix nicht editierbar? Matrix nicht zerreissen
//! schlaegt nicht zu, wenn geschuetzt UND Matrix, aber damit
//! muss man leben.. wird in Copy-Routine abgefangen, sonst
@@ -443,7 +442,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
SfxBindings& rBindings = GetViewData()->GetBindings();
rBindings.Invalidate( SID_PASTE );
- rBindings.Invalidate( FID_PASTE_CONTENTS );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
return 0;
@@ -453,7 +452,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
void __EXPORT ScCellShell::GetClipState( SfxItemSet& rSet )
{
// SID_PASTE
-// FID_PASTE_CONTENTS
+// SID_PASTE_SPECIAL
// SID_CLIPBOARD_FORMAT_ITEMS
if ( !pImpl->m_pClipEvtLstnr )
@@ -490,7 +489,7 @@ void __EXPORT ScCellShell::GetClipState( SfxItemSet& rSet )
if (bDisable)
{
rSet.DisableItem( SID_PASTE );
- rSet.DisableItem( FID_PASTE_CONTENTS );
+ rSet.DisableItem( SID_PASTE_SPECIAL );
rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
}
else if ( rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) != SFX_ITEM_UNKNOWN )
@@ -670,15 +669,9 @@ void ScCellShell::GetState(SfxItemSet &rSet)
nErrCode = pFCell->GetErrCode();
}
- if ( nErrCode > 0 )
- rSet.Put( SfxStringItem( nWhich,
- ScGlobal::GetLongErrorString( nErrCode ) ) );
- else
- {
- String aFuncStr;
- if ( pTabViewShell->GetFunction( aFuncStr ) )
- rSet.Put( SfxStringItem( nWhich, aFuncStr ) );
- }
+ String aFuncStr;
+ if ( pTabViewShell->GetFunction( aFuncStr, nErrCode ) )
+ rSet.Put( SfxStringItem( nWhich, aFuncStr ) );
}
}
break;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index e5bb702402d8..f610e28b3fc5 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -104,6 +104,7 @@
#include "dpgroup.hxx" // for ScDPNumGroupInfo
#include "spellparam.hxx"
#include "postit.hxx"
+#include "clipparam.hxx"
#include "globstr.hrc"
#include "scui_def.hxx" //CHINA001
@@ -1182,41 +1183,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_PASTE:
{
- Window* pWin = GetViewData()->GetActiveWin();
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
- ScDocument* pThisDoc = GetViewData()->GetDocument();
- ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( GetViewData()->GetCurX(),
- GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
- if ( pOwnClip && pDPObj )
- {
- // paste from Calc into DataPilot table: sort (similar to drag & drop)
-
- ScDocument* pClipDoc = pOwnClip->GetDocument();
- SCTAB nSourceTab = pOwnClip->GetVisibleTab();
-
- SCCOL nClipStartX;
- SCROW nClipStartY;
- SCCOL nClipEndX;
- SCROW nClipEndY;
- pClipDoc->GetClipStart( nClipStartX, nClipStartY );
- pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE );
- nClipEndX = nClipEndX + nClipStartX;
- nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference
-
- ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab );
- BOOL bDone = pTabViewShell->DataPilotMove( aSource, GetViewData()->GetCurPos() );
- if ( !bDone )
- pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT );
- }
- else
- {
- // normal paste
- WaitObject aWait( GetViewData()->GetDialogParent() );
- pTabViewShell->PasteFromSystem();
- }
+ PasteFromClipboard ( GetViewData(), pTabViewShell, true );
rReq.Done();
}
- pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
break;
case SID_CLIPBOARD_FORMAT_ITEMS:
@@ -1418,7 +1387,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pTabViewShell->CellContentChanged(); // => PasteFromXXX ???
break;
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
// Unterscheidung, ob eigene oder fremde Daten,
// dadurch FID_INS_CELL_CONTENTS ueberfluessig
{
@@ -1516,43 +1485,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
break;
-#if 0
- // clipboard slots were used only for old basic:
-
- case SID_GET_CLPBRD_FORMAT_COUNT:
- rReq.SetReturnValue( SfxUInt16Item( nSlot, Clipboard::GetFormatCount() ) );
- break;
-
- case SID_GET_CLPBRD_FORMAT_BY_IDX:
- if (pReqArgs)
- {
- const SfxPoolItem* pItem;
- if ( pReqArgs->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET &&
- pItem->ISA(SfxUInt16Item) )
- {
- USHORT nCount = Clipboard::GetFormatCount();
- USHORT nPos = ((const SfxUInt16Item*)pItem)->GetValue(); // 1-based
- if ( nPos && nPos <= nCount )
- rReq.SetReturnValue( SfxUInt32Item( nSlot, Clipboard::GetFormat(--nPos) ) );
- }
- }
- break;
-
- case SID_GET_CLPBRD_FORMAT_NAME:
- if (pReqArgs)
- {
- const SfxPoolItem* pItem;
- if ( pReqArgs->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET &&
- pItem->ISA(SfxUInt32Item) )
- {
- String aName = Exchange::GetFormatName(
- ((const SfxUInt32Item*)pItem)->GetValue() );
- rReq.SetReturnValue( SfxStringItem( nSlot, aName ) );
- }
- }
- break;
-#endif
-
//
// sonstiges
//
@@ -2226,3 +2158,52 @@ IMPL_LINK( ScCellShell, DialogClosed, AbstractScLinkedAreaDlg*, EMPTYARG )
return 0;
}
+void ScCellShell::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog )
+{
+ Window* pWin = pViewData->GetActiveWin();
+ ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
+ ScDocument* pThisDoc = pViewData->GetDocument();
+ ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( pViewData->GetCurX(),
+ pViewData->GetCurY(), pViewData->GetTabNo() );
+ if ( pOwnClip && pDPObj )
+ {
+ // paste from Calc into DataPilot table: sort (similar to drag & drop)
+
+ ScDocument* pClipDoc = pOwnClip->GetDocument();
+ SCTAB nSourceTab = pOwnClip->GetVisibleTab();
+
+ SCCOL nClipStartX;
+ SCROW nClipStartY;
+ SCCOL nClipEndX;
+ SCROW nClipEndY;
+ pClipDoc->GetClipStart( nClipStartX, nClipStartY );
+ pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE );
+ nClipEndX = nClipEndX + nClipStartX;
+ nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference
+
+ ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab );
+ BOOL bDone = pTabViewShell->DataPilotMove( aSource, pViewData->GetCurPos() );
+ if ( !bDone )
+ pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT );
+ }
+ else
+ {
+ // normal paste
+ WaitObject aWait( pViewData->GetDialogParent() );
+ if (!pOwnClip)
+ pTabViewShell->PasteFromSystem();
+ else
+ {
+ ScDocument* pClipDoc = pOwnClip->GetDocument();
+ sal_uInt16 nFlags = IDF_ALL;
+ if (pClipDoc->GetClipParam().isMultiRange())
+ // For multi-range paste, we paste values by default.
+ nFlags &= ~IDF_FORMULA;
+
+ pTabViewShell->PasteFromClip( nFlags, pClipDoc,
+ PASTE_NOFUNC, FALSE, FALSE, FALSE, INS_NONE, IDF_NONE,
+ bShowDialog ); // allow warning dialog
+ }
+ }
+ pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
+}
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index d9c19f02058a..022eabdc11cf 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -268,7 +268,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
}
break;
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
@@ -714,7 +714,7 @@ IMPL_LINK( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
SfxBindings& rBindings = pViewData->GetBindings();
rBindings.Invalidate( SID_PASTE );
- rBindings.Invalidate( FID_PASTE_CONTENTS );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
return 0;
@@ -742,7 +742,7 @@ void __EXPORT ScEditShell::GetClipState( SfxItemSet& rSet )
switch (nWhich)
{
case SID_PASTE:
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
if( !bPastePossible )
rSet.DisableItem( nWhich );
break;
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index b2f3e12d1ee6..36f6c682832f 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -824,6 +824,11 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq )
bNumFormatChanged, aOldSet, rNewSet ) )
pDoc->InvalidateTextWidth( NULL, NULL, bNumFormatChanged );
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (pDoc->IsStreamValid(nTab))
+ pDoc->SetStreamValid(nTab, FALSE);
+
ULONG nOldFormat = ((const SfxUInt32Item&)aOldSet.
Get( ATTR_VALUE_FORMAT )).GetValue();
ULONG nNewFormat = ((const SfxUInt32Item&)rNewSet.
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index e41bd4941d9c..f5688171b145 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -94,7 +94,6 @@ const USHORT SC_SHRINKAGAIN_MAX = 7;
class ScDrawStringsVars
{
ScOutputData* pOutput; // Verbindung
- SvNumberFormatter* pFormatter;
const ScPatternAttr* pPattern; // Attribute
const SfxItemSet* pCondSet; // aus bedingter Formatierung
@@ -187,8 +186,6 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, BOOL bPTL) :
bShrink ( FALSE ),
bPixelToLogic( bPTL )
{
- pFormatter = pData->pDoc->GetFormatTable();
-
ScModule* pScMod = SC_MOD();
// #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE)
bCellContrast = pOutput->bUseStyleColor &&
@@ -373,7 +370,7 @@ void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet*
// Zahlenformat
// ULONG nOld = nValueFormat;
- nValueFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
+ nValueFormat = pPattern->GetNumberFormat( pOutput->pDoc->GetFormatTable(), pCondSet );
/* s.u.
if (nValueFormat != nOld)
@@ -414,7 +411,7 @@ void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxIt
const SfxPoolItem* pLangItem;
if ( !pCondSet || pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT,TRUE,&pLangItem) != SFX_ITEM_SET )
pLangItem = &pPattern->GetItem(ATTR_LANGUAGE_FORMAT);
- nValueFormat = pFormatter->GetFormatForLanguageIfBuiltIn(
+ nValueFormat = pOutput->pDoc->GetFormatTable()->GetFormatForLanguageIfBuiltIn(
((SfxUInt32Item*)pFormItem)->GetValue(),
((SvxLanguageItem*)pLangItem)->GetLanguage() );
@@ -456,7 +453,7 @@ BOOL ScDrawStringsVars::SetText( ScBaseCell* pCell )
ULONG nFormat = GetValueFormat();
ScCellFormat::GetString( pCell,
nFormat, aString, &pColor,
- *pFormatter,
+ *pOutput->pDoc->GetFormatTable(),
pOutput->bShowNullValues,
pOutput->bShowFormulas,
ftCheck );
@@ -1358,11 +1355,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
}
if (bDoCell && !bNeedEdit)
{
- if ( pCell->GetCellType() == CELLTYPE_FORMULA )
+ BOOL bFormulaCell = (pCell->GetCellType() == CELLTYPE_FORMULA );
+ if ( bFormulaCell )
lcl_CreateInterpretProgress( bProgress, pDoc, (ScFormulaCell*)pCell );
if ( aVars.SetText(pCell) )
pOldPattern = NULL;
- bNeedEdit = aVars.HasEditCharacters();
+ bNeedEdit = aVars.HasEditCharacters() ||
+ (bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult());
}
if (bDoCell && !bNeedEdit)
{
@@ -1914,8 +1913,6 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
Size aMinSize = pRefDevice->PixelToLogic(Size(0,100)); // erst darueber wird ausgegeben
// UINT32 nMinHeight = aMinSize.Height() / 200; // 1/2 Pixel
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-
ScModule* pScMod = SC_MOD();
sal_Int32 nConfBackColor = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
// #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE)
@@ -2319,12 +2316,12 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
else
{
ULONG nFormat = pPattern->GetNumberFormat(
- pFormatter, pCondSet );
+ pDoc->GetFormatTable(), pCondSet );
String aString;
Color* pColor;
ScCellFormat::GetString( pCell,
nFormat,aString, &pColor,
- *pFormatter,
+ *pDoc->GetFormatTable(),
bShowNullValues,
bShowFormulas,
ftCheck );
@@ -2810,8 +2807,6 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
nRotMax = pRowInfo[nRotY].nRotMaxCol;
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-
ScModule* pScMod = SC_MOD();
sal_Int32 nConfBackColor = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
// #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE)
@@ -3100,12 +3095,12 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
else
{
ULONG nFormat = pPattern->GetNumberFormat(
- pFormatter, pCondSet );
+ pDoc->GetFormatTable(), pCondSet );
String aString;
Color* pColor;
ScCellFormat::GetString( pCell,
nFormat,aString, &pColor,
- *pFormatter,
+ *pDoc->GetFormatTable(),
bShowNullValues,
bShowFormulas,
ftCheck );
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 3bfb8729cd37..db1a8952aeef 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -49,6 +49,7 @@
#include "sc.hrc"
#include "globstr.hrc"
#include "transobj.hxx"
+#include "clipparam.hxx"
// STATIC DATA -----------------------------------------------------------
@@ -447,7 +448,8 @@ void ScTabControl::DoDrag( const Region& /* rRegion */ )
aTabMark.SetMarkArea( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab) );
ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
- pDoc->CopyToClip( 0,0, MAXCOL,MAXROW, FALSE, pClipDoc, FALSE, &aTabMark );
+ ScClipParam aClipParam(ScRange(0, 0, 0, MAXCOL, MAXROW, 0), false);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &aTabMark, false);
TransferableObjectDescriptor aObjDesc;
pDocSh->FillTransferableObjectDescriptor( aObjDesc );
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index f8cf331bc8cf..a19760e4c277 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -422,7 +422,7 @@ void ScTabView::SelectionChanged()
rBindings.Invalidate( SID_CUT );
rBindings.Invalidate( SID_COPY );
rBindings.Invalidate( SID_PASTE );
- rBindings.Invalidate( FID_PASTE_CONTENTS );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( FID_INS_ROW );
rBindings.Invalidate( FID_INS_COLUMN );
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index d8449ebc3699..e34741ba4c6b 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1510,7 +1510,7 @@ BOOL ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt)
// #51889# Spezialfall: Copy/Cut bei Mehrfachselektion -> Fehlermeldung
// (Slot ist disabled, SfxViewShell::KeyInput wuerde also kommentarlos verschluckt)
KeyFuncType eFunc = aCode.GetFunction();
- if ( eFunc == KEYFUNC_COPY || eFunc == KEYFUNC_CUT )
+ if ( eFunc == KEYFUNC_CUT )
{
ScRange aDummy;
ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy );
@@ -1806,7 +1806,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode )
{
SCTAB nInitTabCount = 3; //! konfigurierbar !!!
for (SCTAB i=1; i<nInitTabCount; i++)
- pDoc->MakeTable(i);
+ pDoc->MakeTable(i,false);
}
pDocSh->SetEmpty( FALSE ); // #i6232# make sure this is done only once
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 766785d5ffc8..9e844f970909 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -72,11 +72,23 @@
#include "compiler.hxx"
-BOOL ScTabViewShell::GetFunction( String& rFuncStr )
+BOOL ScTabViewShell::GetFunction( String& rFuncStr, sal_uInt16 nErrCode )
{
String aStr;
ScSubTotalFunc eFunc = (ScSubTotalFunc) SC_MOD()->GetAppOptions().GetStatusFunc();
+ ScViewData* pViewData = GetViewData();
+ ScMarkData& rMark = pViewData->GetMarkData();
+ bool bIgnoreError = (rMark.IsMarked() || rMark.IsMultiMarked());
+
+ if (bIgnoreError && (eFunc == SUBTOTAL_FUNC_CNT || eFunc == SUBTOTAL_FUNC_CNT2))
+ nErrCode = 0;
+
+ if (nErrCode)
+ {
+ rFuncStr = ScGlobal::GetLongErrorString(nErrCode);
+ return true;
+ }
USHORT nGlobStrId = 0;
switch (eFunc)
@@ -94,9 +106,7 @@ BOOL ScTabViewShell::GetFunction( String& rFuncStr )
}
if (nGlobStrId)
{
- ScViewData* pViewData = GetViewData();
ScDocument* pDoc = pViewData->GetDocument();
- ScMarkData& rMark = pViewData->GetMarkData();
SCCOL nPosX = pViewData->GetCurX();
SCROW nPosY = pViewData->GetCurY();
SCTAB nTab = pViewData->GetTabNo();
@@ -104,30 +114,38 @@ BOOL ScTabViewShell::GetFunction( String& rFuncStr )
aStr = ScGlobal::GetRscString(nGlobStrId);
aStr += '=';
- // Anzahl im Standardformat, die anderen nach Cursorposition
- sal_uInt32 nNumFmt = 0;
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
- if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 )
- {
- // Zahlformat aus Attributen oder Formel
- pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt );
- if ( (nNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- {
- ScBaseCell* pCell;
- pDoc->GetCell( nPosX, nPosY, nTab, pCell );
- if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
- nNumFmt = ((ScFormulaCell*)pCell)->GetStandardFormat(
- *pFormatter, nNumFmt );
- }
- }
ScAddress aCursor( nPosX, nPosY, nTab );
double nVal;
if ( pDoc->GetSelectionFunction( eFunc, aCursor, rMark, nVal ) )
{
- String aValStr;
- Color* pDummy;
- pFormatter->GetOutputString( nVal, nNumFmt, aValStr, &pDummy );
- aStr += aValStr;
+ if ( nVal == 0.0 )
+ aStr += '0';
+ else
+ {
+ // Anzahl im Standardformat, die anderen nach Cursorposition
+ SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ sal_uInt32 nNumFmt = 0;
+ if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 )
+ {
+ // Zahlformat aus Attributen oder Formel
+ pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt );
+ if ( (nNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
+ {
+ ScBaseCell* pCell;
+ pDoc->GetCell( nPosX, nPosY, nTab, pCell );
+ if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+
+ nNumFmt = ((ScFormulaCell*)pCell)->GetStandardFormat(*pFormatter, nNumFmt );
+ }
+ }
+ }
+
+ String aValStr;
+ Color* pDummy;
+ pFormatter->GetOutputString( nVal, nNumFmt, aValStr, &pDummy );
+ aStr += aValStr;
+ }
}
rFuncStr = aStr;
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index f2bc65a66ba8..37dc2c11da7f 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -465,7 +465,10 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
case SID_INSERT_SOUND:
case SID_INSERT_VIDEO:
- if ( bOle || bTabProt || !SvxPluginFileDlg::IsAvailable(nWhich) || bShared )
+ /* #i102735# discussed with NN: removed for performance reasons
+ || !SvxPluginFileDlg::IsAvailable(nWhich)
+ */
+ if ( bOle || bTabProt || bShared )
rSet.DisableItem( nWhich );
break;
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 9dda9a097395..3065aa2fd4e1 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -212,6 +212,7 @@
#include "transobj.hxx"
#include "drwtrans.hxx"
#include "docuno.hxx"
+#include "clipparam.hxx"
using namespace com::sun::star;
@@ -312,10 +313,10 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI
ScRange aRange;
ScMarkType eMarkType = GetViewData()->GetSimpleArea( aRange );
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ ScMarkData& rMark = GetViewData()->GetMarkData();
if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED )
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- ScMarkData& rMark = GetViewData()->GetMarkData();
if ( !pDoc->HasSelectedBlockMatrixFragment(
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
@@ -342,9 +343,8 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI
ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
}
- pDoc->CopyToClip( aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(),
- bCut, pClipDoc, FALSE, &rMark, FALSE, bIncludeObjects );
+ ScClipParam aClipParam(aRange, bCut);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, false, bIncludeObjects);
if (bSysClip)
{
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -382,6 +382,124 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI
ErrorMessage(STR_MATRIXFRAGMENTERR);
}
}
+ else if (eMarkType == SC_MARK_MULTI)
+ {
+ bool bSuccess = false;
+ ScClipParam aClipParam;
+ aClipParam.mbCutMode = false;
+ rMark.MarkToSimple();
+ rMark.FillRangeListWithMarks(&aClipParam.maRanges, false);
+
+ do
+ {
+ if (bCut)
+ // We con't support cutting of multi-selections.
+ break;
+
+ if (pClipDoc)
+ // TODO: What's this for?
+ break;
+
+ ::std::auto_ptr<ScDocument> pDocClip(new ScDocument(SCDOCMODE_CLIP));
+
+ // Check for geometrical feasibility of the ranges.
+ bool bValidRanges = true;
+ ScRangePtr p = aClipParam.maRanges.First();
+ SCCOL nPrevColDelta = 0;
+ SCROW nPrevRowDelta = 0;
+ SCCOL nPrevCol = p->aStart.Col();
+ SCROW nPrevRow = p->aStart.Row();
+ SCCOL nPrevColSize = p->aEnd.Col() - p->aStart.Col() + 1;
+ SCROW nPrevRowSize = p->aEnd.Row() - p->aStart.Row() + 1;
+ for (p = aClipParam.maRanges.Next(); p; p = aClipParam.maRanges.Next())
+ {
+ if (pDoc->HasSelectedBlockMatrixFragment(
+ p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), rMark))
+ {
+ if (!bApi)
+ ErrorMessage(STR_MATRIXFRAGMENTERR);
+ return false;
+ }
+
+ SCCOL nColDelta = p->aStart.Col() - nPrevCol;
+ SCROW nRowDelta = p->aStart.Row() - nPrevRow;
+
+ if ((nColDelta && nRowDelta) || (nPrevColDelta && nRowDelta) || (nPrevRowDelta && nColDelta))
+ {
+ bValidRanges = false;
+ break;
+ }
+
+ if (aClipParam.meDirection == ScClipParam::Unspecified)
+ {
+ if (nColDelta)
+ aClipParam.meDirection = ScClipParam::Column;
+ if (nRowDelta)
+ aClipParam.meDirection = ScClipParam::Row;
+ }
+
+ SCCOL nColSize = p->aEnd.Col() - p->aStart.Col() + 1;
+ SCROW nRowSize = p->aEnd.Row() - p->aStart.Row() + 1;
+
+ if (aClipParam.meDirection == ScClipParam::Column && nRowSize != nPrevRowSize)
+ {
+ // column-oriented ranges must have identical row size.
+ bValidRanges = false;
+ break;
+ }
+ if (aClipParam.meDirection == ScClipParam::Row && nColSize != nPrevColSize)
+ {
+ // likewise, row-oriented ranges must have identical
+ // column size.
+ bValidRanges = false;
+ break;
+ }
+
+ nPrevCol = p->aStart.Col();
+ nPrevRow = p->aStart.Row();
+ nPrevColDelta = nColDelta;
+ nPrevRowDelta = nRowDelta;
+ nPrevColSize = nColSize;
+ nPrevRowSize = nRowSize;
+ }
+ if (!bValidRanges)
+ break;
+
+ pDoc->CopyToClip(aClipParam, pDocClip.get(), &rMark, false, false, bIncludeObjects);
+
+ ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ if ( pChangeTrack )
+ pChangeTrack->ResetLastCut(); // kein CutMode mehr
+
+ {
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
+ TransferableObjectDescriptor aObjDesc;
+ pDocSh->FillTransferableObjectDescriptor( aObjDesc );
+ aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
+ // maSize is set in ScTransferObj ctor
+
+ ScTransferObj* pTransferObj = new ScTransferObj( pDocClip.release(), aObjDesc );
+ uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+
+ if ( ScGlobal::pDrawClipDocShellRef )
+ {
+ SfxObjectShellRef aPersistRef( &(*ScGlobal::pDrawClipDocShellRef) );
+ pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive
+ }
+
+ pTransferObj->CopyToClipboard( GetActiveWin() ); // system clipboard
+ SC_MOD()->SetClipObject( pTransferObj, NULL ); // internal clipboard
+ }
+
+ bSuccess = true;
+ }
+ while (false);
+
+ if (!bSuccess && !bApi)
+ ErrorMessage(STR_NOMULTISELECT);
+
+ bDone = bSuccess;
+ }
else
{
if (!bApi)
@@ -408,9 +526,8 @@ ScTransferObj* ScViewFunc::CopyToTransferable()
BOOL bAnyOle = pDoc->HasOLEObjectsInArea( aRange, &rMark );
ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
- pDoc->CopyToClip( aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(),
- FALSE, pClipDoc, FALSE, &rMark, FALSE, TRUE );
+ ScClipParam aClipParam(aRange, false);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, false, true);
ScDrawLayer::SetGlobalDrawPersist(NULL);
pClipDoc->ExtendMerge( aRange, TRUE );
@@ -739,6 +856,52 @@ BOOL lcl_SelHasAttrib( ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
// internes Paste
+namespace {
+
+class CursorSwitcher
+{
+public:
+ CursorSwitcher(ScViewFunc* pViewFunc) :
+ mpViewFunc(pViewFunc)
+ {
+ mpViewFunc->HideCursor();
+ }
+
+ ~CursorSwitcher()
+ {
+ mpViewFunc->ShowCursor();
+ }
+private:
+ ScViewFunc* mpViewFunc;
+};
+
+bool lcl_checkDestRangeForOverwrite(const ScRange& rDestRange, const ScDocument* pDoc, const ScMarkData& rMark, Window* pParentWnd)
+{
+ bool bIsEmpty = true;
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab < nTabCount && bIsEmpty; ++nTab)
+ {
+ if (!rMark.GetTableSelect(nTab))
+ continue;
+
+ bIsEmpty = pDoc->IsBlockEmpty(nTab, rDestRange.aStart.Col(), rDestRange.aStart.Row(),
+ rDestRange.aEnd.Col(), rDestRange.aEnd.Row());
+ }
+
+ if (!bIsEmpty)
+ {
+ ScReplaceWarnBox aBox(pParentWnd);
+ if (aBox.Execute() != RET_YES)
+ {
+ // changing the configuration is within the ScReplaceWarnBox
+ return false;
+ }
+ }
+ return true;
+}
+
+}
+
BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
USHORT nFunction, BOOL bSkipEmpty,
BOOL bTranspose, BOOL bAsLink,
@@ -764,6 +927,12 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
// do not copy note captions into undo document
nUndoFlags |= IDF_NOCAPTIONS;
+ ScClipParam& rClipParam = pClipDoc->GetClipParam();
+ if (rClipParam.isMultiRange())
+ return PasteMultiRangesFromClip(
+ nFlags, pClipDoc, nFunction, bSkipEmpty, bTranspose, bAsLink, bAllowDialogs,
+ eMoveMode, nContFlags, nUndoFlags);
+
BOOL bCutMode = pClipDoc->IsCutMode(); // if transposing, take from original clipdoc
BOOL bIncludeFiltered = bCutMode;
@@ -992,23 +1161,8 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
SC_MOD()->GetInputOptions().GetReplaceCellsWarn();
if ( bAskIfNotEmpty )
{
- BOOL bIsEmpty = TRUE;
- SCTAB nTabCount = pDoc->GetTableCount();
- for (SCTAB nTab=0; nTab<nTabCount && bIsEmpty; nTab++)
- if ( aFilteredMark.GetTableSelect(nTab) &&
- !pDoc->IsBlockEmpty( nTab, aUserRange.aStart.Col(), aUserRange.aStart.Row(),
- aUserRange.aEnd.Col(), aUserRange.aEnd.Row() ) )
- bIsEmpty = FALSE;
-
- if ( !bIsEmpty )
- {
- ScReplaceWarnBox aBox( GetViewData()->GetDialogParent() );
- if ( aBox.Execute() != RET_YES )
- {
- // changing the configuration is within the ScReplaceWarnBox
- return FALSE;
- }
- }
+ if (!lcl_checkDestRangeForOverwrite(aUserRange, pDoc, aFilteredMark, GetViewData()->GetDialogParent()))
+ return false;
}
}
@@ -1302,7 +1456,179 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
// AdjustBlockHeight has already been called above
aModificator.SetDocumentModified();
- pDocSh->UpdateOle(GetViewData());
+ PostPasteFromClip(aUserRange, rMark);
+ return TRUE;
+}
+
+bool ScViewFunc::PasteMultiRangesFromClip(
+ sal_uInt16 nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction,
+ bool bSkipEmpty, bool bTranspose, bool bAsLink, bool bAllowDialogs,
+ InsCellCmd eMoveMode, sal_uInt16 /*nContFlags*/, sal_uInt16 nUndoFlags)
+{
+ ScViewData& rViewData = *GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
+ ScMarkData aMark(rViewData.GetMarkData());
+ const ScAddress& rCurPos = rViewData.GetCurPos();
+ ScClipParam& rClipParam = pClipDoc->GetClipParam();
+ SCCOL nColSize = rClipParam.getPasteColSize();
+ SCROW nRowSize = rClipParam.getPasteRowSize();
+
+ if (bTranspose)
+ {
+ if (static_cast<SCROW>(rCurPos.Col()) + nRowSize-1 > static_cast<SCROW>(MAXCOL))
+ {
+ ErrorMessage(STR_PASTE_FULL);
+ return false;
+ }
+
+ ::std::auto_ptr<ScDocument> pTransClip(new ScDocument(SCDOCMODE_CLIP));
+ pClipDoc->TransposeClip(pTransClip.get(), nFlags, bAsLink);
+ pClipDoc = pTransClip.release();
+ SCCOL nTempColSize = nColSize;
+ nColSize = static_cast<SCCOL>(nRowSize);
+ nRowSize = static_cast<SCROW>(nTempColSize);
+ }
+
+ if (!ValidCol(rCurPos.Col()+nColSize-1) || !ValidRow(rCurPos.Row()+nRowSize-1))
+ {
+ ErrorMessage(STR_PASTE_FULL);
+ return false;
+ }
+
+ // Determine the first and last selected sheet numbers.
+ SCTAB nTab1 = aMark.GetFirstSelected();
+ SCTAB nTab2 = nTab1;
+ for (SCTAB i = nTab1+1; i <= MAXTAB; ++i)
+ if (aMark.GetTableSelect(i))
+ nTab2 = i;
+
+ ScDocShellModificator aModificator(*pDocSh);
+
+ // For multi-selection paste, we don't support cell duplication for larger
+ // destination range. In case the destination is marked, we reset it to
+ // the clip size.
+ ScRange aMarkedRange(rCurPos.Col(), rCurPos.Row(), nTab1,
+ rCurPos.Col()+nColSize-1, rCurPos.Row()+nRowSize-1, nTab2);
+
+ // Extend the marked range to account for filtered rows in the destination
+ // area.
+ if (ScViewUtil::HasFiltered(aMarkedRange, pDoc))
+ {
+ if (!ScViewUtil::FitToUnfilteredRows(aMarkedRange, pDoc, nRowSize))
+ return false;
+ }
+
+ bool bAskIfNotEmpty =
+ bAllowDialogs && (nFlags & IDF_CONTENTS) &&
+ nFunction == PASTE_NOFUNC && SC_MOD()->GetInputOptions().GetReplaceCellsWarn();
+
+ if (bAskIfNotEmpty)
+ {
+ if (!lcl_checkDestRangeForOverwrite(aMarkedRange, pDoc, aMark, rViewData.GetDialogParent()))
+ return false;
+ }
+
+ aMark.SetMarkArea(aMarkedRange);
+ MarkRange(aMarkedRange);
+
+ bool bInsertCells = (eMoveMode != INS_NONE);
+ if (bInsertCells)
+ {
+ if (!InsertCells(eMoveMode, pDoc->IsUndoEnabled(), true))
+ return false;
+ }
+
+ ::std::auto_ptr<ScDocument> pUndoDoc;
+ if (pDoc->IsUndoEnabled())
+ {
+ pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
+ pUndoDoc->InitUndoSelected(pDoc, aMark, false, false);
+ pDoc->CopyToDocument(aMarkedRange, nUndoFlags, false, pUndoDoc.get(), &aMark, true);
+ }
+
+ ::std::auto_ptr<ScDocument> pMixDoc;
+ if ( bSkipEmpty || nFunction )
+ {
+ if ( nFlags & IDF_CONTENTS )
+ {
+ pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
+ pMixDoc->InitUndoSelected(pDoc, aMark, false, false);
+ pDoc->CopyToDocument(aMarkedRange, IDF_CONTENTS, false, pMixDoc.get(), &aMark, true);
+ }
+ }
+
+ /* Make draw layer and start drawing undo.
+ - Needed before AdjustBlockHeight to track moved drawing objects.
+ - Needed before pDoc->CopyFromClip to track inserted note caption objects.
+ */
+ if (nFlags & IDF_OBJECTS)
+ pDocSh->MakeDrawLayer();
+ if (pDoc->IsUndoEnabled())
+ pDoc->BeginDrawUndo();
+
+ CursorSwitcher aCursorSwitch(this);
+ sal_uInt16 nNoObjFlags = nFlags & ~IDF_OBJECTS;
+ pDoc->CopyMultiRangeFromClip(rCurPos, aMark, nNoObjFlags, pClipDoc,
+ true, bAsLink, false, bSkipEmpty);
+
+ if (pMixDoc.get())
+ pDoc->MixDocument(aMarkedRange, nFunction, bSkipEmpty, pMixDoc.get());
+
+ AdjustBlockHeight(); // update row heights before pasting objects
+
+ if (nFlags & IDF_OBJECTS)
+ {
+ // Paste the drawing objects after the row heights have been updated.
+ pDoc->CopyMultiRangeFromClip(rCurPos, aMark, IDF_OBJECTS, pClipDoc,
+ true, false, false, true);
+ }
+
+ pDocSh->PostPaint(
+ aMarkedRange.aStart.Col(), aMarkedRange.aStart.Row(), nTab1,
+ aMarkedRange.aEnd.Col(), aMarkedRange.aEnd.Row(), nTab1, PAINT_GRID);
+
+ if (pDoc->IsUndoEnabled())
+ {
+ SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
+ String aUndo = ScGlobal::GetRscString(
+ pClipDoc->IsCutMode() ? STR_UNDO_CUT : STR_UNDO_COPY);
+ pUndoMgr->EnterListAction(aUndo, aUndo);
+
+ ScUndoPasteOptions aOptions; // store options for repeat
+ aOptions.nFunction = nFunction;
+ aOptions.bSkipEmpty = bSkipEmpty;
+ aOptions.bTranspose = bTranspose;
+ aOptions.bAsLink = bAsLink;
+ aOptions.eMoveMode = eMoveMode;
+
+ ScUndoPaste* pUndo = new ScUndoPaste(pDocSh,
+ aMarkedRange.aStart.Col(),
+ aMarkedRange.aStart.Row(),
+ aMarkedRange.aStart.Tab(),
+ aMarkedRange.aEnd.Col(),
+ aMarkedRange.aEnd.Row(),
+ aMarkedRange.aEnd.Tab(),
+ aMark, pUndoDoc.release(), NULL, nFlags|nUndoFlags, NULL, NULL, NULL, NULL, false, &aOptions);
+
+ if (bInsertCells)
+ pUndoMgr->AddUndoAction(new ScUndoWrapper(pUndo), true);
+ else
+ pUndoMgr->AddUndoAction(pUndo, false);
+
+ pUndoMgr->LeaveListAction();
+ }
+ aModificator.SetDocumentModified();
+ PostPasteFromClip(aMarkedRange, aMark);
+ return true;
+}
+
+void ScViewFunc::PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark)
+{
+ ScViewData* pViewData = GetViewData();
+ ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScDocument* pDoc = pViewData->GetDocument();
+ pDocSh->UpdateOle(pViewData);
SelectionChanged();
@@ -1316,7 +1642,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
{
if ( rMark.GetTableSelect( i ) )
{
- ScRange aChangeRange( aUserRange );
+ ScRange aChangeRange(rPasteRange);
aChangeRange.aStart.SetTab( i );
aChangeRange.aEnd.SetTab( i );
aChangeRanges.Append( aChangeRange );
@@ -1324,8 +1650,6 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
}
-
- return TRUE;
}
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 0f3a1c812802..578f6c1fe733 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -155,7 +155,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
pRedoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL|IDF_NOCAPTIONS, FALSE, pRedoDoc );
ScMarkData aDestMark;
aDestMark.SelectOneTable( nTab );
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index f8b89a85e11c..35af3ee2a2e3 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -79,6 +79,7 @@
#include "asciiopt.hxx"
#include "scabstdlg.hxx"
+#include "clipparam.hxx"
#include <vcl/msgbox.hxx>
#include <sfx2/viewfrm.hxx>
#include <svx/dbaexchange.hxx>
@@ -163,12 +164,12 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId,
if ( pSrcDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow ) )
pSrcDoc->GetCellArea( nSrcTab, nLastCol, nLastRow );
else
- {
+ {
nFirstCol = nLastCol = 0;
nFirstRow = nLastRow = 0;
- }
- pSrcDoc->CopyToClip( nFirstCol, nFirstRow, nLastCol, nLastRow,
- FALSE, pClipDoc, FALSE, &aSrcMark );
+ }
+ ScClipParam aClipParam(ScRange(nFirstCol, nFirstRow, 0, nLastCol, nLastRow, 0), false);
+ pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aSrcMark);
ScGlobal::SetClipDocName( xDocShRef->GetTitle( SFX_TITLE_FULLNAME ) );
SetCursor( nPosX, nPosY );