summaryrefslogtreecommitdiff
path: root/sc/source/ui/optdlg
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/optdlg')
-rw-r--r--sc/source/ui/optdlg/opredlin.cxx227
-rw-r--r--sc/source/ui/optdlg/tpcalc.cxx306
-rw-r--r--sc/source/ui/optdlg/tpcompatibility.cxx108
-rw-r--r--sc/source/ui/optdlg/tpformula.cxx290
-rw-r--r--sc/source/ui/optdlg/tpprint.cxx146
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx808
-rw-r--r--sc/source/ui/optdlg/tpview.cxx684
7 files changed, 2569 insertions, 0 deletions
diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx
new file mode 100644
index 000000000000..7648ec79cb4e
--- /dev/null
+++ b/sc/source/ui/optdlg/opredlin.cxx
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#undef SC_DLLIMPLEMENTATION
+
+
+
+//------------------------------------------------------------------
+
+#include <svx/dlgutil.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/xtable.hxx>
+
+#include "appoptio.hxx"
+#include "scmod.hxx"
+#include "scitems.hxx"
+#include "tpview.hxx"
+#include "global.hxx"
+#include "viewopti.hxx"
+#include "tabvwsh.hxx"
+#include "uiitems.hxx"
+#include "scresid.hxx"
+#include "docsh.hxx"
+#include "sc.hrc" // -> Slot-IDs
+#include "optdlg.hrc"
+#include "globstr.hrc"
+
+#include "opredlin.hxx"
+#include "opredlin.hrc"
+
+//------------------------------------------------------------------
+
+ScRedlineOptionsTabPage::ScRedlineOptionsTabPage( Window* pParent,
+ const SfxItemSet& rSet )
+ : SfxTabPage(pParent, ScResId(RID_SCPAGE_OPREDLINE), rSet),
+ aContentFT ( this, ScResId(FT_CONTENT )),
+ aContentColorLB ( this, ScResId(CLB_CONTENT )),
+ aRemoveFT ( this, ScResId(FT_REMOVE )),
+ aRemoveColorLB ( this, ScResId(CLB_REMOVE )),
+ aInsertFT ( this, ScResId(FT_INSERT )),
+ aInsertColorLB ( this, ScResId(CLB_INSERT )),
+ aMoveFT ( this, ScResId(FT_MOVE )),
+ aMoveColorLB ( this, ScResId(CLB_MOVE )),
+ aChangedGB ( this, ScResId(GB_COLORCHGS)),
+ aAuthorStr (ScResId(STR_AUTHOR))
+{
+ FreeResource();
+
+ Link aLk = LINK(this, ScRedlineOptionsTabPage, ColorHdl);
+ aContentColorLB.SetSelectHdl( aLk );
+ aMoveColorLB.SetSelectHdl( aLk );
+ aInsertColorLB.SetSelectHdl( aLk );
+ aRemoveColorLB.SetSelectHdl( aLk );
+}
+
+ScRedlineOptionsTabPage::~ScRedlineOptionsTabPage()
+{
+}
+
+SfxTabPage* ScRedlineOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new ScRedlineOptionsTabPage( pParent, rSet );
+}
+
+sal_Bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet& /* rSet */ )
+{
+ ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
+
+ sal_uLong nNew=0;
+ sal_uInt16 nPos=0;
+
+ nPos = aContentColorLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ nPos = aContentColorLB.GetSelectEntryPos();
+ if (nPos!=0)
+ nNew= aContentColorLB.GetEntryColor(nPos).GetColor();
+ else
+ nNew= COL_TRANSPARENT;
+
+ aAppOptions.SetTrackContentColor(nNew);
+
+ }
+ nPos = aMoveColorLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ nPos = aMoveColorLB.GetSelectEntryPos();
+ if (nPos!=0)
+ nNew= aMoveColorLB.GetEntryColor(nPos).GetColor();
+ else
+ nNew= COL_TRANSPARENT;
+
+ aAppOptions.SetTrackMoveColor(nNew);
+
+ }
+ nPos = aInsertColorLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ nPos = aInsertColorLB.GetSelectEntryPos();
+ if (nPos!=0)
+ nNew= aInsertColorLB.GetEntryColor(nPos).GetColor();
+ else
+ nNew= COL_TRANSPARENT;
+
+ aAppOptions.SetTrackInsertColor(nNew);
+
+ }
+ nPos = aRemoveColorLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ nPos = aRemoveColorLB.GetSelectEntryPos();
+ if (nPos!=0)
+ nNew= aRemoveColorLB.GetEntryColor(nPos).GetColor();
+ else
+ nNew= COL_TRANSPARENT;
+
+ aAppOptions.SetTrackDeleteColor(nNew);
+
+ }
+
+ SC_MOD()->SetAppOptions(aAppOptions);
+
+ // Repaint (wenn alles ueber Items laufen wuerde, wie es sich gehoert,
+ // waere das nicht noetig...)
+ ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
+ if (pDocSh)
+ pDocSh->PostPaintGridAll();
+
+ return false;
+}
+
+void ScRedlineOptionsTabPage::Reset( const SfxItemSet& /* rSet */ )
+{
+
+ XColorTable* pColorTbl = XColorTable::GetStdColorTable();
+ aContentColorLB.InsertEntry(aAuthorStr);
+ aMoveColorLB.InsertEntry(aAuthorStr);
+ aInsertColorLB.InsertEntry(aAuthorStr);
+ aRemoveColorLB.InsertEntry(aAuthorStr);
+
+ aContentColorLB.SetUpdateMode( false);
+ aMoveColorLB.SetUpdateMode( false);
+ aInsertColorLB.SetUpdateMode( false);
+ aRemoveColorLB.SetUpdateMode( false);
+
+ for( sal_uInt16 i = 0; i < pColorTbl->Count(); ++i )
+ {
+ XColorEntry* pEntry = pColorTbl->GetColor( i );
+ Color aColor = pEntry->GetColor();
+ String sName = pEntry->GetName();
+
+ aContentColorLB.InsertEntry( aColor, sName );
+ aMoveColorLB.InsertEntry( aColor, sName );
+ aInsertColorLB.InsertEntry( aColor, sName );
+ aRemoveColorLB.InsertEntry( aColor, sName );
+ }
+ aContentColorLB.SetUpdateMode( sal_True );
+ aMoveColorLB.SetUpdateMode( sal_True );
+ aInsertColorLB.SetUpdateMode( sal_True );
+ aRemoveColorLB.SetUpdateMode( sal_True );
+
+
+ ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
+
+ sal_uLong nColor = aAppOptions.GetTrackContentColor();
+ if (nColor == COL_TRANSPARENT)
+ aContentColorLB.SelectEntryPos(0);
+ else
+ aContentColorLB.SelectEntry(Color(nColor));
+
+ nColor = aAppOptions.GetTrackMoveColor();
+ if (nColor == COL_TRANSPARENT)
+ aMoveColorLB.SelectEntryPos(0);
+ else
+ aMoveColorLB.SelectEntry(Color(nColor));
+
+
+ nColor = aAppOptions.GetTrackInsertColor();
+ if (nColor == COL_TRANSPARENT)
+ aInsertColorLB.SelectEntryPos(0);
+ else
+ aInsertColorLB.SelectEntry(Color(nColor));
+
+
+ nColor = aAppOptions.GetTrackDeleteColor();
+ if (nColor == COL_TRANSPARENT)
+ aRemoveColorLB.SelectEntryPos(0);
+ else
+ aRemoveColorLB.SelectEntry(Color(nColor));
+
+}
+
+
+IMPL_LINK( ScRedlineOptionsTabPage, ColorHdl, ColorListBox *, EMPTYARG )
+{
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx
new file mode 100644
index 000000000000..a969b311ddf7
--- /dev/null
+++ b/sc/source/ui/optdlg/tpcalc.cxx
@@ -0,0 +1,306 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#undef SC_DLLIMPLEMENTATION
+
+
+
+//------------------------------------------------------------------
+
+#include "scitems.hxx"
+#include <vcl/msgbox.hxx>
+
+#include "global.hxx"
+#include "globstr.hrc"
+#include "uiitems.hxx"
+#include "docsh.hxx"
+#include "document.hxx"
+#include "docoptio.hxx"
+#include "scresid.hxx"
+#include "sc.hrc" // -> Slot-IDs
+#include "optdlg.hrc"
+
+#define _TPCALC_CXX
+#include "tpcalc.hxx"
+#undef _TPCALC_CXX
+
+#include <math.h>
+
+// STATIC DATA -----------------------------------------------------------
+
+static sal_uInt16 pCalcOptRanges[] =
+{
+ SID_SCDOCOPTIONS,
+ SID_SCDOCOPTIONS,
+ 0
+};
+
+//========================================================================
+
+ScTpCalcOptions::ScTpCalcOptions( Window* pParent,
+ const SfxItemSet& rCoreAttrs )
+
+ : SfxTabPage ( pParent,
+ ScResId( RID_SCPAGE_CALC ),
+ rCoreAttrs ),
+
+ aGbZRefs ( this, ScResId( GB_ZREFS ) ),
+ aBtnIterate ( this, ScResId( BTN_ITERATE ) ),
+ aFtSteps ( this, ScResId( FT_STEPS ) ),
+ aEdSteps ( this, ScResId( ED_STEPS ) ),
+ aFtEps ( this, ScResId( FT_EPS ) ),
+ aEdEps ( this, ScResId( ED_EPS ) ),
+ aSeparatorFL ( this, ScResId( FL_SEPARATOR ) ),
+ aGbDate ( this, ScResId( GB_DATE ) ),
+ aBtnDateStd ( this, ScResId( BTN_DATESTD ) ),
+ aBtnDateSc10 ( this, ScResId( BTN_DATESC10 ) ),
+ aBtnDate1904 ( this, ScResId( BTN_DATE1904 ) ),
+ aBtnCase ( this, ScResId( BTN_CASE ) ),
+ aBtnCalc ( this, ScResId( BTN_CALC ) ),
+ aBtnMatch ( this, ScResId( BTN_MATCH ) ),
+ aBtnRegex ( this, ScResId( BTN_REGEX ) ),
+ aBtnLookUp ( this, ScResId( BTN_LOOKUP ) ),
+ aBtnGeneralPrec ( this, ScResId( BTN_GENERAL_PREC ) ),
+ aFtPrec ( this, ScResId( FT_PREC ) ),
+ aEdPrec ( this, ScResId( ED_PREC ) ),
+ pOldOptions ( new ScDocOptions(
+ ((const ScTpCalcItem&)rCoreAttrs.Get(
+ GetWhich( SID_SCDOCOPTIONS ))).
+ GetDocOptions() ) ),
+ pLocalOptions ( new ScDocOptions ),
+ nWhichCalc ( GetWhich( SID_SCDOCOPTIONS ) )
+{
+ aSeparatorFL.SetStyle( aSeparatorFL.GetStyle() | WB_VERT );
+ Init();
+ FreeResource();
+ SetExchangeSupport();
+}
+
+//-----------------------------------------------------------------------
+
+ScTpCalcOptions::~ScTpCalcOptions()
+{
+ delete pOldOptions;
+ delete pLocalOptions;
+}
+
+//-----------------------------------------------------------------------
+
+void ScTpCalcOptions::Init()
+{
+ aBtnIterate .SetClickHdl( LINK( this, ScTpCalcOptions, CheckClickHdl ) );
+ aBtnGeneralPrec.SetClickHdl( LINK(this, ScTpCalcOptions, CheckClickHdl) );
+ aBtnDateStd .SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
+ aBtnDateSc10.SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
+ aBtnDate1904.SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
+}
+
+//-----------------------------------------------------------------------
+
+sal_uInt16* ScTpCalcOptions::GetRanges()
+{
+ return pCalcOptRanges;
+}
+
+//-----------------------------------------------------------------------
+
+SfxTabPage* ScTpCalcOptions::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new ScTpCalcOptions( pParent, rAttrSet ) );
+}
+
+//-----------------------------------------------------------------------
+
+void ScTpCalcOptions::Reset( const SfxItemSet& /* rCoreAttrs */ )
+{
+ sal_uInt16 d,m,y;
+
+ *pLocalOptions = *pOldOptions;
+
+ aBtnCase .Check( !pLocalOptions->IsIgnoreCase() );
+ aBtnCalc .Check( pLocalOptions->IsCalcAsShown() );
+ aBtnMatch .Check( pLocalOptions->IsMatchWholeCell() );
+ aBtnRegex .Check( pLocalOptions->IsFormulaRegexEnabled() );
+ aBtnLookUp .Check( pLocalOptions->IsLookUpColRowNames() );
+ aBtnIterate.Check( pLocalOptions->IsIter() );
+ aEdSteps .SetValue( pLocalOptions->GetIterCount() );
+ aEdEps .SetValue( pLocalOptions->GetIterEps(), 6 );
+
+ pLocalOptions->GetDate( d, m, y );
+
+ switch ( y )
+ {
+ case 1899:
+ aBtnDateStd.Check();
+ break;
+ case 1900:
+ aBtnDateSc10.Check();
+ break;
+ case 1904:
+ aBtnDate1904.Check();
+ break;
+ }
+
+ sal_uInt16 nPrec = pLocalOptions->GetStdPrecision();
+ if (nPrec == SvNumberFormatter::UNLIMITED_PRECISION)
+ {
+ aFtPrec.Disable();
+ aEdPrec.Disable();
+ aBtnGeneralPrec.Check(false);
+ }
+ else
+ {
+ aBtnGeneralPrec.Check();
+ aFtPrec.Enable();
+ aEdPrec.Enable();
+ aEdPrec.SetValue(nPrec);
+ }
+
+ CheckClickHdl( &aBtnIterate );
+}
+
+
+//-----------------------------------------------------------------------
+
+sal_Bool ScTpCalcOptions::FillItemSet( SfxItemSet& rCoreAttrs )
+{
+ // alle weiteren Optionen werden in den Handlern aktualisiert
+ pLocalOptions->SetIterCount( (sal_uInt16)aEdSteps.GetValue() );
+ pLocalOptions->SetIgnoreCase( !aBtnCase.IsChecked() );
+ pLocalOptions->SetCalcAsShown( aBtnCalc.IsChecked() );
+ pLocalOptions->SetMatchWholeCell( aBtnMatch.IsChecked() );
+ pLocalOptions->SetFormulaRegexEnabled( aBtnRegex.IsChecked() );
+ pLocalOptions->SetLookUpColRowNames( aBtnLookUp.IsChecked() );
+
+ if (aBtnGeneralPrec.IsChecked())
+ pLocalOptions->SetStdPrecision(
+ static_cast<sal_uInt16>(aEdPrec.GetValue()) );
+ else
+ pLocalOptions->SetStdPrecision( SvNumberFormatter::UNLIMITED_PRECISION );
+
+ if ( *pLocalOptions != *pOldOptions )
+ {
+ rCoreAttrs.Put( ScTpCalcItem( nWhichCalc, *pLocalOptions ) );
+ return sal_True;
+ }
+ else
+ return false;
+}
+
+//------------------------------------------------------------------------
+
+int ScTpCalcOptions::DeactivatePage( SfxItemSet* pSetP )
+{
+ int nReturn = KEEP_PAGE;
+
+ double fEps;
+ if( aEdEps.GetValue( fEps ) && (fEps > 0.0) )
+ {
+ pLocalOptions->SetIterEps( fEps );
+ nReturn = LEAVE_PAGE;
+ }
+
+ if ( nReturn == KEEP_PAGE )
+ {
+ ErrorBox( this,
+ WinBits( WB_OK | WB_DEF_OK ),
+ ScGlobal::GetRscString( STR_INVALID_EPS )
+ ).Execute();
+
+ aEdEps.GrabFocus();
+ }
+ else if ( pSetP )
+ FillItemSet( *pSetP );
+
+ return nReturn;
+}
+
+//-----------------------------------------------------------------------
+// Handler:
+
+IMPL_LINK( ScTpCalcOptions, RadioClickHdl, RadioButton*, pBtn )
+{
+ if ( pBtn == &aBtnDateStd )
+ {
+ pLocalOptions->SetDate( 30, 12, 1899 );
+ }
+ else if ( pBtn == &aBtnDateSc10 )
+ {
+ pLocalOptions->SetDate( 1, 1, 1900 );
+ }
+ else if ( pBtn == &aBtnDate1904 )
+ {
+ pLocalOptions->SetDate( 1, 1, 1904 );
+ }
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------
+
+IMPL_LINK( ScTpCalcOptions, CheckClickHdl, CheckBox*, pBtn )
+{
+ if (pBtn == &aBtnGeneralPrec)
+ {
+ if (pBtn->IsChecked())
+ {
+ aEdPrec.Enable();
+ aFtPrec.Enable();
+ }
+ else
+ {
+ aEdPrec.Disable();
+ aFtPrec.Disable();
+ }
+ }
+ else if (pBtn == &aBtnIterate)
+ {
+ if ( pBtn->IsChecked() )
+ {
+ pLocalOptions->SetIter( sal_True );
+ aFtSteps.Enable(); aEdSteps.Enable();
+ aFtEps .Enable(); aEdEps .Enable();
+ }
+ else
+ {
+ pLocalOptions->SetIter( false );
+ aFtSteps.Disable(); aEdSteps.Disable();
+ aFtEps .Disable(); aEdEps .Disable();
+ }
+ }
+
+ return 0;
+}
+
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx
new file mode 100644
index 000000000000..367180b5153a
--- /dev/null
+++ b/sc/source/ui/optdlg/tpcompatibility.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * LibreOffice - a multi-platform office productivity suite
+ *
+ * This file is part of LibreOffice.
+ *
+ * LibreOffice 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.
+ *
+ * LibreOffice 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 LibreOffice. 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"
+
+#undef SC_DLLIMPLEMENTATION
+
+#include "tpcompatibility.hxx"
+#include "optdlg.hrc"
+#include "scresid.hxx"
+#include "docoptio.hxx"
+
+ScTpCompatOptions::ScTpCompatOptions(Window *pParent, const SfxItemSet &rCoreAttrs) :
+ SfxTabPage(pParent, ScResId(RID_SCPAGE_COMPATIBILITY), rCoreAttrs),
+ maFlKeyBindings(this, ScResId(FL_KEY_BINDINGS)),
+ maFtKeyBindings(this, ScResId(FT_KEY_BINDINGS)),
+ maLbKeyBindings(this, ScResId(LB_KEY_BINDINGS))
+{
+ FreeResource();
+
+ const ScTpCalcItem& rItem = static_cast<const ScTpCalcItem&>(
+ rCoreAttrs.Get(GetWhich(SID_SCDOCOPTIONS)));
+ mpOldOptions.reset(new ScDocOptions(rItem.GetDocOptions()));
+ mpNewOptions.reset(new ScDocOptions(rItem.GetDocOptions()));
+}
+
+ScTpCompatOptions::~ScTpCompatOptions()
+{
+}
+
+SfxTabPage* ScTpCompatOptions::Create(Window *pParent, const SfxItemSet &rCoreAttrs)
+{
+ return new ScTpCompatOptions(pParent, rCoreAttrs);
+}
+
+sal_Bool ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs)
+{
+ ScOptionsUtil::KeyBindingType eKeyB = ScOptionsUtil::KEY_DEFAULT;
+ switch (maLbKeyBindings.GetSelectEntryPos())
+ {
+ case 0:
+ eKeyB = ScOptionsUtil::KEY_DEFAULT;
+ break;
+ case 1:
+ eKeyB = ScOptionsUtil::KEY_OOO_LEGACY;
+ break;
+ default:
+ ;
+ }
+ mpNewOptions->SetKeyBindingType(eKeyB);
+
+ if (*mpNewOptions != *mpOldOptions)
+ {
+ rCoreAttrs.Put(ScTpCalcItem(GetWhich(SID_SCDOCOPTIONS), *mpNewOptions));
+ return true;
+ }
+ else
+ return false;
+}
+
+void ScTpCompatOptions::Reset(const SfxItemSet &/*rCoreAttrs*/)
+{
+ ScOptionsUtil::KeyBindingType eKeyB = mpOldOptions->GetKeyBindingType();
+ switch (eKeyB)
+ {
+ case ScOptionsUtil::KEY_DEFAULT:
+ maLbKeyBindings.SelectEntryPos(0);
+ break;
+ case ScOptionsUtil::KEY_OOO_LEGACY:
+ maLbKeyBindings.SelectEntryPos(1);
+ break;
+ default:
+ ;
+ }
+}
+
+int ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/)
+{
+ return KEEP_PAGE;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx
new file mode 100644
index 000000000000..c87183e6bb33
--- /dev/null
+++ b/sc/source/ui/optdlg/tpformula.cxx
@@ -0,0 +1,290 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#undef SC_DLLIMPLEMENTATION
+
+
+
+//------------------------------------------------------------------
+
+#include "tpformula.hxx"
+#include "optdlg.hrc"
+#include "scresid.hxx"
+#include "formula/grammar.hxx"
+#include "docoptio.hxx"
+#include "global.hxx"
+
+#include <unotools/localedatawrapper.hxx>
+
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/i18n/LocaleDataItem.hpp>
+
+using ::rtl::OUString;
+using ::com::sun::star::lang::Locale;
+using ::com::sun::star::i18n::LocaleDataItem;
+
+ScTpFormulaOptions::ScTpFormulaOptions(Window* pParent, const SfxItemSet& rCoreAttrs) :
+ SfxTabPage(pParent, ScResId(RID_SCPAGE_FORMULA), rCoreAttrs),
+
+ maFlFormulaOpt(this, ScResId(FL_FORMULA_OPTIONS)),
+ maFtFormulaSyntax(this, ScResId(FT_FORMULA_SYNTAX)),
+ maLbFormulaSyntax(this, ScResId(LB_FORMULA_SYNTAX)),
+ maCbEnglishFuncName(this, ScResId(CB_ENGLISH_FUNC_NAME)),
+ maFlFormulaSeps(this, ScResId(FL_FORMULA_SEPS)),
+ maFtSepFuncArg(this, ScResId(FT_FORMULA_SEP_ARG)),
+ maEdSepFuncArg(this, ScResId(ED_FORMULA_SEP_ARG)),
+ maFtSepArrayCol(this, ScResId(FT_FORMULA_SEP_ARRAY_C)),
+ maEdSepArrayCol(this, ScResId(ED_FORMULA_SEP_ARRAY_C)),
+ maFtSepArrayRow(this, ScResId(FT_FORMULA_SEP_ARRAY_R)),
+ maEdSepArrayRow(this, ScResId(ED_FORMULA_SEP_ARRAY_R)),
+ maBtnSepReset(this, ScResId(BTN_FORMULA_SEP_RESET)),
+
+ mpOldOptions(NULL),
+ mpNewOptions(NULL),
+ mnDecSep(0)
+{
+ FreeResource();
+
+ const ScTpCalcItem& rItem = static_cast<const ScTpCalcItem&>(
+ rCoreAttrs.Get(GetWhich(SID_SCDOCOPTIONS)));
+ mpOldOptions.reset(new ScDocOptions(rItem.GetDocOptions()));
+ mpNewOptions.reset(new ScDocOptions(rItem.GetDocOptions()));
+
+ Init();
+}
+
+ScTpFormulaOptions::~ScTpFormulaOptions()
+{
+}
+
+void ScTpFormulaOptions::Init()
+{
+ Link aLink = LINK( this, ScTpFormulaOptions, ButtonHdl );
+ maBtnSepReset.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScTpFormulaOptions, SepModifyHdl );
+ maEdSepFuncArg.SetModifyHdl(aLink);
+ maEdSepArrayCol.SetModifyHdl(aLink);
+ maEdSepArrayRow.SetModifyHdl(aLink);
+
+ aLink = LINK( this, ScTpFormulaOptions, SepEditOnFocusHdl );
+ maEdSepFuncArg.SetGetFocusHdl(aLink);
+ maEdSepArrayCol.SetGetFocusHdl(aLink);
+ maEdSepArrayRow.SetGetFocusHdl(aLink);
+
+ // Get the decimal separator for current locale.
+ String aSep = mpOldOptions->GetLocaleDataWrapper().getNumDecimalSep();
+ mnDecSep = aSep.Len() ? aSep.GetChar(0) : sal_Unicode('.');
+}
+
+void ScTpFormulaOptions::ResetSeparators()
+{
+ ScDocOptions aOpt;
+ maEdSepFuncArg.SetText(aOpt.GetFormulaSepArg());
+ maEdSepArrayCol.SetText(aOpt.GetFormulaSepArrayCol());
+ maEdSepArrayRow.SetText(aOpt.GetFormulaSepArrayRow());
+}
+
+void ScTpFormulaOptions::OnFocusSeparatorInput(Edit* pEdit)
+{
+ if (!pEdit)
+ return;
+
+ // Make sure the entire text is selected.
+ xub_StrLen nLen = pEdit->GetText().Len();
+ Selection aSel(0, nLen);
+ pEdit->SetSelection(aSel);
+ maOldSepValue = pEdit->GetText();
+}
+
+bool ScTpFormulaOptions::IsValidSeparator(const OUString& rSep) const
+{
+ if (rSep.getLength() != 1)
+ // Must be one-character long.
+ return false;
+
+ if (rSep.compareToAscii("a") >= 0 && rSep.compareToAscii("z") <= 0)
+ return false;
+
+ if (rSep.compareToAscii("A") >= 0 && rSep.compareToAscii("Z") <= 0)
+ return false;
+
+ sal_Unicode c = rSep.getStr()[0];
+ switch (c)
+ {
+ case '+':
+ case '-':
+ case '/':
+ case '*':
+ case '<':
+ case '>':
+ case '[':
+ case ']':
+ case '(':
+ case ')':
+ case '"':
+ case '\'':
+ // Disallowed characters. Anything else we want to disallow ?
+ return false;
+ }
+
+ if (c == mnDecSep)
+ // decimal separator is not allowed.
+ return false;
+
+ return true;
+}
+
+bool ScTpFormulaOptions::IsValidSeparatorSet() const
+{
+ // Make sure the column and row separators are different.
+ String aColStr = maEdSepArrayCol.GetText();
+ String aRowStr = maEdSepArrayRow.GetText();
+ if (aColStr == aRowStr)
+ return false;
+
+ return true;
+}
+
+IMPL_LINK( ScTpFormulaOptions, ButtonHdl, PushButton*, pBtn )
+{
+ if (pBtn == &maBtnSepReset)
+ ResetSeparators();
+
+ return 0;
+}
+
+IMPL_LINK( ScTpFormulaOptions, SepModifyHdl, Edit*, pEdit )
+{
+ if (!pEdit)
+ return 0;
+
+ String aStr = pEdit->GetText();
+ if (aStr.Len() > 1)
+ {
+ // In case the string is more than one character long, only grab the
+ // first character.
+ aStr = aStr.Copy(0, 1);
+ pEdit->SetText(aStr);
+ }
+
+ if ((!IsValidSeparator(aStr) || !IsValidSeparatorSet()) && maOldSepValue.getLength())
+ // Invalid separator. Restore the old value.
+ pEdit->SetText(maOldSepValue);
+
+ OnFocusSeparatorInput(pEdit);
+ return 0;
+}
+
+IMPL_LINK( ScTpFormulaOptions, SepEditOnFocusHdl, Edit*, pEdit )
+{
+ OnFocusSeparatorInput(pEdit);
+ return 0;
+}
+
+SfxTabPage* ScTpFormulaOptions::Create(Window* pParent, const SfxItemSet& rCoreSet)
+{
+ return new ScTpFormulaOptions(pParent, rCoreSet);
+}
+
+sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
+{
+ ::formula::FormulaGrammar::Grammar eGram = ::formula::FormulaGrammar::GRAM_DEFAULT;
+ switch (maLbFormulaSyntax.GetSelectEntryPos())
+ {
+ case 0:
+ eGram = ::formula::FormulaGrammar::GRAM_NATIVE;
+ break;
+ case 1:
+ eGram = ::formula::FormulaGrammar::GRAM_NATIVE_XL_A1;
+ break;
+ case 2:
+ eGram = ::formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1;
+ break;
+ }
+
+ mpNewOptions->SetFormulaSyntax(eGram);
+ mpNewOptions->SetUseEnglishFuncName(maCbEnglishFuncName.IsChecked());
+ mpNewOptions->SetFormulaSepArg(maEdSepFuncArg.GetText());
+ mpNewOptions->SetFormulaSepArrayCol(maEdSepArrayCol.GetText());
+ mpNewOptions->SetFormulaSepArrayRow(maEdSepArrayRow.GetText());
+
+ if (*mpNewOptions != *mpOldOptions)
+ {
+ rCoreSet.Put(ScTpCalcItem(GetWhich(SID_SCDOCOPTIONS), *mpNewOptions));
+ return true;
+ }
+ else
+ return false;
+}
+
+void ScTpFormulaOptions::Reset(const SfxItemSet& /*rCoreSet*/)
+{
+ ::formula::FormulaGrammar::Grammar eGram = mpNewOptions->GetFormulaSyntax();
+ switch (eGram)
+ {
+ case ::formula::FormulaGrammar::GRAM_NATIVE:
+ maLbFormulaSyntax.SelectEntryPos(0);
+ break;
+ case ::formula::FormulaGrammar::GRAM_NATIVE_XL_A1:
+ maLbFormulaSyntax.SelectEntryPos(1);
+ break;
+ case ::formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1:
+ maLbFormulaSyntax.SelectEntryPos(2);
+ break;
+ default:
+ maLbFormulaSyntax.SelectEntryPos(0);
+ }
+
+ maCbEnglishFuncName.Check(mpNewOptions->GetUseEnglishFuncName());
+
+ OUString aSep = mpNewOptions->GetFormulaSepArg();
+ OUString aSepArrayRow = mpNewOptions->GetFormulaSepArrayRow();
+ OUString aSepArrayCol = mpNewOptions->GetFormulaSepArrayCol();
+
+ if (aSep.getLength() == 1 && aSepArrayRow.getLength() == 1 && aSepArrayCol.getLength() == 1)
+ {
+ // Each separator must be one character long.
+ maEdSepFuncArg.SetText(aSep);
+ maEdSepArrayCol.SetText(aSepArrayCol);
+ maEdSepArrayRow.SetText(aSepArrayRow);
+ }
+ else
+ ResetSeparators();
+}
+
+int ScTpFormulaOptions::DeactivatePage(SfxItemSet* /*pSet*/)
+{
+ // What's this method for ?
+ return KEEP_PAGE;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx
new file mode 100644
index 000000000000..29fd59c5309b
--- /dev/null
+++ b/sc/source/ui/optdlg/tpprint.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#undef SC_DLLIMPLEMENTATION
+
+#include <svl/eitem.hxx>
+
+#include "tpprint.hxx"
+#include "printopt.hxx"
+#include "scmod.hxx"
+#include "scresid.hxx"
+#include "sc.hrc"
+#include "optdlg.hrc"
+
+// -----------------------------------------------------------------------
+
+static sal_uInt16 pPrintOptRanges[] =
+{
+ SID_SCPRINTOPTIONS,
+ SID_SCPRINTOPTIONS,
+ 0
+};
+
+// -----------------------------------------------------------------------
+
+ScTpPrintOptions::ScTpPrintOptions( Window* pParent,
+ const SfxItemSet& rCoreAttrs )
+ : SfxTabPage ( pParent,
+ ScResId( RID_SCPAGE_PRINT ),
+ rCoreAttrs ),
+ aPagesFL ( this, ScResId( FL_PAGES ) ),
+ aSkipEmptyPagesCB( this, ScResId( BTN_SKIPEMPTYPAGES ) ),
+ aSheetsFL ( this, ScResId( FL_SHEETS ) ),
+ aSelectedSheetsCB( this, ScResId( BTN_SELECTEDSHEETS ) )
+{
+ FreeResource();
+}
+
+ScTpPrintOptions::~ScTpPrintOptions()
+{
+}
+
+sal_uInt16* ScTpPrintOptions::GetRanges()
+{
+ return pPrintOptRanges;
+}
+
+SfxTabPage* ScTpPrintOptions::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new ScTpPrintOptions( pParent, rAttrSet );
+}
+
+int ScTpPrintOptions::DeactivatePage( SfxItemSet* pSetP )
+{
+ if ( pSetP )
+ FillItemSet( *pSetP );
+
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpPrintOptions::Reset( const SfxItemSet& rCoreSet )
+{
+ ScPrintOptions aOptions;
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCPRINTOPTIONS, false , &pItem))
+ aOptions = ((const ScTpPrintItem*)pItem)->GetPrintOptions();
+ else
+ {
+ // when called from print dialog and no options set, use configuration
+ aOptions = SC_MOD()->GetPrintOptions();
+ }
+
+ if ( SFX_ITEM_SET == rCoreSet.GetItemState( SID_PRINT_SELECTEDSHEET, false , &pItem ) )
+ {
+ sal_Bool bChecked = ( (const SfxBoolItem*)pItem )->GetValue();
+ aSelectedSheetsCB.Check( bChecked );
+ }
+ else
+ {
+ aSelectedSheetsCB.Check( !aOptions.GetAllSheets() );
+ }
+
+ aSkipEmptyPagesCB.Check( aOptions.GetSkipEmpty() );
+ aSkipEmptyPagesCB.SaveValue();
+ aSelectedSheetsCB.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool ScTpPrintOptions::FillItemSet( SfxItemSet& rCoreAttrs )
+{
+ rCoreAttrs.ClearItem( SID_PRINT_SELECTEDSHEET );
+
+ bool bSkipEmptyChanged = ( aSkipEmptyPagesCB.GetSavedValue() != aSkipEmptyPagesCB.IsChecked() );
+ bool bSelectedSheetsChanged = ( aSelectedSheetsCB.GetSavedValue() != aSelectedSheetsCB.IsChecked() );
+
+ if ( bSkipEmptyChanged || bSelectedSheetsChanged )
+ {
+ ScPrintOptions aOpt;
+ aOpt.SetSkipEmpty( aSkipEmptyPagesCB.IsChecked() );
+ aOpt.SetAllSheets( !aSelectedSheetsCB.IsChecked() );
+ rCoreAttrs.Put( ScTpPrintItem( SID_SCPRINTOPTIONS, aOpt ) );
+ if ( bSelectedSheetsChanged )
+ {
+ rCoreAttrs.Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, aSelectedSheetsCB.IsChecked() ) );
+ }
+ return sal_True;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
new file mode 100644
index 000000000000..6761f313e38c
--- /dev/null
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -0,0 +1,808 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#undef SC_DLLIMPLEMENTATION
+
+//------------------------------------------------------------------
+#include <vcl/msgbox.hxx>
+
+#include "global.hxx"
+#include "document.hxx"
+#include "tabvwsh.hxx"
+#include "viewdata.hxx"
+#include "uiitems.hxx"
+#include "userlist.hxx"
+#include "rangeutl.hxx"
+#include "crdlg.hxx"
+#include "scresid.hxx"
+#include "sc.hrc" // -> Slot-IDs
+#include "optdlg.hrc"
+#include "globstr.hrc"
+
+#define _TPUSRLST_CXX
+#include "tpusrlst.hxx"
+#undef _TPUSRLST_CXX
+
+// STATIC DATA -----------------------------------------------------------
+
+#define CR (sal_Unicode)13
+#define LF (sal_Unicode)10
+
+static sal_uInt16 pUserListsRanges[] =
+{
+ SID_SCUSERLISTS,
+ SID_SCUSERLISTS,
+ 0
+};
+
+static const sal_Unicode cDelimiter = ',';
+
+
+//========================================================================
+// Benutzerdefinierte Listen:
+
+
+ScTpUserLists::ScTpUserLists( Window* pParent,
+ const SfxItemSet& rCoreAttrs )
+
+ : SfxTabPage ( pParent,
+ ScResId( RID_SCPAGE_USERLISTS ),
+ rCoreAttrs ),
+ aFtLists ( this, ScResId( FT_LISTS ) ),
+ aLbLists ( this, ScResId( LB_LISTS ) ),
+ aFtEntries ( this, ScResId( FT_ENTRIES ) ),
+ aEdEntries ( this, ScResId( ED_ENTRIES ) ),
+ aFtCopyFrom ( this, ScResId( FT_COPYFROM ) ),
+ aEdCopyFrom ( this, ScResId( ED_COPYFROM ) ),
+ aBtnNew ( this, ScResId( BTN_NEW ) ),
+ aBtnAdd ( this, ScResId( BTN_ADD ) ),
+ aBtnRemove ( this, ScResId( BTN_REMOVE ) ),
+ aBtnCopy ( this, ScResId( BTN_COPY ) ),
+ aStrQueryRemove ( ScResId( STR_QUERYREMOVE ) ),
+ aStrNew ( aBtnNew.GetText() ),
+ aStrCancel ( ScResId( STR_DISMISS ) ),
+ aStrAdd ( ScResId( SCSTR_ADD ) ),
+ aStrModify ( ScResId( SCSTR_MODIFY ) ),
+ aStrCopyList ( ScResId( STR_COPYLIST ) ),
+ aStrCopyFrom ( ScResId( STR_COPYFROM ) ),
+ aStrCopyErr ( ScResId( STR_COPYERR ) ),
+ nWhichUserLists ( GetWhich( SID_SCUSERLISTS ) ),
+ pUserLists ( NULL ),
+ pDoc ( NULL ),
+ pViewData ( NULL ),
+ pRangeUtil ( new ScRangeUtil ),
+ bModifyMode ( false ),
+ bCancelMode ( false ),
+ bCopyDone ( false ),
+ nCancelPos ( 0 )
+{
+ SetExchangeSupport();
+ Init();
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+ScTpUserLists::~ScTpUserLists()
+{
+ delete pUserLists;
+ delete pRangeUtil;
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpUserLists::Init()
+{
+ SfxViewShell* pSh = SfxViewShell::Current();
+ ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, pSh);
+
+ aLbLists.SetSelectHdl ( LINK( this, ScTpUserLists, LbSelectHdl ) );
+ aBtnNew.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
+ aBtnNew.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
+ aBtnAdd.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
+ aBtnRemove.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
+ aEdEntries.SetModifyHdl ( LINK( this, ScTpUserLists, EdEntriesModHdl ) );
+
+
+ if ( pViewSh )
+ {
+ SCTAB nStartTab = 0;
+ SCTAB nEndTab = 0;
+ SCCOL nStartCol = 0;
+ SCROW nStartRow = 0;
+ SCCOL nEndCol = 0;
+ SCROW nEndRow = 0;
+
+ pViewData = pViewSh->GetViewData();
+ pDoc = pViewData->GetDocument();
+
+ pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
+ nEndCol, nEndRow, nEndTab );
+
+ PutInOrder( nStartCol, nEndCol );
+ PutInOrder( nStartRow, nEndRow );
+ PutInOrder( nStartTab, nEndTab );
+
+ ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab
+ ).Format( aStrSelectedArea, SCR_ABS_3D, pDoc );
+
+ aBtnCopy.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
+ aBtnCopy.Enable();
+ }
+ else
+ {
+ aBtnCopy.Disable();
+ aFtCopyFrom.Disable();
+ aEdCopyFrom.Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16* ScTpUserLists::GetRanges()
+{
+ return pUserListsRanges;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* ScTpUserLists::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new ScTpUserLists( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpUserLists::Reset( const SfxItemSet& rCoreAttrs )
+{
+ const ScUserListItem& rUserListItem = (const ScUserListItem&)
+ rCoreAttrs.Get( nWhichUserLists );
+ const ScUserList* pCoreList = rUserListItem.GetUserList();
+
+ DBG_ASSERT( pCoreList, "UserList not found :-/" );
+
+ if ( pCoreList )
+ {
+ if ( !pUserLists )
+ pUserLists = new ScUserList( *pCoreList );
+ else
+ *pUserLists = *pCoreList;
+
+ if ( UpdateUserListBox() > 0 )
+ {
+ aLbLists.SelectEntryPos( 0 );
+ UpdateEntries( 0 );
+ }
+ }
+ else if ( !pUserLists )
+ pUserLists = new ScUserList;
+
+ aEdCopyFrom.SetText( aStrSelectedArea );
+
+ if ( aLbLists.GetEntryCount() == 0 )
+ {
+ aFtLists .Disable();
+ aLbLists .Disable();
+ aFtEntries .Disable();
+ aEdEntries .Disable();
+ aBtnRemove .Disable();
+ }
+
+ aBtnNew.SetText( aStrNew );
+ aBtnAdd.SetText( aStrAdd );
+ aBtnAdd.Disable();
+
+ if ( !bCopyDone && pViewData )
+ {
+ aFtCopyFrom .Enable();
+ aEdCopyFrom .Enable();
+ aBtnCopy .Enable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool ScTpUserLists::FillItemSet( SfxItemSet& rCoreAttrs )
+{
+ // Modifikationen noch nicht uebernommen?
+ // -> Click auf Add-Button simulieren
+
+ if ( bModifyMode || bCancelMode )
+ BtnClickHdl( &aBtnAdd );
+
+ const ScUserListItem& rUserListItem = (const ScUserListItem&)
+ GetItemSet().Get( nWhichUserLists );
+
+ ScUserList* pCoreList = rUserListItem.GetUserList();
+ sal_Bool bDataModified = false;
+
+ if ( (pUserLists == NULL) && (pCoreList == NULL) )
+ {
+ bDataModified = false;
+ }
+ else if ( pUserLists != NULL )
+ {
+ if ( pCoreList != NULL )
+ bDataModified = (*pUserLists != *pCoreList);
+ else
+ bDataModified = sal_True;
+ }
+
+ if ( bDataModified )
+ {
+ ScUserListItem aULItem( nWhichUserLists );
+
+ if ( pUserLists )
+ aULItem.SetUserList( *pUserLists );
+
+ rCoreAttrs.Put( aULItem );
+ }
+
+ return bDataModified;
+}
+
+// -----------------------------------------------------------------------
+
+int ScTpUserLists::DeactivatePage( SfxItemSet* pSetP )
+{
+ if ( pSetP )
+ FillItemSet( *pSetP );
+
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 ScTpUserLists::UpdateUserListBox()
+{
+ aLbLists.Clear();
+
+ if ( !pUserLists ) return 0;
+
+ //----------------------------------------------------------
+
+ sal_uInt16 nCount = pUserLists->GetCount();
+ String aEntry;
+
+ if ( nCount > 0 )
+ {
+ for ( sal_uInt16 i=0; i<nCount; i++ )
+ {
+ aEntry = (*pUserLists)[i]->GetString();
+ DBG_ASSERT( aEntry.Len() > 0, "Empty UserList-entry :-/" );
+ aLbLists.InsertEntry( aEntry );
+ }
+ }
+
+ return nCount;
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpUserLists::UpdateEntries( sal_uInt16 nList )
+{
+ if ( !pUserLists ) return;
+
+ //----------------------------------------------------------
+
+ if ( nList < pUserLists->GetCount() )
+ {
+ ScUserListData* pList = (*pUserLists)[nList];
+ sal_uInt16 nSubCount = pList->GetSubCount();
+ String aEntryListStr;
+
+ for ( sal_uInt16 i=0; i<nSubCount; i++ )
+ {
+ if ( i!=0 )
+ aEntryListStr += CR;
+ aEntryListStr += pList->GetSubStr( i );
+ }
+
+ aEntryListStr.ConvertLineEnd();
+ aEdEntries.SetText( aEntryListStr );
+ }
+ else
+ {
+ OSL_FAIL( "Invalid ListIndex :-/" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpUserLists::MakeListStr( String& rListStr )
+{
+ String aInputStr(rListStr);
+ String aStr;
+
+ xub_StrLen nLen = aStr.Len();
+ xub_StrLen c = 0;
+
+ aInputStr.ConvertLineEnd( LINEEND_LF );
+
+ xub_StrLen nToken=rListStr.GetTokenCount(LF);
+
+ for(xub_StrLen i=0;i<nToken;i++)
+ {
+ String aString=rListStr.GetToken(i,LF);
+ aString.EraseLeadingChars(' ');
+ aString.EraseTrailingChars(' ');
+ aStr+=aString;
+ aStr+=cDelimiter;
+ }
+
+ aStr.EraseLeadingChars( cDelimiter );
+ aStr.EraseTrailingChars( cDelimiter );
+ nLen = aStr.Len();
+
+ rListStr.Erase();
+
+ // Alle Doppelten cDelimiter entfernen:
+ c=0;
+ while ( c < nLen )
+ {
+ rListStr += aStr.GetChar(c);
+ c++;
+
+ if ( aStr.GetChar(c) == cDelimiter )
+ {
+ rListStr += aStr.GetChar(c);
+
+ while ( (aStr.GetChar(c) == cDelimiter) && (c < nLen) )
+ c++;
+ }
+ }
+
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpUserLists::AddNewList( const String& rEntriesStr )
+{
+ String theEntriesStr( rEntriesStr );
+
+ if ( !pUserLists )
+ pUserLists = new ScUserList;
+
+ MakeListStr( theEntriesStr );
+
+ if ( !pUserLists->Insert( new ScUserListData( theEntriesStr ) ) )
+ {
+ OSL_FAIL( "Entry could not be inserted :-/" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos,
+ const ScRefAddress& rEndPos )
+{
+ if ( bCopyDone ) return;
+
+ //----------------------------------------------------------
+
+ SCTAB nTab = rStartPos.Tab();
+ SCCOL nStartCol = rStartPos.Col();
+ SCROW nStartRow = rStartPos.Row();
+ SCCOL nEndCol = rEndPos.Col();
+ SCROW nEndRow = rEndPos.Row();
+ sal_uInt16 nCellDir = SCRET_COLS;
+ sal_Bool bValueIgnored = false;
+
+ if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) )
+ {
+ nCellDir = ScColOrRowDlg( this, aStrCopyList, aStrCopyFrom ).Execute();
+ }
+ else if ( nStartCol != nEndCol )
+ nCellDir = SCRET_ROWS;
+ else
+ nCellDir = SCRET_COLS;
+
+ if ( nCellDir != RET_CANCEL )
+ {
+ String aStrList;
+ String aStrField;
+
+ if ( nCellDir == SCRET_COLS )
+ {
+ for ( SCCOL col=nStartCol; col<=nEndCol; col++ )
+ {
+ for ( SCROW row=nStartRow; row<=nEndRow; row++ )
+ {
+ if ( pDoc->HasStringData( col, row, nTab ) )
+ {
+ pDoc->GetString( col, row, nTab, aStrField );
+
+ if ( aStrField.Len() > 0 )
+ {
+ aStrList += aStrField;
+ aStrList += '\n';
+ }
+ }
+ else
+ bValueIgnored = sal_True;
+ }
+ if ( aStrList.Len() > 0 )
+ AddNewList( aStrList );
+ aStrList.Erase();
+ }
+ }
+ else
+ {
+ for ( SCROW row=nStartRow; row<=nEndRow; row++ )
+ {
+ for ( SCCOL col=nStartCol; col<=nEndCol; col++ )
+ {
+ if ( pDoc->HasStringData( col, row, nTab ) )
+ {
+ pDoc->GetString( col, row, nTab, aStrField );
+
+ if ( aStrField.Len() > 0 )
+ {
+ aStrList += aStrField;
+ aStrList += '\n';
+ }
+ }
+ else
+ bValueIgnored = sal_True;
+ }
+ if ( aStrList.Len() > 0 )
+ AddNewList( aStrList );
+ aStrList.Erase();
+ }
+ }
+
+ if ( bValueIgnored )
+ {
+ InfoBox( this, aStrCopyErr ).Execute();
+ }
+ }
+
+ //----------------------------------------------------------
+
+ bCopyDone = sal_True;
+
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpUserLists::ModifyList( sal_uInt16 nSelList,
+ const String& rEntriesStr )
+{
+ if ( !pUserLists ) return;
+
+ //----------------------------------------------------------
+
+ String theEntriesStr( rEntriesStr );
+
+ MakeListStr( theEntriesStr );
+
+ (*pUserLists)[nSelList]->SetString( theEntriesStr );
+}
+
+// -----------------------------------------------------------------------
+
+void ScTpUserLists::RemoveList( sal_uInt16 nList )
+{
+ if ( pUserLists ) pUserLists->AtFree( nList );
+}
+
+//-----------------------------------------------------------------------
+// Handler:
+//---------
+
+IMPL_LINK( ScTpUserLists, LbSelectHdl, ListBox*, pLb )
+{
+ if ( pLb == &aLbLists )
+ {
+ sal_uInt16 nSelPos = aLbLists.GetSelectEntryPos();
+ if ( nSelPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ if ( !aFtEntries.IsEnabled() ) aFtEntries.Enable();
+ if ( !aEdEntries.IsEnabled() ) aEdEntries.Enable();
+ if ( !aBtnRemove.IsEnabled() ) aBtnRemove.Enable();
+ if ( aBtnAdd.IsEnabled() ) aBtnAdd.Disable();
+
+ UpdateEntries( nSelPos );
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
+{
+ if ( pBtn == &aBtnNew )
+ {
+ if ( !bCancelMode )
+ {
+ nCancelPos = ( aLbLists.GetEntryCount() > 0 )
+ ? aLbLists.GetSelectEntryPos()
+ : 0;
+ aLbLists.SetNoSelection();
+ aFtLists.Disable();
+ aLbLists.Disable();
+ aFtEntries.Enable();
+ aEdEntries.Enable();
+ aEdEntries.SetText( EMPTY_STRING );
+ aEdEntries.GrabFocus();
+ aBtnAdd.Disable();
+ aBtnRemove.Disable();
+ //-----------------------------
+ if ( aBtnCopy.IsEnabled() )
+ {
+ aBtnCopy.Disable();
+ aFtCopyFrom.Disable();
+ aEdCopyFrom.Disable();
+ }
+ aBtnNew.SetText( aStrCancel );
+ bCancelMode = sal_True;
+ }
+ else // if ( bCancelMode )
+ {
+ if ( aLbLists.GetEntryCount() > 0 )
+ {
+ aLbLists.SelectEntryPos( nCancelPos );
+ LbSelectHdl( &aLbLists );
+ aFtLists.Enable();
+ aLbLists.Enable();
+ }
+ else
+ {
+ aFtEntries.Disable();
+ aEdEntries.Disable();
+ aEdEntries.SetText( EMPTY_STRING );
+ aBtnRemove.Disable();
+ }
+ aBtnAdd.Disable();
+ //-----------------------------
+ if ( pViewData && !bCopyDone )
+ {
+ aBtnCopy.Enable();
+ aFtCopyFrom.Enable();
+ aEdCopyFrom.Enable();
+ }
+ aBtnNew.SetText( aStrNew );
+ bCancelMode = false;
+ bModifyMode = false;
+ }
+ }
+ else if ( pBtn == &aBtnAdd )
+ {
+ String theEntriesStr( aEdEntries.GetText() );
+
+ if ( !bModifyMode )
+ {
+ if ( theEntriesStr.Len() > 0 )
+ {
+ AddNewList( theEntriesStr );
+ UpdateUserListBox();
+ aLbLists.SelectEntryPos( aLbLists.GetEntryCount()-1 );
+ LbSelectHdl( &aLbLists );
+ aFtLists.Enable();
+ aLbLists.Enable();
+ }
+ else
+ {
+ if ( aLbLists.GetEntryCount() > 0 )
+ {
+ aLbLists.SelectEntryPos( nCancelPos );
+ LbSelectHdl( &aLbLists );
+ aLbLists.Enable();
+ aLbLists.Enable();
+ }
+ }
+
+ aBtnAdd.Disable();
+ aBtnRemove.Enable();
+ aBtnNew.SetText( aStrNew );
+ bCancelMode = false;
+ }
+ else // if ( bModifyMode )
+ {
+ sal_uInt16 nSelList = aLbLists.GetSelectEntryPos();
+
+ DBG_ASSERT( nSelList != LISTBOX_ENTRY_NOTFOUND, "Modify without List :-/" );
+
+ if ( theEntriesStr.Len() > 0 )
+ {
+ ModifyList( nSelList, theEntriesStr );
+ UpdateUserListBox();
+ aLbLists.SelectEntryPos( nSelList );
+ }
+ else
+ {
+ aLbLists.SelectEntryPos( 0 );
+ LbSelectHdl( &aLbLists );
+ }
+
+ aBtnNew.SetText( aStrNew ); bCancelMode = false;
+ aBtnAdd.SetText( aStrAdd ); bModifyMode = false;
+ aBtnAdd.Disable();
+ aBtnRemove.Enable();
+ aFtLists.Enable();
+ aLbLists.Enable();
+ }
+
+ if ( pViewData && !bCopyDone )
+ {
+ aBtnCopy.Enable();
+ aFtCopyFrom.Enable();
+ aEdCopyFrom.Enable();
+ }
+ }
+ else if ( pBtn == &aBtnRemove )
+ {
+ if ( aLbLists.GetEntryCount() > 0 )
+ {
+ sal_uInt16 nRemovePos = aLbLists.GetSelectEntryPos();
+ String aMsg ( aStrQueryRemove.GetToken( 0, '#' ) );
+
+ aMsg += aLbLists.GetEntry( nRemovePos );
+ aMsg += aStrQueryRemove.GetToken( 1, '#' );
+
+
+ if ( RET_YES == QueryBox( this,
+ WinBits( WB_YES_NO | WB_DEF_YES ),
+ aMsg
+ ).Execute() )
+ {
+ RemoveList( nRemovePos );
+ UpdateUserListBox();
+
+ if ( aLbLists.GetEntryCount() > 0 )
+ {
+ aLbLists.SelectEntryPos(
+ ( nRemovePos >= aLbLists.GetEntryCount() )
+ ? aLbLists.GetEntryCount()-1
+ : nRemovePos );
+ LbSelectHdl( &aLbLists );
+ }
+ else
+ {
+ aFtLists.Disable();
+ aLbLists.Disable();
+ aFtEntries.Disable();
+ aEdEntries.Disable();
+ aEdEntries.SetText( EMPTY_STRING );
+ aBtnRemove.Disable();
+ }
+ }
+
+ if ( pViewData && !bCopyDone && !aBtnCopy.IsEnabled() )
+ {
+ aBtnCopy.Enable();
+ aFtCopyFrom.Enable();
+ aEdCopyFrom.Enable();
+ }
+ }
+ }
+ else if ( pViewData && (pBtn == &aBtnCopy) )
+ {
+ if ( bCopyDone )
+ return 0;
+
+ //-----------------------------------------------------------
+
+ ScRefAddress theStartPos;
+ ScRefAddress theEndPos;
+ String theAreaStr( aEdCopyFrom.GetText() );
+ sal_Bool bAreaOk = false;
+
+ if ( theAreaStr.Len() > 0 )
+ {
+ bAreaOk = pRangeUtil->IsAbsArea( theAreaStr,
+ pDoc,
+ pViewData->GetTabNo(),
+ &theAreaStr,
+ &theStartPos,
+ &theEndPos,
+ pDoc->GetAddressConvention() );
+ if ( !bAreaOk )
+ {
+ bAreaOk = pRangeUtil->IsAbsPos( theAreaStr,
+ pDoc,
+ pViewData->GetTabNo(),
+ &theAreaStr,
+ &theStartPos,
+ pDoc->GetAddressConvention() );
+ theEndPos = theStartPos;
+ }
+ }
+
+ if ( bAreaOk )
+ {
+ CopyListFromArea( theStartPos, theEndPos );
+ UpdateUserListBox();
+ aLbLists.SelectEntryPos( aLbLists.GetEntryCount()-1 );
+ LbSelectHdl( &aLbLists );
+ aEdCopyFrom .SetText( theAreaStr );
+ aEdCopyFrom .Disable();
+ aBtnCopy .Disable();
+ aFtCopyFrom .Disable();
+ }
+ else
+ {
+ ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ),
+ ScGlobal::GetRscString( STR_INVALID_TABREF )
+ ).Execute();
+ aEdCopyFrom.GrabFocus();
+ aEdCopyFrom.SetSelection( Selection( 0, SELECTION_MAX ) );
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScTpUserLists, EdEntriesModHdl, MultiLineEdit*, pEd )
+{
+ if ( pEd != &aEdEntries )
+ return 0;
+
+ //-----------------------------------------------------------
+
+ if ( aBtnCopy.IsEnabled() )
+ {
+ aBtnCopy .Disable();
+ aFtCopyFrom .Disable();
+ aEdCopyFrom .Disable();
+ }
+
+ if ( aEdEntries.GetText().Len() > 0 )
+ {
+ if ( !bCancelMode && !bModifyMode )
+ {
+ aBtnNew.SetText( aStrCancel ); bCancelMode = sal_True;
+ aBtnAdd.SetText( aStrModify ); bModifyMode = sal_True;
+ aBtnAdd.Enable();
+ aBtnRemove.Disable();
+ aFtLists.Disable();
+ aLbLists.Disable();
+ }
+ else // if ( bCancelMode || bModifyMode )
+ {
+ if ( !aBtnAdd.IsEnabled() ) aBtnAdd.Enable();
+ }
+ }
+ else
+ {
+ if ( aBtnAdd.IsEnabled() ) aBtnAdd.Disable();
+ }
+
+ return 0;
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
new file mode 100644
index 000000000000..79ec3116762f
--- /dev/null
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -0,0 +1,684 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#undef SC_DLLIMPLEMENTATION
+
+
+
+//------------------------------------------------------------------
+
+#include "scitems.hxx"
+#include "tpview.hxx"
+#include "global.hxx"
+#include "viewopti.hxx"
+#include "tabvwsh.hxx"
+#include "uiitems.hxx"
+#include "scresid.hxx"
+#include "docsh.hxx"
+#include "sc.hrc" // -> Slot-IDs
+#include "optdlg.hrc"
+#include "globstr.hrc"
+#include <appoptio.hxx>
+#include <scmod.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/xtable.hxx>
+
+
+// STATIC DATA -----------------------------------------------------------
+
+
+
+ScTpContentOptions::ScTpContentOptions( Window* pParent,
+ const SfxItemSet& rArgSet ) :
+ SfxTabPage(pParent, ScResId( RID_SCPAGE_CONTENT ), rArgSet),
+
+ aLinesGB( this, ScResId(GB_LINES )),
+ aGridCB( this, ScResId(CB_GRID )),
+ aColorFT( this, ScResId(FT_COLOR )),
+ aColorLB( this, ScResId(LB_COLOR )),
+ aBreakCB( this, ScResId(CB_PAGEBREAKS )),
+ aGuideLineCB( this, ScResId(CB_GUIDELINE )),
+ aHandleCB( this, ScResId(CB_HANDLES )),
+ aBigHandleCB( this, ScResId(CB_BIGHANDLES )),
+
+ aSeparator1FL (this, ScResId(FL_SEPARATOR1 )),
+ aDisplayGB( this, ScResId(GB_DISPLAY)),
+ aFormulaCB( this, ScResId(CB_FORMULA)),
+ aNilCB( this, ScResId(CB_NIL )),
+ aAnnotCB( this, ScResId(CB_ANNOT )),
+ aValueCB( this, ScResId(CB_VALUE )),
+ aAnchorCB( this, ScResId(CB_ANCHOR )),
+ aClipMarkCB( this, ScResId(CB_CLIP )),
+ aRangeFindCB( this, ScResId( CB_RFIND )),
+
+ aObjectGB( this, ScResId(GB_OBJECT )),
+ aObjGrfFT( this, ScResId(FT_OBJGRF )),
+ aObjGrfLB( this, ScResId(LB_OBJGRF )),
+ aDiagramFT( this, ScResId(FT_DIAGRAM)),
+ aDiagramLB( this, ScResId(LB_DIAGRAM)),
+ aDrawFT( this, ScResId(FT_DRAW )),
+ aDrawLB( this, ScResId(LB_DRAW )),
+
+ aZoomGB( this, ScResId(GB_ZOOM) ),
+ aSyncZoomCB( this, ScResId(CB_SYNCZOOM) ),
+
+ aSeparator2FL (this, ScResId(FL_SEPARATOR2)),
+ aWindowGB( this, ScResId(GB_WINDOW )),
+ aRowColHeaderCB(this, ScResId(CB_ROWCOLHEADER )),
+ aHScrollCB( this, ScResId(CB_HSCROLL )),
+ aVScrollCB( this, ScResId(CB_VSCROLL )),
+ aTblRegCB( this, ScResId(CB_TBLREG )),
+ aOutlineCB( this, ScResId(CB_OUTLINE )),
+ pLocalOptions(0)
+{
+ FreeResource();
+ aSeparator1FL.SetStyle( aSeparator1FL.GetStyle() | WB_VERT );
+ aSeparator2FL.SetStyle( aSeparator2FL.GetStyle() | WB_VERT );
+ SetExchangeSupport();
+ Link aSelObjHdl(LINK( this, ScTpContentOptions, SelLbObjHdl ) );
+ aObjGrfLB. SetSelectHdl(aSelObjHdl);
+ aDiagramLB. SetSelectHdl(aSelObjHdl);
+ aDrawLB. SetSelectHdl(aSelObjHdl);
+
+ Link aCBHdl(LINK( this, ScTpContentOptions, CBHdl ) );
+ aFormulaCB .SetClickHdl(aCBHdl);
+ aNilCB .SetClickHdl(aCBHdl);
+ aAnnotCB .SetClickHdl(aCBHdl);
+ aValueCB .SetClickHdl(aCBHdl);
+ aAnchorCB .SetClickHdl(aCBHdl);
+ aClipMarkCB .SetClickHdl(aCBHdl);
+
+ aVScrollCB .SetClickHdl(aCBHdl);
+ aHScrollCB .SetClickHdl(aCBHdl);
+ aTblRegCB .SetClickHdl(aCBHdl);
+ aOutlineCB .SetClickHdl(aCBHdl);
+ aBreakCB .SetClickHdl(aCBHdl);
+ aGuideLineCB.SetClickHdl(aCBHdl);
+ aHandleCB .SetClickHdl(aCBHdl);
+ aBigHandleCB.SetClickHdl(aCBHdl);
+ aRowColHeaderCB.SetClickHdl(aCBHdl);
+
+ aGridCB .SetClickHdl( LINK( this, ScTpContentOptions, GridHdl ) );
+}
+
+ScTpContentOptions::~ScTpContentOptions()
+{
+ delete pLocalOptions;
+}
+
+SfxTabPage* ScTpContentOptions::Create( Window* pParent,
+ const SfxItemSet& rCoreSet )
+{
+ return new ScTpContentOptions(pParent, rCoreSet);
+}
+
+sal_Bool ScTpContentOptions::FillItemSet( SfxItemSet& rCoreSet )
+{
+ sal_Bool bRet = false;
+ if( aFormulaCB .GetSavedValue() != aFormulaCB .IsChecked() ||
+ aNilCB .GetSavedValue() != aNilCB .IsChecked() ||
+ aAnnotCB .GetSavedValue() != aAnnotCB .IsChecked() ||
+ aValueCB .GetSavedValue() != aValueCB .IsChecked() ||
+ aAnchorCB .GetSavedValue() != aAnchorCB .IsChecked() ||
+ aClipMarkCB .GetSavedValue() != aClipMarkCB .IsChecked() ||
+ aObjGrfLB .GetSavedValue() != aObjGrfLB .GetSelectEntryPos() ||
+ aDiagramLB .GetSavedValue() != aDiagramLB .GetSelectEntryPos() ||
+ aDrawLB .GetSavedValue() != aDrawLB .GetSelectEntryPos() ||
+ aGridCB .GetSavedValue() != aGridCB.IsChecked() ||
+ aRowColHeaderCB .GetSavedValue() != aRowColHeaderCB.IsChecked() ||
+ aHScrollCB .GetSavedValue() != aHScrollCB .IsChecked() ||
+ aVScrollCB .GetSavedValue() != aVScrollCB .IsChecked() ||
+ aTblRegCB .GetSavedValue() != aTblRegCB .IsChecked() ||
+ aOutlineCB .GetSavedValue() != aOutlineCB .IsChecked() ||
+ aColorLB .GetSavedValue() != aColorLB .GetSelectEntryPos() ||
+ aBreakCB .GetSavedValue() != aBreakCB .IsChecked() ||
+ aGuideLineCB .GetSavedValue() != aGuideLineCB .IsChecked() ||
+ aHandleCB .GetSavedValue() != aHandleCB .IsChecked() ||
+ aBigHandleCB .GetSavedValue() != aBigHandleCB .IsChecked())
+ {
+ pLocalOptions->SetGridColor( aColorLB.GetSelectEntryColor(),
+ aColorLB.GetSelectEntry() );
+ rCoreSet.Put(ScTpViewItem(SID_SCVIEWOPTIONS, *pLocalOptions));
+ bRet = sal_True;
+ }
+ if(aRangeFindCB.GetSavedValue() != aRangeFindCB.IsChecked())
+ {
+ rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_RANGEFINDER, aRangeFindCB.IsChecked()));
+ bRet = sal_True;
+ }
+ if(aSyncZoomCB.GetSavedValue() != aSyncZoomCB.IsChecked())
+ {
+ rCoreSet.Put(SfxBoolItem(SID_SC_OPT_SYNCZOOM, aSyncZoomCB.IsChecked()));
+ bRet = sal_True;
+ }
+
+
+ return bRet;
+}
+
+void ScTpContentOptions::Reset( const SfxItemSet& rCoreSet )
+{
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCVIEWOPTIONS, false , &pItem))
+ pLocalOptions = new ScViewOptions(
+ ((const ScTpViewItem*)pItem)->GetViewOptions() );
+ else
+ pLocalOptions = new ScViewOptions;
+ aFormulaCB .Check(pLocalOptions->GetOption(VOPT_FORMULAS));
+ aNilCB .Check(pLocalOptions->GetOption(VOPT_NULLVALS));
+ aAnnotCB .Check(pLocalOptions->GetOption(VOPT_NOTES));
+ aValueCB .Check(pLocalOptions->GetOption(VOPT_SYNTAX));
+ aAnchorCB .Check(pLocalOptions->GetOption(VOPT_ANCHOR));
+ aClipMarkCB .Check(pLocalOptions->GetOption(VOPT_CLIPMARKS));
+
+ aObjGrfLB .SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_OLE) );
+ aDiagramLB .SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_CHART) );
+ aDrawLB .SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_DRAW) );
+
+ aRowColHeaderCB.Check( pLocalOptions->GetOption(VOPT_HEADER) );
+ aHScrollCB .Check( pLocalOptions->GetOption(VOPT_HSCROLL) );
+ aVScrollCB .Check( pLocalOptions->GetOption(VOPT_VSCROLL) );
+ aTblRegCB .Check( pLocalOptions->GetOption(VOPT_TABCONTROLS) );
+ aOutlineCB .Check( pLocalOptions->GetOption(VOPT_OUTLINER) );
+
+ InitGridOpt();
+
+ aBreakCB.Check( pLocalOptions->GetOption(VOPT_PAGEBREAKS) );
+ aGuideLineCB.Check( pLocalOptions->GetOption(VOPT_HELPLINES) );
+ aHandleCB.Check( !pLocalOptions->GetOption(VOPT_SOLIDHANDLES) ); // inverted
+ aBigHandleCB.Check( pLocalOptions->GetOption(VOPT_BIGHANDLES) );
+
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_RANGEFINDER, false, &pItem))
+ aRangeFindCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_OPT_SYNCZOOM, false, &pItem))
+ aSyncZoomCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+
+ aRangeFindCB.SaveValue();
+ aSyncZoomCB.SaveValue();
+
+ aFormulaCB .SaveValue();
+ aNilCB .SaveValue();
+ aAnnotCB .SaveValue();
+ aValueCB .SaveValue();
+ aAnchorCB .SaveValue();
+ aClipMarkCB .SaveValue();
+ aObjGrfLB .SaveValue();
+ aDiagramLB .SaveValue();
+ aDrawLB .SaveValue();
+ aRowColHeaderCB .SaveValue();
+ aHScrollCB .SaveValue();
+ aVScrollCB .SaveValue();
+ aTblRegCB .SaveValue();
+ aOutlineCB .SaveValue();
+ aGridCB .SaveValue();
+ aColorLB .SaveValue();
+ aBreakCB .SaveValue();
+ aGuideLineCB .SaveValue();
+ aHandleCB .SaveValue();
+ aBigHandleCB .SaveValue();
+}
+
+void ScTpContentOptions::ActivatePage( const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_SCVIEWOPTIONS, false , &pItem))
+ *pLocalOptions = ((const ScTpViewItem*)pItem)->GetViewOptions();
+}
+
+int ScTpContentOptions::DeactivatePage( SfxItemSet* pSetP )
+{
+ if(pSetP)
+ FillItemSet(*pSetP);
+ return SfxTabPage::LEAVE_PAGE;
+}
+
+IMPL_LINK( ScTpContentOptions, SelLbObjHdl, ListBox*, pLb )
+{
+ sal_uInt16 nSelPos = pLb->GetSelectEntryPos();
+ ScVObjMode eMode = ScVObjMode(nSelPos);
+ ScVObjType eType = VOBJ_TYPE_OLE;
+
+ if ( pLb == &aDiagramLB )
+ eType = VOBJ_TYPE_CHART;
+ else if ( pLb == &aDrawLB )
+ eType = VOBJ_TYPE_DRAW;
+
+ pLocalOptions->SetObjMode( eType, eMode );
+
+ return 0;
+}
+
+IMPL_LINK( ScTpContentOptions, CBHdl, CheckBox*, pBtn )
+{
+ ScViewOption eOption = VOPT_FORMULAS;
+ sal_Bool bChecked = pBtn->IsChecked();
+
+ if ( &aFormulaCB == pBtn ) eOption = VOPT_FORMULAS;
+ else if ( &aNilCB == pBtn ) eOption = VOPT_NULLVALS;
+ else if ( &aAnnotCB == pBtn ) eOption = VOPT_NOTES;
+ else if ( &aValueCB == pBtn ) eOption = VOPT_SYNTAX;
+ else if ( &aAnchorCB == pBtn ) eOption = VOPT_ANCHOR;
+ else if ( &aClipMarkCB == pBtn ) eOption = VOPT_CLIPMARKS;
+ else if ( &aVScrollCB == pBtn ) eOption = VOPT_VSCROLL;
+ else if ( &aHScrollCB == pBtn ) eOption = VOPT_HSCROLL;
+ else if ( &aTblRegCB == pBtn ) eOption = VOPT_TABCONTROLS;
+ else if ( &aOutlineCB == pBtn ) eOption = VOPT_OUTLINER;
+ else if ( &aBreakCB == pBtn ) eOption = VOPT_PAGEBREAKS;
+ else if ( &aGuideLineCB == pBtn ) eOption = VOPT_HELPLINES;
+ else if ( &aHandleCB == pBtn ) eOption = VOPT_SOLIDHANDLES;
+ else if ( &aBigHandleCB == pBtn ) eOption = VOPT_BIGHANDLES;
+ else if ( &aRowColHeaderCB == pBtn ) eOption = VOPT_HEADER;
+
+ // VOPT_SOLIDHANDLES is inverted (CheckBox is "simple handles")
+ if ( eOption == VOPT_SOLIDHANDLES )
+ pLocalOptions->SetOption( eOption, !bChecked );
+ else
+ pLocalOptions->SetOption( eOption, bChecked );
+
+
+ return 0;
+}
+
+void ScTpContentOptions::InitGridOpt()
+{
+ sal_Bool bGrid = pLocalOptions->GetOption( VOPT_GRID );
+
+ aGridCB.Check( bGrid );
+
+ if ( bGrid )
+ aColorFT.Enable(), aColorLB.Enable();
+ else
+ aColorFT.Disable(), aColorLB.Disable();
+
+ if ( aColorLB.GetEntryCount() == 0 )
+ {
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ // hier koennte auch eine andere DocShell kommen!
+ pDocSh = PTR_CAST(ScDocShell, pDocSh);
+
+ XColorTable* pColorTable = NULL;
+
+ if ( pDocSh )
+ {
+ const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+
+ if ( pItem )
+ pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+ }
+ else
+ pColorTable = XColorTable::GetStdColorTable();
+
+ if ( !pColorTable )
+ return;
+
+ //------------------------------------------------------
+
+ aColorLB.SetUpdateMode( false );
+
+ // Eintraege aus der Colortable
+
+ long nCount = pColorTable->Count();
+ for ( long n=0; n<nCount; n++ )
+ {
+ XColorEntry* pEntry = pColorTable->GetColor(n);
+ aColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+
+ // Standard-Gitterfarbe
+
+ Color aStdCol( SC_STD_GRIDCOLOR ); // wie Default in ScViewOptions
+ if ( LISTBOX_ENTRY_NOTFOUND ==
+ aColorLB.GetEntryPos( aStdCol ) )
+ aColorLB.InsertEntry( aStdCol, ScGlobal::GetRscString( STR_GRIDCOLOR ) );
+
+ aColorLB.SetUpdateMode( sal_True );
+
+ Invalidate();
+ }
+
+ // also select grid color entry on subsequent calls
+
+ String aName;
+ Color aCol = pLocalOptions->GetGridColor( &aName );
+ sal_uInt16 nSelPos = aColorLB.GetEntryPos( aCol );
+
+ if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
+ aColorLB.SelectEntryPos( nSelPos );
+ else
+ aColorLB.SelectEntryPos( aColorLB.InsertEntry( aCol, aName ) );
+}
+
+IMPL_LINK( ScTpContentOptions, GridHdl, CheckBox*, pBox )
+{
+ sal_Bool bChecked = pBox->IsChecked();
+ aColorFT.Enable(bChecked);
+ aColorLB.Enable(bChecked);
+ pLocalOptions->SetOption( VOPT_GRID, bChecked );
+ return 0;
+}
+
+ScTpLayoutOptions::ScTpLayoutOptions( Window* pParent,
+ const SfxItemSet& rArgSet ) :
+ SfxTabPage(pParent, ScResId( RID_SCPAGE_LAYOUT ), rArgSet),
+ aUnitGB( this, ScResId(GB_UNIT )),
+ aUnitFT( this, ScResId(FT_UNIT )),
+ aUnitLB( this, ScResId(LB_UNIT )),
+ aTabFT( this, ScResId( FT_TAB )),
+ aTabMF( this, ScResId( MF_TAB )),
+ aSeparatorFL( this, ScResId( FL_SEPARATOR )),
+ aLinkGB (this, ScResId(GB_LINK )),
+ aLinkFT(this, ScResId(FT_UPDATE_LINKS )),
+ aAlwaysRB (this, ScResId(RB_ALWAYS )),
+ aRequestRB (this, ScResId(RB_REQUEST )),
+ aNeverRB (this, ScResId(RB_NEVER )),
+
+ aOptionsGB( this, ScResId( GB_OPTIONS )),
+ aAlignCB ( this, ScResId( CB_ALIGN )),
+ aAlignLB ( this, ScResId( LB_ALIGN )),
+ aEditModeCB( this, ScResId( CB_EDITMODE )),
+ aFormatCB( this, ScResId( CB_FORMAT )),
+ aExpRefCB( this, ScResId( CB_EXPREF )),
+ aMarkHdrCB( this, ScResId( CB_MARKHDR )),
+ aTextFmtCB( this, ScResId( CB_TEXTFMT )),
+ aReplWarnCB( this, ScResId( CB_REPLWARN )),
+ aUnitArr( ScResId(ST_UNIT )),
+ pDoc(NULL)
+{
+ FreeResource();
+ aSeparatorFL.SetStyle( aSeparatorFL.GetStyle() | WB_VERT );
+ SetExchangeSupport();
+
+ aUnitLB. SetSelectHdl( LINK( this, ScTpLayoutOptions, MetricHdl ) );
+
+ aAlignCB.SetClickHdl(LINK(this, ScTpLayoutOptions, AlignHdl));
+
+
+ for ( sal_uInt16 i = 0; i < aUnitArr.Count(); ++i )
+ {
+ String sMetric = aUnitArr.GetStringByPos( i );
+ FieldUnit eFUnit = (FieldUnit)aUnitArr.GetValue( i );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_MM:
+ case FUNIT_CM:
+ case FUNIT_POINT:
+ case FUNIT_PICA:
+ case FUNIT_INCH:
+ {
+ // nur diese Metriken benutzen
+ sal_uInt16 nPos = aUnitLB.InsertEntry( sMetric );
+ aUnitLB.SetEntryData( nPos, (void*)(long)eFUnit );
+ }
+ break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
+ }
+
+}
+
+ScTpLayoutOptions::~ScTpLayoutOptions()
+{
+}
+
+SfxTabPage* ScTpLayoutOptions::Create( Window* pParent,
+ const SfxItemSet& rCoreSet )
+{
+ ScTpLayoutOptions* pNew = new ScTpLayoutOptions(pParent, rCoreSet);
+ ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current());
+
+ if(pDocSh!=NULL)
+ pNew->SetDocument(pDocSh->GetDocument());
+ return pNew;
+}
+
+sal_Bool ScTpLayoutOptions::FillItemSet( SfxItemSet& rCoreSet )
+{
+ sal_Bool bRet = sal_True;
+ const sal_uInt16 nMPos = aUnitLB.GetSelectEntryPos();
+ if ( nMPos != aUnitLB.GetSavedValue() )
+ {
+ sal_uInt16 nFieldUnit = (sal_uInt16)(long)aUnitLB.GetEntryData( nMPos );
+ rCoreSet.Put( SfxUInt16Item( SID_ATTR_METRIC,
+ (sal_uInt16)nFieldUnit ) );
+ bRet = sal_True;
+ }
+
+ if(aTabMF.GetText() != aTabMF.GetSavedValue())
+ {
+ rCoreSet.Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP,
+ sal::static_int_cast<sal_uInt16>( aTabMF.Denormalize(aTabMF.GetValue(FUNIT_TWIP)) )));
+ bRet = sal_True;
+ }
+
+ ScLkUpdMode nSet=LM_ALWAYS;
+
+ if(aRequestRB.IsChecked())
+ {
+ nSet=LM_ON_DEMAND;
+ }
+ else if(aNeverRB.IsChecked())
+ {
+ nSet=LM_NEVER;
+ }
+
+ if(aRequestRB.IsChecked() != aRequestRB.GetSavedValue() ||
+ aNeverRB.IsChecked() != aNeverRB.GetSavedValue() )
+ {
+ if(pDoc)
+ pDoc->SetLinkMode(nSet);
+ ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
+ aAppOptions.SetLinkMode(nSet );
+ SC_MOD()->SetAppOptions(aAppOptions);
+ bRet = sal_True;
+ }
+ if(aAlignCB.GetSavedValue() != aAlignCB.IsChecked())
+ {
+ rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_SELECTION, aAlignCB.IsChecked()));
+ bRet = sal_True;
+ }
+
+ if(aAlignLB.GetSavedValue() != aAlignLB.GetSelectEntryPos())
+ {
+ rCoreSet.Put(SfxUInt16Item(SID_SC_INPUT_SELECTIONPOS, aAlignLB.GetSelectEntryPos()));
+ bRet = sal_True;
+ }
+
+ if(aEditModeCB.GetSavedValue() != aEditModeCB.IsChecked())
+ {
+ rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_EDITMODE, aEditModeCB.IsChecked()));
+ bRet = sal_True;
+ }
+
+ if(aFormatCB.GetSavedValue() != aFormatCB.IsChecked())
+ {
+ rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_FMT_EXPAND, aFormatCB.IsChecked()));
+ bRet = sal_True;
+ }
+
+
+ if(aExpRefCB.GetSavedValue() != aExpRefCB.IsChecked())
+ {
+ rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_REF_EXPAND, aExpRefCB.IsChecked()));
+ bRet = sal_True;
+ }
+
+ if(aMarkHdrCB.GetSavedValue() != aMarkHdrCB.IsChecked())
+ {
+ rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_MARK_HEADER, aMarkHdrCB.IsChecked()));
+ bRet = sal_True;
+ }
+
+ if(aTextFmtCB.GetSavedValue() != aTextFmtCB.IsChecked())
+ {
+ rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_TEXTWYSIWYG, aTextFmtCB.IsChecked()));
+ bRet = sal_True;
+ }
+
+ if( aReplWarnCB.GetSavedValue() != aReplWarnCB.IsChecked() )
+ {
+ rCoreSet.Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN, aReplWarnCB.IsChecked() ) );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+void ScTpLayoutOptions::Reset( const SfxItemSet& rCoreSet )
+{
+ aUnitLB.SetNoSelection();
+ if ( rCoreSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SfxUInt16Item& rItem = (SfxUInt16Item&)rCoreSet.Get( SID_ATTR_METRIC );
+ FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue();
+
+ for ( sal_uInt16 i = 0; i < aUnitLB.GetEntryCount(); ++i )
+ {
+ if ( (FieldUnit)(long)aUnitLB.GetEntryData( i ) == eFieldUnit )
+ {
+ aUnitLB.SelectEntryPos( i );
+ break;
+ }
+ }
+ ::SetFieldUnit(aTabMF, eFieldUnit);
+ }
+ aUnitLB.SaveValue();
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem))
+ aTabMF.SetValue(aTabMF.Normalize(((SfxUInt16Item*)pItem)->GetValue()), FUNIT_TWIP);
+ aTabMF.SaveValue();
+
+ aUnitLB .SaveValue();
+ aTabMF .SaveValue();
+
+ ScLkUpdMode nSet=LM_UNKNOWN;
+
+ if(pDoc!=NULL)
+ {
+ nSet=pDoc->GetLinkMode();
+ }
+
+ if(nSet==LM_UNKNOWN)
+ {
+ ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
+ nSet=aAppOptions.GetLinkMode();
+ }
+
+ switch(nSet)
+ {
+ case LM_ALWAYS: aAlwaysRB. Check(); break;
+ case LM_NEVER: aNeverRB. Check(); break;
+ case LM_ON_DEMAND: aRequestRB. Check(); break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_SELECTION, false, &pItem))
+ aAlignCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_SELECTIONPOS, false, &pItem))
+ aAlignLB.SelectEntryPos(((const SfxUInt16Item*)pItem)->GetValue());
+
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_EDITMODE, false, &pItem))
+ aEditModeCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_FMT_EXPAND, false, &pItem))
+ aFormatCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+
+
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_REF_EXPAND, false, &pItem))
+ aExpRefCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_MARK_HEADER, false, &pItem))
+ aMarkHdrCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_TEXTWYSIWYG, false, &pItem))
+ aTextFmtCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+
+ if( SFX_ITEM_SET == rCoreSet.GetItemState( SID_SC_INPUT_REPLCELLSWARN, false, &pItem ) )
+ aReplWarnCB.Check( ( (const SfxBoolItem*)pItem)->GetValue() );
+
+ aAlignCB .SaveValue();
+ aAlignLB .SaveValue();
+ aEditModeCB .SaveValue();
+ aFormatCB .SaveValue();
+
+ aExpRefCB .SaveValue();
+ aMarkHdrCB .SaveValue();
+ aTextFmtCB .SaveValue();
+ aReplWarnCB .SaveValue();
+ AlignHdl(&aAlignCB);
+
+ aAlwaysRB.SaveValue();
+ aNeverRB.SaveValue();
+ aRequestRB.SaveValue();
+}
+
+void ScTpLayoutOptions::ActivatePage( const SfxItemSet& /* rCoreSet */ )
+{
+}
+
+int ScTpLayoutOptions::DeactivatePage( SfxItemSet* pSetP )
+{
+ if(pSetP)
+ FillItemSet(*pSetP);
+ return SfxTabPage::LEAVE_PAGE;
+}
+
+IMPL_LINK(ScTpLayoutOptions, MetricHdl, ListBox*, EMPTYARG)
+{
+ const sal_uInt16 nMPos = aUnitLB.GetSelectEntryPos();
+ if(nMPos != USHRT_MAX)
+ {
+ FieldUnit eFieldUnit = (FieldUnit)(long)aUnitLB.GetEntryData( nMPos );
+ sal_Int64 nVal =
+ aTabMF.Denormalize( aTabMF.GetValue( FUNIT_TWIP ) );
+ ::SetFieldUnit( aTabMF, eFieldUnit );
+ aTabMF.SetValue( aTabMF.Normalize( nVal ), FUNIT_TWIP );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( ScTpLayoutOptions, AlignHdl, CheckBox*, pBox )
+{
+ aAlignLB.Enable(pBox->IsChecked());
+ return 0;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */