[Libreoffice-commits] core.git: 15 commits - include/oox officecfg/registry oox/source sc/inc sc/Library_sc.mk sc/sdi sc/source sc/uiconfig vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Thu Apr 24 13:52:46 PDT 2014
include/oox/helper/graphichelper.hxx | 4
officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 8
oox/source/drawingml/shape.cxx | 10
oox/source/helper/graphichelper.cxx | 4
oox/source/vml/vmlshape.cxx | 10
sc/Library_sc.mk | 1
sc/inc/filter.hxx | 2
sc/inc/sc.hrc | 1
sc/sdi/cellsh.sdi | 1
sc/sdi/scalc.sdi | 23 +
sc/source/filter/html/htmlexp.cxx | 20 -
sc/source/filter/inc/ftools.hxx | 2
sc/source/filter/inc/htmlexp.hxx | 167 +++++---
sc/source/ui/StatisticsDialogs/FTestDialog.cxx | 189 ++++++++++
sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc | 56 ++
sc/source/ui/StatisticsDialogs/StatisticsDialogs.src | 82 ++++
sc/source/ui/StatisticsDialogs/TTestDialog.cxx | 141 +++----
sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx | 6
sc/source/ui/app/scdll.cxx | 1
sc/source/ui/docshell/docsh.cxx | 27 -
sc/source/ui/docshell/impex.cxx | 9
sc/source/ui/inc/FTestDialog.hxx | 35 +
sc/source/ui/inc/TableFillingAndNavigationTools.hxx | 14
sc/source/ui/inc/impex.hxx | 2
sc/source/ui/inc/reffact.hxx | 7
sc/source/ui/view/cellsh1.cxx | 10
sc/source/ui/view/tabvwsh.cxx | 2
sc/source/ui/view/tabvwshc.cxx | 7
sc/uiconfig/scalc/menubar/menubar.xml | 1
vcl/source/filter/wmf/winmtf.cxx | 75 ++-
vcl/source/filter/wmf/winwmf.cxx | 74 ++-
vcl/source/outdev/polyline.cxx | 2
32 files changed, 751 insertions(+), 242 deletions(-)
New commits:
commit a85317c67f870917231e82eb29fd5023e55b87de
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Apr 24 18:46:48 2014 +0200
fdo#77089 if available, use ext. dimensions for non-placable WMF
Change-Id: Idcfaa127ed6abed40d6eec7f81fbbfb36658cc91
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index ba08ed5..47f48c3 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -26,7 +26,6 @@
#include <osl/endian.h>
#include <vcl/svapp.hxx>
#include <vcl/dibtools.hxx>
-#include <boost/scoped_array.hpp>
// MS Windows defines
@@ -1129,19 +1128,22 @@ bool WMFReader::ReadHeader()
else
{
nUnitsPerInch = 96;
- pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the metaactions
- GetPlaceableBound( aPlaceableBound, pWMF );
- pWMF->Seek( nStrmPos );
- if ( pExternalHeader != NULL && ( pExternalHeader->mapMode == MM_ISOTROPIC
- || pExternalHeader->mapMode == MM_ANISOTROPIC ) )
+ if ( pExternalHeader != NULL && ( pExternalHeader->mapMode == MM_ISOTROPIC || pExternalHeader->mapMode == MM_ANISOTROPIC ) )
{
// #n417818#: If we have an external header then overwrite the bounds!
Rectangle aExtRect(0, 0,
- pExternalHeader->xExt*567*nUnitsPerInch/1440/1000,
- pExternalHeader->yExt*567*nUnitsPerInch/1440/1000);
- GetWinExtMax( aExtRect, aPlaceableBound, pExternalHeader->mapMode );
+ (double) pExternalHeader->xExt * 567 * nUnitsPerInch / 1440000,
+ (double) pExternalHeader->yExt * 567 * nUnitsPerInch / 1440000);
+ aPlaceableBound = aExtRect;
pOut->SetMapMode( pExternalHeader->mapMode );
}
+ else
+ {
+ pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the metaactions
+ GetPlaceableBound( aPlaceableBound, pWMF );
+ }
+
+ pWMF->Seek( nStrmPos );
}
pOut->SetWinOrg( aPlaceableBound.TopLeft() );
@@ -1352,6 +1354,22 @@ bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pStm )
}
break;
+ case W_META_SETVIEWPORTORG:
+ {
+ Point aWinOrg;
+ aWinOrg = ReadYX();
+ rPlaceableBound.SetPos( aWinOrg );
+ }
+ break;
+
+ case W_META_SETVIEWPORTEXT:
+ {
+ sal_Int16 nWidth(0), nHeight(0);
+ pStm->ReadInt16( nHeight ).ReadInt16( nWidth );
+ rPlaceableBound.SetSize( Size( nWidth, nHeight ) );
+ }
+ break;
+
case W_META_SETMAPMODE :
pStm->ReadInt16( nMapMode );
break;
@@ -1409,7 +1427,7 @@ bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pStm )
SAL_WARN_IF(!bRecordOk, "vcl.filter", "polypolygon record has more polygons than we can handle");
- bRecordOk &= pStm->good();
+ bRecordOk = bRecordOk && pStm->good();
if (!bRecordOk)
{
commit 0a1e297ac23ae79ce9d511b4fd6bd0d8276a2e25
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Apr 24 18:41:11 2014 +0200
fdo#77089 if font width 0, pass 0 - don't take it from font metric
Change-Id: I6c73da1d2470e75774affda836a8d587eebfbe4b
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 14b81f9..7aa7337 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -236,28 +236,15 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont )
aVDev.SetFont( aFont );
FontMetric aMetric( aVDev.GetFontMetric() );
long nHeight = aMetric.GetAscent() + aMetric.GetDescent();
- if ( nHeight )
+ if (nHeight)
{
double fHeight = ((double)aFontSize.Height() * rFont.lfHeight ) / nHeight;
aFontSize.Height() = (sal_Int32)( fHeight + 0.5 );
}
}
- else if ( rFont.lfHeight < 0 )
- {
- aFontSize.Height() = std::abs(rFont.lfHeight);
- }
- if ( !rFont.lfWidth )
- {
- // #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
- SolarMutexGuard aGuard;
- VirtualDevice aVDev;
-
- aFont.SetSize( aFontSize );
- aVDev.SetFont( aFont );
- FontMetric aMetric( aVDev.GetFontMetric() );
- aFontSize.Width() = aMetric.GetWidth();
- }
+ // Convert height to positive
+ aFontSize.Height() = std::abs(aFontSize.Height());
aFont.SetSize( aFontSize );
};
commit c2d5b59fc6a3b3fbe20a19282538d5f95fa53301
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Apr 24 18:39:27 2014 +0200
fdo#77089 pass shape dimensions to graphicfilter for WMF
Change-Id: I673a76ef85038b1f304ea85faeed5b4a462cb144
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
index 8def09e..f74963c 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -115,7 +115,9 @@ public:
/** Imports a graphic from the storage stream with the passed path and name. */
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
- importEmbeddedGraphic( const OUString& rStreamName ) const;
+ importEmbeddedGraphic(
+ const OUString& rStreamName,
+ const WMF_EXTERNALHEADER* pExtHeader = NULL ) const;
/** Creates a persistent graphic object from the passed graphic.
@return The URL of the created and internally cached graphic object. */
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index d3964be..d85ab4f 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -70,6 +70,8 @@
#include <vcl/graphicfilter.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/wmf.hxx>
+
using namespace ::oox::core;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -1153,7 +1155,13 @@ OUString Shape::finalizeServiceName( XmlFilterBase& rFilter, const OUString& rSe
// import and store the graphic
if( !aGraphicPath.isEmpty() )
{
- Reference< graphic::XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath );
+ // Transfer shape's width and heightto graphicsfilter (can be used by WMF/EMF)
+ WMF_EXTERNALHEADER aExtHeader;
+ aExtHeader.mapMode = 8; // MM_ANISOTROPIC
+ aExtHeader.xExt = rShapeRect.Width;
+ aExtHeader.yExt = rShapeRect.Height;
+
+ Reference< graphic::XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath, &aExtHeader );
if( xGraphic.is() )
maShapeProperties.setProperty(PROP_Graphic, xGraphic);
}
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index 71ab826..135a91c 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -275,7 +275,7 @@ Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rG
return xGraphic;
}
-Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStreamName ) const
+Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStreamName, const WMF_EXTERNALHEADER* pExtHeader ) const
{
Reference< XGraphic > xGraphic;
OSL_ENSURE( !rStreamName.isEmpty(), "GraphicHelper::importEmbeddedGraphic - empty stream name" );
@@ -284,7 +284,7 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr
EmbeddedGraphicMap::const_iterator aIt = maEmbeddedGraphics.find( rStreamName );
if( aIt == maEmbeddedGraphics.end() )
{
- xGraphic = importGraphic( mxStorage->openInputStream( rStreamName ) );
+ xGraphic = importGraphic(mxStorage->openInputStream(rStreamName), pExtHeader);
if( xGraphic.is() )
maEmbeddedGraphics[ rStreamName ] = xGraphic;
}
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 6167a19..d7783d8 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -21,6 +21,7 @@
#include <boost/optional.hpp>
#include "oox/vml/vmlshape.hxx"
+#include <vcl/wmf.hxx>
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -997,8 +998,13 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
// set the replacement graphic
if( !aGraphicPath.isEmpty() )
{
- Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath );
- if( xGraphic.is() )
+ WMF_EXTERNALHEADER aExtHeader;
+ aExtHeader.mapMode = 8;
+ aExtHeader.xExt = rShapeRect.Width;
+ aExtHeader.yExt = rShapeRect.Height;
+
+ Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath, &aExtHeader);
+ if (xGraphic.is())
aOleProps.setProperty( PROP_Graphic, xGraphic);
}
commit 4abaaf7663d053f1c37a34487320246e29e43516
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Apr 24 17:57:09 2014 +0200
fdo#74336 wrongly transformed line width - use 0 for height
Change-Id: I3915cfabb9568480d74ea6d4e459def6fe912eb9
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index 07f2a10..e54dd00 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -289,7 +289,7 @@ bool OutputDevice::TryDrawPolyLineDirectNoAA(
// transform the line width if used
if( fLineWidth != 0.0 )
{
- aB2DLineWidth = aTransform * ::basegfx::B2DVector( fLineWidth, fLineWidth );
+ aB2DLineWidth = aTransform * ::basegfx::B2DVector( fLineWidth, 0.0 );
}
// transform the polygon
commit 30798aa536fb1f0d27bcc3ee42200bc62238c8ca
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Tue Apr 22 13:03:04 2014 +0200
sc html export: Skip all graphic objects at HTML export
Change-Id: I2e7befb46de8bf0ff6e6bc58d0353a8b6ec1c226
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 4a96011..eb93bc6 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -217,7 +217,8 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocume
bTabAlignedLeft( false ),
bCalcAsShown( pDocP->GetDocOptions().IsCalcAsShown() ),
bTableDataWidth( true ),
- bTableDataHeight( true )
+ bTableDataHeight( true ),
+ mbSkipImages ( false )
{
strcpy( sIndent, sIndentSource );
sIndent[0] = 0;
@@ -226,6 +227,12 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocume
SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
eDestEnc = (pDoc->IsClipOrUndo() ? RTL_TEXTENCODING_UTF8 : rHtmlOptions.GetTextEncoding());
bCopyLocalFileToINet = rHtmlOptions.IsSaveGraphicsLocal();
+
+ if (rFilterOptions == "SkipImages")
+ {
+ mbSkipImages = true;
+ }
+
for ( sal_uInt16 j=0; j < SC_HTML_FONTSIZES; j++ )
{
sal_uInt16 nSize = rHtmlOptions.GetFontSize( j );
@@ -798,7 +805,7 @@ void ScHTMLExport::WriteTables()
IncIndent(-1); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_table );
- if ( bTabHasGraphics )
+ if ( bTabHasGraphics && mbSkipImages )
{
// the rest that is not in a cell
size_t ListSize = aGraphList.size();
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index 9696e6f..0c05463 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -125,6 +125,7 @@ class ScHTMLExport : public ScExportBase
bool bCopyLocalFileToINet;
bool bTableDataWidth;
bool bTableDataHeight;
+ bool mbSkipImages;
const SfxItemSet& PageDefaults( SCTAB nTab );
commit b90a19ce9bd5f1224a5b122dccff1a877899db94
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Tue Apr 22 12:56:34 2014 +0200
sc html export: cleanup htmlexp.hxx
Change-Id: Ia7dd944260b3de4085ff25597eef154fde256b54
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index c79aa26..9696e6f 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -29,7 +29,6 @@
#include "expbase.hxx"
-
class ScDocument;
class SfxItemSet;
class SdrPage;
@@ -50,19 +49,23 @@ struct ScHTMLStyle
sal_uInt8 nDefaultScriptType; // Font values are valid for the default script type
bool bInitialized;
- ScHTMLStyle() : nFontHeight(0), nFontSizeNumber(2), nDefaultScriptType(0),
- bInitialized(false) {}
-
- const ScHTMLStyle& operator=( const ScHTMLStyle& r )
- {
- aBackgroundColor = r.aBackgroundColor;
- aFontFamilyName = r.aFontFamilyName;
- nFontHeight = r.nFontHeight;
- nFontSizeNumber = r.nFontSizeNumber;
- nDefaultScriptType = r.nDefaultScriptType;
- bInitialized = r.bInitialized;
- return *this;
- }
+ ScHTMLStyle() :
+ nFontHeight(0),
+ nFontSizeNumber(2),
+ nDefaultScriptType(),
+ bInitialized(false)
+ {}
+
+ const ScHTMLStyle& operator=( const ScHTMLStyle& rScHTMLStyle )
+ {
+ aBackgroundColor = rScHTMLStyle.aBackgroundColor;
+ aFontFamilyName = rScHTMLStyle.aFontFamilyName;
+ nFontHeight = rScHTMLStyle.nFontHeight;
+ nFontSizeNumber = rScHTMLStyle.nFontSizeNumber;
+ nDefaultScriptType = rScHTMLStyle.nDefaultScriptType;
+ bInitialized = rScHTMLStyle.bInitialized;
+ return *this;
+ }
};
struct ScHTMLGraphEntry
@@ -75,9 +78,14 @@ struct ScHTMLGraphEntry
bool bWritten;
ScHTMLGraphEntry( SdrObject* pObj, const ScRange& rRange,
- const Size& rSize, bool bIn, const Size& rSpace ) :
- aRange( rRange ), aSize( rSize ), aSpace( rSpace ),
- pObject( pObj ), bInCell( bIn ), bWritten( false ) {}
+ const Size& rSize, bool bIn, const Size& rSpace ) :
+ aRange( rRange ),
+ aSize( rSize ),
+ aSpace( rSpace ),
+ pObject( pObj ),
+ bInCell( bIn ),
+ bWritten( false )
+ {}
};
@@ -94,73 +102,86 @@ class ScHTMLExport : public ScExportBase
static const sal_uInt16 nCellSpacing;
static const sal_Char sIndentSource[];
- boost::ptr_vector< ScHTMLGraphEntry > aGraphList;
- ScHTMLStyle aHTMLStyle;
- OUString aBaseURL;
- OUString aStreamPath;
- OUString aFilterOptions;
- OUString aCId; // Content-Id fuer Mail-Export
- OutputDevice* pAppWin; // fuer Pixelei
- boost::scoped_ptr< std::map<OUString, OUString> > pFileNameMap; // fuer CopyLocalFileToINet
- OUString aNonConvertibleChars; // collect nonconvertible characters
- rtl_TextEncoding eDestEnc;
- SCTAB nUsedTables;
- short nIndent;
- sal_Char sIndent[nIndentMax+1];
- bool bAll; // ganzes Dokument
- bool bTabHasGraphics;
- bool bTabAlignedLeft;
- bool bCalcAsShown;
- bool bCopyLocalFileToINet;
- bool bTableDataWidth;
- bool bTableDataHeight;
-
- const SfxItemSet& PageDefaults( SCTAB nTab );
-
- void WriteBody();
- void WriteHeader();
- void WriteOverview();
- void WriteTables();
- void WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
- void WriteGraphEntry( ScHTMLGraphEntry* );
- void WriteImage( OUString& rLinkName,
- const Graphic&, const OString& rImgOptions,
- sal_uLong nXOutFlags = 0 );
- // nXOutFlags fuer XOutBitmap::WriteGraphic
-
- // write to stream if and only if URL fields in edit cell
+ typedef boost::scoped_ptr<std::map<OUString, OUString>> FileNameMapPtr;
+ typedef boost::ptr_vector< ScHTMLGraphEntry > GraphEntryList;
+
+ GraphEntryList aGraphList;
+ ScHTMLStyle aHTMLStyle;
+ OUString aBaseURL;
+ OUString aStreamPath;
+ OUString aFilterOptions;
+ OUString aCId; // Content-Id fuer Mail-Export
+ OutputDevice* pAppWin; // fuer Pixelei
+ FileNameMapPtr pFileNameMap; // fuer CopyLocalFileToINet
+ OUString aNonConvertibleChars; // collect nonconvertible characters
+ rtl_TextEncoding eDestEnc;
+ SCTAB nUsedTables;
+ short nIndent;
+ sal_Char sIndent[nIndentMax+1];
+ bool bAll; // ganzes Dokument
+ bool bTabHasGraphics;
+ bool bTabAlignedLeft;
+ bool bCalcAsShown;
+ bool bCopyLocalFileToINet;
+ bool bTableDataWidth;
+ bool bTableDataHeight;
+
+ const SfxItemSet& PageDefaults( SCTAB nTab );
+
+ void WriteBody();
+ void WriteHeader();
+ void WriteOverview();
+ void WriteTables();
+ void WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
+ void WriteGraphEntry( ScHTMLGraphEntry* );
+ void WriteImage( OUString& rLinkName,
+ const Graphic&, const OString& rImgOptions,
+ sal_uLong nXOutFlags = 0 );
+ // nXOutFlags fuer XOutBitmap::WriteGraphic
+
+ // write to stream if and only if URL fields in edit cell
bool WriteFieldText( const EditTextObject* pData );
- // kopiere ggfs. eine lokale Datei ins Internet
- bool CopyLocalFileToINet( OUString& rFileNm,
- const OUString& rTargetNm, bool bFileToFile = false );
- bool HasCId() { return !aCId.isEmpty(); }
- void MakeCIdURL( OUString& rURL );
+ // kopiere ggfs. eine lokale Datei ins Internet
+ bool CopyLocalFileToINet( OUString& rFileNm, const OUString& rTargetNm, bool bFileToFile = false );
+ bool HasCId()
+ {
+ return !aCId.isEmpty();
+ }
+ void MakeCIdURL( OUString& rURL );
+
+ void PrepareGraphics( ScDrawLayer*, SCTAB nTab,
+ SCCOL nStartCol, SCROW nStartRow,
+ SCCOL nEndCol, SCROW nEndRow );
- void PrepareGraphics( ScDrawLayer*, SCTAB nTab,
- SCCOL nStartCol, SCROW nStartRow,
- SCCOL nEndCol, SCROW nEndRow );
- void FillGraphList( const SdrPage*, SCTAB nTab,
- SCCOL nStartCol, SCROW nStartRow,
- SCCOL nEndCol, SCROW nEndRow );
+ void FillGraphList( const SdrPage*, SCTAB nTab,
+ SCCOL nStartCol, SCROW nStartRow,
+ SCCOL nEndCol, SCROW nEndRow );
OString BorderToStyle(const char* pBorderName,
- const ::editeng::SvxBorderLine* pLine, bool& bInsertSemicolon);
+ const editeng::SvxBorderLine* pLine,
+ bool& bInsertSemicolon);
+
+ sal_uInt16 GetFontSizeNumber( sal_uInt16 nHeight );
+ const char* GetFontSizeCss( sal_uInt16 nHeight );
+ sal_uInt16 ToPixel( sal_uInt16 nTwips );
+ Size MMToPixel( const Size& r100thMMSize );
+ void IncIndent( short nVal );
- sal_uInt16 GetFontSizeNumber( sal_uInt16 nHeight );
- const char* GetFontSizeCss( sal_uInt16 nHeight );
- sal_uInt16 ToPixel( sal_uInt16 nTwips );
- Size MMToPixel( const Size& r100thMMSize );
- void IncIndent( short nVal );
- const sal_Char* GetIndentStr() { return sIndent; }
+ const sal_Char* GetIndentStr()
+ {
+ return sIndent;
+ }
public:
ScHTMLExport( SvStream&, const OUString&, ScDocument*, const ScRange&,
- bool bAll, const OUString& aStreamPath, const OUString& rFilterOptions );
+ bool bAll, const OUString& aStreamPath, const OUString& rFilterOptions );
virtual ~ScHTMLExport();
- sal_uLong Write();
+ sal_uLong Write();
const OUString& GetNonConvertibleChars() const
- { return aNonConvertibleChars; }
+ {
+ return aNonConvertibleChars;
+ }
};
#endif
commit 7ab34f414bc14b1cfa491952e259e11a83df5b9e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Tue Apr 22 12:27:25 2014 +0200
sc filter: Read "FilterOptions" in HTML export filter
Change-Id: I3644b5d0bf5f485e1261c478996c95981f6055cb
diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index db51955..ce1f4d4 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -111,7 +111,7 @@ class ScFormatFilterPlugin {
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest,
sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
virtual FltError ScExportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest, bool bAll,
- const OUString& rStreamPath, OUString& rNonConvertibleChars ) = 0;
+ const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions ) = 0;
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest ) = 0;
virtual ScOrcusFilters* GetOrcusFilters() = 0;
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 329d9e0..4a96011 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -130,9 +130,9 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] =
FltError ScFormatFilterPluginImpl::ScExportHTML( SvStream& rStrm, const OUString& rBaseURL, ScDocument* pDoc,
const ScRange& rRange, const rtl_TextEncoding /*eNach*/, bool bAll,
- const OUString& rStreamPath, OUString& rNonConvertibleChars )
+ const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions )
{
- ScHTMLExport aEx( rStrm, rBaseURL, pDoc, rRange, bAll, rStreamPath );
+ ScHTMLExport aEx( rStrm, rBaseURL, pDoc, rRange, bAll, rStreamPath, rFilterOptions );
FltError nErr = aEx.Write();
rNonConvertibleChars = aEx.GetNonConvertibleChars();
return nErr;
@@ -203,11 +203,12 @@ static OString lcl_makeHTMLColorTriplet(const Color& rColor)
}
ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocument* pDocP,
- const ScRange& rRangeP,
- bool bAllP, const OUString& rStreamPathP ) :
+ const ScRange& rRangeP, bool bAllP,
+ const OUString& rStreamPathP, const OUString& rFilterOptions ) :
ScExportBase( rStrmP, pDocP, rRangeP ),
aBaseURL( rBaseURL ),
aStreamPath( rStreamPathP ),
+ aFilterOptions( rFilterOptions ),
pAppWin( Application::GetDefaultDevice() ),
nUsedTables( 0 ),
nIndent( 0 ),
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 20903e2..95a3395 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -299,7 +299,7 @@ public:
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest,
sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) SAL_OVERRIDE;
virtual FltError ScExportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest, bool bAll,
- const OUString& rStreamPath, OUString& rNonConvertibleChars ) SAL_OVERRIDE;
+ const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions ) SAL_OVERRIDE;
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest ) SAL_OVERRIDE;
virtual ScOrcusFilters* GetOrcusFilters() SAL_OVERRIDE;
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index 80c19aa..c79aa26 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -98,6 +98,7 @@ class ScHTMLExport : public ScExportBase
ScHTMLStyle aHTMLStyle;
OUString aBaseURL;
OUString aStreamPath;
+ OUString aFilterOptions;
OUString aCId; // Content-Id fuer Mail-Export
OutputDevice* pAppWin; // fuer Pixelei
boost::scoped_ptr< std::map<OUString, OUString> > pFileNameMap; // fuer CopyLocalFileToINet
@@ -155,7 +156,7 @@ class ScHTMLExport : public ScExportBase
public:
ScHTMLExport( SvStream&, const OUString&, ScDocument*, const ScRange&,
- bool bAll, const OUString& aStreamPath );
+ bool bAll, const OUString& aStreamPath, const OUString& rFilterOptions );
virtual ~ScHTMLExport();
sal_uLong Write();
const OUString& GetNonConvertibleChars() const
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 871adbe..87011f0 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2424,26 +2424,35 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
SvStream* pStream = rMed.GetOutStream();
if ( pStream )
{
- WaitObject aWait( GetActiveDialogParent() );
- ScImportExport aImExport( &aDocument );
- aImExport.SetStreamPath( rMed.GetName() );
- bRet = aImExport.ExportStream( *pStream, rMed.GetBaseURL( true ), SOT_FORMATSTR_ID_HTML );
- if ( bRet && !aImExport.GetNonConvertibleChars().isEmpty() )
- SetError( *new StringErrorInfo(
+ SfxItemSet* pSet = rMed.GetItemSet();
+ const SfxPoolItem* pItem;
+ OUString sFilterOptions;
+
+ if (pSet->GetItemState(SID_FILE_FILTEROPTIONS, true, &pItem) == SFX_ITEM_SET)
+ sFilterOptions = ((SfxStringItem*)pItem)->GetValue();
+
+ WaitObject aWait(GetActiveDialogParent());
+ ScImportExport aImExport(&aDocument);
+ aImExport.SetStreamPath(rMed.GetName());
+ aImExport.SetFilterOptions(sFilterOptions);
+ bRet = aImExport.ExportStream(*pStream, rMed.GetBaseURL(true), SOT_FORMATSTR_ID_HTML);
+ if (bRet && !aImExport.GetNonConvertibleChars().isEmpty())
+ {
+ SetError(*new StringErrorInfo(
SCWARN_EXPORT_NONCONVERTIBLE_CHARS,
aImExport.GetNonConvertibleChars(),
- ERRCODE_BUTTON_OK | ERRCODE_MSG_INFO ), OUString( OSL_LOG_PREFIX ) );
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_INFO), OUString(OSL_LOG_PREFIX));
+ }
}
}
else
{
if (GetError())
- SetError(SCERR_IMPORT_NI, OUString( OSL_LOG_PREFIX ) );
+ SetError(SCERR_IMPORT_NI, OUString(OSL_LOG_PREFIX));
}
return bRet;
}
-
bool ScDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
{
return SfxObjectShell::SaveCompleted( xStor );
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index bb103b5..9882966 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -183,6 +183,11 @@ void ScImportExport::SetExtOptions( const ScAsciiOptions& rOpt )
cStr = rOpt.GetTextSep();
}
+void ScImportExport::SetFilterOptions(const OUString& rFilterOptions)
+{
+ maFilterOptions = rFilterOptions;
+}
+
bool ScImportExport::IsFormatSupported( sal_uLong nFormat )
{
return nFormat == FORMAT_STRING
@@ -2064,7 +2069,7 @@ bool ScImportExport::Doc2HTML( SvStream& rStrm, const OUString& rBaseURL )
{
// rtl_TextEncoding is ignored in ScExportHTML, read from Load/Save HTML options
ScFormatFilter::Get().ScExportHTML( rStrm, rBaseURL, pDoc, aRange, RTL_TEXTENCODING_DONTKNOW, bAll,
- aStreamPath, aNonConvertibleChars );
+ aStreamPath, aNonConvertibleChars, maFilterOptions );
return rStrm.GetError() == SVSTREAM_OK;
}
@@ -2199,7 +2204,7 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin {
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScAddress&, const rtl_TextEncoding, sal_uInt32 ) SAL_OVERRIDE { return eERR_INTERN; }
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange&, const rtl_TextEncoding, sal_uInt32 ) SAL_OVERRIDE { return eERR_INTERN; }
virtual FltError ScExportHTML( SvStream&, const OUString&, ScDocument*, const ScRange&, const rtl_TextEncoding, bool,
- const OUString&, OUString& ) SAL_OVERRIDE { return eERR_INTERN; }
+ const OUString&, OUString&, const OUString& ) SAL_OVERRIDE { return eERR_INTERN; }
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange&, const rtl_TextEncoding ) SAL_OVERRIDE { return eERR_INTERN; }
virtual ScOrcusFilters* GetOrcusFilters() SAL_OVERRIDE { return NULL; }
diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx
index bde5f46..9faa1a6 100644
--- a/sc/source/ui/inc/impex.hxx
+++ b/sc/source/ui/inc/impex.hxx
@@ -53,6 +53,7 @@ class ScImportExport
ScRange aRange;
OUString aStreamPath;
OUString aNonConvertibleChars;
+ OUString maFilterOptions;
sal_uLong nSizeLimit;
sal_Unicode cSep; // Separator
sal_Unicode cStr; // String Delimiter
@@ -92,6 +93,7 @@ public:
~ScImportExport();
void SetExtOptions( const ScAsciiOptions& rOpt );
+ void SetFilterOptions( const OUString& rFilterOptions );
bool IsDoubleRef() const { return !( bAll || bSingle ); }
bool IsSingleRef() const { return bSingle; }
commit ea9989ad770f31aae379dbe6d2cadece3f4f10d7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Tue Apr 22 12:06:11 2014 +0200
wmf: support fat lines for PolyPolygons in wmf filter
Change-Id: I9fe9d7b5237031e3001f64af7001d91fa53f1c64
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index d7785b6..14b81f9 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -1283,6 +1283,13 @@ void WinMtfOutput::DrawPolyPolygon( PolyPolygon& rPolyPolygon, bool bRecordPath
{
UpdateLineStyle();
mpGDIMetaFile->AddAction( new MetaPolyPolygonAction( rPolyPolygon ) );
+ if (maLineStyle.aLineInfo.GetWidth() > 0 || maLineStyle.aLineInfo.GetStyle() == LINE_DASH)
+ {
+ for (sal_uInt16 nPoly = 0; nPoly < rPolyPolygon.Count(); ++nPoly)
+ {
+ mpGDIMetaFile->AddAction(new MetaPolyLineAction(rPolyPolygon[nPoly], maLineStyle.aLineInfo));
+ }
+ }
}
}
}
commit 00e577ac012405f29003533c145bd29d0edbf6db
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Tue Apr 22 11:51:18 2014 +0200
wmf: cleanup winmtf.cxx
Change-Id: Ib69a5d651dfffa4ebe4806a1836d78b09103188e
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 02f2f4c..d7785b6 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -224,7 +224,7 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont )
else
aFont.SetOrientation( (short)rFont.lfEscapement );
- Size aFontSize( Size( rFont.lfWidth, rFont.lfHeight ) );
+ Size aFontSize( Size( rFont.lfWidth, rFont.lfHeight ) );
if ( rFont.lfHeight > 0 )
{
// #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
@@ -242,8 +242,10 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont )
aFontSize.Height() = (sal_Int32)( fHeight + 0.5 );
}
}
- else if ( aFontSize.Height() < 0 )
- aFontSize.Height() *= -1;
+ else if ( rFont.lfHeight < 0 )
+ {
+ aFontSize.Height() = std::abs(rFont.lfHeight);
+ }
if ( !rFont.lfWidth )
{
@@ -471,11 +473,13 @@ void WinMtfOutput::ImplMap( Font& rFont )
{
// !!! HACK: we now always set the width to zero because the OS width is interpreted differently;
// must later be made portable in SV (KA 1996-02-08)
- Size aFontSize = ImplMap ( rFont.GetSize() );
+ Size aFontSize = rFont.GetSize();
if( aFontSize.Height() < 0 )
aFontSize.Height() *= -1;
+ aFontSize = ImplMap (aFontSize);
+
rFont.SetSize( aFontSize );
if( ( mnWinExtX * mnWinExtY ) < 0 )
@@ -683,14 +687,17 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle )
{
if ( eType == GDI_FONT )
{
- ImplMap( ((WinMtfFontStyle*)pStyle)->aFont );
- if (!((WinMtfFontStyle*)pStyle)->aFont.GetHeight() )
- ((WinMtfFontStyle*)pStyle)->aFont.SetHeight( 423 ); // defaulting to 12pt
+ WinMtfFontStyle* pFontStyle = (WinMtfFontStyle*) pStyle;
+ if (pFontStyle->aFont.GetHeight() == 0)
+ pFontStyle->aFont.SetHeight(423);
+ ImplMap(pFontStyle->aFont); // defaulting to 12pt
}
else if ( eType == GDI_PEN )
{
- Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
- ((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
+ WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle;
+ Size aSize(pLineStyle->aLineInfo.GetWidth(), 0);
+ aSize = ImplMap(aSize);
+ pLineStyle->aLineInfo.SetWidth(aSize.Width());
}
}
sal_uInt32 nIndex;
@@ -713,11 +720,18 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS
if ( pStyle )
{
if ( eType == GDI_FONT )
- ImplMap( ((WinMtfFontStyle*)pStyle)->aFont );
+ {
+ WinMtfFontStyle* pFontStyle = (WinMtfFontStyle*) pStyle;
+ if (pFontStyle->aFont.GetHeight() == 0)
+ pFontStyle->aFont.SetHeight(423);
+ ImplMap(pFontStyle->aFont);
+ }
else if ( eType == GDI_PEN )
{
- Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
- ((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
+ WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle;
+ Size aSize(pLineStyle->aLineInfo.GetWidth(), 0);
+ aSize = ImplMap(aSize);
+ pLineStyle->aLineInfo.SetWidth(aSize.Width());
}
}
if ( (sal_uInt32)nIndex >= vGDIObj.size() )
@@ -1329,19 +1343,22 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, sal_Int32* pDXAr
sal_Int32 nOldGfxMode = GetGfxMode();
SetGfxMode( GM_COMPATIBLE );
- if ( pDXArry )
+ if (pDXArry)
{
- sal_Int32 i, nSum, nLen = rText.getLength();
+ sal_Int32 i;
+ sal_Int32 nSum = 0;
+ sal_Int32 nLen = rText.getLength();
- for( i = 0, nSum = 0; i < nLen; i++ )
+ for (i = 0; i < nLen; i++ )
{
- if ( i ) {
+ if (i > 0)
+ {
// #i121382# Map DXArray using WorldTransform
- const Size aSize(ImplMap(Size( nSum, 0)));
+ const Size aSize(ImplMap(Size(nSum, 0)));
const basegfx::B2DVector aVector(aSize.Width(), aSize.Height());
- pDXArry[ i - 1 ] = basegfx::fround(aVector.getLength());
+ pDXArry[i - 1] = basegfx::fround(aVector.getLength());
}
- nSum += pDXArry[ i ];
+ nSum += pDXArry[i];
}
}
if ( mnLatestTextLayoutMode != mnTextLayoutMode )
@@ -1472,7 +1489,7 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, sal_Int32* pDXAr
/* because text without dx array is badly scaled, we
will create such an array if necessary */
sal_Int32* pDX = pDXArry;
- if ( !pDXArry )
+ if (!pDXArry)
{
// #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
SolarMutexGuard aGuard;
commit e6efeb383a047ccf4b5aa50f66a39e936816875a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Tue Apr 22 11:46:45 2014 +0200
wmf: cleanup winwmf.cxx
Change-Id: Iac28bea6f7ae7d83e48945ac34807d9db8f71caf
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index ef39c9c..ba08ed5 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -728,13 +728,17 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
case W_META_CREATEPENINDIRECT:
{
- LineInfo aLineInfo;
- sal_uInt16 nStyle = 0, nWidth = 0, nHeight = 0;
+ LineInfo aLineInfo;
+ sal_uInt16 nStyle = 0;
+ sal_uInt16 nWidth = 0;
+ sal_uInt16 nHeight = 0;
- pWMF->ReadUInt16( nStyle ).ReadUInt16( nWidth ).ReadUInt16( nHeight );
+ pWMF->ReadUInt16(nStyle);
+ pWMF->ReadUInt16(nWidth);
+ pWMF->ReadUInt16(nHeight);
- if ( nWidth )
- aLineInfo.SetWidth( nWidth );
+ if (nWidth > 0)
+ aLineInfo.SetWidth(nWidth);
bool bTransparent = false;
switch( nStyle & 0xFF )
@@ -818,15 +822,25 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
case W_META_CREATEFONTINDIRECT:
{
- Size aFontSize;
- char lfFaceName[ LF_FACESIZE ];
- sal_Int16 lfEscapement = 0, lfOrientation = 0, lfWeight = 0; // ( formerly sal_uInt16 )
+ Size aFontSize;
+ char lfFaceName[LF_FACESIZE];
+ sal_Int16 lfEscapement = 0;
+ sal_Int16 lfOrientation = 0;
+ sal_Int16 lfWeight = 0;
LOGFONTW aLogFont;
aFontSize = ReadYXExt();
- pWMF->ReadInt16( lfEscapement ).ReadInt16( lfOrientation ).ReadInt16( lfWeight )
- .ReadUChar( aLogFont.lfItalic ).ReadUChar( aLogFont.lfUnderline ).ReadUChar( aLogFont.lfStrikeOut ).ReadUChar( aLogFont.lfCharSet ).ReadUChar( aLogFont.lfOutPrecision )
- .ReadUChar( aLogFont.lfClipPrecision ).ReadUChar( aLogFont.lfQuality ).ReadUChar( aLogFont.lfPitchAndFamily );
+ pWMF->ReadInt16( lfEscapement );
+ pWMF->ReadInt16( lfOrientation );
+ pWMF->ReadInt16( lfWeight );
+ pWMF->ReadUChar( aLogFont.lfItalic );
+ pWMF->ReadUChar( aLogFont.lfUnderline );
+ pWMF->ReadUChar( aLogFont.lfStrikeOut );
+ pWMF->ReadUChar( aLogFont.lfCharSet );
+ pWMF->ReadUChar( aLogFont.lfOutPrecision );
+ pWMF->ReadUChar( aLogFont.lfClipPrecision );
+ pWMF->ReadUChar( aLogFont.lfQuality );
+ pWMF->ReadUChar( aLogFont.lfPitchAndFamily );
pWMF->Read( lfFaceName, LF_FACESIZE );
aLogFont.lfWidth = aFontSize.Width();
aLogFont.lfHeight = aFontSize.Height();
commit 15af2fddd639d3614fbdb5447b2dfe4f7c0d622d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Sat Apr 19 23:50:46 2014 +0200
sc: t-test - actually use "Alpha" parameter in formulas
Change-Id: I30399ed526ae4dc345f6e8de69bc0806017e7da7
diff --git a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
index 181b45b..c79ff5e 100644
--- a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
@@ -179,7 +179,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
// T critical one-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_ONE_TAIL));
aOutput.nextColumn();
- aTemplate.setTemplate("=TINV(2*0.05; %DEGREE_OF_FREEDOM%)");
+ aTemplate.setTemplate("=TINV(2*%ALPHA%; %DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
aOutput.newLine();
@@ -193,7 +193,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
// T critical two-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_TWO_TAIL));
aOutput.nextColumn();
- aTemplate.setTemplate("=TINV(0.05; %DEGREE_OF_FREEDOM%)");
+ aTemplate.setTemplate("=TINV(%ALPHA%; %DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
return ScRange(aOutput.mMinimumAddress, aOutput.mMaximumAddress);
commit a204a7ccbabf41642cd997f004d41820a960576b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Sat Apr 19 23:41:07 2014 +0200
sc: Add newLine() convenience method to AddressWalker
And use the newLine() method in t-test and F-test.
Change-Id: I6372fe1fbc1f63bca56b110115732de96eb2afcf
diff --git a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
index 8a6e5a8..feba4eb 100644
--- a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
@@ -80,22 +80,19 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.autoReplaceRange(strWildcardVariable2Range, pVariable2Iterator->get());
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_UNDO_NAME));
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString("Alpha");
aOutput.nextColumn();
aOutput.writeValue(0.05);
aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.nextColumn();
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL));
aOutput.nextColumn();
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL));
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN));
aOutput.nextColumn();
@@ -104,8 +101,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn();
aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE));
aOutput.nextColumn();
@@ -116,8 +112,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=VAR(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VAR2_VARIANCE%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL));
aOutput.nextColumn();
@@ -128,8 +123,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VAR2_OBSERVATIONS%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF));
aOutput.nextColumn();
@@ -140,54 +134,46 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=%VAR2_OBSERVATIONS% - 1");
aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VAR2_DEGREE_OF_FREEDOM%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_F));
aOutput.nextColumn();
aTemplate.setTemplate("=%VAR1_VARIANCE% / %VAR2_VARIANCE%");
aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%F_VALUE%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_RIGHT_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=FDIST(%F_VALUE%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%P_RIGHT_TAIL_VALUE%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
-
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_RIGHT_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=FINV(%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_LEFT_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=1 - %P_RIGHT_TAIL_VALUE%");
aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%P_LEFT_TAIL_VALUE%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_LEFT_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=FINV(1-%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_TWO_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=2*MIN(%P_RIGHT_TAIL_VALUE%; %P_LEFT_TAIL_VALUE%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_TWO_TAIL));
aOutput.nextColumn();
diff --git a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
index e2fb17c..181b45b 100644
--- a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
@@ -81,22 +81,19 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_UNDO_NAME));
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString("Alpha");
aOutput.nextColumn();
aOutput.writeValue(0.05);
aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.nextColumn();
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL));
aOutput.nextColumn();
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL));
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN));
aOutput.nextColumn();
@@ -105,8 +102,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn();
aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE));
aOutput.nextColumn();
@@ -115,8 +111,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn();
aTemplate.setTemplate("=VAR(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// Observations
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL));
@@ -126,24 +121,21 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn();
aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// Pearson Correlation
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_PEARSON_CORRELATION));
aOutput.nextColumn();
aTemplate.setTemplate("=CORREL(%VAR1_RANGE%;%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// Hypothesized mean difference
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE));
aOutput.nextColumn();
aOutput.writeValue(2);
aTemplate.autoReplaceAddress("%HYPOTHESIZED_MEAN_DIFFERENCE%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// Observed mean difference
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_OBSERVED_MEAN_DIFFERENCE));
@@ -151,8 +143,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=AVERAGE(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))");
aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%OBSERVED_MEAN_DIFFERENCE%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// Variance of the Differences
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_VARIANCE_OF_THE_DIFFERENCES));
@@ -160,8 +151,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=VAR(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))");
aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VARIANCE_OF_DIFFERENCES%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// df
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF));
@@ -169,8 +159,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=SUM(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)) - 1");
aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%DEGREE_OF_FREEDOM%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// t stat
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_STAT));
@@ -178,39 +167,34 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=(%OBSERVED_MEAN_DIFFERENCE% - %HYPOTHESIZED_MEAN_DIFFERENCE%) / (%VARIANCE_OF_DIFFERENCES% / ( %DEGREE_OF_FREEDOM% + 1)) ^ 0.5");
aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%T_STAT%", aOutput.current());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// P one-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_P_ONE_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=TDIST(ABS(%T_STAT%); %DEGREE_OF_FREEDOM%; 1)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// T critical one-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_ONE_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=TINV(2*0.05; %DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// P two-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_P_TWO_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=TDIST(ABS(%T_STAT%); %DEGREE_OF_FREEDOM%; 2)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
- aOutput.nextRow();
+ aOutput.newLine();
// T critical two-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_TWO_TAIL));
aOutput.nextColumn();
aTemplate.setTemplate("=TINV(0.05; %DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.resetColumn();
return ScRange(aOutput.mMinimumAddress, aOutput.mMaximumAddress);
}
diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
index fe0d2d5..c39302b 100644
--- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
+++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
@@ -111,6 +111,12 @@ void AddressWalker::reset()
mCurrentAddress = mAddressStack.back();
}
+void AddressWalker::newLine()
+{
+ resetColumn();
+ nextRow();
+}
+
ScAddress AddressWalker::current(SCCOL aRelCol, SCROW aRelRow, SCTAB aRelTab)
{
return ScAddress(
diff --git a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
index 540407a..17f1223 100644
--- a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
+++ b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
@@ -64,12 +64,14 @@ public:
AddressWalker(ScAddress aInitialAddress, bool aTrackRange = true);
ScAddress current(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
- void reset();
- void resetColumn();
- void resetRow();
- void nextColumn();
- void nextRow();
- void push(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
+
+ void reset();
+ void resetColumn();
+ void resetRow();
+ void nextColumn();
+ void nextRow();
+ void newLine();
+ void push(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
};
class AddressWalkerWriter : public AddressWalker
commit 2afa719d62209ea59b805335995949e23ce5c0e9
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Sat Apr 19 23:31:46 2014 +0200
sc: F Test - externalize string ("Variable" label)
Change-Id: Id592d4becf63239a5f55e987fc2d00f3baa6fb52
diff --git a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
index c573f71..8a6e5a8 100644
--- a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
@@ -91,9 +91,9 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextRow();
aOutput.nextColumn();
- aOutput.writeBoldString("Variable 1");
+ aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL));
aOutput.nextColumn();
- aOutput.writeBoldString("Variable 2");
+ aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL));
aOutput.resetColumn();
aOutput.nextRow();
commit 377cca27dfa4a4a67062e33a2028abeacfd59550
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Sat Apr 19 23:30:22 2014 +0200
sc: t-test - refactor to row oriented output & externalise strings
Change-Id: I70b6d9ecc02aabf691b3606487e719885e6430fd
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc
index df0162a..b22f3dc 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc
+++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc
@@ -75,6 +75,8 @@
#define STR_CORRELATION_LABEL 80
#define STR_COVARIANCE_LABEL 81
#define STR_LABEL_ALPHA 82
+#define STR_VARIABLE_1_LABEL 83
+#define STR_VARIABLE_2_LABEL 84
#define STR_FTEST_OBSERVATIONS_LABEL 90
#define STR_FTEST_P_RIGHT_TAIL 91
@@ -84,4 +86,15 @@
#define STR_FTEST_P_TWO_TAIL 95
#define STR_FTEST_F_CRITICAL_TWO_TAIL 96
+#define STR_TTEST_PEARSON_CORRELATION 100
+#define STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE 101
+#define STR_TTEST_OBSERVED_MEAN_DIFFERENCE 102
+#define STR_TTEST_VARIANCE_OF_THE_DIFFERENCES 103
+#define STR_TTEST_T_STAT 104
+#define STR_TTEST_P_ONE_TAIL 105
+#define STR_TTEST_T_CRITICAL_ONE_TAIL 106
+#define STR_TTEST_P_TWO_TAIL 107
+#define STR_TTEST_T_CRITICAL_TWO_TAIL 108
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src
index df73d6c..2d9f946 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src
+++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src
@@ -286,6 +286,15 @@ Resource RID_STATISTICS_DLGS
{
Text [ en-US ] = "Alpha";
};
+ String STR_VARIABLE_1_LABEL
+ {
+ Text [ en-US ] = "Variable 1";
+ };
+ String STR_VARIABLE_2_LABEL
+ {
+ Text [ en-US ] = "Variable 2";
+ };
+
/*F Test */
String STR_FTEST_OBSERVATIONS_LABEL
@@ -316,6 +325,44 @@ Resource RID_STATISTICS_DLGS
{
Text [ en-US ] = "F Critical two-tail";
};
+
+ /*t Test*/
+ String STR_TTEST_PEARSON_CORRELATION
+ {
+ Text [ en-US ] = "Pearson Correlation";
+ };
+ String STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE
+ {
+ Text [ en-US ] = "Hypothesized Mean Difference";
+ };
+ String STR_TTEST_OBSERVED_MEAN_DIFFERENCE
+ {
+ Text [ en-US ] = "Observed Mean Difference";
+ };
+ String STR_TTEST_VARIANCE_OF_THE_DIFFERENCES
+ {
+ Text [ en-US ] = "Variance of the Differences";
+ };
+ String STR_TTEST_T_STAT
+ {
+ Text [ en-US ] = "t Stat";
+ };
+ String STR_TTEST_P_ONE_TAIL
+ {
+ Text [ en-US ] = "P (T<=t) one-tail";
+ };
+ String STR_TTEST_T_CRITICAL_ONE_TAIL
+ {
+ Text [ en-US ] = "t Critical one-tail";
+ };
+ String STR_TTEST_P_TWO_TAIL
+ {
+ Text [ en-US ] = "P (T<=t) two-tail";
+ };
+ String STR_TTEST_T_CRITICAL_TWO_TAIL
+ {
+ Text [ en-US ] = "t Critical two-tail";
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
index 8a06d94..e2fb17c 100644
--- a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
@@ -79,115 +79,138 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.autoReplaceRange(strWildcardVariable1Range, pVariable1Iterator->get());
aTemplate.autoReplaceRange(strWildcardVariable2Range, pVariable2Iterator->get());
+
+ aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_UNDO_NAME));
+ aOutput.resetColumn();
aOutput.nextRow();
- aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN));
- aOutput.nextRow();
- aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE));
- aOutput.nextRow();
- aOutput.writeString("Observations");
- aOutput.nextRow();
- aOutput.writeString("Pearson Correlation");
- aOutput.nextRow();
- aOutput.writeString("Hypothesized Mean Difference");
- aOutput.nextRow();
- aOutput.writeString("Observed Mean Difference");
- aOutput.nextRow();
- aOutput.writeString("Variance of the Differences");
- aOutput.nextRow();
- aOutput.writeString("df");
- aOutput.nextRow();
- aOutput.writeString("t Stat");
- aOutput.nextRow();
- aOutput.writeString("P (T<=t) one-tail");
- aOutput.nextRow();
- aOutput.writeString("t Critical one-tail");
- aOutput.nextRow();
- aOutput.writeString("P (T<=t) two-tail");
- aOutput.nextRow();
- aOutput.writeString("t Critical two-tail");
- aOutput.resetRow();
+ aOutput.writeString("Alpha");
aOutput.nextColumn();
+ aOutput.writeValue(0.05);
+ aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current());
+ aOutput.resetColumn();
+ aOutput.nextRow();
- aOutput.writeString("Variable 1");
+ aOutput.nextColumn();
+ aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL));
+ aOutput.nextColumn();
+ aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL));
+ aOutput.resetColumn();
aOutput.nextRow();
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN));
+ aOutput.nextColumn();
aTemplate.setTemplate("=AVERAGE(%VAR1_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
aOutput.nextRow();
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE));
+ aOutput.nextColumn();
aTemplate.setTemplate("=VAR(%VAR1_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=VAR(%VAR2_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // Observations
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL));
+ aOutput.nextColumn();
aTemplate.setTemplate("=COUNT(%VAR1_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // Pearson Correlation
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_PEARSON_CORRELATION));
+ aOutput.nextColumn();
aTemplate.setTemplate("=CORREL(%VAR1_RANGE%;%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // Hypothesized mean difference
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE));
+ aOutput.nextColumn();
aOutput.writeValue(2);
aTemplate.autoReplaceAddress("%HYPOTHESIZED_MEAN_DIFFERENCE%", aOutput.current());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // Observed mean difference
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_OBSERVED_MEAN_DIFFERENCE));
+ aOutput.nextColumn();
aTemplate.setTemplate("=AVERAGE(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))");
aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%OBSERVED_MEAN_DIFFERENCE%", aOutput.current());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // Variance of the Differences
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_VARIANCE_OF_THE_DIFFERENCES));
+ aOutput.nextColumn();
aTemplate.setTemplate("=VAR(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))");
aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VARIANCE_OF_DIFFERENCES%", aOutput.current());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // df
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF));
+ aOutput.nextColumn();
aTemplate.setTemplate("=SUM(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)) - 1");
aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%DEGREE_OF_FREEDOM%", aOutput.current());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // t stat
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_STAT));
+ aOutput.nextColumn();
aTemplate.setTemplate("=(%OBSERVED_MEAN_DIFFERENCE% - %HYPOTHESIZED_MEAN_DIFFERENCE%) / (%VARIANCE_OF_DIFFERENCES% / ( %DEGREE_OF_FREEDOM% + 1)) ^ 0.5");
aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%T_STAT%", aOutput.current());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // P one-tail
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_P_ONE_TAIL));
+ aOutput.nextColumn();
aTemplate.setTemplate("=TDIST(ABS(%T_STAT%); %DEGREE_OF_FREEDOM%; 1)");
aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // T critical one-tail
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_ONE_TAIL));
+ aOutput.nextColumn();
aTemplate.setTemplate("=TINV(2*0.05; %DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
aOutput.nextRow();
+ // P two-tail
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_P_TWO_TAIL));
+ aOutput.nextColumn();
aTemplate.setTemplate("=TDIST(ABS(%T_STAT%); %DEGREE_OF_FREEDOM%; 2)");
aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
aOutput.nextRow();
- aTemplate.setTemplate("=TINV(0.05; %DEGREE_OF_FREEDOM%)");
- aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.nextRow();
-
- aOutput.resetRow();
-
+ // T critical two-tail
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_TWO_TAIL));
aOutput.nextColumn();
-
- aOutput.writeString("Variable 2");
- aOutput.nextRow();
-
- aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)");
- aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.nextRow();
-
- aTemplate.setTemplate("=VAR(%VAR2_RANGE%)");
- aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.nextRow();
-
- aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)");
+ aTemplate.setTemplate("=TINV(0.05; %DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate());
- aOutput.nextRow();
-
- aOutput.resetRow();
+ aOutput.resetColumn();
return ScRange(aOutput.mMinimumAddress, aOutput.mMaximumAddress);
}
commit 3ce1b10ba72331b5bd7af601dec404e0d920769c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Sat Apr 19 20:15:35 2014 +0200
sc: Add F-Test to Statistics
Change-Id: I31281e863d82a211d7cca897f3e65a0ecfcb5f6b
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 249b0ba..3b8e357 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -725,6 +725,14 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:FTestDialog" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~F-test...</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 3063b56..eb4ace5 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -496,6 +496,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/StatisticsDialogs/CovarianceDialog \
sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog \
sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog \
+ sc/source/ui/StatisticsDialogs/FTestDialog \
sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator \
sc/source/ui/StatisticsDialogs/MovingAverageDialog \
sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 507255b..757931f 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -269,6 +269,7 @@
#define SID_EXPONENTIAL_SMOOTHING_DIALOG (SC_MESSAGE_START + 76)
#define SID_MOVING_AVERAGE_DIALOG (SC_MESSAGE_START + 77)
#define SID_TTEST_DIALOG (SC_MESSAGE_START + 78)
+#define SID_FTEST_DIALOG (SC_MESSAGE_START + 79)
// functions
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 65ff899..b77b4f8 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -159,6 +159,7 @@ interface CellSelection
SID_EXPONENTIAL_SMOOTHING_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_MOVING_AVERAGE_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_TTEST_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
+ SID_FTEST_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 fac4558..d260cda 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -3158,6 +3158,29 @@ SfxVoidItem TTestDialog SID_TTEST_DIALOG
GroupId = GID_OPTIONS;
]
+SfxVoidItem FTestDialog SID_FTEST_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/FTestDialog.cxx b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
new file mode 100644
index 0000000..c573f71
--- /dev/null
+++ b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
@@ -0,0 +1,203 @@
+/* -*- 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 <boost/random.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#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 "FTestDialog.hxx"
+
+namespace
+{
+
+static const OUString strWildcardVariable1Range("%VAR1_RANGE%");
+static const OUString strWildcardVariable2Range("%VAR2_RANGE%");
+
+}
+
+ScFTestDialog::ScFTestDialog(
+ SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow,
+ Window* pParent, ScViewData* pViewData ) :
+ ScStatisticsTwoVariableDialog(
+ pSfxBindings, pChildWindow, pParent, pViewData,
+ "TTestDialog", "modules/scalc/ui/ttestdialog.ui" )
+{}
+
+ScFTestDialog::~ScFTestDialog()
+{}
+
+bool ScFTestDialog::Close()
+{
+ return DoClose( ScFTestDialogWrapper::GetChildWindowId() );
+}
+
+sal_Int16 ScFTestDialog::GetUndoNameId()
+{
+ return STR_FTEST_UNDO_NAME;
+}
+
+ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
+{
+ AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument,
+ formula::FormulaGrammar::mergeToGrammar(formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
+ FormulaTemplate aTemplate(mDocument, mAddressDetails);
+
+ boost::scoped_ptr<DataRangeIterator> pVariable1Iterator;
+ if (mGroupedBy == BY_COLUMN)
+ pVariable1Iterator.reset(new DataRangeByColumnIterator(mVariable1Range));
+ else
+ pVariable1Iterator.reset(new DataRangeByRowIterator(mVariable1Range));
+
+ boost::scoped_ptr<DataRangeIterator> pVariable2Iterator;
+ if (mGroupedBy == BY_COLUMN)
+ pVariable2Iterator.reset(new DataRangeByColumnIterator(mVariable2Range));
+ else
+ pVariable2Iterator.reset(new DataRangeByRowIterator(mVariable2Range));
+
+ aTemplate.autoReplaceRange(strWildcardVariable1Range, pVariable1Iterator->get());
+ aTemplate.autoReplaceRange(strWildcardVariable2Range, pVariable2Iterator->get());
+
+ aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_UNDO_NAME));
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString("Alpha");
+ aOutput.nextColumn();
+ aOutput.writeValue(0.05);
+ aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.nextColumn();
+ aOutput.writeBoldString("Variable 1");
+ aOutput.nextColumn();
+ aOutput.writeBoldString("Variable 2");
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=AVERAGE(%VAR1_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=VAR(%VAR1_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%VAR1_VARIANCE%", aOutput.current());
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=VAR(%VAR2_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%VAR2_VARIANCE%", aOutput.current());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=COUNT(%VAR1_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%VAR1_OBSERVATIONS%", aOutput.current());
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%VAR2_OBSERVATIONS%", aOutput.current());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=%VAR1_OBSERVATIONS% - 1");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%VAR1_DEGREE_OF_FREEDOM%", aOutput.current());
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=%VAR2_OBSERVATIONS% - 1");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%VAR2_DEGREE_OF_FREEDOM%", aOutput.current());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_F));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=%VAR1_VARIANCE% / %VAR2_VARIANCE%");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%F_VALUE%", aOutput.current());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_RIGHT_TAIL));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=FDIST(%F_VALUE%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%P_RIGHT_TAIL_VALUE%", aOutput.current());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_RIGHT_TAIL));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=FINV(%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_LEFT_TAIL));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=1 - %P_RIGHT_TAIL_VALUE%");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aTemplate.autoReplaceAddress("%P_LEFT_TAIL_VALUE%", aOutput.current());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_LEFT_TAIL));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=FINV(1-%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_TWO_TAIL));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=2*MIN(%P_RIGHT_TAIL_VALUE%; %P_LEFT_TAIL_VALUE%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.resetColumn();
+ aOutput.nextRow();
+
+ aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_TWO_TAIL));
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=FINV(1-(%ALPHA%/2); %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+ aOutput.nextColumn();
+ aTemplate.setTemplate("=FINV(%ALPHA%/2; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
+ aOutput.writeFormula(aTemplate.getTemplate());
+
+ return ScRange(aOutput.mMinimumAddress, aOutput.mMaximumAddress);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc
index e697a8c..df0162a 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc
+++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc
@@ -54,25 +54,34 @@
#define STR_EXPONENTIAL_SMOOTHING_UNDO_NAME 38
#define STR_MOVING_AVERAGE_UNDO_NAME 39
#define STR_TTEST_UNDO_NAME 40
+#define STR_FTEST_UNDO_NAME 41
-#define STR_COLUMN_LABEL_TEMPLATE 41
-#define STR_ROW_LABEL_TEMPLATE 42
+#define STR_COLUMN_LABEL_TEMPLATE 60
+#define STR_ROW_LABEL_TEMPLATE 61
-#define STR_ANOVA_SINGLE_FACTOR_LABEL 43
-#define STR_ANOVA_LABEL_GROUPS 44
-#define STR_ANOVA_LABEL_BETWEEN_GROUPS 45
-#define STR_ANOVA_LABEL_WITHIN_GROUPS 46
-#define STR_ANOVA_LABEL_SOURCE_OF_VARIATION 47
-#define STR_ANOVA_LABEL_SS 48
-#define STR_ANOVA_LABEL_DF 49
-#define STR_ANOVA_LABEL_MS 50
-#define STR_ANOVA_LABEL_F 51
-#define STR_ANOVA_LABEL_P_VALUE 52
-#define STR_ANOVA_LABEL_F_CRITICAL 53
-#define STR_ANOVA_LABEL_TOTAL 54
+#define STR_ANOVA_SINGLE_FACTOR_LABEL 62
+#define STR_ANOVA_LABEL_GROUPS 63
+#define STR_ANOVA_LABEL_BETWEEN_GROUPS 64
+#define STR_ANOVA_LABEL_WITHIN_GROUPS 65
+#define STR_ANOVA_LABEL_SOURCE_OF_VARIATION 66
+#define STR_ANOVA_LABEL_SS 67
+#define STR_ANOVA_LABEL_DF 68
+#define STR_ANOVA_LABEL_MS 69
+#define STR_ANOVA_LABEL_F 70
+#define STR_ANOVA_LABEL_P_VALUE 71
+#define STR_ANOVA_LABEL_F_CRITICAL 72
+#define STR_ANOVA_LABEL_TOTAL 73
-#define STR_CORRELATION_LABEL 55
-#define STR_COVARIANCE_LABEL 56
-#define STR_LABEL_ALPHA 57
+#define STR_CORRELATION_LABEL 80
+#define STR_COVARIANCE_LABEL 81
+#define STR_LABEL_ALPHA 82
+
+#define STR_FTEST_OBSERVATIONS_LABEL 90
+#define STR_FTEST_P_RIGHT_TAIL 91
+#define STR_FTEST_F_CRITICAL_RIGHT_TAIL 92
+#define STR_FTEST_P_LEFT_TAIL 93
+#define STR_FTEST_F_CRITICAL_LEFT_TAIL 94
+#define STR_FTEST_P_TWO_TAIL 95
+#define STR_FTEST_F_CRITICAL_TWO_TAIL 96
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src
index 1ab64d5..df73d6c 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src
+++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src
@@ -268,6 +268,11 @@ Resource RID_STATISTICS_DLGS
Text [ en-US ] = "t-test";
};
+ String STR_FTEST_UNDO_NAME
+ {
+ Text [ en-US ] = "F-test";
+ };
+
/* Common */
String STR_COLUMN_LABEL_TEMPLATE
{
@@ -281,6 +286,36 @@ Resource RID_STATISTICS_DLGS
{
Text [ en-US ] = "Alpha";
};
+
+ /*F Test */
+ String STR_FTEST_OBSERVATIONS_LABEL
+ {
+ Text [ en-US ] = "Observations";
+ };
+ String STR_FTEST_P_RIGHT_TAIL
+ {
+ Text [ en-US ] = "P (F<=f) right-tail";
+ };
+ String STR_FTEST_F_CRITICAL_RIGHT_TAIL
+ {
+ Text [ en-US ] = "F Critical right-tail";
+ };
+ String STR_FTEST_P_LEFT_TAIL
+ {
+ Text [ en-US ] = "P (F<=f) left-tail";
+ };
+ String STR_FTEST_F_CRITICAL_LEFT_TAIL
+ {
+ Text [ en-US ] = "F Critical left-tail";
+ };
+ String STR_FTEST_P_TWO_TAIL
+ {
+ Text [ en-US ] = "P two-tail";
+ };
+ String STR_FTEST_F_CRITICAL_TWO_TAIL
+ {
+ Text [ en-US ] = "F Critical two-tail";
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 6d97e2f..6c10603 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -270,6 +270,7 @@ void ScDLL::Init()
ScExponentialSmoothingDialogWrapper ::RegisterChildWindow(false, pMod);
ScMovingAverageDialogWrapper ::RegisterChildWindow(false, pMod);
ScTTestDialogWrapper ::RegisterChildWindow(false, pMod);
+ ScFTestDialogWrapper ::RegisterChildWindow(false, pMod);
// First docking Window for Calc
ScFunctionChildWindow ::RegisterChildWindow(false, pMod);
diff --git a/sc/source/ui/inc/FTestDialog.hxx b/sc/source/ui/inc/FTestDialog.hxx
new file mode 100644
index 0000000..04b91b1
--- /dev/null
+++ b/sc/source/ui/inc/FTestDialog.hxx
@@ -0,0 +1,35 @@
+/* -*- 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 F_TEST_DIALOG_HXX
+#define F_TEST_DIALOG_HXX
+
+#include "StatisticsTwoVariableDialog.hxx"
+
+class ScFTestDialog : public ScStatisticsTwoVariableDialog
+{
+public:
+ ScFTestDialog(
+ SfxBindings* pB, SfxChildWindow* pCW,
+ Window* pParent, ScViewData* pViewData );
+
+ virtual ~ScFTestDialog();
+
+ virtual bool Close() SAL_OVERRIDE;
+
+protected:
+ virtual sal_Int16 GetUndoNameId() SAL_OVERRIDE;
+ virtual ScRange ApplyOutput(ScDocShell* pDocShell) SAL_OVERRIDE;
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index e8e264a..2625a7b 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -114,6 +114,13 @@ private:
ScTTestDialogWrapper() SAL_DELETED_FUNCTION;
};
+class ScFTestDialogWrapper :
+ public ChildWindowWrapper<SID_FTEST_DIALOG>
+{
+private:
+ ScFTestDialogWrapper() 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 c485a99..858d1ab 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -984,6 +984,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
break;
+ case SID_FTEST_DIALOG:
+ {
+ sal_uInt16 nId = ScFTestDialogWrapper::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 3a048d0..7dc93c8 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -95,7 +95,7 @@ void ScTabViewShell::InitInterface_Impl()
GetStaticInterface()->RegisterChildWindow(ScExponentialSmoothingDialogWrapper::GetChildWindowId());
GetStaticInterface()->RegisterChildWindow(ScMovingAverageDialogWrapper::GetChildWindowId());
GetStaticInterface()->RegisterChildWindow(ScTTestDialogWrapper::GetChildWindowId());
-
+ GetStaticInterface()->RegisterChildWindow(ScFTestDialogWrapper::GetChildWindowId());
}
SFX_IMPL_NAMED_VIEWFACTORY( ScTabViewShell, "Default" )
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 758db9b..9d858a6 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -67,6 +67,7 @@
#include "ExponentialSmoothingDialog.hxx"
#include "MovingAverageDialog.hxx"
#include "TTestDialog.hxx"
+#include "FTestDialog.hxx"
#include "PivotLayoutDialog.hxx"
@@ -374,6 +375,12 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
}
break;
+ case SID_FTEST_DIALOG:
+ {
+ pResult = new ScFTestDialog( 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 9e3bd35..d2234bf 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -492,6 +492,7 @@
<menu:menuitem menu:id=".uno:ExponentialSmoothingDialog"/>
<menu:menuitem menu:id=".uno:MovingAverageDialog"/>
<menu:menuitem menu:id=".uno:TTestDialog"/>
+ <menu:menuitem menu:id=".uno:FTestDialog"/>
</menu:menupopup>
</menu:menu>
</menu:menupopup>
More information about the Libreoffice-commits
mailing list