summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx25
-rw-r--r--sc/source/ui/app/inputhdl.cxx50
-rw-r--r--sc/source/ui/app/inputwin.cxx2
-rw-r--r--sc/source/ui/app/transobj.cxx2
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx18
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx4
-rw-r--r--sc/source/ui/dbgui/sortdlg.cxx41
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx21
-rw-r--r--sc/source/ui/docshell/docfunc.cxx390
-rw-r--r--sc/source/ui/docshell/docsh.cxx112
-rw-r--r--sc/source/ui/docshell/docsh3.cxx4
-rw-r--r--sc/source/ui/docshell/docsh4.cxx14
-rw-r--r--sc/source/ui/docshell/docsh5.cxx44
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx101
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx2
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx6
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx4
-rw-r--r--sc/source/ui/drawfunc/fupoor.cxx5
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx6
-rw-r--r--sc/source/ui/drawfunc/fusel2.cxx3
-rw-r--r--sc/source/ui/drawfunc/futext.cxx4
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx2
-rw-r--r--sc/source/ui/formdlg/formula.cxx7
-rw-r--r--sc/source/ui/inc/docfunc.hxx9
-rw-r--r--sc/source/ui/inc/docsh.hxx3
-rw-r--r--sc/source/ui/inc/formula.hxx1
-rw-r--r--sc/source/ui/inc/gridwin.hxx9
-rw-r--r--sc/source/ui/inc/printfun.hxx2
-rw-r--r--sc/source/ui/inc/protectiondlg.hrc47
-rw-r--r--sc/source/ui/inc/protectiondlg.hxx85
-rw-r--r--sc/source/ui/inc/retypepassdlg.hrc74
-rw-r--r--sc/source/ui/inc/retypepassdlg.hxx177
-rw-r--r--sc/source/ui/inc/scui_def.hxx2
-rw-r--r--sc/source/ui/inc/sortdlg.hrc8
-rw-r--r--sc/source/ui/inc/sortdlg.hxx18
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx3
-rw-r--r--sc/source/ui/inc/undoblk.hxx30
-rw-r--r--sc/source/ui/inc/undotab.hxx46
-rw-r--r--sc/source/ui/inc/viewfunc.hxx4
-rw-r--r--sc/source/ui/miscdlgs/makefile.mk16
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.cxx164
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.src130
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.cxx547
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.src316
-rw-r--r--sc/source/ui/src/filter.src64
-rw-r--r--sc/source/ui/src/globstr.src4
-rw-r--r--sc/source/ui/src/sortdlg.src44
-rw-r--r--sc/source/ui/undo/undoblk3.cxx105
-rw-r--r--sc/source/ui/undo/undocell.cxx11
-rw-r--r--sc/source/ui/undo/undotab.cxx303
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx47
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx16
-rw-r--r--sc/source/ui/unoobj/datauno.cxx158
-rw-r--r--sc/source/ui/unoobj/docuno.cxx35
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx3
-rw-r--r--sc/source/ui/unoobj/fmtuno.cxx145
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx6
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx2
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx53
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx5
-rw-r--r--sc/source/ui/unoobj/warnpassword.cxx1
-rw-r--r--sc/source/ui/vba/vbacontrol.cxx9
-rw-r--r--sc/source/ui/vba/vbarange.cxx52
-rw-r--r--sc/source/ui/view/cellsh1.cxx28
-rw-r--r--sc/source/ui/view/cellsh2.cxx358
-rw-r--r--sc/source/ui/view/cellsh3.cxx10
-rw-r--r--sc/source/ui/view/dbfunc3.cxx6
-rw-r--r--sc/source/ui/view/gridwin.cxx206
-rw-r--r--sc/source/ui/view/gridwin5.cxx4
-rw-r--r--sc/source/ui/view/output2.cxx6
-rw-r--r--sc/source/ui/view/preview.cxx4
-rw-r--r--sc/source/ui/view/printfun.cxx5
-rw-r--r--sc/source/ui/view/scextopt.cxx4
-rw-r--r--sc/source/ui/view/select.cxx23
-rw-r--r--sc/source/ui/view/tabview3.cxx46
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx218
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx4
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx5
-rw-r--r--sc/source/ui/view/tabvwshh.cxx21
-rw-r--r--sc/source/ui/view/viewfun2.cxx4
-rw-r--r--sc/source/ui/view/viewfun4.cxx128
-rw-r--r--sc/source/ui/view/viewfun6.cxx6
-rw-r--r--sc/source/ui/view/viewfunc.cxx183
83 files changed, 3799 insertions, 1091 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 616071be52d4..3ed9b4062a9d 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -563,31 +563,6 @@ uno::Reference< XAccessible > ScChildrenShapes::GetAt(const awt::Point& rPoint)
--i;
}
-/* Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
- if (pWindow)
- {
- Point aPnt( rPoint.X, rPoint.Y );
- aPnt = pWindow->PixelToLogic( aPnt );
- SdrPage* pDrawPage = GetDrawPage();
- if (pDrawPage)
- {
- SdrObject * pObj = GetDrawPage()->CheckHit(aPnt, 1, NULL, false);
- if (pObj)
- {
- uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
- SortedShapes::iterator aItr;;
- if (FindShape(xShape, aItr))
- {
- if ((*aItr) && (*aItr)->pAccShape)
- xAccessible = (*aItr)->pAccShape;
- else
- xAccessible = Get(aItr - maZOrderedShapes.begin());
- }
- else
- DBG_ERRORFILE("a shape is not in the list");
- }
- }
- }*/
}
return xAccessible;
}
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 3e069b6c9e59..46987c88636f 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -113,14 +113,22 @@ extern USHORT nEditAdjust; //! Member an ViewData
//==================================================================
+static sal_Unicode lcl_getSheetSeparator(ScDocument* pDoc)
+{
+ ScCompiler aComp(pDoc, ScAddress());
+ aComp.SetGrammar(pDoc->GetGrammar());
+ return aComp.GetNativeAddressSymbol(ScCompiler::Convention::SHEET_SEPARATOR);
+}
+
void ScInputHandler::InitRangeFinder( const String& rFormula )
{
DeleteRangeFinder();
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+ ScDocument* pDoc = pDocSh->GetDocument();
+ const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDoc);
if ( !pActiveViewSh || !SC_MOD()->GetInputOptions().GetRangeFinder() )
return;
- ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
// String aDelimiters = pEngine->GetWordDelimiters();
String aDelimiters = ScEditUtil::ModifyDelimiters(
@@ -129,7 +137,7 @@ void ScInputHandler::InitRangeFinder( const String& rFormula )
xub_StrLen nColon = aDelimiters.Search(':');
if ( nColon != STRING_NOTFOUND )
aDelimiters.Erase( nColon, 1 ); // Delimiter ohne Doppelpunkt
- xub_StrLen nDot = aDelimiters.Search('.');
+ xub_StrLen nDot = aDelimiters.Search(cSheetSep);
if ( nDot != STRING_NOTFOUND )
aDelimiters.Erase( nDot, 1 ); // Delimiter ohne Punkt
@@ -702,6 +710,9 @@ void ScInputHandler::ShowTipCursor()
HideTip();
HideTipBelow();
EditView* pActiveView = pTopView ? pTopView : pTableView;
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+ const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
+ const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
if ( bFormulaMode && pActiveView && pFormulaDataPara && pEngine->GetParagraphCount() == 1 )
{
@@ -730,7 +741,7 @@ void ScInputHandler::ShowTipCursor()
nLeftParentPos = lcl_MatchParenthesis( aSelText, aSelText.Len()-1 );
if( nLeftParentPos != STRING_NOTFOUND )
{
- sal_Unicode c = aSelText.GetChar( nLeftParentPos-1 );
+ sal_Unicode c = ( nLeftParentPos > 0 ) ? aSelText.GetChar( nLeftParentPos-1 ) : 0;
if( !((c >= 'A' && c<= 'Z') || (c>= 'a' && c<= 'z' )) )
continue;
nNextFStart = aHelper.GetFunctionStart( aSelText, nLeftParentPos, TRUE);
@@ -764,8 +775,8 @@ void ScInputHandler::ShowTipCursor()
}
if( bFlag )
{
- nCountSemicolon = aNew.GetTokenCount(';')-1;
- nCountDot = aNew.GetTokenCount('.')-1;
+ nCountSemicolon = aNew.GetTokenCount(cSep)-1;
+ nCountDot = aNew.GetTokenCount(cSheetSep)-1;
if( !nCountSemicolon )
{
@@ -787,7 +798,7 @@ void ScInputHandler::ShowTipCursor()
{
nStartPosition = i+1;
}
- else if( cNext == ';' )
+ else if( cNext == cSep )
{
nCount ++;
nEndPosition = i;
@@ -808,7 +819,7 @@ void ScInputHandler::ShowTipCursor()
{
nStartPosition = i+1;
}
- else if( cNext == ';' )
+ else if( cNext == cSep )
{
nCount ++;
nEndPosition = i;
@@ -818,7 +829,7 @@ void ScInputHandler::ShowTipCursor()
}
nStartPosition = nEndPosition+1;
}
- else if( cNext == '.' )
+ else if( cNext == cSheetSep )
{
continue;
}
@@ -919,6 +930,9 @@ void ScInputHandler::ShowTipBelow( const String& rText )
void ScInputHandler::UseFormulaData()
{
EditView* pActiveView = pTopView ? pTopView : pTableView;
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+ const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
+ const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
// Formeln duerfen nur 1 Absatz haben
if ( pActiveView && pFormulaData && pEngine->GetParagraphCount() == 1 )
@@ -969,7 +983,8 @@ void ScInputHandler::UseFormulaData()
if( nLeftParentPos == STRING_NOTFOUND )
break;
- sal_Unicode c = aFormula.GetChar( nLeftParentPos-1 );
+ // #160063# nLeftParentPos can be 0 if a parenthesis is inserted before the formula
+ sal_Unicode c = ( nLeftParentPos > 0 ) ? aFormula.GetChar( nLeftParentPos-1 ) : 0;
if( !((c >= 'A' && c<= 'Z') || (c>= 'a' && c<= 'z') ) )
continue;
nNextFStart = aHelper.GetFunctionStart( aFormula, nLeftParentPos, TRUE);
@@ -1003,8 +1018,8 @@ void ScInputHandler::UseFormulaData()
}
if( bFlag )
{
- nCountSemicolon = aNew.GetTokenCount(';')-1;
- nCountDot = aNew.GetTokenCount('.')-1;
+ nCountSemicolon = aNew.GetTokenCount(cSep)-1;
+ nCountDot = aNew.GetTokenCount(cSheetSep)-1;
if( !nCountSemicolon )
{
@@ -1026,7 +1041,7 @@ void ScInputHandler::UseFormulaData()
{
nStartPosition = i+1;
}
- else if( cNext == ';' )
+ else if( cNext == cSep )
{
nCount ++;
nEndPosition = i;
@@ -1047,7 +1062,7 @@ void ScInputHandler::UseFormulaData()
{
nStartPosition = i+1;
}
- else if( cNext == ';' )
+ else if( cNext == cSep )
{
nCount ++;
nEndPosition = i;
@@ -1057,7 +1072,7 @@ void ScInputHandler::UseFormulaData()
}
nStartPosition = nEndPosition+1;
}
- else if( cNext == '.' )
+ else if( cNext == cSheetSep )
{
continue;
}
@@ -2740,6 +2755,7 @@ BOOL ScInputHandler::IsModalMode( SfxObjectShell* pDocSh )
void ScInputHandler::AddRefEntry()
{
+ const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
UpdateActiveView();
if (!pTableView && !pTopView)
return; // z.B. FillMode
@@ -2748,9 +2764,9 @@ void ScInputHandler::AddRefEntry()
RemoveSelection();
if (pTableView)
- pTableView->InsertText( ';', FALSE );
+ pTableView->InsertText( cSep, FALSE );
if (pTopView)
- pTopView->InsertText( ';', FALSE );
+ pTopView->InsertText( cSep, FALSE );
DataChanged();
}
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 8fd3c1f8ac0b..5a3fd605b08f 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1699,7 +1699,7 @@ void ScPosWnd::DoEnter()
ScRangeName aNewRanges( *pNames );
ScAddress aCursor( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() );
String aContent;
- aSelection.Format( aContent, SCR_ABS_3D, pDoc );
+ aSelection.Format( aContent, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
ScRangeData* pNew = new ScRangeData( pDoc, aText, aContent, aCursor );
if ( aNewRanges.Insert(pNew) )
{
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 076cd3581d26..94a2cdfc3324 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -658,7 +658,7 @@ void ScTransferObj::InitDocShell()
// page format (grid etc) and page size (maximum size for ole object)
- Size aPaperSize = SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 ); // Twips
+ Size aPaperSize = SvxPaperInfo::GetPaperSize( PAPER_A4 ); // Twips
ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
String aStyleName = pDoc->GetPageStyle( aBlock.aStart.Tab() );
SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SFX_STYLE_FAMILY_PAGE );
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 84d274580aa0..60b101d482c0 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -714,6 +714,24 @@ VclAbstractDialog * ScAbstractDialogFactory_Impl::CreateScColOrRowDlg(Window*
}
//add for ScColOrRowDlg end
+//add for ScSortWarningDlg begin
+VclAbstractDialog * ScAbstractDialogFactory_Impl::CreateScSortWarningDlg( Window* pParent, const String& rExtendText,
+ const String& rCurrentText, int nId )
+{
+ Dialog * pDlg=NULL;
+ switch ( nId )
+ {
+ case RID_SCDLG_SORT_WARNING:
+ pDlg = new ScSortWarningDlg( pParent, rExtendText, rCurrentText );
+ break;
+ default:
+ break;
+ }
+ if( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+//add for ScSortWarningDlg end
//add for ScDataPilotDatabaseDlg begin
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 2bec64c31e13..40f6d3bee976 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -63,6 +63,7 @@ class ScShowTabDlg;
class ScStringInputDlg;
class ScImportOptionsDlg;
class SfxTabDialog;
+class ScSortWarningDlg;
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
DialogClass* pDlg; \
@@ -398,6 +399,9 @@ public:
const String& rStrLabel,
int nId,
BOOL bColDefault = TRUE );
+
+ virtual VclAbstractDialog * CreateScSortWarningDlg( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId );
+
virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ); //add for ScDataPilotDatabaseDlg
virtual AbstractScDataPilotSourceTypeDlg * CreateScDataPilotSourceTypeDlg ( Window* pParent, BOOL bEnableExternal, int nId ) ; //add for ScDataPilotSourceTypeDlg
diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
index 00931de58924..7d1462f62f27 100644
--- a/sc/source/ui/dbgui/sortdlg.cxx
+++ b/sc/source/ui/dbgui/sortdlg.cxx
@@ -34,7 +34,7 @@
#undef SC_DLLIMPLEMENTATION
-
+#include <vcl/msgbox.hxx>
#include "tpsort.hxx"
#include "sortdlg.hxx"
#include "scresid.hxx"
@@ -69,3 +69,42 @@ __EXPORT ScSortDlg::~ScSortDlg()
{
}
+//==================================================================
+ScSortWarningDlg::ScSortWarningDlg( Window* pParent,
+ const String& rExtendText,
+ const String& rCurrentText ):
+ ModalDialog ( pParent, ScResId( RID_SCDLG_SORT_WARNING ) ),
+ aFtText ( this, ScResId( FT_TEXT ) ),
+ aFtTip ( this, ScResId( FT_TIP ) ),
+ aBtnExtSort ( this, ScResId( BTN_EXTSORT ) ),
+ aBtnCurSort ( this, ScResId( BTN_CURSORT ) ),
+ aBtnCancel ( this, ScResId( BTN_CANCEL ) )
+{
+ String sTextName = aFtText.GetText();
+ sTextName.SearchAndReplaceAscii("%1", rExtendText);
+ sTextName.SearchAndReplaceAscii("%2", rCurrentText);
+ aFtText.SetText( sTextName );
+
+ aBtnExtSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+ aBtnCurSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+
+ FreeResource();
+}
+
+ScSortWarningDlg::~ScSortWarningDlg()
+{
+}
+
+IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn )
+{
+ if ( pBtn == &aBtnExtSort )
+ {
+ EndDialog( BTN_EXTEND_RANGE );
+ }
+ else if( pBtn == &aBtnCurSort )
+ {
+ EndDialog( BTN_CURRENT_SELECTION );
+ }
+ return 0;
+}
+//========================================================================//
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 1e85f3c01f3e..33caccaed815 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -58,6 +58,7 @@
#include "editable.hxx"
#include "attrib.hxx"
#include "drwlayer.hxx"
+#include "dpshttab.hxx"
// -----------------------------------------------------------------
@@ -1299,6 +1300,22 @@ BOOL ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
BOOL bOverflow = FALSE;
ScRange aNewOut = pDestObj->GetNewOutputRange( bOverflow );
+
+ //! test for overlap with other data pilot tables
+ if( pOldObj )
+ {
+ const ScSheetSourceDesc* pSheetDesc = pOldObj->GetSheetDesc();
+ if( pSheetDesc && pSheetDesc->aSourceRange.Intersects( aNewOut ) )
+ {
+ ScRange aOldRange = pOldObj->GetOutRange();
+ SCsROW nDiff = aOldRange.aStart.Row()-aNewOut.aStart.Row();
+ aNewOut.aStart.SetRow( aOldRange.aStart.Row() );
+ aNewOut.aEnd.SetRow( aNewOut.aEnd.Row()+nDiff );
+ if( !ValidRow( aNewOut.aStart.Row() ) || !ValidRow( aNewOut.aEnd.Row() ) )
+ bOverflow = TRUE;
+ }
+ }
+
if ( bOverflow )
{
// like with STR_PROTECTIONERR, use undo to reverse everything
@@ -1354,9 +1371,7 @@ BOOL ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
pDoc->CopyToDocument( aNewOut, IDF_ALL, FALSE, pNewUndoDoc );
}
- //! test for overlap with other data pilot tables
-
- pDestObj->Output();
+ pDestObj->Output( aNewOut.aStart );
rDocShell.PostPaintGridAll(); //! only necessary parts
bDone = TRUE;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 0383d6758767..ebb080a89cfa 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -93,7 +93,12 @@
#include "editable.hxx"
#include "compiler.hxx"
#include "scui_def.hxx" //CHINA001
+#include "tabprotection.hxx"
+
+#include <memory>
+
using namespace com::sun::star;
+using ::com::sun::star::uno::Sequence;
// STATIC DATA -----------------------------------------------------------
@@ -955,16 +960,18 @@ BOOL ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
}
-ScTokenArray* lcl_ScDocFunc_CreateTokenArrayXML( const String& rText )
+ScTokenArray* lcl_ScDocFunc_CreateTokenArrayXML( const String& rText, const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScTokenArray* pCode = new ScTokenArray;
pCode->AddString( rText );
+ if( (eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) && (rFormulaNmsp.Len() > 0) )
+ pCode->AddString( rFormulaNmsp );
return pCode;
}
ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
- const String& rText, const formula::FormulaGrammar::Grammar eGrammar )
+ const String& rText, const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScDocument* pDoc = rDocShell.GetDocument();
ScBaseCell* pNewCell = NULL;
@@ -974,7 +981,7 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
ScTokenArray* pCode;
if ( pDoc->IsImportingXML() )
{ // temporary formula string as string tokens
- pCode = lcl_ScDocFunc_CreateTokenArrayXML( rText );
+ pCode = lcl_ScDocFunc_CreateTokenArrayXML( rText, rFormulaNmsp, eGrammar );
pDoc->IncXMLImportedFormulaCount( rText.Len() );
}
else
@@ -1011,8 +1018,8 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
BOOL ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText,
- BOOL bInterpret, BOOL bEnglish, BOOL bApi,
- const formula::FormulaGrammar::Grammar eGrammar )
+ BOOL bInterpret, BOOL bEnglish, BOOL bApi,
+ const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
// SetCellText ruft PutCell oder SetNormalString
@@ -1025,12 +1032,15 @@ BOOL ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText,
// code moved to own method InterpretEnglishString because it is also used in
// ScCellRangeObj::setFormulaArray
- pNewCell = InterpretEnglishString( rPos, rText, eGrammar );
+ pNewCell = InterpretEnglishString( rPos, rText, rFormulaNmsp, eGrammar );
}
// sonst Null behalten -> SetString mit lokalen Formeln/Zahlformat
}
else if ( rText.Len() )
+ {
+ OSL_ENSURE( rFormulaNmsp.Len() == 0, "ScDocFunc::SetCellText - formula namespace, but do not interpret?" );
pNewCell = ScBaseCell::CreateTextCell( rText, pDoc ); // immer Text
+ }
if (pNewCell)
return PutCell( rPos, pNewCell, bApi );
@@ -1047,7 +1057,7 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
if( !pNote || (bShow == pNote->IsCaptionShown()) ) return false;
// move the caption to internal or hidden layer and create undo action
- pNote->ShowCaption( bShow );
+ pNote->ShowCaption( rPos, bShow );
if( rDoc.IsUndoEnabled() )
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideNote( rDocShell, rPos, bShow ) );
@@ -1075,7 +1085,7 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bA
aNewText.ConvertLineEnd(); //! ist das noetig ???
if( ScPostIt* pNote = (aNewText.Len() > 0) ? pDoc->GetOrCreateNote( rPos ) : pDoc->GetNote( rPos ) )
- pNote->SetText( aNewText );
+ pNote->SetText( rPos, aNewText );
//! Undo !!!
@@ -1099,23 +1109,26 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
SfxUndoManager* pUndoMgr = (pDrawLayer && rDoc.IsUndoEnabled()) ? rDocShell.GetUndoManager() : 0;
- // collect drawing undo actions for deleting/inserting caption obejcts
- if( pUndoMgr )
- pDrawLayer->BeginCalcUndo();
-
- // delete old note
ScNoteData aOldData;
- if( ScPostIt* pOldNote = rDoc.ReleaseNote( rPos ) )
+ ScPostIt* pOldNote = rDoc.ReleaseNote( rPos );
+ if( pOldNote )
{
+ // ensure existing caption object before draw undo tracking starts
+ pOldNote->GetOrCreateCaption( rPos );
// rescue note data for undo
aOldData = pOldNote->GetNoteData();
- // delete the note (creates drawing undo action for the caption object)
- delete pOldNote;
}
+ // collect drawing undo actions for deleting/inserting caption obejcts
+ if( pUndoMgr )
+ pDrawLayer->BeginCalcUndo();
+
+ // delete the note (creates drawing undo action for the caption object)
+ delete pOldNote;
+
// create new note (creates drawing undo action for the new caption object)
ScNoteData aNewData;
- if( ScPostIt* pNewNote = ScNoteUtil::CreateNoteFromString( rDoc, rPos, rNoteText, false ) )
+ if( ScPostIt* pNewNote = ScNoteUtil::CreateNoteFromString( rDoc, rPos, rNoteText, false, true ) )
{
if( pAuthor ) pNewNote->SetAuthor( *pAuthor );
if( pDate ) pNewNote->SetDate( *pDate );
@@ -1340,6 +1353,14 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
}
+ ScMarkData aFullMark( aMark ); // including scenario sheets
+ for( i=0; i<nTabCount; i++ )
+ if( aMark.GetTableSelect( i ) )
+ {
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ aFullMark.SelectTable( j, TRUE );
+ }
+
SCTAB nSelCount = aMark.GetSelectCount();
// zugehoerige Szenarien auch anpassen
@@ -1430,8 +1451,8 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
- if(( eCmd == INS_CELLSDOWN && ( nMergeStartX != nMergeTestStartX || nMergeEndX != nMergeTestEndX ))||
- eCmd == INS_CELLSRIGHT && ( nMergeStartY != nMergeTestStartY || nMergeEndY != nMergeTestEndY ) )
+ if(( eCmd == INS_CELLSDOWN && ( nMergeStartX != nMergeTestStartX || nMergeEndX != nMergeTestEndX )) ||
+ (eCmd == INS_CELLSRIGHT && ( nMergeStartY != nMergeTestStartY || nMergeEndY != nMergeTestEndY )) )
{
if (!bApi)
rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
@@ -1543,66 +1564,22 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
switch (eCmd)
{
case INS_CELLSDOWN:
- bSuccess = TRUE;
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- bSuccess &= pDoc->InsertRow( nStartCol, i, nEndCol, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
- }
- }
+ bSuccess = pDoc->InsertRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
nPaintEndY = MAXROW;
break;
case INS_INSROWS:
- bSuccess = TRUE;
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- bSuccess &= pDoc->InsertRow( 0, i, MAXCOL, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
- }
- }
+ bSuccess = pDoc->InsertRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
nPaintStartX = 0;
nPaintEndX = MAXCOL;
nPaintEndY = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case INS_CELLSRIGHT:
- bSuccess = TRUE;
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- bSuccess &= pDoc->InsertCol( nStartRow, i, nEndRow, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
- }
- }
+ bSuccess = pDoc->InsertCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
nPaintEndX = MAXCOL;
break;
case INS_INSCOLS:
- bSuccess = TRUE;
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- bSuccess &= pDoc->InsertCol( 0, i, MAXROW, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
- }
- }
+ bSuccess = pDoc->InsertCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
nPaintStartY = 0;
nPaintEndY = MAXROW;
nPaintEndX = MAXCOL;
@@ -1795,6 +1772,14 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
}
+ ScMarkData aFullMark( aMark ); // including scenario sheets
+ for( i=0; i<nTabCount; i++ )
+ if( aMark.GetTableSelect( i ) )
+ {
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ aFullMark.SelectTable( j, TRUE );
+ }
+
SCTAB nSelCount = aMark.GetSelectCount();
SCCOL nUndoStartX = nStartCol;
@@ -2035,66 +2020,22 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
switch (eCmd)
{
case DEL_CELLSUP:
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
-
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- pDoc->DeleteRow( nStartCol, i, nEndCol, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
- }
- }
+ pDoc->DeleteRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, NULL, &aFullMark );
nPaintEndY = MAXROW;
break;
case DEL_DELROWS:
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
-
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- pDoc->DeleteRow( 0, i, MAXCOL, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline );
- }
- }
+ pDoc->DeleteRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
nPaintStartX = 0;
nPaintEndX = MAXCOL;
nPaintEndY = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case DEL_CELLSLEFT:
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
-
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- pDoc->DeleteCol( nStartRow, i, nEndRow, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
- }
- }
+ pDoc->DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, NULL, &aFullMark );
nPaintEndX = MAXCOL;
break;
case DEL_DELCOLS:
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
-
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- pDoc->DeleteCol( 0, i, MAXROW, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline );
- }
- }
+ pDoc->DeleteCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
nPaintStartY = 0;
nPaintEndY = MAXROW;
nPaintEndX = MAXCOL;
@@ -2109,8 +2050,9 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord )
{
- for ( i=nStartTab; i<=nTabCount; i++)
- pRefUndoDoc->DeleteAreaTab(nUndoStartX,nUndoStartY,nUndoEndX,nUndoEndY, i, IDF_ALL);
+ for( i=0; i<nTabCount; i++ )
+ if( aFullMark.GetTableSelect( i ) )
+ pRefUndoDoc->DeleteAreaTab(nUndoStartX,nUndoStartY,nUndoEndX,nUndoEndY, i, IDF_ALL);
// alle Tabellen anlegen, damit Formeln kopiert werden koennen:
pUndoDoc->AddUndoTab( 0, nTabCount-1, FALSE, FALSE );
@@ -2136,6 +2078,12 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nUndoPos ++;
}
}
+
+ if( !bDeletingMerge )
+ {
+ rDocShell.GetUndoManager()->LeaveListAction();
+ }
+
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDeleteCells(
&rDocShell, ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ),nUndoPos, pTabs, pScenarios,
eCmd, pUndoDoc, pUndoData ) );
@@ -2492,9 +2440,13 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
/* Paste cell notes and drawing objects after adjusting formula references
and row heights. There are no cell notes or drawing objects, if the
- clipdoc does not contain a drawing layer. */
+ clipdoc does not contain a drawing layer.
+ #i102056# Passing IDF_NOTE only would overwrite cell contents with
+ empty note cells, therefore the special modifier IDF_ADDNOTES is passed
+ here too which changes the behaviour of ScColumn::CopyFromClip() to not
+ touch existing cells. */
if ( pClipDoc->GetDrawLayer() )
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_NOTE | IDF_OBJECTS,
+ pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_NOTE | IDF_ADDNOTES | IDF_OBJECTS,
pRefUndoDoc, pClipDoc, TRUE, FALSE, bIncludeFiltered );
if (bRecord)
@@ -3193,103 +3145,156 @@ BOOL ScDocFunc::RemovePageBreak( BOOL bColumn, const ScAddress& rPos,
//------------------------------------------------------------------------
-BOOL lcl_ValidPassword( ScDocument* pDoc, SCTAB nTab,
- const String& rPassword,
- uno::Sequence<sal_Int8>* pReturnOld = NULL )
+void ScDocFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
{
- uno::Sequence<sal_Int8> aOldPassword;
- if ( nTab == TABLEID_DOC )
- {
- if (pDoc->IsDocProtected())
- aOldPassword = pDoc->GetDocPassword();
- }
- else
+ ScDocument* pDoc = rDocShell.GetDocument();
+
+ pDoc->SetTabProtection(nTab, &rProtect);
+ if (pDoc->IsUndoEnabled())
{
- if (pDoc->IsTabProtected(nTab))
- aOldPassword = pDoc->GetTabPassword(nTab);
- }
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
+ if (pProtect)
+ {
+ ::std::auto_ptr<ScTableProtection> p(new ScTableProtection(*pProtect));
+ p->setProtected(true); // just in case ...
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoTabProtect(&rDocShell, nTab, p) );
- if (pReturnOld)
- *pReturnOld = aOldPassword;
+ // ownership of auto_ptr now transferred to ScUndoTabProtect.
+ }
+ }
- return ((aOldPassword.getLength() == 0) || SvPasswordHelper::CompareHashPassword(aOldPassword, rPassword));
+ rDocShell.PostPaintGridAll();
+ ScDocShellModificator aModificator(rDocShell);
+ aModificator.SetDocumentModified();
}
-BOOL ScDocFunc::Protect( SCTAB nTab, const String& rPassword, BOOL bApi )
+BOOL ScDocFunc::Protect( SCTAB nTab, const String& rPassword, BOOL /*bApi*/ )
{
- ScDocShellModificator aModificator( rDocShell );
-
ScDocument* pDoc = rDocShell.GetDocument();
- BOOL bUndo(pDoc->IsUndoEnabled());
- BOOL bOk = lcl_ValidPassword( pDoc, nTab, rPassword);
- if ( bOk )
- {
- uno::Sequence<sal_Int8> aPass;
- if (rPassword.Len())
- SvPasswordHelper::GetHashPassword(aPass, rPassword);
-
- if (bUndo)
+ if (nTab == TABLEID_DOC)
+ {
+ // document protection
+ ScDocProtection aProtection;
+ aProtection.setProtected(true);
+ aProtection.setPassword(rPassword);
+ pDoc->SetDocProtection(&aProtection);
+ if (pDoc->IsUndoEnabled())
{
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoProtect( &rDocShell, nTab, TRUE, aPass ) );
+ ScDocProtection* pProtect = pDoc->GetDocProtection();
+ DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScDocProtection pointer is NULL!");
+ if (pProtect)
+ {
+ ::std::auto_ptr<ScDocProtection> p(new ScDocProtection(*pProtect));
+ p->setProtected(true); // just in case ...
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoDocProtect(&rDocShell, p) );
+ // ownership of auto_ptr is transferred to ScUndoDocProtect.
+ }
}
-
- if ( nTab == TABLEID_DOC )
- pDoc->SetDocProtection( TRUE, aPass );
- else
- pDoc->SetTabProtection( nTab, TRUE, aPass );
-
- rDocShell.PostPaintGridAll();
- aModificator.SetDocumentModified();
}
- else if (!bApi)
+ else
{
- // different password was set before
+ // sheet protection
-//! rDocShell.ErrorMessage(...);
-
- InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
- aBox.Execute();
+ ScTableProtection aProtection;
+ aProtection.setProtected(true);
+ aProtection.setPassword(rPassword);
+ pDoc->SetTabProtection(nTab, &aProtection);
+ if (pDoc->IsUndoEnabled())
+ {
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
+ if (pProtect)
+ {
+ ::std::auto_ptr<ScTableProtection> p(new ScTableProtection(*pProtect));
+ p->setProtected(true); // just in case ...
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoTabProtect(&rDocShell, nTab, p) );
+ // ownership of auto_ptr now transferred to ScUndoTabProtect.
+ }
+ }
}
- return bOk;
+ rDocShell.PostPaintGridAll();
+ ScDocShellModificator aModificator( rDocShell );
+ aModificator.SetDocumentModified();
+
+ return true;
}
BOOL ScDocFunc::Unprotect( SCTAB nTab, const String& rPassword, BOOL bApi )
{
- ScDocShellModificator aModificator( rDocShell );
-
ScDocument* pDoc = rDocShell.GetDocument();
- BOOL bUndo(pDoc->IsUndoEnabled());
- uno::Sequence<sal_Int8> aOldPassword;
- uno::Sequence<sal_Int8> aPass;
- BOOL bOk = lcl_ValidPassword( pDoc, nTab, rPassword, &aOldPassword );
- if ( bOk )
- {
- uno::Sequence<sal_Int8> aEmptyPass;
- if ( nTab == TABLEID_DOC )
- pDoc->SetDocProtection( FALSE, aEmptyPass );
- else
- pDoc->SetTabProtection( nTab, FALSE, aEmptyPass );
- if (bUndo)
+ if (nTab == TABLEID_DOC)
+ {
+ // document protection
+
+ ScDocProtection* pDocProtect = pDoc->GetDocProtection();
+ if (!pDocProtect || !pDocProtect->isProtected())
+ // already unprotected (should not happen)!
+ return true;
+
+ // save the protection state before unprotect (for undo).
+ ::std::auto_ptr<ScDocProtection> pProtectCopy(new ScDocProtection(*pDocProtect));
+
+ if (!pDocProtect->verifyPassword(rPassword))
{
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoProtect( &rDocShell, nTab, FALSE, aOldPassword ) );
+ if (!bApi)
+ {
+ InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
+ aBox.Execute();
+ }
+ return false;
}
- rDocShell.PostPaintGridAll();
- aModificator.SetDocumentModified();
+ pDoc->SetDocProtection(NULL);
+ if (pDoc->IsUndoEnabled())
+ {
+ pProtectCopy->setProtected(false);
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoDocProtect(&rDocShell, pProtectCopy) );
+ // ownership of auto_ptr now transferred to ScUndoDocProtect.
+ }
}
- else if (!bApi)
+ else
{
-//! rDocShell.ErrorMessage(...);
+ // sheet protection
+
+ ScTableProtection* pTabProtect = pDoc->GetTabProtection(nTab);
+ if (!pTabProtect || !pTabProtect->isProtected())
+ // already unprotected (should not happen)!
+ return true;
+
+ // save the protection state before unprotect (for undo).
+ ::std::auto_ptr<ScTableProtection> pProtectCopy(new ScTableProtection(*pTabProtect));
+ if (!pTabProtect->verifyPassword(rPassword))
+ {
+ if (!bApi)
+ {
+ InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
+ aBox.Execute();
+ }
+ return false;
+ }
- InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
- aBox.Execute();
+ pDoc->SetTabProtection(nTab, NULL);
+ if (pDoc->IsUndoEnabled())
+ {
+ pProtectCopy->setProtected(false);
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoTabProtect(&rDocShell, nTab, pProtectCopy) );
+ // ownership of auto_ptr now transferred to ScUndoTabProtect.
+ }
}
- return bOk;
+ rDocShell.PostPaintGridAll();
+ ScDocShellModificator aModificator( rDocShell );
+ aModificator.SetDocumentModified();
+
+ return true;
}
//------------------------------------------------------------------------
@@ -3516,9 +3521,8 @@ BOOL ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
//------------------------------------------------------------------------
BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
- const ScTokenArray* pTokenArray,
- const String& rString, BOOL bApi, BOOL bEnglish,
- const formula::FormulaGrammar::Grammar eGrammar )
+ const ScTokenArray* pTokenArray, const String& rString, BOOL bApi, BOOL bEnglish,
+ const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScDocShellModificator aModificator( rDocShell );
@@ -3565,7 +3569,7 @@ BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
}
else if ( pDoc->IsImportingXML() )
{
- ScTokenArray* pCode = lcl_ScDocFunc_CreateTokenArrayXML( rString );
+ ScTokenArray* pCode = lcl_ScDocFunc_CreateTokenArrayXML( rString, rFormulaNmsp, eGrammar );
pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_STRING, pCode, eGrammar);
delete pCode;
@@ -4495,11 +4499,11 @@ BOOL ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd
if ( DeleteContents( aMark, IDF_CONTENTS, TRUE, bApi ) )
{
// GRAM_PODF_A1 for API compatibility.
- bRet = EnterMatrix( aNewRange, &aMark, NULL, aFormula, bApi, FALSE,formula::FormulaGrammar::GRAM_PODF_A1 );
+ bRet = EnterMatrix( aNewRange, &aMark, NULL, aFormula, bApi, FALSE, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
if (!bRet)
{
// versuchen, alten Zustand wiederherzustellen
- EnterMatrix( rOldRange, &aMark, NULL, aFormula, bApi, FALSE,formula::FormulaGrammar::GRAM_PODF_A1 );
+ EnterMatrix( rOldRange, &aMark, NULL, aFormula, bApi, FALSE, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
}
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index e360e93bae5d..c62c2dc41fdf 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -79,11 +79,6 @@
#include <sot/formats.hxx>
#define SOT_FORMATSTR_ID_STARCALC_30 SOT_FORMATSTR_ID_STARCALC
-//REMOVE #ifndef SO2_DECL_SVSTORAGESTREAM_DEFINED
-//REMOVE #define SO2_DECL_SVSTORAGESTREAM_DEFINED
-//REMOVE SO2_DECL_REF(SotStorageStream)
-//REMOVE #endif
-
// INCLUDE ---------------------------------------------------------------
#include "cell.hxx"
@@ -97,7 +92,6 @@
#include "scresid.hxx"
#include "sc.hrc"
#include "globstr.hrc"
-//CHINA001 #include "tpstat.hxx"
#include "scerrors.hxx"
#include "brdcst.hxx"
#include "stlpool.hxx"
@@ -126,6 +120,7 @@
#include "cfgids.hxx"
#include "warnpassword.hxx"
#include "optsolver.hxx"
+#include "tabprotection.hxx"
#include "docsh.hxx"
#include "docshimp.hxx"
@@ -406,7 +401,7 @@ BOOL ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::R
bRet = aImport.Import(sal_True, nError);
if ( nError )
- pLoadMedium->SetError( nError );
+ pLoadMedium->SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
aDocument.SetXMLFromWrapper( FALSE );
AfterXMLLoading(bRet);
@@ -467,10 +462,10 @@ BOOL __EXPORT ScDocShell::Load( SfxMedium& rMedium )
}
if (!bRet && !rMedium.GetError())
- rMedium.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ rMedium.SetError( SVSTREAM_FILEFORMAT_ERROR, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if (rMedium.GetError())
- SetError( rMedium.GetError() );
+ SetError( rMedium.GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
InitItems();
CalcOutputFactor();
@@ -751,7 +746,7 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
if ( !bSuccess )
- SetError( ERRCODE_IO_ABORT ); // this error code will produce no error message, but will break the further saving process
+ SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // this error code will produce no error message, but will break the further saving process
}
}
break;
@@ -853,7 +848,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else
bRet = TRUE;
@@ -884,7 +879,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
@@ -923,13 +918,13 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError == SCWARN_IMPORT_RANGE_OVERFLOW)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
bRet = TRUE;
}
else if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else
bRet = TRUE;
@@ -989,12 +984,12 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else if ( bOverflow )
{
if (!GetError())
- SetError(SCWARN_IMPORT_RANGE_OVERFLOW);
+ SetError(SCWARN_IMPORT_RANGE_OVERFLOW, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
bSetColWidths = TRUE;
bSetSimpleTextColWidths = TRUE;
@@ -1024,7 +1019,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
bRet = ( eError == SCWARN_IMPORT_RANGE_OVERFLOW );
}
else
@@ -1068,7 +1063,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
@@ -1103,7 +1098,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
if ( eError != eERR_OK && !GetError() )
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
bSetColWidths = TRUE;
bSetSimpleTextColWidths = TRUE;
bSetRowHeights = TRUE;
@@ -1116,7 +1111,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError( eError );
+ SetError( eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
}
@@ -1142,7 +1137,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
@@ -1161,7 +1156,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
if ( eError != eERR_OK && !GetError() )
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else if (aFltName.EqualsAscii(pFilterHtml) || aFltName.EqualsAscii(pFilterHtmlWebQ))
{
@@ -1181,7 +1176,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
@@ -1198,12 +1193,12 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
if ( eError != eERR_OK && !GetError() )
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else
{
if (!GetError())
- SetError(SCERR_IMPORT_NI);
+ SetError(SCERR_IMPORT_NI, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
if (!bCalc3)
@@ -1327,6 +1322,16 @@ BOOL __EXPORT ScDocShell::SaveAs( SfxMedium& rMedium )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::SaveAs" );
+#if ENABLE_SHEET_PROTECTION
+ ScTabViewShell* pViewShell = GetBestViewShell();
+ if (pViewShell && ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_OOO))
+ {
+ if (!pViewShell->ExecuteRetypePassDlg(PASSHASH_OOO))
+ // password re-type cancelled. Don't save the document.
+ return false;
+ }
+#endif
+
ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
PrepareSaveGuard aPrepareGuard( *this);
@@ -1792,7 +1797,6 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
rStream.SetNumberFormatInt( nOldNumberFormatInt );
}
-
BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertTo" );
@@ -1846,15 +1850,39 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
- /* #115980 #If the imported document contained an encrypted password -
- determine if we should save without it. */
- ScExtDocSettings& rDocSett = pExtDocOpt->GetDocSettings();
- if( rDocSett.mbEncrypted )
+#if ENABLE_SHEET_PROTECTION
+ bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_XL);
+ if (bNeedRetypePassDlg && !pViewShell->ExecuteRetypePassDlg(PASSHASH_XL))
+ {
+ 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 );
- // #i42858# warn only on time
- rDocSett.mbEncrypted = false;
+
+ if (bDoSave)
+ {
+ // #i42858# warn only one time
+ pSet->ClearItem(SID_PASSWORD);
+ }
}
+ while (false);
+
+#endif
}
if( bDoSave )
@@ -1867,7 +1895,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
FltError eError = ScFormatFilter::Get().ScExportExcel5( rMed, &aDocument, eFormat, RTL_TEXTENCODING_MS_1252 );
if( eError && !GetError() )
- SetError( eError );
+ SetError( eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
// don't return false for warnings
bRet = ((eError & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK) || (eError == eERR_OK);
@@ -1875,7 +1903,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
else
{
// export aborted, i.e. "Save without password" warning
- SetError( ERRCODE_ABORT );
+ SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
else if (aFltName.EqualsAscii(pFilterAscii))
@@ -1908,7 +1936,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
if (aDocument.GetTableCount() > 1)
if (!rMed.GetError())
- rMed.SetError(SCWARN_EXPORT_ASCII);
+ rMed.SetError(SCWARN_EXPORT_ASCII, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
}
else if (aFltName.EqualsAscii(pFilterDBase))
@@ -1941,11 +1969,11 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
if ( eError != eERR_OK && (eError & ERRCODE_WARNING_MASK) )
{
//! if ( !rMed.GetError() )
-//! rMed.SetError( eError );
+//! rMed.SetError( eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
eError = eERR_OK;
}
//! else if ( aDocument.GetTableCount() > 1 && !rMed.GetError() )
-//! rMed.SetError( SCWARN_EXPORT_ASCII );
+//! rMed.SetError( SCWARN_EXPORT_ASCII, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
INetURLObject aTmpFile( rMed.GetPhysicalName(), INET_PROT_FILE );
if ( bHasMemo )
@@ -1953,7 +1981,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
if ( eError != eERR_OK )
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if ( bHasMemo && IsDocument( aTmpFile ) )
KillFile( aTmpFile );
}
@@ -1974,7 +2002,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
{
KillFile( aTmpFile );
if ( !GetError() )
- SetError( SCERR_EXPORT_DATA );
+ SetError( SCERR_EXPORT_DATA, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
}
@@ -2008,7 +2036,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
if (aDocument.GetTableCount() > 1)
if (!rMed.GetError())
- rMed.SetError(SCWARN_EXPORT_ASCII);
+ rMed.SetError(SCWARN_EXPORT_ASCII, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
}
else if (aFltName.EqualsAscii(pFilterSylk))
@@ -2041,13 +2069,13 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
SetError( *new StringErrorInfo(
SCWARN_EXPORT_NONCONVERTIBLE_CHARS,
aImExport.GetNonConvertibleChars(),
- ERRCODE_BUTTON_OK | ERRCODE_MSG_INFO ) );
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_INFO ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
else
{
if (GetError())
- SetError(SCERR_IMPORT_NI);
+ SetError(SCERR_IMPORT_NI, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
return bRet;
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index fcdfa8612a02..fcbfb648ae14 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1051,8 +1051,8 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
aValue.Erase( 0, 1 );
aValue.Erase( aValue.Len()-1, 1 );
GetDocFunc().EnterMatrix( aSourceRange,
- NULL, NULL, aValue, FALSE, FALSE,
- formula::FormulaGrammar::GRAM_DEFAULT );
+ NULL, NULL, aValue, FALSE, FALSE,
+ EMPTY_STRING, formula::FormulaGrammar::GRAM_DEFAULT );
}
break;
case MM_REFERENCE : // do nothing
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index f73389cb866f..d4df2863eec5 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1842,6 +1842,10 @@ void lcl_GetPrintData( ScDocShell* pDocShell /*in*/,
rOptions = SC_MOD()->GetPrintOptions();
}
+ // update all pending row heights with a single progress bar,
+ // instead of a separate progress for each sheet from ScPrintFunc
+ pDocShell->UpdatePendingRowHeights( MAXTAB, true );
+
// get number of total pages
rnTotalPages = 0;
SCTAB nTabCount = pDocument->GetTableCount();
@@ -2501,10 +2505,14 @@ long __EXPORT ScDocShell::DdeSetData( const String& rItem,
pData->GetSymbol( aPos ); // continue with the name's contents
}
}
+
+ // Address in DDE function must be always parsed as CONV_OOO so that it
+ // would always work regardless of current address convension. We do this
+ // because the address item in a DDE entry is *not* normalized when saved
+ // into ODF.
ScRange aRange;
- formula::FormulaGrammar::AddressConvention eConv = aDocument.GetAddressConvention();
- BOOL bValid = ( ( aRange.Parse( aPos, &aDocument, eConv ) & SCA_VALID ) ||
- ( aRange.aStart.Parse( aPos, &aDocument, eConv ) & SCA_VALID ) );
+ bool bValid = ( (aRange.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO ) & SCA_VALID) ||
+ (aRange.aStart.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO) & SCA_VALID) );
ScServerObject* pObj = NULL; // NULL = error
if ( bValid )
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index d3b6bb55dcdd..281f03ff3622 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -393,13 +393,51 @@ BOOL ScDocShell::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab )
return bChange;
}
-void ScDocShell::UpdateAllRowHeights()
+void ScDocShell::UpdateAllRowHeights( const ScMarkData* pTabMark )
{
// update automatic row heights
ScSizeDeviceProvider aProv(this);
Fraction aZoom(1,1);
- aDocument.UpdateAllRowHeights( aProv.GetDevice(), aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom );
+ aDocument.UpdateAllRowHeights( aProv.GetDevice(), aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, pTabMark );
+}
+
+void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
+{
+ BOOL bIsUndoEnabled = aDocument.IsUndoEnabled();
+ aDocument.EnableUndo( FALSE );
+ if ( bBefore ) // check all sheets up to nUpdateTab
+ {
+ SCTAB nTabCount = aDocument.GetTableCount();
+ if ( nUpdateTab >= nTabCount )
+ nUpdateTab = nTabCount-1; // nUpdateTab is inclusive
+
+ ScMarkData aUpdateSheets;
+ SCTAB nTab;
+ for (nTab=0; nTab<=nUpdateTab; ++nTab)
+ if ( aDocument.IsPendingRowHeights( nTab ) )
+ aUpdateSheets.SelectTable( nTab, TRUE );
+
+ if (aUpdateSheets.GetSelectCount())
+ UpdateAllRowHeights(&aUpdateSheets); // update with a single progress bar
+
+ for (nTab=0; nTab<=nUpdateTab; ++nTab)
+ if ( aUpdateSheets.GetTableSelect( nTab ) )
+ {
+ aDocument.UpdatePageBreaks( nTab );
+ aDocument.SetPendingRowHeights( nTab, FALSE );
+ }
+ }
+ else // only nUpdateTab
+ {
+ if ( aDocument.IsPendingRowHeights( nUpdateTab ) )
+ {
+ AdjustRowHeight( 0, MAXROW, nUpdateTab );
+ aDocument.UpdatePageBreaks( nUpdateTab );
+ aDocument.SetPendingRowHeights( nUpdateTab, FALSE );
+ }
+ }
+ aDocument.EnableUndo( bIsUndoEnabled );
}
#if OLD_PIVOT_IMPLEMENTATION
@@ -827,7 +865,7 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
++nAdjSource; // new position of source table after CopyTab
if ( aDocument.IsTabProtected( nAdjSource ) )
- aDocument.SetTabProtection( nDestTab, TRUE, aDocument.GetTabPassword( nAdjSource ) );
+ aDocument.CopyTabProtection(nAdjSource, nDestTab);
if (bRecord)
{
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 637093275bad..9cc0b274028e 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -143,7 +143,8 @@ private:
// ============================================================================
ScExternalRefCache::Table::Table()
- : mbReferenced( true) // Prevent accidental data loss due to lack of knowledge.
+ : meReferenced( REFERENCED_MARKED )
+ // Prevent accidental data loss due to lack of knowledge.
{
}
@@ -151,14 +152,25 @@ ScExternalRefCache::Table::~Table()
{
}
+void ScExternalRefCache::Table::setReferencedFlag( ScExternalRefCache::Table::ReferencedFlag eFlag )
+{
+ meReferenced = eFlag;
+}
+
void ScExternalRefCache::Table::setReferenced( bool bReferenced )
{
- mbReferenced = bReferenced;
+ if (meReferenced != REFERENCED_PERMANENT)
+ meReferenced = (bReferenced ? REFERENCED_MARKED : UNREFERENCED);
+}
+
+ScExternalRefCache::Table::ReferencedFlag ScExternalRefCache::Table::getReferencedFlag() const
+{
+ return meReferenced;
}
bool ScExternalRefCache::Table::isReferenced() const
{
- return mbReferenced;
+ return meReferenced != UNREFERENCED;
}
void ScExternalRefCache::Table::setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex)
@@ -737,21 +749,57 @@ bool ScExternalRefCache::setCacheDocReferenced( sal_uInt16 nFileId )
return areAllCacheTablesReferenced();
}
-bool ScExternalRefCache::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName )
+bool ScExternalRefCache::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets, bool bPermanent )
{
- size_t nIndex = 0;
- TableTypeRef pTab = getCacheTable( nFileId, rTabName, false, &nIndex);
- if (pTab.get())
+ DocItem* pDoc = getDocItem(nFileId);
+ if (pDoc)
{
- if (!pTab->isReferenced())
+ size_t nIndex = 0;
+ String aTabNameUpper = ScGlobal::pCharClass->upper( rTabName);
+ if (lcl_getTableDataIndex( pDoc->maTableNameIndex, aTabNameUpper, nIndex))
{
- pTab->setReferenced( true);
- addCacheTableToReferenced( nFileId, nIndex);
+ size_t nStop = ::std::min( nIndex + nSheets, pDoc->maTables.size());
+ for (size_t i = nIndex; i < nStop; ++i)
+ {
+ TableTypeRef pTab = pDoc->maTables[i];
+ if (pTab.get())
+ {
+ Table::ReferencedFlag eNewFlag = (bPermanent ?
+ Table::REFERENCED_PERMANENT :
+ Table::REFERENCED_MARKED);
+ Table::ReferencedFlag eOldFlag = pTab->getReferencedFlag();
+ if (eOldFlag != Table::REFERENCED_PERMANENT && eNewFlag != eOldFlag)
+ {
+ pTab->setReferencedFlag( eNewFlag);
+ addCacheTableToReferenced( nFileId, i);
+ }
+ }
+ }
}
}
return areAllCacheTablesReferenced();
}
+void ScExternalRefCache::setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets )
+{
+ DocItem* pDoc = getDocItem(nFileId);
+ if (pDoc)
+ {
+ size_t nIndex = 0;
+ String aTabNameUpper = ScGlobal::pCharClass->upper( rTabName);
+ if (lcl_getTableDataIndex( pDoc->maTableNameIndex, aTabNameUpper, nIndex))
+ {
+ size_t nStop = ::std::min( nIndex + nSheets, pDoc->maTables.size());
+ for (size_t i = nIndex; i < nStop; ++i)
+ {
+ TableTypeRef pTab = pDoc->maTables[i];
+ if (pTab.get())
+ pTab->setReferencedFlag( Table::REFERENCED_PERMANENT);
+ }
+ }
+ }
+}
+
void ScExternalRefCache::setAllCacheTableReferencedStati( bool bReferenced )
{
if (bReferenced)
@@ -791,9 +839,17 @@ void ScExternalRefCache::setAllCacheTableReferencedStati( bool bReferenced )
TableTypeRef & xTab = rDocItem.maTables[i];
if (xTab.get())
{
- xTab->setReferenced( false);
- rDocReferenced.maTables[i] = false;
- rDocReferenced.mbAllTablesReferenced = false;
+ if (xTab->getReferencedFlag() == Table::REFERENCED_PERMANENT)
+ addCacheTableToReferenced( nFileId, i);
+ else
+ {
+ xTab->setReferencedFlag( Table::UNREFERENCED);
+ rDocReferenced.maTables[i] = false;
+ rDocReferenced.mbAllTablesReferenced = false;
+ // An addCacheTableToReferenced() actually may have
+ // resulted in mbAllReferenced been set. Clear it.
+ maReferenced.mbAllReferenced = false;
+ }
}
}
}
@@ -1317,8 +1373,9 @@ void ScExternalRefManager::RefCells::moveTable(SCTAB nOldTab, SCTAB nNewTab, boo
xNewTab->mnIndex = nNewTab;
maTables.insert(itrNew, xNewTab);
list<TabItemRef>::iterator itr = itrNew, itrEnd = maTables.end();
- for (++itr; itr != itrEnd; ++itr)
- (*itr)->mnIndex += 1;
+ if (itr != itrEnd) // #i99807# check that itr is not at end already
+ for (++itr; itr != itrEnd; ++itr)
+ (*itr)->mnIndex += 1;
}
else
{
@@ -1480,9 +1537,19 @@ bool ScExternalRefManager::setCacheDocReferenced( sal_uInt16 nFileId )
return maRefCache.setCacheDocReferenced( nFileId);
}
-bool ScExternalRefManager::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName )
+bool ScExternalRefManager::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets )
{
- return maRefCache.setCacheTableReferenced( nFileId, rTabName);
+ return maRefCache.setCacheTableReferenced( nFileId, rTabName, nSheets, false);
+}
+
+void ScExternalRefManager::setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets )
+{
+ if (isInReferenceMarking())
+ // Do all maintenance work.
+ maRefCache.setCacheTableReferenced( nFileId, rTabName, nSheets, true);
+ else
+ // Set only the permanent flag.
+ maRefCache.setCacheTableReferencedPermanently( nFileId, rTabName, nSheets);
}
void ScExternalRefManager::setAllCacheTableReferencedStati( bool bReferenced )
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 8b86e0d886ef..63f958763479 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -230,7 +230,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
{
SdrPageView* pPV = 0;
SdrObject* pHit = 0;
- if ( pView->PickObj( pWin->PixelToLogic( pViewData->GetMousePosPixel() ), pHit, pPV, SDRSEARCH_DEEP ) )
+ if ( pView->PickObj( pWin->PixelToLogic( pViewData->GetMousePosPixel() ), pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
pObj = pHit;
}
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index 2dccd6edbfe0..fadb8270b6a6 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -795,12 +795,12 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
SdrPageView* pPV;
ScMacroInfo* pInfo = 0;
- if ( pView->PickObj(aPnt, pObj, pPV, SDRSEARCH_ALSOONMASTER) )
+ if ( pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
{
if ( pObj->IsGroupObject() )
{
SdrObject* pHit = 0;
- if ( pView->PickObj(aMDPos, pHit, pPV, SDRSEARCH_DEEP ) )
+ if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
pObj = pHit;
}
pInfo = ScDrawLayer::GetMacroInfo( pObj );
@@ -825,7 +825,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
// kann mit ALT unterdrueckt werden
pWindow->SetPointer( Pointer( POINTER_REFHAND ) ); // Text-URL / ImageMap
}
- else if ( !bAlt && pView->PickObj(aPnt, pObj, pPV, SDRSEARCH_PICKMACRO) )
+ else if ( !bAlt && pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
{
// kann mit ALT unterdrueckt werden
SdrObjMacroHitRec aHitRec; //! muss da noch irgendwas gesetzt werden ????
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 5dff4041bd22..93abbd48c9e7 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -167,8 +167,10 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
if ( aRangeListRef->Count() )
{
pScDoc->LimitChartIfAll( aRangeListRef ); // limit whole columns/rows to used area
+
+ // update string from modified ranges. The ranges must be in the current formula syntax.
String aTmpStr;
- aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() ); // update string from changed ranges
+ aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );
aRangeString = aTmpStr;
ScChartPositioner aChartPositioner( pScDoc, aRangeListRef );
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index c26d3fdcb5fc..23aefe17c71b 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -42,6 +42,7 @@
#include "detfunc.hxx"
#include "document.hxx"
#include <vcl/svapp.hxx>
+#include <svx/sdrhittesthelper.hxx>
/*************************************************************************
|*
@@ -333,8 +334,10 @@ BOOL FuPoor::IsDetectiveHit( const Point& rLogicPos )
{
USHORT nHitLog = (USHORT) pWindow->PixelToLogic(
Size(pView->GetHitTolerancePixel(),0)).Width();
- if ( pObject->IsHit( rLogicPos, nHitLog ) )
+ if(SdrObjectPrimitiveHit(*pObject, rLogicPos, nHitLog, *pPV, 0, false))
+ {
bFound = TRUE;
+ }
}
pObject = aIter.Next();
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 02fc2e38b0f6..79c466f9f2c3 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -171,7 +171,7 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
else
{
BOOL bAlt = rMEvt.IsMod2();
- if ( !bAlt && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_PICKMACRO) )
+ if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
{
pView->BegMacroObj(aMDPos, pObj, pPV, pWindow);
bReturn = TRUE;
@@ -179,7 +179,7 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
else
{
String sURL, sTarget;
- if ( !bAlt && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER))
+ if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER))
{
// Support for imported Excel docs
// Excel is of course not consistent and allows
@@ -200,7 +200,7 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
if ( pObj->IsGroupObject() )
{
SdrObject* pHit = NULL;
- if ( pView->PickObj(aMDPos, pHit, pPV, SDRSEARCH_DEEP ) )
+ if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
pObj = pHit;
}
diff --git a/sc/source/ui/drawfunc/fusel2.cxx b/sc/source/ui/drawfunc/fusel2.cxx
index aa518ee42a81..7c096fd51d71 100644
--- a/sc/source/ui/drawfunc/fusel2.cxx
+++ b/sc/source/ui/drawfunc/fusel2.cxx
@@ -53,6 +53,7 @@
#include "drwlayer.hxx"
#include "docsh.hxx"
#include "drawview.hxx"
+#include <svx/sdrhittesthelper.hxx>
// -----------------------------------------------------------------------
@@ -79,7 +80,7 @@ BOOL FuSelection::TestDetective( SdrPageView* pPV, const Point& rPos )
{
USHORT nHitLog = (USHORT) pWindow->PixelToLogic(
Size(pView->GetHitTolerancePixel(),0)).Width();
- if ( pObject->IsHit( rPos, nHitLog ) )
+ if (SdrObjectPrimitiveHit(*pObject, rPos, nHitLog, *pPV, 0, false))
{
ScViewData* pViewData = pViewShell->GetViewData();
ScSplitPos ePos = pViewShell->FindWindow( pWindow );
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 302d1c825a2a..ebcb2ad30802 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -193,7 +193,7 @@ BOOL __EXPORT FuText::MouseButtonDown(const MouseEvent& rMEvt)
{
if (pHdl == NULL &&
// pView->TakeTextEditObject(aMDPos, pObj, pPV) )
- pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_PICKTEXTEDIT) )
+ pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKTEXTEDIT) )
{
SdrOutliner* pO = MakeOutliner();
lcl_UpdateHyphenator( *pO, pObj );
@@ -250,7 +250,7 @@ BOOL __EXPORT FuText::MouseButtonDown(const MouseEvent& rMEvt)
BOOL bMacro = FALSE;
// if (bMacro && pView->TakeMacroObject(aMDPos,pObj,pPV))
- if (bMacro && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_PICKMACRO) )
+ if (bMacro && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
{
pView->BegMacroObj(aMDPos,pObj,pPV,pWindow);
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index 3fc99568e173..701a53aecfcc 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -130,7 +130,7 @@ void FuText::StopEditMode(BOOL /*bTextDirection*/)
if( pNote )
{
// hide the caption object if it is in hidden state
- pNote->HideCaptionTemp();
+ pNote->ShowCaptionTemp( aNotePos, false );
// update author and date
pNote->AutoStamp();
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 4544c1ca0792..8d631a9f0609 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -126,7 +126,6 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
m_xParser.set(ScServiceProvider::MakeInstance(SC_SERVICE_FORMULAPARS,(ScDocShell*)pDoc->GetDocumentShell()),uno::UNO_QUERY);
uno::Reference< beans::XPropertySet> xSet(m_xParser,uno::UNO_QUERY);
xSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_COMPILEFAP)),uno::makeAny(sal_True));
- xSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_REFERENCEPOS)),uno::makeAny(table::CellAddress(aCursorPos.Tab(),aCursorPos.Col(),aCursorPos.Row())));
m_xOpCodeMapper.set(ScServiceProvider::MakeInstance(SC_SERVICE_OPCODEMAPPER,(ScDocShell*)pDoc->GetDocumentShell()),uno::UNO_QUERY);
@@ -657,6 +656,12 @@ uno::Reference< sheet::XFormulaOpCodeMapper> ScFormulaDlg::getFormulaOpCodeMappe
{
return m_xOpCodeMapper;
}
+
+table::CellAddress ScFormulaDlg::getReferencePosition() const
+{
+ return table::CellAddress(aCursorPos.Tab(),aCursorPos.Col(),aCursorPos.Row());
+}
+
::std::auto_ptr<formula::FormulaTokenArray> ScFormulaDlg::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
{
::std::auto_ptr<formula::FormulaTokenArray> pArray(new ScTokenArray());
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index ecdaceb55294..21e295a58fa4 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -33,7 +33,6 @@
#include <tools/link.hxx>
#include "global.hxx"
-#include "postit.hxx"
#include "formula/grammar.hxx"
class ScEditEngineDefaulter;
@@ -47,7 +46,7 @@ class ScRangeName;
class ScBaseCell;
class ScTokenArray;
struct ScTabOpParam;
-
+class ScTableProtection;
// ---------------------------------------------------------------------------
@@ -90,11 +89,12 @@ public:
BOOL bInterpret, BOOL bApi );
BOOL SetCellText( const ScAddress& rPos, const String& rText,
BOOL bInterpret, BOOL bEnglish, BOOL bApi,
+ const String& rFormulaNmsp,
const formula::FormulaGrammar::Grammar eGrammar );
// creates a new cell for use with PutCell
ScBaseCell* InterpretEnglishString( const ScAddress& rPos, const String& rText,
- const formula::FormulaGrammar::Grammar eGrammar );
+ const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar );
bool ShowNote( const ScAddress& rPos, bool bShow = true );
inline bool HideNote( const ScAddress& rPos ) { return ShowNote( rPos, false ); }
@@ -135,6 +135,8 @@ public:
BOOL RemovePageBreak( BOOL bColumn, const ScAddress& rPos,
BOOL bRecord, BOOL bSetModified, BOOL bApi );
+ void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
+
BOOL Protect( SCTAB nTab, const String& rPassword, BOOL bApi );
BOOL Unprotect( SCTAB nTab, const String& rPassword, BOOL bApi );
@@ -146,6 +148,7 @@ public:
BOOL EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
const ScTokenArray* pTokenArray,
const String& rString, BOOL bApi, BOOL bEnglish,
+ const String& rFormulaNmsp,
const formula::FormulaGrammar::Grammar );
BOOL TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index df102a54f355..b8b8d10f0c6e 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -290,7 +290,8 @@ public:
BOOL IsEditable() const;
BOOL AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab );
- void UpdateAllRowHeights();
+ void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL );
+ void UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore = false );
#if OLD_PIVOT_IMPLEMENTATION
void PivotUpdate( ScPivot* pOldPivot, ScPivot* pNewPivot,
diff --git a/sc/source/ui/inc/formula.hxx b/sc/source/ui/inc/formula.hxx
index a40a6092fe26..b25811eb9220 100644
--- a/sc/source/ui/inc/formula.hxx
+++ b/sc/source/ui/inc/formula.hxx
@@ -105,6 +105,7 @@ public:
virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const;
+ virtual ::com::sun::star::table::CellAddress getReferencePosition() const;
virtual BOOL Close();
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 9b31289d13d0..844d88055578 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -116,18 +116,19 @@ namespace sdr
public:
typedef ::std::vector< basegfx::B2DRange > RangeVector;
+ protected:
+ basegfx::B2DPolyPolygon impGetOverlayPolyPolygon() const;
+
private:
ScOverlayType mePaintType;
RangeVector maRectangles;
- virtual void drawGeometry(OutputDevice& rOutputDevice);
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayObjectCell( ScOverlayType eType, const Color& rColor, const RangeVector& rRects);
virtual ~OverlayObjectCell();
-
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
};
} // end of namespace overlay
diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 6a8e43fb2e7c..fd607975ff47 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -92,7 +92,7 @@ public:
Size aUserSize;
MapMode aUserMapMode;
- Paper ePaper;
+ Paper ePaper;
Orientation eOrientation;
USHORT nPaperBin;
};
diff --git a/sc/source/ui/inc/protectiondlg.hrc b/sc/source/ui/inc/protectiondlg.hrc
new file mode 100644
index 000000000000..79285d3ce125
--- /dev/null
+++ b/sc/source/ui/inc/protectiondlg.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.hrc,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <sc.hrc>
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
+
+#define BTN_PROTECT 4
+#define FT_PASSWORD1 5
+#define ED_PASSWORD1 6
+#define FT_PASSWORD2 7
+#define ED_PASSWORD2 8
+#define FL_OPTIONS 9
+#define FT_OPTIONS 10
+#define CLB_OPTIONS 11
+
+#define ST_SELECT_LOCKED_CELLS 50
+#define ST_SELECT_UNLOCKED_CELLS 51
diff --git a/sc/source/ui/inc/protectiondlg.hxx b/sc/source/ui/inc/protectiondlg.hxx
new file mode 100644
index 000000000000..36330498c941
--- /dev/null
+++ b/sc/source/ui/inc/protectiondlg.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.hxx,v $
+ * $Revision: 1.1.2.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_UI_PROTECTION_DLG_HXX
+#define SC_UI_PROTECTION_DLG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <svx/checklbx.hxx>
+
+class Window;
+class ScTableProtection;
+
+class ScTableProtectionDlg : public ModalDialog
+{
+public:
+ explicit ScTableProtectionDlg(Window* pParent);
+ virtual ~ScTableProtectionDlg();
+
+ virtual short Execute();
+
+ void SetDialogData(const ScTableProtection& rData);
+
+ void WriteData(ScTableProtection& rData) const;
+
+private:
+ ScTableProtectionDlg(); // disabled
+
+ void Init();
+
+ void EnableOptionalWidgets(bool bEnable = true);
+
+ CheckBox maBtnProtect;
+
+ FixedText maPassword1Text;
+ Edit maPassword1Edit;
+ FixedText maPassword2Text;
+ Edit maPassword2Edit;
+
+ FixedLine maOptionsLine;
+ FixedText maOptionsText;
+ SvxCheckListBox maOptionsListBox;
+
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+
+ String maSelectLockedCells;
+ String maSelectUnlockedCells;
+
+ DECL_LINK( OKHdl, OKButton* );
+ DECL_LINK( CheckBoxHdl, CheckBox* );
+ DECL_LINK( PasswordModifyHdl, Edit* );
+};
+
+#endif
diff --git a/sc/source/ui/inc/retypepassdlg.hrc b/sc/source/ui/inc/retypepassdlg.hrc
new file mode 100644
index 000000000000..fe0f7e8a760a
--- /dev/null
+++ b/sc/source/ui/inc/retypepassdlg.hrc
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: retypepassdlg.hrc,v $
+ * $Revision: 1.1.2.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <sc.hrc>
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
+
+#define FT_DESC 10
+#define FL_DOCUMENT 11
+#define FT_DOCSTATUS 12
+#define BTN_RETYPE_DOC 13
+
+#define FL_SHEET 112
+
+#define FT_SHEETNAME1 113
+#define FT_SHEETSTATUS1 114
+#define BTN_RETYPE_SHEET1 115
+
+#define FT_SHEETNAME2 116
+#define FT_SHEETSTATUS2 117
+#define BTN_RETYPE_SHEET2 118
+
+#define FT_SHEETNAME3 119
+#define FT_SHEETSTATUS3 120
+#define BTN_RETYPE_SHEET3 121
+
+#define FT_SHEETNAME4 122
+#define FT_SHEETSTATUS4 123
+#define BTN_RETYPE_SHEET4 124
+
+#define SB_SCROLL 190
+
+#define STR_NOT_PROTECTED 200
+#define STR_NOT_PASS_PROTECTED 201
+#define STR_HASH_BAD 202
+#define STR_HASH_GOOD 203
+#define STR_HASH_REGENERATED 204
+
+#define FT_PASSWORD1 301
+#define ED_PASSWORD1 302
+#define FT_PASSWORD2 303
+#define ED_PASSWORD2 304
+#define BTN_MATCH_OLD_PASSWORD 305
+#define BTN_RETYPE_PASSWORD 306
+#define BTN_REMOVE_PASSWORD 307
diff --git a/sc/source/ui/inc/retypepassdlg.hxx b/sc/source/ui/inc/retypepassdlg.hxx
new file mode 100644
index 000000000000..657773d112f7
--- /dev/null
+++ b/sc/source/ui/inc/retypepassdlg.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: retypepassdlg.hxx,v $
+ * $Revision: 1.1.2.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_UI_RETYPEPASS_DLG_HXX
+#define SC_UI_RETYPEPASS_DLG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/scrbar.hxx>
+#include <svx/checklbx.hxx>
+#include <svtools/stdctrl.hxx>
+
+#include "tabprotection.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+class Window;
+class ScDocProtection;
+class ScTableProtection;
+class ScDocument;
+
+class ScRetypePassDlg : public ModalDialog
+{
+public:
+ typedef ::boost::shared_ptr<ScDocProtection> DocProtectionPtr;
+ typedef ::boost::shared_ptr<ScTableProtection> TabProtectionPtr;
+
+ explicit ScRetypePassDlg(Window* pParent);
+ virtual ~ScRetypePassDlg();
+
+ virtual short Execute();
+
+ void SetDataFromDocument(const ScDocument& rDoc);
+ void SetDesiredHash(ScPasswordHash eHash);
+
+ /** Write the new set of password data to the document instance to
+ overwrite the current ones. */
+ void WriteNewDataToDocument(ScDocument& rDoc) const;
+
+private:
+ ScRetypePassDlg(); // disabled
+
+ void Init();
+ void PopulateDialog();
+ void SetDocData();
+ void SetTableData(size_t nRowPos, SCTAB nTab);
+ void ResetTableRows();
+
+ /** Check the status of all hash values to see if it's okay to enable
+ the OK button. */
+ void CheckHashStatus();
+
+private:
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+
+ FixedInfo maTextDescription;
+
+ FixedLine maLineDocument;
+ FixedText maTextDocStatus;
+ PushButton maBtnRetypeDoc;
+
+ FixedLine maLineSheet;
+ FixedText maTextSheetName1;
+ FixedText maTextSheetStatus1;
+ PushButton maBtnRetypeSheet1;
+
+ FixedText maTextSheetName2;
+ FixedText maTextSheetStatus2;
+ PushButton maBtnRetypeSheet2;
+
+ FixedText maTextSheetName3;
+ FixedText maTextSheetStatus3;
+ PushButton maBtnRetypeSheet3;
+
+ FixedText maTextSheetName4;
+ FixedText maTextSheetStatus4;
+ PushButton maBtnRetypeSheet4;
+
+ ScrollBar maScrollBar;
+
+ String maTextNotProtected;
+ String maTextNotPassProtected;
+ String maTextHashBad;
+ String maTextHashGood;
+ String maTextHashRegen;
+
+ DECL_LINK( OKHdl, OKButton* );
+ DECL_LINK( RetypeBtnHdl, PushButton* );
+ DECL_LINK( ScrollHdl, ScrollBar* );
+
+ struct TableItem
+ {
+ String maName;
+ TabProtectionPtr mpProtect;
+ };
+ ::std::vector<TableItem> maTableItems;
+
+ DocProtectionPtr mpDocItem;
+ size_t mnCurScrollPos;
+ ScPasswordHash meDesiredHash;
+};
+
+// ============================================================================
+
+class ScRetypePassInputDlg : public ModalDialog
+{
+public:
+ explicit ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected);
+ virtual ~ScRetypePassInputDlg();
+
+ virtual short Execute();
+
+ bool IsRemovePassword() const;
+ String GetNewPassword() const;
+
+private:
+ ScRetypePassInputDlg(); // disabled
+
+ void Init();
+ void CheckPasswordInput();
+
+private:
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+
+ RadioButton maBtnRetypePassword;
+
+ FixedText maPassword1Text;
+ Edit maPassword1Edit;
+ FixedText maPassword2Text;
+ Edit maPassword2Edit;
+
+ CheckBox maBtnMatchOldPass;
+
+ RadioButton maBtnRemovePassword;
+
+ DECL_LINK( OKHdl, OKButton* );
+ DECL_LINK( RadioBtnHdl, RadioButton* );
+ DECL_LINK( CheckBoxHdl, CheckBox* );
+ DECL_LINK( PasswordModifyHdl, Edit* );
+
+ ScPassHashProtectable* mpProtected;
+};
+
+#endif
diff --git a/sc/source/ui/inc/scui_def.hxx b/sc/source/ui/inc/scui_def.hxx
index 231c983db69a..e2a11bb3204c 100644
--- a/sc/source/ui/inc/scui_def.hxx
+++ b/sc/source/ui/inc/scui_def.hxx
@@ -53,6 +53,8 @@
#define BTN_PASTE_NAME 100 // from namepast.hxx
#define BTN_PASTE_LIST 101 // from namepast.hxx
+#define BTN_EXTEND_RANGE 150
+#define BTN_CURRENT_SELECTION 151
#define SCRET_REMOVE 0x42 //from subtdlg.hxx
#endif
diff --git a/sc/source/ui/inc/sortdlg.hrc b/sc/source/ui/inc/sortdlg.hrc
index 902606429596..8f2f641e7574 100644
--- a/sc/source/ui/inc/sortdlg.hrc
+++ b/sc/source/ui/inc/sortdlg.hrc
@@ -32,6 +32,7 @@
#include "sc.hrc" // -> RID_SCDLG_SORT
// -> RID_SCPAGE_SORT_FIELDS
// -> RID_SCPAGE_SORT_OPTIONS
+ // -> RID_SCDLG_SORT_WARNING
// -> SCSTR_NONAME
// -> SCSTR_UNDEFINED
// -> SCSTR_FIELD
@@ -40,6 +41,7 @@
#define RID_SCDLG_SORT 256
#define RID_SCPAGE_SORT_FIELDS 257
#define RID_SCPAGE_SORT_OPTIONS 258
+#define RID_SCDLG_SORT_WARNING
*/
#define TP_FIELDS 1
@@ -80,6 +82,12 @@
#define FT_ALGORITHM 18
#define LB_ALGORITHM 19
+//#define RID_SCDLG_SORT_WARNING
+#define FT_TEXT 1
+#define FT_TIP 2
+#define BTN_EXTSORT 3
+#define BTN_CURSORT 4
+#define BTN_CANCEL 5
diff --git a/sc/source/ui/inc/sortdlg.hxx b/sc/source/ui/inc/sortdlg.hxx
index 3dcb3a08191d..d1ffb8aac0ed 100644
--- a/sc/source/ui/inc/sortdlg.hxx
+++ b/sc/source/ui/inc/sortdlg.hxx
@@ -32,6 +32,10 @@
#define SC_SORTDLG_HXX
#include <sfx2/tabdlg.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include "scui_def.hxx" //CHINA001
#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
#define LAYOUT_SFX_TABDIALOG_BROKEN 1
@@ -65,6 +69,20 @@ inline void ScSortDlg::SetByRows ( BOOL bByRows ) { bIsByRows = bByRows; }
inline BOOL ScSortDlg::GetHeaders() const { return bIsHeaders; }
inline BOOL ScSortDlg::GetByRows () const { return bIsByRows; }
+class ScSortWarningDlg : public ModalDialog
+{
+public:
+ ScSortWarningDlg( Window* pParent, const String& rExtendText,const String& rCurrentText );
+ ~ScSortWarningDlg();
+ DECL_LINK( BtnHdl, PushButton* );
+private:
+ FixedText aFtText;
+ FixedText aFtTip;
+ PushButton aBtnExtSort;
+ PushButton aBtnCurSort;
+ CancelButton aBtnCancel;
+};
+
#if !LAYOUT_SFX_TABDIALOG_BROKEN
#include <layout/layout-post.hxx>
#endif
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 13cd49df6879..10224536bf0b 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -39,6 +39,7 @@
#include "target.hxx"
#include "rangelst.hxx" // ScRangeListRef
#include "shellids.hxx"
+#include "tabprotection.hxx" // for ScPasswordHash
class FmFormShell;
class SbxObject;
@@ -430,6 +431,8 @@ public:
void BroadcastAccessibility( const SfxHint &rHint );
BOOL HasAccessibilityObjects();
+ bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
+
using ScTabView::ShowCursor;
};
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index d357461d0f5e..281f44f4fe82 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -36,6 +36,7 @@
#include "spellparam.hxx"
class ScDocShell;
+class ScBaseCell;
class ScDocument;
class ScOutlineTable;
class ScRangeName;
@@ -592,6 +593,35 @@ private:
void SetChangeTrack();
};
+class ScUndoRefConversion: public ScSimpleUndo
+{
+public:
+ TYPEINFO();
+ ScUndoRefConversion( ScDocShell* pNewDocShell,
+ const ScRange& aMarkRange, const ScMarkData& rMark,
+ ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc, BOOL bNewMulti, USHORT nNewFlag);
+ virtual ~ScUndoRefConversion();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual void Repeat(SfxRepeatTarget& rTarget);
+ virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
+
+ virtual String GetComment() const;
+
+private:
+ ScMarkData aMarkData;
+ ScDocument* pUndoDoc;
+ ScDocument* pRedoDoc;
+ ScRange aRange;
+ BOOL bMulti;
+ USHORT nFlags;
+ ULONG nStartChangeAction;
+ ULONG nEndChangeAction;
+
+ void DoChange( ScDocument* pRefDoc);
+ void SetChangeTrack();
+};
class ScUndoListNames: public ScBlockUndo
{
diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx
index ff76ebd16702..1eadf24041db 100644
--- a/sc/source/ui/inc/undotab.hxx
+++ b/sc/source/ui/inc/undotab.hxx
@@ -52,11 +52,15 @@
#include <com/sun/star/uno/Sequence.hxx>
+#include <memory>
+
class ScDocShell;
class ScDocument;
class SdrUndoAction;
class ScPrintRangeSaver;
class SdrObject;
+class ScDocProtection;
+class ScTableProtection;
//----------------------------------------------------------------------------
@@ -335,14 +339,15 @@ private:
void DoChange( BOOL bShow ) const;
};
+// ============================================================================
-class ScUndoProtect : public ScSimpleUndo
+/** This class implements undo & redo of document protect & unprotect
+ operations. */
+class ScUndoDocProtect : public ScSimpleUndo
{
public:
- TYPEINFO();
- ScUndoProtect( ScDocShell* pShell, SCTAB nNewTab,
- BOOL bNewProtect, const com::sun::star::uno::Sequence<sal_Int8>& rNewPassword );
- virtual ~ScUndoProtect();
+ ScUndoDocProtect(ScDocShell* pShell, ::std::auto_ptr<ScDocProtection> pProtectSettings);
+ virtual ~ScUndoDocProtect();
virtual void Undo();
virtual void Redo();
@@ -352,11 +357,34 @@ public:
virtual String GetComment() const;
private:
- SCTAB nTab;
- BOOL bProtect;
- com::sun::star::uno::Sequence<sal_Int8> aPassword;
+ ::std::auto_ptr<ScDocProtection> mpProtectSettings;
+
+ void DoProtect(bool bProtect);
+};
+
+// ============================================================================
+
+/** This class implements undo & redo of both protect and unprotect of
+ sheet. */
+class ScUndoTabProtect : public ScSimpleUndo
+{
+public:
+ ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab,
+ ::std::auto_ptr<ScTableProtection> pProtectSettings);
+ virtual ~ScUndoTabProtect();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual void Repeat(SfxRepeatTarget& rTarget);
+ virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
+
+ virtual String GetComment() const;
+
+private:
+ SCTAB mnTab;
+ ::std::auto_ptr<ScTableProtection> mpProtectSettings;
- void DoProtect( BOOL bDo );
+ void DoProtect(bool bProtect);
};
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 0759d1fe2893..228c4b4c1489 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -69,6 +69,7 @@ class Exchange;
class ScRangeList;
class SvxHyperlinkItem;
class ScTransferObj;
+class ScTableProtection;
namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
@@ -199,6 +200,8 @@ public:
void ChangeIndent( BOOL bIncrement );
+ void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
+
void Protect( SCTAB nTab, const String& rPassword );
BOOL Unprotect( SCTAB nTab, const String& rPassword );
@@ -300,6 +303,7 @@ public:
void SetNoteText( const ScAddress& rPos, const String& rNoteText );
void ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate );
+ void DoRefConversion( BOOL bRecord = TRUE );
//UNUSED2008-05 void DoSpellingChecker( BOOL bRecord = TRUE );
void DoHangulHanjaConversion( BOOL bRecord = TRUE );
diff --git a/sc/source/ui/miscdlgs/makefile.mk b/sc/source/ui/miscdlgs/makefile.mk
index 988b288da625..66e1f33618e2 100644
--- a/sc/source/ui/miscdlgs/makefile.mk
+++ b/sc/source/ui/miscdlgs/makefile.mk
@@ -78,7 +78,9 @@ SLOFILES = \
$(SLO)$/warnbox.obj \
$(SLO)$/scuiautofmt.obj \
$(SLO)$/conflictsdlg.obj \
- $(SLO)$/sharedocdlg.obj
+ $(SLO)$/sharedocdlg.obj \
+ $(SLO)$/protectiondlg.obj \
+ $(SLO)$/retypepassdlg.obj
EXCEPTIONSFILES = \
$(SLO)$/acredlin.obj \
@@ -87,7 +89,9 @@ EXCEPTIONSFILES = \
$(SLO)$/optsolver.obj \
$(SLO)$/solveroptions.obj \
$(SLO)$/crnrdlg.obj \
- $(SLO)$/solverutil.obj
+ $(SLO)$/solverutil.obj \
+ $(SLO)$/protectiondlg.obj \
+ $(SLO)$/retypepassdlg.obj
SRS1NAME=$(TARGET)
SRC1FILES = \
@@ -96,7 +100,9 @@ SRC1FILES = \
highred.src \
linkarea.src \
conflictsdlg.src \
- sharedocdlg.src
+ sharedocdlg.src \
+ protectiondlg.src \
+ retypepassdlg.src
LIB1TARGET = $(SLB)$/$(TARGET).lib
@@ -116,7 +122,9 @@ LIB1OBJFILES = \
$(SLO)$/redcom.obj \
$(SLO)$/warnbox.obj \
$(SLO)$/conflictsdlg.obj \
- $(SLO)$/sharedocdlg.obj
+ $(SLO)$/sharedocdlg.obj \
+ $(SLO)$/protectiondlg.obj \
+ $(SLO)$/retypepassdlg.obj
# --- Tagets -------------------------------------------------------
diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx
new file mode 100644
index 000000000000..a5116ef61d66
--- /dev/null
+++ b/sc/source/ui/miscdlgs/protectiondlg.cxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.cxx,v $
+ * $Revision: 1.1.2.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "protectiondlg.hxx"
+#include "protectiondlg.hrc"
+#include "scresid.hxx"
+#include "tabprotection.hxx"
+
+#include <vcl/msgbox.hxx>
+
+
+// The order must match that of the list box.
+static const ScTableProtection::Option aOptions[] = {
+ ScTableProtection::SELECT_LOCKED_CELLS,
+ ScTableProtection::SELECT_UNLOCKED_CELLS,
+};
+static const USHORT nOptionCount = sizeof(aOptions)/sizeof(aOptions[0]);
+
+
+ScTableProtectionDlg::ScTableProtectionDlg(Window* pParent) :
+ ModalDialog(pParent, ScResId(RID_SCDLG_TABPROTECTION)),
+
+ maBtnProtect (this, ScResId(BTN_PROTECT)),
+ maPassword1Text (this, ScResId(FT_PASSWORD1)),
+ maPassword1Edit (this, ScResId(ED_PASSWORD1)),
+ maPassword2Text (this, ScResId(FT_PASSWORD2)),
+ maPassword2Edit (this, ScResId(ED_PASSWORD2)),
+ maOptionsLine (this, ScResId(FL_OPTIONS)),
+ maOptionsText (this, ScResId(FT_OPTIONS)),
+ maOptionsListBox(this, ScResId(CLB_OPTIONS)),
+
+ maBtnOk (this, ScResId(BTN_OK)),
+ maBtnCancel (this, ScResId(BTN_CANCEL)),
+ maBtnHelp (this, ScResId(BTN_HELP)),
+
+ maSelectLockedCells(ScResId(ST_SELECT_LOCKED_CELLS)),
+ maSelectUnlockedCells(ScResId(ST_SELECT_UNLOCKED_CELLS))
+{
+ Init();
+ FreeResource();
+}
+
+ScTableProtectionDlg::~ScTableProtectionDlg()
+{
+}
+
+short ScTableProtectionDlg::Execute()
+{
+ return ModalDialog::Execute();
+}
+
+void ScTableProtectionDlg::SetDialogData(const ScTableProtection& rData)
+{
+ for (USHORT i = 0; i < nOptionCount; ++i)
+ maOptionsListBox.CheckEntryPos(i, rData.isOptionEnabled(aOptions[i]));
+}
+
+void ScTableProtectionDlg::WriteData(ScTableProtection& rData) const
+{
+ rData.setProtected(maBtnProtect.IsChecked());
+
+ // We assume that the two password texts match.
+ rData.setPassword(maPassword1Edit.GetText());
+
+ for (USHORT i = 0; i < nOptionCount; ++i)
+ rData.setOption(aOptions[i], maOptionsListBox.IsChecked(i));
+}
+
+void ScTableProtectionDlg::Init()
+{
+ Link aLink = LINK( this, ScTableProtectionDlg, CheckBoxHdl );
+ maBtnProtect.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScTableProtectionDlg, OKHdl );
+ maBtnOk.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScTableProtectionDlg, PasswordModifyHdl );
+ maPassword1Edit.SetModifyHdl(aLink);
+ maPassword2Edit.SetModifyHdl(aLink);
+
+ maOptionsListBox.SetUpdateMode(false);
+ maOptionsListBox.Clear();
+
+ maOptionsListBox.InsertEntry(maSelectLockedCells);
+ maOptionsListBox.InsertEntry(maSelectUnlockedCells);
+
+ maOptionsListBox.CheckEntryPos(0, true);
+ maOptionsListBox.CheckEntryPos(1, true);
+
+ maOptionsListBox.SetUpdateMode(true);
+
+ // Set the default state of the dialog.
+ maBtnProtect.Check(true);
+ maPassword1Edit.GrabFocus();
+}
+
+void ScTableProtectionDlg::EnableOptionalWidgets(bool bEnable)
+{
+ maPassword1Text.Enable(bEnable);
+ maPassword1Edit.Enable(bEnable);
+ maPassword2Text.Enable(bEnable);
+ maPassword2Edit.Enable(bEnable);
+ maOptionsLine.Enable(bEnable);
+ maOptionsText.Enable(bEnable);
+
+ maOptionsListBox.Enable(bEnable);
+ maOptionsListBox.Invalidate();
+}
+
+IMPL_LINK( ScTableProtectionDlg, CheckBoxHdl, CheckBox*, pBtn )
+{
+ if (pBtn == &maBtnProtect)
+ {
+ bool bChecked = maBtnProtect.IsChecked();
+ EnableOptionalWidgets(bChecked);
+ maBtnOk.Enable(bChecked);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( ScTableProtectionDlg, OKHdl, OKButton*, EMPTYARG )
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+IMPL_LINK( ScTableProtectionDlg, PasswordModifyHdl, Edit*, EMPTYARG )
+{
+ String aPass1 = maPassword1Edit.GetText();
+ String aPass2 = maPassword2Edit.GetText();
+ maBtnOk.Enable(aPass1.Equals(aPass2));
+ return 0;
+}
diff --git a/sc/source/ui/miscdlgs/protectiondlg.src b/sc/source/ui/miscdlgs/protectiondlg.src
new file mode 100644
index 000000000000..4919f93ca6f4
--- /dev/null
+++ b/sc/source/ui/miscdlgs/protectiondlg.src
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.src,v $
+ * $Revision: 1.1.2.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "protectiondlg.hrc"
+
+ModalDialog RID_SCDLG_TABPROTECTION
+{
+ Text [ en-US ] = "Protect Sheet" ;
+ Size = MAP_APPFONT ( 220 , 135 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 164 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 164 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 164 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+
+ CheckBox BTN_PROTECT
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 150 , 10 );
+
+ Text [ en-US ] = "P~rotect this sheet and the contents of locked cells" ;
+ };
+
+ FixedText FT_PASSWORD1
+ {
+ Pos = MAP_APPFONT ( 11, 23 );
+ Size = MAP_APPFONT ( 42, 10 );
+
+ Text [ en-US ] = "~Password" ;
+ };
+
+ Edit ED_PASSWORD1
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT ( 56, 22 );
+ Size = MAP_APPFONT ( 75, 12 );
+ };
+
+ FixedText FT_PASSWORD2
+ {
+ Pos = MAP_APPFONT ( 11, 40 );
+ Size = MAP_APPFONT ( 42, 10 );
+
+ Text [ en-US ] = "~Confirm" ;
+ };
+
+ Edit ED_PASSWORD2
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT ( 56, 39 );
+ Size = MAP_APPFONT ( 75, 12 );
+ };
+
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6, 60 );
+ Size = MAP_APPFONT ( 150, 8 );
+
+ Text [ en-US ] = "Options";
+ };
+
+ FixedText FT_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 11, 74 );
+ Size = MAP_APPFONT ( 140, 8 );
+
+ Text [ en-US ] = "Allow all users of this sheet to:";
+ };
+
+ Control CLB_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 11, 85 );
+ Size = MAP_APPFONT ( 140, 40 );
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ String ST_SELECT_LOCKED_CELLS
+ {
+ Text [ en-US ] = "Select locked cells";
+ };
+
+ String ST_SELECT_UNLOCKED_CELLS
+ {
+ Text [ en-US ] = "Select unlocked cells";
+ };
+};
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx
new file mode 100644
index 000000000000..84a008f68f5f
--- /dev/null
+++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx
@@ -0,0 +1,547 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: retypepassdlg.cxx,v $
+ * $Revision: 1.1.2.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "retypepassdlg.hxx"
+#include "retypepassdlg.hrc"
+#include "scresid.hxx"
+#include "document.hxx"
+#include "tabprotection.hxx"
+
+#include <stdio.h>
+
+#include <vcl/msgbox.hxx>
+
+ScRetypePassDlg::ScRetypePassDlg(Window* pParent) :
+ ModalDialog(pParent, ScResId(RID_SCDLG_RETYPEPASS)),
+
+ maBtnOk (this, ScResId(BTN_OK)),
+ maBtnCancel (this, ScResId(BTN_CANCEL)),
+ maBtnHelp (this, ScResId(BTN_HELP)),
+
+ maTextDescription(this, ScResId(FT_DESC)),
+ maLineDocument(this, ScResId(FL_DOCUMENT)),
+ maTextDocStatus(this, ScResId(FT_DOCSTATUS)),
+ maBtnRetypeDoc(this, ScResId(BTN_RETYPE_DOC)),
+
+ maLineSheet(this, ScResId(FL_SHEET)),
+ maTextSheetName1(this, ScResId(FT_SHEETNAME1)),
+ maTextSheetStatus1(this, ScResId(FT_SHEETSTATUS1)),
+ maBtnRetypeSheet1(this, ScResId(BTN_RETYPE_SHEET1)),
+
+ maTextSheetName2(this, ScResId(FT_SHEETNAME2)),
+ maTextSheetStatus2(this, ScResId(FT_SHEETSTATUS2)),
+ maBtnRetypeSheet2(this, ScResId(BTN_RETYPE_SHEET2)),
+
+ maTextSheetName3(this, ScResId(FT_SHEETNAME3)),
+ maTextSheetStatus3(this, ScResId(FT_SHEETSTATUS3)),
+ maBtnRetypeSheet3(this, ScResId(BTN_RETYPE_SHEET3)),
+
+ maTextSheetName4(this, ScResId(FT_SHEETNAME4)),
+ maTextSheetStatus4(this, ScResId(FT_SHEETSTATUS4)),
+ maBtnRetypeSheet4(this, ScResId(BTN_RETYPE_SHEET4)),
+
+ maScrollBar (this, ScResId(SB_SCROLL)),
+
+ maTextNotProtected(ScResId(STR_NOT_PROTECTED)),
+ maTextNotPassProtected(ScResId(STR_NOT_PASS_PROTECTED)),
+ maTextHashBad(ScResId(STR_HASH_BAD)),
+ maTextHashGood(ScResId(STR_HASH_GOOD)),
+ maTextHashRegen(ScResId(STR_HASH_REGENERATED)),
+
+ mpDocItem(static_cast<ScDocProtection*>(NULL)),
+ mnCurScrollPos(0),
+ meDesiredHash(PASSHASH_OOO)
+{
+ Init();
+}
+
+ScRetypePassDlg::~ScRetypePassDlg()
+{
+}
+
+short ScRetypePassDlg::Execute()
+{
+ PopulateDialog();
+ CheckHashStatus();
+ return ModalDialog::Execute();
+}
+
+void ScRetypePassDlg::SetDataFromDocument(const ScDocument& rDoc)
+{
+ const ScDocProtection* pDocProtect = rDoc.GetDocProtection();
+ if (pDocProtect && pDocProtect->isProtected())
+ mpDocItem.reset(new ScDocProtection(*pDocProtect));
+
+ SCTAB nTabCount = rDoc.GetTableCount();
+ maTableItems.reserve(nTabCount);
+ for (SCTAB i = 0; i < nTabCount; ++i)
+ {
+ TableItem aTabItem;
+ rDoc.GetName(i, aTabItem.maName);
+
+ const ScTableProtection* pTabProtect = rDoc.GetTabProtection(i);
+ if (pTabProtect && pTabProtect->isProtected())
+ aTabItem.mpProtect.reset(new ScTableProtection(*pTabProtect));
+
+ maTableItems.push_back(aTabItem);
+ }
+}
+
+void ScRetypePassDlg::SetDesiredHash(ScPasswordHash eHash)
+{
+ meDesiredHash = eHash;
+}
+
+void ScRetypePassDlg::WriteNewDataToDocument(ScDocument& rDoc) const
+{
+ if (mpDocItem.get())
+ rDoc.SetDocProtection(mpDocItem.get());
+
+ size_t nTabCount = static_cast<size_t>(rDoc.GetTableCount());
+ size_t n = maTableItems.size();
+ for (size_t i = 0; i < n; ++i)
+ {
+ if (i >= nTabCount)
+ break;
+
+ ScTableProtection* pTabProtect = maTableItems[i].mpProtect.get();
+ if (pTabProtect)
+ rDoc.SetTabProtection(static_cast<SCTAB>(i), pTabProtect);
+ }
+}
+
+void ScRetypePassDlg::Init()
+{
+ Link aLink = LINK( this, ScRetypePassDlg, OKHdl );
+ maBtnOk.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScRetypePassDlg, RetypeBtnHdl );
+ maBtnRetypeDoc.SetClickHdl(aLink);
+ maBtnRetypeSheet1.SetClickHdl(aLink);
+ maBtnRetypeSheet2.SetClickHdl(aLink);
+ maBtnRetypeSheet3.SetClickHdl(aLink);
+ maBtnRetypeSheet4.SetClickHdl(aLink);
+
+ maTextDocStatus.SetText(maTextNotProtected);
+ maTextSheetStatus1.SetText(maTextNotProtected);
+ maTextSheetStatus2.SetText(maTextNotProtected);
+ maTextSheetStatus3.SetText(maTextNotProtected);
+ maTextSheetStatus4.SetText(maTextNotProtected);
+ maBtnRetypeDoc.Disable();
+
+ // Make all sheet rows invisible.
+
+ maTextSheetName1.Show(false);
+ maTextSheetStatus1.Show(false);
+ maBtnRetypeSheet1.Show(false);
+ maBtnRetypeSheet1.Disable();
+
+ maTextSheetName2.Show(false);
+ maTextSheetStatus2.Show(false);
+ maBtnRetypeSheet2.Show(false);
+ maBtnRetypeSheet2.Disable();
+
+ maTextSheetName3.Show(false);
+ maTextSheetStatus3.Show(false);
+ maBtnRetypeSheet3.Show(false);
+ maBtnRetypeSheet3.Disable();
+
+ maTextSheetName4.Show(false);
+ maTextSheetStatus4.Show(false);
+ maBtnRetypeSheet4.Show(false);
+ maBtnRetypeSheet4.Disable();
+
+ maScrollBar.Show(false);
+
+ maScrollBar.SetEndScrollHdl( LINK( this, ScRetypePassDlg, ScrollHdl ) );
+ maScrollBar.SetScrollHdl( LINK( this, ScRetypePassDlg, ScrollHdl ) );
+
+ maScrollBar.SetPageSize(4);
+ maScrollBar.SetVisibleSize(4);
+ maScrollBar.SetLineSize(1);
+}
+
+void ScRetypePassDlg::PopulateDialog()
+{
+ // Document protection first.
+ SetDocData();
+
+ // Sheet protection next. We're only interested in the first 4 sheets
+ // (or less).
+ size_t n = maTableItems.size();
+ for (size_t i = 0; i < n && i < 4; ++i)
+ SetTableData(i, static_cast< SCTAB >( i ));
+
+ if (n > 4)
+ {
+ maScrollBar.Show(true);
+ maScrollBar.SetRange(Range(0, n));
+ }
+}
+
+void ScRetypePassDlg::SetDocData()
+{
+ bool bBtnEnabled = false;
+ if (mpDocItem.get() && mpDocItem->isProtected())
+ {
+ if (mpDocItem->isPasswordEmpty())
+ maTextDocStatus.SetText(maTextNotPassProtected);
+ else if (mpDocItem->hasPasswordHash(meDesiredHash))
+ maTextDocStatus.SetText(maTextHashGood);
+ else
+ {
+ // incompatible hash
+ maTextDocStatus.SetText(maTextHashBad);
+ bBtnEnabled = true;
+ }
+ }
+ maBtnRetypeDoc.Enable(bBtnEnabled);
+}
+
+void ScRetypePassDlg::SetTableData(size_t nRowPos, SCTAB nTab)
+{
+ if (nRowPos >= 4)
+ return;
+
+ FixedText* pName = NULL;
+ FixedText* pStatus = NULL;
+ PushButton* pBtn = NULL;
+ switch (nRowPos)
+ {
+ case 0:
+ pName = &maTextSheetName1;
+ pStatus = &maTextSheetStatus1;
+ pBtn = &maBtnRetypeSheet1;
+ break;
+ case 1:
+ pName = &maTextSheetName2;
+ pStatus = &maTextSheetStatus2;
+ pBtn = &maBtnRetypeSheet2;
+ break;
+ case 2:
+ pName = &maTextSheetName3;
+ pStatus = &maTextSheetStatus3;
+ pBtn = &maBtnRetypeSheet3;
+ break;
+ case 3:
+ pName = &maTextSheetName4;
+ pStatus = &maTextSheetStatus4;
+ pBtn = &maBtnRetypeSheet4;
+ break;
+ default:
+ return;
+ }
+
+ bool bBtnEnabled = false;
+ pName->SetText(maTableItems[nTab].maName);
+ pName->Show(true);
+ const ScTableProtection* pTabProtect = maTableItems[nTab].mpProtect.get();
+ if (pTabProtect && pTabProtect->isProtected())
+ {
+ if (pTabProtect->isPasswordEmpty())
+ pStatus->SetText(maTextNotPassProtected);
+ else if (pTabProtect->hasPasswordHash(meDesiredHash))
+ pStatus->SetText(maTextHashGood);
+ else
+ {
+ // incompatible hash
+ pStatus->SetText(maTextHashBad);
+ bBtnEnabled = true;
+ }
+ }
+ else
+ pStatus->SetText(maTextNotProtected);
+
+ pStatus->Show(true);
+ pBtn->Show(true);
+ pBtn->Enable(bBtnEnabled);
+}
+
+void ScRetypePassDlg::ResetTableRows()
+{
+ long nScrollPos = maScrollBar.GetThumbPos();
+ mnCurScrollPos = nScrollPos < 0 ? 0 : nScrollPos;
+ size_t nRowCount = maTableItems.size() - nScrollPos;
+ for (size_t i = 0; i < nRowCount; ++i)
+ SetTableData(i, static_cast< SCTAB >( i + nScrollPos ));
+}
+
+bool lcl_IsInGoodStatus(ScPassHashProtectable* pProtected, ScPasswordHash eDesiredHash)
+{
+ if (!pProtected || !pProtected->isProtected())
+ // Not protected.
+ return true;
+
+ if (pProtected->isPasswordEmpty())
+ return true;
+
+ if (pProtected->hasPasswordHash(eDesiredHash))
+ return true;
+
+ return false;
+}
+
+void ScRetypePassDlg::CheckHashStatus()
+{
+ do
+ {
+ if (!lcl_IsInGoodStatus(mpDocItem.get(), meDesiredHash))
+ break;
+
+ bool bStatusGood = true;
+ size_t nTabCount = maTableItems.size();
+ for (size_t i = 0; i < nTabCount && bStatusGood; ++i)
+ {
+ if (!lcl_IsInGoodStatus(maTableItems[i].mpProtect.get(), meDesiredHash))
+ bStatusGood = false;
+ }
+ if (!bStatusGood)
+ break;
+
+ maBtnOk.Enable();
+ return;
+ }
+ while (false);
+
+ maBtnOk.Disable();
+}
+
+IMPL_LINK( ScRetypePassDlg, OKHdl, OKButton*, EMPTYARG )
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassDlg, RetypeBtnHdl, PushButton*, pBtn )
+{
+ ScPassHashProtectable* pProtected = NULL;
+ if (pBtn == &maBtnRetypeDoc)
+ {
+ // document protection.
+ pProtected = mpDocItem.get();
+ }
+ else
+ {
+ // sheet protection.
+ size_t nTabPos = mnCurScrollPos;
+ if (pBtn == &maBtnRetypeSheet2)
+ nTabPos += 1;
+ else if (pBtn == &maBtnRetypeSheet3)
+ nTabPos += 2;
+ else if (pBtn == &maBtnRetypeSheet4)
+ nTabPos += 3;
+ else if (pBtn != &maBtnRetypeSheet1)
+ // This should never happen !
+ return 0;
+
+ if (nTabPos >= maTableItems.size())
+ // Likewise, this should never happen !
+ return 0;
+
+ pProtected = maTableItems[nTabPos].mpProtect.get();
+ }
+
+ if (!pProtected)
+ // What the ... !?
+ return 0;
+
+ ScRetypePassInputDlg aDlg(this, pProtected);
+ if (aDlg.Execute() == RET_OK)
+ {
+ // OK is pressed. Update the protected item.
+ if (aDlg.IsRemovePassword())
+ {
+ // Remove password from this item.
+ pProtected->setPassword(String());
+ }
+ else
+ {
+ // Set a new password.
+ String aNewPass = aDlg.GetNewPassword();
+ pProtected->setPassword(aNewPass);
+ }
+
+ SetDocData();
+ ResetTableRows();
+ CheckHashStatus();
+ }
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassDlg, ScrollHdl, ScrollBar*, EMPTYARG )
+{
+ ResetTableRows();
+ return 0;
+}
+
+// ============================================================================
+
+ScRetypePassInputDlg::ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected) :
+ ModalDialog(pParent, ScResId(RID_SCDLG_RETYPEPASS_INPUT)),
+
+ maBtnOk (this, ScResId(BTN_OK)),
+ maBtnCancel (this, ScResId(BTN_CANCEL)),
+ maBtnHelp (this, ScResId(BTN_HELP)),
+
+ maBtnRetypePassword(this, ScResId(BTN_RETYPE_PASSWORD)),
+
+ maPassword1Text (this, ScResId(FT_PASSWORD1)),
+ maPassword1Edit (this, ScResId(ED_PASSWORD1)),
+ maPassword2Text (this, ScResId(FT_PASSWORD2)),
+ maPassword2Edit (this, ScResId(ED_PASSWORD2)),
+ maBtnMatchOldPass(this, ScResId(BTN_MATCH_OLD_PASSWORD)),
+
+ maBtnRemovePassword(this, ScResId(BTN_REMOVE_PASSWORD)),
+
+ mpProtected(pProtected)
+{
+ Init();
+}
+
+ScRetypePassInputDlg::~ScRetypePassInputDlg()
+{
+}
+
+short ScRetypePassInputDlg::Execute()
+{
+ return ModalDialog::Execute();
+}
+
+bool ScRetypePassInputDlg::IsRemovePassword() const
+{
+ return maBtnRemovePassword.IsChecked();
+}
+
+String ScRetypePassInputDlg::GetNewPassword() const
+{
+ return maPassword1Edit.GetText();
+}
+
+void ScRetypePassInputDlg::Init()
+{
+ Link aLink = LINK( this, ScRetypePassInputDlg, OKHdl );
+ maBtnOk.SetClickHdl(aLink);
+ aLink = LINK( this, ScRetypePassInputDlg, RadioBtnHdl );
+ maBtnRetypePassword.SetClickHdl(aLink);
+ maBtnRemovePassword.SetClickHdl(aLink);
+ aLink = LINK( this, ScRetypePassInputDlg, CheckBoxHdl );
+ maBtnMatchOldPass.SetClickHdl(aLink);
+ aLink = LINK( this, ScRetypePassInputDlg, PasswordModifyHdl );
+ maPassword1Edit.SetModifyHdl(aLink);
+ maPassword2Edit.SetModifyHdl(aLink);
+
+ maBtnOk.Disable();
+ maBtnRetypePassword.Check(true);
+ maBtnMatchOldPass.Check(true);
+ maPassword1Edit.GrabFocus();
+}
+
+void ScRetypePassInputDlg::CheckPasswordInput()
+{
+ String aPass1 = maPassword1Edit.GetText();
+ String aPass2 = maPassword2Edit.GetText();
+
+ if (!aPass1.Len() || !aPass2.Len())
+ {
+ // Empty password is not allowed.
+ maBtnOk.Disable();
+ return;
+ }
+
+ if (!aPass1.Equals(aPass2))
+ {
+ // The two passwords differ.
+ maBtnOk.Disable();
+ return;
+ }
+
+ if (!maBtnMatchOldPass.IsChecked())
+ {
+ maBtnOk.Enable();
+ return;
+ }
+
+ if (!mpProtected)
+ {
+ // This should never happen!
+ maBtnOk.Disable();
+ return;
+ }
+
+ bool bPassGood = mpProtected->verifyPassword(aPass1);
+ maBtnOk.Enable(bPassGood);
+}
+
+IMPL_LINK( ScRetypePassInputDlg, OKHdl, OKButton*, EMPTYARG )
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassInputDlg, RadioBtnHdl, RadioButton*, pBtn )
+{
+ if (pBtn == &maBtnRetypePassword)
+ {
+ maBtnRemovePassword.Check(false);
+ maPassword1Text.Enable();
+ maPassword1Edit.Enable();
+ maPassword2Text.Enable();
+ maPassword2Edit.Enable();
+ maBtnMatchOldPass.Enable();
+ CheckPasswordInput();
+ }
+ else if (pBtn == &maBtnRemovePassword)
+ {
+ maBtnRetypePassword.Check(false);
+ maPassword1Text.Disable();
+ maPassword1Edit.Disable();
+ maPassword2Text.Disable();
+ maPassword2Edit.Disable();
+ maBtnMatchOldPass.Disable();
+ maBtnOk.Enable();
+ }
+
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassInputDlg, CheckBoxHdl, CheckBox*, EMPTYARG )
+{
+ CheckPasswordInput();
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassInputDlg, PasswordModifyHdl, Edit*, EMPTYARG )
+{
+ CheckPasswordInput();
+ return 0;
+}
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.src b/sc/source/ui/miscdlgs/retypepassdlg.src
new file mode 100644
index 000000000000..87d436881f69
--- /dev/null
+++ b/sc/source/ui/miscdlgs/retypepassdlg.src
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: retypepassdlg.src,v $
+ * $Revision: 1.1.2.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "retypepassdlg.hrc"
+
+
+ModalDialog RID_SCDLG_RETYPEPASS
+{
+ Text [ en-US ] = "Re-type Password" ;
+ Size = MAP_APPFONT ( 260 , 165 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 204, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 204, 23 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ };
+
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 204, 43 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ };
+
+ FixedText FT_DESC
+ {
+ Pos = MAP_APPFONT ( 6, 6 ) ;
+ Size = MAP_APPFONT ( 190, 36 );
+
+ WordBreak = TRUE ;
+
+ Text [ en-US ] = "The document you are about to export has one or more protected items with password that cannot be exported. Please re-type your password to be able to export your document." ;
+ };
+
+ FixedLine FL_DOCUMENT
+ {
+ Pos = MAP_APPFONT ( 6, 48 );
+ Size = MAP_APPFONT ( 190, 8 );
+
+ Text [ en-US ] = "Document protection" ;
+ };
+
+ FixedText FT_DOCSTATUS
+ {
+ Pos = MAP_APPFONT ( 10, 62 );
+ Size = MAP_APPFONT ( 140, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_DOC
+ {
+ Pos = MAP_APPFONT ( 158, 59 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ FixedLine FL_SHEET
+ {
+ Pos = MAP_APPFONT ( 6, 83 );
+ Size = MAP_APPFONT ( 190, 8 );
+
+ Text [ en-US ] = "Sheet protection" ;
+ };
+
+ FixedText FT_SHEETNAME1
+ {
+ Pos = MAP_APPFONT ( 10, 97 );
+ Size = MAP_APPFONT ( 68, 8 );
+
+ Text [ en-US ] = "Sheet1 has a really long name" ;
+ };
+
+ FixedText FT_SHEETSTATUS1
+ {
+ Pos = MAP_APPFONT ( 82, 97 );
+ Size = MAP_APPFONT ( 72, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_SHEET1
+ {
+ Pos = MAP_APPFONT ( 158, 94 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ FixedText FT_SHEETNAME2
+ {
+ Pos = MAP_APPFONT ( 10, 113 );
+ Size = MAP_APPFONT ( 68, 8 );
+
+ Text [ en-US ] = "Sheet2" ;
+ };
+
+ FixedText FT_SHEETSTATUS2
+ {
+ Pos = MAP_APPFONT ( 82, 113 );
+ Size = MAP_APPFONT ( 72, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_SHEET2
+ {
+ Pos = MAP_APPFONT ( 158, 110 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ FixedText FT_SHEETNAME3
+ {
+ Pos = MAP_APPFONT ( 10, 129 );
+ Size = MAP_APPFONT ( 68, 8 );
+
+ Text [ en-US ] = "Sheet3" ;
+ };
+
+ FixedText FT_SHEETSTATUS3
+ {
+ Pos = MAP_APPFONT ( 82, 129 );
+ Size = MAP_APPFONT ( 72, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_SHEET3
+ {
+ Pos = MAP_APPFONT ( 158, 126 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ FixedText FT_SHEETNAME4
+ {
+ Pos = MAP_APPFONT ( 10, 145 );
+ Size = MAP_APPFONT ( 68, 8 );
+
+ Text [ en-US ] = "Sheet4" ;
+ };
+
+ FixedText FT_SHEETSTATUS4
+ {
+ Pos = MAP_APPFONT ( 82, 145 );
+ Size = MAP_APPFONT ( 72, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_SHEET4
+ {
+ Pos = MAP_APPFONT ( 158, 142 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ ScrollBar SB_SCROLL
+ {
+ Pos = MAP_APPFONT ( 190, 94 ) ;
+ Size = MAP_APPFONT ( 8, 61 ) ;
+ VScroll = TRUE ;
+ };
+
+ String STR_NOT_PROTECTED
+ {
+ Text [ en-US ] = "Not protected" ;
+ };
+
+ String STR_NOT_PASS_PROTECTED
+ {
+ Text [ en-US ] = "Not password-protected" ;
+ };
+
+ String STR_HASH_BAD
+ {
+ Text [ en-US ] = "Hash incompatible" ;
+ };
+
+ String STR_HASH_GOOD
+ {
+ Text [ en-US ] = "Hash compatible" ;
+ };
+
+ String STR_HASH_REGENERATED
+ {
+ Text [ en-US ] = "Hash re-generated" ;
+ };
+};
+
+// ----------------------------------------------------------------------------
+
+ModalDialog RID_SCDLG_RETYPEPASS_INPUT
+{
+ Text [ en-US ] = "Re-type Password" ;
+ Size = MAP_APPFONT ( 230 , 110 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 174, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 174, 23 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ };
+
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 174, 43 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ };
+
+ RadioButton BTN_RETYPE_PASSWORD
+ {
+ Pos = MAP_APPFONT ( 11, 10 );
+ Size = MAP_APPFONT ( 150, 10 );
+
+ Text [ en-US ] = "Re-type password" ;
+ };
+
+ FixedText FT_PASSWORD1
+ {
+ Pos = MAP_APPFONT ( 20, 30 );
+ Size = MAP_APPFONT ( 42, 10 );
+
+ Text [ en-US ] = "~Password" ;
+ };
+
+ Edit ED_PASSWORD1
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT ( 65, 29 );
+ Size = MAP_APPFONT ( 75, 12 );
+ };
+
+ FixedText FT_PASSWORD2
+ {
+ Pos = MAP_APPFONT ( 20, 45 );
+ Size = MAP_APPFONT ( 42, 10 );
+
+ Text [ en-US ] = "~Confirm" ;
+ };
+
+ Edit ED_PASSWORD2
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT ( 65, 44 );
+ Size = MAP_APPFONT ( 75, 12 );
+ };
+
+ CheckBox BTN_MATCH_OLD_PASSWORD
+ {
+ Pos = MAP_APPFONT ( 20, 65 );
+ Size = MAP_APPFONT ( 150, 10 );
+
+ Text [ en-US ] = "New password must match the original password." ;
+ };
+
+ RadioButton BTN_REMOVE_PASSWORD
+ {
+ Pos = MAP_APPFONT ( 11, 90 );
+ Size = MAP_APPFONT ( 150, 10 );
+
+ Text [ en-US ] = "Remove password from this protected item." ;
+ };
+};
+
+
diff --git a/sc/source/ui/src/filter.src b/sc/source/ui/src/filter.src
index 73108b984ebe..2e6a1c330671 100644
--- a/sc/source/ui/src/filter.src
+++ b/sc/source/ui/src/filter.src
@@ -34,7 +34,7 @@ ModelessDialog RID_SCDLG_FILTER
HelpId = SID_FILTER ;
Hide = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 251 , 121 ) ;
+ Size = MAP_APPFONT ( 279 , 121 ) ;
Text [ en-US ] = "Standard Filter" ;
Moveable = TRUE ;
Closeable = FALSE ;
@@ -58,7 +58,7 @@ ModelessDialog RID_SCDLG_FILTER
};
FixedText FT_VAL
{
- Pos = MAP_APPFONT ( 173 , 14 ) ;
+ Pos = MAP_APPFONT ( 201 , 14 ) ;
Size = MAP_APPFONT ( 60 , 8 ) ;
Text [ en-US ] = "Value" ;
};
@@ -150,7 +150,7 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 25 ) ;
- Size = MAP_APPFONT ( 47 , 145 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -165,13 +165,19 @@ ModelessDialog RID_SCDLG_FILTER
< "Smallest" ; Default ; > ;
< "Largest %" ; Default ; > ;
< "Smallest %" ; Default ; > ;
+ < "Contains" ; Default ; > ;
+ < "Does not contain" ; Default ; > ;
+ < "Begins with" ; Default ; > ;
+ < "Does not begin with" ; Default ; > ;
+ < "Ends with" ; Default ; > ;
+ < "Does not end with" ; Default ; > ;
};
};
ListBox LB_COND2
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 41 ) ;
- Size = MAP_APPFONT ( 47 , 145 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -186,13 +192,19 @@ ModelessDialog RID_SCDLG_FILTER
< "Smallest" ; Default ; > ;
< "Largest %" ; Default ; > ;
< "Smallest %" ; Default ; > ;
+ < "Contains" ; Default ; > ;
+ < "Does not contain" ; Default ; > ;
+ < "Begins with" ; Default ; > ;
+ < "Does not begin with" ; Default ; > ;
+ < "Ends with" ; Default ; > ;
+ < "Does not end with" ; Default ; > ;
};
};
ListBox LB_COND3
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 57 ) ;
- Size = MAP_APPFONT ( 47 , 145 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -207,13 +219,19 @@ ModelessDialog RID_SCDLG_FILTER
< "Smallest" ; Default ; > ;
< "Largest %" ; Default ; > ;
< "Smallest %" ; Default ; > ;
+ < "Contains" ; Default ; > ;
+ < "Does not contain" ; Default ; > ;
+ < "Begins with" ; Default ; > ;
+ < "Does not begin with" ; Default ; > ;
+ < "Ends with" ; Default ; > ;
+ < "Does not end with" ; Default ; > ;
};
};
ListBox LB_COND4
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 73 ) ;
- Size = MAP_APPFONT ( 47 , 145 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -228,39 +246,45 @@ ModelessDialog RID_SCDLG_FILTER
< "Smallest" ; Default ; > ;
< "Largest %" ; Default ; > ;
< "Smallest %" ; Default ; > ;
+ < "Contains" ; Default ; > ;
+ < "Does not contain" ; Default ; > ;
+ < "Begins with" ; Default ; > ;
+ < "Does not begin with" ; Default ; > ;
+ < "Ends with" ; Default ; > ;
+ < "Does not end with" ; Default ; > ;
};
};
ComboBox ED_VAL1
{
- Pos = MAP_APPFONT ( 173 , 25 ) ;
+ Pos = MAP_APPFONT ( 201 , 25 ) ;
Size = MAP_APPFONT ( 60 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
ComboBox ED_VAL2
{
- Pos = MAP_APPFONT ( 173 , 41 ) ;
+ Pos = MAP_APPFONT ( 201 , 41 ) ;
Size = MAP_APPFONT ( 60 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
ComboBox ED_VAL3
{
- Pos = MAP_APPFONT ( 173 , 57 ) ;
+ Pos = MAP_APPFONT ( 201 , 57 ) ;
Size = MAP_APPFONT ( 60 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
ComboBox ED_VAL4
{
- Pos = MAP_APPFONT ( 173 , 73 ) ;
+ Pos = MAP_APPFONT ( 201 , 73 ) ;
Size = MAP_APPFONT ( 60 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
ScrollBar LB_SCROLL
{
- Pos = MAP_APPFONT ( 237, 25 ) ;
+ Pos = MAP_APPFONT ( 265, 25 ) ;
Size = MAP_APPFONT ( 8 , 60 ) ;
TabStop = TRUE ;
VScroll = TRUE ;
@@ -269,7 +293,7 @@ ModelessDialog RID_SCDLG_FILTER
FixedLine FL_CRITERIA
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 275 , 8 ) ;
+ Size = MAP_APPFONT ( 267 , 8 ) ;
Text [ en-US ] = "Filter criteria";
};
CheckBox BTN_CASE
@@ -325,7 +349,7 @@ ModelessDialog RID_SCDLG_FILTER
Border = TRUE ;
Hide = TRUE ;
Pos = MAP_APPFONT ( 21 , 170 ) ;
- Size = MAP_APPFONT ( 90 , 90 ) ;
+ Size = MAP_APPFONT ( 110 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
@@ -333,13 +357,13 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Hide = TRUE ;
- Pos = MAP_APPFONT ( 115 , 170 ) ;
- Size = MAP_APPFONT ( 104 , 12 ) ;
+ Pos = MAP_APPFONT ( 136 , 170 ) ;
+ Size = MAP_APPFONT ( 110 , 12 ) ;
TabStop = TRUE ;
};
ImageButton RB_COPY_AREA
{
- Pos = MAP_APPFONT ( 221 , 169 ) ;
+ Pos = MAP_APPFONT ( 248 , 169 ) ;
Size = MAP_APPFONT ( 13 , 15 ) ;
TabStop = FALSE ;
QuickHelpText [ en-US ] = "Shrink" ;
@@ -348,7 +372,7 @@ ModelessDialog RID_SCDLG_FILTER
{
Hide = TRUE ;
Pos = MAP_APPFONT ( 6 , 118 ) ;
- Size = MAP_APPFONT ( 239 , 8 ) ;
+ Size = MAP_APPFONT ( 267 , 8 ) ;
};
FixedText FT_DBAREA
{
@@ -367,14 +391,14 @@ ModelessDialog RID_SCDLG_FILTER
};
OKButton BTN_OK
{
- Pos = MAP_APPFONT ( 141 , 101 ) ;
+ Pos = MAP_APPFONT ( 169 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton BTN_CANCEL
{
- Pos = MAP_APPFONT ( 195 , 101 ) ;
+ Pos = MAP_APPFONT ( 223 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
@@ -395,7 +419,7 @@ ModelessDialog RID_SCDLG_FILTER
FixedLine FL_SEPARATOR
{
Pos = MAP_APPFONT ( 0 , 91 ) ;
- Size = MAP_APPFONT ( 251 , 6 ) ;
+ Size = MAP_APPFONT ( 279 , 6 ) ;
};
};
//============================================================================
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 5166340b189e..c5b8cfd1a9e8 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -438,10 +438,6 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "Cell merge not possible if cells already merged!" ;
};
- String STR_MSSG_APPLYPATTLINES_0
- {
- Text [ en-US ] = "Cannot apply borders to multiple selection" ;
- };
String STR_MSSG_INSERTCELLS_0
{
Text [ en-US ] = "Inserting into merged ranges not possible" ;
diff --git a/sc/source/ui/src/sortdlg.src b/sc/source/ui/src/sortdlg.src
index 2fed10c6f220..71aa7b594575 100644
--- a/sc/source/ui/src/sortdlg.src
+++ b/sc/source/ui/src/sortdlg.src
@@ -304,4 +304,48 @@ TabDialog RID_SCDLG_SORT
};
};
+ModalDialog RID_SCDLG_SORT_WARNING
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 91 ) ;
+ Text [ en-US ] = "Sort Range" ;
+ Moveable = TRUE ;
+ Closeable = FALSE ;
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 8 , 3 ) ;
+ Size = MAP_APPFONT ( 170 , 33 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "The cells next to the current selection also contain data. Do you want to extend the sort range to %1, or sort the currently selected range, %2?";
+ };
+ FixedText FT_TIP
+ {
+ Pos = MAP_APPFONT ( 8 , 55 ) ;
+ Size = MAP_APPFONT ( 170 , 33 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Tip: The sort range can be detected automatically. Place the cell cursor inside a list and execute sort. The whole range of neighboring non-empty cells will then be sorted.";
+ };
+ PushButton BTN_EXTSORT
+ {
+ Pos = MAP_APPFONT ( 6 , 39 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "Extend selection";
+ };
+ PushButton BTN_CURSORT
+ {
+ Pos = MAP_APPFONT ( 70 , 39 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Current selection";
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 134 , 39 ) ;
+ Size = MAP_APPFONT ( 40 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index f12dcda35c8f..ea1e303d6ae3 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -74,6 +74,7 @@ TYPEINIT1(ScUndoAutoFormat, SfxUndoAction);
TYPEINIT1(ScUndoReplace, SfxUndoAction);
TYPEINIT1(ScUndoTabOp, SfxUndoAction);
TYPEINIT1(ScUndoConversion, SfxUndoAction);
+TYPEINIT1(ScUndoRefConversion, SfxUndoAction);
TYPEINIT1(ScUndoRefreshLink, SfxUndoAction);
TYPEINIT1(ScUndoInsertAreaLink, SfxUndoAction);
TYPEINIT1(ScUndoRemoveAreaLink, SfxUndoAction);
@@ -1197,14 +1198,10 @@ void __EXPORT ScUndoReplace::Undo()
}
else if (pSearchItem->GetCellType() == SVX_SEARCHIN_NOTE)
{
- if (ScPostIt* pNote = pDoc->GetNote(aCursorPos))
- {
- pNote->SetText( aUndoStr );
- }
- else
- {
- DBG_ERROR("ScUndoReplace: Hier ist keine Notizzelle");
- }
+ ScPostIt* pNote = pDoc->GetNote( aCursorPos );
+ DBG_ASSERT( pNote, "ScUndoReplace::Undo - cell does not contain a note" );
+ if (pNote)
+ pNote->SetText( aCursorPos, aUndoStr );
if (pViewShell)
pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
SC_FOLLOW_JUMP, FALSE, FALSE );
@@ -1531,6 +1528,98 @@ BOOL ScUndoConversion::CanRepeat(SfxRepeatTarget& rTarget) const
//============================================================================
+// class ScUndoRefConversion
+//
+// cell reference conversion
+
+//----------------------------------------------------------------------------
+
+ScUndoRefConversion::ScUndoRefConversion( ScDocShell* pNewDocShell,
+ const ScRange& aMarkRange, const ScMarkData& rMark,
+ ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc, BOOL bNewMulti, USHORT nNewFlag) :
+ScSimpleUndo( pNewDocShell ),
+aMarkData ( rMark ),
+pUndoDoc ( pNewUndoDoc ),
+pRedoDoc ( pNewRedoDoc ),
+aRange ( aMarkRange ),
+bMulti ( bNewMulti ),
+nFlags ( nNewFlag )
+{
+ SetChangeTrack();
+}
+
+__EXPORT ScUndoRefConversion::~ScUndoRefConversion()
+{
+ delete pUndoDoc;
+ delete pRedoDoc;
+}
+
+String __EXPORT ScUndoRefConversion::GetComment() const
+{
+ return ScGlobal::GetRscString( STR_UNDO_ENTERDATA ); // "Eingabe"
+}
+
+void ScUndoRefConversion::SetChangeTrack()
+{
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ if ( pChangeTrack && (nFlags & IDF_FORMULA) )
+ pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
+ nStartChangeAction, nEndChangeAction );
+ else
+ nStartChangeAction = nEndChangeAction = 0;
+}
+
+void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
+{
+ ScDocument* pDoc = pDocShell->GetDocument();
+
+ ShowTable(aRange);
+
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (pViewShell)
+ pViewShell->SetMarkData( aMarkData );
+
+ ScRange aCopyRange = aRange;
+ SCTAB nTabCount = pDoc->GetTableCount();
+ aCopyRange.aStart.SetTab(0);
+ aCopyRange.aEnd.SetTab(nTabCount-1);
+ pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, pDoc, &aMarkData );
+ pDocShell->PostPaint( aRange, PAINT_GRID);
+ pDocShell->PostDataChanged();
+ if (pViewShell)
+ pViewShell->CellContentChanged();
+}
+void __EXPORT ScUndoRefConversion::Undo()
+{
+ BeginUndo();
+ if (pUndoDoc)
+ DoChange(pUndoDoc);
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ if ( pChangeTrack )
+ pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
+ EndUndo();
+}
+
+void __EXPORT ScUndoRefConversion::Redo()
+{
+ BeginRedo();
+ if (pRedoDoc)
+ DoChange(pRedoDoc);
+ SetChangeTrack();
+ EndRedo();
+}
+
+void __EXPORT ScUndoRefConversion::Repeat(SfxRepeatTarget& rTarget)
+{
+ if (rTarget.ISA(ScTabViewTarget))
+ ((ScTabViewTarget&)rTarget).GetViewShell()->DoRefConversion();
+}
+
+BOOL __EXPORT ScUndoRefConversion::CanRepeat(SfxRepeatTarget& rTarget) const
+{
+ return (rTarget.ISA(ScTabViewTarget));
+}
+//============================================================================
// class ScUndoRefreshLink
//
// Link aktualisieren / aendern
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index d1a59e65fdb0..eb23516cafeb 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -829,6 +829,7 @@ ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rP
mpDrawUndo( pDrawUndo )
{
DBG_ASSERT( maOldData.mpCaption || maNewData.mpCaption, "ScUndoReplaceNote::ScUndoReplaceNote - missing note captions" );
+ DBG_ASSERT( !maOldData.mxInitData.get() && !maNewData.mxInitData.get(), "ScUndoReplaceNote::ScUndoReplaceNote - unexpected unitialized note" );
}
ScUndoReplaceNote::~ScUndoReplaceNote()
@@ -883,7 +884,7 @@ void ScUndoReplaceNote::DoInsertNote( const ScNoteData& rNoteData )
{
ScDocument& rDoc = *pDocShell->GetDocument();
DBG_ASSERT( !rDoc.GetNote( maPos ), "ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
- ScPostIt* pNote = new ScPostIt( rDoc, rNoteData );
+ ScPostIt* pNote = new ScPostIt( rDoc, maPos, rNoteData, false );
rDoc.TakeNote( maPos, pNote );
}
}
@@ -896,7 +897,9 @@ void ScUndoReplaceNote::DoRemoveNote( const ScNoteData& rNoteData )
DBG_ASSERT( rDoc.GetNote( maPos ), "ScUndoReplaceNote::DoRemoveNote - missing cell note" );
if( ScPostIt* pNote = rDoc.ReleaseNote( maPos ) )
{
- // forget caption (already handled in drawing undo)
+ /* Forget pointer to caption object to suppress removing the
+ caption object from the drawing layer while deleting pNote
+ (removing the caption is done by a drawing undo action). */
pNote->ForgetCaption();
delete pNote;
}
@@ -920,7 +923,7 @@ void ScUndoShowHideNote::Undo()
{
BeginUndo();
if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( maPos ) )
- pNote->ShowCaption( !mbShown );
+ pNote->ShowCaption( maPos, !mbShown );
EndUndo();
}
@@ -928,7 +931,7 @@ void ScUndoShowHideNote::Redo()
{
BeginRedo();
if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( maPos ) )
- pNote->ShowCaption( mbShown );
+ pNote->ShowCaption( maPos, mbShown );
EndRedo();
}
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index d3ff10783c27..abd6f815abf9 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -61,6 +61,7 @@
#include "prnsave.hxx"
#include "printfun.hxx"
#include "chgtrack.hxx"
+#include "tabprotection.hxx"
// for ScUndoRenameObject - might me moved to another file later
#include <svx/svditer.hxx>
@@ -72,6 +73,8 @@
extern BOOL bDrawIsInUndo; //! irgendwo als Member !!!
using namespace com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::std::auto_ptr;
// STATIC DATA -----------------------------------------------------------
@@ -85,7 +88,6 @@ TYPEINIT1(ScUndoMakeScenario, SfxUndoAction);
TYPEINIT1(ScUndoImportTab, SfxUndoAction);
TYPEINIT1(ScUndoRemoveLink, SfxUndoAction);
TYPEINIT1(ScUndoShowHideTab, SfxUndoAction);
-TYPEINIT1(ScUndoProtect, SfxUndoAction);
TYPEINIT1(ScUndoPrintRange, SfxUndoAction);
TYPEINIT1(ScUndoScenarioFlags, SfxUndoAction);
TYPEINIT1(ScUndoRenameObject, SfxUndoAction);
@@ -112,12 +114,12 @@ ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell,
SetChangeTrack();
}
-__EXPORT ScUndoInsertTab::~ScUndoInsertTab()
+ScUndoInsertTab::~ScUndoInsertTab()
{
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoInsertTab::GetComment() const
+String ScUndoInsertTab::GetComment() const
{
if (bAppend)
return ScGlobal::GetRscString( STR_UNDO_APPEND_TAB );
@@ -138,7 +140,7 @@ void ScUndoInsertTab::SetChangeTrack()
nEndChangeAction = 0;
}
-void __EXPORT ScUndoInsertTab::Undo()
+void ScUndoInsertTab::Undo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
pViewShell->SetTabNo(nTab);
@@ -159,7 +161,7 @@ void __EXPORT ScUndoInsertTab::Undo()
pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
}
-void __EXPORT ScUndoInsertTab::Redo()
+void ScUndoInsertTab::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -180,14 +182,14 @@ void __EXPORT ScUndoInsertTab::Redo()
SetChangeTrack();
}
-void __EXPORT ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoInsertTab::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoInsertTab::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -211,7 +213,7 @@ ScUndoInsertTables::ScUndoInsertTables( ScDocShell* pNewDocShell,
SetChangeTrack();
}
-__EXPORT ScUndoInsertTables::~ScUndoInsertTables()
+ScUndoInsertTables::~ScUndoInsertTables()
{
String *pStr=NULL;
if(pNameList!=NULL)
@@ -227,7 +229,7 @@ __EXPORT ScUndoInsertTables::~ScUndoInsertTables()
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoInsertTables::GetComment() const
+String ScUndoInsertTables::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
}
@@ -252,7 +254,7 @@ void ScUndoInsertTables::SetChangeTrack()
nStartChangeAction = nEndChangeAction = 0;
}
-void __EXPORT ScUndoInsertTables::Undo()
+void ScUndoInsertTables::Undo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
pViewShell->SetTabNo(nTab);
@@ -282,7 +284,7 @@ void __EXPORT ScUndoInsertTables::Undo()
pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
}
-void __EXPORT ScUndoInsertTables::Redo()
+void ScUndoInsertTables::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -299,14 +301,14 @@ void __EXPORT ScUndoInsertTables::Redo()
SetChangeTrack();
}
-void __EXPORT ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -327,12 +329,12 @@ ScUndoDeleteTab::ScUndoDeleteTab( ScDocShell* pNewDocShell,const SvShorts &aTab,
SetChangeTrack();
}
-__EXPORT ScUndoDeleteTab::~ScUndoDeleteTab()
+ScUndoDeleteTab::~ScUndoDeleteTab()
{
theTabs.Remove(0,theTabs.Count());
}
-String __EXPORT ScUndoDeleteTab::GetComment() const
+String ScUndoDeleteTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_DELETE_TAB );
}
@@ -366,7 +368,7 @@ SCTAB lcl_GetVisibleTabBefore( ScDocument& rDoc, SCTAB nTab )
return nTab;
}
-void __EXPORT ScUndoDeleteTab::Undo()
+void ScUndoDeleteTab::Undo()
{
BeginUndo();
int i=0;
@@ -414,7 +416,7 @@ void __EXPORT ScUndoDeleteTab::Undo()
pDoc->SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
if ( pRefUndoDoc->IsTabProtected( nTab ) )
- pDoc->SetTabProtection( nTab, TRUE, pRefUndoDoc->GetTabPassword( nTab ) );
+ pDoc->SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
// Drawing-Layer passiert beim MoveUndo::EndUndo
// pDoc->TransferDrawPage(pRefUndoDoc, nTab,nTab);
@@ -450,7 +452,7 @@ void __EXPORT ScUndoDeleteTab::Undo()
// EndUndo();
}
-void __EXPORT ScUndoDeleteTab::Redo()
+void ScUndoDeleteTab::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDocShell->GetDocument(), theTabs[0] ) );
@@ -469,7 +471,7 @@ void __EXPORT ScUndoDeleteTab::Redo()
pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
}
-void __EXPORT ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
@@ -478,7 +480,7 @@ void __EXPORT ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
}
}
-BOOL __EXPORT ScUndoDeleteTab::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoDeleteTab::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -500,11 +502,11 @@ ScUndoRenameTab::ScUndoRenameTab( ScDocShell* pNewDocShell,
sNewName = rNewName;
}
-__EXPORT ScUndoRenameTab::~ScUndoRenameTab()
+ScUndoRenameTab::~ScUndoRenameTab()
{
}
-String __EXPORT ScUndoRenameTab::GetComment() const
+String ScUndoRenameTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_RENAME_TAB );
}
@@ -526,22 +528,22 @@ void ScUndoRenameTab::DoChange( SCTAB nTabP, const String& rName ) const
pViewShell->UpdateInputHandler();
}
-void __EXPORT ScUndoRenameTab::Undo()
+void ScUndoRenameTab::Undo()
{
DoChange(nTab, sOldName);
}
-void __EXPORT ScUndoRenameTab::Redo()
+void ScUndoRenameTab::Redo()
{
DoChange(nTab, sNewName);
}
-void __EXPORT ScUndoRenameTab::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoRenameTab::Repeat(SfxRepeatTarget& /* rTarget */)
{
// Repeat macht keinen Sinn
}
-BOOL __EXPORT ScUndoRenameTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoRenameTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -565,13 +567,13 @@ ScUndoMoveTab::ScUndoMoveTab( ScDocShell* pNewDocShell,
theNewTabs.Insert(aNewTab[sal::static_int_cast<USHORT>(i)],theNewTabs.Count());
}
-__EXPORT ScUndoMoveTab::~ScUndoMoveTab()
+ScUndoMoveTab::~ScUndoMoveTab()
{
theNewTabs.Remove(0,theNewTabs.Count());
theOldTabs.Remove(0,theOldTabs.Count());
}
-String __EXPORT ScUndoMoveTab::GetComment() const
+String ScUndoMoveTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_MOVE_TAB );
}
@@ -618,22 +620,22 @@ void ScUndoMoveTab::DoChange( BOOL bUndo ) const
pDocShell->PostDataChanged();
}
-void __EXPORT ScUndoMoveTab::Undo()
+void ScUndoMoveTab::Undo()
{
DoChange( TRUE );
}
-void __EXPORT ScUndoMoveTab::Redo()
+void ScUndoMoveTab::Redo()
{
DoChange( FALSE );
}
-void __EXPORT ScUndoMoveTab::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoMoveTab::Repeat(SfxRepeatTarget& /* rTarget */)
{
// kein Repeat ! ? !
}
-BOOL __EXPORT ScUndoMoveTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoMoveTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -660,12 +662,12 @@ ScUndoCopyTab::ScUndoCopyTab( ScDocShell* pNewDocShell,
theNewTabs.Insert(aNewTab[sal::static_int_cast<USHORT>(i)],theNewTabs.Count());
}
-__EXPORT ScUndoCopyTab::~ScUndoCopyTab()
+ScUndoCopyTab::~ScUndoCopyTab()
{
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoCopyTab::GetComment() const
+String ScUndoCopyTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_COPY_TAB );
}
@@ -684,7 +686,7 @@ void ScUndoCopyTab::DoChange() const
pDocShell->PostDataChanged();
}
-void __EXPORT ScUndoCopyTab::Undo()
+void ScUndoCopyTab::Undo()
{
ScDocument* pDoc = pDocShell->GetDocument();
@@ -717,7 +719,7 @@ void __EXPORT ScUndoCopyTab::Undo()
DoChange();
}
-void __EXPORT ScUndoCopyTab::Redo()
+void ScUndoCopyTab::Redo()
{
ScDocument* pDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -756,7 +758,7 @@ void __EXPORT ScUndoCopyTab::Redo()
}
if ( pDoc->IsTabProtected( nAdjSource ) )
- pDoc->SetTabProtection( nNewTab, TRUE, pDoc->GetTabPassword( nAdjSource ) );
+ pDoc->CopyTabProtection(nAdjSource, nNewTab);
}
RedoSdrUndoAction( pDrawUndo ); // after the sheets are inserted
@@ -767,12 +769,12 @@ void __EXPORT ScUndoCopyTab::Redo()
}
-void __EXPORT ScUndoCopyTab::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoCopyTab::Repeat(SfxRepeatTarget& /* rTarget */)
{
// kein Repeat ! ? !
}
-BOOL __EXPORT ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -801,17 +803,17 @@ ScUndoMakeScenario::ScUndoMakeScenario( ScDocShell* pNewDocShell,
pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
}
-__EXPORT ScUndoMakeScenario::~ScUndoMakeScenario()
+ScUndoMakeScenario::~ScUndoMakeScenario()
{
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoMakeScenario::GetComment() const
+String ScUndoMakeScenario::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_MAKESCENARIO );
}
-void __EXPORT ScUndoMakeScenario::Undo()
+void ScUndoMakeScenario::Undo()
{
ScDocument* pDoc = pDocShell->GetDocument();
@@ -836,7 +838,7 @@ void __EXPORT ScUndoMakeScenario::Undo()
pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
}
-void __EXPORT ScUndoMakeScenario::Redo()
+void ScUndoMakeScenario::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -858,7 +860,7 @@ void __EXPORT ScUndoMakeScenario::Redo()
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
}
-void __EXPORT ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
@@ -866,7 +868,7 @@ void __EXPORT ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
}
}
-BOOL __EXPORT ScUndoMakeScenario::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoMakeScenario::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -889,13 +891,13 @@ ScUndoImportTab::ScUndoImportTab( ScDocShell* pShell,
pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
}
-__EXPORT ScUndoImportTab::~ScUndoImportTab()
+ScUndoImportTab::~ScUndoImportTab()
{
delete pRedoDoc;
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoImportTab::GetComment() const
+String ScUndoImportTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
}
@@ -922,7 +924,7 @@ void ScUndoImportTab::DoChange() const
PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
}
-void __EXPORT ScUndoImportTab::Undo()
+void ScUndoImportTab::Undo()
{
//! eingefuegte Bereichsnamen etc.
@@ -958,7 +960,7 @@ void __EXPORT ScUndoImportTab::Undo()
}
if ( pDoc->IsTabProtected( nTabPos ) )
- pRedoDoc->SetTabProtection( nTabPos, TRUE, pDoc->GetTabPassword( nTabPos ) );
+ pRedoDoc->SetTabProtection(nTabPos, pDoc->GetTabProtection(nTabPos));
}
}
@@ -973,7 +975,7 @@ void __EXPORT ScUndoImportTab::Undo()
DoChange();
}
-void __EXPORT ScUndoImportTab::Redo()
+void ScUndoImportTab::Redo()
{
if (!pRedoDoc)
{
@@ -1012,7 +1014,7 @@ void __EXPORT ScUndoImportTab::Redo()
}
if ( pRedoDoc->IsTabProtected( nTabPos ) )
- pDoc->SetTabProtection( nTabPos, TRUE, pRedoDoc->GetTabPassword( nTabPos ) );
+ pDoc->SetTabProtection(nTabPos, pRedoDoc->GetTabProtection(nTabPos));
}
RedoSdrUndoAction( pDrawUndo ); // after the sheets are inserted
@@ -1020,14 +1022,14 @@ void __EXPORT ScUndoImportTab::Redo()
DoChange();
}
-void __EXPORT ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -1075,14 +1077,14 @@ ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const String& rDoc ) :
}
}
-__EXPORT ScUndoRemoveLink::~ScUndoRemoveLink()
+ScUndoRemoveLink::~ScUndoRemoveLink()
{
delete pTabs;
delete pModes;
delete[] pTabNames;
}
-String __EXPORT ScUndoRemoveLink::GetComment() const
+String ScUndoRemoveLink::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_REMOVELINK );
}
@@ -1099,22 +1101,22 @@ void ScUndoRemoveLink::DoChange( BOOL bLink ) const
pDocShell->UpdateLinks();
}
-void __EXPORT ScUndoRemoveLink::Undo()
+void ScUndoRemoveLink::Undo()
{
DoChange( TRUE );
}
-void __EXPORT ScUndoRemoveLink::Redo()
+void ScUndoRemoveLink::Redo()
{
DoChange( FALSE );
}
-void __EXPORT ScUndoRemoveLink::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoRemoveLink::Repeat(SfxRepeatTarget& /* rTarget */)
{
// gippsnich
}
-BOOL __EXPORT ScUndoRemoveLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoRemoveLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -1132,7 +1134,7 @@ ScUndoShowHideTab::ScUndoShowHideTab( ScDocShell* pShell, SCTAB nNewTab, BOOL bN
{
}
-__EXPORT ScUndoShowHideTab::~ScUndoShowHideTab()
+ScUndoShowHideTab::~ScUndoShowHideTab()
{
}
@@ -1149,17 +1151,17 @@ void ScUndoShowHideTab::DoChange( BOOL bShowP ) const
pDocShell->SetDocumentModified();
}
-void __EXPORT ScUndoShowHideTab::Undo()
+void ScUndoShowHideTab::Undo()
{
DoChange(!bShow);
}
-void __EXPORT ScUndoShowHideTab::Redo()
+void ScUndoShowHideTab::Redo()
{
DoChange(bShow);
}
-void __EXPORT ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
@@ -1167,53 +1169,44 @@ void __EXPORT ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
-String __EXPORT ScUndoShowHideTab::GetComment() const
+String ScUndoShowHideTab::GetComment() const
{
USHORT nId = bShow ? STR_UNDO_SHOWTAB : STR_UNDO_HIDETAB;
return ScGlobal::GetRscString( nId );
}
-// -----------------------------------------------------------------------
-//
-// Tabelle/Dokument schuetzen oder Schutz aufheben
-//
+// ============================================================================
-ScUndoProtect::ScUndoProtect( ScDocShell* pShell, SCTAB nNewTab,
- BOOL bNewProtect, const uno::Sequence<sal_Int8>& rNewPassword ) :
- ScSimpleUndo( pShell ),
- nTab( nNewTab ),
- bProtect( bNewProtect ),
- aPassword( rNewPassword )
+ScUndoDocProtect::ScUndoDocProtect(ScDocShell* pShell, auto_ptr<ScDocProtection> pProtectSettings) :
+ ScSimpleUndo(pShell),
+ mpProtectSettings(pProtectSettings)
{
}
-__EXPORT ScUndoProtect::~ScUndoProtect()
+ScUndoDocProtect::~ScUndoDocProtect()
{
}
-void ScUndoProtect::DoProtect( BOOL bDo )
+void ScUndoDocProtect::DoProtect(bool bProtect)
{
ScDocument* pDoc = pDocShell->GetDocument();
- if (bDo)
+ if (bProtect)
{
- if ( nTab == TABLEID_DOC )
- pDoc->SetDocProtection( TRUE, aPassword );
- else
- pDoc->SetTabProtection( nTab, TRUE, aPassword );
+ // set protection.
+ auto_ptr<ScDocProtection> pCopy(new ScDocProtection(*mpProtectSettings));
+ pCopy->setProtected(true);
+ pDoc->SetDocProtection(pCopy.get());
}
else
{
- uno::Sequence<sal_Int8> aEmptyPass;
- if ( nTab == TABLEID_DOC )
- pDoc->SetDocProtection( FALSE, aEmptyPass );
- else
- pDoc->SetTabProtection( nTab, FALSE, aEmptyPass );
+ // remove protection.
+ pDoc->SetDocProtection(NULL);
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1226,37 +1219,103 @@ void ScUndoProtect::DoProtect( BOOL bDo )
pDocShell->PostPaintGridAll();
}
-void __EXPORT ScUndoProtect::Undo()
+void ScUndoDocProtect::Undo()
{
BeginUndo();
- DoProtect( !bProtect );
+ DoProtect(!mpProtectSettings->isProtected());
EndUndo();
}
-void __EXPORT ScUndoProtect::Redo()
+void ScUndoDocProtect::Redo()
{
BeginRedo();
- DoProtect( bProtect );
+ DoProtect(mpProtectSettings->isProtected());
EndRedo();
}
-void __EXPORT ScUndoProtect::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoDocProtect::Repeat(SfxRepeatTarget& /* rTarget */)
{
// gippsnich
}
-BOOL __EXPORT ScUndoProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoDocProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE; // gippsnich
}
-String __EXPORT ScUndoProtect::GetComment() const
+String ScUndoDocProtect::GetComment() const
{
- USHORT nId;
- if ( nTab == TABLEID_DOC )
- nId = bProtect ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
+ USHORT nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
+ return ScGlobal::GetRscString( nId );
+}
+
+// ============================================================================
+
+ScUndoTabProtect::ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab, auto_ptr<ScTableProtection> pProtectSettings) :
+ ScSimpleUndo(pShell),
+ mnTab(nTab),
+ mpProtectSettings(pProtectSettings)
+{
+}
+
+ScUndoTabProtect::~ScUndoTabProtect()
+{
+}
+
+void ScUndoTabProtect::DoProtect(bool bProtect)
+{
+ ScDocument* pDoc = pDocShell->GetDocument();
+
+ if (bProtect)
+ {
+ // set protection.
+ auto_ptr<ScTableProtection> pCopy(new ScTableProtection(*mpProtectSettings));
+ pCopy->setProtected(true);
+ pDoc->SetTabProtection(mnTab, pCopy.get());
+ }
else
- nId = bProtect ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB;
+ {
+ // remove protection.
+ pDoc->SetTabProtection(mnTab, NULL);
+ }
+
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (pViewShell)
+ {
+ pViewShell->UpdateLayerLocks();
+ pViewShell->UpdateInputHandler(TRUE); // damit sofort wieder eingegeben werden kann
+ }
+
+ pDocShell->PostPaintGridAll();
+}
+
+void ScUndoTabProtect::Undo()
+{
+ BeginUndo();
+ DoProtect(!mpProtectSettings->isProtected());
+ EndUndo();
+}
+
+void ScUndoTabProtect::Redo()
+{
+ BeginRedo();
+ DoProtect(mpProtectSettings->isProtected());
+ EndRedo();
+}
+
+void ScUndoTabProtect::Repeat(SfxRepeatTarget& /* rTarget */)
+{
+ // gippsnich
+}
+
+BOOL ScUndoTabProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+{
+ return FALSE; // gippsnich
+}
+
+String ScUndoTabProtect::GetComment() const
+{
+ USHORT nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB;
return ScGlobal::GetRscString( nId );
}
@@ -1274,7 +1333,7 @@ ScUndoPrintRange::ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
{
}
-__EXPORT ScUndoPrintRange::~ScUndoPrintRange()
+ScUndoPrintRange::~ScUndoPrintRange()
{
delete pOldRanges;
delete pNewRanges;
@@ -1297,31 +1356,31 @@ void ScUndoPrintRange::DoChange(BOOL bUndo)
pDocShell->PostPaint( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), PAINT_GRID );
}
-void __EXPORT ScUndoPrintRange::Undo()
+void ScUndoPrintRange::Undo()
{
BeginUndo();
DoChange( TRUE );
EndUndo();
}
-void __EXPORT ScUndoPrintRange::Redo()
+void ScUndoPrintRange::Redo()
{
BeginRedo();
DoChange( FALSE );
EndRedo();
}
-void __EXPORT ScUndoPrintRange::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoPrintRange::Repeat(SfxRepeatTarget& /* rTarget */)
{
// gippsnich
}
-BOOL __EXPORT ScUndoPrintRange::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoPrintRange::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE; // gippsnich
}
-String __EXPORT ScUndoPrintRange::GetComment() const
+String ScUndoPrintRange::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_PRINTRANGES );
}
@@ -1350,16 +1409,16 @@ ScUndoScenarioFlags::ScUndoScenarioFlags( ScDocShell* pNewDocShell, SCTAB nT,
{
}
-__EXPORT ScUndoScenarioFlags::~ScUndoScenarioFlags()
+ScUndoScenarioFlags::~ScUndoScenarioFlags()
{
}
-String __EXPORT ScUndoScenarioFlags::GetComment() const
+String ScUndoScenarioFlags::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_EDITSCENARIO );
}
-void __EXPORT ScUndoScenarioFlags::Undo()
+void ScUndoScenarioFlags::Undo()
{
ScDocument* pDoc = pDocShell->GetDocument();
@@ -1376,7 +1435,7 @@ void __EXPORT ScUndoScenarioFlags::Undo()
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
}
-void __EXPORT ScUndoScenarioFlags::Redo()
+void ScUndoScenarioFlags::Redo()
{
ScDocument* pDoc = pDocShell->GetDocument();
@@ -1393,12 +1452,12 @@ void __EXPORT ScUndoScenarioFlags::Redo()
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
}
-void __EXPORT ScUndoScenarioFlags::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoScenarioFlags::Repeat(SfxRepeatTarget& /* rTarget */)
{
// Repeat macht keinen Sinn
}
-BOOL __EXPORT ScUndoScenarioFlags::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoScenarioFlags::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -1498,7 +1557,7 @@ ScUndoLayoutRTL::ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, BOOL bNewRT
{
}
-__EXPORT ScUndoLayoutRTL::~ScUndoLayoutRTL()
+ScUndoLayoutRTL::~ScUndoLayoutRTL()
{
}
@@ -1518,29 +1577,29 @@ void ScUndoLayoutRTL::DoChange( BOOL bNew )
pDocShell->SetInUndo( FALSE );
}
-void __EXPORT ScUndoLayoutRTL::Undo()
+void ScUndoLayoutRTL::Undo()
{
DoChange(!bRTL);
}
-void __EXPORT ScUndoLayoutRTL::Redo()
+void ScUndoLayoutRTL::Redo()
{
DoChange(bRTL);
}
-void __EXPORT ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
Execute( FID_TAB_RTL, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoLayoutRTL::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoLayoutRTL::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
-String __EXPORT ScUndoLayoutRTL::GetComment() const
+String ScUndoLayoutRTL::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_TAB_RTL );
}
@@ -1560,7 +1619,7 @@ ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell,
meOldGrammar = pDocShell->GetDocument()->GetGrammar();
}
-__EXPORT ScUndoSetGrammar::~ScUndoSetGrammar()
+ScUndoSetGrammar::~ScUndoSetGrammar()
{
}
@@ -1573,17 +1632,17 @@ void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar )
pDocShell->SetInUndo( FALSE );
}
-void __EXPORT ScUndoSetGrammar::Undo()
+void ScUndoSetGrammar::Undo()
{
DoChange( meOldGrammar );
}
-void __EXPORT ScUndoSetGrammar::Redo()
+void ScUndoSetGrammar::Redo()
{
DoChange( meNewGrammar );
}
-void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
{
#if 0
// erAck: 2006-09-07T23:00+0200 commented out in CWS scr1c1
@@ -1593,12 +1652,12 @@ void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
#endif
}
-BOOL __EXPORT ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
-String __EXPORT ScUndoSetGrammar::GetComment() const
+String ScUndoSetGrammar::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 );
}
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index c73f56dc55a4..cfe51aed6edc 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1170,8 +1170,8 @@ BOOL lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
}
BOOL lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
- const uno::Sequence< uno::Sequence<rtl::OUString> >& aData,
- const formula::FormulaGrammar::Grammar eGrammar )
+ const uno::Sequence< uno::Sequence<rtl::OUString> >& aData,
+ const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
// BOOL bApi = TRUE;
@@ -1226,7 +1226,7 @@ BOOL lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
{
String aText(pColArr[nCol]);
ScAddress aPos( nDocCol, nDocRow, nTab );
- ScBaseCell* pNewCell = aFunc.InterpretEnglishString( aPos, aText, eGrammar );
+ ScBaseCell* pNewCell = aFunc.InterpretEnglishString( aPos, aText, rFormulaNmsp, eGrammar );
pDoc->PutCell( aPos, pNewCell );
++nDocCol;
@@ -5052,15 +5052,14 @@ rtl::OUString SAL_CALL ScCellRangeObj::getArrayFormula() throw(uno::RuntimeExcep
return aFormula;
}
-void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& aFormula,
- const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
+void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& rFormula,
+ const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
{
ScDocShell* pDocSh = GetDocShell();
if (pDocSh)
{
- String aString(aFormula);
ScDocFunc aFunc(*pDocSh);
- if ( aString.Len() )
+ if ( rFormula.getLength() )
{
if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
{
@@ -5068,7 +5067,7 @@ void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& aFormula,
throw uno::RuntimeException();
}
- aFunc.EnterMatrix( aRange, NULL, NULL, aString, TRUE, TRUE, eGrammar );
+ aFunc.EnterMatrix( aRange, NULL, NULL, rFormula, TRUE, TRUE, rFormulaNmsp, eGrammar );
}
else
{
@@ -5086,14 +5085,14 @@ void SAL_CALL ScCellRangeObj::setArrayFormula( const rtl::OUString& aFormula )
{
ScUnoGuard aGuard;
// GRAM_PODF_A1 for API compatibility.
- SetArrayFormula_Impl( aFormula,formula::FormulaGrammar::GRAM_PODF_A1);
+ SetArrayFormula_Impl( aFormula, ::rtl::OUString(), formula::FormulaGrammar::GRAM_PODF_A1);
}
-void ScCellRangeObj::SetArrayFormulaWithGrammar( const rtl::OUString& aFormula,
- const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
+void ScCellRangeObj::SetArrayFormulaWithGrammar( const rtl::OUString& rFormula,
+ const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- SetArrayFormula_Impl( aFormula, eGrammar);
+ SetArrayFormula_Impl( rFormula, rFormulaNmsp, eGrammar);
}
// XArrayFormulaTokens
@@ -5153,7 +5152,7 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula
// Actually GRAM_PODF_A1 is a don't-care here because of the token
// array being set, it fits with other API compatibility grammars
// though.
- aFunc.EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, TRUE, TRUE,formula::FormulaGrammar::GRAM_PODF_A1 );
+ aFunc.EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, TRUE, TRUE, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
else
{
@@ -5269,7 +5268,7 @@ void SAL_CALL ScCellRangeObj::setFormulaArray(
if (pDocSh)
{
// GRAM_PODF_A1 for API compatibility.
- bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray,formula::FormulaGrammar::GRAM_PODF_A1 );
+ bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
if (!bDone)
@@ -5439,7 +5438,7 @@ void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
if ( pDocSh && nSourceCount )
{
ScRange aSourceRange(aRange);
- SCCOLROW nCount = 0; // "Dest-Count"
+ SCsCOLROW nCount = 0; // "Dest-Count"
FillDir eDir = FILL_TO_BOTTOM;
BOOL bError = FALSE;
switch (nFillDirection)
@@ -5467,7 +5466,7 @@ void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
default:
bError = TRUE;
}
- if (nCount > MAXROW) // Ueberlauf
+ if (nCount < 0 || nCount > MAXROW) // overflow
bError = TRUE;
if (!bError)
@@ -5633,7 +5632,15 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe
ScDocShell* pDocSh = GetDocShell();
ScFilterDescriptor aImpl(pDocSh);
- aImpl.setFilterFields( xDescriptor->getFilterFields() );
+ uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY );
+ if ( xDescriptor2.is() )
+ {
+ aImpl.setFilterFields2( xDescriptor2->getFilterFields2() );
+ }
+ else
+ {
+ aImpl.setFilterFields( xDescriptor->getFilterFields() );
+ }
// Rest sind jetzt Properties...
uno::Reference<beans::XPropertySet> xPropSet( xDescriptor, uno::UNO_QUERY );
@@ -6198,7 +6205,7 @@ void ScCellObj::SetString_Impl(const String& rString, BOOL bInterpret, BOOL bEng
{
ScDocFunc aFunc(*pDocSh);
// GRAM_PODF_A1 for API compatibility.
- (void)aFunc.SetCellText( aCellPos, rString, bInterpret, bEnglish, TRUE,formula::FormulaGrammar::GRAM_PODF_A1 );
+ (void)aFunc.SetCellText( aCellPos, rString, bInterpret, bEnglish, TRUE, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
}
@@ -6246,13 +6253,13 @@ void ScCellObj::SetFormulaResultDouble( double fResult )
}
void ScCellObj::SetFormulaWithGrammar( const ::rtl::OUString& rFormula,
- const formula::FormulaGrammar::Grammar eGrammar )
+ const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
ScDocFunc aFunc(*pDocSh);
- aFunc.SetCellText( aCellPos, String( rFormula), TRUE, TRUE, TRUE, eGrammar);
+ aFunc.SetCellText( aCellPos, rFormula, TRUE, TRUE, TRUE, rFormulaNmsp, eGrammar);
}
}
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 083dfc3f9374..ccd1b558342b 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1051,7 +1051,7 @@ void lcl_SeperateOneRowRange(ScRange aR, const ScAddress& rPos, ScRangeListRef&
}
vector<ScSharedTokenRef> aTokens;
- ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
return !aTokens.empty();
}
@@ -1445,7 +1445,7 @@ ScChart2DataProvider::createDataSource(
}
vector<ScSharedTokenRef> aRefTokens;
- ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
if (aRefTokens.empty())
// Invalid range representation. Bail out.
throw lang::IllegalArgumentException();
@@ -2180,7 +2180,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
return false;
vector<ScSharedTokenRef> aTokens;
- ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
return !aTokens.empty();
}
@@ -2197,6 +2197,12 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL
if(!m_pDocument || (aRangeRepresentation.getLength() == 0))
return xResult;
+ // Note: the range representation must be in Calc A1 format. The import
+ // filters use this method to pass data ranges, and they have no idea what
+ // the current formula syntax is. In the future we should add another
+ // method to allow the client code to directly pass tokens representing
+ // ranges.
+
vector<ScSharedTokenRef> aRefTokens;
ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
if (aRefTokens.empty())
@@ -2242,7 +2248,7 @@ rtl::OUString SAL_CALL ScChart2DataProvider::convertRangeToXML( const rtl::OUStr
return aRet;
vector<ScSharedTokenRef> aRefTokens;
- ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
if (aRefTokens.empty())
throw lang::IllegalArgumentException();
@@ -2483,7 +2489,7 @@ void ScChart2DataProvider::detectRangesFromDataSource(vector<ScSharedTokenRef>&
{
const OUString& rRangeRep = *itr;
vector<ScSharedTokenRef> aTokens;
- ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument, m_pDocument->GetGrammar());
CollectRefTokens func;
func = for_each(aTokens.begin(), aTokens.end(), func);
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 98a8a8551d6c..13f2c26c6e47 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -45,6 +45,8 @@
#include <com/sun/star/table/TableOrientation.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/sheet/DataImportMode.hpp>
+#include <com/sun/star/sheet/FilterOperator2.hpp>
+#include <com/sun/star/sheet/TableFilterField2.hpp>
#include "datauno.hxx"
#include "dapiuno.hxx"
@@ -1106,7 +1108,7 @@ void ScFilterDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
}
-// XSheetFilterDescriptor
+// XSheetFilterDescriptor and XSheetFilterDescriptor2
uno::Sequence<sheet::TableFilterField> SAL_CALL ScFilterDescriptorBase::getFilterFields()
throw(uno::RuntimeException)
@@ -1177,6 +1179,80 @@ uno::Sequence<sheet::TableFilterField> SAL_CALL ScFilterDescriptorBase::getFilte
return aSeq;
}
+uno::Sequence<sheet::TableFilterField2> SAL_CALL ScFilterDescriptorBase::getFilterFields2()
+throw(uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+ ScQueryParam aParam;
+ GetData(aParam);
+
+ SCSIZE nEntries = aParam.GetEntryCount(); // allozierte Eintraege im Param
+ SCSIZE nCount = 0; // aktive
+ while ( nCount < nEntries &&
+ aParam.GetEntry(nCount).bDoQuery )
+ ++nCount;
+
+ sheet::TableFilterField2 aField;
+ uno::Sequence<sheet::TableFilterField2> aSeq(static_cast<sal_Int32>(nCount));
+ sheet::TableFilterField2* pAry = aSeq.getArray();
+ for (SCSIZE i=0; i<nCount; i++)
+ {
+ const ScQueryEntry& rEntry = aParam.GetEntry(i);
+
+ rtl::OUString aStringValue;
+ if (rEntry.pStr)
+ aStringValue = *rEntry.pStr;
+
+ aField.Connection = (rEntry.eConnect == SC_AND) ? sheet::FilterConnection_AND : sheet::FilterConnection_OR;
+ aField.Field = rEntry.nField;
+ aField.IsNumeric = !rEntry.bQueryByString;
+ aField.StringValue = aStringValue;
+ aField.NumericValue = rEntry.nVal;
+
+ switch (rEntry.eOp) // ScQueryOp
+ {
+ case SC_EQUAL:
+ {
+ aField.Operator = sheet::FilterOperator2::EQUAL;
+ if (!rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING)
+ {
+ if (rEntry.nVal == SC_EMPTYFIELDS)
+ {
+ aField.Operator = sheet::FilterOperator2::EMPTY;
+ aField.NumericValue = 0;
+ }
+ else if (rEntry.nVal == SC_NONEMPTYFIELDS)
+ {
+ aField.Operator = sheet::FilterOperator2::NOT_EMPTY;
+ aField.NumericValue = 0;
+ }
+ }
+ }
+ break;
+ case SC_LESS: aField.Operator = sheet::FilterOperator2::LESS; break;
+ case SC_GREATER: aField.Operator = sheet::FilterOperator2::GREATER; break;
+ case SC_LESS_EQUAL: aField.Operator = sheet::FilterOperator2::LESS_EQUAL; break;
+ case SC_GREATER_EQUAL: aField.Operator = sheet::FilterOperator2::GREATER_EQUAL; break;
+ case SC_NOT_EQUAL: aField.Operator = sheet::FilterOperator2::NOT_EQUAL; break;
+ case SC_TOPVAL: aField.Operator = sheet::FilterOperator2::TOP_VALUES; break;
+ case SC_BOTVAL: aField.Operator = sheet::FilterOperator2::BOTTOM_VALUES; break;
+ case SC_TOPPERC: aField.Operator = sheet::FilterOperator2::TOP_PERCENT; break;
+ case SC_BOTPERC: aField.Operator = sheet::FilterOperator2::BOTTOM_PERCENT; break;
+ case SC_CONTAINS: aField.Operator = sheet::FilterOperator2::CONTAINS; break;
+ case SC_DOES_NOT_CONTAIN: aField.Operator = sheet::FilterOperator2::DOES_NOT_CONTAIN; break;
+ case SC_BEGINS_WITH: aField.Operator = sheet::FilterOperator2::BEGINS_WITH; break;
+ case SC_DOES_NOT_BEGIN_WITH: aField.Operator = sheet::FilterOperator2::DOES_NOT_BEGIN_WITH; break;
+ case SC_ENDS_WITH: aField.Operator = sheet::FilterOperator2::ENDS_WITH; break;
+ case SC_DOES_NOT_END_WITH: aField.Operator = sheet::FilterOperator2::DOES_NOT_END_WITH; break;
+ default:
+ DBG_ERROR("Falscher Filter-enum");
+ aField.Operator = sheet::FilterOperator2::EMPTY;
+ }
+ pAry[i] = aField;
+ }
+ return aSeq;
+}
+
void SAL_CALL ScFilterDescriptorBase::setFilterFields(
const uno::Sequence<sheet::TableFilterField>& aFilterFields )
throw(uno::RuntimeException)
@@ -1251,6 +1327,86 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields(
PutData(aParam);
}
+void SAL_CALL ScFilterDescriptorBase::setFilterFields2(
+ const uno::Sequence<sheet::TableFilterField2>& aFilterFields )
+ throw(uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+ ScQueryParam aParam;
+ GetData(aParam);
+
+ SCSIZE nCount = static_cast<SCSIZE>(aFilterFields.getLength());
+ DBG_ASSERT( nCount <= MAXQUERY, "setFilterFields: zu viele" );
+
+ aParam.Resize( nCount );
+
+ const sheet::TableFilterField2* pAry = aFilterFields.getConstArray();
+ SCSIZE i;
+ for (i=0; i<nCount; i++)
+ {
+ ScQueryEntry& rEntry = aParam.GetEntry(i);
+ if (!rEntry.pStr)
+ rEntry.pStr = new String; // sollte nicht sein (soll immer initialisiert sein)
+
+ rEntry.bDoQuery = TRUE;
+ rEntry.eConnect = (pAry[i].Connection == sheet::FilterConnection_AND) ? SC_AND : SC_OR;
+ rEntry.nField = pAry[i].Field;
+ rEntry.bQueryByString = !pAry[i].IsNumeric;
+ *rEntry.pStr = String( pAry[i].StringValue );
+ rEntry.nVal = pAry[i].NumericValue;
+
+ if (!rEntry.bQueryByString && pDocSh)
+ {
+ pDocSh->GetDocument()->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, *rEntry.pStr);
+ }
+
+ switch (pAry[i].Operator) // FilterOperator
+ {
+ case sheet::FilterOperator2::EQUAL: rEntry.eOp = SC_EQUAL; break;
+ case sheet::FilterOperator2::LESS: rEntry.eOp = SC_LESS; break;
+ case sheet::FilterOperator2::GREATER: rEntry.eOp = SC_GREATER; break;
+ case sheet::FilterOperator2::LESS_EQUAL: rEntry.eOp = SC_LESS_EQUAL; break;
+ case sheet::FilterOperator2::GREATER_EQUAL: rEntry.eOp = SC_GREATER_EQUAL; break;
+ case sheet::FilterOperator2::NOT_EQUAL: rEntry.eOp = SC_NOT_EQUAL; break;
+ case sheet::FilterOperator2::TOP_VALUES: rEntry.eOp = SC_TOPVAL; break;
+ case sheet::FilterOperator2::BOTTOM_VALUES: rEntry.eOp = SC_BOTVAL; break;
+ case sheet::FilterOperator2::TOP_PERCENT: rEntry.eOp = SC_TOPPERC; break;
+ case sheet::FilterOperator2::BOTTOM_PERCENT: rEntry.eOp = SC_BOTPERC; break;
+ case sheet::FilterOperator2::CONTAINS: rEntry.eOp = SC_CONTAINS; break;
+ case sheet::FilterOperator2::DOES_NOT_CONTAIN: rEntry.eOp = SC_DOES_NOT_CONTAIN; break;
+ case sheet::FilterOperator2::BEGINS_WITH: rEntry.eOp = SC_BEGINS_WITH; break;
+ case sheet::FilterOperator2::DOES_NOT_BEGIN_WITH: rEntry.eOp = SC_DOES_NOT_BEGIN_WITH;break;
+ case sheet::FilterOperator2::ENDS_WITH: rEntry.eOp = SC_ENDS_WITH; break;
+ case sheet::FilterOperator2::DOES_NOT_END_WITH: rEntry.eOp = SC_DOES_NOT_END_WITH; break;
+ case sheet::FilterOperator2::EMPTY:
+ {
+ rEntry.eOp = SC_EQUAL;
+ rEntry.nVal = SC_EMPTYFIELDS;
+ rEntry.bQueryByString = FALSE;
+ *rEntry.pStr = EMPTY_STRING;
+ }
+ break;
+ case sheet::FilterOperator2::NOT_EMPTY:
+ {
+ rEntry.eOp = SC_EQUAL;
+ rEntry.nVal = SC_NONEMPTYFIELDS;
+ rEntry.bQueryByString = FALSE;
+ *rEntry.pStr = EMPTY_STRING;
+ }
+ break;
+ default:
+ DBG_ERROR("Falscher Query-enum");
+ rEntry.eOp = SC_EQUAL;
+ }
+ }
+
+ SCSIZE nParamCount = aParam.GetEntryCount(); // Param wird nicht unter 8 resized
+ for (i=nCount; i<nParamCount; i++)
+ aParam.GetEntry(i).bDoQuery = FALSE; // ueberzaehlige Felder zuruecksetzen
+
+ PutData(aParam);
+}
+
// Rest sind Properties
// XPropertySet
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index f25d4a41980a..c924205bdce5 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -271,10 +271,10 @@ SfxObjectShell* ScModelObj::GetEmbeddedObject() const
return pDocShell;
}
-void ScModelObj::UpdateAllRowHeights()
+void ScModelObj::UpdateAllRowHeights(const ScMarkData* pTabMark)
{
if (pDocShell)
- pDocShell->UpdateAllRowHeights();
+ pDocShell->UpdateAllRowHeights(pTabMark);
}
ScDrawLayer* ScModelObj::MakeDrawLayer()
@@ -2791,7 +2791,26 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
nRowArr[1] = nEndRow;
String aNameString(aPropertyName);
- if ( aNameString.EqualsAscii( SC_UNONAME_CELLHGT ) )
+ if ( aNameString.EqualsAscii( SC_UNONAME_OHEIGHT ) )
+ {
+ sal_Int32 nNewHeight = 0;
+ if ( pDoc->IsImportingXML() && ( aValue >>= nNewHeight ) )
+ {
+ // used to set the stored row height for rows with optimal height when loading
+ pDoc->SetRowHeightRange( nStartRow, nEndRow, nTab, (USHORT)HMMToTwips(nNewHeight) );
+ }
+ else
+ {
+ BOOL bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ if (bOpt)
+ aFunc.SetWidthOrHeight( FALSE, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, TRUE, TRUE );
+ else
+ {
+ //! manually set old heights again?
+ }
+ }
+ }
+ else if ( aNameString.EqualsAscii( SC_UNONAME_CELLHGT ) )
{
sal_Int32 nNewHeight = 0;
if ( aValue >>= nNewHeight )
@@ -2813,16 +2832,6 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
else
pDoc->GetRowFlagsArrayModifiable( nTab).AndValue( nStartRow, nEndRow, sal::static_int_cast<BYTE>(~CR_FILTERED) );
}
- else if ( aNameString.EqualsAscii( SC_UNONAME_OHEIGHT ) )
- {
- BOOL bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- if (bOpt)
- aFunc.SetWidthOrHeight( FALSE, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, TRUE, TRUE );
- else
- {
- //! manually set old heights again?
- }
- }
else if ( aNameString.EqualsAscii( SC_UNONAME_NEWPAGE) || aNameString.EqualsAscii( SC_UNONAME_MANPAGE) )
{
//! single function to set/remove all breaks?
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index 80f77998fe44..476409fa5113 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -51,6 +51,7 @@
#include "unoguard.hxx"
#include "drwlayer.hxx"
#include "userdat.hxx"
+#include "postit.hxx"
#include "AccessibleText.hxx"
//------------------------------------------------------------------------
@@ -223,7 +224,7 @@ SvxEditSource* ScAnnotationEditSource::Clone() const
SdrObject* ScAnnotationEditSource::GetCaptionObj()
{
ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos );
- return pNote ? pNote->GetCaption() : 0;
+ return pNote ? pNote->GetOrCreateCaption( aCellPos ) : 0;
}
SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder()
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index 14fdb958a180..f9407b544f76 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -42,7 +42,6 @@
#include "fmtuno.hxx"
#include "miscuno.hxx"
-#include "conditio.hxx"
#include "validat.hxx"
#include "document.hxx"
#include "unoguard.hxx"
@@ -51,7 +50,8 @@
#include "tokenarray.hxx"
#include "tokenuno.hxx"
-using namespace com::sun::star;
+using namespace ::com::sun::star;
+using namespace ::formula;
//------------------------------------------------------------------------
@@ -130,12 +130,17 @@ ScConditionMode lcl_ConditionOperatorToMode( sheet::ConditionOperator eOper )
//------------------------------------------------------------------------
-//UNUSED2008-05 ScTableConditionalFormat::ScTableConditionalFormat()
-//UNUSED2008-05 {
-//UNUSED2008-05 }
+ScCondFormatEntryItem::ScCondFormatEntryItem() :
+ meGrammar1( FormulaGrammar::GRAM_UNSPECIFIED ),
+ meGrammar2( FormulaGrammar::GRAM_UNSPECIFIED ),
+ meMode( SC_COND_NONE )
+{
+}
+
+//------------------------------------------------------------------------
-ScTableConditionalFormat::ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
- const formula::FormulaGrammar::Grammar eGrammar)
+ScTableConditionalFormat::ScTableConditionalFormat(
+ ScDocument* pDoc, ULONG nKey, FormulaGrammar::Grammar eGrammar)
{
// Eintrag aus dem Dokument lesen...
@@ -156,11 +161,11 @@ ScTableConditionalFormat::ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
{
ScCondFormatEntryItem aItem;
const ScCondFormatEntry* pFormatEntry = pFormat->GetEntry(i);
- aItem.mnMode = sal::static_int_cast<USHORT>(pFormatEntry->GetOperation());
+ aItem.meMode = pFormatEntry->GetOperation();
aItem.maPos = pFormatEntry->GetValidSrcPos();
aItem.maExpr1 = pFormatEntry->GetExpression(aItem.maPos, 0, 0, eGrammar);
aItem.maExpr2 = pFormatEntry->GetExpression(aItem.maPos, 1, 0, eGrammar);
- aItem.meGrammar = eGrammar;
+ aItem.meGrammar1 = aItem.meGrammar2 = eGrammar;
aItem.maStyle = pFormatEntry->GetStyle();
AddEntry_Impl(aItem);
@@ -170,8 +175,20 @@ ScTableConditionalFormat::ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
}
}
+namespace {
+
+FormulaGrammar::Grammar lclResolveGrammar( FormulaGrammar::Grammar eExtGrammar, FormulaGrammar::Grammar eIntGrammar )
+{
+ if( eExtGrammar != FormulaGrammar::GRAM_UNSPECIFIED )
+ return eExtGrammar;
+ OSL_ENSURE( eIntGrammar != FormulaGrammar::GRAM_UNSPECIFIED, "lclResolveGrammar - unspecified grammar, using GRAM_PODF_A1" );
+ return (eIntGrammar == FormulaGrammar::GRAM_UNSPECIFIED) ? FormulaGrammar::GRAM_PODF_A1 : eIntGrammar;
+}
+
+} // namespace
+
void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat,
- ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar ) const
+ ScDocument* pDoc, FormulaGrammar::Grammar eGrammar) const
{
// ScConditionalFormat = Core-Struktur, muss leer sein
@@ -185,15 +202,12 @@ void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat,
ScCondFormatEntryItem aData;
pEntry->GetData(aData);
- if (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED)
- eGrammar = aData.meGrammar;
- if (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED)
- {
- DBG_ERRORFILE("FillFormat: unspecified grammar, using GRAM_PODF_A1");
- eGrammar = formula::FormulaGrammar::GRAM_PODF_A1;
- }
- ScCondFormatEntry aCoreEntry( static_cast<ScConditionMode>(aData.mnMode),
- aData.maExpr1, aData.maExpr2, pDoc, aData.maPos, aData.maStyle, eGrammar );
+
+ FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar, aData.meGrammar1 );
+ FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar, aData.meGrammar2 );
+
+ ScCondFormatEntry aCoreEntry( aData.meMode, aData.maExpr1, aData.maExpr2,
+ pDoc, aData.maPos, aData.maStyle, aData.maExprNmsp1, aData.maExprNmsp2, eGrammar1, eGrammar2 );
if ( aData.maPosStr.Len() )
aCoreEntry.SetSrcString( aData.maPosStr );
@@ -248,69 +262,86 @@ void SAL_CALL ScTableConditionalFormat::addNew(
{
ScUnoGuard aGuard;
ScCondFormatEntryItem aEntry;
- aEntry.mnMode = sal::static_int_cast<USHORT>(SC_COND_NONE);
+ aEntry.meMode = SC_COND_NONE;
const beans::PropertyValue* pPropArray = aConditionalEntry.getConstArray();
long nPropCount = aConditionalEntry.getLength();
for (long i = 0; i < nPropCount; i++)
{
const beans::PropertyValue& rProp = pPropArray[i];
- String aPropName(rProp.Name);
- if ( aPropName.EqualsAscii( SC_UNONAME_OPERATOR ) )
+ if ( rProp.Name.equalsAscii( SC_UNONAME_OPERATOR ) )
{
sheet::ConditionOperator eOper = (sheet::ConditionOperator)
ScUnoHelpFunctions::GetEnumFromAny( rProp.Value );
- aEntry.mnMode = sal::static_int_cast<USHORT>(lcl_ConditionOperatorToMode( eOper ));
+ aEntry.meMode = lcl_ConditionOperatorToMode( eOper );
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_FORMULA1 ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULA1 ) )
{
rtl::OUString aStrVal;
uno::Sequence<sheet::FormulaToken> aTokens;
if ( rProp.Value >>= aStrVal )
- aEntry.maExpr1 = String( aStrVal );
+ aEntry.maExpr1 = aStrVal;
else if ( rProp.Value >>= aTokens )
{
aEntry.maExpr1.Erase();
aEntry.maTokens1 = aTokens;
}
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_FORMULA2 ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULA2 ) )
{
rtl::OUString aStrVal;
uno::Sequence<sheet::FormulaToken> aTokens;
if ( rProp.Value >>= aStrVal )
- aEntry.maExpr2 = String( aStrVal );
+ aEntry.maExpr2 = aStrVal;
else if ( rProp.Value >>= aTokens )
{
aEntry.maExpr2.Erase();
aEntry.maTokens2 = aTokens;
}
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_SOURCEPOS ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_SOURCEPOS ) )
{
table::CellAddress aAddress;
if ( rProp.Value >>= aAddress )
aEntry.maPos = ScAddress( (SCCOL)aAddress.Column, (SCROW)aAddress.Row, aAddress.Sheet );
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_SOURCESTR ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_SOURCESTR ) )
{
rtl::OUString aStrVal;
if ( rProp.Value >>= aStrVal )
aEntry.maPosStr = String( aStrVal );
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_STYLENAME ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_STYLENAME ) )
{
rtl::OUString aStrVal;
if ( rProp.Value >>= aStrVal )
aEntry.maStyle = ScStyleNameConversion::ProgrammaticToDisplayName(
aStrVal, SFX_STYLE_FAMILY_PARA );
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_GRAMMAR ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULANMSP1 ) )
+ {
+ rtl::OUString aStrVal;
+ if ( rProp.Value >>= aStrVal )
+ aEntry.maExprNmsp1 = aStrVal;
+ }
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULANMSP2 ) )
+ {
+ rtl::OUString aStrVal;
+ if ( rProp.Value >>= aStrVal )
+ aEntry.maExprNmsp2 = aStrVal;
+ }
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_GRAMMAR1 ) )
{
sal_Int32 nVal = 0;
if ( rProp.Value >>= nVal )
- aEntry.meGrammar = static_cast<formula::FormulaGrammar::Grammar>(nVal);
+ aEntry.meGrammar1 = static_cast< FormulaGrammar::Grammar >( nVal );
+ }
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_GRAMMAR2 ) )
+ {
+ sal_Int32 nVal = 0;
+ if ( rProp.Value >>= nVal )
+ aEntry.meGrammar2 = static_cast< FormulaGrammar::Grammar >( nVal );
}
else
{
@@ -523,14 +554,14 @@ sheet::ConditionOperator SAL_CALL ScTableConditionalEntry::getOperator()
throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- return lcl_ConditionModeToOperator( static_cast<ScConditionMode>(aData.mnMode) );
+ return lcl_ConditionModeToOperator( aData.meMode );
}
void SAL_CALL ScTableConditionalEntry::setOperator( sheet::ConditionOperator nOperator )
throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- aData.mnMode = sal::static_int_cast<USHORT>( lcl_ConditionOperatorToMode( nOperator ) );
+ aData.meMode = lcl_ConditionOperatorToMode( nOperator );
if (pParent)
pParent->DataChanged();
}
@@ -619,7 +650,7 @@ ScTableValidationObj::ScTableValidationObj(ScDocument* pDoc, ULONG nKey,
aSrcPos = pData->GetValidSrcPos(); // #b4974740# valid pos for expressions
aExpr1 = pData->GetExpression( aSrcPos, 0, 0, eGrammar );
aExpr2 = pData->GetExpression( aSrcPos, 1, 0, eGrammar );
- meGrammar = eGrammar;
+ meGrammar1 = meGrammar2 = eGrammar;
nValMode = sal::static_int_cast<USHORT>( pData->GetDataMode() );
bIgnoreBlank = pData->IsIgnoreBlank();
nShowList = pData->GetListType();
@@ -647,18 +678,14 @@ ScValidationData* ScTableValidationObj::CreateValidationData( ScDocument* pDoc,
{
// ScValidationData = Core-Struktur
- if (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED)
- eGrammar = meGrammar;
- if (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED)
- {
- DBG_ERRORFILE("CreateValidationData: unspecified grammar, using GRAM_PODF_A1");
- eGrammar = formula::FormulaGrammar::GRAM_PODF_A1;
- }
+ FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar, meGrammar1 );
+ FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar, meGrammar2 );
ScValidationData* pRet = new ScValidationData( (ScValidationMode)nValMode,
(ScConditionMode)nMode,
aExpr1, aExpr2, pDoc, aSrcPos,
- eGrammar );
+ maExprNmsp1, maExprNmsp2,
+ eGrammar1, eGrammar2 );
pRet->SetIgnoreBlank(bIgnoreBlank);
pRet->SetListType(nShowList);
@@ -702,7 +729,9 @@ void ScTableValidationObj::ClearData_Impl()
aSrcPos.Set(0,0,0);
aExpr1.Erase();
aExpr2.Erase();
- meGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED; // will be overriden when needed
+ maExprNmsp1.Erase();
+ maExprNmsp2.Erase();
+ meGrammar1 = meGrammar2 = FormulaGrammar::GRAM_UNSPECIFIED; // will be overriden when needed
aInputTitle.Erase();
aInputMessage.Erase();
aErrorTitle.Erase();
@@ -905,13 +934,37 @@ void SAL_CALL ScTableValidationObj::setPropertyValue(
if ( aValue >>= aStrVal )
aPosString = String( aStrVal );
}
- else if ( aString.EqualsAscii( SC_UNONAME_GRAMMAR ) )
+ else if ( aString.EqualsAscii( SC_UNONAME_FORMULANMSP1 ) )
+ {
+ // internal - only for XML filter, not in PropertySetInfo, only set
+
+ rtl::OUString aStrVal;
+ if ( aValue >>= aStrVal )
+ maExprNmsp1 = aStrVal;
+ }
+ else if ( aString.EqualsAscii( SC_UNONAME_FORMULANMSP2 ) )
+ {
+ // internal - only for XML filter, not in PropertySetInfo, only set
+
+ rtl::OUString aStrVal;
+ if ( aValue >>= aStrVal )
+ maExprNmsp2 = aStrVal;
+ }
+ else if ( aString.EqualsAscii( SC_UNONAME_GRAMMAR1 ) )
+ {
+ // internal - only for XML filter, not in PropertySetInfo, only set
+
+ sal_Int32 nVal = 0;
+ if ( aValue >>= nVal )
+ meGrammar1 = static_cast< FormulaGrammar::Grammar >(nVal);
+ }
+ else if ( aString.EqualsAscii( SC_UNONAME_GRAMMAR2 ) )
{
// internal - only for XML filter, not in PropertySetInfo, only set
sal_Int32 nVal = 0;
if ( aValue >>= nVal )
- meGrammar = static_cast<formula::FormulaGrammar::Grammar>(nVal);
+ meGrammar2 = static_cast< FormulaGrammar::Grammar >(nVal);
}
DataChanged();
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index 4a9cd420f5de..e44dab865d46 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -220,14 +220,14 @@ rtl::OUString SAL_CALL ScAnnotationObj::getAuthor() throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
const ScPostIt* pNote = ImplGetNote();
- return pNote ? pNote->GetAuthor() : EMPTY_STRING;
+ return pNote ? pNote->GetAuthor() : rtl::OUString();
}
rtl::OUString SAL_CALL ScAnnotationObj::getDate() throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
const ScPostIt* pNote = ImplGetNote();
- return pNote ? pNote->GetDate() : EMPTY_STRING;
+ return pNote ? pNote->GetDate() : rtl::OUString();
}
sal_Bool SAL_CALL ScAnnotationObj::getIsVisible() throw(uno::RuntimeException)
@@ -298,7 +298,7 @@ uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape()
{
if (!xShape.is())
if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) )
- if( SdrObject* pCaption = pNote->GetCaption() )
+ if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) )
xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
return xShape;
}
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 1e735cc77866..1b17c2e130ac 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -356,7 +356,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
// error during storage creation means _here_ that the medium
// is broken, but we can not handle it in medium since unpossibility
// to create a storage does not _always_ means that the medium is broken
- aMedium.SetError( aMedium.GetLastStorageCreationState() );
+ aMedium.SetError( aMedium.GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if ( xInteraction.is() )
{
OUString empty;
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index dfb0f42702a8..e6e194d7eb75 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -51,17 +51,16 @@
#include "docsh.hxx"
#include "rangeseq.hxx"
#include "externalrefmgr.hxx"
-using namespace formula;
-using namespace com::sun::star;
+using namespace ::formula;
+using namespace ::com::sun::star;
-//------------------------------------------------------------------------
+// ============================================================================
const SfxItemPropertyMapEntry* lcl_GetFormulaParserMap()
{
static SfxItemPropertyMapEntry aFormulaParserMap_Impl[] =
{
- {MAP_CHAR_LEN(SC_UNO_REFERENCEPOS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_COMPILEFAP), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_COMPILEENGLISH), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_IGNORELEADING), 0, &getBooleanCppuType(), 0, 0 },
@@ -74,7 +73,7 @@ const SfxItemPropertyMapEntry* lcl_GetFormulaParserMap()
SC_SIMPLE_SERVICE_INFO( ScFormulaParserObj, "ScFormulaParserObj", SC_SERVICENAME_FORMULAPARS )
-//------------------------------------------------------------------------
+// ============================================================================
ScFormulaParserObj::ScFormulaParserObj(ScDocShell* pDocSh) :
mpDocShell( pDocSh ),
@@ -135,7 +134,8 @@ void ScFormulaParserObj::SetCompilerFlags( ScCompiler& rCompiler ) const
rCompiler.SetExternalLinks( maExternalLinks);
}
-uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( const rtl::OUString& aFormula )
+uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula(
+ const rtl::OUString& aFormula, const table::CellAddress& rReferencePos )
throw (uno::RuntimeException)
{
ScUnoGuard aGuard;
@@ -143,8 +143,10 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( co
if (mpDocShell)
{
+ ScAddress aRefPos( ScAddress::UNINITIALIZED );
+ ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
ScDocument* pDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( pDoc, maRefPos);
+ ScCompiler aCompiler( pDoc, aRefPos);
aCompiler.SetGrammar(pDoc->GetGrammar());
SetCompilerFlags( aCompiler );
@@ -156,7 +158,8 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( co
return aRet;
}
-rtl::OUString SAL_CALL ScFormulaParserObj::printFormula( const uno::Sequence<sheet::FormulaToken>& aTokens )
+rtl::OUString SAL_CALL ScFormulaParserObj::printFormula(
+ const uno::Sequence<sheet::FormulaToken>& aTokens, const table::CellAddress& rReferencePos )
throw (uno::RuntimeException)
{
ScUnoGuard aGuard;
@@ -167,7 +170,9 @@ rtl::OUString SAL_CALL ScFormulaParserObj::printFormula( const uno::Sequence<she
ScDocument* pDoc = mpDocShell->GetDocument();
ScTokenArray aCode;
(void)ScTokenConversion::ConvertToTokenArray( *pDoc, aCode, aTokens );
- ScCompiler aCompiler( pDoc, maRefPos, aCode);
+ ScAddress aRefPos( ScAddress::UNINITIALIZED );
+ ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
+ ScCompiler aCompiler( pDoc, aRefPos, aCode);
aCompiler.SetGrammar(pDoc->GetGrammar());
SetCompilerFlags( aCompiler );
@@ -197,13 +202,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
{
ScUnoGuard aGuard;
String aString(aPropertyName);
- if ( aString.EqualsAscii( SC_UNO_REFERENCEPOS ) )
- {
- table::CellAddress aAddress;
- aValue >>= aAddress;
- ScUnoConversion::FillScAddress( maRefPos, aAddress );
- } // if ( aString.EqualsAscii( SC_UNO_REFERENCEPOS ) )
- else if ( aString.EqualsAscii( SC_UNO_COMPILEFAP ) )
+ if ( aString.EqualsAscii( SC_UNO_COMPILEFAP ) )
{
aValue >>= mbCompileFAP;
}
@@ -218,7 +217,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
if (mxOpCodeMap.get() && mbEnglish != bOldEnglish)
{
ScDocument* pDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( pDoc, maRefPos);
+ ScCompiler aCompiler( pDoc, ScAddress());
aCompiler.SetGrammar(pDoc->GetGrammar());
mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish);
}
@@ -239,7 +238,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
if (aValue >>= maOpCodeMapping)
{
ScDocument* pDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( pDoc, maRefPos);
+ ScCompiler aCompiler( pDoc, ScAddress());
aCompiler.SetGrammar(pDoc->GetGrammar());
mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish);
}
@@ -262,13 +261,7 @@ uno::Any SAL_CALL ScFormulaParserObj::getPropertyValue( const rtl::OUString& aPr
ScUnoGuard aGuard;
uno::Any aRet;
String aString(aPropertyName);
- if ( aString.EqualsAscii( SC_UNO_REFERENCEPOS ) )
- {
- table::CellAddress aAddress;
- ScUnoConversion::FillApiAddress( aAddress, maRefPos );
- aRet <<= aAddress;
- }
- else if ( aString.EqualsAscii( SC_UNO_COMPILEFAP ) )
+ if ( aString.EqualsAscii( SC_UNO_COMPILEFAP ) )
{
aRet <<= mbCompileFAP;
}
@@ -299,7 +292,7 @@ uno::Any SAL_CALL ScFormulaParserObj::getPropertyValue( const rtl::OUString& aPr
SC_IMPL_DUMMY_PROPERTY_LISTENER( ScFormulaParserObj )
-//------------------------------------------------------------------------
+// ============================================================================
void lcl_ExternalRefToApi( sheet::SingleReference& rAPI, const ScSingleRefData& rRef )
{
@@ -345,7 +338,7 @@ void lcl_SingleRefToApi( sheet::SingleReference& rAPI, const ScSingleRefData& rR
bool ScTokenConversion::ConvertToTokenArray( ScDocument& rDoc,
ScTokenArray& rTokenArray, const uno::Sequence<sheet::FormulaToken>& rSequence )
{
- return rTokenArray.Fill(rSequence,rDoc.GetExternalRefManager());
+ return !rTokenArray.Fill(rSequence,rDoc.GetExternalRefManager());
}
// static
@@ -463,9 +456,13 @@ bool ScTokenConversion::ConvertToTokenSequence( ScDocument& rDoc,
return !bError;
}
-// -----------------------------------------------------------------------------
+
+// ============================================================================
+
ScFormulaOpCodeMapperObj::ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> _pCompiler)
: formula::FormulaOpCodeMapperObj(_pCompiler)
{
}
+// ============================================================================
+
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index fa27b94a9956..c1af5ac9bb99 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -71,6 +71,7 @@
#include "gridwin.hxx"
#include <com/sun/star/view/DocumentZoomType.hpp>
#include "AccessibilityHints.hxx"
+#include <svx/sdrhittesthelper.hxx>
using namespace com::sun::star;
@@ -1169,7 +1170,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP
SdrView* pDrawView = GetViewShell()->GetSdrView();
- if (pDrawPage && pDrawView)
+ if (pDrawPage && pDrawView && pDrawView->GetSdrPageView())
{
Window* pActiveWin = pData->GetActiveWin();
Point aPos = pActiveWin->PixelToLogic(rPoint);
@@ -1183,7 +1184,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP
while (i < nCount && !bFound)
{
SdrObject* pObj = pDrawPage->GetObj(i);
- if (pObj && pObj->IsHit(aPos, nHitLog))
+ if (pObj && SdrObjectPrimitiveHit(*pObj, aPos, nHitLog, *pDrawView->GetSdrPageView(), 0, false))
{
xTarget.set(pObj->getUnoShape(), uno::UNO_QUERY);
bFound = sal_True;
diff --git a/sc/source/ui/unoobj/warnpassword.cxx b/sc/source/ui/unoobj/warnpassword.cxx
index 6453bcbd0de7..6b11ac7c6641 100644
--- a/sc/source/ui/unoobj/warnpassword.cxx
+++ b/sc/source/ui/unoobj/warnpassword.cxx
@@ -95,3 +95,4 @@ bool ScWarnPassword::WarningOnPassword( SfxMedium& rMedium )
}
return bReturn;
}
+
diff --git a/sc/source/ui/vba/vbacontrol.cxx b/sc/source/ui/vba/vbacontrol.cxx
index ddb4b39a91a5..eaf9365016ec 100644
--- a/sc/source/ui/vba/vbacontrol.cxx
+++ b/sc/source/ui/vba/vbacontrol.cxx
@@ -185,14 +185,15 @@ void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeE
sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
{
- uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
- return xWindow2->isVisible();
+ sal_Bool bVisible = sal_False;
+ m_xProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ) ) >>= bVisible;
+ return bVisible;
}
void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
{
- uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
- xWindow2->setVisible( bVisible );
+ m_xProps->setPropertyValue
+ (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ), uno::makeAny( bVisible ) );
}
double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException)
{
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 5019167b4374..d1ac4504ce96 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -77,7 +77,10 @@
#include <com/sun/star/sheet/XCellRangeMovement.hpp>
#include <com/sun/star/sheet/XCellRangeData.hpp>
#include <com/sun/star/sheet/FormulaResult.hpp>
+#include <com/sun/star/sheet/FilterOperator2.hpp>
#include <com/sun/star/sheet/TableFilterField.hpp>
+#include <com/sun/star/sheet/TableFilterField2.hpp>
+#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
#include <com/sun/star/sheet/XSheetFilterable.hpp>
#include <com/sun/star/sheet/FilterConnection.hpp>
#include <com/sun/star/util/CellProtection.hpp>
@@ -4027,7 +4030,7 @@ void lcl_SetAllQueryForField( ScDocShell* pDocShell, SCCOLROW nField, sal_Int16
}
// Modifies sCriteria, and nOp depending on the value of sCriteria
-void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference< beans::XPropertySet >& xDescProps, sheet::TableFilterField& rFilterField )
+void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference< beans::XPropertySet >& xDescProps, sheet::TableFilterField2& rFilterField )
{
// #TODO make this more efficient and cycle through
// sCriteria1 character by character to pick up <,<>,=, * etc.
@@ -4047,10 +4050,10 @@ void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference<
if ( ( nPos = sCriteria1.indexOf( EQUALS ) ) == 0 )
{
if ( sCriteria1.getLength() == EQUALS.getLength() )
- rFilterField.Operator = sheet::FilterOperator_EMPTY;
+ rFilterField.Operator = sheet::FilterOperator2::EMPTY;
else
{
- rFilterField.Operator = sheet::FilterOperator_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::EQUAL;
sCriteria1 = sCriteria1.copy( EQUALS.getLength() );
sCriteria1 = VBAToRegexp( sCriteria1 );
// UseRegularExpressions
@@ -4062,10 +4065,10 @@ void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference<
else if ( ( nPos = sCriteria1.indexOf( NOTEQUALS ) ) == 0 )
{
if ( sCriteria1.getLength() == NOTEQUALS.getLength() )
- rFilterField.Operator = sheet::FilterOperator_NOT_EMPTY;
+ rFilterField.Operator = sheet::FilterOperator2::NOT_EMPTY;
else
{
- rFilterField.Operator = sheet::FilterOperator_NOT_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::NOT_EQUAL;
sCriteria1 = sCriteria1.copy( NOTEQUALS.getLength() );
sCriteria1 = VBAToRegexp( sCriteria1 );
// UseRegularExpressions
@@ -4079,12 +4082,12 @@ void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference<
if ( ( nPos = sCriteria1.indexOf( GREATERTHANEQUALS ) ) == 0 )
{
sCriteria1 = sCriteria1.copy( GREATERTHANEQUALS.getLength() );
- rFilterField.Operator = sheet::FilterOperator_GREATER_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::GREATER_EQUAL;
}
else
{
sCriteria1 = sCriteria1.copy( GREATERTHAN.getLength() );
- rFilterField.Operator = sheet::FilterOperator_GREATER;
+ rFilterField.Operator = sheet::FilterOperator2::GREATER;
}
}
@@ -4094,17 +4097,17 @@ void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference<
if ( ( nPos = sCriteria1.indexOf( LESSTHANEQUALS ) ) == 0 )
{
sCriteria1 = sCriteria1.copy( LESSTHANEQUALS.getLength() );
- rFilterField.Operator = sheet::FilterOperator_LESS_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::LESS_EQUAL;
}
else
{
sCriteria1 = sCriteria1.copy( LESSTHAN.getLength() );
- rFilterField.Operator = sheet::FilterOperator_LESS;
+ rFilterField.Operator = sheet::FilterOperator2::LESS;
}
}
else
- rFilterField.Operator = sheet::FilterOperator_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::EQUAL;
if ( bIsNumeric )
{
@@ -4213,13 +4216,16 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
bool bAll = false;;
if ( ( Field >>= nField ) )
{
- uno::Sequence< sheet::TableFilterField > sTabFilts;
- uno::Reference< sheet::XSheetFilterDescriptor > xDesc = xDataBaseRange->getFilterDescriptor();
- uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW );
+ uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc(
+ xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
+ if ( xDesc.is() )
+ {
+ uno::Sequence< sheet::TableFilterField2 > sTabFilts;
+ uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW );
if ( Criteria1.hasValue() )
{
sTabFilts.realloc( 1 );
- sTabFilts[0].Operator = sheet::FilterOperator_EQUAL;// sensible default
+ sTabFilts[0].Operator = sheet::FilterOperator2::EQUAL;// sensible default
if ( !bCritHasNumericValue )
{
Criteria1 >>= sCriteria1;
@@ -4252,16 +4258,16 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
switch ( nOperator )
{
case excel::XlAutoFilterOperator::xlBottom10Items:
- sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_VALUES;
+ sTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_VALUES;
break;
case excel::XlAutoFilterOperator::xlBottom10Percent:
- sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_PERCENT;
+ sTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_PERCENT;
break;
case excel::XlAutoFilterOperator::xlTop10Items:
- sTabFilts[0].Operator = sheet::FilterOperator_TOP_VALUES;
+ sTabFilts[0].Operator = sheet::FilterOperator2::TOP_VALUES;
break;
case excel::XlAutoFilterOperator::xlTop10Percent:
- sTabFilts[0].Operator = sheet::FilterOperator_TOP_PERCENT;
+ sTabFilts[0].Operator = sheet::FilterOperator2::TOP_PERCENT;
break;
case excel::XlAutoFilterOperator::xlOr:
nConn = sheet::FilterConnection_OR;
@@ -4300,12 +4306,12 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
{
Criteria2 >>= sTabFilts[1].NumericValue;
sTabFilts[1].IsNumeric = sal_True;
- sTabFilts[1].Operator = sheet::FilterOperator_EQUAL;
+ sTabFilts[1].Operator = sheet::FilterOperator2::EQUAL;
}
}
}
- xDesc->setFilterFields( sTabFilts );
+ xDesc->setFilterFields2( sTabFilts );
if ( !bAll )
{
xDataBaseRange->refresh();
@@ -4313,6 +4319,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
else
// was 0 based now seems to be 1
lcl_SetAllQueryForField( pShell, nField, nSheet );
+ }
}
else
{
@@ -4333,7 +4340,10 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
lcl_SetAllQueryForField( pShell, rEntry.nField, nSheet );
}
// remove exising filters
- xDataBaseRange->getFilterDescriptor()->setFilterFields( uno::Sequence< sheet::TableFilterField >() );
+ uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor(
+ xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
+ if( xSheetFilterDescriptor.is() )
+ xSheetFilterDescriptor->setFilterFields2( uno::Sequence< sheet::TableFilterField2 >() );
}
xDBRangeProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ), uno::Any(!bHasAuto) );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 6446d023fe9b..e5bb702402d8 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -103,6 +103,7 @@
#include "dpsave.hxx"
#include "dpgroup.hxx" // for ScDPNumGroupInfo
#include "spellparam.hxx"
+#include "postit.hxx"
#include "globstr.hrc"
#include "scui_def.hxx" //CHINA001
@@ -1708,32 +1709,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
break;
case SID_TOGGLE_REL:
- {
- BOOL bOk = FALSE;
- SCCOL nCol = GetViewData()->GetCurX();
- SCROW nRow = GetViewData()->GetCurY();
- SCTAB nTab = GetViewData()->GetTabNo();
- ScDocument* pDoc = GetViewData()->GetDocument();
- CellType eType;
- pDoc->GetCellType( nCol, nRow, nTab, eType );
- if (eType == CELLTYPE_FORMULA)
- {
- String aOld;
- pDoc->GetFormula( nCol, nRow, nTab, aOld );
- xub_StrLen nLen = aOld.Len();
- ScRefFinder aFinder( aOld, pDoc );
- aFinder.ToggleRel( 0, nLen );
- if (aFinder.GetFound())
- {
- String aNew = aFinder.GetText();
- pTabViewShell->EnterData( nCol, nRow, nTab, aNew );
- pTabViewShell->UpdateInputHandler();
- bOk = TRUE;
- }
- }
- if (!bOk)
- pTabViewShell->ErrorMessage(STR_ERR_NOREF);
- }
+ pTabViewShell->DoRefConversion();
break;
case SID_DEC_INDENT:
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 564053a937ef..eabf33f3defc 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -138,6 +138,77 @@ bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange )
return bRet;
}
+BOOL lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam )
+{
+ ScTabViewShell* pTabViewShell = pData->GetViewShell();
+ ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDocument* pDoc = pData->GetDocument();
+ SCTAB nTab = pData->GetTabNo();
+ ScDirection eFillDir = DIR_TOP;
+ BOOL bSort = TRUE;
+ ScRange aExternalRange;
+
+ if( rSortParam.nCol1 != rSortParam.nCol2 )
+ eFillDir = DIR_LEFT;
+ if( rSortParam.nRow1 != rSortParam.nRow2 )
+ eFillDir = DIR_TOP;
+
+ SCSIZE nCount = pDoc->GetEmptyLinesInBlock( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab, eFillDir );
+
+ if( rSortParam.nRow2 == MAXROW )
+ aExternalRange = ScRange( rSortParam.nCol1,sal::static_int_cast<SCROW>( nCount ), nTab );
+ else
+ aExternalRange = ScRange( pData->GetCurX(), pData->GetCurY(), nTab );
+
+ SCROW nStartRow = aExternalRange.aStart.Row();
+ SCCOL nStartCol = aExternalRange.aStart.Col();
+ SCROW nEndRow = aExternalRange.aEnd.Row();
+ SCCOL nEndCol = aExternalRange.aEnd.Col();
+ pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, FALSE );
+ aExternalRange.aStart.SetRow( nStartRow );
+ aExternalRange.aStart.SetCol( nStartCol );
+ aExternalRange.aEnd.SetRow( nEndRow );
+ aExternalRange.aEnd.SetCol( nEndCol );
+
+ if(( rSortParam.nCol1 == rSortParam.nCol2 && aExternalRange.aStart.Col() != aExternalRange.aEnd.Col() ) ||
+ ( rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row() ) )
+ {
+ USHORT nFmt = SCA_VALID;
+ String aExtendStr,aCurrentStr;
+
+ pTabViewShell->AddHighlightRange( aExternalRange,Color( COL_LIGHTBLUE ) );
+ ScRange rExtendRange( aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), nTab, aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row(), nTab );
+ rExtendRange.Format( aExtendStr, nFmt, pDoc );
+
+ ScRange rCurrentRange( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab );
+ rCurrentRange.Format( aCurrentStr, nFmt, pDoc );
+
+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
+
+ VclAbstractDialog* pWarningDlg = pFact->CreateScSortWarningDlg( pTabViewShell->GetDialogParent(),aExtendStr,aCurrentStr,RID_SCDLG_SORT_WARNING );
+ DBG_ASSERT(pWarningDlg, "Dialog create fail!");//CHINA001
+ short bResult = pWarningDlg->Execute();
+ if( bResult == BTN_EXTEND_RANGE || bResult == BTN_CURRENT_SELECTION )
+ {
+ if( bResult == BTN_EXTEND_RANGE )
+ {
+ pTabViewShell->MarkRange( aExternalRange, FALSE );
+ pDBData->SetArea( nTab, aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row() );
+ }
+ }
+ else
+ {
+ bSort = FALSE;
+ pData->GetDocShell()->CancelAutoDBRange();
+ }
+
+ delete pWarningDlg;
+ pTabViewShell->ClearHighlightRanges();
+ }
+ return bSort;
+}
+
void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
@@ -332,40 +403,47 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
case SID_SORT_DESCENDING:
case SID_SORT_ASCENDING:
{
- SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+ //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
+ //the patch comes from maoyg
ScSortParam aSortParam;
ScDBData* pDBData = pTabViewShell->GetDBData();
- SCCOL nCol = GetViewData()->GetCurX();
- SCCOL nTab = GetViewData()->GetTabNo();
- ScDocument* pDoc = GetViewData()->GetDocument();
- BOOL bHasHeader = FALSE;
+ ScViewData* pData = GetViewData();
pDBData->GetSortParam( aSortParam );
- bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
+ if( lcl_GetSortParam( pData, aSortParam ) )
+ {
+ SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+ SCCOL nCol = GetViewData()->GetCurX();
+ SCCOL nTab = GetViewData()->GetTabNo();
+ ScDocument* pDoc = GetViewData()->GetDocument();
- if( nCol < aSortParam.nCol1 )
- nCol = aSortParam.nCol1;
- else if( nCol > aSortParam.nCol2 )
- nCol = aSortParam.nCol2;
+ pDBData->GetSortParam( aSortParam );
+ BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
- aSortParam.bHasHeader = bHasHeader;
- aSortParam.bByRow = TRUE;
- aSortParam.bCaseSens = FALSE;
- aSortParam.bIncludePattern = TRUE;
- aSortParam.bInplace = TRUE;
- aSortParam.bDoSort[0] = TRUE;
- aSortParam.nField[0] = nCol;
- aSortParam.bAscending[0] = (nSlotId == SID_SORT_ASCENDING);
+ if( nCol < aSortParam.nCol1 )
+ nCol = aSortParam.nCol1;
+ else if( nCol > aSortParam.nCol2 )
+ nCol = aSortParam.nCol2;
- for ( USHORT i=1; i<MAXSORT; i++ )
- aSortParam.bDoSort[i] = FALSE;
+ aSortParam.bHasHeader = bHasHeader;
+ aSortParam.bByRow = TRUE;
+ aSortParam.bCaseSens = FALSE;
+ aSortParam.bIncludePattern = TRUE;
+ aSortParam.bInplace = TRUE;
+ aSortParam.bDoSort[0] = TRUE;
+ aSortParam.nField[0] = nCol;
+ aSortParam.bAscending[0] = (nSlotId == SID_SORT_ASCENDING);
- aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
+ for ( USHORT i=1; i<MAXSORT; i++ )
+ aSortParam.bDoSort[i] = FALSE;
- pTabViewShell->UISort( aSortParam ); // Teilergebnisse bei Bedarf neu
+ aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
- rReq.Done();
+ pTabViewShell->UISort( aSortParam ); // Teilergebnisse bei Bedarf neu
+
+ rReq.Done();
+ }
}
break;
@@ -373,141 +451,155 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
const SfxItemSet* pArgs = rReq.GetArgs();
+ //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
+ //the patch comes from maoyg
+
if ( pArgs ) // Basic
{
ScSortParam aSortParam;
- ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScViewData* pData = GetViewData();
+
pDBData->GetSortParam( aSortParam );
- aSortParam.bInplace = TRUE; // von Basic immer
-
- const SfxPoolItem* pItem;
- if ( pArgs->GetItemState( SID_SORT_BYROW, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bByRow = ((const SfxBoolItem*)pItem)->GetValue();
- if ( pArgs->GetItemState( SID_SORT_HASHEADER, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bHasHeader = ((const SfxBoolItem*)pItem)->GetValue();
- if ( pArgs->GetItemState( SID_SORT_CASESENS, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bCaseSens = ((const SfxBoolItem*)pItem)->GetValue();
- if ( pArgs->GetItemState( SID_SORT_ATTRIBS, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bIncludePattern = ((const SfxBoolItem*)pItem)->GetValue();
- if ( pArgs->GetItemState( SID_SORT_USERDEF, TRUE, &pItem ) == SFX_ITEM_SET )
+
+ if( lcl_GetSortParam( pData, aSortParam ) )
{
- USHORT nUserIndex = ((const SfxUInt16Item*)pItem)->GetValue();
- aSortParam.bUserDef = ( nUserIndex != 0 );
- if ( nUserIndex )
- aSortParam.nUserIndex = nUserIndex - 1; // Basic: 1-basiert
- }
+ ScDocument* pDoc = GetViewData()->GetDocument();
+
+ pDBData->GetSortParam( aSortParam );
+ BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
+ if( bHasHeader )
+ aSortParam.bHasHeader = bHasHeader;
+
+ aSortParam.bInplace = TRUE; // von Basic immer
+
+ const SfxPoolItem* pItem;
+ if ( pArgs->GetItemState( SID_SORT_BYROW, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bByRow = ((const SfxBoolItem*)pItem)->GetValue();
+ if ( pArgs->GetItemState( SID_SORT_HASHEADER, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bHasHeader = ((const SfxBoolItem*)pItem)->GetValue();
+ if ( pArgs->GetItemState( SID_SORT_CASESENS, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bCaseSens = ((const SfxBoolItem*)pItem)->GetValue();
+ if ( pArgs->GetItemState( SID_SORT_ATTRIBS, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bIncludePattern = ((const SfxBoolItem*)pItem)->GetValue();
+ if ( pArgs->GetItemState( SID_SORT_USERDEF, TRUE, &pItem ) == SFX_ITEM_SET )
+ {
+ USHORT nUserIndex = ((const SfxUInt16Item*)pItem)->GetValue();
+ aSortParam.bUserDef = ( nUserIndex != 0 );
+ if ( nUserIndex )
+ aSortParam.nUserIndex = nUserIndex - 1; // Basic: 1-basiert
+ }
- SCCOLROW nField0 = 0;
- if ( pArgs->GetItemState( FN_PARAM_1, TRUE, &pItem ) == SFX_ITEM_SET )
- nField0 = ((const SfxInt32Item*)pItem)->GetValue();
- aSortParam.bDoSort[0] = ( nField0 != 0 );
- aSortParam.nField[0] = nField0 > 0 ? (nField0-1) : 0;
- if ( pArgs->GetItemState( FN_PARAM_2, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bAscending[0] = ((const SfxBoolItem*)pItem)->GetValue();
- SCCOLROW nField1 = 0;
- if ( pArgs->GetItemState( FN_PARAM_3, TRUE, &pItem ) == SFX_ITEM_SET )
- nField1 = ((const SfxInt32Item*)pItem)->GetValue();
- aSortParam.bDoSort[1] = ( nField1 != 0 );
- aSortParam.nField[1] = nField1 > 0 ? (nField1-1) : 0;
- if ( pArgs->GetItemState( FN_PARAM_4, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bAscending[1] = ((const SfxBoolItem*)pItem)->GetValue();
- SCCOLROW nField2 = 0;
- if ( pArgs->GetItemState( FN_PARAM_5, TRUE, &pItem ) == SFX_ITEM_SET )
- nField2 = ((const SfxInt32Item*)pItem)->GetValue();
- aSortParam.bDoSort[2] = ( nField2 != 0 );
- aSortParam.nField[2] = nField2 > 0 ? (nField2-1) : 0;
- if ( pArgs->GetItemState( FN_PARAM_6, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bAscending[2] = ((const SfxBoolItem*)pItem)->GetValue();
-
- // Teilergebnisse bei Bedarf neu
- pTabViewShell->UISort( aSortParam );
- rReq.Done();
+ SCCOLROW nField0 = 0;
+ if ( pArgs->GetItemState( FN_PARAM_1, TRUE, &pItem ) == SFX_ITEM_SET )
+ nField0 = ((const SfxInt32Item*)pItem)->GetValue();
+ aSortParam.bDoSort[0] = ( nField0 != 0 );
+ aSortParam.nField[0] = nField0 > 0 ? (nField0-1) : 0;
+ if ( pArgs->GetItemState( FN_PARAM_2, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bAscending[0] = ((const SfxBoolItem*)pItem)->GetValue();
+ SCCOLROW nField1 = 0;
+ if ( pArgs->GetItemState( FN_PARAM_3, TRUE, &pItem ) == SFX_ITEM_SET )
+ nField1 = ((const SfxInt32Item*)pItem)->GetValue();
+ aSortParam.bDoSort[1] = ( nField1 != 0 );
+ aSortParam.nField[1] = nField1 > 0 ? (nField1-1) : 0;
+ if ( pArgs->GetItemState( FN_PARAM_4, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bAscending[1] = ((const SfxBoolItem*)pItem)->GetValue();
+ SCCOLROW nField2 = 0;
+ if ( pArgs->GetItemState( FN_PARAM_5, TRUE, &pItem ) == SFX_ITEM_SET )
+ nField2 = ((const SfxInt32Item*)pItem)->GetValue();
+ aSortParam.bDoSort[2] = ( nField2 != 0 );
+ aSortParam.nField[2] = nField2 > 0 ? (nField2-1) : 0;
+ if ( pArgs->GetItemState( FN_PARAM_6, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bAscending[2] = ((const SfxBoolItem*)pItem)->GetValue();
+
+ // Teilergebnisse bei Bedarf neu
+ pTabViewShell->UISort( aSortParam );
+ rReq.Done();
+ }
}
else
{
- //CHINA001 ScSortDlg* pDlg = NULL;
- SfxAbstractTabDialog* pDlg = NULL;
ScSortParam aSortParam;
- SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+ ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScViewData* pData = GetViewData();
- ScDBData* pDBData = pTabViewShell->GetDBData();
pDBData->GetSortParam( aSortParam );
- aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
- //CHINA001 pDlg = new ScSortDlg( pTabViewShell->GetDialogParent(), &aArgSet );
- ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
+ if( lcl_GetSortParam( pData, aSortParam ) )
+ {
+ SfxAbstractTabDialog* pDlg = NULL;
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
- pDlg = pFact->CreateScSortDlg( pTabViewShell->GetDialogParent(), &aArgSet, RID_SCDLG_SORT );
- DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
- pDlg->SetCurPageId(1);
+ pDBData->GetSortParam( aSortParam );
+ BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
+ if( bHasHeader )
+ aSortParam.bHasHeader = bHasHeader;
- if ( pDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- const ScSortParam& rOutParam = ((const ScSortItem&)
- pOutSet->Get( SCITEM_SORTDATA )).GetSortData();
+ aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
- // Teilergebnisse bei Bedarf neu
- pTabViewShell->UISort( rOutParam );
+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
+
+ pDlg = pFact->CreateScSortDlg( pTabViewShell->GetDialogParent(), &aArgSet, RID_SCDLG_SORT );
+ DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
+ pDlg->SetCurPageId(1);
- if ( rOutParam.bInplace )
+ if ( pDlg->Execute() == RET_OK )
{
- rReq.AppendItem( SfxBoolItem( SID_SORT_BYROW,
- rOutParam.bByRow ) );
- rReq.AppendItem( SfxBoolItem( SID_SORT_HASHEADER,
- rOutParam.bHasHeader ) );
- rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
- rOutParam.bCaseSens ) );
- rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
- rOutParam.bIncludePattern ) );
- USHORT nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
- rReq.AppendItem( SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
- if ( rOutParam.bDoSort[0] )
- {
- rReq.AppendItem( SfxInt32Item( FN_PARAM_1,
- rOutParam.nField[0] + 1 ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_2,
- rOutParam.bAscending[0] ) );
- }
- if ( rOutParam.bDoSort[1] )
- {
- rReq.AppendItem( SfxInt32Item( FN_PARAM_3,
- rOutParam.nField[1] + 1 ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_4,
- rOutParam.bAscending[1] ) );
- }
- if ( rOutParam.bDoSort[2] )
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ const ScSortParam& rOutParam = ((const ScSortItem&)
+ pOutSet->Get( SCITEM_SORTDATA )).GetSortData();
+
+ // Teilergebnisse bei Bedarf neu
+ pTabViewShell->UISort( rOutParam );
+
+ if ( rOutParam.bInplace )
{
- rReq.AppendItem( SfxInt32Item( FN_PARAM_5,
- rOutParam.nField[2] + 1 ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_6,
- rOutParam.bAscending[2] ) );
+ rReq.AppendItem( SfxBoolItem( SID_SORT_BYROW,
+ rOutParam.bByRow ) );
+ rReq.AppendItem( SfxBoolItem( SID_SORT_HASHEADER,
+ rOutParam.bHasHeader ) );
+ rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
+ rOutParam.bCaseSens ) );
+ rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
+ rOutParam.bIncludePattern ) );
+ USHORT nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
+ rReq.AppendItem( SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
+ if ( rOutParam.bDoSort[0] )
+ {
+ rReq.AppendItem( SfxInt32Item( FN_PARAM_1,
+ rOutParam.nField[0] + 1 ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_2,
+ rOutParam.bAscending[0] ) );
+ }
+ if ( rOutParam.bDoSort[1] )
+ {
+ rReq.AppendItem( SfxInt32Item( FN_PARAM_3,
+ rOutParam.nField[1] + 1 ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_4,
+ rOutParam.bAscending[1] ) );
+ }
+ if ( rOutParam.bDoSort[2] )
+ {
+ rReq.AppendItem( SfxInt32Item( FN_PARAM_5,
+ rOutParam.nField[2] + 1 ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_6,
+ rOutParam.bAscending[2] ) );
+ }
}
+
+ rReq.Done();
}
+ else
+ GetViewData()->GetDocShell()->CancelAutoDBRange();
- rReq.Done();
+ delete pDlg;
}
- else
- GetViewData()->GetDocShell()->CancelAutoDBRange();
-
- delete pDlg;
}
}
break;
-/*
- {
-
- USHORT nId = ScPivotLayoutWrapper::GetChildWindowId();
- SfxChildWindow* pWnd = pSfxApp->GetChildWindow( nId );
-
- pScMod->SetRefDialog( nId, pWnd ? FALSE : TRUE );
-
- }
- break;
-*/
-
case SID_FILTER:
{
const SfxItemSet* pArgs = rReq.GetArgs();
@@ -1242,6 +1334,10 @@ void __EXPORT ScCellShell::GetDBState( SfxItemSet& rSet )
{
rSet.DisableItem( nWhich );
}
+ else if (pDoc->GetDPAtBlock(aDummy))
+ {
+ rSet.DisableItem( nWhich );
+ }
else
rSet.Put( SfxBoolItem( nWhich, bAutoFilter ) );
}
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 4bb33a4c7855..dd79bb52a112 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -950,16 +950,12 @@ void ScCellShell::Execute( SfxRequest& rReq )
DBG_ERROR("Execute von InputLine-Status");
break;
-
case SID_STATUS_DOCPOS:
- {
- //! Navigator an-/ausschalten (wie im Writer) ???
- //!pViewData->GetDispatcher().Execute( SID_NAVIGATOR,
- //! SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
- }
+ // Launch navigator.
+ GetViewData()->GetDispatcher().Execute(
+ SID_NAVIGATOR, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
break;
-
case SID_MARKAREA:
// called from Basic at the hidden view to select a range in the visible view
DBG_ERROR("old slot SID_MARKAREA");
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 8dcb47c927a2..36667ee43c0f 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1898,7 +1898,13 @@ void ScDBFunc::RepeatDB( BOOL bRecord )
pDBData->GetQueryParam( aQueryParam ); // Bereich kann sich geaendert haben
ScRange aAdvSource;
if (pDBData->GetAdvancedQuerySource(aAdvSource))
+ {
+ pDoc->CreateQueryParam(
+ aAdvSource.aStart.Col(), aAdvSource.aStart.Row(),
+ aAdvSource.aEnd.Col(), aAdvSource.aEnd.Row(),
+ aAdvSource.aStart.Tab(), aQueryParam );
Query( aQueryParam, &aAdvSource, FALSE );
+ }
else
Query( aQueryParam, NULL, FALSE );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 5591a2a496be..5397377b69cc 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -119,6 +119,8 @@
#include "drwlayer.hxx"
#include "attrib.hxx"
#include "validat.hxx"
+#include "tabprotection.hxx"
+#include "postit.hxx"
// #114409#
#include <vcl/salbtype.hxx> // FRound
@@ -128,6 +130,11 @@
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <vcl/svapp.hxx>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
using namespace com::sun::star;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Any;
@@ -1139,6 +1146,13 @@ void ScGridWindow::ExecFilter( ULONG nSel,
if (SC_AUTOFILTER_CUSTOM == nSel)
{
+ SCTAB nAreaTab;
+ SCCOL nStartCol;
+ SCROW nStartRow;
+ SCCOL nEndCol;
+ SCROW nEndRow;
+ pDBData->GetArea( nAreaTab, nStartCol,nStartRow,nEndCol,nEndRow );
+ pViewData->GetView()->MarkRange( ScRange( nStartCol,nStartRow,nAreaTab,nEndCol,nEndRow,nAreaTab));
pViewData->GetView()->SetCursor(nCol,nRow); //! auch ueber Slot ??
pViewData->GetDispatcher().Execute( SID_FILTER, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD );
}
@@ -2020,8 +2034,9 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
Point aPos = rMEvt.GetPosPixel();
SCsCOL nPosX;
SCsROW nPosY;
+ SCTAB nTab = pViewData->GetTabNo();
pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( nPosX, nPosY, pViewData->GetTabNo() );
+ ScDPObject* pDPObj = pDoc->GetDPAtCursor( nPosX, nPosY, nTab );
if ( pDPObj && pDPObj->GetSaveData()->GetDrillDown() )
{
ScAddress aCellPos( nPosX, nPosY, pViewData->GetTabNo() );
@@ -2063,16 +2078,34 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
return;
}
- // edit cell contents
- pViewData->GetViewShell()->UpdateInputHandler();
- pScMod->SetInputMode( SC_INPUT_TABLE );
- if (pViewData->HasEditView(eWhich))
+ // Check for cell protection attribute.
+ ScTableProtection* pProtect = pDoc->GetTabProtection( nTab );
+ bool bEditAllowed = true;
+ if ( pProtect && pProtect->isProtected() )
+ {
+ bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED);
+ bool bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+
+ if ( bSkipProtected && bSkipUnprotected )
+ bEditAllowed = false;
+ else if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
+ bEditAllowed = false;
+ }
+
+ if ( bEditAllowed )
{
- // Text-Cursor gleich an die geklickte Stelle setzen
- EditView* pEditView = pViewData->GetEditView( eWhich );
- MouseEvent aEditEvt( rMEvt.GetPosPixel(), 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 );
- pEditView->MouseButtonDown( aEditEvt );
- pEditView->MouseButtonUp( aEditEvt );
+ // edit cell contents
+ pViewData->GetViewShell()->UpdateInputHandler();
+ pScMod->SetInputMode( SC_INPUT_TABLE );
+ if (pViewData->HasEditView(eWhich))
+ {
+ // Text-Cursor gleich an die geklickte Stelle setzen
+ EditView* pEditView = pViewData->GetEditView( eWhich );
+ MouseEvent aEditEvt( rMEvt.GetPosPixel(), 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 );
+ pEditView->MouseButtonDown( aEditEvt );
+ pEditView->MouseButtonUp( aEditEvt );
+ }
}
return;
}
@@ -5662,112 +5695,107 @@ namespace sdr
mePaintType( eType ),
maRectangles( rRects )
{
+ // no AA for selection overlays
+ allowAntiAliase(false);
}
OverlayObjectCell::~OverlayObjectCell()
{
}
- void OverlayObjectCell::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
{
- // safe original AA and switch off for selection
- const sal_uInt16 nOriginalAA(rOutputDevice.GetAntialiasing());
- rOutputDevice.SetAntialiasing(0);
-
- // set colors
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(getBaseColor());
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ const sal_uInt32 nCount(maRectangles.size());
- if ( mePaintType == SC_OVERLAY_BORDER_TRANSPARENT )
- {
- // to draw the border, all rectangles have to be collected into a PolyPolygon
-
- PolyPolygon aPolyPoly;
- sal_uInt32 nRectCount = maRectangles.size();
- for(sal_uInt32 nRect=0; nRect < nRectCount; ++nRect)
- {
- const basegfx::B2DRange& rRange(maRectangles[nRect]);
- Rectangle aRectangle(FRound(rRange.getMinX()), FRound(rRange.getMinY()), FRound(rRange.getMaxX()), FRound(rRange.getMaxY()));
- if ( nRectCount == 1 || nRect+1 < nRectCount )
- {
- // simply add for all except the last rect
- aPolyPoly.Insert( Polygon( aRectangle ) );
- }
- else
- {
- PolyPolygon aTemp( aPolyPoly );
- aTemp.GetUnion( PolyPolygon( Polygon( aRectangle ) ), aPolyPoly );
- }
- }
-
- rOutputDevice.DrawTransparent(aPolyPoly, 75);
-
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- rOutputDevice.DrawPolyPolygon(aPolyPoly);
- }
- else
+ if(nCount)
{
- if ( mePaintType == SC_OVERLAY_INVERT )
+ // create fill primities for all rectangles
+ // These ranges are meant as rectangles, so it is not sufficient to replace them
+ // using the derived polygon. That would leave out the bottom and right lines
+ // in a discrete width/height due to polygon painting conventions of leaving off those.
+ // To solve, it is either possible to create a view-dependent rectangle primitive
+ // handling this internally or to additionally create a hairline primitive to
+ // cover these areas (which i will do here)
+ const bool bIsTransparent(SC_OVERLAY_BORDER_TRANSPARENT == mePaintType);
+ aRetval.realloc(nCount * 2);
+
+ for(sal_uInt32 a(0);a < nCount; a++)
{
- rOutputDevice.Push();
- rOutputDevice.SetRasterOp( ROP_XOR );
- rOutputDevice.SetFillColor( COL_WHITE );
+ const basegfx::B2DRange& rRange(maRectangles[a]);
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
+
+ aRetval[a * 2] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
+ aRetval[(a * 2) + 1] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
}
- for(sal_uInt32 a(0L);a < maRectangles.size(); a++)
+ if(SC_OVERLAY_INVERT == mePaintType)
{
- const basegfx::B2DRange& rRange(maRectangles[a]);
- const Rectangle aRectangle(FRound(rRange.getMinX()), FRound(rRange.getMinY()), FRound(rRange.getMaxX()), FRound(rRange.getMaxY()));
+ // embed all in invert primitive
+ const drawinglayer::primitive2d::Primitive2DReference aInvert(
+ new drawinglayer::primitive2d::InvertPrimitive2D(
+ aRetval));
- switch(mePaintType)
- {
- case SC_OVERLAY_INVERT :
- {
- rOutputDevice.DrawRect( aRectangle );
- break;
- }
- case SC_OVERLAY_SOLID :
- {
- rOutputDevice.DrawRect(aRectangle);
- break;
- }
- default:
- {
- // SC_OVERLAY_BORDER_TRANSPARENT is handled separately
- }
- }
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
}
-
- if ( mePaintType == SC_OVERLAY_INVERT )
+ else if(bIsTransparent)
{
- rOutputDevice.Pop();
+ // embed all rectangles in 75% transparent paint
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha(
+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ aRetval,
+ 0.75));
+
+ // prepare merged PolyPoygon selection outline
+ const basegfx::B2DPolyPolygon aPolyPolygon(impGetOverlayPolyPolygon());
+ const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline(
+ new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+ aPolyPolygon,
+ aRGBColor));
+
+ // add both to result
+ aRetval.realloc(2);
+ aRetval[0] = aUnifiedAlpha;
+ aRetval[1] = aSelectionOutline;
}
}
- // restore original AA
- rOutputDevice.SetAntialiasing(nOriginalAA);
+ return aRetval;
}
- void OverlayObjectCell::createBaseRange(OutputDevice& /* rOutputDevice */)
+ basegfx::B2DPolyPolygon OverlayObjectCell::impGetOverlayPolyPolygon() const
{
- maBaseRange.reset();
+ PolyPolygon aPolyPoly;
+ const sal_uInt32 nRectCount(maRectangles.size());
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
+ for(sal_uInt32 nRect(0); nRect < nRectCount; ++nRect)
{
- maBaseRange.expand(maRectangles[a]);
- }
- }
+ const basegfx::B2DRange& rRange(maRectangles[nRect]);
+ const Rectangle aRectangle(
+ FRound(rRange.getMinX()), FRound(rRange.getMinY()),
+ FRound(rRange.getMaxX()), FRound(rRange.getMaxY()));
- void OverlayObjectCell::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
- {
- maRectangles[a].transform(rMatrix);
+ if ( nRectCount == 1 || nRect+1 < nRectCount )
+ {
+ // simply add for all except the last rect
+ aPolyPoly.Insert( Polygon( aRectangle ) );
+ }
+ else
+ {
+ PolyPolygon aTemp( aPolyPoly );
+ aTemp.GetUnion( PolyPolygon( Polygon( aRectangle ) ), aPolyPoly );
+ }
}
- }
+ return aPolyPoly.getB2DPolyPolygon();
+ }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 8739ee2b0b91..f3d5b2781607 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -338,12 +338,12 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
SdrObject* pObj = 0;
SdrPageView* pPV = 0;
Point aMDPos = PixelToLogic( aPosPixel );
- if ( pDrView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER) )
+ if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
{
if ( pObj->IsGroupObject() )
{
SdrObject* pHit = 0;
- if ( pDrView->PickObj(aMDPos, pHit, pPV, SDRSEARCH_DEEP ) )
+ if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
pObj = pHit;
}
#ifdef ISSUE66550_HLINK_FOR_SHAPES
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index dd76058756a1..e41bd4941d9c 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1358,13 +1358,11 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
}
if (bDoCell && !bNeedEdit)
{
- BOOL bFormulaCell = (pCell->GetCellType() == CELLTYPE_FORMULA );
- if ( bFormulaCell )
+ if ( pCell->GetCellType() == CELLTYPE_FORMULA )
lcl_CreateInterpretProgress( bProgress, pDoc, (ScFormulaCell*)pCell );
if ( aVars.SetText(pCell) )
pOldPattern = NULL;
- bNeedEdit = aVars.HasEditCharacters() ||
- (bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult());
+ bNeedEdit = aVars.HasEditCharacters();
}
if (bDoCell && !bNeedEdit)
{
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 2906440d7e5a..b94837fc1793 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -244,6 +244,10 @@ void ScPreview::CalcPages( SCTAB /*nToWhichTab*/ )
nTabsTested = 0;
}
+ // update all pending row heights with a single progress bar,
+ // instead of a separate progress for each sheet from ScPrintFunc
+ pDocShell->UpdatePendingRowHeights( nAnz-1, true );
+
// PrintOptions is passed to PrintFunc for SkipEmpty flag,
// but always all sheets are used (there is no selected sheet)
ScPrintOptions aOptions = SC_MOD()->GetPrintOptions();
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 4324b610dd0b..b7b8b9fbadf6 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -185,6 +185,7 @@ long lcl_LineTotal(const SvxBorderLine* pLine)
void ScPrintFunc::Construct( const ScPrintOptions* pOptions )
{
+ pDocShell->UpdatePendingRowHeights( nPrintTab );
pDoc = pDocShell->GetDocument();
SfxPrinter* pDocPrinter = pDoc->GetPrinter(); // auch fuer Preview den Drucker nehmen
@@ -886,7 +887,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
if ( !aPageSize.Width() || !aPageSize.Height() )
{
DBG_ERROR("PageSize Null ?!?!?");
- aPageSize = SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 );
+ aPageSize = SvxPaperInfo::GetPaperSize( PAPER_A4 );
}
pBorderItem = (const SvxBoxItem*) &pParamSet->Get(ATTR_BORDER);
@@ -2677,7 +2678,7 @@ void ScPrintFunc::ApplyPrintSettings()
aEnumSize.Width() = aEnumSize.Height();
aEnumSize.Height() = nTemp;
}
- Paper ePaper = SvxPaperInfo::GetSvPaper( aEnumSize, MAP_TWIP, TRUE );
+ Paper ePaper = SvxPaperInfo::GetSvxPaper( aEnumSize, MAP_TWIP, TRUE );
USHORT nPaperBin = ((const SvxPaperBinItem&)pParamSet->Get(ATTR_PAGE_PAPERBIN)).GetValue();
pPrinter->SetPaper( ePaper );
diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx
index 15b4329fb00e..e6b4a3d0c20e 100644
--- a/sc/source/ui/view/scextopt.cxx
+++ b/sc/source/ui/view/scextopt.cxx
@@ -42,9 +42,7 @@ ScExtDocSettings::ScExtDocSettings() :
maOleSize( ScAddress::INITIALIZE_INVALID ),
mfTabBarWidth( -1.0 ),
mnLinkCnt( 0 ),
- mnDisplTab( 0 ),
- mbWinProtected( false ),
- mbEncrypted( false )
+ mnDisplTab( 0 )
{
}
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index 288b50daed19..b8d0da840db7 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -47,6 +47,7 @@
//#include "dataobj.hxx"
#include "transobj.hxx"
#include "docsh.hxx"
+#include "tabprotection.hxx"
extern USHORT nScFillModeMouseModifier; // global.cxx
@@ -322,6 +323,26 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
{
ScTabView* pView = pViewData->GetView();
SCTAB nTab = pViewData->GetTabNo();
+ ScDocument* pDoc = pViewData->GetDocument();
+
+ if ( pDoc->IsTabProtected(nTab) )
+ {
+ if (nPosX < 0 || nPosY < 0)
+ return false;
+
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ bool bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+
+ if ( bSkipProtected && bSkipUnprotected )
+ return FALSE;
+
+ bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED);
+ if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
+ // Don't select this cell!
+ return FALSE;
+ }
+
ScModule* pScMod = SC_MOD();
ScTabViewShell* pViewShell = pViewData->GetViewShell();
bool bRefMode = ( pViewShell ? pViewShell->IsRefInputMode() : false );
@@ -375,7 +396,6 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
ScRange aDelRange;
BOOL bOldDelMark = pViewData->GetDelMark( aDelRange );
- ScDocument* pDoc = pViewData->GetDocument();
if ( nPosX+1 >= (SCsCOL) nStartX && nPosX <= (SCsCOL) nEndX &&
nPosY+1 >= (SCsROW) nStartY && nPosY <= (SCsROW) nEndY &&
@@ -511,7 +531,6 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
BYTE nMode = pViewData->GetFillMode();
if ( nMode == SC_FILL_EMBED_LT || nMode == SC_FILL_EMBED_RB )
{
- ScDocument* pDoc = pViewData->GetDocument();
DBG_ASSERT( pDoc->IsEmbedded(), "!pDoc->IsEmbedded()" );
ScRange aRange;
pDoc->GetEmbedded( aRange);
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 1be33a37cd26..608658024d2b 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -79,6 +79,7 @@
#include "AccessibilityHints.hxx"
#include "rangeutl.hxx"
#include "client.hxx"
+#include "tabprotection.hxx"
#include <com/sun/star/chart2/data/HighlightedRange.hpp>
@@ -946,6 +947,17 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
ScDocument* pDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
+ bool bSkipProtected = false, bSkipUnprotected = false;
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ if ( pProtect && pProtect->isProtected() )
+ {
+ bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+ }
+
+ if ( bSkipProtected && bSkipUnprotected )
+ return;
+
SCsCOL nOldX;
SCsROW nOldY;
SCsCOL nCurX;
@@ -965,7 +977,7 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
nCurY = (nMovY != 0) ? nOldY+nMovY : (SCsROW) aViewData.GetOldCurY();
}
- BOOL bHidden;
+ BOOL bSkipCell = FALSE;
aViewData.ResetOldCursor();
if (nMovX != 0 && VALIDCOLROW(nCurX,nCurY))
@@ -974,15 +986,20 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
do
{
BYTE nColFlags = pDoc->GetColFlags( nCurX, nTab );
- bHidden = (nColFlags & CR_HIDDEN) || pDoc->IsHorOverlapped( nCurX, nCurY, nTab );
- if (bHidden)
+ bSkipCell = (nColFlags & CR_HIDDEN) || pDoc->IsHorOverlapped( nCurX, nCurY, nTab );
+ if (bSkipProtected && !bSkipCell)
+ bSkipCell = pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
+ if (bSkipUnprotected && !bSkipCell)
+ bSkipCell = !pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
+
+ if (bSkipCell)
{
if ( nCurX<=0 || nCurX>=MAXCOL )
{
if (bHFlip)
{
nCurX = nOldX;
- bHidden = FALSE;
+ bSkipCell = FALSE;
}
else
{
@@ -995,7 +1012,8 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
if (nMovX > 0) ++nCurX; else --nCurX;
}
}
- while (bHidden);
+ while (bSkipCell);
+
if (pDoc->IsVerOverlapped( nCurX, nCurY, nTab ))
{
aViewData.SetOldCursor( nCurX,nCurY );
@@ -1010,15 +1028,20 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
do
{
BYTE nRowFlags = pDoc->GetRowFlags( nCurY, nTab );
- bHidden = (nRowFlags & CR_HIDDEN) || pDoc->IsVerOverlapped( nCurX, nCurY, nTab );
- if (bHidden)
+ bSkipCell = (nRowFlags & CR_HIDDEN) || pDoc->IsVerOverlapped( nCurX, nCurY, nTab );
+ if (bSkipProtected && !bSkipCell)
+ bSkipCell = pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
+ if (bSkipUnprotected && !bSkipCell)
+ bSkipCell = !pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
+
+ if (bSkipCell)
{
if ( nCurY<=0 || nCurY>=MAXROW )
{
if (bVFlip)
{
nCurY = nOldY;
- bHidden = FALSE;
+ bSkipCell = FALSE;
}
else
{
@@ -1031,7 +1054,8 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
if (nMovY > 0) ++nCurY; else --nCurY;
}
}
- while (bHidden);
+ while (bSkipCell);
+
if (pDoc->IsHorOverlapped( nCurX, nCurY, nTab ))
{
aViewData.SetOldCursor( nCurX,nCurY );
@@ -1571,6 +1595,10 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
ScDocument* pDoc = aViewData.GetDocument();
pDoc->MakeTable( nTab );
+ // Update pending row heights before switching the sheet, so Reschedule from the progress bar
+ // doesn't paint the new sheet with old heights
+ aViewData.GetDocShell()->UpdatePendingRowHeights( nTab );
+
SCTAB nTabCount = pDoc->GetTableCount();
SCTAB nOldPos = nTab;
while (!pDoc->IsVisible(nTab)) // naechste sichtbare suchen
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 7461d884c5b2..525ea1f14578 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -75,6 +75,8 @@
#include "autofmt.hxx"
#include "dwfunctr.hxx"
#include "shtabdlg.hxx"
+#include "tabprotection.hxx"
+#include "protectiondlg.hxx"
#include <svtools/ilstitem.hxx>
#define _SVSTDARR_ULONGS
@@ -85,6 +87,10 @@
#include <svx/dialogs.hrc> //CHINA001
#include "scabstdlg.hxx" //CHINA001
+#include <memory>
+
+using ::std::auto_ptr;
+
#define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() )
#define IS_AVAILABLE(WhichId,ppItem) \
(pReqArgs->GetItemState((WhichId), TRUE, ppItem ) == SFX_ITEM_SET)
@@ -985,14 +991,6 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
break;
- case SID_STATUS_DOCPOS:
- {
- //! Navigator an-/ausschalten (wie im Writer) ???
- //!GetViewData()->GetDispatcher().Execute( SID_NAVIGATOR,
- //! SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
- }
- break;
-
case FID_PROTECT_DOC:
{
ScDocument* pDoc = GetViewData()->GetDocument();
@@ -1009,12 +1007,13 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
}
- if (pDoc->IsDocProtected())
+ ScDocProtection* pProtect = pDoc->GetDocProtection();
+ if (pProtect && pProtect->isProtected())
{
BOOL bCancel = FALSE;
String aPassword;
- if (pDoc->GetDocPassword().getLength())
+ if (pProtect->isProtectedWithPass())
{
String aText( ScResId(SCSTR_PASSWORD) );
@@ -1064,89 +1063,164 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
case FID_PROTECT_TABLE:
+ {
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ SCTAB nTab = GetViewData()->GetTabNo();
+ bool bOldProtection = pDoc->IsTabProtected(nTab);
+
+#if ENABLE_SHEET_PROTECTION
+
+ if( pReqArgs )
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- SCTAB nTab = GetViewData()->GetTabNo();
- SfxPasswordDialog* pDlg;
- String aPassword;
- BOOL bCancel = FALSE;
- BOOL bOldProtection = pDoc->IsTabProtected(nTab);
- BOOL bNewProtection = ! bOldProtection;
+ const SfxPoolItem* pItem;
+ bool bNewProtection = !bOldProtection;
+ if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
+ bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
+ if( bNewProtection == bOldProtection )
+ {
+ rReq.Ignore();
+ break;
+ }
+ }
- if( pReqArgs )
+ if (bOldProtection)
+ {
+ // Unprotect a protected sheet.
+
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ if (pProtect && pProtect->isProtectedWithPass())
{
- const SfxPoolItem* pItem;
- if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
- bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
- if( bNewProtection == bOldProtection )
+ String aText( ScResId(SCSTR_PASSWORDOPT) );
+ auto_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(GetDialogParent(), &aText));
+ pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
+ pDlg->SetMinLen( 0 );
+ pDlg->SetHelpId( FID_PROTECT_TABLE );
+ pDlg->SetEditHelpId( HID_PASSWD_TABLE );
+
+ if (pDlg->Execute() == RET_OK)
{
- rReq.Ignore();
- break;
+ String aPassword = pDlg->GetPassword();
+ Unprotect(nTab, aPassword);
}
}
+ else
+ // this sheet is not password-protected.
+ Unprotect(nTab, String());
- if ( bOldProtection)
- {
- if (pDoc->GetTabPassword(nTab).getLength())
- {
- String aText( ScResId(SCSTR_PASSWORD) );
+ if (!pReqArgs)
+ {
+ rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
+ rReq.Done();
+ }
+ }
+ else
+ {
+ // Protect a current sheet.
- pDlg = new SfxPasswordDialog( GetDialogParent(), &aText );
- pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
- pDlg->SetMinLen( 0 );
- pDlg->SetHelpId( FID_PROTECT_TABLE );
- pDlg->SetEditHelpId( HID_PASSWD_TABLE );
+ auto_ptr<ScTableProtectionDlg> pDlg(new ScTableProtectionDlg(GetDialogParent()));
- if (pDlg->Execute() == RET_OK)
- aPassword = pDlg->GetPassword();
- else
- bCancel = TRUE;
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ if (pProtect)
+ pDlg->SetDialogData(*pProtect);
- delete pDlg;
- }
- }
- else
- {
- String aText( ScResId(SCSTR_PASSWORDOPT) );
+ if (pDlg->Execute() == RET_OK)
+ {
+ pScMod->InputEnterHandler();
- pDlg = new SfxPasswordDialog( GetDialogParent(), &aText );
- pDlg->SetText( ScResId(SCSTR_PROTECTTAB) );
- pDlg->SetMinLen( 0 );
- pDlg->SetHelpId( FID_PROTECT_TABLE );
- pDlg->SetEditHelpId( HID_PASSWD_TABLE );
- pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
+ ScTableProtection aNewProtect;
+ pDlg->WriteData(aNewProtect);
+ ProtectSheet(nTab, aNewProtect);
+ if (!pReqArgs)
+ {
+ rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, true) );
+ rReq.Done();
+ }
+ }
+ }
+#else
+ auto_ptr<SfxPasswordDialog> pDlg;
+ String aPassword;
+ BOOL bCancel = FALSE;
+ bool bNewProtection = ! bOldProtection;
- if (pDlg->Execute() == RET_OK)
- aPassword = pDlg->GetPassword();
- else
- bCancel = TRUE;
+ if( pReqArgs )
+ {
+ const SfxPoolItem* pItem;
+ if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
+ bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
+ if( bNewProtection == bOldProtection )
+ {
+ rReq.Ignore();
+ break;
+ }
+ }
- delete pDlg;
- }
+ if ( bOldProtection)
+ {
+ // Unprotect a protected sheet.
- if( !bCancel )
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ if (pProtect && pProtect->isProtectedWithPass())
{
- if ( bOldProtection )
- Unprotect( nTab, aPassword );
+ String aText( ScResId(SCSTR_PASSWORDOPT) );
+ pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
+ pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
+ pDlg->SetMinLen( 0 );
+ pDlg->SetHelpId( FID_PROTECT_TABLE );
+ pDlg->SetEditHelpId( HID_PASSWD_TABLE );
+
+ if (pDlg->Execute() == RET_OK)
+ aPassword = pDlg->GetPassword();
else
- {
- pScMod->InputEnterHandler();
+ bCancel = TRUE;
+ }
- Protect( nTab, aPassword );
- }
+ if (!pReqArgs)
+ {
+ rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
+ rReq.Done();
+ }
+ }
+ else
+ {
+ String aText( ScResId(SCSTR_PASSWORDOPT) );
- if( !pReqArgs )
- {
- rReq.AppendItem( SfxBoolItem( FID_PROTECT_TABLE, bNewProtection ) );
- rReq.Done();
- }
+ pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
+ pDlg->SetText( ScResId(SCSTR_PROTECTTAB) );
+ pDlg->SetMinLen( 0 );
+ pDlg->SetHelpId( FID_PROTECT_TABLE );
+ pDlg->SetEditHelpId( HID_PASSWD_TABLE );
+ pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
+
+ if (pDlg->Execute() == RET_OK)
+ aPassword = pDlg->GetPassword();
+ else
+ bCancel = TRUE;
+ }
+
+ if( !bCancel )
+ {
+ if ( bOldProtection )
+ Unprotect( nTab, aPassword );
+ else
+ {
+ pScMod->InputEnterHandler();
+
+ Protect( nTab, aPassword );
}
- TabChanged();
- UpdateInputHandler(TRUE); // damit sofort wieder eingegeben werden kann
- SelectionChanged();
+ if( !pReqArgs )
+ {
+ rReq.AppendItem( SfxBoolItem( FID_PROTECT_TABLE, bNewProtection ) );
+ rReq.Done();
+ }
}
- break;
+#endif
+ TabChanged();
+ UpdateInputHandler(true); // damit sofort wieder eingegeben werden kann
+ SelectionChanged();
+ }
+ break;
case SID_OPT_LOCALE_CHANGED :
{ // locale changed, SYSTEM number formats changed => repaint cell contents
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 2b9ef68b1f8a..d8449ebc3699 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1190,6 +1190,10 @@ PrintDialog* __EXPORT ScTabViewShell::CreatePrintDialog( Window *pParent )
bool bAllTabs = SC_MOD()->GetPrintOptions().GetAllSheets();
pDlg->CheckSheetRange( bAllTabs ? PRINTSHEETS_ALL : PRINTSHEETS_SELECTED_SHEETS );
+ // update all pending row heights with a single progress bar,
+ // instead of a separate progress for each sheet from ScPrintFunc
+ pDocShell->UpdatePendingRowHeights( MAXTAB, true );
+
for ( SCTAB i=0; i<nTabCount; i++ )
{
ScPrintFunc aPrintFunc( pDocShell, pPrinter, i );
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 36c0c0694d18..92cf03cdf5d6 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -47,6 +47,7 @@
#include "tabvwsh.hxx"
#include "sc.hrc"
#include "global.hxx"
+#include "docsh.hxx"
#include "document.hxx"
#include "cell.hxx"
#include "globstr.hrc"
@@ -160,6 +161,10 @@ void __EXPORT ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
if (PaintExtras())
nParts = PAINT_ALL;
+ // if the current sheet has pending row height updates (sheet links refreshed),
+ // execute them before invalidating the window
+ GetViewData()->GetDocShell()->UpdatePendingRowHeights( GetViewData()->GetTabNo() );
+
if (nParts & PAINT_SIZE)
RepeatResize(); //! InvalidateBorder ???
if (nParts & PAINT_GRID)
diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx
index 5c6ca6843833..7526a3de19bd 100644
--- a/sc/source/ui/view/tabvwshh.cxx
+++ b/sc/source/ui/view/tabvwshh.cxx
@@ -43,6 +43,7 @@
#include <sfx2/request.hxx>
#include <basic/sbxcore.hxx>
#include <svtools/whiter.hxx>
+#include <vcl/msgbox.hxx>
#include "tabvwsh.hxx"
#include "client.hxx"
@@ -50,6 +51,10 @@
#include "docsh.hxx"
#include "sc.hrc"
#include "drwlayer.hxx" // GetVisibleName
+#include "retypepassdlg.hxx"
+#include "tabprotection.hxx"
+
+#include <memory>
using namespace com::sun::star;
@@ -270,6 +275,22 @@ BOOL ScTabViewShell::HasAccessibilityObjects()
return pAccessibilityBroadcaster != NULL;
}
+bool ScTabViewShell::ExecuteRetypePassDlg(ScPasswordHash eDesiredHash)
+{
+ using ::std::auto_ptr;
+
+ ScDocument* pDoc = GetViewData()->GetDocument();
+
+ auto_ptr<ScRetypePassDlg> pDlg(new ScRetypePassDlg(GetDialogParent()));
+ pDlg->SetDataFromDocument(*pDoc);
+ pDlg->SetDesiredHash(eDesiredHash);
+ if (pDlg->Execute() != RET_OK)
+ return false;
+
+ pDlg->WriteNewDataToDocument(*pDoc);
+ return true;
+}
+
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index a7b2f634bd6c..50ede74ab06b 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2197,7 +2197,7 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
pUndoDoc->SetVisible( nTab, pDoc->IsVisible( nTab ) );
if ( pDoc->IsTabProtected( nTab ) )
- pUndoDoc->SetTabProtection( nTab, TRUE, pDoc->GetTabPassword( nTab ) );
+ pUndoDoc->SetTabProtection(nTab, pDoc->GetTabProtection(nTab));
// Drawing-Layer muss sein Undo selbst in der Hand behalten !!!
// pUndoDoc->TransferDrawPage(pDoc, nTab,nTab);
@@ -2612,7 +2612,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy )
}
if ( nErrVal > 0 && pDoc->IsTabProtected( TheTabs[i] ) )
- pDestDoc->SetTabProtection( nDestTab1, TRUE, pDoc->GetTabPassword( TheTabs[i] ) );
+ pDestDoc->SetTabProtection(nDestTab1, pDoc->GetTabProtection(TheTabs[i]));
nDestTab1++;
}
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 57fef68c5f83..0f3a1c812802 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -81,6 +81,9 @@
#include "impex.hxx"
#include "editutil.hxx"
#include "editable.hxx"
+#include "dociter.hxx"
+#include "reffind.hxx"
+#include "compiler.hxx"
using namespace com::sun::star;
@@ -187,7 +190,128 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
ShowAllCursors();
}
}
+void ScViewFunc::DoRefConversion( BOOL bRecord )
+{
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ ScMarkData& rMark = GetViewData()->GetMarkData();
+ SCTAB nTabCount = pDoc->GetTableCount();
+ if (bRecord && !pDoc->IsUndoEnabled())
+ bRecord = FALSE;
+ ScRange aMarkRange;
+ rMark.MarkToSimple();
+ BOOL bMulti = rMark.IsMultiMarked();
+ if (bMulti)
+ rMark.GetMultiMarkArea( aMarkRange );
+ else if (rMark.IsMarked())
+ rMark.GetMarkArea( aMarkRange );
+ else
+ {
+ aMarkRange = ScRange( GetViewData()->GetCurX(),
+ GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+ }
+ ScEditableTester aTester( pDoc, aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
+ aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(),rMark );
+ if (!aTester.IsEditable())
+ {
+ ErrorMessage(aTester.GetMessageId());
+ return;
+ }
+
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
+ BOOL bOk = FALSE;
+
+ ScDocument* pUndoDoc = NULL;
+ if (bRecord)
+ {
+ pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ SCTAB nTab = aMarkRange.aStart.Tab();
+ pUndoDoc->InitUndo( pDoc, nTab, nTab );
+
+ if ( rMark.GetSelectCount() > 1 )
+ {
+ for (SCTAB i=0; i<nTabCount; i++)
+ if ( rMark.GetTableSelect(i) && i != nTab )
+ pUndoDoc->AddUndoTab( i, i );
+ }
+ ScRange aCopyRange = aMarkRange;
+ aCopyRange.aStart.SetTab(0);
+ aCopyRange.aEnd.SetTab(nTabCount-1);
+ pDoc->CopyToDocument( aCopyRange, IDF_ALL, bMulti, pUndoDoc, &rMark );
+ }
+
+ ScRangeListRef xRanges;
+ GetViewData()->GetMultiArea( xRanges );
+ ULONG nCount = xRanges->Count();
+
+ for (SCTAB i=0; i<nTabCount; i++)
+ {
+ if (rMark.GetTableSelect(i))
+ {
+ for (ULONG j=0; j<nCount; j++)
+ {
+ ScRange aRange = *xRanges->GetObject(j);
+ aRange.aStart.SetTab(i);
+ aRange.aEnd.SetTab(i);
+ ScCellIterator aIter( pDoc, aRange );
+ ScBaseCell* pCell = aIter.GetFirst();
+ while ( pCell )
+ {
+ if (pCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+ String aOld;
+ ((ScFormulaCell*)pCell)->GetFormula(aOld);
+ xub_StrLen nLen = aOld.Len();
+ ScRefFinder aFinder( aOld, pDoc );
+ aFinder.ToggleRel( 0, nLen );
+ if (aFinder.GetFound())
+ {
+ ScAddress aPos = ((ScFormulaCell*)pCell)->aPos;
+ String aNew = aFinder.GetText();
+ ScCompiler aComp( pDoc, aPos);
+ aComp.SetGrammar(pDoc->GetGrammar());
+ ScTokenArray* pArr = aComp.CompileString( aNew );
+ ScFormulaCell* pNewCell = new ScFormulaCell( pDoc, aPos,
+ pArr,formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE );
+ pDoc->PutCell( aPos, pNewCell );
+ bOk = TRUE;
+ }
+ }
+ pCell = aIter.GetNext();
+ }
+ }
+ }
+ }
+ if (bRecord)
+ {
+ ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
+ SCTAB nTab = aMarkRange.aStart.Tab();
+ pRedoDoc->InitUndo( pDoc, nTab, nTab );
+
+ if ( rMark.GetSelectCount() > 1 )
+ {
+ for (SCTAB i=0; i<nTabCount; i++)
+ if ( rMark.GetTableSelect(i) && i != nTab )
+ pRedoDoc->AddUndoTab( i, i );
+ }
+ ScRange aCopyRange = aMarkRange;
+ aCopyRange.aStart.SetTab(0);
+ aCopyRange.aEnd.SetTab(nTabCount-1);
+ pDoc->CopyToDocument( aCopyRange, IDF_ALL, bMulti, pRedoDoc, &rMark );
+
+ pDocSh->GetUndoManager()->AddUndoAction(
+ new ScUndoRefConversion( pDocSh,
+ aMarkRange, rMark, pUndoDoc, pRedoDoc, bMulti, IDF_ALL) );
+ }
+
+ pDocSh->PostPaint( aMarkRange, PAINT_GRID );
+ pDocSh->UpdateOle(GetViewData());
+ pDocSh->SetDocumentModified();
+ CellContentChanged();
+
+ if (!bOk)
+ ErrorMessage(STR_ERR_NOREF);
+}
// Thesaurus - Undo ok
void ScViewFunc::DoThesaurus( BOOL bRecord )
{
@@ -537,11 +661,13 @@ BOOL ScViewFunc::PasteFile( const Point& rPos, const String& rFile, BOOL bLink )
SfxDispatcher &rDispatcher = GetViewData()->GetDispatcher();
SfxStringItem aFileNameItem( SID_FILE_NAME, aStrURL );
SfxStringItem aFilterItem( SID_FILTER_NAME, pFlt->GetName() );
+ // #i69524# add target, as in SfxApplication when the Open dialog is used
+ SfxStringItem aTargetItem( SID_TARGETNAME, String::CreateFromAscii("_default") );
// Asynchron oeffnen, kann naemlich auch aus D&D heraus passieren
// und das bekommt dem MAC nicht so gut ...
return BOOL( 0 != rDispatcher.Execute( SID_OPENDOC,
- SFX_CALLMODE_ASYNCHRON, &aFileNameItem, &aFilterItem, 0L) );
+ SFX_CALLMODE_ASYNCHRON, &aFileNameItem, &aFilterItem, &aTargetItem, 0L) );
}
}
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index cb9d4eb0da72..ceb852354c7e 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -175,9 +175,11 @@ void ScViewFunc::EditNote()
// hide temporary note caption
HideNoteMarker();
// show caption object without changing internal visibility state
- pNote->ShowCaptionTemp();
+ pNote->ShowCaptionTemp( aPos );
- // drawing object has been created in ScDocument::GetOrCreateNote
+ /* Drawing object has been created in ScDocument::GetOrCreateNote() or
+ in ScPostIt::ShowCaptionTemp(), so ScPostIt::GetCaption() should
+ return a caption object. */
if( SdrCaptionObj* pCaption = pNote->GetCaption() )
{
// #i33764# enable the resize handles before starting edit mode
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 9df9dc5f5246..79343c31f85b 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -599,6 +599,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rS
}
else
{
+ DELETEZ(pUndoData);
ScFormulaCell* pCell = new ScFormulaCell( aCell, *pDoc, aPos );
if ( nError )
{
@@ -751,12 +752,13 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextOb
ScPatternAttr* pCellAttrs = NULL;
EditTextObject* pNewData = NULL;
String aString;
+
+ const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
+ ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() );
+ aEngine.SetText(*pData);
+
if (bTestSimple) // Testen, ob einfacher String ohne Attribute
{
- const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
- ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() );
- aEngine.SetText(*pData);
-
ScEditAttrTester aAttrTester( &aEngine );
bSimple = !aAttrTester.NeedsObject();
bCommon = aAttrTester.NeedsCellAttr();
@@ -777,11 +779,11 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextOb
pCellAttrs->GetFromEditItemSet( &aAttrTester.GetAttribs() );
//! remove common attributes from EditEngine?
}
-
- if (bSimple)
- aString = aEngine.GetText();
}
+ // #i97726# always get text for "repeat" of undo action
+ aString = ScEditUtil::GetSpaceDelimitedString(aEngine);
+
//
// Undo
//
@@ -838,7 +840,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextOb
{ // wg. ChangeTrack erst jetzt
pDocSh->GetUndoManager()->AddUndoAction(
new ScUndoEnterData( pDocSh, nCol, nRow, nTab, nPos, pTabs,
- ppOldCells, NULL, NULL, String(),
+ ppOldCells, NULL, NULL, aString,
pUndoData ) );
}
@@ -924,7 +926,7 @@ void ScViewFunc::EnterMatrix( const String& rString )
if (pData->GetSimpleArea(aRange) == SC_MARK_SIMPLE)
{
ScDocShell* pDocSh = pData->GetDocShell();
- BOOL bSuccess = pDocSh->GetDocFunc().EnterMatrix( aRange, &rMark, NULL, rString, FALSE, FALSE,formula::FormulaGrammar::GRAM_DEFAULT );
+ BOOL bSuccess = pDocSh->GetDocFunc().EnterMatrix( aRange, &rMark, NULL, rString, FALSE, FALSE, EMPTY_STRING, formula::FormulaGrammar::GRAM_DEFAULT );
if (bSuccess)
pDocSh->UpdateOle(GetViewData());
}
@@ -1179,103 +1181,69 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
const SvxBoxInfoItem* pNewInner, BOOL bRecord )
{
ScDocument* pDoc = GetViewData()->GetDocument();
- ScMarkData& rMark = GetViewData()->GetMarkData();
+ ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered
+ ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
- SCCOL nStartCol;
- SCROW nStartRow;
- SCTAB nStartTab;
- SCCOL nEndCol;
- SCROW nEndRow;
- SCTAB nEndTab;
-
- ScMarkType eMarkType = GetViewData()->GetSimpleArea( nStartCol, nStartRow,
- nStartTab, nEndCol, nEndRow, nEndTab);
- if (eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED)
+ ScRange aMarkRange;
+ aFuncMark.MarkToSimple();
+ BOOL bMulti = aFuncMark.IsMultiMarked();
+ if (bMulti)
+ aFuncMark.GetMultiMarkArea( aMarkRange );
+ else if (aFuncMark.IsMarked())
+ aFuncMark.GetMarkArea( aMarkRange );
+ else
{
- bool bChangeSelection = false;
- ScRange aMarkRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab );
- if ( eMarkType == SC_MARK_SIMPLE_FILTERED )
- {
- ScMarkData aVisibleMark( rMark );
- ScViewUtil::UnmarkFiltered( aVisibleMark, pDoc );
- ScRangeList aRangeList;
- aVisibleMark.FillRangeListWithMarks( &aRangeList, FALSE );
- if ( aRangeList.Count() > 0 )
- {
- // use the first range of visible cells
- // (might also show an error message instead, or, later, allow multiple ranges)
-
- aMarkRange = *aRangeList.GetObject(0);
- }
- else // all hidden -> cursor position
- {
- aMarkRange.aStart.SetCol(GetViewData()->GetCurX());
- aMarkRange.aStart.SetRow(GetViewData()->GetCurY());
- aMarkRange.aStart.SetTab(GetViewData()->GetTabNo());
- aMarkRange.aEnd = aMarkRange.aStart;
- }
- aMarkRange.GetVars( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab );
- bChangeSelection = true; // change the selection to only the affected cells
- }
-
- rMark.MarkToSimple(); // not done by GetSimpleArea anymore
+ aMarkRange = ScRange( GetViewData()->GetCurX(),
+ GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+ DoneBlockMode();
+ InitOwnBlockMode();
+ aFuncMark.SetMarkArea(aMarkRange);
+ MarkDataChanged();
+ }
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
- ScDocShellModificator aModificator( *pDocSh );
+ ScDocShellModificator aModificator( *pDocSh );
- if (!rMark.IsMarked() || bChangeSelection)
- {
- DoneBlockMode();
- InitOwnBlockMode();
- rMark.SetMarkArea( ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ) );
- MarkDataChanged();
- }
+ if (bRecord)
+ {
+ ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ SCTAB nStartTab = aMarkRange.aStart.Tab();
+ SCTAB nTabCount = pDoc->GetTableCount();
+ pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ for (SCTAB i=0; i<nTabCount; i++)
+ if (i != nStartTab && aFuncMark.GetTableSelect(i))
+ pUndoDoc->AddUndoTab( i, i );
- if (bRecord)
- {
- SCTAB nTabCount = pDoc->GetTableCount();
- ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
- for (SCTAB i=0; i<nTabCount; i++)
- if (i != nStartTab && rMark.GetTableSelect(i))
- pUndoDoc->AddUndoTab( i, i );
- pDoc->CopyToDocument( nStartCol, nStartRow, 0, nEndCol, nEndRow, nTabCount-1,
- IDF_ATTRIB, FALSE, pUndoDoc );
+ ScRange aCopyRange = aMarkRange;
+ aCopyRange.aStart.SetTab(0);
+ aCopyRange.aEnd.SetTab(nTabCount-1);
+ pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &aFuncMark );
- pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoSelectionAttr( pDocSh, rMark,
- nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab,
- pUndoDoc, FALSE, &rAttr, pNewOuter, pNewInner ) );
- }
+ pDocSh->GetUndoManager()->AddUndoAction(
+ new ScUndoSelectionAttr(
+ pDocSh, aFuncMark,
+ aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), aMarkRange.aStart.Tab(),
+ aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), aMarkRange.aEnd.Tab(),
+ pUndoDoc, bMulti, &rAttr, pNewOuter, pNewInner ) );
+ }
- USHORT nExt = SC_PF_TESTMERGE;
- pDocSh->UpdatePaintExt( nExt, nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab ); // content before the change
+ USHORT nExt = SC_PF_TESTMERGE;
+ pDocSh->UpdatePaintExt( nExt, aMarkRange ); // content before the change
- pDoc->ApplySelectionFrame( rMark, pNewOuter, pNewInner );
+ pDoc->ApplySelectionFrame( aFuncMark, pNewOuter, pNewInner );
- pDocSh->UpdatePaintExt( nExt, nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab ); // content after the change
+ pDocSh->UpdatePaintExt( nExt, aMarkRange ); // content after the change
- rMark.MarkToMulti();
- pDoc->ApplySelectionPattern( rAttr, rMark );
+ aFuncMark.MarkToMulti();
+ pDoc->ApplySelectionPattern( rAttr, aFuncMark );
- pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab,
- PAINT_GRID, nExt );
- pDocSh->UpdateOle(GetViewData());
- aModificator.SetDocumentModified();
- CellContentChanged();
- rMark.MarkToSimple();
- }
- else
- { // "Rahmen nicht auf Mehrfachselektion"
- ErrorMessage(STR_MSSG_APPLYPATTLINES_0);
- }
+ pDocSh->PostPaint( aMarkRange, PAINT_GRID, nExt );
+ pDocSh->UpdateOle(GetViewData());
+ aModificator.SetDocumentModified();
+ CellContentChanged();
StartFormatArea();
}
@@ -2215,6 +2183,7 @@ void ScViewFunc::SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pR
const SCCOLROW* pTabRanges = pRanges;
pDoc->IncSizeRecalcLevel( nTab ); // nicht fuer jede Spalte einzeln
+ pDoc->InitializeNoteCaptions( nTab );
for (SCCOLROW nRangeNo=0; nRangeNo<nRangeCnt; nRangeNo++)
{
SCCOLROW nStartNo = *(pTabRanges++);
@@ -2580,6 +2549,36 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, BOOL bOptimal )
ShowAllCursors();
}
+void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
+{
+ if (nTab == TABLEID_DOC)
+ return;
+
+ ScMarkData& rMark = GetViewData()->GetMarkData();
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
+ ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocFunc aFunc(*pDocSh);
+ bool bUndo(pDoc->IsUndoEnabled());
+
+ // modifying several tables is handled here
+
+ if (bUndo)
+ {
+ String aUndo = ScGlobal::GetRscString( STR_UNDO_PROTECT_TAB );
+ pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
+ }
+
+ SCTAB nCount = pDocSh->GetDocument()->GetTableCount();
+ for ( SCTAB i=0; i<nCount; i++ )
+ if ( rMark.GetTableSelect(i) )
+ aFunc.ProtectSheet(i, rProtect);
+
+ if (bUndo)
+ pDocSh->GetUndoManager()->LeaveListAction();
+
+ UpdateLayerLocks(); //! broadcast to all views
+}
+
void ScViewFunc::Protect( SCTAB nTab, const String& rPassword )
{
ScMarkData& rMark = GetViewData()->GetMarkData();