summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx25
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx11
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx58
-rw-r--r--sc/source/ui/condformat/condformathelper.cxx120
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx206
-rw-r--r--sc/source/ui/inc/condformatdlg.hxx10
-rw-r--r--sc/source/ui/inc/condformathelper.hxx30
-rw-r--r--sc/source/ui/inc/condformatmgr.hrc18
-rw-r--r--sc/source/ui/inc/condformatmgr.hxx108
-rw-r--r--sc/source/ui/src/condformatmgr.src66
-rw-r--r--sc/source/ui/src/globstr.src4
-rw-r--r--sc/source/ui/view/cellsh1.cxx29
12 files changed, 618 insertions, 67 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 01c3b0839bf5..4dd5292133dd 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -81,6 +81,7 @@
#include "tpdefaults.hxx"
#include "colorformat.hxx"
#include "condformatdlg.hxx"
+#include "condformatmgr.hxx"
// ause
#include "editutil.hxx"
@@ -90,6 +91,7 @@ IMPL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScAutoFormatDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScColRowLabelDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScCondFormatDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScDataBarSettingsDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScDataPilotSourceTypeDlg_Impl);
@@ -460,7 +462,10 @@ ScConditionalFormat* AbstractScCondFormatDlg_Impl::GetConditionalFormat()
return pDlg->GetConditionalFormat();
}
-
+ScConditionalFormatList* AbstractScCondFormatManagerDlg_Impl::GetConditionalFormatList()
+{
+ return pDlg->GetConditionalFormatList();
+}
long AbstractScMetricInputDlg_Impl::GetInputValue( FieldUnit eUnit ) const
@@ -794,6 +799,24 @@ AbstractScCondFormatDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatDlg(Win
return NULL;
}
+AbstractScCondFormatManagerDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList,
+ const ScRangeList& rList, const ScAddress& rPos, int nId )
+{
+ ScCondFormatManagerDlg* pDlg = NULL;
+ switch( nId )
+ {
+ case RID_SCDLG_COND_FORMAT_MANAGER:
+ pDlg = new ScCondFormatManagerDlg( pParent, pDoc, pFormatList, rList, rPos );
+ break;
+ default:
+ break;
+ }
+ if(pDlg)
+ return new AbstractScCondFormatManagerDlg_Impl( pDlg );
+
+ return NULL;
+}
+
AbstractScDataBarSettingsDlg* ScAbstractDialogFactory_Impl::CreateScDataBarSetttingsDlg(Window* pParent, ScDocument* pDoc, int nId)
{
ScDataBarSettingsDlg* pDlg = NULL;
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 4728f1c079da..fcf000d7fa39 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -66,6 +66,7 @@ class SfxTabDialog;
class ScTextImportOptionsDlg;
class ScDataBarSettingsDlg;
class ScCondFormatDlg;
+class ScCondFormatManagerDlg;
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
DialogClass* pDlg; \
@@ -144,6 +145,13 @@ class AbstractScCondFormatDlg_Impl : public AbstractScCondFormatDlg
virtual ScConditionalFormat* GetConditionalFormat();
};
+class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDlg
+{
+ DECL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl, ScCondFormatManagerDlg)
+
+ virtual ScConditionalFormatList* GetConditionalFormatList();
+};
+
class AbstractScDataBarSettingsDlg_Impl : public AbstractScDataBarSettingsDlg
{
DECL_ABSTDLG_BASE(AbstractScDataBarSettingsDlg_Impl, ScDataBarSettingsDlg)
@@ -430,6 +438,9 @@ public:
virtual AbstractScCondFormatDlg* CreateScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat,
const ScRangeList& rRange, const ScAddress& rPos, int nId ); //add for ScDataBarSettingsDlg
+ virtual AbstractScCondFormatManagerDlg* CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList,
+ const ScRangeList& rList, const ScAddress& rPos, int nId );
+
virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent, ScDocument* pDoc, int nId ); //add for ScDataBarSettingsDlg
virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ); //add for ScDataPilotDatabaseDlg
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 6c4865be1e7d..9e8ca45419cf 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -387,57 +387,6 @@ void ScCondFrmtEntry::Init()
mpDataBarData->maPositiveColor = COL_LIGHTBLUE;
}
-namespace {
-
-rtl::OUString getTextForType(ScCondFormatEntryType eType)
-{
- switch(eType)
- {
- case CONDITION:
- return rtl::OUString("Cell value");
- case COLORSCALE:
- return rtl::OUString("Color scale");
- case DATABAR:
- return rtl::OUString("Data Bar");
- case FORMULA:
- return rtl::OUString("Formula is");
- default:
- break;
- }
-
- return rtl::OUString("");
-}
-
-rtl::OUString getExpression(sal_Int32 nIndex)
-{
- switch(nIndex)
- {
- case 0:
- return rtl::OUString("=");
- case 1:
- return rtl::OUString("<");
- case 2:
- return rtl::OUString(">");
- case 3:
- return rtl::OUString("<=");
- case 4:
- return rtl::OUString(">=");
- case 5:
- return rtl::OUString("!=");
- case 6:
- return rtl::OUString("between");
- case 7:
- return rtl::OUString("not between");
- case 8:
- return rtl::OUString("duplicate");
- case 9:
- return rtl::OUString("unique");
- }
- return rtl::OUString();
-}
-
-}
-
long ScCondFrmtEntry::Notify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
@@ -454,11 +403,8 @@ void ScCondFrmtEntry::SwitchToType( ScCondFormatEntryType eType )
case COLLAPSED:
{
maLbType.Hide();
- rtl::OUStringBuffer maCondText(getTextForType(meType));
- maCondText.append(rtl::OUString(" "));
- if(meType == CONDITION)
- maCondText.append(getExpression(maLbCondType.GetSelectEntryPos()));
- maFtCondition.SetText(maCondText.makeStringAndClear());
+ rtl::OUString maCondText = ScCondFormatHelper::GetExpression(meType, maLbCondType.GetSelectEntryPos());
+ maFtCondition.SetText(maCondText);
maFtCondition.Show();
maLbType.Hide();
HideCondElements();
diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx
new file mode 100644
index 000000000000..0ef03e83c1af
--- /dev/null
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <rtl/ustrbuf.hxx>
+#include "condformathelper.hxx"
+
+namespace {
+
+rtl::OUString getTextForType(ScCondFormatEntryType eType)
+{
+ switch(eType)
+ {
+ case CONDITION:
+ return rtl::OUString("Cell value");
+ case COLORSCALE:
+ return rtl::OUString("Color scale");
+ case DATABAR:
+ return rtl::OUString("Data Bar");
+ case FORMULA:
+ return rtl::OUString("Formula is");
+ default:
+ break;
+ }
+
+ return rtl::OUString("");
+}
+
+rtl::OUString getExpression(sal_Int32 nIndex)
+{
+ switch(nIndex)
+ {
+ case 0:
+ return rtl::OUString("=");
+ case 1:
+ return rtl::OUString("<");
+ case 2:
+ return rtl::OUString(">");
+ case 3:
+ return rtl::OUString("<=");
+ case 4:
+ return rtl::OUString(">=");
+ case 5:
+ return rtl::OUString("!=");
+ case 6:
+ return rtl::OUString("between");
+ case 7:
+ return rtl::OUString("not between");
+ case 8:
+ return rtl::OUString("duplicate");
+ case 9:
+ return rtl::OUString("unique");
+ }
+ return rtl::OUString();
+}
+
+}
+
+rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos)
+{
+ rtl::OUStringBuffer aBuffer;
+ if(!rFormat.IsEmpty())
+ {
+ switch(rFormat.GetEntry(0)->GetType())
+ {
+ case condformat::CONDITION:
+ {
+ const ScConditionEntry* pEntry = static_cast<const ScConditionEntry*>(rFormat.GetEntry(0));
+ ScConditionMode eMode = pEntry->GetOperation();
+ if(eMode == SC_COND_DIRECT)
+ {
+ aBuffer.append(getTextForType(FORMULA));
+ }
+ else
+ {
+ aBuffer.append(getTextForType(CONDITION));
+ aBuffer.append(rtl::OUString(" "));
+ aBuffer.append(getExpression(static_cast<sal_Int32>(eMode)));
+ aBuffer.append(rtl::OUString(" "));
+ if(eMode == SC_COND_BETWEEN || eMode == SC_COND_NOTBETWEEN)
+ {
+ aBuffer.append(pEntry->GetExpression(rPos, 0));
+ aBuffer.append(rtl::OUString(" and "));
+ aBuffer.append(pEntry->GetExpression(rPos, 1));
+ }
+ else
+ {
+ aBuffer.append(pEntry->GetExpression(rPos, 0));
+ }
+ }
+ }
+
+ break;
+ case condformat::DATABAR:
+ aBuffer.append(getTextForType(DATABAR));
+ break;
+ case condformat::COLORSCALE:
+ aBuffer.append(getTextForType(COLORSCALE));
+ break;
+ }
+ }
+ return aBuffer.makeStringAndClear();
+}
+
+rtl::OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex )
+{
+ rtl::OUStringBuffer aBuffer(getTextForType(eType));
+ aBuffer.append(rtl::OUString(" "));
+ if(eType == CONDITION)
+ aBuffer.append(getExpression(nIndex));
+
+ return aBuffer.makeStringAndClear();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
new file mode 100644
index 000000000000..c8f3ad6c7d13
--- /dev/null
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "condformatmgr.hxx"
+#include "condformatmgr.hrc"
+#include "scresid.hxx"
+#include "globstr.hrc"
+#include "condformatdlg.hxx"
+#include "vcl/msgbox.hxx"
+
+#define ITEMID_RANGE 1
+#define ITEMID_CONDITION 2
+
+
+ScCondFormatManagerWindow::ScCondFormatManagerWindow(Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos):
+ SvTabListBox(pParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP),
+ maHeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER ),
+ mpDoc(pDoc),
+ mpFormatList(pFormatList),
+ mrPos(rPos)
+{
+ Size aBoxSize( pParent->GetOutputSizePixel() );
+
+ maHeaderBar.SetPosSizePixel( Point(0, 0), Size( aBoxSize.Width(), 16 ) );
+
+ String aConditionStr(ScGlobal::GetRscString(STR_HEADER_COND));
+ String aRangeStr(ScGlobal::GetRscString(STR_HEADER_RANGE));
+
+ long nTabSize = aBoxSize.Width()/2;
+ maHeaderBar.InsertItem( ITEMID_RANGE, aRangeStr, nTabSize, HIB_LEFT| HIB_VCENTER );
+ maHeaderBar.InsertItem( ITEMID_CONDITION, aConditionStr, nTabSize, HIB_LEFT| HIB_VCENTER );
+
+ static long nTabs[] = {2, 0, nTabSize };
+ Size aHeadSize( maHeaderBar.GetSizePixel() );
+
+ //pParent->SetFocusControl( this );
+ SetPosSizePixel( Point( 0, aHeadSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
+ SetTabs( &nTabs[0], MAP_PIXEL );
+
+ //maHeaderBar.SetEndDragHdl( LINK( this, ScRangeManagerTable, HeaderEndDragHdl ) );
+
+ Init();
+ Show();
+ maHeaderBar.Show();
+ SetSelectionMode(MULTIPLE_SELECTION);
+}
+
+String ScCondFormatManagerWindow::createEntryString(const ScConditionalFormat& rFormat)
+{
+ ScRangeList aRange = rFormat.GetRange();
+ String aStr;
+ aRange.Format(aStr, SCA_VALID, mpDoc, mpDoc->GetAddressConvention());
+ aStr += '\t';
+ aStr += ScCondFormatHelper::GetExpression(rFormat, mrPos);
+ return aStr;
+}
+
+void ScCondFormatManagerWindow::Init()
+{
+ SetUpdateMode(false);
+
+ for(ScConditionalFormatList::iterator itr = mpFormatList->begin(); itr != mpFormatList->end(); ++itr)
+ {
+ SvLBoxEntry* pEntry = InsertEntryToColumn( createEntryString(*itr), LIST_APPEND, 0xffff );
+ maMapLBoxEntryToCondIndex.insert(std::pair<SvLBoxEntry*,sal_Int32>(pEntry,itr->GetKey()));
+ }
+ SetUpdateMode(true);
+}
+
+void ScCondFormatManagerWindow::DeleteSelection()
+{
+ if(GetSelectionCount())
+ {
+ for(SvLBoxEntry* pEntry = FirstSelected(); pEntry != NULL; pEntry = NextSelected(pEntry))
+ {
+ sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second;
+ mpFormatList->erase(nIndex);
+ }
+ RemoveSelection();
+ }
+}
+
+ScConditionalFormat* ScCondFormatManagerWindow::GetSelection()
+{
+ SvLBoxEntry* pEntry = FirstSelected();
+ if(!pEntry)
+ return NULL;
+
+ sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second;
+ return mpFormatList->GetFormat(nIndex);
+}
+
+void ScCondFormatManagerWindow::Update()
+{
+ Clear();
+ maMapLBoxEntryToCondIndex.clear();
+ Init();
+}
+
+ScCondFormatManagerCtrl::ScCondFormatManagerCtrl(Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos):
+ Control(pParent, ScResId(CTRL_TABLE)),
+ maWdManager(this, pDoc, pFormatList, rPos)
+{
+}
+
+ScConditionalFormat* ScCondFormatManagerCtrl::GetSelection()
+{
+ return maWdManager.GetSelection();
+}
+
+void ScCondFormatManagerCtrl::DeleteSelection()
+{
+ maWdManager.DeleteSelection();
+}
+
+void ScCondFormatManagerCtrl::Update()
+{
+ maWdManager.Update();
+}
+
+ScCondFormatManagerDlg::ScCondFormatManagerDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScRangeList& rList, const ScAddress& rPos):
+ ModalDialog(pParent, ScResId(RID_SCDLG_COND_FORMAT_MANAGER)),
+ maBtnAdd(this, ScResId(BTN_ADD)),
+ maBtnRemove(this, ScResId(BTN_REMOVE)),
+ maBtnEdit(this, ScResId(BTN_EDIT)),
+ maBtnOk(this, ScResId(BTN_OK)),
+ maBtnCancel(this, ScResId(BTN_CANCEL)),
+ maFlLine(this, ScResId(FL_LINE)),
+ mpFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : NULL),
+ maCtrlManager(this, pDoc, mpFormatList, rPos),
+ mpDoc(pDoc),
+ mrRangeList(rList),
+ maPos(rPos)
+{
+ FreeResource();
+
+ maBtnRemove.SetClickHdl(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
+ maBtnEdit.SetClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
+ maBtnAdd.Hide();
+}
+
+ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
+{
+ delete mpFormatList;
+}
+
+ScConditionalFormatList* ScCondFormatManagerDlg::GetConditionalFormatList()
+{
+ ScConditionalFormatList* pList = mpFormatList;
+ mpFormatList = NULL;
+ return pList;
+}
+
+IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl)
+{
+ maCtrlManager.DeleteSelection();
+ return 0;
+}
+
+IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
+{
+ ScConditionalFormat* pFormat = maCtrlManager.GetSelection();
+
+ if(!pFormat)
+ return 0;
+
+ ScCondFormatDlg* pDlg = new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(), maPos);
+ if(pDlg->Execute() == RET_OK)
+ {
+ sal_Int32 nKey = pFormat->GetKey();
+ mpFormatList->erase(nKey);
+ ScConditionalFormat* pNewFormat = pDlg->GetConditionalFormat();
+ pNewFormat->SetKey(nKey);
+ mpFormatList->InsertNew(pNewFormat);
+ maCtrlManager.Update();
+ }
+
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index d7b10e19a22b..8015b263805e 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -36,6 +36,7 @@
#include <svtools/ctrlbox.hxx>
#include "rangelst.hxx"
+#include "condformathelper.hxx"
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/scoped_ptr.hpp>
@@ -46,15 +47,6 @@ class ScFormatEntry;
class ScConditionalFormat;
struct ScDataBarFormatData;
-enum ScCondFormatEntryType
-{
- CONDITION,
- COLORSCALE,
- DATABAR,
- FORMULA,
- COLLAPSED
-};
-
class ScCondFrmtEntry : public Control
{
private:
diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx
new file mode 100644
index 000000000000..99f5b59cdfb1
--- /dev/null
+++ b/sc/source/ui/inc/condformathelper.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <rtl/ustring.hxx>
+#include "conditio.hxx"
+
+enum ScCondFormatEntryType
+{
+ CONDITION,
+ COLORSCALE,
+ DATABAR,
+ FORMULA,
+ COLLAPSED
+};
+
+class ScCondFormatHelper
+{
+public:
+ static rtl::OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos);
+
+ static rtl::OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatmgr.hrc b/sc/source/ui/inc/condformatmgr.hrc
new file mode 100644
index 000000000000..7fb10c7f0e9d
--- /dev/null
+++ b/sc/source/ui/inc/condformatmgr.hrc
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_ADD 3
+#define BTN_REMOVE 4
+#define BTN_EDIT 5
+#define FL_LINE 6
+#define CTRL_TABLE 8
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx
new file mode 100644
index 000000000000..bf7cfb313483
--- /dev/null
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "sc.hrc"
+
+#include <vcl/dialog.hxx>
+#include <svtools/svtabbx.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/headbar.hxx>
+
+#include "conditio.hxx"
+#include "rangelst.hxx"
+#include "document.hxx"
+
+#include <map>
+
+class ScDocument;
+
+class ScCondFormatManagerWindow : public SvTabListBox
+{
+private:
+ void Init();
+ String createEntryString(const ScConditionalFormat& rFormat);
+
+ HeaderBar maHeaderBar;
+ ScDocument* mpDoc;
+ ScConditionalFormatList* mpFormatList;
+ const ScAddress& mrPos;
+ std::map<SvLBoxEntry*, sal_Int32> maMapLBoxEntryToCondIndex;
+
+public:
+ ScCondFormatManagerWindow( Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos );
+
+ void DeleteSelection();
+ ScConditionalFormat* GetSelection();
+ void Update();
+};
+
+class ScCondFormatManagerCtrl : Control
+{
+public:
+ ScCondFormatManagerCtrl(Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos);
+
+ ScConditionalFormat* GetSelection();
+ void DeleteSelection();
+ void Update();
+
+private:
+ ScCondFormatManagerWindow maWdManager;
+};
+
+class ScCondFormatManagerDlg : public ModalDialog
+{
+public:
+ ScCondFormatManagerDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScRangeList& rList, const ScAddress& rPos);
+ ~ScCondFormatManagerDlg();
+
+ ScConditionalFormatList* GetConditionalFormatList();
+
+private:
+ PushButton maBtnAdd;
+ PushButton maBtnRemove;
+ PushButton maBtnEdit;
+
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+
+ FixedLine maFlLine;
+
+ ScConditionalFormatList* mpFormatList;
+
+ ScCondFormatManagerCtrl maCtrlManager;
+
+ ScDocument* mpDoc;
+ const ScRangeList& mrRangeList;
+ ScAddress maPos;
+
+ DECL_LINK(RemoveBtnHdl, void*);
+ DECL_LINK(EditBtnHdl, void*);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/condformatmgr.src b/sc/source/ui/src/condformatmgr.src
new file mode 100644
index 000000000000..9009d213e4ba
--- /dev/null
+++ b/sc/source/ui/src/condformatmgr.src
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "sc.hrc"
+#include "condformatmgr.hrc"
+
+ModalDialog RID_SCDLG_COND_FORMAT_MANAGER
+{
+ OutputSize = TRUE;
+ Hide = TRUE;
+ Size = MAP_APPFONT ( 300, 275 );
+ Text [ en-US ] = "Manage Conditional Formatting";
+ Moveable = TRUE;
+ Closeable = TRUE;
+ OkButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 190, 255 );
+ Size = MAP_APPFONT ( 50, 14 );
+ TabStop = TRUE;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 245, 255 );
+ Size = MAP_APPFONT ( 50, 14 );
+ TabStop = TRUE;
+ };
+ PushButton BTN_ADD
+ {
+ Pos = MAP_APPFONT( 5, 230 );
+ Size = MAP_APPFONT( 40, 14 );
+ Text [ en-US ] = "Add";
+ TabStop = TRUE;
+ };
+ PushButton BTN_REMOVE
+ {
+ Pos = MAP_APPFONT( 95, 230 );
+ Size = MAP_APPFONT( 40, 14 );
+ Text [ en-US ] = "Remove";
+ TabStop = TRUE;
+ };
+ Control CTRL_TABLE
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 290, 220 );
+ Border = TRUE;
+ };
+ PushButton BTN_EDIT
+ {
+ Pos = MAP_APPFONT( 50, 230 );
+ Size = MAP_APPFONT( 40, 14 );
+ Text [ en-US ] = "Edit...";
+ };
+ FixedLine FL_LINE
+ {
+ Pos = MAP_APPFONT( 0, 250 );
+ Size = MAP_APPFONT( 300, 2 );
+ };
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index dcc4adb67c8b..4b2a4ecae4f3 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -1859,5 +1859,9 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "This Document is referenced by another document and not yet saved. Closing it without saving will result in data loss.";
};
+ String STR_HEADER_COND
+ {
+ Text [ en_US ] = "First Condition";
+ };
};
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 7ce2a6a55ed0..ee6d5bd9a4a0 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2061,7 +2061,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
pDlg = pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aPos, RID_SCDLG_CONDFORMAT );
}
- OSL_ENSURE(pDlg, "Dialog create fail!");
+
if(pDlg->Execute() == RET_OK)
{
ScConditionalFormat* pFormat = pDlg->GetConditionalFormat();
@@ -2074,6 +2074,33 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
break;
+ case SID_OPENDLG_CONDFRMT_MANAGER:
+ {
+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+ OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
+
+ ScRangeList aRangeList;
+ ScViewData* pData = GetViewData();
+ pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false);
+ ScDocument* pDoc = pData->GetDocument();
+
+ ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo());
+ if(aRangeList.empty())
+ {
+ ScRange* pRange = new ScRange(aPos);
+ aRangeList.push_back(pRange);
+ }
+
+ ScConditionalFormatList* pList = pDoc->GetCondFormList( aPos.Tab() );
+ AbstractScCondFormatManagerDlg* pDlg = pFact->CreateScCondFormatMgrDlg( pTabViewShell->GetDialogParent(), pDoc, pList, aRangeList, aPos, RID_SCDLG_COND_FORMAT_MANAGER);
+ if(pDlg->Execute() == RET_OK)
+ {
+ pDoc->SetCondFormList(pDlg->GetConditionalFormatList(), aPos.Tab());
+ }
+ delete pDlg;
+ }
+ break;
+
case SID_COLORSCALE:
{
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();