summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-05-15 16:29:32 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-05-15 16:29:32 +0000
commit3ce7d8ae026a8a9a6a2af2f6e7b3bf955bedf90b (patch)
treea300abd7f28f3166f6076d51a649ddbfcd4e1113 /sc
parent79ad1c597058615625961cd1e47ef5614aaf1a8c (diff)
CWS-TOOLING: integrate CWS calc49
2009-04-27 15:35:08 +0200 oc r271282 : #i101371 Adapt autotests because of changed standard filter dialog 2009-04-27 15:33:38 +0200 oc r271281 : #i101371 Adapt autotests because of changed standard filter dialog 2009-04-27 14:07:49 +0200 oc r271268 : #i101371 Autotest for NewStyle button in conditional formatting dialog 2009-04-27 14:05:43 +0200 oc r271267 : #i101371 Autotest for NewStyle button in conditional formatting dialog 2009-04-27 14:03:00 +0200 oc r271266 : #i101371 Autotest for NewStyle button in conditional formatting dialog 2009-04-02 14:04:47 +0200 nn r270403 : CWS-TOOLING: rebase CWS calc49 to trunk@270033 (milestone: DEV300:m45) 2009-03-25 14:18:26 +0100 nn r270025 : #i83643# adjust conditional formats when cell style is renamed (patch from gaojingmei) 2009-03-23 15:05:13 +0100 nn r269875 : gcc warnings 2009-03-23 14:20:06 +0100 nn r269871 : #i17995# order of OK/Cancel/Help/More is different between standard and advanced filter dialog 2009-03-20 19:15:21 +0100 nn r269825 : gcc warnings 2009-03-20 18:10:25 +0100 nn r269823 : #i70320# ScTabView::SetTabNo: don't deselect if called with bNew = TRUE 2009-03-18 17:28:04 +0100 nn r269695 : #i97974# CopyToTable: update draw page size (patch from gaozm) 2009-03-18 14:30:50 +0100 nn r269665 : #i45291# handle date/time input from validity dialog (patch from gaojingmei) 2009-03-18 11:43:17 +0100 nn r269648 : #i27253# add 'New Style' buttons to conditional formatting dialog 2009-03-17 19:04:02 +0100 nn r269624 : #i13829# include formats when sorting with toolbar buttons 2009-03-17 16:41:26 +0100 nn r269617 : #i17995# allow more criteria in standard filter dialog 2009-03-12 10:23:21 +0100 nn r269365 : #i7500# allow paste on merged cells (patch from mloiseleur/maoyg) 2009-03-12 09:57:17 +0100 nn r269360 : #i8302# insert/delete in merged cells (patch from maoyg) 2009-03-11 19:07:44 +0100 nn r269349 : #i27666# select current cell content in validity drop-down (patch from gaojingmei) 2009-03-11 19:03:40 +0100 nn r269348 : #i7921# right variable 2009-03-04 17:45:03 +0100 nn r268853 : #i7921# 'Deselect All Sheets' slot 2009-03-04 17:43:58 +0100 nn r268852 : #i70320# #i7921# 'Deselect All Sheets' in context menu and TabBar empty area 2009-03-03 17:50:40 +0100 nn r268774 : #i70320# deselect sheets when switching sheets and all sheets are selected 2009-03-03 14:50:44 +0100 nn r268728 : #i99714# unused methods (patch from cmc) 2009-02-23 19:47:06 +0100 nn r268369 : #i5550# lcl_DecompValueString: prefer end above beginning if not followed by space 2009-02-20 19:42:05 +0100 nn r268337 : #i93091# ScDBFunc::GetDBData: allow filtered rows in selection
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/conditio.hxx3
-rw-r--r--sc/inc/sc.hrc3
-rw-r--r--sc/sdi/scalc.sdi25
-rw-r--r--sc/sdi/tabvwsh.sdi1
-rw-r--r--sc/source/core/data/conditio.cxx14
-rw-r--r--sc/source/core/data/table2.cxx56
-rw-r--r--sc/source/core/data/table4.cxx9
-rw-r--r--sc/source/ui/attrdlg/condfrmt.cxx70
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx535
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx5
-rw-r--r--sc/source/ui/docshell/docfunc.cxx471
-rw-r--r--sc/source/ui/docshell/docsh4.cxx18
-rw-r--r--sc/source/ui/inc/condfrmt.hrc4
-rw-r--r--sc/source/ui/inc/condfrmt.hxx4
-rw-r--r--sc/source/ui/inc/filtdlg.hxx49
-rw-r--r--sc/source/ui/inc/filter.hrc7
-rw-r--r--sc/source/ui/inc/tabview.hxx1
-rw-r--r--sc/source/ui/src/condfrmt.src21
-rw-r--r--sc/source/ui/src/filter.src124
-rw-r--r--sc/source/ui/src/popup.src6
-rw-r--r--sc/source/ui/src/scstring.src10
-rw-r--r--sc/source/ui/undo/undoblk.cxx2
-rw-r--r--sc/source/ui/view/cellsh2.cxx37
-rw-r--r--sc/source/ui/view/dbfunc.cxx3
-rw-r--r--sc/source/ui/view/gridwin.cxx49
-rw-r--r--sc/source/ui/view/tabcont.cxx11
-rw-r--r--sc/source/ui/view/tabview2.cxx20
-rw-r--r--sc/source/ui/view/tabview3.cxx40
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx9
-rw-r--r--sc/source/ui/view/tabvwsha.cxx5
-rw-r--r--sc/source/ui/view/viewfun3.cxx34
31 files changed, 1366 insertions, 280 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 52d791999..7ee308df5 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -188,6 +188,7 @@ public:
int operator== ( const ScCondFormatEntry& r ) const;
const String& GetStyle() const { return aStyleName; }
+ void UpdateStyleName(const String& rNew) { aStyleName=rNew; }
protected:
virtual void DataChanged( const ScRange* pModified ) const;
@@ -224,6 +225,7 @@ public:
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos );
+ void RenameCellStyle( const String& rOld, const String& rNew );
void SourceChanged( const ScAddress& rAddr );
@@ -278,6 +280,7 @@ public:
void CompileXML();
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+ void RenameCellStyle( const String& rOld, const String& rNew );
void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos );
void SourceChanged( const ScAddress& rAddr );
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index fbeac17e6..79211b88d 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -832,6 +832,7 @@
#define FID_TAB_APPEND (TAB_POPUP_START+5)
#define FID_TAB_INDEX (TAB_POPUP_START+6)
#define FID_TAB_RTL (TAB_POPUP_START+7)
+#define FID_TAB_DESELECTALL (TAB_POPUP_START+8)
#define TAB_POPUP_END (DATA_MENU_END + 20)
@@ -1305,6 +1306,8 @@
#define SCSTR_DPFUNCLISTBOX (STR_START + 92)
#define STR_PRINT_NOTHING (STR_START + 93)
#define SCSTR_ALLFILTER (STR_START + 94)
+#define SCSTR_MOREBTN_MOREOPTIONS (STR_START + 95)
+#define SCSTR_MOREBTN_FEWEROPTIONS (STR_START + 96)
// Items
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 3c4ebc0b0..9a1678db6 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6870,6 +6870,31 @@ SfxVoidItem TableSelectAll FID_TAB_SELECTALL
]
//--------------------------------------------------------------------------
+SfxVoidItem TableDeselectAll FID_TAB_DESELECTALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
SfxVoidItem TextAttributes SID_DRAWTEXT_ATTR_DLG
()
[
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 412cf01e4..624cb09ad 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -53,6 +53,7 @@ interface Tables
]
{
FID_TAB_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; ]
+ FID_TAB_DESELECTALL [ ExecMethod = Execute; StateMethod = GetState; ]
FID_TAB_MENU_RENAME [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
FID_TAB_APPEND [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
FID_INS_TABLE [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index e1097daae..50fb22a95 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1455,6 +1455,13 @@ void ScConditionalFormat::UpdateReference( UpdateRefMode eUpdateRefMode,
pAreas = NULL;
}
+void ScConditionalFormat::RenameCellStyle(const String& rOld, const String& rNew)
+{
+ for (USHORT i=0; i<nEntryCount; i++)
+ if ( ppEntries[i]->GetStyle() == rOld )
+ ppEntries[i]->UpdateStyleName( rNew );
+}
+
void ScConditionalFormat::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos )
{
for (USHORT i=0; i<nEntryCount; i++)
@@ -1561,6 +1568,13 @@ void ScConditionalFormatList::UpdateReference( UpdateRefMode eUpdateRefMode,
(*this)[i]->UpdateReference( eUpdateRefMode, rRange, nDx, nDy, nDz );
}
+void ScConditionalFormatList::RenameCellStyle( const String& rOld, const String& rNew )
+{
+ ULONG nCount=Count();
+ for (USHORT i=0; i<nCount; i++)
+ (*this)[i]->RenameCellStyle(rOld,rNew);
+}
+
void ScConditionalFormatList::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos )
{
USHORT nCount = Count();
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 3d20822b2..707e34683 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -626,35 +626,43 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if ( pCharts && !pCharts->GetCount() )
pCharts = NULL;
- if (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth)
- for (SCCOL i=nCol1; i<=nCol2; i++)
- {
- BOOL bChange = pCharts &&
- ( pDestTab->pColFlags[i] & CR_HIDDEN ) != ( pColFlags[i] & CR_HIDDEN );
- pDestTab->pColWidth[i] = pColWidth[i];
- pDestTab->pColFlags[i] = pColFlags[i];
- //! Aenderungen zusammenfassen?
- if (bChange)
- pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, MAXROW, nTab ));
- }
+ BOOL bWidth = (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth);
+ BOOL bHeight = (nCol1==0 && nCol2==MAXCOL && pRowHeight && pDestTab->pRowHeight);
- if (nCol1==0 && nCol2==MAXCOL && pRowHeight && pDestTab->pRowHeight)
+ if (bWidth||bHeight)
{
- pDestTab->pRowHeight->CopyFrom( *pRowHeight, nRow1, nRow2);
- for (SCROW i=nRow1; i<=nRow2; i++)
+ pDestTab->IncRecalcLevel();
+
+ if (bWidth)
+ for (SCCOL i=nCol1; i<=nCol2; i++)
+ {
+ BOOL bChange = pCharts &&
+ ( pDestTab->pColFlags[i] & CR_HIDDEN ) != ( pColFlags[i] & CR_HIDDEN );
+ pDestTab->pColWidth[i] = pColWidth[i];
+ pDestTab->pColFlags[i] = pColFlags[i];
+ //! Aenderungen zusammenfassen?
+ if (bChange)
+ pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, MAXROW, nTab ));
+ }
+
+ if (bHeight)
{
- // TODO: might need some performance improvement, block
- // operations instead of single GetValue()/SetValue() calls.
- BYTE nThisRowFlags = pRowFlags->GetValue(i);
- BOOL bChange = pCharts &&
- ( pDestTab->pRowFlags->GetValue(i) & CR_HIDDEN ) != ( nThisRowFlags & CR_HIDDEN );
- pDestTab->pRowFlags->SetValue( i, nThisRowFlags );
- //! Aenderungen zusammenfassen?
- if (bChange)
- pCharts->SetRangeDirty(ScRange( 0, i, nTab, MAXCOL, i, nTab ));
+ pDestTab->pRowHeight->CopyFrom( *pRowHeight, nRow1, nRow2);
+ for (SCROW i=nRow1; i<=nRow2; i++)
+ {
+ // TODO: might need some performance improvement, block
+ // operations instead of single GetValue()/SetValue() calls.
+ BYTE nThisRowFlags = pRowFlags->GetValue(i);
+ BOOL bChange = pCharts &&
+ ( pDestTab->pRowFlags->GetValue(i) & CR_HIDDEN ) != ( nThisRowFlags & CR_HIDDEN );
+ pDestTab->pRowFlags->SetValue( i, nThisRowFlags );
+ //! Aenderungen zusammenfassen?
+ if (bChange)
+ pCharts->SetRangeDirty(ScRange( 0, i, nTab, MAXCOL, i, nTab ));
+ }
}
+ pDestTab->DecRecalcLevel();
}
-
pDestTab->SetOutlineTable( pOutlineTable ); // auch nur wenn bColRowFlags
}
}
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index daf1dc24b..edb90923a 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -106,7 +106,14 @@ short lcl_DecompValueString( String& aValue, sal_Int32& nVal, USHORT* pMinDigits
nNum = nNeg = 1;
while ( p[nNum] && CharClass::isAsciiNumeric( p[nNum] ) )
nNum++;
- if ( nNum > nNeg )
+
+ sal_Unicode cNext = p[nNum]; // 0 if at the end
+ sal_Unicode cLast = p[aValue.Len()-1];
+
+ // #i5550# If there are numbers at the beginning and the end,
+ // prefer the one at the beginning only if it's followed by a space.
+ // Otherwise, use the number at the end, to enable things like IP addresses.
+ if ( nNum > nNeg && ( cNext == 0 || cNext == ' ' || !CharClass::isAsciiNumeric(cLast) ) )
{ // number at the beginning
nVal = aValue.Copy( 0, nNum ).ToInt32();
// #60893# any number with a leading zero sets the minimum number of digits
diff --git a/sc/source/ui/attrdlg/condfrmt.cxx b/sc/source/ui/attrdlg/condfrmt.cxx
index dc739aa56..d64795b30 100644
--- a/sc/source/ui/attrdlg/condfrmt.cxx
+++ b/sc/source/ui/attrdlg/condfrmt.cxx
@@ -33,6 +33,7 @@
#include <sfx2/dispatch.hxx>
+#include <svtools/stritem.hxx>
#include "tabvwsh.hxx"
#include "reffact.hxx"
@@ -72,6 +73,7 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aRbCond12 ( this, ScResId( RB_COND1_2 ), &aEdtCond12,this ),
aFtCond1Template ( this, ScResId( FT_COND1_TEMPLATE ) ),
aLbCond1Template ( this, ScResId( LB_COND1_TEMPLATE ) ),
+ aBtnNew1 ( this, ScResId( BTN_COND1_NEW ) ),
aFlSep1 ( this, ScResId( FL_SEP1 ) ),
aCbxCond2 ( this, ScResId( CBX_COND2 ) ),
@@ -84,6 +86,7 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aRbCond22 ( this, ScResId( RB_COND2_2 ), &aEdtCond22,this ),
aFtCond2Template ( this, ScResId( FT_COND2_TEMPLATE ) ),
aLbCond2Template ( this, ScResId( LB_COND2_TEMPLATE ) ),
+ aBtnNew2 ( this, ScResId( BTN_COND2_NEW ) ),
aFlSep2 ( this, ScResId( FL_SEP2 ) ),
aCbxCond3 ( this, ScResId( CBX_COND3 ) ),
@@ -96,6 +99,7 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aRbCond32 ( this, ScResId( RB_COND3_2 ), &aEdtCond32,this ),
aFtCond3Template ( this, ScResId( FT_COND3_TEMPLATE ) ),
aLbCond3Template ( this, ScResId( LB_COND3_TEMPLATE ) ),
+ aBtnNew3 ( this, ScResId( BTN_COND3_NEW ) ),
aBtnOk ( this, ScResId( BTN_OK ) ),
aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
@@ -127,7 +131,12 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aBtnOk.SetClickHdl ( LINK( this, ScConditionalFormatDlg, BtnHdl ) );
//? aBtnCancel.SetClickHdl( LINK( this, ScConditionalFormatDlg, BtnHdl ) );
- Link aLink = LINK( this, ScConditionalFormatDlg, GetFocusHdl );
+ Link aLink = LINK( this, ScConditionalFormatDlg, NewBtnHdl );
+ aBtnNew1.SetClickHdl( aLink );
+ aBtnNew2.SetClickHdl( aLink );
+ aBtnNew3.SetClickHdl( aLink );
+
+ aLink = LINK( this, ScConditionalFormatDlg, GetFocusHdl );
aEdtCond11.SetGetFocusHdl( aLink );
aEdtCond12.SetGetFocusHdl( aLink );
aEdtCond21.SetGetFocusHdl( aLink );
@@ -478,6 +487,7 @@ IMPL_LINK( ScConditionalFormatDlg, ClickCond1Hdl, void *, EMPTYARG )
aRbCond12.Enable( bChecked );
aFtCond1Template.Enable( bChecked );
aLbCond1Template.Enable( bChecked );
+ aBtnNew1.Enable( bChecked );
return( 0L );
}
@@ -558,6 +568,7 @@ IMPL_LINK( ScConditionalFormatDlg, ClickCond2Hdl, void *, EMPTYARG )
aRbCond22.Enable( bChecked );
aFtCond2Template.Enable( bChecked );
aLbCond2Template.Enable( bChecked );
+ aBtnNew2.Enable( bChecked );
return( 0L );
}
@@ -638,6 +649,7 @@ IMPL_LINK( ScConditionalFormatDlg, ClickCond3Hdl, void *, EMPTYARG )
aRbCond32.Enable( bChecked );
aFtCond3Template.Enable( bChecked );
aLbCond3Template.Enable( bChecked );
+ aBtnNew3.Enable( bChecked );
return( 0L );
}
@@ -762,3 +774,59 @@ IMPL_LINK( ScConditionalFormatDlg, BtnHdl, PushButton*, pBtn )
}
+//----------------------------------------------------------------------------
+
+IMPL_LINK( ScConditionalFormatDlg, NewBtnHdl, PushButton*, pBtn )
+{
+ SfxUInt16Item aFamilyItem( SID_STYLE_FAMILY, SFX_STYLE_FAMILY_PARA );
+ SfxStringItem aRefItem( SID_STYLE_REFERENCE, ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
+
+ // unlock the dispatcher so SID_STYLE_NEW can be executed
+ // (SetDispatcherLock would affect all Calc documents)
+ SfxDispatcher* pDisp = GetBindings().GetDispatcher();
+ BOOL bLocked = pDisp->IsLocked();
+ if (bLocked)
+ pDisp->Lock(sal_False);
+
+ // Execute the "new style" slot, complete with undo and all necessary updates.
+ // The return value (SfxUInt16Item) is ignored, look for new styles instead.
+ pDisp->Execute( SID_STYLE_NEW, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD | SFX_CALLMODE_MODAL,
+ &aFamilyItem,
+ &aRefItem,
+ 0L );
+
+ if (bLocked)
+ pDisp->Lock(sal_True);
+
+ // Find the new style and add it into the style list boxes
+ String aNewStyle;
+ SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA );
+ for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() )
+ {
+ String aName = pStyle->GetName();
+ if ( aLbCond1Template.GetEntryPos(aName) == LISTBOX_ENTRY_NOTFOUND ) // all lists contain the same entries
+ {
+ aLbCond1Template.InsertEntry( aName );
+ aLbCond2Template.InsertEntry( aName );
+ aLbCond3Template.InsertEntry( aName );
+ // if there are several new styles (from API or a different view),
+ // assume the last one is the result of the dialog
+ aNewStyle = aName;
+ }
+ }
+
+ // select the new style in the list box for which the button was pressed
+ if ( aNewStyle.Len() )
+ {
+ ListBox* pListBox = &aLbCond1Template;
+ if ( pBtn == &aBtnNew2 )
+ pListBox = &aLbCond2Template;
+ else if ( pBtn == &aBtnNew3 )
+ pListBox = &aLbCond3Template;
+
+ pListBox->SelectEntry( aNewStyle );
+ }
+
+ return 0;
+}
+
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 7384b88f6..4a2d4d423 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -75,21 +75,33 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
: ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_FILTER ),
//
aFlCriteria ( this, ScResId( FL_CRITERIA ) ),
+ aLbConnect1 ( this, ScResId( LB_OP1 ) ),
aLbField1 ( this, ScResId( LB_FIELD1 ) ),
aLbCond1 ( this, ScResId( LB_COND1 ) ),
aEdVal1 ( this, ScResId( ED_VAL1 ) ),
- aLbConnect1 ( this, ScResId( LB_OP1 ) ),
+ aLbConnect2 ( this, ScResId( LB_OP2 ) ),
aLbField2 ( this, ScResId( LB_FIELD2 ) ),
aLbCond2 ( this, ScResId( LB_COND2 ) ),
aEdVal2 ( this, ScResId( ED_VAL2 ) ),
- aLbConnect2 ( this, ScResId( LB_OP2 ) ),
+ aLbConnect3 ( this, ScResId( LB_OP3 ) ),
aLbField3 ( this, ScResId( LB_FIELD3 ) ),
aLbCond3 ( this, ScResId( LB_COND3 ) ),
aEdVal3 ( this, ScResId( ED_VAL3 ) ),
+ aLbConnect4 ( this, ScResId( LB_OP4 ) ),
+ aLbField4 ( this, ScResId( LB_FIELD4 ) ),
+ aLbCond4 ( this, ScResId( LB_COND4 ) ),
+ aEdVal4 ( this, ScResId( ED_VAL4 ) ),
aFtConnect ( this, ScResId( FT_OP ) ),
aFtField ( this, ScResId( FT_FIELD ) ),
aFtCond ( this, ScResId( FT_COND ) ),
aFtVal ( this, ScResId( FT_VAL ) ),
+ aFlSeparator ( this, ScResId( FL_SEPARATOR ) ),
+ aScrollBar ( this, ScResId( LB_SCROLL ) ),
+ aFlOptions ( this, ScResId( FL_OPTIONS ) ),
+ aBtnMore ( this, ScResId( BTN_MORE ) ),
+ aBtnHelp ( this, ScResId( BTN_HELP ) ),
+ aBtnOk ( this, ScResId( BTN_OK ) ),
+ aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
_INIT_COMMON_FILTER_RSCOBJS
aStrEmpty ( ScResId( SCSTR_EMPTY ) ),
aStrNotEmpty ( ScResId( SCSTR_NOTEMPTY ) ),
@@ -110,7 +122,12 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
{
for (USHORT i=0; i<=MAXCOL; i++)
pEntryLists[i] = NULL;
-
+ for (SCSIZE i=0;i<MAXQUERY;i++)
+ {
+ bRefreshExceptQuery[i]=FALSE;
+ }
+ aBtnMore.SetMoreText( String(ScResId( SCSTR_MOREBTN_MOREOPTIONS )) );
+ aBtnMore.SetLessText( String(ScResId( SCSTR_MOREBTN_FEWEROPTIONS )) );
Init( rArgSet );
FreeResource();
@@ -153,8 +170,16 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
aLbField1.SetSelectHdl ( LINK( this, ScFilterDlg, LbSelectHdl ) );
aLbField2.SetSelectHdl ( LINK( this, ScFilterDlg, LbSelectHdl ) );
aLbField3.SetSelectHdl ( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbField4.SetSelectHdl ( LINK( this, ScFilterDlg, LbSelectHdl ) );
aLbConnect1.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
aLbConnect2.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbConnect3.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbConnect4.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+
+ aLbCond1.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbCond2.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbCond3.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbCond4.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
pViewData = rQueryItem.GetViewData();
pDoc = pViewData ? pViewData->GetDocument() : NULL;
@@ -164,12 +189,19 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
aFieldLbArr [0] = &aLbField1;
aFieldLbArr [1] = &aLbField2;
aFieldLbArr [2] = &aLbField3;
+ aFieldLbArr [3] = &aLbField4;
aValueEdArr [0] = &aEdVal1;
aValueEdArr [1] = &aEdVal2;
aValueEdArr [2] = &aEdVal3;
+ aValueEdArr [3] = &aEdVal4;
aCondLbArr [0] = &aLbCond1;
aCondLbArr [1] = &aLbCond2;
aCondLbArr [2] = &aLbCond3;
+ aCondLbArr [3] = &aLbCond4;
+ aConnLbArr [0] = &aLbConnect1;
+ aConnLbArr [1] = &aLbConnect2;
+ aConnLbArr [2] = &aLbConnect3;
+ aConnLbArr [3] = &aLbConnect4;
// Optionen initialisieren lassen:
@@ -197,7 +229,7 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
FillFieldLists();
- for ( SCSIZE i=0; i<3; i++ )
+ for ( SCSIZE i=0; i<4; i++ )
{
String aValStr;
USHORT nCondPos = 0;
@@ -208,7 +240,6 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
{
nCondPos = (USHORT)rEntry.eOp;
nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
-
if ( rEntry.nVal == SC_EMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING )
{
aValStr = aStrEmpty;
@@ -223,8 +254,14 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
aValStr = *rEntry.pStr;
}
else if ( i == 0 )
+ {
nFieldSelPos = GetFieldSelPos( pViewData->GetCurX() );
+ rEntry.nField = nFieldSelPos ? (theQueryData.nCol1 +
+ static_cast<SCCOL>(nFieldSelPos) - 1) : static_cast<SCCOL>(0);
+ rEntry.bDoQuery=TRUE;
+ bRefreshExceptQuery[i]=TRUE;
+ }
aFieldLbArr[i]->SelectEntryPos( nFieldSelPos );
aCondLbArr [i]->SelectEntryPos( nCondPos );
aValueEdArr[i]->SetText( aValStr );
@@ -232,26 +269,36 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
UpdateValueList( static_cast<USHORT>(i+1) );
}
+ aScrollBar.SetEndScrollHdl( LINK( this, ScFilterDlg, ScrollHdl ) );
+ aScrollBar.SetScrollHdl( LINK( this, ScFilterDlg, ScrollHdl ) );
+
+ aScrollBar.SetRange( Range( 0, 4 ) );
+ aScrollBar.SetLineSize( 1 );
+ aLbConnect1.Hide();
// Disable/Enable Logik:
(aLbField1.GetSelectEntryPos() != 0)
&& (aLbField2.GetSelectEntryPos() != 0)
- ? aLbConnect1.SelectEntryPos( (USHORT)theQueryData.GetEntry(1).eConnect )
- : aLbConnect1.SetNoSelection();
+ ? aLbConnect2.SelectEntryPos( (USHORT)theQueryData.GetEntry(1).eConnect )
+ : aLbConnect2.SetNoSelection();
(aLbField2.GetSelectEntryPos() != 0)
&& (aLbField3.GetSelectEntryPos() != 0)
- ? aLbConnect2.SelectEntryPos( (USHORT)theQueryData.GetEntry(2).eConnect )
- : aLbConnect2.SetNoSelection();
+ ? aLbConnect3.SelectEntryPos( (USHORT)theQueryData.GetEntry(2).eConnect )
+ : aLbConnect3.SetNoSelection();
+ (aLbField3.GetSelectEntryPos() != 0)
+ && (aLbField4.GetSelectEntryPos() != 0)
+ ? aLbConnect4.SelectEntryPos( (USHORT)theQueryData.GetEntry(3).eConnect )
+ : aLbConnect4.SetNoSelection();
if ( aLbField1.GetSelectEntryPos() == 0 )
{
- aLbConnect1.Disable();
+ aLbConnect2.Disable();
aLbField2.Disable();
aLbCond2.Disable();
aEdVal2.Disable();
}
- else if ( aLbConnect1.GetSelectEntryCount() == 0 )
+ else if ( aLbConnect2.GetSelectEntryCount() == 0 )
{
aLbField2.Disable();
aLbCond2.Disable();
@@ -260,17 +307,30 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
if ( aLbField2.GetSelectEntryPos() == 0 )
{
- aLbConnect2.Disable();
+ aLbConnect3.Disable();
aLbField3.Disable();
aLbCond3.Disable();
aEdVal3.Disable();
}
- else if ( aLbConnect2.GetSelectEntryCount() == 0 )
+ else if ( aLbConnect3.GetSelectEntryCount() == 0 )
{
aLbField3.Disable();
aLbCond3.Disable();
aEdVal3.Disable();
}
+ if ( aLbField3.GetSelectEntryPos() == 0 )
+ {
+ aLbConnect4.Disable();
+ aLbField4.Disable();
+ aLbCond4.Disable();
+ aEdVal4.Disable();
+ }
+ else if ( aLbConnect4.GetSelectEntryCount() == 0 )
+ {
+ aLbField4.Disable();
+ aLbCond4.Disable();
+ aEdVal4.Disable();
+ }
if(pDoc!=NULL &&
pDoc->GetChangeTrack()!=NULL) aBtnCopyResult.Disable();
@@ -332,9 +392,11 @@ void ScFilterDlg::FillFieldLists()
aLbField1.Clear();
aLbField2.Clear();
aLbField3.Clear();
+ aLbField4.Clear();
aLbField1.InsertEntry( aStrNone, 0 );
aLbField2.InsertEntry( aStrNone, 0 );
aLbField3.InsertEntry( aStrNone, 0 );
+ aLbField4.InsertEntry( aStrNone, 0 );
if ( pDoc )
{
@@ -358,6 +420,7 @@ void ScFilterDlg::FillFieldLists()
aLbField1.InsertEntry( aFieldName, i );
aLbField2.InsertEntry( aFieldName, i );
aLbField3.InsertEntry( aFieldName, i );
+ aLbField4.InsertEntry( aFieldName, i );
i++;
}
nFieldCount = i;
@@ -369,7 +432,7 @@ void ScFilterDlg::FillFieldLists()
void ScFilterDlg::UpdateValueList( USHORT nList )
{
- if ( pDoc && nList>0 && nList<=3 )
+ if ( pDoc && nList>0 && nList<=4 )
{
ComboBox* pValList = aValueEdArr[nList-1];
USHORT nFieldSelPos = aFieldLbArr[nList-1]->GetSelectEntryPos();
@@ -442,7 +505,7 @@ void ScFilterDlg::UpdateHdrInValueList( USHORT nList )
{
//! GetText / SetText ??
- if ( pDoc && nList>0 && nList<=3 )
+ if ( pDoc && nList>0 && nList<=4 )
{
USHORT nFieldSelPos = aFieldLbArr[nList-1]->GetSelectEntryPos();
if ( nFieldSelPos )
@@ -492,7 +555,7 @@ void ScFilterDlg::UpdateHdrInValueList( USHORT nList )
void ScFilterDlg::ClearValueList( USHORT nList )
{
- if ( nList>0 && nList<=3 )
+ if ( nList>0 && nList<=4 )
{
ComboBox* pValList = aValueEdArr[nList-1];
pValList->Clear();
@@ -519,10 +582,7 @@ ScQueryItem* ScFilterDlg::GetOutputItem()
{
ScAddress theCopyPos;
ScQueryParam theParam( theQueryData );
- USHORT nConnect1 = aLbConnect1.GetSelectEntryPos();
- USHORT nConnect2 = aLbConnect2.GetSelectEntryPos();
BOOL bCopyPosOk = FALSE;
- SCSIZE i;
if ( aBtnCopyResult.IsChecked() )
{
@@ -536,57 +596,6 @@ ScQueryItem* ScFilterDlg::GetOutputItem()
bCopyPosOk = ( SCA_VALID == (nResult & SCA_VALID) );
}
- for ( i = 0; i < 3; i++ )
- {
- USHORT nField = aFieldLbArr[i]->GetSelectEntryPos();
- ScQueryOp eOp = (ScQueryOp)aCondLbArr[i]->GetSelectEntryPos();
-
- BOOL bDoThis = (aFieldLbArr[i]->GetSelectEntryPos() != 0);
- theParam.GetEntry(i).bDoQuery = bDoThis;
-
- if ( bDoThis )
- {
- ScQueryEntry& rEntry = theParam.GetEntry(i);
-
- String aStrVal( aValueEdArr[i]->GetText() );
-
- /*
- * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer"
- * als Konstanten in nVal in Verbindung mit dem Schalter
- * bQueryByString auf FALSE.
- */
- if ( aStrVal == aStrEmpty )
- {
- rEntry.pStr->Erase();
- rEntry.nVal = SC_EMPTYFIELDS;
- rEntry.bQueryByString = FALSE;
- }
- else if ( aStrVal == aStrNotEmpty )
- {
- rEntry.pStr->Erase();
- rEntry.nVal = SC_NONEMPTYFIELDS;
- rEntry.bQueryByString = FALSE;
- }
- else
- {
- *rEntry.pStr = aStrVal;
- rEntry.nVal = 0;
- rEntry.bQueryByString = TRUE;
- }
-
- rEntry.nField = nField ? (theQueryData.nCol1 +
- static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
- rEntry.eOp = eOp;
- }
- }
-
- theParam.GetEntry(1).eConnect = (nConnect1 != LISTBOX_ENTRY_NOTFOUND)
- ? (ScQueryConnect)nConnect1
- : SC_AND;
- theParam.GetEntry(2).eConnect = (nConnect2 != LISTBOX_ENTRY_NOTFOUND)
- ? (ScQueryConnect)nConnect2
- : SC_AND;
-
if ( aBtnCopyResult.IsChecked() && bCopyPosOk )
{
theParam.bInplace = FALSE;
@@ -611,10 +620,6 @@ ScQueryItem* ScFilterDlg::GetOutputItem()
// nur die drei eingestellten - alles andere zuruecksetzen
- SCSIZE nEC = theParam.GetEntryCount();
- for (i=3; i<nEC; i++) // alles ueber 3
- theParam.GetEntry(i).bDoQuery = FALSE; // zuruecksetzen
-
DELETEZ( pOutItem );
pOutItem = new ScQueryItem( nWhichQuery, &theParam );
@@ -713,86 +718,231 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
* Behandlung der Enable/Disable-Logik,
* abhaengig davon, welche ListBox angefasst wurde:
*/
+ USHORT nOffset = GetSliderPos();
if ( pLb == &aLbConnect1 )
{
- if ( !aLbField2.IsEnabled() )
- {
- aLbField2.Enable();
- aLbCond2.Enable();
- aEdVal2.Enable();
- }
+ aLbField1.Enable();
+ aLbCond1.Enable();
+ aEdVal1.Enable();
+
+ USHORT nConnect1 = aLbConnect1.GetSelectEntryPos();
+ USHORT nQE = nOffset;
+ theQueryData.GetEntry(nQE).eConnect =(ScQueryConnect)nConnect1;
+ bRefreshExceptQuery[nQE]=TRUE;
}
+
else if ( pLb == &aLbConnect2 )
{
- if ( !aLbField3.IsEnabled() )
- {
- aLbField3.Enable();
- aLbCond3.Enable();
- aEdVal3.Enable();
- }
+ aLbField2.Enable();
+ aLbCond2.Enable();
+ aEdVal2.Enable();
+
+ USHORT nConnect2 = aLbConnect2.GetSelectEntryPos();
+ USHORT nQE = 1+nOffset;
+ theQueryData.GetEntry(nQE).eConnect =(ScQueryConnect)nConnect2;
+ bRefreshExceptQuery[nQE]=TRUE;
+ }
+ else if ( pLb == &aLbConnect3 )
+ {
+ aLbField3.Enable();
+ aLbCond3.Enable();
+ aEdVal3.Enable();
+
+ USHORT nConnect3 = aLbConnect3.GetSelectEntryPos();
+ USHORT nQE = 2+nOffset;
+ theQueryData.GetEntry(nQE).eConnect = (ScQueryConnect)nConnect3;
+ bRefreshExceptQuery[nQE]=TRUE;
+
+ }
+ else if ( pLb == &aLbConnect4 )
+ {
+ aLbField4.Enable();
+ aLbCond4.Enable();
+ aEdVal4.Enable();
+
+ USHORT nConnect4 = aLbConnect4.GetSelectEntryPos();
+ USHORT nQE = 3+nOffset;
+ theQueryData.GetEntry(nQE).eConnect = (ScQueryConnect)nConnect4;
+ bRefreshExceptQuery[nQE]=TRUE;
+
}
else if ( pLb == &aLbField1 )
{
if ( aLbField1.GetSelectEntryPos() == 0 )
{
- aLbConnect1.SetNoSelection();
aLbConnect2.SetNoSelection();
+ aLbConnect3.SetNoSelection();
+ aLbConnect4.SetNoSelection();
aLbField2.SelectEntryPos( 0 );
aLbField3.SelectEntryPos( 0 );
+ aLbField4.SelectEntryPos( 0 );
aLbCond2.SelectEntryPos( 0 );
aLbCond3.SelectEntryPos( 0 );
+ aLbCond4.SelectEntryPos( 0 );
ClearValueList( 1 );
ClearValueList( 2 );
ClearValueList( 3 );
+ ClearValueList( 4 );
- aLbConnect1.Disable();
aLbConnect2.Disable();
+ aLbConnect3.Disable();
+ aLbConnect4.Disable();
aLbField2.Disable();
aLbField3.Disable();
+ aLbField4.Disable();
aLbCond2.Disable();
aLbCond3.Disable();
+ aLbCond4.Disable();
aEdVal2.Disable();
aEdVal3.Disable();
+ aEdVal4.Disable();
+ for (USHORT i= nOffset; i< MAXQUERY; i++)
+ {
+ theQueryData.GetEntry(i).bDoQuery = FALSE;
+ bRefreshExceptQuery[i]=FALSE;
+ theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
+ }
+ bRefreshExceptQuery[nOffset] =TRUE;
}
else
{
UpdateValueList( 1 );
- if ( !aLbConnect1.IsEnabled() )
+ if ( !aLbConnect2.IsEnabled() )
{
- aLbConnect1.Enable();
+ aLbConnect2.Enable();
}
+ theQueryData.GetEntry(nOffset).bDoQuery = TRUE;
+ USHORT nField = pLb->GetSelectEntryPos();
+ theQueryData.GetEntry(nOffset).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
}
}
else if ( pLb == &aLbField2 )
{
if ( aLbField2.GetSelectEntryPos() == 0 )
{
- aLbConnect2.SetNoSelection();
+ aLbConnect3.SetNoSelection();
+ aLbConnect4.SetNoSelection();
aLbField3.SelectEntryPos( 0 );
+ aLbField4.SelectEntryPos( 0 );
aLbCond3.SelectEntryPos( 0 );
+ aLbCond4.SelectEntryPos( 0 );
ClearValueList( 2 );
ClearValueList( 3 );
+ ClearValueList( 4 );
- aLbConnect2.Disable();
+ aLbConnect3.Disable();
+ aLbConnect4.Disable();
aLbField3.Disable();
+ aLbField4.Disable();
aLbCond3.Disable();
+ aLbCond4.Disable();
aEdVal3.Disable();
+ aEdVal4.Disable();
+
+ USHORT nTemp=nOffset+1;
+ for (USHORT i= nTemp; i< MAXQUERY; i++)
+ {
+ theQueryData.GetEntry(i).bDoQuery = FALSE;
+ bRefreshExceptQuery[i]=FALSE;
+ theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
+ }
+ bRefreshExceptQuery[nTemp]=TRUE;
}
else
{
UpdateValueList( 2 );
- if ( !aLbConnect2.IsEnabled() )
+ if ( !aLbConnect3.IsEnabled() )
{
- aLbConnect2.Enable();
+ aLbConnect3.Enable();
}
+ USHORT nField = pLb->GetSelectEntryPos();
+ USHORT nQ=1+nOffset;
+ theQueryData.GetEntry(nQ).bDoQuery = TRUE;
+ theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
}
}
else if ( pLb == &aLbField3 )
{
- ( aLbField3.GetSelectEntryPos() == 0 )
- ? ClearValueList( 3 )
- : UpdateValueList( 3 );
+ if ( aLbField3.GetSelectEntryPos() == 0 )
+ {
+ aLbConnect4.SetNoSelection();
+ aLbField4.SelectEntryPos( 0 );
+ aLbCond4.SelectEntryPos( 0 );
+ ClearValueList( 3 );
+ ClearValueList( 4 );
+
+ aLbConnect4.Disable();
+ aLbField4.Disable();
+ aLbCond4.Disable();
+ aEdVal4.Disable();
+
+ USHORT nTemp=nOffset+2;
+ for (USHORT i= nTemp; i< MAXQUERY; i++)
+ {
+ theQueryData.GetEntry(i).bDoQuery = FALSE;
+ bRefreshExceptQuery[i]=FALSE;
+ theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
+ }
+ bRefreshExceptQuery[nTemp]=TRUE;
+ }
+ else
+ {
+ UpdateValueList( 3 );
+ if ( !aLbConnect4.IsEnabled() )
+ {
+ aLbConnect4.Enable();
+ }
+
+ USHORT nField = pLb->GetSelectEntryPos();
+ USHORT nQ=2+nOffset;
+ theQueryData.GetEntry(nQ).bDoQuery = TRUE;
+ theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
+
+ }
+ }
+ else if ( pLb == &aLbField4 )
+ {
+ if ( aLbField4.GetSelectEntryPos() == 0 )
+ {
+ ClearValueList( 4 );
+ USHORT nTemp=nOffset+3;
+ for (USHORT i= nTemp; i< MAXQUERY; i++)
+ {
+ theQueryData.GetEntry(i).bDoQuery = FALSE;
+ bRefreshExceptQuery[i]=FALSE;
+ theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
+ }
+ bRefreshExceptQuery[nTemp]=TRUE;
+ }
+ else
+ {
+ UpdateValueList( 4 );
+ USHORT nField = pLb->GetSelectEntryPos();
+ USHORT nQ=3+nOffset;
+ theQueryData.GetEntry(nQ).bDoQuery = TRUE;
+ theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
+ }
+
+ }
+ else if ( pLb == &aLbCond1)
+ {
+ theQueryData.GetEntry(nOffset).eOp=(ScQueryOp)pLb->GetSelectEntryPos();
+ }
+ else if ( pLb == &aLbCond2)
+ {
+ USHORT nQ=1+nOffset;
+ theQueryData.GetEntry(nQ).eOp=(ScQueryOp)pLb->GetSelectEntryPos();
+ }
+ else if ( pLb == &aLbCond3)
+ {
+ USHORT nQ=2+nOffset;
+ theQueryData.GetEntry(nQ).eOp=(ScQueryOp)pLb->GetSelectEntryPos();
+ }
+ else
+ {
+ USHORT nQ=3+nOffset;
+ theQueryData.GetEntry(nQ).eOp=(ScQueryOp)pLb->GetSelectEntryPos();
}
return 0;
@@ -814,14 +964,17 @@ IMPL_LINK( ScFilterDlg, CheckBoxHdl, CheckBox*, pBox )
USHORT nCurSel1 = aLbField1.GetSelectEntryPos();
USHORT nCurSel2 = aLbField2.GetSelectEntryPos();
USHORT nCurSel3 = aLbField3.GetSelectEntryPos();
+ USHORT nCurSel4 = aLbField4.GetSelectEntryPos();
FillFieldLists();
aLbField1.SelectEntryPos( nCurSel1 );
aLbField2.SelectEntryPos( nCurSel2 );
aLbField3.SelectEntryPos( nCurSel3 );
+ aLbField4.SelectEntryPos( nCurSel4 );
UpdateHdrInValueList( 1 );
UpdateHdrInValueList( 2 );
UpdateHdrInValueList( 3 );
+ UpdateHdrInValueList( 4 );
}
if ( pBox == &aBtnCase ) // Wertlisten komplett
@@ -832,6 +985,7 @@ IMPL_LINK( ScFilterDlg, CheckBoxHdl, CheckBox*, pBox )
UpdateValueList( 1 ); // aktueller Text wird gemerkt
UpdateValueList( 2 );
UpdateValueList( 3 );
+ UpdateValueList( 4 );
}
return 0;
@@ -842,27 +996,190 @@ IMPL_LINK( ScFilterDlg, CheckBoxHdl, CheckBox*, pBox )
IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd )
{
+ USHORT nOffset = GetSliderPos();
+ USHORT i=0;
+ USHORT nQE =i + nOffset;
if ( pEd )
{
- String aStrVal = pEd->GetText();
- ListBox* pLb = &aLbCond1;
-
- if ( pEd == &aEdVal2 ) pLb = &aLbCond2;
- else if ( pEd == &aEdVal3 ) pLb = &aLbCond3;
-
- // wenn einer der Sonderwerte leer/nicht-leer
- // gewaehlt wird, so macht nur der =-Operator Sinn:
+ String aStrVal = pEd->GetText();
+ ListBox* pLbCond = &aLbCond1;
+ ListBox* pLbField = &aLbField1;
+ if ( pEd == &aEdVal2 )
+ {
+ pLbCond = &aLbCond2;
+ pLbField = &aLbField2;
+ i=1;
+ nQE=i+nOffset;
+ }
+ if ( pEd == &aEdVal3 )
+ {
+ pLbCond = &aLbCond3;
+ pLbField = &aLbField3;
+ i=2;
+ nQE=i+nOffset;
+ }
+ if ( pEd == &aEdVal4 )
+ {
+ pLbCond = &aLbCond4;
+ pLbField = &aLbField4;
+ i=3;
+ nQE=i+nOffset;
+ }
if ( aStrEmpty == aStrVal || aStrNotEmpty == aStrVal )
{
- pLb->SelectEntry( '=' );
- pLb->Disable();
+ pLbCond->SelectEntry( '=' );
+ pLbCond->Disable();
}
else
- pLb->Enable();
- }
+ pLbCond->Enable();
+
+ ScQueryEntry& rEntry = theQueryData.GetEntry( nQE );
+ BOOL bDoThis = (pLbField->GetSelectEntryPos() != 0);
+ rEntry.bDoQuery = bDoThis;
+
+ if ( rEntry.bDoQuery || bRefreshExceptQuery[nQE] )
+ {
+ if ( aStrVal == aStrEmpty )
+ {
+ rEntry.pStr->Erase();
+ rEntry.nVal = SC_EMPTYFIELDS;
+ rEntry.bQueryByString = FALSE;
+ }
+ else if ( aStrVal == aStrNotEmpty )
+ {
+ rEntry.pStr->Erase();
+ rEntry.nVal = SC_NONEMPTYFIELDS;
+ rEntry.bQueryByString = FALSE;
+ }
+ else
+ {
+ *rEntry.pStr = aStrVal;
+ rEntry.nVal = 0;
+ rEntry.bQueryByString = TRUE;
+ }
+
+ USHORT nField = pLbField->GetSelectEntryPos();
+ rEntry.nField = nField ? (theQueryData.nCol1 +
+ static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
+
+ ScQueryOp eOp = (ScQueryOp)pLbCond->GetSelectEntryPos();
+ rEntry.eOp = eOp;
+
+ }
+ }
+ return 0;
+}
+//----------------------------------------------------------------------------
+IMPL_LINK( ScFilterDlg, ScrollHdl, ScrollBar*, EMPTYARG )
+{
+ SliderMoved();
return 0;
}
+void ScFilterDlg::SliderMoved()
+{
+ USHORT nOffset = GetSliderPos();
+ RefreshEditRow( nOffset);
+}
+USHORT ScFilterDlg::GetSliderPos()
+{
+ return (USHORT) aScrollBar.GetThumbPos();
+}
+void ScFilterDlg::RefreshEditRow( USHORT nOffset )
+{
+ if (nOffset==0)
+ aConnLbArr[0]->Hide();
+ else
+ aConnLbArr[0]->Show();
+
+ for ( USHORT i=0; i<4; i++ )
+ {
+ String aValStr;
+ USHORT nCondPos = 0;
+ USHORT nFieldSelPos = 0;
+ USHORT nQE = i+nOffset;
+
+ ScQueryEntry& rEntry = theQueryData.GetEntry( nQE);
+ if ( rEntry.bDoQuery || bRefreshExceptQuery[nQE] )
+ {
+ nCondPos = (USHORT)rEntry.eOp;
+ if(rEntry.bDoQuery)
+ nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
+
+ if ( rEntry.nVal == SC_EMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING )
+ {
+ aValStr = aStrEmpty;
+ aCondLbArr[i]->Disable();
+ }
+ else if ( rEntry.nVal == SC_NONEMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING )
+ {
+ aValStr = aStrNotEmpty;
+ aCondLbArr[i]->Disable();
+ }
+ else
+ {
+ aValStr = *rEntry.pStr;
+ aCondLbArr[i]->Enable();
+ }
+ aFieldLbArr[i]->Enable();
+ aValueEdArr[i]->Enable();
+ if (nOffset==0)
+ {
+ if (i<3)
+ {
+ if(rEntry.bDoQuery)
+ aConnLbArr[i+1]->Enable();
+ else
+ aConnLbArr[i+1]->Disable();
+ USHORT nQENext = nQE+1;
+ if(theQueryData.GetEntry(nQENext).bDoQuery || bRefreshExceptQuery[nQENext])
+ aConnLbArr[i+1]->SelectEntryPos( (USHORT) theQueryData.GetEntry(nQENext).eConnect );
+ else
+ aConnLbArr[i+1]->SetNoSelection();
+ }
+ }
+ else
+ {
+ if(theQueryData.GetEntry( nQE-1).bDoQuery)
+ aConnLbArr[i]->Enable();
+ else
+ aConnLbArr[i]->Disable();
+
+ if(rEntry.bDoQuery || bRefreshExceptQuery[nQE])
+ aConnLbArr[i]->SelectEntryPos( (USHORT) rEntry.eConnect );
+ else
+ aConnLbArr[i]->SetNoSelection();
+ }
+
+ }
+ else
+ {
+ if (nOffset==0)
+ {
+ if(i<3)
+ {
+ aConnLbArr[i+1]->SetNoSelection();
+ aConnLbArr[i+1]->Disable();
+ }
+ }
+ else
+ {
+ if(theQueryData.GetEntry( nQE-1).bDoQuery)
+ aConnLbArr[i]->Enable();
+ else
+ aConnLbArr[i]->Disable();
+ aConnLbArr[i]->SetNoSelection();
+ }
+ aFieldLbArr[i]->Disable();
+ aCondLbArr[i]->Disable();
+ aValueEdArr[i]->Disable();
+ }
+ aFieldLbArr[i]->SelectEntryPos( nFieldSelPos );
+ aCondLbArr [i]->SelectEntryPos( nCondPos );
+ aValueEdArr[i]->SetText( aValStr );
+ UpdateValueList( static_cast<USHORT>(i+1) );
+ }
+}
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index f6adfe46a..86de32ed2 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -78,7 +78,12 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi
aEdFilterArea ( this, this, ScResId( ED_CRITERIA_AREA ) ),
aRbFilterArea ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea, this ),
//
+ aFlOptions ( this, ScResId( FL_OPTIONS ) ),
_INIT_COMMON_FILTER_RSCOBJS
+ aBtnOk ( this, ScResId( BTN_OK ) ),
+ aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, ScResId( BTN_HELP ) ),
+ aBtnMore ( this, ScResId( BTN_MORE ) ),
//
pOptionsMgr ( NULL ),
nWhichQuery ( rArgSet.GetPool()->GetWhich( SID_QUERY ) ),
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 5c15f2952..dc50dae5e 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -59,6 +59,7 @@
#include "arealink.hxx"
#include "attrib.hxx"
+#include "dociter.hxx"
#include "autoform.hxx"
#include "cell.hxx"
#include "detdata.hxx"
@@ -1307,6 +1308,15 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
BOOL bSuccess;
SCTAB i;
+ ScTabViewShell* pViewSh = rDocShell.GetBestViewShell(); //preserve current cursor position
+ SCCOL nCursorCol = 0;
+ SCROW nCursorRow = 0;
+ if( pViewSh )
+ {
+ nCursorCol = pViewSh->GetViewData()->GetCurX();
+ nCursorRow = pViewSh->GetViewData()->GetCurY();
+ }
+
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
@@ -1340,22 +1350,33 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nMergeTestEndX = nEndCol;
SCROW nMergeTestEndY = nEndRow;
- if (eCmd==INS_INSROWS)
+ ScRange aExtendMergeRange( rRange );
+
+ if( rRange.aStart == rRange.aEnd && pDoc->HasAttrib(rRange, HASATTR_MERGED) )
+ {
+ pDoc->ExtendMerge( aExtendMergeRange );
+ pDoc->ExtendOverlapped( aExtendMergeRange );
+ nMergeTestEndX = aExtendMergeRange.aEnd.Col();
+ nMergeTestEndY = aExtendMergeRange.aEnd.Row();
+ nPaintEndX = nMergeTestEndX;
+ nPaintEndY = nMergeTestEndY;
+ }
+
+ if ( eCmd == INS_INSROWS )
{
nMergeTestStartX = 0;
nMergeTestEndX = MAXCOL;
}
- if (eCmd==INS_INSCOLS)
+ if ( eCmd == INS_INSCOLS )
{
nMergeTestStartY = 0;
nMergeTestEndY = MAXROW;
}
- if (eCmd==INS_CELLSDOWN)
+ if ( eCmd == INS_CELLSDOWN )
nMergeTestEndY = MAXROW;
- if (eCmd==INS_CELLSRIGHT)
+ if ( eCmd == INS_CELLSRIGHT )
nMergeTestEndX = MAXCOL;
- BOOL bCanDo = TRUE;
BOOL bNeedRefresh = FALSE;
SCCOL nEditTestEndX = (eCmd==INS_INSCOLS) ? MAXCOL : nMergeTestEndX;
@@ -1368,12 +1389,35 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
return FALSE;
}
+ WaitObject aWait( rDocShell.GetActiveDialogParent() ); // wichtig wegen TrackFormulas bei UpdateReference
+
+ ScDocument* pRefUndoDoc = NULL;
+ ScRefUndoData* pUndoData = NULL;
+ if ( bRecord )
+ {
+ pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, FALSE, FALSE );
+
+ // pRefUndoDoc is filled in InsertCol / InsertRow
+
+ pUndoData = new ScRefUndoData( pDoc );
+
+ pDoc->BeginDrawUndo();
+ }
+
+ // #i8302 : we unmerge overwhelming ranges, before insertion all the actions are put in the same ListAction
+ // the patch comes from mloiseleur and maoyg
+ BOOL bInsertMerge = FALSE;
+ std::vector<ScRange> qIncreaseRange;
+ String aUndo = ScGlobal::GetRscString( STR_UNDO_INSERTCELLS );
+ if (bRecord)
+ rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo );
+
for( i=0; i<nTabCount; i++ )
{
if( aMark.GetTableSelect(i) )
{
- if (pDoc->HasAttrib( nMergeTestStartX,nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i,
- HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ if( pDoc->HasAttrib( nMergeTestStartX, nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
if (eCmd==INS_CELLSRIGHT)
bNeedRefresh = TRUE;
@@ -1385,49 +1429,115 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
- if ( nMergeStartX != nMergeTestStartX || nMergeStartY != nMergeTestStartY ||
- nMergeEndX != nMergeTestEndX || nMergeEndY != nMergeTestEndY )
- bCanDo = FALSE;
-
- //! ? nur Start testen ?
+
+ if(( eCmd == INS_CELLSDOWN && ( nMergeStartX != nMergeTestStartX || nMergeEndX != nMergeTestEndX ))||
+ eCmd == INS_CELLSRIGHT && ( nMergeStartY != nMergeTestStartY || nMergeEndY != nMergeTestEndY ) )
+ {
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
+ rDocShell.GetUndoManager()->LeaveListAction();
+ return FALSE;
+ }
+
+ SCCOL nTestCol = -1;
+ SCROW nTestRow1 = -1;
+ SCROW nTestRow2 = -1;
+
+ ScDocAttrIterator aTestIter( pDoc, i, nMergeTestStartX, nMergeTestStartY, nMergeTestEndX, nMergeTestEndY );
+ ScRange aExtendRange( nMergeTestStartX, nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i );
+ const ScPatternAttr* pPattern = NULL;
+ const ScMergeAttr* pMergeFlag = NULL;
+ const ScMergeFlagAttr* pMergeFlagAttr = NULL;
+ while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != NULL )
+ {
+ pMergeFlag = (const ScMergeAttr*) &pPattern->GetItem(ATTR_MERGE);
+ pMergeFlagAttr = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG);
+ INT16 nNewFlags = pMergeFlagAttr->GetValue() & ( SC_MF_HOR | SC_MF_VER );
+ if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
+ {
+ ScRange aRange( nTestCol, nTestRow1, i );
+ pDoc->ExtendOverlapped(aRange);
+ pDoc->ExtendMerge(aRange, TRUE, TRUE);
- if (!bCanDo)
- if ( eCmd==INS_INSCOLS || eCmd==INS_INSROWS )
- if ( nMergeStartX == nMergeTestStartX && nMergeStartY == nMergeTestStartY )
+ if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
{
- bCanDo = TRUE;
+ for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ )
+ {
+ ScRange aTestRange( nTestCol, nTestRow, i );
+ pDoc->ExtendOverlapped( aTestRange );
+ pDoc->ExtendMerge( aTestRange, TRUE, TRUE);
+ ScRange aMergeRange( aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
+ if( !aExtendRange.In( aMergeRange ) )
+ {
+ qIncreaseRange.push_back( aTestRange );
+ bInsertMerge = TRUE;
+ }
+ }
}
- }
-
- if (!bCanDo)
- {
- //! auf Verschieben (Drag&Drop) zurueckfuehren !!!
- // "Kann nicht in zusammengefasste Bereiche einfuegen"
- if (!bApi)
- rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
- return FALSE;
- }
- }
- }
-
- //
- // ausfuehren
- //
-
- WaitObject aWait( rDocShell.GetActiveDialogParent() ); // wichtig wegen TrackFormulas bei UpdateReference
+ else
+ {
+ ScRange aMergeRange( aRange.aStart.Col(),aRange.aStart.Row(), i );
+ if( !aExtendRange.In( aMergeRange ) )
+ {
+ qIncreaseRange.push_back( aRange );
+ }
+ bInsertMerge = TRUE;
+ }
+ }
+ }
- ScDocument* pRefUndoDoc = NULL;
- ScRefUndoData* pUndoData = NULL;
- if ( bRecord )
- {
- pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, FALSE, FALSE );
+ if( bInsertMerge )
+ {
+ if( eCmd == INS_INSROWS || eCmd == INS_CELLSDOWN )
+ {
+ nStartRow = aExtendMergeRange.aStart.Row();
+ nEndRow = aExtendMergeRange.aEnd.Row();
- // pRefUndoDoc is filled in InsertCol / InsertRow
+ if( eCmd == INS_CELLSDOWN )
+ nEndCol = nMergeTestEndX;
+ else
+ {
+ nStartCol = 0;
+ nEndCol = MAXCOL;
+ }
+ }
+ else if( eCmd == INS_CELLSRIGHT || eCmd == INS_INSCOLS )
+ {
- pUndoData = new ScRefUndoData( pDoc );
+ nStartCol = aExtendMergeRange.aStart.Col();
+ nEndCol = aExtendMergeRange.aEnd.Col();
+ if( eCmd == INS_CELLSRIGHT )
+ {
+ nEndRow = nMergeTestEndY;
+ }
+ else
+ {
+ nStartRow = 0;
+ nEndRow = MAXROW;
+ }
+ }
- pDoc->BeginDrawUndo();
+ if( !qIncreaseRange.empty() )
+ {
+ for( ::std::vector<ScRange>::const_iterator iIter( qIncreaseRange.begin()); iIter != qIncreaseRange.end(); iIter++ )
+ {
+ ScRange aRange( *iIter );
+ if( pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ {
+ UnmergeCells( aRange, TRUE, TRUE );
+ }
+ }
+ }
+ }
+ else
+ {
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
+ rDocShell.GetUndoManager()->LeaveListAction();
+ return FALSE;
+ }
+ }
+ }
}
switch (eCmd)
@@ -1509,6 +1619,7 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB* pTabs = NULL;
SCTAB* pScenarios = NULL;
SCTAB nUndoPos = 0;
+
if ( bRecord )
{
pTabs = new SCTAB[nSelCount];
@@ -1518,7 +1629,6 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
{
if( aMark.GetTableSelect( i ) )
{
-
SCTAB nCount = 0;
for( SCTAB j=i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
nCount ++;
@@ -1528,11 +1638,45 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
nUndoPos ++;
}
}
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoInsertCells(
+
+ if( !bInsertMerge )
+ {
+ rDocShell.GetUndoManager()->LeaveListAction();
+ }
+
+ rDocShell.GetUndoManager()->AddUndoAction( new ScUndoInsertCells(
&rDocShell, ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ),
nUndoPos, pTabs, pScenarios, eCmd, pRefUndoDoc, pUndoData, bPartOfPaste ) );
}
+ // #i8302 : we remerge growing ranges, with the new part inserted
+
+ while( !qIncreaseRange.empty() )
+ {
+ ScRange aRange = qIncreaseRange.back();
+ if( !pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ {
+ switch (eCmd)
+ {
+ case INS_CELLSDOWN:
+ case INS_INSROWS:
+ aRange.aEnd.IncRow(static_cast<SCsCOL>(nEndRow-nStartRow+1));
+ break;
+ case INS_CELLSRIGHT:
+ case INS_INSCOLS:
+ aRange.aEnd.IncCol(static_cast<SCsCOL>(nEndCol-nStartCol+1));
+ break;
+ default:
+ break;
+ }
+ MergeCells(aRange, FALSE, TRUE, TRUE);
+ }
+ qIncreaseRange.pop_back();
+ }
+
+ if( bInsertMerge )
+ rDocShell.GetUndoManager()->LeaveListAction();
+
for( i=0; i<nTabCount; i++ )
{
if( aMark.GetTableSelect( i ) )
@@ -1565,15 +1709,39 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDocShell.PostPaint( nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i+nScenarioCount, nPaintFlags, nExtFlags );
}
}
- aModificator.SetDocumentModified();
+ //aModificator.SetDocumentModified();
}
else
{
+ if( bInsertMerge )
+ {
+ while( !qIncreaseRange.empty() )
+ {
+ ScRange aRange = qIncreaseRange.back();
+ MergeCells(aRange, FALSE, TRUE, TRUE);
+ qIncreaseRange.pop_back();
+ }
+
+ if( pViewSh )
+ {
+ pViewSh->MarkRange( rRange, FALSE );
+ pViewSh->SetCursor( nCursorCol, nCursorRow );
+ }
+ }
+
+ rDocShell.GetUndoManager()->LeaveListAction();
+ SfxUndoManager* pMgr = rDocShell.GetUndoManager();
+ pMgr->RemoveLastUndoAction();
+
delete pRefUndoDoc;
delete pUndoData;
if (!bApi)
rDocShell.ErrorMessage(STR_INSERT_FULL); // Spalte/Zeile voll
}
+
+ aModificator.SetDocumentModified();
+
+ SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
return bSuccess;
}
@@ -1634,6 +1802,18 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nUndoEndX = nEndCol;
SCROW nUndoEndY = nEndRow;
+ ScRange aExtendMergeRange( rRange );
+
+ if( rRange.aStart == rRange.aEnd && pDoc->HasAttrib(rRange, HASATTR_MERGED) )
+ {
+ pDoc->ExtendMerge( aExtendMergeRange );
+ pDoc->ExtendOverlapped( aExtendMergeRange );
+ nUndoEndX = aExtendMergeRange.aEnd.Col();
+ nUndoEndY = aExtendMergeRange.aEnd.Row();
+ nPaintEndX = nUndoEndX;
+ nPaintEndY = nUndoEndY;
+ }
+
if (eCmd==DEL_DELROWS)
{
nUndoStartX = 0;
@@ -1644,7 +1824,6 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nUndoStartY = 0;
nUndoEndY = MAXROW;
}
-
// Test Zellschutz
SCCOL nEditTestEndX = nUndoEndX;
@@ -1665,19 +1844,24 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nMergeTestEndX = (eCmd==DEL_CELLSLEFT) ? MAXCOL : nUndoEndX;
SCROW nMergeTestEndY = (eCmd==DEL_CELLSUP) ? MAXROW : nUndoEndY;
- BOOL bCanDo = TRUE;
+ SCCOL nExtendStartCol = nUndoStartX;
+ SCROW nExtendStartRow = nUndoStartY;
BOOL bNeedRefresh = FALSE;
+ //Issue 8302 want to be able to insert into the middle of merged cells
+ //the patch comes from maoyg
+ ::std::vector<ScRange> qDecreaseRange;
+ BOOL bDeletingMerge = FALSE;
+ String aUndo = ScGlobal::GetRscString( STR_UNDO_DELETECELLS );
+ if (bRecord)
+ rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo );
+
for( i=0; i<nTabCount; i++ )
{
if( aMark.GetTableSelect(i) )
{
- if (pDoc->HasAttrib( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i,
- HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ if ( pDoc->HasAttrib( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i, HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
- if ( eCmd==DEL_CELLSLEFT || eCmd==DEL_CELLSUP )
- bNeedRefresh = TRUE;
-
SCCOL nMergeStartX = nUndoStartX;
SCROW nMergeStartY = nUndoStartY;
SCCOL nMergeEndX = nMergeTestEndX;
@@ -1685,28 +1869,119 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
- if ( nMergeStartX != nUndoStartX || nMergeStartY != nUndoStartY ||
- nMergeEndX != nMergeTestEndX || nMergeEndY != nMergeTestEndY )
- bCanDo = FALSE;
+ if( ( eCmd == DEL_CELLSUP && ( nMergeStartX != nUndoStartX || nMergeEndX != nMergeTestEndX))||
+ ( eCmd == DEL_CELLSLEFT && ( nMergeStartY != nUndoStartY || nMergeEndY != nMergeTestEndY)))
+ {
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_DELETECELLS_0);
+ rDocShell.GetUndoManager()->LeaveListAction();
+ return FALSE;
+ }
- // ganze Zeilen/Spalten: Testen, ob Merge komplett geloescht werden kann
+ nExtendStartCol = nMergeStartX;
+ nExtendStartRow = nMergeStartY;
+ SCCOL nTestCol = -1;
+ SCROW nTestRow1 = -1;
+ SCROW nTestRow2 = -1;
+
+ ScDocAttrIterator aTestIter( pDoc, i, nUndoStartX, nUndoStartY, nMergeTestEndX, nMergeTestEndY );
+ ScRange aExtendRange( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i );
+ const ScPatternAttr* pPattern = NULL;
+ const ScMergeAttr* pMergeFlag = NULL;
+ const ScMergeFlagAttr* pMergeFlagAttr = NULL;
+ while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != NULL )
+ {
+ pMergeFlag = (const ScMergeAttr*) &pPattern->GetItem( ATTR_MERGE );
+ pMergeFlagAttr = (const ScMergeFlagAttr*) &pPattern->GetItem( ATTR_MERGE_FLAG );
+ INT16 nNewFlags = pMergeFlagAttr->GetValue() & ( SC_MF_HOR | SC_MF_VER );
+ if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
+ {
+ ScRange aRange( nTestCol, nTestRow1, i );
+ pDoc->ExtendOverlapped( aRange );
+ pDoc->ExtendMerge( aRange, TRUE, TRUE );
- if (!bCanDo)
- if ( eCmd==DEL_DELCOLS || eCmd==DEL_DELROWS )
- if ( nMergeStartX == nUndoStartX && nMergeStartY == nUndoStartY )
+ if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
+ {
+ for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ )
+ {
+ ScRange aTestRange( nTestCol, nTestRow, i );
+ pDoc->ExtendOverlapped( aTestRange );
+ pDoc->ExtendMerge( aTestRange, TRUE, TRUE);
+ ScRange aMergeRange( aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
+ if( !aExtendRange.In( aMergeRange ) )
+ {
+ qDecreaseRange.push_back( aTestRange );
+ bDeletingMerge = TRUE;
+ }
+ }
+ }
+ else
{
- bCanDo = TRUE;
+ ScRange aMergeRange( aRange.aStart.Col(),aRange.aStart.Row(), i );
+ if( !aExtendRange.In( aMergeRange ) )
+ {
+ qDecreaseRange.push_back( aRange );
+ }
+ bDeletingMerge = TRUE;
+ }
+ }
+ }
+
+ if( bDeletingMerge )
+ {
+
+ if( eCmd == DEL_DELROWS || eCmd == DEL_CELLSUP )
+ {
+ nStartRow = aExtendMergeRange.aStart.Row();
+ nEndRow = aExtendMergeRange.aEnd.Row();
+ bNeedRefresh = TRUE;
+
+ if( eCmd == DEL_CELLSUP )
+ {
+ nEndCol = aExtendMergeRange.aEnd.Col();
+ }
+ else
+ {
+ nStartCol = 0;
+ nEndCol = MAXCOL;
+ }
+ }
+ else if( eCmd == DEL_CELLSLEFT || eCmd == DEL_DELCOLS )
+ {
+
+ nStartCol = aExtendMergeRange.aStart.Col();
+ nEndCol = aExtendMergeRange.aEnd.Col();
+ if( eCmd == DEL_CELLSLEFT )
+ {
+ nEndRow = aExtendMergeRange.aEnd.Row();
bNeedRefresh = TRUE;
}
- }
+ else
+ {
+ nStartRow = 0;
+ nEndRow = MAXROW;
+ }
+ }
- if (!bCanDo)
- {
- //! auf Verschieben (Drag&Drop) zurueckfuehren !!!
- // "Kann nicht aus zusammengefassten Bereichen loeschen"
- if (!bApi)
- rDocShell.ErrorMessage(STR_MSSG_DELETECELLS_0);
- return FALSE;
+ if( !qDecreaseRange.empty() )
+ {
+ for( ::std::vector<ScRange>::const_iterator iIter( qDecreaseRange.begin()); iIter != qDecreaseRange.end(); iIter++ )
+ {
+ ScRange aRange( *iIter );
+ if( pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ {
+ UnmergeCells( aRange, TRUE, TRUE );
+ }
+ }
+ }
+ }
+ else
+ {
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_DELETECELLS_0);
+ rDocShell.GetUndoManager()->LeaveListAction();
+ return FALSE;
+ }
}
}
}
@@ -1866,7 +2141,59 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
eCmd, pUndoDoc, pUndoData ) );
}
- if (bNeedRefresh)
+ // #i8302 want to be able to insert into the middle of merged cells
+ // the patch comes from maoyg
+
+ while( !qDecreaseRange.empty() )
+ {
+ ScRange aRange = qDecreaseRange.back();
+
+ long nDecreaseRowCount = 0;
+ long nDecreaseColCount = 0;
+ if( eCmd == DEL_CELLSUP || eCmd == DEL_DELROWS )
+ {
+ if( nStartRow >= aRange.aStart.Row() && nStartRow <= aRange.aEnd.Row() && nEndRow>= aRange.aStart.Row() && nEndRow <= aRange.aEnd.Row() )
+ nDecreaseRowCount = nEndRow-nStartRow+1;
+ else if( nStartRow >= aRange.aStart.Row() && nStartRow <= aRange.aEnd.Row() && nEndRow >= aRange.aStart.Row() && nEndRow >= aRange.aEnd.Row() )
+ nDecreaseRowCount = aRange.aEnd.Row()-nStartRow+1;
+ else if( nStartRow >= aRange.aStart.Row() && nStartRow >= aRange.aEnd.Row() && nEndRow>= aRange.aStart.Row() && nEndRow <= aRange.aEnd.Row() )
+ nDecreaseRowCount = aRange.aEnd.Row()-nEndRow+1;
+ }
+ else if( eCmd == DEL_CELLSLEFT || eCmd == DEL_DELCOLS )
+ {
+ if( nStartCol >= aRange.aStart.Col() && nStartCol <= aRange.aEnd.Col() && nEndCol>= aRange.aStart.Col() && nEndCol <= aRange.aEnd.Col() )
+ nDecreaseColCount = nEndCol-nStartCol+1;
+ else if( nStartCol >= aRange.aStart.Col() && nStartCol <= aRange.aEnd.Col() && nEndCol >= aRange.aStart.Col() && nEndCol >= aRange.aEnd.Col() )
+ nDecreaseColCount = aRange.aEnd.Col()-nStartCol+1;
+ else if( nStartCol >= aRange.aStart.Col() && nStartCol >= aRange.aEnd.Col() && nEndCol>= aRange.aStart.Col() && nEndCol <= aRange.aEnd.Col() )
+ nDecreaseColCount = aRange.aEnd.Col()-nEndCol+1;
+ }
+
+ switch (eCmd)
+ {
+ case DEL_CELLSUP:
+ case DEL_DELROWS:
+ aRange.aEnd.SetRow(static_cast<SCsCOL>( aRange.aEnd.Row()-nDecreaseRowCount));
+ break;
+ case DEL_CELLSLEFT:
+ case DEL_DELCOLS:
+ aRange.aEnd.SetCol(static_cast<SCsCOL>( aRange.aEnd.Col()-nDecreaseColCount));
+ break;
+ default:
+ break;
+ }
+
+ if( !pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ {
+ MergeCells( aRange, FALSE, TRUE, TRUE );
+ }
+ qDecreaseRange.pop_back();
+ }
+
+ if( bDeletingMerge )
+ rDocShell.GetUndoManager()->LeaveListAction();
+
+ if ( bNeedRefresh )
{
// #i51445# old merge flag attributes must be deleted also for single cells,
// not only for whole columns/rows
@@ -1878,7 +2205,7 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScPatternAttr aPattern( pDoc->GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- pDoc->ApplyPatternArea( nUndoStartX, nUndoStartY, nMergeTestEndX, nMergeTestEndY, aMark, aPattern );
+ pDoc->ApplyPatternArea( nExtendStartCol, nExtendStartRow, nMergeTestEndX, nMergeTestEndY, aMark, aPattern );
for( i=0; i<nTabCount; i++ )
{
@@ -1889,7 +2216,7 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
nScenarioCount ++;
- ScRange aMergedRange( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i+nScenarioCount );
+ ScRange aMergedRange( nExtendStartCol, nExtendStartRow, i, nMergeTestEndX, nMergeTestEndY, i+nScenarioCount );
pDoc->ExtendMerge( aMergedRange, TRUE );
}
}
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 7ede02df4..373a4bbe9 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -126,6 +126,7 @@ using namespace ::com::sun::star;
#include "externalrefmgr.hxx"
#include "sharedocdlg.hxx"
+#include "conditio.hxx"
//------------------------------------------------------------------
@@ -1368,6 +1369,23 @@ void ScDocShell::NotifyStyle( const SfxStyleSheetHint& rHint )
}
}
}
+ else if ( pStyle->GetFamily() == SFX_STYLE_FAMILY_PARA )
+ {
+ if ( nId == SFX_STYLESHEET_MODIFIED)
+ {
+ String aNewName = pStyle->GetName();
+ String aOldName = aNewName;
+ BOOL bExtended = rHint.ISA(SfxStyleSheetHintExtended);
+ if (bExtended)
+ aOldName = ((SfxStyleSheetHintExtended&)rHint).GetOldName();
+ if ( aNewName != aOldName )
+ {
+ ScConditionalFormatList* pList = aDocument.GetCondFormList();
+ if (pList)
+ pList->RenameCellStyle( aOldName,aNewName );
+ }
+ }
+ }
// alles andere geht ueber Slots...
}
diff --git a/sc/source/ui/inc/condfrmt.hrc b/sc/source/ui/inc/condfrmt.hrc
index 1adceacd0..b79491b4f 100644
--- a/sc/source/ui/inc/condfrmt.hrc
+++ b/sc/source/ui/inc/condfrmt.hrc
@@ -70,3 +70,7 @@
#define BTN_CANCEL 32
#define BTN_HELP 33
+#define BTN_COND1_NEW 34
+#define BTN_COND2_NEW 35
+#define BTN_COND3_NEW 36
+
diff --git a/sc/source/ui/inc/condfrmt.hxx b/sc/source/ui/inc/condfrmt.hxx
index 2ab16ebe9..bd663d38e 100644
--- a/sc/source/ui/inc/condfrmt.hxx
+++ b/sc/source/ui/inc/condfrmt.hxx
@@ -71,6 +71,7 @@ private:
formula::RefButton aRbCond12;
FixedText aFtCond1Template;
ListBox aLbCond1Template;
+ PushButton aBtnNew1;
FixedLine aFlSep1;
CheckBox aCbxCond2;
@@ -83,6 +84,7 @@ private:
formula::RefButton aRbCond22;
FixedText aFtCond2Template;
ListBox aLbCond2Template;
+ PushButton aBtnNew2;
FixedLine aFlSep2;
CheckBox aCbxCond3;
@@ -95,6 +97,7 @@ private:
formula::RefButton aRbCond32;
FixedText aFtCond3Template;
ListBox aLbCond3Template;
+ PushButton aBtnNew3;
OKButton aBtnOk;
CancelButton aBtnCancel;
@@ -146,6 +149,7 @@ private:
DECL_LINK( GetFocusHdl, Control* );
DECL_LINK( LoseFocusHdl, Control* );
DECL_LINK( BtnHdl, PushButton* );
+ DECL_LINK( NewBtnHdl, PushButton* );
#endif // _CONDFRMT_CXX
};
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index 62f68e8d4..c418e829c 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -59,7 +59,6 @@ class TypedScStrCollection;
// Gemeinsame Resource-Objekte:
#define _COMMON_FILTER_RSCOBJS \
- FixedLine aFlOptions; \
CheckBox aBtnCase; \
CheckBox aBtnRegExp; \
CheckBox aBtnHeader; \
@@ -71,17 +70,12 @@ class TypedScStrCollection;
CheckBox aBtnDestPers; \
FixedText aFtDbAreaLabel; \
FixedInfo aFtDbArea; \
- OKButton aBtnOk; \
- CancelButton aBtnCancel; \
- HelpButton aBtnHelp; \
- MoreButton aBtnMore; \
const String aStrUndefined; \
const String aStrNoName; \
const String aStrNone;
#define _INIT_COMMON_FILTER_RSCOBJS \
- aFlOptions ( this, ScResId( FL_OPTIONS ) ), \
aBtnCase ( this, ScResId( BTN_CASE ) ), \
aBtnRegExp ( this, ScResId( BTN_REGEXP ) ), \
aBtnHeader ( this, ScResId( BTN_HEADER ) ), \
@@ -93,10 +87,6 @@ class TypedScStrCollection;
aBtnDestPers ( this, ScResId( BTN_DEST_PERS ) ), \
aFtDbAreaLabel ( this, ScResId( FT_DBAREA_LABEL ) ), \
aFtDbArea ( this, ScResId( FT_DBAREA ) ), \
- aBtnOk ( this, ScResId( BTN_OK ) ), \
- aBtnCancel ( this, ScResId( BTN_CANCEL ) ), \
- aBtnHelp ( this, ScResId( BTN_HELP ) ), \
- aBtnMore ( this, ScResId( BTN_MORE ) ), \
aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ), \
aStrNoName ( ScGlobal::GetRscString(STR_DB_NONAME) ), \
aStrNone ( ScResId( SCSTR_NONE ) ),
@@ -116,28 +106,46 @@ public:
virtual void SetActive();
virtual BOOL Close();
+ void SliderMoved();
+ USHORT GetSliderPos();
+ void RefreshEditRow( USHORT nOffset );
private:
FixedLine aFlCriteria;
//----------------------------
+ ListBox aLbConnect1;
ListBox aLbField1;
ListBox aLbCond1;
ComboBox aEdVal1;
//----------------------------
- ListBox aLbConnect1;
+ ListBox aLbConnect2;
ListBox aLbField2;
ListBox aLbCond2;
ComboBox aEdVal2;
//----------------------------
- ListBox aLbConnect2;
+ ListBox aLbConnect3;
ListBox aLbField3;
ListBox aLbCond3;
ComboBox aEdVal3;
//----------------------------
+ ListBox aLbConnect4;
+ ListBox aLbField4;
+ ListBox aLbCond4;
+ ComboBox aEdVal4;
+ //----------------------------
FixedText aFtConnect;
FixedText aFtField;
FixedText aFtCond;
FixedText aFtVal;
+ FixedLine aFlSeparator;
+
+ ScrollBar aScrollBar;
+
+ FixedLine aFlOptions;
+ MoreButton aBtnMore;
+ HelpButton aBtnHelp;
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
_COMMON_FILTER_RSCOBJS
@@ -155,9 +163,11 @@ private:
ScDocument* pDoc;
SCTAB nSrcTab;
- ComboBox* aValueEdArr[3];
- ListBox* aFieldLbArr[3];
- ListBox* aCondLbArr[3];
+ ComboBox* aValueEdArr[4];
+ ListBox* aFieldLbArr[4];
+ ListBox* aCondLbArr[4];
+ ListBox* aConnLbArr[4];
+ BOOL bRefreshExceptQuery[MAXQUERY];
USHORT nFieldCount;
BOOL bRefInputMode;
@@ -184,6 +194,7 @@ private:
DECL_LINK( CheckBoxHdl, CheckBox* );
DECL_LINK( EndDlgHdl, Button* );
DECL_LINK( MoreClickHdl, MoreButton* );
+ DECL_LINK( ScrollHdl, ScrollBar* );
// Hack: RefInput-Kontrolle
DECL_LINK( TimeOutHdl, Timer* );
@@ -212,8 +223,15 @@ private:
formula::RefEdit aEdFilterArea;
formula::RefButton aRbFilterArea;
+ FixedLine aFlOptions;
+
_COMMON_FILTER_RSCOBJS
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+ MoreButton aBtnMore;
+
ScFilterOptionsMgr* pOptionsMgr;
const USHORT nWhichQuery;
@@ -238,6 +256,7 @@ private:
DECL_LINK( FilterAreaSelHdl, ListBox* );
DECL_LINK( FilterAreaModHdl, formula::RefEdit* );
DECL_LINK( EndDlgHdl, Button* );
+ DECL_LINK( ScrollHdl, ScrollBar* );
// Hack: RefInput-Kontrolle
DECL_LINK( TimeOutHdl, Timer* );
diff --git a/sc/source/ui/inc/filter.hrc b/sc/source/ui/inc/filter.hrc
index ca82df903..6c58b6d72 100644
--- a/sc/source/ui/inc/filter.hrc
+++ b/sc/source/ui/inc/filter.hrc
@@ -68,6 +68,13 @@
#define ED_VAL2 33
#define ED_VAL3 34
#define FL_CRITERIA 35
+#define FL_SEPARATOR 36
+#define LB_OP3 37
+#define LB_FIELD4 38
+#define LB_COND4 39
+#define ED_VAL4 40
+#define LB_SCROLL 41
+#define LB_OP4 42
// Spezialfilter
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 437b95ba2..d65139f69 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -472,6 +472,7 @@ public:
void SelectAll( BOOL bContinue = FALSE );
void SelectAllTables();
+ void DeselectAllTables();
void MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
BOOL bCols = FALSE, BOOL bRows = FALSE, BOOL bCellSelection = FALSE );
diff --git a/sc/source/ui/src/condfrmt.src b/sc/source/ui/src/condfrmt.src
index 1e6348154..5244309bd 100644
--- a/sc/source/ui/src/condfrmt.src
+++ b/sc/source/ui/src/condfrmt.src
@@ -128,6 +128,13 @@ ModelessDialog RID_SCDLG_CONDFORMAT
DropDown = TRUE ;
Sort = TRUE ;
};
+ PushButton BTN_COND1_NEW
+ {
+ Pos = MAP_APPFONT ( 124 , 34 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New Style..." ;
+ };
FixedLine FL_SEP1
{
Pos = MAP_APPFONT ( 6 , 51 ) ;
@@ -223,6 +230,13 @@ ModelessDialog RID_SCDLG_CONDFORMAT
DropDown = TRUE ;
Sort = TRUE ;
};
+ PushButton BTN_COND2_NEW
+ {
+ Pos = MAP_APPFONT ( 124 , 88 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ne~w Style..." ;
+ };
FixedLine FL_SEP2
{
Pos = MAP_APPFONT ( 6 , 105 ) ;
@@ -318,6 +332,13 @@ ModelessDialog RID_SCDLG_CONDFORMAT
DropDown = TRUE ;
Sort = TRUE ;
};
+ PushButton BTN_COND3_NEW
+ {
+ Pos = MAP_APPFONT ( 124 , 142 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "New ~Style..." ;
+ };
OKButton BTN_OK
{
Pos = MAP_APPFONT ( 260 , 6 ) ;
diff --git a/sc/source/ui/src/filter.src b/sc/source/ui/src/filter.src
index 145809a20..d328b6931 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 ( 298 , 83 ) ;
+ Size = MAP_APPFONT ( 251 , 121 ) ;
Text [ en-US ] = "Standard Filter" ;
Moveable = TRUE ;
Closeable = FALSE ;
@@ -65,7 +65,7 @@ ModelessDialog RID_SCDLG_FILTER
ListBox LB_OP1
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
Size = MAP_APPFONT ( 40 , 46 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
@@ -78,6 +78,19 @@ ModelessDialog RID_SCDLG_FILTER
ListBox LB_OP2
{
Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 40 , 46 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "AND" ; Default ; > ;
+ < "OR" ; Default ; > ;
+ };
+ };
+ ListBox LB_OP3
+ {
+ Border = TRUE ;
Pos = MAP_APPFONT ( 12 , 57 ) ;
Size = MAP_APPFONT ( 40 , 46 ) ;
TabStop = TRUE ;
@@ -88,6 +101,19 @@ ModelessDialog RID_SCDLG_FILTER
< "OR" ; Default ; > ;
};
};
+ ListBox LB_OP4
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 73 ) ;
+ Size = MAP_APPFONT ( 40 , 46 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "AND" ; Default ; > ;
+ < "OR" ; Default ; > ;
+ };
+ };
ListBox LB_FIELD1
{
Border = TRUE ;
@@ -112,11 +138,19 @@ ModelessDialog RID_SCDLG_FILTER
TabStop = TRUE ;
DropDown = TRUE ;
};
+ ListBox LB_FIELD4
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58 , 73 ) ;
+ Size = MAP_APPFONT ( 60 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
ListBox LB_COND1
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 25 ) ;
- Size = MAP_APPFONT ( 47 , 105 ) ;
+ Size = MAP_APPFONT ( 47 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -137,7 +171,7 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 41 ) ;
- Size = MAP_APPFONT ( 47 , 105 ) ;
+ Size = MAP_APPFONT ( 47 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -158,7 +192,28 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 57 ) ;
- Size = MAP_APPFONT ( 47 , 105 ) ;
+ Size = MAP_APPFONT ( 47 , 145 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ stringlist [ en-US ] =
+ {
+ < "=" ; Default ; > ;
+ < "<" ; Default ; > ;
+ < ">" ; Default ; > ;
+ < "<=" ; Default ; > ;
+ < ">=" ; Default ; > ;
+ < "<>" ; Default ; > ;
+ < "Largest" ; Default ; > ;
+ < "Smallest" ; Default ; > ;
+ < "Largest %" ; Default ; > ;
+ < "Smallest %" ; Default ; > ;
+ };
+ };
+ ListBox LB_COND4
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 122 , 73 ) ;
+ Size = MAP_APPFONT ( 47 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -196,16 +251,31 @@ ModelessDialog RID_SCDLG_FILTER
TabStop = TRUE ;
DropDown = TRUE ;
};
+ ComboBox ED_VAL4
+ {
+ Pos = MAP_APPFONT ( 173 , 73 ) ;
+ Size = MAP_APPFONT ( 60 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ScrollBar LB_SCROLL
+ {
+ Pos = MAP_APPFONT ( 237, 25 ) ;
+ Size = MAP_APPFONT ( 8 , 60 ) ;
+ TabStop = TRUE ;
+ VScroll = TRUE ;
+ };
+
FixedLine FL_CRITERIA
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 230 , 8 ) ;
+ Size = MAP_APPFONT ( 275 , 8 ) ;
Text [ en-US ] = "Filter criteria";
};
CheckBox BTN_CASE
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 12 , 86 ) ;
+ Pos = MAP_APPFONT ( 12 , 130 ) ;
Size = MAP_APPFONT ( 128 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Case ~sensitive" ;
@@ -213,7 +283,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_REGEXP
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 142 , 86 ) ;
+ Pos = MAP_APPFONT ( 142 , 130 ) ;
Size = MAP_APPFONT ( 94 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Regular ~expression" ;
@@ -221,7 +291,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_HEADER
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 12 , 100 ) ;
+ Pos = MAP_APPFONT ( 12 , 144 ) ;
Size = MAP_APPFONT ( 128 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Range contains ~column labels" ;
@@ -229,7 +299,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_UNIQUE
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 142 , 100 ) ;
+ Pos = MAP_APPFONT ( 142 , 144 ) ;
Size = MAP_APPFONT ( 94 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~No duplication" ;
@@ -237,7 +307,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_COPY_RESULT
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 12 , 114 ) ;
+ Pos = MAP_APPFONT ( 12 , 158 ) ;
Size = MAP_APPFONT ( 128 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Copy ~results to..." ;
@@ -245,7 +315,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_DEST_PERS
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 142 , 114 ) ;
+ Pos = MAP_APPFONT ( 142 , 158 ) ;
Size = MAP_APPFONT ( 94 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Keep filter criteria" ;
@@ -254,7 +324,7 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Hide = TRUE ;
- Pos = MAP_APPFONT ( 21 , 126 ) ;
+ Pos = MAP_APPFONT ( 21 , 170 ) ;
Size = MAP_APPFONT ( 90 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
@@ -263,13 +333,13 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Hide = TRUE ;
- Pos = MAP_APPFONT ( 115 , 126 ) ;
+ Pos = MAP_APPFONT ( 115 , 170 ) ;
Size = MAP_APPFONT ( 104 , 12 ) ;
TabStop = TRUE ;
};
ImageButton RB_COPY_AREA
{
- Pos = MAP_APPFONT ( 221 , 125 ) ;
+ Pos = MAP_APPFONT ( 221 , 169 ) ;
Size = MAP_APPFONT ( 13 , 15 ) ;
TabStop = FALSE ;
QuickHelpText [ en-US ] = "Shrink" ;
@@ -277,14 +347,13 @@ ModelessDialog RID_SCDLG_FILTER
FixedLine FL_OPTIONS
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 6 , 75 ) ;
- Size = MAP_APPFONT ( 230 , 8 ) ;
- Text [ en-US ] = "Options" ;
+ Pos = MAP_APPFONT ( 6 , 118 ) ;
+ Size = MAP_APPFONT ( 239 , 8 ) ;
};
FixedText FT_DBAREA
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 66 , 144 ) ;
+ Pos = MAP_APPFONT ( 66 , 188 ) ;
Size = MAP_APPFONT ( 167 , 8 ) ;
Left = TRUE ;
Text [ en-US ] = "dummy" ;
@@ -292,36 +361,41 @@ ModelessDialog RID_SCDLG_FILTER
FixedText FT_DBAREA_LABEL
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 6 , 144 ) ;
+ Pos = MAP_APPFONT ( 6 , 188 ) ;
Size = MAP_APPFONT ( 58 , 8 ) ;
Text [ en-US ] = "Data range:" ;
};
OKButton BTN_OK
{
- Pos = MAP_APPFONT ( 242 , 6 ) ;
+ Pos = MAP_APPFONT ( 141 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton BTN_CANCEL
{
- Pos = MAP_APPFONT ( 242 , 23 ) ;
+ Pos = MAP_APPFONT ( 195 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
HelpButton BTN_HELP
{
- Pos = MAP_APPFONT ( 242 , 43 ) ;
+ Pos = MAP_APPFONT ( 62 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
MoreButton BTN_MORE
{
- Pos = MAP_APPFONT ( 242 , 63 ) ;
+ Pos = MAP_APPFONT ( 6 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
MapUnit = MAP_APPFONT ;
- Delta = 75 ;
+ Delta = 81 ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 91 ) ;
+ Size = MAP_APPFONT ( 251 , 6 ) ;
};
};
//============================================================================
diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src
index f6e401b1f..05d10b981 100644
--- a/sc/source/ui/src/popup.src
+++ b/sc/source/ui/src/popup.src
@@ -183,6 +183,12 @@ Menu RID_POPUP_TAB
};
MenuItem
{
+ Identifier = FID_TAB_DESELECTALL ;
+ HelpId = FID_TAB_DESELECTALL ;
+ Text [ en-US ] = "D~eselect All Sheets" ;
+ };
+ MenuItem
+ {
Identifier = FID_TAB_RTL ;
HelpId = FID_TAB_RTL ;
Text [ en-US ] = "S~heet Right-To-Left" ;
diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src
index 4a24f83f8..c50a304eb 100644
--- a/sc/source/ui/src/scstring.src
+++ b/sc/source/ui/src/scstring.src
@@ -728,3 +728,13 @@ String RID_SCSTR_ONCLICK
Text [ en-US ] = "Mouse button pressed";
};
+String SCSTR_MOREBTN_MOREOPTIONS
+{
+ Text [ en-US ] = "More ~Options";
+};
+
+String SCSTR_MOREBTN_FEWEROPTIONS
+{
+ Text [ en-US ] = "Fewer ~Options";
+};
+
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 091c890b7..71d08a26b 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -451,7 +451,7 @@ void ScUndoDeleteCells::DoChange( const BOOL bUndo )
for( i=0; i<nCount; i++ )
{
if ( pDoc->HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
- aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED ) )
+ aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
// #i51445# old merge flag attributes must be deleted also for single cells,
// not only for whole columns/rows
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index c9a93ac85..cf0d80a97 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -352,7 +352,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
aSortParam.bHasHeader = bHasHeader;
aSortParam.bByRow = TRUE;
aSortParam.bCaseSens = FALSE;
- aSortParam.bIncludePattern = FALSE;
+ aSortParam.bIncludePattern = TRUE;
aSortParam.bInplace = TRUE;
aSortParam.bDoSort[0] = TRUE;
aSortParam.nField[0] = nCol;
@@ -980,9 +980,40 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if ( pOutSet->GetItemState( FID_VALID_CONDMODE, TRUE, &pItem ) == SFX_ITEM_SET )
eOper = (ScConditionMode) ((const SfxAllEnumItem*)pItem)->GetValue();
if ( pOutSet->GetItemState( FID_VALID_VALUE1, TRUE, &pItem ) == SFX_ITEM_SET )
- aExpr1 = ((const SfxStringItem*)pItem)->GetValue();
+ {
+ String aTemp1 = ((const SfxStringItem*)pItem)->GetValue();
+ if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
+ {
+ sal_uInt32 nNumIndex = 0;
+ double nVal;
+ if (pDoc->GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
+ aExpr1 =String( ::rtl::math::doubleToUString( nVal,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), TRUE));
+ else
+ aExpr1 = aTemp1;
+ }
+ else
+ aExpr1 = aTemp1;
+ }
if ( pOutSet->GetItemState( FID_VALID_VALUE2, TRUE, &pItem ) == SFX_ITEM_SET )
- aExpr2 = ((const SfxStringItem*)pItem)->GetValue();
+ {
+ String aTemp2 = ((const SfxStringItem*)pItem)->GetValue();
+ if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
+ {
+ sal_uInt32 nNumIndex = 0;
+ double nVal;
+ if (pDoc->GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
+ aExpr2 =String( ::rtl::math::doubleToUString( nVal,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), TRUE));
+ else
+ aExpr2 = aTemp2;
+ }
+ else
+ aExpr2 = aTemp2;
+ }
+
if ( pOutSet->GetItemState( FID_VALID_BLANK, TRUE, &pItem ) == SFX_ITEM_SET )
bBlank = ((const SfxBoolItem*)pItem)->GetValue();
if ( pOutSet->GetItemState( FID_VALID_LISTTYPE, TRUE, &pItem ) == SFX_ITEM_SET )
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index f3f89e439..b3722403a 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -112,7 +112,8 @@ ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode )
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDBData* pData = NULL;
ScRange aRange;
- if ( GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE )
+ ScMarkType eMarkType = GetViewData()->GetSimpleArea(aRange);
+ if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED )
pData = pDocSh->GetDBData( aRange, eMode, FALSE );
else if ( eMode != SC_DB_OLD )
pData = pDocSh->GetDBData(
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 6eeb1d93b..e215c3471 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -118,6 +118,7 @@
#include "userdat.hxx"
#include "drwlayer.hxx"
#include "attrib.hxx"
+#include "validat.hxx"
// #114409#
#include <vcl/salbtype.hxx> // FRound
@@ -989,9 +990,50 @@ void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect )
nSelPos = SC_AUTOFILTER_CUSTOM;
}
}
+ else
+ {
+
+ ULONG nIndex = ((SfxUInt32Item*)pDoc->GetAttr(
+ nCol, nRow, nTab, ATTR_VALIDDATA ))->GetValue();
+ if ( nIndex )
+ {
+ const ScValidationData* pData = pDoc->GetValidationEntry( nIndex );
+ if (pData)
+ {
+ TypedStrData* pNew = NULL;
+ String aDocStr;
+ pDoc->GetString( nCol, nRow, nTab, aDocStr );
+ if ( pDoc->HasValueData( nCol, nRow, nTab ) )
+ {
+ double fVal = pDoc->GetValue(ScAddress(nCol, nRow, nTab));
+ pNew = new TypedStrData( aDocStr, fVal, SC_STRTYPE_VALUE );
+ }
+ else
+ pNew = new TypedStrData( aDocStr, 0.0, SC_STRTYPE_STANDARD );
+
+ bool bSortList = ( pData->GetListType() == ValidListType::SORTEDASCENDING);
+ if ( bSortList )
+ {
+ USHORT nStrIndex;
+ if (aStrings.Search(pNew,nStrIndex))
+ nSelPos = nStrIndex;
+ }
+ else
+ {
+ USHORT nCount = aStrings.GetCount();
+ for (i = 0; ((i < nCount) && ( LISTBOX_ENTRY_NOTFOUND == nSelPos)); i++)
+ {
+ if ( aStrings.Compare(aStrings[i], pNew)==0 )
+ nSelPos = i;
+ }
+ }
+ delete pNew;
+ }
+ }
+ }
// neu (309): irgendwas muss immer selektiert sein:
- if ( LISTBOX_ENTRY_NOTFOUND == nSelPos && pFilterBox->GetEntryCount() > 0 )
+ if ( LISTBOX_ENTRY_NOTFOUND == nSelPos && pFilterBox->GetEntryCount() > 0 && !bDataSelect)
nSelPos = 0;
// keine leere Auswahl-Liste anzeigen:
@@ -1010,6 +1052,11 @@ void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect )
// Select erst nach GrabFocus, damit das Focus-Rechteck richtig landet
if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
pFilterBox->SelectEntryPos( nSelPos );
+ else
+ {
+ if (bDataSelect)
+ pFilterBox->SetNoSelection();
+ }
pFilterBox->EndInit();
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 3ef65c0f9..2bedd87aa 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -171,7 +171,8 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt )
// mouse button down and up on same page?
if( nMouseClickPageId != GetPageId( aPos ) )
nMouseClickPageId = TABBAR_PAGE_NOTFOUND;
- else if ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() )
+
+ if ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() && nMouseClickPageId != 0 && nMouseClickPageId != TAB_PAGE_NOTFOUND )
{
SfxDispatcher* pDispatcher = pViewData->GetViewShell()->GetViewFrame()->GetDispatcher();
pDispatcher->Execute( FID_TAB_MENU_RENAME, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
@@ -179,9 +180,12 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt )
if( nMouseClickPageId == 0 )
{
- // free area clicked -> add new sheet
+ // Click in the area next to the existing tabs:
+ // #i70320# if several sheets are selected, deselect all ecxept the current sheet,
+ // otherwise add new sheet
+ USHORT nSlot = ( GetSelectPageCount() > 1 ) ? FID_TAB_DESELECTALL : FID_INS_TABLE;
SfxDispatcher* pDispatcher = pViewData->GetViewShell()->GetViewFrame()->GetDispatcher();
- pDispatcher->Execute( FID_INS_TABLE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
+ pDispatcher->Execute( nSlot, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
// forget page ID, to be really sure that the dialog is not called twice
nMouseClickPageId = TABBAR_PAGE_NOTFOUND;
}
@@ -251,6 +255,7 @@ void ScTabControl::Select()
SfxBindings& rBind = pViewData->GetBindings();
rBind.Invalidate( FID_FILL_TAB );
+ rBind.Invalidate( FID_TAB_DESELECTALL );
rBind.Invalidate( FID_INS_TABLE );
rBind.Invalidate( FID_TAB_APPEND );
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index c63ccc02f..efc28d828 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -587,10 +587,28 @@ void ScTabView::SelectAllTables()
// pDoc->ExtendMarksFromTable( nTab );
aViewData.GetDocShell()->PostPaintExtras();
- aViewData.GetBindings().Invalidate( FID_FILL_TAB );
+ SfxBindings& rBind = aViewData.GetBindings();
+ rBind.Invalidate( FID_FILL_TAB );
+ rBind.Invalidate( FID_TAB_DESELECTALL );
}
}
+void ScTabView::DeselectAllTables()
+{
+ ScDocument* pDoc = aViewData.GetDocument();
+ ScMarkData& rMark = aViewData.GetMarkData();
+ SCTAB nTab = aViewData.GetTabNo();
+ SCTAB nCount = pDoc->GetTableCount();
+
+ for (SCTAB i=0; i<nCount; i++)
+ rMark.SelectTable( i, ( i == nTab ) );
+
+ aViewData.GetDocShell()->PostPaintExtras();
+ SfxBindings& rBind = aViewData.GetBindings();
+ rBind.Invalidate( FID_FILL_TAB );
+ rBind.Invalidate( FID_TAB_DESELECTALL );
+}
+
BOOL lcl_FitsInWindow( double fScaleX, double fScaleY, USHORT nZoom,
long nWindowX, long nWindowY, ScDocument* pDoc, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 1e737ed2e..4c4869579 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1624,34 +1624,36 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
SfxBindings& rBindings = aViewData.GetBindings();
ScMarkData& rMark = aViewData.GetMarkData();
- BOOL bSelectOneTable = FALSE;
- if (bExtendSelection)
- {
- // #i6327# if all tables are selected, a selection event (#i6330#) will deselect all
- BOOL bAllSelected = TRUE;
- for( SCTAB nSelTab = 0; bAllSelected && (nSelTab < nTabCount); ++nSelTab )
- bAllSelected = !pDoc->IsVisible( nSelTab ) || rMark.GetTableSelect( nSelTab );
- if( bAllSelected )
+ bool bAllSelected = true;
+ for (SCTAB nSelTab = 0; nSelTab < nTabCount; ++nSelTab)
+ {
+ if (!pDoc->IsVisible(nSelTab) || rMark.GetTableSelect(nSelTab))
+ {
+ if (nTab == nSelTab)
+ // This tab is already in selection. Keep the current
+ // selection.
+ bExtendSelection = true;
+ }
+ else
{
- bExtendSelection = FALSE;
- bSelectOneTable = TRUE;
+ bAllSelected = false;
+ if (bExtendSelection)
+ // We got what we need. No need to stay in the loop.
+ break;
}
}
- else
- {
- // move from multi-selection to unselected table
- bSelectOneTable = !rMark.GetTableSelect( nTab );
- }
+ if (bAllSelected && !bNew)
+ // #i6327# if all tables are selected, a selection event (#i6330#) will deselect all
+ // (not if called with bNew to update settings)
+ bExtendSelection = false;
if (bExtendSelection)
- {
- // #i6330# multi-selection with keyboard
rMark.SelectTable( nTab, TRUE );
- }
- else if (bSelectOneTable)
+ else
{
rMark.SelectOneTable( nTab );
rBindings.Invalidate( FID_FILL_TAB );
+ rBindings.Invalidate( FID_TAB_DESELECTALL );
}
bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 7a1b778d2..a9250c941 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -789,6 +789,11 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
rReq.Done();
break;
+ case FID_TAB_DESELECTALL:
+ DeselectAllTables();
+ rReq.Done();
+ break;
+
case SID_SELECT_TABLES:
{
ScViewData& rViewData = *GetViewData();
@@ -865,7 +870,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
rViewData.GetDocShell()->PostPaintExtras();
- rViewData.GetBindings().Invalidate( FID_FILL_TAB );
+ SfxBindings& rBind = rViewData.GetBindings();
+ rBind.Invalidate( FID_FILL_TAB );
+ rBind.Invalidate( FID_TAB_DESELECTALL );
}
rReq.Done();
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index dd8c120c2..90a091eff 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -452,6 +452,11 @@ void __EXPORT ScTabViewShell::GetState( SfxItemSet& rSet )
rSet.Put( SfxBoolItem( nWhich, GetViewData()->GetDocShell()->IsReadOnly() ) );
break;
+ case FID_TAB_DESELECTALL:
+ if ( nTabSelCount == 1 )
+ rSet.DisableItem( nWhich ); // enabled only if several sheets are selected
+ break;
+
} // switch ( nWitch )
nWhich = aIter.NextWhich();
} // while ( nWitch )
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 2939852da..285f79171 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -185,6 +185,9 @@
#include <sot/exchange.hxx>
#include <memory>
+#include "attrib.hxx"
+#include "patattr.hxx"
+#include "dociter.hxx"
#include "viewfunc.hxx"
#include "tabvwsh.hxx"
#include "docsh.hxx"
@@ -1056,11 +1059,35 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
// pDoc->HasCommonAttr( StartCol,nStartRow, nUndoEndCol,nUndoEndRow, nStartTab,
// pClipDoc, nClipStartX, nClipStartY );
+ ScDocFunc& rDocFunc = pDocSh->GetDocFunc();
+ if ( bRecord )
+ {
+ String aUndo = ScGlobal::GetRscString( pClipDoc->IsCutMode() ? STR_UNDO_MOVE : STR_UNDO_COPY );
+ pUndoMgr->EnterListAction( aUndo, aUndo );
+ }
+
if (bClipOver)
if (lcl_SelHasAttrib( pDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HASATTR_OVERLAPPED ))
{ // "Cell merge not possible if cells already merged"
- ErrorMessage(STR_MSSG_PASTEFROMCLIP_1);
- return FALSE;
+ ScDocAttrIterator aIter( pDoc, nStartTab, nStartCol, nStartRow, nUndoEndCol, nUndoEndRow );
+ const ScPatternAttr* pPattern = NULL;
+ const ScMergeAttr* pMergeFlag = NULL;
+ const ScMergeFlagAttr* pMergeFlagAttr = NULL;
+ SCCOL nCol = -1;
+ SCROW nRow1 = -1;
+ SCROW nRow2 = -1;
+ while ( ( pPattern = aIter.GetNext( nCol, nRow1, nRow2 ) ) != NULL )
+ {
+ pMergeFlag = (const ScMergeAttr*) &pPattern->GetItem(ATTR_MERGE);
+ pMergeFlagAttr = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG);
+ if( ( pMergeFlag && pMergeFlag->IsMerged() ) || ( pMergeFlagAttr && pMergeFlagAttr->IsOverlapped() ) )
+ {
+ ScRange aRange(nCol, nRow1, nStartTab);
+ pDoc->ExtendOverlapped(aRange);
+ pDoc->ExtendMerge(aRange, TRUE, TRUE);
+ rDocFunc.UnmergeCells(aRange, bRecord, TRUE);
+ }
+ }
}
if ( !bCutMode )
@@ -1163,7 +1190,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
// skipped rows and merged cells don't mix
if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
- pDocSh->GetDocFunc().UnmergeCells( aUserRange, FALSE, TRUE );
+ rDocFunc.UnmergeCells( aUserRange, FALSE, TRUE );
pDoc->ExtendMergeSel( nStartCol, nStartRow, nEndCol, nEndRow, aFilteredMark, TRUE ); // Refresh
// und Bereich neu
@@ -1256,6 +1283,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
else
pUndoMgr->AddUndoAction( pUndo );
+ pUndoMgr->LeaveListAction();
}
USHORT nPaint = PAINT_GRID;