diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2013-11-10 16:26:34 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2013-11-11 23:22:32 +0100 |
commit | 515a5024377f5c93e962c65cfd987bf5d52d135c (patch) | |
tree | 8e6cc84e2734af01546d8ebec932eae382e58449 | |
parent | f4569ff5ee721683c6ba09b75fe0ce14e3203d3a (diff) |
Add statistics dialog for calculation of moving average.
Change-Id: Iaa481a2d8aff271e8a8350b707e1f444f8d36167
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 8 | ||||
-rw-r--r-- | sc/Library_sc.mk | 1 | ||||
-rw-r--r-- | sc/UIConfig_scalc.mk | 1 | ||||
-rw-r--r-- | sc/inc/sc.hrc | 1 | ||||
-rw-r--r-- | sc/sdi/cellsh.sdi | 1 | ||||
-rw-r--r-- | sc/sdi/scalc.sdi | 24 | ||||
-rw-r--r-- | sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx | 117 | ||||
-rw-r--r-- | sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc | 1 | ||||
-rw-r--r-- | sc/source/ui/StatisticsDialogs/StatisticsDialogs.src | 9 | ||||
-rw-r--r-- | sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx | 54 | ||||
-rw-r--r-- | sc/source/ui/app/scdll.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/MovingAverageDialog.hxx | 45 | ||||
-rw-r--r-- | sc/source/ui/inc/TableFillingAndNavigationTools.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/reffact.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshc.cxx | 7 | ||||
-rw-r--r-- | sc/uiconfig/scalc/menubar/menubar.xml | 1 | ||||
-rwxr-xr-x | sc/uiconfig/scalc/ui/movingaveragedialog.ui | 342 |
19 files changed, 626 insertions, 10 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index da9b2592e3d3..9a32ed6a9ff6 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -691,6 +691,14 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:MovingAverageDialog" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Moving Average...</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:EditHeaderAndFooter" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Headers & Footers...</value> diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index f763edab8a41..f65cf26fd6fb 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -477,6 +477,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog \ sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog \ sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator \ + sc/source/ui/StatisticsDialogs/MovingAverageDialog \ sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog \ sc/source/ui/StatisticsDialogs/SamplingDialog \ sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 61442aacaf3c..2aa1ff8fe648 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -136,6 +136,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/ungroupdialog \ sc/uiconfig/scalc/ui/validationhelptabpage \ sc/uiconfig/scalc/ui/movecopysheet \ + sc/uiconfig/scalc/ui/movingaveragedialog \ )) # vim: set noet sw=4 ts=4: diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 47c73aef1221..d90108355b1d 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -262,6 +262,7 @@ #define SID_CORRELATION_DIALOG (SC_MESSAGE_START + 74) #define SID_COVARIANCE_DIALOG (SC_MESSAGE_START + 75) #define SID_EXPONENTIAL_SMOOTHING_DIALOG (SC_MESSAGE_START + 76) +#define SID_MOVING_AVERAGE_DIALOG (SC_MESSAGE_START + 77) // functions diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 46d9dff6166b..6fe3b249b911 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -154,6 +154,7 @@ interface CellSelection SID_CORRELATION_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_COVARIANCE_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_EXPONENTIAL_SMOOTHING_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] + SID_MOVING_AVERAGE_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_MARKDATAAREA [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ] SID_MARKARRAYFORMULA [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ] SID_SETINPUTMODE [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ] diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index d5260bf8027e..e89202330c4e 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -3110,6 +3110,30 @@ SfxVoidItem ExponentialSmoothingDialog SID_EXPONENTIAL_SMOOTHING_DIALOG GroupId = GID_OPTIONS; ] +SfxVoidItem MovingAverageDialog SID_MOVING_AVERAGE_DIALOG +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_OPTIONS; +] + //-------------------------------------------------------------------------- SfxVoidItem SolverDialog SID_OPENDLG_OPTSOLVER () diff --git a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx new file mode 100644 index 000000000000..d3af93e5b868 --- /dev/null +++ b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx @@ -0,0 +1,117 @@ +/* -*- 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 <sfx2/dispatch.hxx> +#include <svl/zforlist.hxx> +#include <svl/undo.hxx> + +#include "formulacell.hxx" +#include "rangelst.hxx" +#include "scitems.hxx" +#include "docsh.hxx" +#include "document.hxx" +#include "uiitems.hxx" +#include "reffact.hxx" +#include "strload.hxx" +#include "random.hxx" +#include "docfunc.hxx" +#include "StatisticsDialogs.hrc" +#include "TableFillingAndNavigationTools.hxx" + +#include "MovingAverageDialog.hxx" + +ScMovingAverageDialog::ScMovingAverageDialog( + SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, + Window* pParent, ScViewData* pViewData ) : + ScStatisticsInputOutputDialog( + pSfxBindings, pChildWindow, pParent, pViewData, + "MovingAverageDialog", "modules/scalc/ui/movingaveragedialog.ui" ) +{ + get(mpIntervalSpin, "interval-spin"); +} + +ScMovingAverageDialog::~ScMovingAverageDialog() +{} + +sal_Bool ScMovingAverageDialog::Close() +{ + return DoClose( ScMovingAverageDialogWrapper::GetChildWindowId() ); +} + +void ScMovingAverageDialog::CalculateInputAndWriteToOutput( ) +{ + OUString aUndo(SC_STRLOAD(RID_STATISTICS_DLGS, STR_MOVING_AVERAGE_UNDO_NAME)); + ScDocShell* pDocShell = mViewData->GetDocShell(); + svl::IUndoManager* pUndoManager = pDocShell->GetUndoManager(); + pUndoManager->EnterListAction( aUndo, aUndo ); + + AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument); + FormulaTemplate aTemplate(mDocument, mAddressDetails); + + boost::scoped_ptr<DataRangeIterator> pIterator; + if (mGroupedBy == BY_COLUMN) + pIterator.reset(new DataRangeByColumnIterator(mInputRange)); + else + pIterator.reset(new DataRangeByRowIterator(mInputRange)); + + sal_Int32 aIntervalSize = mpIntervalSpin->GetValue(); + bool aCentral = true; + + for( ; pIterator->hasNext(); pIterator->next() ) + { + output.resetRow(); + + // Write column label + aTemplate.setTemplate("Column %NUMBER%"); + aTemplate.applyNumber("%NUMBER%", pIterator->index() + 1); + output.writeString(aTemplate.getTemplate()); + output.nextRow(); + + DataCellIterator aDataCellIterator = pIterator->iterateCells(); + + for (; aDataCellIterator.hasNext(); aDataCellIterator.next()) + { + ScAddress aIntervalStart; + ScAddress aIntervalEnd; + + if (aCentral) + { + sal_Int32 aHalf = aIntervalSize / 2; + sal_Int32 aHalfRemainder = aIntervalSize % 2; + aIntervalStart = aDataCellIterator.getRelative(-aHalf); + aIntervalEnd = aDataCellIterator.getRelative(aHalf - 1 + aHalfRemainder); + } + else + { + aIntervalStart = aDataCellIterator.getRelative(-aIntervalSize); + aIntervalEnd = aDataCellIterator.getRelative(0); + } + + if(aIntervalStart.IsValid() && aIntervalEnd.IsValid()) + { + aTemplate.setTemplate("=AVERAGE(%RANGE%)"); + aTemplate.applyRange("%RANGE%", ScRange(aIntervalStart, aIntervalEnd)); + output.writeFormula(aTemplate.getTemplate()); + } + else + { + output.writeString("N/A"); + } + output.nextRow(); + } + output.nextColumn(); + } + + pUndoManager->LeaveListAction(); + ScRange aOutputRange(output.mMinimumAddress, output.mMaximumAddress); + pDocShell->PostPaint( aOutputRange, PAINT_GRID ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc index 64cbfe561bda..8749ab2587c2 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc +++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc @@ -52,5 +52,6 @@ #define STR_CORRELATION_UNDO_NAME 36 #define STR_COVARIANCE_UNDO_NAME 37 #define STR_EXPONENTIAL_SMOOTHING_UNDO_NAME 38 +#define STR_MOVING_AVERAGE_UNDO_NAME 39 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src index cf39edec8db8..493970f88306 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src +++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src @@ -13,7 +13,14 @@ Resource RID_STATISTICS_DLGS { - /* AnalysisOfVarianceDialog */ + /* MovingAverageDialog */ + + String STR_MOVING_AVERAGE_UNDO_NAME + { + Text [ en-US ] = "Moving Average"; + }; + + /* ExponentialSmoothingDialog */ String STR_EXPONENTIAL_SMOOTHING_UNDO_NAME { diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx index bf5080b1d354..a98257d7900a 100644 --- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx +++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx @@ -8,6 +8,14 @@ * */ +#include <boost/scoped_ptr.hpp> + +#include <editeng/editobj.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/eeitem.hxx> + +#include "editutil.hxx" + #include "TableFillingAndNavigationTools.hxx" FormulaTemplate::FormulaTemplate(ScDocument* aDocument, ScAddress::Details aAddressDetails) : @@ -54,6 +62,11 @@ void FormulaTemplate::applyString(OUString aVariable, OUString aValue) mTemplate = mTemplate.replaceAll(aVariable, aValue); } +void FormulaTemplate::applyNumber(OUString aVariable, sal_Int32 aValue) +{ + mTemplate = mTemplate.replaceAll(aVariable, OUString::number(aValue)); +} + AddressWalker::AddressWalker(ScAddress aInitialAddress, bool aTrackRange) : mCurrentAddress(aInitialAddress), mMinimumAddress(aInitialAddress), @@ -137,7 +150,19 @@ void AddressWalkerWriter::writeString(OUString aString) void AddressWalkerWriter::writeString(const char* aCharArray) { - mpDocShell->GetDocFunc().SetStringCell(mCurrentAddress, OUString::createFromAscii(aCharArray), true); + writeString(OUString::createFromAscii(aCharArray)); +} + +void AddressWalkerWriter::writeBoldString(OUString aString) +{ + ScFieldEditEngine& rEngine = mpDocument->GetEditEngine(); + rEngine.SetText(aString); + SfxItemSet aItemSet = rEngine.GetEmptyItemSet(); + SvxWeightItem aWeight(WEIGHT_BOLD, EE_CHAR_WEIGHT); + aItemSet.Put(aWeight); + rEngine.QuickSetAttribs(aItemSet, ESelection(0, 0, 0, aString.getLength()) ); + boost::scoped_ptr<EditTextObject> pEditText(rEngine.CreateTextObject()); + mpDocShell->GetDocFunc().SetEditCell(mCurrentAddress, *pEditText, true); } void AddressWalkerWriter::writeValue(double aValue) @@ -178,18 +203,33 @@ void DataCellIterator::next() ScAddress DataCellIterator::get() { - if(mByColumn) - return ScAddress(mCol, mInputRange.aStart.Row(), mInputRange.aStart.Tab()); - else - return ScAddress(mInputRange.aStart.Col(), mRow, mInputRange.aStart.Tab()); + return getRelative(0); } ScAddress DataCellIterator::getRelative(int aDelta) { if(mByColumn) - return ScAddress(mCol + aDelta, mInputRange.aStart.Row(), mInputRange.aStart.Tab()); + { + SCCOL aNewColumn = mCol + aDelta; + if(aNewColumn < mInputRange.aStart.Col() || aNewColumn > mInputRange.aEnd.Col()) + { + ScAddress aResult; + aResult.SetInvalid(); + return aResult; + } + return ScAddress(aNewColumn, mInputRange.aStart.Row(), mInputRange.aStart.Tab()); + } else - return ScAddress(mInputRange.aStart.Col(), mRow + aDelta, mInputRange.aStart.Tab()); + { + SCROW aNewRow = mRow + aDelta; + if(aNewRow < mInputRange.aStart.Row() || aNewRow > mInputRange.aEnd.Row()) + { + ScAddress aResult; + aResult.SetInvalid(); + return aResult; + } + return ScAddress(mInputRange.aStart.Col(), aNewRow, mInputRange.aStart.Tab()); + } } // DataRangeIterator diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index c21fc3b7c99b..84f5823ca461 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -250,8 +250,7 @@ void ScDLL::Init() // Hack: Eingabezeile mit 42 registrieren, damit sie im PlugIn immer sichtbar ist ScInputWindowWrapper ::RegisterChildWindow(42, pMod, SFX_CHILDWIN_TASK|SFX_CHILDWIN_FORCEDOCK); - ScNavigatorDialogWrapper ::RegisterChildWindowContext( - sal::static_int_cast<sal_uInt16>(ScTabViewShell::GetInterfaceId()), pMod); + ScNavigatorDialogWrapper ::RegisterChildWindowContext(static_cast<sal_uInt16>(ScTabViewShell::GetInterfaceId()), pMod); ScSolverDlgWrapper ::RegisterChildWindow(false, pMod); ScOptSolverDlgWrapper ::RegisterChildWindow(false, pMod); ScXMLSourceDlgWrapper ::RegisterChildWindow(false, pMod); @@ -274,6 +273,7 @@ void ScDLL::Init() ScCorrelationDialogWrapper ::RegisterChildWindow(false, pMod); ScCovarianceDialogWrapper ::RegisterChildWindow(false, pMod); ScExponentialSmoothingDialogWrapper ::RegisterChildWindow(false, pMod); + ScMovingAverageDialogWrapper ::RegisterChildWindow(false, pMod); // First docking Window for Calc ScFunctionChildWindow ::RegisterChildWindow(false, pMod); diff --git a/sc/source/ui/inc/MovingAverageDialog.hxx b/sc/source/ui/inc/MovingAverageDialog.hxx new file mode 100644 index 000000000000..ee5b2bfa63d3 --- /dev/null +++ b/sc/source/ui/inc/MovingAverageDialog.hxx @@ -0,0 +1,45 @@ +/* -*- 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/. + * + */ + +#ifndef MOVING_AVERAGE_DIALOG_HXX +#define MOVING_AVERAGE_DIALOG_HXX + +#include "global.hxx" +#include "address.hxx" +#include "anyrefdg.hxx" + +#include <vcl/fixed.hxx> +#include <vcl/group.hxx> +#include <vcl/lstbox.hxx> + +#include "StatisticsInputOutputDialog.hxx" + +class ScMovingAverageDialog : public ScStatisticsInputOutputDialog +{ +private: + NumericField* mpIntervalSpin; + +public: + ScMovingAverageDialog( + SfxBindings* pB, SfxChildWindow* pCW, + Window* pParent, ScViewData* pViewData ); + + virtual ~ScMovingAverageDialog(); + + virtual sal_Bool Close(); + +protected: + virtual void CalculateInputAndWriteToOutput(); +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx index 6354df956d4d..f3d2f9b06597 100644 --- a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx +++ b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx @@ -37,6 +37,7 @@ public: void applyRangeList(OUString aVariable, ScRangeList aRangeList); void applyAddress(OUString aVariable, ScAddress aAddress); void applyString(OUString aVariable, OUString aValue); + void applyNumber(OUString aVariable, sal_Int32 aValue); }; class AddressWalker @@ -72,6 +73,7 @@ public: void writeFormula(OUString aFormula); void writeString(OUString aString); void writeString(const char* aCharArray); + void writeBoldString(OUString aString); void writeValue(double aValue); }; diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index 5785192cb53a..da3668c201fb 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -102,6 +102,14 @@ private: ScExponentialSmoothingDialogWrapper() SAL_DELETED_FUNCTION; }; +class ScMovingAverageDialogWrapper : + public ChildWindowWrapper<SID_MOVING_AVERAGE_DIALOG> +{ +private: + ScMovingAverageDialogWrapper() SAL_DELETED_FUNCTION; +}; + + class ScAcceptChgDlgWrapper: public SfxChildWindow { public: diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f2d3eb12bbf3..5b3c6b9f5dd8 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -965,6 +965,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pScMod->SetRefDialog( nId, pWnd ? false : sal_True ); } break; + case SID_MOVING_AVERAGE_DIALOG: + { + sal_uInt16 nId = ScMovingAverageDialogWrapper::GetChildWindowId(); + SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); + SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); + + pScMod->SetRefDialog( nId, pWnd ? false : sal_True ); + } + break; // // disposal (Outlines) diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index 63925b1fe589..0298764b8088 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -88,6 +88,7 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION(ScCorrelationDialogWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScCovarianceDialogWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScExponentialSmoothingDialogWrapper::GetChildWindowId()); + SFX_CHILDWINDOW_REGISTRATION(ScMovingAverageDialogWrapper::GetChildWindowId()); } diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 24aab3d5e6bb..a91377c141a1 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -68,6 +68,7 @@ #include "CorrelationDialog.hxx" #include "CovarianceDialog.hxx" #include "ExponentialSmoothingDialog.hxx" +#include "MovingAverageDialog.hxx" #include <config_orcus.h> @@ -363,6 +364,12 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( } break; + case SID_MOVING_AVERAGE_DIALOG: + { + pResult = new ScMovingAverageDialog( pB, pCW, pParent, GetViewData() ); + } + break; + case SID_OPENDLG_OPTSOLVER: { ScViewData* pViewData = GetViewData(); diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index acd835a4361a..04b059d618f8 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -489,6 +489,7 @@ <menu:menuitem menu:id=".uno:CorrelationDialog"/> <menu:menuitem menu:id=".uno:CovarianceDialog"/> <menu:menuitem menu:id=".uno:ExponentialSmoothingDialog"/> + <menu:menuitem menu:id=".uno:MovingAverageDialog"/> </menu:menupopup> </menu:menu> </menu:menupopup> diff --git a/sc/uiconfig/scalc/ui/movingaveragedialog.ui b/sc/uiconfig/scalc/ui/movingaveragedialog.ui new file mode 100755 index 000000000000..9e1f667efc82 --- /dev/null +++ b/sc/uiconfig/scalc/ui/movingaveragedialog.ui @@ -0,0 +1,342 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.16.0 on Sun Nov 10 13:10:53 2013 --> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkAdjustment" id="interval-adjustment"> + <property name="lower">2</property> + <property name="upper">10000</property> + <property name="value">2</property> + <property name="step_increment">1</property> + <property name="page_increment">1</property> + </object> + <object class="GtkDialog" id="MovingAverageDialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Moving Average</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="apply"> + <property name="label">gtk-apply</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="close"> + <property name="label">gtk-close</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="input-range-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Input Range</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">input-range-edit</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="input-range-edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <property name="width_chars">30</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefButton" id="input-range-button"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="output-range-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Output Range</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">output-range-edit</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="output-range-edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <property name="width_chars">30</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefButton" id="output-range-button"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="bottom_padding">6</property> + <property name="left_padding">12</property> + <property name="right_padding">12</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkRadioButton" id="groupedby-columns-radio"> + <property name="label" translatable="yes">Columns</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="groupedby-rows-radio"> + <property name="label" translatable="yes">Rows</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <property name="group">groupedby-columns-radio</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Grouped by</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">3</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="bottom_padding">6</property> + <property name="left_padding">12</property> + <property name="right_padding">12</property> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="interval-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Interval</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="interval-spin"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">•</property> + <property name="adjustment">interval-adjustment</property> + <property name="value">2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Parameters</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">3</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">apply</action-widget> + <action-widget response="0">ok</action-widget> + <action-widget response="0">close</action-widget> + </action-widgets> + </object> +</interface> |